summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk@arm.linux.org.uk>2015-06-12 14:03:18 +0100
committerRussell King <rmk@arm.linux.org.uk>2015-06-12 16:53:02 +0100
commitf036382eccb77f6b3a10a33643491e07121d42d1 (patch)
treeb80d293d20fc2bfb9b7a3e1b64f65cba3cb5f475
parent36a127044b0b2f99e721644cf7d8de212ee6cfc8 (diff)
Convert gst-plugins-base to stand-alone gst-plugins-xvbo package
We want to be a stand-alone package to support the xvboimagesink plugin, so we don't want to replicate most of gst-plugins-base code here. Delete mode of it, and rename ourselves appropriately. Signed-off-by: Russell King <rmk@arm.linux.org.uk>
-rw-r--r--.gitignore11
-rw-r--r--Makefile.am38
-rw-r--r--REQUIREMENTS60
-rwxr-xr-xautogen.sh4
-rw-r--r--configure.ac611
-rw-r--r--docs/Makefile.am4
-rw-r--r--docs/libs/.gitignore21
-rw-r--r--docs/libs/Makefile.am105
-rw-r--r--docs/libs/compiling.sgml48
-rw-r--r--docs/libs/gst-plugins-base-libs-docs.sgml235
-rw-r--r--docs/libs/gst-plugins-base-libs-overrides.txt0
-rw-r--r--docs/libs/gst-plugins-base-libs-sections.txt1891
-rw-r--r--docs/libs/gst-plugins-base-libs.types59
-rw-r--r--ext/Makefile.am83
-rw-r--r--ext/alsa/Makefile.am36
-rw-r--r--ext/alsa/gstalsa.c561
-rw-r--r--ext/alsa/gstalsa.h55
-rw-r--r--ext/alsa/gstalsadeviceprobe.c210
-rw-r--r--ext/alsa/gstalsadeviceprobe.h33
-rw-r--r--ext/alsa/gstalsamixer.c933
-rw-r--r--ext/alsa/gstalsamixer.h217
-rw-r--r--ext/alsa/gstalsamixerelement.c248
-rw-r--r--ext/alsa/gstalsamixerelement.h61
-rw-r--r--ext/alsa/gstalsamixeroptions.c109
-rw-r--r--ext/alsa/gstalsamixeroptions.h62
-rw-r--r--ext/alsa/gstalsamixertrack.c355
-rw-r--r--ext/alsa/gstalsamixertrack.h79
-rw-r--r--ext/alsa/gstalsaplugin.c91
-rw-r--r--ext/alsa/gstalsasink.c968
-rw-r--r--ext/alsa/gstalsasink.h86
-rw-r--r--ext/alsa/gstalsasrc.c873
-rw-r--r--ext/alsa/gstalsasrc.h86
-rw-r--r--ext/cdparanoia/Makefile.am13
-rw-r--r--ext/cdparanoia/gstcdparanoiasrc.c544
-rw-r--r--ext/cdparanoia/gstcdparanoiasrc.h100
-rw-r--r--ext/gio/Makefile.am29
-rw-r--r--ext/gio/gstgio.c259
-rw-r--r--ext/gio/gstgio.h42
-rw-r--r--ext/gio/gstgiobasesink.c377
-rw-r--r--ext/gio/gstgiobasesink.h71
-rw-r--r--ext/gio/gstgiobasesrc.c447
-rw-r--r--ext/gio/gstgiobasesrc.h72
-rw-r--r--ext/gio/gstgiosink.c319
-rw-r--r--ext/gio/gstgiosink.h68
-rw-r--r--ext/gio/gstgiosrc.c339
-rw-r--r--ext/gio/gstgiosrc.h68
-rw-r--r--ext/gio/gstgiostreamsink.c198
-rw-r--r--ext/gio/gstgiostreamsink.h68
-rw-r--r--ext/gio/gstgiostreamsrc.c191
-rw-r--r--ext/gio/gstgiostreamsrc.h68
-rw-r--r--ext/gnomevfs/Makefile.am21
-rw-r--r--ext/gnomevfs/gstgnomevfs.c143
-rw-r--r--ext/gnomevfs/gstgnomevfs.h38
-rw-r--r--ext/gnomevfs/gstgnomevfssink.c632
-rw-r--r--ext/gnomevfs/gstgnomevfssink.h84
-rw-r--r--ext/gnomevfs/gstgnomevfssrc.c897
-rw-r--r--ext/gnomevfs/gstgnomevfssrc.h87
-rw-r--r--ext/gnomevfs/gstgnomevfsuri.c90
-rw-r--r--ext/gnomevfs/gstgnomevfsuri.h32
-rw-r--r--ext/libvisual/Makefile.am8
-rw-r--r--ext/libvisual/visual.c960
-rw-r--r--ext/ogg/Makefile.am27
-rw-r--r--ext/ogg/README366
-rw-r--r--ext/ogg/dirac_parse.c501
-rw-r--r--ext/ogg/dirac_parse.h178
-rw-r--r--ext/ogg/gstogg.c48
-rw-r--r--ext/ogg/gstoggaviparse.c477
-rw-r--r--ext/ogg/gstoggdemux.c3366
-rw-r--r--ext/ogg/gstoggdemux.h176
-rw-r--r--ext/ogg/gstoggmux.c1692
-rw-r--r--ext/ogg/gstoggmux.h138
-rw-r--r--ext/ogg/gstoggparse.c698
-rw-r--r--ext/ogg/gstoggstream.c1315
-rw-r--r--ext/ogg/gstoggstream.h95
-rw-r--r--ext/ogg/gstogmparse.c972
-rw-r--r--ext/ogg/vorbis_parse.c239
-rw-r--r--ext/pango/Makefile.am28
-rw-r--r--ext/pango/gstclockoverlay.c240
-rw-r--r--ext/pango/gstclockoverlay.h62
-rw-r--r--ext/pango/gsttextoverlay.c2352
-rw-r--r--ext/pango/gsttextoverlay.h158
-rw-r--r--ext/pango/gsttextrender.c705
-rw-r--r--ext/pango/gsttextrender.h104
-rw-r--r--ext/pango/gsttimeoverlay.c151
-rw-r--r--ext/pango/gsttimeoverlay.h61
-rw-r--r--ext/theora/Makefile.am20
-rw-r--r--ext/theora/gsttheora.c52
-rw-r--r--ext/theora/gsttheoradec.c1467
-rw-r--r--ext/theora/gsttheoradec.h110
-rw-r--r--ext/theora/gsttheoraenc.c1256
-rw-r--r--ext/theora/gsttheoraenc.h116
-rw-r--r--ext/theora/gsttheoraparse.c941
-rw-r--r--ext/theora/gsttheoraparse.h87
-rw-r--r--ext/vorbis/Makefile.am46
-rw-r--r--ext/vorbis/README16
-rw-r--r--ext/vorbis/gstivorbisdec.c47
-rw-r--r--ext/vorbis/gstvorbis.c73
-rw-r--r--ext/vorbis/gstvorbiscommon.c75
-rw-r--r--ext/vorbis/gstvorbiscommon.h28
-rw-r--r--ext/vorbis/gstvorbisdec.c1228
-rw-r--r--ext/vorbis/gstvorbisdec.h90
-rw-r--r--ext/vorbis/gstvorbisdeclib.c122
-rw-r--r--ext/vorbis/gstvorbisdeclib.h163
-rw-r--r--ext/vorbis/gstvorbisenc.c1432
-rw-r--r--ext/vorbis/gstvorbisenc.h101
-rw-r--r--ext/vorbis/gstvorbisparse.c671
-rw-r--r--ext/vorbis/gstvorbisparse.h82
-rw-r--r--ext/vorbis/gstvorbistag.c151
-rw-r--r--ext/vorbis/gstvorbistag.h63
-rw-r--r--gst-libs/Makefile.am1
-rw-r--r--gst-libs/ext/.gitignore1
-rw-r--r--gst-libs/ext/Makefile.am2
-rw-r--r--gst-libs/gst/Makefile.am21
-rw-r--r--gst-libs/gst/app/.gitignore2
-rw-r--r--gst-libs/gst/app/Makefile.am75
-rw-r--r--gst-libs/gst/app/gstapp-marshal.list5
-rw-r--r--gst-libs/gst/app/gstappbuffer.c106
-rw-r--r--gst-libs/gst/app/gstappbuffer.h64
-rw-r--r--gst-libs/gst/app/gstappsink.c1381
-rw-r--r--gst-libs/gst/app/gstappsink.h141
-rw-r--r--gst-libs/gst/app/gstappsrc.c1675
-rw-r--r--gst-libs/gst/app/gstappsrc.h149
-rw-r--r--gst-libs/gst/audio/.gitignore4
-rw-r--r--gst-libs/gst/audio/Makefile.am106
-rw-r--r--gst-libs/gst/audio/TODO15
-rw-r--r--gst-libs/gst/audio/audio.c433
-rw-r--r--gst-libs/gst/audio/audio.def5
-rw-r--r--gst-libs/gst/audio/audio.h179
-rw-r--r--gst-libs/gst/audio/audio.vcproj153
-rw-r--r--gst-libs/gst/audio/audiofilter.vcproj144
-rw-r--r--gst-libs/gst/audio/gstaudioclock.c238
-rw-r--r--gst-libs/gst/audio/gstaudioclock.h103
-rw-r--r--gst-libs/gst/audio/gstaudiofilter.c205
-rw-r--r--gst-libs/gst/audio/gstaudiofilter.h96
-rw-r--r--gst-libs/gst/audio/gstaudiosink.c619
-rw-r--r--gst-libs/gst/audio/gstaudiosink.h102
-rw-r--r--gst-libs/gst/audio/gstaudiosrc.c532
-rw-r--r--gst-libs/gst/audio/gstaudiosrc.h99
-rw-r--r--gst-libs/gst/audio/gstbaseaudiosink.c1898
-rw-r--r--gst-libs/gst/audio/gstbaseaudiosink.h166
-rw-r--r--gst-libs/gst/audio/gstbaseaudiosrc.c1125
-rw-r--r--gst-libs/gst/audio/gstbaseaudiosrc.h146
-rw-r--r--gst-libs/gst/audio/gstringbuffer.c2077
-rw-r--r--gst-libs/gst/audio/gstringbuffer.h408
-rw-r--r--gst-libs/gst/audio/mixerutils.c246
-rw-r--r--gst-libs/gst/audio/mixerutils.h50
-rw-r--r--gst-libs/gst/audio/multichannel.c742
-rw-r--r--gst-libs/gst/audio/multichannel.h97
-rw-r--r--gst-libs/gst/audio/testchannels.c49
-rw-r--r--gst-libs/gst/cdda/Makefile.am60
-rw-r--r--gst-libs/gst/cdda/gstcddabasesrc.c1665
-rw-r--r--gst-libs/gst/cdda/gstcddabasesrc.h157
-rw-r--r--gst-libs/gst/fft/Makefile.am82
-rw-r--r--gst-libs/gst/fft/_kiss_fft_guts_f32.h112
-rw-r--r--gst-libs/gst/fft/_kiss_fft_guts_f64.h112
-rw-r--r--gst-libs/gst/fft/_kiss_fft_guts_s16.h135
-rw-r--r--gst-libs/gst/fft/_kiss_fft_guts_s32.h136
-rw-r--r--gst-libs/gst/fft/gstfft.c54
-rw-r--r--gst-libs/gst/fft/gstfft.h49
-rw-r--r--gst-libs/gst/fft/gstfftf32.c208
-rw-r--r--gst-libs/gst/fft/gstfftf32.h75
-rw-r--r--gst-libs/gst/fft/gstfftf64.c208
-rw-r--r--gst-libs/gst/fft/gstfftf64.h75
-rw-r--r--gst-libs/gst/fft/gstffts16.c208
-rw-r--r--gst-libs/gst/fft/gstffts16.h74
-rw-r--r--gst-libs/gst/fft/gstffts32.c207
-rw-r--r--gst-libs/gst/fft/gstffts32.h75
-rw-r--r--gst-libs/gst/fft/kiss_fft_f32.c433
-rw-r--r--gst-libs/gst/fft/kiss_fft_f32.h99
-rw-r--r--gst-libs/gst/fft/kiss_fft_f64.c433
-rw-r--r--gst-libs/gst/fft/kiss_fft_f64.h99
-rw-r--r--gst-libs/gst/fft/kiss_fft_s16.c433
-rw-r--r--gst-libs/gst/fft/kiss_fft_s16.h102
-rw-r--r--gst-libs/gst/fft/kiss_fft_s32.c433
-rw-r--r--gst-libs/gst/fft/kiss_fft_s32.h103
-rw-r--r--gst-libs/gst/fft/kiss_fftr_f32.c168
-rw-r--r--gst-libs/gst/fft/kiss_fftr_f32.h46
-rw-r--r--gst-libs/gst/fft/kiss_fftr_f64.c169
-rw-r--r--gst-libs/gst/fft/kiss_fftr_f64.h46
-rw-r--r--gst-libs/gst/fft/kiss_fftr_s16.c169
-rw-r--r--gst-libs/gst/fft/kiss_fftr_s16.h46
-rw-r--r--gst-libs/gst/fft/kiss_fftr_s32.c169
-rw-r--r--gst-libs/gst/fft/kiss_fftr_s32.h46
-rw-r--r--gst-libs/gst/fft/kiss_version4
-rw-r--r--gst-libs/gst/floatcast/Makefile.am2
-rw-r--r--gst-libs/gst/floatcast/floatcast.h102
-rw-r--r--gst-libs/gst/gettext.h69
-rw-r--r--gst-libs/gst/gst-i18n-plugin.h37
-rw-r--r--gst-libs/gst/interfaces/.gitignore5
-rw-r--r--gst-libs/gst/interfaces/Makefile.am113
-rw-r--r--gst-libs/gst/interfaces/colorbalance.c224
-rw-r--r--gst-libs/gst/interfaces/colorbalance.h112
-rw-r--r--gst-libs/gst/interfaces/colorbalancechannel.c124
-rw-r--r--gst-libs/gst/interfaces/colorbalancechannel.h75
-rw-r--r--gst-libs/gst/interfaces/interfaces-marshal.list5
-rw-r--r--gst-libs/gst/interfaces/mixer.c872
-rw-r--r--gst-libs/gst/interfaces/mixer.h231
-rw-r--r--gst-libs/gst/interfaces/mixeroptions.c146
-rw-r--r--gst-libs/gst/interfaces/mixeroptions.h91
-rw-r--r--gst-libs/gst/interfaces/mixertrack.c288
-rw-r--r--gst-libs/gst/interfaces/mixertrack.h134
-rw-r--r--gst-libs/gst/interfaces/navigation.c841
-rw-r--r--gst-libs/gst/interfaces/navigation.h257
-rw-r--r--gst-libs/gst/interfaces/propertyprobe.c378
-rw-r--r--gst-libs/gst/interfaces/propertyprobe.h115
-rw-r--r--gst-libs/gst/interfaces/streamvolume.c229
-rw-r--r--gst-libs/gst/interfaces/streamvolume.h87
-rw-r--r--gst-libs/gst/interfaces/tuner.c574
-rw-r--r--gst-libs/gst/interfaces/tuner.h128
-rw-r--r--gst-libs/gst/interfaces/tunerchannel.c148
-rw-r--r--gst-libs/gst/interfaces/tunerchannel.h113
-rw-r--r--gst-libs/gst/interfaces/tunernorm.c111
-rw-r--r--gst-libs/gst/interfaces/tunernorm.h67
-rw-r--r--gst-libs/gst/interfaces/videoorientation.c270
-rw-r--r--gst-libs/gst/interfaces/videoorientation.h94
-rw-r--r--gst-libs/gst/interfaces/xoverlay.c458
-rw-r--r--gst-libs/gst/interfaces/xoverlay.h94
-rw-r--r--gst-libs/gst/netbuffer/Makefile.am47
-rw-r--r--gst-libs/gst/netbuffer/README9
-rw-r--r--gst-libs/gst/netbuffer/gstnetbuffer.c448
-rw-r--r--gst-libs/gst/netbuffer/gstnetbuffer.h129
-rw-r--r--gst-libs/gst/pbutils/.gitignore2
-rw-r--r--gst-libs/gst/pbutils/Makefile.am89
-rw-r--r--gst-libs/gst/pbutils/descriptions.c985
-rw-r--r--gst-libs/gst/pbutils/descriptions.h58
-rw-r--r--gst-libs/gst/pbutils/install-plugins.c783
-rw-r--r--gst-libs/gst/pbutils/install-plugins.h144
-rw-r--r--gst-libs/gst/pbutils/missing-plugins.c801
-rw-r--r--gst-libs/gst/pbutils/missing-plugins.h77
-rw-r--r--gst-libs/gst/pbutils/pbutils.c108
-rw-r--r--gst-libs/gst/pbutils/pbutils.h37
-rw-r--r--gst-libs/gst/riff/Makefile.am57
-rw-r--r--gst-libs/gst/riff/riff-ids.h513
-rw-r--r--gst-libs/gst/riff/riff-media.c1863
-rw-r--r--gst-libs/gst/riff/riff-media.h65
-rw-r--r--gst-libs/gst/riff/riff-read.c749
-rw-r--r--gst-libs/gst/riff/riff-read.h87
-rw-r--r--gst-libs/gst/riff/riff.c46
-rw-r--r--gst-libs/gst/riff/riff.def27
-rw-r--r--gst-libs/gst/riff/riff.vcproj158
-rw-r--r--gst-libs/gst/rtp/Makefile.am62
-rw-r--r--gst-libs/gst/rtp/README66
-rw-r--r--gst-libs/gst/rtp/gstbasertpaudiopayload.c968
-rw-r--r--gst-libs/gst/rtp/gstbasertpaudiopayload.h98
-rw-r--r--gst-libs/gst/rtp/gstbasertpdepayload.c696
-rw-r--r--gst-libs/gst/rtp/gstbasertpdepayload.h134
-rw-r--r--gst-libs/gst/rtp/gstbasertppayload.c1018
-rw-r--r--gst-libs/gst/rtp/gstbasertppayload.h160
-rw-r--r--gst-libs/gst/rtp/gstrtcpbuffer.c1945
-rw-r--r--gst-libs/gst/rtp/gstrtcpbuffer.h283
-rw-r--r--gst-libs/gst/rtp/gstrtpbuffer.c1388
-rw-r--r--gst-libs/gst/rtp/gstrtpbuffer.h116
-rw-r--r--gst-libs/gst/rtp/gstrtppayloads.c229
-rw-r--r--gst-libs/gst/rtp/gstrtppayloads.h193
-rw-r--r--gst-libs/gst/rtsp/.gitignore4
-rw-r--r--gst-libs/gst/rtsp/Makefile.am95
-rw-r--r--gst-libs/gst/rtsp/gstrtsp-marshal.list1
-rw-r--r--gst-libs/gst/rtsp/gstrtsp.h27
-rw-r--r--gst-libs/gst/rtsp/gstrtspbase64.c84
-rw-r--r--gst-libs/gst/rtsp/gstrtspbase64.h35
-rw-r--r--gst-libs/gst/rtsp/gstrtspconnection.c3578
-rw-r--r--gst-libs/gst/rtsp/gstrtspconnection.h206
-rw-r--r--gst-libs/gst/rtsp/gstrtspdefs.c510
-rw-r--r--gst-libs/gst/rtsp/gstrtspdefs.h396
-rw-r--r--gst-libs/gst/rtsp/gstrtspextension.c222
-rw-r--r--gst-libs/gst/rtsp/gstrtspextension.h97
-rw-r--r--gst-libs/gst/rtsp/gstrtspmessage.c846
-rw-r--r--gst-libs/gst/rtsp/gstrtspmessage.h187
-rw-r--r--gst-libs/gst/rtsp/gstrtsprange.c276
-rw-r--r--gst-libs/gst/rtsp/gstrtsprange.h121
-rw-r--r--gst-libs/gst/rtsp/gstrtsptransport.c685
-rw-r--r--gst-libs/gst/rtsp/gstrtsptransport.h167
-rw-r--r--gst-libs/gst/rtsp/gstrtspurl.c353
-rw-r--r--gst-libs/gst/rtsp/gstrtspurl.h101
-rw-r--r--gst-libs/gst/sdp/Makefile.am50
-rw-r--r--gst-libs/gst/sdp/gstsdp.h58
-rw-r--r--gst-libs/gst/sdp/gstsdpmessage.c2039
-rw-r--r--gst-libs/gst/sdp/gstsdpmessage.h408
-rw-r--r--gst-libs/gst/tag/Makefile.am68
-rw-r--r--gst-libs/gst/tag/gstid3tag.c486
-rw-r--r--gst-libs/gst/tag/gsttagdemux.c1518
-rw-r--r--gst-libs/gst/tag/gsttagdemux.h144
-rw-r--r--gst-libs/gst/tag/gsttageditingprivate.h41
-rw-r--r--gst-libs/gst/tag/gstvorbistag.c698
-rw-r--r--gst-libs/gst/tag/lang-tables.dat447
-rw-r--r--gst-libs/gst/tag/lang.c497
-rw-r--r--gst-libs/gst/tag/mklangtables.c243
-rw-r--r--gst-libs/gst/tag/tag.h267
-rw-r--r--gst-libs/gst/tag/tags.c510
-rw-r--r--gst-libs/gst/video/.gitignore2
-rw-r--r--gst-libs/gst/video/Makefile.am73
-rw-r--r--gst-libs/gst/video/gstvideofilter.c124
-rw-r--r--gst-libs/gst/video/gstvideofilter.h58
-rw-r--r--gst-libs/gst/video/gstvideosink.c288
-rw-r--r--gst-libs/gst/video/gstvideosink.h132
-rw-r--r--gst-libs/gst/video/video.c1570
-rw-r--r--gst-libs/gst/video/video.h325
-rw-r--r--gst-libs/gst/video/video.vcproj150
-rw-r--r--gst-plugins-base.doap335
-rw-r--r--gst-plugins-base.spec.in266
-rw-r--r--gst-plugins-xvbo.spec.in85
-rw-r--r--gst/Makefile.am2
-rw-r--r--gst/adder/.gitignore7
-rw-r--r--gst/adder/Makefile.am13
-rw-r--r--gst/adder/adder.vcproj148
-rw-r--r--gst/adder/gstadder.c1327
-rw-r--r--gst/adder/gstadder.h109
-rw-r--r--gst/app/Makefile.am8
-rw-r--r--gst/app/gstapp.c42
-rw-r--r--gst/audioconvert/.gitignore1
-rw-r--r--gst/audioconvert/Makefile.am31
-rw-r--r--gst/audioconvert/audioconvert.c600
-rw-r--r--gst/audioconvert/audioconvert.h143
-rw-r--r--gst/audioconvert/audioconvert.vcproj154
-rw-r--r--gst/audioconvert/channelmixtest.c95
-rw-r--r--gst/audioconvert/gstaudioconvert.c1180
-rw-r--r--gst/audioconvert/gstaudioconvert.h60
-rw-r--r--gst/audioconvert/gstaudioquantize.c503
-rw-r--r--gst/audioconvert/gstaudioquantize.h37
-rw-r--r--gst/audioconvert/gstchannelmix.c742
-rw-r--r--gst/audioconvert/gstchannelmix.h59
-rw-r--r--gst/audioconvert/gstfastrandom.h90
-rw-r--r--gst/audioconvert/plugin.c48
-rw-r--r--gst/audioconvert/plugin.h35
-rw-r--r--gst/audiorate/Makefile.am10
-rw-r--r--gst/audiorate/audiorate.vcproj145
-rw-r--r--gst/audiorate/gstaudiorate.c816
-rw-r--r--gst/audiorate/gstaudiorate.h82
-rw-r--r--gst/audioresample/Makefile.am45
-rw-r--r--gst/audioresample/README347
-rw-r--r--gst/audioresample/arch.h265
-rw-r--r--gst/audioresample/fixed_arm4.h148
-rw-r--r--gst/audioresample/fixed_arm5e.h178
-rw-r--r--gst/audioresample/fixed_bfin.h176
-rw-r--r--gst/audioresample/fixed_debug.h487
-rw-r--r--gst/audioresample/fixed_generic.h106
-rw-r--r--gst/audioresample/gstaudioresample.c1479
-rw-r--r--gst/audioresample/gstaudioresample.h92
-rw-r--r--gst/audioresample/resample.c1348
-rw-r--r--gst/audioresample/resample_sse.h128
-rw-r--r--gst/audioresample/speex_resampler.h361
-rw-r--r--gst/audioresample/speex_resampler_double.c25
-rw-r--r--gst/audioresample/speex_resampler_float.c24
-rw-r--r--gst/audioresample/speex_resampler_int.c24
-rw-r--r--gst/audioresample/speex_resampler_wrapper.h161
-rw-r--r--gst/audiotestsrc/Makefile.am9
-rw-r--r--gst/audiotestsrc/gstaudiotestsrc.c1192
-rw-r--r--gst/audiotestsrc/gstaudiotestsrc.h142
-rw-r--r--gst/ffmpegcolorspace/Makefile.am22
-rw-r--r--gst/ffmpegcolorspace/avcodec.h282
-rw-r--r--gst/ffmpegcolorspace/dsputil.c45
-rw-r--r--gst/ffmpegcolorspace/dsputil.h39
-rw-r--r--gst/ffmpegcolorspace/ffmpegcolorspace.vcproj181
-rw-r--r--gst/ffmpegcolorspace/gstffmpeg.c48
-rw-r--r--gst/ffmpegcolorspace/gstffmpegcodecmap.c974
-rw-r--r--gst/ffmpegcolorspace/gstffmpegcodecmap.h58
-rw-r--r--gst/ffmpegcolorspace/gstffmpegcolorspace.c571
-rw-r--r--gst/ffmpegcolorspace/gstffmpegcolorspace.h63
-rw-r--r--gst/ffmpegcolorspace/imgconvert.c3517
-rw-r--r--gst/ffmpegcolorspace/imgconvert_template.h1741
-rw-r--r--gst/ffmpegcolorspace/mem.c125
-rw-r--r--gst/ffmpegcolorspace/utils.c159
-rw-r--r--gst/gdp/Makefile.am15
-rw-r--r--gst/gdp/README22
-rw-r--r--gst/gdp/gstgdp.c46
-rw-r--r--gst/gdp/gstgdpdepay.c482
-rw-r--r--gst/gdp/gstgdpdepay.h80
-rw-r--r--gst/gdp/gstgdppay.c899
-rw-r--r--gst/gdp/gstgdppay.h79
-rw-r--r--gst/playback/.gitignore10
-rw-r--r--gst/playback/Makefile.am100
-rw-r--r--gst/playback/README91
-rw-r--r--gst/playback/decodetest.c169
-rw-r--r--gst/playback/gstdecodebin.c2048
-rw-r--r--gst/playback/gstdecodebin2.c3444
-rw-r--r--gst/playback/gstfactorylists.c266
-rw-r--r--gst/playback/gstfactorylists.h50
-rw-r--r--gst/playback/gstinputselector.c1455
-rw-r--r--gst/playback/gstinputselector.h85
-rw-r--r--gst/playback/gstplay-enum.c79
-rw-r--r--gst/playback/gstplay-enum.h79
-rw-r--r--gst/playback/gstplay-marshal.list12
-rw-r--r--gst/playback/gstplayback.c69
-rw-r--r--gst/playback/gstplaybasebin.c2816
-rw-r--r--gst/playback/gstplaybasebin.h126
-rw-r--r--gst/playback/gstplaybin.c1982
-rw-r--r--gst/playback/gstplaybin2.c3630
-rw-r--r--gst/playback/gstplaysink.c2756
-rw-r--r--gst/playback/gstplaysink.h102
-rw-r--r--gst/playback/gstrawcaps.h42
-rw-r--r--gst/playback/gstscreenshot.c203
-rw-r--r--gst/playback/gstscreenshot.h31
-rw-r--r--gst/playback/gststreaminfo.c402
-rw-r--r--gst/playback/gststreaminfo.h86
-rw-r--r--gst/playback/gststreamselector.c752
-rw-r--r--gst/playback/gststreamselector.h62
-rw-r--r--gst/playback/gstsubtitleoverlay.c2140
-rw-r--r--gst/playback/gstsubtitleoverlay.h129
-rw-r--r--gst/playback/gsturidecodebin.c2226
-rw-r--r--gst/playback/test.c193
-rw-r--r--gst/playback/test2.c43
-rw-r--r--gst/playback/test3.c128
-rw-r--r--gst/playback/test4.c99
-rw-r--r--gst/playback/test5.c132
-rw-r--r--gst/playback/test6.c164
-rw-r--r--gst/playback/test7.c155
-rw-r--r--gst/subparse/Makefile.am33
-rw-r--r--gst/subparse/gstssaparse.c384
-rw-r--r--gst/subparse/gstssaparse.h57
-rw-r--r--gst/subparse/gstsubparse.c1888
-rw-r--r--gst/subparse/gstsubparse.h120
-rw-r--r--gst/subparse/mpl2parse.c104
-rw-r--r--gst/subparse/mpl2parse.h32
-rw-r--r--gst/subparse/qttextparse.c453
-rw-r--r--gst/subparse/qttextparse.h36
-rw-r--r--gst/subparse/samiparse.c474
-rw-r--r--gst/subparse/samiparse.h38
-rw-r--r--gst/subparse/tmplayerparse.c156
-rw-r--r--gst/subparse/tmplayerparse.h32
-rw-r--r--gst/tcp/.gitignore5
-rw-r--r--gst/tcp/Makefile.am41
-rw-r--r--gst/tcp/README53
-rw-r--r--gst/tcp/gstmultifdsink.c2974
-rw-r--r--gst/tcp/gstmultifdsink.h286
-rw-r--r--gst/tcp/gsttcp-marshal.list5
-rw-r--r--gst/tcp/gsttcp.c569
-rw-r--r--gst/tcp/gsttcp.h76
-rw-r--r--gst/tcp/gsttcpclientsink.c464
-rw-r--r--gst/tcp/gsttcpclientsink.h91
-rw-r--r--gst/tcp/gsttcpclientsrc.c444
-rw-r--r--gst/tcp/gsttcpclientsrc.h83
-rw-r--r--gst/tcp/gsttcpplugin.c63
-rw-r--r--gst/tcp/gsttcpplugin.h40
-rw-r--r--gst/tcp/gsttcpserversink.c382
-rw-r--r--gst/tcp/gsttcpserversink.h90
-rw-r--r--gst/tcp/gsttcpserversrc.c486
-rw-r--r--gst/tcp/gsttcpserversrc.h89
-rw-r--r--gst/tcp/tcp.vcproj160
-rw-r--r--gst/typefind/Makefile.am8
-rw-r--r--gst/typefind/gsttypefindfunctions.c3930
-rw-r--r--gst/typefind/typefindfunctions.vcproj145
-rw-r--r--gst/videorate/Makefile.am10
-rw-r--r--gst/videorate/gstvideorate.c920
-rw-r--r--gst/videorate/gstvideorate.h79
-rw-r--r--gst/videorate/videorate.vcproj145
-rw-r--r--gst/videoscale/.gitignore7
-rw-r--r--gst/videoscale/Makefile.am20
-rw-r--r--gst/videoscale/README5
-rw-r--r--gst/videoscale/gstvideoscale.c1034
-rw-r--r--gst/videoscale/gstvideoscale.h95
-rw-r--r--gst/videoscale/videoscale.vcproj154
-rw-r--r--gst/videoscale/vs_4tap.c1339
-rw-r--r--gst/videoscale/vs_4tap.h93
-rw-r--r--gst/videoscale/vs_image.c1071
-rw-r--r--gst/videoscale/vs_image.h83
-rw-r--r--gst/videoscale/vs_scanline.c810
-rw-r--r--gst/videoscale/vs_scanline.h74
-rw-r--r--gst/videotestsrc/Makefile.am12
-rw-r--r--gst/videotestsrc/gstvideotestsrc.c856
-rw-r--r--gst/videotestsrc/gstvideotestsrc.h160
-rw-r--r--gst/videotestsrc/videotestsrc.c2227
-rw-r--r--gst/videotestsrc/videotestsrc.h122
-rw-r--r--gst/videotestsrc/videotestsrc.vcproj154
-rw-r--r--gst/volume/.gitignore1
-rw-r--r--gst/volume/Makefile.am16
-rw-r--r--gst/volume/gstvolume.c858
-rw-r--r--gst/volume/gstvolume.h81
-rw-r--r--gst/volume/volume.vcproj148
-rw-r--r--pkgconfig/.gitignore1
-rw-r--r--pkgconfig/Makefile.am65
-rw-r--r--pkgconfig/gstreamer-app-uninstalled.pc.in13
-rw-r--r--pkgconfig/gstreamer-app.pc.in12
-rw-r--r--pkgconfig/gstreamer-audio-uninstalled.pc.in13
-rw-r--r--pkgconfig/gstreamer-audio.pc.in12
-rw-r--r--pkgconfig/gstreamer-cdda-uninstalled.pc.in13
-rw-r--r--pkgconfig/gstreamer-cdda.pc.in12
-rw-r--r--pkgconfig/gstreamer-fft-uninstalled.pc.in13
-rw-r--r--pkgconfig/gstreamer-fft.pc.in12
-rw-r--r--pkgconfig/gstreamer-floatcast-uninstalled.pc.in12
-rw-r--r--pkgconfig/gstreamer-floatcast.pc.in12
-rw-r--r--pkgconfig/gstreamer-interfaces-uninstalled.pc.in13
-rw-r--r--pkgconfig/gstreamer-interfaces.pc.in12
-rw-r--r--pkgconfig/gstreamer-netbuffer-uninstalled.pc.in13
-rw-r--r--pkgconfig/gstreamer-netbuffer.pc.in12
-rw-r--r--pkgconfig/gstreamer-pbutils-uninstalled.pc.in13
-rw-r--r--pkgconfig/gstreamer-pbutils.pc.in12
-rw-r--r--pkgconfig/gstreamer-plugins-base-uninstalled.pc.in15
-rw-r--r--pkgconfig/gstreamer-plugins-base.pc.in14
-rw-r--r--pkgconfig/gstreamer-riff-uninstalled.pc.in13
-rw-r--r--pkgconfig/gstreamer-riff.pc.in12
-rw-r--r--pkgconfig/gstreamer-rtp-uninstalled.pc.in13
-rw-r--r--pkgconfig/gstreamer-rtp.pc.in12
-rw-r--r--pkgconfig/gstreamer-rtsp-uninstalled.pc.in13
-rw-r--r--pkgconfig/gstreamer-rtsp.pc.in12
-rw-r--r--pkgconfig/gstreamer-sdp-uninstalled.pc.in13
-rw-r--r--pkgconfig/gstreamer-sdp.pc.in12
-rw-r--r--pkgconfig/gstreamer-tag-uninstalled.pc.in13
-rw-r--r--pkgconfig/gstreamer-tag.pc.in12
-rw-r--r--pkgconfig/gstreamer-video-uninstalled.pc.in13
-rw-r--r--pkgconfig/gstreamer-video.pc.in12
-rw-r--r--po/POTFILES.in24
-rw-r--r--sys/Makefile.am28
-rw-r--r--sys/v4l/.gitignore2
-rw-r--r--sys/v4l/Makefile.am41
-rw-r--r--sys/v4l/README35
-rw-r--r--sys/v4l/TODO44
-rw-r--r--sys/v4l/gstv4l.c67
-rw-r--r--sys/v4l/gstv4lcolorbalance.c150
-rw-r--r--sys/v4l/gstv4lcolorbalance.h59
-rw-r--r--sys/v4l/gstv4lelement.c552
-rw-r--r--sys/v4l/gstv4lelement.h116
-rw-r--r--sys/v4l/gstv4ljpegsrc.c297
-rw-r--r--sys/v4l/gstv4ljpegsrc.h57
-rw-r--r--sys/v4l/gstv4lmjpegsink.c435
-rw-r--r--sys/v4l/gstv4lmjpegsink.h97
-rw-r--r--sys/v4l/gstv4lmjpegsrc.c872
-rw-r--r--sys/v4l/gstv4lmjpegsrc.h116
-rw-r--r--sys/v4l/gstv4lsrc.c731
-rw-r--r--sys/v4l/gstv4lsrc.h108
-rw-r--r--sys/v4l/gstv4ltuner.c328
-rw-r--r--sys/v4l/gstv4ltuner.h84
-rw-r--r--sys/v4l/gstv4lxoverlay.c245
-rw-r--r--sys/v4l/gstv4lxoverlay.h40
-rw-r--r--sys/v4l/v4l_calls.c732
-rw-r--r--sys/v4l/v4l_calls.h154
-rw-r--r--sys/v4l/v4lmjpegsink_calls.c525
-rw-r--r--sys/v4l/v4lmjpegsink_calls.h62
-rw-r--r--sys/v4l/v4lmjpegsrc_calls.c577
-rw-r--r--sys/v4l/v4lmjpegsrc_calls.h66
-rw-r--r--sys/v4l/v4lsrc_calls.c764
-rw-r--r--sys/v4l/v4lsrc_calls.h58
-rw-r--r--sys/v4l/videodev_mjpeg.h123
-rw-r--r--sys/ximage/Makefile.am14
-rw-r--r--sys/ximage/ximage.c47
-rw-r--r--sys/ximage/ximagesink.c2447
-rw-r--r--sys/ximage/ximagesink.h231
-rw-r--r--sys/xvimage/Makefile.am15
-rw-r--r--sys/xvimage/xvimagesink.c3634
-rw-r--r--sys/xvimage/xvimagesink.h299
-rw-r--r--tests/Makefile.am27
-rw-r--r--tests/check/.gitignore1
-rw-r--r--tests/check/Makefile.am362
-rw-r--r--tests/check/elements/.gitignore27
-rw-r--r--tests/check/elements/adder.c889
-rw-r--r--tests/check/elements/alsa.c134
-rw-r--r--tests/check/elements/appsink.c357
-rw-r--r--tests/check/elements/audioconvert.c1741
-rw-r--r--tests/check/elements/audiorate.c469
-rw-r--r--tests/check/elements/audioresample.c926
-rw-r--r--tests/check/elements/audiotestsrc.c143
-rw-r--r--tests/check/elements/decodebin.c200
-rw-r--r--tests/check/elements/decodebin2.c203
-rw-r--r--tests/check/elements/ffmpegcolorspace.c439
-rw-r--r--tests/check/elements/gdpdepay.c428
-rw-r--r--tests/check/elements/gdppay.c581
-rw-r--r--tests/check/elements/gnomevfssink.c319
-rw-r--r--tests/check/elements/libvisual.c118
-rw-r--r--tests/check/elements/multifdsink.c881
-rw-r--r--tests/check/elements/playbin.c652
-rw-r--r--tests/check/elements/playbin2.c712
-rw-r--r--tests/check/elements/subparse.c719
-rw-r--r--tests/check/elements/textoverlay.c751
-rw-r--r--tests/check/elements/videorate.c783
-rw-r--r--tests/check/elements/videoscale.c361
-rw-r--r--tests/check/elements/videotestsrc.c447
-rw-r--r--tests/check/elements/volume.c1525
-rw-r--r--tests/check/elements/vorbisdec.c354
-rw-r--r--tests/check/elements/vorbistag.c409
-rw-r--r--tests/check/generic/.gitignore3
-rw-r--r--tests/check/generic/clock-selection.c72
-rw-r--r--tests/check/generic/states.c222
-rw-r--r--tests/check/gst-plugins-base.supp397
-rw-r--r--tests/check/gst/.gitignore2
-rw-r--r--tests/check/gst/typefindfunctions.c125
-rw-r--r--tests/check/libs/.gitignore13
-rw-r--r--tests/check/libs/audio.c559
-rw-r--r--tests/check/libs/cddabasesrc.c518
-rw-r--r--tests/check/libs/fft.c563
-rw-r--r--tests/check/libs/mixer.c241
-rw-r--r--tests/check/libs/navigation.c351
-rw-r--r--tests/check/libs/netbuffer.c96
-rw-r--r--tests/check/libs/pbutils.c724
-rw-r--r--tests/check/libs/rtp.c469
-rw-r--r--tests/check/libs/tag.c783
-rw-r--r--tests/check/libs/video.c598
-rw-r--r--tests/check/pipelines/.gitignore9
-rw-r--r--tests/check/pipelines/basetime.c153
-rw-r--r--tests/check/pipelines/gio.c181
-rw-r--r--tests/check/pipelines/oggmux.c430
-rw-r--r--tests/check/pipelines/simple-launch-lines.c240
-rw-r--r--tests/check/pipelines/streamheader.c256
-rw-r--r--tests/check/pipelines/theoraenc.c463
-rw-r--r--tests/check/pipelines/vorbisdec.c125
-rw-r--r--tests/check/pipelines/vorbisenc.c410
-rw-r--r--tests/examples/Makefile.am13
-rw-r--r--tests/examples/app/.gitignore6
-rw-r--r--tests/examples/app/Makefile.am32
-rw-r--r--tests/examples/app/appsink-src.c192
-rw-r--r--tests/examples/app/appsrc-ra.c229
-rw-r--r--tests/examples/app/appsrc-seekable.c234
-rw-r--r--tests/examples/app/appsrc-stream.c254
-rw-r--r--tests/examples/app/appsrc-stream2.c224
-rw-r--r--tests/examples/app/appsrc_ex.c95
-rw-r--r--tests/examples/dynamic/.gitignore5
-rw-r--r--tests/examples/dynamic/Makefile.am21
-rw-r--r--tests/examples/dynamic/addstream.c253
-rw-r--r--tests/examples/dynamic/codec-select.c298
-rw-r--r--tests/examples/dynamic/sprinkle.c264
-rw-r--r--tests/examples/dynamic/sprinkle2.c288
-rw-r--r--tests/examples/dynamic/sprinkle3.c301
-rw-r--r--tests/examples/gio/.gitignore1
-rw-r--r--tests/examples/gio/Makefile.am8
-rw-r--r--tests/examples/gio/giosrc-mounting.c126
-rw-r--r--tests/examples/overlay/.gitignore5
-rw-r--r--tests/examples/overlay/Makefile.am47
-rw-r--r--tests/examples/overlay/gtk-xoverlay.c147
-rw-r--r--tests/examples/overlay/qt-xoverlay.cpp130
-rw-r--r--tests/examples/overlay/qtgv-xoverlay.cpp128
-rw-r--r--tests/examples/overlay/qtgv-xoverlay.h45
-rw-r--r--tests/examples/seek/.gitignore4
-rw-r--r--tests/examples/seek/Makefile.am13
-rw-r--r--tests/examples/seek/scrubby.c570
-rw-r--r--tests/examples/seek/seek.c2945
-rw-r--r--tests/examples/seek/stepping.c124
-rw-r--r--tests/examples/seek/stepping2.c142
-rw-r--r--tests/examples/snapshot/.gitignore2
-rw-r--r--tests/examples/snapshot/Makefile.am10
-rw-r--r--tests/examples/snapshot/snapshot.c151
-rw-r--r--tests/examples/v4l/.gitignore1
-rw-r--r--tests/examples/v4l/Makefile.am10
-rw-r--r--tests/examples/v4l/probe.c85
-rw-r--r--tests/examples/volume/.gitignore1
-rw-r--r--tests/examples/volume/Makefile.am6
-rw-r--r--tests/examples/volume/volume.c172
-rw-r--r--tests/icles/.gitignore7
-rw-r--r--tests/icles/Makefile.am49
-rw-r--r--tests/icles/playbin-text.c174
-rw-r--r--tests/icles/stress-playbin.c156
-rw-r--r--tests/icles/stress-xoverlay.c247
-rw-r--r--tests/icles/test-box.c144
-rw-r--r--tests/icles/test-colorkey.c258
-rw-r--r--tests/icles/test-scale.c164
-rw-r--r--tests/icles/test-textoverlay.c125
-rw-r--r--tests/old/Makefile.am26
-rw-r--r--tests/old/examples/Makefile.am15
-rw-r--r--tests/old/examples/capsfilter/Makefile.am6
-rw-r--r--tests/old/examples/capsfilter/capsfilter1.c87
-rw-r--r--tests/old/examples/gob/Makefile.am19
-rw-r--r--tests/old/examples/gob/gst-identity2.gob139
-rw-r--r--tests/old/examples/indexing/.gitignore1
-rw-r--r--tests/old/examples/indexing/Makefile.am7
-rw-r--r--tests/old/examples/indexing/indexmpeg.c321
-rw-r--r--tests/old/examples/seek/.gitignore6
-rw-r--r--tests/old/examples/seek/Makefile.am7
-rw-r--r--tests/old/examples/seek/cdparanoia.c215
-rw-r--r--tests/old/examples/seek/cdplayer.c292
-rw-r--r--tests/old/examples/seek/chained.c107
-rw-r--r--tests/old/examples/stats/Makefile.am6
-rw-r--r--tests/old/examples/stats/mp2ogg.c102
-rw-r--r--tests/old/examples/switch/.gitignore1
-rw-r--r--tests/old/examples/switch/Makefile.am7
-rw-r--r--tests/old/examples/switch/switcher.c104
-rw-r--r--tests/old/testsuite/alsa/.gitignore3
-rw-r--r--tests/old/testsuite/alsa/Makefile.am13
-rw-r--r--tests/old/testsuite/alsa/formats.c183
-rw-r--r--tests/old/testsuite/alsa/sinesrc.c349
-rw-r--r--tests/old/testsuite/alsa/sinesrc.h89
-rw-r--r--tests/old/testsuite/alsa/srcstate.c95
-rw-r--r--tests/old/testsuite/alsa/state.c108
-rw-r--r--tests/old/testsuite/embed/Makefile.am7
-rw-r--r--tests/old/testsuite/embed/embed.c54
-rwxr-xr-xtests/old/testsuite/gst-lint571
-rw-r--r--tools/.gitignore4
-rw-r--r--tools/Makefile.am26
-rw-r--r--tools/README.filterstamp24
-rwxr-xr-xtools/filterstamp.sh57
-rw-r--r--tools/gst-launch-ext.1.in42
-rw-r--r--tools/gst-visualise-m.m79
-rw-r--r--tools/gst-visualise.1.in32
-rw-r--r--win32/MANIFEST84
-rw-r--r--win32/common/_stdint.h9
-rw-r--r--win32/common/audio-enumtypes.c175
-rw-r--r--win32/common/audio-enumtypes.h29
-rw-r--r--win32/common/config.h386
-rw-r--r--win32/common/gstrtsp-enumtypes.c391
-rw-r--r--win32/common/gstrtsp-enumtypes.h35
-rw-r--r--win32/common/interfaces-enumtypes.c276
-rw-r--r--win32/common/interfaces-enumtypes.h49
-rw-r--r--win32/common/libgstapp.def33
-rw-r--r--win32/common/libgstaudio.def71
-rw-r--r--win32/common/libgstcdda.def4
-rw-r--r--win32/common/libgstinterfaces.def119
-rw-r--r--win32/common/libgstnetbuffer.def12
-rw-r--r--win32/common/libgstpbutils.def32
-rw-r--r--win32/common/libgstriff.def16
-rw-r--r--win32/common/libgstrtp.def123
-rw-r--r--win32/common/libgstrtsp.def111
-rw-r--r--win32/common/libgstsdp.def75
-rw-r--r--win32/common/libgsttag.def26
-rw-r--r--win32/common/libgstutils.def8
-rw-r--r--win32/common/libgstvideo.def28
-rw-r--r--win32/common/multichannel-enumtypes.c53
-rw-r--r--win32/common/multichannel-enumtypes.h19
-rw-r--r--win32/common/pbutils-enumtypes.c45
-rw-r--r--win32/common/pbutils-enumtypes.h19
-rw-r--r--win32/common/video-enumtypes.c47
-rw-r--r--win32/common/video-enumtypes.h19
-rw-r--r--win32/vs6/grammar.dsp424
-rw-r--r--win32/vs6/gst_plugins_base.dsw440
-rw-r--r--win32/vs6/libgstadder.dsp123
-rw-r--r--win32/vs6/libgstaudio.dsp207
-rw-r--r--win32/vs6/libgstaudioconvert.dsp151
-rw-r--r--win32/vs6/libgstaudiorate.dsp119
-rw-r--r--win32/vs6/libgstaudioresample.dsp163
-rw-r--r--win32/vs6/libgstaudioscale.dsp125
-rw-r--r--win32/vs6/libgstaudiotestsrc.dsp123
-rw-r--r--win32/vs6/libgstcdda.dsp143
-rw-r--r--win32/vs6/libgstdecodebin.dsp123
-rw-r--r--win32/vs6/libgstdecodebin2.dsp135
-rw-r--r--win32/vs6/libgstdirectsound.dsp125
-rw-r--r--win32/vs6/libgstffmpegcolorspace.dsp163
-rw-r--r--win32/vs6/libgstfft.dsp167
-rw-r--r--win32/vs6/libgstgdp.dsp127
-rw-r--r--win32/vs6/libgstinterfaces.dsp223
-rw-r--r--win32/vs6/libgstnetbuffer.dsp127
-rw-r--r--win32/vs6/libgstogg.dsp139
-rw-r--r--win32/vs6/libgstpbutils.dsp139
-rw-r--r--win32/vs6/libgstplaybin.dsp151
-rw-r--r--win32/vs6/libgstriff.dsp143
-rw-r--r--win32/vs6/libgstrtp.dsp155
-rw-r--r--win32/vs6/libgstrtsp.dsp195
-rw-r--r--win32/vs6/libgstsdp.dsp123
-rw-r--r--win32/vs6/libgstsinesrc.dsp121
-rw-r--r--win32/vs6/libgstsubparse.dsp123
-rw-r--r--win32/vs6/libgsttag.dsp139
-rw-r--r--win32/vs6/libgsttheora.dsp131
-rw-r--r--win32/vs6/libgsttypefindfunctions.dsp119
-rw-r--r--win32/vs6/libgstutils.dsp135
-rw-r--r--win32/vs6/libgstvideo.dsp143
-rw-r--r--win32/vs6/libgstvideorate.dsp119
-rw-r--r--win32/vs6/libgstvideoscale.dsp143
-rw-r--r--win32/vs6/libgstvideotestsrc.dsp131
-rw-r--r--win32/vs6/libgstvolume.dsp119
-rw-r--r--win32/vs6/libgstvorbis.dsp147
-rw-r--r--win32/vs7/gst-plugins-base.sln199
-rw-r--r--win32/vs7/libgstadder.vcproj142
-rw-r--r--win32/vs7/libgstaudio.vcproj183
-rw-r--r--win32/vs7/libgstaudioconvert.vcproj151
-rw-r--r--win32/vs7/libgstaudiorate.vcproj142
-rw-r--r--win32/vs7/libgstaudioresample.vcproj163
-rw-r--r--win32/vs7/libgstaudiotestsrc.vcproj142
-rw-r--r--win32/vs7/libgstdecodebin.vcproj169
-rw-r--r--win32/vs7/libgstffmpegcolorspace.vcproj160
-rw-r--r--win32/vs7/libgstinterfaces.vcproj206
-rw-r--r--win32/vs7/libgstogg.vcproj154
-rw-r--r--win32/vs7/libgstplaybin.vcproj178
-rw-r--r--win32/vs7/libgstriff.vcproj153
-rw-r--r--win32/vs7/libgstsubparse.vcproj134
-rw-r--r--win32/vs7/libgsttag.vcproj150
-rw-r--r--win32/vs7/libgsttcp.vcproj160
-rw-r--r--win32/vs7/libgsttheora.vcproj148
-rw-r--r--win32/vs7/libgsttypefind.vcproj142
-rw-r--r--win32/vs7/libgstvideo.vcproj150
-rw-r--r--win32/vs7/libgstvideorate.vcproj142
-rw-r--r--win32/vs7/libgstvideoscale.vcproj148
-rw-r--r--win32/vs7/libgstvideotestsrc.vcproj145
-rw-r--r--win32/vs7/libgstvolume.vcproj142
-rw-r--r--win32/vs7/libgstvorbis.vcproj151
-rw-r--r--win32/vs8/gst-plugins-base.sln177
-rw-r--r--win32/vs8/libgstadder.vcproj206
-rw-r--r--win32/vs8/libgstaudio.vcproj254
-rw-r--r--win32/vs8/libgstaudioconvert.vcproj218
-rw-r--r--win32/vs8/libgstaudiorate.vcproj206
-rw-r--r--win32/vs8/libgstaudioresample.vcproj230
-rw-r--r--win32/vs8/libgstaudiotestsrc.vcproj206
-rw-r--r--win32/vs8/libgstdecodebin.vcproj212
-rw-r--r--win32/vs8/libgstffmpegcolorspace.vcproj230
-rw-r--r--win32/vs8/libgstinterfaces.vcproj264
-rw-r--r--win32/vs8/libgstogg.vcproj226
-rw-r--r--win32/vs8/libgstplaybin.vcproj224
-rw-r--r--win32/vs8/libgstriff.vcproj222
-rw-r--r--win32/vs8/libgstsubparse.vcproj200
-rw-r--r--win32/vs8/libgsttag.vcproj222
-rw-r--r--win32/vs8/libgsttcp.vcproj232
-rw-r--r--win32/vs8/libgsttheora.vcproj218
-rw-r--r--win32/vs8/libgsttypefind.vcproj206
-rw-r--r--win32/vs8/libgstvideo.vcproj218
-rw-r--r--win32/vs8/libgstvideorate.vcproj206
-rw-r--r--win32/vs8/libgstvideoscale.vcproj218
-rw-r--r--win32/vs8/libgstvideotestsrc.vcproj210
-rw-r--r--win32/vs8/libgstvolume.vcproj206
-rw-r--r--win32/vs8/libgstvorbis.vcproj222
792 files changed, 105 insertions, 238222 deletions
diff --git a/.gitignore b/.gitignore
index e07bc131..55375852 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,16 +8,11 @@ config.guess
config.sub
config.rpath
configure
-gst-plugins-base.spec
-gstreamer-libs-uninstalled*.pc
-gstreamer-libs*.pc
-gstreamer-play-uninstalled*.pc
-gstreamer-play*.pc
+gst-plugins-xvbo.spec
libtool
stamp-h
stamp-h.in
stamp-h1
-gst-element-check-*.m4
ltmain.sh
missing
mkinstalldirs
@@ -28,7 +23,7 @@ autoregen.sh
ABOUT-NLS
_stdint.h
-gst-plugins-base-*.tar*
+gst-plugins-xvbo-*.tar*
.deps
.libs
@@ -42,5 +37,3 @@ Makefile.in
Makefile
*.gir
*.typelib
-
-gst-libs/gst/tag/mklangtables
diff --git a/Makefile.am b/Makefile.am
index 0f188876..d14c9947 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,40 +1,21 @@
DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
-if BUILD_EXTERNAL
-SUBDIRS_EXT = ext
-else
-SUBDIRS_EXT =
-endif
-
SUBDIRS = \
- pkgconfig \
- gst-libs \
- gst sys $(SUBDIRS_EXT) \
- tools \
- tests \
- docs \
+ sys \
po \
common \
m4
DIST_SUBDIRS = \
- pkgconfig \
- docs \
- gst-libs \
- gst sys ext \
- tools \
- tests \
+ sys \
po \
common \
m4
-# include before EXTRA_DIST for win32 assignment
-include $(top_srcdir)/common/win32.mak
-
EXTRA_DIST = \
gst-plugins-base.spec depcomp \
AUTHORS COPYING COPYING.LIB NEWS README RELEASE REQUIREMENTS \
- ChangeLog gst-plugins-base.doap autogen.sh $(win32)
+ ChangeLog autogen.sh $(win32)
DISTCLEANFILES = _stdint.h
@@ -54,19 +35,6 @@ check-torture:
true
endif
-WIN32_COPY = \
- $(top_builddir)/gst-libs/gst/*/*-enumtypes.[ch] \
- $(top_builddir)/_stdint.h
-
-win32-update:
- for f in $(WIN32_COPY); do cp -v $$f win32/common; done; \
- for f in win32/common/*-enumtypes.c; do \
- echo "Indenting $$f"; \
- gst-indent $$f; gst-indent $$f; \
- done
- cp -v $(top_builddir)/win32/common/config.h-new \
- $(top_srcdir)/win32/common/config.h
-
include $(top_srcdir)/common/coverage/lcov.mak
check: check-exports
diff --git a/REQUIREMENTS b/REQUIREMENTS
index ac3e1612..83117094 100644
--- a/REQUIREMENTS
+++ b/REQUIREMENTS
@@ -32,12 +32,6 @@ Notes: The required version is updated frequently, so the version
listed in this file is often wrong. If you are compiling from CVS,
the required version is often the latest GStreamer CVS.
-Package: liboil
-Version: >= 0.3.8
-Recommended: 0.3.latest
-URL: http://liboil.freedesktop.org/
-DebianPackage: liboil0.3-dev
-
Optional libraries:
===================
@@ -46,62 +40,10 @@ This file lists supporting libraries for which gst-plugins-base contains
plugins, as well as their minimum version. You can find the corresponding
plugins in ext/(library)
-Package: GTK+
-Version: >= 2.0
-Recommended: >= 2.2
-URL: http://www.gtk.org/
-DebianPackage: libgtk2.0-dev
-Notes: Required by several examples
-
Package: Xlib
-Plugins: xvimagesink, ximagesink, v4l (v4lsrc), ximagesrc, xvboimagesink
+Plugins: xvboimagesink
DebianPackage: libx11-dev libxv-dev libxt-dev
-Package: Alsa
-Version: >= 0.9.1
-Plugins: alsa (alsasrc, alsasink)
-URL: http://www.alsa-project.org/
-DebianPackage: libasound2-dev
-
-Package: CDParanoia
-Plugins: cdparanoia
-URL: http://xiph.org/paranoia/
-DebianPackage: libcdparanoia0-dev
-
-Package: GnomeVFS
-Version: >= 2.0 (2.4?)
-Plugins: gnomevfs (gnomevfssrc)
-URL: http://www.gnome.org/
-DebianPackage: libgnomevfs2-dev
-
-Package: libvisual
-Version: >= 0.2.0
-Recommended: 0.4.0
-Plugins: libvisual
-URL: http://localhost.nl/~synap/libvisual-wiki/index.php/Main_Page
-DebianPackage: libvisual0.4-dev
-
-Package: Ogg
-Version: >= 1.0
-Plugins: ogg (oggdemux, oggmux)
-URL: http://xiph.org/ogg/
-DebianPackage: libogg-dev
-
-Package: Pango
-Plugins: pango
-DebianPackage: libpango1.0-dev
-URL: http://www.pango.org/
-
-Package: Theora
-Plugins: theora (theoradec, theoraenc)
-URL: http://www.theora.org/
-DebianPackage: libtheora-dev
-
-Package: Vorbis
-Plugins: vorbis (vorbisdec, vorbisenc)
-DebianPackage: libvorbis-dev
-URL: http://www.vorbis.com/
-
Package: drm
Plugins: xvboimagesink
DebianPackage: libdrm-dev
diff --git a/autogen.sh b/autogen.sh
index 19bc2fd1..eef5d615 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -2,8 +2,8 @@
# Run this to generate all the initial makefiles, etc.
DIE=0
-package=gst-plugins-base
-srcfile=gst/audiotestsrc/gstaudiotestsrc.c
+package=gst-plugins-xvbo
+srcfile=sys/xvboimage/xvboimagesink.c
# Make sure we have common
if test ! -f common/gst-autogen.sh;
diff --git a/configure.ac b/configure.ac
index 892831e6..1dc94c23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,9 +5,9 @@ dnl please read gstreamer/docs/random/autotools before changing this file
dnl initialize autoconf
dnl releases only do -Wall, git and prerelease does -Werror too
dnl use a three digit version number for releases, and four for git/prerelease
-AC_INIT(GStreamer Base Plug-ins, 0.10.26.3,
+AC_INIT(GStreamer XVBO Plug-in, 0.10.26.3,
http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer,
- gst-plugins-base)
+ gst-plugins-xvbo)
AG_GST_INIT
@@ -21,7 +21,7 @@ dnl check if this is a release version
AS_NANO(GST_GIT="no", GST_GIT="yes")
dnl can autoconf find the source ?
-AC_CONFIG_SRCDIR([gst/audiotestsrc/gstaudiotestsrc.c])
+AC_CONFIG_SRCDIR([sys/xvboimage/xvboimagesink.c])
dnl define the output header for config
AM_CONFIG_HEADER([config.h])
@@ -38,14 +38,6 @@ dnl we override it here if we need to for the release candidate of new series
GST_MAJORMINOR=0.10
AC_SUBST(GST_MAJORMINOR)
-dnl CURRENT, REVISION, AGE
-dnl - library source changed -> increment REVISION
-dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
-dnl - interfaces added -> increment AGE
-dnl - interfaces removed -> AGE = 0
-dnl sets GST_LT_LDFLAGS
-AS_LIBTOOL(GST, 19, 1, 19)
-
dnl FIXME: this macro doesn't actually work;
dnl the generated libtool script has no support for the listed tags.
dnl So this needs to be fixed first if we want to use this
@@ -69,7 +61,7 @@ dnl set up gettext
dnl the version check needs to stay here because autopoint greps for it
AM_GNU_GETTEXT_VERSION([0.17])
AM_GNU_GETTEXT([external])
-AG_GST_GETTEXT([gst-plugins-base-$GST_MAJORMINOR])
+AG_GST_GETTEXT([gst-plugins-xvbo-$GST_MAJORMINOR])
dnl *** check for arguments to configure ***
@@ -107,10 +99,6 @@ AC_SUBST(GST_INSTALL_PLUGINS_HELPER)
AG_GST_ARG_WITH_PLUGINS
-AG_GST_ARG_ENABLE_EXTERNAL
-
-AG_GST_ARG_ENABLE_EXPERIMENTAL
-
dnl *** checks for platform ***
dnl * hardware/architecture *
@@ -165,41 +153,6 @@ dnl used in gst/ffmpegcolorspace/mem.c
dnl FIXME: could be fixed by redefining av_malloc and av_free to GLib's
AC_CHECK_HEADERS([malloc.h])
-ac_cppflags_save="$CPPFLAGS"
-CPPFLAGS="`$PKG_CONFIG --cflags libxml-2.0`"
-AC_COMPILE_IFELSE(
- AC_LANG_PROGRAM([
-#include <libxml/HTMLparser.h>
- ],[
-#ifndef LIBXML_HTML_ENABLED
-#error libxml2 has no HTML support
-#endif /* LIBXML_HTML_ENABLED */
- ]), HAVE_LIBXML_HTML="yes", HAVE_LIBXML_HTML="no")
-CPPFLAGS="$ac_cppflags_save"
-AM_CONDITIONAL(HAVE_LIBXML_HTML, test "x$HAVE_LIBXML_HTML" = "xyes")
-
-dnl used in gst/tcp
-AC_CHECK_HEADERS([sys/socket.h],
- HAVE_SYS_SOCKET_H="yes", HAVE_SYS_SOCKET_H="no")
-AM_CONDITIONAL(HAVE_SYS_SOCKET_H, test "x$HAVE_SYS_SOCKET_H" = "xyes")
-
-dnl used in gst-libs/gst/rtsp
-AC_CHECK_HEADERS([winsock2.h], HAVE_WINSOCK2_H=yes)
-if test "x$HAVE_WINSOCK2_H" = "xyes"; then
- WIN32_LIBS="-lws2_32"
- AC_SUBST(WIN32_LIBS)
-fi
-
-dnl check for hstrerror, for gst-libs/gst/rtsp
-save_libs="$LIBS"
-AC_CHECK_FUNC(hstrerror, ,
- AC_CHECK_LIB(resolv, hstrerror, ,
- [AC_DEFINE(NO_HSTRERROR, 1,
- [Define if you have no native hstrerror() function.])]))
-HSTRERROR_LIBS=$LIBS
-AC_SUBST(HSTRERROR_LIBS)
-LIBS="$save_libs"
-
dnl used in gst-libs/gst/pbutils and associated unit test
AC_CHECK_HEADERS([process.h sys/types.h sys/wait.h sys/stat.h])
@@ -210,27 +163,14 @@ AX_CREATE_STDINT_H
dnl *** checks for functions ***
AC_CHECK_FUNCS([localtime_r gmtime_r])
-dnl *** checks for math functions ***
-LIBS_SAVE=$LIBS
-LIBS="$LIBS $LIBM"
-AC_CHECK_FUNCS(cbrt)
-LIBS=$LIBS_SAVE
-
dnl *** checks for types/defines ***
-dnl Check for FIONREAD ioctl declaration
-dnl used in gst/tcp
-GST_CHECK_FIONREAD
-
dnl *** checks for structures ***
dnl *** checks for compiler characteristics ***
dnl *** checks for library functions ***
-dnl check for fseeko()
-AC_FUNC_FSEEKO
-
dnl Check for fast float to int casting as defined in C99
dnl used in gst-libs/gst/floatcast/floatcast.h
save_libs=$LIBS
@@ -251,12 +191,6 @@ dnl *** checks for dependency libraries ***
dnl GLib is required
AG_GST_GLIB_CHECK([2.18])
-dnl liboil is required
-PKG_CHECK_MODULES(LIBOIL, liboil-0.3 >= 0.3.14, HAVE_LIBOIL=yes, HAVE_LIBOIL=no)
-if test "x$HAVE_LIBOIL" != "xyes"; then
- AC_ERROR([liboil-0.3.14 or later is required])
-fi
-
dnl checks for gstreamer
dnl uninstalled is selected preferentially -- see pkg-config(1)
AG_GST_CHECK_GST($GST_MAJORMINOR, [$GST_REQ], yes)
@@ -272,21 +206,6 @@ GST_PREFIX="`$PKG_CONFIG --variable=prefix gstreamer-$GST_MAJORMINOR`"
AC_SUBST(GLIB_PREFIX)
AC_SUBST(GST_PREFIX)
-dnl GTK is optional and only used in examples
-PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.14.0, HAVE_GTK=yes, HAVE_GTK=no)
-AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
-
-dnl some examples need gtk+-x11
-PKG_CHECK_MODULES(GTK_X11, gtk+-x11-2.0 >= 2.14.0,
- HAVE_GTK_X11=yes, HAVE_GTK_X11=no)
-AM_CONDITIONAL(HAVE_GTK_X11, test "x$HAVE_GTK_X11" = "xyes")
-
-dnl QT is optional and only used in examples
-PKG_CHECK_MODULES(QT, QtGui >= 4.0, HAVE_QT=yes, HAVE_QT=no)
-AM_CONDITIONAL(HAVE_QT, test "x$HAVE_QT" = "xyes")
-PKG_CHECK_MODULES(QT, QtGui >= 4.6, HAVE_QT_GV=yes, HAVE_QT_GV=no)
-AM_CONDITIONAL(HAVE_QT_GV, test "x$HAVE_QT_GV" = "xyes")
-
dnl *** set variables based on configure arguments ***
dnl set license and copyright notice
@@ -306,115 +225,13 @@ AG_GST_SET_ERROR_CXXFLAGS($GST_GIT)
dnl define correct level for debugging messages
AG_GST_SET_LEVEL_DEFAULT($GST_GIT)
-dnl used in examples
-AG_GST_DEFAULT_ELEMENTS
-
-dnl behaviour of speex based audio resampler
-AC_MSG_CHECKING(which audio resample format to use for integer)
-AC_ARG_WITH([audioresample_format],
- AS_HELP_STRING([--with-audioresample-format],[Which implementation should be used for integer audio resampling, int/float/auto, (default is auto)]),
- [ac_cv_audioresample_format=$withval], [ac_cv_audioresample_format=auto])dnl
-AC_MSG_RESULT($ac_cv_audioresample_format)
-case $ac_cv_audioresample_format in
- int)
- AC_DEFINE(AUDIORESAMPLE_FORMAT_INT,1,[The int implementation should be used for integer audio resampling])
- AC_SUBST(AUDIORESAMPLE_FORMAT_INT)
- ;;
- float)
- AC_DEFINE(AUDIORESAMPLE_FORMAT_FLOAT,1,[The float implementation should be used for integer audio resampling])
- AC_SUBST(AUDIORESAMPLE_FORMAT_FLOAT)
- ;;
- auto)
- AC_DEFINE(AUDIORESAMPLE_FORMAT_AUTO,1,[The implementation that should be used for integer audio resampling witll be benchmarked at runtime])
- AC_SUBST(AUDIORESAMPLE_FORMAT_AUTO)
-esac
-AM_CONDITIONAL(AUDIORESAMPLE_NEEDS_LIBOIL, test "$ac_cv_audioresample_format" = "auto")
-
dnl *** plug-ins to include ***
-dnl these are all the gst plug-ins, compilable without additional libs
-AG_GST_CHECK_PLUGIN(adder)
-AG_GST_CHECK_PLUGIN(app)
-AG_GST_CHECK_PLUGIN(audioconvert)
-AG_GST_CHECK_PLUGIN(audiorate)
-AG_GST_CHECK_PLUGIN(audiotestsrc)
-AG_GST_CHECK_PLUGIN(ffmpegcolorspace)
-AG_GST_CHECK_PLUGIN(gdp)
-AG_GST_CHECK_PLUGIN(playback)
-AG_GST_CHECK_PLUGIN(audioresample)
-AG_GST_CHECK_PLUGIN(subparse)
-AG_GST_CHECK_PLUGIN(tcp)
-AG_GST_CHECK_PLUGIN(typefind)
-AG_GST_CHECK_PLUGIN(videotestsrc)
-AG_GST_CHECK_PLUGIN(videorate)
-AG_GST_CHECK_PLUGIN(videoscale)
-AG_GST_CHECK_PLUGIN(volume)
-
dnl check for gstreamer core features (subsystems)
GST_CONFIGPATH=`$PKG_CONFIG --variable=includedir gstreamer-0.10`"/gst/gstconfig.h"
AG_GST_PARSE_SUBSYSTEM_DISABLES($GST_CONFIGPATH)
AM_CONDITIONAL(USE_XML, test $GST_DISABLE_XML != "1")
-dnl disable plug-ins that require libxml2's HTML support if it is not available
-if test "x$HAVE_LIBXML_HTML" != "xyes"; then
- AG_GST_DISABLE_PLUGIN(subparse)
-fi
-
-dnl disable plug-ins that require sys/socket.h if it is not available
-if test "x$HAVE_SYS_SOCKET_H" != "xyes"; then
- AG_GST_DISABLE_PLUGIN(tcp)
-fi
-
-dnl iso-codes is optional, used by libgsttag
-AC_ARG_ENABLE(iso-codes,
-AC_HELP_STRING([--enable-iso-codes],[use iso-codes if installed]),
-[case "${enableval}" in
- yes) enable_iso_codes=yes ;;
- no) enable_iso_codes=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-iso-codes) ;;
-esac
-],
-[enable_iso_codes=yes]) dnl Default value
-
-AC_MSG_CHECKING([whether to use iso-codes if they are available])
-if test "x$enable_iso_codes" = "xyes"; then
- AC_MSG_RESULT([yes])
- have_iso_codes=no
- AC_MSG_CHECKING([whether iso-codes are available on this system])
- if $PKG_CONFIG iso-codes; then
- AC_MSG_RESULT([yes])
- AC_MSG_CHECKING([whether iso-codes has iso-639 domain])
- if $PKG_CONFIG --variable=domains iso-codes | $GREP -q 639 ; then
- AC_MSG_RESULT([yes])
- AC_MSG_CHECKING([for iso-codes prefix])
- ISO_CODES_PREFIX=`$PKG_CONFIG --variable=prefix iso-codes`
- if test -d "$ISO_CODES_PREFIX"; then
- AC_MSG_RESULT([yes])
- AC_MSG_CHECKING([ISO_CODES_PREFIX])
- AC_MSG_RESULT([$ISO_CODES_PREFIX])
- ISO_639_DOMAIN="iso_639"
- AC_MSG_CHECKING([ISO_639_DOMAIN])
- AC_MSG_RESULT([$ISO_639_DOMAIN])
- have_iso_codes=yes
- AC_DEFINE([HAVE_ISO_CODES], [1], [make use of iso-codes for ISO-639])
- AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX], ["$ISO_CODES_PREFIX"], [prefix])
- ISO_CODES_VERSION=`$PKG_CONFIG --modversion iso-codes`
- AC_DEFINE_UNQUOTED([ISO_CODES_VERSION], ["$ISO_CODES_VERSION"], [ ])
- else
- AC_MSG_RESULT([no])
- fi
- else
- AC_MSG_RESULT([no])
- fi
- else
- AC_MSG_RESULT([no])
- fi
- AM_CONDITIONAL(USE_ISO_CODES, test "x$have_iso_codes" = "xyes")
-else
- AC_MSG_RESULT([no (disabled via --disable-iso-codes)])
- AM_CONDITIONAL(USE_ISO_CODES, false)
-fi
-
dnl *** sys plug-ins ***
echo
@@ -423,8 +240,7 @@ echo
dnl *** X11 ***
translit(dnm, m, l) AM_CONDITIONAL(USE_X, true)
-AG_GST_CHECK_FEATURE(X, [X libraries and plugins],
- [ximagesink], [
+AG_GST_CHECK_FEATURE(X, [X libraries and plugins], , [
AC_PATH_XTRA
ac_cflags_save="$CFLAGS"
ac_cppflags_save="$CPPFLAGS"
@@ -453,8 +269,7 @@ AG_GST_CHECK_FEATURE(X, [X libraries and plugins],
dnl Check for Xv extension
translit(dnm, m, l) AM_CONDITIONAL(USE_XVIDEO, true)
-AG_GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions],
- [xvimagesink], [
+AG_GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions], , [
AG_GST_CHECK_XV
])
@@ -502,272 +317,6 @@ AG_GST_CHECK_FEATURE(XVBO, [XVBO buffer passing], [xvboimagesink], [
AC_SUBST(LIBDRM_LIBS)
])
-dnl v4l/v4l2 checks have been moved down because they require X
-
-dnl *** Video 4 Linux ***
-dnl for information about the header/define, see sys/v4l/gstv4lelement.h
-dnl renamed to GST_V4L in accordance with V4L2 below
-translit(dnm, m, l) AM_CONDITIONAL(USE_GST_V4L, true)
-AG_GST_CHECK_FEATURE(GST_V4L, [Video 4 Linux], video4linux, [
- AC_CHECK_DECL(VID_TYPE_MPEG_ENCODER, HAVE_GST_V4L="yes", HAVE_GST_V4L="no", [
-#include <sys/types.h>
-#define _LINUX_TIME_H
-#define __user
-#include <linux/videodev.h>
- ])
-
- dnl we can build v4l without Xv, but then we won't have XOverlay support
- if test "x$HAVE_GST_V4L" = "xyes" -a "x$HAVE_XVIDEO" != "xyes"
- then
- AC_MSG_NOTICE([NO XVIDEO FOUND, VIDEO4LINUX WILL BE BUILT])
- AC_MSG_NOTICE([WITHOUT XOVERLAY SUPPORT])
- fi
-])
-
-# Optional gudev for device probing
-AC_ARG_WITH([gudev],
- AC_HELP_STRING([--with-gudev],
- [device detection with gudev]),
- [],
- [with_gudev=check])
-if test x$HAVE_GST_V4L = xyes; then
- if test x$with_gudev != xno; then
- PKG_CHECK_MODULES(GUDEV, [ gudev-1.0 >= 143 ],
- [ have_gudev=yes
- AC_DEFINE(HAVE_GUDEV, 1,
- [Whether gudev is available for device detection])
- AC_DEFINE([G_UDEV_API_IS_SUBJECT_TO_CHANGE], 1, [I know the API is subject to change.])
- ], [
- have_gudev=no
- ])
- else
- have_gudev=no
- fi
-fi
-AC_SUBST(GUDEV_CFLAGS)
-AC_SUBST(GUDEV_LIBS)
-
-dnl *** ext plug-ins ***
-dnl keep this list sorted alphabetically !
-
-if test "x$BUILD_EXTERNAL" = "xyes"; then
-
-echo
-AC_MSG_NOTICE([Checking libraries for plugins in ext/])
-echo
-
-dnl *** alsa ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_ALSA, true)
-AG_GST_CHECK_FEATURE(ALSA, [ALSA], alsa, [
- PKG_CHECK_MODULES(ALSA, alsa >= 0.9.1, [
- HAVE_ALSA="yes"
- AC_SUBST(ALSA_CFLAGS)
- AC_SUBST(ALSA_LIBS)
- ], [
- AM_PATH_ALSA(0.9.1, HAVE_ALSA="yes", HAVE_ALSA="no")
- ])
-])
-
-dnl *** CDParanoia ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_CDPARANOIA, true)
-AG_GST_CHECK_FEATURE(CDPARANOIA, [CDParanoia], cdparanoia, [
- AG_GST_CHECK_LIBHEADER(CDPARANOIA, cdda_interface,
- cdda_open, -lm,
- cdda_interface.h,
- CDPARANOIA_LIBS="-lcdda_interface -lcdda_paranoia"
- HEADER_DIR="no"
- FOUND_CDPARANOIA="yes")
- if test "x$FOUND_CDPARANOIA" != "xyes";
- then
- AG_GST_CHECK_LIBHEADER(CDPARANOIA, cdda_interface,
- cdda_open, -lm,
- cdda/cdda_interface.h,
- CDPARANOIA_LIBS="-lcdda_interface -lcdda_paranoia"
- HEADER_DIR="yes"
- FOUND_CDPARANOIA="yes")
- fi
- if test "x$HEADER_DIR" = "xyes";
- then
- AC_DEFINE_UNQUOTED(CDPARANOIA_HEADERS_IN_DIR, ,
- defined if cdda headers are in a cdda/ directory)
- fi
- if test "x$FOUND_CDPARANOIA" = "xyes";
- then
- AC_CHECK_LIB(cdda_paranoia,
- paranoia_cachemodel_size,
- : ,
- HAVE_CDPARANOIA=no)
- fi
-
- AC_SUBST(CDPARANOIA_LIBS)
-])
-dnl FIXME : add second check somehow if that is necessary
-dnl AC_CHECK_LIB(cdda_paranoia, paranoia_init, : , HAVE_CDPARANOIA=no, -lcdda_interface )
-dnl AC_CHECK_HEADER(cdda_paranoia.h, :, HAVE_CDPARANOIA=no)
-
-dnl *** GNOME VFS ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_GNOME_VFS, true)
-AG_GST_CHECK_FEATURE(GNOME_VFS, [GNOME VFS], gnomevfs, [
- PKG_CHECK_MODULES(GNOME_VFS, gnome-vfs-2.0, [
- HAVE_GNOME_VFS="yes"
- AC_SUBST(GNOME_VFS_CFLAGS)
- AC_SUBST(GNOME_VFS_LIBS)
- GNOME_VFS_MODULES_DIR="`$PKG_CONFIG --variable=modulesdir gnome-vfs-2.0`"
- AC_DEFINE_UNQUOTED(GNOME_VFS_MODULES_DIR, "$GNOME_VFS_MODULES_DIR",
- [The GnomeVFS modules directory.])
- ],[
- HAVE_GNOME_VFS="no"
- ]
- )
-])
-
-dnl *** ivorbis ***
-dnl AM_PATH_IVORBIS only takes two options
-translit(dnm, m, l) AM_CONDITIONAL(USE_IVORBIS, true)
-AG_GST_CHECK_FEATURE(IVORBIS, [integer vorbis plug-in], ivorbisdec, [
- AG_GST_PKG_CHECK_MODULES(IVORBIS, vorbisidec)
- if test $HAVE_IVORBIS = no
- then
- IVORBIS_LIBS=
- IVORBIS_CFLAGS=
- AC_CHECK_LIB(vorbisidec, vorbis_block_init,
- [IVORBIS_LIBS=-lvorbisidec
- HAVE_IVORBIS=yes
- case $host in
- arm-*-*)
- IVORBIS_CFLAGS="-D_ARM_ASSEM_ $IVORBIS_CFLAGS"
- esac
- ],
- HAVE_IVORBIS=no)
- AC_SUBST(IVORBIS_LIBS)
- AC_SUBST(IVORBIS_CFLAGS)
- fi
-])
-
-dnl *** libgio ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_GIO, true)
-AG_GST_CHECK_FEATURE(GIO, [GIO library], gio, [
- PKG_CHECK_MODULES(GIO, gio-2.0 >= 2.16, [
- HAVE_GIO="yes"
- GIO_MODULE_DIR="`$PKG_CONFIG --variable=giomoduledir gio-2.0`"
- AC_DEFINE_UNQUOTED(GIO_MODULE_DIR, "$GIO_MODULE_DIR",
- [The GIO modules directory.])
- GIO_LIBDIR="`$PKG_CONFIG --variable=libdir gio-2.0`"
- AC_DEFINE_UNQUOTED(GIO_LIBDIR, "$GIO_LIBDIR",
- [The GIO library directory.])
- ], [
- HAVE_GIO="no"
- AC_MSG_RESULT(no)
- ])
- AC_SUBST(GIO_CFLAGS)
- AC_SUBST(GIO_LIBS)
- AC_SUBST(GIO_LDFLAGS)
-])
-
-dnl *** libvisual ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_LIBVISUAL, true)
-AG_GST_CHECK_FEATURE(LIBVISUAL, [libvisual visualization library], libvisual, [
- AG_GST_PKG_CHECK_MODULES(LIBVISUAL, libvisual-0.4 >= 0.4.0)
- if test $HAVE_LIBVISUAL = no
- then
- AG_GST_PKG_CHECK_MODULES(LIBVISUAL, libvisual = 0.2.0)
- if test x$HAVE_LIBVISUAL == xyes; then
- LIBVIS_PLUGINSDIR="`$PKG_CONFIG --variable=pluginsbasedir libvisual-0.2`"
- fi
- else
- if test x$HAVE_LIBVISUAL == xyes; then
- LIBVIS_PLUGINSDIR="`$PKG_CONFIG --variable=pluginsbasedir libvisual-0.4`"
- fi
- fi
- AC_MSG_NOTICE([libvisual pluginsdir: $LIBVIS_PLUGINSDIR])
- if test x$LIBVIS_PLUGINSDIR != x; then
- AC_DEFINE_UNQUOTED(LIBVISUAL_PLUGINSBASEDIR,
- "$LIBVIS_PLUGINSDIR",
- [directory in which the detected libvisual's plugins are located])
- fi
-])
-
-dnl *** ogg ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_OGG, true)
-AG_GST_CHECK_FEATURE(OGG, [Xiph Ogg library], ogg, [
- AG_GST_PKG_CHECK_MODULES(OGG, ogg >= 1.0)
- if test $HAVE_OGG = no
- then
- XIPH_PATH_OGG(HAVE_OGG="yes", HAVE_OGG="no")
- AS_SCRUB_INCLUDE(OGG_CFLAGS)
- fi
-])
-
-dnl *** pango ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_PANGO, true)
-AG_GST_CHECK_FEATURE(PANGO, [Pango font rendering], pango, [
- AG_GST_PKG_CHECK_MODULES(PANGO, pango >= 1.16.0 pangocairo >= 1.16.0)
-])
-
-dnl *** theora ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_THEORA, true)
-AG_GST_CHECK_FEATURE(THEORA, [Xiph Theora video codec], theora, [
- dnl theora uses pkg-config version incorrectly, for pkg-config:
- dnl 1.0 < 1.0RCX < 1.0alphaX < 1.0betaX < 1.0.0
- dnl theoraenc and theoradec appeared in 1.0beta3
-
- AG_GST_PKG_CHECK_MODULES(THEORA, theoradec theoraenc)
-])
-
-dnl *** vorbis ***
-dnl AM_PATH_VORBIS only takes two options
-translit(dnm, m, l) AM_CONDITIONAL(USE_VORBIS, true)
-AG_GST_CHECK_FEATURE(VORBIS, [Xiph Vorbis audio codec], vorbis, [
- AG_GST_PKG_CHECK_MODULES(VORBIS, vorbis >= 1.0 vorbisenc >= 1.0)
- if test $HAVE_VORBIS = no
- then
- XIPH_PATH_VORBIS(HAVE_VORBIS="yes", HAVE_VORBIS="no")
- AS_SCRUB_INCLUDE(VORBIS_CFLAGS)
- fi
-])
-
-if test "x$HAVE_VORBIS" = "xyes"; then
- ac_cflags_save="$CFLAGS"
- AC_COMPILE_IFELSE(
- AC_LANG_PROGRAM([
-#include <vorbis/codec.h>
- ],[
-vorbis_dsp_state *v;
-
-vorbis_synthesis_restart (v);
- ]), HAVE_VSR=yes, HAVE_VSR=no)
- if test "x$HAVE_VSR" = "xyes"; then
- AC_DEFINE_UNQUOTED(HAVE_VORBIS_SYNTHESIS_RESTART, 1,
- [defined if vorbis_synthesis_restart is present])
- fi
- CFLAGS="$ac_cflags_save"
-fi
-
-else
-
-dnl not building plugins with external dependencies,
-dnl but we still need to set the conditionals
-AM_CONDITIONAL(USE_ALSA, false)
-AM_CONDITIONAL(USE_CDPARANOIA, false)
-AM_CONDITIONAL(USE_GNOME_VFS, false)
-AM_CONDITIONAL(USE_GIO, false)
-AM_CONDITIONAL(USE_LIBVISUAL, false)
-AM_CONDITIONAL(USE_OGG, false)
-AM_CONDITIONAL(USE_PANGO, false)
-AM_CONDITIONAL(USE_THEORA, false)
-AM_CONDITIONAL(USE_VORBIS, false)
-
-fi dnl of EXT plugins
-
-dnl seeking needs freetype, so check for it here
-PKG_CHECK_MODULES(FT2, freetype2 >= 2.0.9, HAVE_FT2="yes", [
- AC_CHECK_FT2(2.0.9, HAVE_FT2="yes", HAVE_FT2="no")
-])
-dnl make the HAVE_FT2 variable available to automake and Makefile.am
-AM_CONDITIONAL(HAVE_FT2, test "x$HAVE_FT2" = "xyes")
-AC_SUBST(FT2_CFLAGS)
-AC_SUBST(FT2_LIBS)
-
dnl *** finalize CFLAGS, LDFLAGS, LIBS
dnl Overview:
@@ -777,7 +326,6 @@ dnl GST_PLUGINS_BASE_CFLAGS: to link internally against the plugins base libs
dnl (compare to other modules) or for i18n
dnl GST_ALL_LDFLAGS: linker flags shared by all
dnl GST_LIB_LDFLAGS: additional linker flags for all libaries
-dnl GST_LT_LDFLAGS: library versioning of our libraries
dnl GST_PLUGIN_LDFLAGS: flags to be used for all plugins
dnl GST_OPTION_CFLAGS
@@ -801,15 +349,6 @@ GST_OPTION_CXXFLAGS="\$(ERROR_CXXFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(G
AC_SUBST(GST_OPTION_CFLAGS)
AC_SUBST(GST_OPTION_CXXFLAGS)
-dnl our libraries need to be versioned correctly
-AC_SUBST(GST_LT_LDFLAGS)
-
-dnl GST_PLUGINS_BASE_CFLAGS
-dnl prefer internal headers to already installed ones
-dnl also add builddir include for enumtypes and marshal
-GST_PLUGINS_BASE_CFLAGS="-I\$(top_srcdir)/gst-libs -I\$(top_builddir)/gst-libs"
-AC_SUBST(GST_PLUGINS_BASE_CFLAGS)
-
dnl FIXME: do we want to rename to GST_ALL_* ?
dnl add GST_OPTION_CFLAGS, but overridable
GST_CXXFLAGS="$GST_CFLAGS \$(GST_OPTION_CXXFLAGS)"
@@ -845,102 +384,11 @@ AC_CONFIG_FILES(
Makefile
common/shave
common/shave-libtool
-gst-plugins-base.spec
-gst/Makefile
-gst/adder/Makefile
-gst/app/Makefile
-gst/audioconvert/Makefile
-gst/audiorate/Makefile
-gst/audiotestsrc/Makefile
-gst/ffmpegcolorspace/Makefile
-gst/gdp/Makefile
-gst/playback/Makefile
-gst/audioresample/Makefile
-gst/subparse/Makefile
-gst/tcp/Makefile
-gst/typefind/Makefile
-gst/videotestsrc/Makefile
-gst/videorate/Makefile
-gst/videoscale/Makefile
-gst/volume/Makefile
+gst-plugins-xvbo.spec
sys/Makefile
-sys/ximage/Makefile
sys/xvboimage/Makefile
-sys/xvimage/Makefile
-sys/v4l/Makefile
-ext/Makefile
-ext/alsa/Makefile
-ext/cdparanoia/Makefile
-ext/gnomevfs/Makefile
-ext/gio/Makefile
-ext/libvisual/Makefile
-ext/ogg/Makefile
-ext/pango/Makefile
-ext/theora/Makefile
-ext/vorbis/Makefile
-gst-libs/Makefile
-gst-libs/gst/Makefile
-gst-libs/gst/audio/Makefile
-gst-libs/gst/app/Makefile
-gst-libs/gst/cdda/Makefile
-gst-libs/gst/fft/Makefile
-gst-libs/gst/floatcast/Makefile
-gst-libs/gst/interfaces/Makefile
-gst-libs/gst/netbuffer/Makefile
-gst-libs/gst/riff/Makefile
-gst-libs/gst/rtp/Makefile
-gst-libs/gst/rtsp/Makefile
-gst-libs/gst/sdp/Makefile
-gst-libs/gst/tag/Makefile
-gst-libs/gst/pbutils/Makefile
-gst-libs/gst/video/Makefile
-tools/Makefile
-pkgconfig/Makefile
-pkgconfig/gstreamer-audio.pc
-pkgconfig/gstreamer-audio-uninstalled.pc
-pkgconfig/gstreamer-app.pc
-pkgconfig/gstreamer-app-uninstalled.pc
-pkgconfig/gstreamer-cdda.pc
-pkgconfig/gstreamer-cdda-uninstalled.pc
-pkgconfig/gstreamer-fft.pc
-pkgconfig/gstreamer-fft-uninstalled.pc
-pkgconfig/gstreamer-floatcast.pc
-pkgconfig/gstreamer-floatcast-uninstalled.pc
-pkgconfig/gstreamer-interfaces.pc
-pkgconfig/gstreamer-interfaces-uninstalled.pc
-pkgconfig/gstreamer-netbuffer.pc
-pkgconfig/gstreamer-netbuffer-uninstalled.pc
-pkgconfig/gstreamer-pbutils.pc
-pkgconfig/gstreamer-pbutils-uninstalled.pc
-pkgconfig/gstreamer-riff.pc
-pkgconfig/gstreamer-riff-uninstalled.pc
-pkgconfig/gstreamer-rtp.pc
-pkgconfig/gstreamer-rtp-uninstalled.pc
-pkgconfig/gstreamer-rtsp.pc
-pkgconfig/gstreamer-rtsp-uninstalled.pc
-pkgconfig/gstreamer-sdp.pc
-pkgconfig/gstreamer-sdp-uninstalled.pc
-pkgconfig/gstreamer-tag.pc
-pkgconfig/gstreamer-tag-uninstalled.pc
-pkgconfig/gstreamer-video.pc
-pkgconfig/gstreamer-video-uninstalled.pc
-pkgconfig/gstreamer-plugins-base.pc
-pkgconfig/gstreamer-plugins-base-uninstalled.pc
-tests/Makefile
-tests/check/Makefile
-tests/examples/Makefile
-tests/examples/app/Makefile
-tests/examples/dynamic/Makefile
-tests/examples/overlay/Makefile
-tests/examples/seek/Makefile
-tests/examples/volume/Makefile
-tests/examples/snapshot/Makefile
-tests/examples/gio/Makefile
-tests/examples/v4l/Makefile
-tests/icles/Makefile
docs/Makefile
docs/design/Makefile
-docs/libs/Makefile
docs/plugins/Makefile
docs/version.entities
po/Makefile.in
@@ -949,51 +397,6 @@ common/m4/Makefile
m4/Makefile
)
-dnl Create the config.h file for Visual Studio builds
-dnl Beware of spaces and /'s in some of the shell variable contents.
-sed \
- -e 's/.*config.h.in.*autoheader.*/\/* Autogenerated config.h created for win32 Visual Studio builds *\/\n\n\/* PREFIX -- specifically added for Windows for easier moving *\/\n#define PREFIX "C:\\\\gstreamer"/' \
- -e 's/.* GST_INSTALL_PLUGINS_HELPER/#define GST_INSTALL_PLUGINS_HELPER PREFIX "\\\\libexec\\\\gst-install-plugins-helper.exe"/' \
- -e 's/.* GETTEXT_PACKAGE$/#define GETTEXT_PACKAGE "'$GETTEXT_PACKAGE'"/' \
- -e 's/.* GST_DATADIR$/#define GST_DATADIR PREFIX "\\\\share"/' \
- -e 's/.* GST_LEVEL_DEFAULT$/#define GST_LEVEL_DEFAULT GST_LEVEL_ERROR/' \
- -e 's/.* GST_LICENSE$/#define GST_LICENSE "'$GST_LICENSE'"/' \
- -e 's/.* GST_MAJORMINOR$/#define GST_MAJORMINOR "'$GST_MAJORMINOR'"/' \
- -e "s,.* GST_PACKAGE_NAME$,#define GST_PACKAGE_NAME \"${GST_PACKAGE_NAME}\"," \
- -e 's/.* GST_PACKAGE_ORIGIN$/#define GST_PACKAGE_ORIGIN "Unknown package origin"/' \
- -e 's/.* HAVE_CPU_I386$/#define HAVE_CPU_I386 1/' \
- -e 's/.* HAVE_FGETPOS$/#define HAVE_FGETPOS 1/' \
- -e 's/.* HAVE_FSETPOS$/#define HAVE_FSETPOS 1/' \
- -e 's/.* HAVE_ISO_CODES$/#undef HAVE_ISO_CODES/' \
- -e 's/.* HAVE_LIBXML2$/#define HAVE_LIBXML2 1/' \
- -e 's/.* HAVE_PROCESS_H$/#define HAVE_PROCESS_H 1/' \
- -e 's/.* HAVE_STDLIB_H$/#define HAVE_STDLIB_H 1/' \
- -e 's/.* HAVE_STRING_H$/#define HAVE_STRING_H 1/' \
- -e 's/.* HAVE_SYS_STAT_H$/#define HAVE_SYS_STAT_H 1/' \
- -e 's/.* HAVE_SYS_TYPES_H$/#define HAVE_SYS_TYPES_H 1/' \
- -e 's/.* HAVE_WIN32$/#define HAVE_WIN32 1/' \
- -e 's/.* HAVE_WINSOCK2_H$/#define HAVE_WINSOCK2_H 1/' \
- -e 's/.* HOST_CPU$/#define HOST_CPU "i686"/' \
- -e 's/.* ISO_CODES_PREFIX$/#undef ISO_CODES_PREFIX/' \
- -e 's/.* ISO_CODES_VERSION$/#undef ISO_CODES_VERSION/' \
- -e 's/.* LIBDIR$/#ifdef _DEBUG\n# define LIBDIR PREFIX "\\\\debug\\\\lib"\n#else\n# define LIBDIR PREFIX "\\\\lib"\n#endif/' \
- -e 's/.* LOCALEDIR$/#define LOCALEDIR PREFIX "\\\\share\\\\locale"/' \
- -e "s/.* PACKAGE$/#define PACKAGE \"$PACKAGE\"/" \
- -e 's/.* PACKAGE_BUGREPORT$/#define PACKAGE_BUGREPORT "http:\/\/bugzilla.gnome.org\/enter_bug.cgi?product=GStreamer"/' \
- -e "s/.* PACKAGE_NAME$/#define PACKAGE_NAME \"$PACKAGE_NAME\"/" \
- -e "s/.* PACKAGE_STRING$/#define PACKAGE_STRING \"$PACKAGE_STRING\"/" \
- -e 's/.* PACKAGE_TARNAME$/#define PACKAGE_TARNAME "'$PACKAGE_TARNAME'"/' \
- -e 's/.* PACKAGE_VERSION$/#define PACKAGE_VERSION "'$PACKAGE_VERSION'"/' \
- -e 's/.* PLUGINDIR$/#ifdef _DEBUG\n# define PLUGINDIR PREFIX "\\\\debug\\\\lib\\\\gstreamer-0.10"\n#else\n# define PLUGINDIR PREFIX "\\\\lib\\\\gstreamer-0.10"\n#endif/' \
- -e 's/.* USE_BINARY_REGISTRY$/#define USE_BINARY_REGISTRY/' \
- -e 's/.* VERSION$/#define VERSION "'$VERSION'"/' \
- -e "s/.* DEFAULT_AUDIOSINK$/#define DEFAULT_AUDIOSINK \"directaudiosink\"/" \
- -e "s/.* DEFAULT_VIDEOSINK$/#define DEFAULT_VIDEOSINK \"directdrawsink\"/" \
- -e "s/.* DEFAULT_VISUALIZER$/#define DEFAULT_VISUALIZER \"goom\"/" \
- config.h.in >win32/common/config.h-new
-
-
-
AC_OUTPUT
AG_GST_OUTPUT_PLUGINS
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 7ae8b996..539690d4 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -8,8 +8,8 @@ else
PLUGIN_DOCS_DIRS = plugins
endif
-SUBDIRS = design libs $(PLUGIN_DOCS_DIRS)
-DIST_SUBDIRS = design libs plugins
+SUBDIRS = design $(PLUGIN_DOCS_DIRS)
+DIST_SUBDIRS = design plugins
EXTRA_DIST = \
design-audiosinks.txt \
diff --git a/docs/libs/.gitignore b/docs/libs/.gitignore
deleted file mode 100644
index cae08594..00000000
--- a/docs/libs/.gitignore
+++ /dev/null
@@ -1,21 +0,0 @@
-*.stamp
-html
-tmpl
-xml
-Makefile
-Makefile.in
-*-decl.txt
-*-decl-list.txt
-*-presed-scan.c
-*-undeclared.txt
-*-undocumented.txt
-*-unused.txt
-*.args
-*.hierarchy
-*.interfaces
-*.prerequisites
-*.signals
-doc-registry.xml
-
-*-unused.sgml
-*.bak
diff --git a/docs/libs/Makefile.am b/docs/libs/Makefile.am
deleted file mode 100644
index d0316268..00000000
--- a/docs/libs/Makefile.am
+++ /dev/null
@@ -1,105 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-# FIXME: fix the docs then remove this variable
-DOCS_ARE_INCOMPLETE_PLEASE_FIXME=yespleasedo
-
-# The name of the module, e.g. 'glib'.
-#DOC_MODULE=gst-plugins-libs-@GST_MAJORMINOR@
-DOC_MODULE=gst-plugins-base-libs
-
-# for upload-doc.mak
-DOC=gst-plugins-base-libs
-FORMATS=html
-html: html-build.stamp
-include $(top_srcdir)/common/upload-doc.mak
-
-# generated basefiles
-#basefiles = \
-## $(DOC_MODULE).types \
-# $(DOC_MODULE)-sections.txt \
-# $(DOC_MODULE)-docs.sgml
-
-# ugly hack to make -unused.sgml work
-#unused-build.stamp:
-# BUILDDIR=`pwd` && \
-# cd $(srcdir)/tmpl && \
-# ln -sf gstreamer-libs-unused.sgml \
-# $$BUILDDIR/tmpl/gstreamer-libs-@GST_MAJORMINOR@-unused.sgml
-# touch unused-build.stamp
-
-# these rules are added to create parallel docs using GST_MAJORMINOR
-#$(basefiles): gstreamer-libs-@GST_MAJORMINOR@%: gstreamer-libs%
-# cp $< $@
-
-#CLEANFILES = $(basefiles)
-
-# The top-level SGML file. Change it if you want.
-DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
-
-# The directory containing the source code. Relative to $(top_srcdir).
-# gtk-doc will search all .c & .h files beneath here for inline comments
-# documenting functions and macros.
-DOC_SOURCE_DIR=$(top_srcdir)/gst-libs/gst
-DOC_BUILD_DIR=$(top_builddir)/gst-libs/gst
-
-# Extra options to supply to gtkdoc-scan.
-SCAN_OPTIONS=--deprecated-guards="GST_DISABLE_DEPRECATED"
-
-# FIXME :
-# there's something wrong with gstreamer-sections.txt not being in the dist
-# maybe it doesn't resolve; we're adding it below for now
-#EXTRA_DIST = gstreamer.types.in gstreamer.hierarchy $(DOC_MODULE)-sections.txt gstreamer-sections.txt $(DOC_MAIN_SGML_FILE)
-
-# Extra options to supply to gtkdoc-mkdb.
-MKDB_OPTIONS=--sgml-mode --output-format=xml
-
-# Extra options to supply to gtkdoc-fixref.
-FIXXREF_OPTIONS=--extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html \
- --extra-dir=$(GST_PREFIX)/share/gtk-doc/html
-
-# Used for dependencies.
-HFILE_GLOB=$(DOC_SOURCE_DIR)/*/*.h
-CFILE_GLOB=$(DOC_SOURCE_DIR)/*/*.c
-
-# this is a wingo addition
-# thomasvs: another nice wingo addition would be an explanation on why
-# this is useful ;)
-
-SCANOBJ_DEPS = \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/cdda/libgstcdda-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/fft/libgstfft-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/rtp/libgstrtp-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/rtsp/libgstrtsp-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/sdp/libgstsdp-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/tag/libgsttag-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/app/libgstapp-@GST_MAJORMINOR@.la
-
-# Header files to ignore when scanning.
-IGNORE_HFILES =
-
-# Images to copy into HTML directory.
-HTML_IMAGES =
-
-# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
-content_files = compiling.sgml
-
-# Other files to distribute.
-extra_files =
-
-# CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib
-# contains GtkObjects/GObjects and you want to document signals and properties.
-GTKDOC_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS)
-GTKDOC_LIBS = $(SCANOBJ_DEPS) $(GST_BASE_LIBS)
-
-GTKDOC_CC=$(LIBTOOL) --tag=CC --mode=compile $(CC)
-GTKDOC_LD=$(LIBTOOL) --tag=CC --mode=link $(CC)
-
-# If you need to override some of the declarations, place them in this file
-# and uncomment this line.
-#DOC_OVERRIDES = $(DOC_MODULE)-overrides.txt
-DOC_OVERRIDES =
-
-include $(top_srcdir)/common/gtk-doc.mak
diff --git a/docs/libs/compiling.sgml b/docs/libs/compiling.sgml
deleted file mode 100644
index 70a130c5..00000000
--- a/docs/libs/compiling.sgml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
- "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
-<!ENTITY % version-entities SYSTEM "version.entities">
-%version-entities;
-]>
-<refentry id="compiling" revision="17 Jan 2002">
-<refmeta>
-<refentrytitle>Compiling</refentrytitle>
-<manvolnum>3</manvolnum>
-<refmiscinfo>GStreamer-Base Library</refmiscinfo>
-</refmeta>
-
-<refnamediv>
-<refname>Compiling against the base plugins libraries</refname>
-<refpurpose>
-How to compile against the base plugins libraries
-</refpurpose>
-</refnamediv>
-
-<refsect1>
-<title>Compiling against the base plugins libraries</title>
-
-<para>
-To compile against these libraries, you need to tell the compiler where to
-find the header files and libraries. This is done with the
-<application>pkg-config</application> utility.
-</para>
-<para>
-The following interactive shell session demonstrates how
-<application>pkg-config</application> is used:
-<programlisting>
-$ pkg-config --cflags gstreamer-plugins-base-&GST_MAJORMINOR;
--D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -pthread -I/usr/include/gstreamer-&GST_MAJORMINOR; -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2
-$ pkg-config --libs gstreamer-plugins-base-&GST_MAJORMINOR;
--Wl,--export-dynamic -pthread -lgstreamer-&GST_MAJORMINOR; -lgobject-2.0 -lgmodule-2.0 -ldl -lgthread-2.0 -lxml2 -lpthread -lz -lm -lglib-2.0
-</programlisting>
-</para>
-
-<para>
-Note that, because of the number of libraries provided in this package,
-the pkg-config information <emphasis>does not add -l flags</emphasis> itself
-to choose the libraries to link to. You must add these yourself to select
-which of the libraries you want to use.
-</para>
-</refsect1>
-
-</refentry>
diff --git a/docs/libs/gst-plugins-base-libs-docs.sgml b/docs/libs/gst-plugins-base-libs-docs.sgml
deleted file mode 100644
index 53823605..00000000
--- a/docs/libs/gst-plugins-base-libs-docs.sgml
+++ /dev/null
@@ -1,235 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
- "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
-<!ENTITY % version-entities SYSTEM "version.entities">
-%version-entities;
-]>
-<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
- <bookinfo>
- <title>GStreamer Base Plugins &GST_MAJORMINOR; Library Reference Manual</title>
- <releaseinfo>
- for GStreamer Base Library &GST_MAJORMINOR; (&GST_VERSION;)
- <ulink role="online-location" url="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/</ulink>.
- </releaseinfo>
- </bookinfo>
-
- <part id="gstreamer-plugins-base">
- <title>GStreamer Base Plugins Libraries</title>
- <para>
- This manual describes the libraries provided by the GStreamer Base Plugins
- package.
- </para>
- <xi:include href="compiling.sgml" />
-
- <chapter id="gstreamer-app">
- <title>App Library</title>
- <para>
- This library should be linked to by getting cflags and libs from
- <filename>gstreamer-plugins-base-&GST_MAJORMINOR;.pc</filename> and adding
- <filename>-lgstapp-&GST_MAJORMINOR;</filename> to the library flags.
- </para>
- <para>
- To use it the functionality, insert an appsrc or appsink element into a pipeline and call the appropriate functions on the element.
- </para>
- <xi:include href="xml/gstappsrc.xml" />
- <xi:include href="xml/gstappsink.xml" />
- </chapter>
-
- <chapter id="gstreamer-audio">
- <title>Audio Library</title>
- <para>
- This library should be linked to by getting cflags and libs from
- <filename>gstreamer-plugins-base-&GST_MAJORMINOR;.pc</filename> and adding
- <filename>-lgstaudio-&GST_MAJORMINOR;</filename> to the library flags.
- </para>
- <xi:include href="xml/gstaudio.xml" />
- <xi:include href="xml/gstaudioclock.xml" />
- <xi:include href="xml/gstaudiofilter.xml" />
- <xi:include href="xml/gstaudiomixerutils.xml" />
- <xi:include href="xml/gstaudiosink.xml" />
- <xi:include href="xml/gstaudiosrc.xml" />
- <xi:include href="xml/gstbaseaudiosink.xml" />
- <xi:include href="xml/gstbaseaudiosrc.xml" />
- <xi:include href="xml/gstmultichannel.xml" />
- <xi:include href="xml/gstringbuffer.xml" />
- </chapter>
-
- <chapter id="gstreamer-cdda">
- <title>CDDA Library</title>
- <para>
- This library should be linked to by getting cflags and libs from
- <filename>gstreamer-plugins-base-&GST_MAJORMINOR;.pc</filename> and adding
- <filename>-lgstcdda-&GST_MAJORMINOR;</filename> to the library flags.
- </para>
- <xi:include href="xml/gstcddabasesrc.xml" />
- </chapter>
-
- <chapter id="gstreamer-ffft">
- <title>FFT Library</title>
- <para>
- The gstfft library is based on
- <ulink role="online-location" url="http://sourceforge.net/projects/kissfft">kissfft</ulink>
- by Mark Borgerding.
- </para>
- <para>
- This library should be linked to by getting cflags and libs from
- <filename>gstreamer-plugins-base-&GST_MAJORMINOR;.pc</filename> and adding
- <filename>-lgstfft-&GST_MAJORMINOR;</filename> to the library flags.
- </para>
- <xi:include href="xml/gstfft.xml" />
- <xi:include href="xml/gstffts16.xml" />
- <xi:include href="xml/gstffts32.xml" />
- <xi:include href="xml/gstfftf32.xml" />
- <xi:include href="xml/gstfftf64.xml" />
- </chapter>
-
- <chapter id="gstreamer-floatcast">
- <title>FloatCast Library</title>
- <para>
- This library should be linked to by getting cflags and libs from
- <filename>gstreamer-plugins-base-&GST_MAJORMINOR;.pc</filename> and adding
- <filename>-lgstfloatcase-&GST_MAJORMINOR;</filename> to the library flags.
- </para>
- <xi:include href="xml/gstfloatcast.xml" />
- </chapter>
-
- <chapter id="gstreamer-interfaces">
- <title>Interfaces Library</title>
- <para>
- This library should be linked to by getting cflags and libs from
- <filename>gstreamer-plugins-base-&GST_MAJORMINOR;.pc</filename> and adding
- <filename>-lgstinterfaces-&GST_MAJORMINOR;</filename> to the library flags.
- </para>
- <xi:include href="xml/gstcolorbalance.xml" />
- <xi:include href="xml/gstcolorbalancechannel.xml" />
- <xi:include href="xml/gstmixer.xml" />
- <xi:include href="xml/gstmixeroptions.xml" />
- <xi:include href="xml/gstmixertrack.xml" />
- <xi:include href="xml/gstnavigation.xml" />
- <xi:include href="xml/gstpropertyprobe.xml" />
- <xi:include href="xml/gststreamvolume.xml" />
- <xi:include href="xml/gsttuner.xml" />
- <xi:include href="xml/gsttunerchannel.xml" />
- <xi:include href="xml/gsttunernorm.xml" />
- <xi:include href="xml/gstvideoorientation.xml" />
- <xi:include href="xml/gstxoverlay.xml" />
- </chapter>
-
- <chapter id="gstreamer-netbuffer">
- <title>Network Buffer Library</title>
- <para>
- This library should be linked to by getting cflags and libs from
- <filename>gstreamer-plugins-base-&GST_MAJORMINOR;.pc</filename> and adding
- <filename>-lgstnetbuffer-&GST_MAJORMINOR;</filename> to the library flags.
- </para>
- <xi:include href="xml/gstnetbuffer.xml" />
- </chapter>
-
- <chapter id="gstreamer-riff">
- <title>Riff Media Library</title>
- <para>
- This library should be linked to by getting cflags and libs from
- <filename>gstreamer-plugins-base-&GST_MAJORMINOR;.pc</filename> and adding
- <filename>-lgstriff-&GST_MAJORMINOR;</filename> to the library flags.
- </para>
- <xi:include href="xml/gstriff.xml" />
- </chapter>
-
- <chapter id="gstreamer-rtp">
- <title>RTP Library</title>
- <para>
- This library should be linked to by getting cflags and libs from
- <filename>gstreamer-plugins-base-&GST_MAJORMINOR;.pc</filename> and adding
- <filename>-lgstrtp-&GST_MAJORMINOR;</filename> to the library flags.
- </para>
- <xi:include href="xml/gstbasertpaudiopayload.xml" />
- <xi:include href="xml/gstbasertpdepayload.xml" />
- <xi:include href="xml/gstbasertppayload.xml" />
- <xi:include href="xml/gstrtpbuffer.xml" />
- <xi:include href="xml/gstrtcpbuffer.xml" />
- <xi:include href="xml/gstrtppayloads.xml" />
- </chapter>
-
- <chapter id="gstreamer-rtsp">
- <title>RTSP Library</title>
- <para>
- This library should be linked to by getting cflags and libs from
- <filename>gstreamer-plugins-base-&GST_MAJORMINOR;.pc</filename> and adding
- <filename>-lgstrtsp-&GST_MAJORMINOR;</filename> to the library flags.
- </para>
- <xi:include href="xml/gstrtspbase64.xml" />
- <xi:include href="xml/gstrtspconnection.xml" />
- <xi:include href="xml/gstrtspdefs.xml" />
- <xi:include href="xml/gstrtspmessage.xml" />
- <xi:include href="xml/gstrtsprange.xml" />
- <xi:include href="xml/gstrtsptransport.xml" />
- <xi:include href="xml/gstrtspurl.xml" />
- </chapter>
-
- <chapter id="gstreamer-sdp">
- <title>SDP Library</title>
- <para>
- This library should be linked to by getting cflags and libs from
- <filename>gstreamer-plugins-base-&GST_MAJORMINOR;.pc</filename> and adding
- <filename>-lgstsdp-&GST_MAJORMINOR;</filename> to the library flags.
- </para>
- <xi:include href="xml/gstsdpmessage.xml" />
- </chapter>
-
- <chapter id="gstreamer-tag">
- <title>Tag Support Library</title>
- <para>
- This library should be linked to by getting cflags and libs from
- <filename>gstreamer-plugins-base-&GST_MAJORMINOR;.pc</filename> and adding
- <filename>-lgsttag-&GST_MAJORMINOR;</filename> to the library flags.
- </para>
- <xi:include href="xml/gsttag.xml" />
- <xi:include href="xml/gsttagvorbis.xml" />
- <xi:include href="xml/gsttagid3.xml" />
- <xi:include href="xml/gsttagdemux.xml" />
- <xi:include href="xml/gsttaglanguagecodes.xml" />
- </chapter>
-
- <chapter id="gstreamer-base-utils">
- <title>Base Utils Library</title>
- <para>
- This library should be linked to by getting cflags and libs from
- <filename>gstreamer-plugins-base-&GST_MAJORMINOR;.pc</filename> and adding
- <filename>-lgstpbutils-&GST_MAJORMINOR;</filename> to the library
- flags.
- </para>
- <xi:include href="xml/gstpbutils.xml" />
- <xi:include href="xml/gstpbutilsdescriptions.xml" />
- <xi:include href="xml/gstpbutilsmissingplugins.xml" />
- <xi:include href="xml/gstpbutilsinstallplugins.xml" />
- </chapter>
-
- <chapter id="gstreamer-video">
- <title>Video Library</title>
- <para>
- This library should be linked to by getting cflags and libs from
- <filename>gstreamer-plugins-base-&GST_MAJORMINOR;.pc</filename> and adding
- <filename>-lgstvideo-&GST_MAJORMINOR;</filename> to the library flags.
- </para>
- <xi:include href="xml/gstvideo.xml" />
- <xi:include href="xml/gstvideofilter.xml" />
- <xi:include href="xml/gstvideosink.xml" />
- </chapter>
- </part>
-
- <part id="gstreamer-libs-hierarchy">
- <title>Object Hierarchy</title>
- <xi:include href="xml/tree_index.sgml" />
- </part>
-
- <index id="api-index-full">
- <title>Index</title>
- <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
- </index>
- <index id="api-index-deprecated" role="deprecated">
- <title>Index of deprecated API</title>
- <xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
- </index>
-
- <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
-</book>
diff --git a/docs/libs/gst-plugins-base-libs-overrides.txt b/docs/libs/gst-plugins-base-libs-overrides.txt
deleted file mode 100644
index e69de29b..00000000
--- a/docs/libs/gst-plugins-base-libs-overrides.txt
+++ /dev/null
diff --git a/docs/libs/gst-plugins-base-libs-sections.txt b/docs/libs/gst-plugins-base-libs-sections.txt
deleted file mode 100644
index 06224052..00000000
--- a/docs/libs/gst-plugins-base-libs-sections.txt
+++ /dev/null
@@ -1,1891 +0,0 @@
-# app
-<SECTION>
-<FILE>gstappsrc</FILE>
-<TITLE>appsrc</TITLE>
-<INCLUDE>gst/app/gstappsrc.h</INCLUDE>
-GstAppSrc
-GstAppStreamType
-gst_app_src_set_caps
-gst_app_src_get_caps
-gst_app_src_get_latency
-gst_app_src_set_latency
-gst_app_src_set_size
-gst_app_src_get_size
-gst_app_src_set_stream_type
-gst_app_src_get_stream_type
-gst_app_src_set_max_bytes
-gst_app_src_get_max_bytes
-gst_app_src_get_emit_signals
-gst_app_src_set_emit_signals
-GstAppSrcCallbacks
-gst_app_src_set_callbacks
-gst_app_src_push_buffer
-gst_app_src_end_of_stream
-<SUBSECTION Standard>
-GstAppSrcClass
-GST_APP_SRC
-GST_APP_SRC_CAST
-GST_IS_APP_SRC
-GST_TYPE_APP_SRC
-gst_app_src_get_type
-GST_APP_SRC_CLASS
-GST_IS_APP_SRC_CLASS
-GST_APP_BUFFER
-GST_APP_BUFFER_CLASS
-GST_IS_APP_BUFFER
-GST_IS_APP_BUFFER_CLASS
-GST_TYPE_APP_BUFFER
-<SUBSECTION Private>
-GstAppSrcPrivate
-GstAppBuffer
-GstAppBufferClass
-GstAppBufferFinalizeFunc
-gst_app_buffer_get_type
-gst_app_buffer_new
-</SECTION>
-
-<SECTION>
-<FILE>gstappsink</FILE>
-<TITLE>appsink</TITLE>
-<INCLUDE>gst/app/gstappsink.h</INCLUDE>
-GstAppSink
-gst_app_sink_set_caps
-gst_app_sink_get_caps
-gst_app_sink_is_eos
-gst_app_sink_set_emit_signals
-gst_app_sink_get_emit_signals
-gst_app_sink_set_max_buffers
-gst_app_sink_get_max_buffers
-gst_app_sink_set_drop
-gst_app_sink_get_drop
-gst_app_sink_pull_preroll
-gst_app_sink_pull_buffer
-gst_app_sink_pull_buffer_list
-GstAppSinkCallbacks
-gst_app_sink_set_callbacks
-<SUBSECTION Standard>
-GstAppSinkPrivate
-GstAppSinkClass
-GST_APP_SINK
-GST_APP_SINK_CAST
-GST_IS_APP_SINK
-GST_TYPE_APP_SINK
-gst_app_sink_get_type
-GST_APP_SINK_CLASS
-GST_IS_APP_SINK_CLASS
-</SECTION>
-
-# audio
-
-<SECTION>
-<FILE>gstaudio</FILE>
-<INCLUDE>gst/audio/audio.h</INCLUDE>
-GstAudioFieldFlag
-GST_FRAMES_TO_CLOCK_TIME
-GST_CLOCK_TIME_TO_FRAMES
-GST_AUDIO_DEF_RATE
-GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS
-GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS
-GST_AUDIO_INT_PAD_TEMPLATE_CAPS
-GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS
-gst_audio_frame_byte_size
-gst_audio_frame_length
-gst_audio_duration_from_pad_buffer
-gst_audio_is_buffer_framed
-gst_audio_structure_set_int
-gst_audio_buffer_clip
-<SUBSECTION Standard>
-GST_TYPE_BUFFER_FORMAT
-GST_TYPE_BUFFER_FORMAT_TYPE
-gst_buffer_format_get_type
-gst_buffer_format_type_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstaudioclock</FILE>
-<INCLUDE>gst/audio/gstaudioclock.h</INCLUDE>
-GstAudioClock
-GstAudioClockGetTimeFunc
-gst_audio_clock_new
-gst_audio_clock_adjust
-gst_audio_clock_get_time
-gst_audio_clock_reset
-<SUBSECTION Standard>
-GstAudioClockClass
-GST_AUDIO_CLOCK
-GST_IS_AUDIO_CLOCK
-GST_TYPE_AUDIO_CLOCK
-gst_audio_clock_get_type
-GST_AUDIO_CLOCK_CLASS
-GST_IS_AUDIO_CLOCK_CLASS
-GST_AUDIO_CLOCK_CAST
-</SECTION>
-
-<SECTION>
-<FILE>gstaudiofilter</FILE>
-<INCLUDE>gst/audio/gstaudiofilter.h</INCLUDE>
-GstAudioFilter
-GstAudioFilterClass
-gst_audio_filter_class_add_pad_templates
-<SUBSECTION Standard>
-GST_AUDIO_FILTER
-GST_IS_AUDIO_FILTER
-GST_TYPE_AUDIO_FILTER
-gst_audio_filter_get_type
-GST_AUDIO_FILTER_CLASS
-GST_IS_AUDIO_FILTER_CLASS
-GST_AUDIO_FILTER_CAST
-GST_AUDIO_FILTER_CLASS_CAST
-</SECTION>
-
-<SECTION>
-<FILE>gstaudiomixerutils</FILE>
-<INCLUDE>gst/audio/mixerutils.h</INCLUDE>
-GstAudioMixerFilterFunc
-gst_audio_default_registry_mixer_filter
-</SECTION>
-
-<SECTION>
-<FILE>gstaudiosink</FILE>
-<INCLUDE>gst/audio/gstaudiosink.h</INCLUDE>
-GstAudioSink
-GstAudioSinkClass
-<SUBSECTION Standard>
-GST_AUDIO_SINK
-GST_IS_AUDIO_SINK
-GST_TYPE_AUDIO_SINK
-gst_audio_sink_get_type
-GST_AUDIO_SINK_CLASS
-GST_IS_AUDIO_SINK_CLASS
-GST_AUDIO_SINK_GET_CLASS
-</SECTION>
-
-<SECTION>
-<FILE>gstaudiosrc</FILE>
-<INCLUDE>gst/audio/gstaudiosrc.h</INCLUDE>
-GstAudioSrc
-GstAudioSrcClass
-<SUBSECTION Standard>
-GST_AUDIO_SRC
-GST_IS_AUDIO_SRC
-GST_TYPE_AUDIO_SRC
-gst_audio_src_get_type
-GST_AUDIO_SRC_CLASS
-GST_IS_AUDIO_SRC_CLASS
-GST_AUDIO_SRC_GET_CLASS
-</SECTION>
-
-<SECTION>
-<FILE>gstbaseaudiosink</FILE>
-<INCLUDE>gst/audio/gstbaseaudiosink.h</INCLUDE>
-GstBaseAudioSink
-GstBaseAudioSinkClass
-GstBaseAudioSinkSlaveMethod
-
-GST_BASE_AUDIO_SINK_CLOCK
-GST_BASE_AUDIO_SINK_PAD
-gst_base_audio_sink_create_ringbuffer
-gst_base_audio_sink_set_provide_clock
-gst_base_audio_sink_get_provide_clock
-gst_base_audio_sink_set_slave_method
-gst_base_audio_sink_get_slave_method
-<SUBSECTION Standard>
-GST_BASE_AUDIO_SINK
-GST_IS_BASE_AUDIO_SINK
-GST_TYPE_BASE_AUDIO_SINK
-gst_base_audio_sink_get_type
-GST_BASE_AUDIO_SINK_CLASS
-GST_IS_BASE_AUDIO_SINK_CLASS
-GST_BASE_AUDIO_SINK_GET_CLASS
-GstBaseAudioSinkPrivate
-gst_base_audio_sink_slave_method_get_type
-GST_TYPE_BASE_AUDIO_SINK_SLAVE_METHOD
-</SECTION>
-
-<SECTION>
-<FILE>gstbaseaudiosrc</FILE>
-<INCLUDE>gst/audio/gstbaseaudiosrc.h</INCLUDE>
-GstBaseAudioSrc
-GstBaseAudioSrcClass
-GstBaseAudioSrcSlaveMethod
-
-GST_BASE_AUDIO_SRC_CLOCK
-GST_BASE_AUDIO_SRC_PAD
-gst_base_audio_src_create_ringbuffer
-gst_base_audio_src_set_provide_clock
-gst_base_audio_src_get_provide_clock
-gst_base_audio_src_get_slave_method
-gst_base_audio_src_set_slave_method
-<SUBSECTION Standard>
-GstBaseAudioSrcPrivate
-GST_BASE_AUDIO_SRC
-GST_IS_BASE_AUDIO_SRC
-GST_TYPE_BASE_AUDIO_SRC
-gst_base_audio_src_get_type
-GST_BASE_AUDIO_SRC_CLASS
-GST_IS_BASE_AUDIO_SRC_CLASS
-GST_BASE_AUDIO_SRC_GET_CLASS
-gst_base_audio_src_slave_method_get_type
-GST_TYPE_BASE_AUDIO_SRC_SLAVE_METHOD
-</SECTION>
-
-<SECTION>
-<FILE>gstmultichannel</FILE>
-<INCLUDE>gst/audio/multichannel.h</INCLUDE>
-GstAudioChannelPosition
-gst_audio_fixate_channel_positions
-gst_audio_get_channel_positions
-gst_audio_set_caps_channel_positions_list
-gst_audio_set_channel_positions
-gst_audio_set_structure_channel_positions_list
-gst_audio_check_channel_positions
-<SUBSECTION Standard>
-GST_TYPE_AUDIO_CHANNEL_POSITION
-gst_audio_channel_position_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstringbuffer</FILE>
-<INCLUDE>gst/audio/gstringbuffer.h</INCLUDE>
-GstRingBuffer
-GstRingBufferClass
-GstRingBufferSpec
-GstRingBufferCallback
-GstRingBufferSegState
-GstRingBufferState
-GstBufferFormat
-GstBufferFormatType
-
-GST_RING_BUFFER_BROADCAST
-GST_RING_BUFFER_GET_COND
-GST_RING_BUFFER_SIGNAL
-GST_RING_BUFFER_WAIT
-
-gst_ring_buffer_set_callback
-
-gst_ring_buffer_acquire
-gst_ring_buffer_release
-gst_ring_buffer_is_acquired
-
-gst_ring_buffer_activate
-gst_ring_buffer_is_active
-
-gst_ring_buffer_start
-gst_ring_buffer_pause
-gst_ring_buffer_stop
-
-gst_ring_buffer_delay
-gst_ring_buffer_samples_done
-gst_ring_buffer_set_sample
-gst_ring_buffer_commit
-gst_ring_buffer_commit_full
-gst_ring_buffer_convert
-
-gst_ring_buffer_prepare_read
-gst_ring_buffer_read
-gst_ring_buffer_clear
-gst_ring_buffer_clear_all
-gst_ring_buffer_advance
-
-gst_ring_buffer_close_device
-gst_ring_buffer_open_device
-gst_ring_buffer_device_is_open
-
-gst_ring_buffer_may_start
-gst_ring_buffer_parse_caps
-gst_ring_buffer_set_flushing
-
-<SUBSECTION Standard>
-GST_TYPE_RING_BUFFER
-GST_RING_BUFFER
-GST_RING_BUFFER_CLASS
-GST_RING_BUFFER_GET_CLASS
-GST_IS_RING_BUFFER
-GST_IS_RING_BUFFER_CLASS
-GST_RING_BUFFER_CAST
-gst_ring_buffer_get_type
-GST_TYPE_RING_BUFFER_SEG_STATE
-gst_ring_buffer_seg_state_get_type
-GST_TYPE_RING_BUFFER_STATE
-gst_ring_buffer_state_get_type
-<SUBSECTION Private>
-gst_ring_buffer_debug_spec_buff
-gst_ring_buffer_debug_spec_caps
-</SECTION>
-
-
-# cdda
-
-<SECTION>
-<FILE>gstcddabasesrc</FILE>
-<INCLUDE>gst/cdda/gstcddabasesrc.h</INCLUDE>
-GstCddaBaseSrc
-GstCddaBaseSrcClass
-GstCddaBaseSrcTrack
-GstCddaBaseSrcMode
-gst_cdda_base_src_add_track
-<SUBSECTION Standard>
-GST_TYPE_CDDA_BASE_SRC_MODE
-gst_cdda_base_src_mode_get_type
-GST_CDDA_BASE_SRC
-GST_CDDA_BASE_SRC_CLASS
-GST_CDDA_BASE_SRC_GET_CLASS
-GST_IS_CDDA_BASE_SRC
-GST_IS_CDDA_BASE_SRC_CLASS
-GST_TYPE_CDDA_BASE_SRC
-gst_cdda_base_src_get_type
-</SECTION>
-
-# fft
-
-<SECTION>
-<FILE>gstfft</FILE>
-<INCLUDE>gst/fft/gstfft.h</INCLUDE>
-GstFFTWindow
-gst_fft_next_fast_length
-</SECTION>
-
-<SECTION>
-<FILE>gstffts16</FILE>
-<INCLUDE>gst/fft/gstffts16.h</INCLUDE>
-GstFFTS16
-GstFFTS16Complex
-gst_fft_s16_new
-gst_fft_s16_fft
-gst_fft_s16_inverse_fft
-gst_fft_s16_window
-gst_fft_s16_free
-<SUBSECTION Standard>
-kiss_fft_s16
-kiss_fft_s16_alloc
-kiss_fft_s16_cfg
-kiss_fft_s16_cleanup
-kiss_fft_s16_cpx
-kiss_fft_s16_free
-kiss_fft_s16_next_fast_size
-kiss_fft_s16_scalar
-kiss_fft_s16_stride
-KISS_FFT_S16_COS
-KISS_FFT_S16_MALLOC
-KISS_FFT_S16_SIN
-</SECTION>
-
-<SECTION>
-<FILE>gstffts32</FILE>
-<INCLUDE>gst/fft/gstffts32.h</INCLUDE>
-GstFFTS32
-GstFFTS32Complex
-gst_fft_s32_new
-gst_fft_s32_fft
-gst_fft_s32_inverse_fft
-gst_fft_s32_window
-gst_fft_s32_free
-<SUBSECTION Standard>
-kiss_fft_s32
-kiss_fft_s32_alloc
-kiss_fft_s32_cfg
-kiss_fft_s32_cleanup
-kiss_fft_s32_cpx
-kiss_fft_s32_free
-kiss_fft_s32_next_fast_size
-kiss_fft_s32_scalar
-kiss_fft_s32_stride
-KISS_FFT_S32_COS
-KISS_FFT_S32_MALLOC
-KISS_FFT_S32_SIN
-
-</SECTION>
-
-<SECTION>
-<FILE>gstfftf32</FILE>
-<INCLUDE>gst/fft/gstfftf32.h</INCLUDE>
-GstFFTF32
-GstFFTF32Complex
-gst_fft_f32_new
-gst_fft_f32_fft
-gst_fft_f32_inverse_fft
-gst_fft_f32_window
-gst_fft_f32_free
-<SUBSECTION Standard>
-kiss_fft_f32
-kiss_fft_f32_alloc
-kiss_fft_f32_cfg
-kiss_fft_f32_cleanup
-kiss_fft_f32_cpx
-kiss_fft_f32_free
-kiss_fft_f32_next_fast_size
-kiss_fft_f32_scalar
-kiss_fft_f32_stride
-KISS_FFT_F32_COS
-KISS_FFT_F32_MALLOC
-KISS_FFT_F32_SIN
-</SECTION>
-
-<SECTION>
-<FILE>gstfftf64</FILE>
-<INCLUDE>gst/fft/gstfftf64.h</INCLUDE>
-GstFFTF64
-GstFFTF64Complex
-gst_fft_f64_new
-gst_fft_f64_fft
-gst_fft_f64_inverse_fft
-gst_fft_f64_window
-gst_fft_f64_free
-<SUBSECTION Standard>
-kiss_fft_f64
-kiss_fft_f64_alloc
-kiss_fft_f64_cfg
-kiss_fft_f64_cleanup
-kiss_fft_f64_cpx
-kiss_fft_f64_free
-kiss_fft_f64_next_fast_size
-kiss_fft_f64_scalar
-kiss_fft_f64_stride
-KISS_FFT_F64_COS
-KISS_FFT_F64_MALLOC
-KISS_FFT_F64_SIN
-</SECTION>
-
-# floatcast
-
-<SECTION>
-<FILE>gstfloatcast</FILE>
-<INCLUDE>gst/floatcast/floatcast.h</INCLUDE>
-gst_cast_double
-gst_cast_float
-</SECTION>
-
-
-# interfaces
-
-<SECTION>
-<FILE>gstcolorbalance</FILE>
-<INCLUDE>gst/interfaces/color.h</INCLUDE>
-GstColorBalance
-GstColorBalanceClass
-GstColorBalanceType
-gst_color_balance_list_channels
-gst_color_balance_get_value
-gst_color_balance_set_value
-gst_color_balance_value_changed
-gst_color_balance_get_balance_type
-<SUBSECTION Standard>
-GST_COLOR_BALANCE
-GST_COLOR_BALANCE_CLASS
-GST_COLOR_BALANCE_GET_CLASS
-GST_COLOR_BALANCE_TYPE
-GST_IS_COLOR_BALANCE
-GST_IS_COLOR_BALANCE_CLASS
-GST_TYPE_COLOR_BALANCE
-GST_TYPE_COLOR_BALANCE_TYPE
-gst_color_balance_get_type
-gst_color_balance_type_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstcolorbalancechannel</FILE>
-<INCLUDE>gst/interfaces/colorbalancechannel.h</INCLUDE>
-GstColorBalanceChannel
-GstColorBalanceChannelClass
-<SUBSECTION Standard>
-GST_COLOR_BALANCE_CHANNEL
-GST_COLOR_BALANCE_CHANNEL_CLASS
-GST_IS_COLOR_BALANCE_CHANNEL
-GST_IS_COLOR_BALANCE_CHANNEL_CLASS
-GST_TYPE_COLOR_BALANCE_CHANNEL
-gst_color_balance_channel_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstmixer</FILE>
-<INCLUDE>gst/interfaces/mixer.h</INCLUDE>
-GstMixer
-GstMixerType
-GstMixerFlags
-GstMixerMessageType
-
-gst_mixer_list_tracks
-gst_mixer_get_volume
-gst_mixer_set_volume
-
-gst_mixer_set_mute
-gst_mixer_set_record
-gst_mixer_set_option
-
-gst_mixer_mute_toggled
-gst_mixer_record_toggled
-gst_mixer_volume_changed
-gst_mixer_option_changed
-gst_mixer_options_list_changed
-gst_mixer_get_option
-
-gst_mixer_mixer_changed
-
-gst_mixer_get_mixer_flags
-gst_mixer_get_mixer_type
-
-gst_mixer_message_get_type
-gst_mixer_message_parse_mute_toggled
-gst_mixer_message_parse_option_changed
-gst_mixer_message_parse_record_toggled
-gst_mixer_message_parse_volume_changed
-gst_mixer_message_parse_options_list_changed
-
-<SUBSECTION Standard>
-GstMixerClass
-GST_TYPE_MIXER
-GST_TYPE_MIXER_TYPE
-GST_TYPE_MIXER_FLAGS
-GST_TYPE_MIXER_MESSAGE_TYPE
-GST_MIXER
-GST_MIXER_CLASS
-GST_MIXER_GET_CLASS
-GST_MIXER_TYPE
-GST_IS_MIXER
-GST_IS_MIXER_CLASS
-gst_mixer_get_type
-gst_mixer_type_get_type
-gst_mixer_flags_get_type
-gst_mixer_message_type_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstmixeroptions</FILE>
-<INCLUDE>gst/interfaces/mixer.h</INCLUDE>
-GstMixerOptions
-gst_mixer_options_get_values
-<SUBSECTION Standard>
-GstMixerOptionsClass
-GST_TYPE_MIXER_OPTIONS
-GST_MIXER_OPTIONS
-GST_MIXER_OPTIONS_CLASS
-GST_IS_MIXER_OPTIONS
-GST_IS_MIXER_OPTIONS_CLASS
-GST_MIXER_OPTIONS_GET_CLASS
-gst_mixer_options_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstmixertrack</FILE>
-<INCLUDE>gst/interfaces/mixer.h</INCLUDE>
-GstMixerTrack
-GstMixerTrackFlags
-GST_MIXER_TRACK_HAS_FLAG
-<SUBSECTION Standard>
-GstMixerTrackClass
-GST_TYPE_MIXER_TRACK
-GST_TYPE_MIXER_TRACK_FLAGS
-GST_MIXER_TRACK
-GST_MIXER_TRACK_CLASS
-GST_IS_MIXER_TRACK
-GST_IS_MIXER_TRACK_CLASS
-gst_mixer_track_flags_get_type
-gst_mixer_track_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstnavigation</FILE>
-<INCLUDE>gst/interfaces/navigation.h</INCLUDE>
-GstNavigation
-GstNavigationInterface
-GstNavigationCommand
-GstNavigationEventType
-GstNavigationMessageType
-GstNavigationQueryType
-
-gst_navigation_send_event
-gst_navigation_send_key_event
-gst_navigation_send_mouse_event
-gst_navigation_send_command
-
-gst_navigation_event_parse_command
-gst_navigation_event_parse_key_event
-gst_navigation_event_parse_mouse_button_event
-gst_navigation_event_parse_mouse_move_event
-gst_navigation_message_get_type
-gst_navigation_message_new_angles_changed
-gst_navigation_message_new_commands_changed
-gst_navigation_message_new_mouse_over
-gst_navigation_message_parse_mouse_over
-gst_navigation_message_parse_angles_changed
-gst_navigation_query_new_angles
-gst_navigation_query_get_type
-gst_navigation_query_new_commands
-gst_navigation_query_parse_angles
-gst_navigation_query_parse_commands_length
-gst_navigation_query_parse_commands_nth
-gst_navigation_query_set_angles
-gst_navigation_query_set_commands
-gst_navigation_query_set_commandsv
-
-GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU
-GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU
-GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU
-GST_NAVIGATION_COMMAND_DVD_MENU
-GST_NAVIGATION_COMMAND_DVD_ROOT_MENU
-GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU
-GST_NAVIGATION_COMMAND_DVD_TITLE_MENU
-
-<SUBSECTION Standard>
-GST_TYPE_NAVIGATION
-GST_NAVIGATION
-GST_NAVIGATION_GET_IFACE
-GST_TYPE_NAVIGATION_COMMAND
-GST_TYPE_NAVIGATION_EVENT_TYPE
-GST_TYPE_NAVIGATION_MESSAGE_TYPE
-GST_TYPE_NAVIGATION_QUERY_TYPE
-GST_IS_NAVIGATION
-gst_navigation_get_type
-gst_navigation_event_get_type
-gst_navigation_event_type_get_type
-gst_navigation_message_type_get_type
-gst_navigation_query_type_get_type
-gst_navigation_command_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstpropertyprobe</FILE>
-<INCLUDE>gst/interfaces/propertyprobe.h</INCLUDE>
-GstPropertyProbe
-GstPropertyProbeInterface
-
-gst_property_probe_get_properties
-gst_property_probe_get_property
-gst_property_probe_get_values
-gst_property_probe_get_values_name
-gst_property_probe_needs_probe
-gst_property_probe_needs_probe_name
-gst_property_probe_probe_and_get_values
-gst_property_probe_probe_and_get_values_name
-gst_property_probe_probe_property
-gst_property_probe_probe_property_name
-<SUBSECTION Standard>
-GST_TYPE_PROPERTY_PROBE
-GST_PROPERTY_PROBE
-GST_PROPERTY_PROBE_GET_IFACE
-GST_IS_PROPERTY_PROBE
-gst_property_probe_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gststreamvolume</FILE>
-<INCLUDE>gst/interfaces/streamvolume.h</INCLUDE>
-GstStreamVolume
-GstStreamVolumeFormat
-
-gst_stream_volume_get_volume
-gst_stream_volume_set_volume
-
-gst_stream_volume_get_mute
-gst_stream_volume_set_mute
-
-gst_stream_volume_convert_volume
-
-<SUBSECTION Standard>
-GstStreamVolumeInterface
-GST_TYPE_STREAM_VOLUME
-GST_STREAM_VOLUME
-GST_STREAM_VOLUME_INTERFACE
-GST_STREAM_VOLUME_GET_INTERFACE
-GST_IS_STREAM_VOLUME
-GST_IS_STREAM_VOLUME_INTERFACE
-gst_stream_volume_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gsttuner</FILE>
-<INCLUDE>gst/interfaces/tuner.h</INCLUDE>
-GstTuner
-GstTunerClass
-
-gst_tuner_list_channels
-gst_tuner_get_channel
-gst_tuner_set_channel
-
-gst_tuner_list_norms
-gst_tuner_get_norm
-gst_tuner_set_norm
-
-gst_tuner_get_frequency
-gst_tuner_set_frequency
-gst_tuner_signal_strength
-
-gst_tuner_find_norm_by_name
-gst_tuner_find_channel_by_name
-
-gst_tuner_channel_changed
-gst_tuner_norm_changed
-gst_tuner_frequency_changed
-gst_tuner_signal_changed
-<SUBSECTION Standard>
-GST_TYPE_TUNER
-GST_TUNER
-GST_TUNER_CLASS
-GST_TUNER_GET_CLASS
-GST_IS_TUNER
-GST_IS_TUNER_CLASS
-gst_tuner_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gsttunerchannel</FILE>
-<INCLUDE>gst/interfaces/tuner.h</INCLUDE>
-GstTunerChannel
-GstTunerChannelFlags
-GST_TUNER_CHANNEL_HAS_FLAG
-<SUBSECTION Standard>
-GstTunerChannelClass
-GST_TYPE_TUNER_CHANNEL
-GST_TYPE_TUNER_CHANNEL_FLAGS
-GST_TUNER_CHANNEL
-GST_TUNER_CHANNEL_CLASS
-GST_IS_TUNER_CHANNEL
-GST_IS_TUNER_CHANNEL_CLASS
-gst_tuner_channel_flags_get_type
-gst_tuner_channel_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gsttunernorm</FILE>
-<INCLUDE>gst/interfaces/tuner.h</INCLUDE>
-GstTunerNorm
-<SUBSECTION Standard>
-GstTunerNormClass
-GST_TYPE_TUNER_NORM
-GST_TUNER_NORM
-GST_TUNER_NORM_CLASS
-GST_IS_TUNER_NORM
-GST_IS_TUNER_NORM_CLASS
-gst_tuner_norm_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstvideoorientation</FILE>
-<INCLUDE>gst/interfaces/videoorientation.h</INCLUDE>
-GstVideoOrientation
-GstVideoOrientationInterface
-gst_video_orientation_get_hcenter
-gst_video_orientation_get_hflip
-gst_video_orientation_get_vcenter
-gst_video_orientation_get_vflip
-gst_video_orientation_set_hcenter
-gst_video_orientation_set_hflip
-gst_video_orientation_set_vcenter
-gst_video_orientation_set_vflip
-<SUBSECTION Standard>
-GST_TYPE_VIDEO_ORIENTATION
-GST_VIDEO_ORIENTATION
-GST_IS_VIDEO_ORIENTATION
-GST_VIDEO_ORIENTATION_GET_IFACE
-gst_video_orientation_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstxoverlay</FILE>
-<INCLUDE>gst/interfaces/xoverlay.h</INCLUDE>
-GstXOverlay
-GstXOverlayClass
-gst_x_overlay_set_xwindow_id
-gst_x_overlay_got_xwindow_id
-gst_x_overlay_prepare_xwindow_id
-gst_x_overlay_expose
-gst_x_overlay_handle_events
-<SUBSECTION Standard>
-GST_TYPE_X_OVERLAY
-GST_X_OVERLAY
-GST_X_OVERLAY_CLASS
-GST_X_OVERLAY_GET_CLASS
-GST_IS_X_OVERLAY
-GST_IS_X_OVERLAY_CLASS
-gst_x_overlay_get_type
-</SECTION>
-
-
-# netbuffer
-
-<SECTION>
-<FILE>gstnetbuffer</FILE>
-<INCLUDE>gst/netbuffer/gstnetbuffer.h</INCLUDE>
-GstNetBuffer
-GstNetType
-GST_NETADDRESS_MAX_LEN
-GstNetAddress
-
-gst_netbuffer_new
-gst_netaddress_get_net_type
-
-gst_netaddress_set_ip4_address
-gst_netaddress_get_ip4_address
-
-gst_netaddress_set_ip6_address
-gst_netaddress_get_ip6_address
-
-gst_netaddress_get_address_bytes
-gst_netaddress_set_address_bytes
-
-gst_netaddress_equal
-
-gst_netaddress_to_string
-<SUBSECTION Standard>
-GstNetBufferClass
-GST_TYPE_NETBUFFER
-GST_NETBUFFER
-GST_NETBUFFER_CLASS
-GST_NETBUFFER_GET_CLASS
-GST_IS_NETBUFFER
-GST_IS_NETBUFFER_CLASS
-gst_netbuffer_get_type
-</SECTION>
-
-
-# riff
-
-<SECTION>
-<FILE>gstriff</FILE>
-<INCLUDE>gst/riff/riff-media.h</INCLUDE>
-GST_RIFF_00
-GST_RIFF_0021
-GST_RIFF_0031
-GST_RIFF_0032
-GST_RIFF_00AM
-GST_RIFF_00__
-GST_RIFF_00db
-GST_RIFF_00dc
-GST_RIFF_00dx
-GST_RIFF_00id
-GST_RIFF_00iv
-GST_RIFF_00pc
-GST_RIFF_00rt
-GST_RIFF_00vc
-GST_RIFF_00xm
-GST_RIFF_00xx
-GST_RIFF_01
-GST_RIFF_01dc
-GST_RIFF_01pc
-GST_RIFF_01wb
-GST_RIFF_02
-GST_RIFF_03
-GST_RIFF_04
-GST_RIFF_05
-GST_RIFF_06
-GST_RIFF_07
-GST_RIFF_AURA
-GST_RIFF_BW10
-GST_RIFF_CCC
-GST_RIFF_CRAM
-GST_RIFF_CVID
-GST_RIFF_CYUV
-GST_RIFF_DIB
-GST_RIFF_DISP
-GST_RIFF_DIV3
-GST_RIFF_DMB1
-GST_RIFF_FCCH_MSVC
-GST_RIFF_FCCH_RLE
-GST_RIFF_FCCH_msvc
-GST_RIFF_FCC_auds
-GST_RIFF_FCC_iavs
-GST_RIFF_FCC_pads
-GST_RIFF_FCC_txts
-GST_RIFF_FCC_vidc
-GST_RIFF_FCC_vids
-GST_RIFF_FF00
-GST_RIFF_H263
-GST_RIFF_I420
-GST_RIFF_IDIT
-GST_RIFF_IJPG
-GST_RIFF_INFO_IARL
-GST_RIFF_INFO_IART
-GST_RIFF_INFO_ICMS
-GST_RIFF_INFO_ICMT
-GST_RIFF_INFO_ICOP
-GST_RIFF_INFO_ICRD
-GST_RIFF_INFO_ICRP
-GST_RIFF_INFO_IDIM
-GST_RIFF_INFO_IDPI
-GST_RIFF_INFO_IENG
-GST_RIFF_INFO_IGNR
-GST_RIFF_INFO_IKEY
-GST_RIFF_INFO_ILGT
-GST_RIFF_INFO_IMED
-GST_RIFF_INFO_INAM
-GST_RIFF_INFO_IPLT
-GST_RIFF_INFO_IPRD
-GST_RIFF_INFO_ISBJ
-GST_RIFF_INFO_ISFT
-GST_RIFF_INFO_ISHP
-GST_RIFF_INFO_ISRC
-GST_RIFF_INFO_ISRF
-GST_RIFF_INFO_ITCH
-GST_RIFF_ISBJ
-GST_RIFF_ISFT
-GST_RIFF_IV31
-GST_RIFF_IV32
-GST_RIFF_IV41
-GST_RIFF_IV50
-GST_RIFF_IYUV
-GST_RIFF_JPEG
-GST_RIFF_L263
-GST_RIFF_LIST_AVIX
-GST_RIFF_LIST_INFO
-GST_RIFF_LIST_adtl
-GST_RIFF_LIST_hdrl
-GST_RIFF_LIST_movi
-GST_RIFF_LIST_odml
-GST_RIFF_LIST_strl
-GST_RIFF_M263
-GST_RIFF_MJPG
-GST_RIFF_MPIX
-GST_RIFF_MVI1
-GST_RIFF_NONE
-GST_RIFF_PACK
-GST_RIFF_Q1_0
-GST_RIFF_RAW
-GST_RIFF_RGB
-GST_RIFF_RIFF_AVI
-GST_RIFF_RIFF_CDXA
-GST_RIFF_RIFF_WAVE
-GST_RIFF_RLE4
-GST_RIFF_RLE8
-GST_RIFF_RT21
-GST_RIFF_SFMC
-GST_RIFF_TAG_acid
-GST_RIFF_TAG_AVF0
-GST_RIFF_TAG_BEXT
-GST_RIFF_TAG_JUNK
-GST_RIFF_TAG_JUNQ
-GST_RIFF_TAG_LIST
-GST_RIFF_TAG_RIFF
-GST_RIFF_TAG_RIFX
-GST_RIFF_TAG_avih
-GST_RIFF_TAG_bext
-GST_RIFF_TAG_cue
-GST_RIFF_TAG_data
-GST_RIFF_TAG_dmlh
-GST_RIFF_TAG_fact
-GST_RIFF_TAG_fmt
-GST_RIFF_TAG_idx1
-GST_RIFF_TAG_plst
-GST_RIFF_TAG_strd
-GST_RIFF_TAG_strf
-GST_RIFF_TAG_strh
-GST_RIFF_TAG_strn
-GST_RIFF_TAG_vedt
-GST_RIFF_TRAN
-GST_RIFF_ULTI
-GST_RIFF_V422
-GST_RIFF_VDOW
-GST_RIFF_VIXL
-GST_RIFF_VSSH
-GST_RIFF_VYUY
-GST_RIFF_WHAM
-GST_RIFF_WINX
-GST_RIFF_WPY2
-GST_RIFF_XMPG
-GST_RIFF_Y41P
-GST_RIFF_YUV8
-GST_RIFF_YUV9
-GST_RIFF_YUY2
-GST_RIFF_YV12
-GST_RIFF_YVU9
-GST_RIFF_azpr
-GST_RIFF_bw10
-GST_RIFF_ccc
-GST_RIFF_cram
-GST_RIFF_cvid
-GST_RIFF_cyuv
-GST_RIFF_dmb1
-GST_RIFF_h263
-GST_RIFF_i263
-GST_RIFF_i420
-GST_RIFF_iv31
-GST_RIFF_iv32
-GST_RIFF_iv41
-GST_RIFF_iv50
-GST_RIFF_iyuv
-GST_RIFF_jpeg
-GST_RIFF_m263
-GST_RIFF_mJPG
-GST_RIFF_mvi1
-GST_RIFF_none
-GST_RIFF_pack
-GST_RIFF_rec
-GST_RIFF_rgb
-GST_RIFF_rle4
-GST_RIFF_rle8
-GST_RIFF_rpza
-GST_RIFF_rt21
-GST_RIFF_tran
-GST_RIFF_ulti
-GST_RIFF_v422
-GST_RIFF_vixl
-GST_RIFF_vyuy
-GST_RIFF_wham
-GST_RIFF_x263
-GST_RIFF_xmpg
-GST_RIFF_y41p
-GST_RIFF_yuy2
-GST_RIFF_yv12
-
-gst_riff_acid
-gst_riff_create_audio_caps
-gst_riff_create_audio_template_caps
-gst_riff_create_iavs_caps
-gst_riff_create_iavs_template_caps
-gst_riff_create_video_caps
-gst_riff_create_video_template_caps
-gst_riff_dmlh
-gst_riff_index_entry
-gst_riff_init
-gst_riff_parse_chunk
-gst_riff_parse_file_header
-gst_riff_parse_info
-gst_riff_parse_strf_auds
-gst_riff_parse_strf_iavs
-gst_riff_parse_strf_vids
-gst_riff_parse_strh
-gst_riff_read_chunk
-gst_riff_strf_auds
-gst_riff_strf_iavs
-gst_riff_strf_vids
-gst_riff_strh
-<SUBSECTION Standard>
-</SECTION>
-
-
-# rtp
-
-<SECTION>
-<FILE>gstbasertpaudiopayload</FILE>
-<INCLUDE>gst/rtp/gstbasertpaudiopayload.h</INCLUDE>
-GstBaseRTPAudioPayload
-GstBaseRTPAudioPayloadClass
-
-gst_base_rtp_audio_payload_set_frame_based
-gst_base_rtp_audio_payload_set_frame_options
-gst_base_rtp_audio_payload_set_sample_based
-gst_base_rtp_audio_payload_set_sample_options
-gst_base_rtp_audio_payload_get_adapter
-gst_base_rtp_audio_payload_push
-gst_base_rtp_audio_payload_flush
-gst_base_rtp_audio_payload_set_samplebits_options
-<SUBSECTION Standard>
-GST_TYPE_BASE_RTP_AUDIO_PAYLOAD
-GST_BASE_RTP_AUDIO_PAYLOAD
-GST_BASE_RTP_AUDIO_PAYLOAD_CLASS
-GST_IS_BASE_RTP_AUDIO_PAYLOAD
-GST_IS_BASE_RTP_AUDIO_PAYLOAD_CLASS
-GST_BASE_RTP_AUDIO_PAYLOAD_CAST
-gst_base_rtp_audio_payload_get_type
-GstBaseRTPAudioPayloadPrivate
-</SECTION>
-
-<SECTION>
-<FILE>gstbasertpdepayload</FILE>
-<INCLUDE>gst/rtp/gstbasertpdepayload.h</INCLUDE>
-GstBaseRTPDepayload
-GstBaseRTPDepayloadClass
-
-GST_BASE_RTP_DEPAYLOAD_SINKPAD
-GST_BASE_RTP_DEPAYLOAD_SRCPAD
-
-gst_base_rtp_depayload_push
-gst_base_rtp_depayload_push_ts
-
-<SUBSECTION Standard>
-GstBaseRTPDepayloadPrivate
-GST_TYPE_BASE_RTP_DEPAYLOAD
-GST_BASE_RTP_DEPAYLOAD
-GST_BASE_RTP_DEPAYLOAD_CLASS
-GST_BASE_RTP_DEPAYLOAD_GET_CLASS
-GST_IS_BASE_RTP_DEPAYLOAD
-GST_IS_BASE_RTP_DEPAYLOAD_CLASS
-GST_BASE_RTP_PAYLOAD_CAST
-gst_base_rtp_depayload_get_type
-GstBaseRTPPayloadPrivate
-
-<SUBSECTION Private>
-QUEUE_LOCK_INIT
-QUEUE_LOCK_FREE
-QUEUE_LOCK
-QUEUE_UNLOCK
-</SECTION>
-
-<SECTION>
-<FILE>gstbasertppayload</FILE>
-<INCLUDE>gst/rtp/gstbasertppayload.h</INCLUDE>
-GstBaseRTPPayload
-GstBaseRTPPayloadClass
-
-GST_BASE_RTP_PAYLOAD_MTU
-GST_BASE_RTP_PAYLOAD_PT
-GST_BASE_RTP_PAYLOAD_SINKPAD
-GST_BASE_RTP_PAYLOAD_SRCPAD
-
-gst_basertppayload_is_filled
-gst_basertppayload_push
-gst_basertppayload_push_list
-gst_basertppayload_set_options
-gst_basertppayload_set_outcaps
-<SUBSECTION Standard>
-GST_TYPE_BASE_RTP_PAYLOAD
-GST_BASE_RTP_PAYLOAD
-GST_BASE_RTP_PAYLOAD_CLASS
-GST_BASE_RTP_PAYLOAD_GET_CLASS
-GST_IS_BASE_RTP_PAYLOAD
-GST_IS_BASE_RTP_PAYLOAD_CLASS
-gst_basertppayload_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstrtcpbuffer</FILE>
-<INCLUDE>gst/rtp/gstrtcpbuffer.h</INCLUDE>
-
-GST_RTCP_VERSION
-
-GST_RTCP_MAX_SDES
-GST_RTCP_MAX_BYE_SSRC_COUNT
-GST_RTCP_MAX_RB_COUNT
-GST_RTCP_MAX_SDES_ITEM_COUNT
-GST_RTCP_VALID_MASK
-GST_RTCP_VALID_VALUE
-
-GstRTCPType
-GstRTCPPacket
-GstRTCPSDESType
-GstRTCPFBType
-
-gst_rtcp_buffer_new_take_data
-gst_rtcp_buffer_new_copy_data
-
-gst_rtcp_buffer_validate_data
-gst_rtcp_buffer_validate
-
-gst_rtcp_buffer_new
-gst_rtcp_buffer_end
-
-gst_rtcp_buffer_get_packet_count
-gst_rtcp_buffer_get_first_packet
-gst_rtcp_packet_move_to_next
-gst_rtcp_buffer_add_packet
-gst_rtcp_packet_remove
-
-gst_rtcp_packet_get_padding
-gst_rtcp_packet_get_count
-gst_rtcp_packet_get_type
-gst_rtcp_packet_get_length
-
-gst_rtcp_packet_sr_get_sender_info
-gst_rtcp_packet_sr_set_sender_info
-
-gst_rtcp_packet_rr_get_ssrc
-gst_rtcp_packet_rr_set_ssrc
-
-gst_rtcp_packet_get_rb_count
-gst_rtcp_packet_get_rb
-gst_rtcp_packet_add_rb
-gst_rtcp_packet_set_rb
-
-gst_rtcp_packet_sdes_get_item_count
-gst_rtcp_packet_sdes_first_item
-gst_rtcp_packet_sdes_next_item
-gst_rtcp_packet_sdes_get_ssrc
-gst_rtcp_packet_sdes_first_entry
-gst_rtcp_packet_sdes_next_entry
-gst_rtcp_packet_sdes_get_entry
-gst_rtcp_packet_sdes_copy_entry
-
-gst_rtcp_packet_sdes_add_item
-gst_rtcp_packet_sdes_add_entry
-
-gst_rtcp_packet_bye_get_ssrc_count
-gst_rtcp_packet_bye_get_nth_ssrc
-gst_rtcp_packet_bye_add_ssrc
-gst_rtcp_packet_bye_add_ssrcs
-
-gst_rtcp_packet_bye_get_reason_len
-gst_rtcp_packet_bye_get_reason
-gst_rtcp_packet_bye_set_reason
-
-gst_rtcp_packet_fb_get_type
-gst_rtcp_packet_fb_set_type
-
-gst_rtcp_packet_fb_get_sender_ssrc
-gst_rtcp_packet_fb_set_sender_ssrc
-
-gst_rtcp_packet_fb_get_media_ssrc
-gst_rtcp_packet_fb_set_media_ssrc
-
-gst_rtcp_ntp_to_unix
-gst_rtcp_unix_to_ntp
-
-gst_rtcp_sdes_name_to_type
-gst_rtcp_sdes_type_to_name
-
-<SUBSECTION Standard>
-</SECTION>
-
-<SECTION>
-<FILE>gstrtppayloads</FILE>
-<INCLUDE>gst/rtp/gstrtppayload.h</INCLUDE>
-GstRTPPayload
-GST_RTP_PAYLOAD_IS_DYNAMIC
-
-GstRTPPayloadInfo
-
-gst_rtp_payload_info_for_name
-gst_rtp_payload_info_for_pt
-
-<SUBSECTION Standard>
-GST_RTP_PAYLOAD_DYNAMIC_STRING
-GST_RTP_PAYLOAD_G723_53_STRING
-GST_RTP_PAYLOAD_G723_63_STRING
-GST_RTP_PAYLOAD_G728_STRING
-GST_RTP_PAYLOAD_G729_STRING
-GST_RTP_PAYLOAD_GSM_STRING
-GST_RTP_PAYLOAD_H263_STRING
-GST_RTP_PAYLOAD_L16_MONO_STRING
-GST_RTP_PAYLOAD_L16_STEREO_STRING
-GST_RTP_PAYLOAD_MPA_STRING
-GST_RTP_PAYLOAD_MPV_STRING
-GST_RTP_PAYLOAD_PCMA_STRING
-GST_RTP_PAYLOAD_PCMU_STRING
-GST_RTP_PAYLOAD_TS41_STRING
-GST_RTP_PAYLOAD_TS48_STRING
-GST_RTP_PAYLOAD_1016_STRING
-GST_RTP_PAYLOAD_CELLB_STRING
-GST_RTP_PAYLOAD_CN_STRING
-GST_RTP_PAYLOAD_DVI4_11025_STRING
-GST_RTP_PAYLOAD_DVI4_16000_STRING
-GST_RTP_PAYLOAD_DVI4_22050_STRING
-GST_RTP_PAYLOAD_DVI4_8000_STRING
-GST_RTP_PAYLOAD_G721_STRING
-GST_RTP_PAYLOAD_G722_STRING
-GST_RTP_PAYLOAD_G723_53
-GST_RTP_PAYLOAD_G723_63
-GST_RTP_PAYLOAD_G723_STRING
-GST_RTP_PAYLOAD_H261_STRING
-GST_RTP_PAYLOAD_JPEG_STRING
-GST_RTP_PAYLOAD_LPC_STRING
-GST_RTP_PAYLOAD_MP2T_STRING
-GST_RTP_PAYLOAD_NV_STRING
-GST_RTP_PAYLOAD_QCELP_STRING
-GST_RTP_PAYLOAD_TS41
-GST_RTP_PAYLOAD_TS48
-</SECTION>
-
-<SECTION>
-<FILE>gstrtpbuffer</FILE>
-<INCLUDE>gst/rtp/gstrtpbuffer.h</INCLUDE>
-
-GST_RTP_VERSION
-
-gst_rtp_buffer_allocate_data
-
-gst_rtp_buffer_new_take_data
-gst_rtp_buffer_new_copy_data
-gst_rtp_buffer_new_allocate
-gst_rtp_buffer_new_allocate_len
-
-gst_rtp_buffer_calc_header_len
-gst_rtp_buffer_calc_packet_len
-gst_rtp_buffer_calc_payload_len
-
-gst_rtp_buffer_validate
-gst_rtp_buffer_validate_data
-
-gst_rtp_buffer_set_packet_len
-gst_rtp_buffer_get_packet_len
-
-gst_rtp_buffer_get_header_len
-
-gst_rtp_buffer_get_version
-gst_rtp_buffer_set_version
-
-gst_rtp_buffer_get_padding
-gst_rtp_buffer_set_padding
-gst_rtp_buffer_pad_to
-
-gst_rtp_buffer_get_extension
-gst_rtp_buffer_set_extension
-gst_rtp_buffer_get_extension_data
-
-gst_rtp_buffer_get_ssrc
-gst_rtp_buffer_set_ssrc
-
-gst_rtp_buffer_get_csrc_count
-gst_rtp_buffer_get_csrc
-gst_rtp_buffer_set_csrc
-
-gst_rtp_buffer_get_marker
-gst_rtp_buffer_set_marker
-
-gst_rtp_buffer_get_payload_type
-gst_rtp_buffer_set_payload_type
-
-gst_rtp_buffer_get_seq
-gst_rtp_buffer_set_seq
-
-gst_rtp_buffer_get_timestamp
-gst_rtp_buffer_set_timestamp
-
-gst_rtp_buffer_get_payload_buffer
-gst_rtp_buffer_get_payload_subbuffer
-gst_rtp_buffer_get_payload_len
-gst_rtp_buffer_get_payload
-
-gst_rtp_buffer_default_clock_rate
-gst_rtp_buffer_compare_seqnum
-gst_rtp_buffer_ext_timestamp
-gst_rtp_buffer_set_extension_data
-
-gst_rtp_buffer_list_validate
-
-gst_rtp_buffer_list_get_payload_len
-
-gst_rtp_buffer_list_get_payload_type
-gst_rtp_buffer_list_set_payload_type
-
-gst_rtp_buffer_list_get_seq
-gst_rtp_buffer_list_set_seq
-
-gst_rtp_buffer_list_get_ssrc
-gst_rtp_buffer_list_set_ssrc
-
-gst_rtp_buffer_list_get_timestamp
-gst_rtp_buffer_list_set_timestamp
-
-</SECTION>
-
-# rtsp
-<SECTION>
-<FILE>gstrtspdefs</FILE>
-<INCLUDE>gst/rtsp/gstrtspdefs.h</INCLUDE>
-GST_RTSP_CHECK
-GstRTSPResult
-GstRTSPFamily
-GstRTSPState
-GstRTSPVersion
-GstRTSPMethod
-GstRTSPAuthMethod
-GST_RTSP_AUTH_MAX
-GstRTSPHeaderField
-GstRTSPStatusCode
-gst_rtsp_strresult
-gst_rtsp_method_as_text
-gst_rtsp_version_as_text
-gst_rtsp_header_as_text
-gst_rtsp_status_as_text
-gst_rtsp_options_as_text
-gst_rtsp_find_header_field
-gst_rtsp_find_method
-</SECTION>
-
-<SECTION>
-<FILE>gstrtsptransport</FILE>
-<INCLUDE>gst/rtsp/gstrtsptransport.h</INCLUDE>
-GstRTSPTransMode
-GstRTSPProfile
-GstRTSPLowerTrans
-GstRTSPTransport
-gst_rtsp_transport_new
-gst_rtsp_transport_init
-gst_rtsp_transport_parse
-gst_rtsp_transport_as_text
-gst_rtsp_transport_get_mime
-gst_rtsp_transport_get_manager
-gst_rtsp_transport_free
-</SECTION>
-
-<SECTION>
-<FILE>gstrtspbase64</FILE>
-<INCLUDE>gst/rtsp/gstrtspbase64.h</INCLUDE>
-gst_rtsp_base64_encode
-gst_rtsp_base64_decode_ip
-</SECTION>
-
-<SECTION>
-<FILE>gstrtspconnection</FILE>
-<INCLUDE>gst/rtsp/gstrtspconnection.h</INCLUDE>
-GstRTSPConnection
-gst_rtsp_connection_create
-gst_rtsp_connection_accept
-gst_rtsp_connection_connect
-gst_rtsp_connection_close
-gst_rtsp_connection_free
-
-gst_rtsp_connection_read
-gst_rtsp_connection_write
-gst_rtsp_connection_poll
-
-gst_rtsp_connection_send
-gst_rtsp_connection_receive
-
-gst_rtsp_connection_next_timeout
-gst_rtsp_connection_reset_timeout
-
-gst_rtsp_connection_flush
-
-gst_rtsp_connection_set_auth
-gst_rtsp_connection_set_auth_param
-gst_rtsp_connection_clear_auth_params
-
-gst_rtsp_connection_set_qos_dscp
-
-gst_rtsp_connection_set_ip
-gst_rtsp_connection_get_ip
-
-gst_rtsp_connection_get_url
-
-gst_rtsp_connection_set_tunneled
-gst_rtsp_connection_is_tunneled
-
-gst_rtsp_connection_get_tunnelid
-gst_rtsp_connection_do_tunnel
-
-GstRTSPWatch
-GstRTSPWatchFuncs
-gst_rtsp_watch_new
-gst_rtsp_watch_unref
-gst_rtsp_watch_attach
-gst_rtsp_watch_reset
-gst_rtsp_watch_queue_message
-</SECTION>
-
-<SECTION>
-<FILE>gstrtspmessage</FILE>
-<INCLUDE>gst/rtsp/gstrtspmessage.h</INCLUDE>
-GstRTSPMsgType
-GstRTSPMessage
-gst_rtsp_message_new
-gst_rtsp_message_init
-gst_rtsp_message_unset
-gst_rtsp_message_free
-gst_rtsp_message_get_type
-gst_rtsp_message_new_request
-gst_rtsp_message_init_request
-gst_rtsp_message_parse_request
-gst_rtsp_message_new_response
-gst_rtsp_message_init_response
-gst_rtsp_message_parse_response
-gst_rtsp_message_new_data
-gst_rtsp_message_init_data
-gst_rtsp_message_parse_data
-gst_rtsp_message_add_header
-gst_rtsp_message_take_header
-gst_rtsp_message_remove_header
-gst_rtsp_message_get_header
-gst_rtsp_message_append_headers
-gst_rtsp_message_set_body
-gst_rtsp_message_take_body
-gst_rtsp_message_get_body
-gst_rtsp_message_steal_body
-gst_rtsp_message_dump
-</SECTION>
-
-<SECTION>
-<FILE>gstrtspurl</FILE>
-<INCLUDE>gst/rtsp/gstrtspurl.h</INCLUDE>
-GST_RTSP_DEFAULT_PORT
-GstRTSPUrl
-gst_rtsp_url_parse
-gst_rtsp_url_copy
-gst_rtsp_url_free
-gst_rtsp_url_get_request_uri
-gst_rtsp_url_set_port
-gst_rtsp_url_get_port
-<SUBSECTION Standard>
-gst_rtsp_url_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstrtsprange</FILE>
-<INCLUDE>gst/rtsp/gstrtsrange.h</INCLUDE>
-GstRTSPRangeUnit
-GstRTSPTimeRange
-GstRTSPTime
-GstRTSPTimeType
-gst_rtsp_range_parse
-gst_rtsp_range_to_string
-gst_rtsp_range_free
-</SECTION>
-
-# sdp
-<SECTION>
-<FILE>gstsdpmessage</FILE>
-<INCLUDE>gst/sdp/gstsdpmessage.h</INCLUDE>
-GstSDPResult
-GstSDPOrigin
-GstSDPConnection
-GST_SDP_BWTYPE_CT
-GST_SDP_BWTYPE_AS
-GST_SDP_BWTYPE_EXT_PREFIX
-GstSDPBandwidth
-GstSDPTime
-GstSDPZone
-GstSDPKey
-GstSDPAttribute
-GstSDPMedia
-GstSDPMessage
-gst_sdp_message_new
-gst_sdp_message_init
-gst_sdp_message_uninit
-gst_sdp_message_free
-gst_sdp_message_parse_buffer
-gst_sdp_message_get_version
-gst_sdp_message_set_version
-gst_sdp_message_get_origin
-gst_sdp_message_set_origin
-gst_sdp_message_get_session_name
-gst_sdp_message_set_session_name
-gst_sdp_message_get_information
-gst_sdp_message_set_information
-gst_sdp_message_get_uri
-gst_sdp_message_set_uri
-gst_sdp_message_emails_len
-gst_sdp_message_get_email
-gst_sdp_message_add_email
-gst_sdp_message_phones_len
-gst_sdp_message_get_phone
-gst_sdp_message_add_phone
-gst_sdp_message_get_connection
-gst_sdp_message_set_connection
-gst_sdp_message_bandwidths_len
-gst_sdp_message_get_bandwidth
-gst_sdp_message_add_bandwidth
-gst_sdp_message_times_len
-gst_sdp_message_get_time
-gst_sdp_message_add_time
-gst_sdp_message_zones_len
-gst_sdp_message_get_zone
-gst_sdp_message_add_zone
-gst_sdp_message_get_key
-gst_sdp_message_set_key
-gst_sdp_message_attributes_len
-gst_sdp_message_get_attribute
-gst_sdp_message_get_attribute_val
-gst_sdp_message_get_attribute_val_n
-gst_sdp_message_add_attribute
-gst_sdp_message_medias_len
-gst_sdp_message_get_media
-gst_sdp_message_add_media
-gst_sdp_message_dump
-gst_sdp_message_as_text
-
-gst_sdp_media_new
-gst_sdp_media_init
-gst_sdp_media_uninit
-gst_sdp_media_free
-gst_sdp_media_get_media
-gst_sdp_media_set_media
-gst_sdp_media_get_port
-gst_sdp_media_get_num_ports
-gst_sdp_media_set_port_info
-gst_sdp_media_get_proto
-gst_sdp_media_set_proto
-gst_sdp_media_formats_len
-gst_sdp_media_get_format
-gst_sdp_media_add_format
-gst_sdp_media_get_information
-gst_sdp_media_set_information
-gst_sdp_media_connections_len
-gst_sdp_media_get_connection
-gst_sdp_media_add_connection
-gst_sdp_media_bandwidths_len
-gst_sdp_media_get_bandwidth
-gst_sdp_media_add_bandwidth
-gst_sdp_media_get_key
-gst_sdp_media_set_key
-gst_sdp_media_attributes_len
-gst_sdp_media_get_attribute
-gst_sdp_media_get_attribute_val
-gst_sdp_media_get_attribute_val_n
-gst_sdp_media_add_attribute
-gst_sdp_media_as_text
-</SECTION>
-
-# tag
-
-<SECTION>
-<FILE>gsttag</FILE>
-<INCLUDE>gst/tag/tag.h</INCLUDE>
-GST_TAG_MUSICBRAINZ_TRACKID
-GST_TAG_MUSICBRAINZ_ARTISTID
-GST_TAG_MUSICBRAINZ_ALBUMID
-GST_TAG_MUSICBRAINZ_ALBUMARTISTID
-GST_TAG_MUSICBRAINZ_TRMID
-GST_TAG_MUSICBRAINZ_SORTNAME
-GST_TAG_CDDA_CDDB_DISCID
-GST_TAG_CDDA_CDDB_DISCID_FULL
-GST_TAG_CDDA_MUSICBRAINZ_DISCID
-GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL
-GST_TAG_CDDA_TRACK_TAGS
-GST_TAG_CMML_CLIP
-GST_TAG_CMML_HEAD
-GST_TAG_CMML_STREAM
-gst_tag_register_musicbrainz_tags
-gst_tag_freeform_string_to_utf8
-gst_tag_parse_extended_comment
-gst_tag_image_data_to_image_buffer
-GstTagImageType
-<SUBSECTION Standard>
-GST_TYPE_TAG_IMAGE_TYPE
-gst_tag_image_type_get_type
-<SUBSECTION Private>
-GstTagEntryMatch
-</SECTION>
-
-<SECTION>
-<FILE>gsttagvorbis</FILE>
-<INCLUDE>gst/tag/tag.h</INCLUDE>
-<SUBSECTION>
-gst_tag_from_vorbis_tag
-gst_tag_to_vorbis_tag
-gst_vorbis_tag_add
-gst_tag_to_vorbis_comments
-<SUBSECTION>
-gst_tag_list_from_vorbiscomment_buffer
-gst_tag_list_to_vorbiscomment_buffer
-<SUBSECTION Standard>
-gst_vorbis_tag_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gsttagid3</FILE>
-<INCLUDE>gst/tag/tag.h</INCLUDE>
-<SUBSECTION>
-gst_tag_id3_genre_count
-gst_tag_id3_genre_get
-gst_tag_list_new_from_id3v1
-gst_tag_from_id3_tag
-gst_tag_from_id3_user_tag
-gst_tag_to_id3_tag
-gst_tag_list_add_id3_image
-</SECTION>
-
-<SECTION>
-<FILE>gsttagdemux</FILE>
-<INCLUDE>gst/tag/gsttagdemux.h</INCLUDE>
-GstTagDemux
-GstTagDemuxClass
-GstTagDemuxResult
-<SUBSECTION Standard>
-GstTagDemuxPrivate
-GST_IS_TAG_DEMUX
-GST_IS_TAG_DEMUX_CLASS
-GST_TAG_DEMUX
-GST_TAG_DEMUX_CLASS
-GST_TYPE_TAG_DEMUX
-GST_TYPE_TAG_DEMUX_RESULT
-gst_tag_demux_get_type
-gst_tag_demux_result_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gsttaglanguagecodes</FILE>
-<INCLUDE>gst/tag/tag.h</INCLUDE>
-<SUBSECTION>
-gst_tag_get_language_codes
-gst_tag_get_language_name
-gst_tag_get_language_code
-gst_tag_get_language_code_iso_639_1
-gst_tag_get_language_code_iso_639_2B
-gst_tag_get_language_code_iso_639_2T
-</SECTION>
-
-# base utils
-
-<SECTION>
-<FILE>gstpbutils</FILE>
-<INCLUDE>gst/pbutils/pbutils.h</INCLUDE>
-<SUBSECTION>
-gst_pb_utils_init
-</SECTION>
-
-<SECTION>
-<FILE>gstpbutilsmissingplugins</FILE>
-<INCLUDE>gst/pbutils/missing-plugins.h</INCLUDE>
-<SUBSECTION>
-gst_missing_plugin_message_get_installer_detail
-gst_missing_plugin_message_get_description
-gst_is_missing_plugin_message
-<SUBSECTION>
-gst_missing_decoder_message_new
-gst_missing_encoder_message_new
-gst_missing_uri_source_message_new
-gst_missing_uri_sink_message_new
-gst_missing_element_message_new
-<SUBSECTION>
-gst_missing_uri_source_installer_detail_new
-gst_missing_uri_sink_installer_detail_new
-gst_missing_element_installer_detail_new
-gst_missing_decoder_installer_detail_new
-gst_missing_encoder_installer_detail_new
-</SECTION>
-
-<SECTION>
-<FILE>gstpbutilsinstallplugins</FILE>
-<INCLUDE>gst/pbutils/install-plugins.h</INCLUDE>
-<SUBSECTION>
-GstInstallPluginsReturn
-GstInstallPluginsResultFunc
-gst_install_plugins_async
-gst_install_plugins_sync
-gst_install_plugins_return_get_name
-gst_install_plugins_installation_in_progress
-gst_install_plugins_supported
-<SUBSECTION>
-GstInstallPluginsContext
-gst_install_plugins_context_new
-gst_install_plugins_context_free
-gst_install_plugins_context_set_xid
-<SUBSECTION Standard>
-GST_TYPE_INSTALL_PLUGINS_CONTEXT
-GST_TYPE_INSTALL_PLUGINS_RETURN
-gst_install_plugins_context_get_type
-gst_install_plugins_return_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstpbutilsdescriptions</FILE>
-<INCLUDE>gst/pbutils/descriptions.h</INCLUDE>
-<SUBSECTION>
-gst_pb_utils_get_source_description
-gst_pb_utils_get_sink_description
-gst_pb_utils_get_decoder_description
-gst_pb_utils_get_encoder_description
-gst_pb_utils_get_element_description
-<SUBSECTION>
-gst_pb_utils_add_codec_description_to_tag_list
-gst_pb_utils_get_codec_description
-</SECTION>
-
-# video
-
-<SECTION>
-<FILE>gstvideo</FILE>
-<INCLUDE>gst/video/video.h</INCLUDE>
-GST_VIDEO_BLUE_MASK_15
-GST_VIDEO_BLUE_MASK_15_INT
-GST_VIDEO_BLUE_MASK_16
-GST_VIDEO_BLUE_MASK_16_INT
-GST_VIDEO_BYTE1_MASK_24
-GST_VIDEO_BYTE1_MASK_24_INT
-GST_VIDEO_BYTE1_MASK_32
-GST_VIDEO_BYTE1_MASK_32_INT
-GST_VIDEO_BYTE2_MASK_24
-GST_VIDEO_BYTE2_MASK_24_INT
-GST_VIDEO_BYTE2_MASK_32
-GST_VIDEO_BYTE2_MASK_32_INT
-GST_VIDEO_BYTE3_MASK_24
-GST_VIDEO_BYTE3_MASK_24_INT
-GST_VIDEO_BYTE3_MASK_32
-GST_VIDEO_BYTE3_MASK_32_INT
-GST_VIDEO_BYTE4_MASK_32
-GST_VIDEO_BYTE4_MASK_32_INT
-GST_VIDEO_CAPS_ABGR
-GST_VIDEO_CAPS_ARGB
-GST_VIDEO_CAPS_BGR
-GST_VIDEO_CAPS_BGRA
-GST_VIDEO_CAPS_BGRx
-GST_VIDEO_CAPS_BGRx_HOST_ENDIAN
-GST_VIDEO_CAPS_RGB
-GST_VIDEO_CAPS_RGBA
-GST_VIDEO_CAPS_RGB_15
-GST_VIDEO_CAPS_RGB_16
-GST_VIDEO_CAPS_RGBx
-GST_VIDEO_CAPS_YUV
-GST_VIDEO_CAPS_xBGR
-GST_VIDEO_CAPS_xRGB
-GST_VIDEO_CAPS_xRGB_HOST_ENDIAN
-GST_VIDEO_FPS_RANGE
-GST_VIDEO_GREEN_MASK_15
-GST_VIDEO_GREEN_MASK_15_INT
-GST_VIDEO_GREEN_MASK_16
-GST_VIDEO_GREEN_MASK_16_INT
-GST_VIDEO_RED_MASK_15
-GST_VIDEO_RED_MASK_15_INT
-GST_VIDEO_RED_MASK_16
-GST_VIDEO_RED_MASK_16_INT
-GST_VIDEO_SIZE_RANGE
-GST_VIDEO_BUFFER_TFF
-GST_VIDEO_BUFFER_RFF
-GST_VIDEO_BUFFER_ONEFIELD
-GstVideoFormat
-gst_video_calculate_display_ratio
-gst_video_frame_rate
-gst_video_get_size
-gst_video_format_convert
-gst_video_format_new_caps
-gst_video_format_new_caps_interlaced
-gst_video_format_get_component_height
-gst_video_format_get_component_offset
-gst_video_format_get_component_width
-gst_video_format_get_pixel_stride
-gst_video_format_get_row_stride
-gst_video_format_get_size
-gst_video_format_has_alpha
-gst_video_format_is_rgb
-gst_video_format_is_yuv
-gst_video_format_to_fourcc
-gst_video_format_from_fourcc
-gst_video_format_parse_caps
-gst_video_format_parse_caps_interlaced
-gst_video_parse_caps_framerate
-gst_video_parse_caps_pixel_aspect_ratio
-</SECTION>
-
-<SECTION>
-<FILE>gstvideofilter</FILE>
-<INCLUDE>gst/video/gstvideofilter.h</INCLUDE>
-GstVideoFilter
-GstVideoFilterClass
-<SUBSECTION Standard>
-GST_TYPE_VIDEO_FILTER
-GST_VIDEO_FILTER
-GST_VIDEO_FILTER_CLASS
-GST_VIDEO_FILTER_GET_CLASS
-GST_IS_VIDEO_FILTER
-GST_IS_VIDEO_FILTER_CLASS
-gst_video_filter_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gstvideosink</FILE>
-<INCLUDE>gst/video/gstvideosink.h</INCLUDE>
-GstVideoSink
-GstVideoSinkClass
-GstVideoRectangle
-GST_VIDEO_SINK_HEIGHT
-GST_VIDEO_SINK_PAD
-GST_VIDEO_SINK_WIDTH
-gst_video_sink_center_rect
-<SUBSECTION Standard>
-GstVideoSinkPrivate
-GST_TYPE_VIDEO_SINK
-GST_VIDEO_SINK
-GST_VIDEO_SINK_CAST
-GST_VIDEO_SINK_CLASS
-GST_VIDEO_SINK_GET_CLASS
-GST_IS_VIDEO_SINK
-GST_IS_VIDEO_SINK_CLASS
-gst_video_sink_get_type
-</SECTION>
-
-# private
-
-<SECTION>
-<FILE>private</FILE>
-<SUBSECTION Private>
-bind_textdomain_codeset
-bindtextdomain
-dcgettext
-dcngettext
-dgettext
-dngettext
-gettext
-gettext_noop
-ngettext
-textdomain
-_
-N_
-</SECTION>
diff --git a/docs/libs/gst-plugins-base-libs.types b/docs/libs/gst-plugins-base-libs.types
deleted file mode 100644
index 85866a84..00000000
--- a/docs/libs/gst-plugins-base-libs.types
+++ /dev/null
@@ -1,59 +0,0 @@
-#include <gst/gst.h>
-
-
-#include <gst/audio/gstaudioclock.h>
-gst_audio_clock_get_type
-#include <gst/audio/gstaudiofilter.h>
-gst_audio_filter_get_type
-#include <gst/audio/gstaudiosink.h>
-gst_audio_sink_get_type
-#include <gst/audio/gstaudiosrc.h>
-gst_audio_src_get_type
-#include <gst/audio/gstbaseaudiosink.h>
-gst_base_audio_sink_get_type
-#include <gst/audio/gstbaseaudiosrc.h>
-gst_base_audio_src_get_type
-#include <gst/audio/gstringbuffer.h>
-gst_ring_buffer_get_type
-
-
-#include <gst/cdda/gstcddabasesrc.h>
-gst_cdda_base_src_get_type
-
-
-#include <gst/interfaces/colorbalance.h>
-gst_color_balance_get_type
-gst_color_balance_channel_get_type
-#include <gst/interfaces/mixer.h>
-gst_mixer_get_type
-gst_mixer_options_get_type
-gst_mixer_track_get_type
-#include <gst/interfaces/navigation.h>
-gst_navigation_get_type
-#include <gst/interfaces/propertyprobe.h>
-gst_property_probe_get_type
-#include <gst/interfaces/tuner.h>
-gst_tuner_get_type
-gst_tuner_channel_get_type
-gst_tuner_norm_get_type
-#include <gst/interfaces/streamvolume.h>
-gst_stream_volume_get_type
-#include <gst/interfaces/videoorientation.h>
-gst_video_orientation_get_type
-#include <gst/interfaces/xoverlay.h>
-gst_x_overlay_get_type
-
-
-#include <gst/rtp/gstbasertpdepayload.h>
-gst_base_rtp_depayload_get_type
-#include <gst/rtp/gstbasertppayload.h>
-gst_basertppayload_get_type
-#include <gst/rtp/gstbasertpaudiopayload.h>
-gst_base_rtp_audio_payload_get_type
-
-
-#include <gst/video/gstvideofilter.h>
-gst_video_filter_get_type
-#include <gst/video/gstvideosink.h>
-gst_video_sink_get_type
-
diff --git a/ext/Makefile.am b/ext/Makefile.am
deleted file mode 100644
index 7c006ff7..00000000
--- a/ext/Makefile.am
+++ /dev/null
@@ -1,83 +0,0 @@
-if USE_ALSA
-ALSA_DIR=alsa
-else
-ALSA_DIR=
-endif
-
-if USE_CDPARANOIA
-CDPARANOIA_DIR=cdparanoia
-else
-CDPARANOIA_DIR=
-endif
-
-if USE_GIO
-GIO_DIR=gio
-else
-GIO_DIR=
-endif
-
-if USE_GNOME_VFS
-GNOMEVFS_DIR=gnomevfs
-else
-GNOMEVFS_DIR=
-endif
-
-if USE_LIBVISUAL
-LIBVISUAL_DIR=libvisual
-else
-LIBVISUAL_DIR=
-endif
-
-if USE_OGG
-OGG_DIR=ogg
-else
-OGG_DIR=
-endif
-
-if USE_PANGO
-PANGO_DIR = pango
-else
-PANGO_DIR =
-endif
-
-if USE_VORBIS
-VORBIS_DIR=vorbis
-endif
-
-if USE_IVORBIS
-VORBIS_DIR=vorbis
-endif
-
-if !USE_VORBIS
-if !USE_IVORBIS
-VORBIS_DIR=
-endif
-endif
-
-if USE_THEORA
-THEORA_DIR=theora
-else
-THEORA_DIR=
-endif
-
-SUBDIRS = \
- $(ALSA_DIR) \
- $(CDPARANOIA_DIR) \
- $(GIO_DIR) \
- $(GNOMEVFS_DIR) \
- $(LIBVISUAL_DIR) \
- $(OGG_DIR) \
- $(PANGO_DIR) \
- $(THEORA_DIR) \
- $(VORBIS_DIR)
-
-DIST_SUBDIRS = \
- alsa \
- cdparanoia \
- gio \
- gnomevfs \
- libvisual \
- ogg \
- pango \
- theora \
- vorbis
diff --git a/ext/alsa/Makefile.am b/ext/alsa/Makefile.am
deleted file mode 100644
index 38cde48a..00000000
--- a/ext/alsa/Makefile.am
+++ /dev/null
@@ -1,36 +0,0 @@
-plugin_LTLIBRARIES = libgstalsa.la
-
-libgstalsa_la_SOURCES = \
- gstalsadeviceprobe.c \
- gstalsamixer.c \
- gstalsamixerelement.c \
- gstalsamixertrack.c \
- gstalsamixeroptions.c \
- gstalsaplugin.c \
- gstalsasink.c \
- gstalsasrc.c \
- gstalsa.c
-
-libgstalsa_la_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(GST_CFLAGS) \
- $(ALSA_CFLAGS)
-libgstalsa_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la \
- $(top_builddir)/gst-libs/gst/audio/libgstaudio-$(GST_MAJORMINOR).la \
- $(GST_BASE_LIBS) \
- $(ALSA_LIBS)
-
-libgstalsa_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstalsa_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = \
- gstalsa.h \
- gstalsadeviceprobe.h \
- gstalsamixer.h \
- gstalsamixerelement.h \
- gstalsamixertrack.h \
- gstalsamixeroptions.h \
- gstalsasrc.h \
- gstalsasink.h
diff --git a/ext/alsa/gstalsa.c b/ext/alsa/gstalsa.c
deleted file mode 100644
index 2cc37ab1..00000000
--- a/ext/alsa/gstalsa.c
+++ /dev/null
@@ -1,561 +0,0 @@
-/* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "gstalsa.h"
-
-#include <gst/audio/multichannel.h>
-
-static GstCaps *
-gst_alsa_detect_rates (GstObject * obj, snd_pcm_hw_params_t * hw_params,
- GstCaps * in_caps)
-{
- GstCaps *caps;
- guint min, max;
- gint err, dir, min_rate, max_rate, i;
-
- GST_LOG_OBJECT (obj, "probing sample rates ...");
-
- if ((err = snd_pcm_hw_params_get_rate_min (hw_params, &min, &dir)) < 0)
- goto min_rate_err;
-
- if ((err = snd_pcm_hw_params_get_rate_max (hw_params, &max, &dir)) < 0)
- goto max_rate_err;
-
- min_rate = min;
- max_rate = max;
-
- if (min_rate < 4000)
- min_rate = 4000; /* random 'sensible minimum' */
-
- if (max_rate <= 0)
- max_rate = G_MAXINT; /* or maybe just use 192400 or so? */
- else if (max_rate > 0 && max_rate < 4000)
- max_rate = MAX (4000, min_rate);
-
- GST_DEBUG_OBJECT (obj, "Min. rate = %u (%d)", min_rate, min);
- GST_DEBUG_OBJECT (obj, "Max. rate = %u (%d)", max_rate, max);
-
- caps = gst_caps_make_writable (in_caps);
-
- for (i = 0; i < gst_caps_get_size (caps); ++i) {
- GstStructure *s;
-
- s = gst_caps_get_structure (caps, i);
- if (min_rate == max_rate) {
- gst_structure_set (s, "rate", G_TYPE_INT, min_rate, NULL);
- } else {
- gst_structure_set (s, "rate", GST_TYPE_INT_RANGE,
- min_rate, max_rate, NULL);
- }
- }
-
- return caps;
-
- /* ERRORS */
-min_rate_err:
- {
- GST_ERROR_OBJECT (obj, "failed to query minimum sample rate: %s",
- snd_strerror (err));
- gst_caps_unref (in_caps);
- return NULL;
- }
-max_rate_err:
- {
- GST_ERROR_OBJECT (obj, "failed to query maximum sample rate: %s",
- snd_strerror (err));
- gst_caps_unref (in_caps);
- return NULL;
- }
-}
-
-static const struct
-{
- const int width;
- const int depth;
- const int sformat;
- const int uformat;
-} pcmformats[] = {
- {
- 8, 8, SND_PCM_FORMAT_S8, SND_PCM_FORMAT_U8}, {
- 16, 16, SND_PCM_FORMAT_S16, SND_PCM_FORMAT_U16}, {
- 32, 24, SND_PCM_FORMAT_S24, SND_PCM_FORMAT_U24}, {
-#if (G_BYTE_ORDER == G_LITTLE_ENDIAN) /* no endian-unspecific enum available */
- 24, 24, SND_PCM_FORMAT_S24_3LE, SND_PCM_FORMAT_U24_3LE}, {
-#else
- 24, 24, SND_PCM_FORMAT_S24_3BE, SND_PCM_FORMAT_U24_3BE}, {
-#endif
- 32, 32, SND_PCM_FORMAT_S32, SND_PCM_FORMAT_U32}
-};
-
-static GstCaps *
-gst_alsa_detect_formats (GstObject * obj, snd_pcm_hw_params_t * hw_params,
- GstCaps * in_caps)
-{
- snd_pcm_format_mask_t *mask;
- GstStructure *s;
- GstCaps *caps;
- gint i;
-
- snd_pcm_format_mask_malloc (&mask);
- snd_pcm_hw_params_get_format_mask (hw_params, mask);
-
- caps = gst_caps_new_empty ();
-
- for (i = 0; i < gst_caps_get_size (in_caps); ++i) {
- GstStructure *scopy;
- gint w, width = 0, depth = 0;
-
- s = gst_caps_get_structure (in_caps, i);
- if (!gst_structure_has_name (s, "audio/x-raw-int")) {
- GST_WARNING_OBJECT (obj, "skipping non-int format");
- continue;
- }
- if (!gst_structure_get_int (s, "width", &width) ||
- !gst_structure_get_int (s, "depth", &depth))
- continue;
- if (width == 0 || (width % 8) != 0)
- continue; /* Only full byte widths are valid */
- for (w = 0; w < G_N_ELEMENTS (pcmformats); w++)
- if (pcmformats[w].width == width && pcmformats[w].depth == depth)
- break;
- if (w == G_N_ELEMENTS (pcmformats))
- continue; /* Unknown format */
-
- if (snd_pcm_format_mask_test (mask, pcmformats[w].sformat) &&
- snd_pcm_format_mask_test (mask, pcmformats[w].uformat)) {
- /* template contains { true, false } or just one, leave it as it is */
- scopy = gst_structure_copy (s);
- } else if (snd_pcm_format_mask_test (mask, pcmformats[w].sformat)) {
- scopy = gst_structure_copy (s);
- gst_structure_set (scopy, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
- } else if (snd_pcm_format_mask_test (mask, pcmformats[w].uformat)) {
- scopy = gst_structure_copy (s);
- gst_structure_set (scopy, "signed", G_TYPE_BOOLEAN, FALSE, NULL);
- } else {
- scopy = NULL;
- }
- if (scopy) {
- if (width > 8) {
- /* TODO: proper endianness detection, for now it's CPU endianness only */
- gst_structure_set (scopy, "endianness", G_TYPE_INT, G_BYTE_ORDER, NULL);
- }
- gst_caps_append_structure (caps, scopy);
- }
- }
-
- snd_pcm_format_mask_free (mask);
- gst_caps_unref (in_caps);
- return caps;
-}
-
-/* we don't have channel mappings for more than this many channels */
-#define GST_ALSA_MAX_CHANNELS 8
-
-static GstStructure *
-get_channel_free_structure (const GstStructure * in_structure)
-{
- GstStructure *s = gst_structure_copy (in_structure);
-
- gst_structure_remove_field (s, "channels");
- return s;
-}
-
-static void
-caps_add_channel_configuration (GstCaps * caps,
- const GstStructure * in_structure, gint min_chans, gint max_chans)
-{
- GstAudioChannelPosition pos[8] = {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
- GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT
- };
- GstStructure *s = NULL;
- gint c;
-
- if (min_chans == max_chans && max_chans <= 2) {
- s = get_channel_free_structure (in_structure);
- gst_structure_set (s, "channels", G_TYPE_INT, max_chans, NULL);
- gst_caps_append_structure (caps, s);
- return;
- }
-
- g_assert (min_chans >= 1);
-
- /* mono and stereo don't need channel configurations */
- if (min_chans == 2) {
- s = get_channel_free_structure (in_structure);
- gst_structure_set (s, "channels", G_TYPE_INT, 2, NULL);
- gst_caps_append_structure (caps, s);
- } else if (min_chans == 1 && max_chans >= 2) {
- s = get_channel_free_structure (in_structure);
- gst_structure_set (s, "channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
- gst_caps_append_structure (caps, s);
- }
-
- /* don't know whether to use 2.1 or 3.0 here - but I suspect
- * alsa might work around that/fix it somehow. Can we tell alsa
- * what our channel layout is like? */
- if (max_chans >= 3 && min_chans <= 3) {
- GstAudioChannelPosition pos_21[3] = {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_LFE
- };
-
- s = get_channel_free_structure (in_structure);
- gst_structure_set (s, "channels", G_TYPE_INT, 3, NULL);
- gst_audio_set_channel_positions (s, pos_21);
- gst_caps_append_structure (caps, s);
- }
-
- /* everything else (4, 6, 8 channels) needs a channel layout */
- for (c = MAX (4, min_chans); c <= 8; c += 2) {
- if (max_chans >= c) {
- s = get_channel_free_structure (in_structure);
- gst_structure_set (s, "channels", G_TYPE_INT, c, NULL);
- gst_audio_set_channel_positions (s, pos);
- gst_caps_append_structure (caps, s);
- }
- }
-
- for (c = MAX (9, min_chans); c <= max_chans; ++c) {
- GstAudioChannelPosition *ch_layout;
- guint i;
-
- ch_layout = g_new (GstAudioChannelPosition, c);
- for (i = 0; i < c; ++i) {
- ch_layout[i] = GST_AUDIO_CHANNEL_POSITION_NONE;
- }
- s = get_channel_free_structure (in_structure);
- gst_structure_set (s, "channels", G_TYPE_INT, c, NULL);
- gst_audio_set_channel_positions (s, ch_layout);
- gst_caps_append_structure (caps, s);
- g_free (ch_layout);
- }
-}
-
-static GstCaps *
-gst_alsa_detect_channels (GstObject * obj, snd_pcm_hw_params_t * hw_params,
- GstCaps * in_caps)
-{
- GstCaps *caps;
- guint min, max;
- gint min_chans, max_chans;
- gint err, i;
-
- GST_LOG_OBJECT (obj, "probing channels ...");
-
- if ((err = snd_pcm_hw_params_get_channels_min (hw_params, &min)) < 0)
- goto min_chan_error;
-
- if ((err = snd_pcm_hw_params_get_channels_max (hw_params, &max)) < 0)
- goto max_chan_error;
-
- /* note: the above functions may return (guint) -1 */
- min_chans = min;
- max_chans = max;
-
- if (min_chans < 0) {
- min_chans = 1;
- max_chans = GST_ALSA_MAX_CHANNELS;
- } else if (max_chans < 0) {
- max_chans = GST_ALSA_MAX_CHANNELS;
- }
-
- if (min_chans > max_chans) {
- gint temp;
-
- GST_WARNING_OBJECT (obj, "minimum channels > maximum channels (%d > %d), "
- "please fix your soundcard drivers", min, max);
- temp = min_chans;
- min_chans = max_chans;
- max_chans = temp;
- }
-
- /* pro cards seem to return large numbers for min_channels */
- if (min_chans > GST_ALSA_MAX_CHANNELS) {
- GST_DEBUG_OBJECT (obj, "min_chans = %u, looks like a pro card", min_chans);
- if (max_chans < min_chans) {
- max_chans = min_chans;
- } else {
- /* only support [max_chans; max_chans] for these cards for now
- * to avoid inflating the source caps with loads of structures ... */
- min_chans = max_chans;
- }
- } else {
- min_chans = MAX (min_chans, 1);
- max_chans = MIN (GST_ALSA_MAX_CHANNELS, max_chans);
- }
-
- GST_DEBUG_OBJECT (obj, "Min. channels = %d (%d)", min_chans, min);
- GST_DEBUG_OBJECT (obj, "Max. channels = %d (%d)", max_chans, max);
-
- caps = gst_caps_new_empty ();
-
- for (i = 0; i < gst_caps_get_size (in_caps); ++i) {
- GstStructure *s;
- GType field_type;
- gint c_min = min_chans;
- gint c_max = max_chans;
-
- s = gst_caps_get_structure (in_caps, i);
- /* the template caps might limit the number of channels (like alsasrc),
- * in which case we don't want to return a superset, so hack around this
- * for the two common cases where the channels are either a fixed number
- * or a min/max range). Example: alsasrc template has channels = [1,2] and
- * the detection will claim to support 8 channels for device 'plughw:0' */
- field_type = gst_structure_get_field_type (s, "channels");
- if (field_type == G_TYPE_INT) {
- gst_structure_get_int (s, "channels", &c_min);
- gst_structure_get_int (s, "channels", &c_max);
- } else if (field_type == GST_TYPE_INT_RANGE) {
- const GValue *val;
-
- val = gst_structure_get_value (s, "channels");
- c_min = CLAMP (gst_value_get_int_range_min (val), min_chans, max_chans);
- c_max = CLAMP (gst_value_get_int_range_max (val), min_chans, max_chans);
- } else {
- c_min = min_chans;
- c_max = max_chans;
- }
-
- caps_add_channel_configuration (caps, s, c_min, c_max);
- }
-
- gst_caps_unref (in_caps);
-
- return caps;
-
- /* ERRORS */
-min_chan_error:
- {
- GST_ERROR_OBJECT (obj, "failed to query minimum channel count: %s",
- snd_strerror (err));
- return NULL;
- }
-max_chan_error:
- {
- GST_ERROR_OBJECT (obj, "failed to query maximum channel count: %s",
- snd_strerror (err));
- return NULL;
- }
-}
-
-snd_pcm_t *
-gst_alsa_open_iec958_pcm (GstObject * obj)
-{
- char *iec958_pcm_name = NULL;
- snd_pcm_t *pcm = NULL;
- int res;
- char devstr[256]; /* Storage for local 'default' device string */
-
- /*
- * Try and open our default iec958 device. Fall back to searching on card x
- * if this fails, which should only happen on older alsa setups
- */
-
- /* The string will be one of these:
- * SPDIF_CON: Non-audio flag not set:
- * spdif:{AES0 0x0 AES1 0x82 AES2 0x0 AES3 0x2}
- * SPDIF_CON: Non-audio flag set:
- * spdif:{AES0 0x2 AES1 0x82 AES2 0x0 AES3 0x2}
- */
- sprintf (devstr,
- "iec958:{AES0 0x%02x AES1 0x%02x AES2 0x%02x AES3 0x%02x}",
- IEC958_AES0_CON_EMPHASIS_NONE | IEC958_AES0_NONAUDIO,
- IEC958_AES1_CON_ORIGINAL | IEC958_AES1_CON_PCM_CODER,
- 0, IEC958_AES3_CON_FS_48000);
-
- GST_DEBUG_OBJECT (obj, "Generated device string \"%s\"", devstr);
- iec958_pcm_name = devstr;
-
- res = snd_pcm_open (&pcm, iec958_pcm_name, SND_PCM_STREAM_PLAYBACK, 0);
- if (G_UNLIKELY (res < 0)) {
- GST_DEBUG_OBJECT (obj, "failed opening IEC958 device: %s",
- snd_strerror (res));
- pcm = NULL;
- }
-
- return pcm;
-}
-
-
-/*
- * gst_alsa_probe_supported_formats:
- *
- * Takes the template caps and returns the subset which is actually
- * supported by this device.
- *
- */
-
-GstCaps *
-gst_alsa_probe_supported_formats (GstObject * obj, snd_pcm_t * handle,
- const GstCaps * template_caps)
-{
- snd_pcm_hw_params_t *hw_params;
- snd_pcm_stream_t stream_type;
- GstCaps *caps;
- gint err;
-
- snd_pcm_hw_params_malloc (&hw_params);
- if ((err = snd_pcm_hw_params_any (handle, hw_params)) < 0)
- goto error;
-
- stream_type = snd_pcm_stream (handle);
-
- caps = gst_caps_copy (template_caps);
-
- if (!(caps = gst_alsa_detect_formats (obj, hw_params, caps)))
- goto subroutine_error;
-
- if (!(caps = gst_alsa_detect_rates (obj, hw_params, caps)))
- goto subroutine_error;
-
- if (!(caps = gst_alsa_detect_channels (obj, hw_params, caps)))
- goto subroutine_error;
-
- /* Try opening IEC958 device to see if we can support that format (playback
- * only for now but we could add SPDIF capture later) */
- if (stream_type == SND_PCM_STREAM_PLAYBACK) {
- snd_pcm_t *pcm = gst_alsa_open_iec958_pcm (obj);
-
- if (G_LIKELY (pcm)) {
- gst_caps_append (caps, gst_caps_new_simple ("audio/x-iec958", NULL));
- snd_pcm_close (pcm);
- }
- }
-
- snd_pcm_hw_params_free (hw_params);
- return caps;
-
- /* ERRORS */
-error:
- {
- GST_ERROR_OBJECT (obj, "failed to query formats: %s", snd_strerror (err));
- snd_pcm_hw_params_free (hw_params);
- return NULL;
- }
-subroutine_error:
- {
- GST_ERROR_OBJECT (obj, "failed to query formats");
- snd_pcm_hw_params_free (hw_params);
- return NULL;
- }
-}
-
-static gchar *
-gst_alsa_find_device_name_no_handle (GstObject * obj, const gchar * devcard,
- gint device_num, snd_pcm_stream_t stream)
-{
- snd_ctl_card_info_t *info = NULL;
- snd_ctl_t *ctl = NULL;
- gchar *ret = NULL;
- gint dev = -1;
-
- GST_LOG_OBJECT (obj, "[%s] device=%d", devcard, device_num);
-
- if (snd_ctl_open (&ctl, devcard, 0) < 0)
- return NULL;
-
- snd_ctl_card_info_malloc (&info);
- if (snd_ctl_card_info (ctl, info) < 0)
- goto done;
-
- while (snd_ctl_pcm_next_device (ctl, &dev) == 0 && dev >= 0) {
- if (dev == device_num) {
- snd_pcm_info_t *pcminfo;
-
- snd_pcm_info_malloc (&pcminfo);
- snd_pcm_info_set_device (pcminfo, dev);
- snd_pcm_info_set_subdevice (pcminfo, 0);
- snd_pcm_info_set_stream (pcminfo, stream);
- if (snd_ctl_pcm_info (ctl, pcminfo) < 0) {
- snd_pcm_info_free (pcminfo);
- break;
- }
-
- ret = (gchar *) snd_pcm_info_get_name (pcminfo);
- if (ret) {
- ret = g_strdup (ret);
- GST_LOG_OBJECT (obj, "name from pcminfo: %s", ret);
- }
- snd_pcm_info_free (pcminfo);
- if (ret)
- break;
- }
- }
-
- if (ret == NULL) {
- char *name = NULL;
- gint card;
-
- GST_LOG_OBJECT (obj, "no luck so far, trying backup");
- card = snd_ctl_card_info_get_card (info);
- snd_card_get_name (card, &name);
- ret = g_strdup (name);
- free (name);
- }
-
-done:
- snd_ctl_card_info_free (info);
- snd_ctl_close (ctl);
-
- return ret;
-}
-
-gchar *
-gst_alsa_find_device_name (GstObject * obj, const gchar * device,
- snd_pcm_t * handle, snd_pcm_stream_t stream)
-{
- gchar *ret = NULL;
-
- if (device != NULL) {
- gchar *dev, *comma;
- gint devnum;
-
- GST_LOG_OBJECT (obj, "Trying to get device name from string '%s'", device);
-
- /* only want name:card bit, but not devices and subdevices */
- dev = g_strdup (device);
- if ((comma = strchr (dev, ','))) {
- *comma = '\0';
- devnum = atoi (comma + 1);
- ret = gst_alsa_find_device_name_no_handle (obj, dev, devnum, stream);
- }
- g_free (dev);
- }
-
- if (ret == NULL && handle != NULL) {
- snd_pcm_info_t *info;
-
- GST_LOG_OBJECT (obj, "Trying to get device name from open handle");
- snd_pcm_info_malloc (&info);
- snd_pcm_info (handle, info);
- ret = g_strdup (snd_pcm_info_get_name (info));
- snd_pcm_info_free (info);
- }
-
- GST_LOG_OBJECT (obj, "Device name for device '%s': %s",
- GST_STR_NULL (device), GST_STR_NULL (ret));
-
- return ret;
-}
diff --git a/ext/alsa/gstalsa.h b/ext/alsa/gstalsa.h
deleted file mode 100644
index e7af889f..00000000
--- a/ext/alsa/gstalsa.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2001 CodeFactory AB
- * Copyright (C) 2001 Thomas Nyberg <thomas@codefactory.se>
- * Copyright (C) 2001-2002 Andy Wingo <apwingo@eos.ncsu.edu>
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#ifndef __GST_ALSA_H__
-#define __GST_ALSA_H__
-
-
-#define ALSA_PCM_NEW_HW_PARAMS_API
-#define ALSA_PCM_NEW_SW_PARAMS_API
-
-#include <alsa/asoundlib.h>
-#include <alsa/control.h>
-#include <alsa/error.h>
-#include <gst/gst.h>
-
-#define GST_CHECK_ALSA_VERSION(major,minor,micro) \
- (SND_LIB_MAJOR > (major) || \
- (SND_LIB_MAJOR == (major) && SND_LIB_MINOR > (minor)) || \
- (SND_LIB_MAJOR == (major) && SND_LIB_MINOR == (minor) && \
- SND_LIB_SUBMINOR >= (micro)))
-
-GST_DEBUG_CATEGORY_EXTERN (alsa_debug);
-#define GST_CAT_DEFAULT alsa_debug
-
-snd_pcm_t * gst_alsa_open_iec958_pcm (GstObject * obj);
-
-GstCaps * gst_alsa_probe_supported_formats (GstObject * obj,
- snd_pcm_t * handle,
- const GstCaps * template_caps);
-
-gchar * gst_alsa_find_device_name (GstObject * obj,
- const gchar * device,
- snd_pcm_t * handle,
- snd_pcm_stream_t stream);
-
-#endif /* __GST_ALSA_H__ */
diff --git a/ext/alsa/gstalsadeviceprobe.c b/ext/alsa/gstalsadeviceprobe.c
deleted file mode 100644
index 83596a3f..00000000
--- a/ext/alsa/gstalsadeviceprobe.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/* Copyright (C) 2001 CodeFactory AB
- * Copyright (C) 2001 Thomas Nyberg <thomas@codefactory.se>
- * Copyright (C) 2001-2002 Andy Wingo <apwingo@eos.ncsu.edu>
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstalsadeviceprobe.h"
-#include "gst/interfaces/propertyprobe.h"
-
-static const GList *
-gst_alsa_device_property_probe_get_properties (GstPropertyProbe * probe)
-{
- GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
- static GList *list = NULL;
-
- /* well, not perfect, but better than no locking at all.
- * In the worst case we leak a list node, so who cares? */
- GST_CLASS_LOCK (GST_OBJECT_CLASS (klass));
-
- if (!list) {
- GParamSpec *pspec;
-
- pspec = g_object_class_find_property (klass, "device");
- list = g_list_append (NULL, pspec);
- }
-
- GST_CLASS_UNLOCK (GST_OBJECT_CLASS (klass));
-
- return list;
-}
-
-static GList *
-gst_alsa_get_device_list (snd_pcm_stream_t stream)
-{
- snd_ctl_t *handle;
- int card, dev;
- snd_ctl_card_info_t *info;
- snd_pcm_info_t *pcminfo;
- gboolean mixer = (stream == -1);
- GList *list = NULL;
-
- if (stream == -1)
- stream = 0;
-
- snd_ctl_card_info_malloc (&info);
- snd_pcm_info_malloc (&pcminfo);
- card = -1;
-
- if (snd_card_next (&card) < 0 || card < 0) {
- /* no soundcard found */
- GST_WARNING ("No soundcard found");
- goto beach;
- }
-
- while (card >= 0) {
- gchar name[32];
-
- g_snprintf (name, sizeof (name), "hw:%d", card);
- if (snd_ctl_open (&handle, name, 0) < 0) {
- goto next_card;
- }
- if (snd_ctl_card_info (handle, info) < 0) {
- snd_ctl_close (handle);
- goto next_card;
- }
-
- if (mixer) {
- list = g_list_append (list, g_strdup (name));
- } else {
- dev = -1;
- while (1) {
- gchar *gst_device;
-
- snd_ctl_pcm_next_device (handle, &dev);
-
- if (dev < 0)
- break;
- snd_pcm_info_set_device (pcminfo, dev);
- snd_pcm_info_set_subdevice (pcminfo, 0);
- snd_pcm_info_set_stream (pcminfo, stream);
- if (snd_ctl_pcm_info (handle, pcminfo) < 0) {
- continue;
- }
-
- gst_device = g_strdup_printf ("hw:%d,%d", card, dev);
- list = g_list_append (list, gst_device);
- }
- }
- snd_ctl_close (handle);
- next_card:
- if (snd_card_next (&card) < 0) {
- break;
- }
- }
-
-beach:
- snd_ctl_card_info_free (info);
- snd_pcm_info_free (pcminfo);
-
- return list;
-}
-
-static void
-gst_alsa_device_property_probe_probe_property (GstPropertyProbe * probe,
- guint prop_id, const GParamSpec * pspec)
-{
- if (!g_str_equal (pspec->name, "device")) {
- G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
- }
-}
-
-static gboolean
-gst_alsa_device_property_probe_needs_probe (GstPropertyProbe * probe,
- guint prop_id, const GParamSpec * pspec)
-{
- /* don't cache probed data */
- return TRUE;
-}
-
-static GValueArray *
-gst_alsa_device_property_probe_get_values (GstPropertyProbe * probe,
- guint prop_id, const GParamSpec * pspec)
-{
- GstElementClass *klass;
- const GList *templates;
- snd_pcm_stream_t mode = -1;
- GValueArray *array;
- GValue value = { 0, };
- GList *l, *list;
-
- if (!g_str_equal (pspec->name, "device")) {
- G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
- return NULL;
- }
-
- klass = GST_ELEMENT_GET_CLASS (GST_ELEMENT (probe));
-
- /* I'm pretty sure ALSA has a good way to do this. However, their cool
- * auto-generated documentation is pretty much useless if you try to
- * do function-wise look-ups. */
- /* we assume one pad template at max [zero=mixer] */
- templates = gst_element_class_get_pad_template_list (klass);
- if (templates) {
- if (GST_PAD_TEMPLATE_DIRECTION (templates->data) == GST_PAD_SRC)
- mode = SND_PCM_STREAM_CAPTURE;
- else
- mode = SND_PCM_STREAM_PLAYBACK;
- }
-
- list = gst_alsa_get_device_list (mode);
-
- if (list == NULL) {
- GST_LOG_OBJECT (probe, "No devices found");
- return NULL;
- }
-
- array = g_value_array_new (g_list_length (list));
- g_value_init (&value, G_TYPE_STRING);
- for (l = list; l != NULL; l = l->next) {
- GST_LOG_OBJECT (probe, "Found device: %s", (gchar *) l->data);
- g_value_take_string (&value, (gchar *) l->data);
- l->data = NULL;
- g_value_array_append (array, &value);
- }
- g_value_unset (&value);
- g_list_free (list);
-
- return array;
-}
-
-static void
-gst_alsa_property_probe_interface_init (GstPropertyProbeInterface * iface)
-{
- iface->get_properties = gst_alsa_device_property_probe_get_properties;
- iface->probe_property = gst_alsa_device_property_probe_probe_property;
- iface->needs_probe = gst_alsa_device_property_probe_needs_probe;
- iface->get_values = gst_alsa_device_property_probe_get_values;
-}
-
-void
-gst_alsa_type_add_device_property_probe_interface (GType type)
-{
- static const GInterfaceInfo probe_iface_info = {
- (GInterfaceInitFunc) gst_alsa_property_probe_interface_init,
- NULL,
- NULL,
- };
-
- g_type_add_interface_static (type, GST_TYPE_PROPERTY_PROBE,
- &probe_iface_info);
-}
diff --git a/ext/alsa/gstalsadeviceprobe.h b/ext/alsa/gstalsadeviceprobe.h
deleted file mode 100644
index b60b0fef..00000000
--- a/ext/alsa/gstalsadeviceprobe.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 2001 CodeFactory AB
- * Copyright (C) 2001 Thomas Nyberg <thomas@codefactory.se>
- * Copyright (C) 2001-2002 Andy Wingo <apwingo@eos.ncsu.edu>
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __GST_ALSA_DEVICE_PROBE_H__
-#define __GST_ALSA_DEVICE_PROBE_H__
-
-#include "gstalsa.h"
-
-G_BEGIN_DECLS
-
-void gst_alsa_type_add_device_property_probe_interface (GType type);
-
-G_END_DECLS
-
-#endif /* __GST_ALSA_DEVICE_PROBE_H__ */
-
diff --git a/ext/alsa/gstalsamixer.c b/ext/alsa/gstalsamixer.c
deleted file mode 100644
index 1c5d8184..00000000
--- a/ext/alsa/gstalsamixer.c
+++ /dev/null
@@ -1,933 +0,0 @@
-/* ALSA mixer implementation.
- * Copyright (C) 2003 Leif Johnson <leif@ambient.2y.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-alsamixer
- * @see_also: alsasink, alsasrc
- *
- * This element controls various aspects such as the volume and balance
- * of an audio device using the ALSA api.
- *
- * The application should query and use the interfaces provided by this
- * element to control the device.
- *
- * Last reviewed on 2006-03-01 (0.10.4)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstalsamixer.h"
-
-static void gst_alsa_mixer_update_option (GstAlsaMixer * mixer,
- GstAlsaMixerOptions * alsa_opts);
-static void gst_alsa_mixer_update_track (GstAlsaMixer * mixer,
- GstAlsaMixerTrack * alsa_track);
-static int gst_alsa_mixer_handle_callback (snd_mixer_t * handle,
- unsigned int mask, snd_mixer_elem_t * elem);
-
-/* First some utils, then the mixer implementation */
-static gboolean
-gst_alsa_mixer_open (GstAlsaMixer * mixer)
-{
- gint err;
- snd_ctl_t *ctl;
- snd_ctl_card_info_t *card_info;
-
- g_return_val_if_fail (mixer->handle == NULL, FALSE);
-
- /* open and initialize the mixer device */
- err = snd_mixer_open (&mixer->handle, 0);
- if (err < 0 || mixer->handle == NULL)
- goto open_failed;
-
- if ((err = snd_mixer_attach (mixer->handle, mixer->device)) < 0) {
- GST_WARNING ("Cannot open mixer for sound device '%s': %s", mixer->device,
- snd_strerror (err));
- goto error;
- }
-
- if ((err = snd_mixer_selem_register (mixer->handle, NULL, NULL)) < 0) {
- GST_WARNING ("Cannot register mixer elements: %s", snd_strerror (err));
- goto error;
- }
-
- if ((err = snd_mixer_load (mixer->handle)) < 0) {
- GST_WARNING ("Cannot load mixer settings: %s", snd_strerror (err));
- goto error;
- }
-
- snd_mixer_set_callback_private (mixer->handle, mixer);
- snd_mixer_set_callback (mixer->handle, gst_alsa_mixer_handle_callback);
-
- /* now get the device name, any of this is not fatal */
- g_free (mixer->cardname);
- if ((err = snd_ctl_open (&ctl, mixer->device, 0)) < 0) {
- GST_WARNING ("Cannot open CTL: %s", snd_strerror (err));
- goto no_card_name;
- }
-
- snd_ctl_card_info_malloc (&card_info);
- if ((err = snd_ctl_card_info (ctl, card_info)) < 0) {
- GST_WARNING ("Cannot get card info: %s", snd_strerror (err));
- snd_ctl_close (ctl);
- goto no_card_name;
- }
-
- mixer->cardname = g_strdup (snd_ctl_card_info_get_name (card_info));
- GST_DEBUG ("Card name = %s", GST_STR_NULL (mixer->cardname));
- snd_ctl_card_info_free (card_info);
- snd_ctl_close (ctl);
-
-no_card_name:
- if (mixer->cardname == NULL) {
- mixer->cardname = g_strdup ("Unknown");
- GST_DEBUG ("Cannot find card name");
- }
-
- GST_INFO ("Successfully opened mixer for device '%s'.", mixer->device);
-
- return TRUE;
-
- /* ERROR */
-open_failed:
- {
- GST_WARNING ("Cannot open mixer: %s", snd_strerror (err));
- mixer->handle = NULL;
- return FALSE;
- }
-error:
- {
- snd_mixer_close (mixer->handle);
- mixer->handle = NULL;
- return FALSE;
- }
-}
-
-static snd_mixer_elem_t *
-gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
-{
- snd_mixer_elem_t *element;
- gint i, count;
-
- count = snd_mixer_get_count (handle);
-
- g_static_rec_mutex_lock (mixer->rec_mutex);
-
- /* Check if we have a playback mixer labelled as 'Master' */
- element = snd_mixer_first_elem (handle);
- for (i = 0; i < count; i++) {
- if (snd_mixer_selem_has_playback_volume (element) &&
- strcmp (snd_mixer_selem_get_name (element), "Master") == 0) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
- return element;
- }
- element = snd_mixer_elem_next (element);
- }
-
- /* If not, check if we have a playback mixer labelled as 'Front' */
- element = snd_mixer_first_elem (handle);
- for (i = 0; i < count; i++) {
- if (snd_mixer_selem_has_playback_volume (element) &&
- strcmp (snd_mixer_selem_get_name (element), "Front") == 0) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
- return element;
- }
- element = snd_mixer_elem_next (element);
- }
-
- /* If not, check if we have a playback mixer labelled as 'PCM' */
- element = snd_mixer_first_elem (handle);
- for (i = 0; i < count; i++) {
- if (snd_mixer_selem_has_playback_volume (element) &&
- strcmp (snd_mixer_selem_get_name (element), "PCM") == 0) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
- return element;
- }
- element = snd_mixer_elem_next (element);
- }
-
- /* If not, check if we have a playback mixer labelled as 'Speaker' */
- element = snd_mixer_first_elem (handle);
- for (i = 0; i < count; i++) {
- if (snd_mixer_selem_has_playback_volume (element) &&
- strcmp (snd_mixer_selem_get_name (element), "Speaker") == 0) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
- return element;
- }
- element = snd_mixer_elem_next (element);
- }
-
- /* If not, check if we have a playback mixer with both volume and switch that
- * is not mono */
- element = snd_mixer_first_elem (handle);
- for (i = 0; i < count; i++) {
- if (snd_mixer_selem_has_playback_volume (element) &&
- snd_mixer_selem_has_playback_switch (element) &&
- !snd_mixer_selem_is_playback_mono (element)) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
- return element;
- }
- element = snd_mixer_elem_next (element);
- }
-
- /* If not, check if we have any playback mixer with both volume and switch */
- element = snd_mixer_first_elem (handle);
- for (i = 0; i < count; i++) {
- if (snd_mixer_selem_has_playback_volume (element) &&
- snd_mixer_selem_has_playback_switch (element)) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
- return element;
- }
- element = snd_mixer_elem_next (element);
- }
-
- /* If not, take any playback mixer with a volume control */
- element = snd_mixer_first_elem (handle);
- for (i = 0; i < count; i++) {
- if (snd_mixer_selem_has_playback_volume (element)) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
- return element;
- }
- element = snd_mixer_elem_next (element);
- }
-
- g_static_rec_mutex_unlock (mixer->rec_mutex);
- /* Looks like we're out of luck ... */
- return NULL;
-}
-
-static void
-gst_alsa_mixer_update (GstAlsaMixer * mixer, snd_mixer_elem_t * elem)
-{
- GList *item;
-
- g_return_if_fail (mixer != NULL);
-
- g_static_rec_mutex_lock (mixer->rec_mutex);
-
- for (item = mixer->tracklist; item != NULL; item = item->next) {
- if (GST_IS_ALSA_MIXER_TRACK (item->data)) {
- if (elem && (GST_ALSA_MIXER_TRACK (item->data)->element != elem))
- continue;
-
- gst_alsa_mixer_update_track (mixer, GST_ALSA_MIXER_TRACK (item->data));
- } else if (GST_IS_ALSA_MIXER_OPTIONS (item->data)) {
- if (elem && (GST_ALSA_MIXER_OPTIONS (item->data)->element != elem))
- continue;
-
- gst_alsa_mixer_update_option (mixer, GST_ALSA_MIXER_OPTIONS (item->data));
- }
- }
-
- g_static_rec_mutex_unlock (mixer->rec_mutex);
-}
-
-static int
-gst_alsa_mixer_elem_handle_callback (snd_mixer_elem_t * elem, unsigned int mask)
-{
- GstAlsaMixer *mixer =
- (GstAlsaMixer *) snd_mixer_elem_get_callback_private (elem);
-
- GST_LOG ("ALSA elem cb");
-
- g_return_val_if_fail (mixer != NULL, 1);
-
- gst_alsa_mixer_update (mixer, elem);
-
- return 0;
-}
-
-static int
-gst_alsa_mixer_handle_callback (snd_mixer_t * handle, unsigned int mask,
- snd_mixer_elem_t * elem)
-{
- GstAlsaMixer *mixer =
- (GstAlsaMixer *) snd_mixer_get_callback_private (handle);
-
- GST_LOG ("ALSA cb");
-
- g_return_val_if_fail (mixer != NULL, 1);
-
- /* Hopefully won't be call recursively and will handle pending elem events */
- snd_mixer_handle_events (mixer->handle);
-
- gst_alsa_mixer_update (mixer, elem);
-
- return 0;
-}
-
-static void
-gst_alsa_mixer_ensure_track_list (GstAlsaMixer * mixer)
-{
- gint i, count;
- snd_mixer_elem_t *element, *master;
- GList *item;
-
- g_return_if_fail (mixer->handle != NULL);
-
- if (mixer->tracklist)
- return;
-
- g_static_rec_mutex_lock (mixer->rec_mutex);
-
- master = gst_alsa_mixer_find_master_mixer (mixer, mixer->handle);
-
- count = snd_mixer_get_count (mixer->handle);
- element = snd_mixer_first_elem (mixer->handle);
-
- /* build track list
- *
- * Some ALSA tracks may have playback and capture capabilities.
- * Here we model them as two separate GStreamer tracks.
- */
-
- for (i = 0; i < count; i++) {
- GstMixerTrack *play_track = NULL;
- GstMixerTrack *cap_track = NULL;
- const gchar *name;
- GList *item;
- gint samename = 0;
-
- name = snd_mixer_selem_get_name (element);
-
- /* prevent dup names */
- for (item = mixer->tracklist; item != NULL; item = item->next) {
- snd_mixer_elem_t *temp;
-
- if (GST_IS_ALSA_MIXER_OPTIONS (item->data))
- temp = GST_ALSA_MIXER_OPTIONS (item->data)->element;
- else
- temp = GST_ALSA_MIXER_TRACK (item->data)->element;
-
- if (strcmp (name, snd_mixer_selem_get_name (temp)) == 0)
- samename++;
- }
-
- GST_LOG ("[%s] probing element #%u, mixer->dir=%u", name, i, mixer->dir);
-
- if (mixer->dir & GST_ALSA_MIXER_PLAYBACK) {
- gboolean has_playback_switch, has_playback_volume;
-
- has_playback_switch = snd_mixer_selem_has_playback_switch (element);
- has_playback_volume = snd_mixer_selem_has_playback_volume (element);
-
- GST_LOG ("[%s] PLAYBACK: has_playback_volume=%d, has_playback_switch=%d"
- "%s", name, has_playback_volume, has_playback_switch,
- (element == master) ? " MASTER" : "");
-
- if (has_playback_volume) {
- gint flags = GST_MIXER_TRACK_OUTPUT;
-
- if (element == master)
- flags |= GST_MIXER_TRACK_MASTER;
-
- play_track = gst_alsa_mixer_track_new (element, samename, i,
- flags, FALSE, NULL, FALSE);
-
- } else if (has_playback_switch) {
- /* simple mute switch */
- play_track = gst_alsa_mixer_track_new (element, samename, i,
- GST_MIXER_TRACK_OUTPUT, TRUE, NULL, FALSE);
- }
-
- if (snd_mixer_selem_is_enumerated (element)) {
- GstMixerOptions *opts = gst_alsa_mixer_options_new (element, i);
-
- GST_LOG ("[%s] is enumerated (%d)", name, i);
- mixer->tracklist = g_list_append (mixer->tracklist, opts);
- }
- }
-
- if (mixer->dir & GST_ALSA_MIXER_CAPTURE) {
- gboolean has_capture_switch, has_common_switch;
- gboolean has_capture_volume, has_common_volume;
-
- has_capture_switch = snd_mixer_selem_has_capture_switch (element);
- has_common_switch = snd_mixer_selem_has_common_switch (element);
- has_capture_volume = snd_mixer_selem_has_capture_volume (element);
- has_common_volume = snd_mixer_selem_has_common_volume (element);
-
- GST_LOG ("[%s] CAPTURE: has_capture_volume=%d, has_common_volume=%d, "
- "has_capture_switch=%d, has_common_switch=%d, play_track=%p", name,
- has_capture_volume, has_common_volume, has_capture_switch,
- has_common_switch, play_track);
-
- if (has_capture_volume && !(play_track && has_common_volume)) {
- cap_track = gst_alsa_mixer_track_new (element, samename, i,
- GST_MIXER_TRACK_INPUT, FALSE, NULL, play_track != NULL);
- } else if (has_capture_switch && !(play_track && has_common_switch)) {
- cap_track = gst_alsa_mixer_track_new (element, samename, i,
- GST_MIXER_TRACK_INPUT, TRUE, NULL, play_track != NULL);
- }
- }
-
-
- if (play_track && cap_track) {
- GST_ALSA_MIXER_TRACK (play_track)->shared_mute =
- GST_ALSA_MIXER_TRACK (cap_track);
- GST_ALSA_MIXER_TRACK (cap_track)->shared_mute =
- GST_ALSA_MIXER_TRACK (play_track);
- }
-
- if (play_track)
- mixer->tracklist = g_list_append (mixer->tracklist, play_track);
-
- if (cap_track)
- mixer->tracklist = g_list_append (mixer->tracklist, cap_track);
-
- element = snd_mixer_elem_next (element);
- }
-
- for (item = mixer->tracklist; item != NULL; item = item->next) {
- snd_mixer_elem_t *temp;
-
- if (GST_IS_ALSA_MIXER_OPTIONS (item->data))
- temp = GST_ALSA_MIXER_OPTIONS (item->data)->element;
- else
- temp = GST_ALSA_MIXER_TRACK (item->data)->element;
-
- snd_mixer_elem_set_callback (temp, gst_alsa_mixer_elem_handle_callback);
- snd_mixer_elem_set_callback_private (temp, mixer);
- }
-
- g_static_rec_mutex_unlock (mixer->rec_mutex);
-}
-
-static void
-task_monitor_alsa (gpointer data)
-{
- struct pollfd *pfds;
- unsigned int nfds, rnfds;
- unsigned short revents;
- GstAlsaMixer *mixer = (GstAlsaMixer *) data;
-
- g_static_rec_mutex_lock (mixer->rec_mutex);
-
- nfds = snd_mixer_poll_descriptors_count (mixer->handle);
- if (nfds <= 0) {
- GST_ERROR ("snd_mixer_poll_descriptors_count <= 0: %d", nfds);
- /* FIXME: sleep ? stop monitoring ? */
- g_static_rec_mutex_unlock (mixer->rec_mutex);
- return;
- }
-
- pfds = g_newa (struct pollfd, nfds + 1);
- rnfds = snd_mixer_poll_descriptors (mixer->handle, pfds, nfds);
- g_assert (rnfds <= nfds);
-
- pfds[rnfds].fd = mixer->pfd[0];
- pfds[rnfds].events = POLLIN | POLLPRI | POLLHUP | POLLERR;
- pfds[rnfds].revents = 0;
-
- g_static_rec_mutex_unlock (mixer->rec_mutex);
-
- GST_LOG ("task loop");
- poll (pfds, rnfds + 1, -1);
-
- g_static_rec_mutex_lock (mixer->rec_mutex);
-
- snd_mixer_poll_descriptors_revents (mixer->handle, pfds, nfds, &revents);
- if (revents & POLLIN || revents & POLLPRI) {
- GST_DEBUG ("Handling events");
- snd_mixer_handle_events (mixer->handle);
- }
-
- g_static_rec_mutex_unlock (mixer->rec_mutex);
-}
-
-/* API */
-
-GstAlsaMixer *
-gst_alsa_mixer_new (const char *device, GstAlsaMixerDirection dir)
-{
- GstAlsaMixer *ret = NULL;
-
- g_return_val_if_fail (device != NULL, NULL);
-
- ret = g_new0 (GstAlsaMixer, 1);
-
- if (pipe (ret->pfd) == -1)
- goto error;
-
- ret->rec_mutex = g_new (GStaticRecMutex, 1);
- g_static_rec_mutex_init (ret->rec_mutex);
-
- ret->task_mutex = g_new (GStaticRecMutex, 1);
- g_static_rec_mutex_init (ret->task_mutex);
-
- ret->task = gst_task_create (task_monitor_alsa, ret);
- gst_task_set_lock (ret->task, ret->task_mutex);
-
- ret->device = g_strdup (device);
- ret->dir = dir;
-
- if (!gst_alsa_mixer_open (ret))
- goto error;
-
- if (gst_task_start (ret->task) == FALSE) {
- GST_WARNING ("Could not start alsamixer task");
- }
-
- return ret;
-
- /* ERRORS */
-error:
- {
- gst_alsa_mixer_free (ret);
- return NULL;
- }
-}
-
-void
-gst_alsa_mixer_free (GstAlsaMixer * mixer)
-{
- g_return_if_fail (mixer != NULL);
-
- if (mixer->task) {
- if (write (mixer->pfd[1], "stop", 5) <= 0) {
- GST_ERROR ("Cannot send " "stop" " to alsamixer task");
- close (mixer->pfd[1]);
- mixer->pfd[1] = -1;
- }
-
- if (gst_task_join (mixer->task) == FALSE) {
- GST_ERROR ("Cannot join alsamixer task");
- }
-
- gst_object_unref (mixer->task);
- mixer->task = NULL;
- }
-
- g_static_rec_mutex_free (mixer->task_mutex);
- g_free (mixer->task_mutex);
- mixer->task_mutex = NULL;
-
- if (mixer->pfd[0] > 0) {
- close (mixer->pfd[0]);
- mixer->pfd[0] = -1;
- }
-
- if (mixer->pfd[1] > 0) {
- close (mixer->pfd[1]);
- mixer->pfd[1] = -1;
- }
-
- if (mixer->interface) {
- g_object_unref (G_OBJECT (mixer->interface));
- mixer->interface = NULL;
- }
-
- if (mixer->device) {
- g_free (mixer->device);
- mixer->device = NULL;
- }
-
- if (mixer->cardname) {
- g_free (mixer->cardname);
- mixer->cardname = NULL;
- }
-
- if (mixer->tracklist) {
- g_list_foreach (mixer->tracklist, (GFunc) g_object_unref, NULL);
- g_list_free (mixer->tracklist);
- mixer->tracklist = NULL;
- }
-
- if (mixer->handle) {
- snd_mixer_close (mixer->handle);
- mixer->handle = NULL;
- }
-
- g_static_rec_mutex_free (mixer->rec_mutex);
- g_free (mixer->rec_mutex);
- mixer->rec_mutex = NULL;
-
- g_free (mixer);
-}
-
-const GList *
-gst_alsa_mixer_list_tracks (GstAlsaMixer * mixer)
-{
- g_return_val_if_fail (mixer->handle != NULL, NULL);
-
- gst_alsa_mixer_ensure_track_list (mixer);
-
- return (const GList *) mixer->tracklist;
-}
-
-void
-gst_alsa_mixer_get_volume (GstAlsaMixer * mixer, GstMixerTrack * track,
- gint * volumes)
-{
- gint i;
- GstAlsaMixerTrack *alsa_track = GST_ALSA_MIXER_TRACK (track);
-
- g_return_if_fail (mixer->handle != NULL);
-
- g_static_rec_mutex_lock (mixer->rec_mutex);
-
- gst_alsa_mixer_track_update (alsa_track);
-
- if (track->flags & GST_MIXER_TRACK_OUTPUT) { /* return playback volume */
-
- /* Is emulated mute flag activated? */
- if (track->flags & GST_MIXER_TRACK_MUTE &&
- !(alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_PSWITCH)) {
- for (i = 0; i < track->num_channels; i++)
- volumes[i] = alsa_track->volumes[i];
- } else {
- for (i = 0; i < track->num_channels; i++) {
- long tmp = 0;
-
- snd_mixer_selem_get_playback_volume (alsa_track->element, i, &tmp);
- alsa_track->volumes[i] = volumes[i] = (gint) tmp;
- }
- }
-
- } else if (track->flags & GST_MIXER_TRACK_INPUT) { /* return capture volume */
-
- /* Is emulated record flag activated? */
- if (alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH ||
- track->flags & GST_MIXER_TRACK_RECORD) {
- for (i = 0; i < track->num_channels; i++) {
- long tmp = 0;
-
- snd_mixer_selem_get_capture_volume (alsa_track->element, i, &tmp);
- alsa_track->volumes[i] = volumes[i] = (gint) tmp;
- }
- } else {
- for (i = 0; i < track->num_channels; i++)
- volumes[i] = alsa_track->volumes[i];
- }
- }
- g_static_rec_mutex_unlock (mixer->rec_mutex);
-}
-
-static gboolean
-check_if_volumes_are_the_same (guint num_channels, gint * volumes)
-{
- guint i;
-
- if (num_channels <= 1)
- return TRUE;
-
- for (i = 1; i < num_channels; i++) {
- if (volumes[i] != volumes[0])
- return FALSE;
- }
-
- return TRUE;
-}
-
-void
-gst_alsa_mixer_set_volume (GstAlsaMixer * mixer, GstMixerTrack * track,
- gint * volumes)
-{
- GstAlsaMixerTrack *alsa_track = GST_ALSA_MIXER_TRACK (track);
- gint i;
-
- g_return_if_fail (mixer->handle != NULL);
-
- g_static_rec_mutex_lock (mixer->rec_mutex);
-
- gst_alsa_mixer_track_update (alsa_track);
-
- if (track->flags & GST_MIXER_TRACK_OUTPUT) {
-
- /* Is emulated mute flag activated? */
- if (track->flags & GST_MIXER_TRACK_MUTE &&
- !(alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_PSWITCH)) {
- for (i = 0; i < track->num_channels; i++)
- alsa_track->volumes[i] = volumes[i];
- } else {
- if (check_if_volumes_are_the_same (track->num_channels, volumes)) {
- snd_mixer_selem_set_playback_volume_all (alsa_track->element,
- volumes[0]);
- for (i = 0; i < track->num_channels; i++)
- alsa_track->volumes[i] = volumes[0];
- } else {
- for (i = 0; i < track->num_channels; i++) {
- alsa_track->volumes[i] = volumes[i];
- snd_mixer_selem_set_playback_volume (alsa_track->element, i,
- volumes[i]);
- }
- }
- }
-
- } else if (track->flags & GST_MIXER_TRACK_INPUT) {
-
- /* Is emulated record flag activated? */
- if (track->flags & GST_MIXER_TRACK_RECORD ||
- alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH) {
- if (check_if_volumes_are_the_same (track->num_channels, volumes)) {
- snd_mixer_selem_set_capture_volume_all (alsa_track->element,
- volumes[0]);
- for (i = 0; i < track->num_channels; i++)
- alsa_track->volumes[i] = volumes[0];
- } else {
- for (i = 0; i < track->num_channels; i++) {
- alsa_track->volumes[i] = volumes[i];
- snd_mixer_selem_set_capture_volume (alsa_track->element, i,
- volumes[i]);
- }
- }
- } else {
- for (i = 0; i < track->num_channels; i++)
- alsa_track->volumes[i] = volumes[i];
- }
- }
- g_static_rec_mutex_unlock (mixer->rec_mutex);
-}
-
-void
-gst_alsa_mixer_set_mute (GstAlsaMixer * mixer, GstMixerTrack * track,
- gboolean mute)
-{
- GstAlsaMixerTrack *alsa_track = GST_ALSA_MIXER_TRACK (track);
-
- g_return_if_fail (mixer->handle != NULL);
-
- g_static_rec_mutex_lock (mixer->rec_mutex);
-
- gst_alsa_mixer_track_update (alsa_track);
-
- if (!!(mute) == !!(track->flags & GST_MIXER_TRACK_MUTE)) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
- return;
- }
- if (mute) {
- track->flags |= GST_MIXER_TRACK_MUTE;
-
- if (alsa_track->shared_mute)
- ((GstMixerTrack *) (alsa_track->shared_mute))->flags |=
- GST_MIXER_TRACK_MUTE;
- } else {
- track->flags &= ~GST_MIXER_TRACK_MUTE;
-
- if (alsa_track->shared_mute)
- ((GstMixerTrack *) (alsa_track->shared_mute))->flags &=
- ~GST_MIXER_TRACK_MUTE;
- }
-
- if (alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_PSWITCH) {
- snd_mixer_selem_set_playback_switch_all (alsa_track->element, mute ? 0 : 1);
- } else {
- gint i;
- GstAlsaMixerTrack *ctrl_track;
-
- if ((track->flags & GST_MIXER_TRACK_INPUT)
- && alsa_track->shared_mute != NULL)
- ctrl_track = alsa_track->shared_mute;
- else
- ctrl_track = alsa_track;
-
- for (i = 0; i < ((GstMixerTrack *) ctrl_track)->num_channels; i++) {
- long vol =
- mute ? ((GstMixerTrack *) ctrl_track)->min_volume : ctrl_track->
- volumes[i];
- snd_mixer_selem_set_playback_volume (ctrl_track->element, i, vol);
- }
- }
- g_static_rec_mutex_unlock (mixer->rec_mutex);
-}
-
-void
-gst_alsa_mixer_set_record (GstAlsaMixer * mixer,
- GstMixerTrack * track, gboolean record)
-{
- GstAlsaMixerTrack *alsa_track = GST_ALSA_MIXER_TRACK (track);
-
- g_return_if_fail (mixer->handle != NULL);
-
- g_static_rec_mutex_lock (mixer->rec_mutex);
-
- gst_alsa_mixer_track_update (alsa_track);
-
- if (!!(record) == !!(track->flags & GST_MIXER_TRACK_RECORD)) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
- return;
- }
-
- if (record) {
- track->flags |= GST_MIXER_TRACK_RECORD;
- } else {
- track->flags &= ~GST_MIXER_TRACK_RECORD;
- }
-
- if (alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH) {
- snd_mixer_selem_set_capture_switch_all (alsa_track->element,
- record ? 1 : 0);
-
- /* update all tracks in same exlusive cswitch group */
- if (alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH_EXCL) {
- GList *item;
-
- for (item = mixer->tracklist; item != NULL; item = item->next) {
-
- if (GST_IS_ALSA_MIXER_TRACK (item->data)) {
- GstAlsaMixerTrack *item_alsa_track =
- GST_ALSA_MIXER_TRACK (item->data);
-
- if (item_alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH_EXCL &&
- item_alsa_track->capture_group == alsa_track->capture_group) {
- gst_alsa_mixer_track_update (item_alsa_track);
- }
- }
- }
- }
- } else {
- gint i;
-
- for (i = 0; i < track->num_channels; i++) {
- long vol = record ? alsa_track->volumes[i] : track->min_volume;
-
- snd_mixer_selem_set_capture_volume (alsa_track->element, i, vol);
- }
- }
- g_static_rec_mutex_unlock (mixer->rec_mutex);
-}
-
-void
-gst_alsa_mixer_set_option (GstAlsaMixer * mixer,
- GstMixerOptions * opts, gchar * value)
-{
- gint idx = -1, n = 0;
- GList *item;
- GstAlsaMixerOptions *alsa_opts = GST_ALSA_MIXER_OPTIONS (opts);
-
- g_return_if_fail (mixer->handle != NULL);
-
- for (item = opts->values; item != NULL; item = item->next, n++) {
- if (!strcmp (item->data, value)) {
- idx = n;
- break;
- }
- }
- if (idx == -1)
- return;
-
- g_static_rec_mutex_lock (mixer->rec_mutex);
- snd_mixer_selem_set_enum_item (alsa_opts->element, 0, idx);
- g_static_rec_mutex_unlock (mixer->rec_mutex);
-}
-
-const gchar *
-gst_alsa_mixer_get_option (GstAlsaMixer * mixer, GstMixerOptions * opts)
-{
- gint ret;
- guint idx;
- GstAlsaMixerOptions *alsa_opts = GST_ALSA_MIXER_OPTIONS (opts);
-
- g_return_val_if_fail (mixer->handle != NULL, NULL);
- g_static_rec_mutex_lock (mixer->rec_mutex);
- ret = snd_mixer_selem_get_enum_item (alsa_opts->element, 0, &idx);
- g_static_rec_mutex_unlock (mixer->rec_mutex);
- if (ret == 0)
- return g_list_nth_data (opts->values, idx);
- else
- return snd_strerror (ret); /* feeble attempt at error handling */
-}
-
-GstMixerFlags
-gst_alsa_mixer_get_mixer_flags (GstAlsaMixer * mixer)
-{
- g_return_val_if_fail (mixer != NULL, GST_MIXER_FLAG_NONE);
-
- return GST_MIXER_FLAG_AUTO_NOTIFICATIONS;
-}
-
-static void
-gst_alsa_mixer_update_option (GstAlsaMixer * mixer,
- GstAlsaMixerOptions * alsa_opts)
-{
- gint ret;
- guint idx;
- /* const */ gchar *option;
-
- if (mixer->interface == NULL) {
- GST_WARNING ("Cannot send update notifications, no GstMixer * given");
- return;
- }
- g_static_rec_mutex_lock (mixer->rec_mutex);
- ret = snd_mixer_selem_get_enum_item (alsa_opts->element, 0, &idx);
- g_static_rec_mutex_unlock (mixer->rec_mutex);
- if (ret == 0) {
- option = g_list_nth_data (GST_MIXER_OPTIONS (alsa_opts)->values, idx);
- gst_mixer_option_changed (mixer->interface, GST_MIXER_OPTIONS (alsa_opts),
- option);
- }
-}
-
-static void
-gst_alsa_mixer_update_track (GstAlsaMixer * mixer,
- GstAlsaMixerTrack * alsa_track)
-{
- GstMixerTrack *track = (GstMixerTrack *) alsa_track;
- gboolean old_mute;
- gboolean old_record;
- gint i, n_channels;
- gint *old_volumes;
-
- GST_DEBUG ("Updating track %" GST_PTR_FORMAT, alsa_track);
-
- if (mixer->interface == NULL) {
- GST_WARNING ("Cannot send update notifications, no GstMixer * given");
- return;
- }
-
- old_mute = !!(GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE));
- old_record = !!(GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_RECORD));
- old_volumes = g_new (gint, track->num_channels);
- n_channels = track->num_channels;
- memcpy (old_volumes, alsa_track->volumes,
- sizeof (gint) * track->num_channels);
-
- gst_alsa_mixer_track_update (alsa_track);
-
- if (old_record !=
- !!(GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_RECORD))) {
- gst_mixer_record_toggled (mixer->interface, track,
- !!GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_RECORD));
- }
- if (old_mute != !!(GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE))) {
- gst_mixer_mute_toggled (mixer->interface, track,
- !!GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE));
- }
-
- n_channels = MIN (n_channels, track->num_channels);
- for (i = 0; i < n_channels; i++) {
- if (old_volumes[i] != alsa_track->volumes[i]) {
- gst_mixer_volume_changed (mixer->interface, track, alsa_track->volumes);
- break;
- }
- }
- g_free (old_volumes);
-}
-
-/* utility function for gstalsamixerelement to set the interface */
-void
-_gst_alsa_mixer_set_interface (GstAlsaMixer * mixer, GstMixer * interface)
-{
- g_return_if_fail (mixer != NULL && mixer->interface == NULL);
- g_return_if_fail (interface != NULL);
-
- mixer->interface = g_object_ref (G_OBJECT (interface));
-}
diff --git a/ext/alsa/gstalsamixer.h b/ext/alsa/gstalsamixer.h
deleted file mode 100644
index ccc37845..00000000
--- a/ext/alsa/gstalsamixer.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/* ALSA mixer interface implementation.
- * Copyright (C) 2003 Leif Johnson <leif@ambient.2y.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., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#ifndef __GST_ALSA_MIXER_H__
-#define __GST_ALSA_MIXER_H__
-
-
-#include "gstalsa.h"
-
-#include <gst/interfaces/mixer.h>
-#include "gstalsamixeroptions.h"
-#include "gstalsamixertrack.h"
-
-
-G_BEGIN_DECLS
-
-/* This does not get you what you think it does, use obj->mixer */
-/* #define GST_ALSA_MIXER(obj) ((GstAlsaMixer*)(obj)) */
-
-typedef struct _GstAlsaMixer GstAlsaMixer;
-
-typedef enum {
- GST_ALSA_MIXER_CAPTURE = 1<<0,
- GST_ALSA_MIXER_PLAYBACK = 1<<1,
- GST_ALSA_MIXER_ALL = GST_ALSA_MIXER_CAPTURE | GST_ALSA_MIXER_PLAYBACK
-} GstAlsaMixerDirection;
-
-/**
- * GstAlsaMixer:
- *
- * Opaque data structure
- */
-struct _GstAlsaMixer
-{
- GList * tracklist; /* list of available tracks */
-
- snd_mixer_t * handle;
-
- GstTask * task;
- GStaticRecMutex * task_mutex;
- GStaticRecMutex * rec_mutex;
-
- int pfd[2];
-
- GstMixer * interface;
- gchar * device;
- gchar * cardname;
-
- GstAlsaMixerDirection dir;
-};
-
-
-GstAlsaMixer* gst_alsa_mixer_new (const gchar *device,
- GstAlsaMixerDirection dir);
-void gst_alsa_mixer_free (GstAlsaMixer *mixer);
-
-const GList* gst_alsa_mixer_list_tracks (GstAlsaMixer * mixer);
-void gst_alsa_mixer_set_volume (GstAlsaMixer * mixer,
- GstMixerTrack * track,
- gint * volumes);
-void gst_alsa_mixer_get_volume (GstAlsaMixer * mixer,
- GstMixerTrack * track,
- gint * volumes);
-void gst_alsa_mixer_set_record (GstAlsaMixer * mixer,
- GstMixerTrack * track,
- gboolean record);
-void gst_alsa_mixer_set_mute (GstAlsaMixer * mixer,
- GstMixerTrack * track,
- gboolean mute);
-void gst_alsa_mixer_set_option (GstAlsaMixer * mixer,
- GstMixerOptions * opts,
- gchar * value);
-const gchar* gst_alsa_mixer_get_option (GstAlsaMixer * mixer,
- GstMixerOptions * opts);
-void _gst_alsa_mixer_set_interface (GstAlsaMixer * mixer,
- GstMixer * interface);
-GstMixerFlags gst_alsa_mixer_get_mixer_flags (GstAlsaMixer *mixer);
-
-#define GST_IMPLEMENT_ALSA_MIXER_METHODS(Type, interface_as_function) \
-static gboolean \
-interface_as_function ## _supported (Type *this, GType iface_type) \
-{ \
- g_assert (iface_type == GST_TYPE_MIXER); \
- \
- return (this->mixer != NULL); \
-} \
- \
-static const GList* \
-interface_as_function ## _list_tracks (GstMixer * mixer) \
-{ \
- Type *this = (Type*) mixer; \
- \
- g_return_val_if_fail (this != NULL, NULL); \
- g_return_val_if_fail (this->mixer != NULL, NULL); \
- \
- return gst_alsa_mixer_list_tracks (this->mixer); \
-} \
- \
-static void \
-interface_as_function ## _set_volume (GstMixer * mixer, GstMixerTrack * track, \
- gint * volumes) \
-{ \
- Type *this = (Type*) mixer; \
- \
- g_return_if_fail (this != NULL); \
- g_return_if_fail (this->mixer != NULL); \
- \
- gst_alsa_mixer_set_volume (this->mixer, track, volumes); \
-} \
- \
-static void \
-interface_as_function ## _get_volume (GstMixer * mixer, GstMixerTrack * track, \
- gint * volumes) \
-{ \
- Type *this = (Type*) mixer; \
- \
- g_return_if_fail (this != NULL); \
- g_return_if_fail (this->mixer != NULL); \
- \
- gst_alsa_mixer_get_volume (this->mixer, track, volumes); \
-} \
- \
-static void \
-interface_as_function ## _set_record (GstMixer * mixer, GstMixerTrack * track, \
- gboolean record) \
-{ \
- Type *this = (Type*) mixer; \
- \
- g_return_if_fail (this != NULL); \
- g_return_if_fail (this->mixer != NULL); \
- \
- gst_alsa_mixer_set_record (this->mixer, track, record); \
-} \
- \
-static void \
-interface_as_function ## _set_mute (GstMixer * mixer, GstMixerTrack * track, \
- gboolean mute) \
-{ \
- Type *this = (Type*) mixer; \
- \
- g_return_if_fail (this != NULL); \
- g_return_if_fail (this->mixer != NULL); \
- \
- gst_alsa_mixer_set_mute (this->mixer, track, mute); \
-} \
- \
-static void \
-interface_as_function ## _set_option (GstMixer * mixer, GstMixerOptions * opts, \
- gchar * value) \
-{ \
- Type *this = (Type*) mixer; \
- \
- g_return_if_fail (this != NULL); \
- g_return_if_fail (this->mixer != NULL); \
- \
- gst_alsa_mixer_set_option (this->mixer, opts, value); \
-} \
- \
-static const gchar* \
-interface_as_function ## _get_option (GstMixer * mixer, GstMixerOptions * opts) \
-{ \
- Type *this = (Type*) mixer; \
- \
- g_return_val_if_fail (this != NULL, NULL); \
- g_return_val_if_fail (this->mixer != NULL, NULL); \
- \
- return gst_alsa_mixer_get_option (this->mixer, opts); \
-} \
- \
-static GstMixerFlags \
-interface_as_function ## _get_mixer_flags (GstMixer * mixer) \
-{ \
- Type *this = (Type*) mixer; \
- \
- g_return_val_if_fail (this != NULL, GST_MIXER_FLAG_NONE); \
- g_return_val_if_fail (this->mixer != NULL, GST_MIXER_FLAG_NONE); \
- \
- return gst_alsa_mixer_get_mixer_flags (this->mixer); \
-} \
- \
-static void \
-interface_as_function ## _interface_init (GstMixerClass * klass) \
-{ \
- GST_MIXER_TYPE (klass) = GST_MIXER_HARDWARE; \
- \
- /* set up the interface hooks */ \
- klass->list_tracks = interface_as_function ## _list_tracks; \
- klass->set_volume = interface_as_function ## _set_volume; \
- klass->get_volume = interface_as_function ## _get_volume; \
- klass->set_mute = interface_as_function ## _set_mute; \
- klass->set_record = interface_as_function ## _set_record; \
- klass->set_option = interface_as_function ## _set_option; \
- klass->get_option = interface_as_function ## _get_option; \
- klass->get_mixer_flags = interface_as_function ## _get_mixer_flags; \
-}
-
-
-G_END_DECLS
-
-
-#endif /* __GST_ALSA_MIXER_H__ */
diff --git a/ext/alsa/gstalsamixerelement.c b/ext/alsa/gstalsamixerelement.c
deleted file mode 100644
index 57e35263..00000000
--- a/ext/alsa/gstalsamixerelement.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/* ALSA mixer implementation.
- * Copyright (C) 2003 Leif Johnson <leif@ambient.2y.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstalsamixerelement.h"
-#include "gstalsadeviceprobe.h"
-
-#define DEFAULT_PROP_DEVICE "default"
-#define DEFAULT_PROP_DEVICE_NAME ""
-
-enum
-{
- PROP_0,
- PROP_DEVICE,
- PROP_DEVICE_NAME
-};
-
-static const GstElementDetails gst_alsa_mixer_element_details =
-GST_ELEMENT_DETAILS ("Alsa mixer",
- "Generic/Audio",
- "Control sound input and output levels with ALSA",
- "Leif Johnson <leif@ambient.2y.net>");
-
-static void gst_alsa_mixer_element_init_interfaces (GType type);
-
-GST_BOILERPLATE_FULL (GstAlsaMixerElement, gst_alsa_mixer_element,
- GstElement, GST_TYPE_ELEMENT, gst_alsa_mixer_element_init_interfaces);
-
-/* massive macro that takes care of all the GstMixer stuff */
-GST_IMPLEMENT_ALSA_MIXER_METHODS (GstAlsaMixerElement, gst_alsa_mixer_element);
-
-static void gst_alsa_mixer_element_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-static void gst_alsa_mixer_element_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_alsa_mixer_element_finalize (GObject * object);
-
-static GstStateChangeReturn gst_alsa_mixer_element_change_state (GstElement
- * element, GstStateChange transition);
-
-static gboolean
-gst_alsa_mixer_element_interface_supported (GstAlsaMixerElement * this,
- GType interface_type)
-{
- if (interface_type == GST_TYPE_MIXER) {
- return gst_alsa_mixer_element_supported (this, interface_type);
- }
-
- g_return_val_if_reached (FALSE);
-}
-
-static void
-gst_implements_interface_init (GstImplementsInterfaceClass * klass)
-{
- klass->supported = (gpointer) gst_alsa_mixer_element_interface_supported;
-}
-
-static void
-gst_alsa_mixer_element_init_interfaces (GType type)
-{
- static const GInterfaceInfo implements_iface_info = {
- (GInterfaceInitFunc) gst_implements_interface_init,
- NULL,
- NULL,
- };
- static const GInterfaceInfo mixer_iface_info = {
- (GInterfaceInitFunc) gst_alsa_mixer_element_interface_init,
- NULL,
- NULL,
- };
-
- g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE,
- &implements_iface_info);
- g_type_add_interface_static (type, GST_TYPE_MIXER, &mixer_iface_info);
-
- gst_alsa_type_add_device_property_probe_interface (type);
-}
-
-static void
-gst_alsa_mixer_element_base_init (gpointer klass)
-{
- gst_element_class_set_details (GST_ELEMENT_CLASS (klass),
- &gst_alsa_mixer_element_details);
-}
-
-static void
-gst_alsa_mixer_element_class_init (GstAlsaMixerElementClass * klass)
-{
- GstElementClass *element_class;
- GObjectClass *gobject_class;
-
- element_class = (GstElementClass *) klass;
- gobject_class = (GObjectClass *) klass;
-
- gobject_class->finalize = gst_alsa_mixer_element_finalize;
- gobject_class->get_property = gst_alsa_mixer_element_get_property;
- gobject_class->set_property = gst_alsa_mixer_element_set_property;
-
- g_object_class_install_property (gobject_class, PROP_DEVICE,
- g_param_spec_string ("device", "Device",
- "ALSA device, as defined in an asound configuration file",
- DEFAULT_PROP_DEVICE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_DEVICE_NAME,
- g_param_spec_string ("device-name", "Device name",
- "Human-readable name of the sound device",
- DEFAULT_PROP_DEVICE_NAME, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- element_class->change_state =
- GST_DEBUG_FUNCPTR (gst_alsa_mixer_element_change_state);
-}
-
-static void
-gst_alsa_mixer_element_finalize (GObject * obj)
-{
- GstAlsaMixerElement *this = GST_ALSA_MIXER_ELEMENT (obj);
-
- g_free (this->device);
-
- G_OBJECT_CLASS (parent_class)->finalize (obj);
-}
-
-static void
-gst_alsa_mixer_element_init (GstAlsaMixerElement * this,
- GstAlsaMixerElementClass * klass)
-{
- this->mixer = NULL;
- this->device = g_strdup (DEFAULT_PROP_DEVICE);
-}
-
-static void
-gst_alsa_mixer_element_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstAlsaMixerElement *this = GST_ALSA_MIXER_ELEMENT (object);
-
- switch (prop_id) {
- case PROP_DEVICE:{
- GST_OBJECT_LOCK (this);
- g_free (this->device);
- this->device = g_value_dup_string (value);
- /* make sure we never set NULL, this is nice when we want to open the
- * device. */
- if (this->device == NULL)
- this->device = g_strdup (DEFAULT_PROP_DEVICE);
- GST_OBJECT_UNLOCK (this);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_alsa_mixer_element_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstAlsaMixerElement *this = GST_ALSA_MIXER_ELEMENT (object);
-
- switch (prop_id) {
- case PROP_DEVICE:{
- GST_OBJECT_LOCK (this);
- g_value_set_string (value, this->device);
- GST_OBJECT_UNLOCK (this);
- break;
- }
- case PROP_DEVICE_NAME:{
- GST_OBJECT_LOCK (this);
- if (this->mixer) {
- g_value_set_string (value, this->mixer->cardname);
- } else {
- g_value_set_string (value, NULL);
- }
- GST_OBJECT_UNLOCK (this);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstStateChangeReturn
-gst_alsa_mixer_element_change_state (GstElement * element,
- GstStateChange transition)
-{
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
- GstAlsaMixerElement *this = GST_ALSA_MIXER_ELEMENT (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- if (!this->mixer) {
- this->mixer = gst_alsa_mixer_new (this->device, GST_ALSA_MIXER_ALL);
- if (!this->mixer)
- goto open_failed;
- _gst_alsa_mixer_set_interface (this->mixer, GST_MIXER (element));
- }
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- if (ret == GST_STATE_CHANGE_FAILURE)
- return ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_NULL:
- if (this->mixer) {
- gst_alsa_mixer_free (this->mixer);
- this->mixer = NULL;
- }
- break;
- default:
- break;
- }
-
- return ret;
-
- /* ERRORS */
-open_failed:
- {
- GST_ELEMENT_ERROR (element, RESOURCE, OPEN_READ_WRITE, (NULL),
- ("Failed to open alsa mixer device '%s'", this->device));
- return GST_STATE_CHANGE_FAILURE;
- }
-}
diff --git a/ext/alsa/gstalsamixerelement.h b/ext/alsa/gstalsamixerelement.h
deleted file mode 100644
index 16cb2458..00000000
--- a/ext/alsa/gstalsamixerelement.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* ALSA mixer interface implementation.
- * Copyright (C) 2003 Leif Johnson <leif@ambient.2y.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., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#ifndef __GST_ALSA_MIXER_ELEMENT_H__
-#define __GST_ALSA_MIXER_ELEMENT_H__
-
-
-#include "gstalsa.h"
-#include "gstalsamixer.h"
-
-G_BEGIN_DECLS
-
-#define GST_ALSA_MIXER_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ALSA_MIXER_ELEMENT,GstAlsaMixerElement))
-#define GST_ALSA_MIXER_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ALSA_MIXER_ELEMENT,GstAlsaMixerElementClass))
-#define GST_IS_ALSA_MIXER_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ALSA_MIXER_ELEMENT))
-#define GST_IS_ALSA_MIXER_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ALSA_MIXER_ELEMENT))
-#define GST_TYPE_ALSA_MIXER_ELEMENT (gst_alsa_mixer_element_get_type())
-
-typedef struct _GstAlsaMixerElement GstAlsaMixerElement;
-typedef struct _GstAlsaMixerElementClass GstAlsaMixerElementClass;
-
-/**
- * GstAlsaMixerElement
- *
- * Opaque datastructure.
- */
-struct _GstAlsaMixerElement {
- GstElement parent;
-
- GstAlsaMixer *mixer;
- gchar *device;
-};
-
-struct _GstAlsaMixerElementClass {
- GstElementClass parent;
-};
-
-
-GType gst_alsa_mixer_element_get_type (void);
-
-
-G_END_DECLS
-
-
-#endif /* __GST_ALSA_MIXER_ELEMENT_H__ */
diff --git a/ext/alsa/gstalsamixeroptions.c b/ext/alsa/gstalsamixeroptions.c
deleted file mode 100644
index 20bb89d7..00000000
--- a/ext/alsa/gstalsamixeroptions.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* ALSA mixer object implementation.
- * Copyright (C) 2003 Leif Johnson <leif@ambient.2y.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstalsamixeroptions.h"
-
-static void gst_alsa_mixer_options_init (GstAlsaMixerOptions * alsa_opts);
-static void gst_alsa_mixer_options_class_init (gpointer g_class,
- gpointer class_data);
-
-static GstMixerOptionsClass *parent_class = NULL;
-
-GType
-gst_alsa_mixer_options_get_type (void)
-{
- static GType opts_type = 0;
-
- if (!opts_type) {
- static const GTypeInfo opts_info = {
- sizeof (GstAlsaMixerOptionsClass),
- NULL,
- NULL,
- gst_alsa_mixer_options_class_init,
- NULL,
- NULL,
- sizeof (GstAlsaMixerOptions),
- 0,
- (GInstanceInitFunc) gst_alsa_mixer_options_init,
- };
-
- opts_type =
- g_type_register_static (GST_TYPE_MIXER_OPTIONS, "GstAlsaMixerOptions",
- &opts_info, 0);
- }
-
- return opts_type;
-}
-
-static void
-gst_alsa_mixer_options_class_init (gpointer g_class, gpointer class_data)
-{
- parent_class = g_type_class_peek_parent (g_class);
-}
-
-static void
-gst_alsa_mixer_options_init (GstAlsaMixerOptions * alsa_opts)
-{
-}
-
-GstMixerOptions *
-gst_alsa_mixer_options_new (snd_mixer_elem_t * element, gint track_num)
-{
- GstMixerOptions *opts;
- GstAlsaMixerOptions *alsa_opts;
- GstMixerTrack *track;
- const gchar *label;
- guint index;
- gint num, i;
- gchar str[256];
-
- label = snd_mixer_selem_get_name (element);
- index = snd_mixer_selem_get_index (element);
-
- GST_LOG ("[%s,%u]", label, index);
-
- opts = g_object_new (GST_ALSA_MIXER_OPTIONS_TYPE,
- "untranslated-label", label, "index", index, NULL);
- alsa_opts = (GstAlsaMixerOptions *) opts;
- track = (GstMixerTrack *) opts;
-
- /* set basic information */
- track->label = g_strdup (label); /* FIXME: translate this? */
- track->num_channels = 0;
- track->flags = 0;
- alsa_opts->element = element;
- alsa_opts->track_num = track_num;
-
- /* get enumerations for switch/options object */
- num = snd_mixer_selem_get_enum_items (element);
- for (i = 0; i < num; i++) {
- if (snd_mixer_selem_get_enum_item_name (element, i, 255, str) < 0) {
- g_object_unref (G_OBJECT (alsa_opts));
- return NULL;
- }
-
- opts->values = g_list_append (opts->values, g_strdup (str));
- }
-
- return opts;
-}
diff --git a/ext/alsa/gstalsamixeroptions.h b/ext/alsa/gstalsamixeroptions.h
deleted file mode 100644
index b3c36c0d..00000000
--- a/ext/alsa/gstalsamixeroptions.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ALSA mixer options object.
- * Copyright (C) 2003 Leif Johnson <leif@ambient.2y.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., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#ifndef __GST_ALSA_MIXER_OPTIONS_H__
-#define __GST_ALSA_MIXER_OPTIONS_H__
-
-
-#include "gstalsa.h"
-#include <gst/interfaces/mixeroptions.h>
-
-
-G_BEGIN_DECLS
-
-
-#define GST_ALSA_MIXER_OPTIONS_TYPE (gst_alsa_mixer_options_get_type ())
-#define GST_ALSA_MIXER_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ALSA_MIXER_OPTIONS,GstAlsaMixerOptions))
-#define GST_ALSA_MIXER_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ALSA_MIXER_OPTIONS,GstAlsaMixerOptionsClass))
-#define GST_IS_ALSA_MIXER_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ALSA_MIXER_OPTIONS))
-#define GST_IS_ALSA_MIXER_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ALSA_MIXER_OPTIONS))
-#define GST_TYPE_ALSA_MIXER_OPTIONS (gst_alsa_mixer_options_get_type())
-
-
-typedef struct _GstAlsaMixerOptions GstAlsaMixerOptions;
-typedef struct _GstAlsaMixerOptionsClass GstAlsaMixerOptionsClass;
-
-
-struct _GstAlsaMixerOptions {
- GstMixerOptions parent;
- snd_mixer_elem_t *element; /* the ALSA mixer element for this track */
- gint track_num;
-};
-
-struct _GstAlsaMixerOptionsClass {
- GstMixerOptionsClass parent;
-};
-
-
-GType gst_alsa_mixer_options_get_type (void);
-GstMixerOptions *gst_alsa_mixer_options_new (snd_mixer_elem_t * element,
- gint track_num);
-
-
-G_END_DECLS
-
-
-#endif /* __GST_ALSA_MIXER_OPTIONS_H__ */
diff --git a/ext/alsa/gstalsamixertrack.c b/ext/alsa/gstalsamixertrack.c
deleted file mode 100644
index a1fdb7f3..00000000
--- a/ext/alsa/gstalsamixertrack.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/* ALSA mixer track implementation.
- * Copyright (C) 2003 Leif Johnson <leif@ambient.2y.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst-i18n-plugin.h>
-
-#include "gstalsamixertrack.h"
-
-static void gst_alsa_mixer_track_init (GstAlsaMixerTrack * alsa_track);
-static void gst_alsa_mixer_track_class_init (gpointer g_class,
- gpointer class_data);
-
-static GstMixerTrackClass *parent_class = NULL;
-
-GType
-gst_alsa_mixer_track_get_type (void)
-{
- static GType track_type = 0;
-
- if (!track_type) {
- static const GTypeInfo track_info = {
- sizeof (GstAlsaMixerTrackClass),
- NULL,
- NULL,
- gst_alsa_mixer_track_class_init,
- NULL,
- NULL,
- sizeof (GstAlsaMixerTrack),
- 0,
- (GInstanceInitFunc) gst_alsa_mixer_track_init,
- NULL
- };
-
- track_type =
- g_type_register_static (GST_TYPE_MIXER_TRACK, "GstAlsaMixerTrack",
- &track_info, 0);
- }
-
- return track_type;
-}
-
-static void
-gst_alsa_mixer_track_class_init (gpointer g_class, gpointer class_data)
-{
- parent_class = g_type_class_peek_parent (g_class);
-}
-
-static void
-gst_alsa_mixer_track_init (GstAlsaMixerTrack * alsa_track)
-{
-}
-
-static void
-gst_alsa_mixer_track_update_alsa_capabilities (GstAlsaMixerTrack * alsa_track)
-{
- alsa_track->alsa_flags = 0;
- alsa_track->capture_group = -1;
-
- /* common flags */
- if (snd_mixer_selem_has_common_volume (alsa_track->element))
- alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_VOLUME;
-
- if (snd_mixer_selem_has_common_switch (alsa_track->element))
- alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_SWITCH;
-
- /* Since we create two separate mixer track objects for alsa elements that
- * support both playback and capture, we're going to 'hide' the alsa flags
- * that don't pertain to this mixer track from alsa_flags, otherwise
- * gst_alsa_mixer_track_update() is going to do things we don't want */
-
- /* playback flags */
- if ((GST_MIXER_TRACK (alsa_track)->flags & GST_MIXER_TRACK_OUTPUT)) {
- if (snd_mixer_selem_has_playback_volume (alsa_track->element))
- alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_PVOLUME;
-
- if (snd_mixer_selem_has_playback_switch (alsa_track->element))
- alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_PSWITCH;
- }
-
- /* capture flags */
- if ((GST_MIXER_TRACK (alsa_track)->flags & GST_MIXER_TRACK_INPUT)) {
- if (snd_mixer_selem_has_capture_volume (alsa_track->element))
- alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_CVOLUME;
-
- if (snd_mixer_selem_has_capture_switch (alsa_track->element)) {
- alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_CSWITCH;
-
- if (snd_mixer_selem_has_capture_switch_exclusive (alsa_track->element)) {
- alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_CSWITCH_EXCL;
- alsa_track->capture_group =
- snd_mixer_selem_get_capture_group (alsa_track->element);
- }
- }
- }
-
- GST_LOG ("[%s] alsa_flags=0x%08x, capture_group=%d",
- snd_mixer_selem_get_name (alsa_track->element),
- alsa_track->alsa_flags, alsa_track->capture_group);
-}
-
-inline static gboolean
-alsa_track_has_cap (GstAlsaMixerTrack * alsa_track, guint32 flag)
-{
- return ((alsa_track->alsa_flags & flag) != 0);
-}
-
-GstMixerTrack *
-gst_alsa_mixer_track_new (snd_mixer_elem_t * element,
- gint num, gint track_num, gint flags, gboolean sw,
- GstAlsaMixerTrack * shared_mute_track, gboolean append_capture)
-{
- GstAlsaMixerTrack *alsa_track;
- GstMixerTrack *track;
- const gchar *name;
- guint index;
- const gchar *label;
- gint i;
- long min = 0, max = 0;
- const struct
- {
- const gchar orig[12];
- const gchar trans[12];
- } alsa_track_labels[] = {
- {
- "Master", N_("Master")}, {
- "Bass", N_("Bass")}, {
- "Treble", N_("Treble")}, {
- "PCM", N_("PCM")}, {
- "Synth", N_("Synth")}, {
- "Line", N_("Line-in")}, {
- "CD", N_("CD")}, {
- "Mic", N_("Microphone")}, {
- "PC Speaker", N_("PC Speaker")}, {
- "Playback", N_("Playback")}, {
- "Capture", N_("Capture")}
- };
-
- name = snd_mixer_selem_get_name (element);
- index = snd_mixer_selem_get_index (element);
-
- GST_LOG
- ("[%s,%u] num=%d,track_num=%d,flags=0x%08x,sw=%s,shared_mute_track=%p",
- name, index, num, track_num, flags, (sw) ? "true" : "false",
- shared_mute_track);
-
- track = (GstMixerTrack *) g_object_new (GST_ALSA_MIXER_TRACK_TYPE,
- "untranslated-label", name, "index", index, NULL);
-
- alsa_track = (GstAlsaMixerTrack *) track;
-
- GST_LOG ("[%s] created new mixer track %p", name, track);
-
- /* This reflects the assumptions used for GstAlsaMixerTrack */
- if (!(!!(flags & GST_MIXER_TRACK_OUTPUT) ^ !!(flags & GST_MIXER_TRACK_INPUT))) {
- GST_ERROR ("Mixer track must be either output or input!");
- g_return_val_if_reached (NULL);
- }
-
- track->flags = flags;
- alsa_track->element = element;
- alsa_track->shared_mute = shared_mute_track;
- alsa_track->track_num = track_num;
- alsa_track->alsa_channels = 0;
-
- gst_alsa_mixer_track_update_alsa_capabilities (alsa_track);
-
- if (flags & GST_MIXER_TRACK_OUTPUT) {
- while (alsa_track->alsa_channels < GST_ALSA_MAX_CHANNELS &&
- snd_mixer_selem_has_playback_channel (element,
- alsa_track->alsa_channels)) {
- alsa_track->alsa_channels++;
- }
- GST_LOG ("[%s] %d output channels", name, alsa_track->alsa_channels);
- } else if (flags & GST_MIXER_TRACK_INPUT) {
- while (alsa_track->alsa_channels < GST_ALSA_MAX_CHANNELS &&
- snd_mixer_selem_has_capture_channel (element,
- alsa_track->alsa_channels)) {
- alsa_track->alsa_channels++;
- }
- GST_LOG ("[%s] %d input channels", name, alsa_track->alsa_channels);
- } else {
- g_assert_not_reached ();
- }
-
- if (sw)
- track->num_channels = 0;
- else
- track->num_channels = alsa_track->alsa_channels;
-
- /* translate the name if we can */
- label = name;
- for (i = 0; i < G_N_ELEMENTS (alsa_track_labels); ++i) {
- if (g_utf8_collate (label, alsa_track_labels[i].orig) == 0) {
- label = _(alsa_track_labels[i].trans);
- break;
- }
- }
-
- if (num == 0) {
- track->label = g_strdup_printf ("%s%s%s", label,
- append_capture ? " " : "", append_capture ? _("Capture") : "");
- } else {
- track->label = g_strdup_printf ("%s%s%s %d", label,
- append_capture ? " " : "", append_capture ? _("Capture") : "", num);
- }
-
- /* set volume information */
- if (track->num_channels > 0) {
- if ((flags & GST_MIXER_TRACK_OUTPUT))
- snd_mixer_selem_get_playback_volume_range (element, &min, &max);
- else
- snd_mixer_selem_get_capture_volume_range (element, &min, &max);
- }
- track->min_volume = (gint) min;
- track->max_volume = (gint) max;
-
- for (i = 0; i < track->num_channels; i++) {
- long tmp = 0;
-
- if (flags & GST_MIXER_TRACK_OUTPUT)
- snd_mixer_selem_get_playback_volume (element, i, &tmp);
- else
- snd_mixer_selem_get_capture_volume (element, i, &tmp);
-
- alsa_track->volumes[i] = (gint) tmp;
- }
-
- gst_alsa_mixer_track_update (alsa_track);
-
- return track;
-}
-
-void
-gst_alsa_mixer_track_update (GstAlsaMixerTrack * alsa_track)
-{
- GstMixerTrack *track = (GstMixerTrack *) alsa_track;
- gint i;
- gint audible = !(track->flags & GST_MIXER_TRACK_MUTE);
-
- if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_PVOLUME)) {
- /* update playback volume */
- for (i = 0; i < track->num_channels; i++) {
- long vol = 0;
-
- snd_mixer_selem_get_playback_volume (alsa_track->element, i, &vol);
- alsa_track->volumes[i] = (gint) vol;
- }
- }
-
- if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_CVOLUME)) {
- /* update capture volume */
- for (i = 0; i < track->num_channels; i++) {
- long vol = 0;
-
- snd_mixer_selem_get_capture_volume (alsa_track->element, i, &vol);
- alsa_track->volumes[i] = (gint) vol;
- }
- }
-
- /* Any updates in flags? */
- if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_PSWITCH)) {
- int v = 0;
-
- audible = 0;
- for (i = 0; i < alsa_track->alsa_channels; ++i) {
- snd_mixer_selem_get_playback_switch (alsa_track->element, i, &v);
- audible += v;
- }
-
- } else if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_PVOLUME) &&
- track->flags & GST_MIXER_TRACK_MUTE) {
- /* check if user has raised volume with a parallel running application */
-
- for (i = 0; i < track->num_channels; i++) {
- long vol = 0;
-
- snd_mixer_selem_get_playback_volume (alsa_track->element, i, &vol);
-
- if (vol > track->min_volume) {
- audible = 1;
- break;
- }
- }
- }
-
- if (!!(audible) != !(track->flags & GST_MIXER_TRACK_MUTE)) {
- if (audible) {
- track->flags &= ~GST_MIXER_TRACK_MUTE;
-
- if (alsa_track->shared_mute)
- ((GstMixerTrack *) (alsa_track->shared_mute))->flags &=
- ~GST_MIXER_TRACK_MUTE;
- } else {
- track->flags |= GST_MIXER_TRACK_MUTE;
-
- if (alsa_track->shared_mute)
- ((GstMixerTrack *) (alsa_track->shared_mute))->flags |=
- GST_MIXER_TRACK_MUTE;
- }
- }
-
- if (track->flags & GST_MIXER_TRACK_INPUT) {
- gint recording = track->flags & GST_MIXER_TRACK_RECORD;
-
- if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_CSWITCH)) {
- int v = 0;
-
- recording = 0;
- for (i = 0; i < alsa_track->alsa_channels; ++i) {
- snd_mixer_selem_get_capture_switch (alsa_track->element, i, &v);
- recording += v;
- }
-
- } else if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_CVOLUME) &&
- !(track->flags & GST_MIXER_TRACK_RECORD)) {
- /* check if user has raised volume with a parallel running application */
-
- for (i = 0; i < track->num_channels; i++) {
- long vol = 0;
-
- snd_mixer_selem_get_capture_volume (alsa_track->element, i, &vol);
-
- if (vol > track->min_volume) {
- recording = 1;
- break;
- }
- }
- }
-
- if (recording)
- track->flags |= GST_MIXER_TRACK_RECORD;
- else
- track->flags &= ~GST_MIXER_TRACK_RECORD;
- }
-
-}
diff --git a/ext/alsa/gstalsamixertrack.h b/ext/alsa/gstalsamixertrack.h
deleted file mode 100644
index acc64cb3..00000000
--- a/ext/alsa/gstalsamixertrack.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* ALSA mixer track object.
- * Copyright (C) 2003 Leif Johnson <leif@ambient.2y.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., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#ifndef __GST_ALSA_MIXER_TRACK_H__
-#define __GST_ALSA_MIXER_TRACK_H__
-
-
-#include "gstalsa.h"
-#include <gst/interfaces/mixertrack.h>
-
-
-G_BEGIN_DECLS
-
-
-#define GST_ALSA_MIXER_TRACK_TYPE (gst_alsa_mixer_track_get_type ())
-#define GST_ALSA_MIXER_TRACK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ALSA_MIXER_TRACK,GstAlsaMixerTrack))
-#define GST_ALSA_MIXER_TRACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ALSA_MIXER_TRACK,GstAlsaMixerTrackClass))
-#define GST_IS_ALSA_MIXER_TRACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ALSA_MIXER_TRACK))
-#define GST_IS_ALSA_MIXER_TRACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ALSA_MIXER_TRACK))
-#define GST_TYPE_ALSA_MIXER_TRACK (gst_alsa_mixer_track_get_type())
-
-typedef struct _GstAlsaMixerTrack GstAlsaMixerTrack;
-typedef struct _GstAlsaMixerTrackClass GstAlsaMixerTrackClass;
-
-#define GST_ALSA_MIXER_TRACK_VOLUME (1<<0) /* common volume */
-#define GST_ALSA_MIXER_TRACK_PVOLUME (1<<1)
-#define GST_ALSA_MIXER_TRACK_CVOLUME (1<<2)
-#define GST_ALSA_MIXER_TRACK_SWITCH (1<<3) /* common switch */
-#define GST_ALSA_MIXER_TRACK_PSWITCH (1<<4)
-#define GST_ALSA_MIXER_TRACK_CSWITCH (1<<5)
-#define GST_ALSA_MIXER_TRACK_CSWITCH_EXCL (1<<6)
-
-#define GST_ALSA_MAX_CHANNELS (SND_MIXER_SCHN_LAST+1)
-
-struct _GstAlsaMixerTrack {
- GstMixerTrack parent;
- snd_mixer_elem_t *element; /* the ALSA mixer element for this track */
- GstAlsaMixerTrack *shared_mute;
- gint track_num;
- guint32 alsa_flags; /* alsa track capabilities */
- gint alsa_channels;
- gint capture_group;
- gint volumes[GST_ALSA_MAX_CHANNELS];
-};
-
-struct _GstAlsaMixerTrackClass {
- GstMixerTrackClass parent;
-};
-
-GType gst_alsa_mixer_track_get_type (void);
-GstMixerTrack * gst_alsa_mixer_track_new (snd_mixer_elem_t * element,
- gint num,
- gint track_num,
- gint flags,
- gboolean sw, /* is simple switch? */
- GstAlsaMixerTrack * shared_mute_track,
- gboolean label_append_capture);
-void gst_alsa_mixer_track_update (GstAlsaMixerTrack * alsa_track);
-
-G_END_DECLS
-
-
-#endif /* __GST_ALSA_MIXER_TRACK_H__ */
diff --git a/ext/alsa/gstalsaplugin.c b/ext/alsa/gstalsaplugin.c
deleted file mode 100644
index 38f16e20..00000000
--- a/ext/alsa/gstalsaplugin.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2001 CodeFactory AB
- * Copyright (C) 2001 Thomas Nyberg <thomas@codefactory.se>
- * Copyright (C) 2001-2002 Andy Wingo <apwingo@eos.ncsu.edu>
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstalsasink.h"
-#include "gstalsasrc.h"
-#include "gstalsamixerelement.h"
-
-#include <gst/gst-i18n-plugin.h>
-
-GST_DEBUG_CATEGORY (alsa_debug);
-
-/* ALSA debugging wrapper */
-static void
-gst_alsa_error_wrapper (const char *file, int line, const char *function,
- int err, const char *fmt, ...)
-{
-#ifndef GST_DISABLE_GST_DEBUG
- va_list args;
- gchar *str;
-
- va_start (args, fmt);
- str = g_strdup_vprintf (fmt, args);
- va_end (args);
- /* FIXME: use GST_LEVEL_ERROR here? Currently warning is used because we're
- * able to catch enough of the errors that would be printed otherwise
- */
- gst_debug_log (alsa_debug, GST_LEVEL_WARNING, file, function, line, NULL,
- "alsalib error: %s%s%s", str, err ? ": " : "",
- err ? snd_strerror (err) : "");
- g_free (str);
-#endif
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- int err;
-
- if (!gst_element_register (plugin, "alsamixer", GST_RANK_NONE,
- GST_TYPE_ALSA_MIXER_ELEMENT))
- return FALSE;
- if (!gst_element_register (plugin, "alsasrc", GST_RANK_PRIMARY,
- GST_TYPE_ALSA_SRC))
- return FALSE;
- if (!gst_element_register (plugin, "alsasink", GST_RANK_PRIMARY,
- GST_TYPE_ALSA_SINK))
- return FALSE;
-
- GST_DEBUG_CATEGORY_INIT (alsa_debug, "alsa", 0, "alsa plugins");
-
-#if ENABLE_NLS
- GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
- LOCALEDIR);
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif
-
- err = snd_lib_error_set_handler (gst_alsa_error_wrapper);
- if (err != 0)
- GST_WARNING ("failed to set alsa error handler");
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "alsa",
- "ALSA plugin library",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/alsa/gstalsasink.c b/ext/alsa/gstalsasink.c
deleted file mode 100644
index bc75ca6b..00000000
--- a/ext/alsa/gstalsasink.c
+++ /dev/null
@@ -1,968 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
- * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
- *
- * gstalsasink.c:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-/**
- * SECTION:element-alsasink
- * @see_also: alsasrc, alsamixer
- *
- * This element renders raw audio samples using the ALSA api.
- *
- * <refsect2>
- * <title>Example pipelines</title>
- * |[
- * gst-launch -v filesrc location=sine.ogg ! oggdemux ! vorbisdec ! audioconvert ! audioresample ! alsasink
- * ]| Play an Ogg/Vorbis file.
- * </refsect2>
- *
- * Last reviewed on 2006-03-01 (0.10.4)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <unistd.h>
-#include <string.h>
-#include <getopt.h>
-#include <alsa/asoundlib.h>
-
-#include "gstalsa.h"
-#include "gstalsasink.h"
-#include "gstalsadeviceprobe.h"
-
-#include <gst/gst-i18n-plugin.h>
-
-/* elementfactory information */
-static const GstElementDetails gst_alsasink_details =
-GST_ELEMENT_DETAILS ("Audio sink (ALSA)",
- "Sink/Audio",
- "Output to a sound card via ALSA",
- "Wim Taymans <wim@fluendo.com>");
-
-#define DEFAULT_DEVICE "default"
-#define DEFAULT_DEVICE_NAME ""
-#define SPDIF_PERIOD_SIZE 1536
-#define SPDIF_BUFFER_SIZE 15360
-
-enum
-{
- PROP_0,
- PROP_DEVICE,
- PROP_DEVICE_NAME
-};
-
-static void gst_alsasink_init_interfaces (GType type);
-
-GST_BOILERPLATE_FULL (GstAlsaSink, gst_alsasink, GstAudioSink,
- GST_TYPE_AUDIO_SINK, gst_alsasink_init_interfaces);
-
-static void gst_alsasink_finalise (GObject * object);
-static void gst_alsasink_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_alsasink_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static GstCaps *gst_alsasink_getcaps (GstBaseSink * bsink);
-
-static gboolean gst_alsasink_open (GstAudioSink * asink);
-static gboolean gst_alsasink_prepare (GstAudioSink * asink,
- GstRingBufferSpec * spec);
-static gboolean gst_alsasink_unprepare (GstAudioSink * asink);
-static gboolean gst_alsasink_close (GstAudioSink * asink);
-static guint gst_alsasink_write (GstAudioSink * asink, gpointer data,
- guint length);
-static guint gst_alsasink_delay (GstAudioSink * asink);
-static void gst_alsasink_reset (GstAudioSink * asink);
-
-static gint output_ref; /* 0 */
-static snd_output_t *output; /* NULL */
-static GStaticMutex output_mutex = G_STATIC_MUTEX_INIT;
-
-
-#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
-# define ALSA_SINK_FACTORY_ENDIANNESS "LITTLE_ENDIAN, BIG_ENDIAN"
-#else
-# define ALSA_SINK_FACTORY_ENDIANNESS "BIG_ENDIAN, LITTLE_ENDIAN"
-#endif
-
-static GstStaticPadTemplate alsasink_sink_factory =
- GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) { " ALSA_SINK_FACTORY_ENDIANNESS " }, "
- "signed = (boolean) { TRUE, FALSE }, "
- "width = (int) 32, "
- "depth = (int) 32, "
- "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
- "audio/x-raw-int, "
- "endianness = (int) { " ALSA_SINK_FACTORY_ENDIANNESS " }, "
- "signed = (boolean) { TRUE, FALSE }, "
- "width = (int) 24, "
- "depth = (int) 24, "
- "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
- "audio/x-raw-int, "
- "endianness = (int) { " ALSA_SINK_FACTORY_ENDIANNESS " }, "
- "signed = (boolean) { TRUE, FALSE }, "
- "width = (int) 32, "
- "depth = (int) 24, "
- "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
- "audio/x-raw-int, "
- "endianness = (int) { " ALSA_SINK_FACTORY_ENDIANNESS " }, "
- "signed = (boolean) { TRUE, FALSE }, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
- "audio/x-raw-int, "
- "signed = (boolean) { TRUE, FALSE }, "
- "width = (int) 8, "
- "depth = (int) 8, "
- "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ];"
- "audio/x-iec958")
- );
-
-static void
-gst_alsasink_finalise (GObject * object)
-{
- GstAlsaSink *sink = GST_ALSA_SINK (object);
-
- g_free (sink->device);
- g_mutex_free (sink->alsa_lock);
-
- g_static_mutex_lock (&output_mutex);
- --output_ref;
- if (output_ref == 0) {
- snd_output_close (output);
- output = NULL;
- }
- g_static_mutex_unlock (&output_mutex);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_alsasink_init_interfaces (GType type)
-{
- gst_alsa_type_add_device_property_probe_interface (type);
-}
-
-static void
-gst_alsasink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &gst_alsasink_details);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&alsasink_sink_factory));
-}
-
-static void
-gst_alsasink_class_init (GstAlsaSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseSinkClass *gstbasesink_class;
- GstAudioSinkClass *gstaudiosink_class;
-
- gobject_class = (GObjectClass *) klass;
- gstbasesink_class = (GstBaseSinkClass *) klass;
- gstaudiosink_class = (GstAudioSinkClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->finalize = gst_alsasink_finalise;
- gobject_class->get_property = gst_alsasink_get_property;
- gobject_class->set_property = gst_alsasink_set_property;
-
- gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_alsasink_getcaps);
-
- gstaudiosink_class->open = GST_DEBUG_FUNCPTR (gst_alsasink_open);
- gstaudiosink_class->prepare = GST_DEBUG_FUNCPTR (gst_alsasink_prepare);
- gstaudiosink_class->unprepare = GST_DEBUG_FUNCPTR (gst_alsasink_unprepare);
- gstaudiosink_class->close = GST_DEBUG_FUNCPTR (gst_alsasink_close);
- gstaudiosink_class->write = GST_DEBUG_FUNCPTR (gst_alsasink_write);
- gstaudiosink_class->delay = GST_DEBUG_FUNCPTR (gst_alsasink_delay);
- gstaudiosink_class->reset = GST_DEBUG_FUNCPTR (gst_alsasink_reset);
-
- g_object_class_install_property (gobject_class, PROP_DEVICE,
- g_param_spec_string ("device", "Device",
- "ALSA device, as defined in an asound configuration file",
- DEFAULT_DEVICE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_DEVICE_NAME,
- g_param_spec_string ("device-name", "Device name",
- "Human-readable name of the sound device", DEFAULT_DEVICE_NAME,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-}
-
-static void
-gst_alsasink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstAlsaSink *sink;
-
- sink = GST_ALSA_SINK (object);
-
- switch (prop_id) {
- case PROP_DEVICE:
- g_free (sink->device);
- sink->device = g_value_dup_string (value);
- /* setting NULL restores the default device */
- if (sink->device == NULL) {
- sink->device = g_strdup (DEFAULT_DEVICE);
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_alsasink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstAlsaSink *sink;
-
- sink = GST_ALSA_SINK (object);
-
- switch (prop_id) {
- case PROP_DEVICE:
- g_value_set_string (value, sink->device);
- break;
- case PROP_DEVICE_NAME:
- g_value_take_string (value,
- gst_alsa_find_device_name (GST_OBJECT_CAST (sink),
- sink->device, sink->handle, SND_PCM_STREAM_PLAYBACK));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_alsasink_init (GstAlsaSink * alsasink, GstAlsaSinkClass * g_class)
-{
- GST_DEBUG_OBJECT (alsasink, "initializing alsasink");
-
- alsasink->device = g_strdup (DEFAULT_DEVICE);
- alsasink->handle = NULL;
- alsasink->cached_caps = NULL;
- alsasink->alsa_lock = g_mutex_new ();
-
- g_static_mutex_lock (&output_mutex);
- if (output_ref == 0) {
- snd_output_stdio_attach (&output, stdout, 0);
- ++output_ref;
- }
- g_static_mutex_unlock (&output_mutex);
-}
-
-#define CHECK(call, error) \
-G_STMT_START { \
-if ((err = call) < 0) \
- goto error; \
-} G_STMT_END;
-
-static GstCaps *
-gst_alsasink_getcaps (GstBaseSink * bsink)
-{
- GstElementClass *element_class;
- GstPadTemplate *pad_template;
- GstAlsaSink *sink = GST_ALSA_SINK (bsink);
- GstCaps *caps;
-
- if (sink->handle == NULL) {
- GST_DEBUG_OBJECT (sink, "device not open, using template caps");
- return NULL; /* base class will get template caps for us */
- }
-
- if (sink->cached_caps) {
- GST_LOG_OBJECT (sink, "Returning cached caps");
- return gst_caps_ref (sink->cached_caps);
- }
-
- element_class = GST_ELEMENT_GET_CLASS (sink);
- pad_template = gst_element_class_get_pad_template (element_class, "sink");
- g_return_val_if_fail (pad_template != NULL, NULL);
-
- caps = gst_alsa_probe_supported_formats (GST_OBJECT (sink), sink->handle,
- gst_pad_template_get_caps (pad_template));
-
- if (caps) {
- sink->cached_caps = gst_caps_ref (caps);
- }
-
- GST_INFO_OBJECT (sink, "returning caps %" GST_PTR_FORMAT, caps);
-
- return caps;
-}
-
-static int
-set_hwparams (GstAlsaSink * alsa)
-{
- guint rrate;
- gint err, dir;
- snd_pcm_hw_params_t *params;
- guint period_time, buffer_time;
-
- snd_pcm_hw_params_malloc (&params);
-
- GST_DEBUG_OBJECT (alsa, "Negotiating to %d channels @ %d Hz (format = %s) "
- "SPDIF (%d)", alsa->channels, alsa->rate,
- snd_pcm_format_name (alsa->format), alsa->iec958);
-
- /* start with requested values, if we cannot configure alsa for those values,
- * we set these values to -1, which will leave the default alsa values */
- buffer_time = alsa->buffer_time;
- period_time = alsa->period_time;
-
-retry:
- /* choose all parameters */
- CHECK (snd_pcm_hw_params_any (alsa->handle, params), no_config);
- /* set the interleaved read/write format */
- CHECK (snd_pcm_hw_params_set_access (alsa->handle, params, alsa->access),
- wrong_access);
- /* set the sample format */
- if (alsa->iec958) {
- /* Try to use big endian first else fallback to le and swap bytes */
- if (snd_pcm_hw_params_set_format (alsa->handle, params, alsa->format) < 0) {
- alsa->format = SND_PCM_FORMAT_S16_LE;
- alsa->need_swap = TRUE;
- GST_DEBUG_OBJECT (alsa, "falling back to little endian with swapping");
- } else {
- alsa->need_swap = FALSE;
- }
- }
- CHECK (snd_pcm_hw_params_set_format (alsa->handle, params, alsa->format),
- no_sample_format);
- /* set the count of channels */
- CHECK (snd_pcm_hw_params_set_channels (alsa->handle, params, alsa->channels),
- no_channels);
- /* set the stream rate */
- rrate = alsa->rate;
- CHECK (snd_pcm_hw_params_set_rate_near (alsa->handle, params, &rrate, NULL),
- no_rate);
- if (rrate != alsa->rate)
- goto rate_match;
-
- /* get and dump some limits */
- {
- guint min, max;
-
- snd_pcm_hw_params_get_buffer_time_min (params, &min, &dir);
- snd_pcm_hw_params_get_buffer_time_max (params, &max, &dir);
-
- GST_DEBUG_OBJECT (alsa, "buffer time %u, min %u, max %u",
- alsa->buffer_time, min, max);
-
- snd_pcm_hw_params_get_period_time_min (params, &min, &dir);
- snd_pcm_hw_params_get_period_time_max (params, &max, &dir);
-
- GST_DEBUG_OBJECT (alsa, "period time %u, min %u, max %u",
- alsa->period_time, min, max);
-
- snd_pcm_hw_params_get_periods_min (params, &min, &dir);
- snd_pcm_hw_params_get_periods_max (params, &max, &dir);
-
- GST_DEBUG_OBJECT (alsa, "periods min %u, max %u", min, max);
- }
-
- /* now try to configure the buffer time and period time, if one
- * of those fail, we fall back to the defaults and emit a warning. */
- if (buffer_time != -1 && !alsa->iec958) {
- /* set the buffer time */
- if ((err = snd_pcm_hw_params_set_buffer_time_near (alsa->handle, params,
- &buffer_time, &dir)) < 0) {
- GST_ELEMENT_WARNING (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to set buffer time %i for playback: %s",
- buffer_time, snd_strerror (err)));
- /* disable buffer_time the next round */
- buffer_time = -1;
- goto retry;
- }
- GST_DEBUG_OBJECT (alsa, "buffer time %u", buffer_time);
- }
- if (period_time != -1 && !alsa->iec958) {
- /* set the period time */
- if ((err = snd_pcm_hw_params_set_period_time_near (alsa->handle, params,
- &period_time, &dir)) < 0) {
- GST_ELEMENT_WARNING (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to set period time %i for playback: %s",
- period_time, snd_strerror (err)));
- /* disable period_time the next round */
- period_time = -1;
- goto retry;
- }
- GST_DEBUG_OBJECT (alsa, "period time %u", period_time);
- }
-
- /* Set buffer size and period size manually for SPDIF */
- if (G_UNLIKELY (alsa->iec958)) {
- snd_pcm_uframes_t buffer_size = SPDIF_BUFFER_SIZE;
- snd_pcm_uframes_t period_size = SPDIF_PERIOD_SIZE;
-
- CHECK (snd_pcm_hw_params_set_buffer_size_near (alsa->handle, params,
- &buffer_size), buffer_size);
- CHECK (snd_pcm_hw_params_set_period_size_near (alsa->handle, params,
- &period_size, NULL), period_size);
- }
-
- /* write the parameters to device */
- CHECK (snd_pcm_hw_params (alsa->handle, params), set_hw_params);
-
- /* now get the configured values */
- CHECK (snd_pcm_hw_params_get_buffer_size (params, &alsa->buffer_size),
- buffer_size);
- CHECK (snd_pcm_hw_params_get_period_size (params, &alsa->period_size, &dir),
- period_size);
-
- GST_DEBUG_OBJECT (alsa, "buffer size %lu, period size %lu", alsa->buffer_size,
- alsa->period_size);
-
- snd_pcm_hw_params_free (params);
- return 0;
-
- /* ERRORS */
-no_config:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Broken configuration for playback: no configurations available: %s",
- snd_strerror (err)));
- snd_pcm_hw_params_free (params);
- return err;
- }
-wrong_access:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Access type not available for playback: %s", snd_strerror (err)));
- snd_pcm_hw_params_free (params);
- return err;
- }
-no_sample_format:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Sample format not available for playback: %s", snd_strerror (err)));
- snd_pcm_hw_params_free (params);
- return err;
- }
-no_channels:
- {
- gchar *msg = NULL;
-
- if ((alsa->channels) == 1)
- msg = g_strdup (_("Could not open device for playback in mono mode."));
- if ((alsa->channels) == 2)
- msg = g_strdup (_("Could not open device for playback in stereo mode."));
- if ((alsa->channels) > 2)
- msg =
- g_strdup_printf (_
- ("Could not open device for playback in %d-channel mode."),
- alsa->channels);
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (msg), (snd_strerror (err)));
- g_free (msg);
- snd_pcm_hw_params_free (params);
- return err;
- }
-no_rate:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Rate %iHz not available for playback: %s",
- alsa->rate, snd_strerror (err)));
- return err;
- }
-rate_match:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Rate doesn't match (requested %iHz, get %iHz)", alsa->rate, err));
- snd_pcm_hw_params_free (params);
- return -EINVAL;
- }
-buffer_size:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to get buffer size for playback: %s", snd_strerror (err)));
- snd_pcm_hw_params_free (params);
- return err;
- }
-period_size:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to get period size for playback: %s", snd_strerror (err)));
- snd_pcm_hw_params_free (params);
- return err;
- }
-set_hw_params:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to set hw params for playback: %s", snd_strerror (err)));
- snd_pcm_hw_params_free (params);
- return err;
- }
-}
-
-static int
-set_swparams (GstAlsaSink * alsa)
-{
- int err;
- snd_pcm_sw_params_t *params;
-
- snd_pcm_sw_params_malloc (&params);
-
- /* get the current swparams */
- CHECK (snd_pcm_sw_params_current (alsa->handle, params), no_config);
- /* start the transfer when the buffer is almost full: */
- /* (buffer_size / avail_min) * avail_min */
- CHECK (snd_pcm_sw_params_set_start_threshold (alsa->handle, params,
- (alsa->buffer_size / alsa->period_size) * alsa->period_size),
- start_threshold);
-
- /* allow the transfer when at least period_size samples can be processed */
- CHECK (snd_pcm_sw_params_set_avail_min (alsa->handle, params,
- alsa->period_size), set_avail);
-
-#if GST_CHECK_ALSA_VERSION(1,0,16)
- /* snd_pcm_sw_params_set_xfer_align() is deprecated, alignment is always 1 */
-#else
- /* align all transfers to 1 sample */
- CHECK (snd_pcm_sw_params_set_xfer_align (alsa->handle, params, 1), set_align);
-#endif
-
- /* write the parameters to the playback device */
- CHECK (snd_pcm_sw_params (alsa->handle, params), set_sw_params);
-
- snd_pcm_sw_params_free (params);
- return 0;
-
- /* ERRORS */
-no_config:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to determine current swparams for playback: %s",
- snd_strerror (err)));
- snd_pcm_sw_params_free (params);
- return err;
- }
-start_threshold:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to set start threshold mode for playback: %s",
- snd_strerror (err)));
- snd_pcm_sw_params_free (params);
- return err;
- }
-set_avail:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to set avail min for playback: %s", snd_strerror (err)));
- snd_pcm_sw_params_free (params);
- return err;
- }
-#if !GST_CHECK_ALSA_VERSION(1,0,16)
-set_align:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to set transfer align for playback: %s", snd_strerror (err)));
- snd_pcm_sw_params_free (params);
- return err;
- }
-#endif
-set_sw_params:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to set sw params for playback: %s", snd_strerror (err)));
- snd_pcm_sw_params_free (params);
- return err;
- }
-}
-
-static gboolean
-alsasink_parse_spec (GstAlsaSink * alsa, GstRingBufferSpec * spec)
-{
- /* Initialize our boolean */
- alsa->iec958 = FALSE;
-
- switch (spec->type) {
- case GST_BUFTYPE_LINEAR:
- GST_DEBUG_OBJECT (alsa,
- "Linear format : depth=%d, width=%d, sign=%d, bigend=%d", spec->depth,
- spec->width, spec->sign, spec->bigend);
-
- alsa->format = snd_pcm_build_linear_format (spec->depth, spec->width,
- spec->sign ? 0 : 1, spec->bigend ? 1 : 0);
- break;
- case GST_BUFTYPE_FLOAT:
- switch (spec->format) {
- case GST_FLOAT32_LE:
- alsa->format = SND_PCM_FORMAT_FLOAT_LE;
- break;
- case GST_FLOAT32_BE:
- alsa->format = SND_PCM_FORMAT_FLOAT_BE;
- break;
- case GST_FLOAT64_LE:
- alsa->format = SND_PCM_FORMAT_FLOAT64_LE;
- break;
- case GST_FLOAT64_BE:
- alsa->format = SND_PCM_FORMAT_FLOAT64_BE;
- break;
- default:
- goto error;
- }
- break;
- case GST_BUFTYPE_A_LAW:
- alsa->format = SND_PCM_FORMAT_A_LAW;
- break;
- case GST_BUFTYPE_MU_LAW:
- alsa->format = SND_PCM_FORMAT_MU_LAW;
- break;
- case GST_BUFTYPE_IEC958:
- alsa->format = SND_PCM_FORMAT_S16_BE;
- alsa->iec958 = TRUE;
- break;
- default:
- goto error;
-
- }
- alsa->rate = spec->rate;
- alsa->channels = spec->channels;
- alsa->buffer_time = spec->buffer_time;
- alsa->period_time = spec->latency_time;
- alsa->access = SND_PCM_ACCESS_RW_INTERLEAVED;
-
- return TRUE;
-
- /* ERRORS */
-error:
- {
- return FALSE;
- }
-}
-
-static gboolean
-gst_alsasink_open (GstAudioSink * asink)
-{
- GstAlsaSink *alsa;
- gint err;
-
- alsa = GST_ALSA_SINK (asink);
-
- /* open in non-blocking mode, we'll use snd_pcm_wait() for space to become
- * available. */
- CHECK (snd_pcm_open (&alsa->handle, alsa->device, SND_PCM_STREAM_PLAYBACK,
- SND_PCM_NONBLOCK), open_error);
- GST_LOG_OBJECT (alsa, "Opened device %s", alsa->device);
-
- return TRUE;
-
- /* ERRORS */
-open_error:
- {
- if (err == -EBUSY) {
- GST_ELEMENT_ERROR (alsa, RESOURCE, BUSY,
- (_("Could not open audio device for playback. "
- "Device is being used by another application.")),
- ("Device '%s' is busy", alsa->device));
- } else {
- GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_WRITE,
- (_("Could not open audio device for playback.")),
- ("Playback open error on device '%s': %s", alsa->device,
- snd_strerror (err)));
- }
- return FALSE;
- }
-}
-
-static gboolean
-gst_alsasink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec)
-{
- GstAlsaSink *alsa;
- gint err;
-
- alsa = GST_ALSA_SINK (asink);
-
- if (spec->format == GST_IEC958) {
- snd_pcm_close (alsa->handle);
- alsa->handle = gst_alsa_open_iec958_pcm (GST_OBJECT (alsa));
- if (G_UNLIKELY (!alsa->handle)) {
- goto no_iec958;
- }
- }
-
- if (!alsasink_parse_spec (alsa, spec))
- goto spec_parse;
-
- CHECK (set_hwparams (alsa), hw_params_failed);
- CHECK (set_swparams (alsa), sw_params_failed);
-
- alsa->bytes_per_sample = spec->bytes_per_sample;
- spec->segsize = alsa->period_size * spec->bytes_per_sample;
- spec->segtotal = alsa->buffer_size / alsa->period_size;
-
- {
- snd_output_t *out_buf = NULL;
- char *msg = NULL;
-
- snd_output_buffer_open (&out_buf);
- snd_pcm_dump_hw_setup (alsa->handle, out_buf);
- snd_output_buffer_string (out_buf, &msg);
- GST_DEBUG_OBJECT (alsa, "Hardware setup: \n%s", msg);
- snd_output_close (out_buf);
- snd_output_buffer_open (&out_buf);
- snd_pcm_dump_sw_setup (alsa->handle, out_buf);
- snd_output_buffer_string (out_buf, &msg);
- GST_DEBUG_OBJECT (alsa, "Software setup: \n%s", msg);
- snd_output_close (out_buf);
- }
-
- return TRUE;
-
- /* ERRORS */
-no_iec958:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_WRITE, (NULL),
- ("Could not open IEC958 (SPDIF) device for playback"));
- return FALSE;
- }
-spec_parse:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Error parsing spec"));
- return FALSE;
- }
-hw_params_failed:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Setting of hwparams failed: %s", snd_strerror (err)));
- return FALSE;
- }
-sw_params_failed:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Setting of swparams failed: %s", snd_strerror (err)));
- return FALSE;
- }
-}
-
-static gboolean
-gst_alsasink_unprepare (GstAudioSink * asink)
-{
- GstAlsaSink *alsa;
- gint err;
-
- alsa = GST_ALSA_SINK (asink);
-
- CHECK (snd_pcm_drop (alsa->handle), drop);
-
- CHECK (snd_pcm_hw_free (alsa->handle), hw_free);
-
- return TRUE;
-
- /* ERRORS */
-drop:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Could not drop samples: %s", snd_strerror (err)));
- return FALSE;
- }
-hw_free:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Could not free hw params: %s", snd_strerror (err)));
- return FALSE;
- }
-}
-
-static gboolean
-gst_alsasink_close (GstAudioSink * asink)
-{
- GstAlsaSink *alsa = GST_ALSA_SINK (asink);
- gint err;
-
- if (alsa->handle) {
- CHECK (snd_pcm_close (alsa->handle), close_error);
- alsa->handle = NULL;
- }
- gst_caps_replace (&alsa->cached_caps, NULL);
-
- return TRUE;
-
- /* ERRORS */
-close_error:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, CLOSE, (NULL),
- ("Playback close error: %s", snd_strerror (err)));
- return FALSE;
- }
-}
-
-
-/*
- * Underrun and suspend recovery
- */
-static gint
-xrun_recovery (GstAlsaSink * alsa, snd_pcm_t * handle, gint err)
-{
- GST_DEBUG_OBJECT (alsa, "xrun recovery %d", err);
-
- if (err == -EPIPE) { /* under-run */
- err = snd_pcm_prepare (handle);
- if (err < 0)
- GST_WARNING_OBJECT (alsa,
- "Can't recovery from underrun, prepare failed: %s",
- snd_strerror (err));
- return 0;
- } else if (err == -ESTRPIPE) {
- while ((err = snd_pcm_resume (handle)) == -EAGAIN)
- g_usleep (100); /* wait until the suspend flag is released */
-
- if (err < 0) {
- err = snd_pcm_prepare (handle);
- if (err < 0)
- GST_WARNING_OBJECT (alsa,
- "Can't recovery from suspend, prepare failed: %s",
- snd_strerror (err));
- }
- return 0;
- }
- return err;
-}
-
-static guint
-gst_alsasink_write (GstAudioSink * asink, gpointer data, guint length)
-{
- GstAlsaSink *alsa;
- gint err;
- gint cptr;
- gint16 *ptr = data;
-
- alsa = GST_ALSA_SINK (asink);
-
- if (alsa->iec958 && alsa->need_swap) {
- guint i;
-
- GST_DEBUG_OBJECT (asink, "swapping bytes");
- for (i = 0; i < length / 2; i++) {
- ptr[i] = GUINT16_SWAP_LE_BE (ptr[i]);
- }
- }
-
- GST_LOG_OBJECT (asink, "received audio samples buffer of %u bytes", length);
-
- cptr = length / alsa->bytes_per_sample;
-
- GST_ALSA_SINK_LOCK (asink);
- while (cptr > 0) {
- /* start by doing a blocking wait for free space. Set the timeout
- * to 4 times the period time */
- err = snd_pcm_wait (alsa->handle, (4 * alsa->period_time / 1000));
- if (err < 0) {
- GST_DEBUG_OBJECT (asink, "wait error, %d", err);
- } else {
- err = snd_pcm_writei (alsa->handle, ptr, cptr);
- }
-
- GST_DEBUG_OBJECT (asink, "written %d frames out of %d", err, cptr);
- if (err < 0) {
- GST_DEBUG_OBJECT (asink, "Write error: %s", snd_strerror (err));
- if (err == -EAGAIN) {
- continue;
- } else if (xrun_recovery (alsa, alsa->handle, err) < 0) {
- goto write_error;
- }
- continue;
- }
-
- ptr += snd_pcm_frames_to_bytes (alsa->handle, err);
- cptr -= err;
- }
- GST_ALSA_SINK_UNLOCK (asink);
-
- return length - (cptr * alsa->bytes_per_sample);
-
-write_error:
- {
- GST_ALSA_SINK_UNLOCK (asink);
- return length; /* skip one period */
- }
-}
-
-static guint
-gst_alsasink_delay (GstAudioSink * asink)
-{
- GstAlsaSink *alsa;
- snd_pcm_sframes_t delay;
- int res;
-
- alsa = GST_ALSA_SINK (asink);
-
- res = snd_pcm_delay (alsa->handle, &delay);
- if (G_UNLIKELY (res < 0)) {
- /* on errors, report 0 delay */
- GST_DEBUG_OBJECT (alsa, "snd_pcm_delay returned %d", res);
- delay = 0;
- }
- if (G_UNLIKELY (delay < 0)) {
- /* make sure we never return a negative delay */
- GST_WARNING_OBJECT (alsa, "snd_pcm_delay returned negative delay");
- delay = 0;
- }
-
- return delay;
-}
-
-static void
-gst_alsasink_reset (GstAudioSink * asink)
-{
- GstAlsaSink *alsa;
- gint err;
-
- alsa = GST_ALSA_SINK (asink);
-
- GST_ALSA_SINK_LOCK (asink);
- GST_DEBUG_OBJECT (alsa, "drop");
- CHECK (snd_pcm_drop (alsa->handle), drop_error);
- GST_DEBUG_OBJECT (alsa, "prepare");
- CHECK (snd_pcm_prepare (alsa->handle), prepare_error);
- GST_DEBUG_OBJECT (alsa, "reset done");
- GST_ALSA_SINK_UNLOCK (asink);
-
- return;
-
- /* ERRORS */
-drop_error:
- {
- GST_ERROR_OBJECT (alsa, "alsa-reset: pcm drop error: %s",
- snd_strerror (err));
- GST_ALSA_SINK_UNLOCK (asink);
- return;
- }
-prepare_error:
- {
- GST_ERROR_OBJECT (alsa, "alsa-reset: pcm prepare error: %s",
- snd_strerror (err));
- GST_ALSA_SINK_UNLOCK (asink);
- return;
- }
-}
diff --git a/ext/alsa/gstalsasink.h b/ext/alsa/gstalsasink.h
deleted file mode 100644
index 902dbf77..00000000
--- a/ext/alsa/gstalsasink.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
- *
- * gstalsasink.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_ALSASINK_H__
-#define __GST_ALSASINK_H__
-
-#include <gst/gst.h>
-#include <gst/audio/gstaudiosink.h>
-#include <alsa/asoundlib.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_ALSA_SINK (gst_alsasink_get_type())
-#define GST_ALSA_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ALSA_SINK,GstAlsaSink))
-#define GST_ALSA_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ALSA_SINK,GstAlsaSinkClass))
-#define GST_IS_ALSA_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ALSA_SINK))
-#define GST_IS_ALSA_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ALSA_SINK))
-#define GST_ALSA_SINK_CAST(obj) ((GstAlsaSink *) (obj))
-
-typedef struct _GstAlsaSink GstAlsaSink;
-typedef struct _GstAlsaSinkClass GstAlsaSinkClass;
-
-#define GST_ALSA_SINK_GET_LOCK(obj) (GST_ALSA_SINK_CAST (obj)->alsa_lock)
-#define GST_ALSA_SINK_LOCK(obj) (g_mutex_lock (GST_ALSA_SINK_GET_LOCK (obj)))
-#define GST_ALSA_SINK_UNLOCK(obj) (g_mutex_unlock (GST_ALSA_SINK_GET_LOCK (obj)))
-
-/**
- * GstAlsaSink:
- *
- * Opaque data structure
- */
-struct _GstAlsaSink {
- GstAudioSink sink;
-
- gchar *device;
-
- snd_pcm_t *handle;
- snd_pcm_hw_params_t *hwparams;
- snd_pcm_sw_params_t *swparams;
-
- snd_pcm_access_t access;
- snd_pcm_format_t format;
- guint rate;
- guint channels;
- gint bytes_per_sample;
- gboolean iec958;
- gboolean need_swap;
-
- guint buffer_time;
- guint period_time;
- snd_pcm_uframes_t buffer_size;
- snd_pcm_uframes_t period_size;
-
- GstCaps *cached_caps;
-
- GMutex *alsa_lock;
-};
-
-struct _GstAlsaSinkClass {
- GstAudioSinkClass parent_class;
-};
-
-GType gst_alsasink_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_ALSASINK_H__ */
diff --git a/ext/alsa/gstalsasrc.c b/ext/alsa/gstalsasrc.c
deleted file mode 100644
index db9c3a60..00000000
--- a/ext/alsa/gstalsasrc.c
+++ /dev/null
@@ -1,873 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
- *
- * gstalsasrc.c:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-/**
- * SECTION:element-alsasrc
- * @see_also: alsasink, alsamixer
- *
- * This element reads data from an audio card using the ALSA API.
- *
- * <refsect2>
- * <title>Example pipelines</title>
- * |[
- * gst-launch -v alsasrc ! audioconvert ! vorbisenc ! oggmux ! filesink location=alsasrc.ogg
- * ]| Record from a sound card using ALSA and encode to Ogg/Vorbis.
- * </refsect2>
- *
- * Last reviewed on 2006-03-01 (0.10.4)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <unistd.h>
-#include <string.h>
-#include <getopt.h>
-#include <alsa/asoundlib.h>
-
-#include "gstalsasrc.h"
-#include "gstalsadeviceprobe.h"
-
-#include <gst/gst-i18n-plugin.h>
-
-/* elementfactory information */
-static const GstElementDetails gst_alsasrc_details =
-GST_ELEMENT_DETAILS ("Audio source (ALSA)",
- "Source/Audio",
- "Read from a sound card via ALSA",
- "Wim Taymans <wim@fluendo.com>");
-
-#define DEFAULT_PROP_DEVICE "default"
-#define DEFAULT_PROP_DEVICE_NAME ""
-
-enum
-{
- PROP_0,
- PROP_DEVICE,
- PROP_DEVICE_NAME,
-};
-
-static void gst_alsasrc_init_interfaces (GType type);
-
-GST_BOILERPLATE_FULL (GstAlsaSrc, gst_alsasrc, GstAudioSrc,
- GST_TYPE_AUDIO_SRC, gst_alsasrc_init_interfaces);
-
-GST_IMPLEMENT_ALSA_MIXER_METHODS (GstAlsaSrc, gst_alsasrc_mixer);
-
-static void gst_alsasrc_finalize (GObject * object);
-static void gst_alsasrc_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_alsasrc_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static GstCaps *gst_alsasrc_getcaps (GstBaseSrc * bsrc);
-
-static gboolean gst_alsasrc_open (GstAudioSrc * asrc);
-static gboolean gst_alsasrc_prepare (GstAudioSrc * asrc,
- GstRingBufferSpec * spec);
-static gboolean gst_alsasrc_unprepare (GstAudioSrc * asrc);
-static gboolean gst_alsasrc_close (GstAudioSrc * asrc);
-static guint gst_alsasrc_read (GstAudioSrc * asrc, gpointer data, guint length);
-static guint gst_alsasrc_delay (GstAudioSrc * asrc);
-static void gst_alsasrc_reset (GstAudioSrc * asrc);
-
-/* AlsaSrc signals and args */
-enum
-{
- LAST_SIGNAL
-};
-
-#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
-# define ALSA_SRC_FACTORY_ENDIANNESS "LITTLE_ENDIAN, BIG_ENDIAN"
-#else
-# define ALSA_SRC_FACTORY_ENDIANNESS "BIG_ENDIAN, LITTLE_ENDIAN"
-#endif
-
-static GstStaticPadTemplate alsasrc_src_factory =
- GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) { " ALSA_SRC_FACTORY_ENDIANNESS " }, "
- "signed = (boolean) { TRUE, FALSE }, "
- "width = (int) 32, "
- "depth = (int) 32, "
- "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
- "audio/x-raw-int, "
- "endianness = (int) { " ALSA_SRC_FACTORY_ENDIANNESS " }, "
- "signed = (boolean) { TRUE, FALSE }, "
- "width = (int) 32, "
- "depth = (int) 24, "
- "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
- "audio/x-raw-int, "
- "endianness = (int) { " ALSA_SRC_FACTORY_ENDIANNESS " }, "
- "signed = (boolean) { TRUE, FALSE }, "
- "width = (int) 24, "
- "depth = (int) 24, "
- "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
- "audio/x-raw-int, "
- "endianness = (int) { " ALSA_SRC_FACTORY_ENDIANNESS " }, "
- "signed = (boolean) { TRUE, FALSE }, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
- "audio/x-raw-int, "
- "signed = (boolean) { TRUE, FALSE }, "
- "width = (int) 8, "
- "depth = (int) 8, "
- "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]")
- );
-
-static void
-gst_alsasrc_finalize (GObject * object)
-{
- GstAlsaSrc *src = GST_ALSA_SRC (object);
-
- g_free (src->device);
- g_mutex_free (src->alsa_lock);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static gboolean
-gst_alsasrc_interface_supported (GstAlsaSrc * this, GType interface_type)
-{
- /* only support this one interface (wrapped by GstImplementsInterface) */
- g_assert (interface_type == GST_TYPE_MIXER);
-
- return gst_alsasrc_mixer_supported (this, interface_type);
-}
-
-static void
-gst_implements_interface_init (GstImplementsInterfaceClass * klass)
-{
- klass->supported = (gpointer) gst_alsasrc_interface_supported;
-}
-
-static void
-gst_alsasrc_init_interfaces (GType type)
-{
- static const GInterfaceInfo implements_iface_info = {
- (GInterfaceInitFunc) gst_implements_interface_init,
- NULL,
- NULL,
- };
- static const GInterfaceInfo mixer_iface_info = {
- (GInterfaceInitFunc) gst_alsasrc_mixer_interface_init,
- NULL,
- NULL,
- };
-
- g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE,
- &implements_iface_info);
- g_type_add_interface_static (type, GST_TYPE_MIXER, &mixer_iface_info);
-
- gst_alsa_type_add_device_property_probe_interface (type);
-}
-
-static void
-gst_alsasrc_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &gst_alsasrc_details);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&alsasrc_src_factory));
-}
-
-static void
-gst_alsasrc_class_init (GstAlsaSrcClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseSrcClass *gstbasesrc_class;
- GstAudioSrcClass *gstaudiosrc_class;
-
- gobject_class = (GObjectClass *) klass;
- gstbasesrc_class = (GstBaseSrcClass *) klass;
- gstaudiosrc_class = (GstAudioSrcClass *) klass;
-
- gobject_class->finalize = gst_alsasrc_finalize;
- gobject_class->get_property = gst_alsasrc_get_property;
- gobject_class->set_property = gst_alsasrc_set_property;
-
- gstbasesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_alsasrc_getcaps);
-
- gstaudiosrc_class->open = GST_DEBUG_FUNCPTR (gst_alsasrc_open);
- gstaudiosrc_class->prepare = GST_DEBUG_FUNCPTR (gst_alsasrc_prepare);
- gstaudiosrc_class->unprepare = GST_DEBUG_FUNCPTR (gst_alsasrc_unprepare);
- gstaudiosrc_class->close = GST_DEBUG_FUNCPTR (gst_alsasrc_close);
- gstaudiosrc_class->read = GST_DEBUG_FUNCPTR (gst_alsasrc_read);
- gstaudiosrc_class->delay = GST_DEBUG_FUNCPTR (gst_alsasrc_delay);
- gstaudiosrc_class->reset = GST_DEBUG_FUNCPTR (gst_alsasrc_reset);
-
- g_object_class_install_property (gobject_class, PROP_DEVICE,
- g_param_spec_string ("device", "Device",
- "ALSA device, as defined in an asound configuration file",
- DEFAULT_PROP_DEVICE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_DEVICE_NAME,
- g_param_spec_string ("device-name", "Device name",
- "Human-readable name of the sound device",
- DEFAULT_PROP_DEVICE_NAME, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-}
-
-static void
-gst_alsasrc_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstAlsaSrc *src;
-
- src = GST_ALSA_SRC (object);
-
- switch (prop_id) {
- case PROP_DEVICE:
- g_free (src->device);
- src->device = g_value_dup_string (value);
- if (src->device == NULL) {
- src->device = g_strdup (DEFAULT_PROP_DEVICE);
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_alsasrc_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstAlsaSrc *src;
-
- src = GST_ALSA_SRC (object);
-
- switch (prop_id) {
- case PROP_DEVICE:
- g_value_set_string (value, src->device);
- break;
- case PROP_DEVICE_NAME:
- g_value_take_string (value,
- gst_alsa_find_device_name (GST_OBJECT_CAST (src),
- src->device, src->handle, SND_PCM_STREAM_CAPTURE));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_alsasrc_init (GstAlsaSrc * alsasrc, GstAlsaSrcClass * g_class)
-{
- GST_DEBUG_OBJECT (alsasrc, "initializing");
-
- alsasrc->device = g_strdup (DEFAULT_PROP_DEVICE);
- alsasrc->cached_caps = NULL;
-
- alsasrc->alsa_lock = g_mutex_new ();
-}
-
-#define CHECK(call, error) \
-G_STMT_START { \
-if ((err = call) < 0) \
- goto error; \
-} G_STMT_END;
-
-
-static GstCaps *
-gst_alsasrc_getcaps (GstBaseSrc * bsrc)
-{
- GstElementClass *element_class;
- GstPadTemplate *pad_template;
- GstAlsaSrc *src;
- GstCaps *caps;
-
- src = GST_ALSA_SRC (bsrc);
-
- if (src->handle == NULL) {
- GST_DEBUG_OBJECT (src, "device not open, using template caps");
- return NULL; /* base class will get template caps for us */
- }
-
- if (src->cached_caps) {
- GST_LOG_OBJECT (src, "Returning cached caps");
- return gst_caps_ref (src->cached_caps);
- }
-
- element_class = GST_ELEMENT_GET_CLASS (src);
- pad_template = gst_element_class_get_pad_template (element_class, "src");
- g_return_val_if_fail (pad_template != NULL, NULL);
-
- caps = gst_alsa_probe_supported_formats (GST_OBJECT (src), src->handle,
- gst_pad_template_get_caps (pad_template));
-
- if (caps) {
- src->cached_caps = gst_caps_ref (caps);
- }
-
- GST_INFO_OBJECT (src, "returning caps %" GST_PTR_FORMAT, caps);
-
- return caps;
-}
-
-static int
-set_hwparams (GstAlsaSrc * alsa)
-{
- guint rrate;
- gint err, dir;
- snd_pcm_hw_params_t *params;
-
- snd_pcm_hw_params_malloc (&params);
-
- /* choose all parameters */
- CHECK (snd_pcm_hw_params_any (alsa->handle, params), no_config);
- /* set the interleaved read/write format */
- CHECK (snd_pcm_hw_params_set_access (alsa->handle, params, alsa->access),
- wrong_access);
- /* set the sample format */
- CHECK (snd_pcm_hw_params_set_format (alsa->handle, params, alsa->format),
- no_sample_format);
- /* set the count of channels */
- CHECK (snd_pcm_hw_params_set_channels (alsa->handle, params, alsa->channels),
- no_channels);
- /* set the stream rate */
- rrate = alsa->rate;
- CHECK (snd_pcm_hw_params_set_rate_near (alsa->handle, params, &rrate, NULL),
- no_rate);
- if (rrate != alsa->rate)
- goto rate_match;
-
- if (alsa->buffer_time != -1) {
- /* set the buffer time */
- CHECK (snd_pcm_hw_params_set_buffer_time_near (alsa->handle, params,
- &alsa->buffer_time, &dir), buffer_time);
- }
- if (alsa->period_time != -1) {
- /* set the period time */
- CHECK (snd_pcm_hw_params_set_period_time_near (alsa->handle, params,
- &alsa->period_time, &dir), period_time);
- }
-
- /* write the parameters to device */
- CHECK (snd_pcm_hw_params (alsa->handle, params), set_hw_params);
-
- CHECK (snd_pcm_hw_params_get_buffer_size (params, &alsa->buffer_size),
- buffer_size);
-
- CHECK (snd_pcm_hw_params_get_period_size (params, &alsa->period_size, &dir),
- period_size);
-
- snd_pcm_hw_params_free (params);
- return 0;
-
- /* ERRORS */
-no_config:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Broken configuration for recording: no configurations available: %s",
- snd_strerror (err)));
- snd_pcm_hw_params_free (params);
- return err;
- }
-wrong_access:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Access type not available for recording: %s", snd_strerror (err)));
- snd_pcm_hw_params_free (params);
- return err;
- }
-no_sample_format:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Sample format not available for recording: %s", snd_strerror (err)));
- snd_pcm_hw_params_free (params);
- return err;
- }
-no_channels:
- {
- gchar *msg = NULL;
-
- if ((alsa->channels) == 1)
- msg = g_strdup (_("Could not open device for recording in mono mode."));
- if ((alsa->channels) == 2)
- msg = g_strdup (_("Could not open device for recording in stereo mode."));
- if ((alsa->channels) > 2)
- msg =
- g_strdup_printf (_
- ("Could not open device for recording in %d-channel mode"),
- alsa->channels);
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (msg), (snd_strerror (err)));
- g_free (msg);
- snd_pcm_hw_params_free (params);
- return err;
- }
-no_rate:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Rate %iHz not available for recording: %s",
- alsa->rate, snd_strerror (err)));
- snd_pcm_hw_params_free (params);
- return err;
- }
-rate_match:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Rate doesn't match (requested %iHz, get %iHz)", alsa->rate, err));
- snd_pcm_hw_params_free (params);
- return -EINVAL;
- }
-buffer_time:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to set buffer time %i for recording: %s",
- alsa->buffer_time, snd_strerror (err)));
- snd_pcm_hw_params_free (params);
- return err;
- }
-buffer_size:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to get buffer size for recording: %s", snd_strerror (err)));
- snd_pcm_hw_params_free (params);
- return err;
- }
-period_time:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to set period time %i for recording: %s", alsa->period_time,
- snd_strerror (err)));
- snd_pcm_hw_params_free (params);
- return err;
- }
-period_size:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to get period size for recording: %s", snd_strerror (err)));
- snd_pcm_hw_params_free (params);
- return err;
- }
-set_hw_params:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to set hw params for recording: %s", snd_strerror (err)));
- snd_pcm_hw_params_free (params);
- return err;
- }
-}
-
-static int
-set_swparams (GstAlsaSrc * alsa)
-{
- int err;
- snd_pcm_sw_params_t *params;
-
- snd_pcm_sw_params_malloc (&params);
-
- /* get the current swparams */
- CHECK (snd_pcm_sw_params_current (alsa->handle, params), no_config);
- /* allow the transfer when at least period_size samples can be processed */
- CHECK (snd_pcm_sw_params_set_avail_min (alsa->handle, params,
- alsa->period_size), set_avail);
- /* start the transfer on first read */
- CHECK (snd_pcm_sw_params_set_start_threshold (alsa->handle, params,
- 0), start_threshold);
-
-#if GST_CHECK_ALSA_VERSION(1,0,16)
- /* snd_pcm_sw_params_set_xfer_align() is deprecated, alignment is always 1 */
-#else
- /* align all transfers to 1 sample */
- CHECK (snd_pcm_sw_params_set_xfer_align (alsa->handle, params, 1), set_align);
-#endif
-
- /* write the parameters to the recording device */
- CHECK (snd_pcm_sw_params (alsa->handle, params), set_sw_params);
-
- snd_pcm_sw_params_free (params);
- return 0;
-
- /* ERRORS */
-no_config:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to determine current swparams for playback: %s",
- snd_strerror (err)));
- snd_pcm_sw_params_free (params);
- return err;
- }
-start_threshold:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to set start threshold mode for playback: %s",
- snd_strerror (err)));
- snd_pcm_sw_params_free (params);
- return err;
- }
-set_avail:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to set avail min for playback: %s", snd_strerror (err)));
- snd_pcm_sw_params_free (params);
- return err;
- }
-#if !GST_CHECK_ALSA_VERSION(1,0,16)
-set_align:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to set transfer align for playback: %s", snd_strerror (err)));
- snd_pcm_sw_params_free (params);
- return err;
- }
-#endif
-set_sw_params:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Unable to set sw params for playback: %s", snd_strerror (err)));
- snd_pcm_sw_params_free (params);
- return err;
- }
-}
-
-static gboolean
-alsasrc_parse_spec (GstAlsaSrc * alsa, GstRingBufferSpec * spec)
-{
- switch (spec->type) {
- case GST_BUFTYPE_LINEAR:
- alsa->format = snd_pcm_build_linear_format (spec->depth, spec->width,
- spec->sign ? 0 : 1, spec->bigend ? 1 : 0);
- break;
- case GST_BUFTYPE_FLOAT:
- switch (spec->format) {
- case GST_FLOAT32_LE:
- alsa->format = SND_PCM_FORMAT_FLOAT_LE;
- break;
- case GST_FLOAT32_BE:
- alsa->format = SND_PCM_FORMAT_FLOAT_BE;
- break;
- case GST_FLOAT64_LE:
- alsa->format = SND_PCM_FORMAT_FLOAT64_LE;
- break;
- case GST_FLOAT64_BE:
- alsa->format = SND_PCM_FORMAT_FLOAT64_BE;
- break;
- default:
- goto error;
- }
- break;
- case GST_BUFTYPE_A_LAW:
- alsa->format = SND_PCM_FORMAT_A_LAW;
- break;
- case GST_BUFTYPE_MU_LAW:
- alsa->format = SND_PCM_FORMAT_MU_LAW;
- break;
- default:
- goto error;
-
- }
- alsa->rate = spec->rate;
- alsa->channels = spec->channels;
- alsa->buffer_time = spec->buffer_time;
- alsa->period_time = spec->latency_time;
- alsa->access = SND_PCM_ACCESS_RW_INTERLEAVED;
-
- return TRUE;
-
- /* ERRORS */
-error:
- {
- return FALSE;
- }
-}
-
-static gboolean
-gst_alsasrc_open (GstAudioSrc * asrc)
-{
- GstAlsaSrc *alsa;
- gint err;
-
- alsa = GST_ALSA_SRC (asrc);
-
- CHECK (snd_pcm_open (&alsa->handle, alsa->device, SND_PCM_STREAM_CAPTURE,
- SND_PCM_NONBLOCK), open_error);
-
- if (!alsa->mixer)
- alsa->mixer = gst_alsa_mixer_new (alsa->device, GST_ALSA_MIXER_CAPTURE);
-
- return TRUE;
-
- /* ERRORS */
-open_error:
- {
- if (err == -EBUSY) {
- GST_ELEMENT_ERROR (alsa, RESOURCE, BUSY,
- (_("Could not open audio device for recording. "
- "Device is being used by another application.")),
- ("Device '%s' is busy", alsa->device));
- } else {
- GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
- (_("Could not open audio device for recording.")),
- ("Recording open error on device '%s': %s", alsa->device,
- snd_strerror (err)));
- }
- return FALSE;
- }
-}
-
-static gboolean
-gst_alsasrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
-{
- GstAlsaSrc *alsa;
- gint err;
-
- alsa = GST_ALSA_SRC (asrc);
-
- if (!alsasrc_parse_spec (alsa, spec))
- goto spec_parse;
-
- CHECK (snd_pcm_nonblock (alsa->handle, 0), non_block);
-
- CHECK (set_hwparams (alsa), hw_params_failed);
- CHECK (set_swparams (alsa), sw_params_failed);
- CHECK (snd_pcm_prepare (alsa->handle), prepare_failed);
-
- alsa->bytes_per_sample = spec->bytes_per_sample;
- spec->segsize = alsa->period_size * spec->bytes_per_sample;
- spec->segtotal = alsa->buffer_size / alsa->period_size;
- spec->silence_sample[0] = 0;
- spec->silence_sample[1] = 0;
- spec->silence_sample[2] = 0;
- spec->silence_sample[3] = 0;
-
- return TRUE;
-
- /* ERRORS */
-spec_parse:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Error parsing spec"));
- return FALSE;
- }
-non_block:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Could not set device to blocking: %s", snd_strerror (err)));
- return FALSE;
- }
-hw_params_failed:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Setting of hwparams failed: %s", snd_strerror (err)));
- return FALSE;
- }
-sw_params_failed:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Setting of swparams failed: %s", snd_strerror (err)));
- return FALSE;
- }
-prepare_failed:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Prepare failed: %s", snd_strerror (err)));
- return FALSE;
- }
-}
-
-static gboolean
-gst_alsasrc_unprepare (GstAudioSrc * asrc)
-{
- GstAlsaSrc *alsa;
- gint err;
-
- alsa = GST_ALSA_SRC (asrc);
-
- CHECK (snd_pcm_drop (alsa->handle), drop);
-
- CHECK (snd_pcm_hw_free (alsa->handle), hw_free);
-
- CHECK (snd_pcm_nonblock (alsa->handle, 1), non_block);
-
- return TRUE;
-
- /* ERRORS */
-drop:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Could not drop samples: %s", snd_strerror (err)));
- return FALSE;
- }
-hw_free:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Could not free hw params: %s", snd_strerror (err)));
- return FALSE;
- }
-non_block:
- {
- GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
- ("Could not set device to nonblocking: %s", snd_strerror (err)));
- return FALSE;
- }
-}
-
-static gboolean
-gst_alsasrc_close (GstAudioSrc * asrc)
-{
- GstAlsaSrc *alsa = GST_ALSA_SRC (asrc);
-
- snd_pcm_close (alsa->handle);
- alsa->handle = NULL;
-
- if (alsa->mixer) {
- gst_alsa_mixer_free (alsa->mixer);
- alsa->mixer = NULL;
- }
-
- gst_caps_replace (&alsa->cached_caps, NULL);
-
- return TRUE;
-}
-
-/*
- * Underrun and suspend recovery
- */
-static gint
-xrun_recovery (GstAlsaSrc * alsa, snd_pcm_t * handle, gint err)
-{
- GST_DEBUG_OBJECT (alsa, "xrun recovery %d", err);
-
- if (err == -EPIPE) { /* under-run */
- err = snd_pcm_prepare (handle);
- if (err < 0)
- GST_WARNING_OBJECT (alsa,
- "Can't recovery from underrun, prepare failed: %s",
- snd_strerror (err));
- return 0;
- } else if (err == -ESTRPIPE) {
- while ((err = snd_pcm_resume (handle)) == -EAGAIN)
- g_usleep (100); /* wait until the suspend flag is released */
-
- if (err < 0) {
- err = snd_pcm_prepare (handle);
- if (err < 0)
- GST_WARNING_OBJECT (alsa,
- "Can't recovery from suspend, prepare failed: %s",
- snd_strerror (err));
- }
- return 0;
- }
- return err;
-}
-
-static guint
-gst_alsasrc_read (GstAudioSrc * asrc, gpointer data, guint length)
-{
- GstAlsaSrc *alsa;
- gint err;
- gint cptr;
- gint16 *ptr;
-
- alsa = GST_ALSA_SRC (asrc);
-
- cptr = length / alsa->bytes_per_sample;
- ptr = data;
-
- GST_ALSA_SRC_LOCK (asrc);
- while (cptr > 0) {
- if ((err = snd_pcm_readi (alsa->handle, ptr, cptr)) < 0) {
- if (err == -EAGAIN) {
- GST_DEBUG_OBJECT (asrc, "Read error: %s", snd_strerror (err));
- continue;
- } else if (xrun_recovery (alsa, alsa->handle, err) < 0) {
- goto read_error;
- }
- continue;
- }
-
- ptr += err * alsa->channels;
- cptr -= err;
- }
- GST_ALSA_SRC_UNLOCK (asrc);
-
- return length - cptr;
-
-read_error:
- {
- GST_ALSA_SRC_UNLOCK (asrc);
- return length; /* skip one period */
- }
-}
-
-static guint
-gst_alsasrc_delay (GstAudioSrc * asrc)
-{
- GstAlsaSrc *alsa;
- snd_pcm_sframes_t delay;
- int res;
-
- alsa = GST_ALSA_SRC (asrc);
-
- res = snd_pcm_delay (alsa->handle, &delay);
- if (G_UNLIKELY (res < 0)) {
- GST_DEBUG_OBJECT (alsa, "snd_pcm_delay returned %d", res);
- delay = 0;
- }
-
- return CLAMP (delay, 0, alsa->buffer_size);
-}
-
-static void
-gst_alsasrc_reset (GstAudioSrc * asrc)
-{
- GstAlsaSrc *alsa;
- gint err;
-
- alsa = GST_ALSA_SRC (asrc);
-
- GST_ALSA_SRC_LOCK (asrc);
- GST_DEBUG_OBJECT (alsa, "drop");
- CHECK (snd_pcm_drop (alsa->handle), drop_error);
- GST_DEBUG_OBJECT (alsa, "prepare");
- CHECK (snd_pcm_prepare (alsa->handle), prepare_error);
- GST_DEBUG_OBJECT (alsa, "reset done");
- GST_ALSA_SRC_UNLOCK (asrc);
-
- return;
-
- /* ERRORS */
-drop_error:
- {
- GST_ERROR_OBJECT (alsa, "alsa-reset: pcm drop error: %s",
- snd_strerror (err));
- GST_ALSA_SRC_UNLOCK (asrc);
- return;
- }
-prepare_error:
- {
- GST_ERROR_OBJECT (alsa, "alsa-reset: pcm prepare error: %s",
- snd_strerror (err));
- GST_ALSA_SRC_UNLOCK (asrc);
- return;
- }
-}
diff --git a/ext/alsa/gstalsasrc.h b/ext/alsa/gstalsasrc.h
deleted file mode 100644
index d0fcbf07..00000000
--- a/ext/alsa/gstalsasrc.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
- *
- * gstalsasrc.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_ALSASRC_H__
-#define __GST_ALSASRC_H__
-
-#include <gst/audio/gstaudiosrc.h>
-#include "gstalsa.h"
-#include "gstalsamixer.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_ALSA_SRC (gst_alsasrc_get_type())
-#define GST_ALSA_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ALSA_SRC,GstAlsaSrc))
-#define GST_ALSA_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ALSA_SRC,GstAlsaSrcClass))
-#define GST_IS_ALSA_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ALSA_SRC))
-#define GST_IS_ALSA_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ALSA_SRC))
-#define GST_ALSA_SRC_CAST(obj) ((GstAlsaSrc *)(obj))
-
-#define GST_ALSA_SRC_GET_LOCK(obj) (GST_ALSA_SRC_CAST (obj)->alsa_lock)
-#define GST_ALSA_SRC_LOCK(obj) (g_mutex_lock (GST_ALSA_SRC_GET_LOCK (obj)))
-#define GST_ALSA_SRC_UNLOCK(obj) (g_mutex_unlock (GST_ALSA_SRC_GET_LOCK (obj)))
-
-typedef struct _GstAlsaSrc GstAlsaSrc;
-typedef struct _GstAlsaSrcClass GstAlsaSrcClass;
-
-/**
- * GstAlsaSrc:
- *
- * Opaque data structure
- */
-struct _GstAlsaSrc {
- GstAudioSrc src;
-
- gchar *device;
-
- snd_pcm_t *handle;
- snd_pcm_hw_params_t *hwparams;
- snd_pcm_sw_params_t *swparams;
-
- GstCaps *cached_caps;
-
- snd_pcm_access_t access;
- snd_pcm_format_t format;
- guint rate;
- guint channels;
- gint bytes_per_sample;
-
- guint buffer_time;
- guint period_time;
- snd_pcm_uframes_t buffer_size;
- snd_pcm_uframes_t period_size;
-
- GstAlsaMixer *mixer;
-
- GMutex *alsa_lock;
-};
-
-struct _GstAlsaSrcClass {
- GstAudioSrcClass parent_class;
-};
-
-GType gst_alsasrc_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_ALSASRC_H__ */
diff --git a/ext/cdparanoia/Makefile.am b/ext/cdparanoia/Makefile.am
deleted file mode 100644
index aef35819..00000000
--- a/ext/cdparanoia/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-plugin_LTLIBRARIES = libgstcdparanoia.la
-
-libgstcdparanoia_la_SOURCES = gstcdparanoiasrc.c
-libgstcdparanoia_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-libgstcdparanoia_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/cdda/libgstcdda-$(GST_MAJORMINOR).la \
- $(GST_BASE_LIBS) \
- $(GST_LIBS) \
- $(CDPARANOIA_LIBS)
-libgstcdparanoia_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstcdparanoia_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = gstcdparanoiasrc.h
diff --git a/ext/cdparanoia/gstcdparanoiasrc.c b/ext/cdparanoia/gstcdparanoiasrc.c
deleted file mode 100644
index fb710e0d..00000000
--- a/ext/cdparanoia/gstcdparanoiasrc.c
+++ /dev/null
@@ -1,544 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * <2005> Wim Taymans <wim@fluendo.com>
- * <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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <errno.h>
-
-#include "gstcdparanoiasrc.h"
-#include "gst/gst-i18n-plugin.h"
-
-enum
-{
- TRANSPORT_ERROR,
- UNCORRECTED_ERROR,
- NUM_SIGNALS
-};
-
-enum
-{
- PROP_0,
- PROP_READ_SPEED,
- PROP_PARANOIA_MODE,
- PROP_SEARCH_OVERLAP,
- PROP_GENERIC_DEVICE,
- PROP_CACHE_SIZE
-};
-
-#define DEFAULT_READ_SPEED -1
-#define DEFAULT_SEARCH_OVERLAP -1
-#define DEFAULT_PARANOIA_MODE PARANOIA_MODE_FRAGMENT
-#define DEFAULT_GENERIC_DEVICE NULL
-#define DEFAULT_CACHE_SIZE -1
-
-GST_DEBUG_CATEGORY_STATIC (gst_cd_paranoia_src_debug);
-#define GST_CAT_DEFAULT gst_cd_paranoia_src_debug
-
-GST_BOILERPLATE (GstCdParanoiaSrc, gst_cd_paranoia_src, GstCddaBaseSrc,
- GST_TYPE_CDDA_BASE_SRC);
-
-static void gst_cd_paranoia_src_finalize (GObject * obj);
-static void gst_cd_paranoia_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_cd_paranoia_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static GstBuffer *gst_cd_paranoia_src_read_sector (GstCddaBaseSrc * src,
- gint sector);
-static gboolean gst_cd_paranoia_src_open (GstCddaBaseSrc * src,
- const gchar * device);
-static void gst_cd_paranoia_src_close (GstCddaBaseSrc * src);
-
-static const GstElementDetails cdparanoia_details =
-GST_ELEMENT_DETAILS ("CD Audio (cdda) Source, Paranoia IV",
- "Source/File",
- "Read audio from CD in paranoid mode",
- "Erik Walthinsen <omega@cse.ogi.edu>, " "Wim Taymans <wim@fluendo.com>");
-
-/* We use these to serialize calls to paranoia_read() among several
- * cdparanoiasrc instances. We do this because it's the only reasonably
- * easy way to find out the calling object from within the paranoia
- * callback, and we need the object instance in there to emit our signals */
-static GstCdParanoiaSrc *cur_cb_source;
-static GStaticMutex cur_cb_mutex = G_STATIC_MUTEX_INIT;
-
-static gint cdpsrc_signals[NUM_SIGNALS]; /* all 0 */
-
-#define GST_TYPE_CD_PARANOIA_MODE (gst_cd_paranoia_mode_get_type())
-static GType
-gst_cd_paranoia_mode_get_type (void)
-{
- static const GFlagsValue paranoia_modes[] = {
- {PARANOIA_MODE_DISABLE, "PARANOIA_MODE_DISABLE", "disable"},
- {PARANOIA_MODE_FRAGMENT, "PARANOIA_MODE_FRAGMENT", "fragment"},
- {PARANOIA_MODE_OVERLAP, "PARANOIA_MODE_OVERLAP", "overlap"},
- {PARANOIA_MODE_SCRATCH, "PARANOIA_MODE_SCRATCH", "scratch"},
- {PARANOIA_MODE_REPAIR, "PARANOIA_MODE_REPAIR", "repair"},
- {PARANOIA_MODE_FULL, "PARANOIA_MODE_FULL", "full"},
- {0, NULL, NULL},
- };
-
- static GType type; /* 0 */
-
- if (!type) {
- type = g_flags_register_static ("GstCdParanoiaMode", paranoia_modes);
- }
-
- return type;
-}
-
-static void
-gst_cd_paranoia_src_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &cdparanoia_details);
-}
-
-static void
-gst_cd_paranoia_src_init (GstCdParanoiaSrc * src, GstCdParanoiaSrcClass * klass)
-{
- src->d = NULL;
- src->p = NULL;
- src->next_sector = -1;
-
- src->search_overlap = DEFAULT_SEARCH_OVERLAP;
- src->paranoia_mode = DEFAULT_PARANOIA_MODE;
- src->read_speed = DEFAULT_READ_SPEED;
- src->generic_device = g_strdup (DEFAULT_GENERIC_DEVICE);
- src->cache_size = DEFAULT_CACHE_SIZE;
-}
-
-static void
-gst_cd_paranoia_src_class_init (GstCdParanoiaSrcClass * klass)
-{
- GstCddaBaseSrcClass *cddabasesrc_class = GST_CDDA_BASE_SRC_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->set_property = gst_cd_paranoia_src_set_property;
- gobject_class->get_property = gst_cd_paranoia_src_get_property;
- gobject_class->finalize = gst_cd_paranoia_src_finalize;
-
- cddabasesrc_class->open = gst_cd_paranoia_src_open;
- cddabasesrc_class->close = gst_cd_paranoia_src_close;
- cddabasesrc_class->read_sector = gst_cd_paranoia_src_read_sector;
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_GENERIC_DEVICE,
- g_param_spec_string ("generic-device", "Generic device",
- "Use specified generic scsi device", DEFAULT_GENERIC_DEVICE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_READ_SPEED,
- g_param_spec_int ("read-speed", "Read speed",
- "Read from device at specified speed", -1, G_MAXINT,
- DEFAULT_READ_SPEED, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PARANOIA_MODE,
- g_param_spec_flags ("paranoia-mode", "Paranoia mode",
- "Type of checking to perform", GST_TYPE_CD_PARANOIA_MODE,
- DEFAULT_PARANOIA_MODE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SEARCH_OVERLAP,
- g_param_spec_int ("search-overlap", "Search overlap",
- "Force minimum overlap search during verification to n sectors", -1,
- 75, DEFAULT_SEARCH_OVERLAP,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstCdParanoiaSrc:cache-size
- *
- * Set CD cache size to n sectors (-1 = auto)
- *
- * Since: 0.10.24
- */
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_CACHE_SIZE,
- g_param_spec_int ("cache-size", "Cache size",
- "Set CD cache size to n sectors (-1 = auto)", -1,
- G_MAXINT, DEFAULT_CACHE_SIZE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /* FIXME: we don't really want signals for this, but messages on the bus,
- * but then we can't check any longer whether anyone is interested in them */
- /**
- * GstCdParanoiaSrc::transport-error
- * @cdparanoia: The CdParanoia instance
- * @sector: The sector number at which the error was encountered.
- *
- * This signal is emitted whenever an error occurs while reading.
- * CdParanoia will attempt to recover the data.
- */
- cdpsrc_signals[TRANSPORT_ERROR] =
- g_signal_new ("transport-error", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstCdParanoiaSrcClass, transport_error),
- NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
- /**
- * GstCdParanoiaSrc::uncorrected-error
- * @cdparanoia: The CdParanoia instance
- * @sector: The sector number at which the error was encountered.
- *
- * This signal is emitted whenever an uncorrectable error occurs while
- * reading. The data could not be read.
- */
- cdpsrc_signals[UNCORRECTED_ERROR] =
- g_signal_new ("uncorrected-error", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstCdParanoiaSrcClass, uncorrected_error),
- NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
-}
-
-static gboolean
-gst_cd_paranoia_src_open (GstCddaBaseSrc * cddabasesrc, const gchar * device)
-{
- GstCdParanoiaSrc *src = GST_CD_PARANOIA_SRC (cddabasesrc);
- gint i, cache_size;
-
- GST_DEBUG_OBJECT (src, "trying to open device %s (generic-device=%s) ...",
- device, GST_STR_NULL (src->generic_device));
-
- /* find the device */
- if (src->generic_device != NULL) {
- src->d = cdda_identify_scsi (src->generic_device, device, FALSE, NULL);
- } else {
- if (device != NULL) {
- src->d = cdda_identify (device, FALSE, NULL);
- } else {
- src->d = cdda_identify ("/dev/cdrom", FALSE, NULL);
- }
- }
-
- /* fail if the device couldn't be found */
- if (src->d == NULL)
- goto no_device;
-
- /* set verbosity mode */
- cdda_verbose_set (src->d, CDDA_MESSAGE_FORGETIT, CDDA_MESSAGE_FORGETIT);
-
- /* open the disc */
- if (cdda_open (src->d))
- goto open_failed;
-
- if (src->read_speed != -1) {
- cdda_speed_set (src->d, src->read_speed);
- }
-
- for (i = 1; i < src->d->tracks + 1; i++) {
- GstCddaBaseSrcTrack track = { 0, };
-
- track.num = i;
- track.is_audio = IS_AUDIO (src->d, i - 1);
- track.start = cdda_track_firstsector (src->d, i);
- track.end = cdda_track_lastsector (src->d, i);
- track.tags = NULL;
-
- gst_cdda_base_src_add_track (GST_CDDA_BASE_SRC (src), &track);
- }
-
- /* create the paranoia struct and set it up */
- src->p = paranoia_init (src->d);
- if (src->p == NULL)
- goto init_failed;
-
- paranoia_modeset (src->p, src->paranoia_mode);
- GST_INFO_OBJECT (src, "set paranoia mode to 0x%02x", src->paranoia_mode);
-
- if (src->search_overlap != -1) {
- paranoia_overlapset (src->p, src->search_overlap);
- GST_INFO_OBJECT (src, "search overlap set to %u", src->search_overlap);
- }
-
- cache_size = src->cache_size;
- if (cache_size == -1) {
- /* if paranoia mode is low (the default), assume we're doing playback */
- if (src->paranoia_mode <= PARANOIA_MODE_FRAGMENT)
- cache_size = 150;
- else
- cache_size = paranoia_cachemodel_size (src->p, -1);
- }
- paranoia_cachemodel_size (src->p, cache_size);
- GST_INFO_OBJECT (src, "set cachemodel size to %u", cache_size);
-
- src->next_sector = -1;
-
- return TRUE;
-
- /* ERRORS */
-no_device:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
- (_("Could not open CD device for reading.")), ("cdda_identify failed"));
- return FALSE;
- }
-open_failed:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
- (_("Could not open CD device for reading.")), ("cdda_open failed"));
- cdda_close (src->d);
- src->d = NULL;
- return FALSE;
- }
-init_failed:
- {
- GST_ELEMENT_ERROR (src, LIBRARY, INIT,
- ("failed to initialize paranoia"), ("failed to initialize paranoia"));
- return FALSE;
- }
-}
-
-static void
-gst_cd_paranoia_src_close (GstCddaBaseSrc * cddabasesrc)
-{
- GstCdParanoiaSrc *src = GST_CD_PARANOIA_SRC (cddabasesrc);
-
- if (src->p) {
- paranoia_free (src->p);
- src->p = NULL;
- }
-
- if (src->d) {
- cdda_close (src->d);
- src->d = NULL;
- }
-
- src->next_sector = -1;
-}
-
-static void
-gst_cd_paranoia_dummy_callback (long inpos, int function)
-{
- /* Used by instanced where no one is interested what's happening here */
-}
-
-static void
-gst_cd_paranoia_paranoia_callback (long inpos, int function)
-{
- GstCdParanoiaSrc *src = cur_cb_source;
- gint sector = (gint) (inpos / CD_FRAMEWORDS);
-
- switch (function) {
- case PARANOIA_CB_SKIP:
- GST_INFO_OBJECT (src, "Skip at sector %d", sector);
- g_signal_emit (src, cdpsrc_signals[UNCORRECTED_ERROR], 0, sector);
- break;
- case PARANOIA_CB_READERR:
- GST_INFO_OBJECT (src, "Transport error at sector %d", sector);
- g_signal_emit (src, cdpsrc_signals[TRANSPORT_ERROR], 0, sector);
- break;
- default:
- break;
- }
-}
-
-static gboolean
-gst_cd_paranoia_src_signal_is_being_watched (GstCdParanoiaSrc * src, gint sig)
-{
- return g_signal_has_handler_pending (src, cdpsrc_signals[sig], 0, FALSE);
-}
-
-static GstBuffer *
-gst_cd_paranoia_src_read_sector (GstCddaBaseSrc * cddabasesrc, gint sector)
-{
- GstCdParanoiaSrc *src = GST_CD_PARANOIA_SRC (cddabasesrc);
- GstBuffer *buf;
- gboolean do_serialize;
- gint16 *cdda_buf;
-
-#if 0
- /* Do we really need to output this? (tpm) */
- /* Due to possible autocorrections of start sectors of audio tracks on
- * multisession cds, we can maybe not compute the correct discid.
- * So issue a warning.
- * See cdparanoia/interface/common-interface.c:FixupTOC */
- if (src->d && src->d->cd_extra) {
- g_message
- ("DiscID on multisession discs might be broken. Use at own risk.");
- }
-#endif
-
- if (src->next_sector == -1 || src->next_sector != sector) {
- if (paranoia_seek (src->p, sector, SEEK_SET) == -1)
- goto seek_failed;
-
- GST_DEBUG_OBJECT (src, "successfully seeked to sector %d", sector);
- src->next_sector = sector;
- }
-
- do_serialize =
- gst_cd_paranoia_src_signal_is_being_watched (src, TRANSPORT_ERROR) ||
- gst_cd_paranoia_src_signal_is_being_watched (src, UNCORRECTED_ERROR);
-
- if (do_serialize) {
- GST_LOG_OBJECT (src, "Signal handlers connected, serialising access");
- g_static_mutex_lock (&cur_cb_mutex);
- GST_LOG_OBJECT (src, "Got lock");
- cur_cb_source = src;
-
- cdda_buf = paranoia_read (src->p, gst_cd_paranoia_paranoia_callback);
-
- cur_cb_source = NULL;
- GST_LOG_OBJECT (src, "Releasing lock");
- g_static_mutex_unlock (&cur_cb_mutex);
- } else {
- cdda_buf = paranoia_read (src->p, gst_cd_paranoia_dummy_callback);
- }
-
- if (cdda_buf == NULL)
- goto read_failed;
-
- buf = gst_buffer_new_and_alloc (CD_FRAMESIZE_RAW);
- memcpy (GST_BUFFER_DATA (buf), cdda_buf, CD_FRAMESIZE_RAW);
-
- /* cdda base class will take care of timestamping etc. */
- ++src->next_sector;
-
- return buf;
-
- /* ERRORS */
-seek_failed:
- {
- GST_WARNING_OBJECT (src, "seek to sector %d failed!", sector);
- GST_ELEMENT_ERROR (src, RESOURCE, SEEK,
- (_("Could not seek CD.")),
- ("paranoia_seek to %d failed: %s", sector, g_strerror (errno)));
- return NULL;
- }
-read_failed:
- {
- GST_WARNING_OBJECT (src, "read at sector %d failed!", sector);
- GST_ELEMENT_ERROR (src, RESOURCE, READ,
- (_("Could not read CD.")),
- ("paranoia_read at %d failed: %s", sector, g_strerror (errno)));
- return NULL;
- }
-}
-
-static void
-gst_cd_paranoia_src_finalize (GObject * obj)
-{
- GstCdParanoiaSrc *src = GST_CD_PARANOIA_SRC (obj);
-
- g_free (src->generic_device);
-
- G_OBJECT_CLASS (parent_class)->finalize (obj);
-}
-
-static void
-gst_cd_paranoia_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstCdParanoiaSrc *src = GST_CD_PARANOIA_SRC (object);
-
- GST_OBJECT_LOCK (src);
-
- switch (prop_id) {
- case PROP_GENERIC_DEVICE:{
- g_free (src->generic_device);
- src->generic_device = g_value_dup_string (value);
- if (src->generic_device && src->generic_device[0] == '\0') {
- g_free (src->generic_device);
- src->generic_device = NULL;
- }
- break;
- }
- case PROP_READ_SPEED:{
- src->read_speed = g_value_get_int (value);
- if (src->read_speed == 0)
- src->read_speed = -1;
- break;
- }
- case PROP_PARANOIA_MODE:{
- src->paranoia_mode = g_value_get_flags (value) & PARANOIA_MODE_FULL;
- break;
- }
- case PROP_SEARCH_OVERLAP:{
- src->search_overlap = g_value_get_int (value);
- break;
- }
- case PROP_CACHE_SIZE:{
- src->cache_size = g_value_get_int (value);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-
- GST_OBJECT_UNLOCK (src);
-}
-
-static void
-gst_cd_paranoia_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstCdParanoiaSrc *src = GST_CD_PARANOIA_SRC (object);
-
- GST_OBJECT_LOCK (src);
-
- switch (prop_id) {
- case PROP_READ_SPEED:
- g_value_set_int (value, src->read_speed);
- break;
- case PROP_PARANOIA_MODE:
- g_value_set_flags (value, src->paranoia_mode);
- break;
- case PROP_GENERIC_DEVICE:
- g_value_set_string (value, src->generic_device);
- break;
- case PROP_SEARCH_OVERLAP:
- g_value_set_int (value, src->search_overlap);
- break;
- case PROP_CACHE_SIZE:
- g_value_set_int (value, src->cache_size);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-
- GST_OBJECT_UNLOCK (src);
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (gst_cd_paranoia_src_debug, "cdparanoiasrc", 0,
- "CD Paranoia Source");
-
- if (!gst_element_register (plugin, "cdparanoiasrc", GST_RANK_SECONDARY,
- GST_TYPE_CD_PARANOIA_SRC))
- return FALSE;
-
-#ifdef ENABLE_NLS
- GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
- LOCALEDIR);
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif
-
-
- return TRUE;
-}
-
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "cdparanoia",
- "Read audio from CD in paranoid mode",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/cdparanoia/gstcdparanoiasrc.h b/ext/cdparanoia/gstcdparanoiasrc.h
deleted file mode 100644
index 6cec23c4..00000000
--- a/ext/cdparanoia/gstcdparanoiasrc.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_CD_PARANOIA_SRC_H__
-#define __GST_CD_PARANOIA_SRC_H__
-
-#include "gst/cdda/gstcddabasesrc.h"
-
-G_BEGIN_DECLS
-
-#define size16 gint16
-#define size32 gint32
-
-#ifdef CDPARANOIA_HEADERS_IN_DIR
- #include <cdda/cdda_interface.h>
- #include <cdda/cdda_paranoia.h>
-#else
- #include <cdda_interface.h>
- #include <cdda_paranoia.h>
-#endif
-
-#define GST_TYPE_CD_PARANOIA_SRC (gst_cd_paranoia_src_get_type())
-#define GST_CD_PARANOIA_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CD_PARANOIA_SRC,GstCdParanoiaSrc))
-#define GST_CD_PARANOIA_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CD_PARANOIA_SRC,GstCdParanoiaSrcClass))
-#define GST_IS_CD_PARANOIA_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CD_PARANOIA_SRC))
-#define GST_IS_CD_PARANOIA_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CD_PARANOIA_SRC))
-#define GST_CD_PARANOIA_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CDDA_BASAE_SRC, GstCdParanoiaSrcClass))
-
-typedef struct _GstCdParanoiaSrc GstCdParanoiaSrc;
-typedef struct _GstCdParanoiaSrcClass GstCdParanoiaSrcClass;
-
-/**
- * GstCdParanoiaSrc:
- *
- * The cdparanoia object structure.
- */
-struct _GstCdParanoiaSrc {
- GstCddaBaseSrc cddabasesrc;
-
- /*< private >*/
- cdrom_drive *d;
- cdrom_paranoia *p;
-
- gint next_sector; /* -1 or next sector we expect to
- * read, so we know when to do a seek */
-
- gint paranoia_mode;
- gint read_speed;
- gint search_overlap;
- gint cache_size;
-
- gchar *generic_device;
-};
-
-struct _GstCdParanoiaSrcClass {
- GstCddaBaseSrcClass parent_class;
-
- /* signal callbacks */
- /**
- * GstCdParanoiaSrcClass::transport-error:
- * @src: the GstCddaBaseSrc source element object
- * @sector: the sector at which the error happened
- *
- * This signal is emitted when a sector could not be read
- * because of a transport error.
- */
- void (*transport_error) (GstCdParanoiaSrc * src, gint sector);
- /**
- * GstCdParanoiaSrcClass::uncorrected-error:
- * @src: the GstCddaBaseSrc source element object
- * @sector: the sector at which the error happened
- *
- * This signal is emitted when a sector could not be read
- * because of a transport error.
- */
- void (*uncorrected_error) (GstCdParanoiaSrc * src, gint sector);
-};
-
-GType gst_cd_paranoia_src_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_CD_PARANOIA_SRC_H__ */
-
diff --git a/ext/gio/Makefile.am b/ext/gio/Makefile.am
deleted file mode 100644
index 237cfdd2..00000000
--- a/ext/gio/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-# plugindir is set in configure
-
-plugin_LTLIBRARIES = libgstgio.la
-
-# sources used to compile this plug-in
-libgstgio_la_SOURCES = \
- gstgio.c \
- gstgiobasesink.c \
- gstgiobasesrc.c \
- gstgiosink.c \
- gstgiosrc.c \
- gstgiostreamsink.c \
- gstgiostreamsrc.c
-
-libgstgio_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(GIO_CFLAGS)
-libgstgio_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(GIO_LIBS)
-libgstgio_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(GIO_LDFLAGS)
-libgstgio_la_LIBTOOLFLAGS = --tag=disable-static
-
-# headers we need but don't want installed
-noinst_HEADERS = \
- gstgio.h \
- gstgiobasesink.h \
- gstgiobasesrc.h \
- gstgiosink.h \
- gstgiosrc.h \
- gstgiostreamsink.h \
- gstgiostreamsrc.h
-
diff --git a/ext/gio/gstgio.c b/ext/gio/gstgio.c
deleted file mode 100644
index be0a940b..00000000
--- a/ext/gio/gstgio.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2007 Rene Stadler <mail@renestadler.de>
- * Copyright (C) 2007 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstgio.h"
-#include "gstgiosink.h"
-#include "gstgiosrc.h"
-#include "gstgiostreamsink.h"
-#include "gstgiostreamsrc.h"
-
-#include <string.h>
-
-GST_DEBUG_CATEGORY_STATIC (gst_gio_debug);
-#define GST_CAT_DEFAULT gst_gio_debug
-
-/* @func_name: Name of the GIO function, for debugging messages.
- * @err: Error location. *err may be NULL, but err must be non-NULL.
- * @ret: Flow return location. May be NULL. Is set to either #GST_FLOW_ERROR
- * or #GST_FLOW_WRONG_STATE.
- *
- * Returns: TRUE to indicate a handled error. Error at given location err will
- * be freed and *err will be set to NULL. A FALSE return indicates an unhandled
- * error: The err location is unchanged and guaranteed to be != NULL. ret, if
- * given, is set to GST_FLOW_ERROR.
- */
-gboolean
-gst_gio_error (gpointer element, const gchar * func_name, GError ** err,
- GstFlowReturn * ret)
-{
- gboolean handled = TRUE;
-
- if (ret)
- *ret = GST_FLOW_ERROR;
-
- if (GST_GIO_ERROR_MATCHES (*err, CANCELLED)) {
- GST_DEBUG_OBJECT (element, "blocking I/O call cancelled (%s)", func_name);
- if (ret)
- *ret = GST_FLOW_WRONG_STATE;
- } else if (*err != NULL) {
- handled = FALSE;
- } else {
- GST_ELEMENT_ERROR (element, LIBRARY, FAILED, (NULL),
- ("%s call failed without error set", func_name));
- }
-
- if (handled)
- g_clear_error (err);
-
- return handled;
-}
-
-GstFlowReturn
-gst_gio_seek (gpointer element, GSeekable * stream, guint64 offset,
- GCancellable * cancel)
-{
- gboolean success;
- GstFlowReturn ret;
- GError *err = NULL;
-
- GST_LOG_OBJECT (element, "seeking to offset %" G_GINT64_FORMAT, offset);
-
- success = g_seekable_seek (stream, offset, G_SEEK_SET, cancel, &err);
-
- if (success)
- ret = GST_FLOW_OK;
- else if (!gst_gio_error (element, "g_seekable_seek", &err, &ret)) {
- GST_ELEMENT_ERROR (element, RESOURCE, SEEK, (NULL),
- ("Could not seek: %s", err->message));
- g_clear_error (&err);
- }
-
- return ret;
-}
-
-static gpointer
-_internal_get_supported_protocols (gpointer data)
-{
- const gchar *const *schemes;
- gchar **our_schemes;
- guint num;
- gint i, j;
-
- schemes = g_vfs_get_supported_uri_schemes (g_vfs_get_default ());
- num = g_strv_length ((gchar **) schemes);
-
- if (num == 0) {
- GST_WARNING ("No GIO supported URI schemes found");
- return NULL;
- }
-
- our_schemes = g_new0 (gchar *, num + 1);
-
- /* - Filter http/https as we can't support the icy stuff with GIO.
- * Use souphttpsrc if you need that.
- * - Filter cdda as it doesn't support musicbrainz stuff and everything
- * else one expects from a cdda source. Use cdparanoiasrc or cdiosrc
- * for cdda.
- */
- for (i = 0, j = 0; i < num; i++) {
- if (strcmp (schemes[i], "http") == 0 || strcmp (schemes[i], "https") == 0
- || strcmp (schemes[i], "cdda") == 0)
- continue;
-
- our_schemes[j] = g_strdup (schemes[i]);
- j++;
- }
-
- return our_schemes;
-}
-
-static gchar **
-gst_gio_get_supported_protocols (void)
-{
- static GOnce once = G_ONCE_INIT;
-
- g_once (&once, _internal_get_supported_protocols, NULL);
- return (gchar **) once.retval;
-}
-
-static GstURIType
-gst_gio_uri_handler_get_type_sink (void)
-{
- return GST_URI_SINK;
-}
-
-static GstURIType
-gst_gio_uri_handler_get_type_src (void)
-{
- return GST_URI_SRC;
-}
-
-static gchar **
-gst_gio_uri_handler_get_protocols (void)
-{
- static gchar **protocols = NULL;
-
- if (!protocols)
- protocols = gst_gio_get_supported_protocols ();
-
- return protocols;
-}
-
-static const gchar *
-gst_gio_uri_handler_get_uri (GstURIHandler * handler)
-{
- GstElement *element = GST_ELEMENT (handler);
- const gchar *uri;
-
- g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
-
- g_object_get (G_OBJECT (element), "location", &uri, NULL);
-
- return uri;
-}
-
-static gboolean
-gst_gio_uri_handler_set_uri (GstURIHandler * handler, const gchar * uri)
-{
- GstElement *element = GST_ELEMENT (handler);
-
- g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
-
- if (GST_STATE (element) == GST_STATE_PLAYING ||
- GST_STATE (element) == GST_STATE_PAUSED)
- return FALSE;
-
- g_object_set (G_OBJECT (element), "location", uri, NULL);
-
- return TRUE;
-}
-
-static void
-gst_gio_uri_handler_init (gpointer g_iface, gpointer iface_data)
-{
- GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
- gboolean sink = GPOINTER_TO_INT (iface_data); /* See in do_init below. */
-
- if (sink)
- iface->get_type = gst_gio_uri_handler_get_type_sink;
- else
- iface->get_type = gst_gio_uri_handler_get_type_src;
- iface->get_protocols = gst_gio_uri_handler_get_protocols;
- iface->get_uri = gst_gio_uri_handler_get_uri;
- iface->set_uri = gst_gio_uri_handler_set_uri;
-}
-
-void
-gst_gio_uri_handler_do_init (GType type)
-{
- GInterfaceInfo uri_handler_info = {
- gst_gio_uri_handler_init,
- NULL,
- NULL
- };
-
- /* Store information for uri_handler_init to use for distinguishing the
- * element types. This lets us use a single interface implementation for both
- * classes. */
- uri_handler_info.interface_data = GINT_TO_POINTER (g_type_is_a (type,
- GST_TYPE_BASE_SINK));
-
- g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &uri_handler_info);
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- gboolean ret = TRUE;
-
- GST_DEBUG_CATEGORY_INIT (gst_gio_debug, "gio", 0, "GIO elements");
-
- gst_plugin_add_dependency_simple (plugin, NULL, GIO_MODULE_DIR, NULL,
- GST_PLUGIN_DEPENDENCY_FLAG_NONE);
- gst_plugin_add_dependency_simple (plugin, "LD_LIBRARY_PATH", GIO_LIBDIR,
- "gvfsd", GST_PLUGIN_DEPENDENCY_FLAG_NONE);
-
- /* FIXME: Rank is MARGINAL for now, should be at least SECONDARY+1 in the future
- * to replace gnomevfssink/src. For testing purposes PRIMARY+1 one makes sense
- * so it gets autoplugged and preferred over filesrc/sink. */
-
- ret &= gst_element_register (plugin, "giosink", GST_RANK_MARGINAL,
- GST_TYPE_GIO_SINK);
-
- ret &= gst_element_register (plugin, "giosrc", GST_RANK_MARGINAL,
- GST_TYPE_GIO_SRC);
-
- ret &= gst_element_register (plugin, "giostreamsink", GST_RANK_NONE,
- GST_TYPE_GIO_STREAM_SINK);
-
- ret &= gst_element_register (plugin, "giostreamsrc", GST_RANK_NONE,
- GST_TYPE_GIO_STREAM_SRC);
-
- return ret;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, "gio",
- "GIO elements", plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME,
- GST_PACKAGE_ORIGIN)
diff --git a/ext/gio/gstgio.h b/ext/gio/gstgio.h
deleted file mode 100644
index 01183e13..00000000
--- a/ext/gio/gstgio.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2007 Rene Stadler <mail@renestadler.de>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_GIO_H__
-#define __GST_GIO_H__
-
-#include <gio/gio.h>
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_GIO_ERROR_MATCHES(err, code) g_error_matches (err, G_IO_ERROR, G_IO_ERROR_##code)
-
-#define GST_GIO_STREAM_IS_SEEKABLE(stream) (G_IS_SEEKABLE (stream) && g_seekable_can_seek (G_SEEKABLE (stream)))
-
-gboolean gst_gio_error (gpointer element, const gchar *func_name,
- GError **err, GstFlowReturn *ret);
-GstFlowReturn gst_gio_seek (gpointer element, GSeekable *stream, guint64 offset,
- GCancellable *cancel);
-void gst_gio_uri_handler_do_init (GType type);
-
-G_END_DECLS
-
-#endif /* __GST_GIO_H__ */
diff --git a/ext/gio/gstgiobasesink.c b/ext/gio/gstgiobasesink.c
deleted file mode 100644
index 2b16909b..00000000
--- a/ext/gio/gstgiobasesink.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2007 Rene Stadler <mail@renestadler.de>
- * Copyright (C) 2007-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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gstgiobasesink.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_gio_base_sink_debug);
-#define GST_CAT_DEFAULT gst_gio_base_sink_debug
-
-static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-GST_BOILERPLATE (GstGioBaseSink, gst_gio_base_sink, GstBaseSink,
- GST_TYPE_BASE_SINK);
-
-static void gst_gio_base_sink_finalize (GObject * object);
-static gboolean gst_gio_base_sink_start (GstBaseSink * base_sink);
-static gboolean gst_gio_base_sink_stop (GstBaseSink * base_sink);
-static gboolean gst_gio_base_sink_unlock (GstBaseSink * base_sink);
-static gboolean gst_gio_base_sink_unlock_stop (GstBaseSink * base_sink);
-static gboolean gst_gio_base_sink_event (GstBaseSink * base_sink,
- GstEvent * event);
-static GstFlowReturn gst_gio_base_sink_render (GstBaseSink * base_sink,
- GstBuffer * buffer);
-static gboolean gst_gio_base_sink_query (GstPad * pad, GstQuery * query);
-
-static void
-gst_gio_base_sink_base_init (gpointer gclass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
- GST_DEBUG_CATEGORY_INIT (gst_gio_base_sink_debug, "gio_base_sink", 0,
- "GIO base sink");
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_factory));
-}
-
-static void
-gst_gio_base_sink_class_init (GstGioBaseSinkClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
- GstBaseSinkClass *gstbasesink_class = (GstBaseSinkClass *) klass;
-
- gobject_class->finalize = gst_gio_base_sink_finalize;
-
- gstbasesink_class->start = GST_DEBUG_FUNCPTR (gst_gio_base_sink_start);
- gstbasesink_class->stop = GST_DEBUG_FUNCPTR (gst_gio_base_sink_stop);
- gstbasesink_class->unlock = GST_DEBUG_FUNCPTR (gst_gio_base_sink_unlock);
- gstbasesink_class->unlock_stop =
- GST_DEBUG_FUNCPTR (gst_gio_base_sink_unlock_stop);
- gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_gio_base_sink_event);
- gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_gio_base_sink_render);
-}
-
-static void
-gst_gio_base_sink_init (GstGioBaseSink * sink, GstGioBaseSinkClass * gclass)
-{
- gst_pad_set_query_function (GST_BASE_SINK_PAD (sink),
- GST_DEBUG_FUNCPTR (gst_gio_base_sink_query));
-
- gst_base_sink_set_sync (GST_BASE_SINK (sink), FALSE);
-
- sink->cancel = g_cancellable_new ();
-}
-
-static void
-gst_gio_base_sink_finalize (GObject * object)
-{
- GstGioBaseSink *sink = GST_GIO_BASE_SINK (object);
-
- if (sink->cancel) {
- g_object_unref (sink->cancel);
- sink->cancel = NULL;
- }
-
- if (sink->stream) {
- g_object_unref (sink->stream);
- sink->stream = NULL;
- }
-
- GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
-}
-
-static gboolean
-gst_gio_base_sink_start (GstBaseSink * base_sink)
-{
- GstGioBaseSink *sink = GST_GIO_BASE_SINK (base_sink);
- GstGioBaseSinkClass *gbsink_class = GST_GIO_BASE_SINK_GET_CLASS (sink);
-
- sink->position = 0;
-
- /* FIXME: This will likely block */
- sink->stream = gbsink_class->get_stream (sink);
- if (G_UNLIKELY (!G_IS_OUTPUT_STREAM (sink->stream))) {
- GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL),
- ("No output stream provided by subclass"));
- return FALSE;
- } else if (G_UNLIKELY (g_output_stream_is_closed (sink->stream))) {
- GST_ELEMENT_ERROR (sink, LIBRARY, FAILED, (NULL),
- ("Output stream is already closed"));
- return FALSE;
- }
-
- GST_DEBUG_OBJECT (sink, "started sink");
-
- return TRUE;
-}
-
-static gboolean
-gst_gio_base_sink_stop (GstBaseSink * base_sink)
-{
- GstGioBaseSink *sink = GST_GIO_BASE_SINK (base_sink);
- GstGioBaseSinkClass *klass = GST_GIO_BASE_SINK_GET_CLASS (sink);
- gboolean success;
- GError *err = NULL;
-
- if (klass->close_on_stop && G_IS_OUTPUT_STREAM (sink->stream)) {
- GST_DEBUG_OBJECT (sink, "closing stream");
-
- /* FIXME: can block but unfortunately we can't use async operations
- * here because they require a running main loop */
- success = g_output_stream_close (sink->stream, sink->cancel, &err);
-
- if (!success && !gst_gio_error (sink, "g_output_stream_close", &err, NULL)) {
- GST_ELEMENT_WARNING (sink, RESOURCE, CLOSE, (NULL),
- ("gio_output_stream_close failed: %s", err->message));
- g_clear_error (&err);
- } else if (!success) {
- GST_ELEMENT_WARNING (sink, RESOURCE, CLOSE, (NULL),
- ("g_output_stream_close failed"));
- } else {
- GST_DEBUG_OBJECT (sink, "g_outut_stream_close succeeded");
- }
-
- g_object_unref (sink->stream);
- sink->stream = NULL;
- } else {
- success = g_output_stream_flush (sink->stream, sink->cancel, &err);
-
- if (!success && !gst_gio_error (sink, "g_output_stream_flush", &err, NULL)) {
- GST_ELEMENT_WARNING (sink, RESOURCE, CLOSE, (NULL),
- ("gio_output_stream_flush failed: %s", err->message));
- g_clear_error (&err);
- } else if (!success) {
- GST_ELEMENT_WARNING (sink, RESOURCE, CLOSE, (NULL),
- ("g_output_stream_flush failed"));
- } else {
- GST_DEBUG_OBJECT (sink, "g_outut_stream_flush succeeded");
- }
-
- g_object_unref (sink->stream);
- sink->stream = NULL;
- }
-
- return TRUE;
-}
-
-static gboolean
-gst_gio_base_sink_unlock (GstBaseSink * base_sink)
-{
- GstGioBaseSink *sink = GST_GIO_BASE_SINK (base_sink);
-
- GST_LOG_OBJECT (sink, "triggering cancellation");
-
- g_cancellable_cancel (sink->cancel);
-
- return TRUE;
-}
-
-static gboolean
-gst_gio_base_sink_unlock_stop (GstBaseSink * base_sink)
-{
- GstGioBaseSink *sink = GST_GIO_BASE_SINK (base_sink);
-
- GST_LOG_OBJECT (sink, "resetting cancellable");
-
- g_cancellable_reset (sink->cancel);
-
- return TRUE;
-}
-
-static gboolean
-gst_gio_base_sink_event (GstBaseSink * base_sink, GstEvent * event)
-{
- GstGioBaseSink *sink = GST_GIO_BASE_SINK (base_sink);
- GstFlowReturn ret = GST_FLOW_OK;
-
- if (sink->stream == NULL)
- return TRUE;
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:
- if (G_IS_OUTPUT_STREAM (sink->stream)) {
- GstFormat format;
- gint64 offset;
-
- gst_event_parse_new_segment (event, NULL, NULL, &format, &offset, NULL,
- NULL);
-
- if (format != GST_FORMAT_BYTES) {
- GST_WARNING_OBJECT (sink, "ignored NEWSEGMENT event in %s format",
- gst_format_get_name (format));
- break;
- }
-
- if (GST_GIO_STREAM_IS_SEEKABLE (sink->stream)) {
- ret = gst_gio_seek (sink, G_SEEKABLE (sink->stream), offset,
- sink->cancel);
- if (ret == GST_FLOW_OK)
- sink->position = offset;
- } else {
- ret = GST_FLOW_NOT_SUPPORTED;
- }
- }
- break;
-
- case GST_EVENT_EOS:
- case GST_EVENT_FLUSH_START:
- if (G_IS_OUTPUT_STREAM (sink->stream)) {
- gboolean success;
- GError *err = NULL;
-
- success = g_output_stream_flush (sink->stream, sink->cancel, &err);
-
- if (!success && !gst_gio_error (sink, "g_output_stream_flush", &err,
- &ret)) {
- GST_ELEMENT_ERROR (sink, RESOURCE, WRITE, (NULL),
- ("flush failed: %s", err->message));
- g_clear_error (&err);
- }
- }
- break;
-
- default:
- break;
- }
-
- return (ret == GST_FLOW_OK);
-}
-
-static GstFlowReturn
-gst_gio_base_sink_render (GstBaseSink * base_sink, GstBuffer * buffer)
-{
- GstGioBaseSink *sink = GST_GIO_BASE_SINK (base_sink);
- gssize written;
- gboolean success;
- GError *err = NULL;
-
- g_return_val_if_fail (G_IS_OUTPUT_STREAM (sink->stream), GST_FLOW_ERROR);
-
- GST_LOG_OBJECT (sink, "writing %u bytes to offset %" G_GUINT64_FORMAT,
- GST_BUFFER_SIZE (buffer), sink->position);
-
- written = g_output_stream_write (sink->stream,
- GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer), sink->cancel, &err);
-
- success = (written >= 0);
-
- if (G_UNLIKELY (success && written < GST_BUFFER_SIZE (buffer))) {
- /* FIXME: Can this happen? Should we handle it gracefully? gnomevfssink
- * doesn't... */
- GST_ELEMENT_ERROR (sink, RESOURCE, WRITE, (NULL),
- ("Could not write to stream: (short write, only %"
- G_GSSIZE_FORMAT " bytes of %d bytes written)",
- written, GST_BUFFER_SIZE (buffer)));
- return GST_FLOW_ERROR;
- }
-
- if (success) {
- sink->position += written;
- return GST_FLOW_OK;
-
- } else {
- GstFlowReturn ret;
-
- if (!gst_gio_error (sink, "g_output_stream_write", &err, &ret)) {
- GST_ELEMENT_ERROR (sink, RESOURCE, WRITE, (NULL),
- ("Could not write to stream: %s", err->message));
- g_clear_error (&err);
- }
-
- return ret;
- }
-}
-
-static gboolean
-gst_gio_base_sink_query (GstPad * pad, GstQuery * query)
-{
- GstGioBaseSink *sink = GST_GIO_BASE_SINK (GST_PAD_PARENT (pad));
- GstFormat format;
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_POSITION:
- gst_query_parse_position (query, &format, NULL);
- switch (format) {
- case GST_FORMAT_BYTES:
- case GST_FORMAT_DEFAULT:
- gst_query_set_position (query, GST_FORMAT_BYTES, sink->position);
- return TRUE;
- default:
- return FALSE;
- }
- case GST_QUERY_FORMATS:
- gst_query_set_formats (query, 2, GST_FORMAT_DEFAULT, GST_FORMAT_BYTES);
- return TRUE;
- case GST_QUERY_URI:
- if (GST_IS_URI_HANDLER (sink)) {
- const gchar *uri;
-
- uri = gst_uri_handler_get_uri (GST_URI_HANDLER (sink));
- gst_query_set_uri (query, uri);
- return TRUE;
- }
- return FALSE;
- default:
- return gst_pad_query_default (pad, query);
- }
-}
-
-void
-gst_gio_base_sink_set_stream (GstGioBaseSink * sink, GOutputStream * stream)
-{
- g_return_if_fail (G_IS_OUTPUT_STREAM (stream));
- g_return_if_fail ((GST_STATE (sink) != GST_STATE_PLAYING &&
- GST_STATE (sink) != GST_STATE_PAUSED));
-
- if (G_IS_OUTPUT_STREAM (sink->stream)) {
- gboolean success;
- GError *err = NULL;
-
- GST_DEBUG_OBJECT (sink, "closing old stream");
-
- /* FIXME: can block but unfortunately we can't use async operations
- * here because they require a running main loop */
- success = g_output_stream_close (sink->stream, sink->cancel, &err);
-
- if (!success && !gst_gio_error (sink, "g_output_stream_close", &err, NULL)) {
- GST_ELEMENT_WARNING (sink, RESOURCE, CLOSE, (NULL),
- ("g_output_stream_close failed: %s", err->message));
- g_clear_error (&err);
- } else if (!success) {
- GST_ELEMENT_WARNING (sink, RESOURCE, CLOSE, (NULL),
- ("g_output_stream_close failed"));
- } else {
- GST_DEBUG_OBJECT (sink, "g_output_stream_close succeeded");
- }
-
- g_object_unref (sink->stream);
- sink->stream = NULL;
- }
-
- sink->stream = stream;
-}
diff --git a/ext/gio/gstgiobasesink.h b/ext/gio/gstgiobasesink.h
deleted file mode 100644
index 7f13a854..00000000
--- a/ext/gio/gstgiobasesink.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2007 Rene Stadler <mail@renestadler.de>
- * Copyright (C) 2007-2009 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_GIO_BASE_SINK_H__
-#define __GST_GIO_BASE_SINK_H__
-
-#include "gstgio.h"
-
-#include <gst/base/gstbasesink.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GIO_BASE_SINK \
- (gst_gio_base_sink_get_type())
-#define GST_GIO_BASE_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GIO_BASE_SINK,GstGioBaseSink))
-#define GST_GIO_BASE_SINK_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GIO_BASE_SINK, GstGioBaseSinkClass))
-#define GST_GIO_BASE_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GIO_BASE_SINK,GstGioBaseSinkClass))
-#define GST_IS_GIO_BASE_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GIO_BASE_SINK))
-#define GST_IS_GIO_BASE_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GIO_BASE_SINK))
-
-typedef struct _GstGioBaseSink GstGioBaseSink;
-typedef struct _GstGioBaseSinkClass GstGioBaseSinkClass;
-
-struct _GstGioBaseSink
-{
- GstBaseSink sink;
-
- /* < protected > */
- GCancellable *cancel;
- guint64 position;
-
- /* < private > */
- GOutputStream *stream;
-};
-
-struct _GstGioBaseSinkClass
-{
- GstBaseSinkClass parent_class;
-
- GOutputStream * (*get_stream) (GstGioBaseSink *bsink);
- gboolean close_on_stop;
-};
-
-GType gst_gio_base_sink_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_GIO_BASE_SINK_H__ */
diff --git a/ext/gio/gstgiobasesrc.c b/ext/gio/gstgiobasesrc.c
deleted file mode 100644
index 133e12c2..00000000
--- a/ext/gio/gstgiobasesrc.c
+++ /dev/null
@@ -1,447 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2007 Rene Stadler <mail@renestadler.de>
- * Copyright (C) 2007-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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gstgiobasesrc.h"
-
-#include <gst/base/gsttypefindhelper.h>
-
-GST_DEBUG_CATEGORY_STATIC (gst_gio_base_src_debug);
-#define GST_CAT_DEFAULT gst_gio_base_src_debug
-
-static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-GST_BOILERPLATE (GstGioBaseSrc, gst_gio_base_src, GstBaseSrc,
- GST_TYPE_BASE_SRC);
-
-static void gst_gio_base_src_finalize (GObject * object);
-
-static gboolean gst_gio_base_src_start (GstBaseSrc * base_src);
-static gboolean gst_gio_base_src_stop (GstBaseSrc * base_src);
-static gboolean gst_gio_base_src_get_size (GstBaseSrc * base_src,
- guint64 * size);
-static gboolean gst_gio_base_src_is_seekable (GstBaseSrc * base_src);
-static gboolean gst_gio_base_src_unlock (GstBaseSrc * base_src);
-static gboolean gst_gio_base_src_unlock_stop (GstBaseSrc * base_src);
-static gboolean gst_gio_base_src_check_get_range (GstBaseSrc * base_src);
-static GstFlowReturn gst_gio_base_src_create (GstBaseSrc * base_src,
- guint64 offset, guint size, GstBuffer ** buf);
-static gboolean gst_gio_base_src_query (GstBaseSrc * base_src,
- GstQuery * query);
-
-static void
-gst_gio_base_src_base_init (gpointer gclass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
- GST_DEBUG_CATEGORY_INIT (gst_gio_base_src_debug, "gio_base_src", 0,
- "GIO base source");
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_factory));
-}
-
-static void
-gst_gio_base_src_class_init (GstGioBaseSrcClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
- GstBaseSrcClass *gstbasesrc_class = (GstBaseSrcClass *) klass;
-
- gobject_class->finalize = gst_gio_base_src_finalize;
-
- gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_gio_base_src_start);
- gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_gio_base_src_stop);
- gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_gio_base_src_get_size);
- gstbasesrc_class->is_seekable =
- GST_DEBUG_FUNCPTR (gst_gio_base_src_is_seekable);
- gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_gio_base_src_unlock);
- gstbasesrc_class->unlock_stop =
- GST_DEBUG_FUNCPTR (gst_gio_base_src_unlock_stop);
- gstbasesrc_class->check_get_range =
- GST_DEBUG_FUNCPTR (gst_gio_base_src_check_get_range);
- gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_gio_base_src_create);
- gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_gio_base_src_query);
-}
-
-static void
-gst_gio_base_src_init (GstGioBaseSrc * src, GstGioBaseSrcClass * gclass)
-{
- src->cancel = g_cancellable_new ();
-}
-
-static void
-gst_gio_base_src_finalize (GObject * object)
-{
- GstGioBaseSrc *src = GST_GIO_BASE_SRC (object);
-
- if (src->cancel) {
- g_object_unref (src->cancel);
- src->cancel = NULL;
- }
-
- if (src->stream) {
- g_object_unref (src->stream);
- src->stream = NULL;
- }
-
- if (src->cache) {
- gst_buffer_unref (src->cache);
- src->cache = NULL;
- }
-
- GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
-}
-
-static gboolean
-gst_gio_base_src_start (GstBaseSrc * base_src)
-{
- GstGioBaseSrc *src = GST_GIO_BASE_SRC (base_src);
- GstGioBaseSrcClass *gbsrc_class = GST_GIO_BASE_SRC_GET_CLASS (src);
-
- src->position = 0;
-
- /* FIXME: This will likely block */
- src->stream = gbsrc_class->get_stream (src);
- if (G_UNLIKELY (!G_IS_INPUT_STREAM (src->stream))) {
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
- ("No input stream provided by subclass"));
- return FALSE;
- } else if (G_UNLIKELY (g_input_stream_is_closed (src->stream))) {
- GST_ELEMENT_ERROR (src, LIBRARY, FAILED, (NULL),
- ("Input stream is already closed"));
- return FALSE;
- }
-
- if (G_IS_SEEKABLE (src->stream))
- src->position = g_seekable_tell (G_SEEKABLE (src->stream));
-
- GST_DEBUG_OBJECT (src, "started source");
-
- return TRUE;
-}
-
-static gboolean
-gst_gio_base_src_stop (GstBaseSrc * base_src)
-{
- GstGioBaseSrc *src = GST_GIO_BASE_SRC (base_src);
- GstGioBaseSrcClass *klass = GST_GIO_BASE_SRC_GET_CLASS (src);
- gboolean success;
- GError *err = NULL;
-
- if (klass->close_on_stop && G_IS_INPUT_STREAM (src->stream)) {
- GST_DEBUG_OBJECT (src, "closing stream");
-
- /* FIXME: can block but unfortunately we can't use async operations
- * here because they require a running main loop */
- success = g_input_stream_close (src->stream, src->cancel, &err);
-
- if (!success && !gst_gio_error (src, "g_input_stream_close", &err, NULL)) {
- GST_ELEMENT_WARNING (src, RESOURCE, CLOSE, (NULL),
- ("g_input_stream_close failed: %s", err->message));
- g_clear_error (&err);
- } else if (!success) {
- GST_ELEMENT_WARNING (src, RESOURCE, CLOSE, (NULL),
- ("g_input_stream_close failed"));
- } else {
- GST_DEBUG_OBJECT (src, "g_input_stream_close succeeded");
- }
-
- g_object_unref (src->stream);
- src->stream = NULL;
- } else {
- g_object_unref (src->stream);
- src->stream = NULL;
- }
-
- return TRUE;
-}
-
-static gboolean
-gst_gio_base_src_get_size (GstBaseSrc * base_src, guint64 * size)
-{
- GstGioBaseSrc *src = GST_GIO_BASE_SRC (base_src);
-
- if (G_IS_FILE_INPUT_STREAM (src->stream)) {
- GFileInfo *info;
- GError *err = NULL;
-
- info = g_file_input_stream_query_info (G_FILE_INPUT_STREAM (src->stream),
- G_FILE_ATTRIBUTE_STANDARD_SIZE, src->cancel, &err);
-
- if (info != NULL) {
- *size = g_file_info_get_size (info);
- g_object_unref (info);
- GST_DEBUG_OBJECT (src, "found size: %" G_GUINT64_FORMAT, *size);
- return TRUE;
- }
-
- if (!gst_gio_error (src, "g_file_input_stream_query_info", &err, NULL)) {
-
- if (GST_GIO_ERROR_MATCHES (err, NOT_SUPPORTED))
- GST_DEBUG_OBJECT (src, "size information not available");
- else
- GST_WARNING_OBJECT (src, "size information retrieval failed: %s",
- err->message);
-
- g_clear_error (&err);
- }
- }
-
- if (GST_GIO_STREAM_IS_SEEKABLE (src->stream)) {
- goffset old;
- goffset stream_size;
- gboolean ret;
- GSeekable *seekable = G_SEEKABLE (src->stream);
- GError *err = NULL;
-
- old = g_seekable_tell (seekable);
-
- ret = g_seekable_seek (seekable, 0, G_SEEK_END, src->cancel, &err);
- if (!ret) {
- if (!gst_gio_error (src, "g_seekable_seek", &err, NULL)) {
- if (GST_GIO_ERROR_MATCHES (err, NOT_SUPPORTED))
- GST_DEBUG_OBJECT (src,
- "Seeking to the end of stream is not supported");
- else
- GST_WARNING_OBJECT (src, "Seeking to end of stream failed: %s",
- err->message);
- g_clear_error (&err);
- } else {
- GST_WARNING_OBJECT (src, "Seeking to end of stream failed");
- }
- return FALSE;
- }
-
- stream_size = g_seekable_tell (seekable);
-
- ret = g_seekable_seek (seekable, old, G_SEEK_SET, src->cancel, &err);
- if (!ret) {
- if (!gst_gio_error (src, "g_seekable_seek", &err, NULL)) {
- if (GST_GIO_ERROR_MATCHES (err, NOT_SUPPORTED))
- GST_ERROR_OBJECT (src, "Seeking to the old position not supported");
- else
- GST_ERROR_OBJECT (src, "Seeking to the old position failed: %s",
- err->message);
- g_clear_error (&err);
- } else {
- GST_ERROR_OBJECT (src, "Seeking to the old position faile");
- }
- return FALSE;
- }
-
- if (stream_size >= 0) {
- *size = stream_size;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static gboolean
-gst_gio_base_src_is_seekable (GstBaseSrc * base_src)
-{
- GstGioBaseSrc *src = GST_GIO_BASE_SRC (base_src);
- gboolean seekable;
-
- seekable = GST_GIO_STREAM_IS_SEEKABLE (src->stream);
-
- GST_DEBUG_OBJECT (src, "can seek: %d", seekable);
-
- return seekable;
-}
-
-static gboolean
-gst_gio_base_src_unlock (GstBaseSrc * base_src)
-{
- GstGioBaseSrc *src = GST_GIO_BASE_SRC (base_src);
-
- GST_LOG_OBJECT (src, "triggering cancellation");
-
- g_cancellable_cancel (src->cancel);
-
- return TRUE;
-}
-
-static gboolean
-gst_gio_base_src_unlock_stop (GstBaseSrc * base_src)
-{
- GstGioBaseSrc *src = GST_GIO_BASE_SRC (base_src);
-
- GST_LOG_OBJECT (src, "resetting cancellable");
-
- g_cancellable_reset (src->cancel);
-
- return TRUE;
-}
-
-static gboolean
-gst_gio_base_src_check_get_range (GstBaseSrc * base_src)
-{
- return GST_CALL_PARENT_WITH_DEFAULT (GST_BASE_SRC_CLASS,
- check_get_range, (base_src), FALSE);
-}
-
-static GstFlowReturn
-gst_gio_base_src_create (GstBaseSrc * base_src, guint64 offset, guint size,
- GstBuffer ** buf_return)
-{
- GstGioBaseSrc *src = GST_GIO_BASE_SRC (base_src);
- GstBuffer *buf;
- GstFlowReturn ret = GST_FLOW_OK;
-
- g_return_val_if_fail (G_IS_INPUT_STREAM (src->stream), GST_FLOW_ERROR);
-
- /* If we have the requested part in our cache take a subbuffer of that,
- * otherwise fill the cache again with at least 4096 bytes from the
- * requested offset and return a subbuffer of that.
- *
- * We need caching because every read/seek operation will need to go
- * over DBus if our backend is GVfs and this is painfully slow. */
- if (src->cache && offset >= GST_BUFFER_OFFSET (src->cache) &&
- offset + size <= GST_BUFFER_OFFSET_END (src->cache)) {
- GST_DEBUG_OBJECT (src, "Creating subbuffer from cached buffer: offset %"
- G_GUINT64_FORMAT " length %u", offset, size);
-
- buf = gst_buffer_create_sub (src->cache,
- offset - GST_BUFFER_OFFSET (src->cache), size);
-
- GST_BUFFER_OFFSET (buf) = offset;
- GST_BUFFER_OFFSET_END (buf) = offset + size;
- GST_BUFFER_SIZE (buf) = size;
- } else {
- guint cachesize = MAX (4096, size);
- gssize read, res;
- gboolean success, eos;
- GError *err = NULL;
-
- if (src->cache) {
- gst_buffer_unref (src->cache);
- src->cache = NULL;
- }
-
- if (G_UNLIKELY (offset != src->position)) {
- if (!GST_GIO_STREAM_IS_SEEKABLE (src->stream))
- return GST_FLOW_NOT_SUPPORTED;
-
- GST_DEBUG_OBJECT (src, "Seeking to position %" G_GUINT64_FORMAT, offset);
- ret = gst_gio_seek (src, G_SEEKABLE (src->stream), offset, src->cancel);
-
- if (ret == GST_FLOW_OK)
- src->position = offset;
- else
- return ret;
- }
-
- src->cache = gst_buffer_try_new_and_alloc (cachesize);
- if (G_UNLIKELY (src->cache == NULL)) {
- GST_ERROR_OBJECT (src, "Failed to allocate %u bytes", cachesize);
- return GST_FLOW_ERROR;
- }
-
- GST_LOG_OBJECT (src, "Reading %u bytes from offset %" G_GUINT64_FORMAT,
- cachesize, offset);
-
- /* GIO sometimes gives less bytes than requested although
- * it's not at the end of file. SMB for example only
- * supports reads up to 64k. So we loop here until we get at
- * at least the requested amount of bytes or a read returns
- * nothing. */
- read = 0;
- while (size - read > 0 && (res =
- g_input_stream_read (G_INPUT_STREAM (src->stream),
- GST_BUFFER_DATA (src->cache) + read, cachesize - read,
- src->cancel, &err)) > 0) {
- read += res;
- }
-
- success = (read >= 0);
- eos = (cachesize > 0 && read == 0);
-
- if (!success && !gst_gio_error (src, "g_input_stream_read", &err, &ret)) {
- GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
- ("Could not read from stream: %s", err->message));
- g_clear_error (&err);
- }
-
- if (success && !eos) {
- src->position += read;
- GST_BUFFER_SIZE (src->cache) = read;
-
- GST_BUFFER_OFFSET (src->cache) = offset;
- GST_BUFFER_OFFSET_END (src->cache) = offset + read;
-
- GST_DEBUG_OBJECT (src, "Read successful");
- GST_DEBUG_OBJECT (src, "Creating subbuffer from new "
- "cached buffer: offset %" G_GUINT64_FORMAT " length %u", offset,
- size);
-
- buf = gst_buffer_create_sub (src->cache, 0, MIN (size, read));
-
- GST_BUFFER_OFFSET (buf) = offset;
- GST_BUFFER_OFFSET_END (buf) = offset + MIN (size, read);
- GST_BUFFER_SIZE (buf) = MIN (size, read);
- } else {
- GST_DEBUG_OBJECT (src, "Read not successful");
- gst_buffer_unref (src->cache);
- src->cache = NULL;
- buf = NULL;
- }
-
- if (eos)
- ret = GST_FLOW_UNEXPECTED;
- }
-
- *buf_return = buf;
-
- return ret;
-}
-
-static gboolean
-gst_gio_base_src_query (GstBaseSrc * base_src, GstQuery * query)
-{
- gboolean ret = FALSE;
- GstGioBaseSrc *src = GST_GIO_BASE_SRC (base_src);
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_URI:
- if (GST_IS_URI_HANDLER (src)) {
- const gchar *uri = gst_uri_handler_get_uri (GST_URI_HANDLER (src));
- gst_query_set_uri (query, uri);
- ret = TRUE;
- }
- break;
- default:
- ret = FALSE;
- break;
- }
-
- if (!ret)
- ret = GST_BASE_SRC_CLASS (parent_class)->query (base_src, query);
-
- return ret;
-}
diff --git a/ext/gio/gstgiobasesrc.h b/ext/gio/gstgiobasesrc.h
deleted file mode 100644
index 7a14859c..00000000
--- a/ext/gio/gstgiobasesrc.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2007 Rene Stadler <mail@renestadler.de>
- * Copyright (C) 2007-2009 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_GIO_BASE_SRC_H__
-#define __GST_GIO_BASE_SRC_H__
-
-#include "gstgio.h"
-
-#include <gst/base/gstbasesrc.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GIO_BASE_SRC \
- (gst_gio_base_src_get_type())
-#define GST_GIO_BASE_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GIO_BASE_SRC,GstGioBaseSrc))
-#define GST_GIO_BASE_SRC_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GIO_BASE_SRC, GstGioBaseSrcClass))
-#define GST_GIO_BASE_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GIO_BASE_SRC,GstGioBaseSrcClass))
-#define GST_IS_GIO_BASE_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GIO_BASE_SRC))
-#define GST_IS_GIO_BASE_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GIO_BASE_SRC))
-
-typedef struct _GstGioBaseSrc GstGioBaseSrc;
-typedef struct _GstGioBaseSrcClass GstGioBaseSrcClass;
-
-struct _GstGioBaseSrc
-{
- GstBaseSrc src;
-
- /* < protected > */
- GCancellable *cancel;
- guint64 position;
-
- /* < private > */
- GInputStream *stream;
- GstBuffer *cache;
-};
-
-struct _GstGioBaseSrcClass
-{
- GstBaseSrcClass parent_class;
-
- GInputStream * (*get_stream) (GstGioBaseSrc *bsrc);
- gboolean close_on_stop;
-};
-
-GType gst_gio_base_src_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_GIO_BASE_SRC_H__ */
diff --git a/ext/gio/gstgiosink.c b/ext/gio/gstgiosink.c
deleted file mode 100644
index 69e05e50..00000000
--- a/ext/gio/gstgiosink.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2007 Rene Stadler <mail@renestadler.de>
- * Copyright (C) 2007-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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-giosink
- * @see_also: #GstFileSink, #GstGnomeVFSSink, #GstGioSrc
- *
- * This plugin writes incoming data to a local or remote location specified
- * by an URI. This location can be specified using any protocol supported by
- * the GIO library or it's VFS backends. Common protocols are 'file', 'ftp',
- * or 'smb'.
- *
- * If the URI or #GFile already exists giosink will post a message of
- * type %GST_MESSAGE_ELEMENT with name "file-exists" on the bus. The message
- * also contains the #GFile and the corresponding URI.
- * Applications can use the "file-exists" message to notify the user about
- * the problem and to set a different target location or to remove the
- * existing file. Note that right after the "file-exists" message a normal
- * error message is posted on the bus which should be ignored if "file-exists"
- * is handled by the application, for example by calling
- * gst_bus_set_flushing(bus, TRUE) after the "file-exists" message was
- * received and gst_bus_set_flushing(bus, FALSE) after the problem is
- * resolved.
- *
- * Similar to the "file-exist" message a "not-mounted" message is posted
- * on the bus if the target location is not mounted yet and needs to be
- * mounted. This message can be used by application to mount the location
- * and retry after the location was mounted successfully.
- *
- * <refsect2>
- * <title>Example pipelines</title>
- * |[
- * gst-launch -v filesrc location=input.xyz ! giosink location=file:///home/joe/out.xyz
- * ]| The above pipeline will simply copy a local file. Instead of giosink,
- * we could just as well have used the filesink element here.
- * |[
- * gst-launch -v filesrc location=foo.mp3 ! mad ! flacenc ! giosink location=smb://othercomputer/foo.flac
- * ]| The above pipeline will re-encode an mp3 file into FLAC format and store
- * it on a remote host using the Samba protocol.
- * |[
- * gst-launch -v audiotestsrc num-buffers=100 ! vorbisenc ! oggmux ! giosink location=file:///home/foo/bar.ogg
- * ]| The above pipeline will encode a 440Hz sine wave to Ogg Vorbis and stores
- * it in the home directory of user foo.
- * </refsect2>
- */
-
-/* FIXME: We would like to mount the enclosing volume of an URL
- * if it isn't mounted yet but this is possible async-only.
- * Unfortunately this requires a running main loop from the
- * default context and we can't guarantuee this!
- *
- * We would also like to do authentication while mounting.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gstgiosink.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_gio_sink_debug);
-#define GST_CAT_DEFAULT gst_gio_sink_debug
-
-/* Filter signals and args */
-enum
-{
- LAST_SIGNAL
-};
-
-enum
-{
- PROP_0,
- PROP_LOCATION,
- PROP_FILE
-};
-
-GST_BOILERPLATE_FULL (GstGioSink, gst_gio_sink, GstGioBaseSink,
- GST_TYPE_GIO_BASE_SINK, gst_gio_uri_handler_do_init);
-
-static void gst_gio_sink_finalize (GObject * object);
-static void gst_gio_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_gio_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static GOutputStream *gst_gio_sink_get_stream (GstGioBaseSink * base_sink);
-
-static void
-gst_gio_sink_base_init (gpointer gclass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
- GST_DEBUG_CATEGORY_INIT (gst_gio_sink_debug, "gio_sink", 0, "GIO sink");
-
- gst_element_class_set_details_simple (element_class, "GIO sink",
- "Sink/File",
- "Write to any GIO-supported location",
- "Ren\xc3\xa9 Stadler <mail@renestadler.de>, "
- "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
-}
-
-static void
-gst_gio_sink_class_init (GstGioSinkClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
- GstGioBaseSinkClass *gstgiobasesink_class = (GstGioBaseSinkClass *) klass;
-
- gobject_class->finalize = gst_gio_sink_finalize;
- gobject_class->set_property = gst_gio_sink_set_property;
- gobject_class->get_property = gst_gio_sink_get_property;
-
- g_object_class_install_property (gobject_class, PROP_LOCATION,
- g_param_spec_string ("location", "Location", "URI location to write to",
- NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstGioSink:file
- *
- * %GFile to write to.
- *
- * Since: 0.10.20
- **/
- g_object_class_install_property (gobject_class, PROP_FILE,
- g_param_spec_object ("file", "File", "GFile to write to",
- G_TYPE_FILE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstgiobasesink_class->get_stream =
- GST_DEBUG_FUNCPTR (gst_gio_sink_get_stream);
- gstgiobasesink_class->close_on_stop = TRUE;
-}
-
-static void
-gst_gio_sink_init (GstGioSink * sink, GstGioSinkClass * gclass)
-{
-}
-
-static void
-gst_gio_sink_finalize (GObject * object)
-{
- GstGioSink *sink = GST_GIO_SINK (object);
-
- if (sink->file) {
- g_object_unref (sink->file);
- sink->file = NULL;
- }
-
- GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
-}
-
-static void
-gst_gio_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstGioSink *sink = GST_GIO_SINK (object);
-
- switch (prop_id) {
- case PROP_LOCATION:{
- const gchar *uri = NULL;
-
- if (GST_STATE (sink) == GST_STATE_PLAYING ||
- GST_STATE (sink) == GST_STATE_PAUSED) {
- GST_WARNING
- ("Setting a new location or GFile not supported in PLAYING or PAUSED state");
- break;
- }
-
- GST_OBJECT_LOCK (GST_OBJECT (sink));
- if (sink->file)
- g_object_unref (sink->file);
-
- uri = g_value_get_string (value);
-
- if (uri) {
- sink->file = g_file_new_for_uri (uri);
-
- if (!sink->file) {
- GST_ERROR ("Could not create GFile for URI '%s'", uri);
- }
- } else {
- sink->file = NULL;
- }
- GST_OBJECT_UNLOCK (GST_OBJECT (sink));
- break;
- }
- case PROP_FILE:
- if (GST_STATE (sink) == GST_STATE_PLAYING ||
- GST_STATE (sink) == GST_STATE_PAUSED) {
- GST_WARNING
- ("Setting a new location or GFile not supported in PLAYING or PAUSED state");
- break;
- }
-
- GST_OBJECT_LOCK (GST_OBJECT (sink));
- if (sink->file)
- g_object_unref (sink->file);
-
- sink->file = g_value_dup_object (value);
-
- GST_OBJECT_UNLOCK (GST_OBJECT (sink));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_gio_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstGioSink *sink = GST_GIO_SINK (object);
-
- switch (prop_id) {
- case PROP_LOCATION:{
- gchar *uri;
-
- GST_OBJECT_LOCK (GST_OBJECT (sink));
- if (sink->file) {
- uri = g_file_get_uri (sink->file);
- g_value_set_string (value, uri);
- g_free (uri);
- } else {
- g_value_set_string (value, NULL);
- }
- GST_OBJECT_UNLOCK (GST_OBJECT (sink));
- break;
- }
- case PROP_FILE:
- GST_OBJECT_LOCK (GST_OBJECT (sink));
- g_value_set_object (value, sink->file);
- GST_OBJECT_UNLOCK (GST_OBJECT (sink));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GOutputStream *
-gst_gio_sink_get_stream (GstGioBaseSink * bsink)
-{
- GstGioSink *sink = GST_GIO_SINK (bsink);
- GOutputStream *stream;
- GCancellable *cancel = GST_GIO_BASE_SINK (sink)->cancel;
- GError *err = NULL;
- gchar *uri;
-
- if (sink->file == NULL) {
- GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL),
- ("No location or GFile given"));
- return NULL;
- }
-
- uri = g_file_get_uri (sink->file);
- if (!uri)
- uri = g_strdup ("(null)");
-
- stream =
- G_OUTPUT_STREAM (g_file_create (sink->file, G_FILE_CREATE_NONE, cancel,
- &err));
-
- if (!stream) {
- if (!gst_gio_error (sink, "g_file_create", &err, NULL)) {
- /*if (GST_GIO_ERROR_MATCHES (err, EXISTS)) */
- /* FIXME: Retry with replace if overwrite == TRUE! */
-
- if (GST_GIO_ERROR_MATCHES (err, NOT_FOUND)) {
- GST_ELEMENT_ERROR (sink, RESOURCE, NOT_FOUND, (NULL),
- ("Could not open location %s for writing: %s", uri, err->message));
- } else if (GST_GIO_ERROR_MATCHES (err, EXISTS)) {
- gst_element_post_message (GST_ELEMENT_CAST (sink),
- gst_message_new_element (GST_OBJECT_CAST (sink),
- gst_structure_new ("file-exists", "file", G_TYPE_FILE,
- sink->file, "uri", G_TYPE_STRING, uri, NULL)));
-
- GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL),
- ("Location %s already exists: %s", uri, err->message));
- } else if (GST_GIO_ERROR_MATCHES (err, NOT_MOUNTED)) {
- gst_element_post_message (GST_ELEMENT_CAST (sink),
- gst_message_new_element (GST_OBJECT_CAST (sink),
- gst_structure_new ("not-mounted", "file", G_TYPE_FILE,
- sink->file, "uri", G_TYPE_STRING, uri, NULL)));
-
- GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL),
- ("Location %s not mounted: %s", uri, err->message));
- } else {
- GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL),
- ("Could not open location %s for writing: %s", uri, err->message));
- }
-
- g_clear_error (&err);
- }
- g_free (uri);
- return NULL;
- }
-
- GST_DEBUG_OBJECT (sink, "opened location %s", uri);
-
- g_free (uri);
-
- return stream;
-}
diff --git a/ext/gio/gstgiosink.h b/ext/gio/gstgiosink.h
deleted file mode 100644
index 494d5db3..00000000
--- a/ext/gio/gstgiosink.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2007 Rene Stadler <mail@renestadler.de>
- * Copyright (C) 2007-2009 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_GIO_SINK_H__
-#define __GST_GIO_SINK_H__
-
-#include "gstgio.h"
-#include "gstgiobasesink.h"
-
-#include <gst/base/gstbasesink.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GIO_SINK \
- (gst_gio_sink_get_type())
-#define GST_GIO_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GIO_SINK,GstGioSink))
-#define GST_GIO_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GIO_SINK,GstGioSinkClass))
-#define GST_IS_GIO_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GIO_SINK))
-#define GST_IS_GIO_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GIO_SINK))
-
-typedef struct _GstGioSink GstGioSink;
-typedef struct _GstGioSinkClass GstGioSinkClass;
-
-/**
- * GstGioSink:
- *
- * Opaque data structure.
- */
-struct _GstGioSink
-{
- GstGioBaseSink sink;
-
- /*< private >*/
- GFile *file;
-};
-
-struct _GstGioSinkClass
-{
- GstGioBaseSinkClass parent_class;
-};
-
-GType gst_gio_sink_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_GIO_SINK_H__ */
diff --git a/ext/gio/gstgiosrc.c b/ext/gio/gstgiosrc.c
deleted file mode 100644
index 5fd810e7..00000000
--- a/ext/gio/gstgiosrc.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2007 Rene Stadler <mail@renestadler.de>
- * Copyright (C) 2007-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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-giosrc
- * @see_also: #GstFileSrc, #GstGnomeVFSSrc, #GstGioSink
- *
- * This plugin reads data from a local or remote location specified
- * by an URI. This location can be specified using any protocol supported by
- * the GIO library or it's VFS backends. Common protocols are 'file', 'http',
- * 'ftp', or 'smb'.
- *
- * If an URI or #GFile is not mounted giosrc will post a message of type
- * %GST_MESSAGE_ELEMENT with name "not-mounted" on the bus. The message
- * also contains the #GFile and the corresponding URI.
- * Applications can use the "not-mounted" message to mount the #GFile
- * by calling g_file_mount_enclosing_volume() and then restart the
- * pipeline after the mounting has succeeded. Note that right after the
- * "not-mounted" message a normal error message is posted on the bus which
- * should be ignored if "not-mounted" is handled by the application, for
- * example by calling gst_bus_set_flushing(bus, TRUE) after the "not-mounted"
- * message was received and gst_bus_set_flushing(bus, FALSE) after the
- * mounting was successful.
- *
- * <refsect2>
- * <title>Example launch lines</title>
- * |[
- * gst-launch -v giosrc location=file:///home/joe/foo.xyz ! fakesink
- * ]| The above pipeline will simply read a local file and do nothing with the
- * data read. Instead of giosrc, we could just as well have used the
- * filesrc element here.
- * |[
- * gst-launch -v giosrc location=smb://othercomputer/foo.xyz ! filesink location=/home/joe/foo.xyz
- * ]| The above pipeline will copy a file from a remote host to the local file
- * system using the Samba protocol.
- * |[
- * gst-launch -v giosrc location=http://music.foobar.com/demo.mp3 ! mad ! audioconvert ! audioresample ! alsasink
- * ]| The above pipeline will read and decode and play an mp3 file from a
- * web server using the http protocol.
- * </refsect2>
- */
-
-/* FIXME: We would like to mount the enclosing volume of an URL
- * if it isn't mounted yet but this is possible async-only.
- * Unfortunately this requires a running main loop from the
- * default context and we can't guarantuee this!
- *
- * We would also like to do authentication while mounting.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gstgiosrc.h"
-#include <string.h>
-
-GST_DEBUG_CATEGORY_STATIC (gst_gio_src_debug);
-#define GST_CAT_DEFAULT gst_gio_src_debug
-
-enum
-{
- PROP_0,
- PROP_LOCATION,
- PROP_FILE
-};
-
-GST_BOILERPLATE_FULL (GstGioSrc, gst_gio_src, GstGioBaseSrc,
- GST_TYPE_GIO_BASE_SRC, gst_gio_uri_handler_do_init);
-
-static void gst_gio_src_finalize (GObject * object);
-
-static void gst_gio_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_gio_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static GInputStream *gst_gio_src_get_stream (GstGioBaseSrc * bsrc);
-
-static gboolean gst_gio_src_check_get_range (GstBaseSrc * base_src);
-
-static void
-gst_gio_src_base_init (gpointer gclass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
- GST_DEBUG_CATEGORY_INIT (gst_gio_src_debug, "gio_src", 0, "GIO source");
-
- gst_element_class_set_details_simple (element_class, "GIO source",
- "Source/File",
- "Read from any GIO-supported location",
- "Ren\xc3\xa9 Stadler <mail@renestadler.de>, "
- "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
-}
-
-static void
-gst_gio_src_class_init (GstGioSrcClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
- GstBaseSrcClass *gstbasesrc_class = (GstBaseSrcClass *) klass;
- GstGioBaseSrcClass *gstgiobasesrc_class = (GstGioBaseSrcClass *) klass;
-
- gobject_class->finalize = gst_gio_src_finalize;
- gobject_class->set_property = gst_gio_src_set_property;
- gobject_class->get_property = gst_gio_src_get_property;
-
- g_object_class_install_property (gobject_class, PROP_LOCATION,
- g_param_spec_string ("location", "Location", "URI location to read from",
- NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstGioSrc:file
- *
- * %GFile to read from.
- *
- * Since: 0.10.20
- **/
- g_object_class_install_property (gobject_class, PROP_FILE,
- g_param_spec_object ("file", "File", "GFile to read from",
- G_TYPE_FILE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstbasesrc_class->check_get_range =
- GST_DEBUG_FUNCPTR (gst_gio_src_check_get_range);
-
- gstgiobasesrc_class->get_stream = GST_DEBUG_FUNCPTR (gst_gio_src_get_stream);
- gstgiobasesrc_class->close_on_stop = TRUE;
-}
-
-static void
-gst_gio_src_init (GstGioSrc * src, GstGioSrcClass * gclass)
-{
-}
-
-static void
-gst_gio_src_finalize (GObject * object)
-{
- GstGioSrc *src = GST_GIO_SRC (object);
-
- if (src->file) {
- g_object_unref (src->file);
- src->file = NULL;
- }
-
- GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
-}
-
-static void
-gst_gio_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstGioSrc *src = GST_GIO_SRC (object);
-
- switch (prop_id) {
- case PROP_LOCATION:{
- const gchar *uri = NULL;
-
- if (GST_STATE (src) == GST_STATE_PLAYING ||
- GST_STATE (src) == GST_STATE_PAUSED) {
- GST_WARNING
- ("Setting a new location or GFile not supported in PLAYING or PAUSED state");
- break;
- }
-
- GST_OBJECT_LOCK (GST_OBJECT (src));
- if (src->file)
- g_object_unref (src->file);
-
- uri = g_value_get_string (value);
-
- if (uri) {
- src->file = g_file_new_for_uri (uri);
-
- if (!src->file) {
- GST_ERROR ("Could not create GFile for URI '%s'", uri);
- }
- } else {
- src->file = NULL;
- }
- GST_OBJECT_UNLOCK (GST_OBJECT (src));
- break;
- }
- case PROP_FILE:
- if (GST_STATE (src) == GST_STATE_PLAYING ||
- GST_STATE (src) == GST_STATE_PAUSED) {
- GST_WARNING
- ("Setting a new location or GFile not supported in PLAYING or PAUSED state");
- break;
- }
-
- GST_OBJECT_LOCK (GST_OBJECT (src));
- if (src->file)
- g_object_unref (src->file);
-
- src->file = g_value_dup_object (value);
-
- GST_OBJECT_UNLOCK (GST_OBJECT (src));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_gio_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstGioSrc *src = GST_GIO_SRC (object);
-
- switch (prop_id) {
- case PROP_LOCATION:{
- gchar *uri;
-
- GST_OBJECT_LOCK (GST_OBJECT (src));
- if (src->file) {
- uri = g_file_get_uri (src->file);
- g_value_set_string (value, uri);
- g_free (uri);
- } else {
- g_value_set_string (value, NULL);
- }
- GST_OBJECT_UNLOCK (GST_OBJECT (src));
- break;
- }
- case PROP_FILE:
- GST_OBJECT_LOCK (GST_OBJECT (src));
- g_value_set_object (value, src->file);
- GST_OBJECT_UNLOCK (GST_OBJECT (src));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-gst_gio_src_check_get_range (GstBaseSrc * base_src)
-{
- GstGioSrc *src = GST_GIO_SRC (base_src);
- gchar *scheme;
-
- if (src->file == NULL)
- goto done;
-
- scheme = g_file_get_uri_scheme (src->file);
- if (scheme == NULL)
- goto done;
-
- if (strcmp (scheme, "file") == 0) {
- GST_LOG_OBJECT (src, "local URI, assuming random access is possible");
- g_free (scheme);
- return TRUE;
- } else if (strcmp (scheme, "http") == 0 || strcmp (scheme, "https") == 0) {
- GST_LOG_OBJECT (src, "blacklisted protocol '%s', "
- "no random access possible", scheme);
- g_free (scheme);
- return FALSE;
- }
-
- g_free (scheme);
-
-done:
-
- GST_DEBUG_OBJECT (src, "undecided about random access, asking base class");
-
- return GST_CALL_PARENT_WITH_DEFAULT (GST_BASE_SRC_CLASS,
- check_get_range, (base_src), FALSE);
-}
-
-
-static GInputStream *
-gst_gio_src_get_stream (GstGioBaseSrc * bsrc)
-{
- GstGioSrc *src = GST_GIO_SRC (bsrc);
- GError *err = NULL;
- GInputStream *stream;
- GCancellable *cancel = bsrc->cancel;
- gchar *uri = NULL;
-
- if (src->file == NULL) {
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
- ("No location or GFile given"));
- return NULL;
- }
-
- uri = g_file_get_uri (src->file);
- if (!uri)
- uri = g_strdup ("(null)");
-
- stream = G_INPUT_STREAM (g_file_read (src->file, cancel, &err));
-
- if (stream == NULL && !gst_gio_error (src, "g_file_read", &err, NULL)) {
- if (GST_GIO_ERROR_MATCHES (err, NOT_FOUND)) {
- GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),
- ("Could not open location %s for reading: %s", uri, err->message));
- } else if (GST_GIO_ERROR_MATCHES (err, NOT_MOUNTED)) {
- gst_element_post_message (GST_ELEMENT_CAST (src),
- gst_message_new_element (GST_OBJECT_CAST (src),
- gst_structure_new ("not-mounted", "file", G_TYPE_FILE, src->file,
- "uri", G_TYPE_STRING, uri, NULL)));
-
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
- ("Location %s not mounted: %s", uri, err->message));
- } else {
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
- ("Could not open location %s for reading: %s", uri, err->message));
- }
-
- g_free (uri);
- g_clear_error (&err);
- return NULL;
- } else if (stream == NULL) {
- g_free (uri);
- return NULL;
- }
-
- GST_DEBUG_OBJECT (src, "opened location %s", uri);
- g_free (uri);
-
- return stream;
-}
diff --git a/ext/gio/gstgiosrc.h b/ext/gio/gstgiosrc.h
deleted file mode 100644
index 080d3d8f..00000000
--- a/ext/gio/gstgiosrc.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2007 Rene Stadler <mail@renestadler.de>
- * Copyright (C) 2007-2009 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_GIO_SRC_H__
-#define __GST_GIO_SRC_H__
-
-#include "gstgio.h"
-#include "gstgiobasesrc.h"
-
-#include <gst/base/gstbasesrc.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GIO_SRC \
- (gst_gio_src_get_type())
-#define GST_GIO_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GIO_SRC,GstGioSrc))
-#define GST_GIO_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GIO_SRC,GstGioSrcClass))
-#define GST_IS_GIO_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GIO_SRC))
-#define GST_IS_GIO_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GIO_SRC))
-
-typedef struct _GstGioSrc GstGioSrc;
-typedef struct _GstGioSrcClass GstGioSrcClass;
-
-/**
- * GstGioSrc:
- *
- * Opaque data structure.
- */
-struct _GstGioSrc
-{
- GstGioBaseSrc src;
-
- /*< private >*/
- GFile *file;
-};
-
-struct _GstGioSrcClass
-{
- GstGioBaseSrcClass parent_class;
-};
-
-GType gst_gio_src_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_GIO_SRC_H__ */
diff --git a/ext/gio/gstgiostreamsink.c b/ext/gio/gstgiostreamsink.c
deleted file mode 100644
index 02dac71f..00000000
--- a/ext/gio/gstgiostreamsink.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2007 Rene Stadler <mail@renestadler.de>
- * Copyright (C) 2007-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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-giostreamsink
- *
- * This plugin writes incoming data to a custom GIO #GOutputStream.
- *
- * It can, for example, be used to write a stream to memory with a
- * #GMemoryOuputStream or to write to a file with a #GFileOuputStream.
- *
- * <refsect2>
- * <title>Example code</title>
- * <para>
- * The following example writes the received data to a #GMemoryOutputStream.
- * |[
-
-#include &lt;gst/gst.h&gt;
-#include &lt;gio/gio.h&gt;
-
-...
-
-GstElement *sink;
-GMemoryOuputStream *stream;
-// out_data will contain the received data
-guint8 *out_data;
-
-...
-
-stream = G_MEMORY_OUTPUT_STREAM (g_memory_output_stream_new (NULL, 0,
- (GReallocFunc) g_realloc, (GDestroyNotify) g_free));
-sink = gst_element_factory_make ("giostreamsink", "sink");
-g_object_set (G_OBJECT (sink), "stream", stream, NULL);
-
-...
-
-// after processing get the written data
-out_data = g_memory_ouput_stream_get_data (G_MEMORY_OUTPUT_STREAM (stream));
-
-...
-
- * ]|
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gstgiostreamsink.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_gio_stream_sink_debug);
-#define GST_CAT_DEFAULT gst_gio_stream_sink_debug
-
-/* Filter signals and args */
-enum
-{
- LAST_SIGNAL
-};
-
-enum
-{
- PROP_0,
- PROP_STREAM
-};
-
-GST_BOILERPLATE (GstGioStreamSink, gst_gio_stream_sink, GstGioBaseSink,
- GST_TYPE_GIO_BASE_SINK);
-
-static void gst_gio_stream_sink_finalize (GObject * object);
-static void gst_gio_stream_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_gio_stream_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static GOutputStream *gst_gio_stream_sink_get_stream (GstGioBaseSink * bsink);
-
-static void
-gst_gio_stream_sink_base_init (gpointer gclass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
- GST_DEBUG_CATEGORY_INIT (gst_gio_stream_sink_debug, "gio_stream_sink", 0,
- "GIO stream sink");
-
- gst_element_class_set_details_simple (element_class, "GIO stream sink",
- "Sink",
- "Write to any GIO stream",
- "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
-}
-
-static void
-gst_gio_stream_sink_class_init (GstGioStreamSinkClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
- GstGioBaseSinkClass *ggbsink_class = (GstGioBaseSinkClass *) klass;
-
- gobject_class->finalize = gst_gio_stream_sink_finalize;
- gobject_class->set_property = gst_gio_stream_sink_set_property;
- gobject_class->get_property = gst_gio_stream_sink_get_property;
-
- g_object_class_install_property (gobject_class, PROP_STREAM,
- g_param_spec_object ("stream", "Stream", "Stream to write to",
- G_TYPE_OUTPUT_STREAM, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- ggbsink_class->get_stream =
- GST_DEBUG_FUNCPTR (gst_gio_stream_sink_get_stream);
-}
-
-static void
-gst_gio_stream_sink_init (GstGioStreamSink * sink,
- GstGioStreamSinkClass * gclass)
-{
-}
-
-static void
-gst_gio_stream_sink_finalize (GObject * object)
-{
- GstGioStreamSink *sink = GST_GIO_STREAM_SINK (object);
-
- if (sink->stream) {
- g_object_unref (sink->stream);
- sink->stream = NULL;
- }
-
- GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
-}
-
-static void
-gst_gio_stream_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstGioStreamSink *sink = GST_GIO_STREAM_SINK (object);
-
- switch (prop_id) {
- case PROP_STREAM:{
- GObject *stream;
-
- if (GST_STATE (sink) == GST_STATE_PLAYING ||
- GST_STATE (sink) == GST_STATE_PAUSED) {
- GST_WARNING
- ("Setting a new stream not supported in PLAYING or PAUSED state");
- break;
- }
-
- stream = g_value_dup_object (value);
- if (sink->stream)
- g_object_unref (sink->stream);
- sink->stream = G_OUTPUT_STREAM (stream);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_gio_stream_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstGioStreamSink *sink = GST_GIO_STREAM_SINK (object);
-
- switch (prop_id) {
- case PROP_STREAM:
- g_value_set_object (value, GST_GIO_BASE_SINK (sink)->stream);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GOutputStream *
-gst_gio_stream_sink_get_stream (GstGioBaseSink * bsink)
-{
- GstGioStreamSink *sink = GST_GIO_STREAM_SINK (bsink);
-
- return (sink->stream) ? g_object_ref (sink->stream) : NULL;
-}
diff --git a/ext/gio/gstgiostreamsink.h b/ext/gio/gstgiostreamsink.h
deleted file mode 100644
index 5e6206b5..00000000
--- a/ext/gio/gstgiostreamsink.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2007 Rene Stadler <mail@renestadler.de>
- * Copyright (C) 2007-2009 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_GIO_STREAM_SINK_H__
-#define __GST_GIO_STREAM_SINK_H__
-
-#include "gstgio.h"
-#include "gstgiobasesink.h"
-
-#include <gst/base/gstbasesink.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GIO_STREAM_SINK \
- (gst_gio_stream_sink_get_type())
-#define GST_GIO_STREAM_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GIO_STREAM_SINK,GstGioStreamSink))
-#define GST_GIO_STREAM_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GIO_STREAM_SINK,GstGioStreamSinkClass))
-#define GST_IS_GIO_STREAM_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GIO_STREAM_SINK))
-#define GST_IS_GIO_STREAM_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GIO_STREAM_SINK))
-
-typedef struct _GstGioStreamSink GstGioStreamSink;
-typedef struct _GstGioStreamSinkClass GstGioStreamSinkClass;
-
-/**
- * GstGioStreamSink:
- *
- * Opaque data structure.
- */
-struct _GstGioStreamSink
-{
- GstGioBaseSink sink;
-
- /* < private > */
- GOutputStream *stream;
-};
-
-struct _GstGioStreamSinkClass
-{
- GstGioBaseSinkClass parent_class;
-};
-
-GType gst_gio_stream_sink_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_GIO_STREAM_SINK_H__ */
diff --git a/ext/gio/gstgiostreamsrc.c b/ext/gio/gstgiostreamsrc.c
deleted file mode 100644
index b031de6b..00000000
--- a/ext/gio/gstgiostreamsrc.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2007 Rene Stadler <mail@renestadler.de>
- * Copyright (C) 2007-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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-giostreamsrc
- *
- * This plugin reads data from a custom GIO #GInputStream.
- *
- * It can, for example, be used to read data from memory with a
- * #GMemoryInputStream or to read from a file with a
- * #GFileInputStream.
- *
- * <refsect2>
- * <title>Example code</title>
- * <para>
- * The following example reads data from a #GMemoryOutputStream.
- * |[
-
-#include &lt;gst/gst.h&gt;
-#include &lt;gio/gio.h&gt;
-
-...
-
-GstElement *src;
-GMemoryInputStream *stream;
-// in_data will contain the data to send
-guint8 *in_data;
-gint i;
-
-...
-in_data = g_new (guint8, 512);
-for (i = 0; i < 512; i++)
- in_data[i] = i % 256;
-
-stream = G_MEMORY_INPUT_STREAM (g_memory_input_stream_new_from_data (in_data, 512,
- (GDestroyNotify) g_free));
-src = gst_element_factory_make ("giostreamsrc", "src");
-g_object_set (G_OBJECT (src), "stream", stream, NULL);
-
-...
-
- * ]|
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gstgiostreamsrc.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_gio_stream_src_debug);
-#define GST_CAT_DEFAULT gst_gio_stream_src_debug
-
-enum
-{
- PROP_0,
- PROP_STREAM
-};
-
-GST_BOILERPLATE (GstGioStreamSrc, gst_gio_stream_src, GstGioBaseSrc,
- GST_TYPE_GIO_BASE_SRC);
-
-static void gst_gio_stream_src_finalize (GObject * object);
-static void gst_gio_stream_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_gio_stream_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static GInputStream *gst_gio_stream_src_get_stream (GstGioBaseSrc * bsrc);
-
-static void
-gst_gio_stream_src_base_init (gpointer gclass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
- GST_DEBUG_CATEGORY_INIT (gst_gio_stream_src_debug, "gio_stream_src", 0,
- "GIO source");
-
- gst_element_class_set_details_simple (element_class, "GIO stream source",
- "Source",
- "Read from any GIO stream",
- "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
-}
-
-static void
-gst_gio_stream_src_class_init (GstGioStreamSrcClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
- GstGioBaseSrcClass *gstgiobasesrc_class = (GstGioBaseSrcClass *) klass;
-
- gobject_class->finalize = gst_gio_stream_src_finalize;
- gobject_class->set_property = gst_gio_stream_src_set_property;
- gobject_class->get_property = gst_gio_stream_src_get_property;
-
- g_object_class_install_property (gobject_class, PROP_STREAM,
- g_param_spec_object ("stream", "Stream", "Stream to read from",
- G_TYPE_INPUT_STREAM, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstgiobasesrc_class->get_stream =
- GST_DEBUG_FUNCPTR (gst_gio_stream_src_get_stream);
-}
-
-static void
-gst_gio_stream_src_init (GstGioStreamSrc * src, GstGioStreamSrcClass * gclass)
-{
-}
-
-static void
-gst_gio_stream_src_finalize (GObject * object)
-{
- GstGioStreamSrc *src = GST_GIO_STREAM_SRC (object);
-
- if (src->stream) {
- g_object_unref (src->stream);
- src->stream = NULL;
- }
-
- GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
-}
-
-static void
-gst_gio_stream_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstGioStreamSrc *src = GST_GIO_STREAM_SRC (object);
-
- switch (prop_id) {
- case PROP_STREAM:{
- GObject *stream;
-
- if (GST_STATE (src) == GST_STATE_PLAYING ||
- GST_STATE (src) == GST_STATE_PAUSED) {
- GST_WARNING
- ("Setting a new stream not supported in PLAYING or PAUSED state");
- break;
- }
-
- stream = g_value_dup_object (value);
- if (src->stream)
- g_object_unref (src->stream);
- src->stream = G_INPUT_STREAM (stream);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_gio_stream_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstGioStreamSrc *src = GST_GIO_STREAM_SRC (object);
-
- switch (prop_id) {
- case PROP_STREAM:
- g_value_set_object (value, src->stream);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GInputStream *
-gst_gio_stream_src_get_stream (GstGioBaseSrc * bsrc)
-{
- GstGioStreamSrc *src = GST_GIO_STREAM_SRC (bsrc);
-
- return (src->stream) ? g_object_ref (src->stream) : NULL;
-}
diff --git a/ext/gio/gstgiostreamsrc.h b/ext/gio/gstgiostreamsrc.h
deleted file mode 100644
index 975a2775..00000000
--- a/ext/gio/gstgiostreamsrc.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2007 Rene Stadler <mail@renestadler.de>
- * Copyright (C) 2007-2009 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_GIO_STREAM_SRC_H__
-#define __GST_GIO_STREAM_SRC_H__
-
-#include "gstgio.h"
-#include "gstgiobasesrc.h"
-
-#include <gst/base/gstbasesrc.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GIO_STREAM_SRC \
- (gst_gio_stream_src_get_type())
-#define GST_GIO_STREAM_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GIO_STREAM_SRC,GstGioStreamSrc))
-#define GST_GIO_STREAM_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GIO_STREAM_SRC,GstGioStreamSrcClass))
-#define GST_IS_GIO_STREAM_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GIO_STREAM_SRC))
-#define GST_IS_GIO_STREAM_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GIO_STREAM_SRC))
-
-typedef struct _GstGioStreamSrc GstGioStreamSrc;
-typedef struct _GstGioStreamSrcClass GstGioStreamSrcClass;
-
-/**
- * GstGioStreamSrc:
- *
- * Opaque data structure.
- */
-struct _GstGioStreamSrc
-{
- GstGioBaseSrc src;
-
- /* < private > */
- GInputStream *stream;
-};
-
-struct _GstGioStreamSrcClass
-{
- GstGioBaseSrcClass parent_class;
-};
-
-GType gst_gio_stream_src_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_GIO_STREAM_SRC_H__ */
diff --git a/ext/gnomevfs/Makefile.am b/ext/gnomevfs/Makefile.am
deleted file mode 100644
index f87a94b3..00000000
--- a/ext/gnomevfs/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-plugin_LTLIBRARIES = libgstgnomevfs.la
-
-libgstgnomevfs_la_SOURCES = \
- gstgnomevfs.c \
- gstgnomevfssink.c \
- gstgnomevfssrc.c \
- gstgnomevfsuri.c
-
-libgstgnomevfs_la_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(GNOME_VFS_CFLAGS)
-libgstgnomevfs_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/tag/libgsttag-$(GST_MAJORMINOR).la \
- $(GST_BASE_LIBS) $(GNOME_VFS_LIBS)
-libgstgnomevfs_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstgnomevfs_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = \
- gstgnomevfs.h \
- gstgnomevfssink.h \
- gstgnomevfssrc.h \
- gstgnomevfsuri.h
diff --git a/ext/gnomevfs/gstgnomevfs.c b/ext/gnomevfs/gstgnomevfs.c
deleted file mode 100644
index 747f1cf0..00000000
--- a/ext/gnomevfs/gstgnomevfs.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * gnomevfs.c: register gnomevfs 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "gst/gst-i18n-plugin.h"
-
-#include "gstgnomevfs.h"
-#include "gstgnomevfssrc.h"
-#include "gstgnomevfssink.h"
-
-#include <libgnomevfs/gnome-vfs.h>
-#include <gst/gst.h>
-
-#include <string.h>
-
-gchar *
-gst_gnome_vfs_location_to_uri_string (const gchar * location)
-{
- gchar *newloc, *ret;
-
- if (location == NULL)
- return NULL;
-
- /* already an URI string? */
- if (strstr (location, "://"))
- return g_strdup (location);
-
- newloc = gnome_vfs_escape_path_string (location);
-
- if (newloc && *newloc == '/') {
- ret = g_strdup_printf ("file://%s", newloc);
- } else {
- gchar *curdir;
-
- curdir = g_get_current_dir ();
- ret = g_strdup_printf ("file://%s/%s", curdir, newloc);
- g_free (curdir);
- }
-
- g_free (newloc);
- return ret;
-}
-
-GType
-gst_gnome_vfs_uri_get_type (void)
-{
- static GType type; /* 0 */
-
- if (type == 0) {
- type = g_boxed_type_register_static ("GnomeVFSURI",
- (GBoxedCopyFunc) gnome_vfs_uri_ref,
- (GBoxedFreeFunc) gnome_vfs_uri_unref);
- }
-
- return type;
-}
-
-static gpointer
-gst_gnome_vfs_handle_copy (gpointer handle)
-{
- return handle;
-}
-
-static void
-gst_gnome_vfs_handle_free (gpointer handle)
-{
- return;
-}
-
-GType
-gst_gnome_vfs_handle_get_type (void)
-{
- static GType type; /* 0 */
-
- if (type == 0) {
- /* hackish, but makes it show up nicely in gst-inspect */
- type = g_boxed_type_register_static ("GnomeVFSHandle",
- (GBoxedCopyFunc) gst_gnome_vfs_handle_copy,
- (GBoxedFreeFunc) gst_gnome_vfs_handle_free);
- }
-
- return type;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- /* gnome vfs engine init */
- if (!gnome_vfs_initialized ()) {
- if (!gnome_vfs_init ()) {
- GST_WARNING ("Failed to initialize GnomeVFS - not registering plugin!");
- return FALSE;
- }
- }
-
- gst_plugin_add_dependency_simple (plugin, NULL, GNOME_VFS_MODULES_DIR, NULL,
- GST_PLUGIN_DEPENDENCY_FLAG_NONE);
-
- if (!gst_element_register (plugin, "gnomevfssrc", GST_RANK_SECONDARY,
- gst_gnome_vfs_src_get_type ()))
- return FALSE;
-
- if (!gst_element_register (plugin, "gnomevfssink", GST_RANK_SECONDARY,
- gst_gnome_vfs_sink_get_type ()))
- return FALSE;
-
-#ifdef ENABLE_NLS
-/* FIXME: add category
- GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE, LOCALEDIR);
- */
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif /* ENABLE_NLS */
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "gnomevfs",
- "elements to read from and write to Gnome-VFS uri's",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/gnomevfs/gstgnomevfs.h b/ext/gnomevfs/gstgnomevfs.h
deleted file mode 100644
index f2228bea..00000000
--- a/ext/gnomevfs/gstgnomevfs.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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_GNOME_VFS_H__
-#define __GST_GNOME_VFS_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GNOME_VFS_URI (gst_gnome_vfs_uri_get_type ())
-#define GST_TYPE_GNOME_VFS_HANDLE (gst_gnome_vfs_handle_get_type ())
-
-GType gst_gnome_vfs_uri_get_type (void);
-GType gst_gnome_vfs_handle_get_type (void);
-
-gchar * gst_gnome_vfs_location_to_uri_string (const gchar * location);
-
-G_END_DECLS
-
-#endif /* __GST_GNOME_VFS_H__ */
diff --git a/ext/gnomevfs/gstgnomevfssink.c b/ext/gnomevfs/gstgnomevfssink.c
deleted file mode 100644
index 431c9fda..00000000
--- a/ext/gnomevfs/gstgnomevfssink.c
+++ /dev/null
@@ -1,632 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2000 Wim Taymans <wtay@chello.be>
- * 2001 Bastien Nocera <hadess@hadess.net>
- * 2003 Colin Walters <walters@verbum.org>
- * 2005 Tim-Philipp Müller <tim centricular net>
- *
- * gstgnomevfssink.c:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-/**
- * SECTION:element-gnomevfssink
- * @see_also: #GstFileSink, #GstGnomeVFSSrc
- *
- * This plugin writes incoming data to a local or remote location specified
- * by an URI. This location can be specified using any protocol supported by
- * the GnomeVFS library. Common protocols are 'file', 'ftp', or 'smb'.
- *
- * Applications can connect to the #GstGnomeVFSSink::allow-overwrite signal to
- * receive a callback when an existing file will be overwritten. The return
- * value of the signal will determine if gnomevfssink will overwrite the
- * resource or abort with an error.
- *
- * <refsect2>
- * <title>Example launch lines</title>
- * |[
- * gst-launch -v filesrc location=input.xyz ! gnomevfssink location=file:///home/joe/out.xyz
- * ]| The above pipeline will simply copy a local file. Instead of gnomevfssink,
- * we could just as well have used the filesink element here.
- * |[
- * gst-launch -v filesrc location=foo.mp3 ! mad ! flacenc ! gnomevfssink location=smb://othercomputer/foo.flac
- * ]| The above pipeline will re-encode an mp3 file into FLAC format and store
- * it on a remote host using the Samba protocol.
- * </refsect2>
- *
- * Last reviewed on 2006-02-28 (0.10.4)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstgnomevfssink.h"
-
-#include "gst/gst-i18n-plugin.h"
-
-#include <gst/gst.h>
-#include <libgnomevfs/gnome-vfs.h>
-#include <string.h>
-#include <errno.h>
-
-static const GstElementDetails gst_gnome_vfs_sink_details =
-GST_ELEMENT_DETAILS ("GnomeVFS Sink",
- "Sink/File",
- "Write a stream to a GnomeVFS URI",
- "Bastien Nocera <hadess@hadess.net>");
-
-enum
-{
- SIGNAL_ERASE_ASK,
- LAST_SIGNAL
-};
-
-enum
-{
- ARG_0,
- ARG_LOCATION,
- ARG_URI,
- ARG_HANDLE
-};
-
-static void gst_gnome_vfs_sink_finalize (GObject * obj);
-
-static void gst_gnome_vfs_sink_uri_handler_init (gpointer g_iface,
- gpointer iface_data);
-
-static void gst_gnome_vfs_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_gnome_vfs_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static gboolean gst_gnome_vfs_sink_open_file (GstGnomeVFSSink * sink);
-static void gst_gnome_vfs_sink_close_file (GstGnomeVFSSink * sink);
-static gboolean gst_gnome_vfs_sink_start (GstBaseSink * basesink);
-static gboolean gst_gnome_vfs_sink_stop (GstBaseSink * basesink);
-static GstFlowReturn gst_gnome_vfs_sink_render (GstBaseSink * basesink,
- GstBuffer * buffer);
-static gboolean gst_gnome_vfs_sink_handle_event (GstBaseSink * basesink,
- GstEvent * event);
-static gboolean gst_gnome_vfs_sink_query (GstPad * pad, GstQuery * query);
-
-static guint gst_gnome_vfs_sink_signals[LAST_SIGNAL]; /* all 0 */
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-GST_DEBUG_CATEGORY_STATIC (gst_gnome_vfs_sink_debug);
-#define GST_CAT_DEFAULT gst_gnome_vfs_sink_debug
-
-static void
-gst_gnome_vfs_sink_do_init (GType type)
-{
- static const GInterfaceInfo urihandler_info = {
- gst_gnome_vfs_sink_uri_handler_init,
- NULL,
- NULL
- };
-
- g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &urihandler_info);
-
- GST_DEBUG_CATEGORY_INIT (gst_gnome_vfs_sink_debug, "gnomevfssink", 0,
- "Gnome VFS sink element");
-}
-
-GST_BOILERPLATE_FULL (GstGnomeVFSSink, gst_gnome_vfs_sink, GstBaseSink,
- GST_TYPE_BASE_SINK, gst_gnome_vfs_sink_do_init);
-
-static void
-gst_gnome_vfs_sink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sinktemplate));
-
- gst_element_class_set_details (element_class, &gst_gnome_vfs_sink_details);
-}
-
-static gboolean
-_gst_boolean_allow_overwrite_accumulator (GSignalInvocationHint * ihint,
- GValue * return_accu, const GValue * handler_return, gpointer dummy)
-{
- gboolean allow_overwrite;
-
- allow_overwrite = g_value_get_boolean (handler_return);
- if (!(ihint->run_type & G_SIGNAL_RUN_CLEANUP))
- g_value_set_boolean (return_accu, allow_overwrite);
-
- /* stop emission if signal doesn't allow overwriting */
- return allow_overwrite;
-}
-
-static void
-gst_gnome_vfs_sink_class_init (GstGnomeVFSSinkClass * klass)
-{
- GstBaseSinkClass *basesink_class;
- GObjectClass *gobject_class;
-
- gobject_class = (GObjectClass *) klass;
- basesink_class = (GstBaseSinkClass *) klass;
-
- gobject_class->set_property = gst_gnome_vfs_sink_set_property;
- gobject_class->get_property = gst_gnome_vfs_sink_get_property;
- gobject_class->finalize = gst_gnome_vfs_sink_finalize;
-
- g_object_class_install_property (gobject_class, ARG_LOCATION,
- g_param_spec_string ("location", "File Location",
- "Location of the file to write", NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_URI,
- g_param_spec_boxed ("uri", "GnomeVFSURI", "URI for GnomeVFS",
- GST_TYPE_GNOME_VFS_URI, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_HANDLE,
- g_param_spec_boxed ("handle", "GnomeVFSHandle", "Handle for GnomeVFS",
- GST_TYPE_GNOME_VFS_HANDLE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstGnomeVFSSink::allow-overwrite
- * @sink: the object which received the signal
- * @uri: the URI to be overwritten
- *
- * This signal is fired when gnomevfssink is about to overwrite an
- * existing resource. The application can connect to this signal and ask
- * the user if the resource may be overwritten.
- *
- * Returns: A boolean indicating that the resource may be overwritten.
- */
- gst_gnome_vfs_sink_signals[SIGNAL_ERASE_ASK] =
- g_signal_new ("allow-overwrite", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_CLEANUP, G_STRUCT_OFFSET (GstGnomeVFSSinkClass, erase_ask),
- _gst_boolean_allow_overwrite_accumulator, NULL,
- gst_marshal_BOOLEAN__POINTER, G_TYPE_BOOLEAN, 1, GST_TYPE_GNOME_VFS_URI);
-
- basesink_class->stop = GST_DEBUG_FUNCPTR (gst_gnome_vfs_sink_stop);
- basesink_class->start = GST_DEBUG_FUNCPTR (gst_gnome_vfs_sink_start);
- basesink_class->event = GST_DEBUG_FUNCPTR (gst_gnome_vfs_sink_handle_event);
- basesink_class->render = GST_DEBUG_FUNCPTR (gst_gnome_vfs_sink_render);
- basesink_class->get_times = NULL;
-}
-
-static void
-gst_gnome_vfs_sink_finalize (GObject * obj)
-{
- GstGnomeVFSSink *sink = GST_GNOME_VFS_SINK (obj);
-
- if (sink->uri) {
- gnome_vfs_uri_unref (sink->uri);
- sink->uri = NULL;
- }
-
- if (sink->uri_name) {
- g_free (sink->uri_name);
- sink->uri_name = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->finalize (obj);
-}
-
-static void
-gst_gnome_vfs_sink_init (GstGnomeVFSSink * sink, GstGnomeVFSSinkClass * klass)
-{
- gst_pad_set_query_function (GST_BASE_SINK_PAD (sink),
- GST_DEBUG_FUNCPTR (gst_gnome_vfs_sink_query));
-
- sink->uri = NULL;
- sink->uri_name = NULL;
- sink->handle = NULL;
- sink->own_handle = FALSE;
- sink->current_pos = 0;
-
- GST_BASE_SINK (sink)->sync = FALSE;
-}
-
-static void
-gst_gnome_vfs_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstGnomeVFSSink *sink;
- GstState cur_state;
-
- sink = GST_GNOME_VFS_SINK (object);
-
- gst_element_get_state (GST_ELEMENT (sink), &cur_state, NULL, 0);
-
- if (cur_state == GST_STATE_PLAYING || cur_state == GST_STATE_PAUSED) {
- GST_WARNING_OBJECT (sink, "cannot set property when PAUSED or PLAYING");
- return;
- }
-
- GST_OBJECT_LOCK (sink);
-
- switch (prop_id) {
- case ARG_LOCATION:{
- const gchar *new_location;
-
- if (sink->uri) {
- gnome_vfs_uri_unref (sink->uri);
- sink->uri = NULL;
- }
- if (sink->uri_name) {
- g_free (sink->uri_name);
- sink->uri_name = NULL;
- }
-
- new_location = g_value_get_string (value);
- if (new_location) {
- sink->uri_name = gst_gnome_vfs_location_to_uri_string (new_location);
- sink->uri = gnome_vfs_uri_new (sink->uri_name);
- }
- break;
- }
- case ARG_URI:{
- if (sink->uri) {
- gnome_vfs_uri_unref (sink->uri);
- sink->uri = NULL;
- }
- if (sink->uri_name) {
- g_free (sink->uri_name);
- sink->uri_name = NULL;
- }
- if (g_value_get_boxed (value)) {
- sink->uri = (GnomeVFSURI *) g_value_dup_boxed (value);
- sink->uri_name = gnome_vfs_uri_to_string (sink->uri, 0);
- }
- break;
- }
- case ARG_HANDLE:{
- if (sink->uri) {
- gnome_vfs_uri_unref (sink->uri);
- sink->uri = NULL;
- }
- if (sink->uri_name) {
- g_free (sink->uri_name);
- sink->uri_name = NULL;
- }
- sink->handle = g_value_get_boxed (value);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-
- GST_OBJECT_UNLOCK (sink);
-}
-
-static void
-gst_gnome_vfs_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstGnomeVFSSink *sink;
-
- sink = GST_GNOME_VFS_SINK (object);
-
- GST_OBJECT_LOCK (sink);
-
- switch (prop_id) {
- case ARG_LOCATION:
- g_value_set_string (value, sink->uri_name);
- break;
- case ARG_URI:
- g_value_set_boxed (value, sink->uri);
- break;
- case ARG_HANDLE:
- g_value_set_boxed (value, sink->handle);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-
- GST_OBJECT_UNLOCK (sink);
-}
-
-static gboolean
-gst_gnome_vfs_sink_open_file (GstGnomeVFSSink * sink)
-{
- GnomeVFSResult result;
-
- if (sink->uri) {
- /* open the file, all permissions, umask will apply */
- result = gnome_vfs_create_uri (&(sink->handle), sink->uri,
- GNOME_VFS_OPEN_WRITE, TRUE,
- GNOME_VFS_PERM_USER_READ | GNOME_VFS_PERM_USER_WRITE |
- GNOME_VFS_PERM_GROUP_READ | GNOME_VFS_PERM_GROUP_WRITE |
- GNOME_VFS_PERM_OTHER_READ | GNOME_VFS_PERM_OTHER_WRITE);
-
- /* if the file existed and the property says to ask, then ask! */
- if (result == GNOME_VFS_ERROR_FILE_EXISTS) {
- gboolean erase_anyway = FALSE;
-
- g_signal_emit (G_OBJECT (sink),
- gst_gnome_vfs_sink_signals[SIGNAL_ERASE_ASK], 0, sink->uri,
- &erase_anyway);
- if (erase_anyway) {
- result = gnome_vfs_create_uri (&(sink->handle), sink->uri,
- GNOME_VFS_OPEN_WRITE, FALSE,
- GNOME_VFS_PERM_USER_READ | GNOME_VFS_PERM_USER_WRITE |
- GNOME_VFS_PERM_GROUP_READ | GNOME_VFS_PERM_GROUP_WRITE |
- GNOME_VFS_PERM_OTHER_READ | GNOME_VFS_PERM_OTHER_WRITE);
- }
- }
-
- GST_DEBUG_OBJECT (sink, "open: %s", gnome_vfs_result_to_string (result));
-
- if (result != GNOME_VFS_OK) {
- gchar *filename = gnome_vfs_uri_to_string (sink->uri,
- GNOME_VFS_URI_HIDE_PASSWORD);
-
- GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
- (_("Could not open vfs file \"%s\" for writing: %s."),
- filename, gnome_vfs_result_to_string (result)), GST_ERROR_SYSTEM);
- g_free (filename);
- return FALSE;
- }
- sink->own_handle = TRUE;
- } else if (!sink->handle) {
- GST_ELEMENT_ERROR (sink, RESOURCE, FAILED, (_("No filename given")),
- (NULL));
- return FALSE;
- } else {
- sink->own_handle = FALSE;
- }
-
- sink->current_pos = 0;
-
- return TRUE;
-}
-
-static void
-gst_gnome_vfs_sink_close_file (GstGnomeVFSSink * sink)
-{
- GnomeVFSResult result;
-
- if (sink->own_handle) {
- /* close the file */
- result = gnome_vfs_close (sink->handle);
-
- if (result != GNOME_VFS_OK) {
- gchar *filename = gnome_vfs_uri_to_string (sink->uri,
- GNOME_VFS_URI_HIDE_PASSWORD);
-
- GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
- (_("Could not close vfs file \"%s\"."), filename), GST_ERROR_SYSTEM);
- g_free (filename);
- }
-
- sink->own_handle = FALSE;
- sink->handle = NULL;
- }
-}
-
-static gboolean
-gst_gnome_vfs_sink_start (GstBaseSink * basesink)
-{
- gboolean ret;
-
- ret = gst_gnome_vfs_sink_open_file (GST_GNOME_VFS_SINK (basesink));
-
- return ret;
-}
-
-static gboolean
-gst_gnome_vfs_sink_stop (GstBaseSink * basesink)
-{
- GST_DEBUG_OBJECT (basesink, "closing ...");
- gst_gnome_vfs_sink_close_file (GST_GNOME_VFS_SINK (basesink));
- return TRUE;
-}
-
-static gboolean
-gst_gnome_vfs_sink_handle_event (GstBaseSink * basesink, GstEvent * event)
-{
- GstGnomeVFSSink *sink;
- gboolean ret = TRUE;
-
- sink = GST_GNOME_VFS_SINK (basesink);
-
- GST_DEBUG_OBJECT (sink, "processing %s event", GST_EVENT_TYPE_NAME (event));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:{
- GnomeVFSResult res;
- GstFormat format;
- gint64 offset;
-
- gst_event_parse_new_segment (event, NULL, NULL, &format, &offset,
- NULL, NULL);
-
- if (format != GST_FORMAT_BYTES) {
- GST_WARNING_OBJECT (sink, "ignored NEWSEGMENT event in %s format",
- gst_format_get_name (format));
- break;
- }
-
- GST_LOG_OBJECT (sink, "seeking to offset %" G_GINT64_FORMAT, offset);
- res = gnome_vfs_seek (sink->handle, GNOME_VFS_SEEK_START, offset);
-
- if (res != GNOME_VFS_OK) {
- GST_ERROR_OBJECT (sink, "Failed to seek to offset %"
- G_GINT64_FORMAT ": %s", offset, gnome_vfs_result_to_string (res));
- ret = FALSE;
- } else {
- sink->current_pos = offset;
- }
-
- break;
- }
-
- case GST_EVENT_FLUSH_START:
- case GST_EVENT_EOS:{
- /* No need to flush with GnomeVfs */
- break;
- }
- default:
- break;
- }
-
- return ret;
-}
-
-static gboolean
-gst_gnome_vfs_sink_query (GstPad * pad, GstQuery * query)
-{
- GstGnomeVFSSink *sink;
- GstFormat format;
-
- sink = GST_GNOME_VFS_SINK (GST_PAD_PARENT (pad));
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_POSITION:
- gst_query_parse_position (query, &format, NULL);
- switch (format) {
- case GST_FORMAT_DEFAULT:
- case GST_FORMAT_BYTES:
- gst_query_set_position (query, GST_FORMAT_BYTES, sink->current_pos);
- return TRUE;
- default:
- return FALSE;
- }
-
- case GST_QUERY_FORMATS:
- gst_query_set_formats (query, 2, GST_FORMAT_DEFAULT, GST_FORMAT_BYTES);
- return TRUE;
-
- case GST_QUERY_URI:
- gst_query_set_uri (query, sink->uri_name);
- return TRUE;
-
- default:
- return gst_pad_query_default (pad, query);
- }
-}
-
-static GstFlowReturn
-gst_gnome_vfs_sink_render (GstBaseSink * basesink, GstBuffer * buf)
-{
- GnomeVFSFileSize written, cur_pos;
- GstGnomeVFSSink *sink;
- GnomeVFSResult result;
- GstFlowReturn ret;
-
- sink = GST_GNOME_VFS_SINK (basesink);
-
- if (gnome_vfs_tell (sink->handle, &cur_pos) == GNOME_VFS_OK) {
- /* bring up to date with current position for proper reporting */
- sink->current_pos = cur_pos;
- }
-
- result = gnome_vfs_write (sink->handle, GST_BUFFER_DATA (buf),
- GST_BUFFER_SIZE (buf), &written);
-
- switch (result) {
- case GNOME_VFS_OK:{
- GST_DEBUG_OBJECT (sink, "wrote %" G_GINT64_FORMAT " bytes at %"
- G_GINT64_FORMAT, (gint64) written, (gint64) cur_pos);
-
- if (written < GST_BUFFER_SIZE (buf)) {
- /* FIXME: what to do here? (tpm) */
- g_warning ("%s: %d bytes should be written, only %"
- G_GUINT64_FORMAT " bytes written", G_STRLOC,
- GST_BUFFER_SIZE (buf), written);
- }
-
- sink->current_pos += GST_BUFFER_SIZE (buf);
- ret = GST_FLOW_OK;
- break;
- }
- case GNOME_VFS_ERROR_NO_SPACE:{
- /* TODO: emit signal/send msg on out-of-diskspace and
- * handle this gracefully (see open bug) (tpm) */
- GST_ELEMENT_ERROR (sink, RESOURCE, NO_SPACE_LEFT, (NULL),
- ("bufsize=%u, written=%u", GST_BUFFER_SIZE (buf), (guint) written));
- ret = GST_FLOW_ERROR;
- break;
- }
- default:{
- gchar *filename = gnome_vfs_uri_to_string (sink->uri,
- GNOME_VFS_URI_HIDE_PASSWORD);
-
- GST_ELEMENT_ERROR (sink, RESOURCE, WRITE,
- (_("Error while writing to file \"%s\"."), filename),
- ("%s, bufsize=%u, written=%u", gnome_vfs_result_to_string (result),
- GST_BUFFER_SIZE (buf), (guint) written));
-
- g_free (filename);
- ret = GST_FLOW_ERROR;
- break;
- }
- }
-
- return GST_FLOW_OK;
-}
-
-/*** GSTURIHANDLER INTERFACE *************************************************/
-
-static GstURIType
-gst_gnome_vfs_sink_uri_get_type (void)
-{
- return GST_URI_SINK;
-}
-
-static gchar **
-gst_gnome_vfs_sink_uri_get_protocols (void)
-{
- return gst_gnomevfs_get_supported_uris ();
-}
-
-static const gchar *
-gst_gnome_vfs_sink_uri_get_uri (GstURIHandler * handler)
-{
- GstGnomeVFSSink *sink = GST_GNOME_VFS_SINK (handler);
-
- return sink->uri_name;
-}
-
-static gboolean
-gst_gnome_vfs_sink_uri_set_uri (GstURIHandler * handler, const gchar * uri)
-{
- GstGnomeVFSSink *sink = GST_GNOME_VFS_SINK (handler);
- GstState cur_state;
-
- gst_element_get_state (GST_ELEMENT (sink), &cur_state, NULL, 0);
-
- if (cur_state == GST_STATE_PLAYING || cur_state == GST_STATE_PAUSED) {
- GST_WARNING_OBJECT (sink, "cannot set uri when PAUSED or PLAYING");
- return FALSE;
- }
-
- g_object_set (sink, "location", uri, NULL);
-
- return TRUE;
-}
-
-static void
-gst_gnome_vfs_sink_uri_handler_init (gpointer g_iface, gpointer iface_data)
-{
- GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
-
- iface->get_type = gst_gnome_vfs_sink_uri_get_type;
- iface->get_protocols = gst_gnome_vfs_sink_uri_get_protocols;
- iface->get_uri = gst_gnome_vfs_sink_uri_get_uri;
- iface->set_uri = gst_gnome_vfs_sink_uri_set_uri;
-}
diff --git a/ext/gnomevfs/gstgnomevfssink.h b/ext/gnomevfs/gstgnomevfssink.h
deleted file mode 100644
index 409add96..00000000
--- a/ext/gnomevfs/gstgnomevfssink.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2000 Wim Taymans <wtay@chello.be>
- * 2001 Bastien Nocera <hadess@hadess.net>
- * 2003 Colin Walters <walters@verbum.org>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_GNOME_VFS_SINK_H__
-#define __GST_GNOME_VFS_SINK_H__
-
-#include "gstgnomevfs.h"
-#include "gstgnomevfsuri.h"
-#include <gst/base/gstbasesink.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GNOME_VFS_SINK \
- (gst_gnome_vfs_sink_get_type())
-#define GST_GNOME_VFS_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GNOME_VFS_SINK,GstGnomeVFSSink))
-#define GST_GNOME_VFS_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GNOME_VFS_SINK,GstGnomeVFSSinkClass))
-#define GST_IS_GNOME_VFS_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GNOME_VFS_SINK))
-#define GST_IS_GNOME_VFS_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GNOME_VFS_SINK))
-
-typedef struct _GstGnomeVFSSink GstGnomeVFSSink;
-typedef struct _GstGnomeVFSSinkClass GstGnomeVFSSinkClass;
-
-/**
- * GstGnomeVFSSink:
- *
- * Opaque data structure.
- */
-struct _GstGnomeVFSSink
-{
- GstBaseSink basesink;
-
- /*< private >*/
-
- /* uri */
- GnomeVFSURI *uri;
- gchar *uri_name;
-
- /* handle */
- GnomeVFSHandle *handle;
-
- /* whether we opened the handle ourselves */
- gboolean own_handle;
-
- guint64 current_pos;
-};
-
-struct _GstGnomeVFSSinkClass
-{
- GstBaseSinkClass basesink_class;
-
- /* signals */
- gboolean (*erase_ask) (GstElement * element, GnomeVFSURI * uri);
-};
-
-GType gst_gnome_vfs_sink_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_GNOME_VFS_SINK_H__ */
-
diff --git a/ext/gnomevfs/gstgnomevfssrc.c b/ext/gnomevfs/gstgnomevfssrc.c
deleted file mode 100644
index cf26b30e..00000000
--- a/ext/gnomevfs/gstgnomevfssrc.c
+++ /dev/null
@@ -1,897 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2000 Wim Taymans <wtay@chello.be>
- * 2001 Bastien Nocera <hadess@hadess.net>
- * 2002 Kristian Rietveld <kris@gtk.org>
- * 2002,2003 Colin Walters <walters@gnu.org>
- *
- * gnomevfssrc.c:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-/**
- * SECTION:element-gnomevfssrc
- * @see_also: #GstFileSrc, #GstGnomeVFSSink
- *
- * This plugin reads data from a local or remote location specified
- * by an URI. This location can be specified using any protocol supported by
- * the GnomeVFS library. Common protocols are 'file', 'http', 'ftp', or 'smb'.
- *
- * In case the #GstGnomeVFSSrc:iradio-mode property is set and the
- * location is a http resource, gnomevfssrc will send special icecast http
- * headers to the server to request additional icecast metainformation. If
- * the server is not an icecast server, it will display the same behaviour
- * as if the #GstGnomeVFSSrc:iradio-mode property was not set. However,
- * if the server is in fact an icecast server, gnomevfssrc will output
- * data with a media type of application/x-icy, in which case you will
- * need to use the #GstICYDemux element as follow-up element to extract
- * the icecast meta data and to determine the underlying media type.
- *
- * <refsect2>
- * <title>Example launch lines</title>
- * |[
- * gst-launch -v gnomevfssrc location=file:///home/joe/foo.xyz ! fakesink
- * ]| The above pipeline will simply read a local file and do nothing with the
- * data read. Instead of gnomevfssrc, we could just as well have used the
- * filesrc element here.
- * |[
- * gst-launch -v gnomevfssrc location=smb://othercomputer/foo.xyz ! filesink location=/home/joe/foo.xyz
- * ]| The above pipeline will copy a file from a remote host to the local file
- * system using the Samba protocol.
- * |[
- * gst-launch -v gnomevfssrc location=http://music.foobar.com/demo.mp3 ! mad ! audioconvert ! audioresample ! alsasink
- * ]| The above pipeline will read and decode and play an mp3 file from a
- * web server using the http protocol.
- * </refsect2>
- */
-
-
-#define BROKEN_SIG 1
-/*#undef BROKEN_SIG */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gst/gst-i18n-plugin.h"
-
-#include "gstgnomevfssrc.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <errno.h>
-#include <string.h>
-
-#include <gst/gst.h>
-#include <gst/tag/tag.h>
-
-/* gnome-vfs.h doesn't include the following header, which we need: */
-#include <libgnomevfs/gnome-vfs-standard-callbacks.h>
-
-GST_DEBUG_CATEGORY_STATIC (gnomevfssrc_debug);
-#define GST_CAT_DEFAULT gnomevfssrc_debug
-
-static const GstElementDetails gst_gnome_vfs_src_details =
-GST_ELEMENT_DETAILS ("GnomeVFS Source",
- "Source/File",
- "Read from any GnomeVFS-supported file",
- "Bastien Nocera <hadess@hadess.net>\n"
- "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
-
-static GStaticMutex count_lock = G_STATIC_MUTEX_INIT;
-static gint ref_count = 0;
-static gboolean vfs_owner = FALSE;
-
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-enum
-{
- ARG_0,
- ARG_HANDLE,
- ARG_LOCATION,
- ARG_IRADIO_MODE,
- ARG_IRADIO_NAME,
- ARG_IRADIO_GENRE,
- ARG_IRADIO_URL,
- ARG_IRADIO_TITLE
-};
-
-static void gst_gnome_vfs_src_base_init (gpointer g_class);
-static void gst_gnome_vfs_src_class_init (GstGnomeVFSSrcClass * klass);
-static void gst_gnome_vfs_src_init (GstGnomeVFSSrc * gnomevfssrc);
-static void gst_gnome_vfs_src_finalize (GObject * object);
-static void gst_gnome_vfs_src_uri_handler_init (gpointer g_iface,
- gpointer iface_data);
-
-static void gst_gnome_vfs_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_gnome_vfs_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static gboolean gst_gnome_vfs_src_stop (GstBaseSrc * src);
-static gboolean gst_gnome_vfs_src_start (GstBaseSrc * src);
-static gboolean gst_gnome_vfs_src_is_seekable (GstBaseSrc * src);
-static gboolean gst_gnome_vfs_src_check_get_range (GstBaseSrc * src);
-static gboolean gst_gnome_vfs_src_get_size (GstBaseSrc * src, guint64 * size);
-static GstFlowReturn gst_gnome_vfs_src_create (GstBaseSrc * basesrc,
- guint64 offset, guint size, GstBuffer ** buffer);
-static gboolean gst_gnome_vfs_src_query (GstBaseSrc * src, GstQuery * query);
-
-static GstElementClass *parent_class = NULL;
-
-GType
-gst_gnome_vfs_src_get_type (void)
-{
- static GType gnomevfssrc_type = 0;
-
- if (!gnomevfssrc_type) {
- static const GTypeInfo gnomevfssrc_info = {
- sizeof (GstGnomeVFSSrcClass),
- gst_gnome_vfs_src_base_init,
- NULL,
- (GClassInitFunc) gst_gnome_vfs_src_class_init,
- NULL,
- NULL,
- sizeof (GstGnomeVFSSrc),
- 0,
- (GInstanceInitFunc) gst_gnome_vfs_src_init,
- };
- static const GInterfaceInfo urihandler_info = {
- gst_gnome_vfs_src_uri_handler_init,
- NULL,
- NULL
- };
-
- gnomevfssrc_type =
- g_type_register_static (GST_TYPE_BASE_SRC,
- "GstGnomeVFSSrc", &gnomevfssrc_info, 0);
- g_type_add_interface_static (gnomevfssrc_type, GST_TYPE_URI_HANDLER,
- &urihandler_info);
- }
- return gnomevfssrc_type;
-}
-
-static void
-gst_gnome_vfs_src_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&srctemplate));
- gst_element_class_set_details (element_class, &gst_gnome_vfs_src_details);
-
- GST_DEBUG_CATEGORY_INIT (gnomevfssrc_debug, "gnomevfssrc", 0,
- "Gnome-VFS Source");
-}
-
-static void
-gst_gnome_vfs_src_class_init (GstGnomeVFSSrcClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseSrcClass *gstbasesrc_class;
-
- gobject_class = G_OBJECT_CLASS (klass);
- gstbasesrc_class = GST_BASE_SRC_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->finalize = gst_gnome_vfs_src_finalize;
- gobject_class->set_property = gst_gnome_vfs_src_set_property;
- gobject_class->get_property = gst_gnome_vfs_src_get_property;
-
- /* properties */
- gst_element_class_install_std_props (GST_ELEMENT_CLASS (klass),
- "location", ARG_LOCATION, G_PARAM_READWRITE, NULL);
- g_object_class_install_property (gobject_class,
- ARG_HANDLE,
- g_param_spec_boxed ("handle",
- "GnomeVFSHandle", "Handle for GnomeVFS",
- GST_TYPE_GNOME_VFS_HANDLE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /* icecast stuff */
- g_object_class_install_property (gobject_class,
- ARG_IRADIO_MODE,
- g_param_spec_boolean ("iradio-mode",
- "iradio-mode",
- "Enable internet radio mode (extraction of shoutcast/icecast metadata)",
- FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class,
- ARG_IRADIO_NAME,
- g_param_spec_string ("iradio-name",
- "iradio-name", "Name of the stream", NULL,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_IRADIO_GENRE,
- g_param_spec_string ("iradio-genre", "iradio-genre",
- "Genre of the stream", NULL,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_IRADIO_URL,
- g_param_spec_string ("iradio-url", "iradio-url",
- "Homepage URL for radio stream", NULL,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_IRADIO_TITLE,
- g_param_spec_string ("iradio-title", "iradio-title",
- "Name of currently playing song", NULL,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_start);
- gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_stop);
- gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_get_size);
- gstbasesrc_class->is_seekable =
- GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_is_seekable);
- gstbasesrc_class->check_get_range =
- GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_check_get_range);
- gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_create);
- gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_query);
-}
-
-static void
-gst_gnome_vfs_src_init (GstGnomeVFSSrc * gnomevfssrc)
-{
- gnomevfssrc->uri = NULL;
- gnomevfssrc->uri_name = NULL;
- gnomevfssrc->handle = NULL;
- gnomevfssrc->curoffset = 0;
- gnomevfssrc->seekable = FALSE;
-
- gnomevfssrc->iradio_mode = FALSE;
- gnomevfssrc->http_callbacks_pushed = FALSE;
- gnomevfssrc->iradio_name = NULL;
- gnomevfssrc->iradio_genre = NULL;
- gnomevfssrc->iradio_url = NULL;
- gnomevfssrc->iradio_title = NULL;
-
- g_static_mutex_lock (&count_lock);
- if (ref_count == 0) {
- /* gnome vfs engine init */
- if (gnome_vfs_initialized () == FALSE) {
- gnome_vfs_init ();
- vfs_owner = TRUE;
- }
- }
- ref_count++;
- g_static_mutex_unlock (&count_lock);
-}
-
-static void
-gst_gnome_vfs_src_finalize (GObject * object)
-{
- GstGnomeVFSSrc *src = GST_GNOME_VFS_SRC (object);
-
- g_static_mutex_lock (&count_lock);
- ref_count--;
- if (ref_count == 0 && vfs_owner) {
- if (gnome_vfs_initialized () == TRUE) {
- gnome_vfs_shutdown ();
- }
- }
- g_static_mutex_unlock (&count_lock);
-
- if (src->uri) {
- gnome_vfs_uri_unref (src->uri);
- src->uri = NULL;
- }
-
- g_free (src->uri_name);
- src->uri_name = NULL;
-
- g_free (src->iradio_name);
- src->iradio_name = NULL;
-
- g_free (src->iradio_genre);
- src->iradio_genre = NULL;
-
- g_free (src->iradio_url);
- src->iradio_url = NULL;
-
- g_free (src->iradio_title);
- src->iradio_title = NULL;
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/*
- * URI interface support.
- */
-
-static GstURIType
-gst_gnome_vfs_src_uri_get_type (void)
-{
- return GST_URI_SRC;
-}
-
-static gchar **
-gst_gnome_vfs_src_uri_get_protocols (void)
-{
- return gst_gnomevfs_get_supported_uris ();
-}
-
-static const gchar *
-gst_gnome_vfs_src_uri_get_uri (GstURIHandler * handler)
-{
- GstGnomeVFSSrc *src = GST_GNOME_VFS_SRC (handler);
-
- return src->uri_name;
-}
-
-static gboolean
-gst_gnome_vfs_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
-{
- GstGnomeVFSSrc *src = GST_GNOME_VFS_SRC (handler);
-
- if (GST_STATE (src) == GST_STATE_PLAYING ||
- GST_STATE (src) == GST_STATE_PAUSED)
- return FALSE;
-
- g_object_set (G_OBJECT (src), "location", uri, NULL);
-
- return TRUE;
-}
-
-static void
-gst_gnome_vfs_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
-{
- GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
-
- iface->get_type = gst_gnome_vfs_src_uri_get_type;
- iface->get_protocols = gst_gnome_vfs_src_uri_get_protocols;
- iface->get_uri = gst_gnome_vfs_src_uri_get_uri;
- iface->set_uri = gst_gnome_vfs_src_uri_set_uri;
-}
-
-static void
-gst_gnome_vfs_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstGnomeVFSSrc *src;
-
- src = GST_GNOME_VFS_SRC (object);
-
- switch (prop_id) {
- case ARG_LOCATION:{
- const gchar *new_location;
-
- /* the element must be stopped or paused in order to do this */
- if (GST_STATE (src) == GST_STATE_PLAYING ||
- GST_STATE (src) == GST_STATE_PAUSED)
- break;
-
- if (src->uri) {
- gnome_vfs_uri_unref (src->uri);
- src->uri = NULL;
- }
- if (src->uri_name) {
- g_free (src->uri_name);
- src->uri_name = NULL;
- }
-
- new_location = g_value_get_string (value);
- if (new_location) {
- src->uri_name = gst_gnome_vfs_location_to_uri_string (new_location);
- src->uri = gnome_vfs_uri_new (src->uri_name);
- }
- break;
- }
- case ARG_HANDLE:
- if (GST_STATE (src) == GST_STATE_NULL ||
- GST_STATE (src) == GST_STATE_READY) {
- if (src->uri) {
- gnome_vfs_uri_unref (src->uri);
- src->uri = NULL;
- }
- if (src->uri_name) {
- g_free (src->uri_name);
- src->uri_name = NULL;
- }
- src->handle = g_value_get_boxed (value);
- }
- break;
- case ARG_IRADIO_MODE:
- src->iradio_mode = g_value_get_boolean (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_gnome_vfs_src_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstGnomeVFSSrc *src;
-
- src = GST_GNOME_VFS_SRC (object);
-
- switch (prop_id) {
- case ARG_LOCATION:
- g_value_set_string (value, src->uri_name);
- break;
- case ARG_HANDLE:
- g_value_set_boxed (value, src->handle);
- break;
- case ARG_IRADIO_MODE:
- g_value_set_boolean (value, src->iradio_mode);
- break;
- case ARG_IRADIO_NAME:
- g_value_set_string (value, src->iradio_name);
- break;
- case ARG_IRADIO_GENRE:
- g_value_set_string (value, src->iradio_genre);
- break;
- case ARG_IRADIO_URL:
- g_value_set_string (value, src->iradio_url);
- break;
- case ARG_IRADIO_TITLE:
- g_value_set_string (value, src->iradio_title);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static char *
-gst_gnome_vfs_src_unicodify (const char *str)
-{
- const gchar *env_vars[] = { "GST_ICY_TAG_ENCODING",
- "GST_TAG_ENCODING", NULL
- };
-
- return gst_tag_freeform_string_to_utf8 (str, -1, env_vars);
-}
-
-static void
-gst_gnome_vfs_src_send_additional_headers_callback (gconstpointer in,
- gsize in_size, gpointer out, gsize out_size, gpointer callback_data)
-{
- GstGnomeVFSSrc *src = GST_GNOME_VFS_SRC (callback_data);
- GnomeVFSModuleCallbackAdditionalHeadersOut *out_args =
- (GnomeVFSModuleCallbackAdditionalHeadersOut *) out;
-
- if (!src->iradio_mode)
- return;
- GST_DEBUG_OBJECT (src, "sending headers\n");
-
- out_args->headers = g_list_append (out_args->headers,
- g_strdup ("icy-metadata:1\r\n"));
-}
-
-static void
-gst_gnome_vfs_src_received_headers_callback (gconstpointer in,
- gsize in_size, gpointer out, gsize out_size, gpointer callback_data)
-{
- GList *i;
- gint icy_metaint;
- GstGnomeVFSSrc *src = GST_GNOME_VFS_SRC (callback_data);
- GnomeVFSModuleCallbackReceivedHeadersIn *in_args =
- (GnomeVFSModuleCallbackReceivedHeadersIn *) in;
-
- /* This is only used for internet radio stuff right now */
- if (!src->iradio_mode)
- return;
-
- GST_DEBUG_OBJECT (src, "receiving internet radio metadata\n");
-
- /* FIXME: Could we use "Accept-Ranges: bytes"
- * http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.5
- * to enable pull-mode?
- */
-
- for (i = in_args->headers; i; i = i->next) {
- char *data = (char *) i->data;
- char *key = data;
- char *value = strchr (data, ':');
-
- if (!value)
- continue;
-
- value++;
- g_strstrip (value);
- if (!strlen (value))
- continue;
-
- GST_LOG_OBJECT (src, "data %s", data);
-
- /* Icecast stuff */
- if (strncmp (data, "icy-metaint:", 12) == 0) { /* ugh */
- if (sscanf (data + 12, "%d", &icy_metaint) == 1) {
- if (icy_metaint > 0) {
- GstCaps *icy_caps;
-
- icy_caps = gst_caps_new_simple ("application/x-icy",
- "metadata-interval", G_TYPE_INT, icy_metaint, NULL);
- gst_pad_set_caps (GST_BASE_SRC_PAD (src), icy_caps);
- gst_caps_unref (icy_caps);
- }
- }
- continue;
- }
-
- if (!strncmp (data, "icy-", 4))
- key = data + 4;
- else
- continue;
-
- GST_DEBUG_OBJECT (src, "key: %s", key);
- if (!strncmp (key, "name", 4)) {
- g_free (src->iradio_name);
- src->iradio_name = gst_gnome_vfs_src_unicodify (value);
- if (src->iradio_name)
- g_object_notify (G_OBJECT (src), "iradio-name");
- } else if (!strncmp (key, "genre", 5)) {
- g_free (src->iradio_genre);
- src->iradio_genre = gst_gnome_vfs_src_unicodify (value);
- if (src->iradio_genre)
- g_object_notify (G_OBJECT (src), "iradio-genre");
- } else if (!strncmp (key, "url", 3)) {
- g_free (src->iradio_url);
- src->iradio_url = gst_gnome_vfs_src_unicodify (value);
- if (src->iradio_url)
- g_object_notify (G_OBJECT (src), "iradio-url");
- }
- }
-}
-
-static void
-gst_gnome_vfs_src_push_callbacks (GstGnomeVFSSrc * src)
-{
- if (src->http_callbacks_pushed)
- return;
-
- GST_DEBUG_OBJECT (src, "pushing callbacks");
- gnome_vfs_module_callback_push
- (GNOME_VFS_MODULE_CALLBACK_HTTP_SEND_ADDITIONAL_HEADERS,
- gst_gnome_vfs_src_send_additional_headers_callback, src, NULL);
- gnome_vfs_module_callback_push
- (GNOME_VFS_MODULE_CALLBACK_HTTP_RECEIVED_HEADERS,
- gst_gnome_vfs_src_received_headers_callback, src, NULL);
-
- src->http_callbacks_pushed = TRUE;
-}
-
-static void
-gst_gnome_vfs_src_pop_callbacks (GstGnomeVFSSrc * src)
-{
- if (!src->http_callbacks_pushed)
- return;
-
- GST_DEBUG_OBJECT (src, "popping callbacks");
- gnome_vfs_module_callback_pop
- (GNOME_VFS_MODULE_CALLBACK_HTTP_SEND_ADDITIONAL_HEADERS);
- gnome_vfs_module_callback_pop
- (GNOME_VFS_MODULE_CALLBACK_HTTP_RECEIVED_HEADERS);
-
- src->http_callbacks_pushed = FALSE;
-}
-
-/*
- * Read a new buffer from src->reqoffset, takes care of events
- * and seeking and such.
- */
-static GstFlowReturn
-gst_gnome_vfs_src_create (GstBaseSrc * basesrc, guint64 offset, guint size,
- GstBuffer ** buffer)
-{
- GnomeVFSResult res;
- GstBuffer *buf;
- GnomeVFSFileSize readbytes;
- guint8 *data;
- guint todo;
- GstGnomeVFSSrc *src;
-
- src = GST_GNOME_VFS_SRC (basesrc);
-
- GST_DEBUG ("now at %" G_GINT64_FORMAT ", reading from %" G_GUINT64_FORMAT
- ", size %u", src->curoffset, offset, size);
-
- /* seek if required */
- if (G_UNLIKELY (src->curoffset != offset)) {
- GST_DEBUG ("need to seek");
- if (src->seekable) {
- GST_DEBUG ("seeking to %" G_GUINT64_FORMAT, offset);
- res = gnome_vfs_seek (src->handle, GNOME_VFS_SEEK_START, offset);
- if (res != GNOME_VFS_OK)
- goto seek_failed;
- src->curoffset = offset;
- } else {
- goto cannot_seek;
- }
- }
-
- buf = gst_buffer_try_new_and_alloc (size);
- if (G_UNLIKELY (buf == NULL && size == 0)) {
- GST_ERROR_OBJECT (src, "Failed to allocate %u bytes", size);
- return GST_FLOW_ERROR;
- }
-
- data = GST_BUFFER_DATA (buf);
-
- todo = size;
- while (todo > 0) {
- /* this can return less that we ask for */
- res = gnome_vfs_read (src->handle, data, todo, &readbytes);
-
- if (G_UNLIKELY (res == GNOME_VFS_ERROR_EOF || (res == GNOME_VFS_OK
- && readbytes == 0)))
- goto eos;
-
- if (G_UNLIKELY (res != GNOME_VFS_OK))
- goto read_failed;
-
- if (readbytes < todo) {
- data = &data[readbytes];
- todo -= readbytes;
- } else {
- todo = 0;
- }
- GST_LOG (" got size %" G_GUINT64_FORMAT, readbytes);
- }
- GST_BUFFER_OFFSET (buf) = src->curoffset;
- src->curoffset += size;
-
- /* we're done, return the buffer */
- *buffer = buf;
-
- return GST_FLOW_OK;
-
-seek_failed:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, SEEK, (NULL),
- ("Failed to seek to requested position %" G_GINT64_FORMAT ": %s",
- offset, gnome_vfs_result_to_string (res)));
- return GST_FLOW_ERROR;
- }
-cannot_seek:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, SEEK, (NULL),
- ("Requested seek from %" G_GINT64_FORMAT " to %" G_GINT64_FORMAT
- " on non-seekable stream", src->curoffset, offset));
- return GST_FLOW_ERROR;
- }
-read_failed:
- {
- gst_buffer_unref (buf);
- GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
- ("Failed to read data: %s", gnome_vfs_result_to_string (res)));
- return GST_FLOW_ERROR;
- }
-eos:
- {
- gst_buffer_unref (buf);
- GST_DEBUG_OBJECT (src, "Reading data gave EOS");
- return GST_FLOW_UNEXPECTED;
- }
-}
-
-static gboolean
-gst_gnome_vfs_src_query (GstBaseSrc * basesrc, GstQuery * query)
-{
- gboolean ret = FALSE;
- GstGnomeVFSSrc *src = GST_GNOME_VFS_SRC (basesrc);
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_URI:
- gst_query_set_uri (query, src->uri_name);
- ret = TRUE;
- break;
- default:
- ret = FALSE;
- break;
- }
-
- if (!ret)
- ret = GST_BASE_SRC_CLASS (parent_class)->query (basesrc, query);
-
- return ret;
-}
-
-static gboolean
-gst_gnome_vfs_src_is_seekable (GstBaseSrc * basesrc)
-{
- GstGnomeVFSSrc *src;
-
- src = GST_GNOME_VFS_SRC (basesrc);
-
- return src->seekable;
-}
-
-static gboolean
-gst_gnome_vfs_src_check_get_range (GstBaseSrc * basesrc)
-{
- GstGnomeVFSSrc *src;
- const gchar *protocol;
-
- src = GST_GNOME_VFS_SRC (basesrc);
-
- if (src->uri == NULL) {
- GST_WARNING_OBJECT (src, "no URI set yet");
- return FALSE;
- }
-
- if (gnome_vfs_uri_is_local (src->uri)) {
- GST_LOG_OBJECT (src, "local URI (%s), assuming random access is possible",
- GST_STR_NULL (src->uri_name));
- return TRUE;
- }
-
- /* blacklist certain protocols we know won't work getrange-based */
- protocol = gnome_vfs_uri_get_scheme (src->uri);
- if (protocol == NULL)
- goto undecided;
-
- if (strcmp (protocol, "http") == 0 || strcmp (protocol, "https") == 0) {
- GST_LOG_OBJECT (src, "blacklisted protocol '%s', no random access possible"
- " (URI=%s)", protocol, GST_STR_NULL (src->uri_name));
- return FALSE;
- }
-
- /* fall through to undecided */
-
-undecided:
- {
- /* don't know what to do, let the basesrc class decide for us */
- GST_LOG_OBJECT (src, "undecided about URI '%s', let base class handle it",
- GST_STR_NULL (src->uri_name));
-
- if (GST_BASE_SRC_CLASS (parent_class)->check_get_range)
- return GST_BASE_SRC_CLASS (parent_class)->check_get_range (basesrc);
-
- return FALSE;
- }
-}
-
-static gboolean
-gst_gnome_vfs_src_get_size (GstBaseSrc * basesrc, guint64 * size)
-{
- GstGnomeVFSSrc *src;
- GnomeVFSFileInfo *info;
- GnomeVFSFileInfoOptions options;
- GnomeVFSResult res;
-
- src = GST_GNOME_VFS_SRC (basesrc);
-
- *size = -1;
- info = gnome_vfs_file_info_new ();
- options = GNOME_VFS_FILE_INFO_DEFAULT | GNOME_VFS_FILE_INFO_FOLLOW_LINKS;
- res = gnome_vfs_get_file_info_from_handle (src->handle, info, options);
- if (res == GNOME_VFS_OK) {
- if ((info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) != 0) {
- *size = info->size;
- GST_DEBUG_OBJECT (src, "from handle: %" G_GUINT64_FORMAT " bytes", *size);
- } else if (src->own_handle && gnome_vfs_uri_is_local (src->uri)) {
- GST_DEBUG_OBJECT (src,
- "file size not known, file local, trying fallback");
- res = gnome_vfs_get_file_info_uri (src->uri, info, options);
- if (res == GNOME_VFS_OK &&
- (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) != 0) {
- *size = info->size;
- GST_DEBUG_OBJECT (src, "from uri: %" G_GUINT64_FORMAT " bytes", *size);
- }
- }
- } else {
- GST_WARNING_OBJECT (src, "getting info failed: %s",
- gnome_vfs_result_to_string (res));
- }
- gnome_vfs_file_info_unref (info);
-
- if (*size == (GnomeVFSFileSize) - 1)
- return FALSE;
-
- GST_DEBUG_OBJECT (src, "return size %" G_GUINT64_FORMAT, *size);
-
- return TRUE;
-}
-
-/* open the file, do stuff necessary to go to PAUSED state */
-static gboolean
-gst_gnome_vfs_src_start (GstBaseSrc * basesrc)
-{
- GnomeVFSResult res;
- GstGnomeVFSSrc *src;
-
- src = GST_GNOME_VFS_SRC (basesrc);
-
- gst_gnome_vfs_src_push_callbacks (src);
-
- if (src->uri != NULL) {
- GnomeVFSOpenMode mode = GNOME_VFS_OPEN_READ;
-
- /* this can block... */
- res = gnome_vfs_open_uri (&src->handle, src->uri, mode);
- if (res != GNOME_VFS_OK)
- goto open_failed;
- src->own_handle = TRUE;
- } else if (!src->handle) {
- goto no_filename;
- } else {
- src->own_handle = FALSE;
- }
-
- if (gnome_vfs_seek (src->handle, GNOME_VFS_SEEK_CURRENT, 0) == GNOME_VFS_OK) {
- src->seekable = TRUE;
- } else {
- src->seekable = FALSE;
- }
-
- return TRUE;
-
- /* ERRORS */
-open_failed:
- {
- gchar *filename = gnome_vfs_uri_to_string (src->uri,
- GNOME_VFS_URI_HIDE_PASSWORD);
-
- gst_gnome_vfs_src_pop_callbacks (src);
-
- if (res == GNOME_VFS_ERROR_NOT_FOUND ||
- res == GNOME_VFS_ERROR_HOST_NOT_FOUND ||
- res == GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE) {
- GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),
- ("Could not open vfs file \"%s\" for reading: %s (%d)",
- filename, gnome_vfs_result_to_string (res), res));
- } else {
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
- ("Could not open vfs file \"%s\" for reading: %s (%d)",
- filename, gnome_vfs_result_to_string (res), res));
- }
- g_free (filename);
- return FALSE;
- }
-no_filename:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), ("No filename given"));
- return FALSE;
- }
-}
-
-static gboolean
-gst_gnome_vfs_src_stop (GstBaseSrc * basesrc)
-{
- GstGnomeVFSSrc *src;
-
- src = GST_GNOME_VFS_SRC (basesrc);
-
- gst_gnome_vfs_src_pop_callbacks (src);
-
- if (src->own_handle) {
- GnomeVFSResult res;
-
- res = gnome_vfs_close (src->handle);
- if (res != GNOME_VFS_OK) {
- GST_ELEMENT_ERROR (src, RESOURCE, CLOSE, (NULL),
- ("Could not close vfs handle: %s", gnome_vfs_result_to_string (res)));
- }
- src->handle = NULL;
- }
- src->curoffset = 0;
-
- return TRUE;
-}
diff --git a/ext/gnomevfs/gstgnomevfssrc.h b/ext/gnomevfs/gstgnomevfssrc.h
deleted file mode 100644
index 31c1f65c..00000000
--- a/ext/gnomevfs/gstgnomevfssrc.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2000 Wim Taymans <wtay@chello.be>
- * 2001 Bastien Nocera <hadess@hadess.net>
- * 2002 Kristian Rietveld <kris@gtk.org>
- * 2002,2003 Colin Walters <walters@gnu.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_GNOME_VFS_SRC_H__
-#define __GST_GNOME_VFS_SRC_H__
-
-#include <gst/base/gstbasesrc.h>
-
-#include "gstgnomevfs.h"
-#include "gstgnomevfsuri.h"
-#include <libgnomevfs/gnome-vfs.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GNOME_VFS_SRC \
- (gst_gnome_vfs_src_get_type())
-#define GST_GNOME_VFS_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GNOME_VFS_SRC,GstGnomeVFSSrc))
-#define GST_GNOME_VFS_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GNOME_VFS_SRC,GstGnomeVFSSrcClass))
-#define GST_IS_GNOME_VFS_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GNOME_VFS_SRC))
-#define GST_IS_GNOME_VFS_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GNOME_VFS_SRC))
-
-typedef struct _GstGnomeVFSSrc GstGnomeVFSSrc;
-typedef struct _GstGnomeVFSSrcClass GstGnomeVFSSrcClass;
-
-/**
- * GstGnomeVFSSrc:
- *
- * Opaque data structure.
- */
-struct _GstGnomeVFSSrc
-{
- GstBaseSrc basesrc;
-
- /* uri, file, ... */
- GnomeVFSURI *uri;
- gchar *uri_name;
- GnomeVFSHandle *handle;
- gboolean own_handle;
- GnomeVFSFileOffset curoffset; /* current offset in file */
- gboolean seekable;
-
- /* shoutcast/icecast metadata extraction handling */
- gboolean iradio_mode;
- gboolean http_callbacks_pushed;
-
- gchar *iradio_name;
- gchar *iradio_genre;
- gchar *iradio_url;
- gchar *iradio_title;
-};
-
-struct _GstGnomeVFSSrcClass
-{
- GstBaseSrcClass basesrc_class;
-};
-
-GType gst_gnome_vfs_src_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_GNOME_VFS_SRC_H__ */
-
-
diff --git a/ext/gnomevfs/gstgnomevfsuri.c b/ext/gnomevfs/gstgnomevfsuri.c
deleted file mode 100644
index e811c31b..00000000
--- a/ext/gnomevfs/gstgnomevfsuri.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2000 Wim Taymans <wtay@chello.be>
- * 2001 Bastien Nocera <hadess@hadess.net>
- * 2003 Colin Walters <walters@verbum.org>
- *
- * gstgnomevfssink.c:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <libgnomevfs/gnome-vfs.h>
-#include "gstgnomevfsuri.h"
-
-#include <gst/gst.h>
-
-/* FIXME: move this to source and sink and remove this file:
- * e.g. sinks cannot save to http:// and src cannot read from burn://
- */
-static gpointer
-_internal_get_supported_uris (gpointer data)
-{
- /* no dav/davs in the list, because they don't appear to be reliable enough */
- const gchar *uris[] = {
- "http://localhost/bla",
- "https://localhost/bla",
- "file:///bla",
- "smb://localhost/bla",
- "ftp://localhost/bla",
- "sftp://localhost/bla",
- "nfs://localhost/bla",
- "ssh://localhost/bla",
- "burn://"
- };
- GnomeVFSURI *uri;
- gchar **result;
- gint n, r = 0;
-
- result = g_new0 (gchar *, G_N_ELEMENTS (uris) + 1);
- for (n = 0; n < G_N_ELEMENTS (uris); n++) {
- uri = gnome_vfs_uri_new (uris[n]);
- if (uri != NULL) {
- gchar *protocol = g_strdup (uris[n]);
- gint n;
-
- gnome_vfs_uri_unref (uri);
- for (n = 0; protocol[n] != '\0'; n++) {
- if (protocol[n] == ':') {
- protocol[n] = '\0';
- break;
- }
- }
-
- GST_DEBUG ("adding protocol '%s'", protocol);
- result[r++] = protocol;
- } else {
- GST_DEBUG ("could not create GnomeVfsUri from '%s'", uris[n]);
- }
- }
- result[r] = NULL;
-
- return result;
-}
-
-gchar **
-gst_gnomevfs_get_supported_uris (void)
-{
- static GOnce once = G_ONCE_INIT;
-
- g_once (&once, _internal_get_supported_uris, NULL);
- return (gchar **) once.retval;
-}
diff --git a/ext/gnomevfs/gstgnomevfsuri.h b/ext/gnomevfs/gstgnomevfsuri.h
deleted file mode 100644
index f99b1f7e..00000000
--- a/ext/gnomevfs/gstgnomevfsuri.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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_GNOME_VFS_URI_H__
-#define __GST_GNOME_VFS_URI_H__
-
-#include <libgnomevfs/gnome-vfs.h>
-
-G_BEGIN_DECLS
-
-gchar **gst_gnomevfs_get_supported_uris (void);
-
-G_END_DECLS
-
-#endif /* __GST_GNOME_VFS_URI_H__ */
diff --git a/ext/libvisual/Makefile.am b/ext/libvisual/Makefile.am
deleted file mode 100644
index d5d02136..00000000
--- a/ext/libvisual/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-plugin_LTLIBRARIES = libgstlibvisual.la
-
-libgstlibvisual_la_SOURCES = visual.c
-libgstlibvisual_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(LIBVISUAL_CFLAGS)
-libgstlibvisual_la_LIBADD = $(GST_BASE_LIBS) $(LIBVISUAL_LIBS)
-libgstlibvisual_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstlibvisual_la_LIBTOOLFLAGS = --tag=disable-static
-
diff --git a/ext/libvisual/visual.c b/ext/libvisual/visual.c
deleted file mode 100644
index 8e0ef0ea..00000000
--- a/ext/libvisual/visual.c
+++ /dev/null
@@ -1,960 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/base/gstadapter.h>
-#include <gst/video/video.h>
-#include <gst/audio/audio.h>
-#include <libvisual/libvisual.h>
-
-#define GST_TYPE_VISUAL (gst_visual_get_type())
-#define GST_IS_VISUAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VISUAL))
-#define GST_VISUAL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VISUAL,GstVisual))
-#define GST_IS_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VISUAL))
-#define GST_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VISUAL,GstVisualClass))
-#define GST_VISUAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VISUAL, GstVisualClass))
-
-typedef struct _GstVisual GstVisual;
-typedef struct _GstVisualClass GstVisualClass;
-
-GST_DEBUG_CATEGORY_STATIC (libvisual_debug);
-#define GST_CAT_DEFAULT (libvisual_debug)
-
-struct _GstVisual
-{
- GstElement element;
-
- /* pads */
- GstPad *sinkpad;
- GstPad *srcpad;
- GstSegment segment;
-
- /* libvisual stuff */
- VisAudio *audio;
- VisVideo *video;
- VisActor *actor;
-
- /* audio/video state */
- gint channels;
- gint rate; /* Input samplerate */
- gint bps;
-
- /* framerate numerator & denominator */
- gint fps_n;
- gint fps_d;
- gint width;
- gint height;
- GstClockTime duration;
- guint outsize;
-
- /* samples per frame based on caps */
- guint spf;
-
- /* state stuff */
- GstAdapter *adapter;
- guint count;
-
- /* QoS stuff *//* with LOCK */
- gdouble proportion;
- GstClockTime earliest_time;
-};
-
-struct _GstVisualClass
-{
- GstElementClass parent_class;
-
- VisPluginRef *plugin;
-};
-
-GType gst_visual_get_type (void);
-
-
-static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN "; "
-#if G_BYTE_ORDER == G_BIG_ENDIAN
- GST_VIDEO_CAPS_RGB "; "
-#else
- GST_VIDEO_CAPS_BGR "; "
-#endif
- GST_VIDEO_CAPS_RGB_16)
- );
-
-static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-int, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) TRUE, " "channels = (int) { 1, 2 }, "
-#if defined(VISUAL_API_VERSION) && VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000
- "rate = (int) { 8000, 11250, 22500, 32000, 44100, 48000, 96000 }"
-#else
- "rate = (int) [ 1000, MAX ]"
-#endif
- )
- );
-
-
-static void gst_visual_class_init (gpointer g_class, gpointer class_data);
-static void gst_visual_init (GstVisual * visual);
-static void gst_visual_dispose (GObject * object);
-
-static GstStateChangeReturn gst_visual_change_state (GstElement * element,
- GstStateChange transition);
-static GstFlowReturn gst_visual_chain (GstPad * pad, GstBuffer * buffer);
-static gboolean gst_visual_sink_event (GstPad * pad, GstEvent * event);
-static gboolean gst_visual_src_event (GstPad * pad, GstEvent * event);
-
-static gboolean gst_visual_sink_setcaps (GstPad * pad, GstCaps * caps);
-static gboolean gst_visual_src_setcaps (GstPad * pad, GstCaps * caps);
-static GstCaps *gst_visual_getcaps (GstPad * pad);
-static void libvisual_log_handler (const char *message, const char *funcname,
- void *priv);
-
-static GstElementClass *parent_class = NULL;
-
-GType
-gst_visual_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo info = {
- sizeof (GstVisualClass),
- NULL,
- NULL,
- gst_visual_class_init,
- NULL,
- NULL,
- sizeof (GstVisual),
- 0,
- (GInstanceInitFunc) gst_visual_init,
- };
-
- type = g_type_register_static (GST_TYPE_ELEMENT, "GstVisual", &info, 0);
- }
- return type;
-}
-
-static void
-libvisual_log_handler (const char *message, const char *funcname, void *priv)
-{
- GST_CAT_LEVEL_LOG (libvisual_debug, (GstDebugLevel) (priv), NULL, "%s - %s",
- funcname, message);
-}
-
-static void
-gst_visual_class_init (gpointer g_class, gpointer class_data)
-{
- GstVisualClass *klass = GST_VISUAL_CLASS (g_class);
- GstElementClass *element = GST_ELEMENT_CLASS (g_class);
- GObjectClass *object = G_OBJECT_CLASS (g_class);
-
- klass->plugin = class_data;
-
- element->change_state = gst_visual_change_state;
-
- if (class_data == NULL) {
- parent_class = g_type_class_peek_parent (g_class);
- } else {
- GstElementDetails details = {
- NULL,
- "Visualization",
- klass->plugin->info->about,
- "Benjamin Otte <otte@gnome.org>"
- };
-
- details.longname = g_strdup_printf ("libvisual %s plugin v.%s",
- klass->plugin->info->name, klass->plugin->info->version);
-
- /* FIXME: improve to only register what plugin supports? */
- gst_element_class_add_pad_template (element,
- gst_static_pad_template_get (&src_template));
- gst_element_class_add_pad_template (element,
- gst_static_pad_template_get (&sink_template));
- gst_element_class_set_details (element, &details);
- g_free (details.longname);
- }
-
- object->dispose = gst_visual_dispose;
-}
-
-static void
-gst_visual_init (GstVisual * visual)
-{
- /* create the sink and src pads */
- visual->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
- gst_pad_set_setcaps_function (visual->sinkpad, gst_visual_sink_setcaps);
- gst_pad_set_chain_function (visual->sinkpad, gst_visual_chain);
- gst_pad_set_event_function (visual->sinkpad, gst_visual_sink_event);
- gst_element_add_pad (GST_ELEMENT (visual), visual->sinkpad);
-
- visual->srcpad = gst_pad_new_from_static_template (&src_template, "src");
- gst_pad_set_setcaps_function (visual->srcpad, gst_visual_src_setcaps);
- gst_pad_set_getcaps_function (visual->srcpad, gst_visual_getcaps);
- gst_pad_set_event_function (visual->srcpad, gst_visual_src_event);
- gst_element_add_pad (GST_ELEMENT (visual), visual->srcpad);
-
- visual->adapter = gst_adapter_new ();
-}
-
-static void
-gst_visual_clear_actors (GstVisual * visual)
-{
- if (visual->actor) {
- visual_object_unref (VISUAL_OBJECT (visual->actor));
- visual->actor = NULL;
- }
- if (visual->video) {
- visual_object_unref (VISUAL_OBJECT (visual->video));
- visual->video = NULL;
- }
- if (visual->audio) {
- visual_object_unref (VISUAL_OBJECT (visual->audio));
- visual->audio = NULL;
- }
-}
-
-static void
-gst_visual_dispose (GObject * object)
-{
- GstVisual *visual = GST_VISUAL (object);
-
- if (visual->adapter) {
- g_object_unref (visual->adapter);
- visual->adapter = NULL;
- }
- gst_visual_clear_actors (visual);
-
- GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
-}
-
-static void
-gst_visual_reset (GstVisual * visual)
-{
- gst_adapter_clear (visual->adapter);
- gst_segment_init (&visual->segment, GST_FORMAT_UNDEFINED);
-
- GST_OBJECT_LOCK (visual);
- visual->proportion = 1.0;
- visual->earliest_time = -1;
- GST_OBJECT_UNLOCK (visual);
-}
-
-static GstCaps *
-gst_visual_getcaps (GstPad * pad)
-{
- GstCaps *ret;
- GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad));
- int depths;
-
- if (!visual->actor) {
- ret = gst_caps_copy (gst_pad_get_pad_template_caps (visual->srcpad));
- goto beach;
- }
-
- ret = gst_caps_new_empty ();
- depths = visual_actor_get_supported_depth (visual->actor);
- if (depths < 0) {
- /* FIXME: set an error */
- goto beach;
- }
- if (depths == VISUAL_VIDEO_DEPTH_GL) {
- /* We can't handle GL only plugins */
- goto beach;
- }
-
- GST_DEBUG_OBJECT (visual, "libvisual plugin supports depths %u (0x%04x)",
- depths, depths);
- /* if (depths & VISUAL_VIDEO_DEPTH_32BIT) Always supports 32bit output */
- gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN));
-
- if (depths & VISUAL_VIDEO_DEPTH_24BIT) {
-#if G_BYTE_ORDER == G_BIG_ENDIAN
- gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_RGB));
-#else
- gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_BGR));
-#endif
- }
- if (depths & VISUAL_VIDEO_DEPTH_16BIT) {
- gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_RGB_16));
- }
-
-beach:
-
- GST_DEBUG_OBJECT (visual, "returning caps %" GST_PTR_FORMAT, ret);
- gst_object_unref (visual);
- return ret;
-}
-
-static gboolean
-gst_visual_src_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad));
- GstStructure *structure;
- gint depth, pitch;
-
- structure = gst_caps_get_structure (caps, 0);
-
- GST_DEBUG_OBJECT (visual, "src pad got caps %" GST_PTR_FORMAT, caps);
-
- if (!gst_structure_get_int (structure, "width", &visual->width))
- goto error;
- if (!gst_structure_get_int (structure, "height", &visual->height))
- goto error;
- if (!gst_structure_get_int (structure, "bpp", &depth))
- goto error;
- if (!gst_structure_get_fraction (structure, "framerate", &visual->fps_n,
- &visual->fps_d))
- goto error;
-
- visual_video_set_depth (visual->video,
- visual_video_depth_enum_from_value (depth));
- visual_video_set_dimension (visual->video, visual->width, visual->height);
- pitch = GST_ROUND_UP_4 (visual->width * visual->video->bpp);
- visual_video_set_pitch (visual->video, pitch);
- visual_actor_video_negotiate (visual->actor, 0, FALSE, FALSE);
-
- /* precalc some values */
- visual->outsize = visual->video->height * pitch;
- visual->spf =
- gst_util_uint64_scale_int (visual->rate, visual->fps_d, visual->fps_n);
- visual->duration =
- gst_util_uint64_scale_int (GST_SECOND, visual->fps_d, visual->fps_n);
-
- gst_object_unref (visual);
- return TRUE;
-
- /* ERRORS */
-error:
- {
- GST_DEBUG_OBJECT (visual, "error parsing caps");
- gst_object_unref (visual);
- return FALSE;
- }
-}
-
-static gboolean
-gst_visual_sink_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad));
- GstStructure *structure;
-
- structure = gst_caps_get_structure (caps, 0);
-
- gst_structure_get_int (structure, "channels", &visual->channels);
- gst_structure_get_int (structure, "rate", &visual->rate);
-
- /* this is how many samples we need to fill one frame at the requested
- * framerate. */
- if (visual->fps_n != 0) {
- visual->spf =
- gst_util_uint64_scale_int (visual->rate, visual->fps_d, visual->fps_n);
- }
- visual->bps = visual->channels * sizeof (gint16);
-
- gst_object_unref (visual);
- return TRUE;
-}
-
-static gboolean
-gst_vis_src_negotiate (GstVisual * visual)
-{
- GstCaps *othercaps, *target, *intersect;
- GstStructure *structure;
- GstCaps *caps;
-
- caps = gst_pad_get_caps (visual->srcpad);
-
- /* see what the peer can do */
- othercaps = gst_pad_peer_get_caps (visual->srcpad);
- if (othercaps) {
- intersect = gst_caps_intersect (othercaps, caps);
- gst_caps_unref (othercaps);
- gst_caps_unref (caps);
-
- if (gst_caps_is_empty (intersect))
- goto no_format;
-
- target = gst_caps_copy_nth (intersect, 0);
- gst_caps_unref (intersect);
- } else {
- /* need a copy, we'll be modifying it when fixating */
- target = gst_caps_copy (caps);
- gst_caps_unref (caps);
- }
-
- /* fixate in case something is not fixed. This does nothing if the value is
- * already fixed. For video we always try to fixate to something like
- * 320x240x30 by convention. */
- structure = gst_caps_get_structure (target, 0);
- gst_structure_fixate_field_nearest_int (structure, "width", 320);
- gst_structure_fixate_field_nearest_int (structure, "height", 240);
- gst_structure_fixate_field_nearest_fraction (structure, "framerate", 30, 1);
-
- gst_pad_set_caps (visual->srcpad, target);
- gst_caps_unref (target);
-
- return TRUE;
-
- /* ERRORS */
-no_format:
- {
- GST_ELEMENT_ERROR (visual, STREAM, FORMAT, (NULL),
- ("could not negotiate output format"));
- gst_caps_unref (intersect);
- return FALSE;
- }
-}
-
-static gboolean
-gst_visual_sink_event (GstPad * pad, GstEvent * event)
-{
- GstVisual *visual;
- gboolean res;
-
- visual = GST_VISUAL (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_START:
- res = gst_pad_push_event (visual->srcpad, event);
- break;
- case GST_EVENT_FLUSH_STOP:
- /* reset QoS and adapter. */
- gst_visual_reset (visual);
- res = gst_pad_push_event (visual->srcpad, event);
- break;
- case GST_EVENT_NEWSEGMENT:
- {
- GstFormat format;
- gdouble rate, arate;
- gint64 start, stop, time;
- gboolean update;
-
- /* the newsegment values are used to clip the input samples
- * and to convert the incomming timestamps to running time so
- * we can do QoS */
- gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
- &start, &stop, &time);
-
- /* now configure the values */
- gst_segment_set_newsegment_full (&visual->segment, update,
- rate, arate, format, start, stop, time);
-
- /* and forward */
- res = gst_pad_push_event (visual->srcpad, event);
- break;
- }
- default:
- res = gst_pad_push_event (visual->srcpad, event);
- break;
- }
-
- gst_object_unref (visual);
- return res;
-}
-
-static gboolean
-gst_visual_src_event (GstPad * pad, GstEvent * event)
-{
- GstVisual *visual;
- gboolean res;
-
- visual = GST_VISUAL (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_QOS:
- {
- gdouble proportion;
- GstClockTimeDiff diff;
- GstClockTime timestamp;
-
- gst_event_parse_qos (event, &proportion, &diff, &timestamp);
-
- /* save stuff for the _chain function */
- GST_OBJECT_LOCK (visual);
- visual->proportion = proportion;
- if (diff >= 0)
- /* we're late, this is a good estimate for next displayable
- * frame (see part-qos.txt) */
- visual->earliest_time = timestamp + 2 * diff + visual->duration;
- else
- visual->earliest_time = timestamp + diff;
-
- GST_OBJECT_UNLOCK (visual);
-
- res = gst_pad_push_event (visual->sinkpad, event);
- break;
- }
- default:
- res = gst_pad_push_event (visual->sinkpad, event);
- break;
- }
-
- gst_object_unref (visual);
- return res;
-}
-
-/* allocate and output buffer, if no format was negotiated, this
- * function will negotiate one. After calling this function, a
- * reverse negotiation could have happened. */
-static GstFlowReturn
-get_buffer (GstVisual * visual, GstBuffer ** outbuf)
-{
- GstFlowReturn ret;
-
- /* we don't know an output format yet, pick one */
- if (GST_PAD_CAPS (visual->srcpad) == NULL) {
- if (!gst_vis_src_negotiate (visual))
- return GST_FLOW_NOT_NEGOTIATED;
- }
-
- GST_DEBUG_OBJECT (visual, "allocating output buffer with caps %"
- GST_PTR_FORMAT, GST_PAD_CAPS (visual->srcpad));
-
- /* now allocate a buffer with the last negotiated format.
- * Downstream could renegotiate a new format, which will trigger
- * our setcaps function on the source pad. */
- ret =
- gst_pad_alloc_buffer_and_set_caps (visual->srcpad,
- GST_BUFFER_OFFSET_NONE, visual->outsize,
- GST_PAD_CAPS (visual->srcpad), outbuf);
-
- /* no buffer allocated, we don't care why. */
- if (ret != GST_FLOW_OK)
- return ret;
-
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_visual_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstBuffer *outbuf = NULL;
- guint i;
- GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad));
- GstFlowReturn ret = GST_FLOW_OK;
- guint avail;
-
- GST_DEBUG_OBJECT (visual, "chain function called");
-
- /* If we don't have an output format yet, preallocate a buffer to try and
- * set one */
- if (GST_PAD_CAPS (visual->srcpad) == NULL) {
- ret = get_buffer (visual, &outbuf);
- if (ret != GST_FLOW_OK) {
- gst_buffer_unref (buffer);
- goto beach;
- }
- }
-
- /* resync on DISCONT */
- if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) {
- gst_adapter_clear (visual->adapter);
- }
-
- GST_DEBUG_OBJECT (visual,
- "Input buffer has %d samples, time=%" G_GUINT64_FORMAT,
- GST_BUFFER_SIZE (buffer) / visual->bps, GST_BUFFER_TIMESTAMP (buffer));
-
- gst_adapter_push (visual->adapter, buffer);
-
- while (TRUE) {
- gboolean need_skip;
- const guint16 *data;
- guint64 dist, timestamp;
-
- GST_DEBUG_OBJECT (visual, "processing buffer");
-
- avail = gst_adapter_available (visual->adapter);
- GST_DEBUG_OBJECT (visual, "avail now %u", avail);
-
- /* we need at least 512 samples */
- if (avail < 512 * visual->bps)
- break;
-
- /* we need at least enough samples to make one frame */
- if (avail < visual->spf * visual->bps)
- break;
-
- /* get timestamp of the current adapter byte */
- timestamp = gst_adapter_prev_timestamp (visual->adapter, &dist);
- if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
- /* convert bytes to time */
- dist /= visual->bps;
- timestamp += gst_util_uint64_scale_int (dist, GST_SECOND, visual->rate);
- }
-
- if (timestamp != -1) {
- gint64 qostime;
-
- /* QoS is done on running time */
- qostime = gst_segment_to_running_time (&visual->segment, GST_FORMAT_TIME,
- timestamp);
-
- GST_OBJECT_LOCK (visual);
- /* check for QoS, don't compute buffers that are known to be late */
- need_skip = visual->earliest_time != -1 &&
- qostime <= visual->earliest_time;
- GST_OBJECT_UNLOCK (visual);
-
- if (need_skip) {
- GST_WARNING_OBJECT (visual,
- "QoS: skip ts: %" GST_TIME_FORMAT ", earliest: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (qostime), GST_TIME_ARGS (visual->earliest_time));
- goto skip;
- }
- }
-
- /* Read 512 samples per channel */
- data =
- (const guint16 *) gst_adapter_peek (visual->adapter, 512 * visual->bps);
-
-#if defined(VISUAL_API_VERSION) && VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000
- {
- VisBuffer *lbuf, *rbuf;
- guint16 ldata[512], rdata[512];
- VisAudioSampleRateType rate;
-
- lbuf = visual_buffer_new_with_buffer (ldata, sizeof (ldata), NULL);
- rbuf = visual_buffer_new_with_buffer (rdata, sizeof (rdata), NULL);
-
- if (visual->channels == 2) {
- for (i = 0; i < 512; i++) {
- ldata[i] = *data++;
- rdata[i] = *data++;
- }
- } else {
- for (i = 0; i < 512; i++) {
- ldata[i] = *data;
- rdata[i] = *data++;
- }
- }
-
- switch (visual->rate) {
- case 8000:
- rate = VISUAL_AUDIO_SAMPLE_RATE_8000;
- break;
- case 11250:
- rate = VISUAL_AUDIO_SAMPLE_RATE_11250;
- break;
- case 22500:
- rate = VISUAL_AUDIO_SAMPLE_RATE_22500;
- break;
- case 32000:
- rate = VISUAL_AUDIO_SAMPLE_RATE_32000;
- break;
- case 44100:
- rate = VISUAL_AUDIO_SAMPLE_RATE_44100;
- break;
- case 48000:
- rate = VISUAL_AUDIO_SAMPLE_RATE_48000;
- break;
- case 96000:
- rate = VISUAL_AUDIO_SAMPLE_RATE_96000;
- break;
- default:
- visual_object_unref (VISUAL_OBJECT (lbuf));
- visual_object_unref (VISUAL_OBJECT (rbuf));
- GST_ERROR_OBJECT (visual, "unsupported rate %d", visual->rate);
- ret = GST_FLOW_ERROR;
- goto beach;
- break;
- }
-
- visual_audio_samplepool_input_channel (visual->audio->samplepool,
- lbuf,
- rate, VISUAL_AUDIO_SAMPLE_FORMAT_S16, VISUAL_AUDIO_CHANNEL_LEFT);
- visual_audio_samplepool_input_channel (visual->audio->samplepool,
- rbuf,
- rate, VISUAL_AUDIO_SAMPLE_FORMAT_S16, VISUAL_AUDIO_CHANNEL_RIGHT);
-
- visual_object_unref (VISUAL_OBJECT (lbuf));
- visual_object_unref (VISUAL_OBJECT (rbuf));
-
- }
-#else
- if (visual->channels == 2) {
- for (i = 0; i < 512; i++) {
- visual->audio->plugpcm[0][i] = *data++;
- visual->audio->plugpcm[1][i] = *data++;
- }
- } else {
- for (i = 0; i < 512; i++) {
- visual->audio->plugpcm[0][i] = *data;
- visual->audio->plugpcm[1][i] = *data++;
- }
- }
-#endif
-
- /* alloc a buffer if we don't have one yet, this happens
- * when we pushed a buffer in this while loop before */
- if (outbuf == NULL) {
- ret = get_buffer (visual, &outbuf);
- if (ret != GST_FLOW_OK) {
- goto beach;
- }
- }
- visual_video_set_buffer (visual->video, GST_BUFFER_DATA (outbuf));
- visual_audio_analyze (visual->audio);
- visual_actor_run (visual->actor, visual->audio);
- visual_video_set_buffer (visual->video, NULL);
- GST_DEBUG_OBJECT (visual, "rendered one frame");
-
- GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
- GST_BUFFER_DURATION (outbuf) = visual->duration;
-
- ret = gst_pad_push (visual->srcpad, outbuf);
- outbuf = NULL;
-
- skip:
- GST_DEBUG_OBJECT (visual, "finished frame, flushing %u samples from input",
- visual->spf);
-
- /* Flush out the number of samples per frame */
- gst_adapter_flush (visual->adapter, visual->spf * visual->bps);
-
- /* quit the loop if something was wrong */
- if (ret != GST_FLOW_OK)
- break;
- }
-
-beach:
-
- if (outbuf != NULL)
- gst_buffer_unref (outbuf);
-
- gst_object_unref (visual);
-
- return ret;
-}
-
-static GstStateChangeReturn
-gst_visual_change_state (GstElement * element, GstStateChange transition)
-{
- GstVisual *visual = GST_VISUAL (element);
- GstStateChangeReturn ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- visual->actor =
- visual_actor_new (GST_VISUAL_GET_CLASS (visual)->plugin->info->
- plugname);
- visual->video = visual_video_new ();
- visual->audio = visual_audio_new ();
- /* can't have a play without actors */
- if (!visual->actor || !visual->video)
- goto no_actors;
-
- if (visual_actor_realize (visual->actor) != 0)
- goto no_realize;
-
- visual_actor_set_video (visual->actor, visual->video);
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- gst_visual_reset (visual);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- gst_visual_clear_actors (visual);
- break;
- default:
- break;
- }
-
- return ret;
-
- /* ERRORS */
-no_actors:
- {
- GST_ELEMENT_ERROR (visual, LIBRARY, INIT, (NULL),
- ("could not create actors"));
- gst_visual_clear_actors (visual);
- return GST_STATE_CHANGE_FAILURE;
- }
-no_realize:
- {
- GST_ELEMENT_ERROR (visual, LIBRARY, INIT, (NULL),
- ("could not realize actor"));
- gst_visual_clear_actors (visual);
- return GST_STATE_CHANGE_FAILURE;
- }
-}
-
-static void
-make_valid_name (char *name)
-{
- /*
- * Replace invalid chars with _ in the type name
- */
- static const gchar extra_chars[] = "-_+";
- gchar *p = name;
-
- for (; *p; p++) {
- int valid = ((p[0] >= 'A' && p[0] <= 'Z') ||
- (p[0] >= 'a' && p[0] <= 'z') ||
- (p[0] >= '0' && p[0] <= '9') || strchr (extra_chars, p[0]));
- if (!valid)
- *p = '_';
- }
-}
-
-static gboolean
-gst_visual_actor_plugin_is_gl (VisObject * plugin, const gchar * name)
-{
- gboolean is_gl;
- gint depth;
-
-#if !defined(VISUAL_API_VERSION)
-
- depth = VISUAL_PLUGIN_ACTOR (plugin)->depth;
- is_gl = (depth == VISUAL_VIDEO_DEPTH_GL);
-
-#elif VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000
-
- depth = VISUAL_ACTOR_PLUGIN (plugin)->vidoptions.depth;
- /* FIXME: how to figure this out correctly in 0.4? */
- is_gl = (depth & VISUAL_VIDEO_DEPTH_GL) == VISUAL_VIDEO_DEPTH_GL;
-
-#else
-# error what libvisual version is this?
-#endif
-
- if (!is_gl) {
- GST_DEBUG ("plugin %s is not a GL plugin (%d), registering", name, depth);
- } else {
- GST_DEBUG ("plugin %s is a GL plugin (%d), ignoring", name, depth);
- }
-
- return is_gl;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- guint i, count;
- VisList *list;
-
- GST_DEBUG_CATEGORY_INIT (libvisual_debug, "libvisual", 0,
- "libvisual audio visualisations");
-
-#ifdef LIBVISUAL_PLUGINSBASEDIR
- gst_plugin_add_dependency_simple (plugin, "HOME/.libvisual/actor",
- LIBVISUAL_PLUGINSBASEDIR "/actor", NULL, GST_PLUGIN_DEPENDENCY_FLAG_NONE);
-#endif
-
- visual_log_set_verboseness (VISUAL_LOG_VERBOSENESS_LOW);
- visual_log_set_info_handler (libvisual_log_handler, (void *) GST_LEVEL_INFO);
- visual_log_set_warning_handler (libvisual_log_handler,
- (void *) GST_LEVEL_WARNING);
- visual_log_set_critical_handler (libvisual_log_handler,
- (void *) GST_LEVEL_ERROR);
- visual_log_set_error_handler (libvisual_log_handler,
- (void *) GST_LEVEL_ERROR);
-
- if (!visual_is_initialized ())
- if (visual_init (NULL, NULL) != 0)
- return FALSE;
-
- list = visual_actor_get_list ();
-
-#if !defined(VISUAL_API_VERSION)
- count = visual_list_count (list);
-#elif VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000
- count = visual_collection_size (VISUAL_COLLECTION (list));
-#endif
-
- for (i = 0; i < count; i++) {
- VisPluginRef *ref = visual_list_get (list, i);
- VisPluginData *visplugin = NULL;
- gboolean skip = FALSE;
- GType type;
- gchar *name;
- GTypeInfo info = {
- sizeof (GstVisualClass),
- NULL,
- NULL,
- gst_visual_class_init,
- NULL,
- ref,
- sizeof (GstVisual),
- 0,
- NULL
- };
-
- visplugin = visual_plugin_load (ref);
-
- if (ref->info->plugname == NULL)
- continue;
-
- /* Blacklist some plugins */
- if (strcmp (ref->info->plugname, "gstreamer") == 0 ||
- strcmp (ref->info->plugname, "gdkpixbuf") == 0) {
- skip = TRUE;
- } else {
- /* Ignore plugins that only support GL output for now */
- skip = gst_visual_actor_plugin_is_gl (visplugin->info->plugin,
- visplugin->info->plugname);
- }
-
- visual_plugin_unload (visplugin);
-
- if (!skip) {
- name = g_strdup_printf ("GstVisual%s", ref->info->plugname);
- make_valid_name (name);
- type = g_type_register_static (GST_TYPE_VISUAL, name, &info, 0);
- g_free (name);
-
- name = g_strdup_printf ("libvisual_%s", ref->info->plugname);
- make_valid_name (name);
- if (!gst_element_register (plugin, name, GST_RANK_NONE, type)) {
- g_free (name);
- return FALSE;
- }
- g_free (name);
- }
- }
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "libvisual",
- "libvisual visualization plugins",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/ogg/Makefile.am b/ext/ogg/Makefile.am
deleted file mode 100644
index 2d152335..00000000
--- a/ext/ogg/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-plugin_LTLIBRARIES = libgstogg.la
-
-libgstogg_la_SOURCES = \
- gstogg.c \
- gstoggdemux.c \
- gstoggmux.c \
- gstogmparse.c \
- gstoggaviparse.c \
- gstoggparse.c \
- gstoggstream.c \
- gstoggstream.h \
- dirac_parse.c \
- dirac_parse.h \
- vorbis_parse.c
-
-noinst_HEADERS = \
- gstoggdemux.h gstoggmux.h
-
-libgstogg_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(OGG_CFLAGS)
-libgstogg_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/riff/libgstriff-$(GST_MAJORMINOR).la \
- $(top_builddir)/gst-libs/gst/tag/libgsttag-$(GST_MAJORMINOR).la \
- $(GST_BASE_LIBS) \
- $(OGG_LIBS)
-libgstogg_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstogg_la_LIBTOOLFLAGS = --tag=disable-static
-
diff --git a/ext/ogg/README b/ext/ogg/README
deleted file mode 100644
index 557e9d50..00000000
--- a/ext/ogg/README
+++ /dev/null
@@ -1,366 +0,0 @@
-This document describes some things to know about the Ogg format, as well
-as implementation details in GStreamer.
-
-INTRODUCTION
-============
-
-ogg and the granulepos
-----------------------
-
-An ogg stream contains pages with a serial number and a granulepos.
-The granulepos is a 64 bit signed integer. It is a value that in some way
-represents a time since the start of the stream.
-The interpretation as such is however both codec-specific and
-stream-specific.
-
-ogg has no notion of time: it only knows about bytes and granulepos values
-on pages.
-
-The granule position is just a number; the only guarantee for a valid ogg
-stream is that within a logical stream, this number never decreases.
-
-While logically a granulepos value can be constructed for every ogg packet,
-the page is marked with only one granulepos value: the granulepos of the
-last packet to end on that page.
-
-theora and the granulepos
--------------------------
-
-The granulepos in theora is an encoding of the frame number of the last
-key frame ("i frame"), and the number of frames since the last key frame
-("p frame"). The granulepos is constructed as the sum of the first number,
-shifted to the left for granuleshift bits, and the second number:
-granulepos = pframe << granuleshift + iframe
-
-(This means that given a framenumber or a timestamp, one cannot generate
- the one and only granulepos for that page; several granulepos possibilities
- correspond to this frame number. You also need the last keyframe, as well
- as the granuleshift.
- However, given a granulepos, the theora codec can still map that to a
- unique timestamp and frame number for that theora stream)
-
- Note: currently theora stores the "presentation time" as the granulepos;
- ie. a first data page with one packet contains one video frame and
- will be marked with 0/0. Changing that to be 1/0 (so that it
- represents the number of decodable frames up to that point, like
- for Vorbis) is being discussed.
-
-vorbis and granulepos
----------------------
-
-In Vorbis, the granulepos represents the number of samples that can be
-decoded from all packets up to that point.
-
-In GStreamer, the vorbisenc elements produces a stream where:
-- OFFSET is the time corresponding to the granulepos
- number of bytes produced before
-- OFFSET_END is the granulepos of the produced vorbis buffer
-- TIMESTAMP is the timestamp matching the begin of the buffer
-- DURATION is set to the length in time of the buffer
-
-Ogg media mapping
------------------
-
-Ogg defines a mapping for each media type that it embeds.
-
-For Vorbis:
-
- - 3 header pages, with granulepos 0.
- - 1 page with 1 packet header identification
- - N pages with 2 packets comments and codebooks
- - granulepos is samplenumber of next page
- - one packet can contain a variable number of samples but one frame
- that should be handed to the vorbis decoder.
-
-For Theora
-
- - 3 header pages, with granulepos 0.
- - 1 page with 1 packet header identification
- - N pages with 2 packets comments and codebooks
- - granulepos is framenumber of last packet in page, where framenumber
- is a combination of keyframe number and p frames since keyframe.
- - one packet contains 1 frame
-
-
-
-
-DEMUXING
-========
-
-ogg demuxer
------------
-
-This ogg demuxer has two modes of operation, which both share a significant
-amount of code. The first mode is the streaming mode which is automatically
-selected when the demuxer is connected to a non-getrange based element. When
-connected to a getrange based element the ogg demuxer can do full seeking
-with great efficiency.
-
-1) the streaming mode.
-
-In this mode, the ogg demuxer receives buffers in the _chain() function which
-are then simply submited to the ogg sync layer. Pages are then processed when
-the sync layer detects them, pads are created for new chains and packets are
-sent to the peer elements of the pads.
-
-In this mode, no seeking is possible. This is the typical case when the
-stream is read from a network source.
-
-In this mode, no setup is done at startup, the pages are just read and decoded.
-A new logical chain is detected when one of the pages has the BOS flag set. At
-this point the existing pads are removed and new pads are created for all the
-logical streams in this new chain.
-
-
-2) the random access mode.
-
- In this mode, the ogg file is first scanned to detect the position and length
-of all chains. This scanning is performed using a recursive binary search
-algorithm that is explained below.
-
- find_chains(start, end)
- {
- ret1 = read_next_pages (start);
- ret2 = read_prev_page (end);
-
- if (WAS_HEADER (ret1)) {
- }
- else {
- }
-
- }
-
- a) read first and last pages
-
- start end
- V V
- +-----------------------+-------------+--------------------+
- | 111 | 222 | 333 |
- BOS BOS BOS EOS
-
-
- after reading start, serial 111, BOS, chain[0] = 111
- after reading end, serial 333, EOS
-
- start serialno != end serialno, binary search start, (end-start)/2
-
- start bisect end
- V V V
- +-----------------------+-------------+--------------------+
- | 111 | 222 | 333 |
-
-
- after reading start, serial 111, BOS, chain[0] = 111
- after reading end, serial 222, EOS
-
- while (
-
-
-
-testcases
----------
-
- a) stream without BOS
-
- +----------------------------------------------------------+
- 111 |
- EOS
-
- b) chained stream, first chain without BOS
-
- +-------------------+--------------------------------------+
- 111 | 222 |
- BOS EOS
-
-
- c) chained stream
-
- +-------------------+--------------------------------------+
- | 111 | 222 |
- BOS BOS EOS
-
-
- d) chained stream, second without BOS
-
- +-------------------+--------------------------------------+
- | 111 | 222 |
- BOS EOS
-
-What can an ogg demuxer do?
----------------------------
-
-An ogg demuxer can read pages and get the granulepos from them.
-It can ask the decoder elements to convert a granulepos to time.
-
-An ogg demuxer can also get the granulepos of the first and the last page of a
-stream to get the start and end timestamp of that stream.
-It can also get the length in bytes of the stream
-(when the peer is seekable, that is).
-
-An ogg demuxer is therefore basically able to seek to any byte position and
-timestamp.
-
-When asked to seek to a given granulepos, the ogg demuxer should always convert
-the value to a timestamp using the peer decoder element conversion function. It
-can then binary search the file to eventually end up on the page with the given
-granule pos or a granulepos with the same timestamp.
-
-Seeking in ogg currently
-------------------------
-
-When seeking in an ogg, the decoders can choose to forward the seek event as a
-granulepos or a timestamp to the ogg demuxer.
-
-In the case of a granulepos, the ogg demuxer will seek back to the beginning of
-the stream and skip pages until it finds one with the requested timestamp.
-
-In the case of a timestamp, the ogg demuxer also seeks back to the beginning of
-the stream. For each page it reads, it asks the decoder element to convert the
-granulepos back to a timestamp. The ogg demuxer keeps on skipping pages until
-the page has a timestamp bigger or equal to the requested one.
-
-It is therefore important that the decoder elements in vorbis can convert a
-granulepos into a timestamp or never seek on timestamp on the oggdemuxer.
-
-The default format on the oggdemuxer source pads is currently defined as a the
-granulepos of the packets, it is also the value of the OFFSET field in the
-GstBuffer.
-
-MUXING
-======
-
-Oggmux
-------
-
-The ogg muxer's job is to output complete Ogg pages such that the absolute
-time represented by the valid (ie, not -1) granulepos values on those pages
-never decreases. This has to be true for all logical streams in the group at
-the same time.
-
-To achieve this, encoders are required to pass along the exact time that the
-granulepos represents for each ogg packet that it pushes to the ogg muxer.
-This is ESSENTIAL: without this exact time representation of the granulepos,
-the muxer can not produce valid streams.
-
-The ogg muxer has a packet queue per sink pad. From this queue a page can
-be flushed when:
- - total byte size of queued packets exceeds a given value
- - total time duration of queued packets exceeds a given value
- - total byte size of queued packets exceeds maximum Ogg page size
- - eos of the pad
- - encoder sent a command to flush out an ogg page after this new packet
- (in 0.8, through a flush event; in 0.10, with a GstOggBuffer)
- - muxer wants a flush to happen (so it can output pages)
-
-The ogg muxer also has a page queue per sink pad. This queue collects
-Ogg pages from the corresponding packet queue. Each page is also marked
-with the timestamp that the granulepos in the header represents.
-
-A page can be flushed from this collection of page queues when:
-- ideally, every page queue has at least one page with a valid granulepos
- -> choose the page, from all queues, with the lowest timestamp value
-- if not, muxer can wait if the following limits aren't reached:
- - total byte size of any page queue exceeds a limit
- - total time duration of any page queue exceeds a limit
-- if this limit is reached, then:
- - request a page flush from packet queue to page queue for each queue
- that does not have pages
- - now take the page from all queues with the lowest timestamp value
- - make sure all later-coming data is marked as old, either to be still
- output (but producing an invalid stream, though it can be fixed later)
- or dropped (which means it's gone forever)
-
-The oggmuxer uses the offset fields to fill in the granulepos in the pages.
-
-GStreamer implementation details
---------------------------------
-As said before, the basic rule is that the ogg muxer needs an exact time
-representation for each granulepos. This needs to be provided by the encoder.
-
-Potential problems are:
- - initial offsets for a raw stream need to be preserved somehow. Example:
- if the first audio sample has time 0.5, the granulepos in the vorbis encoder
- needs to be adjusted to take this into account.
- - initial offsets may need be on rate boundaries. Example:
- if the framerate is 5 fps, and the first video frame has time 0.1 s, the
- granulepos cannot correctly represent this timestamp.
- This can be handled out-of-band (initial offset in another muxing format,
- skeleton track with initial offsets, ...)
-
-Given that the basic rule for muxing is that the muxer needs an exact timestamp
-matching the granulepos, we need some way of communicating this time value
-from encoders to the Ogg muxer. So we need a mechanism to communicate
-a granulepos and its time representation for each GstBuffer.
-
-(This is an instance of a more generic problem - having a way to attach
- more fields to a GstBuffer)
-
-Possible ways:
-- setting TIMESTAMP to this value: bad - this value represents the end time
- of the buffer, and thus conflicts with GStreamer's idea of what TIMESTAMP
- is. This would cause problems muxing the encoded stream in other muxing
- formats, or for streaming. Note that this is what was done in GStreamer 0.8
-- setting DURATION to GP_TIME - TIMESTAMP: bad - this breaks the concept of
- duration for this frame. Take the video example above; each buffer would
- have a correct timestamp, but always a 0.1 s duration as opposed to the
- correct 0.2 s duration
-- subclassing GstBuffer: clean, but requires a common header used between
- ogg muxer and all encoders that can be muxed into ogg. Also, what if
- a format can be muxed into more than one container, and they each have
- their own "extra" info to communicate ?
-- adding key/value pairs to GstBuffer: clean, but requires changes to
- core. Also, the overhead of allocating e.g. a GstStructure for *each* buffer
- may be expensive.
-- "cheating":
- - abuse OFFSET to store the timestamp matching this granulepos
- - abuse OFFSET_END to store the granulepos value
- The drawback here is that before, it made sense to use OFFSET and OFFSET_END
- to store a byte count. Given that this is not used for anything critical
- (you can't store a raw theora or vorbis stream in a file anyway),
- this is what's being done for now.
-
-In practice
------------
-- all encoders of formats that can be muxed into Ogg produce a stream where:
- - OFFSET is abused to be the timestamp corresponding exactly to the
- granulepos
- - OFFSET_END is abused to be the granulepos of the encoded theora buffer
- - TIMESTAMP is the timestamp matching the begin of the buffer
- - DURATION is the length in time of the buffer
-
-- initial delays should be handled in the GStreamer encoders by mangling
- the granulepos of the encoded packet to take the delay into account as
- best as possible and store that in OFFSET;
- this then brings TIMESTAMP + DURATION to within less
- than a frame period of the granulepos's time representation
- The ogg muxer will then create new ogg packets with this OFFSET as
- the granulepos. So in effect, the granulepos produced by the encoders
- does not get used directly.
-
-TODO
-----
-- decide on a proper mechanism for communicating extra per-buffer fields
-- the ogg muxer sets timestamp and duration on outgoing ogg pages based on
- timestamp/duration of incoming ogg packets.
- Note that:
- - since the ogg muxer *has* to output pages sorted by gp time, representing
- end time of the page, this means that the buffer's timestamps are not
- necessarily monotonically increasing
- - timestamp + duration of buffers don't match up; the duration represents
- the length of the ogg page *for that stream*. Hence, for a normal
- two-stream file, the sum of all durations is twice the length of the
- muxed file.
-
-TESTING
--------
-Proper muxing can be tested by generating test files with command lines like:
-- video and audio start from 0:
-gst-launch -v videotestsrc ! theoraenc ! oggmux audiotestsrc ! audioconvert ! vorbisenc ! identity ! oggmux0. oggmux0. ! filesink location=test.ogg
-
-- video starts after audio:
-gst-launch -v videotestsrc timestamp-offset=500000000 ! theoraenc ! oggmux audiotestsrc ! audioconvert ! vorbisenc ! identity ! oggmux0. oggmux0. ! filesink location=test.ogg
-
-- audio starts after video:
-gst-launch -v videotestsrc ! theoraenc ! oggmux audiotestsrc timestamp-offset=500000000 ! audioconvert ! vorbisenc ! identity ! oggmux0. oggmux0. ! filesink location=test.ogg
-
-The resulting files can be verified with oggz-validate for correctness.
diff --git a/ext/ogg/dirac_parse.c b/ext/ogg/dirac_parse.c
deleted file mode 100644
index f7b483dc..00000000
--- a/ext/ogg/dirac_parse.c
+++ /dev/null
@@ -1,501 +0,0 @@
-
-#include "dirac_parse.h"
-#include <string.h>
-
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
-
-typedef struct _Unpack Unpack;
-
-struct _Unpack
-{
- unsigned char *data;
- int n_bits_left;
- int index;
- int guard_bit;
-};
-
-static void schro_unpack_init_with_data (Unpack * unpack, unsigned char *data,
- int n_bytes, unsigned int guard_bit);
-
-static unsigned int schro_unpack_decode_bit (Unpack * unpack);
-static unsigned int schro_unpack_decode_uint (Unpack * unpack);
-
-
-void schro_video_format_set_std_video_format (DiracSequenceHeader * format,
- int index);
-void schro_video_format_set_std_frame_rate (DiracSequenceHeader * format,
- int index);
-void schro_video_format_set_std_aspect_ratio (DiracSequenceHeader * format,
- int index);
-void schro_video_format_set_std_signal_range (DiracSequenceHeader * format,
- int index);
-void schro_video_format_set_std_colour_spec (DiracSequenceHeader * format,
- int index);
-
-
-
-
-int
-dirac_sequence_header_parse (DiracSequenceHeader * header,
- unsigned char *data, int n_bytes)
-{
- int bit;
- int index;
- Unpack _unpack;
- Unpack *unpack = &_unpack;
- int major_version;
- int minor_version;
- int profile;
- int level;
-
- memset (header, 0, sizeof (*header));
-
- schro_unpack_init_with_data (unpack, data, n_bytes, 1);
-
- /* parse parameters */
- major_version = schro_unpack_decode_uint (unpack);
- minor_version = schro_unpack_decode_uint (unpack);
- profile = schro_unpack_decode_uint (unpack);
- level = schro_unpack_decode_uint (unpack);
-
- /* base video header */
- index = schro_unpack_decode_uint (unpack);
- schro_video_format_set_std_video_format (header, index);
-
- header->major_version = major_version;
- header->minor_version = minor_version;
- header->profile = profile;
- header->level = level;
-
- /* source parameters */
- /* frame dimensions */
- bit = schro_unpack_decode_bit (unpack);
- if (bit) {
- header->width = schro_unpack_decode_uint (unpack);
- header->height = schro_unpack_decode_uint (unpack);
- }
-
- /* chroma header */
- bit = schro_unpack_decode_bit (unpack);
- if (bit) {
- header->chroma_format = schro_unpack_decode_uint (unpack);
- }
-
- /* scan header */
- bit = schro_unpack_decode_bit (unpack);
- if (bit) {
- header->interlaced = schro_unpack_decode_bit (unpack);
- if (header->interlaced) {
- header->top_field_first = schro_unpack_decode_bit (unpack);
- }
- }
-
- /* frame rate */
- bit = schro_unpack_decode_bit (unpack);
- if (bit) {
- index = schro_unpack_decode_uint (unpack);
- if (index == 0) {
- header->frame_rate_numerator = schro_unpack_decode_uint (unpack);
- header->frame_rate_denominator = schro_unpack_decode_uint (unpack);
- } else {
- schro_video_format_set_std_frame_rate (header, index);
- }
- }
-
- /* aspect ratio */
- bit = schro_unpack_decode_bit (unpack);
- if (bit) {
- index = schro_unpack_decode_uint (unpack);
- if (index == 0) {
- header->aspect_ratio_numerator = schro_unpack_decode_uint (unpack);
- header->aspect_ratio_denominator = schro_unpack_decode_uint (unpack);
- } else {
- schro_video_format_set_std_aspect_ratio (header, index);
- }
- }
-
- /* clean area */
- bit = schro_unpack_decode_bit (unpack);
- if (bit) {
- header->clean_width = schro_unpack_decode_uint (unpack);
- header->clean_height = schro_unpack_decode_uint (unpack);
- header->left_offset = schro_unpack_decode_uint (unpack);
- header->top_offset = schro_unpack_decode_uint (unpack);
- }
-
- /* signal range */
- bit = schro_unpack_decode_bit (unpack);
- if (bit) {
- index = schro_unpack_decode_uint (unpack);
- if (index == 0) {
- header->luma_offset = schro_unpack_decode_uint (unpack);
- header->luma_excursion = schro_unpack_decode_uint (unpack);
- header->chroma_offset = schro_unpack_decode_uint (unpack);
- header->chroma_excursion = schro_unpack_decode_uint (unpack);
- } else {
- schro_video_format_set_std_signal_range (header, index);
- }
- }
-
- /* colour spec */
- bit = schro_unpack_decode_bit (unpack);
- if (bit) {
- index = schro_unpack_decode_uint (unpack);
- schro_video_format_set_std_colour_spec (header, index);
- if (index == 0) {
- /* colour primaries */
- bit = schro_unpack_decode_bit (unpack);
- if (bit) {
- header->colour_primaries = schro_unpack_decode_uint (unpack);
- }
- /* colour matrix */
- bit = schro_unpack_decode_bit (unpack);
- if (bit) {
- header->colour_matrix = schro_unpack_decode_uint (unpack);
- }
- /* transfer function */
- bit = schro_unpack_decode_bit (unpack);
- if (bit) {
- header->transfer_function = schro_unpack_decode_uint (unpack);
- }
- }
- }
-
- header->interlaced_coding = schro_unpack_decode_uint (unpack);
-
- return 1;
-}
-
-/* standard stuff */
-
-static DiracSequenceHeader schro_video_formats[] = {
- {0, 0, 0, 0,
- 0, /* custom */
- 640, 480, SCHRO_CHROMA_420,
- FALSE, FALSE,
- 24000, 1001, 1, 1,
- 640, 480, 0, 0,
- 0, 255, 128, 255,
- 0, 0, 0},
- {0, 0, 0, 0,
- 1, /* QSIF525 */
- 176, 120, SCHRO_CHROMA_420,
- FALSE, FALSE,
- 15000, 1001, 10, 11,
- 176, 120, 0, 0,
- 0, 255, 128, 255,
- 1, 1, 0},
- {0, 0, 0, 0,
- 2, /* QCIF */
- 176, 144, SCHRO_CHROMA_420,
- FALSE, TRUE,
- 25, 2, 12, 11,
- 176, 144, 0, 0,
- 0, 255, 128, 255,
- 2, 1, 0},
- {0, 0, 0, 0,
- 3, /* SIF525 */
- 352, 240, SCHRO_CHROMA_420,
- FALSE, FALSE,
- 15000, 1001, 10, 11,
- 352, 240, 0, 0,
- 0, 255, 128, 255,
- 1, 1, 0},
- {0, 0, 0, 0,
- 4, /* CIF */
- 352, 288, SCHRO_CHROMA_420,
- FALSE, TRUE,
- 25, 2, 12, 11,
- 352, 288, 0, 0,
- 0, 255, 128, 255,
- 2, 1, 0},
- {0, 0, 0, 0,
- 5, /* 4SIF525 */
- 704, 480, SCHRO_CHROMA_420,
- FALSE, FALSE,
- 15000, 1001, 10, 11,
- 704, 480, 0, 0,
- 0, 255, 128, 255,
- 1, 1, 0},
- {0, 0, 0, 0,
- 6, /* 4CIF */
- 704, 576, SCHRO_CHROMA_420,
- FALSE, TRUE,
- 25, 2, 12, 11,
- 704, 576, 0, 0,
- 0, 255, 128, 255,
- 2, 1, 0},
- {0, 0, 0, 0,
- 7, /* SD480I-60 */
- 720, 480, SCHRO_CHROMA_422,
- TRUE, FALSE,
- 30000, 1001, 10, 11,
- 704, 480, 8, 0,
- 64, 876, 512, 896,
- 1, 1, 0},
- {0, 0, 0, 0,
- 8, /* SD576I-50 */
- 720, 576, SCHRO_CHROMA_422,
- TRUE, TRUE,
- 25, 1, 12, 11,
- 704, 576, 8, 0,
- 64, 876, 512, 896,
- 2, 1, 0},
- {0, 0, 0, 0,
- 9, /* HD720P-60 */
- 1280, 720, SCHRO_CHROMA_422,
- FALSE, TRUE,
- 60000, 1001, 1, 1,
- 1280, 720, 0, 0,
- 64, 876, 512, 896,
- 0, 0, 0},
- {0, 0, 0, 0,
- 10, /* HD720P-50 */
- 1280, 720, SCHRO_CHROMA_422,
- FALSE, TRUE,
- 50, 1, 1, 1,
- 1280, 720, 0, 0,
- 64, 876, 512, 896,
- 0, 0, 0},
- {0, 0, 0, 0,
- 11, /* HD1080I-60 */
- 1920, 1080, SCHRO_CHROMA_422,
- TRUE, TRUE,
- 30000, 1001, 1, 1,
- 1920, 1080, 0, 0,
- 64, 876, 512, 896,
- 0, 0, 0},
- {0, 0, 0, 0,
- 12, /* HD1080I-50 */
- 1920, 1080, SCHRO_CHROMA_422,
- TRUE, TRUE,
- 25, 1, 1, 1,
- 1920, 1080, 0, 0,
- 64, 876, 512, 896,
- 0, 0, 0},
- {0, 0, 0, 0,
- 13, /* HD1080P-60 */
- 1920, 1080, SCHRO_CHROMA_422,
- FALSE, TRUE,
- 60000, 1001, 1, 1,
- 1920, 1080, 0, 0,
- 64, 876, 512, 896,
- 0, 0, 0},
- {0, 0, 0, 0,
- 14, /* HD1080P-50 */
- 1920, 1080, SCHRO_CHROMA_422,
- FALSE, TRUE,
- 50, 1, 1, 1,
- 1920, 1080, 0, 0,
- 64, 876, 512, 896,
- 0, 0, 0},
- {0, 0, 0, 0,
- 15, /* DC2K */
- 2048, 1080, SCHRO_CHROMA_444,
- FALSE, TRUE,
- 24, 1, 1, 1,
- 2048, 1080, 0, 0,
- 256, 3504, 2048, 3584,
- 3, 0, 0},
- {0, 0, 0, 0,
- 16, /* DC4K */
- 4096, 2160, SCHRO_CHROMA_444,
- FALSE, TRUE,
- 24, 1, 1, 1,
- 2048, 1536, 0, 0,
- 256, 3504, 2048, 3584,
- 3, 0, 0},
-};
-
-void
-schro_video_format_set_std_video_format (DiracSequenceHeader * format,
- int index)
-{
-
- if (index < 0 || index >= ARRAY_SIZE (schro_video_formats)) {
- return;
- }
-
- memcpy (format, schro_video_formats + index, sizeof (DiracSequenceHeader));
-}
-
-typedef struct _SchroFrameRate SchroFrameRate;
-struct _SchroFrameRate
-{
- int numerator;
- int denominator;
-};
-
-static SchroFrameRate schro_frame_rates[] = {
- {0, 0},
- {24000, 1001},
- {24, 1},
- {25, 1},
- {30000, 1001},
- {30, 1},
- {50, 1},
- {60000, 1001},
- {60, 1},
- {15000, 1001},
- {25, 2}
-};
-
-void
-schro_video_format_set_std_frame_rate (DiracSequenceHeader * format, int index)
-{
- if (index < 1 || index >= ARRAY_SIZE (schro_frame_rates)) {
- return;
- }
-
- format->frame_rate_numerator = schro_frame_rates[index].numerator;
- format->frame_rate_denominator = schro_frame_rates[index].denominator;
-}
-
-typedef struct _SchroPixelAspectRatio SchroPixelAspectRatio;
-struct _SchroPixelAspectRatio
-{
- int numerator;
- int denominator;
-};
-
-static const SchroPixelAspectRatio schro_aspect_ratios[] = {
- {0, 0},
- {1, 1},
- {10, 11},
- {12, 11},
- {40, 33},
- {16, 11},
- {4, 3}
-};
-
-void
-schro_video_format_set_std_aspect_ratio (DiracSequenceHeader * format,
- int index)
-{
- if (index < 1 || index >= ARRAY_SIZE (schro_aspect_ratios)) {
- return;
- }
-
- format->aspect_ratio_numerator = schro_aspect_ratios[index].numerator;
- format->aspect_ratio_denominator = schro_aspect_ratios[index].denominator;
-
-}
-
-typedef struct _SchroSignalRangeStruct SchroSignalRangeStruct;
-struct _SchroSignalRangeStruct
-{
- int luma_offset;
- int luma_excursion;
- int chroma_offset;
- int chroma_excursion;
-};
-
-static const SchroSignalRangeStruct schro_signal_ranges[] = {
- {0, 0, 0, 0},
- {0, 255, 128, 255},
- {16, 219, 128, 224},
- {64, 876, 512, 896},
- {256, 3504, 2048, 3584}
-};
-
-void
-schro_video_format_set_std_signal_range (DiracSequenceHeader * format, int i)
-{
- if (i < 1 || i >= ARRAY_SIZE (schro_signal_ranges)) {
- return;
- }
-
- format->luma_offset = schro_signal_ranges[i].luma_offset;
- format->luma_excursion = schro_signal_ranges[i].luma_excursion;
- format->chroma_offset = schro_signal_ranges[i].chroma_offset;
- format->chroma_excursion = schro_signal_ranges[i].chroma_excursion;
-}
-
-typedef struct _SchroColourSpecStruct SchroColourSpecStruct;
-struct _SchroColourSpecStruct
-{
- int colour_primaries;
- int colour_matrix;
- int transfer_function;
-};
-
-static const SchroColourSpecStruct schro_colour_specs[] = {
- { /* Custom */
- SCHRO_COLOUR_PRIMARY_HDTV,
- SCHRO_COLOUR_MATRIX_HDTV,
- SCHRO_TRANSFER_CHAR_TV_GAMMA},
- { /* SDTV 525 */
- SCHRO_COLOUR_PRIMARY_SDTV_525,
- SCHRO_COLOUR_MATRIX_SDTV,
- SCHRO_TRANSFER_CHAR_TV_GAMMA},
- { /* SDTV 625 */
- SCHRO_COLOUR_PRIMARY_SDTV_625,
- SCHRO_COLOUR_MATRIX_SDTV,
- SCHRO_TRANSFER_CHAR_TV_GAMMA},
- { /* HDTV */
- SCHRO_COLOUR_PRIMARY_HDTV,
- SCHRO_COLOUR_MATRIX_HDTV,
- SCHRO_TRANSFER_CHAR_TV_GAMMA},
- { /* Cinema */
- SCHRO_COLOUR_PRIMARY_CINEMA,
- SCHRO_COLOUR_MATRIX_HDTV,
- SCHRO_TRANSFER_CHAR_TV_GAMMA}
-};
-
-void
-schro_video_format_set_std_colour_spec (DiracSequenceHeader * format, int i)
-{
- if (i < 0 || i >= ARRAY_SIZE (schro_colour_specs)) {
- return;
- }
-
- format->colour_primaries = schro_colour_specs[i].colour_primaries;
- format->colour_matrix = schro_colour_specs[i].colour_matrix;
- format->transfer_function = schro_colour_specs[i].transfer_function;
-}
-
-
-/* unpack */
-
-static void
-schro_unpack_init_with_data (Unpack * unpack, unsigned char *data,
- int n_bytes, unsigned int guard_bit)
-{
- memset (unpack, 0, sizeof (Unpack));
-
- unpack->data = data;
- unpack->n_bits_left = 8 * n_bytes;
- unpack->guard_bit = guard_bit;
-}
-
-static unsigned int
-schro_unpack_decode_bit (Unpack * unpack)
-{
- int bit;
-
- if (unpack->n_bits_left < 1) {
- return unpack->guard_bit;
- }
- bit = (unpack->data[unpack->index >> 3] >> (7 - (unpack->index & 7))) & 1;
- unpack->index++;
- unpack->n_bits_left--;
-
- return bit;
-}
-
-static unsigned int
-schro_unpack_decode_uint (Unpack * unpack)
-{
- int count;
- int value;
-
- count = 0;
- value = 0;
- while (!schro_unpack_decode_bit (unpack)) {
- count++;
- value <<= 1;
- value |= schro_unpack_decode_bit (unpack);
- }
-
- return (1 << count) - 1 + value;
-}
diff --git a/ext/ogg/dirac_parse.h b/ext/ogg/dirac_parse.h
deleted file mode 100644
index 9dc4ffec..00000000
--- a/ext/ogg/dirac_parse.h
+++ /dev/null
@@ -1,178 +0,0 @@
-
-#ifndef __DIRAC_PARSE_H__
-#define __DIRAC_PARSE_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-typedef enum _SchroParseCode {
- SCHRO_PARSE_CODE_SEQUENCE_HEADER = 0x00,
- SCHRO_PARSE_CODE_END_OF_SEQUENCE = 0x10,
- SCHRO_PARSE_CODE_AUXILIARY_DATA = 0x20,
- SCHRO_PARSE_CODE_PADDING = 0x30,
-
- SCHRO_PARSE_CODE_INTRA_REF = 0x0c,
- SCHRO_PARSE_CODE_INTRA_NON_REF = 0x08,
- SCHRO_PARSE_CODE_INTRA_REF_NOARITH = 0x4c,
- SCHRO_PARSE_CODE_INTRA_NON_REF_NOARITH = 0x48,
-
- SCHRO_PARSE_CODE_INTER_REF_1 = 0x0d,
- SCHRO_PARSE_CODE_INTER_REF_1_NOARITH = 0x4d,
- SCHRO_PARSE_CODE_INTER_REF_2 = 0x0e,
- SCHRO_PARSE_CODE_INTER_REF_2_NOARITH = 0x4e,
-
- SCHRO_PARSE_CODE_INTER_NON_REF_1 = 0x09,
- SCHRO_PARSE_CODE_INTER_NON_REF_1_NOARITH = 0x49,
- SCHRO_PARSE_CODE_INTER_NON_REF_2 = 0x0a,
- SCHRO_PARSE_CODE_INTER_NON_REF_2_NOARITH = 0x4a,
-
- SCHRO_PARSE_CODE_LD_INTRA_REF = 0xcc,
- SCHRO_PARSE_CODE_LD_INTRA_NON_REF = 0xc8
-} SchroParseCode;
-
-#define SCHRO_PARSE_CODE_PICTURE(is_ref,n_refs,is_lowdelay,is_noarith) \
- (8 | ((is_ref)<<2) | (n_refs) | ((is_lowdelay)<<7) | ((is_noarith)<<6))
-
-#define SCHRO_PARSE_CODE_IS_SEQ_HEADER(x) ((x) == SCHRO_PARSE_CODE_SEQUENCE_HEADER)
-#define SCHRO_PARSE_CODE_IS_END_OF_SEQUENCE(x) ((x) == SCHRO_PARSE_CODE_END_OF_SEQUENCE)
-#define SCHRO_PARSE_CODE_IS_AUXILIARY_DATA(x) ((x) == SCHRO_PARSE_CODE_AUXILIARY_DATA)
-#define SCHRO_PARSE_CODE_IS_PADDING(x) ((x) == SCHRO_PARSE_CODE_PADDING)
-#define SCHRO_PARSE_CODE_IS_PICTURE(x) ((x) & 0x8)
-#define SCHRO_PARSE_CODE_IS_LOW_DELAY(x) (((x) & 0x88) == 0x88)
-#define SCHRO_PARSE_CODE_IS_CORE_SYNTAX(x) (((x) & 0x88) == 0x08)
-#define SCHRO_PARSE_CODE_USING_AC(x) (((x) & 0x48) == 0x08)
-#define SCHRO_PARSE_CODE_IS_REFERENCE(x) (((x) & 0xc) == 0x0c)
-#define SCHRO_PARSE_CODE_IS_NON_REFERENCE(x) (((x) & 0xc) == 0x08)
-#define SCHRO_PARSE_CODE_NUM_REFS(x) ((x) & 0x3)
-#define SCHRO_PARSE_CODE_IS_INTRA(x) (SCHRO_PARSE_CODE_IS_PICTURE(x) && SCHRO_PARSE_CODE_NUM_REFS(x) == 0)
-#define SCHRO_PARSE_CODE_IS_INTER(x) (SCHRO_PARSE_CODE_IS_PICTURE(x) && SCHRO_PARSE_CODE_NUM_REFS(x) > 0)
-
-#define SCHRO_PARSE_HEADER_SIZE (4+1+4+4)
-
-typedef enum _SchroVideoFormatEnum {
- SCHRO_VIDEO_FORMAT_CUSTOM = 0,
- SCHRO_VIDEO_FORMAT_QSIF,
- SCHRO_VIDEO_FORMAT_QCIF,
- SCHRO_VIDEO_FORMAT_SIF,
- SCHRO_VIDEO_FORMAT_CIF,
- SCHRO_VIDEO_FORMAT_4SIF,
- SCHRO_VIDEO_FORMAT_4CIF,
- SCHRO_VIDEO_FORMAT_SD480I_60,
- SCHRO_VIDEO_FORMAT_SD576I_50,
- SCHRO_VIDEO_FORMAT_HD720P_60,
- SCHRO_VIDEO_FORMAT_HD720P_50,
- SCHRO_VIDEO_FORMAT_HD1080I_60,
- SCHRO_VIDEO_FORMAT_HD1080I_50,
- SCHRO_VIDEO_FORMAT_HD1080P_60,
- SCHRO_VIDEO_FORMAT_HD1080P_50,
- SCHRO_VIDEO_FORMAT_DC2K_24,
- SCHRO_VIDEO_FORMAT_DC4K_24
-} SchroVideoFormatEnum;
-
-typedef enum _SchroChromaFormat {
- SCHRO_CHROMA_444 = 0,
- SCHRO_CHROMA_422,
- SCHRO_CHROMA_420
-} SchroChromaFormat;
-
-#define SCHRO_CHROMA_FORMAT_H_SHIFT(format) (((format) == SCHRO_CHROMA_444)?0:1)
-#define SCHRO_CHROMA_FORMAT_V_SHIFT(format) (((format) == SCHRO_CHROMA_420)?1:0)
-
-typedef enum _SchroSignalRange {
- SCHRO_SIGNAL_RANGE_CUSTOM = 0,
- SCHRO_SIGNAL_RANGE_8BIT_FULL = 1,
- SCHRO_SIGNAL_RANGE_8BIT_VIDEO = 2,
- SCHRO_SIGNAL_RANGE_10BIT_VIDEO = 3,
- SCHRO_SIGNAL_RANGE_12BIT_VIDEO = 4
-} SchroSignalRange;
-
-typedef enum _SchroColourSpec {
- SCHRO_COLOUR_SPEC_CUSTOM = 0,
- SCHRO_COLOUR_SPEC_SDTV_525 = 1,
- SCHRO_COLOUR_SPEC_SDTV_625 = 2,
- SCHRO_COLOUR_SPEC_HDTV = 3,
- SCHRO_COLOUR_SPEC_CINEMA = 4
-} SchroColourSpec;
-
-typedef enum _SchroColourPrimaries {
- SCHRO_COLOUR_PRIMARY_HDTV = 0,
- SCHRO_COLOUR_PRIMARY_SDTV_525 = 1,
- SCHRO_COLOUR_PRIMARY_SDTV_625 = 2,
- SCHRO_COLOUR_PRIMARY_CINEMA = 3
-} SchroColourPrimaries;
-
-typedef enum _SchroColourMatrix {
- SCHRO_COLOUR_MATRIX_HDTV = 0,
- SCHRO_COLOUR_MATRIX_SDTV = 1,
- SCHRO_COLOUR_MATRIX_REVERSIBLE = 2
-}SchroColourMatrix;
-
-typedef enum _SchroTransferFunction {
- SCHRO_TRANSFER_CHAR_TV_GAMMA = 0,
- SCHRO_TRANSFER_CHAR_EXTENDED_GAMUT = 1,
- SCHRO_TRANSFER_CHAR_LINEAR = 2,
- SCHRO_TRANSFER_CHAR_DCI_GAMMA = 3
-} SchroTransferFunction;
-
-
-
-typedef struct _DiracSequenceHeader DiracSequenceHeader;
-
-struct _DiracSequenceHeader {
- int major_version;
- int minor_version;
- int profile;
- int level;
-
- int index;
- int width;
- int height;
- int chroma_format;
-
- int interlaced;
- int top_field_first;
-
- int frame_rate_numerator;
- int frame_rate_denominator;
- int aspect_ratio_numerator;
- int aspect_ratio_denominator;
-
- int clean_width;
- int clean_height;
- int left_offset;
- int top_offset;
-
- int luma_offset;
- int luma_excursion;
- int chroma_offset;
- int chroma_excursion;
-
- int colour_primaries;
- int colour_matrix;
- int transfer_function;
-
- int interlaced_coding;
-
- int unused0;
- int unused1;
- int unused2;
-};
-
-
-int dirac_sequence_header_parse (DiracSequenceHeader *header,
- unsigned char *data, int length);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/ext/ogg/gstogg.c b/ext/ogg/gstogg.c
deleted file mode 100644
index d525aaa4..00000000
--- a/ext/ogg/gstogg.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-extern gboolean gst_ogg_demux_plugin_init (GstPlugin * plugin);
-extern gboolean gst_ogg_mux_plugin_init (GstPlugin * plugin);
-extern gboolean gst_ogm_parse_plugin_init (GstPlugin * plugin);
-extern gboolean gst_ogg_parse_plugin_init (GstPlugin * plugin);
-extern gboolean gst_ogg_avi_parse_plugin_init (GstPlugin * plugin);
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- gst_ogg_demux_plugin_init (plugin);
- gst_ogg_mux_plugin_init (plugin);
- gst_ogm_parse_plugin_init (plugin);
- gst_ogg_parse_plugin_init (plugin);
- gst_ogg_avi_parse_plugin_init (plugin);
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "ogg",
- "ogg stream manipulation (info about ogg: http://xiph.org)",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/ogg/gstoggaviparse.c b/ext/ogg/gstoggaviparse.c
deleted file mode 100644
index 4b51e01e..00000000
--- a/ext/ogg/gstoggaviparse.c
+++ /dev/null
@@ -1,477 +0,0 @@
-/* GStreamer
- * Copyright (C) 2006 Wim Taymans <wim@fluendo.com>
- *
- * gstoggaviparse.c: ogg avi stream parser
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-/*
- * Ogg in AVI is mostly done for vorbis audio. In the codec_data we receive the
- * first 3 packets of the raw vorbis data. On the sinkpad we receive full-blown Ogg
- * pages.
- * Before extracting the packets out of the ogg pages, we push the raw vorbis
- * header packets to the decoder.
- * We don't use the incomming timestamps but use the ganulepos on the ogg pages
- * directly.
- * This parser only does ogg/vorbis for now.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <gst/gst.h>
-#include <ogg/ogg.h>
-#include <string.h>
-
-static const GstElementDetails gst_ogg_avi_parse_details =
-GST_ELEMENT_DETAILS ("Ogg AVI parser",
- "Codec/Parser",
- "parse an ogg avi stream into pages (info about ogg: http://xiph.org)",
- "Wim Taymans <wim@fluendo.com>");
-
-GST_DEBUG_CATEGORY_STATIC (gst_ogg_avi_parse_debug);
-#define GST_CAT_DEFAULT gst_ogg_avi_parse_debug
-
-#define GST_TYPE_OGG_AVI_PARSE (gst_ogg_avi_parse_get_type())
-#define GST_OGG_AVI_PARSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OGG_AVI_PARSE, GstOggAviParse))
-#define GST_OGG_AVI_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OGG_AVI_PARSE, GstOggAviParse))
-#define GST_IS_OGG_AVI_PARSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OGG_AVI_PARSE))
-#define GST_IS_OGG_AVI_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OGG_AVI_PARSE))
-
-static GType gst_ogg_avi_parse_get_type (void);
-
-typedef struct _GstOggAviParse GstOggAviParse;
-typedef struct _GstOggAviParseClass GstOggAviParseClass;
-
-struct _GstOggAviParse
-{
- GstElement element;
-
- GstPad *sinkpad;
- GstPad *srcpad;
-
- gboolean discont;
- gint serial;
-
- ogg_sync_state sync;
- ogg_stream_state stream;
-};
-
-struct _GstOggAviParseClass
-{
- GstElementClass parent_class;
-};
-
-static void gst_ogg_avi_parse_base_init (gpointer g_class);
-static void gst_ogg_avi_parse_class_init (GstOggAviParseClass * klass);
-static void gst_ogg_avi_parse_init (GstOggAviParse * ogg);
-static GstElementClass *parent_class = NULL;
-
-static GType
-gst_ogg_avi_parse_get_type (void)
-{
- static GType ogg_avi_parse_type = 0;
-
- if (!ogg_avi_parse_type) {
- static const GTypeInfo ogg_avi_parse_info = {
- sizeof (GstOggAviParseClass),
- gst_ogg_avi_parse_base_init,
- NULL,
- (GClassInitFunc) gst_ogg_avi_parse_class_init,
- NULL,
- NULL,
- sizeof (GstOggAviParse),
- 0,
- (GInstanceInitFunc) gst_ogg_avi_parse_init,
- };
-
- ogg_avi_parse_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstOggAviParse",
- &ogg_avi_parse_info, 0);
- }
- return ogg_avi_parse_type;
-}
-
-enum
-{
- PROP_0
-};
-
-static GstStaticPadTemplate ogg_avi_parse_src_template_factory =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-vorbis")
- );
-
-static GstStaticPadTemplate ogg_avi_parse_sink_template_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-ogg-avi")
- );
-
-static void gst_ogg_avi_parse_finalize (GObject * object);
-static GstStateChangeReturn gst_ogg_avi_parse_change_state (GstElement *
- element, GstStateChange transition);
-static gboolean gst_ogg_avi_parse_event (GstPad * pad, GstEvent * event);
-static GstFlowReturn gst_ogg_avi_parse_chain (GstPad * pad, GstBuffer * buffer);
-static gboolean gst_ogg_avi_parse_setcaps (GstPad * pad, GstCaps * caps);
-
-static void
-gst_ogg_avi_parse_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &gst_ogg_avi_parse_details);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&ogg_avi_parse_sink_template_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&ogg_avi_parse_src_template_factory));
-}
-
-static void
-gst_ogg_avi_parse_class_init (GstOggAviParseClass * klass)
-{
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- gstelement_class->change_state = gst_ogg_avi_parse_change_state;
-
- gobject_class->finalize = gst_ogg_avi_parse_finalize;
-}
-
-static void
-gst_ogg_avi_parse_init (GstOggAviParse * ogg)
-{
- /* create the sink and source pads */
- ogg->sinkpad =
- gst_pad_new_from_static_template (&ogg_avi_parse_sink_template_factory,
- "sink");
- gst_pad_set_setcaps_function (ogg->sinkpad, gst_ogg_avi_parse_setcaps);
- gst_pad_set_event_function (ogg->sinkpad, gst_ogg_avi_parse_event);
- gst_pad_set_chain_function (ogg->sinkpad, gst_ogg_avi_parse_chain);
- gst_element_add_pad (GST_ELEMENT (ogg), ogg->sinkpad);
-
- ogg->srcpad =
- gst_pad_new_from_static_template (&ogg_avi_parse_src_template_factory,
- "src");
- gst_pad_use_fixed_caps (ogg->srcpad);
- gst_element_add_pad (GST_ELEMENT (ogg), ogg->srcpad);
-}
-
-static void
-gst_ogg_avi_parse_finalize (GObject * object)
-{
- GstOggAviParse *ogg = GST_OGG_AVI_PARSE (object);
-
- GST_LOG_OBJECT (ogg, "Disposing of object %p", ogg);
-
- ogg_sync_clear (&ogg->sync);
- ogg_stream_clear (&ogg->stream);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static gboolean
-gst_ogg_avi_parse_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstOggAviParse *ogg;
- GstStructure *structure;
- const GValue *codec_data;
- GstBuffer *buffer;
- guint8 *data;
- guint size;
- guint32 sizes[3];
- GstCaps *outcaps;
- gint i, offs;
-
- ogg = GST_OGG_AVI_PARSE (GST_OBJECT_PARENT (pad));
-
- structure = gst_caps_get_structure (caps, 0);
-
- /* take codec data */
- codec_data = gst_structure_get_value (structure, "codec_data");
- if (codec_data == NULL)
- goto no_data;
-
- /* only buffers are valid */
- if (G_VALUE_TYPE (codec_data) != GST_TYPE_BUFFER)
- goto wrong_format;
-
- /* Now parse the data */
- buffer = gst_value_get_buffer (codec_data);
-
- /* first 22 bytes are bits_per_sample, channel_mask, GUID
- * Then we get 3 LE guint32 with the 3 header sizes
- * then we get the bytes of the 3 headers. */
- data = GST_BUFFER_DATA (buffer);
- size = GST_BUFFER_SIZE (buffer);
-
- GST_LOG_OBJECT (ogg, "configuring codec_data of size %u", size);
-
- /* skip headers */
- data += 22;
- size -= 22;
-
- /* we need at least 12 bytes for the packet sizes of the 3 headers */
- if (size < 12)
- goto buffer_too_small;
-
- /* read sizes of the 3 headers */
- sizes[0] = GST_READ_UINT32_LE (data);
- sizes[1] = GST_READ_UINT32_LE (data + 4);
- sizes[2] = GST_READ_UINT32_LE (data + 8);
-
- GST_DEBUG_OBJECT (ogg, "header sizes: %u %u %u", sizes[0], sizes[1],
- sizes[2]);
-
- size -= 12;
-
- /* and we need at least enough data for all the headers */
- if (size < sizes[0] + sizes[1] + sizes[2])
- goto buffer_too_small;
-
- /* set caps */
- outcaps = gst_caps_new_simple ("audio/x-vorbis", NULL);
- gst_pad_set_caps (ogg->srcpad, outcaps);
-
- /* copy header data */
- offs = 34;
- for (i = 0; i < 3; i++) {
- GstBuffer *out;
-
- /* now output the raw vorbis header packets */
- out = gst_buffer_create_sub (buffer, offs, sizes[i]);
- gst_buffer_set_caps (out, outcaps);
- gst_pad_push (ogg->srcpad, out);
-
- offs += sizes[i];
- }
- gst_caps_unref (outcaps);
-
- return TRUE;
-
- /* ERRORS */
-no_data:
- {
- GST_DEBUG_OBJECT (ogg, "no codec_data found in caps");
- return FALSE;
- }
-wrong_format:
- {
- GST_DEBUG_OBJECT (ogg, "codec_data is not a buffer");
- return FALSE;
- }
-buffer_too_small:
- {
- GST_DEBUG_OBJECT (ogg, "codec_data is too small");
- return FALSE;
- }
-}
-
-static gboolean
-gst_ogg_avi_parse_event (GstPad * pad, GstEvent * event)
-{
- GstOggAviParse *ogg;
- gboolean ret;
-
- ogg = GST_OGG_AVI_PARSE (GST_OBJECT_PARENT (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_START:
- ret = gst_pad_push_event (ogg->srcpad, event);
- break;
- case GST_EVENT_FLUSH_STOP:
- ogg_sync_reset (&ogg->sync);
- ogg_stream_reset (&ogg->stream);
- ogg->discont = TRUE;
- ret = gst_pad_push_event (ogg->srcpad, event);
- break;
- default:
- ret = gst_pad_push_event (ogg->srcpad, event);
- break;
- }
- return ret;
-}
-
-static GstFlowReturn
-gst_ogg_avi_parse_push_packet (GstOggAviParse * ogg, ogg_packet * packet)
-{
- GstBuffer *buffer;
- GstFlowReturn result;
-
- /* allocate space for header and body */
- buffer = gst_buffer_new_and_alloc (packet->bytes);
- memcpy (GST_BUFFER_DATA (buffer), packet->packet, packet->bytes);
-
- GST_LOG_OBJECT (ogg, "created buffer %p from page", buffer);
-
- GST_BUFFER_OFFSET_END (buffer) = packet->granulepos;
-
- if (ogg->discont) {
- GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
- ogg->discont = FALSE;
- }
-
- result = gst_pad_push (ogg->srcpad, buffer);
-
- return result;
-}
-
-static GstFlowReturn
-gst_ogg_avi_parse_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstFlowReturn result = GST_FLOW_OK;
- GstOggAviParse *ogg;
- guint8 *data;
- guint size;
- gchar *oggbuf;
- gint ret = -1;
-
- ogg = GST_OGG_AVI_PARSE (GST_OBJECT_PARENT (pad));
-
- data = GST_BUFFER_DATA (buffer);
- size = GST_BUFFER_SIZE (buffer);
-
- GST_LOG_OBJECT (ogg, "Chain function received buffer of size %d", size);
-
- if (GST_BUFFER_IS_DISCONT (buffer)) {
- ogg_sync_reset (&ogg->sync);
- ogg->discont = TRUE;
- }
-
- /* write data to sync layer */
- oggbuf = ogg_sync_buffer (&ogg->sync, size);
- memcpy (oggbuf, data, size);
- ogg_sync_wrote (&ogg->sync, size);
- gst_buffer_unref (buffer);
-
- /* try to get as many packets out of the stream as possible */
- do {
- ogg_page page;
-
- /* try to swap out a page */
- ret = ogg_sync_pageout (&ogg->sync, &page);
- if (ret == 0) {
- GST_DEBUG_OBJECT (ogg, "need more data");
- break;
- } else if (ret == -1) {
- GST_DEBUG_OBJECT (ogg, "discont in pages");
- ogg->discont = TRUE;
- } else {
- /* new unknown stream, init the ogg stream with the serial number of the
- * page. */
- if (ogg->serial == -1) {
- ogg->serial = ogg_page_serialno (&page);
- ogg_stream_init (&ogg->stream, ogg->serial);
- }
-
- /* submit page */
- if (ogg_stream_pagein (&ogg->stream, &page) != 0) {
- GST_WARNING_OBJECT (ogg, "ogg stream choked on page resetting stream");
- ogg_sync_reset (&ogg->sync);
- ogg->discont = TRUE;
- continue;
- }
-
- /* try to get as many packets as possible out of the page */
- do {
- ogg_packet packet;
-
- ret = ogg_stream_packetout (&ogg->stream, &packet);
- GST_LOG_OBJECT (ogg, "packetout gave %d", ret);
- switch (ret) {
- case 0:
- break;
- case -1:
- /* out of sync, We mark a DISCONT. */
- ogg->discont = TRUE;
- break;
- case 1:
- result = gst_ogg_avi_parse_push_packet (ogg, &packet);
- if (GST_FLOW_IS_FATAL (result))
- goto done;
- break;
- default:
- GST_WARNING_OBJECT (ogg,
- "invalid return value %d for ogg_stream_packetout, resetting stream",
- ret);
- break;
- }
- }
- while (ret != 0);
- }
- }
- while (ret != 0);
-
-done:
- return result;
-}
-
-static GstStateChangeReturn
-gst_ogg_avi_parse_change_state (GstElement * element, GstStateChange transition)
-{
- GstOggAviParse *ogg;
- GstStateChangeReturn result = GST_STATE_CHANGE_FAILURE;
-
- ogg = GST_OGG_AVI_PARSE (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- ogg_sync_init (&ogg->sync);
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- ogg_sync_reset (&ogg->sync);
- ogg_stream_reset (&ogg->stream);
- ogg->serial = -1;
- ogg->discont = TRUE;
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- default:
- break;
- }
-
- result = parent_class->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- ogg_sync_clear (&ogg->sync);
- break;
- default:
- break;
- }
- return result;
-}
-
-gboolean
-gst_ogg_avi_parse_plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (gst_ogg_avi_parse_debug, "oggaviparse", 0,
- "ogg avi parser");
-
- return gst_element_register (plugin, "oggaviparse", GST_RANK_PRIMARY,
- GST_TYPE_OGG_AVI_PARSE);
-}
diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c
deleted file mode 100644
index d8f00efb..00000000
--- a/ext/ogg/gstoggdemux.c
+++ /dev/null
@@ -1,3366 +0,0 @@
-/* GStreamer
- * Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
- *
- * gstoggdemux.c: ogg stream demuxer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-/**
- * SECTION:element-oggdemux
- * @see_also: <link linkend="gst-plugins-base-plugins-oggmux">oggmux</link>
- *
- * This element demuxes ogg files into their encoded audio and video components.
- *
- * <refsect2>
- * <title>Example pipelines</title>
- * |[
- * gst-launch -v filesrc location=test.ogg ! oggdemux ! vorbisdec ! audioconvert ! alsasink
- * ]| Decodes the vorbis audio stored inside an ogg container.
- * </refsect2>
- *
- * Last reviewed on 2006-12-30 (0.10.5)
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <string.h>
-#include <gst/gst-i18n-plugin.h>
-#include <gst/tag/tag.h>
-
-#include "gstoggdemux.h"
-
-static const GstElementDetails gst_ogg_demux_details =
-GST_ELEMENT_DETAILS ("Ogg demuxer",
- "Codec/Demuxer",
- "demux ogg streams (info about ogg: http://xiph.org)",
- "Wim Taymans <wim@fluendo.com>");
-
-#define CHUNKSIZE (8500) /* this is out of vorbisfile */
-#define SKELETON_FISHEAD_SIZE 64
-#define SKELETON_FISBONE_MIN_SIZE 52
-
-#define GST_FLOW_LIMIT GST_FLOW_CUSTOM_ERROR
-
-#define GST_CHAIN_LOCK(ogg) g_mutex_lock((ogg)->chain_lock)
-#define GST_CHAIN_UNLOCK(ogg) g_mutex_unlock((ogg)->chain_lock)
-
-GST_DEBUG_CATEGORY (gst_ogg_demux_debug);
-GST_DEBUG_CATEGORY (gst_ogg_demux_setup_debug);
-#define GST_CAT_DEFAULT gst_ogg_demux_debug
-
-
-static ogg_packet *
-_ogg_packet_copy (const ogg_packet * packet)
-{
- ogg_packet *ret = g_new0 (ogg_packet, 1);
-
- *ret = *packet;
- ret->packet = g_memdup (packet->packet, packet->bytes);
-
- return ret;
-}
-
-static void
-_ogg_packet_free (ogg_packet * packet)
-{
- g_free (packet->packet);
- g_free (packet);
-}
-
-static ogg_page *
-gst_ogg_page_copy (ogg_page * page)
-{
- ogg_page *p = g_new0 (ogg_page, 1);
-
- /* make a copy of the page */
- p->header = g_memdup (page->header, page->header_len);
- p->header_len = page->header_len;
- p->body = g_memdup (page->body, page->body_len);
- p->body_len = page->body_len;
-
- return p;
-}
-
-static void
-gst_ogg_page_free (ogg_page * page)
-{
- g_free (page->header);
- g_free (page->body);
- g_free (page);
-}
-
-static gboolean gst_ogg_demux_collect_chain_info (GstOggDemux * ogg,
- GstOggChain * chain);
-static gboolean gst_ogg_demux_activate_chain (GstOggDemux * ogg,
- GstOggChain * chain, GstEvent * event);
-static void gst_ogg_chain_mark_discont (GstOggChain * chain);
-
-static gboolean gst_ogg_demux_perform_seek (GstOggDemux * ogg,
- GstEvent * event);
-static gboolean gst_ogg_demux_receive_event (GstElement * element,
- GstEvent * event);
-
-static void gst_ogg_pad_class_init (GstOggPadClass * klass);
-static void gst_ogg_pad_init (GstOggPad * pad);
-static void gst_ogg_pad_dispose (GObject * object);
-static void gst_ogg_pad_finalize (GObject * object);
-
-static const GstQueryType *gst_ogg_pad_query_types (GstPad * pad);
-static gboolean gst_ogg_pad_src_query (GstPad * pad, GstQuery * query);
-static gboolean gst_ogg_pad_event (GstPad * pad, GstEvent * event);
-static GstCaps *gst_ogg_pad_getcaps (GstPad * pad);
-static GstOggPad *gst_ogg_chain_get_stream (GstOggChain * chain,
- glong serialno);
-
-static GstFlowReturn gst_ogg_demux_combine_flows (GstOggDemux * ogg,
- GstOggPad * pad, GstFlowReturn ret);
-static void gst_ogg_demux_sync_streams (GstOggDemux * ogg);
-
-G_DEFINE_TYPE (GstOggPad, gst_ogg_pad, GST_TYPE_PAD);
-
-static void
-gst_ogg_pad_class_init (GstOggPadClass * klass)
-{
- GObjectClass *gobject_class;
-
- gobject_class = (GObjectClass *) klass;
-
- gobject_class->dispose = gst_ogg_pad_dispose;
- gobject_class->finalize = gst_ogg_pad_finalize;
-}
-
-static void
-gst_ogg_pad_init (GstOggPad * pad)
-{
- gst_pad_set_event_function (GST_PAD (pad),
- GST_DEBUG_FUNCPTR (gst_ogg_pad_event));
- gst_pad_set_getcaps_function (GST_PAD (pad),
- GST_DEBUG_FUNCPTR (gst_ogg_pad_getcaps));
- gst_pad_set_query_type_function (GST_PAD (pad),
- GST_DEBUG_FUNCPTR (gst_ogg_pad_query_types));
- gst_pad_set_query_function (GST_PAD (pad),
- GST_DEBUG_FUNCPTR (gst_ogg_pad_src_query));
-
- pad->mode = GST_OGG_PAD_MODE_INIT;
-
- pad->current_granule = -1;
- pad->keyframe_granule = -1;
-
- pad->start_time = GST_CLOCK_TIME_NONE;
-
- pad->last_stop = GST_CLOCK_TIME_NONE;
-
- pad->have_type = FALSE;
- pad->continued = NULL;
- pad->map.headers = NULL;
- pad->map.queued = NULL;
-}
-
-static void
-gst_ogg_pad_dispose (GObject * object)
-{
- GstOggPad *pad = GST_OGG_PAD (object);
-
- pad->chain = NULL;
- pad->ogg = NULL;
-
- g_list_foreach (pad->map.headers, (GFunc) _ogg_packet_free, NULL);
- g_list_free (pad->map.headers);
- pad->map.headers = NULL;
- g_list_foreach (pad->map.queued, (GFunc) _ogg_packet_free, NULL);
- g_list_free (pad->map.queued);
- pad->map.queued = NULL;
-
- /* clear continued pages */
- g_list_foreach (pad->continued, (GFunc) gst_ogg_page_free, NULL);
- g_list_free (pad->continued);
- pad->continued = NULL;
-
- ogg_stream_reset (&pad->map.stream);
-
- G_OBJECT_CLASS (gst_ogg_pad_parent_class)->dispose (object);
-}
-
-static void
-gst_ogg_pad_finalize (GObject * object)
-{
- GstOggPad *pad = GST_OGG_PAD (object);
-
- ogg_stream_clear (&pad->map.stream);
-
- G_OBJECT_CLASS (gst_ogg_pad_parent_class)->finalize (object);
-}
-
-static const GstQueryType *
-gst_ogg_pad_query_types (GstPad * pad)
-{
- static const GstQueryType query_types[] = {
- GST_QUERY_DURATION,
- GST_QUERY_SEEKING,
- 0
- };
-
- return query_types;
-}
-
-static GstCaps *
-gst_ogg_pad_getcaps (GstPad * pad)
-{
- return gst_caps_ref (GST_PAD_CAPS (pad));
-}
-
-static gboolean
-gst_ogg_pad_src_query (GstPad * pad, GstQuery * query)
-{
- gboolean res = TRUE;
- GstOggDemux *ogg;
-
- ogg = GST_OGG_DEMUX (gst_pad_get_parent (pad));
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_DURATION:
- {
- GstFormat format;
- gint64 total_time;
-
- gst_query_parse_duration (query, &format, NULL);
- /* can only get position in time */
- if (format != GST_FORMAT_TIME)
- goto wrong_format;
-
- if (ogg->pullmode) {
- /* we must return the total length */
- total_time = ogg->total_time;
- } else {
- /* in push mode we can answer the query and we must return -1 */
- total_time = -1;
- }
-
- gst_query_set_duration (query, GST_FORMAT_TIME, total_time);
- break;
- }
- case GST_QUERY_SEEKING:
- {
- GstFormat format;
-
- gst_query_parse_seeking (query, &format, NULL, NULL, NULL);
- if (format == GST_FORMAT_TIME) {
- gst_query_set_seeking (query, GST_FORMAT_TIME, ogg->pullmode,
- 0, ogg->total_time);
- } else {
- res = FALSE;
- }
- break;
- }
-
- default:
- res = gst_pad_query_default (pad, query);
- break;
- }
-done:
- gst_object_unref (ogg);
-
- return res;
-
- /* ERRORS */
-wrong_format:
- {
- GST_DEBUG_OBJECT (ogg, "only query duration on TIME is supported");
- res = FALSE;
- goto done;
- }
-}
-
-static gboolean
-gst_ogg_demux_receive_event (GstElement * element, GstEvent * event)
-{
- gboolean res;
- GstOggDemux *ogg;
-
- ogg = GST_OGG_DEMUX (element);
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:
- /* can't seek if we are not pullmode, FIXME could pass the
- * seek query upstream after converting it to bytes using
- * the average bitrate of the stream. */
- if (!ogg->pullmode) {
- GST_DEBUG_OBJECT (ogg, "seek on pull mode stream not implemented yet");
- goto error;
- }
-
- /* now do the seek */
- res = gst_ogg_demux_perform_seek (ogg, event);
- gst_event_unref (event);
- break;
- default:
- GST_DEBUG_OBJECT (ogg, "We only handle seek events here");
- goto error;
- }
-
- return res;
-
- /* ERRORS */
-error:
- {
- GST_DEBUG_OBJECT (ogg, "error handling event");
- gst_event_unref (event);
- return FALSE;
- }
-}
-
-static gboolean
-gst_ogg_pad_event (GstPad * pad, GstEvent * event)
-{
- gboolean res;
- GstOggDemux *ogg;
-
- ogg = GST_OGG_DEMUX (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:
- /* can't seek if we are not pullmode, FIXME could pass the
- * seek query upstream after converting it to bytes using
- * the average bitrate of the stream. */
- if (!ogg->pullmode) {
- GST_DEBUG_OBJECT (ogg, "seek on pull mode stream not implemented yet");
- goto error;
- }
-
- /* now do the seek */
- res = gst_ogg_demux_perform_seek (ogg, event);
- gst_event_unref (event);
- break;
- default:
- res = gst_pad_event_default (pad, event);
- break;
- }
-done:
- gst_object_unref (ogg);
-
- return res;
-
- /* ERRORS */
-error:
- {
- GST_DEBUG_OBJECT (ogg, "error handling event");
- gst_event_unref (event);
- res = FALSE;
- goto done;
- }
-}
-
-static void
-gst_ogg_pad_reset (GstOggPad * pad)
-{
- ogg_stream_reset (&pad->map.stream);
-
- GST_DEBUG_OBJECT (pad, "doing reset");
-
- /* clear continued pages */
- g_list_foreach (pad->continued, (GFunc) gst_ogg_page_free, NULL);
- g_list_free (pad->continued);
- pad->continued = NULL;
-
- pad->last_ret = GST_FLOW_OK;
- pad->last_stop = GST_CLOCK_TIME_NONE;
- pad->current_granule = -1;
- pad->keyframe_granule = -1;
-}
-
-/* called when the skeleton fishead is found. Caller ensures the packet is
- * precisely the correct size; we don't re-check this here. */
-static void
-gst_ogg_pad_parse_skeleton_fishead (GstOggPad * pad, ogg_packet * packet)
-{
- GstOggDemux *ogg = pad->ogg;
- guint8 *data = packet->packet;
- guint16 major, minor;
- gint64 prestime_n, prestime_d;
- gint64 basetime_n, basetime_d;
-
- /* skip "fishead\0" */
- major = GST_READ_UINT16_LE (data + 8);
- minor = GST_READ_UINT16_LE (data + 10);
- prestime_n = (gint64) GST_READ_UINT64_LE (data + 12);
- prestime_d = (gint64) GST_READ_UINT64_LE (data + 20);
- basetime_n = (gint64) GST_READ_UINT64_LE (data + 28);
- basetime_d = (gint64) GST_READ_UINT64_LE (data + 36);
-
- ogg->basetime = gst_util_uint64_scale (GST_SECOND, basetime_n, basetime_d);
- ogg->prestime = gst_util_uint64_scale (GST_SECOND, prestime_n, prestime_d);
- ogg->have_fishead = TRUE;
- pad->map.is_skeleton = TRUE;
- pad->start_time = GST_CLOCK_TIME_NONE;
- GST_INFO_OBJECT (ogg, "skeleton fishead parsed (basetime: %"
- GST_TIME_FORMAT ", prestime: %" GST_TIME_FORMAT ")",
- GST_TIME_ARGS (ogg->basetime), GST_TIME_ARGS (ogg->prestime));
-}
-
-/* function called when a skeleton fisbone is found. Caller ensures that
- * the packet length is sufficient */
-static void
-gst_ogg_pad_parse_skeleton_fisbone (GstOggPad * pad, ogg_packet * packet)
-{
- GstOggPad *fisbone_pad;
- gint64 start_granule;
- guint32 serialno;
- guint8 *data = packet->packet;
-
- serialno = GST_READ_UINT32_LE (data + 12);
-
- fisbone_pad = gst_ogg_chain_get_stream (pad->chain, serialno);
- if (fisbone_pad) {
- if (fisbone_pad->map.have_fisbone)
- /* already parsed */
- return;
-
- fisbone_pad->map.have_fisbone = TRUE;
-
- fisbone_pad->map.granulerate_n = GST_READ_UINT64_LE (data + 20);
- fisbone_pad->map.granulerate_d = GST_READ_UINT64_LE (data + 28);
- start_granule = GST_READ_UINT64_LE (data + 36);
- fisbone_pad->map.preroll = GST_READ_UINT32_LE (data + 44);
- fisbone_pad->map.granuleshift = GST_READ_UINT8 (data + 48);
-
- GST_INFO_OBJECT (pad->ogg, "skeleton fisbone parsed "
- "(serialno: %08x start time: %" GST_TIME_FORMAT
- " granulerate_n: %d granulerate_d: %d "
- " preroll: %" G_GUINT32_FORMAT " granuleshift: %d)",
- serialno, GST_TIME_ARGS (fisbone_pad->start_time),
- fisbone_pad->map.granulerate_n, fisbone_pad->map.granulerate_d,
- fisbone_pad->map.preroll, fisbone_pad->map.granuleshift);
- } else {
- GST_WARNING_OBJECT (pad->ogg,
- "found skeleton fisbone for an unknown stream %" G_GUINT32_FORMAT,
- serialno);
- }
-}
-
-/* queue data, basically takes the packet, puts it in a buffer and store the
- * buffer in the queued list. */
-static GstFlowReturn
-gst_ogg_demux_queue_data (GstOggPad * pad, ogg_packet * packet)
-{
-#ifndef GST_DISABLE_GST_DEBUG
- GstOggDemux *ogg = pad->ogg;
-#endif
-
- GST_DEBUG_OBJECT (ogg, "%p queueing data serial %08lx", pad,
- pad->map.serialno);
-
- pad->map.queued = g_list_append (pad->map.queued, _ogg_packet_copy (packet));
-
- /* we are ok now */
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet,
- gboolean push_headers)
-{
- GstBuffer *buf = NULL;
- GstFlowReturn ret, cret;
- GstOggDemux *ogg = pad->ogg;
- gint64 current_time;
- GstOggChain *chain;
- gint64 duration;
- gint offset;
- gint trim;
- GstClockTime out_timestamp, out_duration;
- guint64 out_offset, out_offset_end;
- gboolean delta_unit = FALSE;
-
- GST_DEBUG_OBJECT (ogg,
- "%p streaming to peer serial %08lx", pad, pad->map.serialno);
-
- if (pad->map.is_ogm) {
- const guint8 *data;
- long bytes;
-
- data = packet->packet;
- bytes = packet->bytes;
-
- if (bytes < 1)
- goto empty_packet;
-
- if (data[0] & 1) {
- /* We don't push header packets for OGM */
- cret = gst_ogg_demux_combine_flows (ogg, pad, GST_FLOW_OK);
- goto done;
- } else if (data[0] & 3 && pad->map.is_ogm_text) {
- GstTagList *tags;
-
- /* We don't push comment packets either for text streams,
- * other streams will handle the comment packets in the
- * decoder */
- buf = gst_buffer_new ();
-
- GST_BUFFER_DATA (buf) = (guint8 *) data;
- GST_BUFFER_SIZE (buf) = bytes;
-
- tags = gst_tag_list_from_vorbiscomment_buffer (buf,
- (guint8 *) "\003vorbis", 7, NULL);
- gst_buffer_unref (buf);
- buf = NULL;
-
- if (tags) {
- GST_DEBUG_OBJECT (ogg, "tags = %" GST_PTR_FORMAT, tags);
- gst_element_found_tags_for_pad (GST_ELEMENT (ogg), GST_PAD_CAST (pad),
- tags);
- } else {
- GST_DEBUG_OBJECT (ogg, "failed to extract tags from vorbis comment");
- }
-
- cret = gst_ogg_demux_combine_flows (ogg, pad, GST_FLOW_OK);
- goto done;
- }
-
- offset = 1 + (((data[0] & 0xc0) >> 6) | ((data[0] & 0x02) << 1));
- delta_unit = (((data[0] & 0x08) >> 3) == 0);
-
- trim = 0;
-
- /* Strip trailing \0 for subtitles */
- if (pad->map.is_ogm_text) {
- while (bytes && data[bytes - 1] == 0) {
- trim++;
- bytes--;
- }
- }
- } else {
- offset = 0;
- trim = 0;
- }
-
- /* get timing info for the packet */
- duration = gst_ogg_stream_get_packet_duration (&pad->map, packet);
- GST_DEBUG_OBJECT (ogg, "packet duration %" G_GUINT64_FORMAT, duration);
-
- if (packet->b_o_s) {
- out_timestamp = GST_CLOCK_TIME_NONE;
- out_duration = GST_CLOCK_TIME_NONE;
- out_offset = 0;
- out_offset_end = -1;
- } else {
- if (packet->granulepos != -1) {
- pad->current_granule = gst_ogg_stream_granulepos_to_granule (&pad->map,
- packet->granulepos);
- pad->keyframe_granule =
- gst_ogg_stream_granulepos_to_key_granule (&pad->map,
- packet->granulepos);
- GST_DEBUG_OBJECT (ogg, "new granule %" G_GUINT64_FORMAT,
- pad->current_granule);
- } else if (ogg->segment.rate > 0.0 && pad->current_granule != -1) {
- pad->current_granule += duration;
- GST_DEBUG_OBJECT (ogg, "interpollating granule %" G_GUINT64_FORMAT,
- pad->current_granule);
- }
- if (ogg->segment.rate < 0.0 && packet->granulepos == -1) {
- /* negative rates, only set timestamp on the packets with a granulepos */
- out_timestamp = -1;
- out_duration = -1;
- out_offset = -1;
- out_offset_end = -1;
- } else {
- /* we only push buffers after we have a valid granule. This is done so that
- * we nicely skip packets without a timestamp after a seek. This is ok
- * because we base or seek on the packet after the page with the smaller
- * timestamp. */
- if (pad->current_granule == -1)
- goto no_timestamp;
-
- if (pad->map.is_ogm) {
- out_timestamp = gst_ogg_stream_granule_to_time (&pad->map,
- pad->current_granule);
- out_duration = gst_util_uint64_scale (duration,
- GST_SECOND * pad->map.granulerate_d, pad->map.granulerate_n);
- } else if (pad->is_sparse) {
- out_timestamp = gst_ogg_stream_granule_to_time (&pad->map,
- pad->current_granule);
- out_duration = GST_CLOCK_TIME_NONE;
- } else {
- out_timestamp = gst_ogg_stream_granule_to_time (&pad->map,
- pad->current_granule - duration);
- out_duration =
- gst_ogg_stream_granule_to_time (&pad->map,
- pad->current_granule) - out_timestamp;
- }
- out_offset_end =
- gst_ogg_stream_granule_to_granulepos (&pad->map, pad->current_granule,
- pad->keyframe_granule);
- out_offset =
- gst_ogg_stream_granule_to_time (&pad->map, pad->current_granule);
- }
- }
-
- /* check for invalid buffer sizes */
- if (G_UNLIKELY (offset + trim >= packet->bytes))
- goto empty_packet;
-
- ret =
- gst_pad_alloc_buffer_and_set_caps (GST_PAD_CAST (pad),
- GST_BUFFER_OFFSET_NONE, packet->bytes - offset - trim,
- GST_PAD_CAPS (pad), &buf);
-
- /* combine flows */
- cret = gst_ogg_demux_combine_flows (ogg, pad, ret);
- if (ret != GST_FLOW_OK)
- goto no_buffer;
-
- /* set delta flag for OGM content */
- if (delta_unit)
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
-
- /* copy packet in buffer */
- memcpy (buf->data, packet->packet + offset, packet->bytes - offset - trim);
-
- GST_BUFFER_TIMESTAMP (buf) = out_timestamp;
- GST_BUFFER_DURATION (buf) = out_duration;
- GST_BUFFER_OFFSET (buf) = out_offset;
- GST_BUFFER_OFFSET_END (buf) = out_offset_end;
-
- /* Mark discont on the buffer */
- if (pad->discont) {
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
- pad->discont = FALSE;
- }
-
- pad->last_stop = ogg->segment.last_stop;
-
- /* don't push the header packets when we are asked to skip them */
- if (!packet->b_o_s || push_headers) {
- ret = gst_pad_push (GST_PAD_CAST (pad), buf);
- buf = NULL;
-
- /* combine flows */
- cret = gst_ogg_demux_combine_flows (ogg, pad, ret);
- }
-
- /* we're done with skeleton stuff */
- if (pad->map.is_skeleton)
- goto done;
-
- /* check if valid granulepos, then we can calculate the current
- * position. We know the granule for each packet but we only want to update
- * the last_stop when we have a valid granulepos on the packet because else
- * our time jumps around for the different streams. */
- if (packet->granulepos < 0)
- goto done;
-
- /* convert to time */
- current_time = gst_ogg_stream_get_end_time_for_granulepos (&pad->map,
- packet->granulepos);
-
- /* convert to stream time */
- if ((chain = pad->chain)) {
- gint64 chain_start = 0;
-
- if (chain->segment_start != GST_CLOCK_TIME_NONE)
- chain_start = chain->segment_start;
-
- current_time = current_time - chain_start + chain->begin_time;
- }
-
- /* and store as the current position */
- gst_segment_set_last_stop (&ogg->segment, GST_FORMAT_TIME, current_time);
-
- GST_DEBUG_OBJECT (ogg, "ogg current time %" GST_TIME_FORMAT,
- GST_TIME_ARGS (current_time));
-
-done:
- if (buf)
- gst_buffer_unref (buf);
- /* return combined flow result */
- return cret;
-
- /* special cases */
-empty_packet:
- {
- GST_DEBUG_OBJECT (ogg, "Skipping empty packet");
- cret = gst_ogg_demux_combine_flows (ogg, pad, GST_FLOW_OK);
- goto done;
- }
-no_timestamp:
- {
- GST_DEBUG_OBJECT (ogg, "skipping packet: no valid granule found yet");
- cret = gst_ogg_demux_combine_flows (ogg, pad, GST_FLOW_OK);
- goto done;
- }
-no_buffer:
- {
- GST_DEBUG_OBJECT (ogg,
- "%p could not get buffer from peer %08lx, %d (%s), combined %d (%s)",
- pad, pad->map.serialno, ret, gst_flow_get_name (ret),
- cret, gst_flow_get_name (cret));
- goto done;
- }
-}
-
-/* submit a packet to the oggpad, this function will run the
- * typefind code for the pad if this is the first packet for this
- * stream
- */
-static GstFlowReturn
-gst_ogg_pad_submit_packet (GstOggPad * pad, ogg_packet * packet)
-{
- gint64 granule;
- GstFlowReturn ret = GST_FLOW_OK;
-
- GstOggDemux *ogg = pad->ogg;
-
- GST_DEBUG_OBJECT (ogg, "%p submit packet serial %08lx", pad,
- pad->map.serialno);
-
- if (!pad->have_type) {
- if (!ogg->have_fishead && packet->bytes == SKELETON_FISHEAD_SIZE &&
- !memcmp (packet->packet, "fishead\0", 8)) {
- gst_ogg_pad_parse_skeleton_fishead (pad, packet);
- }
- pad->have_type = gst_ogg_stream_setup_map (&pad->map, packet);
- if (!pad->have_type) {
- pad->map.caps = gst_caps_new_simple ("application/x-unknown", NULL);
- }
- if (pad->map.caps) {
- gst_pad_set_caps (GST_PAD (pad), pad->map.caps);
- } else {
- GST_WARNING_OBJECT (ogg, "stream parser didn't create src pad caps");
- }
- }
-
- if (ogg->have_fishead && packet->bytes >= SKELETON_FISBONE_MIN_SIZE &&
- !memcmp (packet->packet, "fisbone\0", 8)) {
- gst_ogg_pad_parse_skeleton_fisbone (pad, packet);
- }
-
- granule = gst_ogg_stream_granulepos_to_granule (&pad->map,
- packet->granulepos);
- if (granule != -1) {
- GST_DEBUG_OBJECT (ogg, "%p has granulepos %" G_GINT64_FORMAT, pad, granule);
- pad->current_granule = granule;
- }
-
- /* restart header packet count when seeing a b_o_s page;
- * particularly useful following a seek or even following chain finding */
- if (packet->b_o_s) {
- GST_DEBUG_OBJECT (ogg, "b_o_s packet, resetting header packet count");
- pad->map.n_header_packets_seen = 0;
- if (!pad->map.have_headers) {
- GST_DEBUG_OBJECT (ogg, "clearing header packets");
- g_list_foreach (pad->map.headers, (GFunc) _ogg_packet_free, NULL);
- g_list_free (pad->map.headers);
- pad->map.headers = NULL;
- }
- }
-
- /* Overload the value of b_o_s in ogg_packet with a flag whether or
- * not this is a header packet. Maybe some day this could be cleaned
- * up. */
- packet->b_o_s = gst_ogg_stream_packet_is_header (&pad->map, packet);
- if (!packet->b_o_s) {
- pad->map.have_headers = TRUE;
- if (pad->start_time == GST_CLOCK_TIME_NONE) {
- gint64 duration = gst_ogg_stream_get_packet_duration (&pad->map, packet);
- GST_DEBUG ("duration %" G_GINT64_FORMAT, duration);
- if (duration != -1) {
- pad->map.accumulated_granule += duration;
- GST_DEBUG ("accumulated granule %" G_GINT64_FORMAT,
- pad->map.accumulated_granule);
- }
-
- if (packet->granulepos != -1) {
- ogg_int64_t start_granule;
- gint64 granule;
-
- granule = gst_ogg_stream_granulepos_to_granule (&pad->map,
- packet->granulepos);
-
- if (granule > pad->map.accumulated_granule)
- start_granule = granule - pad->map.accumulated_granule;
- else
- start_granule = 0;
-
- pad->start_time = gst_ogg_stream_granule_to_time (&pad->map,
- start_granule);
- GST_DEBUG ("start time %" G_GINT64_FORMAT, pad->start_time);
- } else {
- packet->granulepos = gst_ogg_stream_granule_to_granulepos (&pad->map,
- pad->map.accumulated_granule, pad->keyframe_granule);
- }
- }
- } else {
- pad->map.n_header_packets_seen++;
- if (!pad->map.have_headers) {
- pad->map.headers =
- g_list_append (pad->map.headers, _ogg_packet_copy (packet));
- GST_DEBUG ("keeping header packet %d", pad->map.n_header_packets_seen);
- }
- }
-
- /* we know the start_time of the pad data, see if we
- * can activate the complete chain if this is a dynamic
- * chain. */
- if (pad->start_time != GST_CLOCK_TIME_NONE) {
- GstOggChain *chain = pad->chain;
-
- /* check if complete chain has start time */
- if (chain == ogg->building_chain) {
-
- /* see if we have enough info to activate the chain, we have enough info
- * when all streams have a valid start time. */
- if (gst_ogg_demux_collect_chain_info (ogg, chain)) {
- GstEvent *event;
-
- GST_DEBUG_OBJECT (ogg, "segment_start: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (chain->segment_start));
- GST_DEBUG_OBJECT (ogg, "segment_stop: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (chain->segment_stop));
- GST_DEBUG_OBJECT (ogg, "segment_time: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (chain->begin_time));
-
- /* create the newsegment event we are going to send out */
- event = gst_event_new_new_segment (FALSE, ogg->segment.rate,
- GST_FORMAT_TIME, chain->segment_start, chain->segment_stop,
- chain->begin_time);
- gst_event_set_seqnum (event, ogg->seqnum);
-
- gst_ogg_demux_activate_chain (ogg, chain, event);
-
- ogg->building_chain = NULL;
- }
- }
- }
-
- /* if we are building a chain, store buffer for when we activate
- * it. This path is taken if we operate in streaming mode. */
- if (ogg->building_chain) {
- /* bos packets where stored in the header list so we can discard
- * them here*/
- if (!packet->b_o_s)
- ret = gst_ogg_demux_queue_data (pad, packet);
- }
- /* else we are completely streaming to the peer */
- else {
- ret = gst_ogg_demux_chain_peer (pad, packet, !ogg->pullmode);
- }
- return ret;
-}
-
-/* flush at most @npackets from the stream layer. All packets if
- * @npackets is 0;
- */
-static GstFlowReturn
-gst_ogg_pad_stream_out (GstOggPad * pad, gint npackets)
-{
- GstFlowReturn result = GST_FLOW_OK;
- gboolean done = FALSE;
- GstOggDemux *ogg;
-
- ogg = pad->ogg;
-
- while (!done) {
- int ret;
- ogg_packet packet;
-
- ret = ogg_stream_packetout (&pad->map.stream, &packet);
- switch (ret) {
- case 0:
- GST_LOG_OBJECT (ogg, "packetout done");
- done = TRUE;
- break;
- case -1:
- GST_LOG_OBJECT (ogg, "packetout discont");
- gst_ogg_chain_mark_discont (pad->chain);
- break;
- case 1:
- GST_LOG_OBJECT (ogg, "packetout gave packet of size %ld", packet.bytes);
- result = gst_ogg_pad_submit_packet (pad, &packet);
- if (GST_FLOW_IS_FATAL (result))
- goto could_not_submit;
- break;
- default:
- GST_WARNING_OBJECT (ogg,
- "invalid return value %d for ogg_stream_packetout, resetting stream",
- ret);
- gst_ogg_pad_reset (pad);
- break;
- }
- if (npackets > 0) {
- npackets--;
- done = (npackets == 0);
- }
- }
- return result;
-
- /* ERRORS */
-could_not_submit:
- {
- GST_WARNING_OBJECT (ogg,
- "could not submit packet for stream %08lx, error: %d",
- pad->map.serialno, result);
- gst_ogg_pad_reset (pad);
- return result;
- }
-}
-
-/* submit a page to an oggpad, this function will then submit all
- * the packets in the page.
- */
-static GstFlowReturn
-gst_ogg_pad_submit_page (GstOggPad * pad, ogg_page * page)
-{
- GstFlowReturn result = GST_FLOW_OK;
- GstOggDemux *ogg;
- gboolean continued = FALSE;
-
- ogg = pad->ogg;
-
- /* for negative rates we read pages backwards and must therefore be carefull
- * with continued pages */
- if (ogg->segment.rate < 0.0) {
- gint npackets;
-
- continued = ogg_page_continued (page);
-
- /* number of completed packets in the page */
- npackets = ogg_page_packets (page);
- if (!continued) {
- /* page is not continued so it contains at least one packet start. It's
- * possible that no packet ends on this page (npackets == 0). In that
- * case, the next (continued) page(s) we kept contain the remainder of the
- * packets. We mark npackets=1 to make us start decoding the pages in the
- * remainder of the algorithm. */
- if (npackets == 0)
- npackets = 1;
- }
- GST_LOG_OBJECT (ogg, "continued: %d, %d packets", continued, npackets);
-
- if (npackets == 0) {
- GST_LOG_OBJECT (ogg, "no decodable packets, we need a previous page");
- goto done;
- }
- }
-
- if (ogg_stream_pagein (&pad->map.stream, page) != 0)
- goto choked;
-
- /* flush all packets in the stream layer, this might not give a packet if
- * the page had no packets finishing on the page (npackets == 0). */
- result = gst_ogg_pad_stream_out (pad, 0);
-
- if (pad->continued) {
- ogg_packet packet;
-
- /* now send the continued pages to the stream layer */
- while (pad->continued) {
- ogg_page *p = (ogg_page *) pad->continued->data;
-
- GST_LOG_OBJECT (ogg, "submitting continued page %p", p);
- if (ogg_stream_pagein (&pad->map.stream, p) != 0)
- goto choked;
-
- pad->continued = g_list_delete_link (pad->continued, pad->continued);
-
- /* free the page */
- gst_ogg_page_free (p);
- }
-
- GST_LOG_OBJECT (ogg, "flushing last continued packet");
- /* flush 1 continued packet in the stream layer */
- result = gst_ogg_pad_stream_out (pad, 1);
-
- /* flush all remaining packets, we pushed them in the previous round.
- * We don't use _reset() because we still want to get the discont when
- * we submit a next page. */
- while (ogg_stream_packetout (&pad->map.stream, &packet) != 0);
- }
-
-done:
- /* keep continued pages (only in reverse mode) */
- if (continued) {
- ogg_page *p = gst_ogg_page_copy (page);
-
- GST_LOG_OBJECT (ogg, "keeping continued page %p", p);
- pad->continued = g_list_prepend (pad->continued, p);
- }
-
- return result;
-
-choked:
- {
- GST_WARNING_OBJECT (ogg,
- "ogg stream choked on page (serial %08lx), resetting stream",
- pad->map.serialno);
- gst_ogg_pad_reset (pad);
- /* we continue to recover */
- return GST_FLOW_OK;
- }
-}
-
-
-static GstOggChain *
-gst_ogg_chain_new (GstOggDemux * ogg)
-{
- GstOggChain *chain = g_new0 (GstOggChain, 1);
-
- GST_DEBUG_OBJECT (ogg, "creating new chain %p", chain);
- chain->ogg = ogg;
- chain->offset = -1;
- chain->bytes = -1;
- chain->have_bos = FALSE;
- chain->streams = g_array_new (FALSE, TRUE, sizeof (GstOggPad *));
- chain->begin_time = GST_CLOCK_TIME_NONE;
- chain->segment_start = GST_CLOCK_TIME_NONE;
- chain->segment_stop = GST_CLOCK_TIME_NONE;
- chain->total_time = GST_CLOCK_TIME_NONE;
-
- return chain;
-}
-
-static void
-gst_ogg_chain_free (GstOggChain * chain)
-{
- gint i;
-
- for (i = 0; i < chain->streams->len; i++) {
- GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
-
- gst_object_unref (pad);
- }
- g_array_free (chain->streams, TRUE);
- g_free (chain);
-}
-
-static void
-gst_ogg_chain_mark_discont (GstOggChain * chain)
-{
- gint i;
-
- for (i = 0; i < chain->streams->len; i++) {
- GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
-
- pad->discont = TRUE;
- pad->map.last_size = 0;
- }
-}
-
-static void
-gst_ogg_chain_reset (GstOggChain * chain)
-{
- gint i;
-
- for (i = 0; i < chain->streams->len; i++) {
- GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
-
- gst_ogg_pad_reset (pad);
- }
-}
-
-static GstOggPad *
-gst_ogg_chain_new_stream (GstOggChain * chain, glong serialno)
-{
- GstOggPad *ret;
- GstTagList *list;
- gchar *name;
-
- GST_DEBUG_OBJECT (chain->ogg, "creating new stream %08lx in chain %p",
- serialno, chain);
-
- ret = g_object_new (GST_TYPE_OGG_PAD, NULL);
- /* we own this one */
- gst_object_ref (ret);
- gst_object_sink (ret);
-
- GST_PAD_DIRECTION (ret) = GST_PAD_SRC;
- ret->discont = TRUE;
- ret->map.last_size = 0;
-
- ret->chain = chain;
- ret->ogg = chain->ogg;
-
- ret->map.serialno = serialno;
- if (ogg_stream_init (&ret->map.stream, serialno) != 0)
- goto init_failed;
-
- name = g_strdup_printf ("serial_%08lx", serialno);
- gst_object_set_name (GST_OBJECT (ret), name);
- g_free (name);
-
- /* FIXME: either do something with it or remove it */
- list = gst_tag_list_new ();
- gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_SERIAL, serialno,
- NULL);
- gst_tag_list_free (list);
-
- GST_DEBUG_OBJECT (chain->ogg,
- "created new ogg src %p for stream with serial %08lx", ret, serialno);
-
- g_array_append_val (chain->streams, ret);
-
- return ret;
-
- /* ERRORS */
-init_failed:
- {
- GST_ERROR ("Could not initialize ogg_stream struct for serial %08lx.",
- serialno);
- gst_object_unref (ret);
- return NULL;
- }
-}
-
-static GstOggPad *
-gst_ogg_chain_get_stream (GstOggChain * chain, glong serialno)
-{
- gint i;
-
- for (i = 0; i < chain->streams->len; i++) {
- GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
-
- if (pad->map.serialno == serialno)
- return pad;
- }
- return NULL;
-}
-
-static gboolean
-gst_ogg_chain_has_stream (GstOggChain * chain, glong serialno)
-{
- return gst_ogg_chain_get_stream (chain, serialno) != NULL;
-}
-
-#define CURRENT_CHAIN(ogg) (&g_array_index ((ogg)->chains, GstOggChain, (ogg)->current_chain))
-
-/* signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- ARG_0
- /* FILL ME */
-};
-
-static GstStaticPadTemplate ogg_demux_src_template_factory =
-GST_STATIC_PAD_TEMPLATE ("src_%d",
- GST_PAD_SRC,
- GST_PAD_SOMETIMES,
- GST_STATIC_CAPS_ANY);
-
-static GstStaticPadTemplate ogg_demux_sink_template_factory =
- GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/ogg; application/x-annodex")
- );
-
-static void gst_ogg_demux_finalize (GObject * object);
-
-static GstFlowReturn gst_ogg_demux_read_chain (GstOggDemux * ogg,
- GstOggChain ** chain);
-static GstFlowReturn gst_ogg_demux_read_end_chain (GstOggDemux * ogg,
- GstOggChain * chain);
-
-static gboolean gst_ogg_demux_sink_event (GstPad * pad, GstEvent * event);
-static void gst_ogg_demux_loop (GstOggPad * pad);
-static GstFlowReturn gst_ogg_demux_chain (GstPad * pad, GstBuffer * buffer);
-static gboolean gst_ogg_demux_sink_activate (GstPad * sinkpad);
-static gboolean gst_ogg_demux_sink_activate_pull (GstPad * sinkpad,
- gboolean active);
-static gboolean gst_ogg_demux_sink_activate_push (GstPad * sinkpad,
- gboolean active);
-static GstStateChangeReturn gst_ogg_demux_change_state (GstElement * element,
- GstStateChange transition);
-static void gst_ogg_demux_send_event (GstOggDemux * ogg, GstEvent * event);
-
-static void gst_ogg_print (GstOggDemux * demux);
-
-GST_BOILERPLATE (GstOggDemux, gst_ogg_demux, GstElement, GST_TYPE_ELEMENT);
-
-static void
-gst_ogg_demux_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &gst_ogg_demux_details);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&ogg_demux_sink_template_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&ogg_demux_src_template_factory));
-}
-
-static void
-gst_ogg_demux_class_init (GstOggDemuxClass * klass)
-{
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gstelement_class->change_state = gst_ogg_demux_change_state;
- gstelement_class->send_event = gst_ogg_demux_receive_event;
-
- gobject_class->finalize = gst_ogg_demux_finalize;
-}
-
-static void
-gst_ogg_demux_init (GstOggDemux * ogg, GstOggDemuxClass * g_class)
-{
- /* create the sink pad */
- ogg->sinkpad =
- gst_pad_new_from_static_template (&ogg_demux_sink_template_factory,
- "sink");
-
- gst_pad_set_event_function (ogg->sinkpad, gst_ogg_demux_sink_event);
- gst_pad_set_chain_function (ogg->sinkpad, gst_ogg_demux_chain);
- gst_pad_set_activate_function (ogg->sinkpad, gst_ogg_demux_sink_activate);
- gst_pad_set_activatepull_function (ogg->sinkpad,
- gst_ogg_demux_sink_activate_pull);
- gst_pad_set_activatepush_function (ogg->sinkpad,
- gst_ogg_demux_sink_activate_push);
- gst_element_add_pad (GST_ELEMENT (ogg), ogg->sinkpad);
-
- ogg->chain_lock = g_mutex_new ();
- ogg->chains = g_array_new (FALSE, TRUE, sizeof (GstOggChain *));
-
- ogg->newsegment = NULL;
-}
-
-static void
-gst_ogg_demux_finalize (GObject * object)
-{
- GstOggDemux *ogg;
-
- ogg = GST_OGG_DEMUX (object);
-
- g_array_free (ogg->chains, TRUE);
- g_mutex_free (ogg->chain_lock);
- ogg_sync_clear (&ogg->sync);
-
- if (ogg->newsegment)
- gst_event_unref (ogg->newsegment);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static gboolean
-gst_ogg_demux_sink_event (GstPad * pad, GstEvent * event)
-{
- gboolean res;
- GstOggDemux *ogg;
-
- ogg = GST_OGG_DEMUX (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:
- /* FIXME */
- GST_DEBUG_OBJECT (ogg, "got a new segment event");
- ogg_sync_reset (&ogg->sync);
- gst_event_unref (event);
- res = TRUE;
- break;
- case GST_EVENT_EOS:
- {
- GST_DEBUG_OBJECT (ogg, "got an EOS event");
- res = gst_pad_event_default (pad, event);
- if (ogg->current_chain == NULL) {
- GST_ELEMENT_ERROR (ogg, STREAM, DEMUX, (NULL),
- ("can't get first chain"));
- }
- break;
- }
- default:
- res = gst_pad_event_default (pad, event);
- break;
- }
- gst_object_unref (ogg);
-
- return res;
-}
-
-/* submit the given buffer to the ogg sync.
- *
- * Returns the number of bytes submited.
- */
-static GstFlowReturn
-gst_ogg_demux_submit_buffer (GstOggDemux * ogg, GstBuffer * buffer)
-{
- gint size;
- guint8 *data;
- gchar *oggbuffer;
- GstFlowReturn ret = GST_FLOW_OK;
-
- size = GST_BUFFER_SIZE (buffer);
- data = GST_BUFFER_DATA (buffer);
-
- GST_DEBUG_OBJECT (ogg, "submitting %u bytes", size);
- if (G_UNLIKELY (size == 0))
- goto done;
-
- oggbuffer = ogg_sync_buffer (&ogg->sync, size);
- if (G_UNLIKELY (oggbuffer == NULL))
- goto no_buffer;
-
- memcpy (oggbuffer, data, size);
- if (G_UNLIKELY (ogg_sync_wrote (&ogg->sync, size) < 0))
- goto write_failed;
-
-done:
- gst_buffer_unref (buffer);
-
- return ret;
-
- /* ERRORS */
-no_buffer:
- {
- GST_ELEMENT_ERROR (ogg, STREAM, DECODE,
- (NULL), ("failed to get ogg sync buffer"));
- ret = GST_FLOW_ERROR;
- goto done;
- }
-write_failed:
- {
- GST_ELEMENT_ERROR (ogg, STREAM, DECODE,
- (NULL), ("failed to write %d bytes to the sync buffer", size));
- ret = GST_FLOW_ERROR;
- goto done;
- }
-}
-
-/* in random access mode this code updates the current read position
- * and resets the ogg sync buffer so that the next read will happen
- * from this new location.
- */
-static void
-gst_ogg_demux_seek (GstOggDemux * ogg, gint64 offset)
-{
- GST_LOG_OBJECT (ogg, "seeking to %" G_GINT64_FORMAT, offset);
-
- ogg->offset = offset;
- ogg->read_offset = offset;
- ogg_sync_reset (&ogg->sync);
-}
-
-/* read more data from the current offset and submit to
- * the ogg sync layer.
- */
-static GstFlowReturn
-gst_ogg_demux_get_data (GstOggDemux * ogg, gint64 end_offset)
-{
- GstFlowReturn ret;
- GstBuffer *buffer;
-
- GST_LOG_OBJECT (ogg,
- "get data %" G_GINT64_FORMAT " %" G_GINT64_FORMAT " %" G_GINT64_FORMAT,
- ogg->read_offset, ogg->length, end_offset);
-
- if (end_offset > 0 && ogg->read_offset >= end_offset)
- goto boundary_reached;
-
- if (ogg->read_offset == ogg->length)
- goto eos;
-
- ret = gst_pad_pull_range (ogg->sinkpad, ogg->read_offset, CHUNKSIZE, &buffer);
- if (ret != GST_FLOW_OK)
- goto error;
-
- ogg->read_offset += GST_BUFFER_SIZE (buffer);
-
- ret = gst_ogg_demux_submit_buffer (ogg, buffer);
-
- return ret;
-
- /* ERROR */
-boundary_reached:
- {
- GST_LOG_OBJECT (ogg, "reached boundary");
- return GST_FLOW_LIMIT;
- }
-eos:
- {
- GST_LOG_OBJECT (ogg, "reached EOS");
- return GST_FLOW_UNEXPECTED;
- }
-error:
- {
- GST_WARNING_OBJECT (ogg, "got %d (%s) from pull range", ret,
- gst_flow_get_name (ret));
- return ret;
- }
-}
-
-/* Read the next page from the current offset.
- * boundary: number of bytes ahead we allow looking for;
- * -1 if no boundary
- *
- * @offset will contain the offset the next page starts at when this function
- * returns GST_FLOW_OK.
- *
- * GST_FLOW_UNEXPECTED is returned on EOS.
- *
- * GST_FLOW_LIMIT is returned when we did not find a page before the
- * boundary. If @boundary is -1, this is never returned.
- *
- * Any other error returned while retrieving data from the peer is returned as
- * is.
- */
-static GstFlowReturn
-gst_ogg_demux_get_next_page (GstOggDemux * ogg, ogg_page * og, gint64 boundary,
- gint64 * offset)
-{
- gint64 end_offset = -1;
- GstFlowReturn ret;
-
- GST_LOG_OBJECT (ogg,
- "get next page, current offset %" G_GINT64_FORMAT ", bytes boundary %"
- G_GINT64_FORMAT, ogg->offset, boundary);
-
- if (boundary >= 0)
- end_offset = ogg->offset + boundary;
-
- while (TRUE) {
- glong more;
-
- if (end_offset > 0 && ogg->offset >= end_offset)
- goto boundary_reached;
-
- more = ogg_sync_pageseek (&ogg->sync, og);
-
- GST_LOG_OBJECT (ogg, "pageseek gave %ld", more);
-
- if (more < 0) {
- /* skipped n bytes */
- ogg->offset -= more;
- GST_LOG_OBJECT (ogg, "skipped %ld bytes, offset %" G_GINT64_FORMAT, more,
- ogg->offset);
- } else if (more == 0) {
- /* we need more data */
- if (boundary == 0)
- goto boundary_reached;
-
- GST_LOG_OBJECT (ogg, "need more data");
- ret = gst_ogg_demux_get_data (ogg, end_offset);
- if (ret != GST_FLOW_OK)
- break;
- } else {
- gint64 res_offset = ogg->offset;
-
- /* got a page. Return the offset at the page beginning,
- advance the internal offset past the page end */
- if (offset)
- *offset = res_offset;
- ret = GST_FLOW_OK;
-
- ogg->offset += more;
-
- GST_LOG_OBJECT (ogg,
- "got page at %" G_GINT64_FORMAT ", serial %08x, end at %"
- G_GINT64_FORMAT ", granule %" G_GINT64_FORMAT, res_offset,
- ogg_page_serialno (og), ogg->offset,
- (gint64) ogg_page_granulepos (og));
- break;
- }
- }
- GST_LOG_OBJECT (ogg, "returning %d", ret);
-
- return ret;
-
- /* ERRORS */
-boundary_reached:
- {
- GST_LOG_OBJECT (ogg,
- "offset %" G_GINT64_FORMAT " >= end_offset %" G_GINT64_FORMAT,
- ogg->offset, end_offset);
- return GST_FLOW_LIMIT;
- }
-}
-
-/* from the current offset, find the previous page, seeking backwards
- * until we find the page.
- */
-static GstFlowReturn
-gst_ogg_demux_get_prev_page (GstOggDemux * ogg, ogg_page * og, gint64 * offset)
-{
- GstFlowReturn ret;
- gint64 begin = ogg->offset;
- gint64 end = begin;
- gint64 cur_offset = -1;
-
- GST_LOG_OBJECT (ogg, "getting page before %" G_GINT64_FORMAT, begin);
-
- while (cur_offset == -1) {
- begin -= CHUNKSIZE;
- if (begin < 0)
- begin = 0;
-
- /* seek CHUNKSIZE back */
- gst_ogg_demux_seek (ogg, begin);
-
- /* now continue reading until we run out of data, if we find a page
- * start, we save it. It might not be the final page as there could be
- * another page after this one. */
- while (ogg->offset < end) {
- gint64 new_offset;
-
- ret =
- gst_ogg_demux_get_next_page (ogg, og, end - ogg->offset, &new_offset);
- /* we hit the upper limit, offset contains the last page start */
- if (ret == GST_FLOW_LIMIT) {
- GST_LOG_OBJECT (ogg, "hit limit");
- break;
- }
- /* something went wrong */
- if (ret == GST_FLOW_UNEXPECTED) {
- new_offset = 0;
- GST_LOG_OBJECT (ogg, "got unexpected");
- } else if (ret != GST_FLOW_OK) {
- GST_LOG_OBJECT (ogg, "got error %d", ret);
- return ret;
- }
-
- GST_LOG_OBJECT (ogg, "found page at %" G_GINT64_FORMAT, new_offset);
-
- /* offset is next page start */
- cur_offset = new_offset;
- }
- }
-
- GST_LOG_OBJECT (ogg, "found previous page at %" G_GINT64_FORMAT, cur_offset);
-
- /* we have the offset. Actually snork and hold the page now */
- gst_ogg_demux_seek (ogg, cur_offset);
- ret = gst_ogg_demux_get_next_page (ogg, og, -1, NULL);
- if (ret != GST_FLOW_OK) {
- GST_WARNING_OBJECT (ogg, "can't get last page at %" G_GINT64_FORMAT,
- cur_offset);
- /* this shouldn't be possible */
- return ret;
- }
-
- if (offset)
- *offset = cur_offset;
-
- return ret;
-}
-
-static gboolean
-gst_ogg_demux_deactivate_current_chain (GstOggDemux * ogg)
-{
- gint i;
- GstOggChain *chain = ogg->current_chain;
-
- if (chain == NULL)
- return TRUE;
-
- GST_DEBUG_OBJECT (ogg, "deactivating chain %p", chain);
-
- /* send EOS on all the pads */
- for (i = 0; i < chain->streams->len; i++) {
- GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
- GstEvent *event;
-
- if (!pad->added)
- continue;
-
- event = gst_event_new_eos ();
- gst_event_set_seqnum (event, ogg->seqnum);
- gst_pad_push_event (GST_PAD_CAST (pad), event);
-
- GST_DEBUG_OBJECT (ogg, "removing pad %" GST_PTR_FORMAT, pad);
-
- /* deactivate first */
- gst_pad_set_active (GST_PAD_CAST (pad), FALSE);
-
- gst_element_remove_pad (GST_ELEMENT (ogg), GST_PAD_CAST (pad));
-
- pad->added = FALSE;
- }
- /* if we cannot seek back to the chain, we can destroy the chain
- * completely */
- if (!ogg->pullmode) {
- gst_ogg_chain_free (chain);
- }
- ogg->current_chain = NULL;
-
- return TRUE;
-}
-
-static gboolean
-gst_ogg_demux_activate_chain (GstOggDemux * ogg, GstOggChain * chain,
- GstEvent * event)
-{
- gint i;
-
- if (chain == ogg->current_chain) {
- if (event)
- gst_event_unref (event);
- return TRUE;
- }
-
- /* FIXME, should not be called with NULL */
- if (chain != NULL) {
- GST_DEBUG_OBJECT (ogg, "activating chain %p", chain);
-
- /* first add the pads */
- for (i = 0; i < chain->streams->len; i++) {
- GstOggPad *pad;
- GstStructure *structure;
-
- pad = g_array_index (chain->streams, GstOggPad *, i);
-
- if (pad->map.is_skeleton || pad->added || GST_PAD_CAPS (pad) == NULL)
- continue;
-
- GST_DEBUG_OBJECT (ogg, "adding pad %" GST_PTR_FORMAT, pad);
-
- /* mark discont */
- pad->discont = TRUE;
- pad->map.last_size = 0;
- pad->last_ret = GST_FLOW_OK;
- pad->added = TRUE;
-
- structure = gst_caps_get_structure (GST_PAD_CAPS (pad), 0);
- pad->is_sparse =
- gst_structure_has_name (structure, "application/x-ogm-text") ||
- gst_structure_has_name (structure, "text/x-cmml") ||
- gst_structure_has_name (structure, "subtitle/x-kate") ||
- gst_structure_has_name (structure, "application/x-kate");
-
- /* activate first */
- gst_pad_set_active (GST_PAD_CAST (pad), TRUE);
-
- gst_element_add_pad (GST_ELEMENT (ogg), GST_PAD_CAST (pad));
- }
- }
-
- /* after adding the new pads, remove the old pads */
- gst_ogg_demux_deactivate_current_chain (ogg);
-
- ogg->current_chain = chain;
-
- /* we are finished now */
- gst_element_no_more_pads (GST_ELEMENT (ogg));
-
- /* FIXME, must be sent from the streaming thread */
- if (event) {
- gst_ogg_demux_send_event (ogg, event);
-
- gst_element_found_tags (GST_ELEMENT_CAST (ogg),
- gst_tag_list_new_full (GST_TAG_CONTAINER_FORMAT, "Ogg", NULL));
- }
-
- GST_DEBUG_OBJECT (ogg, "starting chain");
-
- /* then send out any headers and queued packets */
- for (i = 0; i < chain->streams->len; i++) {
- GList *walk;
- GstOggPad *pad;
-
- pad = g_array_index (chain->streams, GstOggPad *, i);
-
- GST_DEBUG_OBJECT (ogg, "pushing headers");
- /* push headers */
- for (walk = pad->map.headers; walk; walk = g_list_next (walk)) {
- ogg_packet *p = walk->data;
-
- gst_ogg_demux_chain_peer (pad, p, TRUE);
- }
-
- GST_DEBUG_OBJECT (ogg, "pushing queued buffers");
- /* push queued packets */
- for (walk = pad->map.queued; walk; walk = g_list_next (walk)) {
- ogg_packet *p = walk->data;
-
- gst_ogg_demux_chain_peer (pad, p, TRUE);
- _ogg_packet_free (p);
- }
- /* and free the queued buffers */
- g_list_free (pad->map.queued);
- pad->map.queued = NULL;
- }
- return TRUE;
-}
-
-static gboolean
-do_binary_search (GstOggDemux * ogg, GstOggChain * chain, gint64 begin,
- gint64 end, gint64 begintime, gint64 endtime, gint64 target,
- gint64 * offset)
-{
- gint64 best;
- GstFlowReturn ret;
- gint64 result = 0;
-
- best = begin;
-
- GST_DEBUG_OBJECT (ogg,
- "chain offset %" G_GINT64_FORMAT ", end offset %" G_GINT64_FORMAT, begin,
- end);
- GST_DEBUG_OBJECT (ogg,
- "chain begin time %" GST_TIME_FORMAT ", end time %" GST_TIME_FORMAT,
- GST_TIME_ARGS (begintime), GST_TIME_ARGS (endtime));
- GST_DEBUG_OBJECT (ogg, "target %" GST_TIME_FORMAT, GST_TIME_ARGS (target));
-
- /* perform the seek */
- while (begin < end) {
- gint64 bisect;
-
- if ((end - begin < CHUNKSIZE) || (endtime == begintime)) {
- bisect = begin;
- } else {
- /* take a (pretty decent) guess, avoiding overflow */
- gint64 rate = (end - begin) * GST_MSECOND / (endtime - begintime);
-
- bisect = (target - begintime) / GST_MSECOND * rate + begin - CHUNKSIZE;
-
- if (bisect <= begin)
- bisect = begin;
- GST_DEBUG_OBJECT (ogg, "Initial guess: %" G_GINT64_FORMAT, bisect);
- }
- gst_ogg_demux_seek (ogg, bisect);
-
- while (begin < end) {
- ogg_page og;
-
- GST_DEBUG_OBJECT (ogg,
- "after seek, bisect %" G_GINT64_FORMAT ", begin %" G_GINT64_FORMAT
- ", end %" G_GINT64_FORMAT, bisect, begin, end);
-
- ret = gst_ogg_demux_get_next_page (ogg, &og, end - ogg->offset, &result);
- GST_LOG_OBJECT (ogg, "looking for next page returned %" G_GINT64_FORMAT,
- result);
-
- if (ret == GST_FLOW_LIMIT) {
- /* we hit the upper limit, go back a bit */
- if (bisect <= begin + 1) {
- end = begin; /* found it */
- } else {
- if (bisect == 0)
- goto seek_error;
-
- bisect -= CHUNKSIZE;
- if (bisect <= begin)
- bisect = begin + 1;
-
- gst_ogg_demux_seek (ogg, bisect);
- }
- } else if (ret == GST_FLOW_OK) {
- /* found offset of next ogg page */
- gint64 granulepos;
- GstClockTime granuletime;
- GstOggPad *pad;
-
- /* get the granulepos */
- GST_LOG_OBJECT (ogg, "found next ogg page at %" G_GINT64_FORMAT,
- result);
- granulepos = ogg_page_granulepos (&og);
- if (granulepos == -1) {
- GST_LOG_OBJECT (ogg, "granulepos of next page is -1");
- continue;
- }
-
- /* get the stream */
- pad = gst_ogg_chain_get_stream (chain, ogg_page_serialno (&og));
- if (pad == NULL || pad->map.is_skeleton)
- continue;
-
- /* convert granulepos to time */
- granuletime = gst_ogg_stream_get_end_time_for_granulepos (&pad->map,
- granulepos);
- if (granuletime < pad->start_time)
- continue;
-
- GST_LOG_OBJECT (ogg, "granulepos %" G_GINT64_FORMAT " maps to time %"
- GST_TIME_FORMAT, granulepos, GST_TIME_ARGS (granuletime));
-
- granuletime -= pad->start_time;
- granuletime += chain->begin_time;
-
- GST_DEBUG_OBJECT (ogg,
- "found page with granule %" G_GINT64_FORMAT " and time %"
- GST_TIME_FORMAT, granulepos, GST_TIME_ARGS (granuletime));
-
- if (granuletime < target) {
- best = result; /* raw offset of packet with granulepos */
- begin = ogg->offset; /* raw offset of next page */
- begintime = granuletime;
-
- bisect = begin; /* *not* begin + 1 */
- } else {
- if (bisect <= begin + 1) {
- end = begin; /* found it */
- } else {
- if (end == ogg->offset) { /* we're pretty close - we'd be stuck in */
- end = result;
- bisect -= CHUNKSIZE; /* an endless loop otherwise. */
- if (bisect <= begin)
- bisect = begin + 1;
- gst_ogg_demux_seek (ogg, bisect);
- } else {
- end = result;
- endtime = granuletime;
- break;
- }
- }
- }
- } else
- goto seek_error;
- }
- }
- GST_DEBUG_OBJECT (ogg, "seeking to %" G_GINT64_FORMAT, best);
- gst_ogg_demux_seek (ogg, best);
- *offset = best;
-
- return TRUE;
-
- /* ERRORS */
-seek_error:
- {
- GST_DEBUG_OBJECT (ogg, "got a seek error");
- return FALSE;
- }
-}
-
-/*
- * do seek to time @position, return FALSE or chain and TRUE
- */
-static gboolean
-gst_ogg_demux_do_seek (GstOggDemux * ogg, GstSegment * segment,
- gboolean accurate, gboolean keyframe, GstOggChain ** rchain)
-{
- guint64 position;
- GstOggChain *chain = NULL;
- gint64 begin, end;
- gint64 begintime, endtime;
- gint64 target, keytarget;
- gint64 best;
- gint64 total;
- gint64 result = 0;
- GstFlowReturn ret;
- gint i, pending, len;
-
- position = segment->last_stop;
-
- /* first find the chain to search in */
- total = ogg->total_time;
- if (ogg->chains->len == 0)
- goto no_chains;
-
- for (i = ogg->chains->len - 1; i >= 0; i--) {
- chain = g_array_index (ogg->chains, GstOggChain *, i);
- total -= chain->total_time;
- if (position >= total)
- break;
- }
-
- /* first step, locate page containing the required data */
- begin = chain->offset;
- end = chain->end_offset;
- begintime = chain->begin_time;
- endtime = begintime + chain->total_time;
- target = position - total + begintime;
-
- if (!do_binary_search (ogg, chain, begin, end, begintime, endtime, target,
- &best))
- goto seek_error;
-
- /* second step: find pages for all streams, we use the keyframe_granule to keep
- * track of which ones we saw. If we have seen a page for each stream we can
- * calculate the positions of each keyframe. */
- GST_DEBUG_OBJECT (ogg, "find keyframes");
- len = pending = chain->streams->len;
-
- /* figure out where the keyframes are */
- keytarget = target;
-
- while (TRUE) {
- ogg_page og;
- gint64 granulepos;
- GstOggPad *pad;
- GstClockTime keyframe_time, granule_time;
-
- ret = gst_ogg_demux_get_next_page (ogg, &og, end - ogg->offset, &result);
- GST_LOG_OBJECT (ogg, "looking for next page returned %" G_GINT64_FORMAT,
- result);
- if (ret == GST_FLOW_LIMIT) {
- GST_LOG_OBJECT (ogg, "reached limit");
- break;
- }
-
- /* get the stream */
- pad = gst_ogg_chain_get_stream (chain, ogg_page_serialno (&og));
- if (pad == NULL)
- continue;
-
- if (pad->map.is_skeleton)
- goto next;
-
- granulepos = ogg_page_granulepos (&og);
- if (granulepos == -1) {
- GST_LOG_OBJECT (ogg, "granulepos of next page is -1");
- continue;
- }
-
- /* in reverse we want to go past the page with the lower timestamp */
- if (segment->rate < 0.0) {
- /* get time for this pad */
- granule_time = gst_ogg_stream_get_end_time_for_granulepos (&pad->map,
- granulepos);
-
- GST_LOG_OBJECT (ogg,
- "looking at page with ts %" GST_TIME_FORMAT ", target %"
- GST_TIME_FORMAT, GST_TIME_ARGS (granule_time),
- GST_TIME_ARGS (target));
- if (granule_time < target)
- continue;
- }
-
- /* we've seen this pad before */
- if (pad->keyframe_granule != -1)
- continue;
-
- /* convert granule of this pad to the granule of the keyframe */
- pad->keyframe_granule = gst_ogg_stream_granulepos_to_key_granule (&pad->map,
- granulepos);
- GST_LOG_OBJECT (ogg, "marking stream granule %" G_GINT64_FORMAT,
- pad->keyframe_granule);
-
- /* get time of the keyframe */
- keyframe_time =
- gst_ogg_stream_granule_to_time (&pad->map, pad->keyframe_granule);
- GST_LOG_OBJECT (ogg, "stream %08lx granule time %" GST_TIME_FORMAT,
- pad->map.serialno, GST_TIME_ARGS (keyframe_time));
-
- /* collect smallest value */
- if (keyframe_time != -1) {
- keyframe_time += begintime;
- if (keyframe_time < keytarget)
- keytarget = keyframe_time;
- }
-
- next:
- pending--;
- if (pending == 0)
- break;
- }
-
- /* for negative rates we will get to the keyframe backwards */
- if (segment->rate < 0.0)
- goto done;
-
- if (keytarget != target) {
- GST_LOG_OBJECT (ogg, "final seek to target %" GST_TIME_FORMAT,
- GST_TIME_ARGS (keytarget));
-
- /* last step, seek to the location of the keyframe */
- if (!do_binary_search (ogg, chain, begin, end, begintime, endtime,
- keytarget, &best))
- goto seek_error;
- } else {
- /* seek back to previous position */
- GST_LOG_OBJECT (ogg, "keyframe on target");
- gst_ogg_demux_seek (ogg, best);
- }
-
-done:
- if (keyframe) {
- if (segment->rate > 0.0)
- segment->time = keytarget;
- segment->last_stop = keytarget - begintime;
- }
-
- *rchain = chain;
-
- return TRUE;
-
-no_chains:
- {
- GST_DEBUG_OBJECT (ogg, "no chains");
- return FALSE;
- }
-seek_error:
- {
- GST_DEBUG_OBJECT (ogg, "got a seek error");
- return FALSE;
- }
-}
-
-/* does not take ownership of the event */
-static gboolean
-gst_ogg_demux_perform_seek (GstOggDemux * ogg, GstEvent * event)
-{
- GstOggChain *chain = NULL;
- gboolean res;
- gboolean flush, accurate, keyframe;
- GstFormat format;
- gdouble rate;
- GstSeekFlags flags;
- GstSeekType cur_type, stop_type;
- gint64 cur, stop;
- gboolean update;
- guint32 seqnum;
- GstEvent *tevent;
-
- if (event) {
- GST_DEBUG_OBJECT (ogg, "seek with event");
-
- gst_event_parse_seek (event, &rate, &format, &flags,
- &cur_type, &cur, &stop_type, &stop);
-
- /* we can only seek on time */
- if (format != GST_FORMAT_TIME) {
- GST_DEBUG_OBJECT (ogg, "can only seek on TIME");
- goto error;
- }
- seqnum = gst_event_get_seqnum (event);
- } else {
- GST_DEBUG_OBJECT (ogg, "seek without event");
-
- flags = 0;
- rate = 1.0;
- seqnum = gst_util_seqnum_next ();
- }
-
- GST_DEBUG_OBJECT (ogg, "seek, rate %g", rate);
-
- flush = flags & GST_SEEK_FLAG_FLUSH;
- accurate = flags & GST_SEEK_FLAG_ACCURATE;
- keyframe = flags & GST_SEEK_FLAG_KEY_UNIT;
-
- /* first step is to unlock the streaming thread if it is
- * blocked in a chain call, we do this by starting the flush. because
- * we cannot yet hold any streaming lock, we have to protect the chains
- * with their own lock. */
- if (flush) {
- gint i;
-
- tevent = gst_event_new_flush_start ();
- gst_event_set_seqnum (tevent, seqnum);
-
- gst_event_ref (tevent);
- gst_pad_push_event (ogg->sinkpad, tevent);
-
- GST_CHAIN_LOCK (ogg);
- for (i = 0; i < ogg->chains->len; i++) {
- GstOggChain *chain = g_array_index (ogg->chains, GstOggChain *, i);
- gint j;
-
- for (j = 0; j < chain->streams->len; j++) {
- GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, j);
-
- gst_event_ref (tevent);
- gst_pad_push_event (GST_PAD (pad), tevent);
- }
- }
- GST_CHAIN_UNLOCK (ogg);
-
- gst_event_unref (tevent);
- } else {
- gst_pad_pause_task (ogg->sinkpad);
- }
-
- /* now grab the stream lock so that streaming cannot continue, for
- * non flushing seeks when the element is in PAUSED this could block
- * forever. */
- GST_PAD_STREAM_LOCK (ogg->sinkpad);
-
- if (ogg->segment_running && !flush) {
- /* create the segment event to close the current segment */
- if ((chain = ogg->current_chain)) {
- GstEvent *newseg;
- gint64 chain_start = 0;
-
- if (chain->segment_start != GST_CLOCK_TIME_NONE)
- chain_start = chain->segment_start;
-
- newseg = gst_event_new_new_segment (TRUE, ogg->segment.rate,
- GST_FORMAT_TIME, ogg->segment.start + chain_start,
- ogg->segment.last_stop + chain_start, ogg->segment.time);
- /* set the seqnum of the running segment */
- gst_event_set_seqnum (newseg, ogg->seqnum);
-
- /* send segment on old chain, FIXME, must be sent from streaming thread. */
- gst_ogg_demux_send_event (ogg, newseg);
- }
- }
-
- if (event) {
- gst_segment_set_seek (&ogg->segment, rate, format, flags,
- cur_type, cur, stop_type, stop, &update);
- }
-
- GST_DEBUG_OBJECT (ogg, "segment positions set to %" GST_TIME_FORMAT "-%"
- GST_TIME_FORMAT, GST_TIME_ARGS (ogg->segment.start),
- GST_TIME_ARGS (ogg->segment.stop));
-
- /* we need to stop flushing on the srcpad as we're going to use it
- * next. We can do this as we have the STREAM lock now. */
- if (flush) {
- tevent = gst_event_new_flush_stop ();
- gst_event_set_seqnum (tevent, seqnum);
- gst_pad_push_event (ogg->sinkpad, tevent);
- }
-
- {
- gint i;
-
- /* reset all ogg streams now, need to do this from within the lock to
- * make sure the streaming thread is not messing with the stream */
- for (i = 0; i < ogg->chains->len; i++) {
- GstOggChain *chain = g_array_index (ogg->chains, GstOggChain *, i);
-
- gst_ogg_chain_reset (chain);
- }
- }
-
- /* for reverse we will already seek accurately */
- res = gst_ogg_demux_do_seek (ogg, &ogg->segment, accurate, keyframe, &chain);
-
- /* seek failed, make sure we continue the current chain */
- if (!res) {
- GST_DEBUG_OBJECT (ogg, "seek failed");
- chain = ogg->current_chain;
- } else {
- GST_DEBUG_OBJECT (ogg, "seek success");
- }
-
- if (!chain)
- goto no_chain;
-
- /* now we have a new position, prepare for streaming again */
- {
- GstEvent *event;
- gint64 stop;
- gint64 start;
- gint64 last_stop, begin_time;
-
- /* we have to send the flush to the old chain, not the new one */
- if (flush) {
- tevent = gst_event_new_flush_stop ();
- gst_event_set_seqnum (tevent, seqnum);
- gst_ogg_demux_send_event (ogg, tevent);
- }
-
- /* we need this to see how far inside the chain we need to start */
- if (chain->begin_time != GST_CLOCK_TIME_NONE)
- begin_time = chain->begin_time;
- else
- begin_time = 0;
-
- /* segment.start gives the start over all chains, we calculate the amount
- * of time into this chain we need to start */
- start = ogg->segment.start - begin_time;
- if (chain->segment_start != GST_CLOCK_TIME_NONE)
- start += chain->segment_start;
-
- if ((stop = ogg->segment.stop) == -1)
- stop = ogg->segment.duration;
-
- /* segment.stop gives the stop time over all chains, calculate the amount of
- * time we need to stop in this chain */
- if (stop != -1) {
- if (stop > begin_time)
- stop -= begin_time;
- else
- stop = 0;
- stop += chain->segment_start;
- /* we must stop when this chain ends and switch to the next chain to play
- * the remainder of the segment. */
- stop = MIN (stop, chain->segment_stop);
- }
-
- last_stop = ogg->segment.last_stop;
- if (chain->segment_start != GST_CLOCK_TIME_NONE)
- last_stop += chain->segment_start;
-
- /* create the segment event we are going to send out */
- if (ogg->segment.rate >= 0.0)
- event = gst_event_new_new_segment (FALSE, ogg->segment.rate,
- ogg->segment.format, last_stop, stop, ogg->segment.time);
- else
- event = gst_event_new_new_segment (FALSE, ogg->segment.rate,
- ogg->segment.format, start, last_stop, ogg->segment.time);
-
- gst_event_set_seqnum (event, seqnum);
-
- if (chain != ogg->current_chain) {
- /* switch to different chain, send segment on new chain */
- gst_ogg_demux_activate_chain (ogg, chain, event);
- } else {
- /* mark discont and send segment on current chain */
- gst_ogg_chain_mark_discont (chain);
- /* This event should be sent from the streaming thread (sink pad task) */
- if (ogg->newsegment)
- gst_event_unref (ogg->newsegment);
- ogg->newsegment = event;
- }
-
- /* notify start of new segment */
- if (ogg->segment.flags & GST_SEEK_FLAG_SEGMENT) {
- GstMessage *message;
-
- message = gst_message_new_segment_start (GST_OBJECT (ogg),
- GST_FORMAT_TIME, ogg->segment.last_stop);
- gst_message_set_seqnum (message, seqnum);
-
- gst_element_post_message (GST_ELEMENT (ogg), message);
- }
-
- ogg->segment_running = TRUE;
- ogg->seqnum = seqnum;
- /* restart our task since it might have been stopped when we did the
- * flush. */
- gst_pad_start_task (ogg->sinkpad, (GstTaskFunction) gst_ogg_demux_loop,
- ogg->sinkpad);
- }
-
- /* streaming can continue now */
- GST_PAD_STREAM_UNLOCK (ogg->sinkpad);
-
- return res;
-
-error:
- {
- GST_DEBUG_OBJECT (ogg, "seek failed");
- return FALSE;
- }
-no_chain:
- {
- GST_DEBUG_OBJECT (ogg, "no chain to seek in");
- GST_PAD_STREAM_UNLOCK (ogg->sinkpad);
- return FALSE;
- }
-}
-
-/* finds each bitstream link one at a time using a bisection search
- * (has to begin by knowing the offset of the lb's initial page).
- * Recurses for each link so it can alloc the link storage after
- * finding them all, then unroll and fill the cache at the same time
- */
-static GstFlowReturn
-gst_ogg_demux_bisect_forward_serialno (GstOggDemux * ogg,
- gint64 begin, gint64 searched, gint64 end, GstOggChain * chain, glong m)
-{
- gint64 endsearched = end;
- gint64 next = end;
- ogg_page og;
- GstFlowReturn ret;
- gint64 offset;
- GstOggChain *nextchain;
-
- GST_LOG_OBJECT (ogg,
- "bisect begin: %" G_GINT64_FORMAT ", searched: %" G_GINT64_FORMAT
- ", end %" G_GINT64_FORMAT ", chain: %p", begin, searched, end, chain);
-
- /* the below guards against garbage seperating the last and
- * first pages of two links. */
- while (searched < endsearched) {
- gint64 bisect;
-
- if (endsearched - searched < CHUNKSIZE) {
- bisect = searched;
- } else {
- bisect = (searched + endsearched) / 2;
- }
-
- gst_ogg_demux_seek (ogg, bisect);
- ret = gst_ogg_demux_get_next_page (ogg, &og, -1, &offset);
-
- if (ret == GST_FLOW_UNEXPECTED) {
- endsearched = bisect;
- } else if (ret == GST_FLOW_OK) {
- glong serial = ogg_page_serialno (&og);
-
- if (!gst_ogg_chain_has_stream (chain, serial)) {
- endsearched = bisect;
- next = offset;
- } else {
- searched = offset + og.header_len + og.body_len;
- }
- } else
- return ret;
- }
-
- GST_LOG_OBJECT (ogg, "current chain ends at %" G_GINT64_FORMAT, searched);
-
- chain->end_offset = searched;
- ret = gst_ogg_demux_read_end_chain (ogg, chain);
- if (ret != GST_FLOW_OK)
- return ret;
-
- GST_LOG_OBJECT (ogg, "found begin at %" G_GINT64_FORMAT, next);
-
- gst_ogg_demux_seek (ogg, next);
- ret = gst_ogg_demux_read_chain (ogg, &nextchain);
- if (ret == GST_FLOW_UNEXPECTED) {
- nextchain = NULL;
- ret = GST_FLOW_OK;
- GST_LOG_OBJECT (ogg, "no next chain");
- } else if (ret != GST_FLOW_OK)
- goto done;
-
- if (searched < end && nextchain != NULL) {
- ret = gst_ogg_demux_bisect_forward_serialno (ogg, next, ogg->offset,
- end, nextchain, m + 1);
- if (ret != GST_FLOW_OK)
- goto done;
- }
- GST_LOG_OBJECT (ogg, "adding chain %p", chain);
-
- g_array_insert_val (ogg->chains, 0, chain);
-
-done:
- return ret;
-}
-
-/* read a chain from the ogg file. This code will
- * read all BOS pages and will create and return a GstOggChain
- * structure with the results.
- *
- * This function will also read N pages from each stream in the
- * chain and submit them to the decoders. When the decoder has
- * decoded the first buffer, we know the timestamp of the first
- * page in the chain.
- */
-static GstFlowReturn
-gst_ogg_demux_read_chain (GstOggDemux * ogg, GstOggChain ** res_chain)
-{
- GstFlowReturn ret;
- GstOggChain *chain = NULL;
- gint64 offset = ogg->offset;
- ogg_page op;
- gboolean done;
- gint i;
-
- GST_LOG_OBJECT (ogg, "reading chain at %" G_GINT64_FORMAT, offset);
-
- /* first read the BOS pages, do typefind on them, create
- * the decoders, send data to the decoders. */
- while (TRUE) {
- GstOggPad *pad;
- glong serial;
-
- ret = gst_ogg_demux_get_next_page (ogg, &op, -1, NULL);
- if (ret != GST_FLOW_OK) {
- GST_WARNING_OBJECT (ogg, "problem reading BOS page: ret=%d", ret);
- break;
- }
- if (!ogg_page_bos (&op)) {
- GST_WARNING_OBJECT (ogg, "page is not BOS page");
- /* if we did not find a chain yet, assume this is a bogus stream and
- * ignore it */
- if (!chain)
- ret = GST_FLOW_UNEXPECTED;
- break;
- }
-
- if (chain == NULL) {
- chain = gst_ogg_chain_new (ogg);
- chain->offset = offset;
- }
-
- serial = ogg_page_serialno (&op);
- if (gst_ogg_chain_get_stream (chain, serial) != NULL) {
- GST_WARNING_OBJECT (ogg, "found serial %08lx BOS page twice, ignoring",
- serial);
- continue;
- }
-
- pad = gst_ogg_chain_new_stream (chain, serial);
- gst_ogg_pad_submit_page (pad, &op);
- }
-
- if (ret != GST_FLOW_OK || chain == NULL) {
- if (ret == GST_FLOW_OK) {
- GST_WARNING_OBJECT (ogg, "no chain was found");
- ret = GST_FLOW_ERROR;
- } else if (ret != GST_FLOW_UNEXPECTED) {
- GST_WARNING_OBJECT (ogg, "failed to read chain");
- } else {
- GST_DEBUG_OBJECT (ogg, "done reading chains");
- }
- if (chain) {
- gst_ogg_chain_free (chain);
- }
- if (res_chain)
- *res_chain = NULL;
- return ret;
- }
-
- chain->have_bos = TRUE;
- GST_LOG_OBJECT (ogg, "read bos pages, init decoder now");
-
- /* now read pages until we receive a buffer from each of the
- * stream decoders, this will tell us the timestamp of the
- * first packet in the chain then */
-
- /* save the offset to the first non bos page in the chain: if searching for
- * pad->first_time we read past the end of the chain, we'll seek back to this
- * position
- */
- offset = ogg->offset;
-
- done = FALSE;
- while (!done) {
- glong serial;
- gboolean known_serial = FALSE;
- GstFlowReturn ret;
-
- serial = ogg_page_serialno (&op);
- done = TRUE;
- for (i = 0; i < chain->streams->len; i++) {
- GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
-
- GST_LOG_OBJECT (ogg, "serial %08lx time %" GST_TIME_FORMAT,
- pad->map.serialno, GST_TIME_ARGS (pad->start_time));
-
- if (pad->map.serialno == serial) {
- known_serial = TRUE;
-
- /* submit the page now, this will fill in the start_time when the
- * internal decoder finds it */
- gst_ogg_pad_submit_page (pad, &op);
-
- if (!pad->map.is_skeleton && pad->start_time == -1
- && ogg_page_eos (&op)) {
- /* got EOS on a pad before we could find its start_time.
- * We have no chance of finding a start_time for every pad so
- * stop searching for the other start_time(s).
- */
- done = TRUE;
- break;
- }
- }
- /* the timestamp will be filled in when we submit the pages */
- if (!pad->map.is_skeleton)
- done &= (pad->start_time != GST_CLOCK_TIME_NONE);
-
- GST_LOG_OBJECT (ogg, "done %08lx now %d", pad->map.serialno, done);
- }
-
- /* we read a page not belonging to the current chain: seek back to the
- * beginning of the chain
- */
- if (!known_serial) {
- GST_LOG_OBJECT (ogg, "unknown serial %08lx", serial);
- gst_ogg_demux_seek (ogg, offset);
- break;
- }
-
- if (!done) {
- ret = gst_ogg_demux_get_next_page (ogg, &op, -1, NULL);
- if (ret != GST_FLOW_OK)
- break;
- }
- }
- GST_LOG_OBJECT (ogg, "done reading chain");
- /* now we can fill in the missing info using queries */
- for (i = 0; i < chain->streams->len; i++) {
- GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
-
- if (pad->map.is_skeleton)
- continue;
-
- pad->mode = GST_OGG_PAD_MODE_STREAMING;
- }
-
- if (res_chain)
- *res_chain = chain;
-
- return GST_FLOW_OK;
-}
-
-/* read the last pages from the ogg stream to get the final
- * page end_offsets.
- */
-static GstFlowReturn
-gst_ogg_demux_read_end_chain (GstOggDemux * ogg, GstOggChain * chain)
-{
- gint64 begin = chain->end_offset;
- gint64 end = begin;
- gint64 last_granule = -1;
- GstOggPad *last_pad = NULL;
- GstFlowReturn ret;
- gboolean done = FALSE;
- ogg_page og;
- gint i;
-
- while (!done) {
- begin -= CHUNKSIZE;
- if (begin < 0)
- begin = 0;
-
- gst_ogg_demux_seek (ogg, begin);
-
- /* now continue reading until we run out of data, if we find a page
- * start, we save it. It might not be the final page as there could be
- * another page after this one. */
- while (ogg->offset < end) {
- ret = gst_ogg_demux_get_next_page (ogg, &og, end - ogg->offset, NULL);
-
- if (ret == GST_FLOW_LIMIT)
- break;
- if (ret != GST_FLOW_OK)
- return ret;
-
- for (i = 0; i < chain->streams->len; i++) {
- GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
-
- if (pad->map.is_skeleton)
- continue;
-
- if (pad->map.serialno == ogg_page_serialno (&og)) {
- gint64 granulepos = ogg_page_granulepos (&og);
-
- if (last_granule == -1 || last_granule < granulepos) {
- last_granule = granulepos;
- last_pad = pad;
- }
- if (last_granule != -1) {
- done = TRUE;
- }
- break;
- }
- }
- }
- }
-
- if (last_pad) {
- chain->segment_stop =
- gst_ogg_stream_get_end_time_for_granulepos (&last_pad->map,
- last_granule);
- } else {
- chain->segment_stop = GST_CLOCK_TIME_NONE;
- }
-
- GST_INFO ("segment stop %" G_GUINT64_FORMAT, chain->segment_stop);
-
- return GST_FLOW_OK;
-}
-
-/* find a pad with a given serial number
- */
-static GstOggPad *
-gst_ogg_demux_find_pad (GstOggDemux * ogg, glong serialno)
-{
- GstOggPad *pad;
- gint i;
-
- /* first look in building chain if any */
- if (ogg->building_chain) {
- pad = gst_ogg_chain_get_stream (ogg->building_chain, serialno);
- if (pad)
- return pad;
- }
-
- /* then look in current chain if any */
- if (ogg->current_chain) {
- pad = gst_ogg_chain_get_stream (ogg->current_chain, serialno);
- if (pad)
- return pad;
- }
-
- for (i = 0; i < ogg->chains->len; i++) {
- GstOggChain *chain = g_array_index (ogg->chains, GstOggChain *, i);
-
- pad = gst_ogg_chain_get_stream (chain, serialno);
- if (pad)
- return pad;
- }
- return NULL;
-}
-
-/* find a chain with a given serial number
- */
-static GstOggChain *
-gst_ogg_demux_find_chain (GstOggDemux * ogg, glong serialno)
-{
- GstOggPad *pad;
-
- pad = gst_ogg_demux_find_pad (ogg, serialno);
- if (pad) {
- return pad->chain;
- }
- return NULL;
-}
-
-/* returns TRUE if all streams have valid start time */
-static gboolean
-gst_ogg_demux_collect_chain_info (GstOggDemux * ogg, GstOggChain * chain)
-{
- gint i;
- gboolean res = TRUE;
-
- chain->total_time = GST_CLOCK_TIME_NONE;
- chain->segment_start = G_MAXUINT64;
-
- GST_DEBUG_OBJECT (ogg, "trying to collect chain info");
-
- for (i = 0; i < chain->streams->len; i++) {
- GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
-
- if (pad->map.is_skeleton)
- continue;
-
- /* can do this if the pad start time is not defined */
- if (pad->start_time == GST_CLOCK_TIME_NONE)
- res = FALSE;
- else
- chain->segment_start = MIN (chain->segment_start, pad->start_time);
- }
-
- if (chain->segment_stop != GST_CLOCK_TIME_NONE
- && chain->segment_start != G_MAXUINT64)
- chain->total_time = chain->segment_stop - chain->segment_start;
-
- GST_DEBUG ("total time %" G_GUINT64_FORMAT, chain->total_time);
-
- GST_DEBUG_OBJECT (ogg, "return %d", res);
-
- return res;
-}
-
-static void
-gst_ogg_demux_collect_info (GstOggDemux * ogg)
-{
- gint i;
-
- /* collect all info */
- ogg->total_time = 0;
-
- for (i = 0; i < ogg->chains->len; i++) {
- GstOggChain *chain = g_array_index (ogg->chains, GstOggChain *, i);
-
- chain->begin_time = ogg->total_time;
-
- gst_ogg_demux_collect_chain_info (ogg, chain);
-
- ogg->total_time += chain->total_time;
- }
- gst_segment_set_duration (&ogg->segment, GST_FORMAT_TIME, ogg->total_time);
-}
-
-/* find all the chains in the ogg file, this reads the first and
- * last page of the ogg stream, if they match then the ogg file has
- * just one chain, else we do a binary search for all chains.
- */
-static GstFlowReturn
-gst_ogg_demux_find_chains (GstOggDemux * ogg)
-{
- ogg_page og;
- GstPad *peer;
- GstFormat format;
- gboolean res;
- gulong serialno;
- GstOggChain *chain;
- GstFlowReturn ret;
-
- /* get peer to figure out length */
- if ((peer = gst_pad_get_peer (ogg->sinkpad)) == NULL)
- goto no_peer;
-
- /* find length to read last page, we store this for later use. */
- format = GST_FORMAT_BYTES;
- res = gst_pad_query_duration (peer, &format, &ogg->length);
- gst_object_unref (peer);
- if (!res || ogg->length <= 0)
- goto no_length;
-
- GST_DEBUG_OBJECT (ogg, "file length %" G_GINT64_FORMAT, ogg->length);
-
- /* read chain from offset 0, this is the first chain of the
- * ogg file. */
- gst_ogg_demux_seek (ogg, 0);
- ret = gst_ogg_demux_read_chain (ogg, &chain);
- if (ret != GST_FLOW_OK)
- goto no_first_chain;
-
- /* read page from end offset, we use this page to check if its serial
- * number is contained in the first chain. If this is the case then
- * this ogg is not a chained ogg and we can skip the scanning. */
- gst_ogg_demux_seek (ogg, ogg->length);
- ret = gst_ogg_demux_get_prev_page (ogg, &og, NULL);
- if (ret != GST_FLOW_OK)
- goto no_last_page;
-
- serialno = ogg_page_serialno (&og);
-
- if (!gst_ogg_chain_has_stream (chain, serialno)) {
- /* the last page is not in the first stream, this means we should
- * find all the chains in this chained ogg. */
- ret =
- gst_ogg_demux_bisect_forward_serialno (ogg, 0, 0, ogg->length, chain,
- 0);
- } else {
- /* we still call this function here but with an empty range so that
- * we can reuse the setup code in this routine. */
- ret =
- gst_ogg_demux_bisect_forward_serialno (ogg, 0, ogg->length, ogg->length,
- chain, 0);
- }
- if (ret != GST_FLOW_OK)
- goto done;
-
- /* all fine, collect and print */
- gst_ogg_demux_collect_info (ogg);
-
- /* dump our chains and streams */
- gst_ogg_print (ogg);
-
-done:
- return ret;
-
- /*** error cases ***/
-no_peer:
- {
- GST_ELEMENT_ERROR (ogg, STREAM, DEMUX, (NULL), ("we don't have a peer"));
- return GST_FLOW_NOT_LINKED;
- }
-no_length:
- {
- GST_ELEMENT_ERROR (ogg, STREAM, DEMUX, (NULL), ("can't get file length"));
- return GST_FLOW_NOT_SUPPORTED;
- }
-no_first_chain:
- {
- GST_ELEMENT_ERROR (ogg, STREAM, DEMUX, (NULL), ("can't get first chain"));
- return GST_FLOW_ERROR;
- }
-no_last_page:
- {
- GST_DEBUG_OBJECT (ogg, "can't get last page");
- if (chain)
- gst_ogg_chain_free (chain);
- return ret;
- }
-}
-
-static GstFlowReturn
-gst_ogg_demux_handle_page (GstOggDemux * ogg, ogg_page * page)
-{
- GstOggPad *pad;
- gint64 granule;
- glong serialno;
- GstFlowReturn result = GST_FLOW_OK;
-
- serialno = ogg_page_serialno (page);
- granule = ogg_page_granulepos (page);
-
- GST_LOG_OBJECT (ogg,
- "processing ogg page (serial %08lx, pageno %ld, granulepos %"
- G_GINT64_FORMAT ", bos %d)",
- serialno, ogg_page_pageno (page), granule, ogg_page_bos (page));
-
- if (ogg_page_bos (page)) {
- GstOggChain *chain;
-
- /* first page */
- /* see if we know about the chain already */
- chain = gst_ogg_demux_find_chain (ogg, serialno);
- if (chain) {
- GstEvent *event;
- gint64 start = 0;
-
- if (chain->segment_start != GST_CLOCK_TIME_NONE)
- start = chain->segment_start;
-
- /* create the newsegment event we are going to send out */
- event = gst_event_new_new_segment (FALSE, ogg->segment.rate,
- GST_FORMAT_TIME, start, chain->segment_stop, chain->begin_time);
- gst_event_set_seqnum (event, ogg->seqnum);
-
- GST_DEBUG_OBJECT (ogg,
- "segment: start %" GST_TIME_FORMAT ", stop %" GST_TIME_FORMAT
- ", time %" GST_TIME_FORMAT, GST_TIME_ARGS (start),
- GST_TIME_ARGS (chain->segment_stop),
- GST_TIME_ARGS (chain->begin_time));
-
- /* activate it as it means we have a non-header, this will also deactivate
- * the currently running chain. */
- gst_ogg_demux_activate_chain (ogg, chain, event);
- pad = gst_ogg_demux_find_pad (ogg, serialno);
- } else {
- GstClockTime chain_time;
- GstOggChain *current_chain;
- gint64 current_time;
-
- /* this can only happen in push mode */
- if (ogg->pullmode)
- goto unknown_chain;
-
- current_chain = ogg->current_chain;
- current_time = ogg->segment.last_stop;
-
- /* time of new chain is current time */
- chain_time = current_time;
-
- if (ogg->building_chain == NULL) {
- GstOggChain *newchain;
-
- newchain = gst_ogg_chain_new (ogg);
- newchain->offset = 0;
- /* set new chain begin time aligned with end time of old chain */
- newchain->begin_time = chain_time;
- GST_DEBUG_OBJECT (ogg, "new chain, begin time %" GST_TIME_FORMAT,
- GST_TIME_ARGS (chain_time));
-
- /* and this is the one we are building now */
- ogg->building_chain = newchain;
- }
- pad = gst_ogg_chain_new_stream (ogg->building_chain, serialno);
- }
- } else {
- pad = gst_ogg_demux_find_pad (ogg, serialno);
- }
- if (pad) {
- result = gst_ogg_pad_submit_page (pad, page);
- } else {
- /* no pad. This means an ogg page without bos has been seen for this
- * serialno. we just ignore it but post a warning... */
- GST_ELEMENT_WARNING (ogg, STREAM, DECODE,
- (NULL), ("unknown ogg pad for serial %08lx detected", serialno));
- return GST_FLOW_OK;
- }
- return result;
-
- /* ERRORS */
-unknown_chain:
- {
- GST_ELEMENT_ERROR (ogg, STREAM, DECODE,
- (NULL), ("unknown ogg chain for serial %08lx detected", serialno));
- return GST_FLOW_ERROR;
- }
-}
-
-/* streaming mode, receive a buffer, parse it, create pads for
- * the serialno, submit pages and packets to the oggpads
- */
-static GstFlowReturn
-gst_ogg_demux_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstOggDemux *ogg;
- gint ret = 0;
- GstFlowReturn result = GST_FLOW_OK;
-
- ogg = GST_OGG_DEMUX (GST_OBJECT_PARENT (pad));
-
- GST_DEBUG_OBJECT (ogg, "chain");
- result = gst_ogg_demux_submit_buffer (ogg, buffer);
-
- while (result == GST_FLOW_OK) {
- ogg_page page;
-
- ret = ogg_sync_pageout (&ogg->sync, &page);
- if (ret == 0)
- /* need more data */
- break;
- if (ret == -1) {
- /* discontinuity in the pages */
- GST_DEBUG_OBJECT (ogg, "discont in page found, continuing");
- } else {
- result = gst_ogg_demux_handle_page (ogg, &page);
- }
- }
- if (ret == 0 || result == GST_FLOW_OK) {
- gst_ogg_demux_sync_streams (ogg);
- }
- return result;
-}
-
-static void
-gst_ogg_demux_send_event (GstOggDemux * ogg, GstEvent * event)
-{
- GstOggChain *chain = ogg->current_chain;
-
- if (chain) {
- gint i;
-
- for (i = 0; i < chain->streams->len; i++) {
- GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
-
- gst_event_ref (event);
- GST_DEBUG_OBJECT (pad, "Pushing event %" GST_PTR_FORMAT, event);
- gst_pad_push_event (GST_PAD (pad), event);
- }
- }
- gst_event_unref (event);
-}
-
-static GstFlowReturn
-gst_ogg_demux_combine_flows (GstOggDemux * ogg, GstOggPad * pad,
- GstFlowReturn ret)
-{
- GstOggChain *chain;
-
- /* store the value */
- pad->last_ret = ret;
-
- /* any other error that is not-linked can be returned right
- * away */
- if (ret != GST_FLOW_NOT_LINKED)
- goto done;
-
- /* only return NOT_LINKED if all other pads returned NOT_LINKED */
- chain = ogg->current_chain;
- if (chain) {
- gint i;
-
- for (i = 0; i < chain->streams->len; i++) {
- GstOggPad *opad = g_array_index (chain->streams, GstOggPad *, i);
-
- ret = opad->last_ret;
- /* some other return value (must be SUCCESS but we can return
- * other values as well) */
- if (ret != GST_FLOW_NOT_LINKED)
- goto done;
- }
- /* if we get here, all other pads were unlinked and we return
- * NOT_LINKED then */
- }
-done:
- return ret;
-}
-
-static GstFlowReturn
-gst_ogg_demux_loop_forward (GstOggDemux * ogg)
-{
- GstFlowReturn ret;
- GstBuffer *buffer;
-
- if (ogg->offset == ogg->length) {
- GST_LOG_OBJECT (ogg, "no more data to pull %" G_GINT64_FORMAT
- " == %" G_GINT64_FORMAT, ogg->offset, ogg->length);
- ret = GST_FLOW_UNEXPECTED;
- goto done;
- }
-
- GST_LOG_OBJECT (ogg, "pull data %" G_GINT64_FORMAT, ogg->offset);
- ret = gst_pad_pull_range (ogg->sinkpad, ogg->offset, CHUNKSIZE, &buffer);
- if (ret != GST_FLOW_OK) {
- GST_LOG_OBJECT (ogg, "Failed pull_range");
- goto done;
- }
-
- ogg->offset += GST_BUFFER_SIZE (buffer);
-
- if (G_UNLIKELY (ogg->newsegment)) {
- gst_ogg_demux_send_event (ogg, ogg->newsegment);
- ogg->newsegment = NULL;
- }
-
- ret = gst_ogg_demux_chain (ogg->sinkpad, buffer);
- if (ret != GST_FLOW_OK) {
- GST_LOG_OBJECT (ogg, "Failed demux_chain");
- goto done;
- }
-
- /* check for the end of the segment */
- if (ogg->segment.stop != -1 && ogg->segment.last_stop != -1) {
- if (ogg->segment.last_stop > ogg->segment.stop) {
- ret = GST_FLOW_UNEXPECTED;
- goto done;
- }
- }
-done:
- return ret;
-}
-
-/* reverse mode.
- *
- * We read the pages backwards and send the packets forwards. The first packet
- * in the page will be pushed with the DISCONT flag set.
- *
- * Special care has to be taken for continued pages, which we can only decode
- * when we have the previous page(s).
- */
-static GstFlowReturn
-gst_ogg_demux_loop_reverse (GstOggDemux * ogg)
-{
- GstFlowReturn ret;
- ogg_page page;
- gint64 offset;
-
- if (ogg->offset == 0) {
- GST_LOG_OBJECT (ogg, "no more data to pull %" G_GINT64_FORMAT
- " == 0", ogg->offset);
- ret = GST_FLOW_UNEXPECTED;
- goto done;
- }
-
- GST_LOG_OBJECT (ogg, "read page from %" G_GINT64_FORMAT, ogg->offset);
- ret = gst_ogg_demux_get_prev_page (ogg, &page, &offset);
- if (ret != GST_FLOW_OK)
- goto done;
-
- ogg->offset = offset;
-
- if (G_UNLIKELY (ogg->newsegment)) {
- gst_ogg_demux_send_event (ogg, ogg->newsegment);
- ogg->newsegment = NULL;
- }
-
- ret = gst_ogg_demux_handle_page (ogg, &page);
- if (ret != GST_FLOW_OK)
- goto done;
-
- /* check for the end of the segment */
- if (ogg->segment.start != -1 && ogg->segment.last_stop != -1) {
- if (ogg->segment.last_stop <= ogg->segment.start) {
- ret = GST_FLOW_UNEXPECTED;
- goto done;
- }
- }
-done:
- return ret;
-}
-
-static void
-gst_ogg_demux_sync_streams (GstOggDemux * ogg)
-{
- GstClockTime cur;
- GstOggChain *chain;
- guint i;
-
- chain = ogg->current_chain;
- cur = ogg->segment.last_stop;
- if (chain == NULL || cur == -1)
- return;
-
- for (i = 0; i < chain->streams->len; i++) {
- GstOggPad *stream = g_array_index (chain->streams, GstOggPad *, i);
-
- /* Theoretically, we should be doing this for all streams, but we're only
- * doing it for known-to-be-sparse streams at the moment in order not to
- * break things for wrongly-muxed streams (like we used to produce once) */
- if (stream->is_sparse && stream->last_stop != GST_CLOCK_TIME_NONE) {
-
- /* Does this stream lag? Random threshold of 2 seconds */
- if (GST_CLOCK_DIFF (stream->last_stop, cur) > (2 * GST_SECOND)) {
- GST_DEBUG_OBJECT (stream, "synchronizing stream with others by "
- "advancing time from %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT,
- GST_TIME_ARGS (stream->last_stop), GST_TIME_ARGS (cur));
- stream->last_stop = cur;
- /* advance stream time (FIXME: is this right, esp. time_pos?) */
- gst_pad_push_event (GST_PAD_CAST (stream),
- gst_event_new_new_segment (TRUE, ogg->segment.rate,
- GST_FORMAT_TIME, stream->last_stop, -1, stream->last_stop));
- }
- }
- }
-}
-
-/* random access code
- *
- * - first find all the chains and streams by scanning the file.
- * - then get and chain buffers, just like the streaming case.
- * - when seeking, we can use the chain info to perform the seek.
- */
-static void
-gst_ogg_demux_loop (GstOggPad * pad)
-{
- GstOggDemux *ogg;
- GstFlowReturn ret;
- GstEvent *event;
-
- ogg = GST_OGG_DEMUX (GST_OBJECT_PARENT (pad));
-
- if (ogg->need_chains) {
- gboolean res;
-
- /* this is the only place where we write chains and thus need to lock. */
- GST_CHAIN_LOCK (ogg);
- ret = gst_ogg_demux_find_chains (ogg);
- GST_CHAIN_UNLOCK (ogg);
- if (ret != GST_FLOW_OK)
- goto chain_read_failed;
-
- ogg->need_chains = FALSE;
-
- GST_OBJECT_LOCK (ogg);
- ogg->running = TRUE;
- event = ogg->event;
- ogg->event = NULL;
- GST_OBJECT_UNLOCK (ogg);
-
- /* and seek to configured positions without FLUSH */
- res = gst_ogg_demux_perform_seek (ogg, event);
- if (event)
- gst_event_unref (event);
-
- if (!res)
- goto seek_failed;
- }
-
- if (ogg->segment.rate >= 0.0)
- ret = gst_ogg_demux_loop_forward (ogg);
- else
- ret = gst_ogg_demux_loop_reverse (ogg);
-
- if (ret != GST_FLOW_OK)
- goto pause;
-
- gst_ogg_demux_sync_streams (ogg);
- return;
-
- /* ERRORS */
-chain_read_failed:
- {
- /* error was posted */
- goto pause;
- }
-seek_failed:
- {
- GST_ELEMENT_ERROR (ogg, STREAM, DEMUX, (NULL),
- ("failed to start demuxing ogg"));
- ret = GST_FLOW_ERROR;
- goto pause;
- }
-pause:
- {
- const gchar *reason = gst_flow_get_name (ret);
- GstEvent *event = NULL;
-
- GST_LOG_OBJECT (ogg, "pausing task, reason %s", reason);
- ogg->segment_running = FALSE;
- gst_pad_pause_task (ogg->sinkpad);
-
- if (GST_FLOW_IS_FATAL (ret) || ret == GST_FLOW_NOT_LINKED) {
- if (ret == GST_FLOW_UNEXPECTED) {
- /* perform EOS logic */
- if (ogg->segment.flags & GST_SEEK_FLAG_SEGMENT) {
- gint64 stop;
- GstMessage *message;
-
- /* for segment playback we need to post when (in stream time)
- * we stopped, this is either stop (when set) or the duration. */
- if ((stop = ogg->segment.stop) == -1)
- stop = ogg->segment.duration;
-
- GST_LOG_OBJECT (ogg, "Sending segment done, at end of segment");
- message =
- gst_message_new_segment_done (GST_OBJECT (ogg), GST_FORMAT_TIME,
- stop);
- gst_message_set_seqnum (message, ogg->seqnum);
-
- gst_element_post_message (GST_ELEMENT (ogg), message);
- } else {
- /* normal playback, send EOS to all linked pads */
- GST_LOG_OBJECT (ogg, "Sending EOS, at end of stream");
- event = gst_event_new_eos ();
- }
- } else {
- GST_ELEMENT_ERROR (ogg, STREAM, FAILED,
- (_("Internal data stream error.")),
- ("stream stopped, reason %s", reason));
- event = gst_event_new_eos ();
- }
- if (event) {
- gst_event_set_seqnum (event, ogg->seqnum);
- gst_ogg_demux_send_event (ogg, event);
- }
- }
- return;
- }
-}
-
-static void
-gst_ogg_demux_clear_chains (GstOggDemux * ogg)
-{
- gint i;
-
- gst_ogg_demux_deactivate_current_chain (ogg);
-
- GST_CHAIN_LOCK (ogg);
- for (i = 0; i < ogg->chains->len; i++) {
- GstOggChain *chain = g_array_index (ogg->chains, GstOggChain *, i);
-
- gst_ogg_chain_free (chain);
- }
- ogg->chains = g_array_set_size (ogg->chains, 0);
- GST_CHAIN_UNLOCK (ogg);
-}
-
-/* this function is called when the pad is activated and should start
- * processing data.
- *
- * We check if we can do random access to decide if we work push or
- * pull based.
- */
-static gboolean
-gst_ogg_demux_sink_activate (GstPad * sinkpad)
-{
- if (gst_pad_check_pull_range (sinkpad)) {
- GST_DEBUG_OBJECT (sinkpad, "activating pull");
- return gst_pad_activate_pull (sinkpad, TRUE);
- } else {
- GST_DEBUG_OBJECT (sinkpad, "activating push");
- return gst_pad_activate_push (sinkpad, TRUE);
- }
-}
-
-/* this function gets called when we activate ourselves in push mode.
- * We cannot seek (ourselves) in the stream */
-static gboolean
-gst_ogg_demux_sink_activate_push (GstPad * sinkpad, gboolean active)
-{
- GstOggDemux *ogg;
-
- ogg = GST_OGG_DEMUX (GST_OBJECT_PARENT (sinkpad));
-
- ogg->pullmode = FALSE;
-
- return TRUE;
-}
-
-/* this function gets called when we activate ourselves in pull mode.
- * We can perform random access to the resource and we start a task
- * to start reading */
-static gboolean
-gst_ogg_demux_sink_activate_pull (GstPad * sinkpad, gboolean active)
-{
- GstOggDemux *ogg;
-
- ogg = GST_OGG_DEMUX (GST_OBJECT_PARENT (sinkpad));
-
- if (active) {
- ogg->need_chains = TRUE;
- ogg->pullmode = TRUE;
-
- return gst_pad_start_task (sinkpad, (GstTaskFunction) gst_ogg_demux_loop,
- sinkpad);
- } else {
- return gst_pad_stop_task (sinkpad);
- }
-}
-
-static GstStateChangeReturn
-gst_ogg_demux_change_state (GstElement * element, GstStateChange transition)
-{
- GstOggDemux *ogg;
- GstStateChangeReturn result = GST_STATE_CHANGE_FAILURE;
-
- ogg = GST_OGG_DEMUX (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- ogg->basetime = 0;
- ogg->have_fishead = FALSE;
- ogg_sync_init (&ogg->sync);
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- ogg_sync_reset (&ogg->sync);
- ogg->running = FALSE;
- ogg->segment_running = FALSE;
- gst_segment_init (&ogg->segment, GST_FORMAT_TIME);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- default:
- break;
- }
-
- result = parent_class->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- gst_ogg_demux_clear_chains (ogg);
- GST_OBJECT_LOCK (ogg);
- ogg->running = FALSE;
- ogg->segment_running = FALSE;
- ogg->have_fishead = FALSE;
- GST_OBJECT_UNLOCK (ogg);
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- ogg_sync_clear (&ogg->sync);
- break;
- default:
- break;
- }
- return result;
-}
-
-gboolean
-gst_ogg_demux_plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (gst_ogg_demux_debug, "oggdemux", 0, "ogg demuxer");
- GST_DEBUG_CATEGORY_INIT (gst_ogg_demux_setup_debug, "oggdemux_setup", 0,
- "ogg demuxer setup stage when parsing pipeline");
-
-#if ENABLE_NLS
- GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
- LOCALEDIR);
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif
-
- return gst_element_register (plugin, "oggdemux", GST_RANK_PRIMARY,
- GST_TYPE_OGG_DEMUX);
-}
-
-/* prints all info about the element */
-#undef GST_CAT_DEFAULT
-#define GST_CAT_DEFAULT gst_ogg_demux_setup_debug
-
-#ifdef GST_DISABLE_GST_DEBUG
-
-static void
-gst_ogg_print (GstOggDemux * ogg)
-{
- /* NOP */
-}
-
-#else /* !GST_DISABLE_GST_DEBUG */
-
-static void
-gst_ogg_print (GstOggDemux * ogg)
-{
- guint j, i;
-
- GST_INFO_OBJECT (ogg, "%u chains", ogg->chains->len);
- GST_INFO_OBJECT (ogg, " total time: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (ogg->total_time));
-
- for (i = 0; i < ogg->chains->len; i++) {
- GstOggChain *chain = g_array_index (ogg->chains, GstOggChain *, i);
-
- GST_INFO_OBJECT (ogg, " chain %d (%u streams):", i, chain->streams->len);
- GST_INFO_OBJECT (ogg, " offset: %" G_GINT64_FORMAT " - %" G_GINT64_FORMAT,
- chain->offset, chain->end_offset);
- GST_INFO_OBJECT (ogg, " begin time: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (chain->begin_time));
- GST_INFO_OBJECT (ogg, " total time: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (chain->total_time));
- GST_INFO_OBJECT (ogg, " segment start: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (chain->segment_start));
- GST_INFO_OBJECT (ogg, " segment stop: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (chain->segment_stop));
-
- for (j = 0; j < chain->streams->len; j++) {
- GstOggPad *stream = g_array_index (chain->streams, GstOggPad *, j);
-
- GST_INFO_OBJECT (ogg, " stream %08lx:", stream->map.serialno);
- GST_INFO_OBJECT (ogg, " start time: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (stream->start_time));
- }
- }
-}
-#endif /* GST_DISABLE_GST_DEBUG */
diff --git a/ext/ogg/gstoggdemux.h b/ext/ogg/gstoggdemux.h
deleted file mode 100644
index a47642b3..00000000
--- a/ext/ogg/gstoggdemux.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/* GStreamer
- * Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
- *
- * gstoggdemux.c: ogg stream demuxer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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_OGG_DEMUX_H__
-#define __GST_OGG_DEMUX_H__
-
-#include <ogg/ogg.h>
-
-#include <gst/gst.h>
-
-#include "gstoggstream.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_OGG_PAD (gst_ogg_pad_get_type())
-#define GST_OGG_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OGG_PAD, GstOggPad))
-#define GST_OGG_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OGG_PAD, GstOggPad))
-#define GST_IS_OGG_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OGG_PAD))
-#define GST_IS_OGG_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OGG_PAD))
-
-typedef struct _GstOggPad GstOggPad;
-typedef struct _GstOggPadClass GstOggPadClass;
-
-#define GST_TYPE_OGG_DEMUX (gst_ogg_demux_get_type())
-#define GST_OGG_DEMUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OGG_DEMUX, GstOggDemux))
-#define GST_OGG_DEMUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OGG_DEMUX, GstOggDemux))
-#define GST_IS_OGG_DEMUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OGG_DEMUX))
-#define GST_IS_OGG_DEMUX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OGG_DEMUX))
-
-GType gst_ogg_demux_get_type (void);
-
-typedef struct _GstOggDemux GstOggDemux;
-typedef struct _GstOggDemuxClass GstOggDemuxClass;
-typedef struct _GstOggChain GstOggChain;
-
-/* all information needed for one ogg chain (relevant for chained bitstreams) */
-struct _GstOggChain
-{
- GstOggDemux *ogg;
-
- gint64 offset; /* starting offset of chain */
- gint64 end_offset; /* end offset of chain */
- gint64 bytes; /* number of bytes */
-
- gboolean have_bos;
-
- GArray *streams;
-
- GstClockTime total_time; /* the total time of this chain, this is the MAX of
- the totals of all streams */
- GstClockTime begin_time; /* when this chain starts in the stream */
-
- GstClockTime segment_start; /* the timestamp of the first sample, this is the MIN of
- the start times of all streams. */
- GstClockTime segment_stop; /* the timestamp of the last page, this is the MAX of the
- streams. */
-};
-
-/* different modes for the pad */
-typedef enum
-{
- GST_OGG_PAD_MODE_INIT, /* we are feeding our internal decoder to get info */
- GST_OGG_PAD_MODE_STREAMING, /* we are streaming buffers to the outside */
-} GstOggPadMode;
-
-/* all information needed for one ogg stream */
-struct _GstOggPad
-{
- GstPad pad; /* subclass GstPad */
-
- gboolean have_type;
- GstOggPadMode mode;
-
- GstOggChain *chain; /* the chain we are part of */
- GstOggDemux *ogg; /* the ogg demuxer we are part of */
-
- GstOggStream map;
-
- gint64 packetno;
- gint64 current_granule;
- gint64 keyframe_granule;
-
- GstClockTime start_time; /* the timestamp of the first sample */
-
- gint64 first_granule; /* the granulepos of first page == first sample in next page */
- GstClockTime first_time; /* the timestamp of the second page or granuletime of first page */
-
- gboolean is_sparse; /* TRUE if this is a subtitle pad or some other sparse stream */
- GstClockTime last_stop; /* last_stop when last push occured; used to detect when we
- * need to send a newsegment update event for sparse streams */
-
- GList *continued;
-
- gboolean discont;
- GstFlowReturn last_ret; /* last return of _pad_push() */
-
- gboolean added;
-};
-
-struct _GstOggPadClass
-{
- GstPadClass parent_class;
-};
-
-/**
- * GstOggDemux:
- *
- * The ogg demuxer object structure.
- */
-struct _GstOggDemux
-{
- GstElement element;
-
- GstPad *sinkpad;
-
- gint64 length;
- gint64 read_offset;
- gint64 offset;
-
- gboolean pullmode;
- gboolean running;
-
- gboolean need_chains;
-
- /* state */
- GMutex *chain_lock; /* we need the lock to protect the chains */
- GArray *chains; /* list of chains we know */
- GstClockTime total_time;
-
- GstOggChain *current_chain;
- GstOggChain *building_chain;
-
- /* playback start/stop positions */
- GstSegment segment;
- gboolean segment_running;
- guint32 seqnum;
-
- GstEvent *event;
- GstEvent *newsegment; /* pending newsegment to be sent from _loop */
-
- /* annodex stuff */
- gboolean have_fishead;
- gint64 basetime;
- gint64 prestime;
-
- /* ogg stuff */
- ogg_sync_state sync;
-};
-
-struct _GstOggDemuxClass
-{
- GstElementClass parent_class;
-};
-
-
-G_END_DECLS
-
-#endif /* __GST_OGG_DEMUX_H__ */
diff --git a/ext/ogg/gstoggmux.c b/ext/ogg/gstoggmux.c
deleted file mode 100644
index b37a5638..00000000
--- a/ext/ogg/gstoggmux.c
+++ /dev/null
@@ -1,1692 +0,0 @@
-/* OGG muxer plugin for GStreamer
- * Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
- * Copyright (C) 2006 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-oggmux
- * @see_also: <link linkend="gst-plugins-base-plugins-deoggmux">oggdemux</link>
- *
- * This element merges streams (audio and video) into ogg files.
- *
- * <refsect2>
- * <title>Example pipelines</title>
- * |[
- * gst-launch v4l2src num-buffers=500 ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! theoraenc ! oggmux ! filesink location=video.ogg
- * ]| Encodes a video stream captured from a v4l2-compatible camera to Ogg/Theora
- * (the encoding will stop automatically after 500 frames)
- * </refsect2>
- *
- * Last reviewed on 2008-02-06 (0.10.17)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/base/gstcollectpads.h>
-
-#include "gstoggmux.h"
-
-/* memcpy - if someone knows a way to get rid of it, please speak up
- * note: the ogg docs even say you need this... */
-#include <string.h>
-#include <time.h>
-#include <stdlib.h> /* rand, srand, atoi */
-
-GST_DEBUG_CATEGORY_STATIC (gst_ogg_mux_debug);
-#define GST_CAT_DEFAULT gst_ogg_mux_debug
-
-/* This isn't generally what you'd want with an end-time macro, because
- technically the end time of a buffer with invalid duration is invalid. But
- for sorting ogg pages this is what we want. */
-#define GST_BUFFER_END_TIME(buf) \
- (GST_BUFFER_DURATION_IS_VALID (buf) \
- ? GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf) \
- : GST_BUFFER_TIMESTAMP (buf))
-
-#define GST_GP_FORMAT "[gp %8" G_GINT64_FORMAT "]"
-#define GST_GP_CAST(_gp) ((gint64) _gp)
-
-typedef enum
-{
- GST_OGG_FLAG_BOS = GST_ELEMENT_FLAG_LAST,
- GST_OGG_FLAG_EOS
-}
-GstOggFlag;
-
-/* elementfactory information */
-static const GstElementDetails gst_ogg_mux_details =
-GST_ELEMENT_DETAILS ("Ogg muxer",
- "Codec/Muxer",
- "mux ogg streams (info about ogg: http://xiph.org)",
- "Wim Taymans <wim@fluendo.com>");
-
-/* OggMux signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-/* set to 0.5 seconds by default */
-#define DEFAULT_MAX_DELAY G_GINT64_CONSTANT(500000000)
-#define DEFAULT_MAX_PAGE_DELAY G_GINT64_CONSTANT(500000000)
-enum
-{
- ARG_0,
- ARG_MAX_DELAY,
- ARG_MAX_PAGE_DELAY,
-};
-
-static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/ogg")
- );
-
-static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink_%d",
- GST_PAD_SINK,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS ("video/x-theora; "
- "audio/x-vorbis; audio/x-flac; audio/x-speex; audio/x-celt; "
- "application/x-ogm-video; application/x-ogm-audio; video/x-dirac; "
- "video/x-smoke; text/x-cmml, encoded = (boolean) TRUE; "
- "subtitle/x-kate; application/x-kate")
- );
-
-static void gst_ogg_mux_base_init (gpointer g_class);
-static void gst_ogg_mux_class_init (GstOggMuxClass * klass);
-static void gst_ogg_mux_init (GstOggMux * ogg_mux);
-static void gst_ogg_mux_finalize (GObject * object);
-
-static GstFlowReturn
-gst_ogg_mux_collected (GstCollectPads * pads, GstOggMux * ogg_mux);
-static gboolean gst_ogg_mux_handle_src_event (GstPad * pad, GstEvent * event);
-static GstPad *gst_ogg_mux_request_new_pad (GstElement * element,
- GstPadTemplate * templ, const gchar * name);
-static void gst_ogg_mux_release_pad (GstElement * element, GstPad * pad);
-
-static void gst_ogg_mux_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_ogg_mux_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-static GstStateChangeReturn gst_ogg_mux_change_state (GstElement * element,
- GstStateChange transition);
-
-static GstElementClass *parent_class = NULL;
-
-/*static guint gst_ogg_mux_signals[LAST_SIGNAL] = { 0 }; */
-
-GType
-gst_ogg_mux_get_type (void)
-{
- static GType ogg_mux_type = 0;
-
- if (G_UNLIKELY (ogg_mux_type == 0)) {
- static const GTypeInfo ogg_mux_info = {
- sizeof (GstOggMuxClass),
- gst_ogg_mux_base_init,
- NULL,
- (GClassInitFunc) gst_ogg_mux_class_init,
- NULL,
- NULL,
- sizeof (GstOggMux),
- 0,
- (GInstanceInitFunc) gst_ogg_mux_init,
- };
- static const GInterfaceInfo preset_info = {
- NULL,
- NULL,
- NULL
- };
-
- ogg_mux_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstOggMux", &ogg_mux_info,
- 0);
-
- g_type_add_interface_static (ogg_mux_type, GST_TYPE_PRESET, &preset_info);
- }
- return ogg_mux_type;
-}
-
-static void
-gst_ogg_mux_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_factory));
-
- gst_element_class_set_details (element_class, &gst_ogg_mux_details);
-}
-
-static void
-gst_ogg_mux_class_init (GstOggMuxClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->finalize = gst_ogg_mux_finalize;
- gobject_class->get_property = gst_ogg_mux_get_property;
- gobject_class->set_property = gst_ogg_mux_set_property;
-
- gstelement_class->request_new_pad = gst_ogg_mux_request_new_pad;
- gstelement_class->release_pad = gst_ogg_mux_release_pad;
-
- g_object_class_install_property (gobject_class, ARG_MAX_DELAY,
- g_param_spec_uint64 ("max-delay", "Max delay",
- "Maximum delay in multiplexing streams", 0, G_MAXUINT64,
- DEFAULT_MAX_DELAY,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_MAX_PAGE_DELAY,
- g_param_spec_uint64 ("max-page-delay", "Max page delay",
- "Maximum delay for sending out a page", 0, G_MAXUINT64,
- DEFAULT_MAX_PAGE_DELAY,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstelement_class->change_state = gst_ogg_mux_change_state;
-
-}
-
-#if 0
-static const GstEventMask *
-gst_ogg_mux_get_sink_event_masks (GstPad * pad)
-{
- static const GstEventMask gst_ogg_mux_sink_event_masks[] = {
- {GST_EVENT_EOS, 0},
- {GST_EVENT_DISCONTINUOUS, 0},
- {0,}
- };
-
- return gst_ogg_mux_sink_event_masks;
-}
-#endif
-
-static void
-gst_ogg_mux_clear (GstOggMux * ogg_mux)
-{
- ogg_mux->pulling = NULL;
- ogg_mux->need_headers = TRUE;
- ogg_mux->delta_pad = NULL;
- ogg_mux->offset = 0;
- ogg_mux->next_ts = 0;
- ogg_mux->last_ts = GST_CLOCK_TIME_NONE;
-}
-
-static void
-gst_ogg_mux_init (GstOggMux * ogg_mux)
-{
- GstElementClass *klass = GST_ELEMENT_GET_CLASS (ogg_mux);
-
- ogg_mux->srcpad =
- gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
- "src"), "src");
- gst_pad_set_event_function (ogg_mux->srcpad, gst_ogg_mux_handle_src_event);
- gst_element_add_pad (GST_ELEMENT (ogg_mux), ogg_mux->srcpad);
-
- GST_OBJECT_FLAG_SET (GST_ELEMENT (ogg_mux), GST_OGG_FLAG_BOS);
-
- /* seed random number generator for creation of serial numbers */
- srand (time (NULL));
-
- ogg_mux->collect = gst_collect_pads_new ();
- gst_collect_pads_set_function (ogg_mux->collect,
- (GstCollectPadsFunction) GST_DEBUG_FUNCPTR (gst_ogg_mux_collected),
- ogg_mux);
-
- ogg_mux->max_delay = DEFAULT_MAX_DELAY;
- ogg_mux->max_page_delay = DEFAULT_MAX_PAGE_DELAY;
-
- gst_ogg_mux_clear (ogg_mux);
-}
-
-static void
-gst_ogg_mux_finalize (GObject * object)
-{
- GstOggMux *ogg_mux;
-
- ogg_mux = GST_OGG_MUX (object);
-
- if (ogg_mux->collect) {
- gst_object_unref (ogg_mux->collect);
- ogg_mux->collect = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_ogg_mux_ogg_pad_destroy_notify (GstCollectData * data)
-{
- GstOggPad *oggpad = (GstOggPad *) data;
- GstBuffer *buf;
-
- ogg_stream_clear (&oggpad->stream);
-
- if (oggpad->pagebuffers) {
- while ((buf = g_queue_pop_head (oggpad->pagebuffers)) != NULL) {
- gst_buffer_unref (buf);
- }
- g_queue_free (oggpad->pagebuffers);
- oggpad->pagebuffers = NULL;
- }
-}
-
-static GstPadLinkReturn
-gst_ogg_mux_sinkconnect (GstPad * pad, GstPad * peer)
-{
- GstOggMux *ogg_mux;
-
- ogg_mux = GST_OGG_MUX (gst_pad_get_parent (pad));
-
- GST_DEBUG_OBJECT (ogg_mux, "sinkconnect triggered on %s", GST_PAD_NAME (pad));
-
- gst_object_unref (ogg_mux);
-
- return GST_PAD_LINK_OK;
-}
-
-static gboolean
-gst_ogg_mux_sink_event (GstPad * pad, GstEvent * event)
-{
- GstOggMux *ogg_mux = GST_OGG_MUX (gst_pad_get_parent (pad));
- GstOggPad *ogg_pad = (GstOggPad *) gst_pad_get_element_private (pad);
- gboolean ret;
-
- GST_DEBUG ("Got %s event on pad %s:%s", GST_EVENT_TYPE_NAME (event),
- GST_DEBUG_PAD_NAME (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:
- /* We don't support NEWSEGMENT events */
- gst_event_unref (event);
- ret = FALSE;
- break;
- default:
- ret = TRUE;
- break;
- }
-
- /* now GstCollectPads can take care of the rest, e.g. EOS */
- if (ret)
- ret = ogg_pad->collect_event (pad, event);
-
- gst_object_unref (ogg_mux);
- return ret;
-}
-
-static GstPad *
-gst_ogg_mux_request_new_pad (GstElement * element,
- GstPadTemplate * templ, const gchar * req_name)
-{
- GstOggMux *ogg_mux;
- GstPad *newpad;
- GstElementClass *klass;
-
- g_return_val_if_fail (templ != NULL, NULL);
-
- if (templ->direction != GST_PAD_SINK)
- goto wrong_direction;
-
- g_return_val_if_fail (GST_IS_OGG_MUX (element), NULL);
- ogg_mux = GST_OGG_MUX (element);
-
- klass = GST_ELEMENT_GET_CLASS (element);
-
- if (templ != gst_element_class_get_pad_template (klass, "sink_%d"))
- goto wrong_template;
-
- {
- gint serial;
- gchar *name;
-
- if (req_name == NULL || strlen (req_name) < 6) {
- /* no name given when requesting the pad, use random serial number */
- serial = rand ();
- } else {
- /* parse serial number from requested padname */
- serial = atoi (&req_name[5]);
- }
- /* create new pad with the name */
- GST_DEBUG_OBJECT (ogg_mux, "Creating new pad for serial %d", serial);
- name = g_strdup_printf ("sink_%d", serial);
- newpad = gst_pad_new_from_template (templ, name);
- g_free (name);
-
- /* construct our own wrapper data structure for the pad to
- * keep track of its status */
- {
- GstOggPad *oggpad;
-
- oggpad = (GstOggPad *)
- gst_collect_pads_add_pad_full (ogg_mux->collect, newpad,
- sizeof (GstOggPad), gst_ogg_mux_ogg_pad_destroy_notify);
- ogg_mux->active_pads++;
-
- oggpad->serial = serial;
- ogg_stream_init (&oggpad->stream, serial);
- oggpad->packetno = 0;
- oggpad->pageno = 0;
- oggpad->eos = FALSE;
- /* we assume there will be some control data first for this pad */
- oggpad->state = GST_OGG_PAD_STATE_CONTROL;
- oggpad->new_page = TRUE;
- oggpad->first_delta = FALSE;
- oggpad->prev_delta = FALSE;
- oggpad->pagebuffers = g_queue_new ();
-
- oggpad->collect_event = (GstPadEventFunction) GST_PAD_EVENTFUNC (newpad);
- gst_pad_set_event_function (newpad,
- GST_DEBUG_FUNCPTR (gst_ogg_mux_sink_event));
- }
- }
-
- /* setup some pad functions */
- gst_pad_set_link_function (newpad, gst_ogg_mux_sinkconnect);
-
- /* dd the pad to the element */
- gst_element_add_pad (element, newpad);
-
- return newpad;
-
- /* ERRORS */
-wrong_direction:
- {
- g_warning ("ogg_mux: request pad that is not a SINK pad\n");
- return NULL;
- }
-wrong_template:
- {
- g_warning ("ogg_mux: this is not our template!\n");
- return NULL;
- }
-}
-
-static void
-gst_ogg_mux_release_pad (GstElement * element, GstPad * pad)
-{
- GstOggMux *ogg_mux;
-
- ogg_mux = GST_OGG_MUX (gst_pad_get_parent (pad));
-
- gst_collect_pads_remove_pad (ogg_mux->collect, pad);
- gst_element_remove_pad (element, pad);
-
- gst_object_unref (ogg_mux);
-}
-
-/* handle events */
-static gboolean
-gst_ogg_mux_handle_src_event (GstPad * pad, GstEvent * event)
-{
- GstEventType type;
-
- type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
-
- switch (type) {
- case GST_EVENT_SEEK:
- /* disable seeking for now */
- return FALSE;
- default:
- break;
- }
-
- return gst_pad_event_default (pad, event);
-}
-
-static GstBuffer *
-gst_ogg_mux_buffer_from_page (GstOggMux * mux, ogg_page * page, gboolean delta)
-{
- GstBuffer *buffer;
-
- /* allocate space for header and body */
- buffer = gst_buffer_new_and_alloc (page->header_len + page->body_len);
- memcpy (GST_BUFFER_DATA (buffer), page->header, page->header_len);
- memcpy (GST_BUFFER_DATA (buffer) + page->header_len,
- page->body, page->body_len);
-
- /* Here we set granulepos as our OFFSET_END to give easy direct access to
- * this value later. Before we push it, we reset this to OFFSET + SIZE
- * (see gst_ogg_mux_push_buffer). */
- GST_BUFFER_OFFSET_END (buffer) = ogg_page_granulepos (page);
- if (delta)
- GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
-
- GST_LOG_OBJECT (mux, GST_GP_FORMAT
- " created buffer %p from ogg page",
- GST_GP_CAST (ogg_page_granulepos (page)), buffer);
-
- return buffer;
-}
-
-static GstFlowReturn
-gst_ogg_mux_push_buffer (GstOggMux * mux, GstBuffer * buffer)
-{
- GstCaps *caps;
-
- /* fix up OFFSET and OFFSET_END again */
- GST_BUFFER_OFFSET (buffer) = mux->offset;
- mux->offset += GST_BUFFER_SIZE (buffer);
- GST_BUFFER_OFFSET_END (buffer) = mux->offset;
-
- /* Ensure we have monotonically increasing timestamps in the output. */
- if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer)) {
- if (mux->last_ts != GST_CLOCK_TIME_NONE &&
- GST_BUFFER_TIMESTAMP (buffer) < mux->last_ts)
- GST_BUFFER_TIMESTAMP (buffer) = mux->last_ts;
- else
- mux->last_ts = GST_BUFFER_TIMESTAMP (buffer);
- }
-
- caps = gst_pad_get_negotiated_caps (mux->srcpad);
- gst_buffer_set_caps (buffer, caps);
- if (caps)
- gst_caps_unref (caps);
-
- return gst_pad_push (mux->srcpad, buffer);
-}
-
-/* if all queues have at least one page, dequeue the page with the lowest
- * timestamp */
-static gboolean
-gst_ogg_mux_dequeue_page (GstOggMux * mux, GstFlowReturn * flowret)
-{
- GSList *walk;
- GstOggPad *opad = NULL; /* "oldest" pad */
- GstClockTime oldest = GST_CLOCK_TIME_NONE;
- GstBuffer *buf = NULL;
- gboolean ret = FALSE;
-
- *flowret = GST_FLOW_OK;
-
- walk = mux->collect->data;
- while (walk) {
- GstOggPad *pad = (GstOggPad *) walk->data;
-
- /* We need each queue to either be at EOS, or have one or more pages
- * available with a set granulepos (i.e. not -1), otherwise we don't have
- * enough data yet to determine which stream needs to go next for correct
- * time ordering. */
- if (pad->pagebuffers->length == 0) {
- if (pad->eos) {
- GST_LOG_OBJECT (pad->collect.pad,
- "pad is EOS, skipping for dequeue decision");
- } else {
- GST_LOG_OBJECT (pad->collect.pad,
- "no pages in this queue, can't dequeue");
- return FALSE;
- }
- } else {
- /* We then need to check for a non-negative granulepos */
- int i;
- gboolean valid = FALSE;
-
- for (i = 0; i < pad->pagebuffers->length; i++) {
- buf = g_queue_peek_nth (pad->pagebuffers, i);
- /* Here we check the OFFSET_END, which is actually temporarily the
- * granulepos value for this buffer */
- if (GST_BUFFER_OFFSET_END (buf) != -1) {
- valid = TRUE;
- break;
- }
- }
- if (!valid) {
- GST_LOG_OBJECT (pad->collect.pad,
- "No page timestamps in queue, can't dequeue");
- return FALSE;
- }
- }
-
- walk = g_slist_next (walk);
- }
-
- walk = mux->collect->data;
- while (walk) {
- GstOggPad *pad = (GstOggPad *) walk->data;
-
- /* any page with a granulepos of -1 can be pushed immediately.
- * TODO: it CAN be, but it seems silly to do so? */
- buf = g_queue_peek_head (pad->pagebuffers);
- while (buf && GST_BUFFER_OFFSET_END (buf) == -1) {
- GST_LOG_OBJECT (pad->collect.pad, "[gp -1] pushing page");
- g_queue_pop_head (pad->pagebuffers);
- *flowret = gst_ogg_mux_push_buffer (mux, buf);
- buf = g_queue_peek_head (pad->pagebuffers);
- ret = TRUE;
- }
-
- if (buf) {
- /* if no oldest buffer yet, take this one */
- if (oldest == GST_CLOCK_TIME_NONE) {
- GST_LOG_OBJECT (mux, "no oldest yet, taking buffer %p from pad %"
- GST_PTR_FORMAT " with gp time %" GST_TIME_FORMAT,
- buf, pad->collect.pad, GST_TIME_ARGS (GST_BUFFER_OFFSET (buf)));
- oldest = GST_BUFFER_OFFSET (buf);
- opad = pad;
- } else {
- /* if we have an oldest, compare with this one */
- if (GST_BUFFER_OFFSET (buf) < oldest) {
- GST_LOG_OBJECT (mux, "older buffer %p, taking from pad %"
- GST_PTR_FORMAT " with gp time %" GST_TIME_FORMAT,
- buf, pad->collect.pad, GST_TIME_ARGS (GST_BUFFER_OFFSET (buf)));
- oldest = GST_BUFFER_OFFSET (buf);
- opad = pad;
- }
- }
- }
- walk = g_slist_next (walk);
- }
-
- if (oldest != GST_CLOCK_TIME_NONE) {
- g_assert (opad);
- buf = g_queue_pop_head (opad->pagebuffers);
- GST_LOG_OBJECT (opad->collect.pad,
- GST_GP_FORMAT " pushing oldest page buffer %p (granulepos time %"
- GST_TIME_FORMAT ")", GST_BUFFER_OFFSET_END (buf), buf,
- GST_TIME_ARGS (GST_BUFFER_OFFSET (buf)));
- *flowret = gst_ogg_mux_push_buffer (mux, buf);
- ret = TRUE;
- }
-
- return ret;
-}
-
-/* put the given ogg page on a per-pad queue, timestamping it correctly.
- * after that, dequeue and push as many pages as possible.
- * Caller should make sure:
- * pad->timestamp was set with the timestamp of the first packet put
- * on the page
- * pad->timestamp_end was set with the timestamp + duration of the last packet
- * put on the page
- * pad->gp_time was set with the time matching the gp of the last
- * packet put on the page
- *
- * will also reset timestamp and timestamp_end, so caller func can restart
- * counting.
- */
-static GstFlowReturn
-gst_ogg_mux_pad_queue_page (GstOggMux * mux, GstOggPad * pad, ogg_page * page,
- gboolean delta)
-{
- GstFlowReturn ret;
- GstBuffer *buffer = gst_ogg_mux_buffer_from_page (mux, page, delta);
-
- /* take the timestamp of the first packet on this page */
- GST_BUFFER_TIMESTAMP (buffer) = pad->timestamp;
- GST_BUFFER_DURATION (buffer) = pad->timestamp_end - pad->timestamp;
- /* take the gp time of the last completed packet on this page */
- GST_BUFFER_OFFSET (buffer) = pad->gp_time;
-
- /* the next page will start where the current page's end time leaves off */
- pad->timestamp = pad->timestamp_end;
-
- g_queue_push_tail (pad->pagebuffers, buffer);
- GST_LOG_OBJECT (pad->collect.pad, GST_GP_FORMAT
- " queued buffer page %p (gp time %"
- GST_TIME_FORMAT ", timestamp %" GST_TIME_FORMAT
- "), %d page buffers queued", GST_GP_CAST (ogg_page_granulepos (page)),
- buffer, GST_TIME_ARGS (GST_BUFFER_OFFSET (buffer)),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)),
- g_queue_get_length (pad->pagebuffers));
-
- while (gst_ogg_mux_dequeue_page (mux, &ret)) {
- if (ret != GST_FLOW_OK)
- break;
- }
-
- return ret;
-}
-
-/*
- * Given two pads, compare the buffers queued on it.
- * Returns:
- * 0 if they have an equal priority
- * -1 if the first is better
- * 1 if the second is better
- * Priority decided by: a) validity, b) older timestamp, c) smaller number
- * of muxed pages
- */
-static gint
-gst_ogg_mux_compare_pads (GstOggMux * ogg_mux, GstOggPad * first,
- GstOggPad * second)
-{
- guint64 firsttime, secondtime;
-
- /* if the first pad doesn't contain anything or is even NULL, return
- * the second pad as best candidate and vice versa */
- if (first == NULL || (first->buffer == NULL && first->next_buffer == NULL))
- return 1;
- if (second == NULL || (second->buffer == NULL && second->next_buffer == NULL))
- return -1;
-
- /* no timestamp on first buffer, it must go first */
- if (first->buffer)
- firsttime = GST_BUFFER_TIMESTAMP (first->buffer);
- else
- firsttime = GST_BUFFER_TIMESTAMP (first->next_buffer);
- if (firsttime == GST_CLOCK_TIME_NONE)
- return -1;
-
- /* no timestamp on second buffer, it must go first */
- if (second->buffer)
- secondtime = GST_BUFFER_TIMESTAMP (second->buffer);
- else
- secondtime = GST_BUFFER_TIMESTAMP (second->next_buffer);
- if (secondtime == GST_CLOCK_TIME_NONE)
- return 1;
-
- /* first buffer has higher timestamp, second one should go first */
- if (secondtime < firsttime)
- return 1;
- /* second buffer has higher timestamp, first one should go first */
- else if (secondtime > firsttime)
- return -1;
- else {
- /* buffers with equal timestamps, prefer the pad that has the
- * least number of pages muxed */
- if (second->pageno < first->pageno)
- return 1;
- else if (second->pageno > first->pageno)
- return -1;
- }
-
- /* same priority if all of the above failed */
- return 0;
-}
-
-/* make sure at least one buffer is queued on all pads, two if possible
- *
- * if pad->buffer == NULL, pad->next_buffer != NULL, then
- * we do not know if the buffer is the last or not
- * if pad->buffer != NULL, pad->next_buffer != NULL, then
- * pad->buffer is not the last buffer for the pad
- * if pad->buffer != NULL, pad->next_buffer == NULL, then
- * pad->buffer if the last buffer for the pad
- *
- * returns a pointer to an oggpad that holds the best buffer, or
- * NULL when no pad was usable. "best" means the buffer marked
- * with the lowest timestamp. If best->buffer == NULL then nothing
- * should be done until more data arrives */
-static GstOggPad *
-gst_ogg_mux_queue_pads (GstOggMux * ogg_mux)
-{
- GstOggPad *bestpad = NULL, *still_hungry = NULL;
- GSList *walk;
-
- /* try to make sure we have a buffer from each usable pad first */
- walk = ogg_mux->collect->data;
- while (walk) {
- GstOggPad *pad;
- GstCollectData *data;
-
- data = (GstCollectData *) walk->data;
- pad = (GstOggPad *) data;
-
- walk = g_slist_next (walk);
-
- GST_LOG_OBJECT (data->pad, "looking at pad for buffer");
-
- /* try to get a new buffer for this pad if needed and possible */
- if (pad->buffer == NULL) {
- GstBuffer *buf;
- gboolean incaps;
-
- /* shift the buffer along if needed (it's okay if next_buffer is NULL) */
- if (pad->buffer == NULL) {
- GST_LOG_OBJECT (data->pad, "shifting buffer %" GST_PTR_FORMAT,
- pad->next_buffer);
- pad->buffer = pad->next_buffer;
- pad->next_buffer = NULL;
- }
-
- buf = gst_collect_pads_pop (ogg_mux->collect, data);
- GST_LOG_OBJECT (data->pad, "popped buffer %" GST_PTR_FORMAT, buf);
-
- /* On EOS we get a NULL buffer */
- if (buf != NULL) {
- if (ogg_mux->delta_pad == NULL &&
- GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT))
- ogg_mux->delta_pad = pad;
-
- incaps = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
- /* if we need headers */
- if (pad->state == GST_OGG_PAD_STATE_CONTROL) {
- /* and we have one */
- if (incaps) {
- GST_DEBUG_OBJECT (ogg_mux,
- "got incaps buffer in control state, ignoring");
- /* just ignore */
- gst_buffer_unref (buf);
- buf = NULL;
- } else {
- GST_DEBUG_OBJECT (ogg_mux,
- "got data buffer in control state, switching " "to data mode");
- /* this is a data buffer so switch to data state */
- pad->state = GST_OGG_PAD_STATE_DATA;
- }
- }
- } else {
- GST_DEBUG_OBJECT (data->pad, "EOS on pad");
- if (!pad->eos) {
- ogg_page page;
- GstFlowReturn ret;
-
- /* it's no longer active */
- ogg_mux->active_pads--;
-
- /* Just gone to EOS. Flush existing page(s) */
- pad->eos = TRUE;
-
- while (ogg_stream_flush (&pad->stream, &page)) {
- /* Place page into the per-pad queue */
- ret = gst_ogg_mux_pad_queue_page (ogg_mux, pad, &page,
- pad->first_delta);
- /* increment the page number counter */
- pad->pageno++;
- /* mark other pages as delta */
- pad->first_delta = TRUE;
- }
- }
- }
-
- pad->next_buffer = buf;
- }
-
- /* we should have a buffer now, see if it is the best pad to
- * pull on */
- if (pad->buffer || pad->next_buffer) {
- if (gst_ogg_mux_compare_pads (ogg_mux, bestpad, pad) > 0) {
- GST_LOG_OBJECT (data->pad,
- "new best pad, with buffers %" GST_PTR_FORMAT
- " and %" GST_PTR_FORMAT, pad->buffer, pad->next_buffer);
-
- bestpad = pad;
- }
- } else if (!pad->eos) {
- GST_LOG_OBJECT (data->pad, "hungry pad");
- still_hungry = pad;
- }
- }
-
- if (still_hungry)
- /* drop back into collectpads... */
- return still_hungry;
- else
- return bestpad;
-}
-
-static GList *
-gst_ogg_mux_get_headers (GstOggPad * pad)
-{
- GList *res = NULL;
- GstStructure *structure;
- GstCaps *caps;
- GstPad *thepad;
-
- thepad = pad->collect.pad;
-
- GST_LOG_OBJECT (thepad, "getting headers");
-
- caps = gst_pad_get_negotiated_caps (thepad);
- if (caps != NULL) {
- const GValue *streamheader;
-
- structure = gst_caps_get_structure (caps, 0);
- streamheader = gst_structure_get_value (structure, "streamheader");
- if (streamheader != NULL) {
- GST_LOG_OBJECT (thepad, "got header");
- if (G_VALUE_TYPE (streamheader) == GST_TYPE_ARRAY) {
- GArray *bufarr = g_value_peek_pointer (streamheader);
- gint i;
-
- GST_LOG_OBJECT (thepad, "got fixed list");
-
- for (i = 0; i < bufarr->len; i++) {
- GValue *bufval = &g_array_index (bufarr, GValue, i);
-
- GST_LOG_OBJECT (thepad, "item %d", i);
- if (G_VALUE_TYPE (bufval) == GST_TYPE_BUFFER) {
- GstBuffer *buf = g_value_peek_pointer (bufval);
-
- GST_LOG_OBJECT (thepad, "adding item %d to header list", i);
-
- gst_buffer_ref (buf);
- res = g_list_append (res, buf);
- }
- }
- } else {
- GST_LOG_OBJECT (thepad, "streamheader is not fixed list");
- }
- } else if (gst_structure_has_name (structure, "video/x-dirac")) {
- res = g_list_append (res, pad->buffer);
- pad->buffer = pad->next_buffer;
- pad->next_buffer = NULL;
- pad->always_flush_page = TRUE;
- } else {
- GST_LOG_OBJECT (thepad, "caps don't have streamheader");
- }
- gst_caps_unref (caps);
- } else {
- GST_LOG_OBJECT (thepad, "got empty caps as negotiated format");
- }
- return res;
-}
-
-static GstCaps *
-gst_ogg_mux_set_header_on_caps (GstCaps * caps, GList * buffers)
-{
- GstStructure *structure;
- GValue array = { 0 };
- GList *walk = buffers;
-
- caps = gst_caps_make_writable (caps);
-
- structure = gst_caps_get_structure (caps, 0);
-
- /* put buffers in a fixed list */
- g_value_init (&array, GST_TYPE_ARRAY);
-
- while (walk) {
- GstBuffer *buf = GST_BUFFER (walk->data);
- GstBuffer *copy;
- GValue value = { 0 };
-
- walk = walk->next;
-
- /* mark buffer */
- GST_LOG ("Setting IN_CAPS on buffer of length %d", GST_BUFFER_SIZE (buf));
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
-
- g_value_init (&value, GST_TYPE_BUFFER);
- copy = gst_buffer_copy (buf);
- gst_value_set_buffer (&value, copy);
- gst_buffer_unref (copy);
- gst_value_array_append_value (&array, &value);
- g_value_unset (&value);
- }
- gst_structure_set_value (structure, "streamheader", &array);
- g_value_unset (&array);
-
- return caps;
-}
-
-/*
- * For each pad we need to write out one (small) header in one
- * page that allows decoders to identify the type of the stream.
- * After that we need to write out all extra info for the decoders.
- * In the case of a codec that also needs data as configuration, we can
- * find that info in the streamcaps.
- * After writing the headers we must start a new page for the data.
- */
-static GstFlowReturn
-gst_ogg_mux_send_headers (GstOggMux * mux)
-{
- GSList *walk;
- GList *hbufs, *hwalk;
- GstCaps *caps;
- GstFlowReturn ret;
-
- hbufs = NULL;
- ret = GST_FLOW_OK;
-
- GST_LOG_OBJECT (mux, "collecting headers");
-
- walk = mux->collect->data;
- while (walk) {
- GstOggPad *pad;
- GstPad *thepad;
-
- pad = (GstOggPad *) walk->data;
- thepad = pad->collect.pad;
-
- walk = g_slist_next (walk);
-
- GST_LOG_OBJECT (mux, "looking at pad %s:%s", GST_DEBUG_PAD_NAME (thepad));
-
- /* if the pad has no buffer, we don't care */
- if (pad->buffer == NULL && pad->next_buffer == NULL)
- continue;
-
- /* now figure out the headers */
- pad->headers = gst_ogg_mux_get_headers (pad);
- }
-
- GST_LOG_OBJECT (mux, "creating BOS pages");
- walk = mux->collect->data;
- while (walk) {
- GstOggPad *pad;
- GstBuffer *buf;
- ogg_packet packet;
- ogg_page page;
- GstPad *thepad;
- GstCaps *caps;
- GstStructure *structure;
- GstBuffer *hbuf;
-
- pad = (GstOggPad *) walk->data;
- thepad = pad->collect.pad;
- caps = gst_pad_get_negotiated_caps (thepad);
- structure = gst_caps_get_structure (caps, 0);
-
- walk = walk->next;
-
- pad->packetno = 0;
-
- GST_LOG_OBJECT (thepad, "looping over headers");
-
- if (pad->headers) {
- buf = GST_BUFFER (pad->headers->data);
- pad->headers = g_list_remove (pad->headers, buf);
- } else if (pad->buffer) {
- buf = pad->buffer;
- gst_buffer_ref (buf);
- } else if (pad->next_buffer) {
- buf = pad->next_buffer;
- gst_buffer_ref (buf);
- } else {
- /* fixme -- should be caught in the previous list traversal. */
- GST_OBJECT_LOCK (pad);
- g_critical ("No headers or buffers on pad %s:%s",
- GST_DEBUG_PAD_NAME (pad));
- GST_OBJECT_UNLOCK (pad);
- continue;
- }
-
- /* create a packet from the buffer */
- packet.packet = GST_BUFFER_DATA (buf);
- packet.bytes = GST_BUFFER_SIZE (buf);
- packet.granulepos = GST_BUFFER_OFFSET_END (buf);
- if (packet.granulepos == -1)
- packet.granulepos = 0;
- /* mark BOS and packet number */
- packet.b_o_s = (pad->packetno == 0);
- packet.packetno = pad->packetno++;
- /* mark EOS */
- packet.e_o_s = 0;
-
- /* swap the packet in */
- ogg_stream_packetin (&pad->stream, &packet);
- gst_buffer_unref (buf);
-
- GST_LOG_OBJECT (thepad, "flushing out BOS page");
- if (!ogg_stream_flush (&pad->stream, &page))
- g_critical ("Could not flush BOS page");
-
- hbuf = gst_ogg_mux_buffer_from_page (mux, &page, FALSE);
-
- GST_LOG_OBJECT (mux, "swapped out page with mime type %s",
- gst_structure_get_name (structure));
-
- /* quick hack: put Theora and Dirac video pages at the front.
- * Ideally, we would have a settable enum for which Ogg
- * profile we work with, and order based on that.
- * (FIXME: if there is more than one video stream, shouldn't we only put
- * one's BOS into the first page, followed by an audio stream's BOS, and
- * only then followed by the remaining video and audio streams?) */
- if (gst_structure_has_name (structure, "video/x-theora")) {
- GST_DEBUG_OBJECT (thepad, "putting %s page at the front", "Theora");
- hbufs = g_list_prepend (hbufs, hbuf);
- pad->always_flush_page = TRUE;
- } else if (gst_structure_has_name (structure, "video/x-dirac")) {
- GST_DEBUG_OBJECT (thepad, "putting %s page at the front", "Dirac");
- hbufs = g_list_prepend (hbufs, hbuf);
- pad->always_flush_page = TRUE;
- } else {
- hbufs = g_list_append (hbufs, hbuf);
- }
- gst_caps_unref (caps);
- }
-
- GST_LOG_OBJECT (mux, "creating next headers");
- walk = mux->collect->data;
- while (walk) {
- GstOggPad *pad;
- GstPad *thepad;
-
- pad = (GstOggPad *) walk->data;
- thepad = pad->collect.pad;
-
- walk = walk->next;
-
- GST_LOG_OBJECT (mux, "looping over headers for pad %s:%s",
- GST_DEBUG_PAD_NAME (thepad));
-
- hwalk = pad->headers;
- while (hwalk) {
- GstBuffer *buf = GST_BUFFER (hwalk->data);
- ogg_packet packet;
- ogg_page page;
-
- hwalk = hwalk->next;
-
- /* create a packet from the buffer */
- packet.packet = GST_BUFFER_DATA (buf);
- packet.bytes = GST_BUFFER_SIZE (buf);
- packet.granulepos = GST_BUFFER_OFFSET_END (buf);
- if (packet.granulepos == -1)
- packet.granulepos = 0;
- /* mark BOS and packet number */
- packet.b_o_s = (pad->packetno == 0);
- packet.packetno = pad->packetno++;
- /* mark EOS */
- packet.e_o_s = 0;
-
- /* swap the packet in */
- ogg_stream_packetin (&pad->stream, &packet);
- gst_buffer_unref (buf);
-
- /* if last header, flush page */
- if (hwalk == NULL) {
- GST_LOG_OBJECT (mux,
- "flushing page as packet %" G_GUINT64_FORMAT " is first or "
- "last packet", pad->packetno);
- while (ogg_stream_flush (&pad->stream, &page)) {
- GstBuffer *hbuf = gst_ogg_mux_buffer_from_page (mux, &page, FALSE);
-
- GST_LOG_OBJECT (mux, "swapped out page");
- hbufs = g_list_append (hbufs, hbuf);
- }
- } else {
- GST_LOG_OBJECT (mux, "try to swap out page");
- /* just try to swap out a page then */
- while (ogg_stream_pageout (&pad->stream, &page) > 0) {
- GstBuffer *hbuf = gst_ogg_mux_buffer_from_page (mux, &page, FALSE);
-
- GST_LOG_OBJECT (mux, "swapped out page");
- hbufs = g_list_append (hbufs, hbuf);
- }
- }
- }
- g_list_free (pad->headers);
- pad->headers = NULL;
- }
- /* hbufs holds all buffers for the headers now */
-
- /* create caps with the buffers */
- caps = gst_pad_get_caps (mux->srcpad);
- if (caps) {
- caps = gst_ogg_mux_set_header_on_caps (caps, hbufs);
- gst_pad_set_caps (mux->srcpad, caps);
- gst_caps_unref (caps);
- }
- /* and send the buffers */
- while (hbufs != NULL) {
- GstBuffer *buf = GST_BUFFER (hbufs->data);
-
- hbufs = g_list_delete_link (hbufs, hbufs);
-
- if ((ret = gst_ogg_mux_push_buffer (mux, buf)) != GST_FLOW_OK)
- break;
- }
- /* free any remaining nodes/buffers in case we couldn't push them */
- g_list_foreach (hbufs, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (hbufs);
-
- return ret;
-}
-
-/* this function is called to process data on the best pending pad.
- *
- * basic idea:
- *
- * 1) store the selected pad and keep on pulling until we fill a
- * complete ogg page or the ogg page is filled above the max-delay
- * threshold. This is needed because the ogg spec says that
- * you should fill a complete page with data from the same logical
- * stream. When the page is filled, go back to 1).
- * 2) before filling a page, read ahead one more buffer to see if this
- * packet is the last of the stream. We need to do this because the ogg
- * spec mandates that the last packet should have the EOS flag set before
- * sending it to ogg. if pad->buffer is NULL we need to wait to find out
- * whether there are any more buffers.
- * 3) pages get queued on a per-pad queue. Every time a page is queued, a
- * dequeue is called, which will dequeue the oldest page on any pad, provided
- * that ALL pads have at least one marked page in the queue (or remaining
- * pads are at EOS)
- */
-static GstFlowReturn
-gst_ogg_mux_process_best_pad (GstOggMux * ogg_mux, GstOggPad * best)
-{
- GstFlowReturn ret = GST_FLOW_OK;
- gboolean delta_unit;
- gint64 granulepos = 0;
- GstClockTime timestamp, gp_time;
-
- GST_LOG_OBJECT (ogg_mux, "best pad %" GST_PTR_FORMAT
- ", currently pulling from %" GST_PTR_FORMAT, best->collect.pad,
- ogg_mux->pulling);
-
- /* best->buffer is non-NULL, either the pad is EOS's or there is a next
- * buffer */
- if (best->next_buffer == NULL && !best->eos) {
- GST_WARNING_OBJECT (ogg_mux, "no subsequent buffer and EOS not reached");
- return GST_FLOW_WRONG_STATE;
- }
-
- /* if we were already pulling from one pad, but the new "best" buffer is
- * from another pad, we need to check if we have reason to flush a page
- * for the pad we were pulling from before */
- if (ogg_mux->pulling && best &&
- ogg_mux->pulling != best && ogg_mux->pulling->buffer) {
- GstOggPad *pad = ogg_mux->pulling;
-
- GstClockTime last_ts = GST_BUFFER_END_TIME (pad->buffer);
-
- /* if the next packet in the current page is going to make the page
- * too long, we need to flush */
- if (last_ts > ogg_mux->next_ts + ogg_mux->max_delay) {
- ogg_page page;
-
- GST_LOG_OBJECT (pad->collect.pad,
- GST_GP_FORMAT " stored packet %" G_GINT64_FORMAT
- " will make page too long, flushing",
- GST_BUFFER_OFFSET_END (pad->buffer), (gint64) pad->stream.packetno);
-
- while (ogg_stream_flush (&pad->stream, &page)) {
- /* end time of this page is the timestamp of the next buffer */
- ogg_mux->pulling->timestamp_end = GST_BUFFER_TIMESTAMP (pad->buffer);
- /* Place page into the per-pad queue */
- ret = gst_ogg_mux_pad_queue_page (ogg_mux, pad, &page,
- pad->first_delta);
- /* increment the page number counter */
- pad->pageno++;
- /* mark other pages as delta */
- pad->first_delta = TRUE;
- }
- pad->new_page = TRUE;
- ogg_mux->pulling = NULL;
- }
- }
-
- /* if we don't know which pad to pull on, use the best one */
- if (ogg_mux->pulling == NULL) {
- ogg_mux->pulling = best;
- GST_LOG_OBJECT (ogg_mux->pulling->collect.pad, "pulling from best pad");
-
- /* remember timestamp and gp time of first buffer for this new pad */
- if (ogg_mux->pulling != NULL) {
- ogg_mux->next_ts = GST_BUFFER_TIMESTAMP (ogg_mux->pulling->buffer);
- GST_LOG_OBJECT (ogg_mux->pulling->collect.pad, "updated times, next ts %"
- GST_TIME_FORMAT, GST_TIME_ARGS (ogg_mux->next_ts));
- } else {
- /* no pad to pull on, send EOS */
- gst_pad_push_event (ogg_mux->srcpad, gst_event_new_eos ());
- return GST_FLOW_WRONG_STATE;
- }
- }
-
- if (ogg_mux->need_headers) {
- ret = gst_ogg_mux_send_headers (ogg_mux);
- ogg_mux->need_headers = FALSE;
- }
-
- /* we are pulling from a pad, continue to do so until a page
- * has been filled and queued */
- if (ogg_mux->pulling != NULL) {
- ogg_packet packet;
- ogg_page page;
- GstBuffer *buf, *tmpbuf;
- GstOggPad *pad = ogg_mux->pulling;
- gint64 duration;
- gboolean force_flush;
-
- GST_LOG_OBJECT (ogg_mux->pulling->collect.pad, "pulling from pad");
-
- /* now see if we have a buffer */
- buf = pad->buffer;
- if (buf == NULL) {
- GST_DEBUG_OBJECT (ogg_mux, "pad was EOS");
- ogg_mux->pulling = NULL;
- return GST_FLOW_OK;
- }
-
- delta_unit = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
- duration = GST_BUFFER_DURATION (buf);
-
- /* if the current "next timestamp" on the pad is unset, then this is the
- * first packet on the new page. Update our pad's page timestamp */
- if (ogg_mux->pulling->timestamp == GST_CLOCK_TIME_NONE) {
- ogg_mux->pulling->timestamp = GST_BUFFER_TIMESTAMP (buf);
- GST_LOG_OBJECT (ogg_mux->pulling->collect.pad,
- "updated pad timestamp to %" GST_TIME_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
- }
- /* create a packet from the buffer */
- packet.packet = GST_BUFFER_DATA (buf);
- packet.bytes = GST_BUFFER_SIZE (buf);
- packet.granulepos = GST_BUFFER_OFFSET_END (buf);
- if (packet.granulepos == -1)
- packet.granulepos = 0;
- /* mark BOS and packet number */
- packet.b_o_s = (pad->packetno == 0);
- packet.packetno = pad->packetno++;
- GST_LOG_OBJECT (pad->collect.pad, GST_GP_FORMAT
- " packet %" G_GINT64_FORMAT " (%ld bytes) created from buffer",
- GST_GP_CAST (packet.granulepos), (gint64) packet.packetno,
- packet.bytes);
-
- packet.e_o_s = (pad->eos ? 1 : 0);
- tmpbuf = NULL;
-
- /* we flush when we see a new keyframe */
- force_flush = (pad->prev_delta && !delta_unit) || pad->always_flush_page;
- if (duration != -1) {
- pad->duration += duration;
- /* if page duration exceeds max, flush page */
- if (pad->duration > ogg_mux->max_page_delay) {
- force_flush = TRUE;
- pad->duration = 0;
- }
- }
-
- if (GST_BUFFER_IS_DISCONT (buf)) {
- GST_LOG_OBJECT (pad->collect.pad, "got discont");
- packet.packetno++;
- /* No public API for this; hack things in */
- pad->stream.pageno++;
- force_flush = TRUE;
- }
-
- /* flush the currently built page if necessary */
- if (force_flush) {
- GST_LOG_OBJECT (pad->collect.pad,
- GST_GP_FORMAT " forced flush of page before this packet",
- GST_BUFFER_OFFSET_END (pad->buffer));
- while (ogg_stream_flush (&pad->stream, &page)) {
- /* end time of this page is the timestamp of the next buffer */
- ogg_mux->pulling->timestamp_end = GST_BUFFER_TIMESTAMP (pad->buffer);
- ret = gst_ogg_mux_pad_queue_page (ogg_mux, pad, &page,
- pad->first_delta);
-
- /* increment the page number counter */
- pad->pageno++;
- /* mark other pages as delta */
- pad->first_delta = TRUE;
- }
- pad->new_page = TRUE;
- }
-
- /* if this is the first packet of a new page figure out the delta flag */
- if (pad->new_page) {
- if (delta_unit) {
- /* mark the page as delta */
- pad->first_delta = TRUE;
- } else {
- /* got a keyframe */
- if (ogg_mux->delta_pad == pad) {
- /* if we get it on the pad with deltaunits,
- * we mark the page as non delta */
- pad->first_delta = FALSE;
- } else if (ogg_mux->delta_pad != NULL) {
- /* if there are pads with delta frames, we
- * must mark this one as delta */
- pad->first_delta = TRUE;
- } else {
- pad->first_delta = FALSE;
- }
- }
- pad->new_page = FALSE;
- }
-
- /* save key unit to track delta->key unit transitions */
- pad->prev_delta = delta_unit;
-
- /* swap the packet in */
- if (packet.e_o_s == 1)
- GST_DEBUG_OBJECT (pad->collect.pad, "swapping in EOS packet");
- if (packet.b_o_s == 1)
- GST_DEBUG_OBJECT (pad->collect.pad, "swapping in BOS packet");
-
- ogg_stream_packetin (&pad->stream, &packet);
-
- gp_time = GST_BUFFER_OFFSET (pad->buffer);
- granulepos = GST_BUFFER_OFFSET_END (pad->buffer);
- timestamp = GST_BUFFER_TIMESTAMP (pad->buffer);
-
- GST_LOG_OBJECT (pad->collect.pad,
- GST_GP_FORMAT " packet %" G_GINT64_FORMAT ", gp time %"
- GST_TIME_FORMAT ", timestamp %" GST_TIME_FORMAT " packetin'd",
- granulepos, (gint64) packet.packetno, GST_TIME_ARGS (gp_time),
- GST_TIME_ARGS (timestamp));
- /* don't need the old buffer anymore */
- gst_buffer_unref (pad->buffer);
- /* store new readahead buffer */
- pad->buffer = tmpbuf;
-
- /* let ogg write out the pages now. The packet we got could end
- * up in more than one page so we need to write them all */
- if (ogg_stream_pageout (&pad->stream, &page) > 0) {
- /* we have a new page, so we need to timestamp it correctly.
- * if this fresh packet ends on this page, then the page's granulepos
- * comes from that packet, and we should set this buffer's timestamp */
-
- GST_LOG_OBJECT (pad->collect.pad,
- GST_GP_FORMAT " packet %" G_GINT64_FORMAT ", time %"
- GST_TIME_FORMAT ") caused new page",
- granulepos, (gint64) packet.packetno, GST_TIME_ARGS (timestamp));
- GST_LOG_OBJECT (pad->collect.pad,
- GST_GP_FORMAT " new page %ld",
- GST_GP_CAST (ogg_page_granulepos (&page)), pad->stream.pageno);
-
- if (ogg_page_granulepos (&page) == granulepos) {
- /* the packet we streamed in finishes on the current page,
- * because the page's granulepos is the granulepos of the last
- * packet completed on that page,
- * so update the timestamp that we will give to the page */
- GST_LOG_OBJECT (pad->collect.pad,
- GST_GP_FORMAT
- " packet finishes on current page, updating gp time to %"
- GST_TIME_FORMAT, granulepos, GST_TIME_ARGS (gp_time));
- pad->gp_time = gp_time;
- } else {
- GST_LOG_OBJECT (pad->collect.pad,
- GST_GP_FORMAT
- " packet spans beyond current page, keeping old gp time %"
- GST_TIME_FORMAT, granulepos, GST_TIME_ARGS (pad->gp_time));
- }
-
- /* push the page */
- /* end time of this page is the timestamp of the next buffer */
- pad->timestamp_end = timestamp;
- ret = gst_ogg_mux_pad_queue_page (ogg_mux, pad, &page, pad->first_delta);
- pad->pageno++;
- /* mark next pages as delta */
- pad->first_delta = TRUE;
-
- /* use an inner loop here to flush the remaining pages and
- * mark them as delta frames as well */
- while (ogg_stream_pageout (&pad->stream, &page) > 0) {
- if (ogg_page_granulepos (&page) == granulepos) {
- /* the page has taken up the new packet completely, which means
- * the packet ends the page and we can update the gp time
- * before pushing out */
- pad->gp_time = gp_time;
- }
-
- /* we have a complete page now, we can push the page
- * and make sure to pull on a new pad the next time around */
- ret = gst_ogg_mux_pad_queue_page (ogg_mux, pad, &page,
- pad->first_delta);
- /* increment the page number counter */
- pad->pageno++;
- }
- /* need a new page as well */
- pad->new_page = TRUE;
- pad->duration = 0;
- /* we're done pulling on this pad, make sure to choose a new
- * pad for pulling in the next iteration */
- ogg_mux->pulling = NULL;
- }
-
- /* Update the gp time, if necessary, since any future page will have at
- * least this gp time.
- */
- if (pad->gp_time < gp_time) {
- pad->gp_time = gp_time;
- GST_LOG_OBJECT (pad->collect.pad,
- "Updated running gp time of pad %" GST_PTR_FORMAT
- " to %" GST_TIME_FORMAT, pad->collect.pad, GST_TIME_ARGS (gp_time));
- }
- }
-
- return ret;
-}
-
-/* all_pads_eos:
- *
- * Checks if all pads are EOS'd by peeking.
- *
- * Returns TRUE if all pads are EOS.
- */
-static gboolean
-all_pads_eos (GstCollectPads * pads)
-{
- GSList *walk;
- gboolean alleos = TRUE;
-
- walk = pads->data;
- while (walk) {
- GstBuffer *buf;
- GstCollectData *data = (GstCollectData *) walk->data;
-
- buf = gst_collect_pads_peek (pads, data);
- if (buf) {
- alleos = FALSE;
- gst_buffer_unref (buf);
- goto beach;
- }
- walk = walk->next;
- }
-beach:
- return alleos;
-}
-
-/* This function is called when there is data on all pads.
- *
- * It finds a pad to pull on, this is done by looking at the buffers
- * to decide which one to use, and using the 'oldest' one first. It then calls
- * gst_ogg_mux_process_best_pad() to process as much data as possible.
- *
- * If all the pads have received EOS, it flushes out all data by continually
- * getting the best pad and calling gst_ogg_mux_process_best_pad() until they
- * are all empty, and then sends EOS.
- */
-static GstFlowReturn
-gst_ogg_mux_collected (GstCollectPads * pads, GstOggMux * ogg_mux)
-{
- GstOggPad *best;
- GstFlowReturn ret;
- gint activebefore;
-
- GST_LOG_OBJECT (ogg_mux, "collected");
-
- activebefore = ogg_mux->active_pads;
-
- /* queue buffers on all pads; find a buffer with the lowest timestamp */
- best = gst_ogg_mux_queue_pads (ogg_mux);
- if (best && !best->buffer) {
- GST_DEBUG_OBJECT (ogg_mux, "No buffer available on best pad");
- return GST_FLOW_OK;
- }
-
- if (!best) {
- return GST_FLOW_WRONG_STATE;
- }
-
- ret = gst_ogg_mux_process_best_pad (ogg_mux, best);
-
- if (ogg_mux->active_pads < activebefore) {
- /* If the active pad count went down, this mean at least one pad has gone
- * EOS. Since CollectPads only calls _collected() once when all pads are
- * EOS, and our code doesn't _pop() from all pads we need to check that by
- * peeking on all pads, else we won't be called again and the muxing will
- * not terminate (push out EOS). */
-
- /* if all the pads have been removed, flush all pending data */
- if ((ret == GST_FLOW_OK) && all_pads_eos (pads)) {
- GST_LOG_OBJECT (ogg_mux, "no pads remaining, flushing data");
-
- do {
- best = gst_ogg_mux_queue_pads (ogg_mux);
- if (best)
- ret = gst_ogg_mux_process_best_pad (ogg_mux, best);
- } while ((ret == GST_FLOW_OK) && (best != NULL));
-
- GST_DEBUG_OBJECT (ogg_mux, "Pushing EOS");
- gst_pad_push_event (ogg_mux->srcpad, gst_event_new_eos ());
- }
- }
-
- return ret;
-}
-
-static void
-gst_ogg_mux_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- GstOggMux *ogg_mux;
-
- ogg_mux = GST_OGG_MUX (object);
-
- switch (prop_id) {
- case ARG_MAX_DELAY:
- g_value_set_uint64 (value, ogg_mux->max_delay);
- break;
- case ARG_MAX_PAGE_DELAY:
- g_value_set_uint64 (value, ogg_mux->max_page_delay);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_ogg_mux_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
-{
- GstOggMux *ogg_mux;
-
- ogg_mux = GST_OGG_MUX (object);
-
- switch (prop_id) {
- case ARG_MAX_DELAY:
- ogg_mux->max_delay = g_value_get_uint64 (value);
- break;
- case ARG_MAX_PAGE_DELAY:
- ogg_mux->max_page_delay = g_value_get_uint64 (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/* reset all variables in the ogg pads. */
-static void
-gst_ogg_mux_init_collectpads (GstCollectPads * collect)
-{
- GSList *walk;
-
- walk = collect->data;
- while (walk) {
- GstOggPad *oggpad = (GstOggPad *) walk->data;
-
- ogg_stream_init (&oggpad->stream, oggpad->serial);
- oggpad->packetno = 0;
- oggpad->pageno = 0;
- oggpad->eos = FALSE;
- /* we assume there will be some control data first for this pad */
- oggpad->state = GST_OGG_PAD_STATE_CONTROL;
- oggpad->new_page = TRUE;
- oggpad->first_delta = FALSE;
- oggpad->prev_delta = FALSE;
- oggpad->pagebuffers = g_queue_new ();
-
- walk = g_slist_next (walk);
- }
-}
-
-/* Clear all buffers from the collectpads object */
-static void
-gst_ogg_mux_clear_collectpads (GstCollectPads * collect)
-{
- GSList *walk;
-
- for (walk = collect->data; walk; walk = g_slist_next (walk)) {
- GstOggPad *oggpad = (GstOggPad *) walk->data;
- GstBuffer *buf;
-
- ogg_stream_clear (&oggpad->stream);
-
- while ((buf = g_queue_pop_head (oggpad->pagebuffers)) != NULL) {
- gst_buffer_unref (buf);
- }
- g_queue_free (oggpad->pagebuffers);
- oggpad->pagebuffers = NULL;
-
- if (oggpad->buffer) {
- gst_buffer_unref (oggpad->buffer);
- oggpad->buffer = NULL;
- }
- if (oggpad->next_buffer) {
- gst_buffer_unref (oggpad->next_buffer);
- oggpad->next_buffer = NULL;
- }
- }
-}
-
-static GstStateChangeReturn
-gst_ogg_mux_change_state (GstElement * element, GstStateChange transition)
-{
- GstOggMux *ogg_mux;
- GstStateChangeReturn ret;
-
- ogg_mux = GST_OGG_MUX (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- gst_ogg_mux_clear (ogg_mux);
- gst_ogg_mux_init_collectpads (ogg_mux->collect);
- gst_collect_pads_start (ogg_mux->collect);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- gst_collect_pads_stop (ogg_mux->collect);
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- gst_ogg_mux_clear_collectpads (ogg_mux->collect);
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-gboolean
-gst_ogg_mux_plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (gst_ogg_mux_debug, "oggmux", 0, "ogg muxer");
-
- return gst_element_register (plugin, "oggmux", GST_RANK_PRIMARY,
- GST_TYPE_OGG_MUX);
-}
diff --git a/ext/ogg/gstoggmux.h b/ext/ogg/gstoggmux.h
deleted file mode 100644
index fc0944f2..00000000
--- a/ext/ogg/gstoggmux.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/* OGG muxer plugin for GStreamer
- * Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
- * Copyright (C) 2006 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_OGG_MUX_H__
-#define __GST_OGGEMUX_H__
-
-#include <ogg/ogg.h>
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_OGG_MUX (gst_ogg_mux_get_type())
-#define GST_OGG_MUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OGG_MUX, GstOggMux))
-#define GST_OGG_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OGG_MUX, GstOggMux))
-#define GST_IS_OGG_MUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OGG_MUX))
-#define GST_IS_OGG_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OGG_MUX))
-
-typedef struct _GstOggMux GstOggMux;
-typedef struct _GstOggMuxClass GstOggMuxClass;
-
-typedef enum
-{
- GST_OGG_PAD_STATE_CONTROL = 0,
- GST_OGG_PAD_STATE_DATA = 1
-}
-GstOggPadState;
-
-/* all information needed for one ogg stream */
-typedef struct
-{
- GstCollectData collect; /* we extend the CollectData */
-
- /* These two buffers make a very simple queue - they enter as 'next_buffer'
- * and (usually) leave as 'buffer', except at EOS, when buffer will be NULL */
- GstBuffer *buffer; /* the first waiting buffer for the pad */
- GstBuffer *next_buffer; /* the second waiting buffer for the pad */
-
- gint serial;
- ogg_stream_state stream;
- gint64 packetno; /* number of next packet */
- gint64 pageno; /* number of next page */
- guint64 duration; /* duration of current page */
- gboolean eos;
- gint64 offset;
- GstClockTime timestamp; /* timestamp of the first packet on the next
- * page to be dequeued */
- GstClockTime timestamp_end; /* end timestamp of last complete packet on
- the next page to be dequeued */
- GstClockTime gp_time; /* time corresponding to the gp value of the
- last complete packet on the next page to be
- dequeued */
-
- GstOggPadState state; /* state of the pad */
-
- GList *headers;
-
- GQueue *pagebuffers; /* List of pages in buffers ready for pushing */
-
- gboolean new_page; /* starting a new page */
- gboolean first_delta; /* was the first packet in the page a delta */
- gboolean prev_delta; /* was the previous buffer a delta frame */
-
- GstPadEventFunction collect_event;
-
- gboolean always_flush_page;
-}
-GstOggPad;
-
-/**
- * GstOggMux:
- *
- * The ogg muxer object structure.
- */
-struct _GstOggMux
-{
- GstElement element;
-
- /* source pad */
- GstPad *srcpad;
-
- /* sinkpads */
- GstCollectPads *collect;
-
- /* number of pads which have not received EOS */
- gint active_pads;
-
- /* the pad we are currently using to fill a page */
- GstOggPad *pulling;
-
- /* next timestamp for the page */
- GstClockTime next_ts;
-
- /* Last timestamp actually output on src pad */
- GstClockTime last_ts;
-
- /* offset in stream */
- guint64 offset;
-
- /* need_headers */
- gboolean need_headers;
-
- guint64 max_delay;
- guint64 max_page_delay;
-
- GstOggPad *delta_pad; /* when a delta frame is detected on a stream, we mark
- pages as delta frames up to the page that has the
- keyframe */
-
-};
-
-struct _GstOggMuxClass
-{
- GstElementClass parent_class;
-};
-
-GType gst_ogg_mux_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_OGG_MUX_H__ */
diff --git a/ext/ogg/gstoggparse.c b/ext/ogg/gstoggparse.c
deleted file mode 100644
index a86958b5..00000000
--- a/ext/ogg/gstoggparse.c
+++ /dev/null
@@ -1,698 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005 Michael Smith <msmith@fluendo.com>
- *
- * gstoggparse.c: ogg stream parser
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-/* This ogg parser is essentially a subset of the ogg demuxer - rather than
- * fully demuxing into packets, we only parse out the pages, create one
- * GstBuffer per page, set all the appropriate flags on those pages, set caps
- * appropriately (particularly the 'streamheader' which gives all the header
- * pages required for initialing decode).
- *
- * It's dramatically simpler than the full demuxer as it does not support
- * seeking.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <gst/gst.h>
-#include <ogg/ogg.h>
-#include <string.h>
-
-#include "gstoggstream.h"
-
-static const GstElementDetails gst_ogg_parse_details =
-GST_ELEMENT_DETAILS ("Ogg parser",
- "Codec/Parser",
- "parse ogg streams into pages (info about ogg: http://xiph.org)",
- "Michael Smith <msmith@fluendo.com>");
-
-GST_DEBUG_CATEGORY_STATIC (gst_ogg_parse_debug);
-#define GST_CAT_DEFAULT gst_ogg_parse_debug
-
-#define GST_TYPE_OGG_PARSE (gst_ogg_parse_get_type())
-#define GST_OGG_PARSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OGG_PARSE, GstOggParse))
-#define GST_OGG_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OGG_PARSE, GstOggParse))
-#define GST_IS_OGG_PARSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OGG_PARSE))
-#define GST_IS_OGG_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OGG_PARSE))
-
-static GType gst_ogg_parse_get_type (void);
-
-typedef struct _GstOggParse GstOggParse;
-typedef struct _GstOggParseClass GstOggParseClass;
-
-struct _GstOggParse
-{
- GstElement element;
-
- GstPad *sinkpad; /* Sink pad we're reading data from */
-
- GstPad *srcpad; /* Source pad we're writing to */
-
- GSList *oggstreams; /* list of GstOggStreams for known streams */
-
- gint64 offset; /* Current stream offset */
-
- gboolean in_headers; /* Set if we're reading headers for streams */
-
- gboolean last_page_not_bos; /* Set if we've seen a non-BOS page */
-
- ogg_sync_state sync; /* Ogg page synchronisation */
-
- GstCaps *caps; /* Our src caps */
-};
-
-struct _GstOggParseClass
-{
- GstElementClass parent_class;
-};
-
-static void gst_ogg_parse_base_init (gpointer g_class);
-static void gst_ogg_parse_class_init (GstOggParseClass * klass);
-static void gst_ogg_parse_init (GstOggParse * ogg);
-static GstElementClass *parent_class = NULL;
-
-static GType
-gst_ogg_parse_get_type (void)
-{
- static GType ogg_parse_type = 0;
-
- if (!ogg_parse_type) {
- static const GTypeInfo ogg_parse_info = {
- sizeof (GstOggParseClass),
- gst_ogg_parse_base_init,
- NULL,
- (GClassInitFunc) gst_ogg_parse_class_init,
- NULL,
- NULL,
- sizeof (GstOggParse),
- 0,
- (GInstanceInitFunc) gst_ogg_parse_init,
- };
-
- ogg_parse_type = g_type_register_static (GST_TYPE_ELEMENT, "GstOggParse",
- &ogg_parse_info, 0);
- }
- return ogg_parse_type;
-}
-
-static void
-free_stream (GstOggStream * stream)
-{
- g_list_foreach (stream->headers, (GFunc) gst_mini_object_unref, NULL);
- g_list_foreach (stream->unknown_pages, (GFunc) gst_mini_object_unref, NULL);
-
- g_free (stream);
-}
-
-static void
-gst_ogg_parse_delete_all_streams (GstOggParse * ogg)
-{
- g_slist_foreach (ogg->oggstreams, (GFunc) free_stream, NULL);
- g_slist_free (ogg->oggstreams);
- ogg->oggstreams = NULL;
-}
-
-static GstOggStream *
-gst_ogg_parse_new_stream (GstOggParse * parser, ogg_page * page)
-{
- GstOggStream *stream;
- ogg_packet packet;
- int ret;
- guint32 serialno;
-
- serialno = ogg_page_serialno (page);
-
- GST_DEBUG_OBJECT (parser, "creating new stream %08x", serialno);
-
- stream = g_new0 (GstOggStream, 1);
-
- stream->serialno = serialno;
- stream->in_headers = 1;
-
- if (ogg_stream_init (&stream->stream, serialno) != 0) {
- GST_ERROR ("Could not initialize ogg_stream struct for serial %08x.",
- serialno);
- return NULL;
- }
-
- /* FIXME check return */
- ogg_stream_pagein (&stream->stream, page);
-
- /* FIXME check return */
- ret = ogg_stream_packetout (&stream->stream, &packet);
- if (ret == 1) {
- gst_ogg_stream_setup_map (stream, &packet);
- }
-
- parser->oggstreams = g_slist_append (parser->oggstreams, stream);
-
- return stream;
-}
-
-static GstOggStream *
-gst_ogg_parse_find_stream (GstOggParse * parser, guint32 serialno)
-{
- GSList *l;
-
- for (l = parser->oggstreams; l != NULL; l = l->next) {
- GstOggStream *stream = (GstOggStream *) l->data;
-
- if (stream->serialno == serialno)
- return stream;
- }
- return NULL;
-}
-
-/* signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- ARG_0
- /* FILL ME */
-};
-
-static GstStaticPadTemplate ogg_parse_src_template_factory =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/ogg")
- );
-
-static GstStaticPadTemplate ogg_parse_sink_template_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/ogg")
- );
-
-static void gst_ogg_parse_dispose (GObject * object);
-static GstStateChangeReturn gst_ogg_parse_change_state (GstElement * element,
- GstStateChange transition);
-static GstFlowReturn gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer);
-
-static void
-gst_ogg_parse_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &gst_ogg_parse_details);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&ogg_parse_sink_template_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&ogg_parse_src_template_factory));
-}
-
-static void
-gst_ogg_parse_class_init (GstOggParseClass * klass)
-{
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- gstelement_class->change_state = gst_ogg_parse_change_state;
-
- gobject_class->dispose = gst_ogg_parse_dispose;
-}
-
-static void
-gst_ogg_parse_init (GstOggParse * ogg)
-{
- /* create the sink and source pads */
- ogg->sinkpad =
- gst_pad_new_from_static_template (&ogg_parse_sink_template_factory,
- "sink");
- ogg->srcpad =
- gst_pad_new_from_static_template (&ogg_parse_src_template_factory, "src");
-
- /* TODO: Are there any events we must handle? */
- /* gst_pad_set_event_function (ogg->sinkpad, gst_ogg_parse_handle_event); */
- gst_pad_set_chain_function (ogg->sinkpad, gst_ogg_parse_chain);
-
- gst_element_add_pad (GST_ELEMENT (ogg), ogg->sinkpad);
- gst_element_add_pad (GST_ELEMENT (ogg), ogg->srcpad);
-
- ogg->oggstreams = NULL;
-}
-
-static void
-gst_ogg_parse_dispose (GObject * object)
-{
- GstOggParse *ogg = GST_OGG_PARSE (object);
-
- GST_LOG_OBJECT (ogg, "Disposing of object %p", ogg);
-
- ogg_sync_clear (&ogg->sync);
- gst_ogg_parse_delete_all_streams (ogg);
-
- if (ogg->caps) {
- gst_caps_unref (ogg->caps);
- ogg->caps = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-/* submit the given buffer to the ogg sync.
- *
- * Returns the number of bytes submited.
- */
-static gint
-gst_ogg_parse_submit_buffer (GstOggParse * ogg, GstBuffer * buffer)
-{
- guint size;
- guint8 *data;
- gchar *oggbuffer;
-
- size = GST_BUFFER_SIZE (buffer);
- data = GST_BUFFER_DATA (buffer);
-
- /* We now have a buffer, submit it to the ogg sync layer */
- oggbuffer = ogg_sync_buffer (&ogg->sync, size);
- memcpy (oggbuffer, data, size);
- ogg_sync_wrote (&ogg->sync, size);
-
- /* We've copied all the neccesary data, so we're done with the buffer */
- gst_buffer_unref (buffer);
-
- return size;
-}
-
-static void
-gst_ogg_parse_append_header (GValue * array, GstBuffer * buf)
-{
- GValue value = { 0 };
- /* We require a copy to avoid circular refcounts */
- GstBuffer *buffer = gst_buffer_copy (buf);
-
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
-
- g_value_init (&value, GST_TYPE_BUFFER);
- gst_value_set_buffer (&value, buffer);
- gst_value_array_append_value (array, &value);
- g_value_unset (&value);
-
-}
-
-typedef enum
-{
- PAGE_HEADER, /* Header page */
- PAGE_DATA, /* Data page */
- PAGE_PENDING, /* We don't know yet, we'll have to see some future pages */
-} page_type;
-
-static page_type
-gst_ogg_parse_is_header (GstOggParse * ogg, GstOggStream * stream,
- ogg_page * page)
-{
- ogg_int64_t gpos = ogg_page_granulepos (page);
-
- if (gpos < 0)
- return PAGE_PENDING;
-
- /* This is good enough for now, but technically requires codec-specific
- * behaviour to be perfect. This is where we need the mooted library for
- * this stuff, which nobody has written.
- */
- if (gpos > 0)
- return PAGE_DATA;
- else
- return PAGE_HEADER;
-}
-
-static GstBuffer *
-gst_ogg_parse_buffer_from_page (ogg_page * page,
- guint64 offset, gboolean delta, GstClockTime timestamp)
-{
- int size = page->header_len + page->body_len;
- GstBuffer *buf = gst_buffer_new_and_alloc (size);
-
- memcpy (GST_BUFFER_DATA (buf), page->header, page->header_len);
- memcpy (GST_BUFFER_DATA (buf) + page->header_len, page->body, page->body_len);
-
- GST_BUFFER_TIMESTAMP (buf) = timestamp;
- GST_BUFFER_OFFSET (buf) = offset;
- GST_BUFFER_OFFSET_END (buf) = offset + size;
-
- return buf;
-}
-
-
-/* Reads in buffers, parses them, reframes into one-buffer-per-ogg-page, submits
- * pages to output pad.
- */
-static GstFlowReturn
-gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstOggParse *ogg;
- GstFlowReturn result = GST_FLOW_OK;
- gint ret = -1;
- guint32 serialno;
- GstBuffer *pagebuffer;
- GstClockTime buffertimestamp = GST_BUFFER_TIMESTAMP (buffer);
-
- ogg = GST_OGG_PARSE (GST_OBJECT_PARENT (pad));
-
- GST_LOG_OBJECT (ogg, "Chain function received buffer of size %d",
- GST_BUFFER_SIZE (buffer));
-
- gst_ogg_parse_submit_buffer (ogg, buffer);
-
- while (ret != 0 && result == GST_FLOW_OK) {
- ogg_page page;
-
- /* We use ogg_sync_pageseek() rather than ogg_sync_pageout() so that we can
- * track how many bytes the ogg layer discarded (in the case of sync errors,
- * etc.); this allows us to accurately track the current stream offset
- */
- ret = ogg_sync_pageseek (&ogg->sync, &page);
- if (ret == 0) {
- /* need more data, that's fine... */
- break;
- } else if (ret < 0) {
- /* discontinuity; track how many bytes we skipped (-ret) */
- ogg->offset -= ret;
- } else {
- gint64 granule = ogg_page_granulepos (&page);
-#ifndef GST_DISABLE_GST_DEBUG
- int bos = ogg_page_bos (&page);
-#endif
- guint64 startoffset = ogg->offset;
- GstOggStream *stream;
-
- serialno = ogg_page_serialno (&page);
- stream = gst_ogg_parse_find_stream (ogg, serialno);
-
- GST_LOG_OBJECT (ogg, "Timestamping outgoing buffer as %" GST_TIME_FORMAT,
- GST_TIME_ARGS (buffertimestamp));
-
- buffertimestamp = gst_ogg_stream_get_end_time_for_granulepos (stream,
- granule);
- pagebuffer = gst_ogg_parse_buffer_from_page (&page, startoffset, FALSE,
- buffertimestamp);
-
- /* We read out 'ret' bytes, so we set the next offset appropriately */
- ogg->offset += ret;
-
- GST_LOG_OBJECT (ogg,
- "processing ogg page (serial %08x, pageno %ld, "
- "granule pos %" G_GUINT64_FORMAT ", bos %d, offset %"
- G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT ")",
- serialno, ogg_page_pageno (&page),
- granule, bos, startoffset, ogg->offset);
-
- if (ogg_page_bos (&page)) {
- /* If we've seen this serialno before, this is technically an error,
- * we log this case but accept it - this one replaces the previous
- * stream with this serialno. We can do this since we're streaming, and
- * not supporting seeking...
- */
- GstOggStream *stream = gst_ogg_parse_find_stream (ogg, serialno);
-
- if (stream != NULL) {
- GST_LOG_OBJECT (ogg, "Incorrect stream; repeats serial number %u "
- "at offset %" G_GINT64_FORMAT, serialno, ogg->offset);
- }
-
- if (ogg->last_page_not_bos) {
- GST_LOG_OBJECT (ogg, "Deleting all referenced streams, found a new "
- "chain starting with serial %u", serialno);
- gst_ogg_parse_delete_all_streams (ogg);
- }
-
- stream = gst_ogg_parse_new_stream (ogg, &page);
-
- ogg->last_page_not_bos = FALSE;
-
- gst_buffer_ref (pagebuffer);
- stream->headers = g_list_append (stream->headers, pagebuffer);
-
- if (!ogg->in_headers) {
- GST_LOG_OBJECT (ogg,
- "Found start of new chain at offset %" G_GUINT64_FORMAT,
- startoffset);
- ogg->in_headers = 1;
- }
-
- /* For now, we just keep the header buffer in the stream->headers list;
- * it actually gets output once we've collected the entire set
- */
- } else {
- /* Non-BOS page. Either: we're outside headers, and this isn't a
- * header (normal data), outside headers and this is (error!), inside
- * headers, this is (append header), or inside headers and this isn't
- * (we've found the end of headers; flush the lot!)
- *
- * Before that, we flag that the last page seen (this one) was not a
- * BOS page; that way we know that when we next see a BOS page it's a
- * new chain, and we can flush all existing streams.
- */
- page_type type;
- GstOggStream *stream = gst_ogg_parse_find_stream (ogg, serialno);
-
- if (!stream) {
- GST_LOG_OBJECT (ogg,
- "Non-BOS page unexpectedly found at %" G_GINT64_FORMAT,
- ogg->offset);
- goto failure;
- }
-
- ogg->last_page_not_bos = TRUE;
-
- type = gst_ogg_parse_is_header (ogg, stream, &page);
-
- if (type == PAGE_PENDING && ogg->in_headers) {
- gst_buffer_ref (pagebuffer);
-
- stream->unknown_pages = g_list_append (stream->unknown_pages,
- pagebuffer);
- } else if (type == PAGE_HEADER) {
- if (!ogg->in_headers) {
- GST_LOG_OBJECT (ogg, "Header page unexpectedly found outside "
- "headers at offset %" G_GINT64_FORMAT, ogg->offset);
- goto failure;
- } else {
- /* Append the header to the buffer list, after any unknown previous
- * pages
- */
- stream->headers = g_list_concat (stream->headers,
- stream->unknown_pages);
- g_list_free (stream->unknown_pages);
- gst_buffer_ref (pagebuffer);
- stream->headers = g_list_append (stream->headers, pagebuffer);
- }
- } else { /* PAGE_DATA, or PAGE_PENDING but outside headers */
- if (ogg->in_headers) {
- /* First non-header page... set caps, flush headers.
- *
- * First up, we build a single GValue list of all the pagebuffers
- * we're using for the headers, in order.
- * Then we set this on the caps structure. Then we can start pushing
- * buffers for the headers, and finally we send this non-header
- * page.
- */
- GstCaps *caps;
- GstStructure *structure;
- GValue array = { 0 };
- gint count = 0;
- gboolean found_pending_headers = FALSE;
- GSList *l;
-
- g_value_init (&array, GST_TYPE_ARRAY);
-
- for (l = ogg->oggstreams; l != NULL; l = l->next) {
- GstOggStream *stream = (GstOggStream *) l->data;
-
- if (g_list_length (stream->headers) == 0) {
- GST_LOG_OBJECT (ogg, "No primary header found for stream %08lx",
- stream->serialno);
- goto failure;
- }
-
- gst_ogg_parse_append_header (&array,
- GST_BUFFER (stream->headers->data));
- count++;
- }
-
- for (l = ogg->oggstreams; l != NULL; l = l->next) {
- GstOggStream *stream = (GstOggStream *) l->data;
- int j;
-
- for (j = 1; j < g_list_length (stream->headers); j++) {
- gst_ogg_parse_append_header (&array,
- GST_BUFFER (g_list_nth_data (stream->headers, j)));
- count++;
- }
- }
-
- caps = gst_pad_get_caps (ogg->srcpad);
- caps = gst_caps_make_writable (caps);
-
- structure = gst_caps_get_structure (caps, 0);
- gst_structure_set_value (structure, "streamheader", &array);
-
- gst_pad_set_caps (ogg->srcpad, caps);
-
- g_value_unset (&array);
-
- if (ogg->caps)
- gst_caps_unref (ogg->caps);
- ogg->caps = caps;
-
- GST_LOG_OBJECT (ogg, "Set \"streamheader\" caps with %d buffers "
- "(one per page)", count);
-
- /* Now, we do the same thing, but push buffers... */
- for (l = ogg->oggstreams; l != NULL; l = l->next) {
- GstOggStream *stream = (GstOggStream *) l->data;
- GstBuffer *buf = GST_BUFFER (stream->headers->data);
-
- gst_buffer_set_caps (buf, caps);
-
- result = gst_pad_push (ogg->srcpad, buf);
- if (result != GST_FLOW_OK)
- return result;
- }
- for (l = ogg->oggstreams; l != NULL; l = l->next) {
- GstOggStream *stream = (GstOggStream *) l->data;
- int j;
-
- for (j = 1; j < g_list_length (stream->headers); j++) {
- GstBuffer *buf =
- GST_BUFFER (g_list_nth_data (stream->headers, j));
- gst_buffer_set_caps (buf, caps);
-
- result = gst_pad_push (ogg->srcpad, buf);
- if (result != GST_FLOW_OK)
- return result;
- }
- }
-
- ogg->in_headers = 0;
-
- /* And finally the pending data pages */
- for (l = ogg->oggstreams; l != NULL; l = l->next) {
- GstOggStream *stream = (GstOggStream *) l->data;
- GList *k;
-
- if (stream->unknown_pages == NULL)
- continue;
-
- if (found_pending_headers) {
- GST_WARNING_OBJECT (ogg, "Incorrectly muxed headers found at "
- "approximate offset %" G_GINT64_FORMAT, ogg->offset);
- }
- found_pending_headers = TRUE;
-
- GST_LOG_OBJECT (ogg, "Pushing %d pending pages after headers",
- g_list_length (stream->unknown_pages) + 1);
-
- for (k = stream->unknown_pages; k != NULL; k = k->next) {
- GstBuffer *buf;
-
- buf = GST_BUFFER (k->data);
- gst_buffer_set_caps (buf, caps);
- result = gst_pad_push (ogg->srcpad, buf);
- if (result != GST_FLOW_OK)
- return result;
- }
- g_list_foreach (stream->unknown_pages,
- (GFunc) gst_mini_object_unref, NULL);
- g_list_free (stream->unknown_pages);
- stream->unknown_pages = NULL;
- }
-
- gst_buffer_set_caps (pagebuffer, caps);
-
- result = gst_pad_push (ogg->srcpad, GST_BUFFER (pagebuffer));
- if (result != GST_FLOW_OK)
- return result;
- } else {
- /* Normal data page, submit buffer */
- gst_buffer_set_caps (pagebuffer, ogg->caps);
- result = gst_pad_push (ogg->srcpad, GST_BUFFER (pagebuffer));
- if (result != GST_FLOW_OK)
- return result;
- }
- }
- }
- }
- }
-
- return result;
-
-failure:
- gst_pad_push_event (GST_PAD (ogg->srcpad), gst_event_new_eos ());
- return GST_FLOW_ERROR;
-}
-
-static GstStateChangeReturn
-gst_ogg_parse_change_state (GstElement * element, GstStateChange transition)
-{
- GstOggParse *ogg;
- GstStateChangeReturn result = GST_STATE_CHANGE_FAILURE;
-
- ogg = GST_OGG_PARSE (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- ogg_sync_init (&ogg->sync);
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- ogg_sync_reset (&ogg->sync);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- default:
- break;
- }
-
- result = parent_class->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- ogg_sync_clear (&ogg->sync);
- break;
- default:
- break;
- }
- return result;
-}
-
-gboolean
-gst_ogg_parse_plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (gst_ogg_parse_debug, "oggparse", 0, "ogg parser");
-
- return gst_element_register (plugin, "oggparse", GST_RANK_NONE,
- GST_TYPE_OGG_PARSE);
-}
diff --git a/ext/ogg/gstoggstream.c b/ext/ogg/gstoggstream.c
deleted file mode 100644
index 3dac5ad0..00000000
--- a/ext/ogg/gstoggstream.c
+++ /dev/null
@@ -1,1315 +0,0 @@
-/* GStreamer Ogg Granulepos Mapping Utility Functions
- * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
- * Copyright (C) 2009 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstoggstream.h"
-#include "dirac_parse.h"
-
-#include <gst/riff/riff-media.h>
-
-#include <string.h>
-
-GST_DEBUG_CATEGORY_EXTERN (gst_ogg_demux_debug);
-GST_DEBUG_CATEGORY_EXTERN (gst_ogg_demux_setup_debug);
-#define GST_CAT_DEFAULT gst_ogg_demux_debug
-
-typedef struct _GstOggMap GstOggMap;
-
-typedef gboolean (*GstOggMapSetupFunc) (GstOggStream * pad,
- ogg_packet * packet);
-typedef GstClockTime (*GstOggMapToTimeFunc) (GstOggStream * pad,
- gint64 granulepos);
-typedef gint64 (*GstOggMapToGranuleFunc) (GstOggStream * pad,
- gint64 granulepos);
-typedef gint64 (*GstOggMapToGranuleposFunc) (GstOggStream * pad,
- gint64 granule, gint64 keyframe_granule);
-
-/* returns TRUE if the granulepos denotes a key frame */
-typedef gboolean (*GstOggMapIsKeyFrameFunc) (GstOggStream * pad,
- gint64 granulepos);
-
-/* returns TRUE if the given packet is a stream header packet */
-typedef gboolean (*GstOggMapIsHeaderPacketFunc) (GstOggStream * pad,
- ogg_packet * packet);
-typedef gint64 (*GstOggMapPacketDurationFunc) (GstOggStream * pad,
- ogg_packet * packet);
-
-
-
-#define SKELETON_FISBONE_MIN_SIZE 52
-
-
-struct _GstOggMap
-{
- const gchar *id;
- int id_length;
- int min_packet_size;
- const gchar *media_type;
- GstOggMapSetupFunc setup_func;
- GstOggMapToGranuleFunc granulepos_to_granule_func;
- GstOggMapToGranuleposFunc granule_to_granulepos_func;
- GstOggMapIsKeyFrameFunc is_key_frame_func;
- GstOggMapIsHeaderPacketFunc is_header_func;
- GstOggMapPacketDurationFunc packet_duration_func;
-};
-
-static const GstOggMap mappers[];
-
-GstClockTime
-gst_ogg_stream_get_packet_start_time (GstOggStream * pad, ogg_packet * packet)
-{
- int duration;
-
- if (packet->granulepos == -1) {
- return GST_CLOCK_TIME_NONE;
- }
-
- duration = gst_ogg_stream_get_packet_duration (pad, packet);
- if (duration == -1) {
- return GST_CLOCK_TIME_NONE;
- }
-
- return gst_ogg_stream_granule_to_time (pad,
- gst_ogg_stream_granulepos_to_granule (pad,
- packet->granulepos) - duration);
-}
-
-GstClockTime
-gst_ogg_stream_get_start_time_for_granulepos (GstOggStream * pad,
- gint64 granulepos)
-{
- if (pad->frame_size == 0)
- return GST_CLOCK_TIME_NONE;
-
- return gst_ogg_stream_granule_to_time (pad,
- gst_ogg_stream_granulepos_to_granule (pad, granulepos));
-}
-
-GstClockTime
-gst_ogg_stream_get_end_time_for_granulepos (GstOggStream * pad,
- gint64 granulepos)
-{
- return gst_ogg_stream_granule_to_time (pad,
- gst_ogg_stream_granulepos_to_granule (pad, granulepos));
-}
-
-GstClockTime
-gst_ogg_stream_granule_to_time (GstOggStream * pad, gint64 granule)
-{
- if (granule == 0 || pad->granulerate_n == 0 || pad->granulerate_d == 0)
- return 0;
-
- return gst_util_uint64_scale (granule, GST_SECOND * pad->granulerate_d,
- pad->granulerate_n);
-}
-
-gint64
-gst_ogg_stream_granulepos_to_granule (GstOggStream * pad, gint64 granulepos)
-{
- if (granulepos == -1 || granulepos == 0) {
- return granulepos;
- }
-
- if (mappers[pad->map].granulepos_to_granule_func == NULL) {
- GST_WARNING ("Failed to convert granulepos to granule");
- return -1;
- }
-
- return mappers[pad->map].granulepos_to_granule_func (pad, granulepos);
-}
-
-gint64
-gst_ogg_stream_granulepos_to_key_granule (GstOggStream * pad, gint64 granulepos)
-{
- if (granulepos == -1 || granulepos == 0) {
- return granulepos;
- }
-
- return granulepos >> pad->granuleshift;
-}
-
-gint64
-gst_ogg_stream_granule_to_granulepos (GstOggStream * pad, gint64 granule,
- gint64 keyframe_granule)
-{
- if (granule == -1 || granule == 0) {
- return granule;
- }
-
- if (mappers[pad->map].granule_to_granulepos_func == NULL) {
- GST_WARNING ("Failed to convert granule to granulepos");
- return -1;
- }
-
- return mappers[pad->map].granule_to_granulepos_func (pad, granule,
- keyframe_granule);
-}
-
-gboolean
-gst_ogg_stream_packet_granulepos_is_key_frame (GstOggStream * pad,
- gint64 granulepos)
-{
- if (granulepos == -1) {
- return FALSE;
- }
-
- if (mappers[pad->map].is_key_frame_func == NULL) {
- GST_WARNING ("Failed to determine key frame");
- return FALSE;
- }
-
- return mappers[pad->map].is_key_frame_func (pad, granulepos);
-}
-
-gboolean
-gst_ogg_stream_packet_is_header (GstOggStream * pad, ogg_packet * packet)
-{
- if (mappers[pad->map].is_header_func == NULL) {
- GST_WARNING ("Failed to determine header");
- return FALSE;
- }
-
- return mappers[pad->map].is_header_func (pad, packet);
-}
-
-gint64
-gst_ogg_stream_get_packet_duration (GstOggStream * pad, ogg_packet * packet)
-{
- if (mappers[pad->map].packet_duration_func == NULL) {
- GST_WARNING ("Failed to determine packet duration");
- return -1;
- }
-
- return mappers[pad->map].packet_duration_func (pad, packet);
-}
-
-
-
-
-/* some generic functions */
-
-static gboolean
-is_keyframe_true (GstOggStream * pad, gint64 granulepos)
-{
- return TRUE;
-}
-
-static gint64
-granulepos_to_granule_default (GstOggStream * pad, gint64 granulepos)
-{
- gint64 keyindex, keyoffset;
-
- if (pad->granuleshift != 0) {
- keyindex = granulepos >> pad->granuleshift;
- keyoffset = granulepos - (keyindex << pad->granuleshift);
- return keyindex + keyoffset;
- } else {
- return granulepos;
- }
-}
-
-
-static gint64
-granule_to_granulepos_default (GstOggStream * pad, gint64 granule,
- gint64 keyframe_granule)
-{
- gint64 keyoffset;
-
- if (pad->granuleshift != 0) {
- keyoffset = granule - keyframe_granule;
- return (keyframe_granule << pad->granuleshift) | keyoffset;
- } else {
- return granule;
- }
-}
-
-#ifdef unused
-static gboolean
-is_header_unknown (GstOggStream * pad, ogg_packet * packet)
-{
- GST_WARNING ("don't know how to detect header");
- return FALSE;
-}
-#endif
-
-static gboolean
-is_header_true (GstOggStream * pad, ogg_packet * packet)
-{
- return TRUE;
-}
-
-static gboolean
-is_header_count (GstOggStream * pad, ogg_packet * packet)
-{
- if (pad->n_header_packets_seen < pad->n_header_packets) {
- return TRUE;
- }
- return FALSE;
-}
-
-static gint64
-packet_duration_constant (GstOggStream * pad, ogg_packet * packet)
-{
- return pad->frame_size;
-}
-
-/* theora */
-
-static gboolean
-setup_theora_mapper (GstOggStream * pad, ogg_packet * packet)
-{
- guint8 *data = packet->packet;
- guint w, h, par_d, par_n;
-
- w = GST_READ_UINT24_BE (data + 14) & 0xFFFFF0;
- h = GST_READ_UINT24_BE (data + 17) & 0xFFFFF0;
-
- pad->granulerate_n = GST_READ_UINT32_BE (data + 22);
- pad->granulerate_d = GST_READ_UINT32_BE (data + 26);
-
- par_n = GST_READ_UINT24_BE (data + 30);
- par_d = GST_READ_UINT24_BE (data + 33);
-
- GST_LOG ("fps = %d/%d, PAR = %u/%u, width = %u, height = %u",
- pad->granulerate_n, pad->granulerate_d, par_n, par_d, w, h);
-
- /* 2 bits + 3 bits = 5 bits KFGSHIFT */
- pad->granuleshift = ((GST_READ_UINT8 (data + 40) & 0x03) << 3) +
- (GST_READ_UINT8 (data + 41) >> 5);
-
- pad->n_header_packets = 3;
- pad->frame_size = 1;
-
- if (pad->granulerate_n == 0 || pad->granulerate_d == 0) {
- GST_WARNING ("frame rate %d/%d", pad->granulerate_n, pad->granulerate_d);
- return FALSE;
- }
-
- pad->caps = gst_caps_new_simple ("video/x-theora", NULL);
-
- if (w > 0 && h > 0) {
- gst_caps_set_simple (pad->caps, "width", G_TYPE_INT, w, "height",
- G_TYPE_INT, h, NULL);
- }
-
- /* PAR of 0:N, N:0 and 0:0 is allowed and maps to 1:1 */
- if (par_n == 0 || par_d == 0)
- par_n = par_d = 1;
-
- /* only add framerate now so caps look prettier, with width/height first */
- gst_caps_set_simple (pad->caps, "framerate", GST_TYPE_FRACTION,
- pad->granulerate_n, pad->granulerate_d, "pixel-aspect-ratio",
- GST_TYPE_FRACTION, par_n, par_d, NULL);
-
- return TRUE;
-}
-
-static gint64
-granulepos_to_granule_theora (GstOggStream * pad, gint64 granulepos)
-{
- gint64 keyindex, keyoffset;
-
- if (pad->granuleshift != 0) {
- keyindex = granulepos >> pad->granuleshift;
- keyoffset = granulepos - (keyindex << pad->granuleshift);
- if (keyoffset == 0) {
- pad->theora_has_zero_keyoffset = TRUE;
- }
- if (pad->theora_has_zero_keyoffset) {
- keyoffset++;
- }
- return keyindex + keyoffset;
- } else {
- return granulepos;
- }
-}
-
-static gboolean
-is_keyframe_theora (GstOggStream * pad, gint64 granulepos)
-{
- gint64 frame_mask;
-
- if (granulepos == (gint64) - 1)
- return FALSE;
-
- frame_mask = (1 << (pad->granuleshift + 1)) - 1;
-
- return ((granulepos & frame_mask) == 0);
-}
-
-static gboolean
-is_header_theora (GstOggStream * pad, ogg_packet * packet)
-{
- return (packet->bytes > 0 && (packet->packet[0] & 0x80) == 0x80);
-}
-
-/* dirac */
-
-static gboolean
-setup_dirac_mapper (GstOggStream * pad, ogg_packet * packet)
-{
- int ret;
- DiracSequenceHeader header;
-
- ret = dirac_sequence_header_parse (&header, packet->packet + 13,
- packet->bytes - 13);
- if (ret == 0) {
- GST_DEBUG ("Failed to parse Dirac sequence header");
- return FALSE;
- }
-
- pad->granulerate_n = header.frame_rate_numerator * 2;
- pad->granulerate_d = header.frame_rate_denominator;
- pad->granuleshift = 22;
- pad->n_header_packets = 1;
- pad->frame_size = 2;
-
- if (header.interlaced_coding != 0) {
- GST_DEBUG ("non-progressive Dirac coding not implemented");
- return FALSE;
- }
-
- pad->caps = gst_caps_new_simple ("video/x-dirac",
- "width", G_TYPE_INT, header.width,
- "height", G_TYPE_INT, header.height,
- "interlaced", G_TYPE_BOOLEAN, header.interlaced,
- "pixel-aspect-ratio", GST_TYPE_FRACTION,
- header.aspect_ratio_numerator, header.aspect_ratio_denominator,
- "framerate", GST_TYPE_FRACTION, header.frame_rate_numerator,
- header.frame_rate_denominator, NULL);
-
- return TRUE;
-}
-
-#define OGG_DIRAC_GRANULE_LOW_MASK ((1<<22) - 1)
-static gboolean
-is_keyframe_dirac (GstOggStream * pad, gint64 granulepos)
-{
- gint64 pt;
- int dist_h;
- int dist_l;
- int dist;
- int delay;
- gint64 dt;
-
- if (granulepos == -1)
- return -1;
-
- pt = ((granulepos >> 22) + (granulepos & OGG_DIRAC_GRANULE_LOW_MASK)) >> 9;
- dist_h = (granulepos >> 22) & 0xff;
- dist_l = granulepos & 0xff;
- dist = (dist_h << 8) | dist_l;
- delay = (granulepos >> 9) & 0x1fff;
- dt = pt - delay;
-
- return (dist == 0);
-}
-
-static gint64
-granulepos_to_granule_dirac (GstOggStream * pad, gint64 gp)
-{
- gint64 pt;
- int dist_h;
- int dist_l;
- int dist;
- int delay;
- gint64 dt;
-
- pt = ((gp >> 22) + (gp & OGG_DIRAC_GRANULE_LOW_MASK)) >> 9;
- dist_h = (gp >> 22) & 0xff;
- dist_l = gp & 0xff;
- dist = (dist_h << 8) | dist_l;
- delay = (gp >> 9) & 0x1fff;
- dt = pt - delay;
-
- GST_DEBUG ("pt %" G_GINT64_FORMAT " delay %d", pt, delay);
-
- return dt + 4;
-}
-
-static gint64
-granule_to_granulepos_dirac (GstOggStream * pad, gint64 granule,
- gint64 keyframe_granule)
-{
- /* This conversion requires knowing more details about the Dirac
- * stream. */
- return -1;
-}
-
-
-/* vorbis */
-
-void parse_vorbis_header_packet (GstOggStream * pad, ogg_packet * op);
-void parse_vorbis_setup_packet (GstOggStream * pad, ogg_packet * op);
-
-
-static gboolean
-setup_vorbis_mapper (GstOggStream * pad, ogg_packet * packet)
-{
- guint8 *data = packet->packet;
- guint chans;
-
- data += 1 + 6 + 4;
- chans = GST_READ_UINT8 (data);
- data += 1;
- pad->granulerate_n = GST_READ_UINT32_LE (data);
- pad->granulerate_d = 1;
- pad->granuleshift = 0;
- pad->last_size = 0;
- GST_LOG ("sample rate: %d", pad->granulerate_n);
-
- pad->n_header_packets = 3;
-
- if (pad->granulerate_n == 0)
- return FALSE;
-
- parse_vorbis_header_packet (pad, packet);
-
- pad->caps = gst_caps_new_simple ("audio/x-vorbis",
- "rate", G_TYPE_INT, pad->granulerate_n, "channels", G_TYPE_INT, chans,
- NULL);
-
- return TRUE;
-}
-
-static gboolean
-is_header_vorbis (GstOggStream * pad, ogg_packet * packet)
-{
- if (packet->bytes > 0 && (packet->packet[0] & 0x01) == 0)
- return FALSE;
-
- if (packet->packet[0] == 5) {
- parse_vorbis_setup_packet (pad, packet);
- }
-
- return TRUE;
-}
-
-static gint64
-packet_duration_vorbis (GstOggStream * pad, ogg_packet * packet)
-{
- int mode;
- int size;
- int duration;
-
- if (packet->packet[0] & 1)
- return 0;
-
- mode = (packet->packet[0] >> 1) & ((1 << pad->vorbis_log2_num_modes) - 1);
- size = pad->vorbis_mode_sizes[mode] ? pad->long_size : pad->short_size;
-
- if (pad->last_size == 0) {
- duration = 0;
- } else {
- duration = pad->last_size / 4 + size / 4;
- }
- pad->last_size = size;
-
- GST_DEBUG ("duration %d", (int) duration);
-
- return duration;
-}
-
-/* speex */
-
-
-static gboolean
-setup_speex_mapper (GstOggStream * pad, ogg_packet * packet)
-{
- guint8 *data = packet->packet;
- guint chans;
-
- data += 8 + 20 + 4 + 4;
- pad->granulerate_n = GST_READ_UINT32_LE (data);
- pad->granulerate_d = 1;
- pad->granuleshift = 0;
-
- data += 4 + 4 + 4;
- chans = GST_READ_UINT32_LE (data);
-
- GST_LOG ("sample rate: %d, channels: %u", pad->granulerate_n, chans);
-
- pad->n_header_packets = GST_READ_UINT32_LE (packet->packet + 68) + 2;
- pad->frame_size = GST_READ_UINT32_LE (packet->packet + 64) *
- GST_READ_UINT32_LE (packet->packet + 56);
-
- if (pad->granulerate_n == 0)
- return FALSE;
-
- pad->caps = gst_caps_new_simple ("audio/x-speex", "rate", G_TYPE_INT,
- pad->granulerate_n, "channels", G_TYPE_INT, chans, NULL);
-
- return TRUE;
-}
-
-
-/* flac */
-
-static gboolean
-setup_fLaC_mapper (GstOggStream * pad, ogg_packet * packet)
-{
- pad->granulerate_n = 0;
- pad->granulerate_d = 1;
- pad->granuleshift = 0;
-
- pad->n_header_packets = 3;
-
- pad->caps = gst_caps_new_simple ("audio/x-flac", NULL);
-
- return TRUE;
-}
-
-static gboolean
-is_header_fLaC (GstOggStream * pad, ogg_packet * packet)
-{
- if (pad->n_header_packets_seen == 1) {
- pad->granulerate_n = (packet->packet[14] << 12) |
- (packet->packet[15] << 4) | ((packet->packet[16] >> 4) & 0xf);
- }
-
- if (pad->n_header_packets_seen < pad->n_header_packets) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gboolean
-setup_flac_mapper (GstOggStream * pad, ogg_packet * packet)
-{
- guint8 *data = packet->packet;
- guint chans;
-
- /* see http://flac.sourceforge.net/ogg_mapping.html */
-
- pad->granulerate_n = (GST_READ_UINT32_BE (data + 27) & 0xFFFFF000) >> 12;
- pad->granulerate_d = 1;
- pad->granuleshift = 0;
- chans = ((GST_READ_UINT32_BE (data + 27) & 0x00000E00) >> 9) + 1;
-
- GST_DEBUG ("sample rate: %d, channels: %u", pad->granulerate_n, chans);
-
- pad->n_header_packets = GST_READ_UINT16_BE (packet->packet + 7);
-
- if (pad->granulerate_n == 0)
- return FALSE;
-
- pad->caps = gst_caps_new_simple ("audio/x-flac", "rate", G_TYPE_INT,
- pad->granulerate_n, "channels", G_TYPE_INT, chans, NULL);
-
- return TRUE;
-}
-
-static gboolean
-is_header_flac (GstOggStream * pad, ogg_packet * packet)
-{
- return (packet->bytes > 0 && (packet->packet[0] != 0xff));
-}
-
-static gint64
-packet_duration_flac (GstOggStream * pad, ogg_packet * packet)
-{
- int block_size_index;
-
- if (packet->bytes < 4)
- return -1;
-
- block_size_index = packet->packet[2] >> 4;
- if (block_size_index == 1)
- return 192;
- if (block_size_index >= 2 && block_size_index <= 5) {
- return 576 << (block_size_index - 2);
- }
- if (block_size_index >= 8) {
- return 256 << (block_size_index - 8);
- }
- if (block_size_index == 6 || block_size_index == 7) {
- guint len, bytes = (block_size_index - 6) + 1;
- guint8 tmp;
-
- if (packet->bytes < 4 + 1 + bytes)
- return -1;
- tmp = packet->packet[4];
- /* utf-8 prefix */
- len = 0;
- while (tmp & 0x80) {
- len++;
- tmp <<= 1;
- }
- if (len == 2)
- return -1;
- if (len == 0)
- len++;
- if (packet->bytes < 4 + len + bytes)
- return -1;
- if (bytes == 1) {
- return packet->packet[4 + len] + 1;
- } else {
- return GST_READ_UINT16_BE (packet->packet + 4 + len) + 1;
- }
- }
- return -1;
-}
-
-/* fishead */
-
-static gboolean
-setup_fishead_mapper (GstOggStream * pad, ogg_packet * packet)
-{
- guint8 *data;
- gint64 prestime_n, prestime_d;
- gint64 basetime_n, basetime_d;
- gint64 basetime;
-
- data = packet->packet;
-
- data += 8 + 2 + 2; /* header + major/minor version */
-
- prestime_n = (gint64) GST_READ_UINT64_LE (data);
- data += 8;
- prestime_d = (gint64) GST_READ_UINT64_LE (data);
- data += 8;
- basetime_n = (gint64) GST_READ_UINT64_LE (data);
- data += 8;
- basetime_d = (gint64) GST_READ_UINT64_LE (data);
- data += 8;
-
- /* FIXME: we don't use basetime anywhere in the demuxer! */
- if (basetime_d != 0)
- basetime = gst_util_uint64_scale (GST_SECOND, basetime_n, basetime_d);
- else
- basetime = -1;
-
- GST_INFO ("skeleton fishead parsed (basetime: %" GST_TIME_FORMAT ")",
- GST_TIME_ARGS (basetime));
-
- return TRUE;
-}
-
-gboolean
-gst_ogg_map_add_fisbone (GstOggStream * pad,
- const guint8 * data, guint size, GstClockTime * p_start_time,
- guint32 * p_preroll)
-{
- GstClockTime start_time;
- gint64 start_granule;
- guint32 preroll;
-
- if (size < SKELETON_FISBONE_MIN_SIZE || memcmp (data, "fisbone\0", 8) != 0) {
- GST_WARNING ("invalid fisbone packet, ignoring");
- return FALSE;
- }
-
- if (pad->have_fisbone) {
- GST_DEBUG ("already have fisbone, ignoring second one");
- return FALSE;
- }
-
- /* skip "fisbone\0" + headers offset + serialno + num headers */
- data += 8 + 4 + 4 + 4;
-
- pad->have_fisbone = TRUE;
-
- /* we just overwrite whatever was set before by the format-specific setup */
- pad->granulerate_n = GST_READ_UINT64_LE (data);
- pad->granulerate_d = GST_READ_UINT64_LE (data + 8);
-
- start_granule = GST_READ_UINT64_LE (data + 16);
- preroll = GST_READ_UINT32_LE (data + 24);
- pad->granuleshift = GST_READ_UINT8 (data + 28);
-
- start_time = granulepos_to_granule_default (pad, start_granule);
-
- if (p_start_time)
- *p_start_time = start_time;
-
- if (p_preroll)
- *p_preroll = preroll;
-
- return TRUE;
-}
-
-/* Do we need these for something?
- * ogm->hdr.size = GST_READ_UINT32_LE (&data[13]);
- * ogm->hdr.time_unit = GST_READ_UINT64_LE (&data[17]);
- * ogm->hdr.samples_per_unit = GST_READ_UINT64_LE (&data[25]);
- * ogm->hdr.default_len = GST_READ_UINT32_LE (&data[33]);
- * ogm->hdr.buffersize = GST_READ_UINT32_LE (&data[37]);
- * ogm->hdr.bits_per_sample = GST_READ_UINT32_LE (&data[41]);
- */
-
-static gboolean
-is_header_ogm (GstOggStream * pad, ogg_packet * packet)
-{
- if (packet->bytes >= 1 && (packet->packet[0] & 0x01))
- return TRUE;
-
- return FALSE;
-}
-
-static gint64
-packet_duration_ogm (GstOggStream * pad, ogg_packet * packet)
-{
- const guint8 *data;
- int samples;
- int offset;
- int n;
-
- data = packet->packet;
- offset = 1 + (((data[0] & 0xc0) >> 6) | ((data[0] & 0x02) << 1));
-
- if (offset > packet->bytes) {
- GST_ERROR ("buffer too small");
- return -1;
- }
-
- samples = 0;
- for (n = offset - 1; n > 0; n--) {
- samples = (samples << 8) | data[n];
- }
-
- return samples;
-}
-
-static gboolean
-setup_ogmaudio_mapper (GstOggStream * pad, ogg_packet * packet)
-{
- guint8 *data = packet->packet;
- guint32 fourcc;
-
- pad->granulerate_n = GST_READ_UINT64_LE (data + 25);
- pad->granulerate_d = 1;
-
- fourcc = GST_READ_UINT32_LE (data + 9);
- GST_DEBUG ("fourcc: %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
-
- pad->caps = gst_riff_create_audio_caps (fourcc, NULL, NULL, NULL, NULL, NULL);
-
- GST_LOG ("sample rate: %d", pad->granulerate_n);
- if (pad->granulerate_n == 0)
- return FALSE;
-
- if (pad->caps) {
- gst_caps_set_simple (pad->caps,
- "rate", G_TYPE_INT, pad->granulerate_n, NULL);
- } else {
- pad->caps = gst_caps_new_simple ("audio/x-ogm-unknown",
- "fourcc", GST_TYPE_FOURCC, fourcc,
- "rate", G_TYPE_INT, pad->granulerate_n, NULL);
- }
-
- pad->n_header_packets = 1;
- pad->is_ogm = TRUE;
-
- return TRUE;
-}
-
-static gboolean
-setup_ogmvideo_mapper (GstOggStream * pad, ogg_packet * packet)
-{
- guint8 *data = packet->packet;
- guint32 fourcc;
- int width, height;
- gint64 time_unit;
-
- GST_DEBUG ("time unit %d", GST_READ_UINT32_LE (data + 16));
- GST_DEBUG ("samples per unit %d", GST_READ_UINT32_LE (data + 24));
-
- pad->granulerate_n = 10000000;
- time_unit = GST_READ_UINT64_LE (data + 17);
- if (time_unit > G_MAXINT || time_unit < G_MININT) {
- GST_WARNING ("timeunit is out of range");
- }
- pad->granulerate_d = (gint) CLAMP (time_unit, G_MININT, G_MAXINT);
-
- GST_LOG ("fps = %d/%d = %.3f",
- pad->granulerate_n, pad->granulerate_d,
- (double) pad->granulerate_n / pad->granulerate_d);
-
- fourcc = GST_READ_UINT32_LE (data + 9);
- width = GST_READ_UINT32_LE (data + 45);
- height = GST_READ_UINT32_LE (data + 49);
- GST_DEBUG ("fourcc: %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
-
- pad->caps = gst_riff_create_video_caps (fourcc, NULL, NULL, NULL, NULL, NULL);
-
- if (pad->caps == NULL) {
- pad->caps = gst_caps_new_simple ("video/x-ogm-unknown",
- "fourcc", GST_TYPE_FOURCC, fourcc,
- "framerate", GST_TYPE_FRACTION, pad->granulerate_n,
- pad->granulerate_d, NULL);
- } else {
- gst_caps_set_simple (pad->caps,
- "framerate", GST_TYPE_FRACTION, pad->granulerate_n,
- pad->granulerate_d,
- "width", G_TYPE_INT, width, "height", G_TYPE_INT, height, NULL);
- }
- GST_DEBUG ("caps: %" GST_PTR_FORMAT, pad->caps);
-
- pad->n_header_packets = 1;
- pad->frame_size = 1;
- pad->is_ogm = TRUE;
-
- return TRUE;
-}
-
-static gboolean
-setup_ogmtext_mapper (GstOggStream * pad, ogg_packet * packet)
-{
- guint8 *data = packet->packet;
- gint64 time_unit;
-
- pad->granulerate_n = 10000000;
- time_unit = GST_READ_UINT64_LE (data + 17);
- if (time_unit > G_MAXINT || time_unit < G_MININT) {
- GST_WARNING ("timeunit is out of range");
- }
- pad->granulerate_d = (gint) CLAMP (time_unit, G_MININT, G_MAXINT);
-
- GST_LOG ("fps = %d/%d = %.3f",
- pad->granulerate_n, pad->granulerate_d,
- (double) pad->granulerate_n / pad->granulerate_d);
-
- if (pad->granulerate_d <= 0)
- return FALSE;
-
- pad->caps = gst_caps_new_simple ("text/plain", NULL);
-
- pad->n_header_packets = 1;
- pad->is_ogm = TRUE;
- pad->is_ogm_text = TRUE;
-
- return TRUE;
-}
-
-/* PCM */
-
-#define OGGPCM_FMT_S8 0x00000000 /* Signed integer 8 bit */
-#define OGGPCM_FMT_U8 0x00000001 /* Unsigned integer 8 bit */
-#define OGGPCM_FMT_S16_LE 0x00000002 /* Signed integer 16 bit little endian */
-#define OGGPCM_FMT_S16_BE 0x00000003 /* Signed integer 16 bit big endian */
-#define OGGPCM_FMT_S24_LE 0x00000004 /* Signed integer 24 bit little endian */
-#define OGGPCM_FMT_S24_BE 0x00000005 /* Signed integer 24 bit big endian */
-#define OGGPCM_FMT_S32_LE 0x00000006 /* Signed integer 32 bit little endian */
-#define OGGPCM_FMT_S32_BE 0x00000007 /* Signed integer 32 bit big endian */
-
-#define OGGPCM_FMT_ULAW 0x00000010 /* G.711 u-law encoding (8 bit) */
-#define OGGPCM_FMT_ALAW 0x00000011 /* G.711 A-law encoding (8 bit) */
-
-#define OGGPCM_FMT_FLT32_LE 0x00000020 /* IEEE Float [-1,1] 32 bit little endian */
-#define OGGPCM_FMT_FLT32_BE 0x00000021 /* IEEE Float [-1,1] 32 bit big endian */
-#define OGGPCM_FMT_FLT64_LE 0x00000022 /* IEEE Float [-1,1] 64 bit little endian */
-#define OGGPCM_FMT_FLT64_BE 0x00000023 /* IEEE Float [-1,1] 64 bit big endian */
-
-
-static gboolean
-setup_pcm_mapper (GstOggStream * pad, ogg_packet * packet)
-{
- guint8 *data = packet->packet;
- int format;
- int channels;
- GstCaps *caps;
-
- pad->granulerate_n = GST_READ_UINT32_LE (data + 16);
- pad->granulerate_d = 1;
- GST_LOG ("sample rate: %d", pad->granulerate_n);
-
- format = GST_READ_UINT32_LE (data + 12);
- channels = GST_READ_UINT8 (data + 21);
-
- pad->n_header_packets = 2 + GST_READ_UINT32_LE (data + 24);
-
- if (pad->granulerate_n == 0)
- return FALSE;
-
- switch (format) {
- case OGGPCM_FMT_S8:
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "depth", G_TYPE_INT, 8,
- "width", G_TYPE_INT, 8, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
- break;
- case OGGPCM_FMT_U8:
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "depth", G_TYPE_INT, 8,
- "width", G_TYPE_INT, 8, "signed", G_TYPE_BOOLEAN, FALSE, NULL);
- break;
- case OGGPCM_FMT_S16_LE:
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "depth", G_TYPE_INT, 16,
- "width", G_TYPE_INT, 16,
- "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
- "signed", G_TYPE_BOOLEAN, TRUE, NULL);
- break;
- case OGGPCM_FMT_S16_BE:
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "depth", G_TYPE_INT, 16,
- "width", G_TYPE_INT, 16,
- "endianness", G_TYPE_INT, G_BIG_ENDIAN,
- "signed", G_TYPE_BOOLEAN, TRUE, NULL);
- break;
- case OGGPCM_FMT_S24_LE:
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "depth", G_TYPE_INT, 24,
- "width", G_TYPE_INT, 24,
- "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
- "signed", G_TYPE_BOOLEAN, TRUE, NULL);
- break;
- case OGGPCM_FMT_S24_BE:
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "depth", G_TYPE_INT, 24,
- "width", G_TYPE_INT, 24,
- "endianness", G_TYPE_INT, G_BIG_ENDIAN,
- "signed", G_TYPE_BOOLEAN, TRUE, NULL);
- break;
- case OGGPCM_FMT_S32_LE:
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "depth", G_TYPE_INT, 32,
- "width", G_TYPE_INT, 32,
- "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
- "signed", G_TYPE_BOOLEAN, TRUE, NULL);
- break;
- case OGGPCM_FMT_S32_BE:
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "depth", G_TYPE_INT, 32,
- "width", G_TYPE_INT, 32,
- "endianness", G_TYPE_INT, G_BIG_ENDIAN,
- "signed", G_TYPE_BOOLEAN, TRUE, NULL);
- break;
- case OGGPCM_FMT_ULAW:
- caps = gst_caps_new_simple ("audio/x-mulaw", NULL);
- break;
- case OGGPCM_FMT_ALAW:
- caps = gst_caps_new_simple ("audio/x-alaw", NULL);
- break;
- case OGGPCM_FMT_FLT32_LE:
- caps = gst_caps_new_simple ("audio/x-raw-float",
- "width", G_TYPE_INT, 32,
- "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL);
- break;
- case OGGPCM_FMT_FLT32_BE:
- caps = gst_caps_new_simple ("audio/x-raw-float",
- "width", G_TYPE_INT, 32,
- "endianness", G_TYPE_INT, G_BIG_ENDIAN, NULL);
- break;
- case OGGPCM_FMT_FLT64_LE:
- caps = gst_caps_new_simple ("audio/x-raw-float",
- "width", G_TYPE_INT, 64,
- "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL);
- break;
- case OGGPCM_FMT_FLT64_BE:
- caps = gst_caps_new_simple ("audio/x-raw-float",
- "width", G_TYPE_INT, 64,
- "endianness", G_TYPE_INT, G_BIG_ENDIAN, NULL);
- break;
- default:
- return FALSE;
- }
-
- gst_caps_set_simple (caps, "audio/x-raw-int",
- "rate", G_TYPE_INT, pad->granulerate_n,
- "channels", G_TYPE_INT, channels, NULL);
- pad->caps = caps;
-
- return TRUE;
-}
-
-/* cmml */
-
-static gboolean
-setup_cmml_mapper (GstOggStream * pad, ogg_packet * packet)
-{
- guint8 *data = packet->packet;
-
- pad->granulerate_n = GST_READ_UINT64_LE (data + 12);
- pad->granulerate_d = GST_READ_UINT64_LE (data + 20);
- pad->granuleshift = data[28];
- GST_LOG ("sample rate: %d", pad->granulerate_n);
-
- pad->n_header_packets = 3;
-
- if (pad->granulerate_n == 0)
- return FALSE;
-
- data += 4 + (4 + 4 + 4);
- GST_DEBUG ("blocksize0: %u", 1 << (data[0] >> 4));
- GST_DEBUG ("blocksize1: %u", 1 << (data[0] & 0x0F));
-
- pad->caps = gst_caps_new_simple ("text/x-cmml", NULL);
-
- return TRUE;
-}
-
-/* celt */
-
-static gboolean
-setup_celt_mapper (GstOggStream * pad, ogg_packet * packet)
-{
- guint8 *data = packet->packet;
-
- pad->granulerate_n = GST_READ_UINT32_LE (data + 36);
- pad->granulerate_d = 1;
- pad->granuleshift = 0;
- GST_LOG ("sample rate: %d", pad->granulerate_n);
-
- pad->frame_size = GST_READ_UINT32_LE (packet->packet + 44);
- pad->n_header_packets = GST_READ_UINT32_LE (packet->packet + 56) + 2;
-
- if (pad->granulerate_n == 0)
- return FALSE;
-
- pad->caps = gst_caps_new_simple ("audio/x-celt",
- "rate", G_TYPE_INT, pad->granulerate_n, NULL);
-
- return TRUE;
-}
-
-/* kate */
-
-static gboolean
-setup_kate_mapper (GstOggStream * pad, ogg_packet * packet)
-{
- guint8 *data = packet->packet;
- const char *category;
-
- if (packet->bytes < 64)
- return FALSE;
-
- pad->granulerate_n = GST_READ_UINT32_LE (data + 24);
- pad->granulerate_d = GST_READ_UINT32_LE (data + 28);
- pad->granuleshift = GST_READ_UINT8 (data + 15);
- GST_LOG ("sample rate: %d", pad->granulerate_n);
-
- pad->n_header_packets = GST_READ_UINT8 (data + 11);
-
- if (pad->granulerate_n == 0)
- return FALSE;
-
- category = (const char *) data + 48;
- if (strcmp (category, "subtitles") == 0 || strcmp (category, "SUB") == 0 ||
- strcmp (category, "spu-subtitles") == 0 ||
- strcmp (category, "K-SPU") == 0) {
- pad->caps = gst_caps_new_simple ("subtitle/x-kate", NULL);
- } else {
- pad->caps = gst_caps_new_simple ("application/x-kate", NULL);
- }
-
- return TRUE;
-}
-
-
-/* *INDENT-OFF* */
-/* indent hates our freedoms */
-static const GstOggMap mappers[] = {
- {
- "\200theora", 7, 42,
- "video/x-theora",
- setup_theora_mapper,
- granulepos_to_granule_theora,
- granule_to_granulepos_default,
- is_keyframe_theora,
- is_header_theora,
- packet_duration_constant
- },
- {
- "\001vorbis", 7, 22,
- "audio/x-vorbis",
- setup_vorbis_mapper,
- granulepos_to_granule_default,
- granule_to_granulepos_default,
- is_keyframe_true,
- is_header_vorbis,
- packet_duration_vorbis
- },
- {
- "Speex", 5, 80,
- "audio/x-speex",
- setup_speex_mapper,
- granulepos_to_granule_default,
- granule_to_granulepos_default,
- is_keyframe_true,
- is_header_count,
- packet_duration_constant
- },
- {
- "PCM ", 8, 0,
- "audio/x-raw-int",
- setup_pcm_mapper,
- NULL,
- NULL,
- NULL,
- is_header_count,
- NULL
- },
- {
- "CMML\0\0\0\0", 8, 0,
- "text/x-cmml",
- setup_cmml_mapper,
- NULL,
- NULL,
- NULL,
- is_header_count,
- NULL
- },
- {
- "Annodex", 7, 0,
- "application/x-annodex",
- setup_fishead_mapper,
- granulepos_to_granule_default,
- granule_to_granulepos_default,
- NULL,
- is_header_count,
- NULL
- },
- {
- "fishead", 7, 64,
- "application/octet-stream",
- setup_fishead_mapper,
- NULL,
- NULL,
- NULL,
- is_header_true,
- NULL
- },
- {
- "fLaC", 4, 0,
- "audio/x-flac",
- setup_fLaC_mapper,
- granulepos_to_granule_default,
- granule_to_granulepos_default,
- is_keyframe_true,
- is_header_fLaC,
- NULL
- },
- {
- "\177FLAC", 5, 36,
- "audio/x-flac",
- setup_flac_mapper,
- granulepos_to_granule_default,
- granule_to_granulepos_default,
- is_keyframe_true,
- is_header_flac,
- packet_duration_flac
- },
- {
- "AnxData", 7, 0,
- "application/octet-stream",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- },
- {
- "CELT ", 8, 0,
- "audio/x-celt",
- setup_celt_mapper,
- granulepos_to_granule_default,
- granule_to_granulepos_default,
- NULL,
- is_header_count,
- packet_duration_constant
- },
- {
- "\200kate\0\0\0", 8, 0,
- "text/x-kate",
- setup_kate_mapper,
- granulepos_to_granule_default,
- granule_to_granulepos_default,
- NULL,
- is_header_count,
- NULL
- },
- {
- "BBCD\0", 5, 13,
- "video/x-dirac",
- setup_dirac_mapper,
- granulepos_to_granule_dirac,
- granule_to_granulepos_dirac,
- is_keyframe_dirac,
- is_header_count,
- packet_duration_constant
- },
- {
- "\001audio\0\0\0", 9, 53,
- "application/x-ogm-audio",
- setup_ogmaudio_mapper,
- granulepos_to_granule_default,
- granule_to_granulepos_default,
- is_keyframe_true,
- is_header_ogm,
- packet_duration_ogm
- },
- {
- "\001video\0\0\0", 9, 53,
- "application/x-ogm-video",
- setup_ogmvideo_mapper,
- granulepos_to_granule_default,
- granule_to_granulepos_default,
- NULL,
- is_header_ogm,
- packet_duration_constant
- },
- {
- "\001text\0\0\0", 9, 9,
- "application/x-ogm-text",
- setup_ogmtext_mapper,
- granulepos_to_granule_default,
- granule_to_granulepos_default,
- is_keyframe_true,
- is_header_ogm,
- packet_duration_ogm
- }
-};
-/* *INDENT-ON* */
-
-gboolean
-gst_ogg_stream_setup_map (GstOggStream * pad, ogg_packet * packet)
-{
- int i;
- gboolean ret;
-
- for (i = 0; i < G_N_ELEMENTS (mappers); i++) {
- if (packet->bytes >= mappers[i].min_packet_size &&
- packet->bytes >= mappers[i].id_length &&
- memcmp (packet->packet, mappers[i].id, mappers[i].id_length) == 0) {
-
- GST_DEBUG ("found mapper for '%s'", mappers[i].id);
-
- if (mappers[i].setup_func)
- ret = mappers[i].setup_func (pad, packet);
- else
- continue;
-
- if (ret) {
- GST_DEBUG ("got stream type %" GST_PTR_FORMAT, pad->caps);
- pad->map = i;
- return TRUE;
- } else {
- GST_WARNING ("mapper '%s' did not accept setup header",
- mappers[i].media_type);
- }
- }
- }
-
- return FALSE;
-}
diff --git a/ext/ogg/gstoggstream.h b/ext/ogg/gstoggstream.h
deleted file mode 100644
index 78b55c06..00000000
--- a/ext/ogg/gstoggstream.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* GStreamer
- * Copyright (C) 2009 David Schleef <ds@schleef.org>
- *
- * gstoggstream.h: header for GstOggStream
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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_OGG_STREAM_H__
-#define __GST_OGG_STREAM_H__
-
-#include <ogg/ogg.h>
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-typedef struct _GstOggStream GstOggStream;
-
-struct _GstOggStream
-{
- ogg_stream_state stream;
-
- glong serialno;
- GList *headers;
- gboolean have_headers;
- GList *queued;
-
- /* for oggparse */
- gboolean in_headers;
- GList *unknown_pages;
-
- gint map;
- gboolean is_skeleton;
- gboolean have_fisbone;
- gint granulerate_n;
- gint granulerate_d;
- guint32 preroll;
- guint granuleshift;
- gint n_header_packets;
- gint n_header_packets_seen;
- gint64 accumulated_granule;
- gint frame_size;
-
- GstCaps *caps;
-
- /* vorbis stuff */
- int nln_increments[4];
- int nsn_increment;
- int short_size;
- int long_size;
- int vorbis_log2_num_modes;
- int vorbis_mode_sizes[256];
- int last_size;
- /* theora stuff */
- gboolean theora_has_zero_keyoffset;
- /* OGM stuff */
- gboolean is_ogm;
- gboolean is_ogm_text;
-};
-
-
-gboolean gst_ogg_stream_setup_map (GstOggStream * pad, ogg_packet *packet);
-GstClockTime gst_ogg_stream_get_end_time_for_granulepos (GstOggStream *pad,
- gint64 granulepos);
-GstClockTime gst_ogg_stream_get_start_time_for_granulepos (GstOggStream *pad,
- gint64 granulepos);
-GstClockTime gst_ogg_stream_granule_to_time (GstOggStream *pad, gint64 granule);
-gint64 gst_ogg_stream_granulepos_to_granule (GstOggStream * pad, gint64 granulepos);
-gint64 gst_ogg_stream_granulepos_to_key_granule (GstOggStream * pad, gint64 granulepos);
-gint64 gst_ogg_stream_granule_to_granulepos (GstOggStream * pad, gint64 granule, gint64 keyframe_granule);
-GstClockTime gst_ogg_stream_get_packet_start_time (GstOggStream *pad,
- ogg_packet *packet);
-gboolean gst_ogg_stream_granulepos_is_key_frame (GstOggStream *pad,
- gint64 granulepos);
-gboolean gst_ogg_stream_packet_is_header (GstOggStream *pad, ogg_packet *packet);
-gint64 gst_ogg_stream_get_packet_duration (GstOggStream * pad, ogg_packet *packet);
-
-
-G_END_DECLS
-
-#endif /* __GST_OGG_STREAM_H__ */
diff --git a/ext/ogg/gstogmparse.c b/ext/ogg/gstogmparse.c
deleted file mode 100644
index 31dcd905..00000000
--- a/ext/ogg/gstogmparse.c
+++ /dev/null
@@ -1,972 +0,0 @@
-/* GStreamer OGM parsing
- * Copyright (C) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <string.h>
-
-#include <gst/gst.h>
-#include <gst/tag/tag.h>
-#include <gst/riff/riff-media.h>
-#include <gst/riff/riff-read.h>
-
-GST_DEBUG_CATEGORY_STATIC (gst_ogm_parse_debug);
-#define GST_CAT_DEFAULT gst_ogm_parse_debug
-
-#define GST_TYPE_OGM_VIDEO_PARSE (gst_ogm_video_parse_get_type())
-#define GST_IS_OGM_VIDEO_PARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_OGM_VIDEO_PARSE))
-
-#define GST_TYPE_OGM_AUDIO_PARSE (gst_ogm_audio_parse_get_type())
-#define GST_IS_OGM_AUDIO_PARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_OGM_AUDIO_PARSE))
-
-#define GST_TYPE_OGM_TEXT_PARSE (gst_ogm_text_parse_get_type())
-#define GST_IS_OGM_TEXT_PARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_OGM_TEXT_PARSE))
-
-#define GST_TYPE_OGM_PARSE (gst_ogm_parse_get_type())
-#define GST_OGM_PARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_OGM_PARSE, GstOgmParse))
-#define GST_OGM_PARSE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_OGM_PARSE, GstOgmParse))
-#define GST_IS_OGM_PARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_OGM_PARSE))
-#define GST_IS_OGM_PARSE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_OGM_PARSE))
-#define GST_OGM_PARSE_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_OGM_PARSE, GstOgmParseClass))
-
-static const GstElementDetails gst_ogm_audio_parse_details =
-GST_ELEMENT_DETAILS ("OGM audio stream parser",
- "Codec/Decoder/Audio",
- "parse an OGM audio header and stream",
- "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
-
-static const GstElementDetails gst_ogm_video_parse_details =
-GST_ELEMENT_DETAILS ("OGM video stream parser",
- "Codec/Decoder/Video",
- "parse an OGM video header and stream",
- "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
-
-static const GstElementDetails gst_ogm_text_parse_details =
-GST_ELEMENT_DETAILS ("OGM text stream parser",
- "Codec/Decoder/Subtitle",
- "parse an OGM text header and stream",
- "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
-
-typedef struct _stream_header_video
-{
- gint32 width;
- gint32 height;
-} stream_header_video;
-
-typedef struct _stream_header_audio
-{
- gint16 channels;
- gint16 blockalign;
- gint32 avgbytespersec;
-} stream_header_audio;
-
-/* sizeof(stream_header) might differ due to structure packing and
- * alignment differences on some architectures, so not using that */
-#define OGM_STREAM_HEADER_SIZE (8+4+4+8+8+4+4+4+8)
-
-typedef struct _stream_header
-{
- gchar streamtype[8];
- gchar subtype[4 + 1];
-
- /* size of the structure */
- gint32 size;
-
- /* in reference time */
- gint64 time_unit;
-
- gint64 samples_per_unit;
-
- /* in media time */
- gint32 default_len;
-
- gint32 buffersize;
- gint32 bits_per_sample;
-
- union
- {
- stream_header_video video;
- stream_header_audio audio;
- /* text has no additional data */
- } s;
-} stream_header;
-
-typedef struct _GstOgmParse
-{
- GstElement element;
-
- /* pads */
- GstPad *srcpad, *sinkpad;
- GstPadTemplate *srcpadtempl;
-
- /* we need to cache events that we receive before creating the source pad */
- GList *cached_events;
-
- /* audio or video */
- stream_header hdr;
-
- /* expected next granulepos (used for timestamp guessing) */
- guint64 next_granulepos;
-} GstOgmParse;
-
-typedef struct _GstOgmParseClass
-{
- GstElementClass parent_class;
-} GstOgmParseClass;
-
-static GstStaticPadTemplate sink_factory_video =
-GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-ogm-video"));
-static GstStaticPadTemplate sink_factory_audio =
-GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-ogm-audio"));
-static GstStaticPadTemplate sink_factory_text =
-GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-ogm-text"));
-static GstPadTemplate *video_src_templ, *audio_src_templ, *text_src_templ;
-
-static GType gst_ogm_audio_parse_get_type (void);
-static GType gst_ogm_video_parse_get_type (void);
-static GType gst_ogm_text_parse_get_type (void);
-static GType gst_ogm_parse_get_type (void);
-
-static void gst_ogm_audio_parse_base_init (GstOgmParseClass * klass);
-static void gst_ogm_video_parse_base_init (GstOgmParseClass * klass);
-static void gst_ogm_text_parse_base_init (GstOgmParseClass * klass);
-static void gst_ogm_parse_class_init (GstOgmParseClass * klass);
-static void gst_ogm_parse_init (GstOgmParse * ogm);
-static void gst_ogm_video_parse_init (GstOgmParse * ogm);
-static void gst_ogm_audio_parse_init (GstOgmParse * ogm);
-static void gst_ogm_text_parse_init (GstOgmParse * ogm);
-
-static const GstQueryType *gst_ogm_parse_get_sink_querytypes (GstPad * pad);
-static gboolean gst_ogm_parse_sink_event (GstPad * pad, GstEvent * event);
-static gboolean gst_ogm_parse_sink_query (GstPad * pad, GstQuery * query);
-static gboolean gst_ogm_parse_sink_convert (GstPad * pad, GstFormat src_format,
- gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
-
-static GstFlowReturn gst_ogm_parse_chain (GstPad * pad, GstBuffer * buffer);
-
-static GstStateChangeReturn gst_ogm_parse_change_state (GstElement * element,
- GstStateChange transition);
-
-static GstElementClass *parent_class = NULL;
-
-static GType
-gst_ogm_parse_get_type (void)
-{
- static GType ogm_parse_type = 0;
-
- if (!ogm_parse_type) {
- static const GTypeInfo ogm_parse_info = {
- sizeof (GstOgmParseClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_ogm_parse_class_init,
- NULL,
- NULL,
- sizeof (GstOgmParse),
- 0,
- (GInstanceInitFunc) gst_ogm_parse_init,
- };
-
- ogm_parse_type =
- g_type_register_static (GST_TYPE_ELEMENT,
- "GstOgmParse", &ogm_parse_info, 0);
- }
-
- return ogm_parse_type;
-}
-
-static GType
-gst_ogm_audio_parse_get_type (void)
-{
- static GType ogm_audio_parse_type = 0;
-
- if (!ogm_audio_parse_type) {
- static const GTypeInfo ogm_audio_parse_info = {
- sizeof (GstOgmParseClass),
- (GBaseInitFunc) gst_ogm_audio_parse_base_init,
- NULL,
- NULL,
- NULL,
- NULL,
- sizeof (GstOgmParse),
- 0,
- (GInstanceInitFunc) gst_ogm_audio_parse_init,
- };
-
- ogm_audio_parse_type =
- g_type_register_static (GST_TYPE_OGM_PARSE,
- "GstOgmAudioParse", &ogm_audio_parse_info, 0);
- }
-
- return ogm_audio_parse_type;
-}
-
-static GType
-gst_ogm_video_parse_get_type (void)
-{
- static GType ogm_video_parse_type = 0;
-
- if (!ogm_video_parse_type) {
- static const GTypeInfo ogm_video_parse_info = {
- sizeof (GstOgmParseClass),
- (GBaseInitFunc) gst_ogm_video_parse_base_init,
- NULL,
- NULL,
- NULL,
- NULL,
- sizeof (GstOgmParse),
- 0,
- (GInstanceInitFunc) gst_ogm_video_parse_init,
- };
-
- ogm_video_parse_type =
- g_type_register_static (GST_TYPE_OGM_PARSE,
- "GstOgmVideoParse", &ogm_video_parse_info, 0);
- }
-
- return ogm_video_parse_type;
-}
-
-static GType
-gst_ogm_text_parse_get_type (void)
-{
- static GType ogm_text_parse_type = 0;
-
- if (!ogm_text_parse_type) {
- static const GTypeInfo ogm_text_parse_info = {
- sizeof (GstOgmParseClass),
- (GBaseInitFunc) gst_ogm_text_parse_base_init,
- NULL,
- NULL,
- NULL,
- NULL,
- sizeof (GstOgmParse),
- 0,
- (GInstanceInitFunc) gst_ogm_text_parse_init,
- };
-
- ogm_text_parse_type =
- g_type_register_static (GST_TYPE_OGM_PARSE,
- "GstOgmTextParse", &ogm_text_parse_info, 0);
- }
-
- return ogm_text_parse_type;
-}
-
-static void
-gst_ogm_audio_parse_base_init (GstOgmParseClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- GstCaps *caps = gst_riff_create_audio_template_caps ();
-
- gst_element_class_set_details (element_class, &gst_ogm_audio_parse_details);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_factory_audio));
- audio_src_templ = gst_pad_template_new ("src",
- GST_PAD_SRC, GST_PAD_SOMETIMES, caps);
- gst_element_class_add_pad_template (element_class, audio_src_templ);
-}
-
-static void
-gst_ogm_video_parse_base_init (GstOgmParseClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- GstCaps *caps = gst_riff_create_video_template_caps ();
-
- gst_element_class_set_details (element_class, &gst_ogm_video_parse_details);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_factory_video));
- video_src_templ = gst_pad_template_new ("src",
- GST_PAD_SRC, GST_PAD_SOMETIMES, caps);
- gst_element_class_add_pad_template (element_class, video_src_templ);
-}
-
-static void
-gst_ogm_text_parse_base_init (GstOgmParseClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- GstCaps *caps = gst_caps_new_simple ("text/plain", NULL, NULL);
-
- gst_element_class_set_details (element_class, &gst_ogm_text_parse_details);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_factory_text));
- text_src_templ = gst_pad_template_new ("src",
- GST_PAD_SRC, GST_PAD_SOMETIMES, caps);
- gst_element_class_add_pad_template (element_class, text_src_templ);
-}
-
-static void
-gst_ogm_parse_class_init (GstOgmParseClass * klass)
-{
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_ogm_parse_change_state);
-}
-
-static void
-gst_ogm_parse_init (GstOgmParse * ogm)
-{
- memset (&ogm->hdr, 0, sizeof (ogm->hdr));
- ogm->next_granulepos = 0;
- ogm->srcpad = NULL;
- ogm->cached_events = NULL;
-}
-
-static void
-gst_ogm_audio_parse_init (GstOgmParse * ogm)
-{
- ogm->sinkpad = gst_pad_new_from_static_template (&sink_factory_audio, "sink");
- gst_pad_set_query_function (ogm->sinkpad,
- GST_DEBUG_FUNCPTR (gst_ogm_parse_sink_query));
- gst_pad_set_chain_function (ogm->sinkpad,
- GST_DEBUG_FUNCPTR (gst_ogm_parse_chain));
- gst_pad_set_event_function (ogm->sinkpad,
- GST_DEBUG_FUNCPTR (gst_ogm_parse_sink_event));
- gst_element_add_pad (GST_ELEMENT (ogm), ogm->sinkpad);
-
- ogm->srcpad = NULL;
- ogm->srcpadtempl = audio_src_templ;
-}
-
-static void
-gst_ogm_video_parse_init (GstOgmParse * ogm)
-{
- ogm->sinkpad = gst_pad_new_from_static_template (&sink_factory_video, "sink");
- gst_pad_set_query_function (ogm->sinkpad,
- GST_DEBUG_FUNCPTR (gst_ogm_parse_sink_query));
- gst_pad_set_chain_function (ogm->sinkpad,
- GST_DEBUG_FUNCPTR (gst_ogm_parse_chain));
- gst_pad_set_event_function (ogm->sinkpad,
- GST_DEBUG_FUNCPTR (gst_ogm_parse_sink_event));
- gst_element_add_pad (GST_ELEMENT (ogm), ogm->sinkpad);
-
- ogm->srcpad = NULL;
- ogm->srcpadtempl = video_src_templ;
-}
-
-static void
-gst_ogm_text_parse_init (GstOgmParse * ogm)
-{
- ogm->sinkpad = gst_pad_new_from_static_template (&sink_factory_text, "sink");
- gst_pad_set_query_type_function (ogm->sinkpad,
- gst_ogm_parse_get_sink_querytypes);
- gst_pad_set_query_function (ogm->sinkpad,
- GST_DEBUG_FUNCPTR (gst_ogm_parse_sink_query));
- gst_pad_set_chain_function (ogm->sinkpad,
- GST_DEBUG_FUNCPTR (gst_ogm_parse_chain));
- gst_pad_set_event_function (ogm->sinkpad,
- GST_DEBUG_FUNCPTR (gst_ogm_parse_sink_event));
- gst_element_add_pad (GST_ELEMENT (ogm), ogm->sinkpad);
-
- ogm->srcpad = NULL;
- ogm->srcpadtempl = text_src_templ;
-}
-
-static const GstQueryType *
-gst_ogm_parse_get_sink_querytypes (GstPad * pad)
-{
- static const GstQueryType types[] = {
- GST_QUERY_POSITION,
- 0
- };
-
- return types;
-}
-
-static gboolean
-gst_ogm_parse_sink_convert (GstPad * pad,
- GstFormat src_format, gint64 src_value,
- GstFormat * dest_format, gint64 * dest_value)
-{
- gboolean res = FALSE;
- GstOgmParse *ogm = GST_OGM_PARSE (gst_pad_get_parent (pad));
-
- switch (src_format) {
- case GST_FORMAT_DEFAULT:
- switch (*dest_format) {
- case GST_FORMAT_TIME:
- switch (ogm->hdr.streamtype[0]) {
- case 'a':
- *dest_value = GST_SECOND * src_value / ogm->hdr.samples_per_unit;
- res = TRUE;
- break;
- case 'v':
- case 't':
- *dest_value = (GST_SECOND / 10000000) *
- ogm->hdr.time_unit * src_value;
- res = TRUE;
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- break;
- case GST_FORMAT_TIME:
- switch (*dest_format) {
- case GST_FORMAT_DEFAULT:
- switch (ogm->hdr.streamtype[0]) {
- case 'a':
- *dest_value = ogm->hdr.samples_per_unit * src_value / GST_SECOND;
- res = TRUE;
- break;
- case 'v':
- case 't':
- *dest_value = src_value /
- ((GST_SECOND / 10000000) * ogm->hdr.time_unit);
- res = TRUE;
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
-
- gst_object_unref (ogm);
- return res;
-}
-
-static gboolean
-gst_ogm_parse_sink_query (GstPad * pad, GstQuery * query)
-{
- GstOgmParse *ogm = GST_OGM_PARSE (gst_pad_get_parent (pad));
- GstFormat format;
- gboolean res = FALSE;
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_POSITION:
- {
- gint64 val;
-
- gst_query_parse_position (query, &format, NULL);
-
- if (format != GST_FORMAT_DEFAULT && format != GST_FORMAT_TIME)
- break;
-
- if ((res = gst_ogm_parse_sink_convert (pad,
- GST_FORMAT_DEFAULT, ogm->next_granulepos, &format, &val))) {
- /* don't know the total length here.. */
- gst_query_set_position (query, format, val);
- }
- break;
- }
- case GST_QUERY_CONVERT:
- {
- GstFormat src_fmt, dest_fmt;
- gint64 src_val, dest_val;
-
- /* peel off input */
- gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
- if ((res = gst_ogm_parse_sink_convert (pad, src_fmt, src_val,
- &dest_fmt, &dest_val))) {
- gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
- }
- break;
- }
- default:
- res = gst_pad_query_default (pad, query);
- break;
- }
-
- gst_object_unref (ogm);
- return res;
-}
-
-static GstFlowReturn
-gst_ogm_parse_stream_header (GstOgmParse * ogm, const guint8 * data, guint size)
-{
- GstCaps *caps = NULL;
-
- /* stream header */
- if (size < OGM_STREAM_HEADER_SIZE)
- goto buffer_too_small;
-
- if (!memcmp (data, "video\000\000\000", 8)) {
- ogm->hdr.s.video.width = GST_READ_UINT32_LE (&data[44]);
- ogm->hdr.s.video.height = GST_READ_UINT32_LE (&data[48]);
- } else if (!memcmp (data, "audio\000\000\000", 8)) {
- ogm->hdr.s.audio.channels = GST_READ_UINT32_LE (&data[44]);
- ogm->hdr.s.audio.blockalign = GST_READ_UINT32_LE (&data[46]);
- ogm->hdr.s.audio.avgbytespersec = GST_READ_UINT32_LE (&data[48]);
- } else if (!memcmp (data, "text\000\000\000\000", 8)) {
- /* nothing here */
- } else {
- goto cannot_decode;
- }
- memcpy (ogm->hdr.streamtype, &data[0], 8);
- memcpy (ogm->hdr.subtype, &data[8], 4);
- ogm->hdr.subtype[4] = '\0';
- ogm->hdr.size = GST_READ_UINT32_LE (&data[12]);
- ogm->hdr.time_unit = GST_READ_UINT64_LE (&data[16]);
- ogm->hdr.samples_per_unit = GST_READ_UINT64_LE (&data[24]);
- ogm->hdr.default_len = GST_READ_UINT32_LE (&data[32]);
- ogm->hdr.buffersize = GST_READ_UINT32_LE (&data[36]);
- ogm->hdr.bits_per_sample = GST_READ_UINT32_LE (&data[40]);
-
- switch (ogm->hdr.streamtype[0]) {
- case 'a':{
- guint codec_id = 0;
-
- if (sscanf (ogm->hdr.subtype, "%04x", &codec_id) != 1) {
- GST_WARNING_OBJECT (ogm, "cannot parse subtype %s", ogm->hdr.subtype);
- }
-
- caps =
- gst_riff_create_audio_caps (codec_id, NULL, NULL, NULL, NULL, NULL);
-
- if (caps == NULL) {
- GST_WARNING_OBJECT (ogm, "no audio caps for codec %u found", codec_id);
- caps = gst_caps_new_simple ("audio/x-ogm-unknown", "codec_id",
- G_TYPE_INT, (gint) codec_id, NULL);
- }
-
- gst_caps_set_simple (caps,
- "channels", G_TYPE_INT, ogm->hdr.s.audio.channels,
- "rate", G_TYPE_INT, ogm->hdr.samples_per_unit, NULL);
-
- GST_LOG_OBJECT (ogm, "Type: %s, subtype: 0x%04x, channels: %d, "
- "samplerate: %d, blockalign: %d, bps: %d, caps = %" GST_PTR_FORMAT,
- ogm->hdr.streamtype, codec_id, ogm->hdr.s.audio.channels,
- (gint) ogm->hdr.samples_per_unit, ogm->hdr.s.audio.blockalign,
- ogm->hdr.s.audio.avgbytespersec, caps);
- break;
- }
- case 'v':{
- guint32 fourcc;
- gint time_unit;
-
- fourcc = GST_MAKE_FOURCC (ogm->hdr.subtype[0],
- ogm->hdr.subtype[1], ogm->hdr.subtype[2], ogm->hdr.subtype[3]);
-
- caps = gst_riff_create_video_caps (fourcc, NULL, NULL, NULL, NULL, NULL);
-
- if (caps == NULL) {
- GST_WARNING_OBJECT (ogm, "could not find video caps for fourcc %"
- GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
- caps = gst_caps_new_simple ("video/x-ogm-unknown", "fourcc",
- GST_TYPE_FOURCC, fourcc, NULL);
- break;
- }
-
- GST_LOG_OBJECT (ogm, "Type: %s, subtype: %" GST_FOURCC_FORMAT
- ", size: %dx%d, timeunit: %" G_GINT64_FORMAT
- " (fps: %lf), s/u: %" G_GINT64_FORMAT ", "
- "def.len: %d, bufsize: %d, bps: %d, caps = %" GST_PTR_FORMAT,
- ogm->hdr.streamtype, GST_FOURCC_ARGS (fourcc),
- ogm->hdr.s.video.width, ogm->hdr.s.video.height,
- ogm->hdr.time_unit, 10000000. / ogm->hdr.time_unit,
- ogm->hdr.samples_per_unit, ogm->hdr.default_len,
- ogm->hdr.buffersize, ogm->hdr.bits_per_sample, caps);
-
- /* GST_TYPE_FRACTION contains gint */
- if (ogm->hdr.time_unit > G_MAXINT || ogm->hdr.time_unit < G_MININT)
- GST_WARNING_OBJECT (ogm, "timeunit is out of range");
-
- time_unit = (gint) CLAMP (ogm->hdr.time_unit, G_MININT, G_MAXINT);
- gst_caps_set_simple (caps,
- "width", G_TYPE_INT, ogm->hdr.s.video.width,
- "height", G_TYPE_INT, ogm->hdr.s.video.height,
- "framerate", GST_TYPE_FRACTION, 10000000, time_unit, NULL);
- break;
- }
- case 't':{
- GST_LOG_OBJECT (ogm, "Type: %s, s/u: %" G_GINT64_FORMAT
- ", timeunit=%" G_GINT64_FORMAT,
- ogm->hdr.streamtype, ogm->hdr.samples_per_unit, ogm->hdr.time_unit);
- caps = gst_caps_new_simple ("text/plain", NULL);
- break;
- }
- default:
- g_assert_not_reached ();
- }
-
- if (caps == NULL)
- goto cannot_decode;
-
- if (ogm->srcpad) {
- GstCaps *current_caps = GST_PAD_CAPS (ogm->srcpad);
-
- if (current_caps && caps && !gst_caps_is_equal (current_caps, caps)) {
- GST_WARNING_OBJECT (ogm, "Already an existing pad %s:%s",
- GST_DEBUG_PAD_NAME (ogm->srcpad));
- gst_pad_set_active (ogm->srcpad, FALSE);
- gst_element_remove_pad (GST_ELEMENT (ogm), ogm->srcpad);
- ogm->srcpad = NULL;
- } else {
- GST_DEBUG_OBJECT (ogm, "Existing pad has the same caps, do nothing");
- }
- }
-
- if (ogm->srcpad == NULL) {
- GList *l, *cached_events;
-
- ogm->srcpad = gst_pad_new_from_template (ogm->srcpadtempl, "src");
- gst_pad_use_fixed_caps (ogm->srcpad);
- gst_pad_set_caps (ogm->srcpad, caps);
- gst_pad_set_active (ogm->srcpad, TRUE);
- gst_element_add_pad (GST_ELEMENT (ogm), ogm->srcpad);
- GST_INFO_OBJECT (ogm, "Added pad %s:%s with caps %" GST_PTR_FORMAT,
- GST_DEBUG_PAD_NAME (ogm->srcpad), caps);
-
- GST_OBJECT_LOCK (ogm);
- cached_events = ogm->cached_events;
- ogm->cached_events = NULL;
- GST_OBJECT_UNLOCK (ogm);
-
- for (l = cached_events; l; l = l->next) {
- GstEvent *event = GST_EVENT_CAST (l->data);
-
- GST_DEBUG_OBJECT (ogm, "Pushing cached event %" GST_PTR_FORMAT, event);
- gst_pad_push_event (ogm->srcpad, event);
- }
- g_list_free (cached_events);
-
- {
- GstTagList *tags;
-
- tags = gst_tag_list_new ();
- gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_SUBTITLE_CODEC,
- "Ogm", NULL);
- gst_element_found_tags_for_pad (GST_ELEMENT (ogm), ogm->srcpad, tags);
- }
- }
-
- gst_caps_unref (caps);
-
- return GST_FLOW_OK;
-
-/* ERRORS */
-buffer_too_small:
- {
- GST_ELEMENT_ERROR (ogm, STREAM, WRONG_TYPE, ("Buffer too small"), (NULL));
- return GST_FLOW_ERROR;
- }
-cannot_decode:
- {
- GST_ELEMENT_ERROR (ogm, STREAM, DECODE, (NULL), ("unknown ogm format"));
- return GST_FLOW_ERROR;
- }
-}
-
-static GstFlowReturn
-gst_ogm_parse_comment_packet (GstOgmParse * ogm, GstBuffer * buf)
-{
- GstFlowReturn ret;
-
- if (ogm->srcpad == NULL) {
- GST_DEBUG ("no source pad");
- return GST_FLOW_WRONG_STATE;
- }
-
- /* if this is not a subtitle stream, push the vorbiscomment packet
- * on downstream, the respective decoder will handle it; if it is
- * a subtitle stream, we will have to handle the comment ourself */
- if (ogm->hdr.streamtype[0] == 't') {
- GstTagList *tags;
-
- tags = gst_tag_list_from_vorbiscomment_buffer (buf,
- (guint8 *) "\003vorbis", 7, NULL);
-
- if (tags) {
- GST_DEBUG_OBJECT (ogm, "tags = %" GST_PTR_FORMAT, tags);
- gst_element_found_tags_for_pad (GST_ELEMENT (ogm), ogm->srcpad, tags);
- } else {
- GST_DEBUG_OBJECT (ogm, "failed to extract tags from vorbis comment");
- }
- /* do not push packet downstream, just let parent unref it */
- ret = GST_FLOW_OK;
- } else {
- buf = gst_buffer_copy (buf);
- gst_buffer_set_caps (buf, GST_PAD_CAPS (ogm->srcpad));
- ret = gst_pad_push (ogm->srcpad, buf);
- }
-
- return ret;
-}
-
-static void
-gst_ogm_text_parse_strip_trailing_zeroes (GstOgmParse * ogm, GstBuffer * buf)
-{
- const guint8 *data;
- guint size;
-
- g_assert (gst_buffer_is_metadata_writable (buf));
-
- /* zeroes are not valid UTF-8 characters, so strip them from output */
- data = GST_BUFFER_DATA (buf);
- size = GST_BUFFER_SIZE (buf);
- while (size > 0 && data[size - 1] == '\0') {
- --size;
- }
-
- GST_BUFFER_SIZE (buf) = size;
-}
-
-static GstFlowReturn
-gst_ogm_parse_data_packet (GstOgmParse * ogm, GstBuffer * buf)
-{
- GstFlowReturn ret;
- const guint8 *data;
- GstBuffer *sbuf;
- gboolean keyframe;
- guint size, len, n, xsize = 0;
-
- data = GST_BUFFER_DATA (buf);
- size = GST_BUFFER_SIZE (buf);
-
- if ((data[0] & 0x01) != 0)
- goto invalid_startcode;
-
- /* data - push on */
- len = ((data[0] & 0xc0) >> 6) | ((data[0] & 0x02) << 1);
- keyframe = (((data[0] & 0x08) >> 3) != 0);
-
- if ((1 + len) > size)
- goto buffer_too_small;
-
- for (n = len; n > 0; n--) {
- xsize = (xsize << 8) | data[n];
- }
-
- GST_LOG_OBJECT (ogm, "[0x%02x] samples: %d, hdrbytes: %d, datasize: %d",
- data[0], xsize, len, size - len - 1);
-
- sbuf = gst_buffer_create_sub (buf, len + 1, size - len - 1);
-
- if (GST_BUFFER_OFFSET_END_IS_VALID (buf))
- ogm->next_granulepos = GST_BUFFER_OFFSET_END (buf);
-
- switch (ogm->hdr.streamtype[0]) {
- case 't':
- case 'v':{
- GstClockTime ts, next_ts;
- guint samples;
-
- samples = (ogm->hdr.streamtype[0] == 'v') ? 1 : xsize;
-
- if (!keyframe) {
- GST_BUFFER_FLAG_SET (sbuf, GST_BUFFER_FLAG_DELTA_UNIT);
- }
-
- /* shouldn't this be granulepos - samples? (tpm) */
- ts = gst_util_uint64_scale (ogm->next_granulepos,
- ogm->hdr.time_unit * GST_SECOND, 10000000);
- next_ts = gst_util_uint64_scale (ogm->next_granulepos + samples,
- ogm->hdr.time_unit * GST_SECOND, 10000000);
-
- GST_BUFFER_TIMESTAMP (sbuf) = ts;
- GST_BUFFER_DURATION (sbuf) = next_ts - ts;
-
- ogm->next_granulepos += samples;
-
- if (ogm->hdr.streamtype[0] == 't') {
- gst_ogm_text_parse_strip_trailing_zeroes (ogm, sbuf);
- }
- break;
- }
- case 'a':{
- GstClockTime ts, next_ts;
-
- /* shouldn't this be granulepos - samples? (tpm) */
- ts = gst_util_uint64_scale_int (ogm->next_granulepos,
- GST_SECOND, ogm->hdr.samples_per_unit);
- next_ts = gst_util_uint64_scale_int (ogm->next_granulepos + xsize,
- GST_SECOND, ogm->hdr.samples_per_unit);
-
- GST_BUFFER_TIMESTAMP (sbuf) = ts;
- GST_BUFFER_DURATION (sbuf) = next_ts - ts;
-
- ogm->next_granulepos += xsize;
- break;
- }
- default:
- g_assert_not_reached ();
- break;
- }
-
- if (ogm->srcpad) {
- gst_buffer_set_caps (sbuf, GST_PAD_CAPS (ogm->srcpad));
- GST_LOG_OBJECT (ogm, "Pushing buffer with ts=%" GST_TIME_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (sbuf)));
- ret = gst_pad_push (ogm->srcpad, sbuf);
- if (ret != GST_FLOW_OK) {
- GST_DEBUG_OBJECT (ogm, "Flow on %s:%s = %s",
- GST_DEBUG_PAD_NAME (ogm->srcpad), gst_flow_get_name (ret));
- }
- } else {
- ret = GST_FLOW_WRONG_STATE;
- }
-
- return ret;
-
-/* ERRORS */
-invalid_startcode:
- {
- GST_ELEMENT_ERROR (ogm, STREAM, DECODE, (NULL),
- ("unexpected packet startcode 0x%02x", data[0]));
- return GST_FLOW_ERROR;
- }
-buffer_too_small:
- {
- GST_ELEMENT_ERROR (ogm, STREAM, DECODE, (NULL),
- ("buffer too small, len+1=%u, size=%u", len + 1, size));
- return GST_FLOW_ERROR;
- }
-}
-
-static GstFlowReturn
-gst_ogm_parse_chain (GstPad * pad, GstBuffer * buf)
-{
- GstFlowReturn ret = GST_FLOW_OK;
- GstOgmParse *ogm = GST_OGM_PARSE (GST_PAD_PARENT (pad));
- guint8 *data = GST_BUFFER_DATA (buf);
- guint size = GST_BUFFER_SIZE (buf);
-
- if (size < 1)
- goto buffer_too_small;
-
- GST_LOG_OBJECT (ogm, "Packet with start code 0x%02x", data[0]);
-
- switch (data[0]) {
- case 0x01:{
- ret = gst_ogm_parse_stream_header (ogm, data + 1, size - 1);
- break;
- }
- case 0x03:{
- ret = gst_ogm_parse_comment_packet (ogm, buf);
- break;
- }
- default:{
- ret = gst_ogm_parse_data_packet (ogm, buf);
- break;
- }
- }
-
- gst_buffer_unref (buf);
-
- if (ret != GST_FLOW_OK) {
- GST_DEBUG_OBJECT (ogm, "Flow: %s", gst_flow_get_name (ret));
- }
-
- return ret;
-
-/* ERRORS */
-buffer_too_small:
- {
- GST_ELEMENT_ERROR (ogm, STREAM, DECODE, (NULL), ("buffer too small"));
- gst_buffer_unref (buf);
- return GST_FLOW_ERROR;
- }
-}
-
-static gboolean
-gst_ogm_parse_sink_event (GstPad * pad, GstEvent * event)
-{
- GstOgmParse *ogm = GST_OGM_PARSE (gst_pad_get_parent (pad));
- gboolean res;
-
- GST_LOG_OBJECT (ogm, "processing %s event", GST_EVENT_TYPE_NAME (event));
-
- GST_OBJECT_LOCK (ogm);
- if (ogm->srcpad == NULL) {
- ogm->cached_events = g_list_append (ogm->cached_events, event);
- GST_OBJECT_UNLOCK (ogm);
- res = TRUE;
- } else {
- GST_OBJECT_UNLOCK (ogm);
- res = gst_pad_event_default (pad, event);
- }
-
- gst_object_unref (ogm);
- return res;
-}
-
-static GstStateChangeReturn
-gst_ogm_parse_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret;
- GstOgmParse *ogm = GST_OGM_PARSE (element);
-
- ret = parent_class->change_state (element, transition);
- if (ret != GST_STATE_CHANGE_SUCCESS)
- return ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- if (ogm->srcpad) {
- gst_pad_set_active (ogm->srcpad, FALSE);
- gst_element_remove_pad (element, ogm->srcpad);
- ogm->srcpad = NULL;
- }
- memset (&ogm->hdr, 0, sizeof (ogm->hdr));
- ogm->next_granulepos = 0;
- g_list_foreach (ogm->cached_events, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (ogm->cached_events);
- ogm->cached_events = NULL;
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-gboolean
-gst_ogm_parse_plugin_init (GstPlugin * plugin)
-{
- gst_riff_init ();
-
- GST_DEBUG_CATEGORY_INIT (gst_ogm_parse_debug, "ogmparse", 0, "ogm parser");
-
- return gst_element_register (plugin, "ogmaudioparse", GST_RANK_PRIMARY,
- GST_TYPE_OGM_AUDIO_PARSE) &&
- gst_element_register (plugin, "ogmvideoparse", GST_RANK_PRIMARY,
- GST_TYPE_OGM_VIDEO_PARSE) &&
- gst_element_register (plugin, "ogmtextparse", GST_RANK_PRIMARY,
- GST_TYPE_OGM_TEXT_PARSE);
-}
diff --git a/ext/ogg/vorbis_parse.c b/ext/ogg/vorbis_parse.c
deleted file mode 100644
index f9ba746d..00000000
--- a/ext/ogg/vorbis_parse.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- This file borrowed from liboggz
- */
-/*
- Copyright (C) 2003 Commonwealth Scientific and Industrial Research
- Organisation (CSIRO) Australia
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - 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.
-
- - Neither the name of CSIRO Australia nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- 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 ORGANISATION 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.
-*/
-
-/*
- * oggz_auto.c
- *
- * Conrad Parker <conrad@annodex.net>
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "gstoggstream.h"
-
-/*
- * Vorbis packets can be short or long, and each packet overlaps the previous
- * and next packets. The granulepos of a packet is always the last sample
- * that is completely decoded at the end of decoding that packet - i.e. the
- * last packet before the first overlapping packet. If the sizes of packets
- * are 's' and 'l', then the increment will depend on the previous and next
- * packet types:
- * v prev<<1 | next
- * lll: l/2 3
- * lls: 3l/4 - s/4 2
- * lsl: s/2
- * lss: s/2
- * sll: l/4 + s/4 1
- * sls: l/2 0
- * ssl: s/2
- * sss: s/2
- *
- * The previous and next packet types can be inferred from the current packet
- * (additional information is not required)
- *
- * The two blocksizes can be determined from the first header packet, by reading
- * byte 28. 1 << (packet[28] >> 4) == long_size.
- * 1 << (packet[28] & 0xF) == short_size.
- *
- * (see http://xiph.org/vorbis/doc/Vorbis_I_spec.html for specification)
- */
-
-
-void
-parse_vorbis_header_packet (GstOggStream * pad, ogg_packet * packet)
-{
- /*
- * on the first (b_o_s) packet, determine the long and short sizes,
- * and then calculate l/2, l/4 - s/4, 3 * l/4 - s/4, l/2 - s/2 and s/2
- */
- int short_size;
- int long_size;
-
- long_size = 1 << (packet->packet[28] >> 4);
- short_size = 1 << (packet->packet[28] & 0xF);
-
- pad->nln_increments[3] = long_size >> 1;
- pad->nln_increments[2] = 3 * (long_size >> 2) - (short_size >> 2);
- pad->nln_increments[1] = (long_size >> 2) + (short_size >> 2);
- pad->nln_increments[0] = pad->nln_increments[3];
- pad->short_size = short_size;
- pad->long_size = long_size;
- pad->nsn_increment = short_size >> 1;
-}
-
-void
-parse_vorbis_setup_packet (GstOggStream * pad, ogg_packet * op)
-{
- /*
- * the code pages, a whole bunch of other fairly useless stuff, AND,
- * RIGHT AT THE END (of a bunch of variable-length compressed rubbish that
- * basically has only one actual set of values that everyone uses BUT YOU
- * CAN'T BE SURE OF THAT, OH NO YOU CAN'T) is the only piece of data that's
- * actually useful to us - the packet modes (because it's inconceivable to
- * think people might want _just that_ and nothing else, you know, for
- * seeking and stuff).
- *
- * Fortunately, because of the mandate that non-used bits must be zero
- * at the end of the packet, we might be able to sneakily work backwards
- * and find out the information we need (namely a mapping of modes to
- * packet sizes)
- */
- unsigned char *current_pos = &op->packet[op->bytes - 1];
- int offset;
- int size;
- int size_check;
- int *mode_size_ptr;
- int i;
- int ii;
-
- /*
- * This is the format of the mode data at the end of the packet for all
- * Vorbis Version 1 :
- *
- * [ 6:number_of_modes ]
- * [ 1:size | 16:window_type(0) | 16:transform_type(0) | 8:mapping ]
- * [ 1:size | 16:window_type(0) | 16:transform_type(0) | 8:mapping ]
- * [ 1:size | 16:window_type(0) | 16:transform_type(0) | 8:mapping ]
- * [ 1:framing(1) ]
- *
- * e.g.:
- *
- * <-
- * 0 0 0 0 0 1 0 0
- * 0 0 1 0 0 0 0 0
- * 0 0 1 0 0 0 0 0
- * 0 0 1|0 0 0 0 0
- * 0 0 0 0|0|0 0 0
- * 0 0 0 0 0 0 0 0
- * 0 0 0 0|0 0 0 0
- * 0 0 0 0 0 0 0 0
- * 0 0 0 0|0 0 0 0
- * 0 0 0|1|0 0 0 0 |
- * 0 0 0 0 0 0 0 0 V
- * 0 0 0|0 0 0 0 0
- * 0 0 0 0 0 0 0 0
- * 0 0 1|0 0 0 0 0
- * 0 0|1|0 0 0 0 0
- *
- *
- * i.e. each entry is an important bit, 32 bits of 0, 8 bits of blah, a
- * bit of 1.
- * Let's find our last 1 bit first.
- *
- */
-
- size = 0;
-
- offset = 8;
- while (!((1 << --offset) & *current_pos)) {
- if (offset == 0) {
- offset = 8;
- current_pos -= 1;
- }
- }
-
- while (1) {
-
- /*
- * from current_pos-5:(offset+1) to current_pos-1:(offset+1) should
- * be zero
- */
- offset = (offset + 7) % 8;
- if (offset == 7)
- current_pos -= 1;
-
- if (((current_pos[-5] & ~((1 << (offset + 1)) - 1)) != 0)
- ||
- current_pos[-4] != 0
- ||
- current_pos[-3] != 0
- ||
- current_pos[-2] != 0
- || ((current_pos[-1] & ((1 << (offset + 1)) - 1)) != 0)
- ) {
- break;
- }
-
- size += 1;
-
- current_pos -= 5;
-
- }
-
- /* Give ourselves a chance to recover if we went back too far by using
- * the size check. */
- for (ii = 0; ii < 2; ii++) {
- if (offset > 4) {
- size_check = (current_pos[0] >> (offset - 5)) & 0x3F;
- } else {
- /* mask part of byte from current_pos */
- size_check = (current_pos[0] & ((1 << (offset + 1)) - 1));
- /* shift to appropriate position */
- size_check <<= (5 - offset);
- /* or in part of byte from current_pos - 1 */
- size_check |= (current_pos[-1] & ~((1 << (offset + 3)) - 1)) >>
- (offset + 3);
- }
-
- size_check += 1;
- if (size_check == size) {
- break;
- }
- offset = (offset + 1) % 8;
- if (offset == 0)
- current_pos += 1;
- current_pos += 5;
- size -= 1;
- }
-
- /* Store mode size information in our info struct */
- i = -1;
- while ((1 << (++i)) < size);
- pad->vorbis_log2_num_modes = i;
-
- mode_size_ptr = pad->vorbis_mode_sizes;
-
- for (i = 0; i < size; i++) {
- offset = (offset + 1) % 8;
- if (offset == 0)
- current_pos += 1;
- *mode_size_ptr++ = (current_pos[0] >> offset) & 0x1;
- current_pos += 5;
- }
-
-}
diff --git a/ext/pango/Makefile.am b/ext/pango/Makefile.am
deleted file mode 100644
index 197ed338..00000000
--- a/ext/pango/Makefile.am
+++ /dev/null
@@ -1,28 +0,0 @@
-plugin_LTLIBRARIES = libgstpango.la
-
-noinst_HEADERS = \
- gstclockoverlay.h \
- gsttextoverlay.h \
- gsttextrender.h \
- gsttimeoverlay.h
-
-libgstpango_la_SOURCES = \
- gstclockoverlay.c \
- gsttextoverlay.c \
- gsttextrender.c \
- gsttimeoverlay.c
-
-libgstpango_la_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(GST_CFLAGS) \
- $(PANGO_CFLAGS)
-libgstpango_la_LIBADD = \
- $(GST_PLUGINS_BASE_LIBS) \
- $(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_MAJORMINOR).la \
- $(GST_BASE_LIBS) \
- $(GST_LIBS) \
- $(PANGO_LIBS)
-libgstpango_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstpango_la_LIBTOOLFLAGS = --tag=disable-static
-
diff --git a/ext/pango/gstclockoverlay.c b/ext/pango/gstclockoverlay.c
deleted file mode 100644
index 5db475bc..00000000
--- a/ext/pango/gstclockoverlay.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-clockoverlay
- * @see_also: #GstTextOverlay, #GstTimeOverlay
- *
- * This element overlays the current clock time on top of a video
- * stream. You can position the text and configure the font details
- * using the properties of the #GstTextOverlay class. By default, the
- * time is displayed in the top left corner of the picture, with some
- * padding to the left and to the top.
- *
- * <refsect2>
- * <title>Example launch lines</title>
- * |[
- * gst-launch -v videotestsrc ! clockoverlay ! xvimagesink
- * ]| Display the current time in the top left corner of the video picture
- * |[
- * gst-launch -v videotestsrc ! clockoverlay halign=right valign=bottom text="Edge City" shaded-background=true ! ffmpegcolorspace ! ximagesink
- * ]| Another pipeline that displays the current time with some leading
- * text in the bottom right corner of the video picture, with the background
- * of the text being shaded in order to make it more legible on top of a
- * bright video background.
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gstclockoverlay.h>
-#include <gst/video/video.h>
-#include <time.h>
-
-
-#define DEFAULT_PROP_TIMEFORMAT "%H:%M:%S"
-
-enum
-{
- PROP_0,
- PROP_TIMEFORMAT,
- PROP_LAST
-};
-
-GST_BOILERPLATE (GstClockOverlay, gst_clock_overlay, GstTextOverlay,
- GST_TYPE_TEXT_OVERLAY);
-
-static void
-gst_clock_overlay_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details_simple (element_class, "Clock overlay",
- "Filter/Editor/Video",
- "Overlays the current clock time on a video stream",
- "Tim-Philipp Müller <tim@centricular.net>");
-}
-
-
-static void gst_clock_overlay_finalize (GObject * object);
-static void gst_clock_overlay_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_clock_overlay_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static gchar *
-gst_clock_overlay_render_time (GstClockOverlay * overlay)
-{
- struct tm *t;
- time_t now;
- gchar buf[256];
-
-#ifdef HAVE_LOCALTIME_R
- struct tm dummy;
-#endif
-
- now = time (NULL);
-
-#ifdef HAVE_LOCALTIME_R
- /* Need to call tzset explicitly when calling localtime_r for changes
- to the timezone between calls to be visible. */
- tzset ();
- t = localtime_r (&now, &dummy);
-#else
- /* on win32 this apparently returns a per-thread struct which would be fine */
- t = localtime (&now);
-#endif
-
- if (t == NULL)
- return g_strdup ("--:--:--");
-
- if (strftime (buf, sizeof (buf), overlay->format, t) == 0)
- return g_strdup ("");
- return g_strdup (buf);
-}
-
-/* Called with lock held */
-static gchar *
-gst_clock_overlay_get_text (GstTextOverlay * overlay, GstBuffer * video_frame)
-{
- gchar *time_str, *txt, *ret;
-
- overlay->need_render = TRUE;
-
- txt = g_strdup (overlay->default_text);
-
- time_str = gst_clock_overlay_render_time (GST_CLOCK_OVERLAY (overlay));
- if (txt != NULL && *txt != '\0') {
- ret = g_strdup_printf ("%s %s", txt, time_str);
- } else {
- ret = time_str;
- time_str = NULL;
- }
-
- g_free (txt);
- g_free (time_str);
-
- return ret;
-}
-
-static void
-gst_clock_overlay_class_init (GstClockOverlayClass * klass)
-{
- GObjectClass *gobject_class;
- GstTextOverlayClass *gsttextoverlay_class;
-
- gobject_class = (GObjectClass *) klass;
- gsttextoverlay_class = (GstTextOverlayClass *) klass;
-
- gobject_class->finalize = gst_clock_overlay_finalize;
- gobject_class->set_property = gst_clock_overlay_set_property;
- gobject_class->get_property = gst_clock_overlay_get_property;
-
- gsttextoverlay_class->get_text = gst_clock_overlay_get_text;
-
- g_object_class_install_property (gobject_class, PROP_TIMEFORMAT,
- g_param_spec_string ("time-format", "Date/Time Format",
- "Format to use for time and date value, as in strftime.",
- DEFAULT_PROP_TIMEFORMAT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-}
-
-
-static void
-gst_clock_overlay_finalize (GObject * object)
-{
- GstClockOverlay *overlay = GST_CLOCK_OVERLAY (object);
-
- g_free (overlay->format);
- overlay->format = NULL;
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
-static void
-gst_clock_overlay_init (GstClockOverlay * overlay, GstClockOverlayClass * klass)
-{
- PangoFontDescription *font_description;
- GstTextOverlay *textoverlay;
- PangoContext *context;
-
- textoverlay = GST_TEXT_OVERLAY (overlay);
-
- context = GST_TEXT_OVERLAY_CLASS (klass)->pango_context;
-
- pango_context_set_language (context, pango_language_from_string ("en_US"));
- pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);
-
- font_description = pango_font_description_new ();
- pango_font_description_set_family_static (font_description, "Monospace");
- pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL);
- pango_font_description_set_variant (font_description, PANGO_VARIANT_NORMAL);
- pango_font_description_set_weight (font_description, PANGO_WEIGHT_NORMAL);
- pango_font_description_set_stretch (font_description, PANGO_STRETCH_NORMAL);
- pango_font_description_set_size (font_description, 18 * PANGO_SCALE);
- pango_context_set_font_description (context, font_description);
- pango_font_description_free (font_description);
-
- textoverlay->valign = GST_TEXT_OVERLAY_VALIGN_TOP;
- textoverlay->halign = GST_TEXT_OVERLAY_HALIGN_LEFT;
-
- overlay->format = g_strdup (DEFAULT_PROP_TIMEFORMAT);
-}
-
-
-static void
-gst_clock_overlay_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstClockOverlay *overlay = GST_CLOCK_OVERLAY (object);
-
- GST_OBJECT_LOCK (overlay);
- switch (prop_id) {
- case PROP_TIMEFORMAT:
- g_free (overlay->format);
- overlay->format = g_value_dup_string (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
- GST_OBJECT_UNLOCK (overlay);
-}
-
-
-static void
-gst_clock_overlay_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstClockOverlay *overlay = GST_CLOCK_OVERLAY (object);
-
- GST_OBJECT_LOCK (overlay);
- switch (prop_id) {
- case PROP_TIMEFORMAT:
- g_value_set_string (value, overlay->format);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
- GST_OBJECT_UNLOCK (overlay);
-}
diff --git a/ext/pango/gstclockoverlay.h b/ext/pango/gstclockoverlay.h
deleted file mode 100644
index 74e32e36..00000000
--- a/ext/pango/gstclockoverlay.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_CLOCK_OVERLAY_H__
-#define __GST_CLOCK_OVERLAY_H__
-
-#include "gsttextoverlay.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_CLOCK_OVERLAY \
- (gst_clock_overlay_get_type())
-#define GST_CLOCK_OVERLAY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CLOCK_OVERLAY,GstClockOverlay))
-#define GST_CLOCK_OVERLAY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CLOCK_OVERLAY,GstClockOverlayClass))
-#define GST_IS_CLOCK_OVERLAY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CLOCK_OVERLAY))
-#define GST_IS_CLOCK_OVERLAY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CLOCK_OVERLAY))
-
-typedef struct _GstClockOverlay GstClockOverlay;
-typedef struct _GstClockOverlayClass GstClockOverlayClass;
-
-/**
- * GstClockOverlay:
- *
- * Opaque clockoverlay data structure.
- */
-struct _GstClockOverlay {
- GstTextOverlay textoverlay;
- gchar *format; /* as in strftime () */
-};
-
-struct _GstClockOverlayClass {
- GstTextOverlayClass parent_class;
-};
-
-GType gst_clock_overlay_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_CLOCK_OVERLAY_H__ */
-
diff --git a/ext/pango/gsttextoverlay.c b/ext/pango/gsttextoverlay.c
deleted file mode 100644
index 3e4a0ee7..00000000
--- a/ext/pango/gsttextoverlay.c
+++ /dev/null
@@ -1,2352 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) <2003> David Schleef <ds@schleef.org>
- * Copyright (C) <2006> Julien Moutte <julien@moutte.net>
- * Copyright (C) <2006> Zeeshan Ali <zeeshan.ali@nokia.com>
- * Copyright (C) <2006-2008> Tim-Philipp Müller <tim centricular net>
- * Copyright (C) <2009> Young-Ho Cha <ganadist@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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-textoverlay
- * @see_also: #GstTextRender, #GstClockOverlay, #GstTimeOverlay, #GstSubParse
- *
- * This plugin renders text on top of a video stream. This can be either
- * static text or text from buffers received on the text sink pad, e.g.
- * as produced by the subparse element. If the text sink pad is not linked,
- * the text set via the "text" property will be rendered. If the text sink
- * pad is linked, text will be rendered as it is received on that pad,
- * honouring and matching the buffer timestamps of both input streams.
- *
- * The text can contain newline characters and text wrapping is enabled by
- * default.
- *
- * <refsect2>
- * <title>Example launch lines</title>
- * |[
- * gst-launch -v videotestsrc ! textoverlay text="Room A" valign=top halign=left ! xvimagesink
- * ]| Here is a simple pipeline that displays a static text in the top left
- * corner of the video picture
- * |[
- * gst-launch -v filesrc location=subtitles.srt ! subparse ! txt. videotestsrc ! timeoverlay ! textoverlay name=txt shaded-background=yes ! xvimagesink
- * ]| Here is another pipeline that displays subtitles from an .srt subtitle
- * file, centered at the bottom of the picture and with a rectangular shading
- * around the text in the background:
- * <para>
- * If you do not have such a subtitle file, create one looking like this
- * in a text editor:
- * |[
- * 1
- * 00:00:03,000 --> 00:00:05,000
- * Hello? (3-5s)
- *
- * 2
- * 00:00:08,000 --> 00:00:13,000
- * Yes, this is a subtitle. Don&apos;t
- * you like it? (8-13s)
- *
- * 3
- * 00:00:18,826 --> 00:01:02,886
- * Uh? What are you talking about?
- * I don&apos;t understand (18-62s)
- * ]|
- * </para>
- * </refsect2>
- */
-
-/* FIXME: alloc segment as part of instance struct */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gst/video/video.h>
-
-#include "gsttextoverlay.h"
-#include "gsttimeoverlay.h"
-#include "gstclockoverlay.h"
-#include "gsttextrender.h"
-#include <string.h>
-
-/* FIXME:
- * - use proper strides and offset for I420
- * - if text is wider than the video picture, it does not get
- * clipped properly during blitting (if wrapping is disabled)
- * - make 'shading_value' a property (or enum: light/normal/dark/verydark)?
- */
-
-GST_DEBUG_CATEGORY (pango_debug);
-#define GST_CAT_DEFAULT pango_debug
-
-#define DEFAULT_PROP_TEXT ""
-#define DEFAULT_PROP_SHADING FALSE
-#define DEFAULT_PROP_VALIGNMENT GST_TEXT_OVERLAY_VALIGN_BASELINE
-#define DEFAULT_PROP_HALIGNMENT GST_TEXT_OVERLAY_HALIGN_CENTER
-#define DEFAULT_PROP_VALIGN "baseline"
-#define DEFAULT_PROP_HALIGN "center"
-#define DEFAULT_PROP_XPAD 25
-#define DEFAULT_PROP_YPAD 25
-#define DEFAULT_PROP_DELTAX 0
-#define DEFAULT_PROP_DELTAY 0
-#define DEFAULT_PROP_WRAP_MODE GST_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR
-#define DEFAULT_PROP_FONT_DESC ""
-#define DEFAULT_PROP_SILENT FALSE
-#define DEFAULT_PROP_LINE_ALIGNMENT GST_TEXT_OVERLAY_LINE_ALIGN_CENTER
-#define DEFAULT_PROP_WAIT_TEXT TRUE
-#define DEFAULT_PROP_AUTO_ADJUST_SIZE TRUE
-#define DEFAULT_PROP_VERTICAL_RENDER FALSE
-
-/* make a property of me */
-#define DEFAULT_SHADING_VALUE -80
-
-#define MINIMUM_OUTLINE_OFFSET 1.0
-#define DEFAULT_SCALE_BASIS 640
-
-#define COMP_Y(ret, r, g, b) \
-{ \
- ret = (int) (((19595 * r) >> 16) + ((38470 * g) >> 16) + ((7471 * b) >> 16)); \
- ret = CLAMP (ret, 0, 255); \
-}
-
-#define COMP_U(ret, r, g, b) \
-{ \
- ret = (int) (-((11059 * r) >> 16) - ((21709 * g) >> 16) + ((32768 * b) >> 16) + 128); \
- ret = CLAMP (ret, 0, 255); \
-}
-
-#define COMP_V(ret, r, g, b) \
-{ \
- ret = (int) (((32768 * r) >> 16) - ((27439 * g) >> 16) - ((5329 * b) >> 16) + 128); \
- ret = CLAMP (ret, 0, 255); \
-}
-
-#define BLEND(ret, alpha, v0, v1) \
-{ \
- ret = (v0 * alpha + v1 * (255 - alpha)) / 255; \
-}
-
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-# define CAIRO_ARGB_A 3
-# define CAIRO_ARGB_R 2
-# define CAIRO_ARGB_G 1
-# define CAIRO_ARGB_B 0
-#else
-# define CAIRO_ARGB_A 0
-# define CAIRO_ARGB_R 1
-# define CAIRO_ARGB_G 2
-# define CAIRO_ARGB_B 3
-#endif
-
-enum
-{
- PROP_0,
- PROP_TEXT,
- PROP_SHADING,
- PROP_VALIGN, /* deprecated */
- PROP_HALIGN, /* deprecated */
- PROP_HALIGNMENT,
- PROP_VALIGNMENT,
- PROP_XPAD,
- PROP_YPAD,
- PROP_DELTAX,
- PROP_DELTAY,
- PROP_WRAP_MODE,
- PROP_FONT_DESC,
- PROP_SILENT,
- PROP_LINE_ALIGNMENT,
- PROP_WAIT_TEXT,
- PROP_AUTO_ADJUST_SIZE,
- PROP_VERTICAL_RENDER,
- PROP_LAST
-};
-
-static GstStaticPadTemplate src_template_factory =
- GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx ";"
- GST_VIDEO_CAPS_xRGB ";"
- GST_VIDEO_CAPS_YUV ("I420") ";" GST_VIDEO_CAPS_YUV ("UYVY"))
- );
-
-static GstStaticPadTemplate video_sink_template_factory =
- GST_STATIC_PAD_TEMPLATE ("video_sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx ";"
- GST_VIDEO_CAPS_xRGB ";"
- GST_VIDEO_CAPS_YUV ("I420") ";" GST_VIDEO_CAPS_YUV ("UYVY"))
- );
-
-static GstStaticPadTemplate text_sink_template_factory =
- GST_STATIC_PAD_TEMPLATE ("text_sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("text/x-pango-markup; text/plain")
- );
-
-#define GST_TYPE_TEXT_OVERLAY_VALIGN (gst_text_overlay_valign_get_type())
-static GType
-gst_text_overlay_valign_get_type (void)
-{
- static GType text_overlay_valign_type = 0;
- static const GEnumValue text_overlay_valign[] = {
- {GST_TEXT_OVERLAY_VALIGN_BASELINE, "baseline", "baseline"},
- {GST_TEXT_OVERLAY_VALIGN_BOTTOM, "bottom", "bottom"},
- {GST_TEXT_OVERLAY_VALIGN_TOP, "top", "top"},
- {0, NULL, NULL},
- };
-
- if (!text_overlay_valign_type) {
- text_overlay_valign_type =
- g_enum_register_static ("GstTextOverlayVAlign", text_overlay_valign);
- }
- return text_overlay_valign_type;
-}
-
-#define GST_TYPE_TEXT_OVERLAY_HALIGN (gst_text_overlay_halign_get_type())
-static GType
-gst_text_overlay_halign_get_type (void)
-{
- static GType text_overlay_halign_type = 0;
- static const GEnumValue text_overlay_halign[] = {
- {GST_TEXT_OVERLAY_HALIGN_LEFT, "left", "left"},
- {GST_TEXT_OVERLAY_HALIGN_CENTER, "center", "center"},
- {GST_TEXT_OVERLAY_HALIGN_RIGHT, "right", "right"},
- {0, NULL, NULL},
- };
-
- if (!text_overlay_halign_type) {
- text_overlay_halign_type =
- g_enum_register_static ("GstTextOverlayHAlign", text_overlay_halign);
- }
- return text_overlay_halign_type;
-}
-
-
-#define GST_TYPE_TEXT_OVERLAY_WRAP_MODE (gst_text_overlay_wrap_mode_get_type())
-static GType
-gst_text_overlay_wrap_mode_get_type (void)
-{
- static GType text_overlay_wrap_mode_type = 0;
- static const GEnumValue text_overlay_wrap_mode[] = {
- {GST_TEXT_OVERLAY_WRAP_MODE_NONE, "none", "none"},
- {GST_TEXT_OVERLAY_WRAP_MODE_WORD, "word", "word"},
- {GST_TEXT_OVERLAY_WRAP_MODE_CHAR, "char", "char"},
- {GST_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR, "wordchar", "wordchar"},
- {0, NULL, NULL},
- };
-
- if (!text_overlay_wrap_mode_type) {
- text_overlay_wrap_mode_type =
- g_enum_register_static ("GstTextOverlayWrapMode",
- text_overlay_wrap_mode);
- }
- return text_overlay_wrap_mode_type;
-}
-
-#define GST_TYPE_TEXT_OVERLAY_LINE_ALIGN (gst_text_overlay_line_align_get_type())
-static GType
-gst_text_overlay_line_align_get_type (void)
-{
- static GType text_overlay_line_align_type = 0;
- static const GEnumValue text_overlay_line_align[] = {
- {GST_TEXT_OVERLAY_LINE_ALIGN_LEFT, "left", "left"},
- {GST_TEXT_OVERLAY_LINE_ALIGN_CENTER, "center", "center"},
- {GST_TEXT_OVERLAY_LINE_ALIGN_RIGHT, "right", "right"},
- {0, NULL, NULL}
- };
-
- if (!text_overlay_line_align_type) {
- text_overlay_line_align_type =
- g_enum_register_static ("GstTextOverlayLineAlign",
- text_overlay_line_align);
- }
- return text_overlay_line_align_type;
-}
-
-#define GST_TEXT_OVERLAY_GET_COND(ov) (((GstTextOverlay *)ov)->cond)
-#define GST_TEXT_OVERLAY_WAIT(ov) (g_cond_wait (GST_TEXT_OVERLAY_GET_COND (ov), GST_OBJECT_GET_LOCK (ov)))
-#define GST_TEXT_OVERLAY_SIGNAL(ov) (g_cond_signal (GST_TEXT_OVERLAY_GET_COND (ov)))
-#define GST_TEXT_OVERLAY_BROADCAST(ov)(g_cond_broadcast (GST_TEXT_OVERLAY_GET_COND (ov)))
-
-static GstStateChangeReturn gst_text_overlay_change_state (GstElement * element,
- GstStateChange transition);
-
-static GstCaps *gst_text_overlay_getcaps (GstPad * pad);
-static gboolean gst_text_overlay_setcaps (GstPad * pad, GstCaps * caps);
-static gboolean gst_text_overlay_setcaps_txt (GstPad * pad, GstCaps * caps);
-static gboolean gst_text_overlay_src_event (GstPad * pad, GstEvent * event);
-static gboolean gst_text_overlay_src_query (GstPad * pad, GstQuery * query);
-
-static gboolean gst_text_overlay_video_event (GstPad * pad, GstEvent * event);
-static GstFlowReturn gst_text_overlay_video_chain (GstPad * pad,
- GstBuffer * buffer);
-static GstFlowReturn gst_text_overlay_video_bufferalloc (GstPad * pad,
- guint64 offset, guint size, GstCaps * caps, GstBuffer ** buffer);
-
-static gboolean gst_text_overlay_text_event (GstPad * pad, GstEvent * event);
-static GstFlowReturn gst_text_overlay_text_chain (GstPad * pad,
- GstBuffer * buffer);
-static GstPadLinkReturn gst_text_overlay_text_pad_link (GstPad * pad,
- GstPad * peer);
-static void gst_text_overlay_text_pad_unlink (GstPad * pad);
-static void gst_text_overlay_pop_text (GstTextOverlay * overlay);
-static void gst_text_overlay_update_render_mode (GstTextOverlay * overlay);
-
-static void gst_text_overlay_finalize (GObject * object);
-static void gst_text_overlay_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_text_overlay_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_text_overlay_adjust_values_with_fontdesc (GstTextOverlay *
- overlay, PangoFontDescription * desc);
-
-GST_BOILERPLATE (GstTextOverlay, gst_text_overlay, GstElement,
- GST_TYPE_ELEMENT);
-
-static void
-gst_text_overlay_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_template_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&video_sink_template_factory));
-
- /* ugh */
- if (!GST_IS_TIME_OVERLAY_CLASS (g_class) &&
- !GST_IS_CLOCK_OVERLAY_CLASS (g_class)) {
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&text_sink_template_factory));
- }
-
- gst_element_class_set_details_simple (element_class, "Text overlay",
- "Filter/Editor/Video",
- "Adds text strings on top of a video buffer",
- "David Schleef <ds@schleef.org>, " "Zeeshan Ali <zeeshan.ali@nokia.com>");
-}
-
-static gchar *
-gst_text_overlay_get_text (GstTextOverlay * overlay, GstBuffer * video_frame)
-{
- return g_strdup (overlay->default_text);
-}
-
-static void
-gst_text_overlay_class_init (GstTextOverlayClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- PangoFontMap *fontmap;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- gobject_class->finalize = gst_text_overlay_finalize;
- gobject_class->set_property = gst_text_overlay_set_property;
- gobject_class->get_property = gst_text_overlay_get_property;
-
- gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_text_overlay_change_state);
-
- klass->get_text = gst_text_overlay_get_text;
- fontmap = pango_cairo_font_map_get_default ();
- klass->pango_context =
- pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_TEXT,
- g_param_spec_string ("text", "text",
- "Text to be display.", DEFAULT_PROP_TEXT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SHADING,
- g_param_spec_boolean ("shaded-background", "shaded background",
- "Whether to shade the background under the text area",
- DEFAULT_PROP_SHADING, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VALIGNMENT,
- g_param_spec_enum ("valignment", "vertical alignment",
- "Vertical alignment of the text", GST_TYPE_TEXT_OVERLAY_VALIGN,
- DEFAULT_PROP_VALIGNMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HALIGNMENT,
- g_param_spec_enum ("halignment", "horizontal alignment",
- "Horizontal alignment of the text", GST_TYPE_TEXT_OVERLAY_HALIGN,
- DEFAULT_PROP_HALIGNMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VALIGN,
- g_param_spec_string ("valign", "vertical alignment",
- "Vertical alignment of the text (deprecated; use valignment)",
- DEFAULT_PROP_VALIGN, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HALIGN,
- g_param_spec_string ("halign", "horizontal alignment",
- "Horizontal alignment of the text (deprecated; use halignment)",
- DEFAULT_PROP_HALIGN, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_XPAD,
- g_param_spec_int ("xpad", "horizontal paddding",
- "Horizontal paddding when using left/right alignment", 0, G_MAXINT,
- DEFAULT_PROP_XPAD, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_YPAD,
- g_param_spec_int ("ypad", "vertical padding",
- "Vertical padding when using top/bottom alignment", 0, G_MAXINT,
- DEFAULT_PROP_YPAD, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DELTAX,
- g_param_spec_int ("deltax", "X position modifier",
- "Shift X position to the left or to the right. Unit is pixels.",
- G_MININT, G_MAXINT, DEFAULT_PROP_DELTAX,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DELTAY,
- g_param_spec_int ("deltay", "Y position modifier",
- "Shift Y position up or down. Unit is pixels.", G_MININT, G_MAXINT,
- DEFAULT_PROP_DELTAY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_WRAP_MODE,
- g_param_spec_enum ("wrap-mode", "wrap mode",
- "Whether to wrap the text and if so how.",
- GST_TYPE_TEXT_OVERLAY_WRAP_MODE, DEFAULT_PROP_WRAP_MODE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_FONT_DESC,
- g_param_spec_string ("font-desc", "font description",
- "Pango font description of font to be used for rendering. "
- "See documentation of pango_font_description_from_string "
- "for syntax.", DEFAULT_PROP_FONT_DESC,
- G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
- /**
- * GstTextOverlay:line-alignment
- *
- * Alignment of text lines relative to each other (for multi-line text)
- *
- * Since: 0.10.15
- **/
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_LINE_ALIGNMENT,
- g_param_spec_enum ("line-alignment", "line alignment",
- "Alignment of text lines relative to each other.",
- GST_TYPE_TEXT_OVERLAY_LINE_ALIGN, DEFAULT_PROP_LINE_ALIGNMENT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstTextOverlay:silent
- *
- * If set, no text is rendered. Useful to switch off text rendering
- * temporarily without removing the textoverlay element from the pipeline.
- *
- * Since: 0.10.15
- **/
- /* FIXME 0.11: rename to "visible" or "text-visible" or "render-text" */
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SILENT,
- g_param_spec_boolean ("silent", "silent",
- "Whether to render the text string",
- DEFAULT_PROP_SILENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstTextOverlay:wait-text
- *
- * If set, the video will block until a subtitle is received on the text pad.
- * If video and subtitles are sent in sync, like from the same demuxer, this
- * property should be set.
- *
- * Since: 0.10.20
- **/
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_WAIT_TEXT,
- g_param_spec_boolean ("wait-text", "Wait Text",
- "Whether to wait for subtitles",
- DEFAULT_PROP_WAIT_TEXT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (G_OBJECT_CLASS (klass),
- PROP_AUTO_ADJUST_SIZE, g_param_spec_boolean ("auto-resize", "auto resize",
- "Automatically adjust font size to screen-size.",
- DEFAULT_PROP_AUTO_ADJUST_SIZE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VERTICAL_RENDER,
- g_param_spec_boolean ("vertical-render", "vertical render",
- "Vertical Render.", DEFAULT_PROP_VERTICAL_RENDER,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-}
-
-static void
-gst_text_overlay_finalize (GObject * object)
-{
- GstTextOverlay *overlay = GST_TEXT_OVERLAY (object);
-
- g_free (overlay->default_text);
-
- if (overlay->text_image) {
- g_free (overlay->text_image);
- overlay->text_image = NULL;
- }
-
- if (overlay->layout) {
- g_object_unref (overlay->layout);
- overlay->layout = NULL;
- }
-
- if (overlay->text_buffer) {
- gst_buffer_unref (overlay->text_buffer);
- overlay->text_buffer = NULL;
- }
-
- if (overlay->cond) {
- g_cond_free (overlay->cond);
- overlay->cond = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_text_overlay_init (GstTextOverlay * overlay, GstTextOverlayClass * klass)
-{
- GstPadTemplate *template;
- PangoFontDescription *desc;
-
- /* video sink */
- template = gst_static_pad_template_get (&video_sink_template_factory);
- overlay->video_sinkpad = gst_pad_new_from_template (template, "video_sink");
- gst_object_unref (template);
- gst_pad_set_getcaps_function (overlay->video_sinkpad,
- GST_DEBUG_FUNCPTR (gst_text_overlay_getcaps));
- gst_pad_set_setcaps_function (overlay->video_sinkpad,
- GST_DEBUG_FUNCPTR (gst_text_overlay_setcaps));
- gst_pad_set_event_function (overlay->video_sinkpad,
- GST_DEBUG_FUNCPTR (gst_text_overlay_video_event));
- gst_pad_set_chain_function (overlay->video_sinkpad,
- GST_DEBUG_FUNCPTR (gst_text_overlay_video_chain));
- gst_pad_set_bufferalloc_function (overlay->video_sinkpad,
- GST_DEBUG_FUNCPTR (gst_text_overlay_video_bufferalloc));
- gst_element_add_pad (GST_ELEMENT (overlay), overlay->video_sinkpad);
-
- if (!GST_IS_TIME_OVERLAY_CLASS (klass) && !GST_IS_CLOCK_OVERLAY_CLASS (klass)) {
- /* text sink */
- template = gst_static_pad_template_get (&text_sink_template_factory);
- overlay->text_sinkpad = gst_pad_new_from_template (template, "text_sink");
- gst_object_unref (template);
- gst_pad_set_setcaps_function (overlay->text_sinkpad,
- GST_DEBUG_FUNCPTR (gst_text_overlay_setcaps_txt));
- gst_pad_set_event_function (overlay->text_sinkpad,
- GST_DEBUG_FUNCPTR (gst_text_overlay_text_event));
- gst_pad_set_chain_function (overlay->text_sinkpad,
- GST_DEBUG_FUNCPTR (gst_text_overlay_text_chain));
- gst_pad_set_link_function (overlay->text_sinkpad,
- GST_DEBUG_FUNCPTR (gst_text_overlay_text_pad_link));
- gst_pad_set_unlink_function (overlay->text_sinkpad,
- GST_DEBUG_FUNCPTR (gst_text_overlay_text_pad_unlink));
- gst_element_add_pad (GST_ELEMENT (overlay), overlay->text_sinkpad);
- }
-
- /* (video) source */
- template = gst_static_pad_template_get (&src_template_factory);
- overlay->srcpad = gst_pad_new_from_template (template, "src");
- gst_object_unref (template);
- gst_pad_set_getcaps_function (overlay->srcpad,
- GST_DEBUG_FUNCPTR (gst_text_overlay_getcaps));
- gst_pad_set_event_function (overlay->srcpad,
- GST_DEBUG_FUNCPTR (gst_text_overlay_src_event));
- gst_pad_set_query_function (overlay->srcpad,
- GST_DEBUG_FUNCPTR (gst_text_overlay_src_query));
- gst_element_add_pad (GST_ELEMENT (overlay), overlay->srcpad);
-
- overlay->line_align = DEFAULT_PROP_LINE_ALIGNMENT;
- overlay->layout =
- pango_layout_new (GST_TEXT_OVERLAY_GET_CLASS (overlay)->pango_context);
- desc =
- pango_context_get_font_description (GST_TEXT_OVERLAY_GET_CLASS
- (overlay)->pango_context);
- gst_text_overlay_adjust_values_with_fontdesc (overlay, desc);
-
- overlay->halign = DEFAULT_PROP_HALIGNMENT;
- overlay->valign = DEFAULT_PROP_VALIGNMENT;
- overlay->xpad = DEFAULT_PROP_XPAD;
- overlay->ypad = DEFAULT_PROP_YPAD;
- overlay->deltax = DEFAULT_PROP_DELTAX;
- overlay->deltay = DEFAULT_PROP_DELTAY;
-
- overlay->wrap_mode = DEFAULT_PROP_WRAP_MODE;
-
- overlay->want_shading = DEFAULT_PROP_SHADING;
- overlay->shading_value = DEFAULT_SHADING_VALUE;
- overlay->silent = DEFAULT_PROP_SILENT;
- overlay->wait_text = DEFAULT_PROP_WAIT_TEXT;
- overlay->auto_adjust_size = DEFAULT_PROP_AUTO_ADJUST_SIZE;
-
- overlay->default_text = g_strdup (DEFAULT_PROP_TEXT);
- overlay->need_render = TRUE;
- overlay->text_image = NULL;
- overlay->use_vertical_render = DEFAULT_PROP_VERTICAL_RENDER;
- gst_text_overlay_update_render_mode (overlay);
-
- overlay->fps_n = 0;
- overlay->fps_d = 1;
-
- overlay->text_buffer = NULL;
- overlay->text_linked = FALSE;
- overlay->cond = g_cond_new ();
- gst_segment_init (&overlay->segment, GST_FORMAT_TIME);
-}
-
-static void
-gst_text_overlay_update_wrap_mode (GstTextOverlay * overlay)
-{
- if (overlay->wrap_mode == GST_TEXT_OVERLAY_WRAP_MODE_NONE) {
- GST_DEBUG_OBJECT (overlay, "Set wrap mode NONE");
- pango_layout_set_width (overlay->layout, -1);
- } else {
- int width;
-
- if (overlay->auto_adjust_size) {
- width = DEFAULT_SCALE_BASIS * PANGO_SCALE;
- if (overlay->use_vertical_render) {
- width = width * (overlay->height - overlay->ypad * 2) / overlay->width;
- }
- } else {
- width =
- (overlay->use_vertical_render ? overlay->height : overlay->width) *
- PANGO_SCALE;
- }
-
- GST_DEBUG_OBJECT (overlay, "Set layout width %d", overlay->width);
- GST_DEBUG_OBJECT (overlay, "Set wrap mode %d", overlay->wrap_mode);
- pango_layout_set_width (overlay->layout, width);
- pango_layout_set_wrap (overlay->layout, (PangoWrapMode) overlay->wrap_mode);
- }
-}
-
-static void
-gst_text_overlay_update_render_mode (GstTextOverlay * overlay)
-{
- PangoMatrix matrix = PANGO_MATRIX_INIT;
- PangoContext *context = pango_layout_get_context (overlay->layout);
-
- if (overlay->use_vertical_render) {
- pango_matrix_rotate (&matrix, -90);
- pango_context_set_base_gravity (context, PANGO_GRAVITY_AUTO);
- pango_context_set_matrix (context, &matrix);
- pango_layout_set_alignment (overlay->layout, PANGO_ALIGN_LEFT);
- } else {
- pango_context_set_base_gravity (context, PANGO_GRAVITY_SOUTH);
- pango_context_set_matrix (context, &matrix);
- pango_layout_set_alignment (overlay->layout, overlay->line_align);
- }
-}
-
-static gboolean
-gst_text_overlay_setcaps_txt (GstPad * pad, GstCaps * caps)
-{
- GstTextOverlay *overlay;
- GstStructure *structure;
-
- overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
-
- structure = gst_caps_get_structure (caps, 0);
- overlay->have_pango_markup =
- gst_structure_has_name (structure, "text/x-pango-markup");
-
- gst_object_unref (overlay);
-
- return TRUE;
-}
-
-/* FIXME: upstream nego (e.g. when the video window is resized) */
-
-static gboolean
-gst_text_overlay_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstTextOverlay *overlay;
- GstStructure *structure;
- gboolean ret = FALSE;
- const GValue *fps;
-
- if (!GST_PAD_IS_SINK (pad))
- return TRUE;
-
- g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
-
- overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
-
- overlay->width = 0;
- overlay->height = 0;
- structure = gst_caps_get_structure (caps, 0);
- fps = gst_structure_get_value (structure, "framerate");
-
- if (fps
- && gst_video_format_parse_caps (caps, &overlay->format, &overlay->width,
- &overlay->height)) {
- ret = gst_pad_set_caps (overlay->srcpad, caps);
- }
-
- overlay->fps_n = gst_value_get_fraction_numerator (fps);
- overlay->fps_d = gst_value_get_fraction_denominator (fps);
-
- if (ret) {
- GST_OBJECT_LOCK (overlay);
- gst_text_overlay_update_wrap_mode (overlay);
- GST_OBJECT_UNLOCK (overlay);
- }
-
- gst_object_unref (overlay);
-
- return ret;
-}
-
-static void
-gst_text_overlay_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstTextOverlay *overlay = GST_TEXT_OVERLAY (object);
-
- GST_OBJECT_LOCK (overlay);
- switch (prop_id) {
- case PROP_TEXT:
- g_free (overlay->default_text);
- overlay->default_text = g_value_dup_string (value);
- overlay->need_render = TRUE;
- break;
- case PROP_SHADING:
- overlay->want_shading = g_value_get_boolean (value);
- break;
- case PROP_XPAD:
- overlay->xpad = g_value_get_int (value);
- break;
- case PROP_YPAD:
- overlay->ypad = g_value_get_int (value);
- break;
- case PROP_DELTAX:
- overlay->deltax = g_value_get_int (value);
- break;
- case PROP_DELTAY:
- overlay->deltay = g_value_get_int (value);
- break;
- case PROP_HALIGN:{
- const gchar *s = g_value_get_string (value);
-
- if (s && g_ascii_strcasecmp (s, "left") == 0)
- overlay->halign = GST_TEXT_OVERLAY_HALIGN_LEFT;
- else if (s && g_ascii_strcasecmp (s, "center") == 0)
- overlay->halign = GST_TEXT_OVERLAY_HALIGN_CENTER;
- else if (s && g_ascii_strcasecmp (s, "right") == 0)
- overlay->halign = GST_TEXT_OVERLAY_HALIGN_RIGHT;
- else
- g_warning ("Invalid value '%s' for textoverlay property 'halign'",
- GST_STR_NULL (s));
- break;
- }
- case PROP_VALIGN:{
- const gchar *s = g_value_get_string (value);
-
- if (s && g_ascii_strcasecmp (s, "baseline") == 0)
- overlay->valign = GST_TEXT_OVERLAY_VALIGN_BASELINE;
- else if (s && g_ascii_strcasecmp (s, "bottom") == 0)
- overlay->valign = GST_TEXT_OVERLAY_VALIGN_BOTTOM;
- else if (s && g_ascii_strcasecmp (s, "top") == 0)
- overlay->valign = GST_TEXT_OVERLAY_VALIGN_TOP;
- else
- g_warning ("Invalid value '%s' for textoverlay property 'valign'",
- GST_STR_NULL (s));
- break;
- }
- case PROP_VALIGNMENT:
- overlay->valign = g_value_get_enum (value);
- break;
- case PROP_HALIGNMENT:
- overlay->halign = g_value_get_enum (value);
- break;
- case PROP_WRAP_MODE:
- overlay->wrap_mode = g_value_get_enum (value);
- gst_text_overlay_update_wrap_mode (overlay);
- break;
- case PROP_FONT_DESC:
- {
- PangoFontDescription *desc;
- const gchar *fontdesc_str;
-
- fontdesc_str = g_value_get_string (value);
- desc = pango_font_description_from_string (fontdesc_str);
- if (desc) {
- GST_LOG_OBJECT (overlay, "font description set: %s", fontdesc_str);
- pango_layout_set_font_description (overlay->layout, desc);
- gst_text_overlay_adjust_values_with_fontdesc (overlay, desc);
- pango_font_description_free (desc);
- } else {
- GST_WARNING_OBJECT (overlay, "font description parse failed: %s",
- fontdesc_str);
- }
- break;
- }
- case PROP_SILENT:
- overlay->silent = g_value_get_boolean (value);
- break;
- case PROP_LINE_ALIGNMENT:
- overlay->line_align = g_value_get_enum (value);
- pango_layout_set_alignment (overlay->layout,
- (PangoAlignment) overlay->line_align);
- break;
- case PROP_WAIT_TEXT:
- overlay->wait_text = g_value_get_boolean (value);
- break;
- case PROP_AUTO_ADJUST_SIZE:
- {
- overlay->auto_adjust_size = g_value_get_boolean (value);
- overlay->need_render = TRUE;
- }
- case PROP_VERTICAL_RENDER:
- overlay->use_vertical_render = g_value_get_boolean (value);
- gst_text_overlay_update_render_mode (overlay);
- overlay->need_render = TRUE;
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-
- overlay->need_render = TRUE;
- GST_OBJECT_UNLOCK (overlay);
-}
-
-static void
-gst_text_overlay_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstTextOverlay *overlay = GST_TEXT_OVERLAY (object);
-
- GST_OBJECT_LOCK (overlay);
- switch (prop_id) {
- case PROP_TEXT:
- g_value_set_string (value, overlay->default_text);
- break;
- case PROP_SHADING:
- g_value_set_boolean (value, overlay->want_shading);
- break;
- case PROP_XPAD:
- g_value_set_int (value, overlay->xpad);
- break;
- case PROP_YPAD:
- g_value_set_int (value, overlay->ypad);
- break;
- case PROP_DELTAX:
- g_value_set_int (value, overlay->deltax);
- break;
- case PROP_DELTAY:
- g_value_set_int (value, overlay->deltay);
- break;
- case PROP_VALIGNMENT:
- g_value_set_enum (value, overlay->valign);
- break;
- case PROP_HALIGNMENT:
- g_value_set_enum (value, overlay->halign);
- break;
- case PROP_WRAP_MODE:
- g_value_set_enum (value, overlay->wrap_mode);
- break;
- case PROP_SILENT:
- g_value_set_boolean (value, overlay->silent);
- break;
- case PROP_LINE_ALIGNMENT:
- g_value_set_enum (value, overlay->line_align);
- break;
- case PROP_WAIT_TEXT:
- g_value_set_boolean (value, overlay->wait_text);
- break;
- case PROP_AUTO_ADJUST_SIZE:
- g_value_set_boolean (value, overlay->auto_adjust_size);
- break;
- case PROP_VERTICAL_RENDER:
- g_value_set_boolean (value, overlay->use_vertical_render);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-
- overlay->need_render = TRUE;
- GST_OBJECT_UNLOCK (overlay);
-}
-
-static gboolean
-gst_text_overlay_src_query (GstPad * pad, GstQuery * query)
-{
- gboolean ret = FALSE;
- GstTextOverlay *overlay = NULL;
-
- overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
-
- ret = gst_pad_peer_query (overlay->video_sinkpad, query);
-
- gst_object_unref (overlay);
-
- return ret;
-}
-
-static gboolean
-gst_text_overlay_src_event (GstPad * pad, GstEvent * event)
-{
- gboolean ret = FALSE;
- GstTextOverlay *overlay = NULL;
-
- overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:{
- GstSeekFlags flags;
-
- /* We don't handle seek if we have not text pad */
- if (!overlay->text_linked) {
- GST_DEBUG_OBJECT (overlay, "seek received, pushing upstream");
- ret = gst_pad_push_event (overlay->video_sinkpad, event);
- goto beach;
- }
-
- GST_DEBUG_OBJECT (overlay, "seek received, driving from here");
-
- gst_event_parse_seek (event, NULL, NULL, &flags, NULL, NULL, NULL, NULL);
-
- /* Flush downstream, only for flushing seek */
- if (flags & GST_SEEK_FLAG_FLUSH)
- gst_pad_push_event (overlay->srcpad, gst_event_new_flush_start ());
-
- /* Mark ourself as flushing, unblock chains */
- GST_OBJECT_LOCK (overlay);
- overlay->video_flushing = TRUE;
- overlay->text_flushing = TRUE;
- gst_text_overlay_pop_text (overlay);
- GST_OBJECT_UNLOCK (overlay);
-
- /* Seek on each sink pad */
- gst_event_ref (event);
- ret = gst_pad_push_event (overlay->video_sinkpad, event);
- if (ret) {
- ret = gst_pad_push_event (overlay->text_sinkpad, event);
- } else {
- gst_event_unref (event);
- }
- break;
- }
- default:
- if (overlay->text_linked) {
- gst_event_ref (event);
- ret = gst_pad_push_event (overlay->video_sinkpad, event);
- gst_pad_push_event (overlay->text_sinkpad, event);
- } else {
- ret = gst_pad_push_event (overlay->video_sinkpad, event);
- }
- break;
- }
-
-beach:
- gst_object_unref (overlay);
-
- return ret;
-}
-
-static GstCaps *
-gst_text_overlay_getcaps (GstPad * pad)
-{
- GstTextOverlay *overlay;
- GstPad *otherpad;
- GstCaps *caps;
-
- overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
-
- if (pad == overlay->srcpad)
- otherpad = overlay->video_sinkpad;
- else
- otherpad = overlay->srcpad;
-
- /* we can do what the peer can */
- caps = gst_pad_peer_get_caps (otherpad);
- if (caps) {
- GstCaps *temp;
- const GstCaps *templ;
-
- GST_DEBUG_OBJECT (pad, "peer caps %" GST_PTR_FORMAT, caps);
-
- /* filtered against our padtemplate */
- templ = gst_pad_get_pad_template_caps (otherpad);
- GST_DEBUG_OBJECT (pad, "our template %" GST_PTR_FORMAT, templ);
- temp = gst_caps_intersect (caps, templ);
- GST_DEBUG_OBJECT (pad, "intersected %" GST_PTR_FORMAT, temp);
- gst_caps_unref (caps);
- /* this is what we can do */
- caps = temp;
- } else {
- /* no peer, our padtemplate is enough then */
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
- }
-
- GST_DEBUG_OBJECT (overlay, "returning %" GST_PTR_FORMAT, caps);
-
- gst_object_unref (overlay);
-
- return caps;
-}
-
-static void
-gst_text_overlay_adjust_values_with_fontdesc (GstTextOverlay * overlay,
- PangoFontDescription * desc)
-{
- gint font_size = pango_font_description_get_size (desc) / PANGO_SCALE;
- overlay->shadow_offset = (double) (font_size) / 13.0;
- overlay->outline_offset = (double) (font_size) / 15.0;
- if (overlay->outline_offset < MINIMUM_OUTLINE_OFFSET)
- overlay->outline_offset = MINIMUM_OUTLINE_OFFSET;
-}
-
-#define CAIRO_UNPREMULTIPLY(a,r,g,b) G_STMT_START { \
- b = (a > 0) ? MIN ((b * 255 + a / 2) / a, 255) : 0; \
- g = (a > 0) ? MIN ((g * 255 + a / 2) / a, 255) : 0; \
- r = (a > 0) ? MIN ((r * 255 + a / 2) / a, 255) : 0; \
-} G_STMT_END
-
-static inline void
-gst_text_overlay_blit_1 (GstTextOverlay * overlay, guchar * dest, gint xpos,
- gint ypos, guchar * text_image, guint dest_stride)
-{
- gint i, j = 0;
- gint x, y;
- guchar r, g, b, a;
- guchar *pimage;
- guchar *py;
- gint width = overlay->image_width;
- gint height = overlay->image_height;
-
- if (xpos < 0) {
- xpos = 0;
- }
-
- if (xpos + width > overlay->width) {
- width = overlay->width - xpos;
- }
-
- if (ypos + height > overlay->height) {
- height = overlay->height - ypos;
- }
-
- dest += (ypos / 1) * dest_stride;
-
- for (i = 0; i < height; i++) {
- pimage = text_image + 4 * (i * overlay->image_width);
- py = dest + i * dest_stride + xpos;
- for (j = 0; j < width; j++) {
- b = pimage[CAIRO_ARGB_B];
- g = pimage[CAIRO_ARGB_G];
- r = pimage[CAIRO_ARGB_R];
- a = pimage[CAIRO_ARGB_A];
- CAIRO_UNPREMULTIPLY (a, r, g, b);
-
- pimage += 4;
- if (a == 0) {
- py++;
- continue;
- }
- COMP_Y (y, r, g, b);
- x = *py;
- BLEND (*py++, a, y, x);
- }
- }
-}
-
-static inline void
-gst_text_overlay_blit_sub2x2cbcr (GstTextOverlay * overlay,
- guchar * destcb, guchar * destcr, gint xpos, gint ypos, guchar * text_image,
- guint destcb_stride, guint destcr_stride)
-{
- gint i, j;
- gint x, cb, cr;
- gushort r, g, b, a;
- gushort r1, g1, b1, a1;
- guchar *pimage1, *pimage2;
- guchar *pcb, *pcr;
- gint width = overlay->image_width - 2;
- gint height = overlay->image_height - 2;
-
- if (xpos < 0) {
- xpos = 0;
- }
-
- if (xpos + width > overlay->width) {
- width = overlay->width - xpos;
- }
-
- if (ypos + height > overlay->height) {
- height = overlay->height - ypos;
- }
-
- destcb += (ypos / 2) * destcb_stride;
- destcr += (ypos / 2) * destcr_stride;
-
- for (i = 0; i < height; i += 2) {
- pimage1 = text_image + 4 * (i * overlay->image_width);
- pimage2 = pimage1 + 4 * overlay->image_width;
- pcb = destcb + (i / 2) * destcb_stride + xpos / 2;
- pcr = destcr + (i / 2) * destcr_stride + xpos / 2;
- for (j = 0; j < width; j += 2) {
- b = pimage1[CAIRO_ARGB_B];
- g = pimage1[CAIRO_ARGB_G];
- r = pimage1[CAIRO_ARGB_R];
- a = pimage1[CAIRO_ARGB_A];
- CAIRO_UNPREMULTIPLY (a, r, g, b);
- pimage1 += 4;
-
- b1 = pimage1[CAIRO_ARGB_B];
- g1 = pimage1[CAIRO_ARGB_G];
- r1 = pimage1[CAIRO_ARGB_R];
- a1 = pimage1[CAIRO_ARGB_A];
- CAIRO_UNPREMULTIPLY (a1, r1, g1, b1);
- b += b1;
- g += g1;
- r += r1;
- a += a1;
- pimage1 += 4;
-
- b1 = pimage2[CAIRO_ARGB_B];
- g1 = pimage2[CAIRO_ARGB_G];
- r1 = pimage2[CAIRO_ARGB_R];
- a1 = pimage2[CAIRO_ARGB_A];
- CAIRO_UNPREMULTIPLY (a1, r1, g1, b1);
- b += b1;
- g += g1;
- r += r1;
- a += a1;
- pimage2 += 4;
-
- /* + 2 for rounding */
- b1 = pimage2[CAIRO_ARGB_B];
- g1 = pimage2[CAIRO_ARGB_G];
- r1 = pimage2[CAIRO_ARGB_R];
- a1 = pimage2[CAIRO_ARGB_A];
- CAIRO_UNPREMULTIPLY (a1, r1, g1, b1);
- b += b1 + 2;
- g += g1 + 2;
- r += r1 + 2;
- a += a1 + 2;
- pimage2 += 4;
-
- b /= 4;
- g /= 4;
- r /= 4;
- a /= 4;
-
- if (a == 0) {
- pcb++;
- pcr++;
- continue;
- }
- COMP_U (cb, r, g, b);
- COMP_V (cr, r, g, b);
-
- x = *pcb;
- BLEND (*pcb++, a, cb, x);
- x = *pcr;
- BLEND (*pcr++, a, cr, x);
- }
- }
-}
-
-static void
-gst_text_overlay_render_pangocairo (GstTextOverlay * overlay,
- const gchar * string, gint textlen)
-{
- cairo_t *cr;
- cairo_surface_t *surface;
- PangoRectangle ink_rect, logical_rect;
- cairo_matrix_t cairo_matrix;
- int width, height;
- double scalef = 1.0;
-
- if (overlay->auto_adjust_size) {
- /* 640 pixel is default */
- scalef = (double) (overlay->width) / DEFAULT_SCALE_BASIS;
- }
- pango_layout_set_width (overlay->layout, -1);
- /* set text on pango layout */
- pango_layout_set_markup (overlay->layout, string, textlen);
-
- /* get subtitle image size */
- pango_layout_get_pixel_extents (overlay->layout, &ink_rect, &logical_rect);
-
- width = (logical_rect.width + overlay->shadow_offset) * scalef;
-
- if (width + overlay->deltax >
- (overlay->use_vertical_render ? overlay->height : overlay->width)) {
- /*
- * subtitle image width is larger then overlay width
- * so rearrange overlay wrap mode.
- */
- gst_text_overlay_update_wrap_mode (overlay);
- pango_layout_get_pixel_extents (overlay->layout, &ink_rect, &logical_rect);
- width = overlay->width;
- }
-
- height =
- (logical_rect.height + logical_rect.y + overlay->shadow_offset) * scalef;
- if (height > overlay->height) {
- height = overlay->height;
- }
- if (overlay->use_vertical_render) {
- PangoRectangle rect;
- PangoContext *context;
- PangoMatrix matrix = PANGO_MATRIX_INIT;
- int tmp;
-
- context = pango_layout_get_context (overlay->layout);
-
- pango_matrix_rotate (&matrix, -90);
-
- rect.x = rect.y = 0;
- rect.width = width;
- rect.height = height;
- pango_matrix_transform_pixel_rectangle (&matrix, &rect);
- matrix.x0 = -rect.x;
- matrix.y0 = -rect.y;
-
- pango_context_set_matrix (context, &matrix);
-
- cairo_matrix.xx = matrix.xx;
- cairo_matrix.yx = matrix.yx;
- cairo_matrix.xy = matrix.xy;
- cairo_matrix.yy = matrix.yy;
- cairo_matrix.x0 = matrix.x0;
- cairo_matrix.y0 = matrix.y0;
- cairo_matrix_scale (&cairo_matrix, scalef, scalef);
-
- tmp = height;
- height = width;
- width = tmp;
- } else {
- cairo_matrix_init_scale (&cairo_matrix, scalef, scalef);
- }
-
- /* reallocate surface */
- overlay->text_image = g_realloc (overlay->text_image, 4 * width * height);
-
- surface = cairo_image_surface_create_for_data (overlay->text_image,
- CAIRO_FORMAT_ARGB32, width, height, width * 4);
- cr = cairo_create (surface);
-
- /* clear surface */
- cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
- cairo_paint (cr);
-
- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
-
- if (overlay->want_shading)
- cairo_paint_with_alpha (cr, overlay->shading_value);
-
- /* apply transformations */
- cairo_set_matrix (cr, &cairo_matrix);
-
- /* FIXME: We use show_layout everywhere except for the surface
- * because it's really faster and internally does all kinds of
- * caching. Unfortunately we have to paint to a cairo path for
- * the outline and this is slow. Once Pango supports user fonts
- * we should use them, see
- * https://bugzilla.gnome.org/show_bug.cgi?id=598695
- *
- * Idea would the be, to create a cairo user font that
- * does shadow, outline, text painting in the
- * render_glyph function.
- */
-
- /* draw shadow text */
- cairo_save (cr);
- cairo_translate (cr, overlay->shadow_offset, overlay->shadow_offset);
- cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.5);
- pango_cairo_show_layout (cr, overlay->layout);
- cairo_restore (cr);
-
- /* draw outline text */
- cairo_save (cr);
- cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
- cairo_set_line_width (cr, overlay->outline_offset);
- pango_cairo_layout_path (cr, overlay->layout);
- cairo_stroke (cr);
- cairo_restore (cr);
-
- /* draw text */
- cairo_save (cr);
- cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
- pango_cairo_show_layout (cr, overlay->layout);
- cairo_restore (cr);
-
- cairo_destroy (cr);
- cairo_surface_destroy (surface);
- overlay->image_width = width;
- overlay->image_height = height;
- overlay->baseline_y = ink_rect.y;
-}
-
-#define BOX_XPAD 6
-#define BOX_YPAD 6
-
-static inline void
-gst_text_overlay_shade_I420_y (GstTextOverlay * overlay, guchar * dest,
- gint x0, gint x1, gint y0, gint y1)
-{
- gint i, j, dest_stride;
-
- dest_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 0,
- overlay->width);
-
- x0 = CLAMP (x0 - BOX_XPAD, 0, overlay->width);
- x1 = CLAMP (x1 + BOX_XPAD, 0, overlay->width);
-
- y0 = CLAMP (y0 - BOX_YPAD, 0, overlay->height);
- y1 = CLAMP (y1 + BOX_YPAD, 0, overlay->height);
-
- for (i = y0; i < y1; ++i) {
- for (j = x0; j < x1; ++j) {
- gint y = dest[(i * dest_stride) + j] + overlay->shading_value;
-
- dest[(i * dest_stride) + j] = CLAMP (y, 0, 255);
- }
- }
-}
-
-static inline void
-gst_text_overlay_shade_UYVY_y (GstTextOverlay * overlay, guchar * dest,
- gint x0, gint x1, gint y0, gint y1)
-{
- gint i, j;
- guint dest_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_UYVY, 0,
- overlay->width);
-
- x0 = CLAMP (x0 - BOX_XPAD, 0, overlay->width);
- x1 = CLAMP (x1 + BOX_XPAD, 0, overlay->width);
-
- y0 = CLAMP (y0 - BOX_YPAD, 0, overlay->height);
- y1 = CLAMP (y1 + BOX_YPAD, 0, overlay->height);
-
- for (i = y0; i < y1; i++) {
- for (j = x0; j < x1; j++) {
- gint y;
- gint y_pos;
-
- y_pos = (i * dest_stride) + j * 2 + 1;
- y = dest[y_pos] + overlay->shading_value;
-
- dest[y_pos] = CLAMP (y, 0, 255);
- }
- }
-}
-
-#define gst_text_overlay_shade_BGRx gst_text_overlay_shade_xRGB
-static inline void
-gst_text_overlay_shade_xRGB (GstTextOverlay * overlay, guchar * dest,
- gint x0, gint x1, gint y0, gint y1)
-{
- gint i, j;
-
- x0 = CLAMP (x0 - BOX_XPAD, 0, overlay->width);
- x1 = CLAMP (x1 + BOX_XPAD, 0, overlay->width);
-
- y0 = CLAMP (y0 - BOX_YPAD, 0, overlay->height);
- y1 = CLAMP (y1 + BOX_YPAD, 0, overlay->height);
-
- for (i = y0; i < y1; i++) {
- for (j = x0; j < x1; j++) {
- gint y, y_pos, k;
-
- y_pos = (i * 4 * overlay->width) + j * 4;
- for (k = 0; k < 4; k++) {
- y = dest[y_pos + k] + overlay->shading_value;
- dest[y_pos + k] = CLAMP (y, 0, 255);
- }
- }
- }
-}
-
-/* FIXME:
- * - use proper strides and offset for I420
- * - don't draw over the edge of the picture (try a longer
- * text with a huge font size)
- */
-
-static inline void
-gst_text_overlay_blit_I420 (GstTextOverlay * overlay,
- guint8 * yuv_pixels, gint xpos, gint ypos)
-{
- int y_stride, u_stride, v_stride;
- int u_offset, v_offset;
- int h, w;
-
- w = overlay->width;
- h = overlay->height;
-
- y_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 0, w);
- u_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 1, w);
- v_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 2, w);
- u_offset =
- gst_video_format_get_component_offset (GST_VIDEO_FORMAT_I420, 1, w, h);
- v_offset =
- gst_video_format_get_component_offset (GST_VIDEO_FORMAT_I420, 2, w, h);
-
- gst_text_overlay_blit_1 (overlay, yuv_pixels, xpos, ypos, overlay->text_image,
- y_stride);
- gst_text_overlay_blit_sub2x2cbcr (overlay, yuv_pixels + u_offset,
- yuv_pixels + v_offset, xpos, ypos, overlay->text_image, u_stride,
- v_stride);
-}
-
-static inline void
-gst_text_overlay_blit_UYVY (GstTextOverlay * overlay,
- guint8 * yuv_pixels, gint xpos, gint ypos)
-{
- int a0, r0, g0, b0;
- int a1, r1, g1, b1;
- int y0, y1, u, v;
- int i, j;
- int h, w;
- guchar *pimage, *dest;
-
- w = overlay->image_width - 2;
- h = overlay->image_height - 2;
-
- if (xpos < 0) {
- xpos = 0;
- }
-
- if (xpos + w > overlay->width) {
- w = overlay->width - xpos;
- }
-
- if (ypos + h > overlay->height) {
- h = overlay->height - ypos;
- }
-
- for (i = 0; i < h; i++) {
- pimage = overlay->text_image + i * overlay->image_width * 4;
- dest = yuv_pixels + (i + ypos) * overlay->width * 2 + xpos * 2;
- for (j = 0; j < w; j += 2) {
- b0 = pimage[CAIRO_ARGB_B];
- g0 = pimage[CAIRO_ARGB_G];
- r0 = pimage[CAIRO_ARGB_R];
- a0 = pimage[CAIRO_ARGB_A];
- CAIRO_UNPREMULTIPLY (a0, r0, g0, b0);
- pimage += 4;
-
- b1 = pimage[CAIRO_ARGB_B];
- g1 = pimage[CAIRO_ARGB_G];
- r1 = pimage[CAIRO_ARGB_R];
- a1 = pimage[CAIRO_ARGB_A];
- CAIRO_UNPREMULTIPLY (a1, r1, g1, b1);
- pimage += 4;
-
- a0 += a1 + 2;
- a0 /= 2;
- if (a0 == 0) {
- dest += 4;
- continue;
- }
-
- COMP_Y (y0, r0, g0, b0);
- COMP_Y (y1, r1, g1, b1);
-
- b0 += b1 + 2;
- g0 += g1 + 2;
- r0 += r1 + 2;
-
- b0 /= 2;
- g0 /= 2;
- r0 /= 2;
-
- COMP_U (u, r0, g0, b0);
- COMP_V (v, r0, g0, b0);
-
- BLEND (*dest, a0, u, *dest);
- dest++;
- BLEND (*dest, a0, y0, *dest);
- dest++;
- BLEND (*dest, a0, v, *dest);
- dest++;
- BLEND (*dest, a0, y1, *dest);
- dest++;
- }
- }
-}
-
-#define xRGB_BLIT_FUNCTION(name, R, G, B) \
-static inline void \
-gst_text_overlay_blit_##name (GstTextOverlay * overlay, \
- guint8 * rgb_pixels, gint xpos, gint ypos) \
-{ \
- int a, r, g, b; \
- int i, j; \
- int h, w; \
- guchar *pimage, *dest; \
- \
- w = overlay->image_width; \
- h = overlay->image_height; \
- \
- if (xpos < 0) { \
- xpos = 0; \
- } \
- \
- if (xpos + w > overlay->width) { \
- w = overlay->width - xpos; \
- } \
- \
- if (ypos + h > overlay->height) { \
- h = overlay->height - ypos; \
- } \
- \
- for (i = 0; i < h; i++) { \
- pimage = overlay->text_image + i * overlay->image_width * 4; \
- dest = rgb_pixels + (i + ypos) * 4 * overlay->width + xpos * 4; \
- for (j = 0; j < w; j++) { \
- a = pimage[CAIRO_ARGB_A]; \
- b = pimage[CAIRO_ARGB_B]; \
- g = pimage[CAIRO_ARGB_G]; \
- r = pimage[CAIRO_ARGB_R]; \
- CAIRO_UNPREMULTIPLY (a, r, g, b); \
- b = (b*a + dest[B] * (255-a)) / 255; \
- g = (g*a + dest[G] * (255-a)) / 255; \
- r = (r*a + dest[R] * (255-a)) / 255; \
- \
- dest[B] = b; \
- dest[G] = g; \
- dest[R] = r; \
- pimage += 4; \
- dest += 4; \
- } \
- } \
-}
-xRGB_BLIT_FUNCTION (xRGB, 1, 2, 3);
-xRGB_BLIT_FUNCTION (BGRx, 2, 1, 0);
-
-static void
-gst_text_overlay_render_text (GstTextOverlay * overlay,
- const gchar * text, gint textlen)
-{
- gchar *string;
-
- if (!overlay->need_render) {
- GST_DEBUG ("Using previously rendered text.");
- return;
- }
-
- /* -1 is the whole string */
- if (text != NULL && textlen < 0) {
- textlen = strlen (text);
- }
-
- if (text != NULL) {
- string = g_strndup (text, textlen);
- } else { /* empty string */
- string = g_strdup (" ");
- }
- g_strdelimit (string, "\r\t", ' ');
- textlen = strlen (string);
-
- /* FIXME: should we check for UTF-8 here? */
-
- GST_DEBUG ("Rendering '%s'", string);
- gst_text_overlay_render_pangocairo (overlay, string, textlen);
-
- g_free (string);
-
- overlay->need_render = FALSE;
-}
-
-static GstFlowReturn
-gst_text_overlay_push_frame (GstTextOverlay * overlay, GstBuffer * video_frame)
-{
- gint xpos, ypos;
- gint width, height;
- GstTextOverlayVAlign valign;
- GstTextOverlayHAlign halign;
-
- width = overlay->image_width;
- height = overlay->image_height;
-
- video_frame = gst_buffer_make_writable (video_frame);
-
- if (overlay->use_vertical_render)
- halign = GST_TEXT_OVERLAY_HALIGN_RIGHT;
- else
- halign = overlay->halign;
-
- switch (halign) {
- case GST_TEXT_OVERLAY_HALIGN_LEFT:
- xpos = overlay->xpad;
- break;
- case GST_TEXT_OVERLAY_HALIGN_CENTER:
- xpos = (overlay->width - width) / 2;
- break;
- case GST_TEXT_OVERLAY_HALIGN_RIGHT:
- xpos = overlay->width - width - overlay->xpad;
- break;
- default:
- xpos = 0;
- }
- xpos += overlay->deltax;
-
- if (overlay->use_vertical_render)
- valign = GST_TEXT_OVERLAY_VALIGN_TOP;
- else
- valign = overlay->valign;
-
- switch (valign) {
- case GST_TEXT_OVERLAY_VALIGN_BOTTOM:
- ypos = overlay->height - height - overlay->ypad;
- break;
- case GST_TEXT_OVERLAY_VALIGN_BASELINE:
- ypos = overlay->height - (height + overlay->ypad);
- break;
- case GST_TEXT_OVERLAY_VALIGN_TOP:
- ypos = overlay->ypad;
- break;
- default:
- ypos = overlay->ypad;
- break;
- }
- ypos += overlay->deltay;
-
- /* shaded background box */
- if (overlay->want_shading) {
- switch (overlay->format) {
- case GST_VIDEO_FORMAT_I420:
- gst_text_overlay_shade_I420_y (overlay,
- GST_BUFFER_DATA (video_frame), xpos, xpos + overlay->image_width,
- ypos, ypos + overlay->image_height);
- break;
- case GST_VIDEO_FORMAT_UYVY:
- gst_text_overlay_shade_UYVY_y (overlay,
- GST_BUFFER_DATA (video_frame), xpos, xpos + overlay->image_width,
- ypos, ypos + overlay->image_height);
- break;
- case GST_VIDEO_FORMAT_xRGB:
- gst_text_overlay_shade_xRGB (overlay,
- GST_BUFFER_DATA (video_frame), xpos, xpos + overlay->image_width,
- ypos, ypos + overlay->image_height);
- break;
- case GST_VIDEO_FORMAT_BGRx:
- gst_text_overlay_shade_BGRx (overlay,
- GST_BUFFER_DATA (video_frame), xpos, xpos + overlay->image_width,
- ypos, ypos + overlay->image_height);
- break;
- default:
- g_assert_not_reached ();
- }
- }
-
- if (ypos < 0)
- ypos = 0;
-
- if (overlay->text_image) {
- switch (overlay->format) {
- case GST_VIDEO_FORMAT_I420:
- gst_text_overlay_blit_I420 (overlay,
- GST_BUFFER_DATA (video_frame), xpos, ypos);
- break;
- case GST_VIDEO_FORMAT_UYVY:
- gst_text_overlay_blit_UYVY (overlay,
- GST_BUFFER_DATA (video_frame), xpos, ypos);
- break;
- case GST_VIDEO_FORMAT_BGRx:
- gst_text_overlay_blit_BGRx (overlay,
- GST_BUFFER_DATA (video_frame), xpos, ypos);
- break;
- case GST_VIDEO_FORMAT_xRGB:
- gst_text_overlay_blit_xRGB (overlay,
- GST_BUFFER_DATA (video_frame), xpos, ypos);
- break;
- default:
- g_assert_not_reached ();
- }
- }
- return gst_pad_push (overlay->srcpad, video_frame);
-}
-
-static GstPadLinkReturn
-gst_text_overlay_text_pad_link (GstPad * pad, GstPad * peer)
-{
- GstTextOverlay *overlay;
-
- overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
-
- GST_DEBUG_OBJECT (overlay, "Text pad linked");
-
- overlay->text_linked = TRUE;
-
- gst_object_unref (overlay);
-
- return GST_PAD_LINK_OK;
-}
-
-static void
-gst_text_overlay_text_pad_unlink (GstPad * pad)
-{
- GstTextOverlay *overlay;
-
- /* don't use gst_pad_get_parent() here, will deadlock */
- overlay = GST_TEXT_OVERLAY (GST_PAD_PARENT (pad));
-
- GST_DEBUG_OBJECT (overlay, "Text pad unlinked");
-
- overlay->text_linked = FALSE;
-
- gst_segment_init (&overlay->text_segment, GST_FORMAT_UNDEFINED);
-}
-
-static gboolean
-gst_text_overlay_text_event (GstPad * pad, GstEvent * event)
-{
- gboolean ret = FALSE;
- GstTextOverlay *overlay = NULL;
-
- overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
-
- GST_LOG_OBJECT (pad, "received event %s", GST_EVENT_TYPE_NAME (event));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:{
- GstFormat fmt;
- gboolean update;
- gdouble rate, applied_rate;
- gint64 cur, stop, time;
-
- overlay->text_eos = FALSE;
-
- gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
- &fmt, &cur, &stop, &time);
-
- if (fmt == GST_FORMAT_TIME) {
- GST_OBJECT_LOCK (overlay);
- gst_segment_set_newsegment_full (&overlay->text_segment, update, rate,
- applied_rate, GST_FORMAT_TIME, cur, stop, time);
- GST_DEBUG_OBJECT (overlay, "TEXT SEGMENT now: %" GST_SEGMENT_FORMAT,
- &overlay->text_segment);
- GST_OBJECT_UNLOCK (overlay);
- } else {
- GST_ELEMENT_WARNING (overlay, STREAM, MUX, (NULL),
- ("received non-TIME newsegment event on text input"));
- }
-
- gst_event_unref (event);
- ret = TRUE;
-
- /* wake up the video chain, it might be waiting for a text buffer or
- * a text segment update */
- GST_OBJECT_LOCK (overlay);
- GST_TEXT_OVERLAY_BROADCAST (overlay);
- GST_OBJECT_UNLOCK (overlay);
- break;
- }
- case GST_EVENT_FLUSH_STOP:
- GST_OBJECT_LOCK (overlay);
- GST_INFO_OBJECT (overlay, "text flush stop");
- overlay->text_flushing = FALSE;
- overlay->text_eos = FALSE;
- gst_text_overlay_pop_text (overlay);
- gst_segment_init (&overlay->text_segment, GST_FORMAT_TIME);
- GST_OBJECT_UNLOCK (overlay);
- gst_event_unref (event);
- ret = TRUE;
- break;
- case GST_EVENT_FLUSH_START:
- GST_OBJECT_LOCK (overlay);
- GST_INFO_OBJECT (overlay, "text flush start");
- overlay->text_flushing = TRUE;
- GST_TEXT_OVERLAY_BROADCAST (overlay);
- GST_OBJECT_UNLOCK (overlay);
- gst_event_unref (event);
- ret = TRUE;
- break;
- case GST_EVENT_EOS:
- GST_OBJECT_LOCK (overlay);
- overlay->text_eos = TRUE;
- GST_INFO_OBJECT (overlay, "text EOS");
- /* wake up the video chain, it might be waiting for a text buffer or
- * a text segment update */
- GST_TEXT_OVERLAY_BROADCAST (overlay);
- GST_OBJECT_UNLOCK (overlay);
- gst_event_unref (event);
- ret = TRUE;
- break;
- default:
- ret = gst_pad_event_default (pad, event);
- break;
- }
-
- gst_object_unref (overlay);
-
- return ret;
-}
-
-static gboolean
-gst_text_overlay_video_event (GstPad * pad, GstEvent * event)
-{
- gboolean ret = FALSE;
- GstTextOverlay *overlay = NULL;
-
- overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
-
- GST_DEBUG_OBJECT (pad, "received event %s", GST_EVENT_TYPE_NAME (event));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:
- {
- GstFormat format;
- gdouble rate;
- gint64 start, stop, time;
- gboolean update;
-
- GST_DEBUG_OBJECT (overlay, "received new segment");
-
- gst_event_parse_new_segment (event, &update, &rate, &format, &start,
- &stop, &time);
-
- if (format == GST_FORMAT_TIME) {
- GST_DEBUG_OBJECT (overlay, "VIDEO SEGMENT now: %" GST_SEGMENT_FORMAT,
- &overlay->segment);
-
- gst_segment_set_newsegment (&overlay->segment, update, rate, format,
- start, stop, time);
- } else {
- GST_ELEMENT_WARNING (overlay, STREAM, MUX, (NULL),
- ("received non-TIME newsegment event on video input"));
- }
-
- ret = gst_pad_event_default (pad, event);
- break;
- }
- case GST_EVENT_EOS:
- GST_OBJECT_LOCK (overlay);
- GST_INFO_OBJECT (overlay, "video EOS");
- overlay->video_eos = TRUE;
- GST_OBJECT_UNLOCK (overlay);
- ret = gst_pad_event_default (pad, event);
- break;
- case GST_EVENT_FLUSH_START:
- GST_OBJECT_LOCK (overlay);
- GST_INFO_OBJECT (overlay, "video flush start");
- overlay->video_flushing = TRUE;
- GST_TEXT_OVERLAY_BROADCAST (overlay);
- GST_OBJECT_UNLOCK (overlay);
- ret = gst_pad_event_default (pad, event);
- break;
- case GST_EVENT_FLUSH_STOP:
- GST_OBJECT_LOCK (overlay);
- GST_INFO_OBJECT (overlay, "video flush stop");
- overlay->video_flushing = FALSE;
- overlay->video_eos = FALSE;
- gst_segment_init (&overlay->segment, GST_FORMAT_TIME);
- GST_OBJECT_UNLOCK (overlay);
- ret = gst_pad_event_default (pad, event);
- break;
- default:
- ret = gst_pad_event_default (pad, event);
- break;
- }
-
- gst_object_unref (overlay);
-
- return ret;
-}
-
-static GstFlowReturn
-gst_text_overlay_video_bufferalloc (GstPad * pad, guint64 offset, guint size,
- GstCaps * caps, GstBuffer ** buffer)
-{
- GstTextOverlay *overlay = GST_TEXT_OVERLAY (gst_pad_get_parent (pad));
- GstFlowReturn ret = GST_FLOW_WRONG_STATE;
- GstPad *allocpad;
-
- GST_OBJECT_LOCK (overlay);
- allocpad = overlay->srcpad ? gst_object_ref (overlay->srcpad) : NULL;
- GST_OBJECT_UNLOCK (overlay);
-
- if (allocpad) {
- ret = gst_pad_alloc_buffer (allocpad, offset, size, caps, buffer);
- gst_object_unref (allocpad);
- }
-
- gst_object_unref (overlay);
- return ret;
-}
-
-/* Called with lock held */
-static void
-gst_text_overlay_pop_text (GstTextOverlay * overlay)
-{
- g_return_if_fail (GST_IS_TEXT_OVERLAY (overlay));
-
- if (overlay->text_buffer) {
- GST_DEBUG_OBJECT (overlay, "releasing text buffer %p",
- overlay->text_buffer);
- gst_buffer_unref (overlay->text_buffer);
- overlay->text_buffer = NULL;
- }
-
- /* Let the text task know we used that buffer */
- GST_TEXT_OVERLAY_BROADCAST (overlay);
-}
-
-/* We receive text buffers here. If they are out of segment we just ignore them.
- If the buffer is in our segment we keep it internally except if another one
- is already waiting here, in that case we wait that it gets kicked out */
-static GstFlowReturn
-gst_text_overlay_text_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstFlowReturn ret = GST_FLOW_OK;
- GstTextOverlay *overlay = NULL;
- gboolean in_seg = FALSE;
- gint64 clip_start = 0, clip_stop = 0;
-
- overlay = GST_TEXT_OVERLAY (GST_PAD_PARENT (pad));
-
- GST_OBJECT_LOCK (overlay);
-
- if (overlay->text_flushing) {
- GST_OBJECT_UNLOCK (overlay);
- ret = GST_FLOW_WRONG_STATE;
- GST_LOG_OBJECT (overlay, "text flushing");
- goto beach;
- }
-
- if (overlay->text_eos) {
- GST_OBJECT_UNLOCK (overlay);
- ret = GST_FLOW_UNEXPECTED;
- GST_LOG_OBJECT (overlay, "text EOS");
- goto beach;
- }
-
- GST_LOG_OBJECT (overlay, "%" GST_SEGMENT_FORMAT " BUFFER: ts=%"
- GST_TIME_FORMAT ", end=%" GST_TIME_FORMAT, &overlay->segment,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer) +
- GST_BUFFER_DURATION (buffer)));
-
- if (G_LIKELY (GST_BUFFER_TIMESTAMP_IS_VALID (buffer))) {
- GstClockTime stop;
-
- if (G_LIKELY (GST_BUFFER_DURATION_IS_VALID (buffer)))
- stop = GST_BUFFER_TIMESTAMP (buffer) + GST_BUFFER_DURATION (buffer);
- else
- stop = GST_CLOCK_TIME_NONE;
-
- in_seg = gst_segment_clip (&overlay->text_segment, GST_FORMAT_TIME,
- GST_BUFFER_TIMESTAMP (buffer), stop, &clip_start, &clip_stop);
- } else {
- in_seg = TRUE;
- }
-
- if (in_seg) {
- if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer))
- GST_BUFFER_TIMESTAMP (buffer) = clip_start;
- else if (GST_BUFFER_DURATION_IS_VALID (buffer))
- GST_BUFFER_DURATION (buffer) = clip_stop - clip_start;
-
- /* Wait for the previous buffer to go away */
- while (overlay->text_buffer != NULL) {
- GST_DEBUG ("Pad %s:%s has a buffer queued, waiting",
- GST_DEBUG_PAD_NAME (pad));
- GST_TEXT_OVERLAY_WAIT (overlay);
- GST_DEBUG ("Pad %s:%s resuming", GST_DEBUG_PAD_NAME (pad));
- if (overlay->text_flushing) {
- GST_OBJECT_UNLOCK (overlay);
- ret = GST_FLOW_WRONG_STATE;
- goto beach;
- }
- }
-
- if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer))
- gst_segment_set_last_stop (&overlay->text_segment, GST_FORMAT_TIME,
- clip_start);
-
- overlay->text_buffer = buffer;
- /* That's a new text buffer we need to render */
- overlay->need_render = TRUE;
-
- /* in case the video chain is waiting for a text buffer, wake it up */
- GST_TEXT_OVERLAY_BROADCAST (overlay);
- }
-
- GST_OBJECT_UNLOCK (overlay);
-
-beach:
-
- return ret;
-}
-
-static GstFlowReturn
-gst_text_overlay_video_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstTextOverlayClass *klass;
- GstTextOverlay *overlay;
- GstFlowReturn ret = GST_FLOW_OK;
- gboolean in_seg = FALSE;
- gint64 start, stop, clip_start = 0, clip_stop = 0;
- gchar *text = NULL;
-
- overlay = GST_TEXT_OVERLAY (GST_PAD_PARENT (pad));
- klass = GST_TEXT_OVERLAY_GET_CLASS (overlay);
-
- if (!GST_BUFFER_TIMESTAMP_IS_VALID (buffer))
- goto missing_timestamp;
-
- /* ignore buffers that are outside of the current segment */
- start = GST_BUFFER_TIMESTAMP (buffer);
-
- if (!GST_BUFFER_DURATION_IS_VALID (buffer)) {
- stop = GST_CLOCK_TIME_NONE;
- } else {
- stop = start + GST_BUFFER_DURATION (buffer);
- }
-
- GST_LOG_OBJECT (overlay, "%" GST_SEGMENT_FORMAT " BUFFER: ts=%"
- GST_TIME_FORMAT ", end=%" GST_TIME_FORMAT, &overlay->segment,
- GST_TIME_ARGS (start), GST_TIME_ARGS (stop));
-
- /* segment_clip() will adjust start unconditionally to segment_start if
- * no stop time is provided, so handle this ourselves */
- if (stop == GST_CLOCK_TIME_NONE && start < overlay->segment.start)
- goto out_of_segment;
-
- in_seg = gst_segment_clip (&overlay->segment, GST_FORMAT_TIME, start, stop,
- &clip_start, &clip_stop);
-
- if (!in_seg)
- goto out_of_segment;
-
- /* if the buffer is only partially in the segment, fix up stamps */
- if (clip_start != start || (stop != -1 && clip_stop != stop)) {
- GST_DEBUG_OBJECT (overlay, "clipping buffer timestamp/duration to segment");
- buffer = gst_buffer_make_metadata_writable (buffer);
- GST_BUFFER_TIMESTAMP (buffer) = clip_start;
- if (stop != -1)
- GST_BUFFER_DURATION (buffer) = clip_stop - clip_start;
- }
-
- /* now, after we've done the clipping, fix up end time if there's no
- * duration (we only use those estimated values internally though, we
- * don't want to set bogus values on the buffer itself) */
- if (stop == -1) {
- GstStructure *s;
- gint fps_num, fps_denom;
-
- s = gst_caps_get_structure (GST_PAD_CAPS (pad), 0);
- if (gst_structure_get_fraction (s, "framerate", &fps_num, &fps_denom) &&
- fps_num && fps_denom) {
- GST_DEBUG_OBJECT (overlay, "estimating duration based on framerate");
- stop = start + gst_util_uint64_scale_int (GST_SECOND, fps_denom, fps_num);
- } else {
- GST_WARNING_OBJECT (overlay, "no duration, assuming minimal duration");
- stop = start + 1; /* we need to assume some interval */
- }
- }
-
-wait_for_text_buf:
-
- GST_OBJECT_LOCK (overlay);
-
- if (overlay->video_flushing)
- goto flushing;
-
- if (overlay->video_eos)
- goto have_eos;
-
- if (overlay->silent) {
- GST_OBJECT_UNLOCK (overlay);
- ret = gst_pad_push (overlay->srcpad, buffer);
-
- /* Update last_stop */
- gst_segment_set_last_stop (&overlay->segment, GST_FORMAT_TIME, clip_start);
-
- return ret;
- }
-
- /* Text pad not linked, rendering internal text */
- if (!overlay->text_linked) {
- if (klass->get_text) {
- text = klass->get_text (overlay, buffer);
- } else {
- text = g_strdup (overlay->default_text);
- }
-
- GST_LOG_OBJECT (overlay, "Text pad not linked, rendering default "
- "text: '%s'", GST_STR_NULL (text));
-
- GST_OBJECT_UNLOCK (overlay);
-
- if (text != NULL && *text != '\0') {
- /* Render and push */
- gst_text_overlay_render_text (overlay, text, -1);
- ret = gst_text_overlay_push_frame (overlay, buffer);
- } else {
- /* Invalid or empty string */
- ret = gst_pad_push (overlay->srcpad, buffer);
- }
- } else {
- /* Text pad linked, check if we have a text buffer queued */
- if (overlay->text_buffer) {
- gboolean pop_text = FALSE, valid_text_time = TRUE;
- GstClockTime text_start = GST_CLOCK_TIME_NONE;
- GstClockTime text_end = GST_CLOCK_TIME_NONE;
- GstClockTime text_running_time = GST_CLOCK_TIME_NONE;
- GstClockTime text_running_time_end = GST_CLOCK_TIME_NONE;
- GstClockTime vid_running_time, vid_running_time_end;
-
- /* if the text buffer isn't stamped right, pop it off the
- * queue and display it for the current video frame only */
- if (!GST_BUFFER_TIMESTAMP_IS_VALID (overlay->text_buffer) ||
- !GST_BUFFER_DURATION_IS_VALID (overlay->text_buffer)) {
- GST_WARNING_OBJECT (overlay,
- "Got text buffer with invalid timestamp or duration");
- pop_text = TRUE;
- valid_text_time = FALSE;
- } else {
- text_start = GST_BUFFER_TIMESTAMP (overlay->text_buffer);
- text_end = text_start + GST_BUFFER_DURATION (overlay->text_buffer);
- }
-
- vid_running_time =
- gst_segment_to_running_time (&overlay->segment, GST_FORMAT_TIME,
- start);
- vid_running_time_end =
- gst_segment_to_running_time (&overlay->segment, GST_FORMAT_TIME,
- stop);
-
- /* If timestamp and duration are valid */
- if (valid_text_time) {
- text_running_time =
- gst_segment_to_running_time (&overlay->segment, GST_FORMAT_TIME,
- text_start);
- text_running_time_end =
- gst_segment_to_running_time (&overlay->segment, GST_FORMAT_TIME,
- text_end);
- }
-
- GST_LOG_OBJECT (overlay, "T: %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT,
- GST_TIME_ARGS (text_running_time),
- GST_TIME_ARGS (text_running_time_end));
- GST_LOG_OBJECT (overlay, "V: %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT,
- GST_TIME_ARGS (vid_running_time),
- GST_TIME_ARGS (vid_running_time_end));
-
- /* Text too old or in the future */
- if (valid_text_time && text_running_time_end <= vid_running_time) {
- /* text buffer too old, get rid of it and do nothing */
- GST_LOG_OBJECT (overlay, "text buffer too old, popping");
- pop_text = FALSE;
- gst_text_overlay_pop_text (overlay);
- GST_OBJECT_UNLOCK (overlay);
- goto wait_for_text_buf;
- } else if (valid_text_time && vid_running_time_end <= text_running_time) {
- GST_LOG_OBJECT (overlay, "text in future, pushing video buf");
- GST_OBJECT_UNLOCK (overlay);
- /* Push the video frame */
- ret = gst_pad_push (overlay->srcpad, buffer);
- } else {
- gchar *in_text;
- gsize in_size;
-
- in_text = (gchar *) GST_BUFFER_DATA (overlay->text_buffer);
- in_size = GST_BUFFER_SIZE (overlay->text_buffer);
-
- /* g_markup_escape_text() absolutely requires valid UTF8 input, it
- * might crash otherwise. We don't fall back on GST_SUBTITLE_ENCODING
- * here on purpose, this is something that needs fixing upstream */
- if (!g_utf8_validate (in_text, in_size, NULL)) {
- const gchar *end = NULL;
-
- GST_WARNING_OBJECT (overlay, "received invalid UTF-8");
- in_text = g_strndup (in_text, in_size);
- while (!g_utf8_validate (in_text, in_size, &end) && end)
- *((gchar *) end) = '*';
- }
-
- /* Get the string */
- if (overlay->have_pango_markup) {
- text = g_strndup (in_text, in_size);
- } else {
- text = g_markup_escape_text (in_text, in_size);
- }
-
- if (text != NULL && *text != '\0') {
- gint text_len = strlen (text);
-
- while (text_len > 0 && (text[text_len - 1] == '\n' ||
- text[text_len - 1] == '\r')) {
- --text_len;
- }
- GST_DEBUG_OBJECT (overlay, "Rendering text '%*s'", text_len, text);
- gst_text_overlay_render_text (overlay, text, text_len);
- } else {
- GST_DEBUG_OBJECT (overlay, "No text to render (empty buffer)");
- gst_text_overlay_render_text (overlay, " ", 1);
- }
-
- if (in_text != (gchar *) GST_BUFFER_DATA (overlay->text_buffer))
- g_free (in_text);
-
- GST_OBJECT_UNLOCK (overlay);
- ret = gst_text_overlay_push_frame (overlay, buffer);
-
- if (valid_text_time && text_running_time_end <= vid_running_time_end) {
- GST_LOG_OBJECT (overlay, "text buffer not needed any longer");
- pop_text = TRUE;
- }
- }
- if (pop_text) {
- GST_OBJECT_LOCK (overlay);
- gst_text_overlay_pop_text (overlay);
- GST_OBJECT_UNLOCK (overlay);
- }
- } else {
- gboolean wait_for_text_buf = TRUE;
-
- if (overlay->text_eos)
- wait_for_text_buf = FALSE;
-
- if (!overlay->wait_text)
- wait_for_text_buf = FALSE;
-
- /* Text pad linked, but no text buffer available - what now? */
- if (overlay->text_segment.format == GST_FORMAT_TIME) {
- GstClockTime text_start_running_time, text_last_stop_running_time;
- GstClockTime vid_running_time;
-
- vid_running_time =
- gst_segment_to_running_time (&overlay->segment, GST_FORMAT_TIME,
- GST_BUFFER_TIMESTAMP (buffer));
- text_start_running_time =
- gst_segment_to_running_time (&overlay->text_segment,
- GST_FORMAT_TIME, overlay->text_segment.start);
- text_last_stop_running_time =
- gst_segment_to_running_time (&overlay->text_segment,
- GST_FORMAT_TIME, overlay->text_segment.last_stop);
-
- if ((GST_CLOCK_TIME_IS_VALID (text_start_running_time) &&
- vid_running_time < text_start_running_time) ||
- (GST_CLOCK_TIME_IS_VALID (text_last_stop_running_time) &&
- vid_running_time < text_last_stop_running_time)) {
- wait_for_text_buf = FALSE;
- }
- }
-
- if (wait_for_text_buf) {
- GST_DEBUG_OBJECT (overlay, "no text buffer, need to wait for one");
- GST_TEXT_OVERLAY_WAIT (overlay);
- GST_DEBUG_OBJECT (overlay, "resuming");
- GST_OBJECT_UNLOCK (overlay);
- goto wait_for_text_buf;
- } else {
- GST_OBJECT_UNLOCK (overlay);
- GST_LOG_OBJECT (overlay, "no need to wait for a text buffer");
- ret = gst_pad_push (overlay->srcpad, buffer);
- }
- }
- }
-
- g_free (text);
-
- /* Update last_stop */
- gst_segment_set_last_stop (&overlay->segment, GST_FORMAT_TIME, clip_start);
-
- return ret;
-
-missing_timestamp:
- {
- GST_WARNING_OBJECT (overlay, "buffer without timestamp, discarding");
- gst_buffer_unref (buffer);
- return GST_FLOW_OK;
- }
-
-flushing:
- {
- GST_OBJECT_UNLOCK (overlay);
- GST_DEBUG_OBJECT (overlay, "flushing, discarding buffer");
- gst_buffer_unref (buffer);
- return GST_FLOW_WRONG_STATE;
- }
-have_eos:
- {
- GST_OBJECT_UNLOCK (overlay);
- GST_DEBUG_OBJECT (overlay, "eos, discarding buffer");
- gst_buffer_unref (buffer);
- return GST_FLOW_UNEXPECTED;
- }
-out_of_segment:
- {
- GST_DEBUG_OBJECT (overlay, "buffer out of segment, discarding");
- gst_buffer_unref (buffer);
- return GST_FLOW_OK;
- }
-}
-
-static GstStateChangeReturn
-gst_text_overlay_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
- GstTextOverlay *overlay = GST_TEXT_OVERLAY (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- GST_OBJECT_LOCK (overlay);
- overlay->text_flushing = TRUE;
- overlay->video_flushing = TRUE;
- /* pop_text will broadcast on the GCond and thus also make the video
- * chain exit if it's waiting for a text buffer */
- gst_text_overlay_pop_text (overlay);
- GST_OBJECT_UNLOCK (overlay);
- break;
- default:
- break;
- }
-
- ret = parent_class->change_state (element, transition);
- if (ret == GST_STATE_CHANGE_FAILURE)
- return ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- GST_OBJECT_LOCK (overlay);
- overlay->text_flushing = FALSE;
- overlay->video_flushing = FALSE;
- overlay->video_eos = FALSE;
- overlay->text_eos = FALSE;
- gst_segment_init (&overlay->segment, GST_FORMAT_TIME);
- gst_segment_init (&overlay->text_segment, GST_FORMAT_TIME);
- GST_OBJECT_UNLOCK (overlay);
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_element_register (plugin, "textoverlay", GST_RANK_NONE,
- GST_TYPE_TEXT_OVERLAY) ||
- !gst_element_register (plugin, "timeoverlay", GST_RANK_NONE,
- GST_TYPE_TIME_OVERLAY) ||
- !gst_element_register (plugin, "clockoverlay", GST_RANK_NONE,
- GST_TYPE_CLOCK_OVERLAY) ||
- !gst_element_register (plugin, "textrender", GST_RANK_NONE,
- GST_TYPE_TEXT_RENDER)) {
- return FALSE;
- }
-
- /*texttestsrc_plugin_init(module, plugin); */
-
- GST_DEBUG_CATEGORY_INIT (pango_debug, "pango", 0, "Pango elements");
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR,
- "pango", "Pango-based text rendering and overlay", plugin_init,
- VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/pango/gsttextoverlay.h b/ext/pango/gsttextoverlay.h
deleted file mode 100644
index 4590b270..00000000
--- a/ext/pango/gsttextoverlay.h
+++ /dev/null
@@ -1,158 +0,0 @@
-#ifndef __GST_TEXT_OVERLAY_H__
-#define __GST_TEXT_OVERLAY_H__
-
-#include <gst/gst.h>
-#include <gst/video/video.h>
-#include <pango/pangocairo.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_TEXT_OVERLAY (gst_text_overlay_get_type())
-#define GST_TEXT_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
- GST_TYPE_TEXT_OVERLAY, GstTextOverlay))
-#define GST_TEXT_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\
- GST_TYPE_TEXT_OVERLAY,GstTextOverlayClass))
-#define GST_TEXT_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
- GST_TYPE_TEXT_OVERLAY, GstTextOverlayClass))
-#define GST_IS_TEXT_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
- GST_TYPE_TEXT_OVERLAY))
-#define GST_IS_TEXT_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
- GST_TYPE_TEXT_OVERLAY))
-
-typedef struct _GstTextOverlay GstTextOverlay;
-typedef struct _GstTextOverlayClass GstTextOverlayClass;
-
-/**
- * GstTextOverlayVAlign:
- * @GST_TEXT_OVERLAY_VALIGN_BASELINE: draw text on the baseline
- * @GST_TEXT_OVERLAY_VALIGN_BOTTOM: draw text on the bottom
- * @GST_TEXT_OVERLAY_VALIGN_TOP: draw test on top
- *
- * Vertical alignment of the text.
- */
-typedef enum {
- GST_TEXT_OVERLAY_VALIGN_BASELINE,
- GST_TEXT_OVERLAY_VALIGN_BOTTOM,
- GST_TEXT_OVERLAY_VALIGN_TOP
-} GstTextOverlayVAlign;
-
-/**
- * GstTextOverlayHAlign:
- * @GST_TEXT_OVERLAY_HALIGN_LEFT: align text left
- * @GST_TEXT_OVERLAY_HALIGN_CENTER: align text center
- * @GST_TEXT_OVERLAY_HALIGN_RIGHT: align text right
- *
- * Horizontal alignment of the text.
- */
-typedef enum {
- GST_TEXT_OVERLAY_HALIGN_LEFT,
- GST_TEXT_OVERLAY_HALIGN_CENTER,
- GST_TEXT_OVERLAY_HALIGN_RIGHT
-} GstTextOverlayHAlign;
-
-/**
- * GstTextOverlayWrapMode:
- * @GST_TEXT_OVERLAY_WRAP_MODE_NONE: no wrapping
- * @GST_TEXT_OVERLAY_WRAP_MODE_WORD: do word wrapping
- * @GST_TEXT_OVERLAY_WRAP_MODE_CHAR: do char wrapping
- * @GST_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR: do word and char wrapping
- *
- * Whether to wrap the text and if so how.
- */
-typedef enum {
- GST_TEXT_OVERLAY_WRAP_MODE_NONE = -1,
- GST_TEXT_OVERLAY_WRAP_MODE_WORD = PANGO_WRAP_WORD,
- GST_TEXT_OVERLAY_WRAP_MODE_CHAR = PANGO_WRAP_CHAR,
- GST_TEXT_OVERLAY_WRAP_MODE_WORD_CHAR = PANGO_WRAP_WORD_CHAR
-} GstTextOverlayWrapMode;
-
-/**
- * GstTextOverlayLineAlign:
- * @GST_TEXT_OVERLAY_LINE_ALIGN_LEFT: lines are left-aligned
- * @GST_TEXT_OVERLAY_LINE_ALIGN_CENTER: lines are center-aligned
- * @GST_TEXT_OVERLAY_LINE_ALIGN_RIGHT: lines are right-aligned
- *
- * Alignment of text lines relative to each other
- */
-typedef enum {
- GST_TEXT_OVERLAY_LINE_ALIGN_LEFT = PANGO_ALIGN_LEFT,
- GST_TEXT_OVERLAY_LINE_ALIGN_CENTER = PANGO_ALIGN_CENTER,
- GST_TEXT_OVERLAY_LINE_ALIGN_RIGHT = PANGO_ALIGN_RIGHT
-} GstTextOverlayLineAlign;
-
-/**
- * GstTextOverlay:
- *
- * Opaque textoverlay object structure
- */
-struct _GstTextOverlay {
- GstElement element;
-
- GstPad *video_sinkpad;
- GstPad *text_sinkpad;
- GstPad *srcpad;
-
- GstSegment segment;
- GstSegment text_segment;
- GstBuffer *text_buffer;
- gboolean text_linked;
- gboolean video_flushing;
- gboolean video_eos;
- gboolean text_flushing;
- gboolean text_eos;
-
- GCond *cond; /* to signal removal of a queued text
- * buffer, arrival of a text buffer,
- * a text segment update, or a change
- * in status (e.g. shutdown, flushing) */
-
- gint width;
- gint height;
- gint fps_n;
- gint fps_d;
- GstVideoFormat format;
-
- GstTextOverlayVAlign valign;
- GstTextOverlayHAlign halign;
- GstTextOverlayWrapMode wrap_mode;
- GstTextOverlayLineAlign line_align;
-
- gint xpad;
- gint ypad;
- gint deltax;
- gint deltay;
- gchar *default_text;
- gboolean want_shading;
- gboolean silent;
- gboolean wait_text;
-
- PangoLayout *layout;
- gdouble shadow_offset;
- gdouble outline_offset;
- guchar *text_image;
- gint image_width;
- gint image_height;
- gint baseline_y;
-
- gboolean auto_adjust_size;
- gboolean need_render;
-
- gint shading_value; /* for timeoverlay subclass */
-
- gboolean have_pango_markup;
- gboolean use_vertical_render;
-};
-
-struct _GstTextOverlayClass {
- GstElementClass parent_class;
-
- PangoContext *pango_context;
-
- gchar * (*get_text) (GstTextOverlay *overlay, GstBuffer *video_frame);
-};
-
-GType gst_text_overlay_get_type(void) G_GNUC_CONST;
-
-G_END_DECLS
-
-#endif /* __GST_TEXT_OVERLAY_H */
diff --git a/ext/pango/gsttextrender.c b/ext/pango/gsttextrender.c
deleted file mode 100644
index c9372449..00000000
--- a/ext/pango/gsttextrender.c
+++ /dev/null
@@ -1,705 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) <2003> David Schleef <ds@schleef.org>
- * Copyright (C) <2009> Young-Ho Cha <ganadist@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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-/**
- * SECTION:element-textrender
- * @see_also: #GstTextOverlay
- *
- * This plugin renders text received on the text sink pad to a video
- * buffer (retaining the alpha channel), so it can later be overlayed
- * on top of video streams using other elements.
- *
- * The text can contain newline characters. (FIXME: What about text
- * wrapping? It does not make sense in this context)
- *
- * <refsect2>
- * <title>Example launch lines</title>
- * |[
- * gst-launch -v filesrc location=subtitles.srt ! subparse ! textrender ! xvimagesink
- * ]|
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gst/gst.h>
-#include <gst/video/video.h>
-
-#include "gsttextrender.h"
-#include <string.h>
-
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-# define CAIRO_ARGB_A 3
-# define CAIRO_ARGB_R 2
-# define CAIRO_ARGB_G 1
-# define CAIRO_ARGB_B 0
-#else
-# define CAIRO_ARGB_A 0
-# define CAIRO_ARGB_R 1
-# define CAIRO_ARGB_G 2
-# define CAIRO_ARGB_B 3
-#endif
-
-GST_DEBUG_CATEGORY_EXTERN (pango_debug);
-#define GST_CAT_DEFAULT pango_debug
-
-#define MINIMUM_OUTLINE_OFFSET 1.0
-
-#define DEFAULT_PROP_VALIGNMENT GST_TEXT_RENDER_VALIGN_BASELINE
-#define DEFAULT_PROP_HALIGNMENT GST_TEXT_RENDER_HALIGN_CENTER
-#define DEFAULT_PROP_LINE_ALIGNMENT GST_TEXT_RENDER_LINE_ALIGN_CENTER
-#define DEFAULT_PROP_XPAD 25
-#define DEFAULT_PROP_YPAD 25
-
-#define DEFAULT_RENDER_WIDTH 720
-#define DEFAULT_RENDER_HEIGHT 576
-
-enum
-{
- PROP_0,
- PROP_HALIGNMENT,
- PROP_VALIGNMENT,
- PROP_LINE_ALIGNMENT,
- PROP_XPAD,
- PROP_YPAD,
- PROP_FONT_DESC
-};
-
-
-static GstStaticPadTemplate src_template_factory =
- GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("AYUV") ";" GST_VIDEO_CAPS_ARGB)
- );
-
-static GstStaticPadTemplate sink_template_factory =
- GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("text/x-pango-markup; text/plain")
- );
-
-#define GST_TYPE_TEXT_RENDER_VALIGN (gst_text_render_valign_get_type())
-static GType
-gst_text_render_valign_get_type (void)
-{
- static GType text_render_valign_type = 0;
- static const GEnumValue text_render_valign[] = {
- {GST_TEXT_RENDER_VALIGN_BASELINE, "baseline", "baseline"},
- {GST_TEXT_RENDER_VALIGN_BOTTOM, "bottom", "bottom"},
- {GST_TEXT_RENDER_VALIGN_TOP, "top", "top"},
- {0, NULL, NULL},
- };
-
- if (!text_render_valign_type) {
- text_render_valign_type =
- g_enum_register_static ("GstTextRenderVAlign", text_render_valign);
- }
- return text_render_valign_type;
-}
-
-#define GST_TYPE_TEXT_RENDER_HALIGN (gst_text_render_halign_get_type())
-static GType
-gst_text_render_halign_get_type (void)
-{
- static GType text_render_halign_type = 0;
- static const GEnumValue text_render_halign[] = {
- {GST_TEXT_RENDER_HALIGN_LEFT, "left", "left"},
- {GST_TEXT_RENDER_HALIGN_CENTER, "center", "center"},
- {GST_TEXT_RENDER_HALIGN_RIGHT, "right", "right"},
- {0, NULL, NULL},
- };
-
- if (!text_render_halign_type) {
- text_render_halign_type =
- g_enum_register_static ("GstTextRenderHAlign", text_render_halign);
- }
- return text_render_halign_type;
-}
-
-#define GST_TYPE_TEXT_RENDER_LINE_ALIGN (gst_text_render_line_align_get_type())
-static GType
-gst_text_render_line_align_get_type (void)
-{
- static GType text_render_line_align_type = 0;
- static const GEnumValue text_render_line_align[] = {
- {GST_TEXT_RENDER_LINE_ALIGN_LEFT, "left", "left"},
- {GST_TEXT_RENDER_LINE_ALIGN_CENTER, "center", "center"},
- {GST_TEXT_RENDER_LINE_ALIGN_RIGHT, "right", "right"},
- {0, NULL, NULL}
- };
-
- if (!text_render_line_align_type) {
- text_render_line_align_type =
- g_enum_register_static ("GstTextRenderLineAlign",
- text_render_line_align);
- }
- return text_render_line_align_type;
-}
-
-static void gst_text_render_adjust_values_with_fontdesc (GstTextRender *
- render, PangoFontDescription * desc);
-
-GST_BOILERPLATE (GstTextRender, gst_text_render, GstElement, GST_TYPE_ELEMENT);
-
-static void gst_text_render_finalize (GObject * object);
-static void gst_text_render_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_text_render_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static void
-gst_text_render_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_template_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_template_factory));
-
- gst_element_class_set_details_simple (element_class, "Text renderer",
- "Filter/Editor/Video",
- "Renders a text string to an image bitmap",
- "David Schleef <ds@schleef.org>, "
- "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
-}
-
-static void
-gst_text_render_class_init (GstTextRenderClass * klass)
-{
- GObjectClass *gobject_class;
- PangoFontMap *fontmap;
-
- gobject_class = (GObjectClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->finalize = gst_text_render_finalize;
- gobject_class->set_property = gst_text_render_set_property;
- gobject_class->get_property = gst_text_render_get_property;
-
- fontmap = pango_cairo_font_map_get_default ();
- klass->pango_context =
- pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_FONT_DESC,
- g_param_spec_string ("font-desc", "font description",
- "Pango font description of font "
- "to be used for rendering. "
- "See documentation of "
- "pango_font_description_from_string"
- " for syntax.", "", G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VALIGNMENT,
- g_param_spec_enum ("valignment", "vertical alignment",
- "Vertical alignment of the text", GST_TYPE_TEXT_RENDER_VALIGN,
- DEFAULT_PROP_VALIGNMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HALIGNMENT,
- g_param_spec_enum ("halignment", "horizontal alignment",
- "Horizontal alignment of the text", GST_TYPE_TEXT_RENDER_HALIGN,
- DEFAULT_PROP_HALIGNMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_XPAD,
- g_param_spec_int ("xpad", "horizontal paddding",
- "Horizontal paddding when using left/right alignment", 0, G_MAXINT,
- DEFAULT_PROP_XPAD, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_YPAD,
- g_param_spec_int ("ypad", "vertical padding",
- "Vertical padding when using top/bottom alignment", 0, G_MAXINT,
- DEFAULT_PROP_YPAD, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_LINE_ALIGNMENT,
- g_param_spec_enum ("line-alignment", "line alignment",
- "Alignment of text lines relative to each other.",
- GST_TYPE_TEXT_RENDER_LINE_ALIGN, DEFAULT_PROP_LINE_ALIGNMENT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-}
-
-static void
-gst_text_render_adjust_values_with_fontdesc (GstTextRender * render,
- PangoFontDescription * desc)
-{
- gint font_size = pango_font_description_get_size (desc) / PANGO_SCALE;
-
- render->shadow_offset = (double) (font_size) / 13.0;
- render->outline_offset = (double) (font_size) / 15.0;
- if (render->outline_offset < MINIMUM_OUTLINE_OFFSET)
- render->outline_offset = MINIMUM_OUTLINE_OFFSET;
-}
-
-static void
-gst_text_render_render_pangocairo (GstTextRender * render)
-{
- cairo_t *cr;
- cairo_surface_t *surface;
- cairo_t *cr_shadow;
- cairo_surface_t *surface_shadow;
- PangoRectangle ink_rect, logical_rect;
- gint width, height;
-
- pango_layout_get_pixel_extents (render->layout, &ink_rect, &logical_rect);
-
- width = logical_rect.width + render->shadow_offset;
- height = logical_rect.height + logical_rect.y + render->shadow_offset;
-
- surface_shadow = cairo_image_surface_create (CAIRO_FORMAT_A8, width, height);
- cr_shadow = cairo_create (surface_shadow);
-
- /* clear shadow surface */
- cairo_set_operator (cr_shadow, CAIRO_OPERATOR_CLEAR);
- cairo_paint (cr_shadow);
- cairo_set_operator (cr_shadow, CAIRO_OPERATOR_OVER);
-
- /* draw shadow text */
- cairo_save (cr_shadow);
- cairo_set_source_rgba (cr_shadow, 0.0, 0.0, 0.0, 0.5);
- cairo_translate (cr_shadow, render->shadow_offset, render->shadow_offset);
- pango_cairo_show_layout (cr_shadow, render->layout);
- cairo_restore (cr_shadow);
-
- /* draw outline text */
- cairo_save (cr_shadow);
- cairo_set_source_rgb (cr_shadow, 0.0, 0.0, 0.0);
- cairo_set_line_width (cr_shadow, render->outline_offset);
- pango_cairo_layout_path (cr_shadow, render->layout);
- cairo_stroke (cr_shadow);
- cairo_restore (cr_shadow);
-
- cairo_destroy (cr_shadow);
-
- render->text_image = g_realloc (render->text_image, 4 * width * height);
-
- surface = cairo_image_surface_create_for_data (render->text_image,
- CAIRO_FORMAT_ARGB32, width, height, width * 4);
- cr = cairo_create (surface);
- cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
- cairo_paint (cr);
- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
-
- /* set default color */
- cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
-
- cairo_save (cr);
- /* draw text */
- pango_cairo_show_layout (cr, render->layout);
- cairo_restore (cr);
-
- /* composite shadow with offset */
- cairo_set_operator (cr, CAIRO_OPERATOR_DEST_OVER);
- cairo_set_source_surface (cr, surface_shadow, 0.0, 0.0);
- cairo_paint (cr);
-
- cairo_destroy (cr);
- cairo_surface_destroy (surface_shadow);
- cairo_surface_destroy (surface);
- render->image_width = width;
- render->image_height = height;
-}
-
-static void
-gst_text_render_check_argb (GstTextRender * render)
-{
- GstCaps *peer_caps;
- peer_caps = gst_pad_get_allowed_caps (render->srcpad);
- if (G_LIKELY (peer_caps)) {
- guint i = 0, n = 0;
-
- n = gst_caps_get_size (peer_caps);
- GST_DEBUG_OBJECT (render, "peer allowed caps (%u structure(s)) are %"
- GST_PTR_FORMAT, n, peer_caps);
-
- /* Check if AYUV or ARGB is first */
- for (i = 0; i < n; i++) {
- GstStructure *s = gst_caps_get_structure (peer_caps, i);
- if (gst_structure_has_name (s, "video/x-raw-rgb") &&
- gst_structure_has_field (s, "alpha_mask")) {
- render->use_ARGB = TRUE;
- break;
- } else if (gst_structure_has_name (s, "video/x-raw-yuv")) {
- guint fourcc;
- if (gst_structure_get_fourcc (s, "format", &fourcc) &&
- fourcc == GST_MAKE_FOURCC ('A', 'Y', 'U', 'V')) {
- render->use_ARGB = FALSE;
- break;
- }
- }
- }
- gst_caps_unref (peer_caps);
- }
-}
-
-static gboolean
-gst_text_render_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstTextRender *render = GST_TEXT_RENDER (gst_pad_get_parent (pad));
- GstStructure *structure;
- gboolean ret = FALSE;
- gint width = 0, height = 0;
-
- structure = gst_caps_get_structure (caps, 0);
- gst_structure_get_int (structure, "width", &width);
- gst_structure_get_int (structure, "height", &height);
-
- GST_DEBUG ("Got caps %" GST_PTR_FORMAT, caps);
-
- if (width >= render->image_width && height >= render->image_height) {
- render->width = width;
- render->height = height;
- ret = TRUE;
- }
-
- gst_text_render_check_argb (render);
-
- gst_object_unref (render);
- return ret;
-}
-
-static void
-gst_text_render_fixate_caps (GstPad * pad, GstCaps * caps)
-{
- GstTextRender *render = GST_TEXT_RENDER (gst_pad_get_parent (pad));
- GstStructure *s = gst_caps_get_structure (caps, 0);
-
- GST_DEBUG ("Fixating caps %" GST_PTR_FORMAT, caps);
- gst_structure_fixate_field_nearest_int (s, "width", render->image_width);
- gst_structure_fixate_field_nearest_int (s, "height", render->image_height);
- GST_DEBUG ("Fixated to %" GST_PTR_FORMAT, caps);
-
- gst_object_unref (render);
-}
-
-#define CAIRO_UNPREMULTIPLY(a,r,g,b) G_STMT_START { \
- b = (a > 0) ? MIN ((b * 255 + a / 2) / a, 255) : 0; \
- g = (a > 0) ? MIN ((g * 255 + a / 2) / a, 255) : 0; \
- r = (a > 0) ? MIN ((r * 255 + a / 2) / a, 255) : 0; \
-} G_STMT_END
-
-static void
-gst_text_renderer_image_to_ayuv (GstTextRender * render, guchar * pixbuf,
- int xpos, int ypos, int stride)
-{
- int y; /* text bitmap coordinates */
- guchar *p, *bitp;
- guchar a, r, g, b;
- int width, height;
-
- width = render->image_width;
- height = render->image_height;
- bitp = render->text_image;
-
- for (y = 0; y < height; y++) {
- int n;
- p = pixbuf + (ypos + y) * stride + xpos * 4;
- for (n = 0; n < width; n++) {
- b = bitp[CAIRO_ARGB_B];
- g = bitp[CAIRO_ARGB_G];
- r = bitp[CAIRO_ARGB_R];
- a = bitp[CAIRO_ARGB_A];
- bitp += 4;
-
- /* Cairo uses pre-multiplied ARGB, unpremultiply it */
- CAIRO_UNPREMULTIPLY (a, r, g, b);
-
- *p++ = a;
- *p++ = CLAMP ((int) (((19595 * r) >> 16) + ((38470 * g) >> 16) +
- ((7471 * b) >> 16)), 0, 255);
- *p++ = CLAMP ((int) (-((11059 * r) >> 16) - ((21709 * g) >> 16) +
- ((32768 * b) >> 16) + 128), 0, 255);
- *p++ = CLAMP ((int) (((32768 * r) >> 16) - ((27439 * g) >> 16) -
- ((5329 * b) >> 16) + 128), 0, 255);
- }
- }
-}
-
-static void
-gst_text_renderer_image_to_argb (GstTextRender * render, guchar * pixbuf,
- int xpos, int ypos, int stride)
-{
- int i, j;
- guchar *p, *bitp;
- int width, height;
-
- width = render->image_width;
- height = render->image_height;
- bitp = render->text_image;
-
- for (i = 0; i < height; i++) {
- p = pixbuf + (ypos + i) * stride + xpos * 4;
- for (j = 0; j < width; j++) {
- p[0] = bitp[CAIRO_ARGB_A];
- p[1] = bitp[CAIRO_ARGB_R];
- p[2] = bitp[CAIRO_ARGB_G];
- p[3] = bitp[CAIRO_ARGB_B];
-
- /* Cairo uses pre-multiplied ARGB, unpremultiply it */
- CAIRO_UNPREMULTIPLY (p[0], p[1], p[2], p[3]);
-
- bitp += 4;
- p += 4;
- }
- }
-}
-
-static GstFlowReturn
-gst_text_render_chain (GstPad * pad, GstBuffer * inbuf)
-{
- GstTextRender *render;
- GstFlowReturn ret;
- GstBuffer *outbuf;
- GstCaps *caps = NULL;
- guint8 *data = GST_BUFFER_DATA (inbuf);
- guint size = GST_BUFFER_SIZE (inbuf);
- gint n;
- gint xpos, ypos;
-
- render = GST_TEXT_RENDER (gst_pad_get_parent (pad));
-
- /* somehow pango barfs over "\0" buffers... */
- while (size > 0 &&
- (data[size - 1] == '\r' ||
- data[size - 1] == '\n' || data[size - 1] == '\0')) {
- size--;
- }
-
- /* render text */
- GST_DEBUG ("rendering '%*s'", size, data);
- pango_layout_set_markup (render->layout, (gchar *) data, size);
- gst_text_render_render_pangocairo (render);
-
- gst_text_render_check_argb (render);
-
- if (!render->use_ARGB) {
- caps =
- gst_video_format_new_caps (GST_VIDEO_FORMAT_AYUV, render->width,
- render->height, 1, 1, 1, 1);
- } else {
- caps =
- gst_video_format_new_caps (GST_VIDEO_FORMAT_ARGB, render->width,
- render->height, 1, 1, 1, 1);
- }
-
- if (!gst_pad_set_caps (render->srcpad, caps)) {
- gst_caps_unref (caps);
- GST_ELEMENT_ERROR (render, CORE, NEGOTIATION, (NULL), (NULL));
- ret = GST_FLOW_ERROR;
- goto done;
- }
-
- GST_DEBUG ("Allocating buffer WxH = %dx%d", render->width, render->height);
- ret =
- gst_pad_alloc_buffer_and_set_caps (render->srcpad, GST_BUFFER_OFFSET_NONE,
- render->width * render->height * 4, caps, &outbuf);
-
- if (ret != GST_FLOW_OK)
- goto done;
-
- gst_buffer_copy_metadata (outbuf, inbuf, GST_BUFFER_COPY_TIMESTAMPS);
- data = GST_BUFFER_DATA (outbuf);
-
- if (render->use_ARGB) {
- memset (data, 0, render->width * render->height * 4);
- } else {
- for (n = 0; n < render->width * render->height; n++) {
- data[n * 4] = data[n * 4 + 1] = 0;
- data[n * 4 + 2] = data[n * 4 + 3] = 128;
- }
- }
-
- switch (render->halign) {
- case GST_TEXT_RENDER_HALIGN_LEFT:
- xpos = render->xpad;
- break;
- case GST_TEXT_RENDER_HALIGN_CENTER:
- xpos = (render->width - render->image_width) / 2;
- break;
- case GST_TEXT_RENDER_HALIGN_RIGHT:
- xpos = render->width - render->image_width - render->xpad;
- break;
- default:
- xpos = 0;
- }
-
- switch (render->valign) {
- case GST_TEXT_RENDER_VALIGN_BOTTOM:
- ypos = render->height - render->image_height - render->ypad;
- break;
- case GST_TEXT_RENDER_VALIGN_BASELINE:
- ypos = render->height - (render->image_height + render->ypad);
- break;
- case GST_TEXT_RENDER_VALIGN_TOP:
- ypos = render->ypad;
- break;
- default:
- ypos = render->ypad;
- break;
- }
-
- if (render->text_image) {
- if (render->use_ARGB) {
- gst_text_renderer_image_to_argb (render, data, xpos, ypos,
- render->width * 4);
- } else {
- gst_text_renderer_image_to_ayuv (render, data, xpos, ypos,
- render->width * 4);
- }
- }
-
- ret = gst_pad_push (render->srcpad, outbuf);
-
-done:
- if (caps)
- gst_caps_unref (caps);
- gst_buffer_unref (inbuf);
- gst_object_unref (render);
- return ret;
-}
-
-static void
-gst_text_render_finalize (GObject * object)
-{
- GstTextRender *render = GST_TEXT_RENDER (object);
-
- g_free (render->text_image);
-
- if (render->layout)
- g_object_unref (render->layout);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_text_render_init (GstTextRender * render, GstTextRenderClass * klass)
-{
- GstPadTemplate *template;
-
- /* sink */
- template = gst_static_pad_template_get (&sink_template_factory);
- render->sinkpad = gst_pad_new_from_template (template, "sink");
- gst_object_unref (template);
- gst_pad_set_chain_function (render->sinkpad,
- GST_DEBUG_FUNCPTR (gst_text_render_chain));
- gst_element_add_pad (GST_ELEMENT (render), render->sinkpad);
-
- /* source */
- template = gst_static_pad_template_get (&src_template_factory);
- render->srcpad = gst_pad_new_from_template (template, "src");
- gst_object_unref (template);
- gst_pad_set_fixatecaps_function (render->srcpad,
- GST_DEBUG_FUNCPTR (gst_text_render_fixate_caps));
- gst_pad_set_setcaps_function (render->srcpad,
- GST_DEBUG_FUNCPTR (gst_text_render_setcaps));
-
- gst_element_add_pad (GST_ELEMENT (render), render->srcpad);
-
- render->line_align = DEFAULT_PROP_LINE_ALIGNMENT;
- render->layout =
- pango_layout_new (GST_TEXT_RENDER_GET_CLASS (render)->pango_context);
- pango_layout_set_alignment (render->layout,
- (PangoAlignment) render->line_align);
-
- render->halign = DEFAULT_PROP_HALIGNMENT;
- render->valign = DEFAULT_PROP_VALIGNMENT;
- render->xpad = DEFAULT_PROP_XPAD;
- render->ypad = DEFAULT_PROP_YPAD;
-
- render->width = DEFAULT_RENDER_WIDTH;
- render->height = DEFAULT_RENDER_HEIGHT;
-
- render->use_ARGB = FALSE;
-}
-
-static void
-gst_text_render_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstTextRender *render = GST_TEXT_RENDER (object);
-
- switch (prop_id) {
- case PROP_VALIGNMENT:
- render->valign = g_value_get_enum (value);
- break;
- case PROP_HALIGNMENT:
- render->halign = g_value_get_enum (value);
- break;
- case PROP_LINE_ALIGNMENT:
- render->line_align = g_value_get_enum (value);
- pango_layout_set_alignment (render->layout,
- (PangoAlignment) render->line_align);
- break;
- case PROP_XPAD:
- render->xpad = g_value_get_int (value);
- break;
- case PROP_YPAD:
- render->ypad = g_value_get_int (value);
- break;
- case PROP_FONT_DESC:
- {
- PangoFontDescription *desc;
-
- desc = pango_font_description_from_string (g_value_get_string (value));
- if (desc) {
- GST_LOG ("font description set: %s", g_value_get_string (value));
- GST_OBJECT_LOCK (render);
- pango_layout_set_font_description (render->layout, desc);
- gst_text_render_adjust_values_with_fontdesc (render, desc);
- pango_font_description_free (desc);
- gst_text_render_render_pangocairo (render);
- GST_OBJECT_UNLOCK (render);
- } else {
- GST_WARNING ("font description parse failed: %s",
- g_value_get_string (value));
- }
- break;
- }
-
- default:
- break;
- }
-}
-
-static void
-gst_text_render_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstTextRender *render = GST_TEXT_RENDER (object);
-
- switch (prop_id) {
- case PROP_VALIGNMENT:
- g_value_set_enum (value, render->valign);
- break;
- case PROP_HALIGNMENT:
- g_value_set_enum (value, render->halign);
- break;
- case PROP_LINE_ALIGNMENT:
- g_value_set_enum (value, render->line_align);
- break;
- case PROP_XPAD:
- g_value_set_int (value, render->xpad);
- break;
- case PROP_YPAD:
- g_value_set_int (value, render->ypad);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
diff --git a/ext/pango/gsttextrender.h b/ext/pango/gsttextrender.h
deleted file mode 100644
index 66d37dbf..00000000
--- a/ext/pango/gsttextrender.h
+++ /dev/null
@@ -1,104 +0,0 @@
-#ifndef __GST_TEXT_RENDER_H__
-#define __GST_TEXT_RENDER_H__
-
-#include <gst/gst.h>
-#include <pango/pangocairo.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_TEXT_RENDER (gst_text_render_get_type())
-#define GST_TEXT_RENDER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
- GST_TYPE_TEXT_RENDER, GstTextRender))
-#define GST_TEXT_RENDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\
- GST_TYPE_TEXT_RENDER, GstTextRenderClass))
-#define GST_TEXT_RENDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
- GST_TYPE_TEXT_RENDER, GstTextRenderClass))
-#define GST_IS_TEXT_RENDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
- GST_TYPE_TEXT_RENDER))
-#define GST_IS_TEXT_RENDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
- GST_TYPE_TEXT_RENDER))
-
-typedef struct _GstTextRender GstTextRender;
-typedef struct _GstTextRenderClass GstTextRenderClass;
-
-/**
- * GstTextRenderVAlign:
- * @GST_TEXT_RENDER_VALIGN_BASELINE: draw text on the baseline
- * @GST_TEXT_RENDER_VALIGN_BOTTOM: draw text on the bottom
- * @GST_TEXT_RENDER_VALIGN_TOP: draw test on top
- *
- * Vertical alignment of the text.
- */
-typedef enum {
- GST_TEXT_RENDER_VALIGN_BASELINE,
- GST_TEXT_RENDER_VALIGN_BOTTOM,
- GST_TEXT_RENDER_VALIGN_TOP
-} GstTextRenderVAlign;
-
-/**
- * GstTextRenderHAlign:
- * @GST_TEXT_RENDER_HALIGN_LEFT: align text left
- * @GST_TEXT_RENDER_HALIGN_CENTER: align text center
- * @GST_TEXT_RENDER_HALIGN_RIGHT: align text right
- *
- * Horizontal alignment of the text.
- */
-typedef enum {
- GST_TEXT_RENDER_HALIGN_LEFT,
- GST_TEXT_RENDER_HALIGN_CENTER,
- GST_TEXT_RENDER_HALIGN_RIGHT
-} GstTextRenderHAlign;
-
-/**
- * GstTextRenderLineAlign:
- * @GST_TEXT_RENDER_LINE_ALIGN_LEFT: lines are left-aligned
- * @GST_TEXT_RENDER_LINE_ALIGN_CENTER: lines are center-aligned
- * @GST_TEXT_RENDER_LINE_ALIGN_RIGHT: lines are right-aligned
- *
- * Alignment of text lines relative to each other
- */
-typedef enum {
- GST_TEXT_RENDER_LINE_ALIGN_LEFT = PANGO_ALIGN_LEFT,
- GST_TEXT_RENDER_LINE_ALIGN_CENTER = PANGO_ALIGN_CENTER,
- GST_TEXT_RENDER_LINE_ALIGN_RIGHT = PANGO_ALIGN_RIGHT
-} GstTextRenderLineAlign;
-
-/**
- * GstTextRender:
- *
- * Opaque textrender data structure.
- */
-struct _GstTextRender {
- GstElement element;
-
- GstPad *sinkpad, *srcpad;
- gint width;
- gint height;
- PangoLayout *layout;
- gdouble shadow_offset;
- gdouble outline_offset;
- guchar *text_image;
- gint image_width;
- gint image_height;
- gint baseline_y;
- gboolean use_ARGB;
-
- GstTextRenderVAlign valign;
- GstTextRenderHAlign halign;
- GstTextRenderLineAlign line_align;
-
- gint xpad;
- gint ypad;
-};
-
-struct _GstTextRenderClass {
- GstElementClass parent_class;
-
- PangoContext *pango_context;
-};
-
-GType gst_text_render_get_type(void) G_GNUC_CONST;
-
-G_END_DECLS
-
-#endif /* __GST_TEXT_RENDER_H */
diff --git a/ext/pango/gsttimeoverlay.c b/ext/pango/gsttimeoverlay.c
deleted file mode 100644
index a342a51e..00000000
--- a/ext/pango/gsttimeoverlay.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-timeoverlay
- * @see_also: #GstTextOverlay, #GstClockOverlay
- *
- * This element overlays the buffer time stamps of a video stream on
- * top of itself. You can position the text and configure the font details
- * using the properties of the #GstTextOverlay class. By default, the
- * time stamp is displayed in the top left corner of the picture, with some
- * padding to the left and to the top.
- *
- * <refsect2>
- * |[
- * gst-launch -v videotestsrc ! timeoverlay ! xvimagesink
- * ]| Display the time stamps in the top left
- * corner of the video picture.
- * |[
- * gst-launch -v videotestsrc ! timeoverlay halign=right valign=bottom text="Stream time:" shaded-background=true ! xvimagesink
- * ]| Another pipeline that displays the time stamps with some leading
- * text in the bottom right corner of the video picture, with the background
- * of the text being shaded in order to make it more legible on top of a
- * bright video background.
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/video/video.h>
-
-#include <gsttimeoverlay.h>
-
-GST_BOILERPLATE (GstTimeOverlay, gst_time_overlay, GstTextOverlay,
- GST_TYPE_TEXT_OVERLAY);
-
-static void
-gst_time_overlay_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details_simple (element_class, "Time overlay",
- "Filter/Editor/Video",
- "Overlays buffer time stamps on a video stream",
- "Tim-Philipp Müller <tim@centricular.net>");
-}
-
-static gchar *
-gst_time_overlay_render_time (GstTimeOverlay * overlay, GstClockTime time)
-{
- guint hours, mins, secs, msecs;
-
- if (!GST_CLOCK_TIME_IS_VALID (time))
- return g_strdup ("");
-
- hours = (guint) (time / (GST_SECOND * 60 * 60));
- mins = (guint) ((time / (GST_SECOND * 60)) % 60);
- secs = (guint) ((time / GST_SECOND) % 60);
- msecs = (guint) ((time % GST_SECOND) / (1000 * 1000));
-
- return g_strdup_printf ("%u:%02u:%02u.%03u", hours, mins, secs, msecs);
-}
-
-/* Called with lock held */
-static gchar *
-gst_time_overlay_get_text (GstTextOverlay * overlay, GstBuffer * video_frame)
-{
- GstClockTime time = GST_BUFFER_TIMESTAMP (video_frame);
- gchar *time_str, *txt, *ret;
-
- overlay->need_render = TRUE;
-
- if (!GST_CLOCK_TIME_IS_VALID (time)) {
- GST_DEBUG ("buffer without valid timestamp");
- return g_strdup ("");
- }
-
- GST_DEBUG ("buffer with timestamp %" GST_TIME_FORMAT, GST_TIME_ARGS (time));
-
- txt = g_strdup (overlay->default_text);
-
- time_str = gst_time_overlay_render_time (GST_TIME_OVERLAY (overlay), time);
- if (txt != NULL && *txt != '\0') {
- ret = g_strdup_printf ("%s %s", txt, time_str);
- } else {
- ret = time_str;
- time_str = NULL;
- }
-
- g_free (txt);
- g_free (time_str);
-
- return ret;
-}
-
-static void
-gst_time_overlay_class_init (GstTimeOverlayClass * klass)
-{
- GstTextOverlayClass *gsttextoverlay_class;
-
- gsttextoverlay_class = (GstTextOverlayClass *) klass;
-
- gsttextoverlay_class->get_text = gst_time_overlay_get_text;
-}
-
-static void
-gst_time_overlay_init (GstTimeOverlay * overlay, GstTimeOverlayClass * klass)
-{
- PangoFontDescription *font_description;
- GstTextOverlay *textoverlay;
- PangoContext *context;
-
- textoverlay = GST_TEXT_OVERLAY (overlay);
-
- context = GST_TEXT_OVERLAY_CLASS (klass)->pango_context;
-
- pango_context_set_language (context, pango_language_from_string ("en_US"));
- pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);
-
- font_description = pango_font_description_new ();
- pango_font_description_set_family_static (font_description, "Monospace");
- pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL);
- pango_font_description_set_variant (font_description, PANGO_VARIANT_NORMAL);
- pango_font_description_set_weight (font_description, PANGO_WEIGHT_NORMAL);
- pango_font_description_set_stretch (font_description, PANGO_STRETCH_NORMAL);
- pango_font_description_set_size (font_description, 18 * PANGO_SCALE);
- pango_context_set_font_description (context, font_description);
- pango_font_description_free (font_description);
-
- textoverlay->valign = GST_TEXT_OVERLAY_VALIGN_TOP;
- textoverlay->halign = GST_TEXT_OVERLAY_HALIGN_LEFT;
-}
diff --git a/ext/pango/gsttimeoverlay.h b/ext/pango/gsttimeoverlay.h
deleted file mode 100644
index 5fbfba97..00000000
--- a/ext/pango/gsttimeoverlay.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_TIME_OVERLAY_H__
-#define __GST_TIME_OVERLAY_H__
-
-#include "gsttextoverlay.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_TIME_OVERLAY \
- (gst_time_overlay_get_type())
-#define GST_TIME_OVERLAY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TIME_OVERLAY,GstTimeOverlay))
-#define GST_TIME_OVERLAY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TIME_OVERLAY,GstTimeOverlayClass))
-#define GST_IS_TIME_OVERLAY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TIME_OVERLAY))
-#define GST_IS_TIME_OVERLAY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TIME_OVERLAY))
-
-typedef struct _GstTimeOverlay GstTimeOverlay;
-typedef struct _GstTimeOverlayClass GstTimeOverlayClass;
-
-/**
- * GstTimeOverlay:
- *
- * Opaque timeoverlay data structure.
- */
-struct _GstTimeOverlay {
- GstTextOverlay textoverlay;
-};
-
-struct _GstTimeOverlayClass {
- GstTextOverlayClass parent_class;
-};
-
-GType gst_time_overlay_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_TIME_OVERLAY_H__ */
-
diff --git a/ext/theora/Makefile.am b/ext/theora/Makefile.am
deleted file mode 100644
index 52164b04..00000000
--- a/ext/theora/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-plugin_LTLIBRARIES = libgsttheora.la
-
-noinst_HEADERS = gsttheoraenc.h \
- gsttheoradec.h \
- gsttheoraparse.h
-
-libgsttheora_la_SOURCES = gsttheora.c \
- gsttheoraenc.c \
- gsttheoradec.c \
- gsttheoraparse.c
-
-libgsttheora_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(THEORA_CFLAGS)
-libgsttheora_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/tag/libgsttag-$(GST_MAJORMINOR).la \
- $(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_MAJORMINOR).la \
- $(GST_LIBS) \
- $(THEORA_LIBS)
-libgsttheora_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgsttheora_la_LIBTOOLFLAGS = --tag=disable-static
-
diff --git a/ext/theora/gsttheora.c b/ext/theora/gsttheora.c
deleted file mode 100644
index 37f32114..00000000
--- a/ext/theora/gsttheora.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* GStreamer
- * Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-extern GType gst_theora_dec_get_type (void);
-extern GType gst_theora_enc_get_type (void);
-extern GType gst_theora_parse_get_type (void);
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_element_register (plugin, "theoradec", GST_RANK_PRIMARY,
- gst_theora_dec_get_type ()))
- return FALSE;
-
- if (!gst_element_register (plugin, "theoraenc", GST_RANK_PRIMARY,
- gst_theora_enc_get_type ()))
- return FALSE;
-
- if (!gst_element_register (plugin, "theoraparse", GST_RANK_NONE,
- gst_theora_parse_get_type ()))
- return FALSE;
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "theora",
- "Theora plugin library",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/theora/gsttheoradec.c b/ext/theora/gsttheoradec.c
deleted file mode 100644
index 7ec3e920..00000000
--- a/ext/theora/gsttheoradec.c
+++ /dev/null
@@ -1,1467 +0,0 @@
-/* GStreamer
- * Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-/**
- * SECTION:element-theoradec
- * @see_also: theoraenc, oggdemux
- *
- * This element decodes theora streams into raw video
- * <ulink url="http://www.theora.org/">Theora</ulink> is a royalty-free
- * video codec maintained by the <ulink url="http://www.xiph.org/">Xiph.org
- * Foundation</ulink>, based on the VP3 codec.
- *
- * <refsect2>
- * <title>Example pipeline</title>
- * |[
- * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! xvimagesink
- * ]| This example pipeline will decode an ogg stream and decodes the theora video. Refer to
- * the theoraenc example to create the ogg file.
- * </refsect2>
- *
- * Last reviewed on 2006-03-01 (0.10.4)
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "gsttheoradec.h"
-#include <gst/tag/tag.h>
-#include <gst/video/video.h>
-
-#define GST_CAT_DEFAULT theoradec_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-#define THEORA_DEF_CROP TRUE
-enum
-{
- ARG_0,
- ARG_CROP
-};
-
-static const GstElementDetails theora_dec_details =
-GST_ELEMENT_DETAILS ("Theora video decoder",
- "Codec/Decoder/Video",
- "decode raw theora streams to raw YUV video",
- "Benjamin Otte <in7y118@public.uni-hamburg.de>, "
- "Wim Taymans <wim@fluendo.com>");
-
-static GstStaticPadTemplate theora_dec_src_factory =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-yuv, "
- "format = (fourcc) { I420, Y42B, Y444 }, "
- "framerate = (fraction) [0/1, MAX], "
- "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
- );
-
-static GstStaticPadTemplate theora_dec_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-theora")
- );
-
-GST_BOILERPLATE (GstTheoraDec, gst_theora_dec, GstElement, GST_TYPE_ELEMENT);
-
-static void theora_dec_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void theora_dec_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-
-static gboolean theora_dec_sink_event (GstPad * pad, GstEvent * event);
-static gboolean theora_dec_setcaps (GstPad * pad, GstCaps * caps);
-static GstFlowReturn theora_dec_chain (GstPad * pad, GstBuffer * buffer);
-static GstStateChangeReturn theora_dec_change_state (GstElement * element,
- GstStateChange transition);
-static gboolean theora_dec_src_event (GstPad * pad, GstEvent * event);
-static gboolean theora_dec_src_query (GstPad * pad, GstQuery * query);
-static gboolean theora_dec_src_convert (GstPad * pad,
- GstFormat src_format, gint64 src_value,
- GstFormat * dest_format, gint64 * dest_value);
-
-#if 0
-static const GstFormat *theora_get_formats (GstPad * pad);
-#endif
-#if 0
-static const GstEventMask *theora_get_event_masks (GstPad * pad);
-#endif
-static const GstQueryType *theora_get_query_types (GstPad * pad);
-
-
-static void
-gst_theora_dec_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&theora_dec_src_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&theora_dec_sink_factory));
- gst_element_class_set_details (element_class, &theora_dec_details);
-}
-
-static void
-gst_theora_dec_class_init (GstTheoraDecClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-
- gobject_class->set_property = theora_dec_set_property;
- gobject_class->get_property = theora_dec_get_property;
-
- g_object_class_install_property (gobject_class, ARG_CROP,
- g_param_spec_boolean ("crop", "Crop",
- "Crop the image to the visible region", THEORA_DEF_CROP,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstelement_class->change_state = theora_dec_change_state;
-
- GST_DEBUG_CATEGORY_INIT (theoradec_debug, "theoradec", 0, "Theora decoder");
-}
-
-static void
-gst_theora_dec_init (GstTheoraDec * dec, GstTheoraDecClass * g_class)
-{
- dec->sinkpad =
- gst_pad_new_from_static_template (&theora_dec_sink_factory, "sink");
- gst_pad_set_event_function (dec->sinkpad, theora_dec_sink_event);
- gst_pad_set_setcaps_function (dec->sinkpad, theora_dec_setcaps);
- gst_pad_set_chain_function (dec->sinkpad, theora_dec_chain);
- gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad);
-
- dec->srcpad =
- gst_pad_new_from_static_template (&theora_dec_src_factory, "src");
- gst_pad_set_event_function (dec->srcpad, theora_dec_src_event);
- gst_pad_set_query_type_function (dec->srcpad, theora_get_query_types);
- gst_pad_set_query_function (dec->srcpad, theora_dec_src_query);
- gst_pad_use_fixed_caps (dec->srcpad);
-
- gst_element_add_pad (GST_ELEMENT (dec), dec->srcpad);
-
- dec->crop = THEORA_DEF_CROP;
- dec->gather = NULL;
- dec->decode = NULL;
- dec->queued = NULL;
- dec->pendingevents = NULL;
-}
-
-static void
-gst_theora_dec_reset (GstTheoraDec * dec)
-{
- dec->need_keyframe = TRUE;
- dec->last_timestamp = -1;
- dec->discont = TRUE;
- dec->frame_nr = -1;
- dec->seqnum = gst_util_seqnum_next ();
- gst_segment_init (&dec->segment, GST_FORMAT_TIME);
-
- GST_OBJECT_LOCK (dec);
- dec->proportion = 1.0;
- dec->earliest_time = -1;
- GST_OBJECT_UNLOCK (dec);
-
- g_list_foreach (dec->queued, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (dec->queued);
- dec->queued = NULL;
- g_list_foreach (dec->gather, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (dec->gather);
- dec->gather = NULL;
- g_list_foreach (dec->decode, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (dec->decode);
- dec->decode = NULL;
- g_list_foreach (dec->pendingevents, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (dec->pendingevents);
- dec->pendingevents = NULL;
-
- if (dec->tags) {
- gst_tag_list_free (dec->tags);
- dec->tags = NULL;
- }
-}
-
-#if 0
-static const GstFormat *
-theora_get_formats (GstPad * pad)
-{
- static GstFormat src_formats[] = {
- GST_FORMAT_DEFAULT, /* frames in this case */
- GST_FORMAT_TIME,
- GST_FORMAT_BYTES,
- 0
- };
- static GstFormat sink_formats[] = {
- GST_FORMAT_DEFAULT,
- GST_FORMAT_TIME,
- 0
- };
-
- return (GST_PAD_IS_SRC (pad) ? src_formats : sink_formats);
-}
-#endif
-
-#if 0
-static const GstEventMask *
-theora_get_event_masks (GstPad * pad)
-{
- static const GstEventMask theora_src_event_masks[] = {
- {GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH},
- {0,}
- };
-
- return theora_src_event_masks;
-}
-#endif
-
-static const GstQueryType *
-theora_get_query_types (GstPad * pad)
-{
- static const GstQueryType theora_src_query_types[] = {
- GST_QUERY_POSITION,
- GST_QUERY_DURATION,
- GST_QUERY_CONVERT,
- 0
- };
-
- return theora_src_query_types;
-}
-
-
-static gboolean
-theora_dec_src_convert (GstPad * pad,
- GstFormat src_format, gint64 src_value,
- GstFormat * dest_format, gint64 * dest_value)
-{
- gboolean res = TRUE;
- GstTheoraDec *dec;
- guint64 scale = 1;
-
- if (src_format == *dest_format) {
- *dest_value = src_value;
- return TRUE;
- }
-
- dec = GST_THEORA_DEC (gst_pad_get_parent (pad));
-
- /* we need the info part before we can done something */
- if (!dec->have_header)
- goto no_header;
-
- switch (src_format) {
- case GST_FORMAT_BYTES:
- switch (*dest_format) {
- case GST_FORMAT_DEFAULT:
- *dest_value = gst_util_uint64_scale_int (src_value, 8,
- dec->info.pic_height * dec->info.pic_width * dec->output_bpp);
- break;
- case GST_FORMAT_TIME:
- /* seems like a rather silly conversion, implement me if you like */
- default:
- res = FALSE;
- }
- break;
- case GST_FORMAT_TIME:
- switch (*dest_format) {
- case GST_FORMAT_BYTES:
- scale =
- dec->output_bpp * (dec->info.pic_width * dec->info.pic_height) /
- 8;
- case GST_FORMAT_DEFAULT:
- *dest_value = scale * gst_util_uint64_scale (src_value,
- dec->info.fps_numerator, dec->info.fps_denominator * GST_SECOND);
- break;
- default:
- res = FALSE;
- }
- break;
- case GST_FORMAT_DEFAULT:
- switch (*dest_format) {
- case GST_FORMAT_TIME:
- *dest_value = gst_util_uint64_scale (src_value,
- GST_SECOND * dec->info.fps_denominator, dec->info.fps_numerator);
- break;
- case GST_FORMAT_BYTES:
- *dest_value = gst_util_uint64_scale_int (src_value,
- dec->output_bpp * dec->info.pic_width * dec->info.pic_height, 8);
- break;
- default:
- res = FALSE;
- }
- break;
- default:
- res = FALSE;
- }
-done:
- gst_object_unref (dec);
- return res;
-
- /* ERRORS */
-no_header:
- {
- GST_DEBUG_OBJECT (dec, "no header yet, cannot convert");
- res = FALSE;
- goto done;
- }
-}
-
-#if 0
-static gboolean
-theora_dec_sink_convert (GstPad * pad,
- GstFormat src_format, gint64 src_value,
- GstFormat * dest_format, gint64 * dest_value)
-{
- gboolean res = TRUE;
- GstTheoraDec *dec;
-
- if (src_format == *dest_format) {
- *dest_value = src_value;
- return TRUE;
- }
-
- dec = GST_THEORA_DEC (gst_pad_get_parent (pad));
-
- /* we need the info part before we can done something */
- if (!dec->have_header)
- goto no_header;
-
- switch (src_format) {
- case GST_FORMAT_DEFAULT:
- switch (*dest_format) {
- case GST_FORMAT_TIME:
- *dest_value = _theora_granule_start_time (dec, src_value);
- break;
- default:
- res = FALSE;
- }
- break;
- case GST_FORMAT_TIME:
- switch (*dest_format) {
- case GST_FORMAT_DEFAULT:
- {
- guint rest;
-
- /* framecount */
- *dest_value = gst_util_uint64_scale (src_value,
- dec->info.fps_numerator, GST_SECOND * dec->info.fps_denominator);
-
- /* funny way of calculating granulepos in theora */
- rest = *dest_value / dec->info.keyframe_granule_shift;
- *dest_value -= rest;
- *dest_value <<= dec->granule_shift;
- *dest_value += rest;
- break;
- }
- default:
- res = FALSE;
- break;
- }
- break;
- default:
- res = FALSE;
- }
-done:
- gst_object_unref (dec);
- return res;
-
- /* ERRORS */
-no_header:
- {
- GST_DEBUG_OBJECT (dec, "no header yet, cannot convert");
- res = FALSE;
- goto done;
- }
-}
-#endif
-
-static gboolean
-theora_dec_src_query (GstPad * pad, GstQuery * query)
-{
- GstTheoraDec *dec;
-
- gboolean res = FALSE;
-
- dec = GST_THEORA_DEC (gst_pad_get_parent (pad));
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_POSITION:
- {
- gint64 value;
- GstFormat format;
- gint64 time;
-
- /* parse format */
- gst_query_parse_position (query, &format, NULL);
-
- time = dec->last_timestamp;
- time = gst_segment_to_stream_time (&dec->segment, GST_FORMAT_TIME, time);
-
- GST_LOG_OBJECT (dec,
- "query %p: our time: %" GST_TIME_FORMAT, query, GST_TIME_ARGS (time));
-
- if (!(res =
- theora_dec_src_convert (pad, GST_FORMAT_TIME, time, &format,
- &value)))
- goto error;
-
- gst_query_set_position (query, format, value);
-
- GST_LOG_OBJECT (dec,
- "query %p: we return %" G_GINT64_FORMAT " (format %u)", query, value,
- format);
- break;
- }
- case GST_QUERY_DURATION:
- {
- /* forward to peer for total */
- res = gst_pad_peer_query (dec->sinkpad, query);
- if (!res)
- goto error;
-
- break;
- }
- case GST_QUERY_CONVERT:
- {
- GstFormat src_fmt, dest_fmt;
- gint64 src_val, dest_val;
-
- gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
- if (!(res =
- theora_dec_src_convert (pad, src_fmt, src_val, &dest_fmt,
- &dest_val)))
- goto error;
-
- gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
- break;
- }
- default:
- res = gst_pad_query_default (pad, query);
- break;
- }
-done:
- gst_object_unref (dec);
-
- return res;
-
- /* ERRORS */
-error:
- {
- GST_DEBUG_OBJECT (dec, "query failed");
- goto done;
- }
-}
-
-static gboolean
-theora_dec_src_event (GstPad * pad, GstEvent * event)
-{
- gboolean res = TRUE;
- GstTheoraDec *dec;
-
- dec = GST_THEORA_DEC (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:
- {
- GstFormat format, tformat;
- gdouble rate;
- GstEvent *real_seek;
- GstSeekFlags flags;
- GstSeekType cur_type, stop_type;
- gint64 cur, stop;
- gint64 tcur, tstop;
- guint32 seqnum;
-
- gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur,
- &stop_type, &stop);
- seqnum = gst_event_get_seqnum (event);
- gst_event_unref (event);
-
- /* we have to ask our peer to seek to time here as we know
- * nothing about how to generate a granulepos from the src
- * formats or anything.
- *
- * First bring the requested format to time
- */
- tformat = GST_FORMAT_TIME;
- if (!(res = theora_dec_src_convert (pad, format, cur, &tformat, &tcur)))
- goto convert_error;
- if (!(res = theora_dec_src_convert (pad, format, stop, &tformat, &tstop)))
- goto convert_error;
-
- /* then seek with time on the peer */
- real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME,
- flags, cur_type, tcur, stop_type, tstop);
- gst_event_set_seqnum (real_seek, seqnum);
-
- res = gst_pad_push_event (dec->sinkpad, real_seek);
- break;
- }
- case GST_EVENT_QOS:
- {
- gdouble proportion;
- GstClockTimeDiff diff;
- GstClockTime timestamp;
-
- gst_event_parse_qos (event, &proportion, &diff, &timestamp);
-
- /* we cannot randomly skip frame decoding since we don't have
- * B frames. we can however use the timestamp and diff to not
- * push late frames. This would at least save us the time to
- * crop/memcpy the data. */
- GST_OBJECT_LOCK (dec);
- dec->proportion = proportion;
- dec->earliest_time = timestamp + diff;
- GST_OBJECT_UNLOCK (dec);
-
- GST_DEBUG_OBJECT (dec, "got QoS %" GST_TIME_FORMAT ", %" G_GINT64_FORMAT,
- GST_TIME_ARGS (timestamp), diff);
-
- res = gst_pad_push_event (dec->sinkpad, event);
- break;
- }
- default:
- res = gst_pad_push_event (dec->sinkpad, event);
- break;
- }
-done:
- gst_object_unref (dec);
-
- return res;
-
- /* ERRORS */
-convert_error:
- {
- GST_DEBUG_OBJECT (dec, "could not convert format");
- goto done;
- }
-}
-
-static gboolean
-theora_dec_sink_event (GstPad * pad, GstEvent * event)
-{
- gboolean ret = FALSE;
- GstTheoraDec *dec;
-
- dec = GST_THEORA_DEC (gst_pad_get_parent (pad));
-
- GST_LOG_OBJECT (dec, "handling event");
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_START:
- ret = gst_pad_push_event (dec->srcpad, event);
- break;
- case GST_EVENT_FLUSH_STOP:
- gst_theora_dec_reset (dec);
- ret = gst_pad_push_event (dec->srcpad, event);
- break;
- case GST_EVENT_EOS:
- ret = gst_pad_push_event (dec->srcpad, event);
- break;
- case GST_EVENT_NEWSEGMENT:
- {
- gboolean update;
- GstFormat format;
- gdouble rate, arate;
- gint64 start, stop, time;
-
- gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
- &start, &stop, &time);
-
- /* we need TIME format */
- if (format != GST_FORMAT_TIME)
- goto newseg_wrong_format;
-
- GST_DEBUG_OBJECT (dec,
- "newsegment: update %d, rate %g, arate %g, start %" GST_TIME_FORMAT
- ", stop %" GST_TIME_FORMAT ", time %" GST_TIME_FORMAT,
- update, rate, arate, GST_TIME_ARGS (start), GST_TIME_ARGS (stop),
- GST_TIME_ARGS (time));
-
- /* now configure the values */
- gst_segment_set_newsegment_full (&dec->segment, update,
- rate, arate, format, start, stop, time);
- dec->seqnum = gst_event_get_seqnum (event);
-
- /* We don't forward this unless/until the decoder is initialised */
- if (dec->have_header) {
- ret = gst_pad_push_event (dec->srcpad, event);
- } else {
- dec->pendingevents = g_list_append (dec->pendingevents, event);
- ret = TRUE;
- }
- break;
- }
- case GST_EVENT_TAG:
- {
- if (dec->have_header)
- /* and forward */
- ret = gst_pad_push_event (dec->srcpad, event);
- else {
- /* store it to send once we're initialized */
- dec->pendingevents = g_list_append (dec->pendingevents, event);
- ret = TRUE;
- }
- break;
- }
- default:
- ret = gst_pad_push_event (dec->srcpad, event);
- break;
- }
-done:
- gst_object_unref (dec);
-
- return ret;
-
- /* ERRORS */
-newseg_wrong_format:
- {
- GST_DEBUG_OBJECT (dec, "received non TIME newsegment");
- gst_event_unref (event);
- goto done;
- }
-}
-
-static gboolean
-theora_dec_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstTheoraDec *dec;
- GstStructure *s;
- const GValue *codec_data;
-
- dec = GST_THEORA_DEC (gst_pad_get_parent (pad));
-
- s = gst_caps_get_structure (caps, 0);
-
- /* parse the par, this overrides the encoded par */
- dec->have_par = gst_structure_get_fraction (s, "pixel-aspect-ratio",
- &dec->par_num, &dec->par_den);
-
- if ((codec_data = gst_structure_get_value (s, "codec_data"))) {
- if (G_VALUE_TYPE (codec_data) == GST_TYPE_BUFFER) {
- GstBuffer *buffer;
- guint8 *data;
- guint size;
- guint offset;
-
- buffer = gst_value_get_buffer (codec_data);
-
- offset = 0;
- size = GST_BUFFER_SIZE (buffer);
- data = GST_BUFFER_DATA (buffer);
-
- while (size > 2) {
- guint psize;
- GstBuffer *buf;
-
- psize = (data[0] << 8) | data[1];
- /* skip header */
- data += 2;
- size -= 2;
- offset += 2;
-
- /* make sure we don't read too much */
- psize = MIN (psize, size);
-
- buf = gst_buffer_create_sub (buffer, offset, psize);
-
- /* first buffer is a discont buffer */
- if (offset == 2)
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
-
- /* now feed it to the decoder we can ignore the error */
- theora_dec_chain (pad, buf);
-
- /* skip the data */
- size -= psize;
- data += psize;
- offset += psize;
- }
- }
- }
-
- gst_object_unref (dec);
-
- return TRUE;
-}
-
-static GstFlowReturn
-theora_handle_comment_packet (GstTheoraDec * dec, ogg_packet * packet)
-{
- gchar *encoder = NULL;
- GstBuffer *buf;
- GstTagList *list;
-
- GST_DEBUG_OBJECT (dec, "parsing comment packet");
-
- buf = gst_buffer_new ();
- GST_BUFFER_SIZE (buf) = packet->bytes;
- GST_BUFFER_DATA (buf) = packet->packet;
-
- list =
- gst_tag_list_from_vorbiscomment_buffer (buf, (guint8 *) "\201theora", 7,
- &encoder);
-
- gst_buffer_unref (buf);
-
- if (!list) {
- GST_ERROR_OBJECT (dec, "couldn't decode comments");
- list = gst_tag_list_new ();
- }
- if (encoder) {
- gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
- GST_TAG_ENCODER, encoder, NULL);
- g_free (encoder);
- }
- gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
- GST_TAG_ENCODER_VERSION, dec->info.version_major,
- GST_TAG_VIDEO_CODEC, "Theora", NULL);
-
- if (dec->info.target_bitrate > 0) {
- gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
- GST_TAG_BITRATE, dec->info.target_bitrate,
- GST_TAG_NOMINAL_BITRATE, dec->info.target_bitrate, NULL);
- }
-
- dec->tags = list;
-
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-theora_handle_type_packet (GstTheoraDec * dec, ogg_packet * packet)
-{
- GstCaps *caps;
- gint par_num, par_den;
- GstFlowReturn ret = GST_FLOW_OK;
- GList *walk;
- guint32 fourcc;
-
- GST_DEBUG_OBJECT (dec, "fps %d/%d, PAR %d/%d",
- dec->info.fps_numerator, dec->info.fps_denominator,
- dec->info.aspect_numerator, dec->info.aspect_denominator);
-
- /* calculate par
- * the info.aspect_* values reflect PAR;
- * 0:x and x:0 are allowed and can be interpreted as 1:1.
- */
- if (dec->have_par) {
- /* we had a par on the sink caps, override the encoded par */
- GST_DEBUG_OBJECT (dec, "overriding with input PAR");
- par_num = dec->par_num;
- par_den = dec->par_den;
- } else {
- /* take encoded par */
- par_num = dec->info.aspect_numerator;
- par_den = dec->info.aspect_denominator;
- }
- if (par_num == 0 || par_den == 0) {
- par_num = par_den = 1;
- }
- /* theora has:
- *
- * width/height : dimension of the encoded frame
- * pic_width/pic_height : dimension of the visible part
- * pic_x/pic_y : offset in encoded frame where visible part starts
- */
- GST_DEBUG_OBJECT (dec, "dimension %dx%d, PAR %d/%d", dec->info.pic_width,
- dec->info.pic_height, par_num, par_den);
- GST_DEBUG_OBJECT (dec, "frame dimension %dx%d, offset %d:%d",
- dec->info.pic_width, dec->info.pic_height,
- dec->info.pic_x, dec->info.pic_y);
-
- if (dec->info.pixel_fmt == TH_PF_420) {
- dec->output_bpp = 12; /* Average bits per pixel. */
- fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0');
- } else if (dec->info.pixel_fmt == TH_PF_422) {
- dec->output_bpp = 16;
- fourcc = GST_MAKE_FOURCC ('Y', '4', '2', 'B');
- } else if (dec->info.pixel_fmt == TH_PF_444) {
- dec->output_bpp = 24;
- fourcc = GST_MAKE_FOURCC ('Y', '4', '4', '4');
- } else {
- GST_ERROR_OBJECT (dec, "Invalid pixel format %d", dec->info.pixel_fmt);
- return GST_FLOW_ERROR;
- }
-
- if (dec->crop) {
- dec->width = dec->info.pic_width;
- dec->height = dec->info.pic_height;
- dec->offset_x = dec->info.pic_x;
- dec->offset_y = dec->info.pic_y;
- /* Ensure correct offsets in chroma for formats that need it
- * by rounding the offset. libtheora will add proper pixels,
- * so no need to handle them ourselves. */
- if (dec->offset_x & 1 && dec->info.pixel_fmt != TH_PF_444) {
- dec->offset_x--;
- dec->width++;
- }
- if (dec->offset_y & 1 && dec->info.pixel_fmt == TH_PF_420) {
- dec->offset_y--;
- dec->height++;
- }
- } else {
- /* no cropping, use the encoded dimensions */
- dec->width = dec->info.frame_width;
- dec->height = dec->info.frame_height;
- dec->offset_x = 0;
- dec->offset_y = 0;
- }
-
- GST_DEBUG_OBJECT (dec, "after fixup frame dimension %dx%d, offset %d:%d",
- dec->width, dec->height, dec->offset_x, dec->offset_y);
-
- /* done */
- dec->decoder = th_decode_alloc (&dec->info, dec->setup);
-
- caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, fourcc,
- "framerate", GST_TYPE_FRACTION,
- dec->info.fps_numerator, dec->info.fps_denominator,
- "pixel-aspect-ratio", GST_TYPE_FRACTION, par_num, par_den,
- "width", G_TYPE_INT, dec->width, "height", G_TYPE_INT, dec->height, NULL);
- gst_pad_set_caps (dec->srcpad, caps);
- gst_caps_unref (caps);
-
- dec->have_header = TRUE;
-
- if (dec->pendingevents) {
- for (walk = dec->pendingevents; walk; walk = g_list_next (walk))
- gst_pad_push_event (dec->srcpad, GST_EVENT_CAST (walk->data));
- g_list_free (dec->pendingevents);
- dec->pendingevents = NULL;
- }
-
- if (dec->tags) {
- gst_element_found_tags_for_pad (GST_ELEMENT_CAST (dec), dec->srcpad,
- dec->tags);
- dec->tags = NULL;
- }
-
- return ret;
-}
-
-static GstFlowReturn
-theora_handle_header_packet (GstTheoraDec * dec, ogg_packet * packet)
-{
- GstFlowReturn res;
- int ret;
-
- GST_DEBUG_OBJECT (dec, "parsing header packet");
-
- ret = th_decode_headerin (&dec->info, &dec->comment, &dec->setup, packet);
- if (ret < 0)
- goto header_read_error;
-
- switch (packet->packet[0]) {
- case 0x81:
- res = theora_handle_comment_packet (dec, packet);
- break;
- case 0x82:
- res = theora_handle_type_packet (dec, packet);
- break;
- default:
- /* ignore */
- g_warning ("unknown theora header packet found");
- case 0x80:
- /* nothing special, this is the identification header */
- res = GST_FLOW_OK;
- break;
- }
- return res;
-
- /* ERRORS */
-header_read_error:
- {
- GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE,
- (NULL), ("couldn't read header packet"));
- return GST_FLOW_ERROR;
- }
-}
-
-/* returns TRUE if buffer is within segment, else FALSE.
- * if Buffer is on segment border, it's timestamp and duration will be clipped */
-static gboolean
-clip_buffer (GstTheoraDec * dec, GstBuffer * buf)
-{
- gboolean res = TRUE;
- GstClockTime in_ts, in_dur, stop;
- gint64 cstart, cstop;
-
- in_ts = GST_BUFFER_TIMESTAMP (buf);
- in_dur = GST_BUFFER_DURATION (buf);
-
- GST_LOG_OBJECT (dec,
- "timestamp:%" GST_TIME_FORMAT " , duration:%" GST_TIME_FORMAT,
- GST_TIME_ARGS (in_ts), GST_TIME_ARGS (in_dur));
-
- /* can't clip without TIME segment */
- if (dec->segment.format != GST_FORMAT_TIME)
- goto beach;
-
- /* we need a start time */
- if (!GST_CLOCK_TIME_IS_VALID (in_ts))
- goto beach;
-
- /* generate valid stop, if duration unknown, we have unknown stop */
- stop =
- GST_CLOCK_TIME_IS_VALID (in_dur) ? (in_ts + in_dur) : GST_CLOCK_TIME_NONE;
-
- /* now clip */
- if (!(res = gst_segment_clip (&dec->segment, GST_FORMAT_TIME,
- in_ts, stop, &cstart, &cstop)))
- goto beach;
-
- /* update timestamp and possibly duration if the clipped stop time is
- * valid */
- GST_BUFFER_TIMESTAMP (buf) = cstart;
- if (GST_CLOCK_TIME_IS_VALID (cstop))
- GST_BUFFER_DURATION (buf) = cstop - cstart;
-
-beach:
- GST_LOG_OBJECT (dec, "%sdropping", (res ? "not " : ""));
- return res;
-}
-
-static GstFlowReturn
-theora_dec_push_forward (GstTheoraDec * dec, GstBuffer * buf)
-{
- GstFlowReturn result = GST_FLOW_OK;
-
- if (clip_buffer (dec, buf)) {
- if (dec->discont) {
- GST_LOG_OBJECT (dec, "setting DISCONT");
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
- dec->discont = FALSE;
- }
- result = gst_pad_push (dec->srcpad, buf);
- } else {
- gst_buffer_unref (buf);
- }
-
- return result;
-}
-
-static GstFlowReturn
-theora_dec_push_reverse (GstTheoraDec * dec, GstBuffer * buf)
-{
- GstFlowReturn result = GST_FLOW_OK;
-
- dec->queued = g_list_prepend (dec->queued, buf);
-
- return result;
-}
-
-/* Allocate buffer and copy image data into Y444 format */
-static GstFlowReturn
-theora_handle_image (GstTheoraDec * dec, th_ycbcr_buffer buf, GstBuffer ** out)
-{
- gint width, height, stride;
- GstFlowReturn result;
- int i, plane;
- GstVideoFormat format;
- guint8 *dest, *src;
-
- switch (dec->info.pixel_fmt) {
- case TH_PF_444:
- format = GST_VIDEO_FORMAT_Y444;
- break;
- case TH_PF_420:
- format = GST_VIDEO_FORMAT_I420;
- break;
- case TH_PF_422:
- format = GST_VIDEO_FORMAT_Y42B;
- break;
- default:
- g_assert_not_reached ();
- }
-
- result =
- gst_pad_alloc_buffer_and_set_caps (dec->srcpad, GST_BUFFER_OFFSET_NONE,
- gst_video_format_get_size (format, dec->width, dec->height),
- GST_PAD_CAPS (dec->srcpad), out);
- if (G_UNLIKELY (result != GST_FLOW_OK)) {
- GST_DEBUG_OBJECT (dec, "could not get buffer, reason: %s",
- gst_flow_get_name (result));
- return result;
- }
-
- for (plane = 0; plane < 3; plane++) {
- width = gst_video_format_get_component_width (format, plane, dec->width);
- height = gst_video_format_get_component_height (format, plane, dec->height);
- stride = gst_video_format_get_row_stride (format, plane, dec->width);
-
- dest =
- GST_BUFFER_DATA (*out) + gst_video_format_get_component_offset (format,
- plane, dec->width, dec->height);
- src = buf[plane].data;
- src += ((height == dec->height) ? dec->offset_y : dec->offset_y / 2)
- * buf[plane].stride;
- src += (width == dec->width) ? dec->offset_x : dec->offset_x / 2;
-
- for (i = 0; i < height; i++) {
- memcpy (dest, src, width);
-
- dest += stride;
- src += buf[plane].stride;
- }
- }
-
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-theora_handle_data_packet (GstTheoraDec * dec, ogg_packet * packet,
- GstClockTime outtime, GstClockTime outdur)
-{
- /* normal data packet */
- th_ycbcr_buffer buf;
- GstBuffer *out;
- gboolean keyframe;
- GstFlowReturn result;
- ogg_int64_t gp;
-
- if (G_UNLIKELY (!dec->have_header))
- goto not_initialized;
-
- /* get timestamp and durations */
- if (outtime == -1)
- outtime = dec->last_timestamp;
- if (outdur == -1)
- outdur = gst_util_uint64_scale_int (GST_SECOND, dec->info.fps_denominator,
- dec->info.fps_numerator);
-
- /* calculate expected next timestamp */
- if (outtime != -1 && outdur != -1)
- dec->last_timestamp = outtime + outdur;
-
- /* the second most significant bit of the first data byte is cleared
- * for keyframes. We can only check it if it's not a zero-length packet. */
- keyframe = packet->bytes && ((packet->packet[0] & 0x40) == 0);
- if (G_UNLIKELY (keyframe)) {
- GST_DEBUG_OBJECT (dec, "we have a keyframe");
- dec->need_keyframe = FALSE;
- } else if (G_UNLIKELY (dec->need_keyframe)) {
- goto dropping;
- }
-
- GST_DEBUG_OBJECT (dec, "parsing data packet");
-
- /* this does the decoding */
- if (G_UNLIKELY (th_decode_packetin (dec->decoder, packet, &gp) < 0))
- goto decode_error;
-
- if (outtime != -1) {
- gboolean need_skip;
- GstClockTime qostime;
-
- /* qos needs to be done on running time */
- qostime = gst_segment_to_running_time (&dec->segment, GST_FORMAT_TIME,
- outtime);
-
- GST_OBJECT_LOCK (dec);
- /* check for QoS, don't perform the last steps of getting and
- * pushing the buffers that are known to be late. */
- need_skip = dec->earliest_time != -1 && qostime <= dec->earliest_time;
- GST_OBJECT_UNLOCK (dec);
-
- if (need_skip)
- goto dropping_qos;
- }
-
- /* this does postprocessing and set up the decoded frame
- * pointers in our yuv variable */
- if (G_UNLIKELY (th_decode_ycbcr_out (dec->decoder, buf) < 0))
- goto no_yuv;
-
- if (G_UNLIKELY ((buf[0].width != dec->info.frame_width)
- || (buf[0].height != dec->info.frame_height)))
- goto wrong_dimensions;
-
- result = theora_handle_image (dec, buf, &out);
- if (result != GST_FLOW_OK)
- return result;
-
- GST_BUFFER_OFFSET (out) = dec->frame_nr;
- if (dec->frame_nr != -1)
- dec->frame_nr++;
- GST_BUFFER_OFFSET_END (out) = dec->frame_nr;
-
- GST_BUFFER_TIMESTAMP (out) = outtime;
- GST_BUFFER_DURATION (out) = outdur;
-
- if (dec->segment.rate >= 0.0)
- result = theora_dec_push_forward (dec, out);
- else
- result = theora_dec_push_reverse (dec, out);
-
- return result;
-
- /* ERRORS */
-not_initialized:
- {
- GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE,
- (NULL), ("no header sent yet"));
- return GST_FLOW_ERROR;
- }
-dropping:
- {
- GST_WARNING_OBJECT (dec, "dropping frame because we need a keyframe");
- dec->discont = TRUE;
- return GST_FLOW_OK;
- }
-dropping_qos:
- {
- if (dec->frame_nr != -1)
- dec->frame_nr++;
- dec->discont = TRUE;
- GST_WARNING_OBJECT (dec, "dropping frame because of QoS");
- return GST_FLOW_OK;
- }
-decode_error:
- {
- GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE,
- (NULL), ("theora decoder did not decode data packet"));
- return GST_FLOW_ERROR;
- }
-no_yuv:
- {
- GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE,
- (NULL), ("couldn't read out YUV image"));
- return GST_FLOW_ERROR;
- }
-wrong_dimensions:
- {
- GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, FORMAT,
- (NULL), ("dimensions of image do not match header"));
- return GST_FLOW_ERROR;
- }
-}
-
-static GstFlowReturn
-theora_dec_decode_buffer (GstTheoraDec * dec, GstBuffer * buf)
-{
- ogg_packet packet;
- GstFlowReturn result = GST_FLOW_OK;
- GstClockTime timestamp, duration;
-
- /* make ogg_packet out of the buffer */
- packet.packet = GST_BUFFER_DATA (buf);
- packet.bytes = GST_BUFFER_SIZE (buf);
- packet.granulepos = -1;
- packet.packetno = 0; /* we don't really care */
- packet.b_o_s = dec->have_header ? 0 : 1;
- /* EOS does not matter for the decoder */
- packet.e_o_s = 0;
-
- GST_LOG_OBJECT (dec, "decode buffer of size %ld", packet.bytes);
-
- /* save last seem timestamp for interpolating the next timestamps using the
- * framerate when we need to */
- timestamp = GST_BUFFER_TIMESTAMP (buf);
- duration = GST_BUFFER_DURATION (buf);
-
- GST_DEBUG_OBJECT (dec, "header=%02x, outtime=%" GST_TIME_FORMAT,
- packet.bytes ? packet.packet[0] : -1, GST_TIME_ARGS (timestamp));
-
- /* switch depending on packet type. A zero byte packet is always a data
- * packet; we don't dereference it in that case. */
- if (packet.bytes && packet.packet[0] & 0x80) {
- if (dec->have_header) {
- GST_WARNING_OBJECT (GST_OBJECT (dec), "Ignoring header");
- goto done;
- }
- result = theora_handle_header_packet (dec, &packet);
- } else {
- result = theora_handle_data_packet (dec, &packet, timestamp, duration);
- }
-
-done:
- return result;
-}
-
-/* For reverse playback we use a technique that can be used for
- * any keyframe based video codec.
- *
- * Input:
- * Buffer decoding order: 7 8 9 4 5 6 1 2 3 EOS
- * Keyframe flag: K K
- * Discont flag: D D D
- *
- * - Each Discont marks a discont in the decoding order.
- * - The keyframes mark where we can start decoding.
- *
- * First we prepend incomming buffers to the gather queue, whenever we receive
- * a discont, we flush out the gather queue.
- *
- * The above data will be accumulated in the gather queue like this:
- *
- * gather queue: 9 8 7
- * D
- *
- * Whe buffer 4 is received (with a DISCONT), we flush the gather queue like
- * this:
- *
- * while (gather)
- * take head of queue and prepend to decode queue.
- * if we copied a keyframe, decode the decode queue.
- *
- * After we flushed the gather queue, we add 4 to the (now empty) gather queue.
- * We get the following situation:
- *
- * gather queue: 4
- * decode queue: 7 8 9
- *
- * After we received 5 (Keyframe) and 6:
- *
- * gather queue: 6 5 4
- * decode queue: 7 8 9
- *
- * When we receive 1 (DISCONT) which triggers a flush of the gather queue:
- *
- * Copy head of the gather queue (6) to decode queue:
- *
- * gather queue: 5 4
- * decode queue: 6 7 8 9
- *
- * Copy head of the gather queue (5) to decode queue. This is a keyframe so we
- * can start decoding.
- *
- * gather queue: 4
- * decode queue: 5 6 7 8 9
- *
- * Decode frames in decode queue, store raw decoded data in output queue, we
- * can take the head of the decode queue and prepend the decoded result in the
- * output queue:
- *
- * gather queue: 4
- * decode queue:
- * output queue: 9 8 7 6 5
- *
- * Now output all the frames in the output queue, picking a frame from the
- * head of the queue.
- *
- * Copy head of the gather queue (4) to decode queue, we flushed the gather
- * queue and can now store input buffer in the gather queue:
- *
- * gather queue: 1
- * decode queue: 4
- *
- * When we receive EOS, the queue looks like:
- *
- * gather queue: 3 2 1
- * decode queue: 4
- *
- * Fill decode queue, first keyframe we copy is 2:
- *
- * gather queue: 1
- * decode queue: 2 3 4
- *
- * Decoded output:
- *
- * gather queue: 1
- * decode queue:
- * output queue: 4 3 2
- *
- * Leftover buffer 1 cannot be decoded and must be discarded.
- */
-static GstFlowReturn
-theora_dec_flush_decode (GstTheoraDec * dec)
-{
- GstFlowReturn res = GST_FLOW_OK;
-
- while (dec->decode) {
- GstBuffer *buf = GST_BUFFER_CAST (dec->decode->data);
-
- GST_DEBUG_OBJECT (dec, "decoding buffer %p, ts %" GST_TIME_FORMAT,
- buf, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
-
- /* decode buffer, prepend to output queue */
- res = theora_dec_decode_buffer (dec, buf);
-
- /* don't need it anymore now */
- gst_buffer_unref (buf);
-
- dec->decode = g_list_delete_link (dec->decode, dec->decode);
- }
- while (dec->queued) {
- GstBuffer *buf = GST_BUFFER_CAST (dec->queued->data);
-
- /* iterate ouput queue an push downstream */
- res = gst_pad_push (dec->srcpad, buf);
-
- dec->queued = g_list_delete_link (dec->queued, dec->queued);
- }
-
- return res;
-}
-
-static GstFlowReturn
-theora_dec_chain_reverse (GstTheoraDec * dec, gboolean discont, GstBuffer * buf)
-{
- GstFlowReturn res = GST_FLOW_OK;
-
- /* if we have a discont, move buffers to the decode list */
- if (G_UNLIKELY (discont)) {
- GST_DEBUG_OBJECT (dec, "received discont,gathering buffers");
- while (dec->gather) {
- GstBuffer *gbuf;
- guint8 *data;
-
- gbuf = GST_BUFFER_CAST (dec->gather->data);
- /* remove from the gather list */
- dec->gather = g_list_delete_link (dec->gather, dec->gather);
- /* copy to decode queue */
- dec->decode = g_list_prepend (dec->decode, gbuf);
-
- /* if we copied a keyframe, flush and decode the decode queue */
- data = GST_BUFFER_DATA (gbuf);
- if ((data[0] & 0x40) == 0) {
- GST_DEBUG_OBJECT (dec, "copied keyframe");
- res = theora_dec_flush_decode (dec);
- }
- }
- }
-
- /* add buffer to gather queue */
- GST_DEBUG_OBJECT (dec, "gathering buffer %p, size %u", buf,
- GST_BUFFER_SIZE (buf));
- dec->gather = g_list_prepend (dec->gather, buf);
-
- return res;
-}
-
-static GstFlowReturn
-theora_dec_chain_forward (GstTheoraDec * dec, gboolean discont,
- GstBuffer * buffer)
-{
- GstFlowReturn result;
-
- result = theora_dec_decode_buffer (dec, buffer);
-
- gst_buffer_unref (buffer);
-
- return result;
-}
-
-static GstFlowReturn
-theora_dec_chain (GstPad * pad, GstBuffer * buf)
-{
- GstTheoraDec *dec;
- GstFlowReturn res;
- gboolean discont;
-
- dec = GST_THEORA_DEC (gst_pad_get_parent (pad));
-
- /* peel of DISCONT flag */
- discont = GST_BUFFER_IS_DISCONT (buf);
-
- /* resync on DISCONT */
- if (G_UNLIKELY (discont)) {
- GST_DEBUG_OBJECT (dec, "received DISCONT buffer");
- dec->need_keyframe = TRUE;
- dec->last_timestamp = -1;
- dec->discont = TRUE;
- }
-
- if (dec->segment.rate > 0.0)
- res = theora_dec_chain_forward (dec, discont, buf);
- else
- res = theora_dec_chain_reverse (dec, discont, buf);
-
- gst_object_unref (dec);
-
- return res;
-}
-
-static GstStateChangeReturn
-theora_dec_change_state (GstElement * element, GstStateChange transition)
-{
- GstTheoraDec *dec = GST_THEORA_DEC (element);
- GstStateChangeReturn ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- th_info_clear (&dec->info);
- th_comment_clear (&dec->comment);
- GST_DEBUG_OBJECT (dec, "Setting have_header to FALSE in READY->PAUSED");
- dec->have_header = FALSE;
- dec->have_par = FALSE;
- gst_theora_dec_reset (dec);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- default:
- break;
- }
-
- ret = parent_class->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- th_info_clear (&dec->info);
- th_comment_clear (&dec->comment);
- th_setup_free (dec->setup);
- dec->setup = NULL;
- th_decode_free (dec->decoder);
- dec->decoder = NULL;
- gst_theora_dec_reset (dec);
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-static void
-theora_dec_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstTheoraDec *dec = GST_THEORA_DEC (object);
-
- switch (prop_id) {
- case ARG_CROP:
- dec->crop = g_value_get_boolean (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-theora_dec_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstTheoraDec *dec = GST_THEORA_DEC (object);
-
- switch (prop_id) {
- case ARG_CROP:
- g_value_set_boolean (value, dec->crop);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
diff --git a/ext/theora/gsttheoradec.h b/ext/theora/gsttheoradec.h
deleted file mode 100644
index 14f806cd..00000000
--- a/ext/theora/gsttheoradec.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* GStreamer
- * Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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_THEORADEC_H__
-#define __GST_THEORADEC_H__
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <theora/theoradec.h>
-#include <string.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_THEORA_DEC \
- (gst_theora_dec_get_type())
-#define GST_THEORA_DEC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_THEORA_DEC,GstTheoraDec))
-#define GST_THEORA_DEC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_THEORA_DEC,GstTheoraDecClass))
-#define GST_IS_THEORA_DEC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_THEORA_DEC))
-#define GST_IS_THEORA_DEC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_THEORA_DEC))
-
-typedef struct _GstTheoraDec GstTheoraDec;
-typedef struct _GstTheoraDecClass GstTheoraDecClass;
-
-/**
- * GstTheoraDec:
- *
- * Opaque object data structure.
- */
-struct _GstTheoraDec
-{
- GstElement element;
-
- /* Pads */
- GstPad *sinkpad;
- GstPad *srcpad;
-
- /* theora decoder state */
- th_dec_ctx *decoder;
- //theora_state state;
- th_setup_info *setup;
- th_info info;
- th_comment comment;
-
- gboolean have_header;
-
- GstClockTime last_timestamp;
- guint64 frame_nr; /* unused */
- gboolean need_keyframe;
- gint width, height;
- gint offset_x, offset_y;
- gint output_bpp;
-
- gboolean crop;
-
- /* list of buffers that need timestamps */
- GList *queued;
- /* list of raw output buffers */
- GList *output;
- /* gather/decode queues for reverse playback */
- GList *gather;
- GList *decode;
- GList *pendingevents;
-
- GstTagList *tags;
-
- /* segment info */ /* with STREAM_LOCK */
- GstSegment segment;
- gboolean discont;
- guint32 seqnum;
-
- /* QoS stuff */ /* with LOCK*/
- gdouble proportion;
- GstClockTime earliest_time;
-
- gboolean have_par;
- gint par_num;
- gint par_den;
-};
-
-struct _GstTheoraDecClass
-{
- GstElementClass parent_class;
-};
-
-G_END_DECLS
-
-#endif /* __GST_THEORADEC_H__ */
diff --git a/ext/theora/gsttheoraenc.c b/ext/theora/gsttheoraenc.c
deleted file mode 100644
index 121d3820..00000000
--- a/ext/theora/gsttheoraenc.c
+++ /dev/null
@@ -1,1256 +0,0 @@
-/* GStreamer
- * Copyright (C) 2004 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-theoraenc
- * @see_also: theoradec, oggmux
- *
- * This element encodes raw video into a Theora stream.
- * <ulink url="http://www.theora.org/">Theora</ulink> is a royalty-free
- * video codec maintained by the <ulink url="http://www.xiph.org/">Xiph.org
- * Foundation</ulink>, based on the VP3 codec.
- *
- * The theora codec internally only supports encoding of images that are a
- * multiple of 16 pixels in both X and Y direction. It is however perfectly
- * possible to encode images with other dimensions because an arbitrary
- * rectangular cropping region can be set up. This element will automatically
- * set up a correct cropping region if the dimensions are not multiples of 16
- * pixels.
- *
- * To control the quality of the encoding, the #GstTheoraEnc::bitrate and
- * #GstTheoraEnc::quality properties can be used. These two properties are
- * mutualy exclusive. Setting the bitrate property will produce a constant
- * bitrate (CBR) stream while setting the quality property will produce a
- * variable bitrate (VBR) stream.
- *
- * <refsect2>
- * <title>Example pipeline</title>
- * |[
- * gst-launch -v videotestsrc num-buffers=1000 ! theoraenc ! oggmux ! filesink location=videotestsrc.ogg
- * ]| This example pipeline will encode a test video source to theora muxed in an
- * ogg container. Refer to the theoradec documentation to decode the create
- * stream.
- * </refsect2>
- *
- * Last reviewed on 2006-03-01 (0.10.4)
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "gsttheoraenc.h"
-
-#include <string.h>
-#include <stdlib.h> /* free */
-
-#include <gst/tag/tag.h>
-#include <gst/video/video.h>
-
-#define GST_CAT_DEFAULT theoraenc_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-#define GST_TYPE_BORDER_MODE (gst_border_mode_get_type())
-static GType
-gst_border_mode_get_type (void)
-{
- static GType border_mode_type = 0;
- static const GEnumValue border_mode[] = {
- {BORDER_NONE, "No Border", "none"},
- {BORDER_BLACK, "Black Border", "black"},
- {BORDER_MIRROR, "Mirror image in borders", "mirror"},
- {0, NULL, NULL},
- };
-
- if (!border_mode_type) {
- border_mode_type =
- g_enum_register_static ("GstTheoraEncBorderMode", border_mode);
- }
- return border_mode_type;
-}
-
-/* taken from theora/lib/toplevel.c */
-static int
-_ilog (unsigned int v)
-{
- int ret = 0;
-
- while (v) {
- ret++;
- v >>= 1;
- }
- return (ret);
-}
-
-#define THEORA_DEF_BITRATE 0
-#define THEORA_DEF_QUALITY 48
-#define THEORA_DEF_KEYFRAME_AUTO TRUE
-#define THEORA_DEF_KEYFRAME_FREQ 64
-#define THEORA_DEF_KEYFRAME_FREQ_FORCE 64
-#define THEORA_DEF_SPEEDLEVEL 1
-#define THEORA_DEF_VP3_COMPATIBLE FALSE
-#define THEORA_DEF_DROP_FRAMES TRUE
-#define THEORA_DEF_CAP_OVERFLOW TRUE
-#define THEORA_DEF_CAP_UNDERFLOW FALSE
-#define THEORA_DEF_RATE_BUFFER 0
-enum
-{
- ARG_0,
- ARG_CENTER,
- ARG_BORDER,
- ARG_BITRATE,
- ARG_QUALITY,
- ARG_QUICK,
- ARG_KEYFRAME_AUTO,
- ARG_KEYFRAME_FREQ,
- ARG_KEYFRAME_FREQ_FORCE,
- ARG_KEYFRAME_THRESHOLD,
- ARG_KEYFRAME_MINDISTANCE,
- ARG_NOISE_SENSITIVITY,
- ARG_SHARPNESS,
- ARG_SPEEDLEVEL,
- ARG_VP3_COMPATIBLE,
- ARG_DROP_FRAMES,
- ARG_CAP_OVERFLOW,
- ARG_CAP_UNDERFLOW,
- ARG_RATE_BUFFER,
- /* FILL ME */
-};
-
-/* this function does a straight granulepos -> timestamp conversion */
-static GstClockTime
-granulepos_to_timestamp (GstTheoraEnc * theoraenc, ogg_int64_t granulepos)
-{
- guint64 iframe, pframe;
- int shift = theoraenc->info.keyframe_granule_shift;
-
- if (granulepos < 0)
- return GST_CLOCK_TIME_NONE;
-
- iframe = granulepos >> shift;
- pframe = granulepos - (iframe << shift);
-
- /* num and den are 32 bit, so we can safely multiply with GST_SECOND */
- return gst_util_uint64_scale ((guint64) (iframe + pframe),
- GST_SECOND * theoraenc->info.fps_denominator,
- theoraenc->info.fps_numerator);
-}
-
-static const GstElementDetails theora_enc_details =
-GST_ELEMENT_DETAILS ("Theora video encoder",
- "Codec/Encoder/Video",
- "encode raw YUV video to a theora stream",
- "Wim Taymans <wim@fluendo.com>");
-
-static GstStaticPadTemplate theora_enc_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-yuv, "
- "format = (fourcc) { I420, Y42B, Y444 }, "
- "framerate = (fraction) [0/1, MAX], "
- "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
- );
-
-static GstStaticPadTemplate theora_enc_src_factory =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-theora")
- );
-
-static void
-_do_init (GType object_type)
-{
- const GInterfaceInfo preset_interface_info = {
- NULL, /* interface_init */
- NULL, /* interface_finalize */
- NULL /* interface_data */
- };
-
- g_type_add_interface_static (object_type, GST_TYPE_PRESET,
- &preset_interface_info);
-}
-
-GST_BOILERPLATE_FULL (GstTheoraEnc, gst_theora_enc, GstElement,
- GST_TYPE_ELEMENT, _do_init);
-
-static gboolean theora_enc_sink_event (GstPad * pad, GstEvent * event);
-static gboolean theora_enc_src_event (GstPad * pad, GstEvent * event);
-static GstFlowReturn theora_enc_chain (GstPad * pad, GstBuffer * buffer);
-static GstStateChangeReturn theora_enc_change_state (GstElement * element,
- GstStateChange transition);
-static GstCaps *theora_enc_sink_getcaps (GstPad * pad);
-static gboolean theora_enc_sink_setcaps (GstPad * pad, GstCaps * caps);
-static void theora_enc_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void theora_enc_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void theora_enc_finalize (GObject * object);
-
-static void
-gst_theora_enc_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&theora_enc_src_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&theora_enc_sink_factory));
- gst_element_class_set_details (element_class, &theora_enc_details);
-}
-
-static void
-gst_theora_enc_class_init (GstTheoraEncClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-
- gobject_class->set_property = theora_enc_set_property;
- gobject_class->get_property = theora_enc_get_property;
- gobject_class->finalize = theora_enc_finalize;
-
- g_object_class_install_property (gobject_class, ARG_CENTER,
- g_param_spec_boolean ("center", "Center",
- "ignored and kept for API compat only", TRUE,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_BORDER,
- g_param_spec_enum ("border", "Border",
- "ignored and kept for API compat only",
- GST_TYPE_BORDER_MODE, BORDER_BLACK,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /* general encoding stream options */
- g_object_class_install_property (gobject_class, ARG_BITRATE,
- g_param_spec_int ("bitrate", "Bitrate", "Compressed video bitrate (kbps)",
- 0, (1 << 24) - 1, THEORA_DEF_BITRATE,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_QUALITY,
- g_param_spec_int ("quality", "Quality", "Video quality", 0, 63,
- THEORA_DEF_QUALITY,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_QUICK,
- g_param_spec_boolean ("quick", "Quick",
- "ignored and kept for API compat only", TRUE,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_KEYFRAME_AUTO,
- g_param_spec_boolean ("keyframe-auto", "Keyframe Auto",
- "Automatic keyframe detection", THEORA_DEF_KEYFRAME_AUTO,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_KEYFRAME_FREQ,
- g_param_spec_int ("keyframe-freq", "Keyframe frequency",
- "Keyframe frequency", 1, 32768, THEORA_DEF_KEYFRAME_FREQ,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_KEYFRAME_FREQ_FORCE,
- g_param_spec_int ("keyframe-force", "Keyframe force",
- "Force keyframe every N frames", 1, 32768,
- THEORA_DEF_KEYFRAME_FREQ_FORCE,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_KEYFRAME_THRESHOLD,
- g_param_spec_int ("keyframe-threshold", "Keyframe threshold",
- "ignored and kept for API compat only", 0, 32768, 80,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_KEYFRAME_MINDISTANCE,
- g_param_spec_int ("keyframe-mindistance", "Keyframe mindistance",
- "ignored and kept for API compat only", 1, 32768, 8,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_NOISE_SENSITIVITY,
- g_param_spec_int ("noise-sensitivity", "Noise sensitivity",
- "ignored and kept for API compat only", 0, 32768, 1,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_SHARPNESS,
- g_param_spec_int ("sharpness", "Sharpness",
- "ignored and kept for API compat only", 0, 2, 0,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_SPEEDLEVEL,
- g_param_spec_int ("speed-level", "Speed level",
- "Controls the amount of motion vector searching done while "
- "encoding. This property requires libtheora version >= 1.0",
- 0, 2, THEORA_DEF_SPEEDLEVEL,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_VP3_COMPATIBLE,
- g_param_spec_boolean ("vp3-compatible", "VP3 Compatible",
- "Disables non-VP3 compatible features."
- " This property requires libtheora version >= 1.1",
- THEORA_DEF_VP3_COMPATIBLE,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_DROP_FRAMES,
- g_param_spec_boolean ("drop-frames", "VP3 Compatible",
- "Allow or disallow frame dropping."
- " This property requires libtheora version >= 1.1",
- THEORA_DEF_DROP_FRAMES,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_CAP_OVERFLOW,
- g_param_spec_boolean ("cap-overflow", "VP3 Compatible",
- "Enable capping of bit reservoir overflows."
- " This property requires libtheora version >= 1.1",
- THEORA_DEF_CAP_OVERFLOW,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_CAP_UNDERFLOW,
- g_param_spec_boolean ("cap-underflow", "VP3 Compatible",
- "Enable capping of bit reservoir underflows."
- " This property requires libtheora version >= 1.1",
- THEORA_DEF_CAP_UNDERFLOW,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_RATE_BUFFER,
- g_param_spec_int ("rate-buffer", "Rate Control Buffer",
- "Sets the size of the rate control buffer, in units of frames. "
- "The default value of 0 instructs the encoder to automatically "
- "select an appropriate value."
- " This property requires libtheora version >= 1.1",
- 0, 1000, THEORA_DEF_RATE_BUFFER,
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstelement_class->change_state = theora_enc_change_state;
- GST_DEBUG_CATEGORY_INIT (theoraenc_debug, "theoraenc", 0, "Theora encoder");
-}
-
-static void
-gst_theora_enc_init (GstTheoraEnc * enc, GstTheoraEncClass * g_class)
-{
- enc->sinkpad =
- gst_pad_new_from_static_template (&theora_enc_sink_factory, "sink");
- gst_pad_set_chain_function (enc->sinkpad, theora_enc_chain);
- gst_pad_set_event_function (enc->sinkpad, theora_enc_sink_event);
- gst_pad_set_getcaps_function (enc->sinkpad, theora_enc_sink_getcaps);
- gst_pad_set_setcaps_function (enc->sinkpad, theora_enc_sink_setcaps);
- gst_element_add_pad (GST_ELEMENT (enc), enc->sinkpad);
-
- enc->srcpad =
- gst_pad_new_from_static_template (&theora_enc_src_factory, "src");
- gst_pad_set_event_function (enc->srcpad, theora_enc_src_event);
- gst_element_add_pad (GST_ELEMENT (enc), enc->srcpad);
-
- gst_segment_init (&enc->segment, GST_FORMAT_UNDEFINED);
-
- enc->video_bitrate = THEORA_DEF_BITRATE;
- enc->video_quality = THEORA_DEF_QUALITY;
- enc->keyframe_auto = THEORA_DEF_KEYFRAME_AUTO;
- enc->keyframe_freq = THEORA_DEF_KEYFRAME_FREQ;
- enc->keyframe_force = THEORA_DEF_KEYFRAME_FREQ_FORCE;
-
- enc->expected_ts = GST_CLOCK_TIME_NONE;
-
- enc->speed_level = THEORA_DEF_SPEEDLEVEL;
- enc->vp3_compatible = THEORA_DEF_VP3_COMPATIBLE;
- enc->drop_frames = THEORA_DEF_DROP_FRAMES;
- enc->cap_overflow = THEORA_DEF_CAP_OVERFLOW;
- enc->cap_underflow = THEORA_DEF_CAP_UNDERFLOW;
- enc->rate_buffer = THEORA_DEF_RATE_BUFFER;
-}
-
-static void
-theora_enc_finalize (GObject * object)
-{
- GstTheoraEnc *enc = GST_THEORA_ENC (object);
-
- GST_DEBUG_OBJECT (enc, "Finalizing");
- if (enc->encoder)
- th_encode_free (enc->encoder);
- th_comment_clear (&enc->comment);
- th_info_clear (&enc->info);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-theora_enc_reset (GstTheoraEnc * enc)
-{
- ogg_uint32_t keyframe_force;
- int rate_flags;
-
- if (enc->encoder)
- th_encode_free (enc->encoder);
- enc->encoder = th_encode_alloc (&enc->info);
- /* We ensure this function cannot fail. */
- g_assert (enc->encoder != NULL);
-#ifdef TH_ENCCTL_SET_SPLEVEL
- th_encode_ctl (enc->encoder, TH_ENCCTL_SET_SPLEVEL, &enc->speed_level,
- sizeof (enc->speed_level));
-#endif
-#ifdef TH_ENCCTL_SET_VP3_COMPATIBLE
- th_encode_ctl (enc->encoder, TH_ENCCTL_SET_VP3_COMPATIBLE,
- &enc->vp3_compatible, sizeof (enc->vp3_compatible));
-#endif
-
- rate_flags = 0;
-#ifdef TH_ENCCTL_SET_RATE_FLAGS
- if (enc->drop_frames)
- rate_flags |= TH_RATECTL_DROP_FRAMES;
- if (enc->drop_frames)
- rate_flags |= TH_RATECTL_CAP_OVERFLOW;
- if (enc->drop_frames)
- rate_flags |= TH_RATECTL_CAP_UNDERFLOW;
- th_encode_ctl (enc->encoder, TH_ENCCTL_SET_RATE_FLAGS,
- &rate_flags, sizeof (rate_flags));
-#endif
-
-#ifdef TH_ENCCTL_SET_RATE_BUFFER
- if (enc->rate_buffer) {
- th_encode_ctl (enc->encoder, TH_ENCCTL_SET_RATE_BUFFER,
- &enc->rate_buffer, sizeof (enc->rate_buffer));
- } else {
- /* FIXME */
- }
-#endif
-
- keyframe_force = enc->keyframe_auto ?
- enc->keyframe_force : enc->keyframe_freq;
- th_encode_ctl (enc->encoder, TH_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE,
- &keyframe_force, sizeof (keyframe_force));
-}
-
-static void
-theora_enc_clear (GstTheoraEnc * enc)
-{
- enc->packetno = 0;
- enc->bytes_out = 0;
- enc->granulepos_offset = 0;
- enc->timestamp_offset = 0;
-
- enc->next_ts = GST_CLOCK_TIME_NONE;
- enc->next_discont = FALSE;
- enc->expected_ts = GST_CLOCK_TIME_NONE;
-}
-
-static char *
-theora_enc_get_supported_formats (void)
-{
- th_enc_ctx *encoder;
- th_info info;
- struct
- {
- th_pixel_fmt pixelformat;
- char *fourcc;
- } formats[] = {
- {
- TH_PF_420, "I420"}, {
- TH_PF_422, "Y42B"}, {
- TH_PF_444, "Y444"}
- };
- GString *string = NULL;
- guint i;
-
- th_info_init (&info);
- info.frame_width = 16;
- info.frame_height = 16;
- info.fps_numerator = 25;
- info.fps_denominator = 1;
- for (i = 0; i < G_N_ELEMENTS (formats); i++) {
- info.pixel_fmt = formats[i].pixelformat;
-
- encoder = th_encode_alloc (&info);
- if (encoder == NULL)
- continue;
-
- GST_LOG ("format %s is supported", formats[i].fourcc);
- th_encode_free (encoder);
-
- if (string == NULL) {
- string = g_string_new (formats[i].fourcc);
- } else {
- g_string_append (string, ", ");
- g_string_append (string, formats[i].fourcc);
- }
- }
- th_info_clear (&info);
-
- return string == NULL ? NULL : g_string_free (string, FALSE);
-}
-
-static GstCaps *
-theora_enc_sink_getcaps (GstPad * pad)
-{
- GstCaps *caps;
- char *supported_formats, *caps_string;
-
- supported_formats = theora_enc_get_supported_formats ();
- if (!supported_formats) {
- GST_WARNING ("no supported formats found. Encoder disabled?");
- return gst_caps_new_empty ();
- }
-
- caps_string = g_strdup_printf ("video/x-raw-yuv, "
- "format = (fourcc) { %s }, "
- "framerate = (fraction) [0/1, MAX], "
- "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]",
- supported_formats);
- caps = gst_caps_from_string (caps_string);
- g_free (caps_string);
- g_free (supported_formats);
- GST_DEBUG ("Supported caps: %" GST_PTR_FORMAT, caps);
-
- return caps;
-}
-
-static gboolean
-theora_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstStructure *structure = gst_caps_get_structure (caps, 0);
- GstTheoraEnc *enc = GST_THEORA_ENC (gst_pad_get_parent (pad));
- guint32 fourcc;
- const GValue *par;
- gint fps_n, fps_d;
-
- gst_structure_get_fourcc (structure, "format", &fourcc);
- gst_structure_get_int (structure, "width", &enc->width);
- gst_structure_get_int (structure, "height", &enc->height);
- gst_structure_get_fraction (structure, "framerate", &fps_n, &fps_d);
- par = gst_structure_get_value (structure, "pixel-aspect-ratio");
-
- th_info_clear (&enc->info);
- th_info_init (&enc->info);
- /* Theora has a divisible-by-sixteen restriction for the encoded video size but
- * we can define a picture area using pic_width/pic_height */
- enc->info.frame_width = GST_ROUND_UP_16 (enc->width);
- enc->info.frame_height = GST_ROUND_UP_16 (enc->height);
- enc->info.pic_width = enc->width;
- enc->info.pic_height = enc->height;
- switch (fourcc) {
- case GST_MAKE_FOURCC ('I', '4', '2', '0'):
- enc->info.pixel_fmt = TH_PF_420;
- break;
- case GST_MAKE_FOURCC ('Y', '4', '2', 'B'):
- enc->info.pixel_fmt = TH_PF_422;
- break;
- case GST_MAKE_FOURCC ('Y', '4', '4', '4'):
- enc->info.pixel_fmt = TH_PF_444;
- break;
- default:
- g_assert_not_reached ();
- }
-
- enc->info.fps_numerator = enc->fps_n = fps_n;
- enc->info.fps_denominator = enc->fps_d = fps_d;
- if (par) {
- enc->info.aspect_numerator = gst_value_get_fraction_numerator (par);
- enc->info.aspect_denominator = gst_value_get_fraction_denominator (par);
- } else {
- /* setting them to 0 indicates that the decoder can chose a good aspect
- * ratio, defaulting to 1/1 */
- enc->info.aspect_numerator = 0;
- enc->info.aspect_denominator = 0;
- }
-
- enc->info.colorspace = TH_CS_UNSPECIFIED;
- enc->info.target_bitrate = enc->video_bitrate;
- enc->info.quality = enc->video_quality;
-
- /* as done in theora */
- enc->info.keyframe_granule_shift = _ilog (enc->keyframe_force - 1);
- GST_DEBUG_OBJECT (enc,
- "keyframe_frequency_force is %d, granule shift is %d",
- enc->keyframe_force, enc->info.keyframe_granule_shift);
-
- theora_enc_reset (enc);
- enc->initialised = TRUE;
-
- gst_object_unref (enc);
-
- return TRUE;
-}
-
-static guint64
-granulepos_add (guint64 granulepos, guint64 addend, gint shift)
-{
- guint64 iframe, pframe;
-
- iframe = granulepos >> shift;
- pframe = granulepos - (iframe << shift);
- iframe += addend;
-
- return (iframe << shift) + pframe;
-}
-
-/* prepare a buffer for transmission by passing data through libtheora */
-static GstFlowReturn
-theora_buffer_from_packet (GstTheoraEnc * enc, ogg_packet * packet,
- GstClockTime timestamp, GstClockTime running_time,
- GstClockTime duration, GstBuffer ** buffer)
-{
- GstBuffer *buf;
- GstFlowReturn ret = GST_FLOW_OK;
-
- buf = gst_buffer_new_and_alloc (packet->bytes);
- if (!buf) {
- GST_WARNING_OBJECT (enc, "Could not allocate buffer");
- ret = GST_FLOW_ERROR;
- goto done;
- }
-
- memcpy (GST_BUFFER_DATA (buf), packet->packet, packet->bytes);
- gst_buffer_set_caps (buf, GST_PAD_CAPS (enc->srcpad));
- /* see ext/ogg/README; OFFSET_END takes "our" granulepos, OFFSET its
- * time representation */
- GST_BUFFER_OFFSET_END (buf) =
- granulepos_add (packet->granulepos, enc->granulepos_offset,
- enc->info.keyframe_granule_shift);
- GST_BUFFER_OFFSET (buf) = granulepos_to_timestamp (enc,
- GST_BUFFER_OFFSET_END (buf));
-
- GST_BUFFER_TIMESTAMP (buf) = timestamp;
- GST_BUFFER_DURATION (buf) = duration;
-
- if (enc->next_discont) {
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
- enc->next_discont = FALSE;
- }
-
- /* the second most significant bit of the first data byte is cleared
- * for keyframes */
- if ((packet->packet[0] & 0x40) == 0) {
- GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
- } else {
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
- }
- enc->packetno++;
-
-done:
- *buffer = buf;
- return ret;
-}
-
-/* push out the buffer and do internal bookkeeping */
-static GstFlowReturn
-theora_push_buffer (GstTheoraEnc * enc, GstBuffer * buffer)
-{
- GstFlowReturn ret;
-
- enc->bytes_out += GST_BUFFER_SIZE (buffer);
-
- ret = gst_pad_push (enc->srcpad, buffer);
-
- return ret;
-}
-
-static GstFlowReturn
-theora_push_packet (GstTheoraEnc * enc, ogg_packet * packet,
- GstClockTime timestamp, GstClockTime running_time, GstClockTime duration)
-{
- GstBuffer *buf;
- GstFlowReturn ret;
-
- ret =
- theora_buffer_from_packet (enc, packet, timestamp, running_time, duration,
- &buf);
- if (ret == GST_FLOW_OK)
- ret = theora_push_buffer (enc, buf);
-
- return ret;
-}
-
-static GstCaps *
-theora_set_header_on_caps (GstCaps * caps, GSList * buffers)
-{
- GstStructure *structure;
- GValue array = { 0 };
- GValue value = { 0 };
- GstBuffer *buffer;
- GSList *walk;
-
- caps = gst_caps_make_writable (caps);
- structure = gst_caps_get_structure (caps, 0);
-
- /* put copies of the buffers in a fixed list */
- g_value_init (&array, GST_TYPE_ARRAY);
-
- for (walk = buffers; walk; walk = walk->next) {
- buffer = walk->data;
-
- /* mark buffer */
- GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_IN_CAPS);
-
- /* Copy buffer, because we can't use the original -
- * it creates a circular refcount with the caps<->buffers */
- buffer = gst_buffer_copy (buffer);
-
- g_value_init (&value, GST_TYPE_BUFFER);
- gst_value_set_buffer (&value, buffer);
- gst_value_array_append_value (&array, &value);
- g_value_unset (&value);
-
- /* Unref our copy */
- gst_buffer_unref (buffer);
- }
-
- gst_structure_set_value (structure, "streamheader", &array);
- g_value_unset (&array);
-
- return caps;
-}
-
-static void
-theora_enc_force_keyframe (GstTheoraEnc * enc)
-{
- GstClockTime next_ts;
-
- /* make sure timestamps increment after resetting the decoder */
- next_ts = enc->next_ts + enc->timestamp_offset;
-
- theora_enc_reset (enc);
- enc->granulepos_offset =
- gst_util_uint64_scale (next_ts, enc->fps_n, GST_SECOND * enc->fps_d);
- enc->timestamp_offset = next_ts;
- enc->next_ts = 0;
-}
-
-static gboolean
-theora_enc_sink_event (GstPad * pad, GstEvent * event)
-{
- GstTheoraEnc *enc;
- ogg_packet op;
- gboolean res;
-
- enc = GST_THEORA_ENC (GST_PAD_PARENT (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:
- {
- gboolean update;
- gdouble rate, applied_rate;
- GstFormat format;
- gint64 start, stop, time;
-
- gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
- &format, &start, &stop, &time);
-
- gst_segment_set_newsegment_full (&enc->segment, update, rate,
- applied_rate, format, start, stop, time);
-
- res = gst_pad_push_event (enc->srcpad, event);
- break;
- }
- case GST_EVENT_EOS:
- if (enc->initialised) {
- /* push last packet with eos flag, should not be called */
- while (th_encode_packetout (enc->encoder, 1, &op)) {
- GstClockTime next_time =
- th_granule_time (enc->encoder, op.granulepos) * GST_SECOND;
-
- theora_push_packet (enc, &op, GST_CLOCK_TIME_NONE, enc->next_ts,
- next_time - enc->next_ts);
- enc->next_ts = next_time;
- }
- }
- res = gst_pad_push_event (enc->srcpad, event);
- break;
- case GST_EVENT_FLUSH_STOP:
- gst_segment_init (&enc->segment, GST_FORMAT_UNDEFINED);
- res = gst_pad_push_event (enc->srcpad, event);
- break;
- case GST_EVENT_CUSTOM_DOWNSTREAM:
- {
- const GstStructure *s;
-
- s = gst_event_get_structure (event);
-
- if (gst_structure_has_name (s, "GstForceKeyUnit"))
- theora_enc_force_keyframe (enc);
- res = gst_pad_push_event (enc->srcpad, event);
- break;
- }
- default:
- res = gst_pad_push_event (enc->srcpad, event);
- break;
- }
- return res;
-}
-
-static gboolean
-theora_enc_src_event (GstPad * pad, GstEvent * event)
-{
- GstTheoraEnc *enc;
- gboolean res = TRUE;
-
- enc = GST_THEORA_ENC (GST_PAD_PARENT (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_CUSTOM_UPSTREAM:
- {
- const GstStructure *s;
-
- s = gst_event_get_structure (event);
-
- if (gst_structure_has_name (s, "GstForceKeyUnit")) {
- GST_OBJECT_LOCK (enc);
- enc->force_keyframe = TRUE;
- GST_OBJECT_UNLOCK (enc);
- /* consume the event */
- res = TRUE;
- gst_event_unref (event);
- } else {
- res = gst_pad_push_event (enc->sinkpad, event);
- }
- break;
- }
- default:
- res = gst_pad_push_event (enc->sinkpad, event);
- break;
- }
-
- return res;
-}
-
-static gboolean
-theora_enc_is_discontinuous (GstTheoraEnc * enc, GstClockTime timestamp,
- GstClockTime duration)
-{
- GstClockTimeDiff max_diff;
- gboolean ret = FALSE;
-
- /* Allow 3/4 a frame off */
- max_diff = (enc->info.fps_denominator * GST_SECOND * 3) /
- (enc->info.fps_numerator * 4);
-
- if (timestamp != GST_CLOCK_TIME_NONE
- && enc->expected_ts != GST_CLOCK_TIME_NONE) {
- if ((GstClockTimeDiff) (timestamp - enc->expected_ts) > max_diff) {
- GST_DEBUG_OBJECT (enc, "Incoming TS %" GST_TIME_FORMAT
- " exceeds expected value %" GST_TIME_FORMAT
- " by too much, marking discontinuity",
- GST_TIME_ARGS (timestamp), GST_TIME_ARGS (enc->expected_ts));
- ret = TRUE;
- }
- }
-
- if (GST_CLOCK_TIME_IS_VALID (duration))
- enc->expected_ts = timestamp + duration;
- else
- enc->expected_ts = GST_CLOCK_TIME_NONE;
-
- return ret;
-}
-
-static void
-theora_enc_init_buffer (th_ycbcr_buffer buf, th_info * info, guint8 * data)
-{
- GstVideoFormat format;
- guint i;
-
- switch (info->pixel_fmt) {
- case TH_PF_444:
- format = GST_VIDEO_FORMAT_Y444;
- break;
- case TH_PF_420:
- format = GST_VIDEO_FORMAT_I420;
- break;
- case TH_PF_422:
- format = GST_VIDEO_FORMAT_Y42B;
- break;
- default:
- g_assert_not_reached ();
- }
-
- /* According to Theora developer Timothy Terriberry, the Theora
- * encoder will not use memory outside of pic_width/height, even when
- * the frame size is bigger. The values outside this region will be encoded
- * to default values.
- * Due to this, setting the frame's width/height as the buffer width/height
- * is perfectly ok, even though it does not strictly look ok.
- */
- for (i = 0; i < 3; i++) {
- buf[i].width =
- gst_video_format_get_component_width (format, i, info->frame_width);
- buf[i].height =
- gst_video_format_get_component_height (format, i, info->frame_height);
-
- buf[i].data =
- data + gst_video_format_get_component_offset (format, i,
- info->pic_width, info->pic_height);
- buf[i].stride =
- gst_video_format_get_row_stride (format, i, info->pic_width);
- }
-}
-
-static GstFlowReturn
-theora_enc_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstTheoraEnc *enc;
- ogg_packet op;
- GstClockTime timestamp, duration, running_time;
- GstFlowReturn ret;
- gboolean force_keyframe;
-
- enc = GST_THEORA_ENC (GST_PAD_PARENT (pad));
-
- /* we keep track of two timelines.
- * - The timestamps from the incomming buffers, which we copy to the outgoing
- * encoded buffers as-is. We need to do this as we simply forward the
- * newsegment events.
- * - The running_time of the buffers, which we use to construct the granulepos
- * in the packets.
- */
- timestamp = GST_BUFFER_TIMESTAMP (buffer);
- duration = GST_BUFFER_DURATION (buffer);
-
- running_time =
- gst_segment_to_running_time (&enc->segment, GST_FORMAT_TIME, timestamp);
- if ((gint64) running_time < 0) {
- GST_DEBUG_OBJECT (enc, "Dropping buffer, timestamp: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
- gst_buffer_unref (buffer);
- return GST_FLOW_OK;
- }
-
- /* see if we need to schedule a keyframe */
- GST_OBJECT_LOCK (enc);
- force_keyframe = enc->force_keyframe;
- enc->force_keyframe = FALSE;
- GST_OBJECT_UNLOCK (enc);
-
- if (force_keyframe) {
- GstClockTime stream_time;
- GstStructure *s;
-
- stream_time = gst_segment_to_stream_time (&enc->segment,
- GST_FORMAT_TIME, timestamp);
-
- s = gst_structure_new ("GstForceKeyUnit",
- "timestamp", G_TYPE_UINT64, timestamp,
- "stream-time", G_TYPE_UINT64, stream_time,
- "running-time", G_TYPE_UINT64, running_time, NULL);
-
- theora_enc_force_keyframe (enc);
-
- gst_pad_push_event (enc->srcpad,
- gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, s));
- }
-
- /* make sure we copy the discont flag to the next outgoing buffer when it's
- * set on the incomming buffer */
- if (GST_BUFFER_IS_DISCONT (buffer)) {
- enc->next_discont = TRUE;
- }
-
- if (enc->packetno == 0) {
- /* no packets written yet, setup headers */
- GstCaps *caps;
- GstBuffer *buf;
- GSList *buffers = NULL;
- int result;
-
- enc->granulepos_offset = 0;
- enc->timestamp_offset = 0;
-
- GST_DEBUG_OBJECT (enc, "output headers");
- /* Theora streams begin with three headers; the initial header (with
- most of the codec setup parameters) which is mandated by the Ogg
- bitstream spec. The second header holds any comment fields. The
- third header holds the bitstream codebook. We merely need to
- make the headers, then pass them to libtheora one at a time;
- libtheora handles the additional Ogg bitstream constraints */
-
- /* create the remaining theora headers */
- th_comment_clear (&enc->comment);
- th_comment_init (&enc->comment);
-
- while ((result =
- th_encode_flushheader (enc->encoder, &enc->comment, &op)) > 0) {
- ret =
- theora_buffer_from_packet (enc, &op, GST_CLOCK_TIME_NONE,
- GST_CLOCK_TIME_NONE, GST_CLOCK_TIME_NONE, &buf);
- if (ret != GST_FLOW_OK) {
- goto header_buffer_alloc;
- }
- buffers = g_slist_prepend (buffers, buf);
- }
- if (result < 0) {
- g_slist_foreach (buffers, (GFunc) gst_buffer_unref, NULL);
- g_slist_free (buffers);
- goto encoder_disabled;
- }
-
- buffers = g_slist_reverse (buffers);
-
- /* mark buffers and put on caps */
- caps = gst_pad_get_caps (enc->srcpad);
- caps = theora_set_header_on_caps (caps, buffers);
- GST_DEBUG ("here are the caps: %" GST_PTR_FORMAT, caps);
- gst_pad_set_caps (enc->srcpad, caps);
-
- g_slist_foreach (buffers, (GFunc) gst_buffer_set_caps, caps);
-
- gst_caps_unref (caps);
-
- /* push out the header buffers */
- while (buffers) {
- buf = buffers->data;
- buffers = g_slist_delete_link (buffers, buffers);
- if ((ret = theora_push_buffer (enc, buf)) != GST_FLOW_OK) {
- g_slist_foreach (buffers, (GFunc) gst_buffer_unref, NULL);
- g_slist_free (buffers);
- goto header_push;
- }
- }
-
- enc->granulepos_offset =
- gst_util_uint64_scale (running_time, enc->fps_n,
- GST_SECOND * enc->fps_d);
- enc->timestamp_offset = running_time;
- enc->next_ts = 0;
- }
-
- {
- th_ycbcr_buffer ycbcr;
- gint res;
-
- theora_enc_init_buffer (ycbcr, &enc->info, GST_BUFFER_DATA (buffer));
-
- if (theora_enc_is_discontinuous (enc, running_time, duration)) {
- theora_enc_reset (enc);
- enc->granulepos_offset =
- gst_util_uint64_scale (running_time, enc->fps_n,
- GST_SECOND * enc->fps_d);
- enc->timestamp_offset = running_time;
- enc->next_ts = 0;
- enc->next_discont = TRUE;
- }
-
- res = th_encode_ycbcr_in (enc->encoder, ycbcr);
- /* none of the failure cases can happen here */
- g_assert (res == 0);
-
- ret = GST_FLOW_OK;
- while (th_encode_packetout (enc->encoder, 0, &op)) {
- GstClockTime next_time;
-
- next_time = th_granule_time (enc->encoder, op.granulepos) * GST_SECOND;
-
- ret =
- theora_push_packet (enc, &op, timestamp, enc->next_ts,
- next_time - enc->next_ts);
-
- enc->next_ts = next_time;
- if (ret != GST_FLOW_OK)
- goto data_push;
- }
- gst_buffer_unref (buffer);
- }
-
- return ret;
-
- /* ERRORS */
-header_buffer_alloc:
- {
- gst_buffer_unref (buffer);
- return ret;
- }
-header_push:
- {
- gst_buffer_unref (buffer);
- return ret;
- }
-data_push:
- {
- gst_buffer_unref (buffer);
- return ret;
- }
-encoder_disabled:
- {
- GST_ELEMENT_ERROR (enc, STREAM, ENCODE, (NULL),
- ("libtheora has been compiled with the encoder disabled"));
- gst_buffer_unref (buffer);
- return GST_FLOW_ERROR;
- }
-}
-
-static GstStateChangeReturn
-theora_enc_change_state (GstElement * element, GstStateChange transition)
-{
- GstTheoraEnc *enc;
- GstStateChangeReturn ret;
-
- enc = GST_THEORA_ENC (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- GST_DEBUG_OBJECT (enc, "READY->PAUSED Initing theora state");
- th_info_init (&enc->info);
- th_comment_init (&enc->comment);
- enc->packetno = 0;
- enc->force_keyframe = FALSE;
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- default:
- break;
- }
-
- ret = parent_class->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- GST_DEBUG_OBJECT (enc, "PAUSED->READY Clearing theora state");
- if (enc->encoder) {
- th_encode_free (enc->encoder);
- enc->encoder = NULL;
- }
- th_comment_clear (&enc->comment);
- th_info_clear (&enc->info);
-
- theora_enc_clear (enc);
- enc->initialised = FALSE;
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-static void
-theora_enc_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstTheoraEnc *enc = GST_THEORA_ENC (object);
-
- switch (prop_id) {
- case ARG_CENTER:
- case ARG_BORDER:
- case ARG_QUICK:
- case ARG_KEYFRAME_THRESHOLD:
- case ARG_KEYFRAME_MINDISTANCE:
- case ARG_NOISE_SENSITIVITY:
- case ARG_SHARPNESS:
- /* kept for API compat, but ignored */
- break;
- case ARG_BITRATE:
- enc->video_bitrate = g_value_get_int (value) * 1000;
- enc->video_quality = 0;
- break;
- case ARG_QUALITY:
- enc->video_quality = g_value_get_int (value);
- enc->video_bitrate = 0;
- break;
- case ARG_KEYFRAME_AUTO:
- enc->keyframe_auto = g_value_get_boolean (value);
- break;
- case ARG_KEYFRAME_FREQ:
- enc->keyframe_freq = g_value_get_int (value);
- break;
- case ARG_KEYFRAME_FREQ_FORCE:
- enc->keyframe_force = g_value_get_int (value);
- break;
- case ARG_SPEEDLEVEL:
-#ifdef TH_ENCCTL_SET_SPLEVEL
- enc->speed_level = g_value_get_int (value);
-#endif
- break;
- case ARG_VP3_COMPATIBLE:
-#ifdef TH_ENCCTL_SET_VP3_COMPATIBLE
- enc->vp3_compatible = g_value_get_boolean (value);
-#endif
- break;
- case ARG_DROP_FRAMES:
-#ifdef TH_ENCCTL_SET_RATE_FLAGS
- enc->drop_frames = g_value_get_boolean (value);
-#endif
- break;
- case ARG_CAP_OVERFLOW:
-#ifdef TH_ENCCTL_SET_RATE_FLAGS
- enc->cap_overflow = g_value_get_boolean (value);
-#endif
- break;
- case ARG_CAP_UNDERFLOW:
-#ifdef TH_ENCCTL_SET_RATE_FLAGS
- enc->cap_underflow = g_value_get_boolean (value);
-#endif
- break;
- case ARG_RATE_BUFFER:
-#ifdef TH_ENCCTL_SET_RATE_BUFFER
- enc->rate_buffer = g_value_get_int (value);
-#endif
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-theora_enc_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstTheoraEnc *enc = GST_THEORA_ENC (object);
-
- switch (prop_id) {
- case ARG_CENTER:
- g_value_set_boolean (value, TRUE);
- break;
- case ARG_BORDER:
- g_value_set_enum (value, BORDER_BLACK);
- break;
- case ARG_BITRATE:
- g_value_set_int (value, enc->video_bitrate / 1000);
- break;
- case ARG_QUALITY:
- g_value_set_int (value, enc->video_quality);
- break;
- case ARG_QUICK:
- g_value_set_boolean (value, TRUE);
- break;
- case ARG_KEYFRAME_AUTO:
- g_value_set_boolean (value, enc->keyframe_auto);
- break;
- case ARG_KEYFRAME_FREQ:
- g_value_set_int (value, enc->keyframe_freq);
- break;
- case ARG_KEYFRAME_FREQ_FORCE:
- g_value_set_int (value, enc->keyframe_force);
- break;
- case ARG_KEYFRAME_THRESHOLD:
- g_value_set_int (value, 80);
- break;
- case ARG_KEYFRAME_MINDISTANCE:
- g_value_set_int (value, 8);
- break;
- case ARG_NOISE_SENSITIVITY:
- g_value_set_int (value, 1);
- break;
- case ARG_SHARPNESS:
- g_value_set_int (value, 0);
- break;
- case ARG_SPEEDLEVEL:
- g_value_set_int (value, enc->speed_level);
- break;
- case ARG_VP3_COMPATIBLE:
- g_value_set_boolean (value, enc->vp3_compatible);
- break;
- case ARG_DROP_FRAMES:
- g_value_set_boolean (value, enc->drop_frames);
- break;
- case ARG_CAP_OVERFLOW:
- g_value_set_boolean (value, enc->cap_overflow);
- break;
- case ARG_CAP_UNDERFLOW:
- g_value_set_boolean (value, enc->cap_underflow);
- break;
- case ARG_RATE_BUFFER:
- g_value_set_int (value, enc->rate_buffer);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
diff --git a/ext/theora/gsttheoraenc.h b/ext/theora/gsttheoraenc.h
deleted file mode 100644
index 3efdab20..00000000
--- a/ext/theora/gsttheoraenc.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* GStreamer
- * Copyright (C) 2004 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_THEORAENC_H__
-#define __GST_THEORAENC_H__
-
-#include <gst/gst.h>
-#include <theora/theoraenc.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_THEORA_ENC \
- (gst_theora_enc_get_type())
-#define GST_THEORA_ENC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_THEORA_ENC,GstTheoraEnc))
-#define GST_THEORA_ENC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_THEORA_ENC,GstTheoraEncClass))
-#define GST_IS_THEORA_ENC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_THEORA_ENC))
-#define GST_IS_THEORA_ENC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_THEORA_ENC))
-
-typedef struct _GstTheoraEnc GstTheoraEnc;
-typedef struct _GstTheoraEncClass GstTheoraEncClass;
-
-/**
- * GstTheoraEncBorderMode:
- * @BORDER_NONE: no border
- * @BORDER_BLACK: black border
- * @BORDER_MIRROR: Mirror image in border
- *
- * Border color to add when sizes not multiple of 16.
- */
-typedef enum
-{
- BORDER_NONE,
- BORDER_BLACK,
- BORDER_MIRROR
-}
-GstTheoraEncBorderMode;
-
-/**
- * GstTheoraEnc:
- *
- * Opaque data structure.
- */
-struct _GstTheoraEnc
-{
- GstElement element;
-
- GstPad *sinkpad;
- GstPad *srcpad;
-
- GstSegment segment;
-
- ogg_stream_state to;
-
- th_enc_ctx *encoder;
- th_info info;
- th_comment comment;
- gboolean initialised;
-
- gint video_bitrate; /* bitrate target for Theora video */
- gint video_quality; /* Theora quality selector 0 = low, 63 = high */
- gboolean keyframe_auto;
- gint keyframe_freq;
- gint keyframe_force;
-
- gint info_width, info_height;
- gint width, height;
- gint fps_n, fps_d;
- GstClockTime next_ts;
-
- GstClockTime expected_ts;
- gboolean next_discont;
-
- gboolean force_keyframe;
-
- guint packetno;
- guint64 bytes_out;
- guint64 granulepos_offset;
- guint64 timestamp_offset;
-
- gint speed_level;
- gboolean vp3_compatible;
- gboolean drop_frames;
- gboolean cap_overflow;
- gboolean cap_underflow;
- int rate_buffer;
-};
-
-struct _GstTheoraEncClass
-{
- GstElementClass parent_class;
-};
-
-G_END_DECLS
-
-#endif /* __GST_THEORAENC_H__ */
-
diff --git a/ext/theora/gsttheoraparse.c b/ext/theora/gsttheoraparse.c
deleted file mode 100644
index 79c90072..00000000
--- a/ext/theora/gsttheoraparse.c
+++ /dev/null
@@ -1,941 +0,0 @@
-/* GStreamer
- * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
- * Copyright (C) 2006 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-theoraparse
- * @see_also: theoradec, oggdemux, vorbisparse
- *
- * The theoraparse element will parse the header packets of the Theora
- * stream and put them as the streamheader in the caps. This is used in the
- * multifdsink case where you want to stream live theora streams to multiple
- * clients, each client has to receive the streamheaders first before they can
- * consume the theora packets.
- *
- * This element also makes sure that the buffers that it pushes out are properly
- * timestamped and that their offset and offset_end are set. The buffers that
- * theoraparse outputs have all of the metadata that oggmux expects to receive,
- * which allows you to (for example) remux an ogg/theora file.
- *
- * In addition, this element allows you to fix badly synchronized streams. You
- * pass in an array of (granule time, buffer time) synchronization points via
- * the synchronization-points GValueArray property, and this element will adjust
- * the granulepos values that it outputs. The adjustment will be made by
- * offsetting all buffers that it outputs by a specified amount, and updating
- * that offset from the value array whenever a keyframe is processed.
- *
- * <refsect2>
- * <title>Example pipelines</title>
- * |[
- * gst-launch -v filesrc location=video.ogg ! oggdemux ! theoraparse ! fakesink
- * ]| This pipeline shows that the streamheader is set in the caps, and that each
- * buffer has the timestamp, duration, offset, and offset_end set.
- * |[
- * gst-launch filesrc location=video.ogg ! oggdemux ! theoraparse \
- * ! oggmux ! filesink location=video-remuxed.ogg
- * ]| This pipeline shows remuxing. video-remuxed.ogg might not be exactly the same
- * as video.ogg, but they should produce exactly the same decoded data.
- * </refsect2>
- *
- * Last reviewed on 2008-05-28 (0.10.20)
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "gsttheoraparse.h"
-
-#define GST_CAT_DEFAULT theoraparse_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-static GstElementDetails theora_parse_details = {
- "Theora video parser",
- "Codec/Parser/Video",
- "parse raw theora streams",
- "Andy Wingo <wingo@pobox.com>"
-};
-
-static GstStaticPadTemplate theora_parse_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-theora")
- );
-
-static GstStaticPadTemplate theora_parse_src_factory =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-theora")
- );
-
-enum
-{
- PROP_0,
- PROP_SYNCHRONIZATION_POINTS
-};
-
-GST_BOILERPLATE (GstTheoraParse, gst_theora_parse, GstElement,
- GST_TYPE_ELEMENT);
-
-static void theora_parse_dispose (GObject * object);
-static void theora_parse_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void theora_parse_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-
-static gboolean theora_parse_src_query (GstPad * pad, GstQuery * query);
-static GstFlowReturn theora_parse_chain (GstPad * pad, GstBuffer * buffer);
-static GstStateChangeReturn theora_parse_change_state (GstElement * element,
- GstStateChange transition);
-static gboolean theora_parse_sink_event (GstPad * pad, GstEvent * event);
-static gboolean theora_parse_src_query (GstPad * pad, GstQuery * query);
-
-static void
-gst_theora_parse_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&theora_parse_src_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&theora_parse_sink_factory));
- gst_element_class_set_details (element_class, &theora_parse_details);
-}
-
-static void
-gst_theora_parse_class_init (GstTheoraParseClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-
- gobject_class->dispose = theora_parse_dispose;
- gobject_class->get_property = theora_parse_get_property;
- gobject_class->set_property = theora_parse_set_property;
-
- /**
- * GstTheoraParse:sychronization-points
- *
- * An array of (granuletime, buffertime) pairs
- *
- * Since: 0.10.10
- */
- g_object_class_install_property (gobject_class, PROP_SYNCHRONIZATION_POINTS,
- g_param_spec_value_array ("synchronization-points",
- "Synchronization points",
- "An array of (granuletime, buffertime) pairs",
- g_param_spec_uint64 ("time", "Time",
- "Time (either granuletime or buffertime)", 0, G_MAXUINT64, 0,
- G_PARAM_READWRITE),
- (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstelement_class->change_state = theora_parse_change_state;
-
- GST_DEBUG_CATEGORY_INIT (theoraparse_debug, "theoraparse", 0,
- "Theora parser");
-}
-
-static void
-gst_theora_parse_init (GstTheoraParse * parse, GstTheoraParseClass * g_class)
-{
- parse->sinkpad =
- gst_pad_new_from_static_template (&theora_parse_sink_factory, "sink");
- gst_pad_set_chain_function (parse->sinkpad, theora_parse_chain);
- gst_pad_set_event_function (parse->sinkpad, theora_parse_sink_event);
- gst_element_add_pad (GST_ELEMENT (parse), parse->sinkpad);
-
- parse->srcpad =
- gst_pad_new_from_static_template (&theora_parse_src_factory, "src");
- gst_pad_set_query_function (parse->srcpad, theora_parse_src_query);
- gst_element_add_pad (GST_ELEMENT (parse), parse->srcpad);
-}
-
-static void
-theora_parse_dispose (GObject * object)
-{
- GstTheoraParse *parse = GST_THEORA_PARSE (object);
-
- g_free (parse->times);
- parse->times = NULL;
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-theora_parse_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstTheoraParse *parse = GST_THEORA_PARSE (object);
-
- switch (prop_id) {
- case PROP_SYNCHRONIZATION_POINTS:
- {
- GValueArray *array;
- guint i;
-
- array = g_value_get_boxed (value);
-
- if (array) {
- if (array->n_values % 2)
- goto odd_values;
-
- g_free (parse->times);
- parse->times = g_new (GstClockTime, array->n_values);
- parse->npairs = array->n_values / 2;
- for (i = 0; i < array->n_values; i++)
- parse->times[i] = g_value_get_uint64 (&array->values[i]);
- } else {
- g_free (parse->times);
- parse->npairs = 0;
- }
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-
- return;
-
-odd_values:
- {
- g_critical ("expected an even number of time values for "
- "synchronization-points");
- return;
- }
-}
-
-static void
-theora_parse_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstTheoraParse *parse = GST_THEORA_PARSE (object);
-
- switch (prop_id) {
- case PROP_SYNCHRONIZATION_POINTS:
- {
- GValueArray *array = NULL;
- guint i;
-
- array = g_value_array_new (parse->npairs * 2);
-
- for (i = 0; i < parse->npairs; i++) {
- GValue v = { 0, };
-
- g_value_init (&v, G_TYPE_UINT64);
- g_value_set_uint64 (&v, parse->times[i * 2]);
- g_value_array_append (array, &v);
- g_value_set_uint64 (&v, parse->times[i * 2 + 1]);
- g_value_array_append (array, &v);
- g_value_unset (&v);
- }
-
- g_value_set_boxed (value, array);
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-theora_parse_set_header_on_caps (GstTheoraParse * parse, GstCaps * caps)
-{
- GstBuffer **bufs;
- GstStructure *structure;
- gint i;
- GValue array = { 0 };
- GValue value = { 0 };
-
- bufs = parse->streamheader;
- structure = gst_caps_get_structure (caps, 0);
- g_value_init (&array, GST_TYPE_ARRAY);
-
- for (i = 0; i < 3; i++) {
- if (bufs[i] == NULL)
- continue;
-
- bufs[i] = gst_buffer_make_metadata_writable (bufs[i]);
- GST_BUFFER_FLAG_SET (bufs[i], GST_BUFFER_FLAG_IN_CAPS);
-
- g_value_init (&value, GST_TYPE_BUFFER);
- gst_value_set_buffer (&value, bufs[i]);
- gst_value_array_append_value (&array, &value);
- g_value_unset (&value);
- }
-
- gst_structure_set_value (structure, "streamheader", &array);
- g_value_unset (&array);
-}
-
-/* two tasks to do here: set the streamheader on the caps, and use libtheora to
- parse the headers */
-static void
-theora_parse_set_streamheader (GstTheoraParse * parse)
-{
- GstCaps *caps;
- gint i;
- guint32 bitstream_version;
- th_setup_info *setup = NULL;
-
- g_assert (!parse->streamheader_received);
-
- caps = gst_caps_make_writable (gst_pad_get_caps (parse->srcpad));
- theora_parse_set_header_on_caps (parse, caps);
- GST_DEBUG_OBJECT (parse, "here are the caps: %" GST_PTR_FORMAT, caps);
- gst_pad_set_caps (parse->srcpad, caps);
- gst_caps_unref (caps);
-
- for (i = 0; i < 3; i++) {
- ogg_packet packet;
- GstBuffer *buf;
- int ret;
-
- buf = parse->streamheader[i];
- if (buf == NULL)
- continue;
-
- gst_buffer_set_caps (buf, GST_PAD_CAPS (parse->srcpad));
-
- packet.packet = GST_BUFFER_DATA (buf);
- packet.bytes = GST_BUFFER_SIZE (buf);
- packet.granulepos = GST_BUFFER_OFFSET_END (buf);
- packet.packetno = i + 1;
- packet.e_o_s = 0;
- packet.b_o_s = (i == 0);
- ret = th_decode_headerin (&parse->info, &parse->comment, &setup, &packet);
- if (ret < 0) {
- GST_WARNING_OBJECT (parse, "Failed to decode Theora header %d: %d\n",
- i + 1, ret);
- }
- }
- if (setup) {
- th_setup_free (setup);
- }
-
- parse->fps_n = parse->info.fps_numerator;
- parse->fps_d = parse->info.fps_denominator;
- parse->shift = parse->info.keyframe_granule_shift;
-
- /* With libtheora-1.0beta1 the granulepos scheme was changed:
- * where earlier the granulepos refered to the index/beginning
- * of a frame, it now refers to the end, which matches the use
- * in vorbis/speex. We check the bitstream version from the header so
- * we know which way to interpret the incoming granuepos
- */
- bitstream_version = (parse->info.version_major << 16) |
- (parse->info.version_minor << 8) | parse->info.version_subminor;
- parse->is_old_bitstream = (bitstream_version <= 0x00030200);
-
- parse->streamheader_received = TRUE;
-}
-
-static void
-theora_parse_drain_event_queue (GstTheoraParse * parse)
-{
- while (parse->event_queue->length) {
- GstEvent *event;
-
- event = GST_EVENT_CAST (g_queue_pop_head (parse->event_queue));
- gst_pad_event_default (parse->sinkpad, event);
- }
-}
-
-static void
-theora_parse_push_headers (GstTheoraParse * parse)
-{
- gint i;
-
- theora_parse_drain_event_queue (parse);
-
- if (!parse->streamheader_received)
- theora_parse_set_streamheader (parse);
-
- /* ignore return values, we pass along the result of pushing data packets only
- */
- for (i = 0; i < 3; i++) {
- GstBuffer *buf;
-
- if ((buf = parse->streamheader[i]))
- gst_pad_push (parse->srcpad, gst_buffer_ref (buf));
- }
-}
-
-static void
-theora_parse_clear_queue (GstTheoraParse * parse)
-{
- while (parse->buffer_queue->length) {
- GstBuffer *buf;
-
- buf = GST_BUFFER_CAST (g_queue_pop_head (parse->buffer_queue));
- gst_buffer_unref (buf);
- }
- while (parse->event_queue->length) {
- GstEvent *event;
-
- event = GST_EVENT_CAST (g_queue_pop_head (parse->event_queue));
- gst_event_unref (event);
- }
-}
-
-static gint64
-make_granulepos (GstTheoraParse * parse, gint64 keyframe, gint64 frame)
-{
- gint64 iframe;
-
- if (keyframe == -1)
- keyframe = 0;
- /* If using newer theora, offset the granulepos by +1, see comment in
- * theora_parse_set_streamheader.
- *
- * We don't increment keyframe directly, as internally we always index frames
- * starting from 0 and we do some sanity checking below. */
- if (!parse->is_old_bitstream)
- iframe = keyframe + 1;
- else
- iframe = keyframe;
-
- g_return_val_if_fail (frame >= keyframe, -1);
- g_return_val_if_fail (frame - keyframe < 1 << parse->shift, -1);
-
- return (iframe << parse->shift) + (frame - keyframe);
-}
-
-static void
-parse_granulepos (GstTheoraParse * parse, gint64 granulepos,
- gint64 * keyframe, gint64 * frame)
-{
- gint64 kf;
-
- kf = granulepos >> parse->shift;
- /* If using newer theora, offset the granulepos by -1, see comment
- * in theora_parse_set_streamheader */
- if (!parse->is_old_bitstream)
- kf -= 1;
- if (keyframe)
- *keyframe = kf;
- if (frame)
- *frame = kf + (granulepos & ((1 << parse->shift) - 1));
-}
-
-static gboolean
-is_keyframe (GstBuffer * buf)
-{
- if (!GST_BUFFER_DATA (buf))
- return FALSE;
- if (!GST_BUFFER_SIZE (buf))
- return FALSE;
- return ((GST_BUFFER_DATA (buf)[0] & 0x40) == 0);
-}
-
-static void
-theora_parse_munge_granulepos (GstTheoraParse * parse, GstBuffer * buf,
- gint64 keyframe, gint64 frame)
-{
- gint64 frames_diff;
- GstClockTimeDiff time_diff;
-
- if (keyframe == frame) {
- gint i;
-
- /* update granule_offset */
- for (i = 0; i < parse->npairs; i++) {
- if (parse->times[i * 2] >= GST_BUFFER_OFFSET (buf))
- break;
- }
- if (i > 0) {
- /* time_diff gets reset below */
- time_diff = parse->times[i * 2 - 1] - parse->times[i * 2 - 2];
- parse->granule_offset = gst_util_uint64_scale (time_diff,
- parse->fps_n, parse->fps_d * GST_SECOND);
- parse->granule_offset <<= parse->shift;
- }
- }
-
- frames_diff = parse->granule_offset >> parse->shift;
- time_diff = gst_util_uint64_scale_int (GST_SECOND * frames_diff,
- parse->fps_d, parse->fps_n);
-
- GST_DEBUG_OBJECT (parse, "offsetting theora stream by %" G_GINT64_FORMAT
- " frames (%" GST_TIME_FORMAT ")", frames_diff, GST_TIME_ARGS (time_diff));
-
- GST_BUFFER_OFFSET_END (buf) += parse->granule_offset;
- GST_BUFFER_OFFSET (buf) += time_diff;
- GST_BUFFER_TIMESTAMP (buf) += time_diff;
-}
-
-static GstFlowReturn
-theora_parse_push_buffer (GstTheoraParse * parse, GstBuffer * buf,
- gint64 keyframe, gint64 frame)
-{
-
- GstClockTime this_time, next_time;
-
- this_time = gst_util_uint64_scale_int (GST_SECOND * frame,
- parse->fps_d, parse->fps_n);
-
- next_time = gst_util_uint64_scale_int (GST_SECOND * (frame + 1),
- parse->fps_d, parse->fps_n);
-
- GST_BUFFER_OFFSET_END (buf) = make_granulepos (parse, keyframe, frame);
- GST_BUFFER_OFFSET (buf) = this_time;
- GST_BUFFER_TIMESTAMP (buf) = this_time;
- GST_BUFFER_DURATION (buf) = next_time - this_time;
-
- gst_buffer_set_caps (buf, GST_PAD_CAPS (parse->srcpad));
-
- if (parse->times)
- theora_parse_munge_granulepos (parse, buf, keyframe, frame);
-
- GST_DEBUG_OBJECT (parse, "pushing buffer with granulepos %" G_GINT64_FORMAT
- "|%" G_GINT64_FORMAT, keyframe, frame - keyframe);
-
- return gst_pad_push (parse->srcpad, buf);
-}
-
-static GstFlowReturn
-theora_parse_drain_queue_prematurely (GstTheoraParse * parse)
-{
- GstFlowReturn ret = GST_FLOW_OK;
-
- /* got an EOS event, make sure to push out any buffers that were in the queue
- * -- won't normally be the case, but this catches the
- * didn't-get-a-granulepos-on-the-last-packet case. Assuming a continuous
- * stream. */
-
- GST_DEBUG_OBJECT (parse, "got EOS, draining queue");
-
- /* if we get an eos before pushing the streamheaders, drain our events before
- * eos */
- theora_parse_drain_event_queue (parse);
-
- while (!g_queue_is_empty (parse->buffer_queue)) {
- GstBuffer *buf;
-
- buf = GST_BUFFER_CAST (g_queue_pop_head (parse->buffer_queue));
-
- parse->prev_frame++;
-
- if (is_keyframe (buf))
- /* we have a keyframe */
- parse->prev_keyframe = parse->prev_frame;
- else
- GST_BUFFER_FLAGS (buf) |= GST_BUFFER_FLAG_DELTA_UNIT;
-
- if (parse->prev_keyframe < 0) {
- if (GST_BUFFER_OFFSET_END_IS_VALID (buf)) {
- parse_granulepos (parse, GST_BUFFER_OFFSET_END (buf),
- &parse->prev_keyframe, NULL);
- } else {
- /* No previous keyframe known; can't extract one from this frame. That
- * means we can't do any valid output for this frame, just continue to
- * the next frame.
- */
- gst_buffer_unref (buf);
- continue;
- }
- }
-
- ret = theora_parse_push_buffer (parse, buf, parse->prev_keyframe,
- parse->prev_frame);
-
- if (ret != GST_FLOW_OK)
- goto done;
- }
-
-done:
- return ret;
-}
-
-static GstFlowReturn
-theora_parse_drain_queue (GstTheoraParse * parse, gint64 granulepos)
-{
- GstFlowReturn ret = GST_FLOW_OK;
- gint64 keyframe, prev_frame, frame;
-
- parse_granulepos (parse, granulepos, &keyframe, &frame);
-
- GST_DEBUG ("draining queue of length %d",
- g_queue_get_length (parse->buffer_queue));
-
- GST_LOG_OBJECT (parse, "gp %" G_GINT64_FORMAT ", kf %" G_GINT64_FORMAT
- ", frame %" G_GINT64_FORMAT, granulepos, keyframe, frame);
-
- prev_frame = frame - g_queue_get_length (parse->buffer_queue);
-
- GST_LOG_OBJECT (parse,
- "new prev %" G_GINT64_FORMAT ", prev %" G_GINT64_FORMAT, prev_frame,
- parse->prev_frame);
-
- if (prev_frame < parse->prev_frame) {
- GST_WARNING ("jumped %" G_GINT64_FORMAT
- " frames backwards! not sure what to do here",
- parse->prev_frame - prev_frame);
- ret = GST_FLOW_ERROR;
- goto done;
- } else if (prev_frame > parse->prev_frame) {
- GST_INFO ("discontinuity detected (%" G_GINT64_FORMAT
- " frames)", prev_frame - parse->prev_frame);
- if (keyframe <= prev_frame && keyframe > parse->prev_keyframe)
- parse->prev_keyframe = keyframe;
- parse->prev_frame = prev_frame;
- }
-
- while (!g_queue_is_empty (parse->buffer_queue)) {
- GstBuffer *buf;
-
- parse->prev_frame++;
- g_assert (parse->prev_frame >= 0);
-
- buf = GST_BUFFER_CAST (g_queue_pop_head (parse->buffer_queue));
-
- if (is_keyframe (buf))
- /* we have a keyframe */
- parse->prev_keyframe = parse->prev_frame;
- else
- GST_BUFFER_FLAGS (buf) |= GST_BUFFER_FLAG_DELTA_UNIT;
-
- ret = theora_parse_push_buffer (parse, buf, parse->prev_keyframe,
- parse->prev_frame);
-
- if (ret != GST_FLOW_OK)
- goto done;
- }
-
-done:
- return ret;
-}
-
-static GstFlowReturn
-theora_parse_queue_buffer (GstTheoraParse * parse, GstBuffer * buf)
-{
- GstFlowReturn ret = GST_FLOW_OK;
-
- buf = gst_buffer_make_metadata_writable (buf);
-
- g_queue_push_tail (parse->buffer_queue, buf);
-
- if (GST_BUFFER_OFFSET_END_IS_VALID (buf)) {
- if (parse->prev_keyframe < 0) {
- parse_granulepos (parse, GST_BUFFER_OFFSET_END (buf),
- &parse->prev_keyframe, NULL);
- }
- ret = theora_parse_drain_queue (parse, GST_BUFFER_OFFSET_END (buf));
- }
-
- return ret;
-}
-
-static GstFlowReturn
-theora_parse_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstFlowReturn ret;
- GstTheoraParse *parse;
- guint8 *data;
- guint size;
- gboolean have_header;
-
- parse = GST_THEORA_PARSE (gst_pad_get_parent (pad));
-
- data = GST_BUFFER_DATA (buffer);
- size = GST_BUFFER_SIZE (buffer);
-
- have_header = FALSE;
- if (size >= 1) {
- if (data[0] & 0x80)
- have_header = TRUE;
- }
-
- if (have_header) {
- if (parse->send_streamheader) {
- /* we need to collect the headers still */
- /* so put it on the streamheader list and return */
- if (data[0] >= 0x80 && data[0] <= 0x82)
- parse->streamheader[data[0] - 0x80] = buffer;
- }
- ret = GST_FLOW_OK;
- } else {
- /* data packet, push the headers we collected before */
- if (parse->send_streamheader) {
- theora_parse_push_headers (parse);
- parse->send_streamheader = FALSE;
- }
-
- ret = theora_parse_queue_buffer (parse, buffer);
- }
-
- gst_object_unref (parse);
-
- return ret;
-}
-
-static gboolean
-theora_parse_queue_event (GstTheoraParse * parse, GstEvent * event)
-{
- g_queue_push_tail (parse->event_queue, event);
- return TRUE;
-}
-
-static gboolean
-theora_parse_sink_event (GstPad * pad, GstEvent * event)
-{
- gboolean ret;
- GstTheoraParse *parse;
-
- parse = GST_THEORA_PARSE (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_STOP:
- theora_parse_clear_queue (parse);
- parse->prev_keyframe = -1;
- parse->prev_frame = -1;
- ret = gst_pad_event_default (pad, event);
- break;
- case GST_EVENT_EOS:
- theora_parse_drain_queue_prematurely (parse);
- ret = gst_pad_event_default (pad, event);
- break;
- default:
- if (parse->send_streamheader && GST_EVENT_IS_SERIALIZED (event))
- ret = theora_parse_queue_event (parse, event);
- else
- ret = gst_pad_event_default (pad, event);
- break;
- }
-
- gst_object_unref (parse);
-
- return ret;
-}
-
-static gboolean
-theora_parse_src_convert (GstPad * pad,
- GstFormat src_format, gint64 src_value,
- GstFormat * dest_format, gint64 * dest_value)
-{
- gboolean res = TRUE;
- GstTheoraParse *parse;
- guint64 scale = 1;
-
- if (src_format == *dest_format) {
- *dest_value = src_value;
- return TRUE;
- }
-
- parse = GST_THEORA_PARSE (gst_pad_get_parent (pad));
-
- /* we need the info part before we can done something */
- if (!parse->streamheader_received)
- goto no_header;
-
- switch (src_format) {
- case GST_FORMAT_BYTES:
- switch (*dest_format) {
- case GST_FORMAT_DEFAULT:
- *dest_value = gst_util_uint64_scale_int (src_value, 2,
- parse->info.pic_height * parse->info.pic_width * 3);
- break;
- case GST_FORMAT_TIME:
- /* seems like a rather silly conversion, implement me if you like */
- default:
- res = FALSE;
- }
- break;
- case GST_FORMAT_TIME:
- switch (*dest_format) {
- case GST_FORMAT_BYTES:
- scale = 3 * (parse->info.pic_width * parse->info.pic_height) / 2;
- case GST_FORMAT_DEFAULT:
- *dest_value = scale * gst_util_uint64_scale (src_value,
- parse->info.fps_numerator,
- parse->info.fps_denominator * GST_SECOND);
- break;
- default:
- GST_DEBUG_OBJECT (parse, "cannot convert to format %s",
- gst_format_get_name (*dest_format));
- res = FALSE;
- }
- break;
- case GST_FORMAT_DEFAULT:
- switch (*dest_format) {
- case GST_FORMAT_TIME:
- *dest_value = gst_util_uint64_scale (src_value,
- GST_SECOND * parse->info.fps_denominator,
- parse->info.fps_numerator);
- break;
- case GST_FORMAT_BYTES:
- *dest_value = gst_util_uint64_scale_int (src_value,
- 3 * parse->info.pic_width * parse->info.pic_height, 2);
- break;
- default:
- res = FALSE;
- }
- break;
- default:
- res = FALSE;
- }
-done:
- gst_object_unref (parse);
- return res;
-
- /* ERRORS */
-no_header:
- {
- GST_DEBUG_OBJECT (parse, "no header yet, cannot convert");
- res = FALSE;
- goto done;
- }
-}
-
-static gboolean
-theora_parse_src_query (GstPad * pad, GstQuery * query)
-{
- GstTheoraParse *parse;
-
- gboolean res = FALSE;
-
- parse = GST_THEORA_PARSE (gst_pad_get_parent (pad));
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_POSITION:
- {
- gint64 frame, value;
- GstFormat my_format, format;
- gint64 time;
-
- frame = parse->prev_frame;
-
- GST_LOG_OBJECT (parse,
- "query %p: we have current frame: %" G_GINT64_FORMAT, query, frame);
-
- /* parse format */
- gst_query_parse_position (query, &format, NULL);
-
- /* and convert to the final format in two steps with time as the
- * intermediate step */
- my_format = GST_FORMAT_TIME;
- if (!(res =
- theora_parse_src_convert (parse->sinkpad, GST_FORMAT_DEFAULT,
- frame, &my_format, &time)))
- goto error;
-
- /* fixme: handle segments
- time = (time - parse->segment.start) + parse->segment.time;
- */
-
- GST_LOG_OBJECT (parse,
- "query %p: our time: %" GST_TIME_FORMAT " (conv to %s)",
- query, GST_TIME_ARGS (time), gst_format_get_name (format));
-
- if (!(res =
- theora_parse_src_convert (pad, my_format, time, &format, &value)))
- goto error;
-
- gst_query_set_position (query, format, value);
-
- GST_LOG_OBJECT (parse,
- "query %p: we return %" G_GINT64_FORMAT " (format %u)", query, value,
- format);
-
- break;
- }
- case GST_QUERY_DURATION:
- /* forward to peer for total */
- if (!(res = gst_pad_query (GST_PAD_PEER (parse->sinkpad), query)))
- goto error;
- break;
- case GST_QUERY_CONVERT:
- {
- GstFormat src_fmt, dest_fmt;
- gint64 src_val, dest_val;
-
- gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
- if (!(res =
- theora_parse_src_convert (pad, src_fmt, src_val, &dest_fmt,
- &dest_val)))
- goto error;
-
- gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
- break;
- }
- default:
- res = gst_pad_query_default (pad, query);
- break;
- }
-done:
- gst_object_unref (parse);
-
- return res;
-
- /* ERRORS */
-error:
- {
- GST_DEBUG_OBJECT (parse, "query failed");
- goto done;
- }
-}
-
-static GstStateChangeReturn
-theora_parse_change_state (GstElement * element, GstStateChange transition)
-{
- GstTheoraParse *parse = GST_THEORA_PARSE (element);
- GstStateChangeReturn ret;
- gint i;
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- th_info_init (&parse->info);
- th_comment_init (&parse->comment);
- parse->send_streamheader = TRUE;
- parse->buffer_queue = g_queue_new ();
- parse->event_queue = g_queue_new ();
- parse->prev_keyframe = -1;
- parse->prev_frame = -1;
- parse->granule_offset = 0;
- break;
- default:
- break;
- }
-
- ret = parent_class->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- th_info_clear (&parse->info);
- th_comment_clear (&parse->comment);
- theora_parse_clear_queue (parse);
- g_queue_free (parse->buffer_queue);
- g_queue_free (parse->event_queue);
- parse->buffer_queue = NULL;
- for (i = 0; i < 3; i++) {
- if (parse->streamheader[i]) {
- gst_buffer_unref (parse->streamheader[i]);
- parse->streamheader[i] = NULL;
- }
- }
- parse->streamheader_received = FALSE;
- break;
- default:
- break;
- }
-
- return ret;
-}
diff --git a/ext/theora/gsttheoraparse.h b/ext/theora/gsttheoraparse.h
deleted file mode 100644
index 83142879..00000000
--- a/ext/theora/gsttheoraparse.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- c-basic-offset: 2 -*-
- * GStreamer
- * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
- * Copyright (C) 2006 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_THEORA_PARSE_H__
-#define __GST_THEORA_PARSE_H__
-
-
-#include <gst/gst.h>
-#include <theora/theoradec.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_THEORA_PARSE \
- (gst_theora_parse_get_type())
-#define GST_THEORA_PARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_THEORA_PARSE,GstTheoraParse))
-#define GST_THEORA_PARSE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_THEORA_PARSE,GstTheoraParseClass))
-#define GST_IS_THEORA_PARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_THEORA_PARSE))
-#define GST_IS_THEORA_PARSE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_THEORA_PARSE))
-
-typedef struct _GstTheoraParse GstTheoraParse;
-typedef struct _GstTheoraParseClass GstTheoraParseClass;
-
-/**
- * GstTheoraParse:
- *
- * Opaque data structure.
- */
-struct _GstTheoraParse {
- GstElement element;
-
- GstPad * sinkpad;
- GstPad * srcpad;
-
- gboolean send_streamheader;
- gboolean streamheader_received;
- gboolean is_old_bitstream;
- GstBuffer * streamheader[3];
-
- GQueue * event_queue;
- GQueue * buffer_queue;
-
- th_info info;
- th_comment comment;
-
- gint64 prev_frame;
- gint64 prev_keyframe;
- guint32 fps_n;
- guint32 fps_d;
- gint shift;
- gint64 granule_offset;
-
- GstClockTime *times;
- gint npairs;
-};
-
-struct _GstTheoraParseClass {
- GstElementClass parent_class;
-};
-
-GType gst_theora_parse_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_THEORA_PARSE_H__ */
diff --git a/ext/vorbis/Makefile.am b/ext/vorbis/Makefile.am
deleted file mode 100644
index fc285a8d..00000000
--- a/ext/vorbis/Makefile.am
+++ /dev/null
@@ -1,46 +0,0 @@
-plugin_LTLIBRARIES =
-
-if USE_VORBIS
-plugin_LTLIBRARIES += libgstvorbis.la
-
-libgstvorbis_la_SOURCES = gstvorbis.c \
- gstvorbisdec.c \
- gstvorbisdeclib.c \
- gstvorbisenc.c \
- gstvorbisparse.c \
- gstvorbistag.c \
- gstvorbiscommon.c
-
-libgstvorbis_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(VORBIS_CFLAGS)
-## AM_PATH_VORBIS also sets VORBISENC_LIBS
-libgstvorbis_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/tag/libgsttag-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
- $(GST_LIBS) \
- $(VORBIS_LIBS) $(VORBISENC_LIBS)
-libgstvorbis_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstvorbis_la_LIBTOOLFLAGS = --tag=disable-static
-endif
-
-if USE_IVORBIS
-plugin_LTLIBRARIES += libgstivorbisdec.la
-
-libgstivorbisdec_la_SOURCES = gstivorbisdec.c \
- gstvorbisdec.c gstvorbisdeclib.c gstvorbiscommon.c
-libgstivorbisdec_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \
- -DTREMOR $(IVORBIS_CFLAGS)
-libgstivorbisdec_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/tag/libgsttag-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
- $(GST_LIBS) $(IVORBIS_LIBS)
-libgstivorbisdec_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstivorbisdec_la_LIBTOOLFLAGS = --tag=disable-static
-endif
-
-noinst_HEADERS = gstvorbisenc.h \
- gstvorbisdec.h \
- gstvorbisdeclib.h \
- gstvorbisparse.h \
- gstvorbistag.h \
- gstvorbiscommon.h
-
diff --git a/ext/vorbis/README b/ext/vorbis/README
deleted file mode 100644
index 6b315101..00000000
--- a/ext/vorbis/README
+++ /dev/null
@@ -1,16 +0,0 @@
-oggvorbisenc : encodes to vorbis inside an ogg stream. This is not the
- GStreamer way of doing things and should be removed for
- 0.9. It is still called "vorbisenc" for backward compatibility
- reasons. It also takes integer audio as input.
-vorbisenc : Encodes to a raw vorbis stream and should be used together
- with an ogg muxer such as "oggmux" it is called "rawvorbisenc".
- It also takes raw float samples as input.
-
-TODO for 0.9:
-
-- remove oggvorbisenc.c and oggvorbisenc.h
-- remove references to oggvorbisenc.[ch] in the Makefile and in vorbis.c
-- remove the element vorbisenc.
-- rename the element rawvorbisenc to vorbisenc.
-
-
diff --git a/ext/vorbis/gstivorbisdec.c b/ext/vorbis/gstivorbisdec.c
deleted file mode 100644
index d938238d..00000000
--- a/ext/vorbis/gstivorbisdec.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstvorbisdec.h"
-
-GST_DEBUG_CATEGORY (vorbisdec_debug);
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-
- /* if tremor is around, there is probably good reason for it, so preferred */
- if (!gst_element_register (plugin, "ivorbisdec", GST_RANK_SECONDARY,
- gst_vorbis_dec_get_type ()))
- return FALSE;
-
- GST_DEBUG_CATEGORY_INIT (vorbisdec_debug, "ivorbisdec", 0,
- "vorbis decoding element (integer decoder)");
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "ivorbisdec",
- "Vorbis Tremor decoder",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/vorbis/gstvorbis.c b/ext/vorbis/gstvorbis.c
deleted file mode 100644
index f710aaa3..00000000
--- a/ext/vorbis/gstvorbis.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gst/tag/tag.h"
-
-#include "gstvorbisenc.h"
-#include "gstvorbisdec.h"
-#include "gstvorbisparse.h"
-#include "gstvorbistag.h"
-
-GST_DEBUG_CATEGORY (vorbisenc_debug);
-GST_DEBUG_CATEGORY (vorbisdec_debug);
-GST_DEBUG_CATEGORY (vorbisparse_debug);
-GST_DEBUG_CATEGORY (vorbistag_debug);
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_element_register (plugin, "vorbisenc", GST_RANK_PRIMARY,
- GST_TYPE_VORBISENC))
- return FALSE;
-
- if (!gst_element_register (plugin, "vorbisdec", GST_RANK_PRIMARY,
- gst_vorbis_dec_get_type ()))
- return FALSE;
-
- if (!gst_element_register (plugin, "vorbisparse", GST_RANK_NONE,
- gst_vorbis_parse_get_type ()))
- return FALSE;
-
- if (!gst_element_register (plugin, "vorbistag", GST_RANK_NONE,
- gst_vorbis_tag_get_type ()))
- return FALSE;
-
- GST_DEBUG_CATEGORY_INIT (vorbisenc_debug, "vorbisenc", 0,
- "vorbis encoding element");
- GST_DEBUG_CATEGORY_INIT (vorbisdec_debug, "vorbisdec", 0,
- "vorbis decoding element");
- GST_DEBUG_CATEGORY_INIT (vorbisparse_debug, "vorbisparse", 0,
- "vorbis parsing element");
- GST_DEBUG_CATEGORY_INIT (vorbistag_debug, "vorbistag", 0,
- "vorbis tagging element");
-
- gst_tag_register_musicbrainz_tags ();
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "vorbis",
- "Vorbis plugin library",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/vorbis/gstvorbiscommon.c b/ext/vorbis/gstvorbiscommon.c
deleted file mode 100644
index c4dd408d..00000000
--- a/ext/vorbis/gstvorbiscommon.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* GStreamer
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstvorbiscommon.h"
-
-/* http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-800004.3.9 */
-const GstAudioChannelPosition gst_vorbis_channel_positions[][8] = {
- { /* Mono */
- GST_AUDIO_CHANNEL_POSITION_FRONT_MONO},
- { /* Stereo */
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT},
- { /* Stereo + Centre */
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT},
- { /* Quadraphonic */
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- },
- { /* Stereo + Centre + rear stereo */
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- },
- { /* Full 5.1 Surround */
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- },
- { /* 6.1 Surround, in Vorbis spec since 2010-01-13 */
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
- GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
- GST_AUDIO_CHANNEL_POSITION_LFE},
- { /* 7.1 Surround, in Vorbis spec since 2010-01-13 */
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
- GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_LFE},
-};
diff --git a/ext/vorbis/gstvorbiscommon.h b/ext/vorbis/gstvorbiscommon.h
deleted file mode 100644
index 563b8f71..00000000
--- a/ext/vorbis/gstvorbiscommon.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* GStreamer
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_VORBIS_COMMON_H__
-#define __GST_VORBIS_COMMON_H__
-
-#include <gst/gst.h>
-#include <gst/audio/multichannel.h>
-
-extern const GstAudioChannelPosition gst_vorbis_channel_positions[][8];
-
-#endif /* __GST_VORBIS_COMMON_H__ */
diff --git a/ext/vorbis/gstvorbisdec.c b/ext/vorbis/gstvorbisdec.c
deleted file mode 100644
index 85f36d09..00000000
--- a/ext/vorbis/gstvorbisdec.c
+++ /dev/null
@@ -1,1228 +0,0 @@
-/* GStreamer
- * Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-/**
- * SECTION:element-vorbisdec
- * @see_also: vorbisenc, oggdemux
- *
- * This element decodes a Vorbis stream to raw float audio.
- * <ulink url="http://www.vorbis.com/">Vorbis</ulink> is a royalty-free
- * audio codec maintained by the <ulink url="http://www.xiph.org/">Xiph.org
- * Foundation</ulink>.
- *
- * <refsect2>
- * <title>Example pipelines</title>
- * |[
- * gst-launch -v filesrc location=sine.ogg ! oggdemux ! vorbisdec ! audioconvert ! alsasink
- * ]| Decode an Ogg/Vorbis. To create an Ogg/Vorbis file refer to the documentation of vorbisenc.
- * </refsect2>
- *
- * Last reviewed on 2006-03-01 (0.10.4)
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "gstvorbisdec.h"
-#include <string.h>
-#include <gst/audio/audio.h>
-#include <gst/tag/tag.h>
-#include <gst/audio/multichannel.h>
-
-#include "gstvorbiscommon.h"
-
-GST_DEBUG_CATEGORY_EXTERN (vorbisdec_debug);
-#define GST_CAT_DEFAULT vorbisdec_debug
-
-static const GstElementDetails vorbis_dec_details =
- GST_VORBIS_DEC_ELEMENT_DETAILS;
-
-static GstStaticPadTemplate vorbis_dec_src_factory =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_VORBIS_DEC_SRC_CAPS);
-
-static GstStaticPadTemplate vorbis_dec_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-vorbis")
- );
-
-GST_BOILERPLATE (GST_VORBIS_DEC_GLIB_TYPE_NAME, gst_vorbis_dec, GstElement,
- GST_TYPE_ELEMENT);
-
-static void vorbis_dec_finalize (GObject * object);
-static gboolean vorbis_dec_sink_event (GstPad * pad, GstEvent * event);
-static GstFlowReturn vorbis_dec_chain (GstPad * pad, GstBuffer * buffer);
-static GstFlowReturn vorbis_dec_chain_forward (GstVorbisDec * vd,
- gboolean discont, GstBuffer * buffer);
-static GstStateChangeReturn vorbis_dec_change_state (GstElement * element,
- GstStateChange transition);
-
-static gboolean vorbis_dec_src_event (GstPad * pad, GstEvent * event);
-static gboolean vorbis_dec_src_query (GstPad * pad, GstQuery * query);
-static gboolean vorbis_dec_convert (GstPad * pad,
- GstFormat src_format, gint64 src_value,
- GstFormat * dest_format, gint64 * dest_value);
-
-static gboolean vorbis_dec_sink_query (GstPad * pad, GstQuery * query);
-
-static void
-gst_vorbis_dec_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- GstPadTemplate *src_template, *sink_template;
-
- src_template = gst_static_pad_template_get (&vorbis_dec_src_factory);
- gst_element_class_add_pad_template (element_class, src_template);
-
- sink_template = gst_static_pad_template_get (&vorbis_dec_sink_factory);
- gst_element_class_add_pad_template (element_class, sink_template);
-
- gst_element_class_set_details (element_class, &vorbis_dec_details);
-}
-
-static void
-gst_vorbis_dec_class_init (GstVorbisDecClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-
- gobject_class->finalize = vorbis_dec_finalize;
-
- gstelement_class->change_state = GST_DEBUG_FUNCPTR (vorbis_dec_change_state);
-}
-
-static const GstQueryType *
-vorbis_get_query_types (GstPad * pad)
-{
- static const GstQueryType vorbis_dec_src_query_types[] = {
- GST_QUERY_POSITION,
- GST_QUERY_DURATION,
- GST_QUERY_CONVERT,
- 0
- };
-
- return vorbis_dec_src_query_types;
-}
-
-static void
-gst_vorbis_dec_init (GstVorbisDec * dec, GstVorbisDecClass * g_class)
-{
- dec->sinkpad = gst_pad_new_from_static_template (&vorbis_dec_sink_factory,
- "sink");
-
- gst_pad_set_event_function (dec->sinkpad,
- GST_DEBUG_FUNCPTR (vorbis_dec_sink_event));
- gst_pad_set_chain_function (dec->sinkpad,
- GST_DEBUG_FUNCPTR (vorbis_dec_chain));
- gst_pad_set_query_function (dec->sinkpad,
- GST_DEBUG_FUNCPTR (vorbis_dec_sink_query));
- gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad);
-
- dec->srcpad = gst_pad_new_from_static_template (&vorbis_dec_src_factory,
- "src");
-
- gst_pad_set_event_function (dec->srcpad,
- GST_DEBUG_FUNCPTR (vorbis_dec_src_event));
- gst_pad_set_query_type_function (dec->srcpad,
- GST_DEBUG_FUNCPTR (vorbis_get_query_types));
- gst_pad_set_query_function (dec->srcpad,
- GST_DEBUG_FUNCPTR (vorbis_dec_src_query));
- gst_pad_use_fixed_caps (dec->srcpad);
- gst_element_add_pad (GST_ELEMENT (dec), dec->srcpad);
-
- dec->queued = NULL;
- dec->pendingevents = NULL;
- dec->taglist = NULL;
-}
-
-static void
-vorbis_dec_finalize (GObject * object)
-{
- /* Release any possibly allocated libvorbis data.
- * _clear functions can safely be called multiple times
- */
- GstVorbisDec *vd = GST_VORBIS_DEC (object);
-
- vorbis_block_clear (&vd->vb);
- vorbis_dsp_clear (&vd->vd);
- vorbis_comment_clear (&vd->vc);
- vorbis_info_clear (&vd->vi);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_vorbis_dec_reset (GstVorbisDec * dec)
-{
- dec->last_timestamp = GST_CLOCK_TIME_NONE;
- dec->discont = TRUE;
- dec->seqnum = gst_util_seqnum_next ();
- gst_segment_init (&dec->segment, GST_FORMAT_TIME);
-
- g_list_foreach (dec->queued, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (dec->queued);
- dec->queued = NULL;
- g_list_foreach (dec->gather, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (dec->gather);
- dec->gather = NULL;
- g_list_foreach (dec->decode, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (dec->decode);
- dec->decode = NULL;
- g_list_foreach (dec->pendingevents, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (dec->pendingevents);
- dec->pendingevents = NULL;
-
- if (dec->taglist)
- gst_tag_list_free (dec->taglist);
- dec->taglist = NULL;
-}
-
-
-static gboolean
-vorbis_dec_convert (GstPad * pad,
- GstFormat src_format, gint64 src_value,
- GstFormat * dest_format, gint64 * dest_value)
-{
- gboolean res = TRUE;
- GstVorbisDec *dec;
- guint64 scale = 1;
-
- if (src_format == *dest_format) {
- *dest_value = src_value;
- return TRUE;
- }
-
- dec = GST_VORBIS_DEC (gst_pad_get_parent (pad));
-
- if (!dec->initialized)
- goto no_header;
-
- if (dec->sinkpad == pad &&
- (src_format == GST_FORMAT_BYTES || *dest_format == GST_FORMAT_BYTES))
- goto no_format;
-
- switch (src_format) {
- case GST_FORMAT_TIME:
- switch (*dest_format) {
- case GST_FORMAT_BYTES:
- scale = dec->width * dec->vi.channels;
- case GST_FORMAT_DEFAULT:
- *dest_value =
- scale * gst_util_uint64_scale_int (src_value, dec->vi.rate,
- GST_SECOND);
- break;
- default:
- res = FALSE;
- }
- break;
- case GST_FORMAT_DEFAULT:
- switch (*dest_format) {
- case GST_FORMAT_BYTES:
- *dest_value = src_value * dec->width * dec->vi.channels;
- break;
- case GST_FORMAT_TIME:
- *dest_value =
- gst_util_uint64_scale_int (src_value, GST_SECOND, dec->vi.rate);
- break;
- default:
- res = FALSE;
- }
- break;
- case GST_FORMAT_BYTES:
- switch (*dest_format) {
- case GST_FORMAT_DEFAULT:
- *dest_value = src_value / (dec->width * dec->vi.channels);
- break;
- case GST_FORMAT_TIME:
- *dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND,
- dec->vi.rate * dec->width * dec->vi.channels);
- break;
- default:
- res = FALSE;
- }
- break;
- default:
- res = FALSE;
- }
-done:
- gst_object_unref (dec);
-
- return res;
-
- /* ERRORS */
-no_header:
- {
- GST_DEBUG_OBJECT (dec, "no header packets received");
- res = FALSE;
- goto done;
- }
-no_format:
- {
- GST_DEBUG_OBJECT (dec, "formats unsupported");
- res = FALSE;
- goto done;
- }
-}
-
-static gboolean
-vorbis_dec_src_query (GstPad * pad, GstQuery * query)
-{
- GstVorbisDec *dec;
- gboolean res = FALSE;
-
- dec = GST_VORBIS_DEC (gst_pad_get_parent (pad));
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_POSITION:
- {
- gint64 value;
- GstFormat format;
- gint64 time;
-
- gst_query_parse_position (query, &format, NULL);
-
- /* we start from the last seen time */
- time = dec->last_timestamp;
- /* correct for the segment values */
- time = gst_segment_to_stream_time (&dec->segment, GST_FORMAT_TIME, time);
-
- GST_LOG_OBJECT (dec,
- "query %p: our time: %" GST_TIME_FORMAT, query, GST_TIME_ARGS (time));
-
- /* and convert to the final format */
- if (!(res =
- vorbis_dec_convert (pad, GST_FORMAT_TIME, time, &format, &value)))
- goto error;
-
- gst_query_set_position (query, format, value);
-
- GST_LOG_OBJECT (dec,
- "query %p: we return %" G_GINT64_FORMAT " (format %u)", query, value,
- format);
-
- break;
- }
- case GST_QUERY_DURATION:
- {
- res = gst_pad_peer_query (dec->sinkpad, query);
- if (!res)
- goto error;
-
- break;
- }
- case GST_QUERY_CONVERT:
- {
- GstFormat src_fmt, dest_fmt;
- gint64 src_val, dest_val;
-
- gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
- if (!(res =
- vorbis_dec_convert (pad, src_fmt, src_val, &dest_fmt, &dest_val)))
- goto error;
- gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
- break;
- }
- default:
- res = gst_pad_query_default (pad, query);
- break;
- }
-done:
- gst_object_unref (dec);
-
- return res;
-
- /* ERRORS */
-error:
- {
- GST_WARNING_OBJECT (dec, "error handling query");
- goto done;
- }
-}
-
-static gboolean
-vorbis_dec_sink_query (GstPad * pad, GstQuery * query)
-{
- GstVorbisDec *dec;
- gboolean res;
-
- dec = GST_VORBIS_DEC (gst_pad_get_parent (pad));
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_CONVERT:
- {
- GstFormat src_fmt, dest_fmt;
- gint64 src_val, dest_val;
-
- gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
- if (!(res =
- vorbis_dec_convert (pad, src_fmt, src_val, &dest_fmt, &dest_val)))
- goto error;
- gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
- break;
- }
- default:
- res = gst_pad_query_default (pad, query);
- break;
- }
-
-done:
- gst_object_unref (dec);
-
- return res;
-
- /* ERRORS */
-error:
- {
- GST_DEBUG_OBJECT (dec, "error converting value");
- goto done;
- }
-}
-
-static gboolean
-vorbis_dec_src_event (GstPad * pad, GstEvent * event)
-{
- gboolean res = TRUE;
- GstVorbisDec *dec;
-
- dec = GST_VORBIS_DEC (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:
- {
- GstFormat format, tformat;
- gdouble rate;
- GstEvent *real_seek;
- GstSeekFlags flags;
- GstSeekType cur_type, stop_type;
- gint64 cur, stop;
- gint64 tcur, tstop;
- guint32 seqnum;
-
- gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur,
- &stop_type, &stop);
- seqnum = gst_event_get_seqnum (event);
- gst_event_unref (event);
-
- /* First bring the requested format to time */
- tformat = GST_FORMAT_TIME;
- if (!(res = vorbis_dec_convert (pad, format, cur, &tformat, &tcur)))
- goto convert_error;
- if (!(res = vorbis_dec_convert (pad, format, stop, &tformat, &tstop)))
- goto convert_error;
-
- /* then seek with time on the peer */
- real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME,
- flags, cur_type, tcur, stop_type, tstop);
- gst_event_set_seqnum (real_seek, seqnum);
-
- res = gst_pad_push_event (dec->sinkpad, real_seek);
- break;
- }
- default:
- res = gst_pad_push_event (dec->sinkpad, event);
- break;
- }
-done:
- gst_object_unref (dec);
-
- return res;
-
- /* ERRORS */
-convert_error:
- {
- GST_DEBUG_OBJECT (dec, "cannot convert start/stop for seek");
- goto done;
- }
-}
-
-static gboolean
-vorbis_dec_sink_event (GstPad * pad, GstEvent * event)
-{
- gboolean ret = FALSE;
- GstVorbisDec *dec;
-
- dec = GST_VORBIS_DEC (gst_pad_get_parent (pad));
-
- GST_LOG_OBJECT (dec, "handling event");
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_EOS:
- ret = gst_pad_push_event (dec->srcpad, event);
- break;
- case GST_EVENT_FLUSH_START:
- ret = gst_pad_push_event (dec->srcpad, event);
- break;
- case GST_EVENT_FLUSH_STOP:
- /* here we must clean any state in the decoder */
-#ifdef HAVE_VORBIS_SYNTHESIS_RESTART
- vorbis_synthesis_restart (&dec->vd);
-#endif
- gst_vorbis_dec_reset (dec);
- ret = gst_pad_push_event (dec->srcpad, event);
- break;
- case GST_EVENT_NEWSEGMENT:
- {
- GstFormat format;
- gdouble rate, arate;
- gint64 start, stop, time;
- gboolean update;
-
- gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
- &start, &stop, &time);
-
- /* we need time for now */
- if (format != GST_FORMAT_TIME)
- goto newseg_wrong_format;
-
- GST_DEBUG_OBJECT (dec,
- "newsegment: update %d, rate %g, arate %g, start %" GST_TIME_FORMAT
- ", stop %" GST_TIME_FORMAT ", time %" GST_TIME_FORMAT,
- update, rate, arate, GST_TIME_ARGS (start), GST_TIME_ARGS (stop),
- GST_TIME_ARGS (time));
-
- /* now configure the values */
- gst_segment_set_newsegment_full (&dec->segment, update,
- rate, arate, format, start, stop, time);
- dec->seqnum = gst_event_get_seqnum (event);
-
- if (dec->initialized)
- /* and forward */
- ret = gst_pad_push_event (dec->srcpad, event);
- else {
- /* store it to send once we're initialized */
- dec->pendingevents = g_list_append (dec->pendingevents, event);
- ret = TRUE;
- }
- break;
- }
- case GST_EVENT_TAG:
- {
- if (dec->initialized)
- /* and forward */
- ret = gst_pad_push_event (dec->srcpad, event);
- else {
- /* store it to send once we're initialized */
- dec->pendingevents = g_list_append (dec->pendingevents, event);
- ret = TRUE;
- }
- break;
- }
- default:
- ret = gst_pad_push_event (dec->srcpad, event);
- break;
- }
-done:
- gst_object_unref (dec);
-
- return ret;
-
- /* ERRORS */
-newseg_wrong_format:
- {
- GST_DEBUG_OBJECT (dec, "received non TIME newsegment");
- goto done;
- }
-}
-
-static GstFlowReturn
-vorbis_handle_identification_packet (GstVorbisDec * vd)
-{
- GstCaps *caps;
- const GstAudioChannelPosition *pos = NULL;
- gint width = GST_VORBIS_DEC_DEFAULT_SAMPLE_WIDTH;
-
- switch (vd->vi.channels) {
- case 1:
- case 2:
- /* nothing */
- break;
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- pos = gst_vorbis_channel_positions[vd->vi.channels - 1];
- break;
- default:{
- gint i;
- GstAudioChannelPosition *posn =
- g_new (GstAudioChannelPosition, vd->vi.channels);
-
- GST_ELEMENT_WARNING (GST_ELEMENT (vd), STREAM, DECODE,
- (NULL), ("Using NONE channel layout for more than 8 channels"));
-
- for (i = 0; i < vd->vi.channels; i++)
- posn[i] = GST_AUDIO_CHANNEL_POSITION_NONE;
-
- pos = posn;
- }
- }
-
- /* negotiate width with downstream */
- caps = gst_pad_get_allowed_caps (vd->srcpad);
- if (caps) {
- if (!gst_caps_is_empty (caps)) {
- GstStructure *s;
-
- s = gst_caps_get_structure (caps, 0);
- /* template ensures 16 or 32 */
- gst_structure_get_int (s, "width", &width);
- }
- gst_caps_unref (caps);
- }
- vd->width = width >> 3;
-
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (vd->srcpad));
- gst_caps_set_simple (caps, "rate", G_TYPE_INT, vd->vi.rate,
- "channels", G_TYPE_INT, vd->vi.channels,
- "width", G_TYPE_INT, width, NULL);
-
- if (pos) {
- gst_audio_set_channel_positions (gst_caps_get_structure (caps, 0), pos);
- }
-
- if (vd->vi.channels > 8) {
- g_free ((GstAudioChannelPosition *) pos);
- }
-
- gst_pad_set_caps (vd->srcpad, caps);
- gst_caps_unref (caps);
-
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-vorbis_handle_comment_packet (GstVorbisDec * vd, ogg_packet * packet)
-{
- guint bitrate = 0;
- gchar *encoder = NULL;
- GstTagList *list, *old_list;
- GstBuffer *buf;
-
- GST_DEBUG_OBJECT (vd, "parsing comment packet");
-
- buf = gst_buffer_new ();
- GST_BUFFER_DATA (buf) = gst_ogg_packet_data (packet);
- GST_BUFFER_SIZE (buf) = gst_ogg_packet_size (packet);
-
- list =
- gst_tag_list_from_vorbiscomment_buffer (buf, (guint8 *) "\003vorbis", 7,
- &encoder);
-
- old_list = vd->taglist;
- vd->taglist = gst_tag_list_merge (vd->taglist, list, GST_TAG_MERGE_REPLACE);
-
- if (old_list)
- gst_tag_list_free (old_list);
- gst_tag_list_free (list);
- gst_buffer_unref (buf);
-
- if (!vd->taglist) {
- GST_ERROR_OBJECT (vd, "couldn't decode comments");
- vd->taglist = gst_tag_list_new ();
- }
- if (encoder) {
- if (encoder[0])
- gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
- GST_TAG_ENCODER, encoder, NULL);
- g_free (encoder);
- }
- gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
- GST_TAG_ENCODER_VERSION, vd->vi.version,
- GST_TAG_AUDIO_CODEC, "Vorbis", NULL);
- if (vd->vi.bitrate_nominal > 0 && vd->vi.bitrate_nominal <= 0x7FFFFFFF) {
- gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
- GST_TAG_NOMINAL_BITRATE, (guint) vd->vi.bitrate_nominal, NULL);
- bitrate = vd->vi.bitrate_nominal;
- }
- if (vd->vi.bitrate_upper > 0 && vd->vi.bitrate_upper <= 0x7FFFFFFF) {
- gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
- GST_TAG_MAXIMUM_BITRATE, (guint) vd->vi.bitrate_upper, NULL);
- if (!bitrate)
- bitrate = vd->vi.bitrate_upper;
- }
- if (vd->vi.bitrate_lower > 0 && vd->vi.bitrate_lower <= 0x7FFFFFFF) {
- gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
- GST_TAG_MINIMUM_BITRATE, (guint) vd->vi.bitrate_lower, NULL);
- if (!bitrate)
- bitrate = vd->vi.bitrate_lower;
- }
- if (bitrate) {
- gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
- GST_TAG_BITRATE, (guint) bitrate, NULL);
- }
-
- if (vd->initialized) {
- gst_element_found_tags_for_pad (GST_ELEMENT_CAST (vd), vd->srcpad,
- vd->taglist);
- vd->taglist = NULL;
- } else {
- /* Only post them as messages for the time being. *
- * They will be pushed on the pad once the decoder is initialized */
- gst_element_post_message (GST_ELEMENT_CAST (vd),
- gst_message_new_tag (GST_OBJECT (vd), gst_tag_list_copy (vd->taglist)));
- }
-
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-vorbis_handle_type_packet (GstVorbisDec * vd)
-{
- GList *walk;
- gint res;
-
- g_assert (vd->initialized == FALSE);
-
- if (G_UNLIKELY ((res = vorbis_synthesis_init (&vd->vd, &vd->vi))))
- goto synthesis_init_error;
-
- if (G_UNLIKELY ((res = vorbis_block_init (&vd->vd, &vd->vb))))
- goto block_init_error;
-
- vd->initialized = TRUE;
-
- if (vd->pendingevents) {
- for (walk = vd->pendingevents; walk; walk = g_list_next (walk))
- gst_pad_push_event (vd->srcpad, GST_EVENT_CAST (walk->data));
- g_list_free (vd->pendingevents);
- vd->pendingevents = NULL;
- }
-
- if (vd->taglist) {
- /* The tags have already been sent on the bus as messages. */
- gst_pad_push_event (vd->srcpad, gst_event_new_tag (vd->taglist));
- vd->taglist = NULL;
- }
- return GST_FLOW_OK;
-
- /* ERRORS */
-synthesis_init_error:
- {
- GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
- (NULL), ("couldn't initialize synthesis (%d)", res));
- return GST_FLOW_ERROR;
- }
-block_init_error:
- {
- GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
- (NULL), ("couldn't initialize block (%d)", res));
- return GST_FLOW_ERROR;
- }
-}
-
-static GstFlowReturn
-vorbis_handle_header_packet (GstVorbisDec * vd, ogg_packet * packet)
-{
- GstFlowReturn res;
- gint ret;
-
- GST_DEBUG_OBJECT (vd, "parsing header packet");
-
- /* Packetno = 0 if the first byte is exactly 0x01 */
- packet->b_o_s = ((gst_ogg_packet_data (packet))[0] == 0x1) ? 1 : 0;
-
- if ((ret = vorbis_synthesis_headerin (&vd->vi, &vd->vc, packet)))
- goto header_read_error;
-
- switch ((gst_ogg_packet_data (packet))[0]) {
- case 0x01:
- res = vorbis_handle_identification_packet (vd);
- break;
- case 0x03:
- res = vorbis_handle_comment_packet (vd, packet);
- break;
- case 0x05:
- res = vorbis_handle_type_packet (vd);
- break;
- default:
- /* ignore */
- g_warning ("unknown vorbis header packet found");
- res = GST_FLOW_OK;
- break;
- }
- return res;
-
- /* ERRORS */
-header_read_error:
- {
- GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
- (NULL), ("couldn't read header packet (%d)", ret));
- return GST_FLOW_ERROR;
- }
-}
-
-static GstFlowReturn
-vorbis_dec_push_forward (GstVorbisDec * dec, GstBuffer * buf)
-{
- GstFlowReturn result;
-
- /* clip */
- if (!(buf = gst_audio_buffer_clip (buf, &dec->segment, dec->vi.rate,
- dec->vi.channels * dec->width))) {
- GST_LOG_OBJECT (dec, "clipped buffer");
- return GST_FLOW_OK;
- }
-
- if (dec->discont) {
- GST_LOG_OBJECT (dec, "setting DISCONT");
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
- dec->discont = FALSE;
- }
-
- GST_DEBUG_OBJECT (dec,
- "pushing time %" GST_TIME_FORMAT ", dur %" GST_TIME_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
- GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
-
- result = gst_pad_push (dec->srcpad, buf);
-
- return result;
-}
-
-static GstFlowReturn
-vorbis_dec_push_reverse (GstVorbisDec * dec, GstBuffer * buf)
-{
- GstFlowReturn result = GST_FLOW_OK;
-
- dec->queued = g_list_prepend (dec->queued, buf);
-
- return result;
-}
-
-static void
-vorbis_do_timestamps (GstVorbisDec * vd, GstBuffer * buf, gboolean reverse,
- GstClockTime timestamp, GstClockTime duration)
-{
- /* interpolate reverse */
- if (vd->last_timestamp != -1 && reverse)
- vd->last_timestamp -= duration;
-
- /* take buffer timestamp, use interpolated timestamp otherwise */
- if (timestamp != -1)
- vd->last_timestamp = timestamp;
- else
- timestamp = vd->last_timestamp;
-
- /* interpolate forwards */
- if (vd->last_timestamp != -1 && !reverse)
- vd->last_timestamp += duration;
-
- GST_BUFFER_TIMESTAMP (buf) = timestamp;
- GST_BUFFER_DURATION (buf) = duration;
-}
-
-static GstFlowReturn
-vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet,
- GstClockTime timestamp, GstClockTime duration)
-{
- vorbis_sample_t **pcm;
- guint sample_count;
- GstBuffer *out;
- GstFlowReturn result;
- gint size;
-
- if (G_UNLIKELY (!vd->initialized))
- goto not_initialized;
-
- /* normal data packet */
- /* FIXME, we can skip decoding if the packet is outside of the
- * segment, this is however not very trivial as we need a previous
- * packet to decode the current one so we must be carefull not to
- * throw away too much. For now we decode everything and clip right
- * before pushing data. */
- if (G_UNLIKELY (vorbis_synthesis (&vd->vb, packet)))
- goto could_not_read;
-
- if (G_UNLIKELY (vorbis_synthesis_blockin (&vd->vd, &vd->vb) < 0))
- goto not_accepted;
-
- /* assume all goes well here */
- result = GST_FLOW_OK;
-
- /* count samples ready for reading */
- if ((sample_count = vorbis_synthesis_pcmout (&vd->vd, NULL)) == 0)
- goto done;
-
- size = sample_count * vd->vi.channels * vd->width;
- GST_LOG_OBJECT (vd, "%d samples ready for reading, size %d", sample_count,
- size);
-
- /* alloc buffer for it */
- result =
- gst_pad_alloc_buffer_and_set_caps (vd->srcpad, GST_BUFFER_OFFSET_NONE,
- size, GST_PAD_CAPS (vd->srcpad), &out);
- if (G_UNLIKELY (result != GST_FLOW_OK))
- goto done;
-
- /* get samples ready for reading now, should be sample_count */
- if (G_UNLIKELY ((vorbis_synthesis_pcmout (&vd->vd, &pcm)) != sample_count))
- goto wrong_samples;
-
- /* copy samples in buffer */
- copy_samples ((vorbis_sample_t *) GST_BUFFER_DATA (out), pcm, sample_count,
- vd->vi.channels, vd->width);
-
- GST_LOG_OBJECT (vd, "setting output size to %d", size);
- GST_BUFFER_SIZE (out) = size;
-
- /* this should not overflow */
- if (duration == -1)
- duration = sample_count * GST_SECOND / vd->vi.rate;
-
- vorbis_do_timestamps (vd, out, FALSE, timestamp, duration);
-
- if (vd->segment.rate >= 0.0)
- result = vorbis_dec_push_forward (vd, out);
- else
- result = vorbis_dec_push_reverse (vd, out);
-
-done:
- vorbis_synthesis_read (&vd->vd, sample_count);
-
- return result;
-
- /* ERRORS */
-not_initialized:
- {
- GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
- (NULL), ("no header sent yet"));
- return GST_FLOW_ERROR;
- }
-could_not_read:
- {
- GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
- (NULL), ("couldn't read data packet"));
- return GST_FLOW_ERROR;
- }
-not_accepted:
- {
- GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
- (NULL), ("vorbis decoder did not accept data packet"));
- return GST_FLOW_ERROR;
- }
-wrong_samples:
- {
- gst_buffer_unref (out);
- GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
- (NULL), ("vorbis decoder reported wrong number of samples"));
- return GST_FLOW_ERROR;
- }
-}
-
-static GstFlowReturn
-vorbis_dec_decode_buffer (GstVorbisDec * vd, GstBuffer * buffer)
-{
- ogg_packet *packet;
- ogg_packet_wrapper packet_wrapper;
- GstFlowReturn result = GST_FLOW_OK;
-
- /* make ogg_packet out of the buffer */
- gst_ogg_packet_wrapper_from_buffer (&packet_wrapper, buffer);
- packet = gst_ogg_packet_from_wrapper (&packet_wrapper);
- /* set some more stuff */
- packet->granulepos = -1;
- packet->packetno = 0; /* we don't care */
- /* EOS does not matter, it is used in vorbis to implement clipping the last
- * block of samples based on the granulepos. We clip based on segments. */
- packet->e_o_s = 0;
-
- GST_LOG_OBJECT (vd, "decode buffer of size %ld", packet->bytes);
-
- /* error out on empty header packets, but just skip empty data packets */
- if (G_UNLIKELY (packet->bytes == 0)) {
- if (vd->initialized)
- goto empty_buffer;
- else
- goto empty_header;
- }
-
- /* switch depending on packet type */
- if ((gst_ogg_packet_data (packet))[0] & 1) {
- if (vd->initialized) {
- GST_WARNING_OBJECT (vd, "Already initialized, so ignoring header packet");
- goto done;
- }
- result = vorbis_handle_header_packet (vd, packet);
- } else {
- GstClockTime timestamp, duration;
-
- timestamp = GST_BUFFER_TIMESTAMP (buffer);
- duration = GST_BUFFER_DURATION (buffer);
-
- result = vorbis_handle_data_packet (vd, packet, timestamp, duration);
- }
-
-done:
- return result;
-
-empty_buffer:
- {
- /* don't error out here, just ignore the buffer, it's invalid for vorbis
- * but not fatal. */
- GST_WARNING_OBJECT (vd, "empty buffer received, ignoring");
- result = GST_FLOW_OK;
- goto done;
- }
-
-/* ERRORS */
-empty_header:
- {
- GST_ELEMENT_ERROR (vd, STREAM, DECODE, (NULL), ("empty header received"));
- result = GST_FLOW_ERROR;
- vd->discont = TRUE;
- goto done;
- }
-}
-
-/*
- * Input:
- * Buffer decoding order: 7 8 9 4 5 6 3 1 2 EOS
- * Discont flag: D D D D
- *
- * - Each Discont marks a discont in the decoding order.
- *
- * for vorbis, each buffer is a keyframe when we have the previous
- * buffer. This means that to decode buffer 7, we need buffer 6, which
- * arrives out of order.
- *
- * we first gather buffers in the gather queue until we get a DISCONT. We
- * prepend each incomming buffer so that they are in reversed order.
- *
- * gather queue: 9 8 7
- * decode queue:
- * output queue:
- *
- * When a DISCONT is received (buffer 4), we move the gather queue to the
- * decode queue. This is simply done be taking the head of the gather queue
- * and prepending it to the decode queue. This yields:
- *
- * gather queue:
- * decode queue: 7 8 9
- * output queue:
- *
- * Then we decode each buffer in the decode queue in order and put the output
- * buffer in the output queue. The first buffer (7) will not produce any output
- * because it needs the previous buffer (6) which did not arrive yet. This
- * yields:
- *
- * gather queue:
- * decode queue: 7 8 9
- * output queue: 9 8
- *
- * Then we remove the consumed buffers from the decode queue. Buffer 7 is not
- * completely consumed, we need to keep it around for when we receive buffer
- * 6. This yields:
- *
- * gather queue:
- * decode queue: 7
- * output queue: 9 8
- *
- * Then we accumulate more buffers:
- *
- * gather queue: 6 5 4
- * decode queue: 7
- * output queue:
- *
- * prepending to the decode queue on DISCONT yields:
- *
- * gather queue:
- * decode queue: 4 5 6 7
- * output queue:
- *
- * after decoding and keeping buffer 4:
- *
- * gather queue:
- * decode queue: 4
- * output queue: 7 6 5
- *
- * Etc..
- */
-static GstFlowReturn
-vorbis_dec_flush_decode (GstVorbisDec * dec)
-{
- GstFlowReturn res = GST_FLOW_OK;
- GList *walk;
-
- walk = dec->decode;
-
- GST_DEBUG_OBJECT (dec, "flushing buffers to decoder");
-
- while (walk) {
- GList *next;
- GstBuffer *buf = GST_BUFFER_CAST (walk->data);
-
- GST_DEBUG_OBJECT (dec, "decoding buffer %p, ts %" GST_TIME_FORMAT,
- buf, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
-
- next = g_list_next (walk);
-
- /* decode buffer, prepend to output queue */
- res = vorbis_dec_decode_buffer (dec, buf);
-
- /* if we generated output, we can discard the buffer, else we
- * keep it in the queue */
- if (dec->queued) {
- GST_DEBUG_OBJECT (dec, "decoded buffer to %p", dec->queued->data);
- dec->decode = g_list_delete_link (dec->decode, walk);
- gst_buffer_unref (buf);
- } else {
- GST_DEBUG_OBJECT (dec, "buffer did not decode, keeping");
- }
- walk = next;
- }
- while (dec->queued) {
- GstBuffer *buf = GST_BUFFER_CAST (dec->queued->data);
- GstClockTime timestamp, duration;
-
- timestamp = GST_BUFFER_TIMESTAMP (buf);
- duration = GST_BUFFER_DURATION (buf);
-
- vorbis_do_timestamps (dec, buf, TRUE, timestamp, duration);
- res = vorbis_dec_push_forward (dec, buf);
-
- dec->queued = g_list_delete_link (dec->queued, dec->queued);
- }
- return res;
-}
-
-static GstFlowReturn
-vorbis_dec_chain_reverse (GstVorbisDec * vd, gboolean discont, GstBuffer * buf)
-{
- GstFlowReturn result = GST_FLOW_OK;
-
- /* if we have a discont, move buffers to the decode list */
- if (G_UNLIKELY (discont)) {
- GST_DEBUG_OBJECT (vd, "received discont");
- while (vd->gather) {
- GstBuffer *gbuf;
-
- gbuf = GST_BUFFER_CAST (vd->gather->data);
- /* remove from the gather list */
- vd->gather = g_list_delete_link (vd->gather, vd->gather);
- /* copy to decode queue */
- vd->decode = g_list_prepend (vd->decode, gbuf);
- }
- /* flush and decode the decode queue */
- result = vorbis_dec_flush_decode (vd);
- }
-
- GST_DEBUG_OBJECT (vd, "gathering buffer %p of size %u, time %" GST_TIME_FORMAT
- ", dur %" GST_TIME_FORMAT, buf, GST_BUFFER_SIZE (buf),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
- GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
-
- /* add buffer to gather queue */
- vd->gather = g_list_prepend (vd->gather, buf);
-
- return result;
-}
-
-static GstFlowReturn
-vorbis_dec_chain_forward (GstVorbisDec * vd, gboolean discont,
- GstBuffer * buffer)
-{
- GstFlowReturn result;
-
- result = vorbis_dec_decode_buffer (vd, buffer);
-
- gst_buffer_unref (buffer);
-
- return result;
-}
-
-static GstFlowReturn
-vorbis_dec_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstVorbisDec *vd;
- GstFlowReturn result = GST_FLOW_OK;
- gboolean discont;
-
- vd = GST_VORBIS_DEC (gst_pad_get_parent (pad));
-
- discont = GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT);
-
- /* resync on DISCONT */
- if (G_UNLIKELY (discont)) {
- GST_DEBUG_OBJECT (vd, "received DISCONT buffer");
- vd->last_timestamp = GST_CLOCK_TIME_NONE;
-#ifdef HAVE_VORBIS_SYNTHESIS_RESTART
- vorbis_synthesis_restart (&vd->vd);
-#endif
- vd->discont = TRUE;
- }
-
- if (vd->segment.rate >= 0.0)
- result = vorbis_dec_chain_forward (vd, discont, buffer);
- else
- result = vorbis_dec_chain_reverse (vd, discont, buffer);
-
- gst_object_unref (vd);
-
- return result;
-}
-
-static GstStateChangeReturn
-vorbis_dec_change_state (GstElement * element, GstStateChange transition)
-{
- GstVorbisDec *vd = GST_VORBIS_DEC (element);
- GstStateChangeReturn res;
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- vorbis_info_init (&vd->vi);
- vorbis_comment_init (&vd->vc);
- vd->initialized = FALSE;
- gst_vorbis_dec_reset (vd);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- default:
- break;
- }
-
- res = parent_class->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- GST_DEBUG_OBJECT (vd, "PAUSED -> READY, clearing vorbis structures");
- vd->initialized = FALSE;
- vorbis_block_clear (&vd->vb);
- vorbis_dsp_clear (&vd->vd);
- vorbis_comment_clear (&vd->vc);
- vorbis_info_clear (&vd->vi);
- gst_vorbis_dec_reset (vd);
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- break;
- default:
- break;
- }
-
- return res;
-}
diff --git a/ext/vorbis/gstvorbisdec.h b/ext/vorbis/gstvorbisdec.h
deleted file mode 100644
index 1c3ddad3..00000000
--- a/ext/vorbis/gstvorbisdec.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- c-basic-offset: 2 -*-
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_VORBIS_DEC_H__
-#define __GST_VORBIS_DEC_H__
-
-
-#include <gst/gst.h>
-#include "gstvorbisdeclib.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_VORBIS_DEC \
- (gst_vorbis_dec_get_type())
-#define GST_VORBIS_DEC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VORBIS_DEC,GstVorbisDec))
-#define GST_VORBIS_DEC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VORBIS_DEC,GstVorbisDecClass))
-#define GST_IS_VORBIS_DEC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VORBIS_DEC))
-#define GST_IS_VORBIS_DEC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VORBIS_DEC))
-
-typedef struct _GstVorbisDec GstVorbisDec;
-typedef struct _GstVorbisDecClass GstVorbisDecClass;
-
-/**
- * GstVorbisDec:
- *
- * Opaque data structure.
- */
-struct _GstVorbisDec {
- GstElement element;
-
- GstPad *sinkpad;
- GstPad *srcpad;
-
- vorbis_dsp_state vd;
- vorbis_info vi;
- vorbis_comment vc;
- vorbis_block vb;
-
- gboolean initialized;
- guint width;
-
- /* list of buffers that need timestamps */
- GList *queued;
- /* list of raw output buffers */
- GList *output;
- /* gather/decode queues for reverse playback */
- GList *gather;
- GList *decode;
-
- GstSegment segment;
- gboolean discont;
- guint32 seqnum;
-
- GstClockTime last_timestamp;
-
- GList *pendingevents;
- GstTagList *taglist;
-};
-
-struct _GstVorbisDecClass {
- GstElementClass parent_class;
-};
-
-GType gst_vorbis_dec_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_VORBIS_DEC_H__ */
diff --git a/ext/vorbis/gstvorbisdeclib.c b/ext/vorbis/gstvorbisdeclib.c
deleted file mode 100644
index 9f3331c3..00000000
--- a/ext/vorbis/gstvorbisdeclib.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* GStreamer
- * Copyright (C) 2010 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
- * Copyright (C) 2010 Nokia Corporation. All rights reserved.
- * Contact: Stefan Kost <stefan.kost@nokia.com>
- *
- * Tremor modifications <2006>:
- * Chris Lord, OpenedHand Ltd. <chris@openedhand.com>, http://www.o-hand.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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstvorbisdeclib.h"
-
-#ifndef TREMOR
-/* These samples can be outside of the float -1.0 -- 1.0 range, this
- * is allowed, downstream elements are supposed to clip */
-void
-copy_samples (vorbis_sample_t * out, vorbis_sample_t ** in, guint samples,
- gint channels, gint width)
-{
- gint i, j;
-
- g_assert (width == 4);
-
-#ifdef GST_VORBIS_DEC_SEQUENTIAL
- for (i = 0; i < channels; i++) {
- memcpy (out, in[i], samples * sizeof (float));
- out += samples;
- }
-#else
- for (j = 0; j < samples; j++) {
- for (i = 0; i < channels; i++) {
- *out++ = in[i][j];
- }
- }
-#endif
-}
-
-#else
-
-/* Taken from Tremor, misc.h */
-#ifdef _ARM_ASSEM_
-static inline ogg_int32_t
-CLIP_TO_15 (ogg_int32_t x)
-{
- int tmp;
- asm volatile ("subs %1, %0, #32768\n\t"
- "movpl %0, #0x7f00\n\t"
- "orrpl %0, %0, #0xff\n"
- "adds %1, %0, #32768\n\t"
- "movmi %0, #0x8000":"+r" (x), "=r" (tmp)
- ::"cc");
-
- return (x);
-}
-#else
-static inline ogg_int32_t
-CLIP_TO_15 (ogg_int32_t x)
-{
- int ret = x;
-
- ret -= ((x <= 32767) - 1) & (x - 32767);
- ret -= ((x >= -32768) - 1) & (x + 32768);
- return (ret);
-}
-#endif
-
-static void
-copy_samples_32 (gint32 * out, ogg_int32_t ** in, guint samples, gint channels)
-{
- gint i, j;
-
- for (j = 0; j < samples; j++) {
- for (i = 0; i < channels; i++) {
- *out++ = CLIP_TO_15 (in[i][j] >> 9);
- }
- }
-}
-
-static void
-copy_samples_16 (gint16 * out, ogg_int32_t ** in, guint samples, gint channels)
-{
- gint i, j;
-
- for (j = 0; j < samples; j++) {
- for (i = 0; i < channels; i++) {
- *out++ = CLIP_TO_15 (in[i][j] >> 9);
- }
- }
-}
-
-void
-copy_samples (vorbis_sample_t * out, vorbis_sample_t ** in, guint samples,
- gint channels, gint width)
-{
- if (width == 4) {
- copy_samples_32 ((gint32 *) out, in, samples, channels);
- } else if (width == 2) {
- copy_samples_16 ((gint16 *) out, in, samples, channels);
- } else {
- g_assert_not_reached ();
- }
-}
-
-#endif
diff --git a/ext/vorbis/gstvorbisdeclib.h b/ext/vorbis/gstvorbisdeclib.h
deleted file mode 100644
index a438fa85..00000000
--- a/ext/vorbis/gstvorbisdeclib.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/* GStreamer
- * Copyright (C) 2010 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
- * Copyright (C) 2010 Nokia Corporation. All rights reserved.
- * Contact: Stefan Kost <stefan.kost@nokia.com>
- *
- * Tremor modifications <2006>:
- * Chris Lord, OpenedHand Ltd. <chris@openedhand.com>, http://www.o-hand.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_VORBIS_DEC_LIB_H__
-#define __GST_VORBIS_DEC_LIB_H__
-
-#include <gst/gst.h>
-
-#ifndef TREMOR
-
-#include <vorbis/codec.h>
-
-typedef float vorbis_sample_t;
-typedef ogg_packet ogg_packet_wrapper;
-
-#define GST_VORBIS_DEC_ELEMENT_DETAILS \
-GST_ELEMENT_DETAILS ("Vorbis audio decoder", \
- "Codec/Decoder/Audio", \
- "decode raw vorbis streams to float audio", \
- "Benjamin Otte <in7y118@public.uni-hamburg.de>")
-
-#define GST_VORBIS_DEC_SRC_CAPS \
- GST_STATIC_CAPS ("audio/x-raw-float, " "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, 256 ], " "endianness = (int) BYTE_ORDER, " \
- "width = (int) 32")
-
-#define GST_VORBIS_DEC_DEFAULT_SAMPLE_WIDTH (32)
-
-#define GST_VORBIS_DEC_GLIB_TYPE_NAME GstVorbisDec
-
-static inline guint8 *
-gst_ogg_packet_data (ogg_packet * p)
-{
- return (guint8 *) p->packet;
-}
-
-static inline gint
-gst_ogg_packet_size (ogg_packet * p)
-{
- return p->bytes;
-}
-
-static inline void
-gst_ogg_packet_wrapper_from_buffer (ogg_packet * packet, GstBuffer * buffer)
-{
- packet->packet = GST_BUFFER_DATA (buffer);
- packet->bytes = GST_BUFFER_SIZE (buffer);
-}
-
-static inline ogg_packet *
-gst_ogg_packet_from_wrapper (ogg_packet_wrapper * packet)
-{
- return packet;
-}
-
-#else
-
-#include <tremor/ivorbiscodec.h>
-
-typedef ogg_int32_t vorbis_sample_t;
-typedef struct _ogg_packet_wrapper ogg_packet_wrapper;
-
-struct _ogg_packet_wrapper {
- ogg_packet packet;
- ogg_reference ref;
- ogg_buffer buf;
-};
-
-#define GST_VORBIS_DEC_ELEMENT_DETAILS \
-GST_ELEMENT_DETAILS ("Vorbis audio decoder", \
- "Codec/Decoder/Audio", \
- "decode raw vorbis streams to integer audio", \
- "Benjamin Otte <in7y118@public.uni-hamburg.de>\n" \
- "Chris Lord <chris@openedhand.com>")
-
-#define GST_VORBIS_DEC_SRC_CAPS \
- GST_STATIC_CAPS ("audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, 6 ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) { 16, 32 }, " \
- "depth = (int) 16, " "signed = (boolean) true")
-
-#define GST_VORBIS_DEC_DEFAULT_SAMPLE_WIDTH (16)
-
-/* we need a different type name here */
-#define GST_VORBIS_DEC_GLIB_TYPE_NAME GstIVorbisDec
-
-/* and still have it compile */
-typedef struct _GstVorbisDec GstIVorbisDec;
-typedef struct _GstVorbisDecClass GstIVorbisDecClass;
-
-/* compensate minor variation */
-#define vorbis_synthesis(a, b) vorbis_synthesis (a, b, 1)
-
-static inline guint8 *
-gst_ogg_packet_data (ogg_packet * p)
-{
- return (guint8 *) p->packet->buffer->data;
-}
-
-static inline gint
-gst_ogg_packet_size (ogg_packet * p)
-{
- return p->packet->buffer->size;
-}
-
-static inline void
-gst_ogg_packet_wrapper_from_buffer (ogg_packet_wrapper * packet,
- GstBuffer * buffer)
-{
- ogg_reference *ref = &packet->ref;
- ogg_buffer *buf = &packet->buf;
-
- buf->data = GST_BUFFER_DATA (buffer);
- buf->size = GST_BUFFER_SIZE (buffer);
- buf->refcount = 1;
- buf->ptr.owner = NULL;
- buf->ptr.next = NULL;
-
- ref->buffer = buf;
- ref->begin = 0;
- ref->length = buf->size;
- ref->next = NULL;
-
- packet->packet.packet = ref;
- packet->packet.bytes = ref->length;
-}
-
-static inline ogg_packet *
-gst_ogg_packet_from_wrapper (ogg_packet_wrapper * packet)
-{
- return &(packet->packet);
-}
-
-#endif
-
-void copy_samples (vorbis_sample_t *out, vorbis_sample_t **in,
- guint samples, gint channels, gint width);
-
-
-#endif /* __GST_VORBIS_DEC_LIB_H__ */
diff --git a/ext/vorbis/gstvorbisenc.c b/ext/vorbis/gstvorbisenc.c
deleted file mode 100644
index b09723b2..00000000
--- a/ext/vorbis/gstvorbisenc.c
+++ /dev/null
@@ -1,1432 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-vorbisenc
- * @see_also: vorbisdec, oggmux
- *
- * This element encodes raw float audio into a Vorbis stream.
- * <ulink url="http://www.vorbis.com/">Vorbis</ulink> is a royalty-free
- * audio codec maintained by the <ulink url="http://www.xiph.org/">Xiph.org
- * Foundation</ulink>.
- *
- * <refsect2>
- * <title>Example pipelines</title>
- * |[
- * gst-launch -v audiotestsrc wave=sine num-buffers=100 ! audioconvert ! vorbisenc ! oggmux ! filesink location=sine.ogg
- * ]| Encode a test sine signal to Ogg/Vorbis. Note that the resulting file
- * will be really small because a sine signal compresses very well.
- * |[
- * gst-launch -v alsasrc ! audioconvert ! vorbisenc ! oggmux ! filesink location=alsasrc.ogg
- * ]| Record from a sound card using ALSA and encode to Ogg/Vorbis.
- * </refsect2>
- *
- * Last reviewed on 2006-03-01 (0.10.4)
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <vorbis/vorbisenc.h>
-
-#include <gst/gsttagsetter.h>
-#include <gst/tag/tag.h>
-#include <gst/audio/multichannel.h>
-#include <gst/audio/audio.h>
-#include "gstvorbisenc.h"
-
-#include "gstvorbiscommon.h"
-
-GST_DEBUG_CATEGORY_EXTERN (vorbisenc_debug);
-#define GST_CAT_DEFAULT vorbisenc_debug
-
-static GstStaticPadTemplate vorbis_enc_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-float, "
- "rate = (int) [ 1, 200000 ], "
- "channels = (int) [ 1, 256 ], " "endianness = (int) BYTE_ORDER, "
- "width = (int) 32")
- );
-
-static GstStaticPadTemplate vorbis_enc_src_factory =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-vorbis")
- );
-
-
-/* elementfactory information */
-static const GstElementDetails vorbisenc_details =
-GST_ELEMENT_DETAILS ("Vorbis audio encoder",
- "Codec/Encoder/Audio",
- "Encodes audio in Vorbis format",
- "Monty <monty@xiph.org>, " "Wim Taymans <wim@fluendo.com>");
-
-enum
-{
- ARG_0,
- ARG_MAX_BITRATE,
- ARG_BITRATE,
- ARG_MIN_BITRATE,
- ARG_QUALITY,
- ARG_MANAGED,
- ARG_LAST_MESSAGE
-};
-
-static GstFlowReturn gst_vorbis_enc_output_buffers (GstVorbisEnc * vorbisenc);
-
-/* this function takes into account the granulepos_offset and the subgranule
- * time offset */
-static GstClockTime
-granulepos_to_timestamp_offset (GstVorbisEnc * vorbisenc,
- ogg_int64_t granulepos)
-{
- if (granulepos >= 0)
- return gst_util_uint64_scale ((guint64) granulepos
- + vorbisenc->granulepos_offset, GST_SECOND, vorbisenc->frequency)
- + vorbisenc->subgranule_offset;
- return GST_CLOCK_TIME_NONE;
-}
-
-/* this function does a straight granulepos -> timestamp conversion */
-static GstClockTime
-granulepos_to_timestamp (GstVorbisEnc * vorbisenc, ogg_int64_t granulepos)
-{
- if (granulepos >= 0)
- return gst_util_uint64_scale ((guint64) granulepos,
- GST_SECOND, vorbisenc->frequency);
- return GST_CLOCK_TIME_NONE;
-}
-
-#define MAX_BITRATE_DEFAULT -1
-#define BITRATE_DEFAULT -1
-#define MIN_BITRATE_DEFAULT -1
-#define QUALITY_DEFAULT 0.3
-#define LOWEST_BITRATE 6000 /* lowest allowed for a 8 kHz stream */
-#define HIGHEST_BITRATE 250001 /* highest allowed for a 44 kHz stream */
-
-static gboolean gst_vorbis_enc_sink_event (GstPad * pad, GstEvent * event);
-static GstFlowReturn gst_vorbis_enc_chain (GstPad * pad, GstBuffer * buffer);
-static gboolean gst_vorbis_enc_setup (GstVorbisEnc * vorbisenc);
-
-static void gst_vorbis_enc_dispose (GObject * object);
-static void gst_vorbis_enc_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_vorbis_enc_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static GstStateChangeReturn gst_vorbis_enc_change_state (GstElement * element,
- GstStateChange transition);
-static void gst_vorbis_enc_add_interfaces (GType vorbisenc_type);
-
-GST_BOILERPLATE_FULL (GstVorbisEnc, gst_vorbis_enc, GstElement,
- GST_TYPE_ELEMENT, gst_vorbis_enc_add_interfaces);
-
-static void
-gst_vorbis_enc_add_interfaces (GType vorbisenc_type)
-{
- static const GInterfaceInfo tag_setter_info = { NULL, NULL, NULL };
- static const GInterfaceInfo preset_info = { NULL, NULL, NULL };
-
- g_type_add_interface_static (vorbisenc_type, GST_TYPE_TAG_SETTER,
- &tag_setter_info);
- g_type_add_interface_static (vorbisenc_type, GST_TYPE_PRESET, &preset_info);
-}
-
-static void
-gst_vorbis_enc_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- GstPadTemplate *src_template, *sink_template;
-
-
- src_template = gst_static_pad_template_get (&vorbis_enc_src_factory);
- gst_element_class_add_pad_template (element_class, src_template);
-
- sink_template = gst_static_pad_template_get (&vorbis_enc_sink_factory);
- gst_element_class_add_pad_template (element_class, sink_template);
- gst_element_class_set_details (element_class, &vorbisenc_details);
-}
-
-static void
-gst_vorbis_enc_class_init (GstVorbisEncClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- gobject_class->set_property = gst_vorbis_enc_set_property;
- gobject_class->get_property = gst_vorbis_enc_get_property;
- gobject_class->dispose = gst_vorbis_enc_dispose;
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_BITRATE,
- g_param_spec_int ("max-bitrate", "Maximum Bitrate",
- "Specify a maximum bitrate (in bps). Useful for streaming "
- "applications. (-1 == disabled)",
- -1, HIGHEST_BITRATE, MAX_BITRATE_DEFAULT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE,
- g_param_spec_int ("bitrate", "Target Bitrate",
- "Attempt to encode at a bitrate averaging this (in bps). "
- "This uses the bitrate management engine, and is not recommended for most users. "
- "Quality is a better alternative. (-1 == disabled)", -1,
- HIGHEST_BITRATE, BITRATE_DEFAULT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MIN_BITRATE,
- g_param_spec_int ("min-bitrate", "Minimum Bitrate",
- "Specify a minimum bitrate (in bps). Useful for encoding for a "
- "fixed-size channel. (-1 == disabled)", -1, HIGHEST_BITRATE,
- MIN_BITRATE_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY,
- g_param_spec_float ("quality", "Quality",
- "Specify quality instead of specifying a particular bitrate.", -0.1,
- 1.0, QUALITY_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MANAGED,
- g_param_spec_boolean ("managed", "Managed",
- "Enable bitrate management engine", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
- g_param_spec_string ("last-message", "last-message",
- "The last status message", NULL,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_vorbis_enc_change_state);
-}
-
-static void
-gst_vorbis_enc_dispose (GObject * object)
-{
- GstVorbisEnc *vorbisenc = GST_VORBISENC (object);
-
- if (vorbisenc->sinkcaps) {
- gst_caps_unref (vorbisenc->sinkcaps);
- vorbisenc->sinkcaps = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static GstCaps *
-gst_vorbis_enc_generate_sink_caps (void)
-{
- GstCaps *caps = gst_caps_new_empty ();
- int i, c;
-
- gst_caps_append_structure (caps, gst_structure_new ("audio/x-raw-float",
- "rate", GST_TYPE_INT_RANGE, 1, 200000,
- "channels", G_TYPE_INT, 1,
- "endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32,
- NULL));
-
- gst_caps_append_structure (caps, gst_structure_new ("audio/x-raw-float",
- "rate", GST_TYPE_INT_RANGE, 1, 200000,
- "channels", G_TYPE_INT, 2,
- "endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32,
- NULL));
-
- for (i = 3; i <= 8; i++) {
- GValue chanpos = { 0 };
- GValue pos = { 0 };
- GstStructure *structure;
-
- g_value_init (&chanpos, GST_TYPE_ARRAY);
- g_value_init (&pos, GST_TYPE_AUDIO_CHANNEL_POSITION);
-
- for (c = 0; c < i; c++) {
- g_value_set_enum (&pos, gst_vorbis_channel_positions[i - 1][c]);
- gst_value_array_append_value (&chanpos, &pos);
- }
- g_value_unset (&pos);
-
- structure = gst_structure_new ("audio/x-raw-float",
- "rate", GST_TYPE_INT_RANGE, 1, 200000,
- "channels", G_TYPE_INT, i,
- "endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32, NULL);
- gst_structure_set_value (structure, "channel-positions", &chanpos);
- g_value_unset (&chanpos);
-
- gst_caps_append_structure (caps, structure);
- }
-
- gst_caps_append_structure (caps, gst_structure_new ("audio/x-raw-float",
- "rate", GST_TYPE_INT_RANGE, 1, 200000,
- "channels", GST_TYPE_INT_RANGE, 9, 256,
- "endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32,
- NULL));
-
- return caps;
-}
-
-static GstCaps *
-gst_vorbis_enc_sink_getcaps (GstPad * pad)
-{
- GstVorbisEnc *vorbisenc = GST_VORBISENC (GST_PAD_PARENT (pad));
-
- if (vorbisenc->sinkcaps == NULL)
- vorbisenc->sinkcaps = gst_vorbis_enc_generate_sink_caps ();
-
- return gst_caps_ref (vorbisenc->sinkcaps);
-}
-
-static gboolean
-gst_vorbis_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstVorbisEnc *vorbisenc;
- GstStructure *structure;
-
- vorbisenc = GST_VORBISENC (GST_PAD_PARENT (pad));
- vorbisenc->setup = FALSE;
-
- structure = gst_caps_get_structure (caps, 0);
- gst_structure_get_int (structure, "channels", &vorbisenc->channels);
- gst_structure_get_int (structure, "rate", &vorbisenc->frequency);
-
- gst_vorbis_enc_setup (vorbisenc);
-
- if (vorbisenc->setup)
- return TRUE;
-
- return FALSE;
-}
-
-static gboolean
-gst_vorbis_enc_convert_src (GstPad * pad, GstFormat src_format,
- gint64 src_value, GstFormat * dest_format, gint64 * dest_value)
-{
- gboolean res = TRUE;
- GstVorbisEnc *vorbisenc;
- gint64 avg;
-
- vorbisenc = GST_VORBISENC (gst_pad_get_parent (pad));
-
- if (vorbisenc->samples_in == 0 ||
- vorbisenc->bytes_out == 0 || vorbisenc->frequency == 0) {
- gst_object_unref (vorbisenc);
- return FALSE;
- }
-
- avg = (vorbisenc->bytes_out * vorbisenc->frequency) / (vorbisenc->samples_in);
-
- switch (src_format) {
- case GST_FORMAT_BYTES:
- switch (*dest_format) {
- case GST_FORMAT_TIME:
- *dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND, avg);
- break;
- default:
- res = FALSE;
- }
- break;
- case GST_FORMAT_TIME:
- switch (*dest_format) {
- case GST_FORMAT_BYTES:
- *dest_value = gst_util_uint64_scale_int (src_value, avg, GST_SECOND);
- break;
- default:
- res = FALSE;
- }
- break;
- default:
- res = FALSE;
- }
- gst_object_unref (vorbisenc);
- return res;
-}
-
-static gboolean
-gst_vorbis_enc_convert_sink (GstPad * pad, GstFormat src_format,
- gint64 src_value, GstFormat * dest_format, gint64 * dest_value)
-{
- gboolean res = TRUE;
- guint scale = 1;
- gint bytes_per_sample;
- GstVorbisEnc *vorbisenc;
-
- vorbisenc = GST_VORBISENC (gst_pad_get_parent (pad));
-
- bytes_per_sample = vorbisenc->channels * 2;
-
- switch (src_format) {
- case GST_FORMAT_BYTES:
- switch (*dest_format) {
- case GST_FORMAT_DEFAULT:
- if (bytes_per_sample == 0)
- return FALSE;
- *dest_value = src_value / bytes_per_sample;
- break;
- case GST_FORMAT_TIME:
- {
- gint byterate = bytes_per_sample * vorbisenc->frequency;
-
- if (byterate == 0)
- return FALSE;
- *dest_value =
- gst_util_uint64_scale_int (src_value, GST_SECOND, byterate);
- break;
- }
- default:
- res = FALSE;
- }
- break;
- case GST_FORMAT_DEFAULT:
- switch (*dest_format) {
- case GST_FORMAT_BYTES:
- *dest_value = src_value * bytes_per_sample;
- break;
- case GST_FORMAT_TIME:
- if (vorbisenc->frequency == 0)
- return FALSE;
- *dest_value =
- gst_util_uint64_scale_int (src_value, GST_SECOND,
- vorbisenc->frequency);
- break;
- default:
- res = FALSE;
- }
- break;
- case GST_FORMAT_TIME:
- switch (*dest_format) {
- case GST_FORMAT_BYTES:
- scale = bytes_per_sample;
- /* fallthrough */
- case GST_FORMAT_DEFAULT:
- *dest_value =
- gst_util_uint64_scale_int (src_value,
- scale * vorbisenc->frequency, GST_SECOND);
- break;
- default:
- res = FALSE;
- }
- break;
- default:
- res = FALSE;
- }
- gst_object_unref (vorbisenc);
- return res;
-}
-
-static gint64
-gst_vorbis_enc_get_latency (GstVorbisEnc * vorbisenc)
-{
- /* FIXME, this probably depends on the bitrate and other setting but for now
- * we return this value, which was obtained by totally unscientific
- * measurements */
- return 58 * GST_MSECOND;
-}
-
-static const GstQueryType *
-gst_vorbis_enc_get_query_types (GstPad * pad)
-{
- static const GstQueryType gst_vorbis_enc_src_query_types[] = {
- GST_QUERY_POSITION,
- GST_QUERY_DURATION,
- GST_QUERY_CONVERT,
- 0
- };
-
- return gst_vorbis_enc_src_query_types;
-}
-
-static gboolean
-gst_vorbis_enc_src_query (GstPad * pad, GstQuery * query)
-{
- gboolean res = TRUE;
- GstVorbisEnc *vorbisenc;
- GstPad *peerpad;
-
- vorbisenc = GST_VORBISENC (gst_pad_get_parent (pad));
- peerpad = gst_pad_get_peer (GST_PAD (vorbisenc->sinkpad));
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_POSITION:
- {
- GstFormat fmt, req_fmt;
- gint64 pos, val;
-
- gst_query_parse_position (query, &req_fmt, NULL);
- if ((res = gst_pad_query_position (peerpad, &req_fmt, &val))) {
- gst_query_set_position (query, req_fmt, val);
- break;
- }
-
- fmt = GST_FORMAT_TIME;
- if (!(res = gst_pad_query_position (peerpad, &fmt, &pos)))
- break;
-
- if ((res = gst_pad_query_convert (peerpad, fmt, pos, &req_fmt, &val))) {
- gst_query_set_position (query, req_fmt, val);
- }
- break;
- }
- case GST_QUERY_DURATION:
- {
- GstFormat fmt, req_fmt;
- gint64 dur, val;
-
- gst_query_parse_duration (query, &req_fmt, NULL);
- if ((res = gst_pad_query_duration (peerpad, &req_fmt, &val))) {
- gst_query_set_duration (query, req_fmt, val);
- break;
- }
-
- fmt = GST_FORMAT_TIME;
- if (!(res = gst_pad_query_duration (peerpad, &fmt, &dur)))
- break;
-
- if ((res = gst_pad_query_convert (peerpad, fmt, dur, &req_fmt, &val))) {
- gst_query_set_duration (query, req_fmt, val);
- }
- break;
- }
- case GST_QUERY_CONVERT:
- {
- GstFormat src_fmt, dest_fmt;
- gint64 src_val, dest_val;
-
- gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
- if (!(res =
- gst_vorbis_enc_convert_src (pad, src_fmt, src_val, &dest_fmt,
- &dest_val)))
- goto error;
- gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
- break;
- }
- case GST_QUERY_LATENCY:
- {
- gboolean live;
- GstClockTime min_latency, max_latency;
- gint64 latency;
-
- if ((res = gst_pad_query (peerpad, query))) {
- gst_query_parse_latency (query, &live, &min_latency, &max_latency);
-
- latency = gst_vorbis_enc_get_latency (vorbisenc);
-
- /* add our latency */
- min_latency += latency;
- if (max_latency != -1)
- max_latency += latency;
-
- gst_query_set_latency (query, live, min_latency, max_latency);
- }
- break;
- }
- default:
- res = gst_pad_query (peerpad, query);
- break;
- }
-
-error:
- gst_object_unref (peerpad);
- gst_object_unref (vorbisenc);
- return res;
-}
-
-static gboolean
-gst_vorbis_enc_sink_query (GstPad * pad, GstQuery * query)
-{
- gboolean res = TRUE;
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_CONVERT:
- {
- GstFormat src_fmt, dest_fmt;
- gint64 src_val, dest_val;
-
- gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
- if (!(res =
- gst_vorbis_enc_convert_sink (pad, src_fmt, src_val, &dest_fmt,
- &dest_val)))
- goto error;
- gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
- break;
- }
- default:
- res = gst_pad_query_default (pad, query);
- break;
- }
-
-error:
- return res;
-}
-
-static void
-gst_vorbis_enc_init (GstVorbisEnc * vorbisenc, GstVorbisEncClass * klass)
-{
- vorbisenc->sinkpad =
- gst_pad_new_from_static_template (&vorbis_enc_sink_factory, "sink");
- gst_pad_set_event_function (vorbisenc->sinkpad,
- GST_DEBUG_FUNCPTR (gst_vorbis_enc_sink_event));
- gst_pad_set_chain_function (vorbisenc->sinkpad,
- GST_DEBUG_FUNCPTR (gst_vorbis_enc_chain));
- gst_pad_set_setcaps_function (vorbisenc->sinkpad,
- GST_DEBUG_FUNCPTR (gst_vorbis_enc_sink_setcaps));
- gst_pad_set_getcaps_function (vorbisenc->sinkpad,
- GST_DEBUG_FUNCPTR (gst_vorbis_enc_sink_getcaps));
- gst_pad_set_query_function (vorbisenc->sinkpad,
- GST_DEBUG_FUNCPTR (gst_vorbis_enc_sink_query));
- gst_element_add_pad (GST_ELEMENT (vorbisenc), vorbisenc->sinkpad);
-
- vorbisenc->srcpad =
- gst_pad_new_from_static_template (&vorbis_enc_src_factory, "src");
- gst_pad_set_query_function (vorbisenc->srcpad,
- GST_DEBUG_FUNCPTR (gst_vorbis_enc_src_query));
- gst_pad_set_query_type_function (vorbisenc->srcpad,
- GST_DEBUG_FUNCPTR (gst_vorbis_enc_get_query_types));
- gst_element_add_pad (GST_ELEMENT (vorbisenc), vorbisenc->srcpad);
-
- vorbisenc->channels = -1;
- vorbisenc->frequency = -1;
-
- vorbisenc->managed = FALSE;
- vorbisenc->max_bitrate = MAX_BITRATE_DEFAULT;
- vorbisenc->bitrate = BITRATE_DEFAULT;
- vorbisenc->min_bitrate = MIN_BITRATE_DEFAULT;
- vorbisenc->quality = QUALITY_DEFAULT;
- vorbisenc->quality_set = FALSE;
- vorbisenc->last_message = NULL;
-}
-
-static void
-gst_vorbis_enc_metadata_set1 (const GstTagList * list, const gchar * tag,
- gpointer vorbisenc)
-{
- GstVorbisEnc *enc = GST_VORBISENC (vorbisenc);
- GList *vc_list, *l;
-
- vc_list = gst_tag_to_vorbis_comments (list, tag);
-
- for (l = vc_list; l != NULL; l = l->next) {
- const gchar *vc_string = (const gchar *) l->data;
- gchar *key = NULL, *val = NULL;
-
- GST_LOG_OBJECT (vorbisenc, "vorbis comment: %s", vc_string);
- if (gst_tag_parse_extended_comment (vc_string, &key, NULL, &val, TRUE)) {
- vorbis_comment_add_tag (&enc->vc, key, val);
- g_free (key);
- g_free (val);
- }
- }
-
- g_list_foreach (vc_list, (GFunc) g_free, NULL);
- g_list_free (vc_list);
-}
-
-static void
-gst_vorbis_enc_set_metadata (GstVorbisEnc * enc)
-{
- GstTagList *merged_tags;
- const GstTagList *user_tags;
-
- vorbis_comment_init (&enc->vc);
-
- user_tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (enc));
-
- GST_DEBUG_OBJECT (enc, "upstream tags = %" GST_PTR_FORMAT, enc->tags);
- GST_DEBUG_OBJECT (enc, "user-set tags = %" GST_PTR_FORMAT, user_tags);
-
- /* gst_tag_list_merge() will handle NULL for either or both lists fine */
- merged_tags = gst_tag_list_merge (user_tags, enc->tags,
- gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (enc)));
-
- if (merged_tags) {
- GST_DEBUG_OBJECT (enc, "merged tags = %" GST_PTR_FORMAT, merged_tags);
- gst_tag_list_foreach (merged_tags, gst_vorbis_enc_metadata_set1, enc);
- gst_tag_list_free (merged_tags);
- }
-}
-
-static gchar *
-get_constraints_string (GstVorbisEnc * vorbisenc)
-{
- gint min = vorbisenc->min_bitrate;
- gint max = vorbisenc->max_bitrate;
- gchar *result;
-
- if (min > 0 && max > 0)
- result = g_strdup_printf ("(min %d bps, max %d bps)", min, max);
- else if (min > 0)
- result = g_strdup_printf ("(min %d bps, no max)", min);
- else if (max > 0)
- result = g_strdup_printf ("(no min, max %d bps)", max);
- else
- result = g_strdup_printf ("(no min or max)");
-
- return result;
-}
-
-static void
-update_start_message (GstVorbisEnc * vorbisenc)
-{
- gchar *constraints;
-
- g_free (vorbisenc->last_message);
-
- if (vorbisenc->bitrate > 0) {
- if (vorbisenc->managed) {
- constraints = get_constraints_string (vorbisenc);
- vorbisenc->last_message =
- g_strdup_printf ("encoding at average bitrate %d bps %s",
- vorbisenc->bitrate, constraints);
- g_free (constraints);
- } else {
- vorbisenc->last_message =
- g_strdup_printf
- ("encoding at approximate bitrate %d bps (VBR encoding enabled)",
- vorbisenc->bitrate);
- }
- } else {
- if (vorbisenc->quality_set) {
- if (vorbisenc->managed) {
- constraints = get_constraints_string (vorbisenc);
- vorbisenc->last_message =
- g_strdup_printf
- ("encoding at quality level %2.2f using constrained VBR %s",
- vorbisenc->quality, constraints);
- g_free (constraints);
- } else {
- vorbisenc->last_message =
- g_strdup_printf ("encoding at quality level %2.2f",
- vorbisenc->quality);
- }
- } else {
- constraints = get_constraints_string (vorbisenc);
- vorbisenc->last_message =
- g_strdup_printf ("encoding using bitrate management %s", constraints);
- g_free (constraints);
- }
- }
-
- g_object_notify (G_OBJECT (vorbisenc), "last_message");
-}
-
-static gboolean
-gst_vorbis_enc_setup (GstVorbisEnc * vorbisenc)
-{
- vorbisenc->setup = FALSE;
-
- if (vorbisenc->bitrate < 0 && vorbisenc->min_bitrate < 0
- && vorbisenc->max_bitrate < 0) {
- vorbisenc->quality_set = TRUE;
- }
-
- update_start_message (vorbisenc);
-
- /* choose an encoding mode */
- /* (mode 0: 44kHz stereo uncoupled, roughly 128kbps VBR) */
- vorbis_info_init (&vorbisenc->vi);
-
- if (vorbisenc->quality_set) {
- if (vorbis_encode_setup_vbr (&vorbisenc->vi,
- vorbisenc->channels, vorbisenc->frequency,
- vorbisenc->quality) != 0) {
- GST_ERROR_OBJECT (vorbisenc,
- "vorbisenc: initialisation failed: invalid parameters for quality");
- vorbis_info_clear (&vorbisenc->vi);
- return FALSE;
- }
-
- /* do we have optional hard quality restrictions? */
- if (vorbisenc->max_bitrate > 0 || vorbisenc->min_bitrate > 0) {
- struct ovectl_ratemanage_arg ai;
-
- vorbis_encode_ctl (&vorbisenc->vi, OV_ECTL_RATEMANAGE_GET, &ai);
-
- ai.bitrate_hard_min = vorbisenc->min_bitrate;
- ai.bitrate_hard_max = vorbisenc->max_bitrate;
- ai.management_active = 1;
-
- vorbis_encode_ctl (&vorbisenc->vi, OV_ECTL_RATEMANAGE_SET, &ai);
- }
- } else {
- long min_bitrate, max_bitrate;
-
- min_bitrate = vorbisenc->min_bitrate > 0 ? vorbisenc->min_bitrate : -1;
- max_bitrate = vorbisenc->max_bitrate > 0 ? vorbisenc->max_bitrate : -1;
-
- if (vorbis_encode_setup_managed (&vorbisenc->vi,
- vorbisenc->channels,
- vorbisenc->frequency,
- max_bitrate, vorbisenc->bitrate, min_bitrate) != 0) {
- GST_ERROR_OBJECT (vorbisenc,
- "vorbis_encode_setup_managed "
- "(c %d, rate %d, max br %ld, br %d, min br %ld) failed",
- vorbisenc->channels, vorbisenc->frequency, max_bitrate,
- vorbisenc->bitrate, min_bitrate);
- vorbis_info_clear (&vorbisenc->vi);
- return FALSE;
- }
- }
-
- if (vorbisenc->managed && vorbisenc->bitrate < 0) {
- vorbis_encode_ctl (&vorbisenc->vi, OV_ECTL_RATEMANAGE_AVG, NULL);
- } else if (!vorbisenc->managed) {
- /* Turn off management entirely (if it was turned on). */
- vorbis_encode_ctl (&vorbisenc->vi, OV_ECTL_RATEMANAGE_SET, NULL);
- }
- vorbis_encode_setup_init (&vorbisenc->vi);
-
- /* set up the analysis state and auxiliary encoding storage */
- vorbis_analysis_init (&vorbisenc->vd, &vorbisenc->vi);
- vorbis_block_init (&vorbisenc->vd, &vorbisenc->vb);
-
- vorbisenc->next_ts = 0;
-
- vorbisenc->setup = TRUE;
-
- return TRUE;
-}
-
-static GstFlowReturn
-gst_vorbis_enc_clear (GstVorbisEnc * vorbisenc)
-{
- GstFlowReturn ret = GST_FLOW_OK;
-
- if (vorbisenc->setup) {
- vorbis_analysis_wrote (&vorbisenc->vd, 0);
- ret = gst_vorbis_enc_output_buffers (vorbisenc);
-
- vorbisenc->setup = FALSE;
- }
-
- /* clean up and exit. vorbis_info_clear() must be called last */
- vorbis_block_clear (&vorbisenc->vb);
- vorbis_dsp_clear (&vorbisenc->vd);
- vorbis_info_clear (&vorbisenc->vi);
-
- vorbisenc->header_sent = FALSE;
-
- return ret;
-}
-
-/* prepare a buffer for transmission by passing data through libvorbis */
-static GstBuffer *
-gst_vorbis_enc_buffer_from_packet (GstVorbisEnc * vorbisenc,
- ogg_packet * packet)
-{
- GstBuffer *outbuf;
-
- outbuf = gst_buffer_new_and_alloc (packet->bytes);
- memcpy (GST_BUFFER_DATA (outbuf), packet->packet, packet->bytes);
- /* see ext/ogg/README; OFFSET_END takes "our" granulepos, OFFSET its
- * time representation */
- GST_BUFFER_OFFSET_END (outbuf) = packet->granulepos +
- vorbisenc->granulepos_offset;
- GST_BUFFER_OFFSET (outbuf) = granulepos_to_timestamp (vorbisenc,
- GST_BUFFER_OFFSET_END (outbuf));
- GST_BUFFER_TIMESTAMP (outbuf) = vorbisenc->next_ts;
-
- /* update the next timestamp, taking granulepos_offset and subgranule offset
- * into account */
- vorbisenc->next_ts =
- granulepos_to_timestamp_offset (vorbisenc, packet->granulepos) +
- vorbisenc->initial_ts;
- GST_BUFFER_DURATION (outbuf) =
- vorbisenc->next_ts - GST_BUFFER_TIMESTAMP (outbuf);
-
- if (vorbisenc->next_discont) {
- GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
- vorbisenc->next_discont = FALSE;
- }
-
- gst_buffer_set_caps (outbuf, vorbisenc->srccaps);
-
- GST_LOG_OBJECT (vorbisenc, "encoded buffer of %d bytes",
- GST_BUFFER_SIZE (outbuf));
- return outbuf;
-}
-
-/* the same as above, but different logic for setting timestamp and granulepos
- * */
-static GstBuffer *
-gst_vorbis_enc_buffer_from_header_packet (GstVorbisEnc * vorbisenc,
- ogg_packet * packet)
-{
- GstBuffer *outbuf;
-
- outbuf = gst_buffer_new_and_alloc (packet->bytes);
- memcpy (GST_BUFFER_DATA (outbuf), packet->packet, packet->bytes);
- GST_BUFFER_OFFSET (outbuf) = vorbisenc->bytes_out;
- GST_BUFFER_OFFSET_END (outbuf) = 0;
- GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE;
- GST_BUFFER_DURATION (outbuf) = GST_CLOCK_TIME_NONE;
-
- gst_buffer_set_caps (outbuf, vorbisenc->srccaps);
-
- GST_DEBUG ("created header packet buffer, %d bytes",
- GST_BUFFER_SIZE (outbuf));
- return outbuf;
-}
-
-/* push out the buffer and do internal bookkeeping */
-static GstFlowReturn
-gst_vorbis_enc_push_buffer (GstVorbisEnc * vorbisenc, GstBuffer * buffer)
-{
- vorbisenc->bytes_out += GST_BUFFER_SIZE (buffer);
-
- GST_DEBUG_OBJECT (vorbisenc,
- "Pushing buffer with GP %" G_GINT64_FORMAT ", ts %" GST_TIME_FORMAT,
- GST_BUFFER_OFFSET_END (buffer),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
- return gst_pad_push (vorbisenc->srcpad, buffer);
-}
-
-static GstFlowReturn
-gst_vorbis_enc_push_packet (GstVorbisEnc * vorbisenc, ogg_packet * packet)
-{
- GstBuffer *outbuf;
-
- outbuf = gst_vorbis_enc_buffer_from_packet (vorbisenc, packet);
- return gst_vorbis_enc_push_buffer (vorbisenc, outbuf);
-}
-
-/* Set a copy of these buffers as 'streamheader' on the caps.
- * We need a copy to avoid these buffers ending up with (indirect) refs on
- * themselves
- */
-static GstCaps *
-gst_vorbis_enc_set_header_on_caps (GstCaps * caps, GstBuffer * buf1,
- GstBuffer * buf2, GstBuffer * buf3)
-{
- GstBuffer *buf;
- GstStructure *structure;
- GValue array = { 0 };
- GValue value = { 0 };
-
- caps = gst_caps_make_writable (caps);
- structure = gst_caps_get_structure (caps, 0);
-
- /* mark buffers */
- GST_BUFFER_FLAG_SET (buf1, GST_BUFFER_FLAG_IN_CAPS);
- GST_BUFFER_FLAG_SET (buf2, GST_BUFFER_FLAG_IN_CAPS);
- GST_BUFFER_FLAG_SET (buf3, GST_BUFFER_FLAG_IN_CAPS);
-
- /* put buffers in a fixed list */
- g_value_init (&array, GST_TYPE_ARRAY);
- g_value_init (&value, GST_TYPE_BUFFER);
- buf = gst_buffer_copy (buf1);
- gst_value_set_buffer (&value, buf);
- gst_buffer_unref (buf);
- gst_value_array_append_value (&array, &value);
- g_value_unset (&value);
- g_value_init (&value, GST_TYPE_BUFFER);
- buf = gst_buffer_copy (buf2);
- gst_value_set_buffer (&value, buf);
- gst_buffer_unref (buf);
- gst_value_array_append_value (&array, &value);
- g_value_unset (&value);
- g_value_init (&value, GST_TYPE_BUFFER);
- buf = gst_buffer_copy (buf3);
- gst_value_set_buffer (&value, buf);
- gst_buffer_unref (buf);
- gst_value_array_append_value (&array, &value);
- gst_structure_set_value (structure, "streamheader", &array);
- g_value_unset (&value);
- g_value_unset (&array);
-
- return caps;
-}
-
-static gboolean
-gst_vorbis_enc_sink_event (GstPad * pad, GstEvent * event)
-{
- gboolean res = TRUE;
- GstVorbisEnc *vorbisenc;
-
- vorbisenc = GST_VORBISENC (GST_PAD_PARENT (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_EOS:
- /* Tell the library we're at end of stream so that it can handle
- * the last frame and mark end of stream in the output properly */
- GST_DEBUG_OBJECT (vorbisenc, "EOS, clearing state and sending event on");
- gst_vorbis_enc_clear (vorbisenc);
-
- res = gst_pad_push_event (vorbisenc->srcpad, event);
- break;
- case GST_EVENT_TAG:
- if (vorbisenc->tags) {
- GstTagList *list;
-
- gst_event_parse_tag (event, &list);
- gst_tag_list_insert (vorbisenc->tags, list,
- gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (vorbisenc)));
- } else {
- g_assert_not_reached ();
- }
- res = gst_pad_push_event (vorbisenc->srcpad, event);
- break;
- case GST_EVENT_NEWSEGMENT:
- {
- gboolean update;
- gdouble rate, applied_rate;
- GstFormat format;
- gint64 start, stop, position;
-
- gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
- &format, &start, &stop, &position);
- if (format == GST_FORMAT_TIME) {
- gst_segment_set_newsegment (&vorbisenc->segment, update, rate, format,
- start, stop, position);
- if (vorbisenc->initial_ts == GST_CLOCK_TIME_NONE) {
- GST_DEBUG_OBJECT (vorbisenc, "Initial segment %" GST_SEGMENT_FORMAT,
- &vorbisenc->segment);
- vorbisenc->initial_ts = start;
- }
- }
- }
- /* fall through */
- default:
- res = gst_pad_push_event (vorbisenc->srcpad, event);
- break;
- }
- return res;
-}
-
-static gboolean
-gst_vorbis_enc_buffer_check_discontinuous (GstVorbisEnc * vorbisenc,
- GstClockTime timestamp, GstClockTime duration)
-{
- gboolean ret = FALSE;
-
- if (timestamp != GST_CLOCK_TIME_NONE &&
- vorbisenc->expected_ts != GST_CLOCK_TIME_NONE &&
- timestamp + duration != vorbisenc->expected_ts) {
- /* It turns out that a lot of elements don't generate perfect streams due
- * to rounding errors. So, we permit small errors (< 1/2 a sample) without
- * causing a discont.
- */
- int halfsample = GST_SECOND / vorbisenc->frequency / 2;
-
- if ((GstClockTimeDiff) (timestamp - vorbisenc->expected_ts) > halfsample) {
- GST_DEBUG_OBJECT (vorbisenc, "Expected TS %" GST_TIME_FORMAT
- ", buffer TS %" GST_TIME_FORMAT,
- GST_TIME_ARGS (vorbisenc->expected_ts), GST_TIME_ARGS (timestamp));
- ret = TRUE;
- }
- }
-
- if (timestamp != GST_CLOCK_TIME_NONE && duration != GST_CLOCK_TIME_NONE) {
- vorbisenc->expected_ts = timestamp + duration;
- } else
- vorbisenc->expected_ts = GST_CLOCK_TIME_NONE;
-
- return ret;
-}
-
-static GstFlowReturn
-gst_vorbis_enc_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstVorbisEnc *vorbisenc;
- GstFlowReturn ret = GST_FLOW_OK;
- gfloat *data;
- gulong size;
- gulong i, j;
- float **vorbis_buffer;
- GstBuffer *buf1, *buf2, *buf3;
- gboolean first = FALSE;
- GstClockTime timestamp = GST_CLOCK_TIME_NONE;
- GstClockTime running_time = GST_CLOCK_TIME_NONE;
-
- vorbisenc = GST_VORBISENC (GST_PAD_PARENT (pad));
-
- if (!vorbisenc->setup)
- goto not_setup;
-
- buffer = gst_audio_buffer_clip (buffer, &vorbisenc->segment,
- vorbisenc->frequency, 4 * vorbisenc->channels);
- if (buffer == NULL) {
- GST_DEBUG_OBJECT (vorbisenc, "Dropping buffer, out of segment");
- return GST_FLOW_OK;
- }
- running_time =
- gst_segment_to_running_time (&vorbisenc->segment, GST_FORMAT_TIME,
- GST_BUFFER_TIMESTAMP (buffer));
- timestamp = running_time + vorbisenc->initial_ts;
- GST_DEBUG_OBJECT (vorbisenc, "Initial ts is %" GST_TIME_FORMAT,
- GST_TIME_ARGS (vorbisenc->initial_ts));
- if (!vorbisenc->header_sent) {
- /* Vorbis streams begin with three headers; the initial header (with
- most of the codec setup parameters) which is mandated by the Ogg
- bitstream spec. The second header holds any comment fields. The
- third header holds the bitstream codebook. We merely need to
- make the headers, then pass them to libvorbis one at a time;
- libvorbis handles the additional Ogg bitstream constraints */
- ogg_packet header;
- ogg_packet header_comm;
- ogg_packet header_code;
- GstCaps *caps;
-
- /* first, make sure header buffers get timestamp == 0 */
- vorbisenc->next_ts = 0;
- vorbisenc->granulepos_offset = 0;
- vorbisenc->subgranule_offset = 0;
-
- GST_DEBUG_OBJECT (vorbisenc, "creating and sending header packets");
- gst_vorbis_enc_set_metadata (vorbisenc);
- vorbis_analysis_headerout (&vorbisenc->vd, &vorbisenc->vc, &header,
- &header_comm, &header_code);
- vorbis_comment_clear (&vorbisenc->vc);
-
- /* create header buffers */
- buf1 = gst_vorbis_enc_buffer_from_header_packet (vorbisenc, &header);
- buf2 = gst_vorbis_enc_buffer_from_header_packet (vorbisenc, &header_comm);
- buf3 = gst_vorbis_enc_buffer_from_header_packet (vorbisenc, &header_code);
-
- /* mark and put on caps */
- vorbisenc->srccaps = gst_caps_new_simple ("audio/x-vorbis", NULL);
- caps = vorbisenc->srccaps;
- caps = gst_vorbis_enc_set_header_on_caps (caps, buf1, buf2, buf3);
-
- /* negotiate with these caps */
- GST_DEBUG ("here are the caps: %" GST_PTR_FORMAT, caps);
- gst_pad_set_caps (vorbisenc->srcpad, caps);
-
- gst_buffer_set_caps (buf1, caps);
- gst_buffer_set_caps (buf2, caps);
- gst_buffer_set_caps (buf3, caps);
-
- /* push out buffers */
- /* push_buffer takes the reference even for failure */
- if ((ret = gst_vorbis_enc_push_buffer (vorbisenc, buf1)) != GST_FLOW_OK)
- goto failed_header_push;
- if ((ret = gst_vorbis_enc_push_buffer (vorbisenc, buf2)) != GST_FLOW_OK) {
- buf2 = NULL;
- goto failed_header_push;
- }
- if ((ret = gst_vorbis_enc_push_buffer (vorbisenc, buf3)) != GST_FLOW_OK) {
- buf3 = NULL;
- goto failed_header_push;
- }
-
- /* now adjust starting granulepos accordingly if the buffer's timestamp is
- nonzero */
- vorbisenc->next_ts = timestamp;
- vorbisenc->expected_ts = timestamp;
- vorbisenc->granulepos_offset = gst_util_uint64_scale
- (running_time, vorbisenc->frequency, GST_SECOND);
- vorbisenc->subgranule_offset = 0;
- vorbisenc->subgranule_offset =
- (vorbisenc->next_ts - vorbisenc->initial_ts) -
- granulepos_to_timestamp_offset (vorbisenc, 0);
-
- vorbisenc->header_sent = TRUE;
- first = TRUE;
- }
-
- if (vorbisenc->expected_ts != GST_CLOCK_TIME_NONE &&
- timestamp < vorbisenc->expected_ts) {
- guint64 diff = vorbisenc->expected_ts - timestamp;
- guint64 diff_bytes;
-
- GST_WARNING_OBJECT (vorbisenc, "Buffer is older than previous "
- "timestamp + duration (%" GST_TIME_FORMAT "< %" GST_TIME_FORMAT
- "), cannot handle. Clipping buffer.",
- GST_TIME_ARGS (timestamp), GST_TIME_ARGS (vorbisenc->expected_ts));
-
- diff_bytes =
- GST_CLOCK_TIME_TO_FRAMES (diff,
- vorbisenc->frequency) * vorbisenc->channels * sizeof (gfloat);
- if (diff_bytes >= GST_BUFFER_SIZE (buffer)) {
- gst_buffer_unref (buffer);
- return GST_FLOW_OK;
- }
- buffer = gst_buffer_make_metadata_writable (buffer);
- GST_BUFFER_DATA (buffer) += diff_bytes;
- GST_BUFFER_SIZE (buffer) -= diff_bytes;
-
- GST_BUFFER_TIMESTAMP (buffer) += diff;
- if (GST_BUFFER_DURATION_IS_VALID (buffer))
- GST_BUFFER_DURATION (buffer) -= diff;
- }
-
- if (gst_vorbis_enc_buffer_check_discontinuous (vorbisenc, timestamp,
- GST_BUFFER_DURATION (buffer)) && !first) {
- GST_WARNING_OBJECT (vorbisenc,
- "Buffer is discontinuous, flushing encoder "
- "and restarting (Discont from %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT
- ")", GST_TIME_ARGS (vorbisenc->next_ts), GST_TIME_ARGS (timestamp));
- /* Re-initialise encoder (there's unfortunately no API to flush it) */
- if ((ret = gst_vorbis_enc_clear (vorbisenc)) != GST_FLOW_OK)
- return ret;
- if (!gst_vorbis_enc_setup (vorbisenc))
- return GST_FLOW_ERROR; /* Should be impossible, we can only get here if
- we successfully initialised earlier */
-
- /* Now, set our granulepos offset appropriately. */
- vorbisenc->next_ts = timestamp;
- /* We need to round to the nearest whole number of samples, not just do
- * a truncating division here */
- vorbisenc->granulepos_offset = gst_util_uint64_scale
- (running_time + GST_SECOND / vorbisenc->frequency / 2
- - vorbisenc->subgranule_offset, vorbisenc->frequency, GST_SECOND);
-
- vorbisenc->header_sent = TRUE;
-
- /* And our next output buffer must have DISCONT set on it */
- vorbisenc->next_discont = TRUE;
- }
-
- /* Sending zero samples to libvorbis marks EOS, so we mustn't do that */
- if (GST_BUFFER_SIZE (buffer) == 0) {
- gst_buffer_unref (buffer);
- return GST_FLOW_OK;
- }
-
- /* data to encode */
- data = (gfloat *) GST_BUFFER_DATA (buffer);
- size = GST_BUFFER_SIZE (buffer) / (vorbisenc->channels * sizeof (float));
-
- /* expose the buffer to submit data */
- vorbis_buffer = vorbis_analysis_buffer (&vorbisenc->vd, size);
-
- /* deinterleave samples, write the buffer data */
- for (i = 0; i < size; i++) {
- for (j = 0; j < vorbisenc->channels; j++) {
- vorbis_buffer[j][i] = *data++;
- }
- }
-
- /* tell the library how much we actually submitted */
- vorbis_analysis_wrote (&vorbisenc->vd, size);
-
- GST_LOG_OBJECT (vorbisenc, "wrote %lu samples to vorbis", size);
-
- vorbisenc->samples_in += size;
-
- gst_buffer_unref (buffer);
-
- ret = gst_vorbis_enc_output_buffers (vorbisenc);
-
- return ret;
-
- /* error cases */
-not_setup:
- {
- gst_buffer_unref (buffer);
- GST_ELEMENT_ERROR (vorbisenc, CORE, NEGOTIATION, (NULL),
- ("encoder not initialized (input is not audio?)"));
- return GST_FLOW_UNEXPECTED;
- }
-failed_header_push:
- {
- GST_WARNING_OBJECT (vorbisenc, "Failed to push headers");
- /* buf1 is always already unreffed */
- if (buf2)
- gst_buffer_unref (buf2);
- if (buf3)
- gst_buffer_unref (buf3);
- gst_buffer_unref (buffer);
- return ret;
- }
-}
-
-static GstFlowReturn
-gst_vorbis_enc_output_buffers (GstVorbisEnc * vorbisenc)
-{
- GstFlowReturn ret;
-
- /* vorbis does some data preanalysis, then divides up blocks for
- more involved (potentially parallel) processing. Get a single
- block for encoding now */
- while (vorbis_analysis_blockout (&vorbisenc->vd, &vorbisenc->vb) == 1) {
- ogg_packet op;
-
- GST_LOG_OBJECT (vorbisenc, "analysed to a block");
-
- /* analysis */
- vorbis_analysis (&vorbisenc->vb, NULL);
- vorbis_bitrate_addblock (&vorbisenc->vb);
-
- while (vorbis_bitrate_flushpacket (&vorbisenc->vd, &op)) {
- GST_LOG_OBJECT (vorbisenc, "pushing out a data packet");
- ret = gst_vorbis_enc_push_packet (vorbisenc, &op);
-
- if (ret != GST_FLOW_OK)
- return ret;
- }
- }
-
- return GST_FLOW_OK;
-}
-
-static void
-gst_vorbis_enc_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstVorbisEnc *vorbisenc;
-
- g_return_if_fail (GST_IS_VORBISENC (object));
-
- vorbisenc = GST_VORBISENC (object);
-
- switch (prop_id) {
- case ARG_MAX_BITRATE:
- g_value_set_int (value, vorbisenc->max_bitrate);
- break;
- case ARG_BITRATE:
- g_value_set_int (value, vorbisenc->bitrate);
- break;
- case ARG_MIN_BITRATE:
- g_value_set_int (value, vorbisenc->min_bitrate);
- break;
- case ARG_QUALITY:
- g_value_set_float (value, vorbisenc->quality);
- break;
- case ARG_MANAGED:
- g_value_set_boolean (value, vorbisenc->managed);
- break;
- case ARG_LAST_MESSAGE:
- g_value_set_string (value, vorbisenc->last_message);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_vorbis_enc_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstVorbisEnc *vorbisenc;
-
- g_return_if_fail (GST_IS_VORBISENC (object));
-
- vorbisenc = GST_VORBISENC (object);
-
- switch (prop_id) {
- case ARG_MAX_BITRATE:
- {
- gboolean old_value = vorbisenc->managed;
-
- vorbisenc->max_bitrate = g_value_get_int (value);
- if (vorbisenc->max_bitrate >= 0
- && vorbisenc->max_bitrate < LOWEST_BITRATE) {
- g_warning ("Lowest allowed bitrate is %d", LOWEST_BITRATE);
- vorbisenc->max_bitrate = LOWEST_BITRATE;
- }
- if (vorbisenc->min_bitrate > 0 && vorbisenc->max_bitrate > 0)
- vorbisenc->managed = TRUE;
- else
- vorbisenc->managed = FALSE;
-
- if (old_value != vorbisenc->managed)
- g_object_notify (object, "managed");
- break;
- }
- case ARG_BITRATE:
- vorbisenc->bitrate = g_value_get_int (value);
- if (vorbisenc->bitrate >= 0 && vorbisenc->bitrate < LOWEST_BITRATE) {
- g_warning ("Lowest allowed bitrate is %d", LOWEST_BITRATE);
- vorbisenc->bitrate = LOWEST_BITRATE;
- }
- break;
- case ARG_MIN_BITRATE:
- {
- gboolean old_value = vorbisenc->managed;
-
- vorbisenc->min_bitrate = g_value_get_int (value);
- if (vorbisenc->min_bitrate >= 0
- && vorbisenc->min_bitrate < LOWEST_BITRATE) {
- g_warning ("Lowest allowed bitrate is %d", LOWEST_BITRATE);
- vorbisenc->min_bitrate = LOWEST_BITRATE;
- }
- if (vorbisenc->min_bitrate > 0 && vorbisenc->max_bitrate > 0)
- vorbisenc->managed = TRUE;
- else
- vorbisenc->managed = FALSE;
-
- if (old_value != vorbisenc->managed)
- g_object_notify (object, "managed");
- break;
- }
- case ARG_QUALITY:
- vorbisenc->quality = g_value_get_float (value);
- if (vorbisenc->quality >= 0.0)
- vorbisenc->quality_set = TRUE;
- else
- vorbisenc->quality_set = FALSE;
- break;
- case ARG_MANAGED:
- vorbisenc->managed = g_value_get_boolean (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstStateChangeReturn
-gst_vorbis_enc_change_state (GstElement * element, GstStateChange transition)
-{
- GstVorbisEnc *vorbisenc = GST_VORBISENC (element);
- GstStateChangeReturn res;
-
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- vorbisenc->tags = gst_tag_list_new ();
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- vorbisenc->setup = FALSE;
- vorbisenc->next_discont = FALSE;
- vorbisenc->header_sent = FALSE;
- gst_segment_init (&vorbisenc->segment, GST_FORMAT_TIME);
- vorbisenc->initial_ts = GST_CLOCK_TIME_NONE;
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- default:
- break;
- }
-
- res = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- vorbis_block_clear (&vorbisenc->vb);
- vorbis_dsp_clear (&vorbisenc->vd);
- vorbis_info_clear (&vorbisenc->vi);
- g_free (vorbisenc->last_message);
- vorbisenc->last_message = NULL;
- if (vorbisenc->srccaps) {
- gst_caps_unref (vorbisenc->srccaps);
- vorbisenc->srccaps = NULL;
- }
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- gst_tag_list_free (vorbisenc->tags);
- vorbisenc->tags = NULL;
- default:
- break;
- }
-
- return res;
-}
diff --git a/ext/vorbis/gstvorbisenc.h b/ext/vorbis/gstvorbisenc.h
deleted file mode 100644
index 9375a16c..00000000
--- a/ext/vorbis/gstvorbisenc.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_VORBIS_ENC_H__
-#define __GST_VORBIS_ENC_H__
-
-
-#include <gst/gst.h>
-
-#include <vorbis/codec.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_VORBISENC \
- (gst_vorbis_enc_get_type())
-#define GST_VORBISENC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VORBISENC,GstVorbisEnc))
-#define GST_VORBISENC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VORBISENC,GstVorbisEncClass))
-#define GST_IS_VORBISENC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VORBISENC))
-#define GST_IS_VORBISENC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VORBISENC))
-
-typedef struct _GstVorbisEnc GstVorbisEnc;
-typedef struct _GstVorbisEncClass GstVorbisEncClass;
-
-/**
- * GstVorbisEnc:
- *
- * Opaque data structure.
- */
-struct _GstVorbisEnc {
- GstElement element;
-
- GstPad *sinkpad;
- GstPad *srcpad;
-
- GstCaps *srccaps;
- GstCaps *sinkcaps;
-
- vorbis_info vi; /* struct that stores all the static vorbis bitstream
- settings */
- vorbis_comment vc; /* struct that stores all the user comments */
-
- vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
- vorbis_block vb; /* local working space for packet->PCM decode */
-
- gboolean managed;
- gint bitrate;
- gint min_bitrate;
- gint max_bitrate;
- gfloat quality;
- gboolean quality_set;
-
- gint channels;
- gint frequency;
-
- guint64 samples_in;
- guint64 bytes_out;
- GstClockTime next_ts;
- GstClockTime expected_ts;
- gboolean next_discont;
- guint64 granulepos_offset;
- gint64 subgranule_offset;
- GstSegment segment;
- GstClockTime initial_ts;
-
- GstTagList * tags;
-
- gboolean setup;
- gboolean header_sent;
- gchar *last_message;
-};
-
-struct _GstVorbisEncClass {
- GstElementClass parent_class;
-};
-
-GType gst_vorbis_enc_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_VORBIS_ENC_H__ */
diff --git a/ext/vorbis/gstvorbisparse.c b/ext/vorbis/gstvorbisparse.c
deleted file mode 100644
index 5e3c12d9..00000000
--- a/ext/vorbis/gstvorbisparse.c
+++ /dev/null
@@ -1,671 +0,0 @@
-/* GStreamer
- * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
- * Copyright (C) 2006 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-vorbisparse
- * @see_also: vorbisdec, oggdemux, theoraparse
- *
- * The vorbisparse element will parse the header packets of the Vorbis
- * stream and put them as the streamheader in the caps. This is used in the
- * multifdsink case where you want to stream live vorbis streams to multiple
- * clients, each client has to receive the streamheaders first before they can
- * consume the vorbis packets.
- *
- * This element also makes sure that the buffers that it pushes out are properly
- * timestamped and that their offset and offset_end are set. The buffers that
- * vorbisparse outputs have all of the metadata that oggmux expects to receive,
- * which allows you to (for example) remux an ogg/vorbis file.
- *
- * <refsect2>
- * <title>Example pipelines</title>
- * |[
- * gst-launch -v filesrc location=sine.ogg ! oggdemux ! vorbisparse ! fakesink
- * ]| This pipeline shows that the streamheader is set in the caps, and that each
- * buffer has the timestamp, duration, offset, and offset_end set.
- * |[
- * gst-launch filesrc location=sine.ogg ! oggdemux ! vorbisparse \
- * ! oggmux ! filesink location=sine-remuxed.ogg
- * ]| This pipeline shows remuxing. sine-remuxed.ogg might not be exactly the same
- * as sine.ogg, but they should produce exactly the same decoded data.
- * </refsect2>
- *
- * Last reviewed on 2006-04-01 (0.10.4.1)
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "gstvorbisparse.h"
-
-GST_DEBUG_CATEGORY_EXTERN (vorbisparse_debug);
-#define GST_CAT_DEFAULT vorbisparse_debug
-
-static const GstElementDetails vorbis_parse_details = {
- "VorbisParse",
- "Codec/Parser/Audio",
- "parse raw vorbis streams",
- "Thomas Vander Stichele <thomas at apestaart dot org>"
-};
-
-static GstStaticPadTemplate vorbis_parse_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-vorbis")
- );
-
-static GstStaticPadTemplate vorbis_parse_src_factory =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-vorbis")
- );
-
-GST_BOILERPLATE (GstVorbisParse, gst_vorbis_parse, GstElement,
- GST_TYPE_ELEMENT);
-
-static GstFlowReturn vorbis_parse_chain (GstPad * pad, GstBuffer * buffer);
-static GstStateChangeReturn vorbis_parse_change_state (GstElement * element,
- GstStateChange transition);
-static gboolean vorbis_parse_sink_event (GstPad * pad, GstEvent * event);
-static gboolean vorbis_parse_src_query (GstPad * pad, GstQuery * query);
-static gboolean vorbis_parse_convert (GstPad * pad,
- GstFormat src_format, gint64 src_value,
- GstFormat * dest_format, gint64 * dest_value);
-static GstFlowReturn vorbis_parse_parse_packet (GstVorbisParse * parse,
- GstBuffer * buf);
-
-static void
-gst_vorbis_parse_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&vorbis_parse_src_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&vorbis_parse_sink_factory));
- gst_element_class_set_details (element_class, &vorbis_parse_details);
-}
-
-static void
-gst_vorbis_parse_class_init (GstVorbisParseClass * klass)
-{
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-
- gstelement_class->change_state = vorbis_parse_change_state;
-
- klass->parse_packet = GST_DEBUG_FUNCPTR (vorbis_parse_parse_packet);
-}
-
-static void
-gst_vorbis_parse_init (GstVorbisParse * parse, GstVorbisParseClass * g_class)
-{
- parse->sinkpad =
- gst_pad_new_from_static_template (&vorbis_parse_sink_factory, "sink");
- gst_pad_set_chain_function (parse->sinkpad,
- GST_DEBUG_FUNCPTR (vorbis_parse_chain));
- gst_pad_set_event_function (parse->sinkpad,
- GST_DEBUG_FUNCPTR (vorbis_parse_sink_event));
- gst_element_add_pad (GST_ELEMENT (parse), parse->sinkpad);
-
- parse->srcpad =
- gst_pad_new_from_static_template (&vorbis_parse_src_factory, "src");
- gst_pad_set_query_function (parse->srcpad,
- GST_DEBUG_FUNCPTR (vorbis_parse_src_query));
- gst_element_add_pad (GST_ELEMENT (parse), parse->srcpad);
-}
-
-static void
-vorbis_parse_set_header_on_caps (GstVorbisParse * parse, GstCaps * caps)
-{
- GstBuffer *buf1, *buf2, *buf3;
- GstStructure *structure;
- GValue array = { 0 };
- GValue value = { 0 };
-
- g_assert (parse);
- g_assert (parse->streamheader);
- g_assert (parse->streamheader->next);
- g_assert (parse->streamheader->next->next);
- buf1 = parse->streamheader->data;
- g_assert (buf1);
- buf2 = parse->streamheader->next->data;
- g_assert (buf2);
- buf3 = parse->streamheader->next->next->data;
- g_assert (buf3);
-
- structure = gst_caps_get_structure (caps, 0);
-
- /* mark buffers */
- GST_BUFFER_FLAG_SET (buf1, GST_BUFFER_FLAG_IN_CAPS);
- GST_BUFFER_FLAG_SET (buf2, GST_BUFFER_FLAG_IN_CAPS);
- GST_BUFFER_FLAG_SET (buf3, GST_BUFFER_FLAG_IN_CAPS);
-
- /* put buffers in a fixed list */
- g_value_init (&array, GST_TYPE_ARRAY);
- g_value_init (&value, GST_TYPE_BUFFER);
- gst_value_set_buffer (&value, buf1);
- gst_value_array_append_value (&array, &value);
- g_value_unset (&value);
- g_value_init (&value, GST_TYPE_BUFFER);
- gst_value_set_buffer (&value, buf2);
- gst_value_array_append_value (&array, &value);
- g_value_unset (&value);
- g_value_init (&value, GST_TYPE_BUFFER);
- gst_value_set_buffer (&value, buf3);
- gst_value_array_append_value (&array, &value);
- gst_structure_set_value (structure, "streamheader", &array);
- g_value_unset (&value);
- g_value_unset (&array);
-}
-
-static void
-vorbis_parse_drain_event_queue (GstVorbisParse * parse)
-{
- while (parse->event_queue->length) {
- GstEvent *event;
-
- event = GST_EVENT_CAST (g_queue_pop_head (parse->event_queue));
- gst_pad_event_default (parse->sinkpad, event);
- }
-}
-
-static void
-vorbis_parse_push_headers (GstVorbisParse * parse)
-{
- /* mark and put on caps */
- GstCaps *caps;
- GstBuffer *outbuf, *outbuf1, *outbuf2, *outbuf3;
- ogg_packet packet;
-
- /* get the headers into the caps, passing them to vorbis as we go */
- caps = gst_caps_make_writable (gst_pad_get_caps (parse->srcpad));
- vorbis_parse_set_header_on_caps (parse, caps);
- GST_DEBUG_OBJECT (parse, "here are the caps: %" GST_PTR_FORMAT, caps);
- gst_pad_set_caps (parse->srcpad, caps);
- gst_caps_unref (caps);
-
- outbuf = GST_BUFFER_CAST (parse->streamheader->data);
- packet.packet = GST_BUFFER_DATA (outbuf);
- packet.bytes = GST_BUFFER_SIZE (outbuf);
- packet.granulepos = GST_BUFFER_OFFSET_END (outbuf);
- packet.packetno = 1;
- packet.e_o_s = 0;
- packet.b_o_s = 1;
- vorbis_synthesis_headerin (&parse->vi, &parse->vc, &packet);
- parse->sample_rate = parse->vi.rate;
- outbuf1 = outbuf;
-
- outbuf = GST_BUFFER_CAST (parse->streamheader->next->data);
- packet.packet = GST_BUFFER_DATA (outbuf);
- packet.bytes = GST_BUFFER_SIZE (outbuf);
- packet.granulepos = GST_BUFFER_OFFSET_END (outbuf);
- packet.packetno = 2;
- packet.e_o_s = 0;
- packet.b_o_s = 0;
- vorbis_synthesis_headerin (&parse->vi, &parse->vc, &packet);
- outbuf2 = outbuf;
-
- outbuf = GST_BUFFER_CAST (parse->streamheader->next->next->data);
- packet.packet = GST_BUFFER_DATA (outbuf);
- packet.bytes = GST_BUFFER_SIZE (outbuf);
- packet.granulepos = GST_BUFFER_OFFSET_END (outbuf);
- packet.packetno = 3;
- packet.e_o_s = 0;
- packet.b_o_s = 0;
- vorbis_synthesis_headerin (&parse->vi, &parse->vc, &packet);
- outbuf3 = outbuf;
-
- /* first process queued events */
- vorbis_parse_drain_event_queue (parse);
-
- /* push out buffers, ignoring return value... */
- gst_buffer_set_caps (outbuf1, GST_PAD_CAPS (parse->srcpad));
- gst_pad_push (parse->srcpad, outbuf1);
- gst_buffer_set_caps (outbuf2, GST_PAD_CAPS (parse->srcpad));
- gst_pad_push (parse->srcpad, outbuf2);
- gst_buffer_set_caps (outbuf3, GST_PAD_CAPS (parse->srcpad));
- gst_pad_push (parse->srcpad, outbuf3);
-
- g_list_free (parse->streamheader);
- parse->streamheader = NULL;
-}
-
-static void
-vorbis_parse_clear_queue (GstVorbisParse * parse)
-{
- while (parse->buffer_queue->length) {
- GstBuffer *buf;
-
- buf = GST_BUFFER_CAST (g_queue_pop_head (parse->buffer_queue));
- gst_buffer_unref (buf);
- }
- while (parse->event_queue->length) {
- GstEvent *event;
-
- event = GST_EVENT_CAST (g_queue_pop_head (parse->event_queue));
- gst_event_unref (event);
- }
-}
-
-static GstFlowReturn
-vorbis_parse_push_buffer (GstVorbisParse * parse, GstBuffer * buf,
- gint64 granulepos)
-{
- guint64 samples;
-
- /* our hack as noted below */
- samples = GST_BUFFER_OFFSET (buf);
-
- GST_BUFFER_OFFSET_END (buf) = granulepos;
- GST_BUFFER_DURATION (buf) = samples * GST_SECOND / parse->sample_rate;
- GST_BUFFER_OFFSET (buf) = granulepos * GST_SECOND / parse->sample_rate;
- GST_BUFFER_TIMESTAMP (buf) =
- GST_BUFFER_OFFSET (buf) - GST_BUFFER_DURATION (buf);
-
- gst_buffer_set_caps (buf, GST_PAD_CAPS (parse->srcpad));
-
- return gst_pad_push (parse->srcpad, buf);
-}
-
-static GstFlowReturn
-vorbis_parse_drain_queue_prematurely (GstVorbisParse * parse)
-{
- GstFlowReturn ret = GST_FLOW_OK;
- gint64 granulepos = MAX (parse->prev_granulepos, 0);
-
- /* got an EOS event, make sure to push out any buffers that were in the queue
- * -- won't normally be the case, but this catches the
- * didn't-get-a-granulepos-on-the-last-packet case. Assuming a continuous
- * stream. */
-
- /* if we got EOS before any buffers came, go ahead and push the other events
- * first */
- vorbis_parse_drain_event_queue (parse);
-
- while (!g_queue_is_empty (parse->buffer_queue)) {
- GstBuffer *buf;
-
- buf = GST_BUFFER_CAST (g_queue_pop_head (parse->buffer_queue));
-
- granulepos += GST_BUFFER_OFFSET (buf);
- ret = vorbis_parse_push_buffer (parse, buf, granulepos);
-
- if (ret != GST_FLOW_OK)
- goto done;
- }
-
- parse->prev_granulepos = granulepos;
-
-done:
- return ret;
-}
-
-static GstFlowReturn
-vorbis_parse_drain_queue (GstVorbisParse * parse, gint64 granulepos)
-{
- GstFlowReturn ret = GST_FLOW_OK;
- GList *walk;
- gint64 cur = granulepos;
- gint64 gp;
-
- for (walk = parse->buffer_queue->head; walk; walk = walk->next)
- cur -= GST_BUFFER_OFFSET (walk->data);
-
- if (parse->prev_granulepos != -1)
- cur = MAX (cur, parse->prev_granulepos);
-
- while (!g_queue_is_empty (parse->buffer_queue)) {
- GstBuffer *buf;
-
- buf = GST_BUFFER_CAST (g_queue_pop_head (parse->buffer_queue));
-
- cur += GST_BUFFER_OFFSET (buf);
- gp = CLAMP (cur, 0, granulepos);
-
- ret = vorbis_parse_push_buffer (parse, buf, gp);
-
- if (ret != GST_FLOW_OK)
- goto done;
- }
-
- parse->prev_granulepos = granulepos;
-
-done:
- return ret;
-}
-
-static GstFlowReturn
-vorbis_parse_queue_buffer (GstVorbisParse * parse, GstBuffer * buf)
-{
- GstFlowReturn ret = GST_FLOW_OK;
- long blocksize;
- ogg_packet packet;
-
- buf = gst_buffer_make_metadata_writable (buf);
-
- packet.packet = GST_BUFFER_DATA (buf);
- packet.bytes = GST_BUFFER_SIZE (buf);
- packet.granulepos = GST_BUFFER_OFFSET_END (buf);
- packet.packetno = parse->packetno + parse->buffer_queue->length;
- packet.e_o_s = 0;
-
- blocksize = vorbis_packet_blocksize (&parse->vi, &packet);
-
- /* temporarily store the sample count in OFFSET -- we overwrite this later */
-
- if (parse->prev_blocksize < 0)
- GST_BUFFER_OFFSET (buf) = 0;
- else
- GST_BUFFER_OFFSET (buf) = (blocksize + parse->prev_blocksize) / 4;
-
- parse->prev_blocksize = blocksize;
-
- g_queue_push_tail (parse->buffer_queue, buf);
-
- if (GST_BUFFER_OFFSET_END_IS_VALID (buf))
- ret = vorbis_parse_drain_queue (parse, GST_BUFFER_OFFSET_END (buf));
-
- return ret;
-}
-
-static GstFlowReturn
-vorbis_parse_parse_packet (GstVorbisParse * parse, GstBuffer * buf)
-{
- GstFlowReturn ret;
- guint8 *data;
- guint size;
- gboolean have_header;
-
- data = GST_BUFFER_DATA (buf);
- size = GST_BUFFER_SIZE (buf);
-
- parse->packetno++;
-
- have_header = FALSE;
- if (size >= 1) {
- if (data[0] >= 0x01 && data[0] <= 0x05)
- have_header = TRUE;
- }
-
- if (have_header) {
- if (!parse->streamheader_sent) {
- /* we need to collect the headers still */
- /* so put it on the streamheader list and return */
- parse->streamheader = g_list_append (parse->streamheader, buf);
- }
- ret = GST_FLOW_OK;
- } else {
- /* data packet, push the headers we collected before */
- if (!parse->streamheader_sent) {
- vorbis_parse_push_headers (parse);
- parse->streamheader_sent = TRUE;
- }
- ret = vorbis_parse_queue_buffer (parse, buf);
- }
-
- return ret;
-}
-
-static GstFlowReturn
-vorbis_parse_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstVorbisParseClass *klass;
- GstVorbisParse *parse;
-
- parse = GST_VORBIS_PARSE (GST_PAD_PARENT (pad));
- klass = GST_VORBIS_PARSE_CLASS (G_OBJECT_GET_CLASS (parse));
-
- g_assert (klass->parse_packet != NULL);
-
- return klass->parse_packet (parse, buffer);
-}
-
-static gboolean
-vorbis_parse_queue_event (GstVorbisParse * parse, GstEvent * event)
-{
- GstFlowReturn ret = TRUE;
-
- g_queue_push_tail (parse->event_queue, event);
-
- return ret;
-}
-
-static gboolean
-vorbis_parse_sink_event (GstPad * pad, GstEvent * event)
-{
- gboolean ret;
- GstVorbisParse *parse;
-
- parse = GST_VORBIS_PARSE (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_START:
- vorbis_parse_clear_queue (parse);
- parse->prev_granulepos = -1;
- parse->prev_blocksize = -1;
- ret = gst_pad_event_default (pad, event);
- break;
- case GST_EVENT_EOS:
- vorbis_parse_drain_queue_prematurely (parse);
- ret = gst_pad_event_default (pad, event);
- break;
- default:
- if (!parse->streamheader_sent && GST_EVENT_IS_SERIALIZED (event))
- ret = vorbis_parse_queue_event (parse, event);
- else
- ret = gst_pad_event_default (pad, event);
- break;
- }
-
- gst_object_unref (parse);
-
- return ret;
-}
-
-static gboolean
-vorbis_parse_convert (GstPad * pad,
- GstFormat src_format, gint64 src_value,
- GstFormat * dest_format, gint64 * dest_value)
-{
- gboolean res = TRUE;
- GstVorbisParse *parse;
- guint64 scale = 1;
-
- parse = GST_VORBIS_PARSE (GST_PAD_PARENT (pad));
-
- /* fixme: assumes atomic access to lots of instance variables modified from
- * the streaming thread, including 64-bit variables */
-
- if (parse->packetno < 4)
- return FALSE;
-
- if (src_format == *dest_format) {
- *dest_value = src_value;
- return TRUE;
- }
-
- if (parse->sinkpad == pad &&
- (src_format == GST_FORMAT_BYTES || *dest_format == GST_FORMAT_BYTES))
- return FALSE;
-
- switch (src_format) {
- case GST_FORMAT_TIME:
- switch (*dest_format) {
- case GST_FORMAT_BYTES:
- scale = sizeof (float) * parse->vi.channels;
- case GST_FORMAT_DEFAULT:
- *dest_value =
- scale * gst_util_uint64_scale_int (src_value, parse->vi.rate,
- GST_SECOND);
- break;
- default:
- res = FALSE;
- }
- break;
- case GST_FORMAT_DEFAULT:
- switch (*dest_format) {
- case GST_FORMAT_BYTES:
- *dest_value = src_value * sizeof (float) * parse->vi.channels;
- break;
- case GST_FORMAT_TIME:
- *dest_value =
- gst_util_uint64_scale_int (src_value, GST_SECOND, parse->vi.rate);
- break;
- default:
- res = FALSE;
- }
- break;
- case GST_FORMAT_BYTES:
- switch (*dest_format) {
- case GST_FORMAT_DEFAULT:
- *dest_value = src_value / (sizeof (float) * parse->vi.channels);
- break;
- case GST_FORMAT_TIME:
- *dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND,
- parse->vi.rate * sizeof (float) * parse->vi.channels);
- break;
- default:
- res = FALSE;
- }
- break;
- default:
- res = FALSE;
- }
-
- return res;
-}
-
-static gboolean
-vorbis_parse_src_query (GstPad * pad, GstQuery * query)
-{
- gint64 granulepos;
- GstVorbisParse *parse;
- gboolean res = FALSE;
-
- parse = GST_VORBIS_PARSE (GST_PAD_PARENT (pad));
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_POSITION:
- {
- GstFormat format;
- gint64 value;
-
- granulepos = parse->prev_granulepos;
-
- gst_query_parse_position (query, &format, NULL);
-
- /* and convert to the final format */
- if (!(res =
- vorbis_parse_convert (pad, GST_FORMAT_DEFAULT, granulepos,
- &format, &value)))
- goto error;
-
- /* fixme: support segments
- value = (value - parse->segment_start) + parse->segment_time;
- */
-
- gst_query_set_position (query, format, value);
-
- GST_LOG_OBJECT (parse, "query %p: peer returned granulepos: %"
- G_GUINT64_FORMAT " - we return %" G_GUINT64_FORMAT " (format %u)",
- query, granulepos, value, format);
-
- break;
- }
- case GST_QUERY_DURATION:
- {
- /* fixme: not threadsafe */
- /* query peer for total length */
- if (!gst_pad_is_linked (parse->sinkpad)) {
- GST_WARNING_OBJECT (parse, "sink pad %" GST_PTR_FORMAT " is not linked",
- parse->sinkpad);
- goto error;
- }
- if (!(res = gst_pad_query (GST_PAD_PEER (parse->sinkpad), query)))
- goto error;
- break;
- }
- case GST_QUERY_CONVERT:
- {
- GstFormat src_fmt, dest_fmt;
- gint64 src_val, dest_val;
-
- gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
- if (!(res =
- vorbis_parse_convert (pad, src_fmt, src_val, &dest_fmt,
- &dest_val)))
- goto error;
- gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
- break;
- }
- default:
- res = gst_pad_query_default (pad, query);
- break;
- }
- return res;
-
-error:
- {
- GST_WARNING_OBJECT (parse, "error handling query");
- return res;
- }
-}
-
-static GstStateChangeReturn
-vorbis_parse_change_state (GstElement * element, GstStateChange transition)
-{
- GstVorbisParse *parse = GST_VORBIS_PARSE (element);
- GstStateChangeReturn ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- vorbis_info_init (&parse->vi);
- vorbis_comment_init (&parse->vc);
- parse->prev_granulepos = -1;
- parse->prev_blocksize = -1;
- parse->packetno = 0;
- parse->streamheader_sent = FALSE;
- parse->buffer_queue = g_queue_new ();
- parse->event_queue = g_queue_new ();
- break;
- default:
- break;
- }
-
- ret = parent_class->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- vorbis_info_clear (&parse->vi);
- vorbis_comment_clear (&parse->vc);
- vorbis_parse_clear_queue (parse);
- g_queue_free (parse->buffer_queue);
- parse->buffer_queue = NULL;
- g_queue_free (parse->event_queue);
- parse->event_queue = NULL;
- break;
- default:
- break;
- }
-
- return ret;
-}
diff --git a/ext/vorbis/gstvorbisparse.h b/ext/vorbis/gstvorbisparse.h
deleted file mode 100644
index 65389497..00000000
--- a/ext/vorbis/gstvorbisparse.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- c-basic-offset: 2 -*-
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_VORBIS_PARSE_H__
-#define __GST_VORBIS_PARSE_H__
-
-
-#include <gst/gst.h>
-#include <vorbis/codec.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_VORBIS_PARSE \
- (gst_vorbis_parse_get_type())
-#define GST_VORBIS_PARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VORBIS_PARSE,GstVorbisParse))
-#define GST_VORBIS_PARSE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VORBIS_PARSE,GstVorbisParseClass))
-#define GST_IS_VORBIS_PARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VORBIS_PARSE))
-#define GST_IS_VORBIS_PARSE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VORBIS_PARSE))
-
-typedef struct _GstVorbisParse GstVorbisParse;
-typedef struct _GstVorbisParseClass GstVorbisParseClass;
-
-/**
- * GstVorbisParse:
- *
- * Opaque data structure.
- */
-struct _GstVorbisParse {
- GstElement element;
-
- GstPad * sinkpad;
- GstPad * srcpad;
-
- guint packetno;
- gboolean streamheader_sent;
- GList * streamheader;
-
- GQueue * event_queue;
- GQueue * buffer_queue;
-
- vorbis_info vi;
- vorbis_comment vc;
-
- gint64 prev_granulepos;
- gint32 prev_blocksize;
- guint32 sample_rate;
-};
-
-struct _GstVorbisParseClass {
- GstElementClass parent_class;
-
- /* virtual functions */
- GstFlowReturn (*parse_packet) (GstVorbisParse * parse, GstBuffer * buf);
-};
-
-GType gst_vorbis_parse_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_VORBIS_PARSE_H__ */
diff --git a/ext/vorbis/gstvorbistag.c b/ext/vorbis/gstvorbistag.c
deleted file mode 100644
index 67a931d1..00000000
--- a/ext/vorbis/gstvorbistag.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2006 James Livingston <doclivingston@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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-vorbistag
- * @see_also: #oggdemux, #oggmux, #vorbisparse, #GstTagSetter
- *
- * The vorbistags element can change the tag contained within a raw
- * vorbis stream. Specifically, it modifies the comments header packet
- * of the vorbis stream.
- *
- * The element will also process the stream as the #vorbisparse element does
- * so it can be used when remuxing an Ogg Vorbis stream, without additional
- * elements.
- *
- * Applications can set the tags to write using the #GstTagSetter interface.
- * Tags contained withing the vorbis bitstream will be picked up
- * automatically (and merged according to the merge mode set via the tag
- * setter interface).
- *
- * <refsect2>
- * <title>Example pipelines</title>
- * |[
- * gst-launch -v filesrc location=foo.ogg ! oggdemux ! vorbistag ! oggmux ! filesink location=bar.ogg
- * ]| This element is not useful with gst-launch, because it does not support
- * setting the tags on a #GstTagSetter interface. Conceptually, the element
- * will usually be used in this order though.
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <glib.h>
-#include <gst/tag/tag.h>
-#include <gst/gsttagsetter.h>
-
-#include <vorbis/codec.h>
-
-#include "gstvorbistag.h"
-
-
-GST_DEBUG_CATEGORY_EXTERN (vorbisparse_debug);
-#define GST_CAT_DEFAULT vorbisparse_debug
-
-static void gst_vorbis_tag_base_init (gpointer g_class);
-static void gst_vorbis_tag_class_init (GstVorbisTagClass * klass);
-static void gst_vorbis_tag_init (GstVorbisTag * tagger,
- GstVorbisTagClass * g_class);
-static GstFlowReturn gst_vorbis_tag_parse_packet (GstVorbisParse * parse,
- GstBuffer * buffer);
-
-#define _do_init(type) \
- G_STMT_START{ \
- static const GInterfaceInfo tag_setter_info = { \
- NULL, \
- NULL, \
- NULL \
- }; \
- g_type_add_interface_static (type, GST_TYPE_TAG_SETTER, \
- &tag_setter_info); \
- }G_STMT_END
-
-GST_BOILERPLATE_FULL (GstVorbisTag, gst_vorbis_tag, GstVorbisParse,
- GST_TYPE_VORBIS_PARSE, _do_init);
-
-static GstElementDetails vorbis_tag_details = {
- "VorbisTag",
- "Formatter/Metadata",
- "Retags vorbis streams",
- "James Livingston <doclivingston@gmail.com>"
-};
-
-
-static void
-gst_vorbis_tag_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &vorbis_tag_details);
-}
-
-static void
-gst_vorbis_tag_class_init (GstVorbisTagClass * klass)
-{
- GstVorbisParseClass *vorbisparse_class = GST_VORBIS_PARSE_CLASS (klass);
-
- vorbisparse_class->parse_packet = gst_vorbis_tag_parse_packet;
-}
-
-static void
-gst_vorbis_tag_init (GstVorbisTag * tagger, GstVorbisTagClass * g_class)
-{
- /* nothing to do */
-}
-
-
-static GstFlowReturn
-gst_vorbis_tag_parse_packet (GstVorbisParse * parse, GstBuffer * buffer)
-{
- GstTagList *old_tags, *new_tags;
- const GstTagList *user_tags;
- GstVorbisTag *tagger;
- gchar *encoder = NULL;
- GstBuffer *new_buf;
-
- /* just pass everything except the comments packet */
- if (GST_BUFFER_SIZE (buffer) >= 1 && GST_BUFFER_DATA (buffer)[0] != 0x03) {
- return GST_VORBIS_PARSE_CLASS (parent_class)->parse_packet (parse, buffer);
- }
-
- tagger = GST_VORBIS_TAG (parse);
-
- old_tags =
- gst_tag_list_from_vorbiscomment_buffer (buffer, (guint8 *) "\003vorbis",
- 7, &encoder);
- user_tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (tagger));
-
- /* build new tag list */
- new_tags = gst_tag_list_merge (user_tags, old_tags,
- gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (tagger)));
- gst_tag_list_free (old_tags);
-
- new_buf =
- gst_tag_list_to_vorbiscomment_buffer (new_tags, (guint8 *) "\003vorbis",
- 7, encoder);
- gst_buffer_copy_metadata (new_buf, buffer, GST_BUFFER_COPY_TIMESTAMPS);
-
- gst_tag_list_free (new_tags);
- g_free (encoder);
- gst_buffer_unref (buffer);
-
- return GST_VORBIS_PARSE_CLASS (parent_class)->parse_packet (parse, new_buf);
-}
diff --git a/ext/vorbis/gstvorbistag.h b/ext/vorbis/gstvorbistag.h
deleted file mode 100644
index 9a443006..00000000
--- a/ext/vorbis/gstvorbistag.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- c-basic-offset: 2 -*-
- * GStreamer
- * Copyright (C) <2006> James Livingston <doclivingston@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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_VORBIS_TAG_H__
-#define __GST_VORBIS_TAG_H__
-
-#include "gstvorbisparse.h"
-
-
-G_BEGIN_DECLS
-
-
-#define GST_TYPE_VORBIS_TAG \
- (gst_vorbis_tag_get_type())
-#define GST_VORBIS_TAG(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VORBIS_TAG,GstVorbisTag))
-#define GST_VORBIS_TAG_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VORBIS_TAG,GstVorbisTagClass))
-#define GST_IS_VORBIS_TAG(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VORBIS_TAG))
-#define GST_IS_VORBIS_TAG_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VORBIS_TAG))
-
-
-typedef struct _GstVorbisTag GstVorbisTag;
-typedef struct _GstVorbisTagClass GstVorbisTagClass;
-
-/**
- * GstVorbisTag:
- *
- * Opaque data structure.
- */
-struct _GstVorbisTag {
- GstVorbisParse parse;
-};
-
-struct _GstVorbisTagClass {
- GstVorbisParseClass parent_class;
-};
-
-GType gst_vorbis_tag_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_VORBIS_TAG_H__ */
diff --git a/gst-libs/Makefile.am b/gst-libs/Makefile.am
deleted file mode 100644
index 062cb55a..00000000
--- a/gst-libs/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = gst
diff --git a/gst-libs/ext/.gitignore b/gst-libs/ext/.gitignore
deleted file mode 100644
index 20645e64..00000000
--- a/gst-libs/ext/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-ffmpeg
diff --git a/gst-libs/ext/Makefile.am b/gst-libs/ext/Makefile.am
deleted file mode 100644
index f9beb01e..00000000
--- a/gst-libs/ext/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-SUBDIRS =
-DIST_SUBDIRS =
diff --git a/gst-libs/gst/Makefile.am b/gst-libs/gst/Makefile.am
deleted file mode 100644
index 52721205..00000000
--- a/gst-libs/gst/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-# The interfaces directory has to be built before the others,
-# otherwise some generated header files will be missing for the
-# plugins in the other directories.
-# Also, the tag directory has to be built before the cdda directory.
-SUBDIRS = \
- interfaces \
- tag \
- audio \
- cdda \
- fft \
- floatcast \
- netbuffer \
- pbutils \
- riff \
- rtp \
- sdp \
- rtsp \
- video \
- app
-
-noinst_HEADERS = gettext.h gst-i18n-plugin.h
diff --git a/gst-libs/gst/app/.gitignore b/gst-libs/gst/app/.gitignore
deleted file mode 100644
index 9f0ae4be..00000000
--- a/gst-libs/gst/app/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-gstapp-marshal.c
-gstapp-marshal.h
diff --git a/gst-libs/gst/app/Makefile.am b/gst-libs/gst/app/Makefile.am
deleted file mode 100644
index 1671baf3..00000000
--- a/gst-libs/gst/app/Makefile.am
+++ /dev/null
@@ -1,75 +0,0 @@
-lib_LTLIBRARIES = libgstapp-@GST_MAJORMINOR@.la
-
-glib_enum_define = GST_APP
-glib_gen_prefix = __gst_app
-glib_gen_basename = gstapp
-
-include $(top_srcdir)/common/gst-glib-gen.mak
-
-built_sources = gstapp-marshal.c
-built_headers = gstapp-marshal.h
-
-BUILT_SOURCES = $(built_sources) $(built_headers)
-
-nodist_libgstapp_@GST_MAJORMINOR@_la_SOURCES = \
- $(built_sources)
-
-libgstapp_@GST_MAJORMINOR@_la_SOURCES = gstappsrc.c gstappbuffer.c gstappsink.c
-libgstapp_@GST_MAJORMINOR@_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS)
-libgstapp_@GST_MAJORMINOR@_la_LIBADD = $(GST_BASE_LIBS)
-libgstapp_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
-libgstapp_@GST_MAJORMINOR@_la_LIBTOOLFLAGS = --tag=disable-static
-
-libgstapp_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/app
-libgstapp_@GST_MAJORMINOR@include_HEADERS = \
- gstappsrc.h \
- gstappbuffer.h \
- gstappsink.h
-
-CLEANFILES = $(BUILT_SOURCES)
-
-EXTRA_DIST = gstapp-marshal.list
-
-if HAVE_INTROSPECTION
-BUILT_GIRSOURCES = GstApp-@GST_MAJORMINOR@.gir
-
-gir_headers=$(patsubst %,$(srcdir)/%, $(libgstapp_@GST_MAJORMINOR@include_HEADERS))
-gir_sources=$(patsubst %,$(srcdir)/%, $(libgstapp_@GST_MAJORMINOR@_la_SOURCES))
-gir_sources+=$(patsubst %,$(builddir)/%, $(nodist_libgstapp_@GST_MAJORMINOR@_la_SOURCES))
-gir_cincludes=$(patsubst %,--c-include='gst/app/%',$(libgstapp_@GST_MAJORMINOR@include_HEADERS))
-
-GstApp-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstapp-@GST_MAJORMINOR@.la
- PKG_CONFIG_PATH="$(PKG_CONFIG_PATH):$(top_builddir)/pkgconfig" \
- $(INTROSPECTION_SCANNER) -v --namespace GstApp \
- --nsversion=@GST_MAJORMINOR@ \
- --strip-prefix=Gst \
- $(gir_cincludes) \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-base-0.10` \
- --library=gstapp-0.10 \
- --include=Gst-0.10 \
- --include=GstBase-0.10 \
- --libtool="$(top_builddir)/libtool" \
- --pkg gstreamer-0.10 \
- --pkg gstreamer-base-0.10 \
- --output $@ \
- $(gir_headers) \
- $(gir_sources)
-
-# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
-# install anything - we need to install inside our prefix.
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(BUILT_GIRSOURCES)
-
-typelibsdir = $(libdir)/girepository-1.0/
-
-typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
-
-%.typelib: %.gir $(INTROSPECTION_COMPILER)
- $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=$(builddir) --includedir=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst --includedir=`$(PKG_CONFIG) --variable=libdir gstreamer-base-0.10` $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
-CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
-endif
diff --git a/gst-libs/gst/app/gstapp-marshal.list b/gst-libs/gst/app/gstapp-marshal.list
deleted file mode 100644
index ad35948d..00000000
--- a/gst-libs/gst/app/gstapp-marshal.list
+++ /dev/null
@@ -1,5 +0,0 @@
-BOOLEAN:UINT64
-ENUM:OBJECT
-ENUM:VOID
-VOID:UINT
-
diff --git a/gst-libs/gst/app/gstappbuffer.c b/gst-libs/gst/app/gstappbuffer.c
deleted file mode 100644
index 06f354f8..00000000
--- a/gst-libs/gst/app/gstappbuffer.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/base/gstpushsrc.h>
-
-#include <string.h>
-
-#include "gstappbuffer.h"
-
-static void gst_app_buffer_init (GstAppBuffer * buffer, gpointer g_class);
-static void gst_app_buffer_class_init (gpointer g_class, gpointer class_data);
-static void gst_app_buffer_finalize (GstAppBuffer * buffer);
-
-static GstBufferClass *parent_class;
-
-GType
-gst_app_buffer_get_type (void)
-{
- static GType _gst_app_buffer_type;
-
- if (G_UNLIKELY (_gst_app_buffer_type == 0)) {
- static const GTypeInfo app_buffer_info = {
- sizeof (GstBufferClass),
- NULL,
- NULL,
- gst_app_buffer_class_init,
- NULL,
- NULL,
- sizeof (GstAppBuffer),
- 0,
- (GInstanceInitFunc) gst_app_buffer_init,
- NULL
- };
- _gst_app_buffer_type = g_type_register_static (GST_TYPE_BUFFER,
- "GstAppBuffer", &app_buffer_info, 0);
- }
- return _gst_app_buffer_type;
-}
-
-static void
-gst_app_buffer_init (GstAppBuffer * buffer, gpointer g_class)
-{
-
-}
-
-static void
-gst_app_buffer_class_init (gpointer g_class, gpointer class_data)
-{
- GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
-
- mini_object_class->finalize =
- (GstMiniObjectFinalizeFunction) gst_app_buffer_finalize;
-
- parent_class = g_type_class_peek_parent (g_class);
-}
-
-static void
-gst_app_buffer_finalize (GstAppBuffer * buffer)
-{
- g_return_if_fail (buffer != NULL);
- g_return_if_fail (GST_IS_APP_BUFFER (buffer));
-
- if (buffer->finalize) {
- buffer->finalize (buffer->priv);
- }
-
- GST_MINI_OBJECT_CLASS (parent_class)->finalize (GST_MINI_OBJECT (buffer));
-}
-
-GstBuffer *
-gst_app_buffer_new (void *data, int length,
- GstAppBufferFinalizeFunc finalize, void *priv)
-{
- GstAppBuffer *buffer;
-
- buffer = (GstAppBuffer *) gst_mini_object_new (GST_TYPE_APP_BUFFER);
-
- GST_BUFFER_DATA (buffer) = data;
- GST_BUFFER_SIZE (buffer) = length;
-
- buffer->finalize = finalize;
- buffer->priv = priv;
-
- return GST_BUFFER (buffer);
-}
diff --git a/gst-libs/gst/app/gstappbuffer.h b/gst-libs/gst/app/gstappbuffer.h
deleted file mode 100644
index 532f2ae2..00000000
--- a/gst-libs/gst/app/gstappbuffer.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _GST_APP_BUFFER_H_
-#define _GST_APP_BUFFER_H_
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_APP_BUFFER \
- (gst_app_buffer_get_type())
-#define GST_APP_BUFFER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_APP_BUFFER,GstAppBuffer))
-#define GST_APP_BUFFER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_APP_BUFFER,GstAppBufferClass))
-#define GST_IS_APP_BUFFER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_APP_BUFFER))
-#define GST_IS_APP_BUFFER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_APP_BUFFER))
-
-typedef struct _GstAppBuffer GstAppBuffer;
-typedef struct _GstAppBufferClass GstAppBufferClass;
-typedef void (*GstAppBufferFinalizeFunc) (void *priv);
-
-struct _GstAppBuffer
-{
- GstBuffer buffer;
-
- /*< private >*/
- GstAppBufferFinalizeFunc finalize;
- void *priv;
-};
-
-struct _GstAppBufferClass
-{
- GstBufferClass buffer_class;
-};
-
-GType gst_app_buffer_get_type(void);
-
-GstBuffer *gst_app_buffer_new (void *data, int length,
- GstAppBufferFinalizeFunc finalize, void *priv);
-
-G_END_DECLS
-
-#endif
-
diff --git a/gst-libs/gst/app/gstappsink.c b/gst-libs/gst/app/gstappsink.c
deleted file mode 100644
index 14519fe3..00000000
--- a/gst-libs/gst/app/gstappsink.c
+++ /dev/null
@@ -1,1381 +0,0 @@
-/* GStreamer
- * Copyright (C) 2007 David Schleef <ds@schleef.org>
- * (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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-appsink
- *
- * Appsink is a sink plugin that supports many different methods for making
- * the application get a handle on the GStreamer data in a pipeline. Unlike
- * most GStreamer elements, Appsink provides external API functions.
- *
- * For the documentation of the API, please see the
- * <link linkend="gst-plugins-base-libs-appsink">libgstapp</link> section in
- * the GStreamer Plugins Base Libraries documentation.
- *
- * Since: 0.10.22
- */
-
-
-/**
- * SECTION:gstappsink
- * @short_description: Easy way for applications to extract buffers from a
- * pipeline
- * @see_also: #GstBaseSink, appsrc
- *
- * Appsink is a sink plugin that supports many different methods for making
- * the application get a handle on the GStreamer data in a pipeline. Unlike
- * most GStreamer elements, Appsink provides external API functions.
- *
- * appsink can be used by linking to the gstappsink.h header file to access the
- * methods or by using the appsink action signals and properties.
- *
- * The normal way of retrieving buffers from appsink is by using the
- * gst_app_sink_pull_buffer() and gst_app_sink_pull_preroll() methods.
- * These methods block until a buffer becomes available in the sink or when the
- * sink is shut down or reaches EOS.
- *
- * Appsink will internally use a queue to collect buffers from the streaming
- * thread. If the application is not pulling buffers fast enough, this queue
- * will consume a lot of memory over time. The "max-buffers" property can be
- * used to limit the queue size. The "drop" property controls whether the
- * streaming thread blocks or if older buffers are dropped when the maximum
- * queue size is reached. Note that blocking the streaming thread can negatively
- * affect real-time performance and should be avoided.
- *
- * If a blocking behaviour is not desirable, setting the "emit-signals" property
- * to %TRUE will make appsink emit the "new-buffer" and "new-preroll" signals
- * when a buffer can be pulled without blocking.
- *
- * The "caps" property on appsink can be used to control the formats that
- * appsink can receive. This property can contain non-fixed caps, the format of
- * the pulled buffers can be obtained by getting the buffer caps.
- *
- * If one of the pull-preroll or pull-buffer methods return %NULL, the appsink
- * is stopped or in the EOS state. You can check for the EOS state with the
- * "eos" property or with the gst_app_sink_is_eos() method.
- *
- * The eos signal can also be used to be informed when the EOS state is reached
- * to avoid polling.
- *
- * Last reviewed on 2008-12-17 (0.10.22)
- *
- * Since: 0.10.22
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/base/gstbasesink.h>
-#include <gst/gstbuffer.h>
-#include <gst/gstbufferlist.h>
-
-#include <string.h>
-
-#include "gstappsink.h"
-
-struct _GstAppSinkPrivate
-{
- GstCaps *caps;
- gboolean emit_signals;
- guint max_buffers;
- gboolean drop;
-
- GCond *cond;
- GMutex *mutex;
- GQueue *queue;
- GstBuffer *preroll;
- gboolean flushing;
- gboolean unlock;
- gboolean started;
- gboolean is_eos;
-
- GstAppSinkCallbacks callbacks;
- gpointer user_data;
- GDestroyNotify notify;
-};
-
-GST_DEBUG_CATEGORY_STATIC (app_sink_debug);
-#define GST_CAT_DEFAULT app_sink_debug
-
-enum
-{
- /* signals */
- SIGNAL_EOS,
- SIGNAL_NEW_PREROLL,
- SIGNAL_NEW_BUFFER,
- SIGNAL_NEW_BUFFER_LIST,
-
- /* actions */
- SIGNAL_PULL_PREROLL,
- SIGNAL_PULL_BUFFER,
- SIGNAL_PULL_BUFFER_LIST,
-
- LAST_SIGNAL
-};
-
-#define DEFAULT_PROP_EOS TRUE
-#define DEFAULT_PROP_EMIT_SIGNALS FALSE
-#define DEFAULT_PROP_MAX_BUFFERS 0
-#define DEFAULT_PROP_DROP FALSE
-
-enum
-{
- PROP_0,
- PROP_CAPS,
- PROP_EOS,
- PROP_EMIT_SIGNALS,
- PROP_MAX_BUFFERS,
- PROP_DROP,
- PROP_LAST
-};
-
-static GstStaticPadTemplate gst_app_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-static void gst_app_sink_uri_handler_init (gpointer g_iface,
- gpointer iface_data);
-
-static void gst_app_sink_dispose (GObject * object);
-static void gst_app_sink_finalize (GObject * object);
-
-static void gst_app_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_app_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static gboolean gst_app_sink_unlock_start (GstBaseSink * bsink);
-static gboolean gst_app_sink_unlock_stop (GstBaseSink * bsink);
-static gboolean gst_app_sink_start (GstBaseSink * psink);
-static gboolean gst_app_sink_stop (GstBaseSink * psink);
-static gboolean gst_app_sink_event (GstBaseSink * sink, GstEvent * event);
-static GstFlowReturn gst_app_sink_preroll (GstBaseSink * psink,
- GstBuffer * buffer);
-static GstFlowReturn gst_app_sink_render_common (GstBaseSink * psink,
- GstMiniObject * data, gboolean is_list);
-static GstFlowReturn gst_app_sink_render (GstBaseSink * psink,
- GstBuffer * buffer);
-static GstFlowReturn gst_app_sink_render_list (GstBaseSink * psink,
- GstBufferList * list);
-static GstCaps *gst_app_sink_getcaps (GstBaseSink * psink);
-static GstMiniObject *gst_app_sink_pull_object (GstAppSink * appsink);
-
-static guint gst_app_sink_signals[LAST_SIGNAL] = { 0 };
-
-static void
-_do_init (GType filesrc_type)
-{
- static const GInterfaceInfo urihandler_info = {
- gst_app_sink_uri_handler_init,
- NULL,
- NULL
- };
- g_type_add_interface_static (filesrc_type, GST_TYPE_URI_HANDLER,
- &urihandler_info);
-}
-
-GST_BOILERPLATE_FULL (GstAppSink, gst_app_sink, GstBaseSink, GST_TYPE_BASE_SINK,
- _do_init);
-
-/* Can't use glib-genmarshal for this, as it doesn't know how to handle
- * GstMiniObject-based types, which are a new fundamental type */
-static void
-gst_app_marshal_BUFFER__VOID (GClosure * closure,
- GValue * return_value,
- guint n_param_values,
- const GValue * param_values,
- gpointer invocation_hint, gpointer marshal_data)
-{
- typedef GstBuffer *(*GMarshalFunc_BUFFER__VOID) (gpointer data1,
- gpointer data2);
- register GMarshalFunc_BUFFER__VOID callback;
- register GCClosure *cc = (GCClosure *) closure;
- register gpointer data1, data2;
- GstBuffer *v_return;
-
- g_return_if_fail (return_value != NULL);
- g_return_if_fail (n_param_values == 1);
-
- if (G_CCLOSURE_SWAP_DATA (closure)) {
- data1 = closure->data;
- data2 = g_value_peek_pointer (param_values + 0);
- } else {
- data1 = g_value_peek_pointer (param_values + 0);
- data2 = closure->data;
- }
- callback =
- (GMarshalFunc_BUFFER__VOID) (marshal_data ? marshal_data : cc->callback);
-
- v_return = callback (data1, data2);
-
- gst_value_take_buffer (return_value, v_return);
-}
-
-static void
-gst_app_sink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- GST_DEBUG_CATEGORY_INIT (app_sink_debug, "appsink", 0, "appsink element");
-
- gst_element_class_set_details_simple (element_class, "AppSink",
- "Generic/Sink", "Allow the application to get access to raw buffer",
- "David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>");
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_app_sink_template));
-}
-
-static void
-gst_app_sink_class_init (GstAppSinkClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
- GstBaseSinkClass *basesink_class = (GstBaseSinkClass *) klass;
-
- gobject_class->dispose = gst_app_sink_dispose;
- gobject_class->finalize = gst_app_sink_finalize;
-
- gobject_class->set_property = gst_app_sink_set_property;
- gobject_class->get_property = gst_app_sink_get_property;
-
- g_object_class_install_property (gobject_class, PROP_CAPS,
- g_param_spec_boxed ("caps", "Caps",
- "The allowed caps for the sink pad", GST_TYPE_CAPS,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_EOS,
- g_param_spec_boolean ("eos", "EOS",
- "Check if the sink is EOS or not started", DEFAULT_PROP_EOS,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_EMIT_SIGNALS,
- g_param_spec_boolean ("emit-signals", "Emit signals",
- "Emit new-preroll and new-buffer signals", DEFAULT_PROP_EMIT_SIGNALS,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_MAX_BUFFERS,
- g_param_spec_uint ("max-buffers", "Max Buffers",
- "The maximum number of buffers to queue internally (0 = unlimited)",
- 0, G_MAXUINT, DEFAULT_PROP_MAX_BUFFERS,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_DROP,
- g_param_spec_boolean ("drop", "Drop",
- "Drop old buffers when the buffer queue is filled", DEFAULT_PROP_DROP,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstAppSink::eos:
- * @appsink: the appsink element that emited the signal
- *
- * Signal that the end-of-stream has been reached. This signal is emited from
- * the steaming thread.
- */
- gst_app_sink_signals[SIGNAL_EOS] =
- g_signal_new ("eos", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstAppSinkClass, eos),
- NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
- /**
- * GstAppSink::new-preroll:
- * @appsink: the appsink element that emited the signal
- *
- * Signal that a new preroll buffer is available.
- *
- * This signal is emited from the steaming thread and only when the
- * "emit-signals" property is %TRUE.
- *
- * The new preroll buffer can be retrieved with the "pull-preroll" action
- * signal or gst_app_sink_pull_preroll() either from this signal callback
- * or from any other thread.
- *
- * Note that this signal is only emited when the "emit-signals" property is
- * set to %TRUE, which it is not by default for performance reasons.
- */
- gst_app_sink_signals[SIGNAL_NEW_PREROLL] =
- g_signal_new ("new-preroll", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstAppSinkClass, new_preroll),
- NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
- /**
- * GstAppSink::new-buffer:
- * @appsink: the appsink element that emited the signal
- *
- * Signal that a new buffer is available.
- *
- * This signal is emited from the steaming thread and only when the
- * "emit-signals" property is %TRUE.
- *
- * The new buffer can be retrieved with the "pull-buffer" action
- * signal or gst_app_sink_pull_buffer() either from this signal callback
- * or from any other thread.
- *
- * Note that this signal is only emited when the "emit-signals" property is
- * set to %TRUE, which it is not by default for performance reasons.
- */
- gst_app_sink_signals[SIGNAL_NEW_BUFFER] =
- g_signal_new ("new-buffer", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstAppSinkClass, new_buffer),
- NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
- /**
- * GstAppSink::new-buffer-list:
- * @appsink: the appsink element that emited the signal
- *
- * Signal that a new bufferlist is available.
- *
- * This signal is emited from the steaming thread and only when the
- * "emit-signals" property is %TRUE.
- *
- * The new buffer can be retrieved with the "pull-buffer-list" action
- * signal or gst_app_sink_pull_buffe_listr() either from this signal callback
- * or from any other thread.
- *
- * Note that this signal is only emited when the "emit-signals" property is
- * set to %TRUE, which it is not by default for performance reasons.
- */
- gst_app_sink_signals[SIGNAL_NEW_BUFFER_LIST] =
- g_signal_new ("new-buffer-list", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstAppSinkClass, new_buffer_list),
- NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
-
- /**
- * GstAppSink::pull-preroll:
- * @appsink: the appsink element to emit this signal on
- *
- * Get the last preroll buffer in @appsink. This was the buffer that caused the
- * appsink to preroll in the PAUSED state. This buffer can be pulled many times
- * and remains available to the application even after EOS.
- *
- * This function is typically used when dealing with a pipeline in the PAUSED
- * state. Calling this function after doing a seek will give the buffer right
- * after the seek position.
- *
- * Note that the preroll buffer will also be returned as the first buffer
- * when calling gst_app_sink_pull_buffer() or the "pull-buffer" action signal.
- *
- * If an EOS event was received before any buffers, this function returns
- * %NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
- *
- * This function blocks until a preroll buffer or EOS is received or the appsink
- * element is set to the READY/NULL state.
- *
- * Returns: a #GstBuffer or NULL when the appsink is stopped or EOS.
- */
- gst_app_sink_signals[SIGNAL_PULL_PREROLL] =
- g_signal_new ("pull-preroll", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstAppSinkClass,
- pull_preroll), NULL, NULL, gst_app_marshal_BUFFER__VOID,
- GST_TYPE_BUFFER, 0, G_TYPE_NONE);
- /**
- * GstAppSink::pull-buffer:
- * @appsink: the appsink element to emit this signal on
- *
- * This function blocks until a buffer or EOS becomes available or the appsink
- * element is set to the READY/NULL state.
- *
- * This function will only return buffers when the appsink is in the PLAYING
- * state. All rendered buffers will be put in a queue so that the application
- * can pull buffers at its own rate.
- *
- * Note that when the application does not pull buffers fast enough, the
- * queued buffers could consume a lot of memory, especially when dealing with
- * raw video frames. It's possible to control the behaviour of the queue with
- * the "drop" and "max-buffers" properties.
- *
- * If an EOS event was received before any buffers, this function returns
- * %NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
- *
- * Returns: a #GstBuffer or NULL when the appsink is stopped or EOS.
- */
- gst_app_sink_signals[SIGNAL_PULL_BUFFER] =
- g_signal_new ("pull-buffer", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstAppSinkClass,
- pull_buffer), NULL, NULL, gst_app_marshal_BUFFER__VOID,
- GST_TYPE_BUFFER, 0, G_TYPE_NONE);
- /**
- * GstAppSink::pull-buffer-list:
- * @appsink: the appsink element to emit this signal on
- *
- * This function blocks until a buffer list or EOS becomes available or the appsink
- * element is set to the READY/NULL state.
- *
- * This function will only return bufferlists when the appsink is in the PLAYING
- * state. All rendered bufferlists will be put in a queue so that the application
- * can pull bufferlists at its own rate.
- *
- * Note that when the application does not pull bufferlists fast enough, the
- * queued bufferlists could consume a lot of memory, especially when dealing with
- * raw video frames. It's possible to control the behaviour of the queue with
- * the "drop" and "max-buffers" properties.
- *
- * If an EOS event was received before any buffers, this function returns
- * %NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
- *
- * Returns: a #GstBufferList or NULL when the appsink is stopped or EOS.
- */
- gst_app_sink_signals[SIGNAL_PULL_BUFFER_LIST] =
- g_signal_new ("pull-buffer-list", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstAppSinkClass,
- pull_buffer_list), NULL, NULL, gst_app_marshal_BUFFER__VOID,
- GST_TYPE_BUFFER_LIST, 0, G_TYPE_NONE);
-
- basesink_class->unlock = gst_app_sink_unlock_start;
- basesink_class->unlock_stop = gst_app_sink_unlock_stop;
- basesink_class->start = gst_app_sink_start;
- basesink_class->stop = gst_app_sink_stop;
- basesink_class->event = gst_app_sink_event;
- basesink_class->preroll = gst_app_sink_preroll;
- basesink_class->render = gst_app_sink_render;
- basesink_class->render_list = gst_app_sink_render_list;
- basesink_class->get_caps = gst_app_sink_getcaps;
-
- klass->pull_preroll = gst_app_sink_pull_preroll;
- klass->pull_buffer = gst_app_sink_pull_buffer;
- klass->pull_buffer_list = gst_app_sink_pull_buffer_list;
-
- g_type_class_add_private (klass, sizeof (GstAppSinkPrivate));
-}
-
-static void
-gst_app_sink_init (GstAppSink * appsink, GstAppSinkClass * klass)
-{
- GstAppSinkPrivate *priv;
-
- priv = appsink->priv =
- G_TYPE_INSTANCE_GET_PRIVATE (appsink, GST_TYPE_APP_SINK,
- GstAppSinkPrivate);
-
- priv->mutex = g_mutex_new ();
- priv->cond = g_cond_new ();
- priv->queue = g_queue_new ();
-
- priv->emit_signals = DEFAULT_PROP_EMIT_SIGNALS;
- priv->max_buffers = DEFAULT_PROP_MAX_BUFFERS;
- priv->drop = DEFAULT_PROP_DROP;
-}
-
-static void
-gst_app_sink_dispose (GObject * obj)
-{
- GstAppSink *appsink = GST_APP_SINK_CAST (obj);
- GstAppSinkPrivate *priv = appsink->priv;
- GstMiniObject *queue_obj;
-
- GST_OBJECT_LOCK (appsink);
- if (priv->caps) {
- gst_caps_unref (priv->caps);
- priv->caps = NULL;
- }
- if (priv->notify) {
- priv->notify (priv->user_data);
- }
- priv->user_data = NULL;
- priv->notify = NULL;
-
- GST_OBJECT_UNLOCK (appsink);
-
- g_mutex_lock (priv->mutex);
- if (priv->preroll) {
- gst_buffer_unref (priv->preroll);
- priv->preroll = NULL;
- }
- while ((queue_obj = g_queue_pop_head (priv->queue)))
- gst_mini_object_unref (queue_obj);
- g_mutex_unlock (priv->mutex);
-
- G_OBJECT_CLASS (parent_class)->dispose (obj);
-}
-
-static void
-gst_app_sink_finalize (GObject * obj)
-{
- GstAppSink *appsink = GST_APP_SINK_CAST (obj);
- GstAppSinkPrivate *priv = appsink->priv;
-
- g_mutex_free (priv->mutex);
- g_cond_free (priv->cond);
- g_queue_free (priv->queue);
-
- G_OBJECT_CLASS (parent_class)->finalize (obj);
-}
-
-static void
-gst_app_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstAppSink *appsink = GST_APP_SINK_CAST (object);
-
- switch (prop_id) {
- case PROP_CAPS:
- gst_app_sink_set_caps (appsink, gst_value_get_caps (value));
- break;
- case PROP_EMIT_SIGNALS:
- gst_app_sink_set_emit_signals (appsink, g_value_get_boolean (value));
- break;
- case PROP_MAX_BUFFERS:
- gst_app_sink_set_max_buffers (appsink, g_value_get_uint (value));
- break;
- case PROP_DROP:
- gst_app_sink_set_drop (appsink, g_value_get_boolean (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_app_sink_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstAppSink *appsink = GST_APP_SINK_CAST (object);
-
- switch (prop_id) {
- case PROP_CAPS:
- {
- GstCaps *caps;
-
- caps = gst_app_sink_get_caps (appsink);
- gst_value_set_caps (value, caps);
- if (caps)
- gst_caps_unref (caps);
- break;
- }
- case PROP_EOS:
- g_value_set_boolean (value, gst_app_sink_is_eos (appsink));
- break;
- case PROP_EMIT_SIGNALS:
- g_value_set_boolean (value, gst_app_sink_get_emit_signals (appsink));
- break;
- case PROP_MAX_BUFFERS:
- g_value_set_uint (value, gst_app_sink_get_max_buffers (appsink));
- break;
- case PROP_DROP:
- g_value_set_boolean (value, gst_app_sink_get_drop (appsink));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-gst_app_sink_unlock_start (GstBaseSink * bsink)
-{
- GstAppSink *appsink = GST_APP_SINK_CAST (bsink);
- GstAppSinkPrivate *priv = appsink->priv;
-
- g_mutex_lock (priv->mutex);
- GST_DEBUG_OBJECT (appsink, "unlock start");
- priv->unlock = TRUE;
- g_cond_signal (priv->cond);
- g_mutex_unlock (priv->mutex);
-
- return TRUE;
-}
-
-static gboolean
-gst_app_sink_unlock_stop (GstBaseSink * bsink)
-{
- GstAppSink *appsink = GST_APP_SINK_CAST (bsink);
- GstAppSinkPrivate *priv = appsink->priv;
-
- g_mutex_lock (priv->mutex);
- GST_DEBUG_OBJECT (appsink, "unlock stop");
- priv->unlock = FALSE;
- g_cond_signal (priv->cond);
- g_mutex_unlock (priv->mutex);
-
- return TRUE;
-}
-
-static void
-gst_app_sink_flush_unlocked (GstAppSink * appsink)
-{
- GstMiniObject *obj;
- GstAppSinkPrivate *priv = appsink->priv;
-
- GST_DEBUG_OBJECT (appsink, "flush stop appsink");
- priv->is_eos = FALSE;
- gst_buffer_replace (&priv->preroll, NULL);
- while ((obj = g_queue_pop_head (priv->queue)))
- gst_mini_object_unref (obj);
- g_cond_signal (priv->cond);
-}
-
-static gboolean
-gst_app_sink_start (GstBaseSink * psink)
-{
- GstAppSink *appsink = GST_APP_SINK_CAST (psink);
- GstAppSinkPrivate *priv = appsink->priv;
-
- g_mutex_lock (priv->mutex);
- GST_DEBUG_OBJECT (appsink, "starting");
- priv->started = TRUE;
- g_mutex_unlock (priv->mutex);
-
- return TRUE;
-}
-
-static gboolean
-gst_app_sink_stop (GstBaseSink * psink)
-{
- GstAppSink *appsink = GST_APP_SINK_CAST (psink);
- GstAppSinkPrivate *priv = appsink->priv;
-
- g_mutex_lock (priv->mutex);
- GST_DEBUG_OBJECT (appsink, "stopping");
- priv->flushing = TRUE;
- priv->started = FALSE;
- gst_app_sink_flush_unlocked (appsink);
- g_mutex_unlock (priv->mutex);
-
- return TRUE;
-}
-
-static gboolean
-gst_app_sink_event (GstBaseSink * sink, GstEvent * event)
-{
- GstAppSink *appsink = GST_APP_SINK_CAST (sink);
- GstAppSinkPrivate *priv = appsink->priv;
-
- switch (event->type) {
- case GST_EVENT_EOS:
-
- g_mutex_lock (priv->mutex);
- GST_DEBUG_OBJECT (appsink, "receiving EOS");
- priv->is_eos = TRUE;
- g_cond_signal (priv->cond);
- g_mutex_unlock (priv->mutex);
-
- /* emit EOS now */
- if (priv->callbacks.eos)
- priv->callbacks.eos (appsink, priv->user_data);
- else
- g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_EOS], 0);
-
- break;
- case GST_EVENT_FLUSH_START:
- /* we don't have to do anything here, the base class will call unlock
- * which will make sure we exit the _render method */
- GST_DEBUG_OBJECT (appsink, "received FLUSH_START");
- break;
- case GST_EVENT_FLUSH_STOP:
- g_mutex_lock (priv->mutex);
- GST_DEBUG_OBJECT (appsink, "received FLUSH_STOP");
- gst_app_sink_flush_unlocked (appsink);
- g_mutex_unlock (priv->mutex);
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-static GstFlowReturn
-gst_app_sink_preroll (GstBaseSink * psink, GstBuffer * buffer)
-{
- GstFlowReturn res = GST_FLOW_OK;
- GstAppSink *appsink = GST_APP_SINK_CAST (psink);
- GstAppSinkPrivate *priv = appsink->priv;
- gboolean emit;
-
- g_mutex_lock (priv->mutex);
- if (priv->flushing)
- goto flushing;
-
- GST_DEBUG_OBJECT (appsink, "setting preroll buffer %p", buffer);
- gst_buffer_replace (&priv->preroll, buffer);
-
- g_cond_signal (priv->cond);
- emit = priv->emit_signals;
- g_mutex_unlock (priv->mutex);
-
- if (priv->callbacks.new_preroll)
- res = priv->callbacks.new_preroll (appsink, priv->user_data);
- else if (emit)
- g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_NEW_PREROLL], 0);
-
- return res;
-
-flushing:
- {
- GST_DEBUG_OBJECT (appsink, "we are flushing");
- g_mutex_unlock (priv->mutex);
- return GST_FLOW_WRONG_STATE;
- }
-}
-
-static GstFlowReturn
-gst_app_sink_render_common (GstBaseSink * psink, GstMiniObject * data,
- gboolean is_list)
-{
- GstFlowReturn ret;
- GstAppSink *appsink = GST_APP_SINK_CAST (psink);
- GstAppSinkPrivate *priv = appsink->priv;
- gboolean emit;
-
-restart:
- g_mutex_lock (priv->mutex);
- if (priv->flushing)
- goto flushing;
-
- GST_DEBUG_OBJECT (appsink, "pushing render buffer%s %p on queue (%d)",
- is_list ? " list" : "", data, priv->queue->length);
-
- while (priv->max_buffers > 0 && priv->queue->length >= priv->max_buffers) {
- if (priv->drop) {
- GstMiniObject *obj;
-
- /* we need to drop the oldest buffer/list and try again */
- obj = g_queue_pop_head (priv->queue);
- GST_DEBUG_OBJECT (appsink, "dropping old buffer/list %p", obj);
- gst_mini_object_unref (obj);
- } else {
- GST_DEBUG_OBJECT (appsink, "waiting for free space, length %d >= %d",
- priv->queue->length, priv->max_buffers);
-
- if (priv->unlock) {
- /* we are asked to unlock, call the wait_preroll method */
- g_mutex_unlock (priv->mutex);
- if ((ret = gst_base_sink_wait_preroll (psink)) != GST_FLOW_OK)
- goto stopping;
-
- /* we are allowed to continue now */
- goto restart;
- }
-
- /* wait for a buffer to be removed or flush */
- g_cond_wait (priv->cond, priv->mutex);
- if (priv->flushing)
- goto flushing;
- }
- }
- /* we need to ref the buffer when pushing it in the queue */
- g_queue_push_tail (priv->queue, gst_mini_object_ref (data));
- g_cond_signal (priv->cond);
- emit = priv->emit_signals;
- g_mutex_unlock (priv->mutex);
-
- if (is_list) {
- if (priv->callbacks.new_buffer_list)
- priv->callbacks.new_buffer_list (appsink, priv->user_data);
- } else {
- if (priv->callbacks.new_buffer)
- priv->callbacks.new_buffer (appsink, priv->user_data);
- else if (emit)
- g_signal_emit (appsink, gst_app_sink_signals[SIGNAL_NEW_BUFFER], 0);
- }
- return GST_FLOW_OK;
-
-flushing:
- {
- GST_DEBUG_OBJECT (appsink, "we are flushing");
- g_mutex_unlock (priv->mutex);
- return GST_FLOW_WRONG_STATE;
- }
-stopping:
- {
- GST_DEBUG_OBJECT (appsink, "we are stopping");
- return ret;
- }
-}
-
-static GstFlowReturn
-gst_app_sink_render (GstBaseSink * psink, GstBuffer * buffer)
-{
- return gst_app_sink_render_common (psink, GST_MINI_OBJECT_CAST (buffer),
- FALSE);
-}
-
-static GstFlowReturn
-gst_app_sink_render_list (GstBaseSink * psink, GstBufferList * list)
-{
- return gst_app_sink_render_common (psink, GST_MINI_OBJECT_CAST (list), TRUE);
-}
-
-static GstCaps *
-gst_app_sink_getcaps (GstBaseSink * psink)
-{
- GstCaps *caps;
- GstAppSink *appsink = GST_APP_SINK_CAST (psink);
- GstAppSinkPrivate *priv = appsink->priv;
-
- GST_OBJECT_LOCK (appsink);
- if ((caps = priv->caps))
- gst_caps_ref (caps);
- GST_DEBUG_OBJECT (appsink, "got caps %" GST_PTR_FORMAT, caps);
- GST_OBJECT_UNLOCK (appsink);
-
- return caps;
-}
-
-static GstMiniObject *
-gst_app_sink_pull_object (GstAppSink * appsink)
-{
- GstMiniObject *obj = NULL;
- GstAppSinkPrivate *priv;
-
- g_return_val_if_fail (GST_IS_APP_SINK (appsink), NULL);
-
- priv = appsink->priv;
-
- g_mutex_lock (priv->mutex);
-
- while (TRUE) {
- GST_DEBUG_OBJECT (appsink, "trying to grab a buffer/list");
- if (!priv->started)
- goto not_started;
-
- if (!g_queue_is_empty (priv->queue))
- break;
-
- if (priv->is_eos)
- goto eos;
-
- /* nothing to return, wait */
- GST_DEBUG_OBJECT (appsink, "waiting for a buffer/list");
- g_cond_wait (priv->cond, priv->mutex);
- }
- obj = g_queue_pop_head (priv->queue);
- GST_DEBUG_OBJECT (appsink, "we have a buffer/list %p", obj);
- g_cond_signal (priv->cond);
- g_mutex_unlock (priv->mutex);
-
- return obj;
-
- /* special conditions */
-eos:
- {
- GST_DEBUG_OBJECT (appsink, "we are EOS, return NULL");
- g_mutex_unlock (priv->mutex);
- return NULL;
- }
-not_started:
- {
- GST_DEBUG_OBJECT (appsink, "we are stopped, return NULL");
- g_mutex_unlock (priv->mutex);
- return NULL;
- }
-}
-
-/* external API */
-
-/**
- * gst_app_sink_set_caps:
- * @appsink: a #GstAppSink
- * @caps: caps to set
- *
- * Set the capabilities on the appsink element. This function takes
- * a copy of the caps structure. After calling this method, the sink will only
- * accept caps that match @caps. If @caps is non-fixed, you must check the caps
- * on the buffers to get the actual used caps.
- *
- * Since: 0.10.22
- */
-void
-gst_app_sink_set_caps (GstAppSink * appsink, const GstCaps * caps)
-{
- GstCaps *old;
- GstAppSinkPrivate *priv;
-
- g_return_if_fail (GST_IS_APP_SINK (appsink));
-
- priv = appsink->priv;
-
- GST_OBJECT_LOCK (appsink);
- GST_DEBUG_OBJECT (appsink, "setting caps to %" GST_PTR_FORMAT, caps);
- if ((old = priv->caps) != caps) {
- if (caps)
- priv->caps = gst_caps_copy (caps);
- else
- priv->caps = NULL;
- if (old)
- gst_caps_unref (old);
- }
- GST_OBJECT_UNLOCK (appsink);
-}
-
-/**
- * gst_app_sink_get_caps:
- * @appsink: a #GstAppSink
- *
- * Get the configured caps on @appsink.
- *
- * Returns: the #GstCaps accepted by the sink. gst_caps_unref() after usage.
- *
- * Since: 0.10.22
- */
-GstCaps *
-gst_app_sink_get_caps (GstAppSink * appsink)
-{
- GstCaps *caps;
- GstAppSinkPrivate *priv;
-
- g_return_val_if_fail (GST_IS_APP_SINK (appsink), NULL);
-
- priv = appsink->priv;
-
- GST_OBJECT_LOCK (appsink);
- if ((caps = priv->caps))
- gst_caps_ref (caps);
- GST_DEBUG_OBJECT (appsink, "getting caps of %" GST_PTR_FORMAT, caps);
- GST_OBJECT_UNLOCK (appsink);
-
- return caps;
-}
-
-/**
- * gst_app_sink_is_eos:
- * @appsink: a #GstAppSink
- *
- * Check if @appsink is EOS, which is when no more buffers can be pulled because
- * an EOS event was received.
- *
- * This function also returns %TRUE when the appsink is not in the PAUSED or
- * PLAYING state.
- *
- * Returns: %TRUE if no more buffers can be pulled and the appsink is EOS.
- *
- * Since: 0.10.22
- */
-gboolean
-gst_app_sink_is_eos (GstAppSink * appsink)
-{
- gboolean ret;
- GstAppSinkPrivate *priv;
-
- g_return_val_if_fail (GST_IS_APP_SINK (appsink), FALSE);
-
- priv = appsink->priv;
-
- g_mutex_lock (priv->mutex);
- if (!priv->started)
- goto not_started;
-
- if (priv->is_eos && g_queue_is_empty (priv->queue)) {
- GST_DEBUG_OBJECT (appsink, "we are EOS and the queue is empty");
- ret = TRUE;
- } else {
- GST_DEBUG_OBJECT (appsink, "we are not yet EOS");
- ret = FALSE;
- }
- g_mutex_unlock (priv->mutex);
-
- return ret;
-
-not_started:
- {
- GST_DEBUG_OBJECT (appsink, "we are stopped, return TRUE");
- g_mutex_unlock (priv->mutex);
- return TRUE;
- }
-}
-
-/**
- * gst_app_sink_set_emit_signals:
- * @appsink: a #GstAppSink
- * @emit: the new state
- *
- * Make appsink emit the "new-preroll" and "new-buffer" signals. This option is
- * by default disabled because signal emission is expensive and unneeded when
- * the application prefers to operate in pull mode.
- *
- * Since: 0.10.22
- */
-void
-gst_app_sink_set_emit_signals (GstAppSink * appsink, gboolean emit)
-{
- GstAppSinkPrivate *priv;
-
- g_return_if_fail (GST_IS_APP_SINK (appsink));
-
- priv = appsink->priv;
-
- g_mutex_lock (priv->mutex);
- priv->emit_signals = emit;
- g_mutex_unlock (priv->mutex);
-}
-
-/**
- * gst_app_sink_get_emit_signals:
- * @appsink: a #GstAppSink
- *
- * Check if appsink will emit the "new-preroll" and "new-buffer" signals.
- *
- * Returns: %TRUE if @appsink is emiting the "new-preroll" and "new-buffer"
- * signals.
- *
- * Since: 0.10.22
- */
-gboolean
-gst_app_sink_get_emit_signals (GstAppSink * appsink)
-{
- gboolean result;
- GstAppSinkPrivate *priv;
-
- g_return_val_if_fail (GST_IS_APP_SINK (appsink), FALSE);
-
- priv = appsink->priv;
-
- g_mutex_lock (priv->mutex);
- result = priv->emit_signals;
- g_mutex_unlock (priv->mutex);
-
- return result;
-}
-
-/**
- * gst_app_sink_set_max_buffers:
- * @appsink: a #GstAppSink
- * @max: the maximum number of buffers to queue
- *
- * Set the maximum amount of buffers that can be queued in @appsink. After this
- * amount of buffers are queued in appsink, any more buffers will block upstream
- * elements until a buffer is pulled from @appsink.
- *
- * Since: 0.10.22
- */
-void
-gst_app_sink_set_max_buffers (GstAppSink * appsink, guint max)
-{
- GstAppSinkPrivate *priv;
-
- g_return_if_fail (GST_IS_APP_SINK (appsink));
-
- priv = appsink->priv;
-
- g_mutex_lock (priv->mutex);
- if (max != priv->max_buffers) {
- priv->max_buffers = max;
- /* signal the change */
- g_cond_signal (priv->cond);
- }
- g_mutex_unlock (priv->mutex);
-}
-
-/**
- * gst_app_sink_get_max_buffers:
- * @appsink: a #GstAppSink
- *
- * Get the maximum amount of buffers that can be queued in @appsink.
- *
- * Returns: The maximum amount of buffers that can be queued.
- *
- * Since: 0.10.22
- */
-guint
-gst_app_sink_get_max_buffers (GstAppSink * appsink)
-{
- guint result;
- GstAppSinkPrivate *priv;
-
- g_return_val_if_fail (GST_IS_APP_SINK (appsink), 0);
-
- priv = appsink->priv;
-
- g_mutex_lock (priv->mutex);
- result = priv->max_buffers;
- g_mutex_unlock (priv->mutex);
-
- return result;
-}
-
-/**
- * gst_app_sink_set_drop:
- * @appsink: a #GstAppSink
- * @drop: the new state
- *
- * Instruct @appsink to drop old buffers when the maximum amount of queued
- * buffers is reached.
- *
- * Since: 0.10.22
- */
-void
-gst_app_sink_set_drop (GstAppSink * appsink, gboolean drop)
-{
- GstAppSinkPrivate *priv;
-
- g_return_if_fail (GST_IS_APP_SINK (appsink));
-
- priv = appsink->priv;
-
- g_mutex_lock (priv->mutex);
- if (priv->drop != drop) {
- priv->drop = drop;
- /* signal the change */
- g_cond_signal (priv->cond);
- }
- g_mutex_unlock (priv->mutex);
-}
-
-/**
- * gst_app_sink_get_drop:
- * @appsink: a #GstAppSink
- *
- * Check if @appsink will drop old buffers when the maximum amount of queued
- * buffers is reached.
- *
- * Returns: %TRUE if @appsink is dropping old buffers when the queue is
- * filled.
- *
- * Since: 0.10.22
- */
-gboolean
-gst_app_sink_get_drop (GstAppSink * appsink)
-{
- gboolean result;
- GstAppSinkPrivate *priv;
-
- g_return_val_if_fail (GST_IS_APP_SINK (appsink), FALSE);
-
- priv = appsink->priv;
-
- g_mutex_lock (priv->mutex);
- result = priv->drop;
- g_mutex_unlock (priv->mutex);
-
- return result;
-}
-
-/**
- * gst_app_sink_pull_preroll:
- * @appsink: a #GstAppSink
- *
- * Get the last preroll buffer in @appsink. This was the buffer that caused the
- * appsink to preroll in the PAUSED state. This buffer can be pulled many times
- * and remains available to the application even after EOS.
- *
- * This function is typically used when dealing with a pipeline in the PAUSED
- * state. Calling this function after doing a seek will give the buffer right
- * after the seek position.
- *
- * Note that the preroll buffer will also be returned as the first buffer
- * when calling gst_app_sink_pull_buffer().
- *
- * If an EOS event was received before any buffers, this function returns
- * %NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
- *
- * This function blocks until a preroll buffer or EOS is received or the appsink
- * element is set to the READY/NULL state.
- *
- * Returns: a #GstBuffer or NULL when the appsink is stopped or EOS.
- *
- * Since: 0.10.22
- */
-GstBuffer *
-gst_app_sink_pull_preroll (GstAppSink * appsink)
-{
- GstBuffer *buf = NULL;
- GstAppSinkPrivate *priv;
-
- g_return_val_if_fail (GST_IS_APP_SINK (appsink), NULL);
-
- priv = appsink->priv;
-
- g_mutex_lock (priv->mutex);
-
- while (TRUE) {
- GST_DEBUG_OBJECT (appsink, "trying to grab a buffer");
- if (!priv->started)
- goto not_started;
-
- if (priv->preroll != NULL)
- break;
-
- if (priv->is_eos)
- goto eos;
-
- /* nothing to return, wait */
- GST_DEBUG_OBJECT (appsink, "waiting for the preroll buffer");
- g_cond_wait (priv->cond, priv->mutex);
- }
- buf = gst_buffer_ref (priv->preroll);
- GST_DEBUG_OBJECT (appsink, "we have the preroll buffer %p", buf);
- g_mutex_unlock (priv->mutex);
-
- return buf;
-
- /* special conditions */
-eos:
- {
- GST_DEBUG_OBJECT (appsink, "we are EOS, return NULL");
- g_mutex_unlock (priv->mutex);
- return NULL;
- }
-not_started:
- {
- GST_DEBUG_OBJECT (appsink, "we are stopped, return NULL");
- g_mutex_unlock (priv->mutex);
- return NULL;
- }
-}
-
-/**
- * gst_app_sink_pull_buffer:
- * @appsink: a #GstAppSink
- *
- * This function blocks until a buffer or EOS becomes available or the appsink
- * element is set to the READY/NULL state.
- *
- * This function will only return buffers when the appsink is in the PLAYING
- * state. All rendered buffers will be put in a queue so that the application
- * can pull buffers at its own rate. Note that when the application does not
- * pull buffers fast enough, the queued buffers could consume a lot of memory,
- * especially when dealing with raw video frames.
- *
- * If an EOS event was received before any buffers, this function returns
- * %NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
- *
- * Returns: a #GstBuffer or NULL when the appsink is stopped or EOS.
- *
- * Since: 0.10.22
- */
-
-GstBuffer *
-gst_app_sink_pull_buffer (GstAppSink * appsink)
-{
- GST_DEBUG_OBJECT (appsink, "pull a buffer");
- return GST_BUFFER_CAST (gst_app_sink_pull_object (appsink));
-}
-
-/**
- * gst_app_sink_pull_buffer_list:
- * @appsink: a #GstAppSink
- *
- * This function blocks until a buffer list or EOS becomes available or the
- * appsink element is set to the READY/NULL state.
- *
- * This function will only return buffer lists when the appsink is in the
- * PLAYING state. All rendered buffer lists will be put in a queue so that
- * the application can pull buffer lists at its own rate. Note that when
- * the application does not pull buffer lists fast enough, the queued buffer
- * lists could consume a lot of memory, especially when dealing with raw
- * video frames.
- *
- * If an EOS event was received before any buffer lists, this function returns
- * %NULL. Use gst_app_sink_is_eos () to check for the EOS condition.
- *
- * Returns: a #GstBufferList or NULL when the appsink is stopped or EOS.
- */
-GstBufferList *
-gst_app_sink_pull_buffer_list (GstAppSink * appsink)
-{
- GST_DEBUG_OBJECT (appsink, "pull a buffer list");
- return GST_BUFFER_LIST_CAST (gst_app_sink_pull_object (appsink));
-}
-
-/**
- * gst_app_sink_set_callbacks:
- * @appsink: a #GstAppSink
- * @callbacks: the callbacks
- * @user_data: a user_data argument for the callbacks
- * @notify: a destroy notify function
- *
- * Set callbacks which will be executed for each new preroll, new buffer and eos.
- * This is an alternative to using the signals, it has lower overhead and is thus
- * less expensive, but also less flexible.
- *
- * If callbacks are installed, no signals will be emited for performance
- * reasons.
- *
- * Since: 0.10.23
- */
-void
-gst_app_sink_set_callbacks (GstAppSink * appsink,
- GstAppSinkCallbacks * callbacks, gpointer user_data, GDestroyNotify notify)
-{
- GDestroyNotify old_notify;
- GstAppSinkPrivate *priv;
-
- g_return_if_fail (GST_IS_APP_SINK (appsink));
- g_return_if_fail (callbacks != NULL);
-
- priv = appsink->priv;
-
- GST_OBJECT_LOCK (appsink);
- old_notify = priv->notify;
-
- if (old_notify) {
- gpointer old_data;
-
- old_data = priv->user_data;
-
- priv->user_data = NULL;
- priv->notify = NULL;
- GST_OBJECT_UNLOCK (appsink);
-
- old_notify (old_data);
-
- GST_OBJECT_LOCK (appsink);
- }
- priv->callbacks = *callbacks;
- priv->user_data = user_data;
- priv->notify = notify;
- GST_OBJECT_UNLOCK (appsink);
-}
-
-/*** GSTURIHANDLER INTERFACE *************************************************/
-
-static GstURIType
-gst_app_sink_uri_get_type (void)
-{
- return GST_URI_SINK;
-}
-
-static gchar **
-gst_app_sink_uri_get_protocols (void)
-{
- static gchar *protocols[] = { "appsink", NULL };
-
- return protocols;
-}
-
-static const gchar *
-gst_app_sink_uri_get_uri (GstURIHandler * handler)
-{
- return "appsink";
-}
-
-static gboolean
-gst_app_sink_uri_set_uri (GstURIHandler * handler, const gchar * uri)
-{
- gchar *protocol;
- gboolean ret;
-
- protocol = gst_uri_get_protocol (uri);
- ret = !strcmp (protocol, "appsink");
- g_free (protocol);
-
- return ret;
-}
-
-static void
-gst_app_sink_uri_handler_init (gpointer g_iface, gpointer iface_data)
-{
- GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
-
- iface->get_type = gst_app_sink_uri_get_type;
- iface->get_protocols = gst_app_sink_uri_get_protocols;
- iface->get_uri = gst_app_sink_uri_get_uri;
- iface->set_uri = gst_app_sink_uri_set_uri;
-}
diff --git a/gst-libs/gst/app/gstappsink.h b/gst-libs/gst/app/gstappsink.h
deleted file mode 100644
index 3e0bc415..00000000
--- a/gst-libs/gst/app/gstappsink.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _GST_APP_SINK_H_
-#define _GST_APP_SINK_H_
-
-#include <gst/gst.h>
-#include <gst/base/gstbasesink.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))
-/* Since 0.10.23 */
-#define GST_APP_SINK_CAST(obj) \
- ((GstAppSink*)(obj))
-
-typedef struct _GstAppSink GstAppSink;
-typedef struct _GstAppSinkClass GstAppSinkClass;
-typedef struct _GstAppSinkPrivate GstAppSinkPrivate;
-
-/**
- * GstAppSinkCallbacks:
- * @eos: Called when the end-of-stream has been reached. This callback
- * is called from the steaming thread.
- * @new_preroll: Called when a new preroll buffer is available.
- * This callback is called from the steaming thread.
- * The new preroll buffer can be retrieved with
- * gst_app_sink_pull_preroll() either from this callback
- * or from any other thread.
- * @new_buffer: Called when a new buffer is available.
- * This callback is called from the steaming thread.
- * The new buffer can be retrieved with
- * gst_app_sink_pull_buffer() either from this callback
- * or from any other thread.
- * @new_buffer_list: Called when a new bufferlist is available.
- * This callback is called from the steaming thread.
- * The new bufferlist can be retrieved with
- * gst_app_sink_pull_buffer_list() either from this callback
- * or from any other thread.
- *
- * A set of callbacks that can be installed on the appsink with
- * gst_app_sink_set_callbacks().
- *
- * Since: 0.10.23
- */
-typedef struct {
- void (*eos) (GstAppSink *sink, gpointer user_data);
- GstFlowReturn (*new_preroll) (GstAppSink *sink, gpointer user_data);
- GstFlowReturn (*new_buffer) (GstAppSink *sink, gpointer user_data);
- GstFlowReturn (*new_buffer_list) (GstAppSink *sink, 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 *sink);
- void (*new_preroll) (GstAppSink *sink);
- void (*new_buffer) (GstAppSink *sink);
-
- /* actions */
- GstBuffer * (*pull_preroll) (GstAppSink *sink);
- GstBuffer * (*pull_buffer) (GstAppSink *sink);
-
- /* ABI added */
- GstBufferList * (*new_buffer_list) (GstAppSink *sink);
- GstBufferList * (*pull_buffer_list) (GstAppSink *sink);
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING - 2];
-};
-
-GType gst_app_sink_get_type(void);
-
-void gst_app_sink_set_caps (GstAppSink *appsink, const GstCaps *caps);
-GstCaps * gst_app_sink_get_caps (GstAppSink *appsink);
-
-gboolean gst_app_sink_is_eos (GstAppSink *appsink);
-
-void gst_app_sink_set_emit_signals (GstAppSink *appsink, gboolean emit);
-gboolean gst_app_sink_get_emit_signals (GstAppSink *appsink);
-
-void gst_app_sink_set_max_buffers (GstAppSink *appsink, guint max);
-guint gst_app_sink_get_max_buffers (GstAppSink *appsink);
-
-void gst_app_sink_set_drop (GstAppSink *appsink, gboolean drop);
-gboolean gst_app_sink_get_drop (GstAppSink *appsink);
-
-GstBuffer * gst_app_sink_pull_preroll (GstAppSink *appsink);
-GstBuffer * gst_app_sink_pull_buffer (GstAppSink *appsink);
-GstBufferList * gst_app_sink_pull_buffer_list (GstAppSink *appsink);
-
-void gst_app_sink_set_callbacks (GstAppSink * appsink,
- GstAppSinkCallbacks *callbacks,
- gpointer user_data,
- GDestroyNotify notify);
-
-G_END_DECLS
-
-#endif
-
diff --git a/gst-libs/gst/app/gstappsrc.c b/gst-libs/gst/app/gstappsrc.c
deleted file mode 100644
index 98f1ef26..00000000
--- a/gst-libs/gst/app/gstappsrc.c
+++ /dev/null
@@ -1,1675 +0,0 @@
-/* GStreamer
- * Copyright (C) 2007 David Schleef <ds@schleef.org>
- * (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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-appsrc
- *
- * The appsrc element can be used by applications to insert data into a
- * GStreamer pipeline. Unlike most GStreamer elements, Appsrc provides
- * external API functions.
- *
- * For the documentation of the API, please see the
- * <link linkend="gst-plugins-base-libs-appsrc">libgstapp</link> section in the
- * GStreamer Plugins Base Libraries documentation.
- *
- * Since: 0.10.22
- */
-
-/**
- * SECTION:gstappsrc
- * @short_description: Easy way for applications to inject buffers into a
- * pipeline
- * @see_also: #GstBaseSrc, appsink
- *
- * The appsrc element can be used by applications to insert data into a
- * GStreamer pipeline. Unlike most GStreamer elements, Appsrc provides
- * external API functions.
- *
- * appsrc can be used by linking with the libgstapp library to access the
- * methods directly or by using the appsrc action signals.
- *
- * Before operating appsrc, the caps property must be set to a fixed caps
- * describing the format of the data that will be pushed with appsrc. An
- * exception to this is when pushing buffers with unknown caps, in which case no
- * caps should be set. This is typically true of file-like sources that push raw
- * byte buffers.
- *
- * The main way of handing data to the appsrc element is by calling the
- * gst_app_src_push_buffer() method or by emiting the push-buffer action signal.
- * This will put the buffer onto a queue from which appsrc will read from in its
- * streaming thread. It is important to note that data transport will not happen
- * from the thread that performed the push-buffer call.
- *
- * The "max-bytes" property controls how much data can be queued in appsrc
- * before appsrc considers the queue full. A filled internal queue will always
- * signal the "enough-data" signal, which signals the application that it should
- * stop pushing data into appsrc. The "block" property will cause appsrc to
- * block the push-buffer method until free data becomes available again.
- *
- * When the internal queue is running out of data, the "need-data" signal is
- * emited, which signals the application that it should start pushing more data
- * into appsrc.
- *
- * In addition to the "need-data" and "enough-data" signals, appsrc can emit the
- * "seek-data" signal when the "stream-mode" property is set to "seekable" or
- * "random-access". The signal argument will contain the new desired position in
- * the stream expressed in the unit set with the "format" property. After
- * receiving the seek-data signal, the application should push-buffers from the
- * new position.
- *
- * These signals allow the application to operate the appsrc in two different
- * ways:
- *
- * The push model, in which the application repeadedly calls the push-buffer method
- * with a new buffer. Optionally, the queue size in the appsrc can be controlled
- * with the enough-data and need-data signals by respectively stopping/starting
- * the push-buffer calls. This is a typical mode of operation for the
- * stream-type "stream" and "seekable". Use this model when implementing various
- * network protocols or hardware devices.
- *
- * The pull model where the need-data signal triggers the next push-buffer call.
- * This mode is typically used in the "random-access" stream-type. Use this
- * model for file access or other randomly accessable sources. In this mode, a
- * buffer of exactly the amount of bytes given by the need-data signal should be
- * pushed into appsrc.
- *
- * In all modes, the size property on appsrc should contain the total stream
- * size in bytes. Setting this property is mandatory in the random-access mode.
- * For the stream and seekable modes, setting this property is optional but
- * recommended.
- *
- * When the application is finished pushing data into appsrc, it should call
- * gst_app_src_end_of_stream() or emit the end-of-stream action signal. After
- * this call, no more buffers can be pushed into appsrc until a flushing seek
- * happened or the state of the appsrc has gone through READY.
- *
- * Last reviewed on 2008-12-17 (0.10.10)
- *
- * Since: 0.10.22
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/base/gstbasesrc.h>
-
-#include <string.h>
-
-#include "gstapp-marshal.h"
-#include "gstappsrc.h"
-
-struct _GstAppSrcPrivate
-{
- GCond *cond;
- GMutex *mutex;
- GQueue *queue;
-
- GstCaps *caps;
- gint64 size;
- GstAppStreamType stream_type;
- guint64 max_bytes;
- GstFormat format;
- gboolean block;
-
- gboolean flushing;
- gboolean started;
- gboolean is_eos;
- guint64 queued_bytes;
- guint64 offset;
- GstAppStreamType current_type;
-
- guint64 min_latency;
- guint64 max_latency;
- gboolean emit_signals;
- guint min_percent;
-
- GstAppSrcCallbacks callbacks;
- gpointer user_data;
- GDestroyNotify notify;
-};
-
-GST_DEBUG_CATEGORY_STATIC (app_src_debug);
-#define GST_CAT_DEFAULT app_src_debug
-
-enum
-{
- /* signals */
- SIGNAL_NEED_DATA,
- SIGNAL_ENOUGH_DATA,
- SIGNAL_SEEK_DATA,
-
- /* actions */
- SIGNAL_PUSH_BUFFER,
- SIGNAL_END_OF_STREAM,
-
- LAST_SIGNAL
-};
-
-#define DEFAULT_PROP_SIZE -1
-#define DEFAULT_PROP_STREAM_TYPE GST_APP_STREAM_TYPE_STREAM
-#define DEFAULT_PROP_MAX_BYTES 200000
-#define DEFAULT_PROP_FORMAT GST_FORMAT_BYTES
-#define DEFAULT_PROP_BLOCK FALSE
-#define DEFAULT_PROP_IS_LIVE FALSE
-#define DEFAULT_PROP_MIN_LATENCY -1
-#define DEFAULT_PROP_MAX_LATENCY -1
-#define DEFAULT_PROP_EMIT_SIGNALS TRUE
-#define DEFAULT_PROP_MIN_PERCENT 0
-
-enum
-{
- PROP_0,
- PROP_CAPS,
- PROP_SIZE,
- PROP_STREAM_TYPE,
- PROP_MAX_BYTES,
- PROP_FORMAT,
- PROP_BLOCK,
- PROP_IS_LIVE,
- PROP_MIN_LATENCY,
- PROP_MAX_LATENCY,
- PROP_EMIT_SIGNALS,
- PROP_MIN_PERCENT,
- PROP_LAST
-};
-
-static GstStaticPadTemplate gst_app_src_template =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-
-#define GST_TYPE_APP_STREAM_TYPE (stream_type_get_type ())
-static GType
-stream_type_get_type (void)
-{
- static GType stream_type_type = 0;
- static const GEnumValue stream_type[] = {
- {GST_APP_STREAM_TYPE_STREAM, "Stream", "stream"},
- {GST_APP_STREAM_TYPE_SEEKABLE, "Seekable", "seekable"},
- {GST_APP_STREAM_TYPE_RANDOM_ACCESS, "Random Access", "random-access"},
- {0, NULL, NULL},
- };
-
- if (!stream_type_type) {
- stream_type_type = g_enum_register_static ("GstAppStreamType", stream_type);
- }
- return stream_type_type;
-}
-
-static void gst_app_src_uri_handler_init (gpointer g_iface,
- gpointer iface_data);
-
-static void gst_app_src_dispose (GObject * object);
-static void gst_app_src_finalize (GObject * object);
-
-static void gst_app_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_app_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static void gst_app_src_set_latencies (GstAppSrc * appsrc,
- gboolean do_min, guint64 min, gboolean do_max, guint64 max);
-
-static GstFlowReturn gst_app_src_create (GstBaseSrc * bsrc,
- guint64 offset, guint size, GstBuffer ** buf);
-static gboolean gst_app_src_start (GstBaseSrc * bsrc);
-static gboolean gst_app_src_stop (GstBaseSrc * bsrc);
-static gboolean gst_app_src_unlock (GstBaseSrc * bsrc);
-static gboolean gst_app_src_unlock_stop (GstBaseSrc * bsrc);
-static gboolean gst_app_src_do_seek (GstBaseSrc * src, GstSegment * segment);
-static gboolean gst_app_src_is_seekable (GstBaseSrc * src);
-static gboolean gst_app_src_check_get_range (GstBaseSrc * src);
-static gboolean gst_app_src_do_get_size (GstBaseSrc * src, guint64 * size);
-static gboolean gst_app_src_query (GstBaseSrc * src, GstQuery * query);
-
-static GstFlowReturn gst_app_src_push_buffer_action (GstAppSrc * appsrc,
- GstBuffer * buffer);
-
-static guint gst_app_src_signals[LAST_SIGNAL] = { 0 };
-
-static void
-_do_init (GType filesrc_type)
-{
- static const GInterfaceInfo urihandler_info = {
- gst_app_src_uri_handler_init,
- NULL,
- NULL
- };
- g_type_add_interface_static (filesrc_type, GST_TYPE_URI_HANDLER,
- &urihandler_info);
-}
-
-GST_BOILERPLATE_FULL (GstAppSrc, gst_app_src, GstBaseSrc, GST_TYPE_BASE_SRC,
- _do_init);
-
-static void
-gst_app_src_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- GST_DEBUG_CATEGORY_INIT (app_src_debug, "appsrc", 0, "appsrc element");
-
- gst_element_class_set_details_simple (element_class, "AppSrc",
- "Generic/Src", "Allow the application to feed buffers to a pipeline",
- "David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>");
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_app_src_template));
-}
-
-static void
-gst_app_src_class_init (GstAppSrcClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
- GstBaseSrcClass *basesrc_class = (GstBaseSrcClass *) klass;
-
- gobject_class->dispose = gst_app_src_dispose;
- gobject_class->finalize = gst_app_src_finalize;
-
- gobject_class->set_property = gst_app_src_set_property;
- gobject_class->get_property = gst_app_src_get_property;
-
- /**
- * GstAppSrc::caps
- *
- * The GstCaps that will negotiated downstream and will be put
- * on outgoing buffers.
- */
- g_object_class_install_property (gobject_class, PROP_CAPS,
- g_param_spec_boxed ("caps", "Caps",
- "The allowed caps for the src pad", GST_TYPE_CAPS,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstAppSrc::format
- *
- * The format to use for segment events. When the source is producing
- * timestamped buffers this property should be set to GST_FORMAT_TIME.
- */
- g_object_class_install_property (gobject_class, PROP_FORMAT,
- g_param_spec_enum ("format", "Format",
- "The format of the segment events and seek", GST_TYPE_FORMAT,
- DEFAULT_PROP_FORMAT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstAppSrc::size
- *
- * The total size in bytes of the data stream. If the total size is known, it
- * is recommended to configure it with this property.
- */
- g_object_class_install_property (gobject_class, PROP_SIZE,
- g_param_spec_int64 ("size", "Size",
- "The size of the data stream in bytes (-1 if unknown)",
- -1, G_MAXINT64, DEFAULT_PROP_SIZE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstAppSrc::stream-type
- *
- * The type of stream that this source is producing. For seekable streams the
- * application should connect to the seek-data signal.
- */
- g_object_class_install_property (gobject_class, PROP_STREAM_TYPE,
- g_param_spec_enum ("stream-type", "Stream Type",
- "the type of the stream", GST_TYPE_APP_STREAM_TYPE,
- DEFAULT_PROP_STREAM_TYPE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstAppSrc::max-bytes
- *
- * The maximum amount of bytes that can be queued internally.
- * After the maximum amount of bytes are queued, appsrc will emit the
- * "enough-data" signal.
- */
- g_object_class_install_property (gobject_class, PROP_MAX_BYTES,
- g_param_spec_uint64 ("max-bytes", "Max bytes",
- "The maximum number of bytes to queue internally (0 = unlimited)",
- 0, G_MAXUINT64, DEFAULT_PROP_MAX_BYTES,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstAppSrc::block
- *
- * When max-bytes are queued and after the enough-data signal has been emited,
- * block any further push-buffer calls until the amount of queued bytes drops
- * below the max-bytes limit.
- */
- g_object_class_install_property (gobject_class, PROP_BLOCK,
- g_param_spec_boolean ("block", "Block",
- "Block push-buffer when max-bytes are queued",
- DEFAULT_PROP_BLOCK, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstAppSrc::is-live
- *
- * Instruct the source to behave like a live source. This includes that it
- * will only push out buffers in the PLAYING state.
- */
- g_object_class_install_property (gobject_class, PROP_IS_LIVE,
- g_param_spec_boolean ("is-live", "Is Live",
- "Whether to act as a live source",
- DEFAULT_PROP_IS_LIVE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstAppSrc::min-latency
- *
- * The minimum latency of the source. A value of -1 will use the default
- * latency calculations of #GstBaseSrc.
- */
- g_object_class_install_property (gobject_class, PROP_MIN_LATENCY,
- g_param_spec_int64 ("min-latency", "Min Latency",
- "The minimum latency (-1 = default)",
- -1, G_MAXINT64, DEFAULT_PROP_MIN_LATENCY,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstAppSrc::max-latency
- *
- * The maximum latency of the source. A value of -1 means an unlimited amout
- * of latency.
- */
- g_object_class_install_property (gobject_class, PROP_MAX_LATENCY,
- g_param_spec_int64 ("max-latency", "Max Latency",
- "The maximum latency (-1 = unlimited)",
- -1, G_MAXINT64, DEFAULT_PROP_MAX_LATENCY,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstAppSrc::emit-signals
- *
- * Make appsrc emit the "need-data", "enough-data" and "seek-data" signals.
- * This option is by default enabled for backwards compatibility reasons but
- * can disabled when needed because signal emission is expensive.
- *
- * Since: 0.10.23
- */
- g_object_class_install_property (gobject_class, PROP_EMIT_SIGNALS,
- g_param_spec_boolean ("emit-signals", "Emit signals",
- "Emit new-preroll and new-buffer signals", DEFAULT_PROP_EMIT_SIGNALS,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstAppSrc::empty-percent
- *
- * Make appsrc emit the "need-data" signal when the amount of bytes in the
- * queue drops below this percentage of max-bytes.
- *
- * Since: 0.10.27
- */
- g_object_class_install_property (gobject_class, PROP_MIN_PERCENT,
- g_param_spec_uint ("min-percent", "Min Percent",
- "Emit need-data when queued bytes drops below this percent of max-bytes",
- 0, 100, DEFAULT_PROP_MIN_PERCENT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstAppSrc::need-data:
- * @appsrc: the appsrc element that emited the signal
- * @length: the amount of bytes needed.
- *
- * Signal that the source needs more data. In the callback or from another
- * thread you should call push-buffer or end-of-stream.
- *
- * @length is just a hint and when it is set to -1, any number of bytes can be
- * pushed into @appsrc.
- *
- * You can call push-buffer multiple times until the enough-data signal is
- * fired.
- */
- gst_app_src_signals[SIGNAL_NEED_DATA] =
- g_signal_new ("need-data", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstAppSrcClass, need_data),
- NULL, NULL, __gst_app_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT);
-
- /**
- * GstAppSrc::enough-data:
- * @appsrc: the appsrc element that emited the signal
- *
- * Signal that the source has enough data. It is recommended that the
- * application stops calling push-buffer until the need-data signal is
- * emited again to avoid excessive buffer queueing.
- */
- gst_app_src_signals[SIGNAL_ENOUGH_DATA] =
- g_signal_new ("enough-data", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstAppSrcClass, enough_data),
- NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
-
- /**
- * GstAppSrc::seek-data:
- * @appsrc: the appsrc element that emited the signal
- * @offset: the offset to seek to
- *
- * Seek to the given offset. The next push-buffer should produce buffers from
- * the new @offset.
- * This callback is only called for seekable stream types.
- *
- * Returns: %TRUE if the seek succeeded.
- */
- gst_app_src_signals[SIGNAL_SEEK_DATA] =
- g_signal_new ("seek-data", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstAppSrcClass, seek_data),
- NULL, NULL, __gst_app_marshal_BOOLEAN__UINT64, G_TYPE_BOOLEAN, 1,
- G_TYPE_UINT64);
-
- /**
- * GstAppSrc::push-buffer:
- * @appsrc: the appsrc
- * @buffer: a buffer to push
- *
- * Adds a buffer to the queue of buffers that the appsrc element will
- * push to its source pad. This function does not take ownership of the
- * buffer so the buffer needs to be unreffed after calling this function.
- *
- * When the block property is TRUE, this function can block until free space
- * becomes available in the queue.
- */
- gst_app_src_signals[SIGNAL_PUSH_BUFFER] =
- g_signal_new ("push-buffer", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstAppSrcClass,
- push_buffer), NULL, NULL, __gst_app_marshal_ENUM__OBJECT,
- GST_TYPE_FLOW_RETURN, 1, GST_TYPE_BUFFER);
-
- /**
- * GstAppSrc::end-of-stream:
- * @appsrc: the appsrc
- *
- * Notify @appsrc that no more buffer are available.
- */
- gst_app_src_signals[SIGNAL_END_OF_STREAM] =
- g_signal_new ("end-of-stream", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstAppSrcClass,
- end_of_stream), NULL, NULL, __gst_app_marshal_ENUM__VOID,
- GST_TYPE_FLOW_RETURN, 0, G_TYPE_NONE);
-
- basesrc_class->create = gst_app_src_create;
- basesrc_class->start = gst_app_src_start;
- basesrc_class->stop = gst_app_src_stop;
- basesrc_class->unlock = gst_app_src_unlock;
- basesrc_class->unlock_stop = gst_app_src_unlock_stop;
- basesrc_class->do_seek = gst_app_src_do_seek;
- basesrc_class->is_seekable = gst_app_src_is_seekable;
- basesrc_class->check_get_range = gst_app_src_check_get_range;
- basesrc_class->get_size = gst_app_src_do_get_size;
- basesrc_class->get_size = gst_app_src_do_get_size;
- basesrc_class->query = gst_app_src_query;
-
- klass->push_buffer = gst_app_src_push_buffer_action;
- klass->end_of_stream = gst_app_src_end_of_stream;
-
- g_type_class_add_private (klass, sizeof (GstAppSrcPrivate));
-}
-
-static void
-gst_app_src_init (GstAppSrc * appsrc, GstAppSrcClass * klass)
-{
- GstAppSrcPrivate *priv;
-
- priv = appsrc->priv = G_TYPE_INSTANCE_GET_PRIVATE (appsrc, GST_TYPE_APP_SRC,
- GstAppSrcPrivate);
-
- priv->mutex = g_mutex_new ();
- priv->cond = g_cond_new ();
- priv->queue = g_queue_new ();
-
- priv->size = DEFAULT_PROP_SIZE;
- priv->stream_type = DEFAULT_PROP_STREAM_TYPE;
- priv->max_bytes = DEFAULT_PROP_MAX_BYTES;
- priv->format = DEFAULT_PROP_FORMAT;
- priv->block = DEFAULT_PROP_BLOCK;
- priv->min_latency = DEFAULT_PROP_MIN_LATENCY;
- priv->max_latency = DEFAULT_PROP_MAX_LATENCY;
- priv->emit_signals = DEFAULT_PROP_EMIT_SIGNALS;
- priv->min_percent = DEFAULT_PROP_MIN_PERCENT;
-
- gst_base_src_set_live (GST_BASE_SRC (appsrc), DEFAULT_PROP_IS_LIVE);
-}
-
-static void
-gst_app_src_flush_queued (GstAppSrc * src)
-{
- GstBuffer *buf;
- GstAppSrcPrivate *priv = src->priv;
-
- while ((buf = g_queue_pop_head (priv->queue)))
- gst_buffer_unref (buf);
- priv->queued_bytes = 0;
-}
-
-static void
-gst_app_src_dispose (GObject * obj)
-{
- GstAppSrc *appsrc = GST_APP_SRC_CAST (obj);
- GstAppSrcPrivate *priv = appsrc->priv;
-
- if (priv->caps) {
- gst_caps_unref (priv->caps);
- priv->caps = NULL;
- }
- gst_app_src_flush_queued (appsrc);
-
- G_OBJECT_CLASS (parent_class)->dispose (obj);
-}
-
-static void
-gst_app_src_finalize (GObject * obj)
-{
- GstAppSrc *appsrc = GST_APP_SRC_CAST (obj);
- GstAppSrcPrivate *priv = appsrc->priv;
-
- g_mutex_free (priv->mutex);
- g_cond_free (priv->cond);
- g_queue_free (priv->queue);
-
- G_OBJECT_CLASS (parent_class)->finalize (obj);
-}
-
-static void
-gst_app_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstAppSrc *appsrc = GST_APP_SRC_CAST (object);
- GstAppSrcPrivate *priv = appsrc->priv;
-
- switch (prop_id) {
- case PROP_CAPS:
- gst_app_src_set_caps (appsrc, gst_value_get_caps (value));
- break;
- case PROP_SIZE:
- gst_app_src_set_size (appsrc, g_value_get_int64 (value));
- break;
- case PROP_STREAM_TYPE:
- gst_app_src_set_stream_type (appsrc, g_value_get_enum (value));
- break;
- case PROP_MAX_BYTES:
- gst_app_src_set_max_bytes (appsrc, g_value_get_uint64 (value));
- break;
- case PROP_FORMAT:
- priv->format = g_value_get_enum (value);
- break;
- case PROP_BLOCK:
- priv->block = g_value_get_boolean (value);
- break;
- case PROP_IS_LIVE:
- gst_base_src_set_live (GST_BASE_SRC (appsrc),
- g_value_get_boolean (value));
- break;
- case PROP_MIN_LATENCY:
- gst_app_src_set_latencies (appsrc, TRUE, g_value_get_int64 (value),
- FALSE, -1);
- break;
- case PROP_MAX_LATENCY:
- gst_app_src_set_latencies (appsrc, FALSE, -1, TRUE,
- g_value_get_int64 (value));
- break;
- case PROP_EMIT_SIGNALS:
- gst_app_src_set_emit_signals (appsrc, g_value_get_boolean (value));
- break;
- case PROP_MIN_PERCENT:
- priv->min_percent = g_value_get_uint (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_app_src_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstAppSrc *appsrc = GST_APP_SRC_CAST (object);
- GstAppSrcPrivate *priv = appsrc->priv;
-
- switch (prop_id) {
- case PROP_CAPS:
- {
- GstCaps *caps;
-
- /* we're missing a _take_caps() function to transfer ownership */
- caps = gst_app_src_get_caps (appsrc);
- gst_value_set_caps (value, caps);
- if (caps)
- gst_caps_unref (caps);
- break;
- }
- case PROP_SIZE:
- g_value_set_int64 (value, gst_app_src_get_size (appsrc));
- break;
- case PROP_STREAM_TYPE:
- g_value_set_enum (value, gst_app_src_get_stream_type (appsrc));
- break;
- case PROP_MAX_BYTES:
- g_value_set_uint64 (value, gst_app_src_get_max_bytes (appsrc));
- break;
- case PROP_FORMAT:
- g_value_set_enum (value, priv->format);
- break;
- case PROP_BLOCK:
- g_value_set_boolean (value, priv->block);
- break;
- case PROP_IS_LIVE:
- g_value_set_boolean (value, gst_base_src_is_live (GST_BASE_SRC (appsrc)));
- break;
- case PROP_MIN_LATENCY:
- {
- guint64 min;
-
- gst_app_src_get_latency (appsrc, &min, NULL);
- g_value_set_int64 (value, min);
- break;
- }
- case PROP_MAX_LATENCY:
- {
- guint64 max;
-
- gst_app_src_get_latency (appsrc, &max, NULL);
- g_value_set_int64 (value, max);
- break;
- }
- case PROP_EMIT_SIGNALS:
- g_value_set_boolean (value, gst_app_src_get_emit_signals (appsrc));
- break;
- case PROP_MIN_PERCENT:
- g_value_set_uint (value, priv->min_percent);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-gst_app_src_unlock (GstBaseSrc * bsrc)
-{
- GstAppSrc *appsrc = GST_APP_SRC_CAST (bsrc);
- GstAppSrcPrivate *priv = appsrc->priv;
-
- g_mutex_lock (priv->mutex);
- GST_DEBUG_OBJECT (appsrc, "unlock start");
- priv->flushing = TRUE;
- g_cond_broadcast (priv->cond);
- g_mutex_unlock (priv->mutex);
-
- return TRUE;
-}
-
-static gboolean
-gst_app_src_unlock_stop (GstBaseSrc * bsrc)
-{
- GstAppSrc *appsrc = GST_APP_SRC_CAST (bsrc);
- GstAppSrcPrivate *priv = appsrc->priv;
-
- g_mutex_lock (priv->mutex);
- GST_DEBUG_OBJECT (appsrc, "unlock stop");
- priv->flushing = FALSE;
- g_cond_broadcast (priv->cond);
- g_mutex_unlock (priv->mutex);
-
- return TRUE;
-}
-
-static gboolean
-gst_app_src_start (GstBaseSrc * bsrc)
-{
- GstAppSrc *appsrc = GST_APP_SRC_CAST (bsrc);
- GstAppSrcPrivate *priv = appsrc->priv;
-
- g_mutex_lock (priv->mutex);
- GST_DEBUG_OBJECT (appsrc, "starting");
- priv->started = TRUE;
- /* set the offset to -1 so that we always do a first seek. This is only used
- * in random-access mode. */
- priv->offset = -1;
- priv->flushing = FALSE;
- g_mutex_unlock (priv->mutex);
-
- gst_base_src_set_format (bsrc, priv->format);
-
- return TRUE;
-}
-
-static gboolean
-gst_app_src_stop (GstBaseSrc * bsrc)
-{
- GstAppSrc *appsrc = GST_APP_SRC_CAST (bsrc);
- GstAppSrcPrivate *priv = appsrc->priv;
-
- g_mutex_lock (priv->mutex);
- GST_DEBUG_OBJECT (appsrc, "stopping");
- priv->is_eos = FALSE;
- priv->flushing = TRUE;
- priv->started = FALSE;
- gst_app_src_flush_queued (appsrc);
- g_mutex_unlock (priv->mutex);
-
- return TRUE;
-}
-
-static gboolean
-gst_app_src_is_seekable (GstBaseSrc * src)
-{
- GstAppSrc *appsrc = GST_APP_SRC_CAST (src);
- GstAppSrcPrivate *priv = appsrc->priv;
- gboolean res = FALSE;
-
- switch (priv->stream_type) {
- case GST_APP_STREAM_TYPE_STREAM:
- break;
- case GST_APP_STREAM_TYPE_SEEKABLE:
- case GST_APP_STREAM_TYPE_RANDOM_ACCESS:
- res = TRUE;
- break;
- }
- return res;
-}
-
-static gboolean
-gst_app_src_check_get_range (GstBaseSrc * src)
-{
- GstAppSrc *appsrc = GST_APP_SRC_CAST (src);
- GstAppSrcPrivate *priv = appsrc->priv;
- gboolean res = FALSE;
-
- switch (priv->stream_type) {
- case GST_APP_STREAM_TYPE_STREAM:
- case GST_APP_STREAM_TYPE_SEEKABLE:
- break;
- case GST_APP_STREAM_TYPE_RANDOM_ACCESS:
- res = TRUE;
- break;
- }
- return res;
-}
-
-static gboolean
-gst_app_src_do_get_size (GstBaseSrc * src, guint64 * size)
-{
- GstAppSrc *appsrc = GST_APP_SRC_CAST (src);
-
- *size = gst_app_src_get_size (appsrc);
-
- return TRUE;
-}
-
-static gboolean
-gst_app_src_query (GstBaseSrc * src, GstQuery * query)
-{
- GstAppSrc *appsrc = GST_APP_SRC_CAST (src);
- GstAppSrcPrivate *priv = appsrc->priv;
- gboolean res;
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_LATENCY:
- {
- GstClockTime min, max;
- gboolean live;
-
- /* Query the parent class for the defaults */
- res = gst_base_src_query_latency (src, &live, &min, &max);
-
- /* overwrite with our values when we need to */
- g_mutex_lock (priv->mutex);
- if (priv->min_latency != -1)
- min = priv->min_latency;
- if (priv->max_latency != -1)
- max = priv->max_latency;
- g_mutex_unlock (priv->mutex);
-
- gst_query_set_latency (query, live, min, max);
- break;
- }
- default:
- res = GST_BASE_SRC_CLASS (parent_class)->query (src, query);
- break;
- }
-
- return res;
-}
-
-/* will be called in push mode */
-static gboolean
-gst_app_src_do_seek (GstBaseSrc * src, GstSegment * segment)
-{
- GstAppSrc *appsrc = GST_APP_SRC_CAST (src);
- GstAppSrcPrivate *priv = appsrc->priv;
- gint64 desired_position;
- gboolean res = FALSE;
-
- desired_position = segment->last_stop;
-
- GST_DEBUG_OBJECT (appsrc, "seeking to %" G_GINT64_FORMAT ", format %s",
- desired_position, gst_format_get_name (segment->format));
-
- /* no need to try to seek in streaming mode */
- if (priv->stream_type == GST_APP_STREAM_TYPE_STREAM)
- return TRUE;
-
- if (priv->callbacks.seek_data)
- res = priv->callbacks.seek_data (appsrc, desired_position, priv->user_data);
- else {
- gboolean emit;
-
- g_mutex_lock (priv->mutex);
- emit = priv->emit_signals;
- g_mutex_unlock (priv->mutex);
-
- if (emit)
- g_signal_emit (appsrc, gst_app_src_signals[SIGNAL_SEEK_DATA], 0,
- desired_position, &res);
- }
-
- if (res) {
- GST_DEBUG_OBJECT (appsrc, "flushing queue");
- gst_app_src_flush_queued (appsrc);
- priv->is_eos = FALSE;
- } else {
- GST_WARNING_OBJECT (appsrc, "seek failed");
- }
-
- return res;
-}
-
-/* must be called with the appsrc mutex */
-static gboolean
-gst_app_src_emit_seek (GstAppSrc * appsrc, guint64 offset)
-{
- gboolean res;
- gboolean emit;
- GstAppSrcPrivate *priv = appsrc->priv;
-
- emit = priv->emit_signals;
- g_mutex_unlock (priv->mutex);
-
- GST_DEBUG_OBJECT (appsrc,
- "we are at %" G_GINT64_FORMAT ", seek to %" G_GINT64_FORMAT,
- priv->offset, offset);
-
- if (priv->callbacks.seek_data)
- res = priv->callbacks.seek_data (appsrc, offset, priv->user_data);
- else if (emit)
- g_signal_emit (appsrc, gst_app_src_signals[SIGNAL_SEEK_DATA], 0,
- offset, &res);
-
- g_mutex_lock (priv->mutex);
-
- return res;
-}
-
-/* must be called with the appsrc mutex. After this call things can be
- * flushing */
-static void
-gst_app_src_emit_need_data (GstAppSrc * appsrc, guint size)
-{
- gboolean emit;
- GstAppSrcPrivate *priv = appsrc->priv;
-
- emit = priv->emit_signals;
- g_mutex_unlock (priv->mutex);
-
- /* we have no data, we need some. We fire the signal with the size hint. */
- if (priv->callbacks.need_data)
- priv->callbacks.need_data (appsrc, size, priv->user_data);
- else if (emit)
- g_signal_emit (appsrc, gst_app_src_signals[SIGNAL_NEED_DATA], 0, size,
- NULL);
-
- g_mutex_lock (priv->mutex);
- /* we can be flushing now because we released the lock */
-}
-
-static GstFlowReturn
-gst_app_src_create (GstBaseSrc * bsrc, guint64 offset, guint size,
- GstBuffer ** buf)
-{
- GstAppSrc *appsrc = GST_APP_SRC_CAST (bsrc);
- GstAppSrcPrivate *priv = appsrc->priv;
- GstFlowReturn ret;
-
- GST_OBJECT_LOCK (appsrc);
- if (G_UNLIKELY (priv->size != bsrc->segment.duration &&
- bsrc->segment.format == GST_FORMAT_BYTES)) {
- GST_DEBUG_OBJECT (appsrc,
- "Size changed from %" G_GINT64_FORMAT " to %" G_GINT64_FORMAT,
- bsrc->segment.duration, priv->size);
- gst_segment_set_duration (&bsrc->segment, GST_FORMAT_BYTES, priv->size);
- GST_OBJECT_UNLOCK (appsrc);
-
- gst_element_post_message (GST_ELEMENT (appsrc),
- gst_message_new_duration (GST_OBJECT (appsrc), GST_FORMAT_BYTES,
- priv->size));
- } else {
- GST_OBJECT_UNLOCK (appsrc);
- }
-
- g_mutex_lock (priv->mutex);
- /* check flushing first */
- if (G_UNLIKELY (priv->flushing))
- goto flushing;
-
- if (priv->stream_type == GST_APP_STREAM_TYPE_RANDOM_ACCESS) {
- /* if we are dealing with a random-access stream, issue a seek if the offset
- * changed. */
- if (G_UNLIKELY (priv->offset != offset)) {
- gboolean res;
-
- /* do the seek */
- res = gst_app_src_emit_seek (appsrc, offset);
-
- if (G_UNLIKELY (!res))
- /* failing to seek is fatal */
- goto seek_error;
-
- priv->offset = offset;
- }
- }
-
- while (TRUE) {
- /* return data as long as we have some */
- if (!g_queue_is_empty (priv->queue)) {
- guint buf_size;
-
- *buf = g_queue_pop_head (priv->queue);
- buf_size = GST_BUFFER_SIZE (*buf);
-
- GST_DEBUG_OBJECT (appsrc, "we have buffer %p of size %u", *buf, buf_size);
-
- priv->queued_bytes -= buf_size;
-
- /* only update the offset when in random_access mode */
- if (priv->stream_type == GST_APP_STREAM_TYPE_RANDOM_ACCESS)
- priv->offset += buf_size;
- gst_buffer_set_caps (*buf, priv->caps);
-
- /* signal that we removed an item */
- g_cond_broadcast (priv->cond);
-
- /* see if we go lower than the empty-percent */
- if (priv->min_percent && priv->max_bytes) {
- if (priv->queued_bytes * 100 / priv->max_bytes <= priv->min_percent)
- /* ignore flushing state, we got a buffer and we will return it now.
- * Errors will be handled in the next round */
- gst_app_src_emit_need_data (appsrc, size);
- }
- ret = GST_FLOW_OK;
- break;
- } else {
- gst_app_src_emit_need_data (appsrc, size);
-
- /* we can be flushing now because we released the lock above */
- if (G_UNLIKELY (priv->flushing))
- goto flushing;
-
- /* if we have a buffer now, continue the loop and try to return it. In
- * random-access mode (where a buffer is normally pushed in the above
- * signal) we can still be empty because the pushed buffer got flushed or
- * when the application pushes the requested buffer later, we support both
- * possiblities. */
- if (!g_queue_is_empty (priv->queue))
- continue;
-
- /* no buffer yet, maybe we are EOS, if not, block for more data. */
- }
-
- /* check EOS */
- if (G_UNLIKELY (priv->is_eos))
- goto eos;
-
- /* nothing to return, wait a while for new data or flushing. */
- g_cond_wait (priv->cond, priv->mutex);
- }
- g_mutex_unlock (priv->mutex);
-
- return ret;
-
- /* ERRORS */
-flushing:
- {
- GST_DEBUG_OBJECT (appsrc, "we are flushing");
- g_mutex_unlock (priv->mutex);
- return GST_FLOW_WRONG_STATE;
- }
-eos:
- {
- GST_DEBUG_OBJECT (appsrc, "we are EOS");
- g_mutex_unlock (priv->mutex);
- return GST_FLOW_UNEXPECTED;
- }
-seek_error:
- {
- g_mutex_unlock (priv->mutex);
- GST_ELEMENT_ERROR (appsrc, RESOURCE, READ, ("failed to seek"),
- GST_ERROR_SYSTEM);
- return GST_FLOW_ERROR;
- }
-}
-
-/* external API */
-
-/**
- * gst_app_src_set_caps:
- * @appsrc: a #GstAppSrc
- * @caps: caps to set
- *
- * Set the capabilities on the appsrc element. This function takes
- * a copy of the caps structure. After calling this method, the source will
- * only produce caps that match @caps. @caps must be fixed and the caps on the
- * buffers must match the caps or left NULL.
- *
- * Since: 0.10.22
- */
-void
-gst_app_src_set_caps (GstAppSrc * appsrc, const GstCaps * caps)
-{
- GstCaps *old;
- GstAppSrcPrivate *priv;
-
- g_return_if_fail (GST_IS_APP_SRC (appsrc));
-
- priv = appsrc->priv;
-
- GST_OBJECT_LOCK (appsrc);
- GST_DEBUG_OBJECT (appsrc, "setting caps to %" GST_PTR_FORMAT, caps);
- if ((old = priv->caps) != caps) {
- if (caps)
- priv->caps = gst_caps_copy (caps);
- else
- priv->caps = NULL;
- if (old)
- gst_caps_unref (old);
- }
- GST_OBJECT_UNLOCK (appsrc);
-}
-
-/**
- * gst_app_src_get_caps:
- * @appsrc: a #GstAppSrc
- *
- * Get the configured caps on @appsrc.
- *
- * Returns: the #GstCaps produced by the source. gst_caps_unref() after usage.
- *
- * Since: 0.10.22
- */
-GstCaps *
-gst_app_src_get_caps (GstAppSrc * appsrc)
-{
- GstCaps *caps;
- GstAppSrcPrivate *priv;
-
- g_return_val_if_fail (GST_IS_APP_SRC (appsrc), NULL);
-
- priv = appsrc->priv;
-
- GST_OBJECT_LOCK (appsrc);
- if ((caps = priv->caps))
- gst_caps_ref (caps);
- GST_DEBUG_OBJECT (appsrc, "getting caps of %" GST_PTR_FORMAT, caps);
- GST_OBJECT_UNLOCK (appsrc);
-
- return caps;
-}
-
-/**
- * gst_app_src_set_size:
- * @appsrc: a #GstAppSrc
- * @size: the size to set
- *
- * Set the size of the stream in bytes. A value of -1 means that the size is
- * not known.
- *
- * Since: 0.10.22
- */
-void
-gst_app_src_set_size (GstAppSrc * appsrc, gint64 size)
-{
- GstAppSrcPrivate *priv;
-
- g_return_if_fail (GST_IS_APP_SRC (appsrc));
-
- priv = appsrc->priv;
-
- GST_OBJECT_LOCK (appsrc);
- GST_DEBUG_OBJECT (appsrc, "setting size of %" G_GINT64_FORMAT, size);
- priv->size = size;
- GST_OBJECT_UNLOCK (appsrc);
-}
-
-/**
- * gst_app_src_get_size:
- * @appsrc: a #GstAppSrc
- *
- * Get the size of the stream in bytes. A value of -1 means that the size is
- * not known.
- *
- * Returns: the size of the stream previously set with gst_app_src_set_size();
- *
- * Since: 0.10.22
- */
-gint64
-gst_app_src_get_size (GstAppSrc * appsrc)
-{
- gint64 size;
- GstAppSrcPrivate *priv;
-
- g_return_val_if_fail (GST_IS_APP_SRC (appsrc), -1);
-
- priv = appsrc->priv;
-
- GST_OBJECT_LOCK (appsrc);
- size = priv->size;
- GST_DEBUG_OBJECT (appsrc, "getting size of %" G_GINT64_FORMAT, size);
- GST_OBJECT_UNLOCK (appsrc);
-
- return size;
-}
-
-/**
- * gst_app_src_set_stream_type:
- * @appsrc: a #GstAppSrc
- * @type: the new state
- *
- * Set the stream type on @appsrc. For seekable streams, the "seek" signal must
- * be connected to.
- *
- * A stream_type stream
- *
- * Since: 0.10.22
- */
-void
-gst_app_src_set_stream_type (GstAppSrc * appsrc, GstAppStreamType type)
-{
- GstAppSrcPrivate *priv;
-
- g_return_if_fail (GST_IS_APP_SRC (appsrc));
-
- priv = appsrc->priv;
-
- GST_OBJECT_LOCK (appsrc);
- GST_DEBUG_OBJECT (appsrc, "setting stream_type of %d", type);
- priv->stream_type = type;
- GST_OBJECT_UNLOCK (appsrc);
-}
-
-/**
- * gst_app_src_get_stream_type:
- * @appsrc: a #GstAppSrc
- *
- * Get the stream type. Control the stream type of @appsrc
- * with gst_app_src_set_stream_type().
- *
- * Returns: the stream type.
- *
- * Since: 0.10.22
- */
-GstAppStreamType
-gst_app_src_get_stream_type (GstAppSrc * appsrc)
-{
- gboolean stream_type;
- GstAppSrcPrivate *priv;
-
- g_return_val_if_fail (GST_IS_APP_SRC (appsrc), FALSE);
-
- priv = appsrc->priv;
-
- GST_OBJECT_LOCK (appsrc);
- stream_type = priv->stream_type;
- GST_DEBUG_OBJECT (appsrc, "getting stream_type of %d", stream_type);
- GST_OBJECT_UNLOCK (appsrc);
-
- return stream_type;
-}
-
-/**
- * gst_app_src_set_max_bytes:
- * @appsrc: a #GstAppSrc
- * @max: the maximum number of bytes to queue
- *
- * Set the maximum amount of bytes that can be queued in @appsrc.
- * After the maximum amount of bytes are queued, @appsrc will emit the
- * "enough-data" signal.
- *
- * Since: 0.10.22
- */
-void
-gst_app_src_set_max_bytes (GstAppSrc * appsrc, guint64 max)
-{
- GstAppSrcPrivate *priv;
-
- g_return_if_fail (GST_IS_APP_SRC (appsrc));
-
- priv = appsrc->priv;
-
- g_mutex_lock (priv->mutex);
- if (max != priv->max_bytes) {
- GST_DEBUG_OBJECT (appsrc, "setting max-bytes to %" G_GUINT64_FORMAT, max);
- priv->max_bytes = max;
- /* signal the change */
- g_cond_broadcast (priv->cond);
- }
- g_mutex_unlock (priv->mutex);
-}
-
-/**
- * gst_app_src_get_max_bytes:
- * @appsrc: a #GstAppSrc
- *
- * Get the maximum amount of bytes that can be queued in @appsrc.
- *
- * Returns: The maximum amount of bytes that can be queued.
- *
- * Since: 0.10.22
- */
-guint64
-gst_app_src_get_max_bytes (GstAppSrc * appsrc)
-{
- guint64 result;
- GstAppSrcPrivate *priv;
-
- g_return_val_if_fail (GST_IS_APP_SRC (appsrc), 0);
-
- priv = appsrc->priv;
-
- g_mutex_lock (priv->mutex);
- result = priv->max_bytes;
- GST_DEBUG_OBJECT (appsrc, "getting max-bytes of %" G_GUINT64_FORMAT, result);
- g_mutex_unlock (priv->mutex);
-
- return result;
-}
-
-static void
-gst_app_src_set_latencies (GstAppSrc * appsrc, gboolean do_min, guint64 min,
- gboolean do_max, guint64 max)
-{
- GstAppSrcPrivate *priv = appsrc->priv;
- gboolean changed = FALSE;
-
- g_mutex_lock (priv->mutex);
- if (do_min && priv->min_latency != min) {
- priv->min_latency = min;
- changed = TRUE;
- }
- if (do_max && priv->max_latency != max) {
- priv->max_latency = max;
- changed = TRUE;
- }
- g_mutex_unlock (priv->mutex);
-
- if (changed) {
- GST_DEBUG_OBJECT (appsrc, "posting latency changed");
- gst_element_post_message (GST_ELEMENT_CAST (appsrc),
- gst_message_new_latency (GST_OBJECT_CAST (appsrc)));
- }
-}
-
-/**
- * gst_app_src_set_latency:
- * @appsrc: a #GstAppSrc
- * @min: the min latency
- * @max: the min latency
- *
- * Configure the @min and @max latency in @src. If @min is set to -1, the
- * default latency calculations for pseudo-live sources will be used.
- *
- * Since: 0.10.22
- */
-void
-gst_app_src_set_latency (GstAppSrc * appsrc, guint64 min, guint64 max)
-{
- gst_app_src_set_latencies (appsrc, TRUE, min, TRUE, max);
-}
-
-/**
- * gst_app_src_get_latency:
- * @appsrc: a #GstAppSrc
- * @min: the min latency
- * @max: the min latency
- *
- * Retrieve the min and max latencies in @min and @max respectively.
- *
- * Since: 0.10.22
- */
-void
-gst_app_src_get_latency (GstAppSrc * appsrc, guint64 * min, guint64 * max)
-{
- GstAppSrcPrivate *priv;
-
- g_return_if_fail (GST_IS_APP_SRC (appsrc));
-
- priv = appsrc->priv;
-
- g_mutex_lock (priv->mutex);
- if (min)
- *min = priv->min_latency;
- if (max)
- *max = priv->max_latency;
- g_mutex_unlock (priv->mutex);
-}
-
-/**
- * gst_app_src_set_emit_signals:
- * @appsrc: a #GstAppSrc
- * @emit: the new state
- *
- * Make appsrc emit the "new-preroll" and "new-buffer" signals. This option is
- * by default disabled because signal emission is expensive and unneeded when
- * the application prefers to operate in pull mode.
- *
- * Since: 0.10.23
- */
-void
-gst_app_src_set_emit_signals (GstAppSrc * appsrc, gboolean emit)
-{
- GstAppSrcPrivate *priv;
-
- g_return_if_fail (GST_IS_APP_SRC (appsrc));
-
- priv = appsrc->priv;
-
- g_mutex_lock (priv->mutex);
- priv->emit_signals = emit;
- g_mutex_unlock (priv->mutex);
-}
-
-/**
- * gst_app_src_get_emit_signals:
- * @appsrc: a #GstAppSrc
- *
- * Check if appsrc will emit the "new-preroll" and "new-buffer" signals.
- *
- * Returns: %TRUE if @appsrc is emiting the "new-preroll" and "new-buffer"
- * signals.
- *
- * Since: 0.10.23
- */
-gboolean
-gst_app_src_get_emit_signals (GstAppSrc * appsrc)
-{
- gboolean result;
- GstAppSrcPrivate *priv;
-
- g_return_val_if_fail (GST_IS_APP_SRC (appsrc), FALSE);
-
- priv = appsrc->priv;
-
- g_mutex_lock (priv->mutex);
- result = priv->emit_signals;
- g_mutex_unlock (priv->mutex);
-
- return result;
-}
-
-static GstFlowReturn
-gst_app_src_push_buffer_full (GstAppSrc * appsrc, GstBuffer * buffer,
- gboolean steal_ref)
-{
- gboolean first = TRUE;
- GstAppSrcPrivate *priv;
-
- g_return_val_if_fail (GST_IS_APP_SRC (appsrc), GST_FLOW_ERROR);
- g_return_val_if_fail (GST_IS_BUFFER (buffer), GST_FLOW_ERROR);
-
- priv = appsrc->priv;
-
- g_mutex_lock (priv->mutex);
-
- while (TRUE) {
- /* can't accept buffers when we are flushing or EOS */
- if (priv->flushing)
- goto flushing;
-
- if (priv->is_eos)
- goto eos;
-
- if (priv->max_bytes && priv->queued_bytes >= priv->max_bytes) {
- GST_DEBUG_OBJECT (appsrc,
- "queue filled (%" G_GUINT64_FORMAT " >= %" G_GUINT64_FORMAT ")",
- priv->queued_bytes, priv->max_bytes);
-
- if (first) {
- gboolean emit;
-
- emit = priv->emit_signals;
- /* only signal on the first push */
- g_mutex_unlock (priv->mutex);
-
- if (priv->callbacks.enough_data)
- priv->callbacks.enough_data (appsrc, priv->user_data);
- else if (emit)
- g_signal_emit (appsrc, gst_app_src_signals[SIGNAL_ENOUGH_DATA], 0,
- NULL);
-
- g_mutex_lock (priv->mutex);
- /* continue to check for flushing/eos after releasing the lock */
- first = FALSE;
- continue;
- }
- if (priv->block) {
- GST_DEBUG_OBJECT (appsrc, "waiting for free space");
- /* we are filled, wait until a buffer gets popped or when we
- * flush. */
- g_cond_wait (priv->cond, priv->mutex);
- } else {
- /* no need to wait for free space, we just pump more data into the
- * queue hoping that the caller reacts to the enough-data signal and
- * stops pushing buffers. */
- break;
- }
- } else
- break;
- }
-
- GST_DEBUG_OBJECT (appsrc, "queueing buffer %p", buffer);
- if (!steal_ref)
- gst_buffer_ref (buffer);
- g_queue_push_tail (priv->queue, buffer);
- priv->queued_bytes += GST_BUFFER_SIZE (buffer);
- g_cond_broadcast (priv->cond);
- g_mutex_unlock (priv->mutex);
-
- return GST_FLOW_OK;
-
- /* ERRORS */
-flushing:
- {
- GST_DEBUG_OBJECT (appsrc, "refuse buffer %p, we are flushing", buffer);
- if (steal_ref)
- gst_buffer_unref (buffer);
- g_mutex_unlock (priv->mutex);
- return GST_FLOW_WRONG_STATE;
- }
-eos:
- {
- GST_DEBUG_OBJECT (appsrc, "refuse buffer %p, we are EOS", buffer);
- if (steal_ref)
- gst_buffer_unref (buffer);
- g_mutex_unlock (priv->mutex);
- return GST_FLOW_UNEXPECTED;
- }
-}
-
-/**
- * gst_app_src_push_buffer:
- * @appsrc: a #GstAppSrc
- * @buffer: a #GstBuffer to push
- *
- * Adds a buffer to the queue of buffers that the appsrc element will
- * push to its source pad. This function takes ownership of the buffer.
- *
- * When the block property is TRUE, this function can block until free
- * space becomes available in the queue.
- *
- * Returns: #GST_FLOW_OK when the buffer was successfuly queued.
- * #GST_FLOW_WRONG_STATE when @appsrc is not PAUSED or PLAYING.
- * #GST_FLOW_UNEXPECTED when EOS occured.
- *
- * Since: 0.10.22
- */
-GstFlowReturn
-gst_app_src_push_buffer (GstAppSrc * appsrc, GstBuffer * buffer)
-{
- return gst_app_src_push_buffer_full (appsrc, buffer, TRUE);
-}
-
-/* push a buffer without stealing the ref of the buffer. This is used for the
- * action signal. */
-static GstFlowReturn
-gst_app_src_push_buffer_action (GstAppSrc * appsrc, GstBuffer * buffer)
-{
- return gst_app_src_push_buffer_full (appsrc, buffer, FALSE);
-}
-
-/**
- * gst_app_src_end_of_stream:
- * @appsrc: a #GstAppSrc
- *
- * Indicates to the appsrc element that the last buffer queued in the
- * element is the last buffer of the stream.
- *
- * Returns: #GST_FLOW_OK when the EOS was successfuly queued.
- * #GST_FLOW_WRONG_STATE when @appsrc is not PAUSED or PLAYING.
- *
- * Since: 0.10.22
- */
-GstFlowReturn
-gst_app_src_end_of_stream (GstAppSrc * appsrc)
-{
- GstAppSrcPrivate *priv;
-
- g_return_val_if_fail (GST_IS_APP_SRC (appsrc), GST_FLOW_ERROR);
-
- priv = appsrc->priv;
-
- g_mutex_lock (priv->mutex);
- /* can't accept buffers when we are flushing. We can accept them when we are
- * EOS although it will not do anything. */
- if (priv->flushing)
- goto flushing;
-
- GST_DEBUG_OBJECT (appsrc, "sending EOS");
- priv->is_eos = TRUE;
- g_cond_broadcast (priv->cond);
- g_mutex_unlock (priv->mutex);
-
- return GST_FLOW_OK;
-
- /* ERRORS */
-flushing:
- {
- g_mutex_unlock (priv->mutex);
- GST_DEBUG_OBJECT (appsrc, "refuse EOS, we are flushing");
- return GST_FLOW_WRONG_STATE;
- }
-}
-
-/**
- * gst_app_src_set_callbacks:
- * @appsrc: a #GstAppSrc
- * @callbacks: the callbacks
- * @user_data: a user_data argument for the callbacks
- * @notify: a destroy notify function
- *
- * Set callbacks which will be executed when data is needed, enough data has
- * been collected or when a seek should be performed.
- * This is an alternative to using the signals, it has lower overhead and is thus
- * less expensive, but also less flexible.
- *
- * If callbacks are installed, no signals will be emited for performance
- * reasons.
- *
- * Since: 0.10.23
- */
-void
-gst_app_src_set_callbacks (GstAppSrc * appsrc,
- GstAppSrcCallbacks * callbacks, gpointer user_data, GDestroyNotify notify)
-{
- GDestroyNotify old_notify;
- GstAppSrcPrivate *priv;
-
- g_return_if_fail (GST_IS_APP_SRC (appsrc));
- g_return_if_fail (callbacks != NULL);
-
- priv = appsrc->priv;
-
- GST_OBJECT_LOCK (appsrc);
- old_notify = priv->notify;
-
- if (old_notify) {
- gpointer old_data;
-
- old_data = priv->user_data;
-
- priv->user_data = NULL;
- priv->notify = NULL;
- GST_OBJECT_UNLOCK (appsrc);
-
- old_notify (old_data);
-
- GST_OBJECT_LOCK (appsrc);
- }
- priv->callbacks = *callbacks;
- priv->user_data = user_data;
- priv->notify = notify;
- GST_OBJECT_UNLOCK (appsrc);
-}
-
-/*** GSTURIHANDLER INTERFACE *************************************************/
-
-static GstURIType
-gst_app_src_uri_get_type (void)
-{
- return GST_URI_SRC;
-}
-
-static gchar **
-gst_app_src_uri_get_protocols (void)
-{
- static gchar *protocols[] = { "appsrc", NULL };
-
- return protocols;
-}
-
-static const gchar *
-gst_app_src_uri_get_uri (GstURIHandler * handler)
-{
- return "appsrc";
-}
-
-static gboolean
-gst_app_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
-{
- gchar *protocol;
- gboolean ret;
-
- protocol = gst_uri_get_protocol (uri);
- ret = !strcmp (protocol, "appsrc");
- g_free (protocol);
-
- return ret;
-}
-
-static void
-gst_app_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
-{
- GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
-
- iface->get_type = gst_app_src_uri_get_type;
- iface->get_protocols = gst_app_src_uri_get_protocols;
- iface->get_uri = gst_app_src_uri_get_uri;
- iface->set_uri = gst_app_src_uri_set_uri;
-}
diff --git a/gst-libs/gst/app/gstappsrc.h b/gst-libs/gst/app/gstappsrc.h
deleted file mode 100644
index a1e09f7a..00000000
--- a/gst-libs/gst/app/gstappsrc.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _GST_APP_SRC_H_
-#define _GST_APP_SRC_H_
-
-#include <gst/gst.h>
-#include <gst/base/gstpushsrc.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))
-/* Since 0.10.23 */
-#define GST_APP_SRC_CAST(obj) \
- ((GstAppSrc*)(obj))
-
-typedef struct _GstAppSrc GstAppSrc;
-typedef struct _GstAppSrcClass GstAppSrcClass;
-typedef struct _GstAppSrcPrivate GstAppSrcPrivate;
-
-/**
- * GstAppSrcCallbacks:
- * @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
- * emited 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().
- *
- * Since: 0.10.23
- */
-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;
-
-struct _GstAppSrc
-{
- GstBaseSrc basesrc;
-
- /*< private >*/
- GstAppSrcPrivate *priv;
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
-};
-
-struct _GstAppSrcClass
-{
- GstBaseSrcClass basesrc_class;
-
- /* signals */
- void (*need_data) (GstAppSrc *src, guint length);
- void (*enough_data) (GstAppSrc *src);
- gboolean (*seek_data) (GstAppSrc *src, guint64 offset);
-
- /* actions */
- GstFlowReturn (*push_buffer) (GstAppSrc *src, GstBuffer *buffer);
- GstFlowReturn (*end_of_stream) (GstAppSrc *src);
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_app_src_get_type(void);
-
-void gst_app_src_set_caps (GstAppSrc *appsrc, const GstCaps *caps);
-GstCaps* gst_app_src_get_caps (GstAppSrc *appsrc);
-
-void gst_app_src_set_size (GstAppSrc *appsrc, gint64 size);
-gint64 gst_app_src_get_size (GstAppSrc *appsrc);
-
-void gst_app_src_set_stream_type (GstAppSrc *appsrc, GstAppStreamType type);
-GstAppStreamType gst_app_src_get_stream_type (GstAppSrc *appsrc);
-
-void gst_app_src_set_max_bytes (GstAppSrc *appsrc, guint64 max);
-guint64 gst_app_src_get_max_bytes (GstAppSrc *appsrc);
-
-void gst_app_src_set_latency (GstAppSrc *appsrc, guint64 min, guint64 max);
-void gst_app_src_get_latency (GstAppSrc *appsrc, guint64 *min, guint64 *max);
-
-void gst_app_src_set_emit_signals (GstAppSrc *appsrc, gboolean emit);
-gboolean gst_app_src_get_emit_signals (GstAppSrc *appsrc);
-
-GstFlowReturn gst_app_src_push_buffer (GstAppSrc *appsrc, GstBuffer *buffer);
-GstFlowReturn gst_app_src_end_of_stream (GstAppSrc *appsrc);
-
-void gst_app_src_set_callbacks (GstAppSrc * appsrc,
- GstAppSrcCallbacks *callbacks,
- gpointer user_data,
- GDestroyNotify notify);
-
-G_END_DECLS
-
-#endif
-
diff --git a/gst-libs/gst/audio/.gitignore b/gst-libs/gst/audio/.gitignore
deleted file mode 100644
index 1b3d8d62..00000000
--- a/gst-libs/gst/audio/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-libgstaudio_la-multichannel-enumtypes.lo
-audio-enumtypes.c
-audio-enumtypes.h
-testchannels
diff --git a/gst-libs/gst/audio/Makefile.am b/gst-libs/gst/audio/Makefile.am
deleted file mode 100644
index 555c9691..00000000
--- a/gst-libs/gst/audio/Makefile.am
+++ /dev/null
@@ -1,106 +0,0 @@
-# variables used for enum/marshal generation
-glib_enum_headers= \
- multichannel.h \
- gstringbuffer.h
-
-glib_enum_define = GST_AUDIO
-glib_gen_prefix = gst_audio
-glib_gen_basename = audio
-
-built_sources = audio-enumtypes.c
-built_headers = audio-enumtypes.h
-BUILT_SOURCES = $(built_sources) $(built_headers)
-
-lib_LTLIBRARIES = \
- libgstaudio-@GST_MAJORMINOR@.la
-
-CLEANFILES = $(BUILT_SOURCES)
-
-libgstaudio_@GST_MAJORMINOR@_la_SOURCES = \
- audio.c \
- gstringbuffer.c \
- gstaudioclock.c \
- mixerutils.c \
- multichannel.c \
- gstbaseaudiosink.c \
- gstbaseaudiosrc.c \
- gstaudiofilter.c \
- gstaudiosink.c \
- gstaudiosrc.c
-nodist_libgstaudio_@GST_MAJORMINOR@_la_SOURCES = $(built_sources) $(built_headers)
-
-libgstaudio_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/audio
-libgstaudio_@GST_MAJORMINOR@include_HEADERS = \
- audio.h \
- gstringbuffer.h \
- gstaudioclock.h \
- gstaudiofilter.h \
- gstbaseaudiosink.h \
- gstbaseaudiosrc.h \
- gstaudiosink.h \
- gstaudiosrc.h \
- mixerutils.h \
- multichannel.h
-
-nodist_libgstaudio_@GST_MAJORMINOR@include_HEADERS = \
- audio-enumtypes.h
-
-libgstaudio_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-libgstaudio_@GST_MAJORMINOR@_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la
-libgstaudio_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
-
-noinst_PROGRAMS = testchannels
-testchannels_SOURCES = testchannels.c
-testchannels_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-testchannels_LDADD = $(GST_LIBS)
-
-include $(top_srcdir)/common/gst-glib-gen.mak
-
-if HAVE_INTROSPECTION
-BUILT_GIRSOURCES = GstAudio-@GST_MAJORMINOR@.gir
-
-gir_headers=$(patsubst %,$(srcdir)/%, $(libgstaudio_@GST_MAJORMINOR@include_HEADERS))
-gir_headers+=$(patsubst %,$(builddir)/%, $(nodist_libgstaudio_@GST_MAJORMINOR@include_HEADERS))
-gir_sources=$(patsubst %,$(srcdir)/%, $(libgstaudio_@GST_MAJORMINOR@_la_SOURCES))
-gir_sources+=$(patsubst %,$(builddir)/%, $(nodist_libgstaudio_@GST_MAJORMINOR@_la_SOURCES))
-gir_cincludes=$(patsubst %,--c-include='gst/audio/%',$(libgstaudio_@GST_MAJORMINOR@include_HEADERS))
-gir_cincludes+=$(patsubst %,--c-include='gst/audio/%',$(nodist_libgstaudio_@GST_MAJORMINOR@include_HEADERS))
-
-GstAudio-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstaudio-@GST_MAJORMINOR@.la
- PKG_CONFIG_PATH="$(PKG_CONFIG_PATH):$(top_builddir)/pkgconfig" \
- $(INTROSPECTION_SCANNER) -v --namespace GstAudio \
- --nsversion=@GST_MAJORMINOR@ \
- --strip-prefix=Gst \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- $(gir_cincludes) \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-base-0.10` \
- --add-include-path=$(builddir)/../interfaces \
- --library=gstaudio-0.10 \
- --include=Gst-0.10 \
- --include=GstBase-0.10 \
- --include=GstInterfaces-0.10 \
- --libtool="$(top_builddir)/libtool" \
- --pkg gstreamer-0.10 \
- --pkg gstreamer-base-0.10 \
- --pkg gstreamer-interfaces-0.10 \
- --output $@ \
- $(gir_headers) \
- $(gir_sources)
-
-# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
-# install anything - we need to install inside our prefix.
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(BUILT_GIRSOURCES)
-
-typelibsdir = $(libdir)/girepository-1.0/
-
-typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
-
-%.typelib: %.gir $(INTROSPECTION_COMPILER)
- $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=$(builddir) --includedir=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst --includedir=`$(PKG_CONFIG) --variable=libdir gstreamer-base-0.10` --includedir=$(builddir)/../interfaces $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
-CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
-endif
diff --git a/gst-libs/gst/audio/TODO b/gst-libs/gst/audio/TODO
deleted file mode 100644
index 887f340b..00000000
--- a/gst-libs/gst/audio/TODO
+++ /dev/null
@@ -1,15 +0,0 @@
-TODO
-----
-
-- audio base classes:
- - GstBaseAudioSink
- - parse caps into rinbuffer spec, also make sure surround sound
- is parsed correctly.
- - implement seek/query/convert
- - implement getrange scheduling
- - simple resampling
- - more accurate master/slave calibration handling
- - faster audio cutoff when going to PAUSED
- - resubmit samples from ringbuffer when doing PAUSED->PLAYING again
- - the ringbuffer should have a state where it is filling up the
- buffer before going to playing.
diff --git a/gst-libs/gst/audio/audio.c b/gst-libs/gst/audio/audio.c
deleted file mode 100644
index 86b8885b..00000000
--- a/gst-libs/gst/audio/audio.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-/**
- * SECTION:gstaudio
- * @short_description: Support library for audio elements
- *
- * This library contains some helper functions for audio elements.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "audio.h"
-#include "audio-enumtypes.h"
-
-#include <gst/gststructure.h>
-
-/**
- * gst_audio_frame_byte_size:
- * @pad: the #GstPad to get the caps from
- *
- * Calculate byte size of an audio frame.
- *
- * Returns: the byte size, or 0 if there was an error
- */
-int
-gst_audio_frame_byte_size (GstPad * pad)
-{
- /* FIXME: this should be moved closer to the gstreamer core
- * and be implemented for every mime type IMO
- */
-
- int width = 0;
- int channels = 0;
- const GstCaps *caps = NULL;
- GstStructure *structure;
-
- /* get caps of pad */
- caps = GST_PAD_CAPS (pad);
-
- if (caps == NULL) {
- /* ERROR: could not get caps of pad */
- g_warning ("gstaudio: could not get caps of pad %s:%s\n",
- GST_DEBUG_PAD_NAME (pad));
- return 0;
- }
-
- structure = gst_caps_get_structure (caps, 0);
-
- gst_structure_get_int (structure, "width", &width);
- gst_structure_get_int (structure, "channels", &channels);
- return (width / 8) * channels;
-}
-
-/**
- * gst_audio_frame_length:
- * @pad: the #GstPad to get the caps from
- * @buf: the #GstBuffer
- *
- * Calculate length of buffer in frames.
- *
- * Returns: 0 if there's an error, or the number of frames if everything's ok
- */
-long
-gst_audio_frame_length (GstPad * pad, GstBuffer * buf)
-{
- /* FIXME: this should be moved closer to the gstreamer core
- * and be implemented for every mime type IMO
- */
- int frame_byte_size = 0;
-
- frame_byte_size = gst_audio_frame_byte_size (pad);
- if (frame_byte_size == 0)
- /* error */
- return 0;
- /* FIXME: this function assumes the buffer size to be a whole multiple
- * of the frame byte size
- */
- return GST_BUFFER_SIZE (buf) / frame_byte_size;
-}
-
-/**
- * gst_audio_duration_from_pad_buffer:
- * @pad: the #GstPad to get the caps from
- * @buf: the #GstBuffer
- *
- * Calculate length in nanoseconds of audio buffer @buf based on capabilities of
- * @pad.
- *
- * Returns: the length.
- */
-GstClockTime
-gst_audio_duration_from_pad_buffer (GstPad * pad, GstBuffer * buf)
-{
- long bytes = 0;
- int width = 0;
- int channels = 0;
- int rate = 0;
-
- GstClockTime length;
-
- const GstCaps *caps = NULL;
- GstStructure *structure;
-
- g_assert (GST_IS_BUFFER (buf));
- /* get caps of pad */
- caps = GST_PAD_CAPS (pad);
- if (caps == NULL) {
- /* ERROR: could not get caps of pad */
- g_warning ("gstaudio: could not get caps of pad %s:%s\n",
- GST_DEBUG_PAD_NAME (pad));
- length = GST_CLOCK_TIME_NONE;
- } else {
- structure = gst_caps_get_structure (caps, 0);
- bytes = GST_BUFFER_SIZE (buf);
- gst_structure_get_int (structure, "width", &width);
- gst_structure_get_int (structure, "channels", &channels);
- gst_structure_get_int (structure, "rate", &rate);
-
- g_assert (bytes != 0);
- g_assert (width != 0);
- g_assert (channels != 0);
- g_assert (rate != 0);
- length = (bytes * 8 * GST_SECOND) / (rate * channels * width);
- }
- return length;
-}
-
-/**
- * gst_audio_is_buffer_framed:
- * @pad: the #GstPad to get the caps from
- * @buf: the #GstBuffer
- *
- * Check if the buffer size is a whole multiple of the frame size.
- *
- * Returns: %TRUE if buffer size is multiple.
- */
-gboolean
-gst_audio_is_buffer_framed (GstPad * pad, GstBuffer * buf)
-{
- if (GST_BUFFER_SIZE (buf) % gst_audio_frame_byte_size (pad) == 0)
- return TRUE;
- else
- return FALSE;
-}
-
-/* _getcaps helper functions
- * sets structure fields to default for audio type
- * flag determines which structure fields to set to default
- * keep these functions in sync with the templates in audio.h
- */
-
-/* private helper function
- * sets a list on the structure
- * pass in structure, fieldname for the list, type of the list values,
- * number of list values, and each of the values, terminating with NULL
- */
-static void
-_gst_audio_structure_set_list (GstStructure * structure,
- const gchar * fieldname, GType type, int number, ...)
-{
- va_list varargs;
- GValue value = { 0 };
- GArray *array;
- int j;
-
- g_return_if_fail (structure != NULL);
-
- g_value_init (&value, GST_TYPE_LIST);
- array = g_value_peek_pointer (&value);
-
- va_start (varargs, number);
-
- for (j = 0; j < number; ++j) {
- int i;
- gboolean b;
-
- GValue list_value = { 0 };
-
- switch (type) {
- case G_TYPE_INT:
- i = va_arg (varargs, int);
-
- g_value_init (&list_value, G_TYPE_INT);
- g_value_set_int (&list_value, i);
- break;
- case G_TYPE_BOOLEAN:
- b = va_arg (varargs, gboolean);
- g_value_init (&list_value, G_TYPE_BOOLEAN);
- g_value_set_boolean (&list_value, b);
- break;
- default:
- g_warning
- ("_gst_audio_structure_set_list: LIST of given type not implemented.");
- }
- g_array_append_val (array, list_value);
-
- }
- gst_structure_set_value (structure, fieldname, &value);
- va_end (varargs);
-}
-
-/**
- * gst_audio_structure_set_int:
- * @structure: a #GstStructure
- * @flag: a set of #GstAudioFieldFlag
- *
- * Do not use anymore.
- *
- * Deprecated: use gst_structure_set()
- */
-#ifndef GST_REMOVE_DEPRECATED
-#ifdef GST_DISABLE_DEPRECATED
-typedef enum
-{
- GST_AUDIO_FIELD_RATE = (1 << 0),
- GST_AUDIO_FIELD_CHANNELS = (1 << 1),
- GST_AUDIO_FIELD_ENDIANNESS = (1 << 2),
- GST_AUDIO_FIELD_WIDTH = (1 << 3),
- GST_AUDIO_FIELD_DEPTH = (1 << 4),
- GST_AUDIO_FIELD_SIGNED = (1 << 5),
-} GstAudioFieldFlag;
-#endif /* GST_DISABLE_DEPRECATED */
-
-void
-gst_audio_structure_set_int (GstStructure * structure, GstAudioFieldFlag flag)
-{
- /* was added here:
- * http://webcvs.freedesktop.org/gstreamer/gst-plugins-base/gst-libs/gst/audio/audio.c?r1=1.16&r2=1.17
- * but it is not used
- */
- if (flag & GST_AUDIO_FIELD_RATE)
- gst_structure_set (structure, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
- NULL);
- if (flag & GST_AUDIO_FIELD_CHANNELS)
- gst_structure_set (structure, "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT,
- NULL);
- if (flag & GST_AUDIO_FIELD_ENDIANNESS)
- _gst_audio_structure_set_list (structure, "endianness", G_TYPE_INT, 2,
- G_LITTLE_ENDIAN, G_BIG_ENDIAN, NULL);
- if (flag & GST_AUDIO_FIELD_WIDTH)
- _gst_audio_structure_set_list (structure, "width", G_TYPE_INT, 3, 8, 16, 32,
- NULL);
- if (flag & GST_AUDIO_FIELD_DEPTH)
- gst_structure_set (structure, "depth", GST_TYPE_INT_RANGE, 1, 32, NULL);
- if (flag & GST_AUDIO_FIELD_SIGNED)
- _gst_audio_structure_set_list (structure, "signed", G_TYPE_BOOLEAN, 2, TRUE,
- FALSE, NULL);
-}
-#endif /* GST_REMOVE_DEPRECATED */
-
-/**
- * gst_audio_buffer_clip:
- * @buffer: The buffer to clip.
- * @segment: Segment in %GST_FORMAT_TIME or %GST_FORMAT_DEFAULT to which the buffer should be clipped.
- * @rate: sample rate.
- * @frame_size: size of one audio frame in bytes.
- *
- * Clip the the buffer to the given %GstSegment.
- *
- * After calling this function the caller does not own a reference to
- * @buffer anymore.
- *
- * Returns: %NULL if the buffer is completely outside the configured segment,
- * otherwise the clipped buffer is returned.
- *
- * If the buffer has no timestamp, it is assumed to be inside the segment and
- * is not clipped
- *
- * Since: 0.10.14
- */
-GstBuffer *
-gst_audio_buffer_clip (GstBuffer * buffer, GstSegment * segment, gint rate,
- gint frame_size)
-{
- GstBuffer *ret;
- GstClockTime timestamp = GST_CLOCK_TIME_NONE, duration = GST_CLOCK_TIME_NONE;
- guint64 offset = GST_BUFFER_OFFSET_NONE, offset_end = GST_BUFFER_OFFSET_NONE;
- guint8 *data;
- guint size;
-
- gboolean change_duration = TRUE, change_offset = TRUE, change_offset_end =
- TRUE;
-
- g_return_val_if_fail (segment->format == GST_FORMAT_TIME ||
- segment->format == GST_FORMAT_DEFAULT, buffer);
- g_return_val_if_fail (GST_IS_BUFFER (buffer), NULL);
-
- if (!GST_BUFFER_TIMESTAMP_IS_VALID (buffer))
- /* No timestamp - assume the buffer is completely in the segment */
- return buffer;
-
- /* Get copies of the buffer metadata to change later.
- * Calculate the missing values for the calculations,
- * they won't be changed later though. */
-
- data = GST_BUFFER_DATA (buffer);
- size = GST_BUFFER_SIZE (buffer);
-
- timestamp = GST_BUFFER_TIMESTAMP (buffer);
- if (GST_BUFFER_DURATION_IS_VALID (buffer)) {
- duration = GST_BUFFER_DURATION (buffer);
- } else {
- change_duration = FALSE;
- duration = gst_util_uint64_scale (size / frame_size, GST_SECOND, rate);
- }
-
- if (GST_BUFFER_OFFSET_IS_VALID (buffer)) {
- offset = GST_BUFFER_OFFSET (buffer);
- } else {
- change_offset = FALSE;
- offset = 0;
- }
-
- if (GST_BUFFER_OFFSET_END_IS_VALID (buffer)) {
- offset_end = GST_BUFFER_OFFSET_END (buffer);
- } else {
- change_offset_end = FALSE;
- offset_end = offset + size / frame_size;
- }
-
- if (segment->format == GST_FORMAT_TIME) {
- /* Handle clipping for GST_FORMAT_TIME */
-
- gint64 start, stop, cstart, cstop, diff;
-
- start = timestamp;
- stop = timestamp + duration;
-
- if (gst_segment_clip (segment, GST_FORMAT_TIME,
- start, stop, &cstart, &cstop)) {
-
- diff = cstart - start;
- if (diff > 0) {
- timestamp = cstart;
-
- if (change_duration)
- duration -= diff;
-
- diff = gst_util_uint64_scale (diff, rate, GST_SECOND);
- if (change_offset)
- offset += diff;
- data += diff * frame_size;
- size -= diff * frame_size;
- }
-
- diff = stop - cstop;
- if (diff > 0) {
- /* duration is always valid if stop is valid */
- duration -= diff;
-
- diff = gst_util_uint64_scale (diff, rate, GST_SECOND);
- if (change_offset_end)
- offset_end -= diff;
- size -= diff * frame_size;
- }
- } else {
- gst_buffer_unref (buffer);
- return NULL;
- }
- } else {
- /* Handle clipping for GST_FORMAT_DEFAULT */
- gint64 start, stop, cstart, cstop, diff;
-
- g_return_val_if_fail (GST_BUFFER_OFFSET_IS_VALID (buffer), buffer);
-
- start = offset;
- stop = offset_end;
-
- if (gst_segment_clip (segment, GST_FORMAT_DEFAULT,
- start, stop, &cstart, &cstop)) {
-
- diff = cstart - start;
- if (diff > 0) {
- offset = cstart;
-
- timestamp = gst_util_uint64_scale (cstart, GST_SECOND, rate);
-
- if (change_duration)
- duration -= gst_util_uint64_scale (diff, GST_SECOND, rate);
-
- data += diff * frame_size;
- size -= diff * frame_size;
- }
-
- diff = stop - cstop;
- if (diff > 0) {
- offset_end = cstop;
-
- if (change_duration)
- duration -= gst_util_uint64_scale (diff, GST_SECOND, rate);
-
- size -= diff * frame_size;
- }
- } else {
- gst_buffer_unref (buffer);
- return NULL;
- }
- }
-
- /* Get a metadata writable buffer and apply all changes */
- ret = gst_buffer_make_metadata_writable (buffer);
-
- GST_BUFFER_TIMESTAMP (ret) = timestamp;
- GST_BUFFER_SIZE (ret) = size;
- GST_BUFFER_DATA (ret) = data;
-
- if (change_duration)
- GST_BUFFER_DURATION (ret) = duration;
- if (change_offset)
- GST_BUFFER_OFFSET (ret) = offset;
- if (change_offset_end)
- GST_BUFFER_OFFSET_END (ret) = offset_end;
-
- return ret;
-}
diff --git a/gst-libs/gst/audio/audio.def b/gst-libs/gst/audio/audio.def
deleted file mode 100644
index 96a3ac06..00000000
--- a/gst-libs/gst/audio/audio.def
+++ /dev/null
@@ -1,5 +0,0 @@
-EXPORTS
- gst_plugin_desc
- gst_audio_length
- gst_audio_is_buffer_framed
- gst_audio_highest_sample_value
diff --git a/gst-libs/gst/audio/audio.h b/gst-libs/gst/audio/audio.h
deleted file mode 100644
index 12a12e00..00000000
--- a/gst-libs/gst/audio/audio.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Library <2001> Thomas Vander Stichele <thomas@apestaart.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <gst/gst.h>
-
-#ifndef __GST_AUDIO_AUDIO_H__
-#define __GST_AUDIO_AUDIO_H__
-
-G_BEGIN_DECLS
-
-/* For people that are looking at this source: the purpose of these defines is
- * to make GstCaps a bit easier, in that you don't have to know all of the
- * properties that need to be defined. you can just use these macros. currently
- * (8/01) the only plugins that use these are the passthrough, speed, volume,
- * adder, and [de]interleave plugins. These are for convenience only, and do not
- * specify the 'limits' of GStreamer. you might also use these definitions as a
- * base for making your own caps, if need be.
- *
- * For example, to make a source pad that can output streams of either mono
- * float or any channel int:
- *
- * template = gst_pad_template_new
- * ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
- * gst_caps_append(gst_caps_new ("sink_int", "audio/x-raw-int",
- * GST_AUDIO_INT_PAD_TEMPLATE_PROPS),
- * gst_caps_new ("sink_float", "audio/x-raw-float",
- * GST_AUDIO_FLOAT_PAD_TEMPLATE_PROPS)),
- * NULL);
- *
- * sinkpad = gst_pad_new_from_template(template, "sink");
- *
- * Andy Wingo, 18 August 2001
- * Thomas, 6 September 2002 */
-
-/* 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)
-
-/**
- * GST_AUDIO_DEF_RATE:
- *
- * Standard sampling rate used in consumer audio.
- */
-#define GST_AUDIO_DEF_RATE 44100
-
-/**
- * GST_AUDIO_INT_PAD_TEMPLATE_CAPS:
- *
- * Template caps for integer audio. Can be used when defining a
- * #GstStaticPadTemplate
- */
-#define GST_AUDIO_INT_PAD_TEMPLATE_CAPS \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
- "width = (int) { 8, 16, 24, 32 }, " \
- "depth = (int) [ 1, 32 ], " \
- "signed = (boolean) { true, false }"
-
-/**
- * GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS:
- *
- * Template caps for 16bit integer stereo audio in native byte-order.
- * Can be used when defining a #GstStaticPadTemplate
- */
-#define GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) 2, " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 16, " \
- "depth = (int) 16, " \
- "signed = (boolean) true"
-
-/**
- * GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS:
- *
- * Template caps for float audio. Can be used when defining a
- * #GstStaticPadTemplate
- */
-#define GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS \
- "audio/x-raw-float, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, " \
- "width = (int) { 32, 64 }"
-
-/**
- * GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS:
- *
- * Template caps for 32bit float mono audio in native byte-order.
- * Can be used when defining a #GstStaticPadTemplate
- */
-#define GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS \
- "audio/x-raw-float, " \
- "width = (int) 32, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) 1, " \
- "endianness = (int) BYTE_ORDER"
-
-/*
- * this library defines and implements some helper functions for audio
- * handling
- */
-
-/* get byte size of audio frame (based on caps of pad */
-int gst_audio_frame_byte_size (GstPad* pad);
-
-/* get length in frames of buffer */
-long gst_audio_frame_length (GstPad* pad, GstBuffer* buf);
-
-GstClockTime gst_audio_duration_from_pad_buffer (GstPad * pad, GstBuffer * buf);
-
-/* check if the buffer size is a whole multiple of the frame size */
-gboolean gst_audio_is_buffer_framed (GstPad* pad, GstBuffer* buf);
-
-/* functions useful for _getcaps functions */
-/**
- * GstAudioFieldFlag:
- *
- * Do not use anymore.
- *
- * Deprecated: use gst_structure_set() directly
- */
-#ifndef GST_DISABLE_DEPRECATED
-typedef enum {
- GST_AUDIO_FIELD_RATE = (1 << 0),
- GST_AUDIO_FIELD_CHANNELS = (1 << 1),
- GST_AUDIO_FIELD_ENDIANNESS = (1 << 2),
- GST_AUDIO_FIELD_WIDTH = (1 << 3),
- GST_AUDIO_FIELD_DEPTH = (1 << 4),
- GST_AUDIO_FIELD_SIGNED = (1 << 5)
-} GstAudioFieldFlag;
-#endif
-
-#ifndef GST_DISABLE_DEPRECATED
-void gst_audio_structure_set_int (GstStructure *structure, GstAudioFieldFlag flag);
-#endif /* GST_DISABLE_DEPRECATED */
-
-GstBuffer *gst_audio_buffer_clip (GstBuffer *buffer, GstSegment *segment, gint rate, gint frame_size);
-
-G_END_DECLS
-
-#endif /* __GST_AUDIO_AUDIO_H__ */
diff --git a/gst-libs/gst/audio/audio.vcproj b/gst-libs/gst/audio/audio.vcproj
deleted file mode 100644
index 21115317..00000000
--- a/gst-libs/gst/audio/audio.vcproj
+++ /dev/null
@@ -1,153 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="audio"
- ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D67893}"
- RootNamespace="audio"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../../win32/Debug"
- IntermediateDirectory="../../../win32/Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;AUDIO_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstaudio.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../../gstreamer/win32/Debug;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
- ModuleDefinitionFile="audio.def"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/audio.pdb"
- SubSystem="2"
- OptimizeReferences="2"
- ImportLibrary="$(OutDir)/gstaudio.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../../win32/Release"
- IntermediateDirectory="../../../win32/Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;AUDIO_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstaudio.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../../gstreamer/win32/Release;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
- ModuleDefinitionFile="audio.def"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/gstaudio.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath=".\audio.c">
- </File>
- <File
- RelativePath=".\audio.def">
- </File>
- <File
- RelativePath=".\audioclock.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- <File
- RelativePath=".\audio.h">
- </File>
- <File
- RelativePath=".\audioclock.h">
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/gst-libs/gst/audio/audiofilter.vcproj b/gst-libs/gst/audio/audiofilter.vcproj
deleted file mode 100644
index d5512606..00000000
--- a/gst-libs/gst/audio/audiofilter.vcproj
+++ /dev/null
@@ -1,144 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="audiofilter"
- ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D67894}"
- RootNamespace="audiofilter"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../../win32/Debug"
- IntermediateDirectory="../../../win32/Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;AUDIOFILTER_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstaudiofilter.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../../gstreamer/win32/Debug;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
- ModuleDefinitionFile="audio.def"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/audiofilter.pdb"
- SubSystem="2"
- OptimizeReferences="2"
- ImportLibrary="$(OutDir)/gstaudiofilter.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../../win32/Release"
- IntermediateDirectory="../../../win32/Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;AUDIOFILTER_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstaudiofilter.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../../gstreamer/win32/Release;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
- ModuleDefinitionFile="audio.def"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/gstaudiofilter.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath=".\gstaudiofilter.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- <File
- RelativePath=".\gstaudiofilter.h">
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/gst-libs/gst/audio/gstaudioclock.c b/gst-libs/gst/audio/gstaudioclock.c
deleted file mode 100644
index 16e76351..00000000
--- a/gst-libs/gst/audio/gstaudioclock.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2000 Wim Taymans <wtay@chello.be>
- *
- * audioclock.c: 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstaudioclock
- * @short_description: Helper object for implementing audio clocks
- * @see_also: #GstBaseAudioSink, #GstSystemClock
- *
- * #GstAudioClock makes it easy for elements to implement a #GstClock, they
- * simply need to provide a function that returns the current clock time.
- *
- * This object is internally used to implement the clock in #GstBaseAudioSink.
- *
- * Last reviewed on 2006-09-27 (0.10.12)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstaudioclock.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_audio_clock_debug);
-#define GST_CAT_DEFAULT gst_audio_clock_debug
-
-static void gst_audio_clock_class_init (GstAudioClockClass * klass);
-static void gst_audio_clock_init (GstAudioClock * clock);
-
-static GstClockTime gst_audio_clock_get_internal_time (GstClock * clock);
-
-static GstSystemClockClass *parent_class = NULL;
-
-/* static guint gst_audio_clock_signals[LAST_SIGNAL] = { 0 }; */
-
-GType
-gst_audio_clock_get_type (void)
-{
- static GType clock_type = 0;
-
- if (!clock_type) {
- static const GTypeInfo clock_info = {
- sizeof (GstAudioClockClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_audio_clock_class_init,
- NULL,
- NULL,
- sizeof (GstAudioClock),
- 4,
- (GInstanceInitFunc) gst_audio_clock_init,
- NULL
- };
-
- clock_type = g_type_register_static (GST_TYPE_SYSTEM_CLOCK, "GstAudioClock",
- &clock_info, 0);
- }
- return clock_type;
-}
-
-
-static void
-gst_audio_clock_class_init (GstAudioClockClass * klass)
-{
- GstClockClass *gstclock_class;
-
- gstclock_class = (GstClockClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gstclock_class->get_internal_time = gst_audio_clock_get_internal_time;
-
- GST_DEBUG_CATEGORY_INIT (gst_audio_clock_debug, "audioclock", 0,
- "audioclock");
-}
-
-static void
-gst_audio_clock_init (GstAudioClock * clock)
-{
- GST_DEBUG_OBJECT (clock, "init");
- clock->last_time = 0;
- clock->abidata.ABI.time_offset = 0;
- GST_OBJECT_FLAG_SET (clock, GST_CLOCK_FLAG_CAN_SET_MASTER);
-}
-
-/**
- * gst_audio_clock_new:
- * @name: the name of the clock
- * @func: a function
- * @user_data: user data
- *
- * Create a new #GstAudioClock instance. Whenever the clock time should be
- * calculated it will call @func with @user_data. When @func returns
- * #GST_CLOCK_TIME_NONE, the clock will return the last reported time.
- *
- * Returns: a new #GstAudioClock casted to a #GstClock.
- */
-GstClock *
-gst_audio_clock_new (const gchar * name, GstAudioClockGetTimeFunc func,
- gpointer user_data)
-{
- GstAudioClock *aclock =
- GST_AUDIO_CLOCK (g_object_new (GST_TYPE_AUDIO_CLOCK, "name", name, NULL));
-
- aclock->func = func;
- aclock->user_data = user_data;
-
- return (GstClock *) aclock;
-}
-
-/**
- * gst_audio_clock_reset:
- * @clock: a #GstAudioClock
- * @time: a #GstClockTime
- *
- * Inform @clock that future calls to #GstAudioClockGetTimeFunc will return values
- * starting from @time. The clock will update an internal offset to make sure that
- * future calls to internal_time will return an increasing result as required by
- * the #GstClock object.
- */
-void
-gst_audio_clock_reset (GstAudioClock * clock, GstClockTime time)
-{
- GstClockTimeDiff time_offset;
-
- if (clock->last_time >= time)
- time_offset = clock->last_time - time;
- else
- time_offset = -(time - clock->last_time);
-
- clock->abidata.ABI.time_offset = time_offset;
-
- GST_DEBUG_OBJECT (clock,
- "reset clock to %" GST_TIME_FORMAT ", last %" GST_TIME_FORMAT ", offset %"
- GST_TIME_FORMAT, GST_TIME_ARGS (time), GST_TIME_ARGS (clock->last_time),
- GST_TIME_ARGS (time_offset));
-}
-
-static GstClockTime
-gst_audio_clock_get_internal_time (GstClock * clock)
-{
- GstAudioClock *aclock;
- GstClockTime result;
-
- aclock = GST_AUDIO_CLOCK_CAST (clock);
-
- result = aclock->func (clock, aclock->user_data);
- if (result == GST_CLOCK_TIME_NONE) {
- result = aclock->last_time;
- } else {
- result += aclock->abidata.ABI.time_offset;
- /* clock must be increasing */
- if (aclock->last_time < result)
- aclock->last_time = result;
- else
- result = aclock->last_time;
- }
-
- GST_DEBUG_OBJECT (clock,
- "result %" GST_TIME_FORMAT ", last_time %" GST_TIME_FORMAT,
- GST_TIME_ARGS (result), GST_TIME_ARGS (aclock->last_time));
-
- return result;
-}
-
-/**
- * gst_audio_clock_get_time:
- * @clock: a #GstAudioClock
- *
- * Report the time as returned by the #GstAudioClockGetTimeFunc without applying
- * any offsets.
- *
- * Returns: the time as reported by the time function of the audio clock
- *
- * Since: 0.10.23
- */
-GstClockTime
-gst_audio_clock_get_time (GstClock * clock)
-{
- GstAudioClock *aclock;
- GstClockTime result;
-
- aclock = GST_AUDIO_CLOCK_CAST (clock);
-
- result = aclock->func (clock, aclock->user_data);
- if (result == GST_CLOCK_TIME_NONE) {
- GST_DEBUG_OBJECT (clock, "no time, reuse last");
- result = aclock->last_time - aclock->abidata.ABI.time_offset;
- }
-
- GST_DEBUG_OBJECT (clock,
- "result %" GST_TIME_FORMAT ", last_time %" GST_TIME_FORMAT,
- GST_TIME_ARGS (result), GST_TIME_ARGS (aclock->last_time));
-
- return result;
-}
-
-/**
- * gst_audio_clock_adjust:
- * @clock: a #GstAudioClock
- * @time: a #GstClockTime
- *
- * Adjust @time with the internal offset of the audio clock.
- *
- * Returns: @time adjusted with the internal offset.
- *
- * Since: 0.10.23
- */
-GstClockTime
-gst_audio_clock_adjust (GstClock * clock, GstClockTime time)
-{
- GstAudioClock *aclock;
- GstClockTime result;
-
- aclock = GST_AUDIO_CLOCK_CAST (clock);
-
- result = time + aclock->abidata.ABI.time_offset;
-
- return result;
-}
diff --git a/gst-libs/gst/audio/gstaudioclock.h b/gst-libs/gst/audio/gstaudioclock.h
deleted file mode 100644
index 60365289..00000000
--- a/gst-libs/gst/audio/gstaudioclock.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#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:
- * @clock: parent #GstSystemClock
- *
- * Opaque #GstAudioClock.
- */
-struct _GstAudioClock {
- GstSystemClock clock;
-
- /* --- protected --- */
- GstAudioClockGetTimeFunc func;
- gpointer user_data;
-
- GstClockTime last_time;
-
- /*< private >*/
- union {
- struct {
- GstClockTimeDiff time_offset;
- } ABI;
- /* adding + 0 to mark ABI change to be undone later */
- gpointer _gst_reserved[GST_PADDING + 0];
- } abidata;
-};
-
-struct _GstAudioClockClass {
- GstSystemClockClass parent_class;
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_audio_clock_get_type (void);
-GstClock* gst_audio_clock_new (const gchar *name, GstAudioClockGetTimeFunc func,
- gpointer user_data);
-void gst_audio_clock_reset (GstAudioClock *clock, GstClockTime time);
-
-GstClockTime gst_audio_clock_get_time (GstClock * clock);
-GstClockTime gst_audio_clock_adjust (GstClock * clock, GstClockTime time);
-
-G_END_DECLS
-
-#endif /* __GST_AUDIO_CLOCK_H__ */
diff --git a/gst-libs/gst/audio/gstaudiofilter.c b/gst-libs/gst/audio/gstaudiofilter.c
deleted file mode 100644
index ca928d6e..00000000
--- a/gst-libs/gst/audio/gstaudiofilter.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/* GStreamer audio filter base class
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) <2003> David Schleef <ds@schleef.org>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstaudiofilter
- * @short_description: Base class for simple audio filters
- *
- * #GstAudioFilter is a #GstBaseTransform-derived base class for simple audio
- * filters, ie. those that output the same format that they get as input.
- *
- * #GstAudioFilter will parse the input format for you (with error checking)
- * before calling your setup function. Also, elements deriving from
- * #GstAudioFilter may use gst_audio_filter_class_add_pad_templates() from
- * their base_init function to easily configure the set of caps/formats that
- * the element is able to handle.
- *
- * Derived classes should override the #GstAudioFilterClass.setup() and
- * #GstBaseTransformClass.transform_ip() and/or
- * #GstBaseTransformClass.transform()
- * virtual functions in their class_init function.
- *
- * Last reviewed on 2007-02-03 (0.10.11.1)
- *
- * Since: 0.10.12
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstaudiofilter.h"
-
-#include <string.h>
-
-GST_DEBUG_CATEGORY_STATIC (audiofilter_dbg);
-#define GST_CAT_DEFAULT audiofilter_dbg
-
-static GstStateChangeReturn gst_audio_filter_change_state (GstElement * element,
- GstStateChange transition);
-static gboolean gst_audio_filter_set_caps (GstBaseTransform * btrans,
- GstCaps * incaps, GstCaps * outcaps);
-static gboolean gst_audio_filter_get_unit_size (GstBaseTransform * btrans,
- GstCaps * caps, guint * size);
-
-#define do_init G_STMT_START { \
- GST_DEBUG_CATEGORY_INIT (audiofilter_dbg, "audiofilter", 0, "audiofilter"); \
-} G_STMT_END
-
-G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstAudioFilter, gst_audio_filter,
- GST_TYPE_BASE_TRANSFORM, do_init);
-
-static void
-gst_audio_filter_class_init (GstAudioFilterClass * klass)
-{
- GstBaseTransformClass *basetrans_class = (GstBaseTransformClass *) klass;
- GstElementClass *gstelement_class = (GstElementClass *) klass;
-
- gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_audio_filter_change_state);
- basetrans_class->set_caps = GST_DEBUG_FUNCPTR (gst_audio_filter_set_caps);
- basetrans_class->get_unit_size =
- GST_DEBUG_FUNCPTR (gst_audio_filter_get_unit_size);
-
- /* FIXME: Ref the GstRingerBuffer class to get it's debug category
- * initialized. gst_ring_buffer_parse_caps () which we use later
- * uses this debug category.
- */
- g_type_class_ref (GST_TYPE_RING_BUFFER);
-}
-
-static void
-gst_audio_filter_init (GstAudioFilter * self)
-{
- /* nothing to do here */
-}
-
-/* we override the state change vfunc here instead of GstBaseTransform's stop
- * vfunc, so GstAudioFilter-derived elements can override ::stop() for their
- * own purposes without having to worry about chaining up */
-static GstStateChangeReturn
-gst_audio_filter_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret;
- GstAudioFilter *filter = GST_AUDIO_FILTER (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- memset (&filter->format, 0, sizeof (GstRingBufferSpec));
- /* to make gst_buffer_spec_parse_caps() happy */
- filter->format.latency_time = GST_SECOND;
- break;
- default:
- break;
- }
-
- ret =
- GST_ELEMENT_CLASS (gst_audio_filter_parent_class)->change_state (element,
- transition);
- if (ret == GST_STATE_CHANGE_FAILURE)
- return ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- case GST_STATE_CHANGE_READY_TO_NULL:
- gst_caps_replace (&filter->format.caps, NULL);
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-static gboolean
-gst_audio_filter_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
- GstCaps * outcaps)
-{
- GstAudioFilterClass *klass;
- GstAudioFilter *filter = GST_AUDIO_FILTER (btrans);
- gboolean ret = TRUE;
-
- GST_LOG_OBJECT (filter, "caps: %" GST_PTR_FORMAT, incaps);
-
- if (!gst_ring_buffer_parse_caps (&filter->format, incaps)) {
- GST_WARNING_OBJECT (filter, "couldn't parse %" GST_PTR_FORMAT, incaps);
- return FALSE;
- }
-
- klass = GST_AUDIO_FILTER_CLASS_CAST (G_OBJECT_GET_CLASS (filter));
-
- if (klass->setup)
- ret = klass->setup (filter, &filter->format);
-
- return ret;
-}
-
-static gboolean
-gst_audio_filter_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
- guint * size)
-{
- GstStructure *structure;
- gboolean ret = TRUE;
- gint width, channels;
-
- structure = gst_caps_get_structure (caps, 0);
-
- ret &= gst_structure_get_int (structure, "width", &width);
- ret &= gst_structure_get_int (structure, "channels", &channels);
-
- if (ret)
- *size = (width / 8) * channels;
-
- return ret;
-}
-
-/**
- * gst_audio_filter_class_add_pad_templates:
- * @klass: an #GstAudioFilterClass
- * @allowed_caps: what formats the filter can handle, as #GstCaps
- *
- * Convenience function to add pad templates to this element class, with
- * @allowed_caps as the caps that can be handled.
- *
- * This function is usually used from within a GObject base_init function.
- *
- * Since: 0.10.12
- */
-void
-gst_audio_filter_class_add_pad_templates (GstAudioFilterClass * klass,
- const GstCaps * allowed_caps)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- GstPadTemplate *pad_template;
-
- g_return_if_fail (GST_IS_AUDIO_FILTER_CLASS (klass));
- g_return_if_fail (GST_IS_CAPS (allowed_caps));
-
- pad_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
- gst_caps_copy (allowed_caps));
- gst_element_class_add_pad_template (element_class, pad_template);
- gst_object_unref (pad_template);
-
- pad_template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
- gst_caps_copy (allowed_caps));
- gst_element_class_add_pad_template (element_class, pad_template);
- gst_object_unref (pad_template);
-}
diff --git a/gst-libs/gst/audio/gstaudiofilter.h b/gst-libs/gst/audio/gstaudiofilter.h
deleted file mode 100644
index c311c979..00000000
--- a/gst-libs/gst/audio/gstaudiofilter.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_AUDIO_FILTER_H__
-#define __GST_AUDIO_FILTER_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
-#include <gst/audio/gstringbuffer.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_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:
- * @basetransform: Element parent class
- *
- * Base class for audio filters with the same format for input and output.
- *
- * Since: 0.10.12
- */
-struct _GstAudioFilter {
- GstBaseTransform basetransform;
-
- /*< protected >*/
- GstRingBufferSpec format; /* currently configured format */
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
-};
-
-/**
- * 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.
- *
- * Since: 0.10.12
- */
-
-struct _GstAudioFilterClass {
- GstBaseTransformClass basetransformclass;
-
- /* virtual function, called whenever the format changes */
- gboolean (*setup) (GstAudioFilter * filter, GstRingBufferSpec * format);
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_audio_filter_get_type (void);
-
-void gst_audio_filter_class_add_pad_templates (GstAudioFilterClass * klass,
- const GstCaps * allowed_caps);
-
-G_END_DECLS
-
-#endif /* __GST_AUDIO_FILTER_H__ */
-
diff --git a/gst-libs/gst/audio/gstaudiosink.c b/gst-libs/gst/audio/gstaudiosink.c
deleted file mode 100644
index ce919af5..00000000
--- a/gst-libs/gst/audio/gstaudiosink.c
+++ /dev/null
@@ -1,619 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2005 Wim Taymans <wim@fluendo.com>
- *
- * gstaudiosink.c: simple audio sink 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstaudiosink
- * @short_description: Simple base class for audio sinks
- * @see_also: #GstBaseAudioSink, #GstRingBuffer, #GstAudioSink.
- *
- * This is the most simple base class for audio sinks that only requires
- * subclasses to implement a set of simple functions:
- *
- * <variablelist>
- * <varlistentry>
- * <term>open()</term>
- * <listitem><para>Open the device.</para></listitem>
- * </varlistentry>
- * <varlistentry>
- * <term>prepare()</term>
- * <listitem><para>Configure the device with the specified format.</para></listitem>
- * </varlistentry>
- * <varlistentry>
- * <term>write()</term>
- * <listitem><para>Write samples to the device.</para></listitem>
- * </varlistentry>
- * <varlistentry>
- * <term>reset()</term>
- * <listitem><para>Unblock writes and flush the device.</para></listitem>
- * </varlistentry>
- * <varlistentry>
- * <term>delay()</term>
- * <listitem><para>Get the number of samples written but not yet played
- * by the device.</para></listitem>
- * </varlistentry>
- * <varlistentry>
- * <term>unprepare()</term>
- * <listitem><para>Undo operations done by prepare.</para></listitem>
- * </varlistentry>
- * <varlistentry>
- * <term>close()</term>
- * <listitem><para>Close the device.</para></listitem>
- * </varlistentry>
- * </variablelist>
- *
- * All scheduling of samples and timestamps is done in this base class
- * together with #GstBaseAudioSink using a default implementation of a
- * #GstRingBuffer that uses threads.
- *
- * Last reviewed on 2006-09-27 (0.10.12)
- */
-
-#include <string.h>
-
-#include "gstaudiosink.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_audio_sink_debug);
-#define GST_CAT_DEFAULT gst_audio_sink_debug
-
-#define GST_TYPE_AUDIORING_BUFFER \
- (gst_audioringbuffer_get_type())
-#define GST_AUDIORING_BUFFER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIORING_BUFFER,GstAudioRingBuffer))
-#define GST_AUDIORING_BUFFER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIORING_BUFFER,GstAudioRingBufferClass))
-#define GST_AUDIORING_BUFFER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIORING_BUFFER, GstAudioRingBufferClass))
-#define GST_AUDIORING_BUFFER_CAST(obj) \
- ((GstAudioRingBuffer *)obj)
-#define GST_IS_AUDIORING_BUFFER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIORING_BUFFER))
-#define GST_IS_AUDIORING_BUFFER_CLASS(klass)\
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIORING_BUFFER))
-
-typedef struct _GstAudioRingBuffer GstAudioRingBuffer;
-typedef struct _GstAudioRingBufferClass GstAudioRingBufferClass;
-
-#define GST_AUDIORING_BUFFER_GET_COND(buf) (((GstAudioRingBuffer *)buf)->cond)
-#define GST_AUDIORING_BUFFER_WAIT(buf) (g_cond_wait (GST_AUDIORING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf)))
-#define GST_AUDIORING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_AUDIORING_BUFFER_GET_COND (buf)))
-#define GST_AUDIORING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_AUDIORING_BUFFER_GET_COND (buf)))
-
-struct _GstAudioRingBuffer
-{
- GstRingBuffer object;
-
- gboolean running;
- gint queuedseg;
-
- GCond *cond;
-};
-
-struct _GstAudioRingBufferClass
-{
- GstRingBufferClass parent_class;
-};
-
-static void gst_audioringbuffer_class_init (GstAudioRingBufferClass * klass);
-static void gst_audioringbuffer_init (GstAudioRingBuffer * ringbuffer,
- GstAudioRingBufferClass * klass);
-static void gst_audioringbuffer_dispose (GObject * object);
-static void gst_audioringbuffer_finalize (GObject * object);
-
-static GstRingBufferClass *ring_parent_class = NULL;
-
-static gboolean gst_audioringbuffer_open_device (GstRingBuffer * buf);
-static gboolean gst_audioringbuffer_close_device (GstRingBuffer * buf);
-static gboolean gst_audioringbuffer_acquire (GstRingBuffer * buf,
- GstRingBufferSpec * spec);
-static gboolean gst_audioringbuffer_release (GstRingBuffer * buf);
-static gboolean gst_audioringbuffer_start (GstRingBuffer * buf);
-static gboolean gst_audioringbuffer_pause (GstRingBuffer * buf);
-static gboolean gst_audioringbuffer_stop (GstRingBuffer * buf);
-static guint gst_audioringbuffer_delay (GstRingBuffer * buf);
-static gboolean gst_audioringbuffer_activate (GstRingBuffer * buf,
- gboolean active);
-
-/* ringbuffer abstract base class */
-static GType
-gst_audioringbuffer_get_type (void)
-{
- static GType ringbuffer_type = 0;
-
- if (!ringbuffer_type) {
- static const GTypeInfo ringbuffer_info = {
- sizeof (GstAudioRingBufferClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_audioringbuffer_class_init,
- NULL,
- NULL,
- sizeof (GstAudioRingBuffer),
- 0,
- (GInstanceInitFunc) gst_audioringbuffer_init,
- NULL
- };
-
- ringbuffer_type =
- g_type_register_static (GST_TYPE_RING_BUFFER, "GstAudioSinkRingBuffer",
- &ringbuffer_info, 0);
- }
- return ringbuffer_type;
-}
-
-static void
-gst_audioringbuffer_class_init (GstAudioRingBufferClass * klass)
-{
- GObjectClass *gobject_class;
- GstRingBufferClass *gstringbuffer_class;
-
- gobject_class = (GObjectClass *) klass;
- gstringbuffer_class = (GstRingBufferClass *) klass;
-
- ring_parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->dispose = gst_audioringbuffer_dispose;
- gobject_class->finalize = gst_audioringbuffer_finalize;
-
- gstringbuffer_class->open_device =
- GST_DEBUG_FUNCPTR (gst_audioringbuffer_open_device);
- gstringbuffer_class->close_device =
- GST_DEBUG_FUNCPTR (gst_audioringbuffer_close_device);
- gstringbuffer_class->acquire =
- GST_DEBUG_FUNCPTR (gst_audioringbuffer_acquire);
- gstringbuffer_class->release =
- GST_DEBUG_FUNCPTR (gst_audioringbuffer_release);
- gstringbuffer_class->start = GST_DEBUG_FUNCPTR (gst_audioringbuffer_start);
- gstringbuffer_class->pause = GST_DEBUG_FUNCPTR (gst_audioringbuffer_pause);
- gstringbuffer_class->resume = GST_DEBUG_FUNCPTR (gst_audioringbuffer_start);
- gstringbuffer_class->stop = GST_DEBUG_FUNCPTR (gst_audioringbuffer_stop);
-
- gstringbuffer_class->delay = GST_DEBUG_FUNCPTR (gst_audioringbuffer_delay);
- gstringbuffer_class->activate =
- GST_DEBUG_FUNCPTR (gst_audioringbuffer_activate);
-}
-
-typedef guint (*WriteFunc) (GstAudioSink * sink, gpointer data, guint length);
-
-/* this internal thread does nothing else but write samples to the audio device.
- * It will write each segment in the ringbuffer and will update the play
- * pointer.
- * The start/stop methods control the thread.
- */
-static void
-audioringbuffer_thread_func (GstRingBuffer * buf)
-{
- GstAudioSink *sink;
- GstAudioSinkClass *csink;
- GstAudioRingBuffer *abuf = GST_AUDIORING_BUFFER_CAST (buf);
- WriteFunc writefunc;
- GstMessage *message;
- GValue val = { 0 };
-
- sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf));
- csink = GST_AUDIO_SINK_GET_CLASS (sink);
-
- GST_DEBUG_OBJECT (sink, "enter thread");
-
- GST_OBJECT_LOCK (abuf);
- GST_DEBUG_OBJECT (sink, "signal wait");
- GST_AUDIORING_BUFFER_SIGNAL (buf);
- GST_OBJECT_UNLOCK (abuf);
-
- writefunc = csink->write;
- if (writefunc == NULL)
- goto no_function;
-
- g_value_init (&val, G_TYPE_POINTER);
- g_value_set_pointer (&val, sink->thread);
- message = gst_message_new_stream_status (GST_OBJECT_CAST (buf),
- GST_STREAM_STATUS_TYPE_ENTER, GST_ELEMENT_CAST (sink));
- gst_message_set_stream_status_object (message, &val);
- GST_DEBUG_OBJECT (sink, "posting ENTER stream status");
- gst_element_post_message (GST_ELEMENT_CAST (sink), message);
-
- while (TRUE) {
- gint left, len;
- guint8 *readptr;
- gint readseg;
-
- /* buffer must be started */
- if (gst_ring_buffer_prepare_read (buf, &readseg, &readptr, &len)) {
- gint written;
-
- left = len;
- do {
- written = writefunc (sink, readptr, left);
- GST_LOG_OBJECT (sink, "transfered %d bytes of %d from segment %d",
- written, left, readseg);
- if (written < 0 || written > left) {
- /* might not be critical, it e.g. happens when aborting playback */
- GST_WARNING_OBJECT (sink,
- "error writing data in %s (reason: %s), skipping segment (left: %d, written: %d)",
- GST_DEBUG_FUNCPTR_NAME (writefunc),
- (errno > 1 ? g_strerror (errno) : "unknown"), left, written);
- break;
- }
- left -= written;
- readptr += written;
- } while (left > 0);
-
- /* clear written samples */
- gst_ring_buffer_clear (buf, readseg);
-
- /* we wrote one segment */
- gst_ring_buffer_advance (buf, 1);
- } else {
- GST_OBJECT_LOCK (abuf);
- if (!abuf->running)
- goto stop_running;
- GST_DEBUG_OBJECT (sink, "signal wait");
- GST_AUDIORING_BUFFER_SIGNAL (buf);
- GST_DEBUG_OBJECT (sink, "wait for action");
- GST_AUDIORING_BUFFER_WAIT (buf);
- GST_DEBUG_OBJECT (sink, "got signal");
- if (!abuf->running)
- goto stop_running;
- GST_DEBUG_OBJECT (sink, "continue running");
- GST_OBJECT_UNLOCK (abuf);
- }
- }
-
- /* Will never be reached */
- g_assert_not_reached ();
- return;
-
- /* ERROR */
-no_function:
- {
- GST_DEBUG_OBJECT (sink, "no write function, exit thread");
- return;
- }
-stop_running:
- {
- GST_OBJECT_UNLOCK (abuf);
- GST_DEBUG_OBJECT (sink, "stop running, exit thread");
- message = gst_message_new_stream_status (GST_OBJECT_CAST (buf),
- GST_STREAM_STATUS_TYPE_LEAVE, GST_ELEMENT_CAST (sink));
- gst_message_set_stream_status_object (message, &val);
- GST_DEBUG_OBJECT (sink, "posting LEAVE stream status");
- gst_element_post_message (GST_ELEMENT_CAST (sink), message);
- return;
- }
-}
-
-static void
-gst_audioringbuffer_init (GstAudioRingBuffer * ringbuffer,
- GstAudioRingBufferClass * g_class)
-{
- ringbuffer->running = FALSE;
- ringbuffer->queuedseg = 0;
-
- ringbuffer->cond = g_cond_new ();
-}
-
-static void
-gst_audioringbuffer_dispose (GObject * object)
-{
- G_OBJECT_CLASS (ring_parent_class)->dispose (object);
-}
-
-static void
-gst_audioringbuffer_finalize (GObject * object)
-{
- GstAudioRingBuffer *ringbuffer = GST_AUDIORING_BUFFER_CAST (object);
-
- g_cond_free (ringbuffer->cond);
-
- G_OBJECT_CLASS (ring_parent_class)->finalize (object);
-}
-
-static gboolean
-gst_audioringbuffer_open_device (GstRingBuffer * buf)
-{
- GstAudioSink *sink;
- GstAudioSinkClass *csink;
- gboolean result = TRUE;
-
- sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf));
- csink = GST_AUDIO_SINK_GET_CLASS (sink);
-
- if (csink->open)
- result = csink->open (sink);
-
- if (!result)
- goto could_not_open;
-
- return result;
-
-could_not_open:
- {
- GST_DEBUG_OBJECT (sink, "could not open device");
- return FALSE;
- }
-}
-
-static gboolean
-gst_audioringbuffer_close_device (GstRingBuffer * buf)
-{
- GstAudioSink *sink;
- GstAudioSinkClass *csink;
- gboolean result = TRUE;
-
- sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf));
- csink = GST_AUDIO_SINK_GET_CLASS (sink);
-
- if (csink->close)
- result = csink->close (sink);
-
- if (!result)
- goto could_not_close;
-
- return result;
-
-could_not_close:
- {
- GST_DEBUG_OBJECT (sink, "could not close device");
- return FALSE;
- }
-}
-
-static gboolean
-gst_audioringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
-{
- GstAudioSink *sink;
- GstAudioSinkClass *csink;
- gboolean result = FALSE;
-
- sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf));
- csink = GST_AUDIO_SINK_GET_CLASS (sink);
-
- if (csink->prepare)
- result = csink->prepare (sink, spec);
- if (!result)
- goto could_not_prepare;
-
- /* set latency to one more segment as we need some headroom */
- spec->seglatency = spec->segtotal + 1;
-
- buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize);
- memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
-
- return TRUE;
-
- /* ERRORS */
-could_not_prepare:
- {
- GST_DEBUG_OBJECT (sink, "could not prepare device");
- return FALSE;
- }
-}
-
-static gboolean
-gst_audioringbuffer_activate (GstRingBuffer * buf, gboolean active)
-{
- GstAudioSink *sink;
- GstAudioRingBuffer *abuf;
- GError *error = NULL;
-
- sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf));
- abuf = GST_AUDIORING_BUFFER_CAST (buf);
-
- if (active) {
- abuf->running = TRUE;
-
- GST_DEBUG_OBJECT (sink, "starting thread");
- sink->thread =
- g_thread_create ((GThreadFunc) audioringbuffer_thread_func, buf, TRUE,
- &error);
- if (!sink->thread || error != NULL)
- goto thread_failed;
-
- GST_DEBUG_OBJECT (sink, "waiting for thread");
- /* the object lock is taken */
- GST_AUDIORING_BUFFER_WAIT (buf);
- GST_DEBUG_OBJECT (sink, "thread is started");
- } else {
- abuf->running = FALSE;
- GST_DEBUG_OBJECT (sink, "signal wait");
- GST_AUDIORING_BUFFER_SIGNAL (buf);
-
- GST_OBJECT_UNLOCK (buf);
-
- /* join the thread */
- g_thread_join (sink->thread);
-
- GST_OBJECT_LOCK (buf);
- }
- return TRUE;
-
- /* ERRORS */
-thread_failed:
- {
- if (error)
- GST_ERROR_OBJECT (sink, "could not create thread %s", error->message);
- else
- GST_ERROR_OBJECT (sink, "could not create thread for unknown reason");
- return FALSE;
- }
-}
-
-/* function is called with LOCK */
-static gboolean
-gst_audioringbuffer_release (GstRingBuffer * buf)
-{
- GstAudioSink *sink;
- GstAudioSinkClass *csink;
- gboolean result = FALSE;
-
- sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf));
- csink = GST_AUDIO_SINK_GET_CLASS (sink);
-
- /* free the buffer */
- gst_buffer_unref (buf->data);
- buf->data = NULL;
-
- if (csink->unprepare)
- result = csink->unprepare (sink);
-
- if (!result)
- goto could_not_unprepare;
-
- GST_DEBUG_OBJECT (sink, "unprepared");
-
- return result;
-
-could_not_unprepare:
- {
- GST_DEBUG_OBJECT (sink, "could not unprepare device");
- return FALSE;
- }
-}
-
-static gboolean
-gst_audioringbuffer_start (GstRingBuffer * buf)
-{
- GstAudioSink *sink;
-
- sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf));
-
- GST_DEBUG_OBJECT (sink, "start, sending signal");
- GST_AUDIORING_BUFFER_SIGNAL (buf);
-
- return TRUE;
-}
-
-static gboolean
-gst_audioringbuffer_pause (GstRingBuffer * buf)
-{
- GstAudioSink *sink;
- GstAudioSinkClass *csink;
-
- sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf));
- csink = GST_AUDIO_SINK_GET_CLASS (sink);
-
- /* unblock any pending writes to the audio device */
- if (csink->reset) {
- GST_DEBUG_OBJECT (sink, "reset...");
- csink->reset (sink);
- GST_DEBUG_OBJECT (sink, "reset done");
- }
-
- return TRUE;
-}
-
-static gboolean
-gst_audioringbuffer_stop (GstRingBuffer * buf)
-{
- GstAudioSink *sink;
- GstAudioSinkClass *csink;
-
- sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf));
- csink = GST_AUDIO_SINK_GET_CLASS (sink);
-
- /* unblock any pending writes to the audio device */
- if (csink->reset) {
- GST_DEBUG_OBJECT (sink, "reset...");
- csink->reset (sink);
- GST_DEBUG_OBJECT (sink, "reset done");
- }
-#if 0
- if (abuf->running) {
- GST_DEBUG_OBJECT (sink, "stop, waiting...");
- GST_AUDIORING_BUFFER_WAIT (buf);
- GST_DEBUG_OBJECT (sink, "stopped");
- }
-#endif
-
- return TRUE;
-}
-
-static guint
-gst_audioringbuffer_delay (GstRingBuffer * buf)
-{
- GstAudioSink *sink;
- GstAudioSinkClass *csink;
- guint res = 0;
-
- sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf));
- csink = GST_AUDIO_SINK_GET_CLASS (sink);
-
- if (csink->delay)
- res = csink->delay (sink);
-
- return res;
-}
-
-/* AudioSink signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- ARG_0,
-};
-
-#define _do_init(bla) \
- GST_DEBUG_CATEGORY_INIT (gst_audio_sink_debug, "audiosink", 0, "audiosink element");
-
-GST_BOILERPLATE_FULL (GstAudioSink, gst_audio_sink, GstBaseAudioSink,
- GST_TYPE_BASE_AUDIO_SINK, _do_init);
-
-static GstRingBuffer *gst_audio_sink_create_ringbuffer (GstBaseAudioSink *
- sink);
-
-static void
-gst_audio_sink_base_init (gpointer g_class)
-{
-}
-
-static void
-gst_audio_sink_class_init (GstAudioSinkClass * klass)
-{
- GstBaseAudioSinkClass *gstbaseaudiosink_class;
-
- gstbaseaudiosink_class = (GstBaseAudioSinkClass *) klass;
-
- gstbaseaudiosink_class->create_ringbuffer =
- GST_DEBUG_FUNCPTR (gst_audio_sink_create_ringbuffer);
-
- g_type_class_ref (GST_TYPE_AUDIORING_BUFFER);
-}
-
-static void
-gst_audio_sink_init (GstAudioSink * audiosink, GstAudioSinkClass * g_class)
-{
-}
-
-static GstRingBuffer *
-gst_audio_sink_create_ringbuffer (GstBaseAudioSink * sink)
-{
- GstRingBuffer *buffer;
-
- GST_DEBUG_OBJECT (sink, "creating ringbuffer");
- buffer = g_object_new (GST_TYPE_AUDIORING_BUFFER, NULL);
- GST_DEBUG_OBJECT (sink, "created ringbuffer @%p", buffer);
-
- return buffer;
-}
diff --git a/gst-libs/gst/audio/gstaudiosink.h b/gst-libs/gst/audio/gstaudiosink.h
deleted file mode 100644
index 83a4e952..00000000
--- a/gst-libs/gst/audio/gstaudiosink.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_AUDIO_SINK_H__
-#define __GST_AUDIO_SINK_H__
-
-#include <gst/gst.h>
-#include <gst/audio/gstbaseaudiosink.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;
-
-/**
- * GstAudioSink:
- *
- * Opaque #GstAudioSink.
- */
-struct _GstAudioSink {
- GstBaseAudioSink 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.
- * @delay: Return how many samples are still in the device. This is used to
- * drive the synchronisation.
- * @reset: Returns as quickly as possible from a write and flush any pending
- * samples from the device.
- *
- * #GstAudioSink class. Override the vmethods to implement functionality.
- */
-struct _GstAudioSinkClass {
- GstBaseAudioSinkClass 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, GstRingBufferSpec *spec);
- /* undo anything that was done in prepare() */
- gboolean (*unprepare) (GstAudioSink *sink);
- /* close the device */
- gboolean (*close) (GstAudioSink *sink);
- /* write samples to the device */
- /* FIXME 0.11: change return value to gint, as most implementation use that
- * already anyway */
- guint (*write) (GstAudioSink *sink, gpointer data, guint length);
- /* get number of samples queued in the device */
- guint (*delay) (GstAudioSink *sink);
- /* reset the audio device, unblock from a write */
- void (*reset) (GstAudioSink *sink);
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_audio_sink_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_AUDIO_SINK_H__ */
diff --git a/gst-libs/gst/audio/gstaudiosrc.c b/gst-libs/gst/audio/gstaudiosrc.c
deleted file mode 100644
index d7a6b547..00000000
--- a/gst-libs/gst/audio/gstaudiosrc.c
+++ /dev/null
@@ -1,532 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2005 Wim Taymans <wim@fluendo.com>
- *
- * gstaudiosrc.c: simple audio src 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstaudiosrc
- * @short_description: Simple base class for audio sources
- * @see_also: #GstBaseAudioSrc, #GstRingBuffer, #GstAudioSrc.
- *
- * This is the most simple base class for audio sources that only requires
- * subclasses to implement a set of simple functions:
- *
- * <variablelist>
- * <varlistentry>
- * <term>open()</term>
- * <listitem><para>Open the device.</para></listitem>
- * </varlistentry>
- * <varlistentry>
- * <term>prepare()</term>
- * <listitem><para>Configure the device with the specified format.</para></listitem>
- * </varlistentry>
- * <varlistentry>
- * <term>read()</term>
- * <listitem><para>Read samples from the device.</para></listitem>
- * </varlistentry>
- * <varlistentry>
- * <term>reset()</term>
- * <listitem><para>Unblock reads and flush the device.</para></listitem>
- * </varlistentry>
- * <varlistentry>
- * <term>delay()</term>
- * <listitem><para>Get the number of samples in the device but not yet read.
- * </para></listitem>
- * </varlistentry>
- * <varlistentry>
- * <term>unprepare()</term>
- * <listitem><para>Undo operations done by prepare.</para></listitem>
- * </varlistentry>
- * <varlistentry>
- * <term>close()</term>
- * <listitem><para>Close the device.</para></listitem>
- * </varlistentry>
- * </variablelist>
- *
- * All scheduling of samples and timestamps is done in this base class
- * together with #GstBaseAudioSrc using a default implementation of a
- * #GstRingBuffer that uses threads.
- *
- * Last reviewed on 2006-09-27 (0.10.12)
- */
-
-#include <string.h>
-
-#include "gstaudiosrc.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_audio_src_debug);
-#define GST_CAT_DEFAULT gst_audio_src_debug
-
-#define GST_TYPE_AUDIORING_BUFFER \
- (gst_audioringbuffer_get_type())
-#define GST_AUDIORING_BUFFER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIORING_BUFFER,GstAudioRingBuffer))
-#define GST_AUDIORING_BUFFER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIORING_BUFFER,GstAudioRingBufferClass))
-#define GST_AUDIORING_BUFFER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIORING_BUFFER, GstAudioRingBufferClass))
-#define GST_IS_AUDIORING_BUFFER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIORING_BUFFER))
-#define GST_IS_AUDIORING_BUFFER_CLASS(klass)\
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIORING_BUFFER))
-
-typedef struct _GstAudioRingBuffer GstAudioRingBuffer;
-typedef struct _GstAudioRingBufferClass GstAudioRingBufferClass;
-
-#define GST_AUDIORING_BUFFER_GET_COND(buf) (((GstAudioRingBuffer *)buf)->cond)
-#define GST_AUDIORING_BUFFER_WAIT(buf) (g_cond_wait (GST_AUDIORING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf)))
-#define GST_AUDIORING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_AUDIORING_BUFFER_GET_COND (buf)))
-#define GST_AUDIORING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_AUDIORING_BUFFER_GET_COND (buf)))
-
-struct _GstAudioRingBuffer
-{
- GstRingBuffer object;
-
- gboolean running;
- gint queuedseg;
-
- GCond *cond;
-};
-
-struct _GstAudioRingBufferClass
-{
- GstRingBufferClass parent_class;
-};
-
-static void gst_audioringbuffer_class_init (GstAudioRingBufferClass * klass);
-static void gst_audioringbuffer_init (GstAudioRingBuffer * ringbuffer,
- GstAudioRingBufferClass * klass);
-static void gst_audioringbuffer_dispose (GObject * object);
-static void gst_audioringbuffer_finalize (GObject * object);
-
-static GstRingBufferClass *ring_parent_class = NULL;
-
-static gboolean gst_audioringbuffer_open_device (GstRingBuffer * buf);
-static gboolean gst_audioringbuffer_close_device (GstRingBuffer * buf);
-static gboolean gst_audioringbuffer_acquire (GstRingBuffer * buf,
- GstRingBufferSpec * spec);
-static gboolean gst_audioringbuffer_release (GstRingBuffer * buf);
-static gboolean gst_audioringbuffer_start (GstRingBuffer * buf);
-static gboolean gst_audioringbuffer_stop (GstRingBuffer * buf);
-static guint gst_audioringbuffer_delay (GstRingBuffer * buf);
-
-/* ringbuffer abstract base class */
-static GType
-gst_audioringbuffer_get_type (void)
-{
- static GType ringbuffer_type = 0;
-
- if (!ringbuffer_type) {
- static const GTypeInfo ringbuffer_info = {
- sizeof (GstAudioRingBufferClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_audioringbuffer_class_init,
- NULL,
- NULL,
- sizeof (GstAudioRingBuffer),
- 0,
- (GInstanceInitFunc) gst_audioringbuffer_init,
- NULL
- };
-
- ringbuffer_type =
- g_type_register_static (GST_TYPE_RING_BUFFER, "GstAudioSrcRingBuffer",
- &ringbuffer_info, 0);
- }
- return ringbuffer_type;
-}
-
-static void
-gst_audioringbuffer_class_init (GstAudioRingBufferClass * klass)
-{
- GObjectClass *gobject_class;
- GstRingBufferClass *gstringbuffer_class;
-
- gobject_class = (GObjectClass *) klass;
- gstringbuffer_class = (GstRingBufferClass *) klass;
-
- ring_parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->dispose = gst_audioringbuffer_dispose;
- gobject_class->finalize = gst_audioringbuffer_finalize;
-
- gstringbuffer_class->open_device =
- GST_DEBUG_FUNCPTR (gst_audioringbuffer_open_device);
- gstringbuffer_class->close_device =
- GST_DEBUG_FUNCPTR (gst_audioringbuffer_close_device);
- gstringbuffer_class->acquire =
- GST_DEBUG_FUNCPTR (gst_audioringbuffer_acquire);
- gstringbuffer_class->release =
- GST_DEBUG_FUNCPTR (gst_audioringbuffer_release);
- gstringbuffer_class->start = GST_DEBUG_FUNCPTR (gst_audioringbuffer_start);
- gstringbuffer_class->resume = GST_DEBUG_FUNCPTR (gst_audioringbuffer_start);
- gstringbuffer_class->stop = GST_DEBUG_FUNCPTR (gst_audioringbuffer_stop);
-
- gstringbuffer_class->delay = GST_DEBUG_FUNCPTR (gst_audioringbuffer_delay);
-}
-
-typedef guint (*ReadFunc) (GstAudioSrc * src, gpointer data, guint length);
-
-/* this internal thread does nothing else but read samples from the audio device.
- * It will read each segment in the ringbuffer and will update the play
- * pointer.
- * The start/stop methods control the thread.
- */
-static void
-audioringbuffer_thread_func (GstRingBuffer * buf)
-{
- GstAudioSrc *src;
- GstAudioSrcClass *csrc;
- GstAudioRingBuffer *abuf = GST_AUDIORING_BUFFER (buf);
- ReadFunc readfunc;
- GstMessage *message;
- GValue val = { 0 };
-
- src = GST_AUDIO_SRC (GST_OBJECT_PARENT (buf));
- csrc = GST_AUDIO_SRC_GET_CLASS (src);
-
- GST_DEBUG_OBJECT (src, "enter thread");
-
- readfunc = csrc->read;
- if (readfunc == NULL)
- goto no_function;
-
- /* FIXME: maybe we should at least use a custom pointer type here? */
- g_value_init (&val, G_TYPE_POINTER);
- g_value_set_pointer (&val, src->thread);
- message = gst_message_new_stream_status (GST_OBJECT_CAST (buf),
- GST_STREAM_STATUS_TYPE_ENTER, GST_ELEMENT_CAST (src));
- gst_message_set_stream_status_object (message, &val);
- GST_DEBUG_OBJECT (src, "posting ENTER stream status");
- gst_element_post_message (GST_ELEMENT_CAST (src), message);
-
- while (TRUE) {
- gint left, len;
- guint8 *readptr;
- gint readseg;
-
- if (gst_ring_buffer_prepare_read (buf, &readseg, &readptr, &len)) {
- gint read;
-
- left = len;
- do {
- read = readfunc (src, readptr, left);
- GST_LOG_OBJECT (src, "transfered %d bytes of %d to segment %d", read,
- left, readseg);
- if (read < 0 || read > left) {
- GST_WARNING_OBJECT (src,
- "error reading data %d (reason: %s), skipping segment", read,
- g_strerror (errno));
- break;
- }
- left -= read;
- readptr += read;
- } while (left > 0);
-
- /* we read one segment */
- gst_ring_buffer_advance (buf, 1);
- } else {
- GST_OBJECT_LOCK (abuf);
- if (!abuf->running)
- goto stop_running;
- GST_DEBUG_OBJECT (src, "signal wait");
- GST_AUDIORING_BUFFER_SIGNAL (buf);
- GST_DEBUG_OBJECT (src, "wait for action");
- GST_AUDIORING_BUFFER_WAIT (buf);
- GST_DEBUG_OBJECT (src, "got signal");
- if (!abuf->running)
- goto stop_running;
- GST_DEBUG_OBJECT (src, "continue running");
- GST_OBJECT_UNLOCK (abuf);
- }
- }
-
- /* Will never be reached */
- g_assert_not_reached ();
- return;
-
- /* ERROR */
-no_function:
- {
- GST_DEBUG ("no write function, exit thread");
- return;
- }
-stop_running:
- {
- GST_OBJECT_UNLOCK (abuf);
- GST_DEBUG ("stop running, exit thread");
- message = gst_message_new_stream_status (GST_OBJECT_CAST (buf),
- GST_STREAM_STATUS_TYPE_LEAVE, GST_ELEMENT_CAST (src));
- gst_message_set_stream_status_object (message, &val);
- GST_DEBUG_OBJECT (src, "posting LEAVE stream status");
- gst_element_post_message (GST_ELEMENT_CAST (src), message);
- return;
- }
-}
-
-static void
-gst_audioringbuffer_init (GstAudioRingBuffer * ringbuffer,
- GstAudioRingBufferClass * g_class)
-{
- ringbuffer->running = FALSE;
- ringbuffer->queuedseg = 0;
-
- ringbuffer->cond = g_cond_new ();
-}
-
-static void
-gst_audioringbuffer_dispose (GObject * object)
-{
- GstAudioRingBuffer *ringbuffer = GST_AUDIORING_BUFFER (object);
-
- if (ringbuffer->cond) {
- g_cond_free (ringbuffer->cond);
- ringbuffer->cond = NULL;
- }
-
- G_OBJECT_CLASS (ring_parent_class)->dispose (object);
-}
-
-static void
-gst_audioringbuffer_finalize (GObject * object)
-{
- G_OBJECT_CLASS (ring_parent_class)->finalize (object);
-}
-
-static gboolean
-gst_audioringbuffer_open_device (GstRingBuffer * buf)
-{
- GstAudioSrc *src;
- GstAudioSrcClass *csrc;
- gboolean result = TRUE;
-
- src = GST_AUDIO_SRC (GST_OBJECT_PARENT (buf));
- csrc = GST_AUDIO_SRC_GET_CLASS (src);
-
- if (csrc->open)
- result = csrc->open (src);
-
- if (!result)
- goto could_not_open;
-
- return result;
-
-could_not_open:
- {
- return FALSE;
- }
-}
-
-static gboolean
-gst_audioringbuffer_close_device (GstRingBuffer * buf)
-{
- GstAudioSrc *src;
- GstAudioSrcClass *csrc;
- gboolean result = TRUE;
-
- src = GST_AUDIO_SRC (GST_OBJECT_PARENT (buf));
- csrc = GST_AUDIO_SRC_GET_CLASS (src);
-
- if (csrc->close)
- result = csrc->close (src);
-
- if (!result)
- goto could_not_open;
-
- return result;
-
-could_not_open:
- {
- return FALSE;
- }
-}
-
-static gboolean
-gst_audioringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
-{
- GstAudioSrc *src;
- GstAudioSrcClass *csrc;
- GstAudioRingBuffer *abuf;
- gboolean result = FALSE;
-
- src = GST_AUDIO_SRC (GST_OBJECT_PARENT (buf));
- csrc = GST_AUDIO_SRC_GET_CLASS (src);
-
- if (csrc->prepare)
- result = csrc->prepare (src, spec);
-
- if (!result)
- goto could_not_open;
-
- buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize);
- memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
-
- abuf = GST_AUDIORING_BUFFER (buf);
- abuf->running = TRUE;
-
- src->thread =
- g_thread_create ((GThreadFunc) audioringbuffer_thread_func, buf, TRUE,
- NULL);
- GST_AUDIORING_BUFFER_WAIT (buf);
-
- return result;
-
-could_not_open:
- {
- return FALSE;
- }
-}
-
-/* function is called with LOCK */
-static gboolean
-gst_audioringbuffer_release (GstRingBuffer * buf)
-{
- GstAudioSrc *src;
- GstAudioSrcClass *csrc;
- GstAudioRingBuffer *abuf;
- gboolean result = FALSE;
-
- src = GST_AUDIO_SRC (GST_OBJECT_PARENT (buf));
- csrc = GST_AUDIO_SRC_GET_CLASS (src);
- abuf = GST_AUDIORING_BUFFER (buf);
-
- abuf->running = FALSE;
- GST_AUDIORING_BUFFER_SIGNAL (buf);
- GST_OBJECT_UNLOCK (buf);
-
- /* join the thread */
- g_thread_join (src->thread);
-
- GST_OBJECT_LOCK (buf);
-
- /* free the buffer */
- gst_buffer_unref (buf->data);
- buf->data = NULL;
-
- if (csrc->unprepare)
- result = csrc->unprepare (src);
-
- return result;
-}
-
-static gboolean
-gst_audioringbuffer_start (GstRingBuffer * buf)
-{
- GST_DEBUG ("start, sending signal");
- GST_AUDIORING_BUFFER_SIGNAL (buf);
-
- return TRUE;
-}
-
-static gboolean
-gst_audioringbuffer_stop (GstRingBuffer * buf)
-{
- GstAudioSrc *src;
- GstAudioSrcClass *csrc;
-
- src = GST_AUDIO_SRC (GST_OBJECT_PARENT (buf));
- csrc = GST_AUDIO_SRC_GET_CLASS (src);
-
- /* unblock any pending writes to the audio device */
- if (csrc->reset) {
- GST_DEBUG ("reset...");
- csrc->reset (src);
- GST_DEBUG ("reset done");
- }
-#if 0
- GST_DEBUG ("stop, waiting...");
- GST_AUDIORING_BUFFER_WAIT (buf);
- GST_DEBUG ("stoped");
-#endif
-
- return TRUE;
-}
-
-static guint
-gst_audioringbuffer_delay (GstRingBuffer * buf)
-{
- GstAudioSrc *src;
- GstAudioSrcClass *csrc;
- guint res = 0;
-
- src = GST_AUDIO_SRC (GST_OBJECT_PARENT (buf));
- csrc = GST_AUDIO_SRC_GET_CLASS (src);
-
- if (csrc->delay)
- res = csrc->delay (src);
-
- return res;
-}
-
-/* AudioSrc signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- ARG_0,
-};
-
-#define _do_init(bla) \
- GST_DEBUG_CATEGORY_INIT (gst_audio_src_debug, "audiosrc", 0, "audiosrc element");
-
-GST_BOILERPLATE_FULL (GstAudioSrc, gst_audio_src, GstBaseAudioSrc,
- GST_TYPE_BASE_AUDIO_SRC, _do_init);
-
-static GstRingBuffer *gst_audio_src_create_ringbuffer (GstBaseAudioSrc * src);
-
-static void
-gst_audio_src_base_init (gpointer g_class)
-{
-}
-
-static void
-gst_audio_src_class_init (GstAudioSrcClass * klass)
-{
- GstBaseAudioSrcClass *gstbaseaudiosrc_class;
-
- gstbaseaudiosrc_class = (GstBaseAudioSrcClass *) klass;
-
- gstbaseaudiosrc_class->create_ringbuffer =
- GST_DEBUG_FUNCPTR (gst_audio_src_create_ringbuffer);
-
- g_type_class_ref (GST_TYPE_AUDIORING_BUFFER);
-}
-
-static void
-gst_audio_src_init (GstAudioSrc * audiosrc, GstAudioSrcClass * g_class)
-{
-}
-
-static GstRingBuffer *
-gst_audio_src_create_ringbuffer (GstBaseAudioSrc * src)
-{
- GstRingBuffer *buffer;
-
- GST_DEBUG ("creating ringbuffer");
- buffer = g_object_new (GST_TYPE_AUDIORING_BUFFER, NULL);
- GST_DEBUG ("created ringbuffer @%p", buffer);
-
- return buffer;
-}
diff --git a/gst-libs/gst/audio/gstaudiosrc.h b/gst-libs/gst/audio/gstaudiosrc.h
deleted file mode 100644
index d3b714dd..00000000
--- a/gst-libs/gst/audio/gstaudiosrc.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_AUDIO_SRC_H__
-#define __GST_AUDIO_SRC_H__
-
-#include <gst/gst.h>
-#include <gst/audio/gstbaseaudiosrc.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:
- * @element: parent class
- *
- * Base class for simple audio sources.
- */
-struct _GstAudioSrc {
- GstBaseAudioSrc 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 to the audio device
- * @delay: the number of samples queued in the device
- * @reset: unblock a read to the device and reset.
- *
- * #GstAudioSrc class. Override the vmethod to implement
- * functionality.
- */
-struct _GstAudioSrcClass {
- GstBaseAudioSrcClass 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, GstRingBufferSpec *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);
- /* get number of samples 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];
-};
-
-GType gst_audio_src_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_AUDIO_SRC_H__ */
diff --git a/gst-libs/gst/audio/gstbaseaudiosink.c b/gst-libs/gst/audio/gstbaseaudiosink.c
deleted file mode 100644
index fee7c95e..00000000
--- a/gst-libs/gst/audio/gstbaseaudiosink.c
+++ /dev/null
@@ -1,1898 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2005 Wim Taymans <wim@fluendo.com>
- *
- * gstbaseaudiosink.c:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-/**
- * SECTION:gstbaseaudiosink
- * @short_description: Base class for audio sinks
- * @see_also: #GstAudioSink, #GstRingBuffer.
- *
- * This is the base class for audio sinks. Subclasses need to implement the
- * ::create_ringbuffer vmethod. This base class will then take care of
- * writing samples to the ringbuffer, synchronisation, clipping and flushing.
- *
- * Last reviewed on 2006-09-27 (0.10.12)
- */
-
-#include <string.h>
-
-#include "gstbaseaudiosink.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_base_audio_sink_debug);
-#define GST_CAT_DEFAULT gst_base_audio_sink_debug
-
-#define GST_BASE_AUDIO_SINK_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BASE_AUDIO_SINK, GstBaseAudioSinkPrivate))
-
-struct _GstBaseAudioSinkPrivate
-{
- /* upstream latency */
- GstClockTime us_latency;
- /* the clock slaving algorithm in use */
- GstBaseAudioSinkSlaveMethod slave_method;
- /* running average of clock skew */
- GstClockTimeDiff avg_skew;
- /* the number of samples we aligned last time */
- gint64 last_align;
-
- gboolean sync_latency;
-
- GstClockTime eos_time;
-
- gboolean do_time_offset;
- /* number of microseconds we alow timestamps or clock slaving to drift
- * before resyncing */
- guint64 drift_tolerance;
-};
-
-/* BaseAudioSink signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-/* we tollerate half a second diff before we start resyncing. This
- * should be enough to compensate for various rounding errors in the timestamp
- * and sample offset position.
- * This is an emergency resync fallback since buffers marked as DISCONT will
- * always lock to the correct timestamp immediatly and buffers not marked as
- * DISCONT are contiguous by definition.
- */
-#define DIFF_TOLERANCE 2
-
-/* FIXME: 0.11, store the buffer_time and latency_time in nanoseconds */
-#define DEFAULT_BUFFER_TIME ((200 * GST_MSECOND) / GST_USECOND)
-#define DEFAULT_LATENCY_TIME ((10 * GST_MSECOND) / GST_USECOND)
-#define DEFAULT_PROVIDE_CLOCK TRUE
-#define DEFAULT_SLAVE_METHOD GST_BASE_AUDIO_SINK_SLAVE_SKEW
-
-/* FIXME, enable pull mode when clock slaving and trick modes are figured out */
-#define DEFAULT_CAN_ACTIVATE_PULL FALSE
-
-/* when timestamps or clock slaving drift for more than 20ms we resync. This is
- * a reasonable default */
-#define DEFAULT_DRIFT_TOLERANCE ((40 * GST_MSECOND) / GST_USECOND)
-
-enum
-{
- PROP_0,
-
- PROP_BUFFER_TIME,
- PROP_LATENCY_TIME,
- PROP_PROVIDE_CLOCK,
- PROP_SLAVE_METHOD,
- PROP_CAN_ACTIVATE_PULL,
- PROP_DRIFT_TOLERANCE,
-
- PROP_LAST
-};
-
-GType
-gst_base_audio_sink_slave_method_get_type (void)
-{
- static GType slave_method_type = 0;
- static const GEnumValue slave_method[] = {
- {GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE, "Resampling slaving", "resample"},
- {GST_BASE_AUDIO_SINK_SLAVE_SKEW, "Skew slaving", "skew"},
- {GST_BASE_AUDIO_SINK_SLAVE_NONE, "No slaving", "none"},
- {0, NULL, NULL},
- };
-
- if (!slave_method_type) {
- slave_method_type =
- g_enum_register_static ("GstBaseAudioSinkSlaveMethod", slave_method);
- }
- return slave_method_type;
-}
-
-
-#define _do_init(bla) \
- GST_DEBUG_CATEGORY_INIT (gst_base_audio_sink_debug, "baseaudiosink", 0, "baseaudiosink element");
-
-GST_BOILERPLATE_FULL (GstBaseAudioSink, gst_base_audio_sink, GstBaseSink,
- GST_TYPE_BASE_SINK, _do_init);
-
-static void gst_base_audio_sink_dispose (GObject * object);
-
-static void gst_base_audio_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_base_audio_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static GstStateChangeReturn gst_base_audio_sink_async_play (GstBaseSink *
- basesink);
-static GstStateChangeReturn gst_base_audio_sink_change_state (GstElement *
- element, GstStateChange transition);
-static gboolean gst_base_audio_sink_activate_pull (GstBaseSink * basesink,
- gboolean active);
-static gboolean gst_base_audio_sink_query (GstElement * element, GstQuery *
- query);
-
-static GstClock *gst_base_audio_sink_provide_clock (GstElement * elem);
-static GstClockTime gst_base_audio_sink_get_time (GstClock * clock,
- GstBaseAudioSink * sink);
-static void gst_base_audio_sink_callback (GstRingBuffer * rbuf, guint8 * data,
- guint len, gpointer user_data);
-
-static GstFlowReturn gst_base_audio_sink_preroll (GstBaseSink * bsink,
- GstBuffer * buffer);
-static GstFlowReturn gst_base_audio_sink_render (GstBaseSink * bsink,
- GstBuffer * buffer);
-static gboolean gst_base_audio_sink_event (GstBaseSink * bsink,
- GstEvent * event);
-static void gst_base_audio_sink_get_times (GstBaseSink * bsink,
- GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
-static gboolean gst_base_audio_sink_setcaps (GstBaseSink * bsink,
- GstCaps * caps);
-static void gst_base_audio_sink_fixate (GstBaseSink * bsink, GstCaps * caps);
-
-static gboolean gst_base_audio_sink_query_pad (GstPad * pad, GstQuery * query);
-
-
-/* static guint gst_base_audio_sink_signals[LAST_SIGNAL] = { 0 }; */
-
-static void
-gst_base_audio_sink_base_init (gpointer g_class)
-{
-}
-
-static void
-gst_base_audio_sink_class_init (GstBaseAudioSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- GstBaseSinkClass *gstbasesink_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
- gstbasesink_class = (GstBaseSinkClass *) klass;
-
- g_type_class_add_private (klass, sizeof (GstBaseAudioSinkPrivate));
-
- gobject_class->set_property = gst_base_audio_sink_set_property;
- gobject_class->get_property = gst_base_audio_sink_get_property;
- gobject_class->dispose = gst_base_audio_sink_dispose;
-
- g_object_class_install_property (gobject_class, PROP_BUFFER_TIME,
- g_param_spec_int64 ("buffer-time", "Buffer Time",
- "Size of audio buffer in microseconds", 1,
- G_MAXINT64, DEFAULT_BUFFER_TIME,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_LATENCY_TIME,
- g_param_spec_int64 ("latency-time", "Latency Time",
- "Audio latency in microseconds", 1,
- G_MAXINT64, DEFAULT_LATENCY_TIME,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_PROVIDE_CLOCK,
- g_param_spec_boolean ("provide-clock", "Provide Clock",
- "Provide a clock to be used as the global pipeline clock",
- DEFAULT_PROVIDE_CLOCK, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SLAVE_METHOD,
- g_param_spec_enum ("slave-method", "Slave Method",
- "Algorithm to use to match the rate of the masterclock",
- GST_TYPE_BASE_AUDIO_SINK_SLAVE_METHOD, DEFAULT_SLAVE_METHOD,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CAN_ACTIVATE_PULL,
- g_param_spec_boolean ("can-activate-pull", "Allow Pull Scheduling",
- "Allow pull-based scheduling", DEFAULT_CAN_ACTIVATE_PULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstBaseAudioSink:drift-tolerance
- *
- * Controls the amount of time in milliseconds that timestamps or clocks are allowed
- * to drift before resynchronisation happens.
- *
- * Since: 0.10.26
- */
- g_object_class_install_property (gobject_class, PROP_DRIFT_TOLERANCE,
- g_param_spec_int64 ("drift-tolerance", "Drift Tolerance",
- "Tolerance for timestamp and clock drift in microseconds", 1,
- G_MAXINT64, DEFAULT_DRIFT_TOLERANCE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_base_audio_sink_change_state);
- gstelement_class->provide_clock =
- GST_DEBUG_FUNCPTR (gst_base_audio_sink_provide_clock);
- gstelement_class->query = GST_DEBUG_FUNCPTR (gst_base_audio_sink_query);
-
- gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_base_audio_sink_event);
- gstbasesink_class->preroll = GST_DEBUG_FUNCPTR (gst_base_audio_sink_preroll);
- gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_base_audio_sink_render);
- gstbasesink_class->get_times =
- GST_DEBUG_FUNCPTR (gst_base_audio_sink_get_times);
- gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_base_audio_sink_setcaps);
- gstbasesink_class->fixate = GST_DEBUG_FUNCPTR (gst_base_audio_sink_fixate);
- gstbasesink_class->async_play =
- GST_DEBUG_FUNCPTR (gst_base_audio_sink_async_play);
- gstbasesink_class->activate_pull =
- GST_DEBUG_FUNCPTR (gst_base_audio_sink_activate_pull);
-
- /* ref class from a thread-safe context to work around missing bit of
- * thread-safety in GObject */
- g_type_class_ref (GST_TYPE_AUDIO_CLOCK);
- g_type_class_ref (GST_TYPE_RING_BUFFER);
-
-}
-
-static void
-gst_base_audio_sink_init (GstBaseAudioSink * baseaudiosink,
- GstBaseAudioSinkClass * g_class)
-{
- GstPluginFeature *feature;
-
- baseaudiosink->priv = GST_BASE_AUDIO_SINK_GET_PRIVATE (baseaudiosink);
-
- baseaudiosink->buffer_time = DEFAULT_BUFFER_TIME;
- baseaudiosink->latency_time = DEFAULT_LATENCY_TIME;
- baseaudiosink->provide_clock = DEFAULT_PROVIDE_CLOCK;
- baseaudiosink->priv->slave_method = DEFAULT_SLAVE_METHOD;
-
- baseaudiosink->provided_clock = gst_audio_clock_new ("GstAudioSinkClock",
- (GstAudioClockGetTimeFunc) gst_base_audio_sink_get_time, baseaudiosink);
-
- GST_BASE_SINK (baseaudiosink)->can_activate_push = TRUE;
- GST_BASE_SINK (baseaudiosink)->can_activate_pull = DEFAULT_CAN_ACTIVATE_PULL;
- baseaudiosink->priv->drift_tolerance = DEFAULT_DRIFT_TOLERANCE;
-
- /* install some custom pad_query functions */
- gst_pad_set_query_function (GST_BASE_SINK_PAD (baseaudiosink),
- GST_DEBUG_FUNCPTR (gst_base_audio_sink_query_pad));
-
- baseaudiosink->priv->do_time_offset = TRUE;
-
- /* check the factory, pulsesink < 0.10.17 does the timestamp offset itself so
- * we should not do ourselves */
- feature =
- GST_PLUGIN_FEATURE_CAST (GST_ELEMENT_CLASS (g_class)->elementfactory);
- GST_DEBUG ("created from factory %p", feature);
-
- /* HACK for old pulsesink that did the time_offset themselves */
- if (feature) {
- if (strcmp (gst_plugin_feature_get_name (feature), "pulsesink") == 0) {
- if (!gst_plugin_feature_check_version (feature, 0, 10, 17)) {
- /* we're dealing with an old pulsesink, we need to disable time corection */
- GST_DEBUG ("disable time offset");
- baseaudiosink->priv->do_time_offset = FALSE;
- }
- }
- }
-}
-
-static void
-gst_base_audio_sink_dispose (GObject * object)
-{
- GstBaseAudioSink *sink;
-
- sink = GST_BASE_AUDIO_SINK (object);
-
- if (sink->provided_clock)
- gst_object_unref (sink->provided_clock);
- sink->provided_clock = NULL;
-
- if (sink->ringbuffer) {
- gst_object_unparent (GST_OBJECT_CAST (sink->ringbuffer));
- sink->ringbuffer = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-
-static GstClock *
-gst_base_audio_sink_provide_clock (GstElement * elem)
-{
- GstBaseAudioSink *sink;
- GstClock *clock;
-
- sink = GST_BASE_AUDIO_SINK (elem);
-
- /* we have no ringbuffer (must be NULL state) */
- if (sink->ringbuffer == NULL)
- goto wrong_state;
-
- if (!gst_ring_buffer_is_acquired (sink->ringbuffer))
- goto wrong_state;
-
- GST_OBJECT_LOCK (sink);
- if (!sink->provide_clock)
- goto clock_disabled;
-
- clock = GST_CLOCK_CAST (gst_object_ref (sink->provided_clock));
- GST_OBJECT_UNLOCK (sink);
-
- return clock;
-
- /* ERRORS */
-wrong_state:
- {
- GST_DEBUG_OBJECT (sink, "ringbuffer not acquired");
- return NULL;
- }
-clock_disabled:
- {
- GST_DEBUG_OBJECT (sink, "clock provide disabled");
- GST_OBJECT_UNLOCK (sink);
- return NULL;
- }
-}
-
-static gboolean
-gst_base_audio_sink_query_pad (GstPad * pad, GstQuery * query)
-{
- gboolean res = FALSE;
- GstBaseAudioSink *basesink;
-
- basesink = GST_BASE_AUDIO_SINK (gst_pad_get_parent (pad));
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_CONVERT:
- {
- GstFormat src_fmt, dest_fmt;
- gint64 src_val, dest_val;
-
- GST_LOG_OBJECT (pad, "query convert");
-
- if (basesink->ringbuffer) {
- gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, NULL);
- res = gst_ring_buffer_convert (basesink->ringbuffer, src_fmt, src_val,
- dest_fmt, &dest_val);
- if (res) {
- gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
- }
- }
- break;
- }
- default:
- break;
- }
-
- gst_object_unref (basesink);
-
- return res;
-}
-
-static gboolean
-gst_base_audio_sink_query (GstElement * element, GstQuery * query)
-{
- gboolean res = FALSE;
- GstBaseAudioSink *basesink;
-
- basesink = GST_BASE_AUDIO_SINK (element);
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_LATENCY:
- {
- gboolean live, us_live;
- GstClockTime min_l, max_l;
-
- GST_DEBUG_OBJECT (basesink, "latency query");
-
- if (!basesink->ringbuffer || !basesink->ringbuffer->spec.rate) {
- GST_DEBUG_OBJECT (basesink,
- "we are not yet negotiated, can't report latency yet");
- res = FALSE;
- goto done;
- }
-
- /* ask parent first, it will do an upstream query for us. */
- if ((res =
- gst_base_sink_query_latency (GST_BASE_SINK_CAST (basesink), &live,
- &us_live, &min_l, &max_l))) {
- GstClockTime min_latency, max_latency;
-
- /* we and upstream are both live, adjust the min_latency */
- if (live && us_live) {
- GstRingBufferSpec *spec;
-
- spec = &basesink->ringbuffer->spec;
-
- basesink->priv->us_latency = min_l;
-
- min_latency =
- gst_util_uint64_scale_int (spec->seglatency * spec->segsize,
- GST_SECOND, spec->rate * spec->bytes_per_sample);
-
- /* we cannot go lower than the buffer size and the min peer latency */
- min_latency = min_latency + min_l;
- /* the max latency is the max of the peer, we can delay an infinite
- * amount of time. */
- max_latency = min_latency + (max_l == -1 ? 0 : max_l);
-
- GST_DEBUG_OBJECT (basesink,
- "peer min %" GST_TIME_FORMAT ", our min latency: %"
- GST_TIME_FORMAT, GST_TIME_ARGS (min_l),
- GST_TIME_ARGS (min_latency));
- } else {
- GST_DEBUG_OBJECT (basesink,
- "peer or we are not live, don't care about latency");
- min_latency = min_l;
- max_latency = max_l;
- }
- gst_query_set_latency (query, live, min_latency, max_latency);
- }
- break;
- }
- case GST_QUERY_CONVERT:
- {
- GstFormat src_fmt, dest_fmt;
- gint64 src_val, dest_val;
-
- GST_LOG_OBJECT (basesink, "query convert");
-
- if (basesink->ringbuffer) {
- gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, NULL);
- res = gst_ring_buffer_convert (basesink->ringbuffer, src_fmt, src_val,
- dest_fmt, &dest_val);
- if (res) {
- gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
- }
- }
- break;
- }
- default:
- res = GST_ELEMENT_CLASS (parent_class)->query (element, query);
- break;
- }
-
-done:
- return res;
-}
-
-
-static GstClockTime
-gst_base_audio_sink_get_time (GstClock * clock, GstBaseAudioSink * sink)
-{
- guint64 raw, samples;
- guint delay;
- GstClockTime result;
-
- if (sink->ringbuffer == NULL || sink->ringbuffer->spec.rate == 0)
- return GST_CLOCK_TIME_NONE;
-
- /* our processed samples are always increasing */
- raw = samples = gst_ring_buffer_samples_done (sink->ringbuffer);
-
- /* the number of samples not yet processed, this is still queued in the
- * device (not played for playback). */
- delay = gst_ring_buffer_delay (sink->ringbuffer);
-
- if (G_LIKELY (samples >= delay))
- samples -= delay;
- else
- samples = 0;
-
- result = gst_util_uint64_scale_int (samples, GST_SECOND,
- sink->ringbuffer->spec.rate);
-
- GST_DEBUG_OBJECT (sink,
- "processed samples: raw %" G_GUINT64_FORMAT ", delay %u, real %"
- G_GUINT64_FORMAT ", time %" GST_TIME_FORMAT,
- raw, delay, samples, GST_TIME_ARGS (result));
-
- return result;
-}
-
-/**
- * gst_base_audio_sink_set_provide_clock:
- * @sink: a #GstBaseAudioSink
- * @provide: new state
- *
- * Controls whether @sink will provide a clock or not. If @provide is %TRUE,
- * gst_element_provide_clock() will return a clock that reflects the datarate
- * of @sink. If @provide is %FALSE, gst_element_provide_clock() will return NULL.
- *
- * Since: 0.10.16
- */
-void
-gst_base_audio_sink_set_provide_clock (GstBaseAudioSink * sink,
- gboolean provide)
-{
- g_return_if_fail (GST_IS_BASE_AUDIO_SINK (sink));
-
- GST_OBJECT_LOCK (sink);
- sink->provide_clock = provide;
- GST_OBJECT_UNLOCK (sink);
-}
-
-/**
- * gst_base_audio_sink_get_provide_clock:
- * @sink: a #GstBaseAudioSink
- *
- * Queries whether @sink will provide a clock or not. See also
- * gst_base_audio_sink_set_provide_clock.
- *
- * Returns: %TRUE if @sink will provide a clock.
- *
- * Since: 0.10.16
- */
-gboolean
-gst_base_audio_sink_get_provide_clock (GstBaseAudioSink * sink)
-{
- gboolean result;
-
- g_return_val_if_fail (GST_IS_BASE_AUDIO_SINK (sink), FALSE);
-
- GST_OBJECT_LOCK (sink);
- result = sink->provide_clock;
- GST_OBJECT_UNLOCK (sink);
-
- return result;
-}
-
-/**
- * gst_base_audio_sink_set_slave_method:
- * @sink: a #GstBaseAudioSink
- * @method: the new slave method
- *
- * Controls how clock slaving will be performed in @sink.
- *
- * Since: 0.10.16
- */
-void
-gst_base_audio_sink_set_slave_method (GstBaseAudioSink * sink,
- GstBaseAudioSinkSlaveMethod method)
-{
- g_return_if_fail (GST_IS_BASE_AUDIO_SINK (sink));
-
- GST_OBJECT_LOCK (sink);
- sink->priv->slave_method = method;
- GST_OBJECT_UNLOCK (sink);
-}
-
-/**
- * gst_base_audio_sink_get_slave_method:
- * @sink: a #GstBaseAudioSink
- *
- * Get the current slave method used by @sink.
- *
- * Returns: The current slave method used by @sink.
- *
- * Since: 0.10.16
- */
-GstBaseAudioSinkSlaveMethod
-gst_base_audio_sink_get_slave_method (GstBaseAudioSink * sink)
-{
- GstBaseAudioSinkSlaveMethod result;
-
- g_return_val_if_fail (GST_IS_BASE_AUDIO_SINK (sink), -1);
-
- GST_OBJECT_LOCK (sink);
- result = sink->priv->slave_method;
- GST_OBJECT_UNLOCK (sink);
-
- return result;
-}
-
-static void
-gst_base_audio_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstBaseAudioSink *sink;
-
- sink = GST_BASE_AUDIO_SINK (object);
-
- switch (prop_id) {
- case PROP_BUFFER_TIME:
- sink->buffer_time = g_value_get_int64 (value);
- break;
- case PROP_LATENCY_TIME:
- sink->latency_time = g_value_get_int64 (value);
- break;
- case PROP_PROVIDE_CLOCK:
- gst_base_audio_sink_set_provide_clock (sink, g_value_get_boolean (value));
- break;
- case PROP_SLAVE_METHOD:
- gst_base_audio_sink_set_slave_method (sink, g_value_get_enum (value));
- break;
- case PROP_CAN_ACTIVATE_PULL:
- GST_BASE_SINK (sink)->can_activate_pull = g_value_get_boolean (value);
- break;
- case PROP_DRIFT_TOLERANCE:
- sink->priv->drift_tolerance = g_value_get_int64 (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_base_audio_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstBaseAudioSink *sink;
-
- sink = GST_BASE_AUDIO_SINK (object);
-
- switch (prop_id) {
- case PROP_BUFFER_TIME:
- g_value_set_int64 (value, sink->buffer_time);
- break;
- case PROP_LATENCY_TIME:
- g_value_set_int64 (value, sink->latency_time);
- break;
- case PROP_PROVIDE_CLOCK:
- g_value_set_boolean (value, gst_base_audio_sink_get_provide_clock (sink));
- break;
- case PROP_SLAVE_METHOD:
- g_value_set_enum (value, gst_base_audio_sink_get_slave_method (sink));
- break;
- case PROP_CAN_ACTIVATE_PULL:
- g_value_set_boolean (value, GST_BASE_SINK (sink)->can_activate_pull);
- break;
- case PROP_DRIFT_TOLERANCE:
- g_value_set_int64 (value, sink->priv->drift_tolerance);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-gst_base_audio_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
-{
- GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (bsink);
- GstRingBufferSpec *spec;
- GstClockTime now;
-
- if (!sink->ringbuffer)
- return FALSE;
-
- spec = &sink->ringbuffer->spec;
-
- GST_DEBUG_OBJECT (sink, "release old ringbuffer");
-
- /* get current time, updates the last_time */
- now = gst_clock_get_time (sink->provided_clock);
-
- GST_DEBUG_OBJECT (sink, "time was %" GST_TIME_FORMAT, GST_TIME_ARGS (now));
-
- /* release old ringbuffer */
- gst_ring_buffer_pause (sink->ringbuffer);
- gst_ring_buffer_activate (sink->ringbuffer, FALSE);
- gst_ring_buffer_release (sink->ringbuffer);
-
- GST_DEBUG_OBJECT (sink, "parse caps");
-
- spec->buffer_time = sink->buffer_time;
- spec->latency_time = sink->latency_time;
-
- /* parse new caps */
- if (!gst_ring_buffer_parse_caps (spec, caps))
- goto parse_error;
-
- gst_ring_buffer_debug_spec_buff (spec);
-
- GST_DEBUG_OBJECT (sink, "acquire ringbuffer");
- if (!gst_ring_buffer_acquire (sink->ringbuffer, spec))
- goto acquire_error;
-
- if (bsink->pad_mode == GST_ACTIVATE_PUSH) {
- GST_DEBUG_OBJECT (sink, "activate ringbuffer");
- gst_ring_buffer_activate (sink->ringbuffer, TRUE);
- }
-
- /* calculate actual latency and buffer times.
- * FIXME: In 0.11, store the latency_time internally in ns */
- spec->latency_time = gst_util_uint64_scale (spec->segsize,
- (GST_SECOND / GST_USECOND), spec->rate * spec->bytes_per_sample);
-
- spec->buffer_time = spec->segtotal * spec->latency_time;
-
- gst_ring_buffer_debug_spec_buff (spec);
-
- return TRUE;
-
- /* ERRORS */
-parse_error:
- {
- GST_DEBUG_OBJECT (sink, "could not parse caps");
- GST_ELEMENT_ERROR (sink, STREAM, FORMAT,
- (NULL), ("cannot parse audio format."));
- return FALSE;
- }
-acquire_error:
- {
- GST_DEBUG_OBJECT (sink, "could not acquire ringbuffer");
- return FALSE;
- }
-}
-
-static void
-gst_base_audio_sink_fixate (GstBaseSink * bsink, GstCaps * caps)
-{
- GstStructure *s;
- gint width, depth;
-
- s = gst_caps_get_structure (caps, 0);
-
- /* fields for all formats */
- gst_structure_fixate_field_nearest_int (s, "rate", 44100);
- gst_structure_fixate_field_nearest_int (s, "channels", 2);
- gst_structure_fixate_field_nearest_int (s, "width", 16);
-
- /* fields for int */
- if (gst_structure_has_field (s, "depth")) {
- gst_structure_get_int (s, "width", &width);
- /* round width to nearest multiple of 8 for the depth */
- depth = GST_ROUND_UP_8 (width);
- gst_structure_fixate_field_nearest_int (s, "depth", depth);
- }
- if (gst_structure_has_field (s, "signed"))
- gst_structure_fixate_field_boolean (s, "signed", TRUE);
- if (gst_structure_has_field (s, "endianness"))
- gst_structure_fixate_field_nearest_int (s, "endianness", G_BYTE_ORDER);
-}
-
-static void
-gst_base_audio_sink_get_times (GstBaseSink * bsink, GstBuffer * buffer,
- GstClockTime * start, GstClockTime * end)
-{
- /* our clock sync is a bit too much for the base class to handle so
- * we implement it ourselves. */
- *start = GST_CLOCK_TIME_NONE;
- *end = GST_CLOCK_TIME_NONE;
-}
-
-/* This waits for the drain to happen and can be canceled */
-static gboolean
-gst_base_audio_sink_drain (GstBaseAudioSink * sink)
-{
- if (!sink->ringbuffer)
- return TRUE;
- if (!sink->ringbuffer->spec.rate)
- return TRUE;
-
- /* need to start playback before we can drain, but only when
- * we have successfully negotiated a format and thus acquired the
- * ringbuffer. */
- if (gst_ring_buffer_is_acquired (sink->ringbuffer))
- gst_ring_buffer_start (sink->ringbuffer);
-
- if (sink->priv->eos_time != -1) {
- GST_DEBUG_OBJECT (sink,
- "last sample time %" GST_TIME_FORMAT,
- GST_TIME_ARGS (sink->priv->eos_time));
-
- /* wait for the EOS time to be reached, this is the time when the last
- * sample is played. */
- gst_base_sink_wait_eos (GST_BASE_SINK (sink), sink->priv->eos_time, NULL);
-
- GST_DEBUG_OBJECT (sink, "drained audio");
- }
- return TRUE;
-}
-
-static gboolean
-gst_base_audio_sink_event (GstBaseSink * bsink, GstEvent * event)
-{
- GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (bsink);
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_START:
- if (sink->ringbuffer)
- gst_ring_buffer_set_flushing (sink->ringbuffer, TRUE);
- break;
- case GST_EVENT_FLUSH_STOP:
- /* always resync on sample after a flush */
- sink->priv->avg_skew = -1;
- sink->next_sample = -1;
- sink->priv->eos_time = -1;
- if (sink->ringbuffer)
- gst_ring_buffer_set_flushing (sink->ringbuffer, FALSE);
- break;
- case GST_EVENT_EOS:
- /* now wait till we played everything */
- gst_base_audio_sink_drain (sink);
- break;
- case GST_EVENT_NEWSEGMENT:
- {
- gdouble rate;
-
- /* we only need the rate */
- gst_event_parse_new_segment_full (event, NULL, &rate, NULL, NULL,
- NULL, NULL, NULL);
-
- GST_DEBUG_OBJECT (sink, "new segment rate of %f", rate);
- break;
- }
- default:
- break;
- }
- return TRUE;
-}
-
-static GstFlowReturn
-gst_base_audio_sink_preroll (GstBaseSink * bsink, GstBuffer * buffer)
-{
- GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (bsink);
-
- if (!gst_ring_buffer_is_acquired (sink->ringbuffer))
- goto wrong_state;
-
- /* we don't really do anything when prerolling. We could make a
- * property to play this buffer to have some sort of scrubbing
- * support. */
- return GST_FLOW_OK;
-
-wrong_state:
- {
- GST_DEBUG_OBJECT (sink, "ringbuffer in wrong state");
- GST_ELEMENT_ERROR (sink, STREAM, FORMAT, (NULL), ("sink not negotiated."));
- return GST_FLOW_NOT_NEGOTIATED;
- }
-}
-
-static guint64
-gst_base_audio_sink_get_offset (GstBaseAudioSink * sink)
-{
- guint64 sample;
- gint writeseg, segdone, sps;
- gint diff;
-
- /* assume we can append to the previous sample */
- sample = sink->next_sample;
- /* no previous sample, try to insert at position 0 */
- if (sample == -1)
- sample = 0;
-
- sps = sink->ringbuffer->samples_per_seg;
-
- /* figure out the segment and the offset inside the segment where
- * the sample should be written. */
- writeseg = sample / sps;
-
- /* get the currently processed segment */
- segdone = g_atomic_int_get (&sink->ringbuffer->segdone)
- - sink->ringbuffer->segbase;
-
- /* see how far away it is from the write segment */
- diff = writeseg - segdone;
- if (diff < 0) {
- /* sample would be dropped, position to next playable position */
- sample = (segdone + 1) * sps;
- }
-
- return sample;
-}
-
-static GstClockTime
-clock_convert_external (GstClockTime external, GstClockTime cinternal,
- GstClockTime cexternal, GstClockTime crate_num, GstClockTime crate_denom)
-{
- /* adjust for rate and speed */
- if (external >= cexternal) {
- external =
- gst_util_uint64_scale (external - cexternal, crate_denom, crate_num);
- external += cinternal;
- } else {
- external =
- gst_util_uint64_scale (cexternal - external, crate_denom, crate_num);
- if (cinternal > external)
- external = cinternal - external;
- else
- external = 0;
- }
- return external;
-}
-
-/* algorithm to calculate sample positions that will result in resampling to
- * match the clock rate of the master */
-static void
-gst_base_audio_sink_resample_slaving (GstBaseAudioSink * sink,
- GstClockTime render_start, GstClockTime render_stop,
- GstClockTime * srender_start, GstClockTime * srender_stop)
-{
- GstClockTime cinternal, cexternal;
- GstClockTime crate_num, crate_denom;
-
- /* FIXME, we can sample and add observations here or use the timeouts on the
- * clock. No idea which one is better or more stable. The timeout seems more
- * arbitrary but this one seems more demanding and does not work when there is
- * no data comming in to the sink. */
-#if 0
- GstClockTime etime, itime;
- gdouble r_squared;
-
- /* sample clocks and figure out clock skew */
- etime = gst_clock_get_time (GST_ELEMENT_CLOCK (sink));
- itime = gst_audio_clock_get_time (sink->provided_clock);
-
- /* add new observation */
- gst_clock_add_observation (sink->provided_clock, itime, etime, &r_squared);
-#endif
-
- /* get calibration parameters to compensate for speed and offset differences
- * when we are slaved */
- gst_clock_get_calibration (sink->provided_clock, &cinternal, &cexternal,
- &crate_num, &crate_denom);
-
- GST_DEBUG_OBJECT (sink, "internal %" GST_TIME_FORMAT " external %"
- GST_TIME_FORMAT " %" G_GUINT64_FORMAT "/%" G_GUINT64_FORMAT " = %f",
- GST_TIME_ARGS (cinternal), GST_TIME_ARGS (cexternal), crate_num,
- crate_denom, gst_guint64_to_gdouble (crate_num) /
- gst_guint64_to_gdouble (crate_denom));
-
- if (crate_num == 0)
- crate_denom = crate_num = 1;
-
- /* bring external time to internal time */
- render_start = clock_convert_external (render_start, cinternal, cexternal,
- crate_num, crate_denom);
- render_stop = clock_convert_external (render_stop, cinternal, cexternal,
- crate_num, crate_denom);
-
- GST_DEBUG_OBJECT (sink,
- "after slaving: start %" GST_TIME_FORMAT " - stop %" GST_TIME_FORMAT,
- GST_TIME_ARGS (render_start), GST_TIME_ARGS (render_stop));
-
- *srender_start = render_start;
- *srender_stop = render_stop;
-}
-
-/* algorithm to calculate sample positions that will result in changing the
- * playout pointer to match the clock rate of the master */
-static void
-gst_base_audio_sink_skew_slaving (GstBaseAudioSink * sink,
- GstClockTime render_start, GstClockTime render_stop,
- GstClockTime * srender_start, GstClockTime * srender_stop)
-{
- GstClockTime cinternal, cexternal, crate_num, crate_denom;
- GstClockTime etime, itime;
- GstClockTimeDiff skew, mdrift, mdrift2;
- gint driftsamples;
- gint64 last_align;
-
- /* get calibration parameters to compensate for offsets */
- gst_clock_get_calibration (sink->provided_clock, &cinternal, &cexternal,
- &crate_num, &crate_denom);
-
- /* sample clocks and figure out clock skew */
- etime = gst_clock_get_time (GST_ELEMENT_CLOCK (sink));
- itime = gst_audio_clock_get_time (sink->provided_clock);
- itime = gst_audio_clock_adjust (sink->provided_clock, itime);
-
- GST_DEBUG_OBJECT (sink,
- "internal %" GST_TIME_FORMAT " external %" GST_TIME_FORMAT
- " cinternal %" GST_TIME_FORMAT " cexternal %" GST_TIME_FORMAT,
- GST_TIME_ARGS (itime), GST_TIME_ARGS (etime),
- GST_TIME_ARGS (cinternal), GST_TIME_ARGS (cexternal));
-
- /* make sure we never go below 0 */
- etime = etime > cexternal ? etime - cexternal : 0;
- itime = itime > cinternal ? itime - cinternal : 0;
-
- /* do itime - etime.
- * positive value means external clock goes slower
- * negative value means external clock goes faster */
- skew = GST_CLOCK_DIFF (etime, itime);
- if (sink->priv->avg_skew == -1) {
- /* first observation */
- sink->priv->avg_skew = skew;
- } else {
- /* next observations use a moving average */
- sink->priv->avg_skew = (31 * sink->priv->avg_skew + skew) / 32;
- }
-
- GST_DEBUG_OBJECT (sink, "internal %" GST_TIME_FORMAT " external %"
- GST_TIME_FORMAT " skew %" G_GINT64_FORMAT " avg %" G_GINT64_FORMAT,
- GST_TIME_ARGS (itime), GST_TIME_ARGS (etime), skew, sink->priv->avg_skew);
-
- /* the max drift we allow */
- mdrift = sink->priv->drift_tolerance * 1000;
- mdrift2 = mdrift / 2;
-
- /* adjust playout pointer based on skew */
- if (sink->priv->avg_skew > mdrift2) {
- /* master is running slower, move internal time forward */
- GST_WARNING_OBJECT (sink,
- "correct clock skew %" G_GINT64_FORMAT " > %" G_GINT64_FORMAT,
- sink->priv->avg_skew, mdrift2);
- cexternal = cexternal > mdrift ? cexternal - mdrift : 0;
- sink->priv->avg_skew -= mdrift;
-
- driftsamples = (sink->ringbuffer->spec.rate * mdrift) / GST_SECOND;
- last_align = sink->priv->last_align;
-
- /* if we were aligning in the wrong direction or we aligned more than what we
- * will correct, resync */
- if (last_align < 0 || last_align > driftsamples)
- sink->next_sample = -1;
-
- GST_DEBUG_OBJECT (sink,
- "last_align %" G_GINT64_FORMAT " driftsamples %u, next %"
- G_GUINT64_FORMAT, last_align, driftsamples, sink->next_sample);
-
- gst_clock_set_calibration (sink->provided_clock, cinternal, cexternal,
- crate_num, crate_denom);
- } else if (sink->priv->avg_skew < -mdrift2) {
- /* master is running faster, move external time forwards */
- GST_WARNING_OBJECT (sink,
- "correct clock skew %" G_GINT64_FORMAT " < %" G_GINT64_FORMAT,
- sink->priv->avg_skew, -mdrift2);
- cexternal += mdrift;
- sink->priv->avg_skew += mdrift;
-
- driftsamples = (sink->ringbuffer->spec.rate * mdrift) / GST_SECOND;
- last_align = sink->priv->last_align;
-
- /* if we were aligning in the wrong direction or we aligned more than what we
- * will correct, resync */
- if (last_align > 0 || -last_align > driftsamples)
- sink->next_sample = -1;
-
- GST_DEBUG_OBJECT (sink,
- "last_align %" G_GINT64_FORMAT " driftsamples %u, next %"
- G_GUINT64_FORMAT, last_align, driftsamples, sink->next_sample);
-
- gst_clock_set_calibration (sink->provided_clock, cinternal, cexternal,
- crate_num, crate_denom);
- }
-
- /* convert, ignoring speed */
- render_start = clock_convert_external (render_start, cinternal, cexternal,
- crate_num, crate_denom);
- render_stop = clock_convert_external (render_stop, cinternal, cexternal,
- crate_num, crate_denom);
-
- *srender_start = render_start;
- *srender_stop = render_stop;
-}
-
-/* apply the clock offset but do no slaving otherwise */
-static void
-gst_base_audio_sink_none_slaving (GstBaseAudioSink * sink,
- GstClockTime render_start, GstClockTime render_stop,
- GstClockTime * srender_start, GstClockTime * srender_stop)
-{
- GstClockTime cinternal, cexternal, crate_num, crate_denom;
-
- /* get calibration parameters to compensate for offsets */
- gst_clock_get_calibration (sink->provided_clock, &cinternal, &cexternal,
- &crate_num, &crate_denom);
-
- /* convert, ignoring speed */
- render_start = clock_convert_external (render_start, cinternal, cexternal,
- crate_num, crate_denom);
- render_stop = clock_convert_external (render_stop, cinternal, cexternal,
- crate_num, crate_denom);
-
- *srender_start = render_start;
- *srender_stop = render_stop;
-}
-
-/* converts render_start and render_stop to their slaved values */
-static void
-gst_base_audio_sink_handle_slaving (GstBaseAudioSink * sink,
- GstClockTime render_start, GstClockTime render_stop,
- GstClockTime * srender_start, GstClockTime * srender_stop)
-{
- switch (sink->priv->slave_method) {
- case GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE:
- gst_base_audio_sink_resample_slaving (sink, render_start, render_stop,
- srender_start, srender_stop);
- break;
- case GST_BASE_AUDIO_SINK_SLAVE_SKEW:
- gst_base_audio_sink_skew_slaving (sink, render_start, render_stop,
- srender_start, srender_stop);
- break;
- case GST_BASE_AUDIO_SINK_SLAVE_NONE:
- gst_base_audio_sink_none_slaving (sink, render_start, render_stop,
- srender_start, srender_stop);
- break;
- default:
- g_warning ("unknown slaving method %d", sink->priv->slave_method);
- break;
- }
-}
-
-/* must be called with LOCK */
-static GstFlowReturn
-gst_base_audio_sink_sync_latency (GstBaseSink * bsink, GstMiniObject * obj)
-{
- GstClock *clock;
- GstClockReturn status;
- GstClockTime time;
- GstFlowReturn ret;
- GstBaseAudioSink *sink;
- GstClockTime itime, etime;
- GstClockTime rate_num, rate_denom;
- GstClockTimeDiff jitter;
-
- sink = GST_BASE_AUDIO_SINK (bsink);
-
- clock = GST_ELEMENT_CLOCK (sink);
- if (G_UNLIKELY (clock == NULL))
- goto no_clock;
-
- /* we provided the global clock, don't need to do anything special */
- if (clock == sink->provided_clock)
- goto no_slaving;
-
- GST_OBJECT_UNLOCK (sink);
-
- do {
- GST_DEBUG_OBJECT (sink, "checking preroll");
-
- ret = gst_base_sink_do_preroll (bsink, obj);
- if (ret != GST_FLOW_OK)
- goto flushing;
-
- GST_OBJECT_LOCK (sink);
- time = sink->priv->us_latency;
- GST_OBJECT_UNLOCK (sink);
-
- /* preroll done, we can sync since we are in PLAYING now. */
- GST_DEBUG_OBJECT (sink, "possibly waiting for clock to reach %"
- GST_TIME_FORMAT, GST_TIME_ARGS (time));
-
- /* wait for the clock, this can be interrupted because we got shut down or
- * we PAUSED. */
- status = gst_base_sink_wait_clock (bsink, time, &jitter);
-
- GST_DEBUG_OBJECT (sink, "clock returned %d %" GST_TIME_FORMAT, status,
- GST_TIME_ARGS (jitter));
-
- /* invalid time, no clock or sync disabled, just continue then */
- if (status == GST_CLOCK_BADTIME)
- break;
-
- /* waiting could have been interrupted and we can be flushing now */
- if (G_UNLIKELY (bsink->flushing))
- goto flushing;
-
- /* retry if we got unscheduled, which means we did not reach the timeout
- * yet. if some other error occures, we continue. */
- } while (status == GST_CLOCK_UNSCHEDULED);
-
- GST_OBJECT_LOCK (sink);
- GST_DEBUG_OBJECT (sink, "latency synced");
-
- /* when we prerolled in time, we can accurately set the calibration,
- * our internal clock should exactly have been the latency (== the running
- * time of the external clock) */
- etime = GST_ELEMENT_CAST (sink)->base_time + time;
- itime = gst_audio_clock_get_time (sink->provided_clock);
- itime = gst_audio_clock_adjust (sink->provided_clock, itime);
-
- if (status == GST_CLOCK_EARLY) {
- /* when we prerolled late, we have to take into account the lateness */
- GST_DEBUG_OBJECT (sink, "late preroll, adding jitter");
- etime += jitter;
- }
-
- /* start ringbuffer so we can start slaving right away when we need to */
- gst_ring_buffer_start (sink->ringbuffer);
-
- GST_DEBUG_OBJECT (sink,
- "internal time: %" GST_TIME_FORMAT " external time: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (itime), GST_TIME_ARGS (etime));
-
- /* copy the original calibrated rate but update the internal and external
- * times. */
- gst_clock_get_calibration (sink->provided_clock, NULL, NULL, &rate_num,
- &rate_denom);
- gst_clock_set_calibration (sink->provided_clock, itime, etime,
- rate_num, rate_denom);
-
- switch (sink->priv->slave_method) {
- case GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE:
- /* only set as master when we are resampling */
- GST_DEBUG_OBJECT (sink, "Setting clock as master");
- gst_clock_set_master (sink->provided_clock, clock);
- break;
- case GST_BASE_AUDIO_SINK_SLAVE_SKEW:
- case GST_BASE_AUDIO_SINK_SLAVE_NONE:
- default:
- break;
- }
-
- sink->priv->avg_skew = -1;
- sink->next_sample = -1;
- sink->priv->eos_time = -1;
-
- return GST_FLOW_OK;
-
- /* ERRORS */
-no_clock:
- {
- GST_DEBUG_OBJECT (sink, "we have no clock");
- return GST_FLOW_OK;
- }
-no_slaving:
- {
- GST_DEBUG_OBJECT (sink, "we are not slaved");
- return GST_FLOW_OK;
- }
-flushing:
- {
- GST_DEBUG_OBJECT (sink, "we are flushing");
- GST_OBJECT_LOCK (sink);
- return GST_FLOW_WRONG_STATE;
- }
-}
-
-static GstFlowReturn
-gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
-{
- guint64 in_offset;
- GstClockTime time, stop, render_start, render_stop, sample_offset;
- GstClockTimeDiff sync_offset, ts_offset;
- GstBaseAudioSink *sink;
- GstRingBuffer *ringbuf;
- gint64 diff, align, ctime, cstop;
- guint8 *data;
- guint size;
- guint samples, written;
- gint bps;
- gint accum;
- gint out_samples;
- GstClockTime base_time, render_delay, latency;
- GstClock *clock;
- gboolean sync, slaved, align_next;
- GstFlowReturn ret;
- GstSegment clip_seg;
- gint64 time_offset;
- gint64 maxdrift;
-
- sink = GST_BASE_AUDIO_SINK (bsink);
-
- ringbuf = sink->ringbuffer;
-
- /* can't do anything when we don't have the device */
- if (G_UNLIKELY (!gst_ring_buffer_is_acquired (ringbuf)))
- goto wrong_state;
-
- /* Wait for upstream latency before starting the ringbuffer, we do this so
- * that we can align the first sample of the ringbuffer to the base_time +
- * latency. */
- GST_OBJECT_LOCK (sink);
- base_time = GST_ELEMENT_CAST (sink)->base_time;
- if (G_UNLIKELY (sink->priv->sync_latency)) {
- ret = gst_base_audio_sink_sync_latency (bsink, GST_MINI_OBJECT_CAST (buf));
- GST_OBJECT_UNLOCK (sink);
- if (G_UNLIKELY (ret != GST_FLOW_OK))
- goto sync_latency_failed;
- /* only do this once until we are set back to PLAYING */
- sink->priv->sync_latency = FALSE;
- } else {
- GST_OBJECT_UNLOCK (sink);
- }
-
- bps = ringbuf->spec.bytes_per_sample;
-
- size = GST_BUFFER_SIZE (buf);
- if (G_UNLIKELY (size % bps) != 0)
- goto wrong_size;
-
- samples = size / bps;
- out_samples = samples;
-
- in_offset = GST_BUFFER_OFFSET (buf);
- time = GST_BUFFER_TIMESTAMP (buf);
-
- GST_DEBUG_OBJECT (sink,
- "time %" GST_TIME_FORMAT ", offset %" G_GUINT64_FORMAT ", start %"
- GST_TIME_FORMAT ", samples %u", GST_TIME_ARGS (time), in_offset,
- GST_TIME_ARGS (bsink->segment.start), samples);
-
- data = GST_BUFFER_DATA (buf);
-
- /* if not valid timestamp or we can't clip or sync, try to play
- * sample ASAP */
- if (!GST_CLOCK_TIME_IS_VALID (time)) {
- render_start = gst_base_audio_sink_get_offset (sink);
- render_stop = render_start + samples;
- GST_DEBUG_OBJECT (sink,
- "Buffer of size %u has no time. Using render_start=%" G_GUINT64_FORMAT,
- GST_BUFFER_SIZE (buf), render_start);
- /* we don't have a start so we don't know stop either */
- stop = -1;
- goto no_sync;
- }
-
- /* let's calc stop based on the number of samples in the buffer instead
- * of trusting the DURATION */
- stop = time + gst_util_uint64_scale_int (samples, GST_SECOND,
- ringbuf->spec.rate);
-
- /* prepare the clipping segment. Since we will be subtracting ts-offset and
- * device-delay later we scale the start and stop with those values so that we
- * can correctly clip them */
- clip_seg.format = GST_FORMAT_TIME;
- clip_seg.start = bsink->segment.start;
- clip_seg.stop = bsink->segment.stop;
- clip_seg.duration = -1;
-
- /* the sync offset is the combination of ts-offset and device-delay */
- latency = gst_base_sink_get_latency (bsink);
- ts_offset = gst_base_sink_get_ts_offset (bsink);
- render_delay = gst_base_sink_get_render_delay (bsink);
- sync_offset = ts_offset - render_delay + latency;
-
- GST_DEBUG_OBJECT (sink,
- "sync-offset %" G_GINT64_FORMAT ", render-delay %" GST_TIME_FORMAT
- ", ts-offset %" G_GINT64_FORMAT, sync_offset,
- GST_TIME_ARGS (render_delay), ts_offset);
-
- /* compensate for ts-offset and device-delay when negative we need to
- * clip. */
- if (sync_offset < 0) {
- clip_seg.start += -sync_offset;
- if (clip_seg.stop != -1)
- clip_seg.stop += -sync_offset;
- }
-
- /* samples should be rendered based on their timestamp. All samples
- * arriving before the segment.start or after segment.stop are to be
- * thrown away. All samples should also be clipped to the segment
- * boundaries */
- if (!gst_segment_clip (&clip_seg, GST_FORMAT_TIME, time, stop, &ctime,
- &cstop))
- goto out_of_segment;
-
- /* see if some clipping happened */
- diff = ctime - time;
- if (diff > 0) {
- /* bring clipped time to samples */
- diff = gst_util_uint64_scale_int (diff, ringbuf->spec.rate, GST_SECOND);
- GST_DEBUG_OBJECT (sink, "clipping start to %" GST_TIME_FORMAT " %"
- G_GUINT64_FORMAT " samples", GST_TIME_ARGS (ctime), diff);
- samples -= diff;
- data += diff * bps;
- time = ctime;
- }
- diff = stop - cstop;
- if (diff > 0) {
- /* bring clipped time to samples */
- diff = gst_util_uint64_scale_int (diff, ringbuf->spec.rate, GST_SECOND);
- GST_DEBUG_OBJECT (sink, "clipping stop to %" GST_TIME_FORMAT " %"
- G_GUINT64_FORMAT " samples", GST_TIME_ARGS (cstop), diff);
- samples -= diff;
- stop = cstop;
- }
-
- /* figure out how to sync */
- if ((clock = GST_ELEMENT_CLOCK (bsink)))
- sync = bsink->sync;
- else
- sync = FALSE;
-
- if (!sync) {
- /* no sync needed, play sample ASAP */
- render_start = gst_base_audio_sink_get_offset (sink);
- render_stop = render_start + samples;
- GST_DEBUG_OBJECT (sink,
- "no sync needed. Using render_start=%" G_GUINT64_FORMAT, render_start);
- goto no_sync;
- }
-
- /* bring buffer start and stop times to running time */
- render_start =
- gst_segment_to_running_time (&bsink->segment, GST_FORMAT_TIME, time);
- render_stop =
- gst_segment_to_running_time (&bsink->segment, GST_FORMAT_TIME, stop);
-
- GST_DEBUG_OBJECT (sink,
- "running: start %" GST_TIME_FORMAT " - stop %" GST_TIME_FORMAT,
- GST_TIME_ARGS (render_start), GST_TIME_ARGS (render_stop));
-
- /* store the time of the last sample, we'll use this to perform sync on the
- * last sample when draining the buffer */
- if (bsink->segment.rate >= 0.0) {
- sink->priv->eos_time = render_stop;
- } else {
- sink->priv->eos_time = render_start;
- }
-
- /* compensate for ts-offset and delay we know this will not underflow because we
- * clipped above. */
- GST_DEBUG_OBJECT (sink,
- "compensating for sync-offset %" GST_TIME_FORMAT,
- GST_TIME_ARGS (sync_offset));
- render_start += sync_offset;
- render_stop += sync_offset;
-
- GST_DEBUG_OBJECT (sink, "adding base_time %" GST_TIME_FORMAT,
- GST_TIME_ARGS (base_time));
-
- /* add base time to sync against the clock */
- render_start += base_time;
- render_stop += base_time;
-
- GST_DEBUG_OBJECT (sink,
- "after compensation: start %" GST_TIME_FORMAT " - stop %" GST_TIME_FORMAT,
- GST_TIME_ARGS (render_start), GST_TIME_ARGS (render_stop));
-
- if ((slaved = clock != sink->provided_clock)) {
- /* handle clock slaving */
- gst_base_audio_sink_handle_slaving (sink, render_start, render_stop,
- &render_start, &render_stop);
- } else {
- /* no slaving needed but we need to adapt to the clock calibration
- * parameters */
- gst_base_audio_sink_none_slaving (sink, render_start, render_stop,
- &render_start, &render_stop);
- }
-
- GST_DEBUG_OBJECT (sink,
- "final timestamps: start %" GST_TIME_FORMAT " - stop %" GST_TIME_FORMAT,
- GST_TIME_ARGS (render_start), GST_TIME_ARGS (render_stop));
-
- /* bring to position in the ringbuffer */
- if (sink->priv->do_time_offset) {
- time_offset =
- GST_AUDIO_CLOCK_CAST (sink->provided_clock)->abidata.ABI.time_offset;
- GST_DEBUG_OBJECT (sink,
- "time offset %" GST_TIME_FORMAT, GST_TIME_ARGS (time_offset));
- if (render_start > time_offset)
- render_start -= time_offset;
- else
- render_start = 0;
- if (render_stop > time_offset)
- render_stop -= time_offset;
- else
- render_stop = 0;
- }
-
- /* and bring the time to the rate corrected offset in the buffer */
- render_start = gst_util_uint64_scale_int (render_start,
- ringbuf->spec.rate, GST_SECOND);
- render_stop = gst_util_uint64_scale_int (render_stop,
- ringbuf->spec.rate, GST_SECOND);
-
- /* positive playback rate, first sample is render_start, negative rate, first
- * sample is render_stop. When no rate conversion is active, render exactly
- * the amount of input samples to avoid aligning to rounding errors. */
- if (bsink->segment.rate >= 0.0) {
- sample_offset = render_start;
- if (bsink->segment.rate == 1.0)
- render_stop = sample_offset + samples;
- } else {
- sample_offset = render_stop;
- if (bsink->segment.rate == -1.0)
- render_start = sample_offset + samples;
- }
-
- /* always resync after a discont */
- if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT))) {
- GST_DEBUG_OBJECT (sink, "resync after discont");
- goto no_align;
- }
-
- /* resync when we don't know what to align the sample with */
- if (G_UNLIKELY (sink->next_sample == -1)) {
- GST_DEBUG_OBJECT (sink,
- "no align possible: no previous sample position known");
- goto no_align;
- }
-
- /* now try to align the sample to the previous one, first see how big the
- * difference is. */
- if (sample_offset >= sink->next_sample)
- diff = sample_offset - sink->next_sample;
- else
- diff = sink->next_sample - sample_offset;
-
- /* calculate the max allowed drift in units of samples. By default this is
- * 20ms and should be anough to compensate for timestamp rounding errors. */
- maxdrift = (ringbuf->spec.rate * sink->priv->drift_tolerance) / GST_MSECOND;
-
- if (G_LIKELY (diff < maxdrift)) {
- /* calc align with previous sample */
- align = sink->next_sample - sample_offset;
- GST_DEBUG_OBJECT (sink,
- "align with prev sample, ABS (%" G_GINT64_FORMAT ") < %"
- G_GINT64_FORMAT, align, maxdrift);
- } else {
- GST_DEBUG_OBJECT (sink,
- "discont timestamp (%" G_GINT64_FORMAT ") >= %" G_GINT64_FORMAT, diff,
- maxdrift);
- align = 0;
- }
- sink->priv->last_align = align;
-
- /* apply alignment */
- render_start += align;
-
- /* only align stop if we are not slaved to resample */
- if (slaved && sink->priv->slave_method == GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE) {
- GST_DEBUG_OBJECT (sink, "no stop time align needed: we are slaved");
- goto no_align;
- }
- render_stop += align;
-
-no_align:
- /* number of target samples is difference between start and stop */
- out_samples = render_stop - render_start;
-
-no_sync:
- /* we render the first or last sample first, depending on the rate */
- if (bsink->segment.rate >= 0.0)
- sample_offset = render_start;
- else
- sample_offset = render_stop;
-
- GST_DEBUG_OBJECT (sink, "rendering at %" G_GUINT64_FORMAT " %d/%d",
- sample_offset, samples, out_samples);
-
- /* we need to accumulate over different runs for when we get interrupted */
- accum = 0;
- align_next = TRUE;
- do {
- written =
- gst_ring_buffer_commit_full (ringbuf, &sample_offset, data, samples,
- out_samples, &accum);
-
- GST_DEBUG_OBJECT (sink, "wrote %u of %u", written, samples);
- /* if we wrote all, we're done */
- if (written == samples)
- break;
-
- /* else something interrupted us and we wait for preroll. */
- if ((ret = gst_base_sink_wait_preroll (bsink)) != GST_FLOW_OK)
- goto stopping;
-
- /* if we got interrupted, we cannot assume that the next sample should
- * be aligned to this one */
- align_next = FALSE;
-
- /* update the output samples. FIXME, this will just skip them when pausing
- * during trick mode */
- if (out_samples > written) {
- out_samples -= written;
- accum = 0;
- } else
- break;
-
- samples -= written;
- data += written * bps;
- } while (TRUE);
-
- if (align_next)
- sink->next_sample = sample_offset;
- else
- sink->next_sample = -1;
-
- GST_DEBUG_OBJECT (sink, "next sample expected at %" G_GUINT64_FORMAT,
- sink->next_sample);
-
- if (GST_CLOCK_TIME_IS_VALID (stop) && stop >= bsink->segment.stop) {
- GST_DEBUG_OBJECT (sink,
- "start playback because we are at the end of segment");
- gst_ring_buffer_start (ringbuf);
- }
-
- return GST_FLOW_OK;
-
- /* SPECIAL cases */
-out_of_segment:
- {
- GST_DEBUG_OBJECT (sink,
- "dropping sample out of segment time %" GST_TIME_FORMAT ", start %"
- GST_TIME_FORMAT, GST_TIME_ARGS (time),
- GST_TIME_ARGS (bsink->segment.start));
- return GST_FLOW_OK;
- }
- /* ERRORS */
-wrong_state:
- {
- GST_DEBUG_OBJECT (sink, "ringbuffer not negotiated");
- GST_ELEMENT_ERROR (sink, STREAM, FORMAT, (NULL), ("sink not negotiated."));
- return GST_FLOW_NOT_NEGOTIATED;
- }
-wrong_size:
- {
- GST_DEBUG_OBJECT (sink, "wrong size");
- GST_ELEMENT_ERROR (sink, STREAM, WRONG_TYPE,
- (NULL), ("sink received buffer of wrong size."));
- return GST_FLOW_ERROR;
- }
-stopping:
- {
- GST_DEBUG_OBJECT (sink, "preroll got interrupted: %d (%s)", ret,
- gst_flow_get_name (ret));
- return ret;
- }
-sync_latency_failed:
- {
- GST_DEBUG_OBJECT (sink, "failed waiting for latency");
- return ret;
- }
-}
-
-/**
- * gst_base_audio_sink_create_ringbuffer:
- * @sink: a #GstBaseAudioSink.
- *
- * Create and return the #GstRingBuffer for @sink. This function will call the
- * ::create_ringbuffer vmethod and will set @sink as the parent of the returned
- * buffer (see gst_object_set_parent()).
- *
- * Returns: The new ringbuffer of @sink.
- */
-GstRingBuffer *
-gst_base_audio_sink_create_ringbuffer (GstBaseAudioSink * sink)
-{
- GstBaseAudioSinkClass *bclass;
- GstRingBuffer *buffer = NULL;
-
- bclass = GST_BASE_AUDIO_SINK_GET_CLASS (sink);
- if (bclass->create_ringbuffer)
- buffer = bclass->create_ringbuffer (sink);
-
- if (buffer)
- gst_object_set_parent (GST_OBJECT (buffer), GST_OBJECT (sink));
-
- return buffer;
-}
-
-static void
-gst_base_audio_sink_callback (GstRingBuffer * rbuf, guint8 * data, guint len,
- gpointer user_data)
-{
- GstBaseSink *basesink;
- GstBaseAudioSink *sink;
- GstBuffer *buf;
- GstFlowReturn ret;
-
- basesink = GST_BASE_SINK (user_data);
- sink = GST_BASE_AUDIO_SINK (user_data);
-
- GST_PAD_STREAM_LOCK (basesink->sinkpad);
-
- /* would be nice to arrange for pad_alloc_buffer to return data -- as it is we
- will copy twice, once into data, once into DMA */
- GST_LOG_OBJECT (basesink, "pulling %d bytes offset %" G_GUINT64_FORMAT
- " to fill audio buffer", len, basesink->offset);
- ret =
- gst_pad_pull_range (basesink->sinkpad, basesink->segment.last_stop, len,
- &buf);
-
- if (ret != GST_FLOW_OK) {
- if (ret == GST_FLOW_UNEXPECTED)
- goto eos;
- else
- goto error;
- }
-
- GST_PAD_PREROLL_LOCK (basesink->sinkpad);
- if (basesink->flushing)
- goto flushing;
-
- /* complete preroll and wait for PLAYING */
- ret = gst_base_sink_do_preroll (basesink, GST_MINI_OBJECT_CAST (buf));
- if (ret != GST_FLOW_OK)
- goto preroll_error;
-
- if (len != GST_BUFFER_SIZE (buf)) {
- GST_INFO_OBJECT (basesink,
- "got different size than requested from sink pad: %u != %u", len,
- GST_BUFFER_SIZE (buf));
- len = MIN (GST_BUFFER_SIZE (buf), len);
- }
-
- basesink->segment.last_stop += len;
-
- memcpy (data, GST_BUFFER_DATA (buf), len);
- GST_PAD_PREROLL_UNLOCK (basesink->sinkpad);
-
- GST_PAD_STREAM_UNLOCK (basesink->sinkpad);
-
- return;
-
-error:
- {
- GST_WARNING_OBJECT (basesink, "Got flow '%s' but can't return it: %d",
- gst_flow_get_name (ret), ret);
- gst_ring_buffer_pause (rbuf);
- GST_PAD_STREAM_UNLOCK (basesink->sinkpad);
- return;
- }
-eos:
- {
- /* FIXME: this is not quite correct; we'll be called endlessly until
- * the sink gets shut down; maybe we should set a flag somewhere, or
- * set segment.stop and segment.duration to the last sample or so */
- GST_DEBUG_OBJECT (sink, "EOS");
- gst_base_audio_sink_drain (sink);
- gst_ring_buffer_pause (rbuf);
- gst_element_post_message (GST_ELEMENT_CAST (sink),
- gst_message_new_eos (GST_OBJECT_CAST (sink)));
- GST_PAD_STREAM_UNLOCK (basesink->sinkpad);
- }
-flushing:
- {
- GST_DEBUG_OBJECT (sink, "we are flushing");
- gst_ring_buffer_pause (rbuf);
- GST_PAD_PREROLL_UNLOCK (basesink->sinkpad);
- GST_PAD_STREAM_UNLOCK (basesink->sinkpad);
- return;
- }
-preroll_error:
- {
- GST_DEBUG_OBJECT (sink, "error %s", gst_flow_get_name (ret));
- gst_ring_buffer_pause (rbuf);
- GST_PAD_PREROLL_UNLOCK (basesink->sinkpad);
- GST_PAD_STREAM_UNLOCK (basesink->sinkpad);
- return;
- }
-}
-
-static gboolean
-gst_base_audio_sink_activate_pull (GstBaseSink * basesink, gboolean active)
-{
- gboolean ret;
- GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (basesink);
-
- if (active) {
- GST_DEBUG_OBJECT (basesink, "activating pull");
-
- gst_ring_buffer_set_callback (sink->ringbuffer,
- gst_base_audio_sink_callback, sink);
-
- ret = gst_ring_buffer_activate (sink->ringbuffer, TRUE);
- } else {
- GST_DEBUG_OBJECT (basesink, "deactivating pull");
- gst_ring_buffer_set_callback (sink->ringbuffer, NULL, NULL);
- ret = gst_ring_buffer_activate (sink->ringbuffer, FALSE);
- }
-
- return ret;
-}
-
-/* should be called with the LOCK */
-static GstStateChangeReturn
-gst_base_audio_sink_async_play (GstBaseSink * basesink)
-{
- GstBaseAudioSink *sink;
-
- sink = GST_BASE_AUDIO_SINK (basesink);
-
- GST_DEBUG_OBJECT (sink, "ringbuffer may start now");
- sink->priv->sync_latency = TRUE;
- gst_ring_buffer_may_start (sink->ringbuffer, TRUE);
- if (basesink->pad_mode == GST_ACTIVATE_PULL) {
- /* we always start the ringbuffer in pull mode immediatly */
- gst_ring_buffer_start (sink->ringbuffer);
- }
-
- return GST_STATE_CHANGE_SUCCESS;
-}
-
-static GstStateChangeReturn
-gst_base_audio_sink_change_state (GstElement * element,
- GstStateChange transition)
-{
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
- GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- if (sink->ringbuffer == NULL) {
- gst_audio_clock_reset (GST_AUDIO_CLOCK (sink->provided_clock), 0);
- sink->ringbuffer = gst_base_audio_sink_create_ringbuffer (sink);
- }
- if (!gst_ring_buffer_open_device (sink->ringbuffer))
- goto open_failed;
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- sink->next_sample = -1;
- sink->priv->last_align = -1;
- sink->priv->eos_time = -1;
- gst_ring_buffer_set_flushing (sink->ringbuffer, FALSE);
- gst_ring_buffer_may_start (sink->ringbuffer, FALSE);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- GST_OBJECT_LOCK (sink);
- GST_DEBUG_OBJECT (sink, "ringbuffer may start now");
- sink->priv->sync_latency = TRUE;
- GST_OBJECT_UNLOCK (sink);
-
- gst_ring_buffer_may_start (sink->ringbuffer, TRUE);
- if (GST_BASE_SINK_CAST (sink)->pad_mode == GST_ACTIVATE_PULL) {
- /* we always start the ringbuffer in pull mode immediatly */
- gst_ring_buffer_start (sink->ringbuffer);
- }
- break;
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- /* ringbuffer cannot start anymore */
- gst_ring_buffer_may_start (sink->ringbuffer, FALSE);
- gst_ring_buffer_pause (sink->ringbuffer);
-
- GST_OBJECT_LOCK (sink);
- sink->priv->sync_latency = FALSE;
- GST_OBJECT_UNLOCK (sink);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- /* make sure we unblock before calling the parent state change
- * so it can grab the STREAM_LOCK */
- gst_ring_buffer_set_flushing (sink->ringbuffer, TRUE);
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- /* stop slaving ourselves to the master, if any */
- gst_clock_set_master (sink->provided_clock, NULL);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- gst_ring_buffer_activate (sink->ringbuffer, FALSE);
- gst_ring_buffer_release (sink->ringbuffer);
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- /* we release again here because the aqcuire happens when setting the
- * caps, which happens before we commit the state to PAUSED and thus the
- * PAUSED->READY state change (see above, where we release the ringbuffer)
- * might not be called when we get here. */
- gst_ring_buffer_activate (sink->ringbuffer, FALSE);
- gst_ring_buffer_release (sink->ringbuffer);
- gst_ring_buffer_close_device (sink->ringbuffer);
- GST_OBJECT_LOCK (sink);
- gst_object_unparent (GST_OBJECT_CAST (sink->ringbuffer));
- sink->ringbuffer = NULL;
- GST_OBJECT_UNLOCK (sink);
- break;
- default:
- break;
- }
-
- return ret;
-
- /* ERRORS */
-open_failed:
- {
- /* subclass must post a meaningfull error message */
- GST_DEBUG_OBJECT (sink, "open failed");
- return GST_STATE_CHANGE_FAILURE;
- }
-}
diff --git a/gst-libs/gst/audio/gstbaseaudiosink.h b/gst-libs/gst/audio/gstbaseaudiosink.h
deleted file mode 100644
index cf971527..00000000
--- a/gst-libs/gst/audio/gstbaseaudiosink.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2005 Wim Taymans <wim@fluendo.com>
- *
- * gstbaseaudiosink.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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 GstRingBuffer in addition to overriding
- * the methods in GstBaseSink and this class.
- */
-
-#ifndef __GST_BASE_AUDIO_SINK_H__
-#define __GST_BASE_AUDIO_SINK_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstbasesink.h>
-#include "gstringbuffer.h"
-#include "gstaudioclock.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_BASE_AUDIO_SINK (gst_base_audio_sink_get_type())
-#define GST_BASE_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_AUDIO_SINK,GstBaseAudioSink))
-#define GST_BASE_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_AUDIO_SINK,GstBaseAudioSinkClass))
-#define GST_BASE_AUDIO_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_AUDIO_SINK, GstBaseAudioSinkClass))
-#define GST_IS_BASE_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_AUDIO_SINK))
-#define GST_IS_BASE_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_AUDIO_SINK))
-
-/**
- * GST_BASE_AUDIO_SINK_CLOCK:
- * @obj: a #GstBaseAudioSink
- *
- * Get the #GstClock of @obj.
- */
-#define GST_BASE_AUDIO_SINK_CLOCK(obj) (GST_BASE_AUDIO_SINK (obj)->clock)
-/**
- * GST_BASE_AUDIO_SINK_PAD:
- * @obj: a #GstBaseAudioSink
- *
- * Get the sink #GstPad of @obj.
- */
-#define GST_BASE_AUDIO_SINK_PAD(obj) (GST_BASE_SINK (obj)->sinkpad)
-
-/**
- * GstBaseAudioSinkSlaveMethod:
- * @GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE: Resample to match the master clock
- * @GST_BASE_AUDIO_SINK_SLAVE_SKEW: Adjust playout pointer when master clock
- * drifts too much.
- * @GST_BASE_AUDIO_SINK_SLAVE_NONE: No adjustment is done.
- *
- * Different possible clock slaving algorithms used when the internal audio
- * clock is not selected as the pipeline master clock.
- */
-typedef enum
-{
- GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE,
- GST_BASE_AUDIO_SINK_SLAVE_SKEW,
- GST_BASE_AUDIO_SINK_SLAVE_NONE
-} GstBaseAudioSinkSlaveMethod;
-
-#define GST_TYPE_BASE_AUDIO_SINK_SLAVE_METHOD (gst_base_audio_sink_slave_method_get_type ())
-
-typedef struct _GstBaseAudioSink GstBaseAudioSink;
-typedef struct _GstBaseAudioSinkClass GstBaseAudioSinkClass;
-typedef struct _GstBaseAudioSinkPrivate GstBaseAudioSinkPrivate;
-
-/**
- * GstBaseAudioSink:
- *
- * Opaque #GstBaseAudioSink.
- */
-struct _GstBaseAudioSink {
- GstBaseSink element;
-
- /*< protected >*/ /* with LOCK */
- /* our ringbuffer */
- GstRingBuffer *ringbuffer;
-
- /* required buffer and latency in microseconds */
- guint64 buffer_time;
- guint64 latency_time;
-
- /* the next sample to write */
- guint64 next_sample;
-
- /* clock */
- gboolean provide_clock;
- GstClock *provided_clock;
-
- /*< private >*/
- GstBaseAudioSinkPrivate *priv;
-
- gpointer _gst_reserved[GST_PADDING - 1];
-};
-
-/**
- * GstBaseAudioSinkClass:
- * @parent_class: the parent class.
- * @create_ringbuffer: create and return a #GstRingBuffer to write to.
- *
- * #GstBaseAudioSink class. Override the vmethod to implement
- * functionality.
- */
-struct _GstBaseAudioSinkClass {
- GstBaseSinkClass parent_class;
-
- /* subclass ringbuffer allocation */
- GstRingBuffer* (*create_ringbuffer) (GstBaseAudioSink *sink);
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_base_audio_sink_get_type(void);
-GType gst_base_audio_sink_slave_method_get_type (void);
-
-GstRingBuffer *gst_base_audio_sink_create_ringbuffer (GstBaseAudioSink *sink);
-
-void gst_base_audio_sink_set_provide_clock (GstBaseAudioSink *sink, gboolean provide);
-gboolean gst_base_audio_sink_get_provide_clock (GstBaseAudioSink *sink);
-
-void gst_base_audio_sink_set_slave_method (GstBaseAudioSink *sink,
- GstBaseAudioSinkSlaveMethod method);
-GstBaseAudioSinkSlaveMethod
- gst_base_audio_sink_get_slave_method (GstBaseAudioSink *sink);
-
-G_END_DECLS
-
-#endif /* __GST_BASE_AUDIO_SINK_H__ */
diff --git a/gst-libs/gst/audio/gstbaseaudiosrc.c b/gst-libs/gst/audio/gstbaseaudiosrc.c
deleted file mode 100644
index 02ce8ec7..00000000
--- a/gst-libs/gst/audio/gstbaseaudiosrc.c
+++ /dev/null
@@ -1,1125 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2005 Wim Taymans <wim@fluendo.com>
- *
- * gstbaseaudiosrc.c:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-/**
- * SECTION:gstbaseaudiosrc
- * @short_description: Base class for audio sources
- * @see_also: #GstAudioSrc, #GstRingBuffer.
- *
- * This is the base class for audio sources. Subclasses need to implement the
- * ::create_ringbuffer vmethod. This base class will then take care of
- * reading samples from the ringbuffer, synchronisation and flushing.
- *
- * Last reviewed on 2006-09-27 (0.10.12)
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <string.h>
-
-#include "gstbaseaudiosrc.h"
-
-#include "gst/gst-i18n-plugin.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_base_audio_src_debug);
-#define GST_CAT_DEFAULT gst_base_audio_src_debug
-
-GType
-gst_base_audio_src_slave_method_get_type (void)
-{
- static GType slave_method_type = 0;
- static const GEnumValue slave_method[] = {
- {GST_BASE_AUDIO_SRC_SLAVE_RESAMPLE, "Resampling slaving", "resample"},
- {GST_BASE_AUDIO_SRC_SLAVE_RETIMESTAMP, "Re-timestamp", "re-timestamp"},
- {GST_BASE_AUDIO_SRC_SLAVE_SKEW, "Skew", "skew"},
- {GST_BASE_AUDIO_SRC_SLAVE_NONE, "No slaving", "none"},
- {0, NULL, NULL},
- };
-
- if (!slave_method_type) {
- slave_method_type =
- g_enum_register_static ("GstBaseAudioSrcSlaveMethod", slave_method);
- }
- return slave_method_type;
-}
-
-#define GST_BASE_AUDIO_SRC_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BASE_AUDIO_SRC, GstBaseAudioSrcPrivate))
-
-struct _GstBaseAudioSrcPrivate
-{
- gboolean provide_clock;
-
- /* the clock slaving algorithm in use */
- GstBaseAudioSrcSlaveMethod slave_method;
-};
-
-/* BaseAudioSrc signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-#define DEFAULT_BUFFER_TIME ((200 * GST_MSECOND) / GST_USECOND)
-#define DEFAULT_LATENCY_TIME ((10 * GST_MSECOND) / GST_USECOND)
-#define DEFAULT_ACTUAL_BUFFER_TIME -1
-#define DEFAULT_ACTUAL_LATENCY_TIME -1
-#define DEFAULT_PROVIDE_CLOCK TRUE
-#define DEFAULT_SLAVE_METHOD GST_BASE_AUDIO_SRC_SLAVE_SKEW
-
-enum
-{
- PROP_0,
- PROP_BUFFER_TIME,
- PROP_LATENCY_TIME,
- PROP_ACTUAL_BUFFER_TIME,
- PROP_ACTUAL_LATENCY_TIME,
- PROP_PROVIDE_CLOCK,
- PROP_SLAVE_METHOD,
- PROP_LAST
-};
-
-static void
-_do_init (GType type)
-{
- GST_DEBUG_CATEGORY_INIT (gst_base_audio_src_debug, "baseaudiosrc", 0,
- "baseaudiosrc element");
-
-#ifdef ENABLE_NLS
- GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
- LOCALEDIR);
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif /* ENABLE_NLS */
-}
-
-GST_BOILERPLATE_FULL (GstBaseAudioSrc, gst_base_audio_src, GstPushSrc,
- GST_TYPE_PUSH_SRC, _do_init);
-
-static void gst_base_audio_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_base_audio_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_base_audio_src_dispose (GObject * object);
-
-static GstStateChangeReturn gst_base_audio_src_change_state (GstElement *
- element, GstStateChange transition);
-
-static GstClock *gst_base_audio_src_provide_clock (GstElement * elem);
-static GstClockTime gst_base_audio_src_get_time (GstClock * clock,
- GstBaseAudioSrc * src);
-
-static GstFlowReturn gst_base_audio_src_create (GstBaseSrc * bsrc,
- guint64 offset, guint length, GstBuffer ** buf);
-static gboolean gst_base_audio_src_check_get_range (GstBaseSrc * bsrc);
-
-static gboolean gst_base_audio_src_event (GstBaseSrc * bsrc, GstEvent * event);
-static void gst_base_audio_src_get_times (GstBaseSrc * bsrc,
- GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
-static gboolean gst_base_audio_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps);
-static gboolean gst_base_audio_src_query (GstBaseSrc * bsrc, GstQuery * query);
-static void gst_base_audio_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
-
-/* static guint gst_base_audio_src_signals[LAST_SIGNAL] = { 0 }; */
-
-static void
-gst_base_audio_src_base_init (gpointer g_class)
-{
-}
-
-static void
-gst_base_audio_src_class_init (GstBaseAudioSrcClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- GstBaseSrcClass *gstbasesrc_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
- gstbasesrc_class = (GstBaseSrcClass *) klass;
-
- g_type_class_add_private (klass, sizeof (GstBaseAudioSrcPrivate));
-
- gobject_class->set_property = gst_base_audio_src_set_property;
- gobject_class->get_property = gst_base_audio_src_get_property;
- gobject_class->dispose = gst_base_audio_src_dispose;
-
- g_object_class_install_property (gobject_class, PROP_BUFFER_TIME,
- g_param_spec_int64 ("buffer-time", "Buffer Time",
- "Size of audio buffer in microseconds", 1,
- G_MAXINT64, DEFAULT_BUFFER_TIME,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_LATENCY_TIME,
- g_param_spec_int64 ("latency-time", "Latency Time",
- "Audio latency in microseconds", 1,
- G_MAXINT64, DEFAULT_LATENCY_TIME,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstBaseAudioSrc:actual-buffer-time:
- *
- * Actual configured size of audio buffer in microseconds.
- *
- * Since: 0.10.20
- **/
- g_object_class_install_property (gobject_class, PROP_ACTUAL_BUFFER_TIME,
- g_param_spec_int64 ("actual-buffer-time", "Actual Buffer Time",
- "Actual configured size of audio buffer in microseconds",
- DEFAULT_ACTUAL_BUFFER_TIME, G_MAXINT64, DEFAULT_ACTUAL_BUFFER_TIME,
- G_PARAM_READABLE));
-
- /**
- * GstBaseAudioSrc:actual-latency-time:
- *
- * Actual configured audio latency in microseconds.
- *
- * Since: 0.10.20
- **/
- g_object_class_install_property (gobject_class, PROP_ACTUAL_LATENCY_TIME,
- g_param_spec_int64 ("actual-latency-time", "Actual Latency Time",
- "Actual configured audio latency in microseconds",
- DEFAULT_ACTUAL_LATENCY_TIME, G_MAXINT64, DEFAULT_ACTUAL_LATENCY_TIME,
- G_PARAM_READABLE));
-
- g_object_class_install_property (gobject_class, PROP_PROVIDE_CLOCK,
- g_param_spec_boolean ("provide-clock", "Provide Clock",
- "Provide a clock to be used as the global pipeline clock",
- DEFAULT_PROVIDE_CLOCK, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SLAVE_METHOD,
- g_param_spec_enum ("slave-method", "Slave Method",
- "Algorithm to use to match the rate of the masterclock",
- GST_TYPE_BASE_AUDIO_SRC_SLAVE_METHOD, DEFAULT_SLAVE_METHOD,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_base_audio_src_change_state);
- gstelement_class->provide_clock =
- GST_DEBUG_FUNCPTR (gst_base_audio_src_provide_clock);
-
- gstbasesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_base_audio_src_setcaps);
- gstbasesrc_class->event = GST_DEBUG_FUNCPTR (gst_base_audio_src_event);
- gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_base_audio_src_query);
- gstbasesrc_class->get_times =
- GST_DEBUG_FUNCPTR (gst_base_audio_src_get_times);
- gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_base_audio_src_create);
- gstbasesrc_class->check_get_range =
- GST_DEBUG_FUNCPTR (gst_base_audio_src_check_get_range);
- gstbasesrc_class->fixate = GST_DEBUG_FUNCPTR (gst_base_audio_src_fixate);
-
- /* ref class from a thread-safe context to work around missing bit of
- * thread-safety in GObject */
- g_type_class_ref (GST_TYPE_AUDIO_CLOCK);
- g_type_class_ref (GST_TYPE_RING_BUFFER);
-}
-
-static void
-gst_base_audio_src_init (GstBaseAudioSrc * baseaudiosrc,
- GstBaseAudioSrcClass * g_class)
-{
- baseaudiosrc->priv = GST_BASE_AUDIO_SRC_GET_PRIVATE (baseaudiosrc);
-
- baseaudiosrc->buffer_time = DEFAULT_BUFFER_TIME;
- baseaudiosrc->latency_time = DEFAULT_LATENCY_TIME;
- baseaudiosrc->priv->provide_clock = DEFAULT_PROVIDE_CLOCK;
- baseaudiosrc->priv->slave_method = DEFAULT_SLAVE_METHOD;
- /* reset blocksize we use latency time to calculate a more useful
- * value based on negotiated format. */
- GST_BASE_SRC (baseaudiosrc)->blocksize = 0;
-
- baseaudiosrc->clock = gst_audio_clock_new ("GstAudioSrcClock",
- (GstAudioClockGetTimeFunc) gst_base_audio_src_get_time, baseaudiosrc);
-
- /* we are always a live source */
- gst_base_src_set_live (GST_BASE_SRC (baseaudiosrc), TRUE);
- /* we operate in time */
- gst_base_src_set_format (GST_BASE_SRC (baseaudiosrc), GST_FORMAT_TIME);
-}
-
-static void
-gst_base_audio_src_dispose (GObject * object)
-{
- GstBaseAudioSrc *src;
-
- src = GST_BASE_AUDIO_SRC (object);
-
- GST_OBJECT_LOCK (src);
- if (src->clock)
- gst_object_unref (src->clock);
- src->clock = NULL;
-
- if (src->ringbuffer) {
- gst_object_unparent (GST_OBJECT_CAST (src->ringbuffer));
- src->ringbuffer = NULL;
- }
- GST_OBJECT_UNLOCK (src);
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static GstClock *
-gst_base_audio_src_provide_clock (GstElement * elem)
-{
- GstBaseAudioSrc *src;
- GstClock *clock;
-
- src = GST_BASE_AUDIO_SRC (elem);
-
- /* we have no ringbuffer (must be NULL state) */
- if (src->ringbuffer == NULL)
- goto wrong_state;
-
- if (!gst_ring_buffer_is_acquired (src->ringbuffer))
- goto wrong_state;
-
- GST_OBJECT_LOCK (src);
- if (!src->priv->provide_clock)
- goto clock_disabled;
-
- clock = GST_CLOCK_CAST (gst_object_ref (src->clock));
- GST_OBJECT_UNLOCK (src);
-
- return clock;
-
- /* ERRORS */
-wrong_state:
- {
- GST_DEBUG_OBJECT (src, "ringbuffer not acquired");
- return NULL;
- }
-clock_disabled:
- {
- GST_DEBUG_OBJECT (src, "clock provide disabled");
- GST_OBJECT_UNLOCK (src);
- return NULL;
- }
-}
-
-static GstClockTime
-gst_base_audio_src_get_time (GstClock * clock, GstBaseAudioSrc * src)
-{
- guint64 raw, samples;
- guint delay;
- GstClockTime result;
-
- if (G_UNLIKELY (src->ringbuffer == NULL || src->ringbuffer->spec.rate == 0))
- return GST_CLOCK_TIME_NONE;
-
- raw = samples = gst_ring_buffer_samples_done (src->ringbuffer);
-
- /* the number of samples not yet processed, this is still queued in the
- * device (not yet read for capture). */
- delay = gst_ring_buffer_delay (src->ringbuffer);
-
- samples += delay;
-
- result = gst_util_uint64_scale_int (samples, GST_SECOND,
- src->ringbuffer->spec.rate);
-
- GST_DEBUG_OBJECT (src,
- "processed samples: raw %" G_GUINT64_FORMAT ", delay %u, real %"
- G_GUINT64_FORMAT ", time %" GST_TIME_FORMAT, raw, delay, samples,
- GST_TIME_ARGS (result));
-
- return result;
-}
-
-static gboolean
-gst_base_audio_src_check_get_range (GstBaseSrc * bsrc)
-{
- /* we allow limited pull base operation of which the details
- * will eventually exposed in an as of yet non-existing query.
- * Basically pulling can be done on any number of bytes as long
- * as the offset is -1 or sequentially increasing. */
- return TRUE;
-}
-
-/**
- * gst_base_audio_src_set_provide_clock:
- * @src: a #GstBaseAudioSrc
- * @provide: new state
- *
- * Controls whether @src will provide a clock or not. If @provide is %TRUE,
- * gst_element_provide_clock() will return a clock that reflects the datarate
- * of @src. If @provide is %FALSE, gst_element_provide_clock() will return NULL.
- *
- * Since: 0.10.16
- */
-void
-gst_base_audio_src_set_provide_clock (GstBaseAudioSrc * src, gboolean provide)
-{
- g_return_if_fail (GST_IS_BASE_AUDIO_SRC (src));
-
- GST_OBJECT_LOCK (src);
- src->priv->provide_clock = provide;
- GST_OBJECT_UNLOCK (src);
-}
-
-/**
- * gst_base_audio_src_get_provide_clock:
- * @src: a #GstBaseAudioSrc
- *
- * Queries whether @src will provide a clock or not. See also
- * gst_base_audio_src_set_provide_clock.
- *
- * Returns: %TRUE if @src will provide a clock.
- *
- * Since: 0.10.16
- */
-gboolean
-gst_base_audio_src_get_provide_clock (GstBaseAudioSrc * src)
-{
- gboolean result;
-
- g_return_val_if_fail (GST_IS_BASE_AUDIO_SRC (src), FALSE);
-
- GST_OBJECT_LOCK (src);
- result = src->priv->provide_clock;
- GST_OBJECT_UNLOCK (src);
-
- return result;
-}
-
-/**
- * gst_base_audio_src_set_slave_method:
- * @src: a #GstBaseAudioSrc
- * @method: the new slave method
- *
- * Controls how clock slaving will be performed in @src.
- *
- * Since: 0.10.20
- */
-void
-gst_base_audio_src_set_slave_method (GstBaseAudioSrc * src,
- GstBaseAudioSrcSlaveMethod method)
-{
- g_return_if_fail (GST_IS_BASE_AUDIO_SRC (src));
-
- GST_OBJECT_LOCK (src);
- src->priv->slave_method = method;
- GST_OBJECT_UNLOCK (src);
-}
-
-/**
- * gst_base_audio_src_get_slave_method:
- * @src: a #GstBaseAudioSrc
- *
- * Get the current slave method used by @src.
- *
- * Returns: The current slave method used by @src.
- *
- * Since: 0.10.20
- */
-GstBaseAudioSrcSlaveMethod
-gst_base_audio_src_get_slave_method (GstBaseAudioSrc * src)
-{
- GstBaseAudioSrcSlaveMethod result;
-
- g_return_val_if_fail (GST_IS_BASE_AUDIO_SRC (src), -1);
-
- GST_OBJECT_LOCK (src);
- result = src->priv->slave_method;
- GST_OBJECT_UNLOCK (src);
-
- return result;
-}
-
-static void
-gst_base_audio_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstBaseAudioSrc *src;
-
- src = GST_BASE_AUDIO_SRC (object);
-
- switch (prop_id) {
- case PROP_BUFFER_TIME:
- src->buffer_time = g_value_get_int64 (value);
- break;
- case PROP_LATENCY_TIME:
- src->latency_time = g_value_get_int64 (value);
- break;
- case PROP_PROVIDE_CLOCK:
- gst_base_audio_src_set_provide_clock (src, g_value_get_boolean (value));
- break;
- case PROP_SLAVE_METHOD:
- gst_base_audio_src_set_slave_method (src, g_value_get_enum (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_base_audio_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstBaseAudioSrc *src;
-
- src = GST_BASE_AUDIO_SRC (object);
-
- switch (prop_id) {
- case PROP_BUFFER_TIME:
- g_value_set_int64 (value, src->buffer_time);
- break;
- case PROP_LATENCY_TIME:
- g_value_set_int64 (value, src->latency_time);
- break;
- case PROP_ACTUAL_BUFFER_TIME:
- GST_OBJECT_LOCK (src);
- if (src->ringbuffer && src->ringbuffer->acquired)
- g_value_set_int64 (value, src->ringbuffer->spec.buffer_time);
- else
- g_value_set_int64 (value, DEFAULT_ACTUAL_BUFFER_TIME);
- GST_OBJECT_UNLOCK (src);
- break;
- case PROP_ACTUAL_LATENCY_TIME:
- GST_OBJECT_LOCK (src);
- if (src->ringbuffer && src->ringbuffer->acquired)
- g_value_set_int64 (value, src->ringbuffer->spec.latency_time);
- else
- g_value_set_int64 (value, DEFAULT_ACTUAL_LATENCY_TIME);
- GST_OBJECT_UNLOCK (src);
- break;
- case PROP_PROVIDE_CLOCK:
- g_value_set_boolean (value, gst_base_audio_src_get_provide_clock (src));
- break;
- case PROP_SLAVE_METHOD:
- g_value_set_enum (value, gst_base_audio_src_get_slave_method (src));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_base_audio_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
-{
- GstStructure *s;
- gint width, depth;
-
- s = gst_caps_get_structure (caps, 0);
-
- /* fields for all formats */
- gst_structure_fixate_field_nearest_int (s, "rate", 44100);
- gst_structure_fixate_field_nearest_int (s, "channels", 2);
- gst_structure_fixate_field_nearest_int (s, "width", 16);
-
- /* fields for int */
- if (gst_structure_has_field (s, "depth")) {
- gst_structure_get_int (s, "width", &width);
- /* round width to nearest multiple of 8 for the depth */
- depth = GST_ROUND_UP_8 (width);
- gst_structure_fixate_field_nearest_int (s, "depth", depth);
- }
- if (gst_structure_has_field (s, "signed"))
- gst_structure_fixate_field_boolean (s, "signed", TRUE);
- if (gst_structure_has_field (s, "endianness"))
- gst_structure_fixate_field_nearest_int (s, "endianness", G_BYTE_ORDER);
-}
-
-static gboolean
-gst_base_audio_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
-{
- GstBaseAudioSrc *src = GST_BASE_AUDIO_SRC (bsrc);
- GstRingBufferSpec *spec;
-
- spec = &src->ringbuffer->spec;
-
- spec->buffer_time = src->buffer_time;
- spec->latency_time = src->latency_time;
-
- if (!gst_ring_buffer_parse_caps (spec, caps))
- goto parse_error;
-
- /* calculate suggested segsize and segtotal */
- spec->segsize =
- spec->rate * spec->bytes_per_sample * spec->latency_time / GST_MSECOND;
- spec->segtotal = spec->buffer_time / spec->latency_time;
-
- GST_DEBUG ("release old ringbuffer");
-
- gst_ring_buffer_release (src->ringbuffer);
-
- gst_ring_buffer_debug_spec_buff (spec);
-
- GST_DEBUG ("acquire new ringbuffer");
-
- if (!gst_ring_buffer_acquire (src->ringbuffer, spec))
- goto acquire_error;
-
- /* calculate actual latency and buffer times */
- spec->latency_time =
- spec->segsize * GST_MSECOND / (spec->rate * spec->bytes_per_sample);
- spec->buffer_time =
- spec->segtotal * spec->segsize * GST_MSECOND / (spec->rate *
- spec->bytes_per_sample);
-
- gst_ring_buffer_debug_spec_buff (spec);
-
- g_object_notify (G_OBJECT (src), "actual-buffer-time");
- g_object_notify (G_OBJECT (src), "actual-latency-time");
-
- return TRUE;
-
- /* ERRORS */
-parse_error:
- {
- GST_DEBUG ("could not parse caps");
- return FALSE;
- }
-acquire_error:
- {
- GST_DEBUG ("could not acquire ringbuffer");
- return FALSE;
- }
-}
-
-static void
-gst_base_audio_src_get_times (GstBaseSrc * bsrc, GstBuffer * buffer,
- GstClockTime * start, GstClockTime * end)
-{
- /* no need to sync to a clock here, we schedule the samples based
- * on our own clock for the moment. */
- *start = GST_CLOCK_TIME_NONE;
- *end = GST_CLOCK_TIME_NONE;
-}
-
-static gboolean
-gst_base_audio_src_query (GstBaseSrc * bsrc, GstQuery * query)
-{
- GstBaseAudioSrc *src = GST_BASE_AUDIO_SRC (bsrc);
- gboolean res = FALSE;
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_LATENCY:
- {
- GstClockTime min_latency, max_latency;
- GstRingBufferSpec *spec;
-
- if (G_UNLIKELY (src->ringbuffer == NULL
- || src->ringbuffer->spec.rate == 0))
- goto done;
-
- spec = &src->ringbuffer->spec;
-
- /* we have at least 1 segment of latency */
- min_latency =
- gst_util_uint64_scale_int (spec->segsize, GST_SECOND,
- spec->rate * spec->bytes_per_sample);
- /* we cannot delay more than the buffersize else we lose data */
- max_latency =
- gst_util_uint64_scale_int (spec->segtotal * spec->segsize, GST_SECOND,
- spec->rate * spec->bytes_per_sample);
-
- GST_DEBUG_OBJECT (src,
- "report latency min %" GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
- GST_TIME_ARGS (min_latency), GST_TIME_ARGS (max_latency));
-
- /* we are always live, the min latency is 1 segment and the max latency is
- * the complete buffer of segments. */
- gst_query_set_latency (query, TRUE, min_latency, max_latency);
-
- res = TRUE;
- break;
- }
- default:
- res = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
- break;
- }
-done:
- return res;
-}
-
-static gboolean
-gst_base_audio_src_event (GstBaseSrc * bsrc, GstEvent * event)
-{
- GstBaseAudioSrc *src = GST_BASE_AUDIO_SRC (bsrc);
- gboolean res;
-
- res = TRUE;
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_START:
- GST_DEBUG_OBJECT (bsrc, "flush-start");
- gst_ring_buffer_pause (src->ringbuffer);
- gst_ring_buffer_clear_all (src->ringbuffer);
- break;
- case GST_EVENT_FLUSH_STOP:
- GST_DEBUG_OBJECT (bsrc, "flush-stop");
- /* always resync on sample after a flush */
- src->next_sample = -1;
- gst_ring_buffer_clear_all (src->ringbuffer);
- break;
- case GST_EVENT_SEEK:
- GST_DEBUG_OBJECT (bsrc, "refuse to seek");
- res = FALSE;
- break;
- default:
- GST_DEBUG_OBJECT (bsrc, "dropping event %p", event);
- break;
- }
- return res;
-}
-
-/* get the next offset in the ringbuffer for reading samples.
- * If the next sample is too far away, this function will position itself to the
- * next most recent sample, creating discontinuity */
-static guint64
-gst_base_audio_src_get_offset (GstBaseAudioSrc * src)
-{
- guint64 sample;
- gint readseg, segdone, segtotal, sps;
- gint diff;
-
- /* assume we can append to the previous sample */
- sample = src->next_sample;
-
- sps = src->ringbuffer->samples_per_seg;
- segtotal = src->ringbuffer->spec.segtotal;
-
- /* get the currently processed segment */
- segdone = g_atomic_int_get (&src->ringbuffer->segdone)
- - src->ringbuffer->segbase;
-
- if (sample != -1) {
- GST_DEBUG_OBJECT (src, "at segment %d and sample %" G_GUINT64_FORMAT,
- segdone, sample);
- /* figure out the segment and the offset inside the segment where
- * the sample should be read from. */
- readseg = sample / sps;
-
- /* see how far away it is from the read segment, normally segdone (where new
- * data is written in the ringbuffer) is bigger than readseg (where we are
- * reading). */
- diff = segdone - readseg;
- if (diff >= segtotal) {
- GST_DEBUG_OBJECT (src, "dropped, align to segment %d", segdone);
- /* sample would be dropped, position to next playable position */
- sample = ((guint64) (segdone)) * sps;
- }
- } else {
- /* no previous sample, go to the current position */
- GST_DEBUG_OBJECT (src, "first sample, align to current %d", segdone);
- sample = ((guint64) (segdone)) * sps;
- readseg = segdone;
- }
-
- GST_DEBUG_OBJECT (src,
- "reading from %d, we are at %d, sample %" G_GUINT64_FORMAT, readseg,
- segdone, sample);
-
- return sample;
-}
-
-static GstFlowReturn
-gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
- GstBuffer ** outbuf)
-{
- GstBaseAudioSrc *src = GST_BASE_AUDIO_SRC (bsrc);
- GstBuffer *buf;
- guchar *data;
- guint samples, total_samples;
- guint64 sample;
- gint bps;
- GstRingBuffer *ringbuffer;
- GstRingBufferSpec *spec;
- guint read;
- GstClockTime timestamp, duration;
- GstClock *clock;
-
- ringbuffer = src->ringbuffer;
- spec = &ringbuffer->spec;
-
- if (G_UNLIKELY (!gst_ring_buffer_is_acquired (ringbuffer)))
- goto wrong_state;
-
- bps = spec->bytes_per_sample;
-
- if ((length == 0 && bsrc->blocksize == 0) || length == -1)
- /* no length given, use the default segment size */
- length = spec->segsize;
- else
- /* make sure we round down to an integral number of samples */
- length -= length % bps;
-
- /* figure out the offset in the ringbuffer */
- if (G_UNLIKELY (offset != -1)) {
- sample = offset / bps;
- /* if a specific offset was given it must be the next sequential
- * offset we expect or we fail for now. */
- if (src->next_sample != -1 && sample != src->next_sample)
- goto wrong_offset;
- } else {
- /* calculate the sequentially next sample we need to read. This can jump and
- * create a DISCONT. */
- sample = gst_base_audio_src_get_offset (src);
- }
-
- GST_DEBUG_OBJECT (src, "reading from sample %" G_GUINT64_FORMAT, sample);
-
- /* get the number of samples to read */
- total_samples = samples = length / bps;
-
- /* FIXME, using a bufferpool would be nice here */
- buf = gst_buffer_new_and_alloc (length);
- data = GST_BUFFER_DATA (buf);
-
- do {
- read = gst_ring_buffer_read (ringbuffer, sample, data, samples);
- GST_DEBUG_OBJECT (src, "read %u of %u", read, samples);
- /* if we read all, we're done */
- if (read == samples)
- break;
-
- /* else something interrupted us and we wait for playing again. */
- GST_DEBUG_OBJECT (src, "wait playing");
- if (gst_base_src_wait_playing (bsrc) != GST_FLOW_OK)
- goto stopped;
-
- GST_DEBUG_OBJECT (src, "continue playing");
-
- /* read next samples */
- sample += read;
- samples -= read;
- data += read * bps;
- } while (TRUE);
-
- /* mark discontinuity if needed */
- if (G_UNLIKELY (sample != src->next_sample) && src->next_sample != -1) {
- GST_WARNING_OBJECT (src,
- "create DISCONT of %" G_GUINT64_FORMAT " samples at sample %"
- G_GUINT64_FORMAT, sample - src->next_sample, sample);
- GST_ELEMENT_WARNING (src, CORE, CLOCK,
- (_("Can't record audio fast enough")),
- ("Dropped %" G_GUINT64_FORMAT " samples. This is most likely because "
- "downstream can't keep up and is consuming samples too slowly.",
- sample - src->next_sample));
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
- }
-
- src->next_sample = sample + samples;
-
- /* get the normal timestamp to get the duration. */
- timestamp = gst_util_uint64_scale_int (sample, GST_SECOND, spec->rate);
- duration = gst_util_uint64_scale_int (src->next_sample, GST_SECOND,
- spec->rate) - timestamp;
-
- GST_OBJECT_LOCK (src);
- if (!(clock = GST_ELEMENT_CLOCK (src)))
- goto no_sync;
-
- if (clock != src->clock) {
- /* we are slaved, check how to handle this */
- switch (src->priv->slave_method) {
- case GST_BASE_AUDIO_SRC_SLAVE_RESAMPLE:
- /* not implemented, use skew algorithm. This algorithm should
- * work on the readout pointer and produces more or less samples based
- * on the clock drift */
- case GST_BASE_AUDIO_SRC_SLAVE_SKEW:
- {
- GstClockTime running_time;
- GstClockTime base_time;
- GstClockTime current_time;
- guint64 running_time_sample;
- gint running_time_segment;
- gint last_read_segment;
- gint segment_skew;
- gint sps;
- gint segments_written;
- gint last_written_segment;
-
- /* get the amount of segments written from the device by now */
- segments_written = g_atomic_int_get (&ringbuffer->segdone);
-
- /* subtract the base to segments_written to get the number of the
- last written segment in the ringbuffer (one segment written = segment 0) */
- last_written_segment = segments_written - ringbuffer->segbase - 1;
-
- /* samples per segment */
- sps = ringbuffer->samples_per_seg;
-
- /* get the current time */
- current_time = gst_clock_get_time (clock);
-
- /* get the basetime */
- base_time = GST_ELEMENT_CAST (src)->base_time;
-
- /* get the running_time */
- running_time = current_time - base_time;
-
- /* the running_time converted to a sample (relative to the ringbuffer) */
- running_time_sample =
- gst_util_uint64_scale_int (running_time, spec->rate, GST_SECOND);
-
- /* the segmentnr corrensponding to running_time, round down */
- running_time_segment = running_time_sample / sps;
-
- /* the segment currently read from the ringbuffer */
- last_read_segment = sample / sps;
-
- /* the skew we have between running_time and the ringbuffertime (last written to) */
- segment_skew = running_time_segment - last_written_segment;
-
- GST_DEBUG_OBJECT (bsrc,
- "\n running_time = %"
- GST_TIME_FORMAT
- "\n timestamp = %"
- GST_TIME_FORMAT
- "\n running_time_segment = %d"
- "\n last_written_segment = %d"
- "\n segment_skew (running time segment - last_written_segment) = %d"
- "\n last_read_segment = %d",
- GST_TIME_ARGS (running_time), GST_TIME_ARGS (timestamp),
- running_time_segment, last_written_segment, segment_skew,
- last_read_segment);
-
- /* Resync the ringbuffer if:
- *
- * 1. We are more than the length of the ringbuffer behind.
- * The length of the ringbuffer then gets to dictate
- * the threshold for what is concidered "too late"
- *
- * 2. If this is our first buffer.
- * We know that we should catch up to running_time
- * the first time we are ran.
- */
- if ((segment_skew >= ringbuffer->spec.segtotal) ||
- (last_read_segment == 0)) {
- gint new_read_segment;
- gint segment_diff;
- guint64 new_sample;
-
- /* the difference between running_time and the last written segment */
- segment_diff = running_time_segment - last_written_segment;
-
- /* advance the ringbuffer */
- gst_ring_buffer_advance (ringbuffer, segment_diff);
-
- /* we move the new read segment to the last known written segment */
- new_read_segment =
- g_atomic_int_get (&ringbuffer->segdone) - ringbuffer->segbase;
-
- /* we calculate the new sample value */
- new_sample = ((guint64) new_read_segment) * sps;
-
- /* and get the relative time to this -> our new timestamp */
- timestamp =
- gst_util_uint64_scale_int (new_sample, GST_SECOND, spec->rate);
-
- /* we update the next sample accordingly */
- src->next_sample = new_sample + samples;
-
- GST_DEBUG_OBJECT (bsrc,
- "Timeshifted the ringbuffer with %d segments: "
- "Updating the timestamp to %" GST_TIME_FORMAT ", "
- "and src->next_sample to %" G_GUINT64_FORMAT, segment_diff,
- GST_TIME_ARGS (timestamp), src->next_sample);
- }
- break;
- }
- case GST_BASE_AUDIO_SRC_SLAVE_RETIMESTAMP:
- {
- GstClockTime base_time, latency;
-
- /* We are slaved to another clock, take running time of the pipeline clock and
- * timestamp against it. Somebody else in the pipeline should figure out the
- * clock drift. We keep the duration we calculated above. */
- timestamp = gst_clock_get_time (clock);
- base_time = GST_ELEMENT_CAST (src)->base_time;
-
- if (GST_CLOCK_DIFF (timestamp, base_time) < 0)
- timestamp -= base_time;
- else
- timestamp = 0;
-
- /* subtract latency */
- latency =
- gst_util_uint64_scale_int (total_samples, GST_SECOND, spec->rate);
- if (timestamp > latency)
- timestamp -= latency;
- else
- timestamp = 0;
- }
- case GST_BASE_AUDIO_SRC_SLAVE_NONE:
- break;
- }
- } else {
- GstClockTime base_time;
-
- /* to get the timestamp against the clock we also need to add our offset */
- timestamp = gst_audio_clock_adjust (clock, timestamp);
-
- /* we are not slaved, subtract base_time */
- base_time = GST_ELEMENT_CAST (src)->base_time;
-
- if (GST_CLOCK_DIFF (timestamp, base_time) < 0) {
- timestamp -= base_time;
- GST_LOG_OBJECT (src,
- "buffer timestamp %" GST_TIME_FORMAT " (base_time %" GST_TIME_FORMAT
- ")", GST_TIME_ARGS (timestamp), GST_TIME_ARGS (base_time));
- } else {
- GST_LOG_OBJECT (src,
- "buffer timestamp 0, ts %" GST_TIME_FORMAT " <= base_time %"
- GST_TIME_FORMAT, GST_TIME_ARGS (timestamp),
- GST_TIME_ARGS (base_time));
- timestamp = 0;
- }
- }
-
-no_sync:
- GST_OBJECT_UNLOCK (src);
-
- GST_BUFFER_TIMESTAMP (buf) = timestamp;
- GST_BUFFER_DURATION (buf) = duration;
- GST_BUFFER_OFFSET (buf) = sample;
- GST_BUFFER_OFFSET_END (buf) = sample + samples;
-
- *outbuf = buf;
-
- return GST_FLOW_OK;
-
- /* ERRORS */
-wrong_state:
- {
- GST_DEBUG_OBJECT (src, "ringbuffer in wrong state");
- return GST_FLOW_WRONG_STATE;
- }
-wrong_offset:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, SEEK,
- (NULL), ("resource can only be operated on sequentially but offset %"
- G_GUINT64_FORMAT " was given", offset));
- return GST_FLOW_ERROR;
- }
-stopped:
- {
- gst_buffer_unref (buf);
- GST_DEBUG_OBJECT (src, "ringbuffer stopped");
- return GST_FLOW_WRONG_STATE;
- }
-}
-
-/**
- * gst_base_audio_src_create_ringbuffer:
- * @src: a #GstBaseAudioSrc.
- *
- * Create and return the #GstRingBuffer for @src. This function will call the
- * ::create_ringbuffer vmethod and will set @src as the parent of the returned
- * buffer (see gst_object_set_parent()).
- *
- * Returns: The new ringbuffer of @src.
- */
-GstRingBuffer *
-gst_base_audio_src_create_ringbuffer (GstBaseAudioSrc * src)
-{
- GstBaseAudioSrcClass *bclass;
- GstRingBuffer *buffer = NULL;
-
- bclass = GST_BASE_AUDIO_SRC_GET_CLASS (src);
- if (bclass->create_ringbuffer)
- buffer = bclass->create_ringbuffer (src);
-
- if (G_LIKELY (buffer))
- gst_object_set_parent (GST_OBJECT_CAST (buffer), GST_OBJECT_CAST (src));
-
- return buffer;
-}
-
-static GstStateChangeReturn
-gst_base_audio_src_change_state (GstElement * element,
- GstStateChange transition)
-{
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
- GstBaseAudioSrc *src = GST_BASE_AUDIO_SRC (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- GST_DEBUG_OBJECT (src, "NULL->READY");
- GST_OBJECT_LOCK (src);
- if (src->ringbuffer == NULL) {
- gst_audio_clock_reset (GST_AUDIO_CLOCK (src->clock), 0);
- src->ringbuffer = gst_base_audio_src_create_ringbuffer (src);
- }
- GST_OBJECT_UNLOCK (src);
- if (!gst_ring_buffer_open_device (src->ringbuffer))
- goto open_failed;
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- GST_DEBUG_OBJECT (src, "READY->PAUSED");
- src->next_sample = -1;
- gst_ring_buffer_set_flushing (src->ringbuffer, FALSE);
- gst_ring_buffer_may_start (src->ringbuffer, FALSE);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- GST_DEBUG_OBJECT (src, "PAUSED->PLAYING");
- gst_ring_buffer_may_start (src->ringbuffer, TRUE);
- break;
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- GST_DEBUG_OBJECT (src, "PLAYING->PAUSED");
- gst_ring_buffer_may_start (src->ringbuffer, FALSE);
- gst_ring_buffer_pause (src->ringbuffer);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- GST_DEBUG_OBJECT (src, "PAUSED->READY");
- gst_ring_buffer_set_flushing (src->ringbuffer, TRUE);
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- GST_DEBUG_OBJECT (src, "PAUSED->READY");
- gst_ring_buffer_release (src->ringbuffer);
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- GST_DEBUG_OBJECT (src, "READY->NULL");
- gst_ring_buffer_close_device (src->ringbuffer);
- GST_OBJECT_LOCK (src);
- gst_object_unparent (GST_OBJECT_CAST (src->ringbuffer));
- src->ringbuffer = NULL;
- GST_OBJECT_UNLOCK (src);
- break;
- default:
- break;
- }
-
- return ret;
-
- /* ERRORS */
-open_failed:
- {
- /* subclass must post a meaningfull error message */
- GST_DEBUG_OBJECT (src, "open failed");
- return GST_STATE_CHANGE_FAILURE;
- }
-
-}
diff --git a/gst-libs/gst/audio/gstbaseaudiosrc.h b/gst-libs/gst/audio/gstbaseaudiosrc.h
deleted file mode 100644
index b55ac1ea..00000000
--- a/gst-libs/gst/audio/gstbaseaudiosrc.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2005 Wim Taymans <wim@fluendo.com>
- *
- * gstbaseaudiosrc.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/* a base class for audio sources.
- */
-
-#ifndef __GST_BASE_AUDIO_SRC_H__
-#define __GST_BASE_AUDIO_SRC_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstpushsrc.h>
-#include "gstringbuffer.h"
-#include "gstaudioclock.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_BASE_AUDIO_SRC (gst_base_audio_src_get_type())
-#define GST_BASE_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_AUDIO_SRC,GstBaseAudioSrc))
-#define GST_BASE_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_AUDIO_SRC,GstBaseAudioSrcClass))
-#define GST_BASE_AUDIO_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_AUDIO_SRC, GstBaseAudioSrcClass))
-#define GST_IS_BASE_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_AUDIO_SRC))
-#define GST_IS_BASE_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_AUDIO_SRC))
-
-/**
- * GST_BASE_AUDIO_SRC_CLOCK:
- * @obj: a #GstBaseAudioSrc
- *
- * Get the #GstClock of @obj.
- */
-#define GST_BASE_AUDIO_SRC_CLOCK(obj) (GST_BASE_AUDIO_SRC (obj)->clock)
-/**
- * GST_BASE_AUDIO_SRC_PAD:
- * @obj: a #GstBaseAudioSrc
- *
- * Get the source #GstPad of @obj.
- */
-#define GST_BASE_AUDIO_SRC_PAD(obj) (GST_BASE_SRC (obj)->srcpad)
-
-typedef struct _GstBaseAudioSrc GstBaseAudioSrc;
-typedef struct _GstBaseAudioSrcClass GstBaseAudioSrcClass;
-typedef struct _GstBaseAudioSrcPrivate GstBaseAudioSrcPrivate;
-
-/**
- * GstBaseAudioSrcSlaveMethod:
- * @GST_BASE_AUDIO_SRC_SLAVE_RESAMPLE: Resample to match the master clock.
- * @GST_BASE_AUDIO_SRC_SLAVE_RETIMESTAMP: Retimestamp output buffers with master
- * clock time.
- * @GST_BASE_AUDIO_SRC_SLAVE_SKEW: Adjust capture pointer when master clock
- * drifts too much.
- * @GST_BASE_AUDIO_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_BASE_AUDIO_SRC_SLAVE_RESAMPLE,
- GST_BASE_AUDIO_SRC_SLAVE_RETIMESTAMP,
- GST_BASE_AUDIO_SRC_SLAVE_SKEW,
- GST_BASE_AUDIO_SRC_SLAVE_NONE
-} GstBaseAudioSrcSlaveMethod;
-
-#define GST_TYPE_BASE_AUDIO_SRC_SLAVE_METHOD (gst_base_audio_src_slave_method_get_type ())
-
-/**
- * GstBaseAudioSrc:
- *
- * Opaque #GstBaseAudioSrc.
- */
-struct _GstBaseAudioSrc {
- GstPushSrc element;
-
- /*< protected >*/ /* with LOCK */
- /* our ringbuffer */
- GstRingBuffer *ringbuffer;
-
- /* required buffer and latency */
- GstClockTime buffer_time;
- GstClockTime latency_time;
-
- /* the next sample to write */
- guint64 next_sample;
-
- /* clock */
- GstClock *clock;
-
- /*< private >*/
- GstBaseAudioSrcPrivate *priv;
-
- gpointer _gst_reserved[GST_PADDING - 1];
-};
-
-/**
- * GstBaseAudioSrcClass:
- * @parent_class: the parent class.
- * @create_ringbuffer: create and return a #GstRingBuffer to read from.
- *
- * #GstBaseAudioSrc class. Override the vmethod to implement
- * functionality.
- */
-struct _GstBaseAudioSrcClass {
- GstPushSrcClass parent_class;
-
- /* subclass ringbuffer allocation */
- GstRingBuffer* (*create_ringbuffer) (GstBaseAudioSrc *src);
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_base_audio_src_get_type(void);
-GType gst_base_audio_src_slave_method_get_type (void);
-
-GstRingBuffer *gst_base_audio_src_create_ringbuffer (GstBaseAudioSrc *src);
-
-void gst_base_audio_src_set_provide_clock (GstBaseAudioSrc *src, gboolean provide);
-gboolean gst_base_audio_src_get_provide_clock (GstBaseAudioSrc *src);
-
-void gst_base_audio_src_set_slave_method (GstBaseAudioSrc *src,
- GstBaseAudioSrcSlaveMethod method);
-GstBaseAudioSrcSlaveMethod
- gst_base_audio_src_get_slave_method (GstBaseAudioSrc *src);
-
-
-G_END_DECLS
-
-#endif /* __GST_BASE_AUDIO_SRC_H__ */
diff --git a/gst-libs/gst/audio/gstringbuffer.c b/gst-libs/gst/audio/gstringbuffer.c
deleted file mode 100644
index de74bcd9..00000000
--- a/gst-libs/gst/audio/gstringbuffer.c
+++ /dev/null
@@ -1,2077 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstringbuffer
- * @short_description: Base class for audio ringbuffer implementations
- * @see_also: #GstBaseAudioSink, #GstAudioSink
- *
- * <refsect2>
- * <para>
- * This object is the base class for audio ringbuffers used by the base
- * audio source and sink classes.
- * </para>
- * <para>
- * The ringbuffer abstracts a circular buffer of data. One reader and
- * one writer can operate on the data from different threads in a lockfree
- * manner. The base class is sufficiently flexible to be used as an
- * abstraction for DMA based ringbuffers as well as a pure software
- * implementations.
- * </para>
- * </refsect2>
- *
- * Last reviewed on 2006-02-02 (0.10.4)
- */
-
-#include <string.h>
-
-#include "gstringbuffer.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_ring_buffer_debug);
-#define GST_CAT_DEFAULT gst_ring_buffer_debug
-
-static void gst_ring_buffer_class_init (GstRingBufferClass * klass);
-static void gst_ring_buffer_init (GstRingBuffer * ringbuffer);
-static void gst_ring_buffer_dispose (GObject * object);
-static void gst_ring_buffer_finalize (GObject * object);
-
-static gboolean gst_ring_buffer_pause_unlocked (GstRingBuffer * buf);
-static void default_clear_all (GstRingBuffer * buf);
-static guint default_commit (GstRingBuffer * buf, guint64 * sample,
- guchar * data, gint in_samples, gint out_samples, gint * accum);
-
-static GstObjectClass *parent_class = NULL;
-
-/* ringbuffer abstract base class */
-GType
-gst_ring_buffer_get_type (void)
-{
- static GType ringbuffer_type = 0;
-
- if (G_UNLIKELY (!ringbuffer_type)) {
- static const GTypeInfo ringbuffer_info = {
- sizeof (GstRingBufferClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_ring_buffer_class_init,
- NULL,
- NULL,
- sizeof (GstRingBuffer),
- 0,
- (GInstanceInitFunc) gst_ring_buffer_init,
- NULL
- };
-
- ringbuffer_type = g_type_register_static (GST_TYPE_OBJECT, "GstRingBuffer",
- &ringbuffer_info, G_TYPE_FLAG_ABSTRACT);
-
- GST_DEBUG_CATEGORY_INIT (gst_ring_buffer_debug, "ringbuffer", 0,
- "ringbuffer class");
- }
- return ringbuffer_type;
-}
-
-static void
-gst_ring_buffer_class_init (GstRingBufferClass * klass)
-{
- GObjectClass *gobject_class;
- GstRingBufferClass *gstringbuffer_class;
-
- gobject_class = (GObjectClass *) klass;
- gstringbuffer_class = (GstRingBufferClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->dispose = gst_ring_buffer_dispose;
- gobject_class->finalize = gst_ring_buffer_finalize;
-
- gstringbuffer_class->clear_all = GST_DEBUG_FUNCPTR (default_clear_all);
- gstringbuffer_class->commit = GST_DEBUG_FUNCPTR (default_commit);
-}
-
-static void
-gst_ring_buffer_init (GstRingBuffer * ringbuffer)
-{
- ringbuffer->open = FALSE;
- ringbuffer->acquired = FALSE;
- ringbuffer->state = GST_RING_BUFFER_STATE_STOPPED;
- ringbuffer->cond = g_cond_new ();
- ringbuffer->waiting = 0;
- ringbuffer->empty_seg = NULL;
- ringbuffer->abidata.ABI.flushing = TRUE;
-}
-
-static void
-gst_ring_buffer_dispose (GObject * object)
-{
- GstRingBuffer *ringbuffer = GST_RING_BUFFER (object);
-
- gst_caps_replace (&ringbuffer->spec.caps, NULL);
-
- G_OBJECT_CLASS (parent_class)->dispose (G_OBJECT (ringbuffer));
-}
-
-static void
-gst_ring_buffer_finalize (GObject * object)
-{
- GstRingBuffer *ringbuffer = GST_RING_BUFFER (object);
-
- g_cond_free (ringbuffer->cond);
- g_free (ringbuffer->empty_seg);
-
- G_OBJECT_CLASS (parent_class)->finalize (G_OBJECT (ringbuffer));
-}
-
-typedef struct
-{
- const GstBufferFormat format;
- const guint8 silence[4];
-} FormatDef;
-
-static const FormatDef linear_defs[4 * 2 * 2] = {
- {GST_S8, {0x00, 0x00, 0x00, 0x00}},
- {GST_S8, {0x00, 0x00, 0x00, 0x00}},
- {GST_U8, {0x80, 0x80, 0x80, 0x80}},
- {GST_U8, {0x80, 0x80, 0x80, 0x80}},
- {GST_S16_LE, {0x00, 0x00, 0x00, 0x00}},
- {GST_S16_BE, {0x00, 0x00, 0x00, 0x00}},
- {GST_U16_LE, {0x00, 0x80, 0x00, 0x80}},
- {GST_U16_BE, {0x80, 0x00, 0x80, 0x00}},
- {GST_S24_LE, {0x00, 0x00, 0x00, 0x00}},
- {GST_S24_BE, {0x00, 0x00, 0x00, 0x00}},
- {GST_U24_LE, {0x00, 0x00, 0x80, 0x00}},
- {GST_U24_BE, {0x80, 0x00, 0x00, 0x00}},
- {GST_S32_LE, {0x00, 0x00, 0x00, 0x00}},
- {GST_S32_BE, {0x00, 0x00, 0x00, 0x00}},
- {GST_U32_LE, {0x00, 0x00, 0x00, 0x80}},
- {GST_U32_BE, {0x80, 0x00, 0x00, 0x00}}
-};
-
-static const FormatDef linear24_defs[3 * 2 * 2] = {
- {GST_S24_3LE, {0x00, 0x00, 0x00, 0x00}},
- {GST_S24_3BE, {0x00, 0x00, 0x00, 0x00}},
- {GST_U24_3LE, {0x00, 0x00, 0x80, 0x00}},
- {GST_U24_3BE, {0x80, 0x00, 0x00, 0x00}},
- {GST_S20_3LE, {0x00, 0x00, 0x00, 0x00}},
- {GST_S20_3BE, {0x00, 0x00, 0x00, 0x00}},
- {GST_U20_3LE, {0x00, 0x00, 0x08, 0x00}},
- {GST_U20_3BE, {0x08, 0x00, 0x00, 0x00}},
- {GST_S18_3LE, {0x00, 0x00, 0x00, 0x00}},
- {GST_S18_3BE, {0x00, 0x00, 0x00, 0x00}},
- {GST_U18_3LE, {0x00, 0x00, 0x02, 0x00}},
- {GST_U18_3BE, {0x02, 0x00, 0x00, 0x00}}
-};
-
-static const FormatDef *
-build_linear_format (int depth, int width, int unsignd, int big_endian)
-{
- const FormatDef *formats;
-
- if (width == 24) {
- switch (depth) {
- case 24:
- formats = &linear24_defs[0];
- break;
- case 20:
- formats = &linear24_defs[4];
- break;
- case 18:
- formats = &linear24_defs[8];
- break;
- default:
- return NULL;
- }
- } else {
- switch (depth) {
- case 8:
- formats = &linear_defs[0];
- break;
- case 16:
- formats = &linear_defs[4];
- break;
- case 24:
- formats = &linear_defs[8];
- break;
- case 32:
- formats = &linear_defs[12];
- break;
- default:
- return NULL;
- }
- }
- if (unsignd)
- formats += 2;
- if (big_endian)
- formats += 1;
-
- return formats;
-}
-
-#ifndef GST_DISABLE_GST_DEBUG
-static const gchar *format_type_names[] = {
- "linear",
- "float",
- "mu law",
- "a law",
- "ima adpcm",
- "mpeg",
- "gsm",
- "iec958",
- "ac3",
- "eac3",
- "dts"
-};
-
-static const gchar *format_names[] = {
- "unknown",
- "s8",
- "u8",
- "s16_le",
- "s16_be",
- "u16_le",
- "u16_be",
- "s24_le",
- "s24_be",
- "u24_le",
- "u24_be",
- "s32_le",
- "s32_be",
- "u32_le",
- "u32_be",
- "s24_3le",
- "s24_3be",
- "u24_3le",
- "u24_3be",
- "s20_3le",
- "s20_3be",
- "u20_3le",
- "u20_3be",
- "s18_3le",
- "s18_3be",
- "u18_3le",
- "u18_3be",
- "float32_le",
- "float32_be",
- "float64_le",
- "float64_be",
- "mu_law",
- "a_law",
- "ima_adpcm",
- "mpeg",
- "gsm",
- "iec958",
- "ac3",
- "eac3",
- "dts"
-};
-#endif
-
-/**
- * gst_ring_buffer_debug_spec_caps:
- * @spec: the spec to debug
- *
- * Print debug info about the parsed caps in @spec to the debug log.
- */
-void
-gst_ring_buffer_debug_spec_caps (GstRingBufferSpec * spec)
-{
- gint i, bytes;
-
- GST_DEBUG ("spec caps: %p %" GST_PTR_FORMAT, spec->caps, spec->caps);
- GST_DEBUG ("parsed caps: type: %d, '%s'", spec->type,
- format_type_names[spec->type]);
- GST_DEBUG ("parsed caps: format: %d, '%s'", spec->format,
- format_names[spec->format]);
- GST_DEBUG ("parsed caps: width: %d", spec->width);
- GST_DEBUG ("parsed caps: depth: %d", spec->depth);
- GST_DEBUG ("parsed caps: sign: %d", spec->sign);
- GST_DEBUG ("parsed caps: bigend: %d", spec->bigend);
- GST_DEBUG ("parsed caps: rate: %d", spec->rate);
- GST_DEBUG ("parsed caps: channels: %d", spec->channels);
- GST_DEBUG ("parsed caps: sample bytes: %d", spec->bytes_per_sample);
- bytes = (spec->width >> 3) * spec->channels;
- for (i = 0; i < bytes; i++) {
- GST_DEBUG ("silence byte %d: %02x", i, spec->silence_sample[i]);
- }
-}
-
-/**
- * gst_ring_buffer_debug_spec_buff:
- * @spec: the spec to debug
- *
- * Print debug info about the buffer sized in @spec to the debug log.
- */
-void
-gst_ring_buffer_debug_spec_buff (GstRingBufferSpec * spec)
-{
- GST_DEBUG ("acquire ringbuffer: buffer time: %" G_GINT64_FORMAT " usec",
- spec->buffer_time);
- GST_DEBUG ("acquire ringbuffer: latency time: %" G_GINT64_FORMAT " usec",
- spec->latency_time);
- GST_DEBUG ("acquire ringbuffer: total segments: %d", spec->segtotal);
- GST_DEBUG ("acquire ringbuffer: latency segments: %d", spec->seglatency);
- GST_DEBUG ("acquire ringbuffer: segment size: %d bytes = %d samples",
- spec->segsize, spec->segsize / spec->bytes_per_sample);
- GST_DEBUG ("acquire ringbuffer: buffer size: %d bytes = %d samples",
- spec->segsize * spec->segtotal,
- spec->segsize * spec->segtotal / spec->bytes_per_sample);
-}
-
-/**
- * gst_ring_buffer_parse_caps:
- * @spec: a spec
- * @caps: a #GstCaps
- *
- * Parse @caps into @spec.
- *
- * Returns: TRUE if the caps could be parsed.
- */
-gboolean
-gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps)
-{
- const gchar *mimetype;
- GstStructure *structure;
- gint i;
-
- structure = gst_caps_get_structure (caps, 0);
-
- /* we have to differentiate between int and float formats */
- mimetype = gst_structure_get_name (structure);
-
- if (!strncmp (mimetype, "audio/x-raw-int", 15)) {
- gint endianness;
- const FormatDef *def;
- gint j, bytes;
-
- spec->type = GST_BUFTYPE_LINEAR;
-
- /* extract the needed information from the cap */
- if (!(gst_structure_get_int (structure, "rate", &spec->rate) &&
- gst_structure_get_int (structure, "channels", &spec->channels) &&
- gst_structure_get_int (structure, "width", &spec->width) &&
- gst_structure_get_int (structure, "depth", &spec->depth) &&
- gst_structure_get_boolean (structure, "signed", &spec->sign)))
- goto parse_error;
-
- /* extract endianness if needed */
- if (spec->width > 8) {
- if (!gst_structure_get_int (structure, "endianness", &endianness))
- goto parse_error;
- } else {
- endianness = G_BYTE_ORDER;
- }
-
- spec->bigend = endianness == G_LITTLE_ENDIAN ? FALSE : TRUE;
-
- def = build_linear_format (spec->depth, spec->width, spec->sign ? 0 : 1,
- spec->bigend ? 1 : 0);
-
- if (def == NULL)
- goto parse_error;
-
- spec->format = def->format;
-
- bytes = spec->width >> 3;
-
- for (i = 0; i < spec->channels; i++) {
- for (j = 0; j < bytes; j++) {
- spec->silence_sample[i * bytes + j] = def->silence[j];
- }
- }
- } else if (!strncmp (mimetype, "audio/x-raw-float", 17)) {
-
- spec->type = GST_BUFTYPE_FLOAT;
-
- /* extract the needed information from the cap */
- if (!(gst_structure_get_int (structure, "rate", &spec->rate) &&
- gst_structure_get_int (structure, "channels", &spec->channels) &&
- gst_structure_get_int (structure, "width", &spec->width)))
- goto parse_error;
-
- /* match layout to format wrt to endianness */
- switch (spec->width) {
- case 32:
- spec->format =
- G_BYTE_ORDER == G_LITTLE_ENDIAN ? GST_FLOAT32_LE : GST_FLOAT32_BE;
- break;
- case 64:
- spec->format =
- G_BYTE_ORDER == G_LITTLE_ENDIAN ? GST_FLOAT64_LE : GST_FLOAT64_BE;
- break;
- default:
- goto parse_error;
- }
- /* float silence is all zeros.. */
- memset (spec->silence_sample, 0, 32);
- } else if (!strncmp (mimetype, "audio/x-alaw", 12)) {
- /* extract the needed information from the cap */
- if (!(gst_structure_get_int (structure, "rate", &spec->rate) &&
- gst_structure_get_int (structure, "channels", &spec->channels)))
- goto parse_error;
-
- spec->type = GST_BUFTYPE_A_LAW;
- spec->format = GST_A_LAW;
- spec->width = 8;
- spec->depth = 8;
- for (i = 0; i < spec->channels; i++)
- spec->silence_sample[i] = 0xd5;
- } else if (!strncmp (mimetype, "audio/x-mulaw", 13)) {
- /* extract the needed information from the cap */
- if (!(gst_structure_get_int (structure, "rate", &spec->rate) &&
- gst_structure_get_int (structure, "channels", &spec->channels)))
- goto parse_error;
-
- spec->type = GST_BUFTYPE_MU_LAW;
- spec->format = GST_MU_LAW;
- spec->width = 8;
- spec->depth = 8;
- for (i = 0; i < spec->channels; i++)
- spec->silence_sample[i] = 0xff;
- } else if (!strncmp (mimetype, "audio/x-iec958", 14)) {
- /* extract the needed information from the cap */
- if (!(gst_structure_get_int (structure, "rate", &spec->rate)))
- goto parse_error;
-
- spec->type = GST_BUFTYPE_IEC958;
- spec->format = GST_IEC958;
- spec->width = 16;
- spec->depth = 16;
- spec->channels = 2;
- } else if (!strncmp (mimetype, "audio/x-ac3", 11)) {
- /* extract the needed information from the cap */
- if (!(gst_structure_get_int (structure, "rate", &spec->rate)))
- goto parse_error;
-
- spec->type = GST_BUFTYPE_AC3;
- spec->format = GST_AC3;
- spec->width = 16;
- spec->depth = 16;
- spec->channels = 2;
- } else {
- goto parse_error;
- }
-
- spec->bytes_per_sample = (spec->width >> 3) * spec->channels;
-
- gst_caps_replace (&spec->caps, caps);
-
- g_return_val_if_fail (spec->latency_time != 0, FALSE);
-
- /* calculate suggested segsize and segtotal. segsize should be one unit
- * of 'latency_time' samples, scaling for the fact that latency_time is
- * currently stored in microseconds (FIXME: in 0.11) */
- spec->segsize = gst_util_uint64_scale (spec->rate * spec->bytes_per_sample,
- spec->latency_time, GST_SECOND / GST_USECOND);
- /* Round to an integer number of samples */
- spec->segsize -= spec->segsize % spec->bytes_per_sample;
-
- spec->segtotal = spec->buffer_time / spec->latency_time;
- /* leave the latency undefined now, implementations can change it but if it's
- * not changed, we assume the same value as segtotal */
- spec->seglatency = -1;
-
- gst_ring_buffer_debug_spec_caps (spec);
- gst_ring_buffer_debug_spec_buff (spec);
-
- return TRUE;
-
- /* ERRORS */
-parse_error:
- {
- GST_DEBUG ("could not parse caps");
- return FALSE;
- }
-}
-
-/**
- * gst_ring_buffer_convert:
- * @buf: the #GstRingBuffer
- * @src_fmt: the source format
- * @src_val: the source value
- * @dest_fmt: the destination format
- * @dest_val: a location to store the converted value
- *
- * Convert @src_val in @src_fmt to the equivalent value in @dest_fmt. The result
- * will be put in @dest_val.
- *
- * Returns: TRUE if the conversion succeeded.
- *
- * Since: 0.10.22.
- */
-gboolean
-gst_ring_buffer_convert (GstRingBuffer * buf,
- GstFormat src_fmt, gint64 src_val, GstFormat dest_fmt, gint64 * dest_val)
-{
- gboolean res = TRUE;
- gint bps, rate;
-
- GST_DEBUG ("converting value %" G_GINT64_FORMAT " from %s (%d) to %s (%d)",
- src_val, gst_format_get_name (src_fmt), src_fmt,
- gst_format_get_name (dest_fmt), dest_fmt);
-
- if (src_fmt == dest_fmt || src_val == -1) {
- *dest_val = src_val;
- goto done;
- }
-
- /* get important info */
- GST_OBJECT_LOCK (buf);
- bps = buf->spec.bytes_per_sample;
- rate = buf->spec.rate;
- GST_OBJECT_UNLOCK (buf);
-
- if (bps == 0 || rate == 0) {
- GST_DEBUG ("no rate or bps configured");
- res = FALSE;
- goto done;
- }
-
- switch (src_fmt) {
- case GST_FORMAT_BYTES:
- switch (dest_fmt) {
- case GST_FORMAT_TIME:
- *dest_val = gst_util_uint64_scale_int (src_val / bps, GST_SECOND,
- rate);
- break;
- case GST_FORMAT_DEFAULT:
- *dest_val = src_val / bps;
- break;
- default:
- res = FALSE;
- break;
- }
- break;
- case GST_FORMAT_DEFAULT:
- switch (dest_fmt) {
- case GST_FORMAT_TIME:
- *dest_val = gst_util_uint64_scale_int (src_val, GST_SECOND, rate);
- break;
- case GST_FORMAT_BYTES:
- *dest_val = src_val * bps;
- break;
- default:
- res = FALSE;
- break;
- }
- break;
- case GST_FORMAT_TIME:
- switch (dest_fmt) {
- case GST_FORMAT_DEFAULT:
- *dest_val = gst_util_uint64_scale_int (src_val, rate, GST_SECOND);
- break;
- case GST_FORMAT_BYTES:
- *dest_val = gst_util_uint64_scale_int (src_val, rate, GST_SECOND);
- *dest_val *= bps;
- break;
- default:
- res = FALSE;
- break;
- }
- break;
- default:
- res = FALSE;
- break;
- }
-done:
- GST_DEBUG ("ret=%d result %" G_GINT64_FORMAT, res, *dest_val);
-
- return res;
-}
-
-/**
- * gst_ring_buffer_set_callback:
- * @buf: the #GstRingBuffer to set the callback on
- * @cb: the callback to set
- * @user_data: user data passed to the callback
- *
- * Sets the given callback function on the buffer. This function
- * will be called every time a segment has been written to a device.
- *
- * MT safe.
- */
-void
-gst_ring_buffer_set_callback (GstRingBuffer * buf, GstRingBufferCallback cb,
- gpointer user_data)
-{
- g_return_if_fail (GST_IS_RING_BUFFER (buf));
-
- GST_OBJECT_LOCK (buf);
- buf->callback = cb;
- buf->cb_data = user_data;
- GST_OBJECT_UNLOCK (buf);
-}
-
-
-/**
- * gst_ring_buffer_open_device:
- * @buf: the #GstRingBuffer
- *
- * Open the audio device associated with the ring buffer. Does not perform any
- * setup on the device. You must open the device before acquiring the ring
- * buffer.
- *
- * Returns: TRUE if the device could be opened, FALSE on error.
- *
- * MT safe.
- */
-gboolean
-gst_ring_buffer_open_device (GstRingBuffer * buf)
-{
- gboolean res = TRUE;
- GstRingBufferClass *rclass;
-
- g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
-
- GST_DEBUG_OBJECT (buf, "opening device");
-
- GST_OBJECT_LOCK (buf);
- if (G_UNLIKELY (buf->open))
- goto was_opened;
-
- buf->open = TRUE;
-
- /* if this fails, something is wrong in this file */
- g_assert (!buf->acquired);
-
- rclass = GST_RING_BUFFER_GET_CLASS (buf);
- if (G_LIKELY (rclass->open_device))
- res = rclass->open_device (buf);
-
- if (G_UNLIKELY (!res))
- goto open_failed;
-
- GST_DEBUG_OBJECT (buf, "opened device");
-
-done:
- GST_OBJECT_UNLOCK (buf);
-
- return res;
-
- /* ERRORS */
-was_opened:
- {
- GST_DEBUG_OBJECT (buf, "Device for ring buffer already open");
- g_warning ("Device for ring buffer %p already open, fix your code", buf);
- res = TRUE;
- goto done;
- }
-open_failed:
- {
- buf->open = FALSE;
- GST_DEBUG_OBJECT (buf, "failed opening device");
- goto done;
- }
-}
-
-/**
- * gst_ring_buffer_close_device:
- * @buf: the #GstRingBuffer
- *
- * Close the audio device associated with the ring buffer. The ring buffer
- * should already have been released via gst_ring_buffer_release().
- *
- * Returns: TRUE if the device could be closed, FALSE on error.
- *
- * MT safe.
- */
-gboolean
-gst_ring_buffer_close_device (GstRingBuffer * buf)
-{
- gboolean res = TRUE;
- GstRingBufferClass *rclass;
-
- g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
-
- GST_DEBUG_OBJECT (buf, "closing device");
-
- GST_OBJECT_LOCK (buf);
- if (G_UNLIKELY (!buf->open))
- goto was_closed;
-
- if (G_UNLIKELY (buf->acquired))
- goto was_acquired;
-
- buf->open = FALSE;
-
- rclass = GST_RING_BUFFER_GET_CLASS (buf);
- if (G_LIKELY (rclass->close_device))
- res = rclass->close_device (buf);
-
- if (G_UNLIKELY (!res))
- goto close_error;
-
- GST_DEBUG_OBJECT (buf, "closed device");
-
-done:
- GST_OBJECT_UNLOCK (buf);
-
- return res;
-
- /* ERRORS */
-was_closed:
- {
- GST_DEBUG_OBJECT (buf, "Device for ring buffer already closed");
- g_warning ("Device for ring buffer %p already closed, fix your code", buf);
- res = TRUE;
- goto done;
- }
-was_acquired:
- {
- GST_DEBUG_OBJECT (buf, "Resources for ring buffer still acquired");
- g_critical ("Resources for ring buffer %p still acquired", buf);
- res = FALSE;
- goto done;
- }
-close_error:
- {
- buf->open = TRUE;
- GST_DEBUG_OBJECT (buf, "error closing device");
- goto done;
- }
-}
-
-/**
- * gst_ring_buffer_device_is_open:
- * @buf: the #GstRingBuffer
- *
- * Checks the status of the device associated with the ring buffer.
- *
- * Returns: TRUE if the device was open, FALSE if it was closed.
- *
- * MT safe.
- */
-gboolean
-gst_ring_buffer_device_is_open (GstRingBuffer * buf)
-{
- gboolean res = TRUE;
-
- g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
-
- GST_OBJECT_LOCK (buf);
- res = buf->open;
- GST_OBJECT_UNLOCK (buf);
-
- return res;
-}
-
-/**
- * gst_ring_buffer_acquire:
- * @buf: the #GstRingBuffer to acquire
- * @spec: the specs of the buffer
- *
- * Allocate the resources for the ringbuffer. This function fills
- * in the data pointer of the ring buffer with a valid #GstBuffer
- * to which samples can be written.
- *
- * Returns: TRUE if the device could be acquired, FALSE on error.
- *
- * MT safe.
- */
-gboolean
-gst_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
-{
- gboolean res = FALSE;
- GstRingBufferClass *rclass;
- gint i, j;
- gint segsize, bps;
-
- g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
-
- GST_DEBUG_OBJECT (buf, "acquiring device");
-
- GST_OBJECT_LOCK (buf);
- if (G_UNLIKELY (!buf->open))
- goto not_opened;
-
- if (G_UNLIKELY (buf->acquired))
- goto was_acquired;
-
- buf->acquired = TRUE;
-
- rclass = GST_RING_BUFFER_GET_CLASS (buf);
- if (G_LIKELY (rclass->acquire))
- res = rclass->acquire (buf, spec);
-
- if (G_UNLIKELY (!res))
- goto acquire_failed;
-
- if (G_UNLIKELY ((bps = buf->spec.bytes_per_sample) == 0))
- goto invalid_bps;
-
- /* if the seglatency was overwritten with something else than -1, use it, else
- * assume segtotal as the latency */
- if (buf->spec.seglatency == -1)
- buf->spec.seglatency = buf->spec.segtotal;
-
- segsize = buf->spec.segsize;
-
- buf->samples_per_seg = segsize / bps;
-
- /* create an empty segment */
- g_free (buf->empty_seg);
- buf->empty_seg = g_malloc (segsize);
-
- /* FIXME, we only have 32 silence samples, which might not be enough to
- * represent silence in all channels */
- bps = MIN (bps, 32);
- for (i = 0, j = 0; i < segsize; i++) {
- buf->empty_seg[i] = buf->spec.silence_sample[j];
- j = (j + 1) % bps;
- }
- GST_DEBUG_OBJECT (buf, "acquired device");
-
-done:
- GST_OBJECT_UNLOCK (buf);
-
- return res;
-
- /* ERRORS */
-not_opened:
- {
- GST_DEBUG_OBJECT (buf, "device not opened");
- g_critical ("Device for %p not opened", buf);
- res = FALSE;
- goto done;
- }
-was_acquired:
- {
- res = TRUE;
- GST_DEBUG_OBJECT (buf, "device was acquired");
- goto done;
- }
-acquire_failed:
- {
- buf->acquired = FALSE;
- GST_DEBUG_OBJECT (buf, "failed to acquire device");
- goto done;
- }
-invalid_bps:
- {
- g_warning
- ("invalid bytes_per_sample from acquire ringbuffer, fix the element");
- buf->acquired = FALSE;
- res = FALSE;
- goto done;
- }
-}
-
-/**
- * gst_ring_buffer_release:
- * @buf: the #GstRingBuffer to release
- *
- * Free the resources of the ringbuffer.
- *
- * Returns: TRUE if the device could be released, FALSE on error.
- *
- * MT safe.
- */
-gboolean
-gst_ring_buffer_release (GstRingBuffer * buf)
-{
- gboolean res = FALSE;
- GstRingBufferClass *rclass;
-
- g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
-
- GST_DEBUG_OBJECT (buf, "releasing device");
-
- gst_ring_buffer_stop (buf);
-
- GST_OBJECT_LOCK (buf);
- if (G_UNLIKELY (!buf->acquired))
- goto was_released;
-
- buf->acquired = FALSE;
-
- /* if this fails, something is wrong in this file */
- g_assert (buf->open == TRUE);
-
- rclass = GST_RING_BUFFER_GET_CLASS (buf);
- if (G_LIKELY (rclass->release))
- res = rclass->release (buf);
-
- /* signal any waiters */
- GST_DEBUG_OBJECT (buf, "signal waiter");
- GST_RING_BUFFER_SIGNAL (buf);
-
- if (G_UNLIKELY (!res))
- goto release_failed;
-
- g_free (buf->empty_seg);
- buf->empty_seg = NULL;
- GST_DEBUG_OBJECT (buf, "released device");
-
-done:
- GST_OBJECT_UNLOCK (buf);
-
- return res;
-
- /* ERRORS */
-was_released:
- {
- res = TRUE;
- GST_DEBUG_OBJECT (buf, "device was released");
- goto done;
- }
-release_failed:
- {
- buf->acquired = TRUE;
- GST_DEBUG_OBJECT (buf, "failed to release device");
- goto done;
- }
-}
-
-/**
- * gst_ring_buffer_is_acquired:
- * @buf: the #GstRingBuffer to check
- *
- * Check if the ringbuffer is acquired and ready to use.
- *
- * Returns: TRUE if the ringbuffer is acquired, FALSE on error.
- *
- * MT safe.
- */
-gboolean
-gst_ring_buffer_is_acquired (GstRingBuffer * buf)
-{
- gboolean res;
-
- g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
-
- GST_OBJECT_LOCK (buf);
- res = buf->acquired;
- GST_OBJECT_UNLOCK (buf);
-
- return res;
-}
-
-/**
- * gst_ring_buffer_activate:
- * @buf: the #GstRingBuffer to activate
- * @active: the new mode
- *
- * Activate @buf to start or stop pulling data.
- *
- * MT safe.
- *
- * Returns: TRUE if the device could be activated in the requested mode,
- * FALSE on error.
- *
- * Since: 0.10.22.
- */
-gboolean
-gst_ring_buffer_activate (GstRingBuffer * buf, gboolean active)
-{
- gboolean res = FALSE;
- GstRingBufferClass *rclass;
-
- g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
-
- GST_DEBUG_OBJECT (buf, "activate device");
-
- GST_OBJECT_LOCK (buf);
- if (G_UNLIKELY (active && !buf->acquired))
- goto not_acquired;
-
- if (G_UNLIKELY (buf->abidata.ABI.active == active))
- goto was_active;
-
- rclass = GST_RING_BUFFER_GET_CLASS (buf);
- /* if there is no activate function we assume it was started/released
- * in the acquire method */
- if (G_LIKELY (rclass->activate))
- res = rclass->activate (buf, active);
- else
- res = TRUE;
-
- if (G_UNLIKELY (!res))
- goto activate_failed;
-
- buf->abidata.ABI.active = active;
-
-done:
- GST_OBJECT_UNLOCK (buf);
-
- return res;
-
- /* ERRORS */
-not_acquired:
- {
- GST_DEBUG_OBJECT (buf, "device not acquired");
- g_critical ("Device for %p not acquired", buf);
- res = FALSE;
- goto done;
- }
-was_active:
- {
- res = TRUE;
- GST_DEBUG_OBJECT (buf, "device was active in mode %d", active);
- goto done;
- }
-activate_failed:
- {
- GST_DEBUG_OBJECT (buf, "failed to activate device");
- goto done;
- }
-}
-
-/**
- * gst_ring_buffer_is_active:
- * @buf: the #GstRingBuffer
- *
- * Check if @buf is activated.
- *
- * MT safe.
- *
- * Returns: TRUE if the device is active.
- *
- * Since: 0.10.22.
- */
-gboolean
-gst_ring_buffer_is_active (GstRingBuffer * buf)
-{
- gboolean res;
-
- g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
-
- GST_OBJECT_LOCK (buf);
- res = buf->abidata.ABI.active;
- GST_OBJECT_UNLOCK (buf);
-
- return res;
-}
-
-
-/**
- * gst_ring_buffer_set_flushing:
- * @buf: the #GstRingBuffer to flush
- * @flushing: the new mode
- *
- * Set the ringbuffer to flushing mode or normal mode.
- *
- * MT safe.
- */
-void
-gst_ring_buffer_set_flushing (GstRingBuffer * buf, gboolean flushing)
-{
- g_return_if_fail (GST_IS_RING_BUFFER (buf));
-
- GST_OBJECT_LOCK (buf);
- buf->abidata.ABI.flushing = flushing;
-
- if (flushing) {
- gst_ring_buffer_pause_unlocked (buf);
- } else {
- gst_ring_buffer_clear_all (buf);
- }
- GST_OBJECT_UNLOCK (buf);
-}
-
-/**
- * gst_ring_buffer_start:
- * @buf: the #GstRingBuffer to start
- *
- * Start processing samples from the ringbuffer.
- *
- * Returns: TRUE if the device could be started, FALSE on error.
- *
- * MT safe.
- */
-gboolean
-gst_ring_buffer_start (GstRingBuffer * buf)
-{
- gboolean res = FALSE;
- GstRingBufferClass *rclass;
- gboolean resume = FALSE;
-
- g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
-
- GST_DEBUG_OBJECT (buf, "starting ringbuffer");
-
- GST_OBJECT_LOCK (buf);
- if (G_UNLIKELY (buf->abidata.ABI.flushing))
- goto flushing;
-
- if (G_UNLIKELY (!buf->acquired))
- goto not_acquired;
-
- /* if stopped, set to started */
- res = g_atomic_int_compare_and_exchange (&buf->state,
- GST_RING_BUFFER_STATE_STOPPED, GST_RING_BUFFER_STATE_STARTED);
-
- if (!res) {
- GST_DEBUG_OBJECT (buf, "was not stopped, try paused");
- /* was not stopped, try from paused */
- res = g_atomic_int_compare_and_exchange (&buf->state,
- GST_RING_BUFFER_STATE_PAUSED, GST_RING_BUFFER_STATE_STARTED);
- if (!res) {
- /* was not paused either, must be started then */
- res = TRUE;
- GST_DEBUG_OBJECT (buf, "was not paused, must have been started");
- goto done;
- }
- resume = TRUE;
- GST_DEBUG_OBJECT (buf, "resuming");
- }
-
- rclass = GST_RING_BUFFER_GET_CLASS (buf);
- if (resume) {
- if (G_LIKELY (rclass->resume))
- res = rclass->resume (buf);
- } else {
- if (G_LIKELY (rclass->start))
- res = rclass->start (buf);
- }
-
- if (G_UNLIKELY (!res)) {
- buf->state = GST_RING_BUFFER_STATE_PAUSED;
- GST_DEBUG_OBJECT (buf, "failed to start");
- } else {
- GST_DEBUG_OBJECT (buf, "started");
- }
-
-done:
- GST_OBJECT_UNLOCK (buf);
-
- return res;
-
-flushing:
- {
- GST_DEBUG_OBJECT (buf, "we are flushing");
- GST_OBJECT_UNLOCK (buf);
- return FALSE;
- }
-not_acquired:
- {
- GST_DEBUG_OBJECT (buf, "we are not acquired");
- GST_OBJECT_UNLOCK (buf);
- return FALSE;
- }
-}
-
-static gboolean
-gst_ring_buffer_pause_unlocked (GstRingBuffer * buf)
-{
- gboolean res = FALSE;
- GstRingBufferClass *rclass;
-
- GST_DEBUG_OBJECT (buf, "pausing ringbuffer");
-
- /* if started, set to paused */
- res = g_atomic_int_compare_and_exchange (&buf->state,
- GST_RING_BUFFER_STATE_STARTED, GST_RING_BUFFER_STATE_PAUSED);
-
- if (!res)
- goto not_started;
-
- /* signal any waiters */
- GST_DEBUG_OBJECT (buf, "signal waiter");
- GST_RING_BUFFER_SIGNAL (buf);
-
- rclass = GST_RING_BUFFER_GET_CLASS (buf);
- if (G_LIKELY (rclass->pause))
- res = rclass->pause (buf);
-
- if (G_UNLIKELY (!res)) {
- buf->state = GST_RING_BUFFER_STATE_STARTED;
- GST_DEBUG_OBJECT (buf, "failed to pause");
- } else {
- GST_DEBUG_OBJECT (buf, "paused");
- }
-
- return res;
-
-not_started:
- {
- /* was not started */
- GST_DEBUG_OBJECT (buf, "was not started");
- return TRUE;
- }
-}
-
-/**
- * gst_ring_buffer_pause:
- * @buf: the #GstRingBuffer to pause
- *
- * Pause processing samples from the ringbuffer.
- *
- * Returns: TRUE if the device could be paused, FALSE on error.
- *
- * MT safe.
- */
-gboolean
-gst_ring_buffer_pause (GstRingBuffer * buf)
-{
- gboolean res = FALSE;
-
- g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
-
- GST_OBJECT_LOCK (buf);
- if (G_UNLIKELY (buf->abidata.ABI.flushing))
- goto flushing;
-
- if (G_UNLIKELY (!buf->acquired))
- goto not_acquired;
-
- res = gst_ring_buffer_pause_unlocked (buf);
- GST_OBJECT_UNLOCK (buf);
-
- return res;
-
- /* ERRORS */
-flushing:
- {
- GST_DEBUG_OBJECT (buf, "we are flushing");
- GST_OBJECT_UNLOCK (buf);
- return FALSE;
- }
-not_acquired:
- {
- GST_DEBUG_OBJECT (buf, "not acquired");
- GST_OBJECT_UNLOCK (buf);
- return FALSE;
- }
-}
-
-/**
- * gst_ring_buffer_stop:
- * @buf: the #GstRingBuffer to stop
- *
- * Stop processing samples from the ringbuffer.
- *
- * Returns: TRUE if the device could be stopped, FALSE on error.
- *
- * MT safe.
- */
-gboolean
-gst_ring_buffer_stop (GstRingBuffer * buf)
-{
- gboolean res = FALSE;
- GstRingBufferClass *rclass;
-
- g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
-
- GST_DEBUG_OBJECT (buf, "stopping");
-
- GST_OBJECT_LOCK (buf);
-
- /* if started, set to stopped */
- res = g_atomic_int_compare_and_exchange (&buf->state,
- GST_RING_BUFFER_STATE_STARTED, GST_RING_BUFFER_STATE_STOPPED);
-
- if (!res) {
- GST_DEBUG_OBJECT (buf, "was not started, try paused");
- /* was not started, try from paused */
- res = g_atomic_int_compare_and_exchange (&buf->state,
- GST_RING_BUFFER_STATE_PAUSED, GST_RING_BUFFER_STATE_STOPPED);
- if (!res) {
- /* was not paused either, must have been stopped then */
- res = TRUE;
- GST_DEBUG_OBJECT (buf, "was not paused, must have been stopped");
- goto done;
- }
- }
-
- /* signal any waiters */
- GST_DEBUG_OBJECT (buf, "signal waiter");
- GST_RING_BUFFER_SIGNAL (buf);
-
- rclass = GST_RING_BUFFER_GET_CLASS (buf);
- if (G_LIKELY (rclass->stop))
- res = rclass->stop (buf);
-
- if (G_UNLIKELY (!res)) {
- buf->state = GST_RING_BUFFER_STATE_STARTED;
- GST_DEBUG_OBJECT (buf, "failed to stop");
- } else {
- GST_DEBUG_OBJECT (buf, "stopped");
- }
-done:
- GST_OBJECT_UNLOCK (buf);
-
- return res;
-}
-
-/**
- * gst_ring_buffer_delay:
- * @buf: the #GstRingBuffer to query
- *
- * Get the number of samples queued in the audio device. This is
- * usually less than the segment size but can be bigger when the
- * implementation uses another internal buffer between the audio
- * device.
- *
- * For playback ringbuffers this is the amount of samples transfered from the
- * ringbuffer to the device but still not played.
- *
- * For capture ringbuffers this is the amount of samples in the device that are
- * not yet transfered to the ringbuffer.
- *
- * Returns: The number of samples queued in the audio device.
- *
- * MT safe.
- */
-guint
-gst_ring_buffer_delay (GstRingBuffer * buf)
-{
- GstRingBufferClass *rclass;
- guint res;
-
- g_return_val_if_fail (GST_IS_RING_BUFFER (buf), 0);
-
- /* buffer must be acquired */
- if (G_UNLIKELY (!gst_ring_buffer_is_acquired (buf)))
- goto not_acquired;
-
- rclass = GST_RING_BUFFER_GET_CLASS (buf);
- if (G_LIKELY (rclass->delay))
- res = rclass->delay (buf);
- else
- res = 0;
-
- return res;
-
-not_acquired:
- {
- GST_DEBUG_OBJECT (buf, "not acquired");
- return 0;
- }
-}
-
-/**
- * gst_ring_buffer_samples_done:
- * @buf: the #GstRingBuffer to query
- *
- * Get the number of samples that were processed by the ringbuffer
- * since it was last started. This does not include the number of samples not
- * yet processed (see gst_ring_buffer_delay()).
- *
- * Returns: The number of samples processed by the ringbuffer.
- *
- * MT safe.
- */
-guint64
-gst_ring_buffer_samples_done (GstRingBuffer * buf)
-{
- gint segdone;
- guint64 samples;
-
- g_return_val_if_fail (GST_IS_RING_BUFFER (buf), 0);
-
- /* get the amount of segments we processed */
- segdone = g_atomic_int_get (&buf->segdone);
-
- /* convert to samples */
- samples = ((guint64) segdone) * buf->samples_per_seg;
-
- return samples;
-}
-
-/**
- * gst_ring_buffer_set_sample:
- * @buf: the #GstRingBuffer to use
- * @sample: the sample number to set
- *
- * Make sure that the next sample written to the device is
- * accounted for as being the @sample sample written to the
- * device. This value will be used in reporting the current
- * sample position of the ringbuffer.
- *
- * This function will also clear the buffer with silence.
- *
- * MT safe.
- */
-void
-gst_ring_buffer_set_sample (GstRingBuffer * buf, guint64 sample)
-{
- g_return_if_fail (GST_IS_RING_BUFFER (buf));
-
- if (sample == -1)
- sample = 0;
-
- if (G_UNLIKELY (buf->samples_per_seg == 0))
- return;
-
- /* FIXME, we assume the ringbuffer can restart at a random
- * position, round down to the beginning and keep track of
- * offset when calculating the processed samples. */
- buf->segbase = buf->segdone - sample / buf->samples_per_seg;
-
- gst_ring_buffer_clear_all (buf);
-
- GST_DEBUG_OBJECT (buf, "set sample to %" G_GUINT64_FORMAT ", segbase %d",
- sample, buf->segbase);
-}
-
-static void
-default_clear_all (GstRingBuffer * buf)
-{
- gint i;
-
- /* not fatal, we just are not negotiated yet */
- if (G_UNLIKELY (buf->spec.segtotal <= 0))
- return;
-
- GST_DEBUG_OBJECT (buf, "clear all segments");
-
- for (i = 0; i < buf->spec.segtotal; i++) {
- gst_ring_buffer_clear (buf, i);
- }
-}
-
-/**
- * gst_ring_buffer_clear_all:
- * @buf: the #GstRingBuffer to clear
- *
- * Fill the ringbuffer with silence.
- *
- * MT safe.
- */
-void
-gst_ring_buffer_clear_all (GstRingBuffer * buf)
-{
- GstRingBufferClass *rclass;
-
- g_return_if_fail (GST_IS_RING_BUFFER (buf));
-
- rclass = GST_RING_BUFFER_GET_CLASS (buf);
-
- if (G_LIKELY (rclass->clear_all))
- rclass->clear_all (buf);
-}
-
-
-static gboolean
-wait_segment (GstRingBuffer * buf)
-{
- gint segments;
- gboolean wait = TRUE;
-
- /* buffer must be started now or we deadlock since nobody is reading */
- if (G_UNLIKELY (g_atomic_int_get (&buf->state) !=
- GST_RING_BUFFER_STATE_STARTED)) {
- /* see if we are allowed to start it */
- if (G_UNLIKELY (g_atomic_int_get (&buf->abidata.ABI.may_start) == FALSE))
- goto no_start;
-
- GST_DEBUG_OBJECT (buf, "start!");
- segments = g_atomic_int_get (&buf->segdone);
- gst_ring_buffer_start (buf);
-
- /* After starting, the writer may have wrote segments already and then we
- * don't need to wait anymore */
- if (G_LIKELY (g_atomic_int_get (&buf->segdone) != segments))
- wait = FALSE;
- }
-
- /* take lock first, then update our waiting flag */
- GST_OBJECT_LOCK (buf);
- if (G_UNLIKELY (buf->abidata.ABI.flushing))
- goto flushing;
-
- if (G_UNLIKELY (g_atomic_int_get (&buf->state) !=
- GST_RING_BUFFER_STATE_STARTED))
- goto not_started;
-
- if (G_LIKELY (wait)) {
- if (g_atomic_int_compare_and_exchange (&buf->waiting, 0, 1)) {
- GST_DEBUG_OBJECT (buf, "waiting..");
- GST_RING_BUFFER_WAIT (buf);
-
- if (G_UNLIKELY (buf->abidata.ABI.flushing))
- goto flushing;
-
- if (G_UNLIKELY (g_atomic_int_get (&buf->state) !=
- GST_RING_BUFFER_STATE_STARTED))
- goto not_started;
- }
- }
- GST_OBJECT_UNLOCK (buf);
-
- return TRUE;
-
- /* ERROR */
-not_started:
- {
- g_atomic_int_compare_and_exchange (&buf->waiting, 1, 0);
- GST_DEBUG_OBJECT (buf, "stopped processing");
- GST_OBJECT_UNLOCK (buf);
- return FALSE;
- }
-flushing:
- {
- g_atomic_int_compare_and_exchange (&buf->waiting, 1, 0);
- GST_DEBUG_OBJECT (buf, "flushing");
- GST_OBJECT_UNLOCK (buf);
- return FALSE;
- }
-no_start:
- {
- GST_DEBUG_OBJECT (buf, "not allowed to start");
- return FALSE;
- }
-}
-
-#define FWD_SAMPLES(s,se,d,de) \
-G_STMT_START { \
- /* no rate conversion */ \
- guint towrite = MIN (se + bps - s, de - d); \
- /* simple copy */ \
- if (!skip) \
- memcpy (d, s, towrite); \
- in_samples -= towrite / bps; \
- out_samples -= towrite / bps; \
- s += towrite; \
- GST_DEBUG ("copy %u bytes", towrite); \
-} G_STMT_END
-
-/* in_samples >= out_samples, rate > 1.0 */
-#define FWD_UP_SAMPLES(s,se,d,de) \
-G_STMT_START { \
- guint8 *sb = s, *db = d; \
- while (s <= se && d < de) { \
- if (!skip) \
- memcpy (d, s, bps); \
- s += bps; \
- *accum += outr; \
- if ((*accum << 1) >= inr) { \
- *accum -= inr; \
- d += bps; \
- } \
- } \
- in_samples -= (s - sb)/bps; \
- out_samples -= (d - db)/bps; \
- GST_DEBUG ("fwd_up end %d/%d",*accum,*toprocess); \
-} G_STMT_END
-
-/* out_samples > in_samples, for rates smaller than 1.0 */
-#define FWD_DOWN_SAMPLES(s,se,d,de) \
-G_STMT_START { \
- guint8 *sb = s, *db = d; \
- while (s <= se && d < de) { \
- if (!skip) \
- memcpy (d, s, bps); \
- d += bps; \
- *accum += inr; \
- if ((*accum << 1) >= outr) { \
- *accum -= outr; \
- s += bps; \
- } \
- } \
- in_samples -= (s - sb)/bps; \
- out_samples -= (d - db)/bps; \
- GST_DEBUG ("fwd_down end %d/%d",*accum,*toprocess); \
-} G_STMT_END
-
-#define REV_UP_SAMPLES(s,se,d,de) \
-G_STMT_START { \
- guint8 *sb = se, *db = d; \
- while (s <= se && d < de) { \
- if (!skip) \
- memcpy (d, se, bps); \
- se -= bps; \
- *accum += outr; \
- while (d < de && (*accum << 1) >= inr) { \
- *accum -= inr; \
- d += bps; \
- } \
- } \
- in_samples -= (sb - se)/bps; \
- out_samples -= (d - db)/bps; \
- GST_DEBUG ("rev_up end %d/%d",*accum,*toprocess); \
-} G_STMT_END
-
-#define REV_DOWN_SAMPLES(s,se,d,de) \
-G_STMT_START { \
- guint8 *sb = se, *db = d; \
- while (s <= se && d < de) { \
- if (!skip) \
- memcpy (d, se, bps); \
- d += bps; \
- *accum += inr; \
- while (s <= se && (*accum << 1) >= outr) { \
- *accum -= outr; \
- se -= bps; \
- } \
- } \
- in_samples -= (sb - se)/bps; \
- out_samples -= (d - db)/bps; \
- GST_DEBUG ("rev_down end %d/%d",*accum,*toprocess); \
-} G_STMT_END
-
-static guint
-default_commit (GstRingBuffer * buf, guint64 * sample,
- guchar * data, gint in_samples, gint out_samples, gint * accum)
-{
- gint segdone;
- gint segsize, segtotal, bps, sps;
- guint8 *dest, *data_end;
- gint writeseg, sampleoff;
- gint *toprocess;
- gint inr, outr;
- gboolean reverse;
-
- g_return_val_if_fail (buf->data != NULL, -1);
- g_return_val_if_fail (data != NULL, -1);
-
- dest = GST_BUFFER_DATA (buf->data);
- segsize = buf->spec.segsize;
- segtotal = buf->spec.segtotal;
- bps = buf->spec.bytes_per_sample;
- sps = buf->samples_per_seg;
-
- reverse = out_samples < 0;
- out_samples = ABS (out_samples);
-
- if (in_samples >= out_samples)
- toprocess = &in_samples;
- else
- toprocess = &out_samples;
-
- inr = in_samples - 1;
- outr = out_samples - 1;
-
- /* data_end points to the last sample we have to write, not past it. This is
- * needed to properly handle reverse playback: it points to the last sample. */
- data_end = data + (bps * inr);
-
- /* figure out the segment and the offset inside the segment where
- * the first sample should be written. */
- writeseg = *sample / sps;
- sampleoff = (*sample % sps) * bps;
-
- /* write out all samples */
- while (*toprocess > 0) {
- gint avail;
- guint8 *d, *d_end;
- gint ws;
- gboolean skip;
-
- while (TRUE) {
- gint diff;
-
- /* get the currently processed segment */
- segdone = g_atomic_int_get (&buf->segdone) - buf->segbase;
-
- /* see how far away it is from the write segment */
- diff = writeseg - segdone;
-
- GST_DEBUG
- ("pointer at %d, write to %d-%d, diff %d, segtotal %d, segsize %d, base %d",
- segdone, writeseg, sampleoff, diff, segtotal, segsize, buf->segbase);
-
- /* segment too far ahead, writer too slow, we need to drop, hopefully UNLIKELY */
- if (G_UNLIKELY (diff < 0)) {
- /* we need to drop one segment at a time, pretend we wrote a
- * segment. */
- skip = TRUE;
- break;
- }
-
- /* write segment is within writable range, we can break the loop and
- * start writing the data. */
- if (diff < segtotal) {
- skip = FALSE;
- break;
- }
-
- /* else we need to wait for the segment to become writable. */
- if (!wait_segment (buf))
- goto not_started;
- }
-
- /* we can write now */
- ws = writeseg % segtotal;
- avail = MIN (segsize - sampleoff, bps * out_samples);
-
- d = dest + (ws * segsize) + sampleoff;
- d_end = d + avail;
- *sample += avail / bps;
-
- GST_DEBUG_OBJECT (buf, "write @%p seg %d, sps %d, off %d, avail %d",
- dest + ws * segsize, ws, sps, sampleoff, avail);
-
- if (G_LIKELY (inr == outr && !reverse)) {
- /* no rate conversion, simply copy samples */
- FWD_SAMPLES (data, data_end, d, d_end);
- } else if (!reverse) {
- if (inr >= outr)
- /* forward speed up */
- FWD_UP_SAMPLES (data, data_end, d, d_end);
- else
- /* forward slow down */
- FWD_DOWN_SAMPLES (data, data_end, d, d_end);
- } else {
- if (inr >= outr)
- /* reverse speed up */
- REV_UP_SAMPLES (data, data_end, d, d_end);
- else
- /* reverse slow down */
- REV_DOWN_SAMPLES (data, data_end, d, d_end);
- }
-
- /* for the next iteration we write to the next segment at the beginning. */
- writeseg++;
- sampleoff = 0;
- }
- /* we consumed all samples here */
- data = data_end + bps;
-
-done:
- return inr - ((data_end - data) / bps);
-
- /* ERRORS */
-not_started:
- {
- GST_DEBUG_OBJECT (buf, "stopped processing");
- goto done;
- }
-}
-
-/**
- * gst_ring_buffer_commit_full:
- * @buf: the #GstRingBuffer to commit
- * @sample: the sample position of the data
- * @data: the data to commit
- * @in_samples: the number of samples in the data to commit
- * @out_samples: the number of samples to write to the ringbuffer
- * @accum: accumulator for rate conversion.
- *
- * Commit @in_samples samples pointed to by @data to the ringbuffer @buf.
- *
- * @in_samples and @out_samples define the rate conversion to perform on the the
- * samples in @data. For negative rates, @out_samples must be negative and
- * @in_samples positive.
- *
- * When @out_samples is positive, the first sample will be written at position @sample
- * in the ringbuffer. When @out_samples is negative, the last sample will be written to
- * @sample in reverse order.
- *
- * @out_samples does not need to be a multiple of the segment size of the ringbuffer
- * although it is recommended for optimal performance.
- *
- * @accum will hold a temporary accumulator used in rate conversion and should be
- * set to 0 when this function is first called. In case the commit operation is
- * interrupted, one can resume the processing by passing the previously returned
- * @accum value back to this function.
- *
- * MT safe.
- *
- * Returns: The number of samples written to the ringbuffer or -1 on error. The
- * number of samples written can be less than @out_samples when @buf was interrupted
- * with a flush or stop.
- *
- * Since: 0.10.11.
- */
-guint
-gst_ring_buffer_commit_full (GstRingBuffer * buf, guint64 * sample,
- guchar * data, gint in_samples, gint out_samples, gint * accum)
-{
- GstRingBufferClass *rclass;
- guint res = -1;
-
- g_return_val_if_fail (GST_IS_RING_BUFFER (buf), -1);
-
- if (G_UNLIKELY (in_samples == 0 || out_samples == 0))
- return in_samples;
-
- rclass = GST_RING_BUFFER_GET_CLASS (buf);
-
- if (G_LIKELY (rclass->commit))
- res = rclass->commit (buf, sample, data, in_samples, out_samples, accum);
-
- return res;
-}
-
-/**
- * gst_ring_buffer_commit:
- * @buf: the #GstRingBuffer to commit
- * @sample: the sample position of the data
- * @data: the data to commit
- * @len: the number of samples in the data to commit
- *
- * Same as gst_ring_buffer_commit_full() but with a in_samples and out_samples
- * equal to @len, ignoring accum.
- *
- * Returns: The number of samples written to the ringbuffer or -1 on
- * error.
- *
- * MT safe.
- */
-guint
-gst_ring_buffer_commit (GstRingBuffer * buf, guint64 sample, guchar * data,
- guint len)
-{
- guint res;
- guint64 samplep = sample;
-
- res = gst_ring_buffer_commit_full (buf, &samplep, data, len, len, NULL);
-
- return res;
-}
-
-/**
- * gst_ring_buffer_read:
- * @buf: the #GstRingBuffer to read from
- * @sample: the sample position of the data
- * @data: where the data should be read
- * @len: the number of samples in data to read
- *
- * Read @len samples from the ringbuffer into the memory pointed
- * to by @data.
- * The first sample should be read from position @sample in
- * the ringbuffer.
- *
- * @len should not be a multiple of the segment size of the ringbuffer
- * although it is recommended.
- *
- * Returns: The number of samples read from the ringbuffer or -1 on
- * error.
- *
- * MT safe.
- */
-guint
-gst_ring_buffer_read (GstRingBuffer * buf, guint64 sample, guchar * data,
- guint len)
-{
- gint segdone;
- gint segsize, segtotal, bps, sps;
- guint8 *dest;
- guint to_read;
-
- g_return_val_if_fail (GST_IS_RING_BUFFER (buf), -1);
- g_return_val_if_fail (buf->data != NULL, -1);
- g_return_val_if_fail (data != NULL, -1);
-
- dest = GST_BUFFER_DATA (buf->data);
- segsize = buf->spec.segsize;
- segtotal = buf->spec.segtotal;
- bps = buf->spec.bytes_per_sample;
- sps = buf->samples_per_seg;
-
- to_read = len;
- /* read enough samples */
- while (to_read > 0) {
- gint sampleslen;
- gint readseg, sampleoff;
-
- /* figure out the segment and the offset inside the segment where
- * the sample should be read from. */
- readseg = sample / sps;
- sampleoff = (sample % sps);
-
- while (TRUE) {
- gint diff;
-
- /* get the currently processed segment */
- segdone = g_atomic_int_get (&buf->segdone) - buf->segbase;
-
- /* see how far away it is from the read segment, normally segdone (where
- * the hardware is writing) is bigger than readseg (where software is
- * reading) */
- diff = segdone - readseg;
-
- GST_DEBUG
- ("pointer at %d, sample %" G_GUINT64_FORMAT
- ", read from %d-%d, to_read %d, diff %d, segtotal %d, segsize %d",
- segdone, sample, readseg, sampleoff, to_read, diff, segtotal,
- segsize);
-
- /* segment too far ahead, reader too slow */
- if (G_UNLIKELY (diff >= segtotal)) {
- /* pretend we read an empty segment. */
- sampleslen = MIN (sps, to_read);
- memcpy (data, buf->empty_seg, sampleslen * bps);
- goto next;
- }
-
- /* read segment is within readable range, we can break the loop and
- * start reading the data. */
- if (diff > 0)
- break;
-
- /* else we need to wait for the segment to become readable. */
- if (!wait_segment (buf))
- goto not_started;
- }
-
- /* we can read now */
- readseg = readseg % segtotal;
- sampleslen = MIN (sps - sampleoff, to_read);
-
- GST_DEBUG_OBJECT (buf, "read @%p seg %d, off %d, sampleslen %d",
- dest + readseg * segsize, readseg, sampleoff, sampleslen);
-
- memcpy (data, dest + (readseg * segsize) + (sampleoff * bps),
- (sampleslen * bps));
-
- next:
- to_read -= sampleslen;
- sample += sampleslen;
- data += sampleslen * bps;
- }
-
- return len - to_read;
-
- /* ERRORS */
-not_started:
- {
- GST_DEBUG_OBJECT (buf, "stopped processing");
- return len - to_read;
- }
-}
-
-/**
- * gst_ring_buffer_prepare_read:
- * @buf: the #GstRingBuffer to read from
- * @segment: the segment to read
- * @readptr: the pointer to the memory where samples can be read
- * @len: the number of bytes to read
- *
- * Returns a pointer to memory where the data from segment @segment
- * can be found. This function is mostly used by subclasses.
- *
- * Returns: FALSE if the buffer is not started.
- *
- * MT safe.
- */
-gboolean
-gst_ring_buffer_prepare_read (GstRingBuffer * buf, gint * segment,
- guint8 ** readptr, gint * len)
-{
- guint8 *data;
- gint segdone;
-
- g_return_val_if_fail (GST_IS_RING_BUFFER (buf), FALSE);
-
- g_return_val_if_fail (buf->data != NULL, FALSE);
- g_return_val_if_fail (segment != NULL, FALSE);
- g_return_val_if_fail (readptr != NULL, FALSE);
- g_return_val_if_fail (len != NULL, FALSE);
-
- data = GST_BUFFER_DATA (buf->data);
-
- if (buf->callback == NULL) {
- /* push mode, fail when nothing is started */
- if (g_atomic_int_get (&buf->state) != GST_RING_BUFFER_STATE_STARTED)
- return FALSE;
- }
-
- /* get the position of the pointer */
- segdone = g_atomic_int_get (&buf->segdone);
-
- *segment = segdone % buf->spec.segtotal;
- *len = buf->spec.segsize;
- *readptr = data + *segment * *len;
-
- GST_LOG ("prepare read from segment %d (real %d) @%p",
- *segment, segdone, *readptr);
-
- /* callback to fill the memory with data, for pull based
- * scheduling. */
- if (buf->callback)
- buf->callback (buf, *readptr, *len, buf->cb_data);
-
- return TRUE;
-}
-
-/**
- * gst_ring_buffer_advance:
- * @buf: the #GstRingBuffer to advance
- * @advance: the number of segments written
- *
- * Subclasses should call this function to notify the fact that
- * @advance segments are now processed by the device.
- *
- * MT safe.
- */
-void
-gst_ring_buffer_advance (GstRingBuffer * buf, guint advance)
-{
- g_return_if_fail (GST_IS_RING_BUFFER (buf));
-
- /* update counter */
- g_atomic_int_add (&buf->segdone, advance);
-
- /* the lock is already taken when the waiting flag is set,
- * we grab the lock as well to make sure the waiter is actually
- * waiting for the signal */
- if (g_atomic_int_compare_and_exchange (&buf->waiting, 1, 0)) {
- GST_OBJECT_LOCK (buf);
- GST_DEBUG_OBJECT (buf, "signal waiter");
- GST_RING_BUFFER_SIGNAL (buf);
- GST_OBJECT_UNLOCK (buf);
- }
-}
-
-/**
- * gst_ring_buffer_clear:
- * @buf: the #GstRingBuffer to clear
- * @segment: the segment to clear
- *
- * Clear the given segment of the buffer with silence samples.
- * This function is used by subclasses.
- *
- * MT safe.
- */
-void
-gst_ring_buffer_clear (GstRingBuffer * buf, gint segment)
-{
- guint8 *data;
-
- g_return_if_fail (GST_IS_RING_BUFFER (buf));
-
- /* no data means it's already cleared */
- if (G_UNLIKELY (buf->data == NULL))
- return;
-
- /* no empty_seg means it's not opened */
- if (G_UNLIKELY (buf->empty_seg == NULL))
- return;
-
- segment %= buf->spec.segtotal;
-
- data = GST_BUFFER_DATA (buf->data);
- data += segment * buf->spec.segsize;
-
- GST_LOG ("clear segment %d @%p", segment, data);
-
- memcpy (data, buf->empty_seg, buf->spec.segsize);
-}
-
-/**
- * gst_ring_buffer_may_start:
- * @buf: the #GstRingBuffer
- * @allowed: the new value
- *
- * Tell the ringbuffer that it is allowed to start playback when
- * the ringbuffer is filled with samples.
- *
- * MT safe.
- *
- * Since: 0.10.6
- */
-void
-gst_ring_buffer_may_start (GstRingBuffer * buf, gboolean allowed)
-{
- g_return_if_fail (GST_IS_RING_BUFFER (buf));
-
- GST_LOG_OBJECT (buf, "may start: %d", allowed);
- g_atomic_int_set (&buf->abidata.ABI.may_start, allowed);
-}
diff --git a/gst-libs/gst/audio/gstringbuffer.h b/gst-libs/gst/audio/gstringbuffer.h
deleted file mode 100644
index aced65cb..00000000
--- a/gst-libs/gst/audio/gstringbuffer.h
+++ /dev/null
@@ -1,408 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2005 Wim Taymans <wim@fluendo.com>
- *
- * gstringbuffer.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_RING_BUFFER_H__
-#define __GST_RING_BUFFER_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_RING_BUFFER (gst_ring_buffer_get_type())
-#define GST_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RING_BUFFER,GstRingBuffer))
-#define GST_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RING_BUFFER,GstRingBufferClass))
-#define GST_RING_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RING_BUFFER, GstRingBufferClass))
-#define GST_RING_BUFFER_CAST(obj) ((GstRingBuffer *)obj)
-#define GST_IS_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RING_BUFFER))
-#define GST_IS_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RING_BUFFER))
-
-typedef struct _GstRingBuffer GstRingBuffer;
-typedef struct _GstRingBufferClass GstRingBufferClass;
-typedef struct _GstRingBufferSpec GstRingBufferSpec;
-
-/**
- * GstRingBufferCallback:
- * @rbuf: a #GstRingBuffer
- * @data: target to fill
- * @len: amount to fill
- * @user_data: user data
- *
- * This function is set with gst_ring_buffer_set_callback() and is
- * called to fill the memory at @data with @len bytes of samples.
- */
-typedef void (*GstRingBufferCallback) (GstRingBuffer *rbuf, guint8* data, guint len, gpointer user_data);
-
-/**
- * GstRingBufferState:
- * @GST_RING_BUFFER_STATE_STOPPED: The ringbuffer is stopped
- * @GST_RING_BUFFER_STATE_PAUSED: The ringbuffer is paused
- * @GST_RING_BUFFER_STATE_STARTED: The ringbuffer is started
- *
- * The state of the ringbuffer.
- */
-typedef enum {
- GST_RING_BUFFER_STATE_STOPPED,
- GST_RING_BUFFER_STATE_PAUSED,
- GST_RING_BUFFER_STATE_STARTED
-} GstRingBufferState;
-
-/**
- * GstRingBufferSegState:
- * @GST_SEGSTATE_INVALID: The content of the segment is invalid
- * @GST_SEGSTATE_EMPTY: The segment is empty
- * @GST_SEGSTATE_FILLED: The segment contains valid data
- * @GST_SEGSTATE_PARTIAL: The segment partially contains valid data
- *
- * The state of a segment in the ringbuffer.
- */
-typedef enum {
- GST_SEGSTATE_INVALID,
- GST_SEGSTATE_EMPTY,
- GST_SEGSTATE_FILLED,
- GST_SEGSTATE_PARTIAL
-} GstRingBufferSegState;
-
-/**
- * GstBufferFormatType:
- * @GST_BUFTYPE_LINEAR: samples in linear PCM
- * @GST_BUFTYPE_FLOAT: samples in float
- * @GST_BUFTYPE_MU_LAW: samples in mulaw
- * @GST_BUFTYPE_A_LAW: samples in alaw
- * @GST_BUFTYPE_IMA_ADPCM: samples in ima adpcm
- * @GST_BUFTYPE_MPEG: samples in mpeg audio format
- * @GST_BUFTYPE_GSM: samples in gsm format
- * @GST_BUFTYPE_IEC958: samples in IEC958 frames (e.g. AC3)
- * @GST_BUFTYPE_AC3: samples in AC3 format
- * @GST_BUFTYPE_EAC3: samples in EAC3 format
- * @GST_BUFTYPE_DTS: samples in DTS format
- *
- * The format of the samples in the ringbuffer.
- */
-typedef enum
-{
- GST_BUFTYPE_LINEAR,
- GST_BUFTYPE_FLOAT,
- GST_BUFTYPE_MU_LAW,
- GST_BUFTYPE_A_LAW,
- GST_BUFTYPE_IMA_ADPCM,
- GST_BUFTYPE_MPEG,
- GST_BUFTYPE_GSM,
- GST_BUFTYPE_IEC958,
- GST_BUFTYPE_AC3,
- GST_BUFTYPE_EAC3,
- GST_BUFTYPE_DTS
-} GstBufferFormatType;
-
-typedef enum
-{
- GST_UNKNOWN,
-
- GST_S8,
- GST_U8,
-
- GST_S16_LE,
- GST_S16_BE,
- GST_U16_LE,
- GST_U16_BE,
-
- GST_S24_LE,
- GST_S24_BE,
- GST_U24_LE,
- GST_U24_BE,
-
- GST_S32_LE,
- GST_S32_BE,
- GST_U32_LE,
- GST_U32_BE,
-
- GST_S24_3LE,
- GST_S24_3BE,
- GST_U24_3LE,
- GST_U24_3BE,
- GST_S20_3LE,
- GST_S20_3BE,
- GST_U20_3LE,
- GST_U20_3BE,
- GST_S18_3LE,
- GST_S18_3BE,
- GST_U18_3LE,
- GST_U18_3BE,
-
- GST_FLOAT32_LE,
- GST_FLOAT32_BE,
-
- GST_FLOAT64_LE,
- GST_FLOAT64_BE,
-
- GST_MU_LAW,
- GST_A_LAW,
- GST_IMA_ADPCM,
- GST_MPEG,
- GST_GSM,
- GST_IEC958,
- GST_AC3,
- GST_EAC3,
- GST_DTS
-} GstBufferFormat;
-
-/**
- * GstRingBufferSpec:
- * @caps: The caps that generated the Spec.
- * @type: the sample type
- * @format: the sample format
- * @sign: the sample sign
- * @bigend: the endianness of the samples
- * @width: the width of the samples
- * @depth: th depth of the samples
- * @rate: the samplerate
- * @channels: the number of channels
- * @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
- * @bytes_per_sample: number of bytes in one sample
- * @silence_sample: bytes representing one sample of silence
- * @seglatency: number of segments queued in the lower level device,
- * defaults to segtotal
- *
- * The structure containing the format specification of the ringbuffer.
- */
-struct _GstRingBufferSpec
-{
- /*< public >*/
- /* in */
- GstCaps *caps; /* the caps of the buffer */
-
- /* in/out */
- GstBufferFormatType type;
- GstBufferFormat format;
- gboolean sign;
- gboolean bigend;
- gint width;
- gint depth;
- gint rate;
- gint channels;
-
- 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. */
- /* out */
- gint bytes_per_sample; /* number of bytes of one sample */
- guint8 silence_sample[32]; /* bytes representing silence */
-
- /* 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]; */
- guint8 _gst_reserved[(sizeof (gpointer) * GST_PADDING) - sizeof (gint)];
-};
-
-#define GST_RING_BUFFER_GET_COND(buf) (((GstRingBuffer *)buf)->cond)
-#define GST_RING_BUFFER_WAIT(buf) (g_cond_wait (GST_RING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf)))
-#define GST_RING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_RING_BUFFER_GET_COND (buf)))
-#define GST_RING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_RING_BUFFER_GET_COND (buf)))
-
-/**
- * GstRingBuffer:
- * @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
- * @data: data in the ringbuffer
- * @spec: format and layout of the ringbuffer data
- * @segstate: status of each segment in the ringbuffer (unused)
- * @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 _GstRingBuffer {
- GstObject object;
-
- /*< public >*/ /* with LOCK */
- GCond *cond;
- gboolean open;
- gboolean acquired;
- GstBuffer *data;
- GstRingBufferSpec spec;
- GstRingBufferSegState *segstate;
- gint samples_per_seg;
- guint8 *empty_seg;
-
- /*< public >*/ /* ATOMIC */
- gint state;
- gint segdone;
- gint segbase;
- gint waiting;
-
- /*< private >*/
- GstRingBufferCallback callback;
- gpointer cb_data;
-
- /*< private >*/
- union {
- struct {
- gboolean flushing;
- /* ATOMIC */
- gint may_start;
- gboolean active;
- } ABI;
- /* adding + 0 to mark ABI change to be undone later */
- gpointer _gst_reserved[GST_PADDING + 0];
- } abidata;
-};
-
-/**
- * GstRingBufferClass:
- * @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 samples queued in device
- * @activate: activate the thread that starts pulling and monitoring the
- * consumed segments in the device. Since 0.10.22
- * @commit: write samples into the ringbuffer
- * @clear_all: clear the entire ringbuffer Since 0.10.24
- *
- * The vmethods that subclasses can override to implement the ringbuffer.
- */
-struct _GstRingBufferClass {
- GstObjectClass parent_class;
-
- /*< public >*/
- gboolean (*open_device) (GstRingBuffer *buf);
- gboolean (*acquire) (GstRingBuffer *buf, GstRingBufferSpec *spec);
- gboolean (*release) (GstRingBuffer *buf);
- gboolean (*close_device) (GstRingBuffer *buf);
-
- gboolean (*start) (GstRingBuffer *buf);
- gboolean (*pause) (GstRingBuffer *buf);
- gboolean (*resume) (GstRingBuffer *buf);
- gboolean (*stop) (GstRingBuffer *buf);
-
- guint (*delay) (GstRingBuffer *buf);
-
- /* ABI added */
- gboolean (*activate) (GstRingBuffer *buf, gboolean active);
-
- guint (*commit) (GstRingBuffer * buf, guint64 *sample,
- guchar * data, gint in_samples,
- gint out_samples, gint * accum);
-
- void (*clear_all) (GstRingBuffer * buf);
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING - 3];
-};
-
-GType gst_ring_buffer_get_type(void);
-
-/* callback stuff */
-void gst_ring_buffer_set_callback (GstRingBuffer *buf, GstRingBufferCallback cb,
- gpointer user_data);
-
-gboolean gst_ring_buffer_parse_caps (GstRingBufferSpec *spec, GstCaps *caps);
-void gst_ring_buffer_debug_spec_caps (GstRingBufferSpec *spec);
-void gst_ring_buffer_debug_spec_buff (GstRingBufferSpec *spec);
-
-gboolean gst_ring_buffer_convert (GstRingBuffer * buf, GstFormat src_fmt,
- gint64 src_val, GstFormat dest_fmt,
- gint64 * dest_val);
-
-/* device state */
-gboolean gst_ring_buffer_open_device (GstRingBuffer *buf);
-gboolean gst_ring_buffer_close_device (GstRingBuffer *buf);
-
-gboolean gst_ring_buffer_device_is_open (GstRingBuffer *buf);
-
-/* allocate resources */
-gboolean gst_ring_buffer_acquire (GstRingBuffer *buf, GstRingBufferSpec *spec);
-gboolean gst_ring_buffer_release (GstRingBuffer *buf);
-
-gboolean gst_ring_buffer_is_acquired (GstRingBuffer *buf);
-
-/* activating */
-gboolean gst_ring_buffer_activate (GstRingBuffer *buf, gboolean active);
-gboolean gst_ring_buffer_is_active (GstRingBuffer *buf);
-
-/* flushing */
-void gst_ring_buffer_set_flushing (GstRingBuffer *buf, gboolean flushing);
-
-/* playback/pause */
-gboolean gst_ring_buffer_start (GstRingBuffer *buf);
-gboolean gst_ring_buffer_pause (GstRingBuffer *buf);
-gboolean gst_ring_buffer_stop (GstRingBuffer *buf);
-
-/* get status */
-guint gst_ring_buffer_delay (GstRingBuffer *buf);
-guint64 gst_ring_buffer_samples_done (GstRingBuffer *buf);
-
-void gst_ring_buffer_set_sample (GstRingBuffer *buf, guint64 sample);
-
-/* clear all segments */
-void gst_ring_buffer_clear_all (GstRingBuffer *buf);
-
-/* commit samples */
-guint gst_ring_buffer_commit (GstRingBuffer *buf, guint64 sample,
- guchar *data, guint len);
-guint gst_ring_buffer_commit_full (GstRingBuffer * buf, guint64 *sample,
- guchar * data, gint in_samples,
- gint out_samples, gint * accum);
-
-/* read samples */
-guint gst_ring_buffer_read (GstRingBuffer *buf, guint64 sample,
- guchar *data, guint len);
-
-/* mostly protected */
-/* not yet implemented
-gboolean gst_ring_buffer_prepare_write (GstRingBuffer *buf, gint *segment, guint8 **writeptr, gint *len);
-*/
-gboolean gst_ring_buffer_prepare_read (GstRingBuffer *buf, gint *segment, guint8 **readptr, gint *len);
-void gst_ring_buffer_clear (GstRingBuffer *buf, gint segment);
-void gst_ring_buffer_advance (GstRingBuffer *buf, guint advance);
-
-void gst_ring_buffer_may_start (GstRingBuffer *buf, gboolean allowed);
-
-
-G_END_DECLS
-
-#endif /* __GST_RING_BUFFER_H__ */
diff --git a/gst-libs/gst/audio/mixerutils.c b/gst-libs/gst/audio/mixerutils.c
deleted file mode 100644
index 94cdde3d..00000000
--- a/gst-libs/gst/audio/mixerutils.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003-2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
- * Copyright (C) 2005-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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstaudiomixerutils
- * @short_description: utility functions to find available audio mixers
- * from the plugin registry
- *
- * <refsect2>
- * <para>
- * Provides some utility functions to detect available audio mixers
- * on the system.
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "mixerutils.h"
-
-#include <gst/interfaces/propertyprobe.h>
-
-#include <string.h>
-
-static void
-gst_audio_mixer_filter_do_filter (GstAudioMixerFilterFunc filter_func,
- GstElementFactory * factory,
- GstElement ** p_element, GList ** p_collection, gpointer user_data)
-{
- /* so, the element is a mixer, let's see if the caller wants it */
- if (filter_func != NULL) {
- if (filter_func (GST_MIXER (*p_element), user_data) == TRUE) {
- *p_collection = g_list_prepend (*p_collection, *p_element);
- /* do not set state back to NULL here on purpose, caller
- * might want to keep the mixer open */
- *p_element = NULL;
- }
- } else {
- gst_element_set_state (*p_element, GST_STATE_NULL);
- *p_collection = g_list_prepend (*p_collection, *p_element);
- *p_element = NULL;
- }
-
- /* create new element for further probing if the old one was cleared */
- if (*p_element == NULL) {
- *p_element = gst_element_factory_create (factory, NULL);
- }
-}
-
-static gboolean
-gst_audio_mixer_filter_check_element (GstElement * element)
-{
- GstStateChangeReturn ret;
-
- /* open device (only then we can know for sure whether it is a mixer) */
- gst_element_set_state (element, GST_STATE_READY);
- ret = gst_element_get_state (element, NULL, NULL, 1 * GST_SECOND);
- if (ret != GST_STATE_CHANGE_SUCCESS) {
- GST_DEBUG ("could not open device / set element to READY");
- gst_element_set_state (element, GST_STATE_NULL);
- return FALSE;
- }
-
- /* is this device a mixer? */
- if (!GST_IS_MIXER (element)) {
- GST_DEBUG ("element is not a mixer");
- gst_element_set_state (element, GST_STATE_NULL);
- return FALSE;
- }
-
- /* any tracks? */
- if (!gst_mixer_list_tracks (GST_MIXER (element))) {
- GST_DEBUG ("element is a mixer, but has no tracks");
- gst_element_set_state (element, GST_STATE_NULL);
- return FALSE;
- }
-
- GST_DEBUG ("element is a mixer with mixer tracks");
- return TRUE;
-}
-
-static void
-gst_audio_mixer_filter_probe_feature (GstAudioMixerFilterFunc filter_func,
- GstElementFactory * factory,
- GList ** p_collection, gboolean first, gpointer user_data)
-{
- GstElement *element;
-
- GST_DEBUG ("probing %s ...", gst_element_factory_get_longname (factory));
-
- /* create element */
- element = gst_element_factory_create (factory, NULL);
-
- if (element == NULL) {
- GST_DEBUG ("could not create element from factory");
- return;
- }
-
- GST_DEBUG ("created element %s (%p)", GST_ELEMENT_NAME (element), element);
-
- if (GST_IS_PROPERTY_PROBE (element)) {
- GstPropertyProbe *probe;
- const GParamSpec *devspec;
-
- probe = GST_PROPERTY_PROBE (element);
-
- GST_DEBUG ("probing available devices ...");
- if ((devspec = gst_property_probe_get_property (probe, "device"))) {
- GValueArray *array;
-
- if ((array = gst_property_probe_probe_and_get_values (probe, devspec))) {
- guint n;
-
- GST_DEBUG ("there are %d available devices", array->n_values);
-
- /* set all devices and test for mixer */
- for (n = 0; n < array->n_values; n++) {
- GValue *device;
-
- /* set this device */
- device = g_value_array_get_nth (array, n);
- g_object_set_property (G_OBJECT (element), "device", device);
-
- GST_DEBUG ("trying device %s ..", g_value_get_string (device));
-
- if (gst_audio_mixer_filter_check_element (element)) {
- gst_audio_mixer_filter_do_filter (filter_func, factory, &element,
- p_collection, user_data);
-
- if (first && *p_collection != NULL) {
- GST_DEBUG ("Stopping after first found mixer, as requested");
- break;
- }
- }
- }
- g_value_array_free (array);
- }
- }
- } else {
- GST_DEBUG ("element does not support the property probe interface");
-
- if (gst_audio_mixer_filter_check_element (element)) {
- gst_audio_mixer_filter_do_filter (filter_func, factory, &element,
- p_collection, user_data);
- }
- }
-
- if (element) {
- gst_element_set_state (element, GST_STATE_NULL);
- gst_object_unref (element);
- }
-}
-
-static gint
-element_factory_rank_compare_func (gconstpointer a, gconstpointer b)
-{
- gint rank_a = gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (a));
- gint rank_b = gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (b));
-
- /* make order chosen in the end more determinable */
- if (rank_a == rank_b) {
- const gchar *name_a = GST_PLUGIN_FEATURE_NAME (GST_PLUGIN_FEATURE (a));
- const gchar *name_b = GST_PLUGIN_FEATURE_NAME (GST_PLUGIN_FEATURE (b));
-
- return g_ascii_strcasecmp (name_a, name_b);
- }
-
- return rank_b - rank_a;
-}
-
-/**
- * gst_audio_default_registry_mixer_filter:
- * @filter_func: filter function, or #NULL
- * @first: set to #TRUE if you only want the first suitable mixer element
- * @user_data: user data to pass to the filter function
- *
- * Utility function to find audio mixer elements.
- *
- * Will traverse the default plugin registry in order of plugin rank and
- * find usable audio mixer elements. The caller may optionally fine-tune
- * the selection by specifying a filter function.
- *
- * Returns: a #GList of audio mixer #GstElement<!-- -->s. You must free each
- * element in the list by setting it to NULL state and calling
- * gst_object_unref(). After that the list itself should be freed
- * using g_list_free().
- *
- * Since: 0.10.2
- */
-GList *
-gst_audio_default_registry_mixer_filter (GstAudioMixerFilterFunc filter_func,
- gboolean first, gpointer data)
-{
- GList *mixer_list = NULL;
- GList *feature_list;
- GList *walk;
-
- /* go through all elements of a certain class and check whether
- * they implement a mixer. If so, add it to the list. */
- feature_list = gst_registry_get_feature_list (gst_registry_get_default (),
- GST_TYPE_ELEMENT_FACTORY);
-
- feature_list = g_list_sort (feature_list, element_factory_rank_compare_func);
-
- for (walk = feature_list; walk != NULL; walk = walk->next) {
- GstElementFactory *factory;
- const gchar *klass;
-
- factory = GST_ELEMENT_FACTORY (walk->data);
-
- /* check category */
- klass = gst_element_factory_get_klass (factory);
- if (strcmp (klass, "Generic/Audio") == 0) {
- gst_audio_mixer_filter_probe_feature (filter_func, factory,
- &mixer_list, first, data);
- }
-
- if (first && mixer_list != NULL) {
- GST_DEBUG ("Stopping after first found mixer, as requested");
- break;
- }
- }
-
- gst_plugin_feature_list_free (feature_list);
-
- return g_list_reverse (mixer_list);
-}
diff --git a/gst-libs/gst/audio/mixerutils.h b/gst-libs/gst/audio/mixerutils.h
deleted file mode 100644
index cfda7ab7..00000000
--- a/gst-libs/gst/audio/mixerutils.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005-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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_AUDIO_MIXERUTILS_H__
-#define __GST_AUDIO_MIXERUTILS_H__
-
-#include <gst/gst.h>
-#include <gst/interfaces/mixer.h>
-
-G_BEGIN_DECLS
-
-/**
- * GstAudioMixerFilterFunc:
- * @mixer: a #GstElement implementing the #GstMixer interface
- * @user_data: user data
- *
- * Function that will be called by gst_audio_default_registry_mixer_filter()
- * so the caller can decide which mixer elements should be kept and returned.
- * When the mixer element is passed to the callback function, it is opened
- * and in READY state. If you decide to keep the element, you need to set it
- * back to NULL state yourself (unless you want to keep it opened of course).
- *
- * Returns: TRUE if the element should be kept, FALSE otherwise.
- */
-typedef gboolean (*GstAudioMixerFilterFunc) (GstMixer * mixer, gpointer user_data);
-
-
-GList * gst_audio_default_registry_mixer_filter (GstAudioMixerFilterFunc filter_func,
- gboolean first,
- gpointer user_data);
-
-G_END_DECLS
-
-#endif /* __GST_AUDIO_MIXERUTILS_H__ */
diff --git a/gst-libs/gst/audio/multichannel.c b/gst-libs/gst/audio/multichannel.c
deleted file mode 100644
index 7b319b81..00000000
--- a/gst-libs/gst/audio/multichannel.c
+++ /dev/null
@@ -1,742 +0,0 @@
-/* GStreamer Multichannel-Audio helper functions
- * (c) 2004 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-/**
- * SECTION:gstmultichannel
- * @short_description: Support for multichannel audio elements
- *
- * This module contains some helper functions and a enum to work with
- * multichannel audio.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "multichannel.h"
-
-#define GST_AUDIO_CHANNEL_POSITIONS_FIELD_NAME "channel-positions"
-
-/**
- * gst_audio_check_channel_positions:
- * @pos: An array of #GstAudioChannelPosition.
- * @channels: The number of elements in @pos.
- *
- * This functions checks if the given channel positions are valid. Channel
- * positions are valid if:
- * <itemizedlist>
- * <listitem><para>No channel positions appears twice or all positions are %GST_AUDIO_CHANNEL_POSITION_NONE.
- * </para></listitem>
- * <listitem><para>Either all or none of the channel positions are %GST_AUDIO_CHANNEL_POSITION_NONE.
- * </para></listitem>
- * <listitem><para>%GST_AUDIO_CHANNEL_POSITION_FRONT_MONO and %GST_AUDIO_CHANNEL_POSITION_LEFT or %GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT don't appear together in the given positions.
- * </para></listitem>
- * </itemizedlist>
- *
- * Since: 0.10.20
- *
- * Returns: %TRUE if the given channel positions are valid
- * and %FALSE otherwise.
- */
-gboolean
-gst_audio_check_channel_positions (const GstAudioChannelPosition * pos,
- guint channels)
-{
- gint i, n;
-
- const struct
- {
- const GstAudioChannelPosition pos1[2];
- const GstAudioChannelPosition pos2[1];
- } conf[] = {
- /* front: mono <-> stereo */
- { {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, {
- GST_AUDIO_CHANNEL_POSITION_FRONT_MONO}}, { {
- GST_AUDIO_CHANNEL_POSITION_INVALID}}
- };
-
- g_return_val_if_fail (pos != NULL, FALSE);
- g_return_val_if_fail (channels > 0, FALSE);
-
- /* check for invalid channel positions */
- for (n = 0; n < channels; n++) {
- if (pos[n] <= GST_AUDIO_CHANNEL_POSITION_INVALID ||
- pos[n] >= GST_AUDIO_CHANNEL_POSITION_NUM) {
- GST_WARNING ("Channel position %d for channel %d is invalid", pos[n], n);
- return FALSE;
- }
- }
-
- /* either all channel positions are NONE or all are defined,
- * but having only some channel positions NONE and others not
- * is not allowed */
- if (pos[0] == GST_AUDIO_CHANNEL_POSITION_NONE) {
- for (n = 1; n < channels; ++n) {
- if (pos[n] != GST_AUDIO_CHANNEL_POSITION_NONE) {
- GST_WARNING ("Either all channel positions must be defined, or all "
- "be set to NONE, having only some defined is not allowed");
- return FALSE;
- }
- }
- /* all positions are NONE, we are done here */
- return TRUE;
- }
-
- /* check for multiple position occurrences */
- for (i = GST_AUDIO_CHANNEL_POSITION_INVALID + 1;
- i < GST_AUDIO_CHANNEL_POSITION_NUM; i++) {
- gint count = 0;
-
- for (n = 0; n < channels; n++) {
- if (pos[n] == i)
- count++;
- }
-
- /* NONE may not occur mixed with other channel positions */
- if (i == GST_AUDIO_CHANNEL_POSITION_NONE && count > 0) {
- GST_WARNING ("Either all channel positions must be defined, or all "
- "be set to NONE, having only some defined is not allowed");
- return FALSE;
- }
-
- if (count > 1) {
- GST_WARNING ("Channel position %d occurred %d times, not allowed",
- i, count);
- return FALSE;
- }
- }
-
- /* check for position conflicts */
- for (i = 0; conf[i].pos1[0] != GST_AUDIO_CHANNEL_POSITION_INVALID; i++) {
- gboolean found1 = FALSE, found2 = FALSE;
-
- for (n = 0; n < channels; n++) {
- if (pos[n] == conf[i].pos1[0] || pos[n] == conf[i].pos1[1])
- found1 = TRUE;
- else if (pos[n] == conf[i].pos2[0])
- found2 = TRUE;
- }
-
- if (found1 && found2) {
- GST_WARNING ("Found conflicting channel positions %d/%d and %d",
- conf[i].pos1[0], conf[i].pos1[1], conf[i].pos2[0]);
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/* FIXME: these default positions may or may not be correct. In any
- * case, they are mostly just a fallback for buggy plugins, so it
- * should not really matter too much */
-#define NUM_DEF_CHANS 8
-static const GstAudioChannelPosition
- default_positions[NUM_DEF_CHANS][NUM_DEF_CHANS] = {
- /* 1 channel */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_MONO,
- },
- /* 2 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- },
- /* 3 channels (2.1) */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_LFE, /* or FRONT_CENTER for 3.0? */
- },
- /* 4 channels (4.0 or 3.1?) */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- },
- /* 5 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- },
- /* 6 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- },
- /* 7 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
- },
- /* 8 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
- GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
- }
-};
-
-/**
- * gst_audio_get_channel_positions:
- * @str: A #GstStructure to retrieve channel positions from.
- *
- * Retrieves a number of (fixed!) audio channel positions from
- * the provided #GstStructure and returns it as a newly allocated
- * array. The caller should g_free () this array. The caller
- * should also check that the members in this #GstStructure are
- * indeed "fixed" before calling this function.
- *
- * Returns: a newly allocated array containing the channel
- * positions as provided in the given #GstStructure. Returns
- * NULL on error.
- */
-
-GstAudioChannelPosition *
-gst_audio_get_channel_positions (GstStructure * str)
-{
- GstAudioChannelPosition *pos;
-
- gint channels, n;
-
- const GValue *pos_val_arr, *pos_val_entry;
-
- gboolean res;
-
- GType t;
-
- /* get number of channels, general type checkups */
- g_return_val_if_fail (str != NULL, NULL);
- res = gst_structure_get_int (str, "channels", &channels);
- g_return_val_if_fail (res, NULL);
- g_return_val_if_fail (channels > 0, NULL);
- pos_val_arr = gst_structure_get_value (str,
- GST_AUDIO_CHANNEL_POSITIONS_FIELD_NAME);
-
- /* The following checks are here to retain compatibility for plugins not
- * implementing this field. They expect that channels=1 implies mono
- * and channels=2 implies stereo, so we follow that. */
- if (pos_val_arr == NULL) {
- /* channel layouts for 1 and 2 channels are implicit, don't warn */
- if (channels > 2) {
- g_warning ("Failed to retrieve channel layout from caps. This usually "
- "means there is a GStreamer element that does not implement "
- "multichannel audio correctly. Please file a bug.");
- }
-
- /* just return some default channel layout if we have one */
- if (channels >= 1 && channels <= NUM_DEF_CHANS) {
- const GstAudioChannelPosition *p;
-
- p = default_positions[channels - 1];
- return g_memdup (p, channels * sizeof (GstAudioChannelPosition));
- }
-
- return NULL;
- }
-
- g_return_val_if_fail (gst_value_array_get_size (pos_val_arr) == channels,
- NULL);
- for (n = 0; n < channels; n++) {
- t = G_VALUE_TYPE (gst_value_array_get_value (pos_val_arr, n));
- g_return_val_if_fail (t == GST_TYPE_AUDIO_CHANNEL_POSITION, NULL);
- }
-
- /* ... and fill array */
- pos = g_new (GstAudioChannelPosition, channels);
- for (n = 0; n < channels; n++) {
- pos_val_entry = gst_value_array_get_value (pos_val_arr, n);
- pos[n] = g_value_get_enum (pos_val_entry);
- }
-
- if (!gst_audio_check_channel_positions (pos, channels)) {
- g_free (pos);
- return NULL;
- }
-
- return pos;
-}
-
-/**
- * gst_audio_set_channel_positions:
- * @str: A #GstStructure to set channel positions on.
- * @pos: an array of channel positions. The number of members
- * in this array should be equal to the (fixed!) number
- * of the "channels" field in the given #GstStructure.
- *
- * Adds a "channel-positions" field to the given #GstStructure,
- * which will represent the channel positions as given in the
- * provided #GstAudioChannelPosition array.
- */
-
-void
-gst_audio_set_channel_positions (GstStructure * str,
- const GstAudioChannelPosition * pos)
-{
- GValue pos_val_arr = { 0 }, pos_val_entry = {
- 0};
- gint channels, n;
-
- gboolean res;
-
- /* get number of channels, checkups */
- g_return_if_fail (str != NULL);
- g_return_if_fail (pos != NULL);
- res = gst_structure_get_int (str, "channels", &channels);
- g_return_if_fail (res);
- g_return_if_fail (channels > 0);
- if (!gst_audio_check_channel_positions (pos, channels))
- return;
-
- /* build gvaluearray from positions */
- g_value_init (&pos_val_entry, GST_TYPE_AUDIO_CHANNEL_POSITION);
- g_value_init (&pos_val_arr, GST_TYPE_ARRAY);
- for (n = 0; n < channels; n++) {
- g_value_set_enum (&pos_val_entry, pos[n]);
- gst_value_array_append_value (&pos_val_arr, &pos_val_entry);
- }
- g_value_unset (&pos_val_entry);
-
- /* add to structure */
- gst_structure_set_value (str,
- GST_AUDIO_CHANNEL_POSITIONS_FIELD_NAME, &pos_val_arr);
- g_value_unset (&pos_val_arr);
-}
-
-/**
- * gst_audio_set_structure_channel_positions_list:
- * @str: #GstStructure to set the list of channel positions
- * on.
- * @pos: the array containing one or more possible audio
- * channel positions that we should add in each value
- * of the array in the given structure.
- * @num_positions: the number of values in pos.
- *
- * Sets a (possibly non-fixed) list of possible audio channel
- * positions (given in pos) on the given structure. The
- * structure, after this function has been called, will contain
- * a "channel-positions" field with an array of the size of
- * the "channels" field value in the given structure (note
- * that this means that the channels field in the provided
- * structure should be fixed!). Each value in the array will
- * contain each of the values given in the pos array.
- */
-
-void
-gst_audio_set_structure_channel_positions_list (GstStructure * str,
- const GstAudioChannelPosition * pos, gint num_positions)
-{
- gint channels, n, c;
- GValue pos_val_arr = { 0 }, pos_val_list = {
- 0}, pos_val_entry = {
- 0};
- gboolean res;
-
- /* get number of channels, general type checkups */
- g_return_if_fail (str != NULL);
- g_return_if_fail (num_positions > 0);
- g_return_if_fail (pos != NULL);
- res = gst_structure_get_int (str, "channels", &channels);
- g_return_if_fail (res);
- g_return_if_fail (channels > 0);
-
- /* create the array of lists */
- g_value_init (&pos_val_arr, GST_TYPE_ARRAY);
- g_value_init (&pos_val_entry, GST_TYPE_AUDIO_CHANNEL_POSITION);
- for (n = 0; n < channels; n++) {
- g_value_init (&pos_val_list, GST_TYPE_LIST);
- for (c = 0; c < num_positions; c++) {
- g_value_set_enum (&pos_val_entry, pos[c]);
- gst_value_list_append_value (&pos_val_list, &pos_val_entry);
- }
- gst_value_array_append_value (&pos_val_arr, &pos_val_list);
- g_value_unset (&pos_val_list);
- }
- g_value_unset (&pos_val_entry);
- gst_structure_set_value (str, GST_AUDIO_CHANNEL_POSITIONS_FIELD_NAME,
- &pos_val_arr);
- g_value_unset (&pos_val_arr);
-}
-
-/*
- * Helper function for below. The structure will be conserved,
- * but might be cut down. Any additional structures that were
- * created will be stored in the returned caps.
- */
-
-static GstCaps *
-add_list_to_struct (GstStructure * str,
- const GstAudioChannelPosition * pos, gint num_positions)
-{
- GstCaps *caps = gst_caps_new_empty ();
-
- const GValue *chan_val;
-
- chan_val = gst_structure_get_value (str, "channels");
- if (G_VALUE_TYPE (chan_val) == G_TYPE_INT) {
- gst_audio_set_structure_channel_positions_list (str, pos, num_positions);
- } else if (G_VALUE_TYPE (chan_val) == GST_TYPE_LIST) {
- gint size;
-
- const GValue *sub_val;
-
- size = gst_value_list_get_size (chan_val);
- sub_val = gst_value_list_get_value (chan_val, 0);
- gst_structure_set_value (str, "channels", sub_val);
- gst_caps_append (caps, add_list_to_struct (str, pos, num_positions));
- while (--size > 0) {
- str = gst_structure_copy (str);
- sub_val = gst_value_list_get_value (chan_val, size);
- gst_structure_set_value (str, "channels", sub_val);
- gst_caps_append (caps, add_list_to_struct (str, pos, num_positions));
- gst_caps_append_structure (caps, str);
- }
- } else if (G_VALUE_TYPE (chan_val) == GST_TYPE_INT_RANGE) {
- gint min, max;
-
- min = gst_value_get_int_range_min (chan_val);
- max = gst_value_get_int_range_max (chan_val);
-
- gst_structure_set (str, "channels", G_TYPE_INT, min, NULL);
- gst_audio_set_structure_channel_positions_list (str, pos, num_positions);
- for (++min; min < max; min++) {
- str = gst_structure_copy (str);
- gst_structure_set (str, "channels", G_TYPE_INT, min, NULL);
- gst_audio_set_structure_channel_positions_list (str, pos, num_positions);
- gst_caps_append_structure (caps, str);
- }
- } else {
- g_warning ("Unexpected value type '%s' for channels field",
- GST_STR_NULL (g_type_name (G_VALUE_TYPE (chan_val))));
- }
-
- return caps;
-}
-
-/**
- * gst_audio_set_caps_channel_positions_list:
- * @caps: #GstCaps to set the list of channel positions on.
- * @pos: the array containing one or more possible audio
- * channel positions that we should add in each value
- * of the array in the given structure.
- * @num_positions: the number of values in pos.
- *
- * Sets a (possibly non-fixed) list of possible audio channel
- * positions (given in pos) on the given caps. Each of the
- * structures of the caps, after this function has been called,
- * will contain a "channel-positions" field with an array.
- * Each value in the array will contain each of the values given
- * in the pos array. Note that the size of the caps might be
- * increased by this, since each structure with a "channel-
- * positions" field needs to have a fixed "channels" field.
- * The input caps is not required to have this.
- */
-
-void
-gst_audio_set_caps_channel_positions_list (GstCaps * caps,
- const GstAudioChannelPosition * pos, gint num_positions)
-{
- gint size, n;
-
- /* get number of channels, general type checkups */
- g_return_if_fail (caps != NULL);
- g_return_if_fail (num_positions > 0);
- g_return_if_fail (pos != NULL);
-
- size = gst_caps_get_size (caps);
- for (n = 0; n < size; n++) {
- gst_caps_append (caps, add_list_to_struct (gst_caps_get_structure (caps,
- n), pos, num_positions));
- }
-}
-
-/**
- * gst_audio_fixate_channel_positions:
- * @str: a #GstStructure containing a (possibly unfixed)
- * "channel-positions" field.
- *
- * Custom fixate function. Elements that implement some sort of
- * channel conversion algorithm should use this function for
- * fixating on GstAudioChannelPosition properties. It will take
- * care of equal channel positioning (left/right). Caller g_free()s
- * the return value. The input properties may be (and are supposed
- * to be) unfixed.
- * Note that this function is mostly a hack because we currently
- * have no way to add default fixation functions for new GTypes.
- *
- * Returns: fixed values that the caller could use as a fixed
- * set of #GstAudioChannelPosition values.
- */
-
-GstAudioChannelPosition *
-gst_audio_fixate_channel_positions (GstStructure * str)
-{
- GstAudioChannelPosition *pos;
-
- gint channels, n, num_unfixed = 0, i, c;
-
- const GValue *pos_val_arr, *pos_val_entry, *pos_val;
-
- gboolean res, is_stereo = TRUE;
-
- GType t;
-
- /*
- * We're going to do this cluelessly. We'll make an array of values that
- * conflict with each other and, for each iteration in this array, pick
- * either one until all unknown values are filled. This might not work in
- * corner cases but should work OK for the general case.
- */
- const struct
- {
- const GstAudioChannelPosition pos1[2];
- const GstAudioChannelPosition pos2[1];
- } conf[] = {
- /* front: mono <-> stereo */
- {
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, {
- GST_AUDIO_CHANNEL_POSITION_FRONT_MONO}}, { {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER}, {
- GST_AUDIO_CHANNEL_POSITION_INVALID}}, { {
- GST_AUDIO_CHANNEL_POSITION_INVALID, GST_AUDIO_CHANNEL_POSITION_INVALID}, {
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER}}, { {
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, {
- GST_AUDIO_CHANNEL_POSITION_INVALID}}, { {
- GST_AUDIO_CHANNEL_POSITION_INVALID, GST_AUDIO_CHANNEL_POSITION_INVALID}, {
- GST_AUDIO_CHANNEL_POSITION_REAR_CENTER}}, { {
- GST_AUDIO_CHANNEL_POSITION_INVALID, GST_AUDIO_CHANNEL_POSITION_INVALID}, {
- GST_AUDIO_CHANNEL_POSITION_LFE}}, { {
- GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
- GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT}, {
- GST_AUDIO_CHANNEL_POSITION_INVALID}}, { {
- GST_AUDIO_CHANNEL_POSITION_INVALID, GST_AUDIO_CHANNEL_POSITION_INVALID}, {
- GST_AUDIO_CHANNEL_POSITION_INVALID}}
- };
- struct
- {
- gint num_opt[3];
- guint num_opts[3];
- gboolean is_fixed[3];
- gint choice; /* -1 is none, 0 is the two, 1 is the one */
- } opt;
-
- /* get number of channels, general type checkups */
- g_return_val_if_fail (str != NULL, NULL);
- res = gst_structure_get_int (str, "channels", &channels);
- g_return_val_if_fail (res, NULL);
- g_return_val_if_fail (channels > 0, NULL);
-
- /* 0.8.x mono/stereo checks */
- pos_val_arr = gst_structure_get_value (str,
- GST_AUDIO_CHANNEL_POSITIONS_FIELD_NAME);
- if (!pos_val_arr && (channels == 1 || channels == 2)) {
- pos = g_new (GstAudioChannelPosition, channels);
- if (channels == 1) {
- pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_MONO;
- } else {
- pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
- pos[1] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
- }
- return pos;
- }
- g_return_val_if_fail (pos_val_arr != NULL, NULL);
- g_return_val_if_fail (gst_value_array_get_size (pos_val_arr) == channels,
- NULL);
- for (n = 0; n < channels; n++) {
- t = G_VALUE_TYPE (gst_value_array_get_value (pos_val_arr, n));
- g_return_val_if_fail (t == GST_TYPE_LIST ||
- t == GST_TYPE_AUDIO_CHANNEL_POSITION, NULL);
- }
-
- /* all unknown, to start with */
- pos = g_new (GstAudioChannelPosition, channels);
- for (n = 0; n < channels; n++)
- pos[n] = GST_AUDIO_CHANNEL_POSITION_INVALID;
- num_unfixed = channels;
-
- /* Iterate the array of conflicting values */
- for (i = 0; conf[i].pos1[0] != GST_AUDIO_CHANNEL_POSITION_INVALID ||
- conf[i].pos2[0] != GST_AUDIO_CHANNEL_POSITION_INVALID; i++) {
- /* front/center only important if not mono (obviously) */
- if (conf[i].pos1[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER &&
- !is_stereo)
- continue;
-
- /* init values */
- for (n = 0; n < 3; n++) {
- opt.num_opt[n] = -1;
- opt.num_opts[n] = -1;
- opt.is_fixed[n] = FALSE;
- }
-
- /* Now, we'll see for each channel if it allows for any of the values in
- * the set of conflicting audio channel positions and keep scores. */
- for (n = 0; n < channels; n++) {
- /* if the channel is already taken, don't bother */
- if (pos[n] != GST_AUDIO_CHANNEL_POSITION_INVALID)
- continue;
-
- pos_val_entry = gst_value_array_get_value (pos_val_arr, n);
- t = G_VALUE_TYPE (pos_val_entry);
- if (t == GST_TYPE_LIST) {
- /* This algorhythm is suboptimal. */
- for (c = 0; c < gst_value_list_get_size (pos_val_entry); c++) {
- pos_val = gst_value_list_get_value (pos_val_entry, c);
- if (g_value_get_enum (pos_val) == conf[i].pos1[0] &&
- opt.num_opts[0] > gst_value_list_get_size (pos_val_entry) &&
- !opt.is_fixed[0]) {
- /* Now test if the old position of num_opt[0] also allows for
- * the other channel (which was skipped previously). If so,
- * keep score. */
- if (opt.num_opt[0] != -1) {
- gint c1;
-
- pos_val_entry = gst_value_array_get_value (pos_val_arr,
- opt.num_opt[0]);
- if (G_VALUE_TYPE (pos_val_entry) == GST_TYPE_LIST) {
- for (c1 = 0; c1 < gst_value_list_get_size (pos_val_entry); c1++) {
- pos_val = gst_value_list_get_value (pos_val_entry, c1);
- if (g_value_get_enum (pos_val) == conf[i].pos1[1] &&
- opt.num_opts[1] > opt.num_opts[0] && !opt.is_fixed[1]) {
- opt.num_opts[1] = opt.num_opts[0];
- opt.num_opt[1] = opt.num_opt[0];
- }
- }
- pos_val = gst_value_list_get_value (pos_val_entry, c);
- }
- pos_val_entry = gst_value_array_get_value (pos_val_arr, n);
- }
-
- /* and save values */
- opt.num_opts[0] = gst_value_list_get_size (pos_val_entry);
- opt.num_opt[0] = n;
- } else if (g_value_get_enum (pos_val) == conf[i].pos1[1] &&
- opt.num_opts[1] > gst_value_list_get_size (pos_val_entry) &&
- !opt.is_fixed[1] && n != opt.num_opt[0]) {
- opt.num_opts[1] = gst_value_list_get_size (pos_val_entry);
- opt.num_opt[1] = n;
- }
-
- /* 2 goes separately, because 0/1 vs. 2 are separate */
- if (g_value_get_enum (pos_val) == conf[i].pos2[0] &&
- opt.num_opts[2] > gst_value_list_get_size (pos_val_entry) &&
- !opt.is_fixed[2]) {
- opt.num_opts[2] = gst_value_list_get_size (pos_val_entry);
- opt.num_opt[2] = n;
- }
- }
- } else {
- if (g_value_get_enum (pos_val_entry) == conf[i].pos1[0]) {
- opt.num_opt[0] = n;
- opt.is_fixed[0] = TRUE;
- } else if (g_value_get_enum (pos_val_entry) == conf[i].pos1[1]) {
- opt.num_opt[1] = n;
- opt.is_fixed[1] = TRUE;
- } else if (g_value_get_enum (pos_val_entry) == conf[i].pos2[0]) {
- opt.num_opt[2] = n;
- opt.is_fixed[2] = TRUE;
- }
- }
- }
-
- /* check our results and choose either one */
- if ((opt.is_fixed[0] || opt.is_fixed[1]) && opt.is_fixed[2]) {
- g_warning ("Pre-fixated on both %d/%d and %d - conflict!",
- conf[i].pos1[0], conf[i].pos1[1], conf[i].pos2[0]);
- g_free (pos);
- return NULL;
- } else if ((opt.is_fixed[0] && opt.num_opt[1] == -1) ||
- (opt.is_fixed[1] && opt.num_opt[0] == -1)) {
- g_warning ("Pre-fixated one side, but other side n/a of %d/%d",
- conf[i].pos1[0], conf[i].pos1[1]);
- g_free (pos);
- return NULL;
- } else if (opt.is_fixed[0] || opt.is_fixed[1]) {
- opt.choice = 0;
- } else if (opt.is_fixed[2]) {
- opt.choice = 1;
- } else if (opt.num_opt[0] != -1 && opt.num_opt[1] != -1) {
- opt.choice = 0;
- } else if (opt.num_opt[2] != -1) {
- opt.choice = 1;
- } else {
- opt.choice = -1;
- }
-
- /* stereo? Note that we keep is_stereo to TRUE if we didn't decide on
- * any arrangement. The mono/stereo channels might be handled elsewhere
- * which is clearly outside the scope of this element, so we cannot
- * know and expect the application to handle that then. */
- if (conf[i].pos2[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_MONO &&
- opt.choice == 1) {
- is_stereo = FALSE;
- }
-
- /* now actually decide what we'll do and fixate on that */
- if (opt.choice == 0) {
- g_assert (conf[i].pos1[0] != GST_AUDIO_CHANNEL_POSITION_INVALID &&
- conf[i].pos1[1] != GST_AUDIO_CHANNEL_POSITION_INVALID);
- pos[opt.num_opt[0]] = conf[i].pos1[0];
- pos[opt.num_opt[1]] = conf[i].pos1[1];
- num_unfixed -= 2;
- } else if (opt.choice == 1) {
- g_assert (conf[i].pos2[0] != GST_AUDIO_CHANNEL_POSITION_INVALID);
- pos[opt.num_opt[2]] = conf[i].pos2[0];
- num_unfixed--;
- }
- }
-
- /* safety check */
- if (num_unfixed > 0) {
- g_warning ("%d unfixed channel positions left after fixation!",
- num_unfixed);
- g_free (pos);
- return NULL;
- }
-
- if (!gst_audio_check_channel_positions (pos, channels)) {
- g_free (pos);
- return NULL;
- }
-
- return pos;
-}
diff --git a/gst-libs/gst/audio/multichannel.h b/gst-libs/gst/audio/multichannel.h
deleted file mode 100644
index 75dbf29b..00000000
--- a/gst-libs/gst/audio/multichannel.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* GStreamer Multichannel-Audio helper functions
- * (c) 2004 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_AUDIO_MULTICHANNEL_H__
-#define __GST_AUDIO_MULTICHANNEL_H__
-
-#include <gst/audio/audio.h>
-#include <gst/audio/audio-enumtypes.h>
-
-G_BEGIN_DECLS
-
-typedef enum {
- GST_AUDIO_CHANNEL_POSITION_INVALID = -1,
-
- /* Main front speakers. Mono and left/right are mututally exclusive! */
- GST_AUDIO_CHANNEL_POSITION_FRONT_MONO,
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
-
- /* rear. Left/right and center are mututally exclusive! */
- GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
-
- /* subwoofer/low-frequency */
- GST_AUDIO_CHANNEL_POSITION_LFE,
-
- /* Center front speakers. Center and left/right_of_center cannot be
- * used together! */
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
-
- /* sides */
- GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
- GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
-
- /* for multi-channel input and output with more than 8 channels,
- * incompatible with all other positions, either all positions
- * are defined or all positions are undefined, but can't mix'n'match */
- GST_AUDIO_CHANNEL_POSITION_NONE,
-
- /* don't use - counter */
- GST_AUDIO_CHANNEL_POSITION_NUM
-} GstAudioChannelPosition;
-
-/* Retrieves or sets the positions from/to a GstStructure. Only
- * works with fixed caps, caller should check for that! Caller
- * g_free()s result of the getter. */
-GstAudioChannelPosition *
- gst_audio_get_channel_positions (GstStructure *str);
-void gst_audio_set_channel_positions (GstStructure *str,
- const GstAudioChannelPosition *pos);
-
-/* Sets a (non-fixed) list of possible audio channel positions
- * on a structure (this requires the "channels" property to
- * be fixed!) or on a caps (here, the "channels" property may be
- * unfixed and the caps may even contain multiple structures). */
-void gst_audio_set_structure_channel_positions_list
- (GstStructure *str,
- const GstAudioChannelPosition *pos,
- gint num_positions);
-void gst_audio_set_caps_channel_positions_list
- (GstCaps *caps,
- const GstAudioChannelPosition *pos,
- gint num_positions);
-
-/* Custom fixate function. Elements that implement some sort of
- * channel conversion algorhithm should use this function for
- * fixating on GstAudioChannelPosition properties. It will take
- * care of equal channel positioning (left/right). Caller g_free()s
- * the return value. The input properties may be (and are supposed
- * to be) unfixed. */
-GstAudioChannelPosition *
- gst_audio_fixate_channel_positions (GstStructure *str);
-
-gboolean gst_audio_check_channel_positions (const GstAudioChannelPosition * pos, guint channels);
-
-G_END_DECLS
-
-#endif /* __GST_AUDIO_MULTICHANNEL_H__ */
diff --git a/gst-libs/gst/audio/testchannels.c b/gst-libs/gst/audio/testchannels.c
deleted file mode 100644
index 53ca51d8..00000000
--- a/gst-libs/gst/audio/testchannels.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* GStreamer Multichannel Test
- * (c) 2004 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "multichannel.c"
-#include "audio-enumtypes.c"
-
-gint
-main (gint argc, gchar * argv[])
-{
- gchar *str;
- GstCaps *caps;
- GstAudioChannelPosition pos[2] = { GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
- };
-
- /* register multichannel type */
- gst_init (&argc, &argv);
- gst_audio_channel_position_get_type ();
-
- /* test some caps-string conversions */
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "channels", G_TYPE_INT, 2, NULL);
- str = gst_caps_to_string (caps);
- g_print ("Test caps #1: %s\n", str);
- g_free (str);
- gst_audio_set_channel_positions (gst_caps_get_structure (caps, 0), pos);
- str = gst_caps_to_string (caps);
- g_print ("Test caps #2: %s\n", str);
- g_free (str);
- gst_caps_unref (caps);
-
- return 0;
-}
diff --git a/gst-libs/gst/cdda/Makefile.am b/gst-libs/gst/cdda/Makefile.am
deleted file mode 100644
index bed4edb3..00000000
--- a/gst-libs/gst/cdda/Makefile.am
+++ /dev/null
@@ -1,60 +0,0 @@
-lib_LTLIBRARIES = libgstcdda-@GST_MAJORMINOR@.la
-
-libgstcdda_@GST_MAJORMINOR@_la_SOURCES = \
- gstcddabasesrc.c
-
-libgstcdda_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/cdda
-libgstcdda_@GST_MAJORMINOR@include_HEADERS = \
- gstcddabasesrc.h
-
-libgstcdda_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) \
- $(top_builddir)/gst-libs/gst/tag/libgsttag-@GST_MAJORMINOR@.la
-libgstcdda_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
-libgstcdda_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
-
-# Disabled until this is fixed:
-# http://bugzilla.gnome.org/show_bug.cgi?id=594209
-if FALSE
-if HAVE_INTROSPECTION
-BUILT_GIRSOURCES = GstCdda-@GST_MAJORMINOR@.gir
-
-gir_headers=$(patsubst %,$(srcdir)/%, $(libgstcdda_@GST_MAJORMINOR@include_HEADERS))
-gir_sources=$(patsubst %,$(srcdir)/%, $(libgstcdda_@GST_MAJORMINOR@_la_SOURCES))
-gir_cincludes=$(patsubst %,--c-include='gst/cdda/%',$(libgstcdda_@GST_MAJORMINOR@include_HEADERS))
-
-GstCdda-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstcdda-@GST_MAJORMINOR@.la
- PKG_CONFIG_PATH="$(PKG_CONFIG_PATH):$(top_builddir)/pkgconfig" \
- $(INTROSPECTION_SCANNER) -v --namespace GstCdda \
- --nsversion=@GST_MAJORMINOR@ \
- --strip-prefix=Gst \
- $(gir_cincludes) \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-base-0.10` \
- --add-include-path=$(builddir)/../tag \
- --library=gstcdda-0.10 \
- --include=Gst-0.10 \
- --include=GstBase-0.10 \
- --include=GstTag-0.10 \
- --libtool="$(top_builddir)/libtool" \
- --pkg gstreamer-0.10 \
- --pkg gstreamer-base-0.10 \
- --pkg gstreamer-tag-0.10 \
- --output $@ \
- $(gir_headers) \
- $(gir_sources)
-
-# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
-# install anything - we need to install inside our prefix.
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(BUILT_GIRSOURCES)
-
-typelibsdir = $(libdir)/girepository-1.0/
-
-typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
-
-%.typelib: %.gir $(INTROSPECTION_COMPILER)
- $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=$(builddir) $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
-CLEANFILES = $(BUILT_GIRSOURCES) $(typelibs_DATA)
-endif
-endif
diff --git a/gst-libs/gst/cdda/gstcddabasesrc.c b/gst-libs/gst/cdda/gstcddabasesrc.c
deleted file mode 100644
index 0a0d53d1..00000000
--- a/gst-libs/gst/cdda/gstcddabasesrc.c
+++ /dev/null
@@ -1,1665 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999 Erik Walthinsen <omega@cse.ogi.edu>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/* TODO:
- *
- * - in ::start(), we want to post a tags message with an array or a list
- * of tagslists of all tracks, so that applications know at least the
- * number of tracks and all track durations immediately without having
- * to do any querying. We have to decide what type and name to use for
- * this array of track taglists.
- *
- * - FIX cddb discid calculation algorithm for mixed mode CDs - do we use
- * offsets and duration of ALL tracks (data + audio) for the CDDB ID
- * calculation, or only audio tracks?
- *
- * - Do we really need properties for the TOC bias/offset stuff? Wouldn't
- * environment variables make much more sense? Do we need this at all
- * (does it only affect ancient hardware?)
- */
-
-/**
- * SECTION:gstcddabasesrc
- * @short_description: Base class for CD digital audio (CDDA) sources
- *
- * <refsect2>
- * <para>
- * Provides a base class for CDDA sources, which handles things like seeking,
- * querying, discid calculation, tags, and buffer timestamping.
- * </para>
- * <title>Using GstCddaBaseSrc-based elements in applications</title>
- * <para>
- * GstCddaBaseSrc registers two #GstFormat<!-- -->s of its own, namely
- * the "track" format and the "sector" format. Applications will usually
- * only find the "track" format interesting. You can retrieve that #GstFormat
- * for use in seek events or queries with gst_format_get_by_nick("track").
- * </para>
- * <para>
- * In order to query the number of tracks, for example, an application would
- * set the CDDA source element to READY or PAUSED state and then query the
- * the number of tracks via gst_element_query_duration() using the track
- * format acquired above. Applications can query the currently playing track
- * in the same way.
- * </para>
- * <para>
- * Alternatively, applications may retrieve the currently playing track and
- * the total number of tracks from the taglist that will posted on the bus
- * whenever the CD is opened or the currently playing track changes. The
- * taglist will contain GST_TAG_TRACK_NUMBER and GST_TAG_TRACK_COUNT tags.
- * </para>
- * <para>
- * Applications playing back CD audio using playbin and cdda://n URIs should
- * issue a seek command in track format to change between tracks, rather than
- * setting a new cdda://n+1 URI on playbin (as setting a new URI on playbin
- * involves closing and re-opening the CD device, which is much much slower).
- * </para>
- * <title>Tags and meta-information</title>
- * <para>
- * CDDA sources will automatically emit a number of tags, details about which
- * can be found in the libgsttag documentation. Those tags are:
- * #GST_TAG_CDDA_CDDB_DISCID, #GST_TAG_CDDA_CDDB_DISCID_FULL,
- * #GST_TAG_CDDA_MUSICBRAINZ_DISCID, #GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL,
- * among others.
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <stdlib.h> /* for strtol */
-
-#include "gstcddabasesrc.h"
-#include "gst/gst-i18n-plugin.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_cdda_base_src_debug);
-#define GST_CAT_DEFAULT gst_cdda_base_src_debug
-
-#define DEFAULT_DEVICE "/dev/cdrom"
-
-#define CD_FRAMESIZE_RAW (2352)
-
-#define SECTORS_PER_SECOND (75)
-#define SECTORS_PER_MINUTE (75*60)
-#define SAMPLES_PER_SECTOR (CD_FRAMESIZE_RAW >> 2)
-#define TIME_INTERVAL_FROM_SECTORS(sectors) ((SAMPLES_PER_SECTOR * sectors * GST_SECOND) / 44100)
-#define SECTORS_FROM_TIME_INTERVAL(dtime) (dtime * 44100 / (SAMPLES_PER_SECTOR * GST_SECOND))
-
-enum
-{
- ARG_0,
- ARG_MODE,
- ARG_DEVICE,
- ARG_TRACK,
- ARG_TOC_OFFSET,
- ARG_TOC_BIAS
-};
-
-static void gst_cdda_base_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_cdda_base_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_cdda_base_src_finalize (GObject * obj);
-static const GstQueryType *gst_cdda_base_src_get_query_types (GstPad * pad);
-static gboolean gst_cdda_base_src_query (GstBaseSrc * src, GstQuery * query);
-static gboolean gst_cdda_base_src_handle_event (GstBaseSrc * basesrc,
- GstEvent * event);
-static gboolean gst_cdda_base_src_do_seek (GstBaseSrc * basesrc,
- GstSegment * segment);
-static void gst_cdda_base_src_setup_interfaces (GType type);
-static gboolean gst_cdda_base_src_start (GstBaseSrc * basesrc);
-static gboolean gst_cdda_base_src_stop (GstBaseSrc * basesrc);
-static GstFlowReturn gst_cdda_base_src_create (GstPushSrc * pushsrc,
- GstBuffer ** buf);
-static gboolean gst_cdda_base_src_is_seekable (GstBaseSrc * basesrc);
-static void gst_cdda_base_src_update_duration (GstCddaBaseSrc * src);
-static void gst_cdda_base_src_set_index (GstElement * src, GstIndex * index);
-static GstIndex *gst_cdda_base_src_get_index (GstElement * src);
-
-GST_BOILERPLATE_FULL (GstCddaBaseSrc, gst_cdda_base_src, GstPushSrc,
- GST_TYPE_PUSH_SRC, gst_cdda_base_src_setup_interfaces);
-
-#define SRC_CAPS \
- "audio/x-raw-int, " \
- "endianness = (int) BYTE_ORDER, " \
- "signed = (boolean) true, " \
- "width = (int) 16, " \
- "depth = (int) 16, " \
- "rate = (int) 44100, " \
- "channels = (int) 2" \
-
-static GstStaticPadTemplate gst_cdda_base_src_src_template =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (SRC_CAPS)
- );
-
-/* our two formats */
-static GstFormat track_format;
-static GstFormat sector_format;
-
-GType
-gst_cdda_base_src_mode_get_type (void)
-{
- static GType mode_type; /* 0 */
- static const GEnumValue modes[] = {
- {GST_CDDA_BASE_SRC_MODE_NORMAL, "Stream consists of a single track",
- "normal"},
- {GST_CDDA_BASE_SRC_MODE_CONTINUOUS, "Stream consists of the whole disc",
- "continuous"},
- {0, NULL, NULL}
- };
-
- if (mode_type == 0)
- mode_type = g_enum_register_static ("GstCddaBaseSrcMode", modes);
-
- return mode_type;
-}
-
-static void
-gst_cdda_base_src_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_cdda_base_src_src_template));
-
- /* our very own formats */
- track_format = gst_format_register ("track", "CD track");
- sector_format = gst_format_register ("sector", "CD sector");
-
- /* register CDDA tags */
- gst_tag_register_musicbrainz_tags ();
-
-#if 0
- ///// FIXME: what type to use here? ///////
- gst_tag_register (GST_TAG_CDDA_TRACK_TAGS, GST_TAG_FLAG_META, GST_TYPE_TAG_LIST, "track-tags", "CDDA taglist for one track", gst_tag_merge_use_first); ///////////// FIXME: right function??? ///////
-#endif
-
- GST_DEBUG_CATEGORY_INIT (gst_cdda_base_src_debug, "cddabasesrc", 0,
- "CDDA Base Source");
-}
-
-static void
-gst_cdda_base_src_class_init (GstCddaBaseSrcClass * klass)
-{
- GstElementClass *element_class;
- GstPushSrcClass *pushsrc_class;
- GstBaseSrcClass *basesrc_class;
- GObjectClass *gobject_class;
-
- gobject_class = (GObjectClass *) klass;
- element_class = (GstElementClass *) klass;
- basesrc_class = (GstBaseSrcClass *) klass;
- pushsrc_class = (GstPushSrcClass *) klass;
-
- gobject_class->set_property = gst_cdda_base_src_set_property;
- gobject_class->get_property = gst_cdda_base_src_get_property;
- gobject_class->finalize = gst_cdda_base_src_finalize;
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEVICE,
- g_param_spec_string ("device", "Device", "CD device location",
- NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MODE,
- g_param_spec_enum ("mode", "Mode", "Mode", GST_TYPE_CDDA_BASE_SRC_MODE,
- GST_CDDA_BASE_SRC_MODE_NORMAL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TRACK,
- g_param_spec_uint ("track", "Track", "Track", 1, 99, 1,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-#if 0
- /* Do we really need this toc adjustment stuff as properties? does the user
- * have a chance to set it in practice, e.g. when using sound-juicer, rb,
- * totem, whatever? Shouldn't we rather use environment variables
- * for this? (tpm) */
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOC_OFFSET,
- g_param_spec_int ("toc-offset", "Table of contents offset",
- "Add <n> sectors to the values reported", G_MININT, G_MAXINT, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOC_BIAS,
- g_param_spec_boolean ("toc-bias", "Table of contents bias",
- "Assume that the beginning offset of track 1 as reported in the TOC "
- "will be addressed as LBA 0. Necessary for some Toshiba drives to "
- "get track boundaries", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-#endif
-
- element_class->set_index = GST_DEBUG_FUNCPTR (gst_cdda_base_src_set_index);
- element_class->get_index = GST_DEBUG_FUNCPTR (gst_cdda_base_src_get_index);
-
- basesrc_class->start = GST_DEBUG_FUNCPTR (gst_cdda_base_src_start);
- basesrc_class->stop = GST_DEBUG_FUNCPTR (gst_cdda_base_src_stop);
- basesrc_class->query = GST_DEBUG_FUNCPTR (gst_cdda_base_src_query);
- basesrc_class->event = GST_DEBUG_FUNCPTR (gst_cdda_base_src_handle_event);
- basesrc_class->do_seek = GST_DEBUG_FUNCPTR (gst_cdda_base_src_do_seek);
- basesrc_class->is_seekable =
- GST_DEBUG_FUNCPTR (gst_cdda_base_src_is_seekable);
-
- pushsrc_class->create = GST_DEBUG_FUNCPTR (gst_cdda_base_src_create);
-}
-
-static void
-gst_cdda_base_src_init (GstCddaBaseSrc * src, GstCddaBaseSrcClass * klass)
-{
- gst_pad_set_query_type_function (GST_BASE_SRC_PAD (src),
- GST_DEBUG_FUNCPTR (gst_cdda_base_src_get_query_types));
-
- /* we're not live and we operate in time */
- gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
- gst_base_src_set_live (GST_BASE_SRC (src), FALSE);
-
- src->device = NULL;
- src->mode = GST_CDDA_BASE_SRC_MODE_NORMAL;
- src->uri_track = -1;
-}
-
-static void
-gst_cdda_base_src_finalize (GObject * obj)
-{
- GstCddaBaseSrc *cddasrc = GST_CDDA_BASE_SRC (obj);
-
- g_free (cddasrc->uri);
- g_free (cddasrc->device);
-
- if (cddasrc->index)
- gst_object_unref (cddasrc->index);
-
- G_OBJECT_CLASS (parent_class)->finalize (obj);
-}
-
-static void
-gst_cdda_base_src_set_device (GstCddaBaseSrc * src, const gchar * device)
-{
- if (src->device)
- g_free (src->device);
- src->device = NULL;
-
- if (!device)
- return;
-
- /* skip multiple slashes */
- while (*device == '/' && *(device + 1) == '/')
- device++;
-
-#ifdef __sun
- /*
- * On Solaris, /dev/rdsk is used for accessing the CD device, but some
- * applications pass in /dev/dsk, so correct.
- */
- if (strncmp (device, "/dev/dsk", 8) == 0) {
- gchar *rdsk_value;
- rdsk_value = g_strdup_printf ("/dev/rdsk%s", device + 8);
- src->device = g_strdup (rdsk_value);
- g_free (rdsk_value);
- } else {
-#endif
- src->device = g_strdup (device);
-#ifdef __sun
- }
-#endif
-}
-
-static void
-gst_cdda_base_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstCddaBaseSrc *src = GST_CDDA_BASE_SRC (object);
-
- GST_OBJECT_LOCK (src);
-
- switch (prop_id) {
- case ARG_MODE:{
- src->mode = g_value_get_enum (value);
- break;
- }
- case ARG_DEVICE:{
- const gchar *dev = g_value_get_string (value);
-
- gst_cdda_base_src_set_device (src, dev);
- break;
- }
- case ARG_TRACK:{
- guint track = g_value_get_uint (value);
-
- if (src->num_tracks > 0 && track > src->num_tracks) {
- g_warning ("Invalid track %u", track);
- } else if (track > 0 && src->tracks != NULL) {
- src->cur_sector = src->tracks[track - 1].start;
- src->uri_track = track;
- } else {
- src->uri_track = track; /* seek will be done in start() */
- }
- break;
- }
- case ARG_TOC_OFFSET:{
- src->toc_offset = g_value_get_int (value);
- break;
- }
- case ARG_TOC_BIAS:{
- src->toc_bias = g_value_get_boolean (value);
- break;
- }
- default:{
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
- }
-
- GST_OBJECT_UNLOCK (src);
-}
-
-static void
-gst_cdda_base_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstCddaBaseSrcClass *klass = GST_CDDA_BASE_SRC_GET_CLASS (object);
- GstCddaBaseSrc *src = GST_CDDA_BASE_SRC (object);
-
- GST_OBJECT_LOCK (src);
-
- switch (prop_id) {
- case ARG_MODE:
- g_value_set_enum (value, src->mode);
- break;
- case ARG_DEVICE:{
- if (src->device == NULL && klass->get_default_device != NULL) {
- gchar *d = klass->get_default_device (src);
-
- if (d != NULL) {
- g_value_set_string (value, DEFAULT_DEVICE);
- g_free (d);
- break;
- }
- }
- if (src->device == NULL)
- g_value_set_string (value, DEFAULT_DEVICE);
- else
- g_value_set_string (value, src->device);
- break;
- }
- case ARG_TRACK:{
- if (src->num_tracks <= 0 && src->uri_track > 0) {
- g_value_set_uint (value, src->uri_track);
- } else {
- g_value_set_uint (value, src->cur_track + 1);
- }
- break;
- }
- case ARG_TOC_OFFSET:
- g_value_set_int (value, src->toc_offset);
- break;
- case ARG_TOC_BIAS:
- g_value_set_boolean (value, src->toc_bias);
- break;
- default:{
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
- }
-
- GST_OBJECT_UNLOCK (src);
-}
-
-static gint
-gst_cdda_base_src_get_track_from_sector (GstCddaBaseSrc * src, gint sector)
-{
- gint i;
-
- for (i = 0; i < src->num_tracks; ++i) {
- if (sector >= src->tracks[i].start && sector <= src->tracks[i].end)
- return i;
- }
- return -1;
-}
-
-static const GstQueryType *
-gst_cdda_base_src_get_query_types (GstPad * pad)
-{
- static const GstQueryType src_query_types[] = {
- GST_QUERY_DURATION,
- GST_QUERY_POSITION,
- GST_QUERY_CONVERT,
- 0
- };
-
- return src_query_types;
-}
-
-static gboolean
-gst_cdda_base_src_convert (GstCddaBaseSrc * src, GstFormat src_format,
- gint64 src_val, GstFormat dest_format, gint64 * dest_val)
-{
- gboolean started;
-
- GST_LOG_OBJECT (src, "converting value %" G_GINT64_FORMAT " from %s into %s",
- src_val, gst_format_get_name (src_format),
- gst_format_get_name (dest_format));
-
- if (src_format == dest_format) {
- *dest_val = src_val;
- return TRUE;
- }
-
- started = GST_OBJECT_FLAG_IS_SET (GST_BASE_SRC (src), GST_BASE_SRC_STARTED);
-
- if (src_format == track_format) {
- if (!started)
- goto not_started;
- if (src_val < 0 || src_val >= src->num_tracks) {
- GST_DEBUG_OBJECT (src, "track number %d out of bounds", (gint) src_val);
- goto wrong_value;
- }
- src_format = GST_FORMAT_DEFAULT;
- src_val = src->tracks[src_val].start * SAMPLES_PER_SECTOR;
- } else if (src_format == sector_format) {
- src_format = GST_FORMAT_DEFAULT;
- src_val = src_val * SAMPLES_PER_SECTOR;
- }
-
- if (src_format == dest_format) {
- *dest_val = src_val;
- goto done;
- }
-
- switch (src_format) {
- case GST_FORMAT_BYTES:
- /* convert to samples (4 bytes per sample) */
- src_val = src_val >> 2;
- /* fallthrough */
- case GST_FORMAT_DEFAULT:{
- switch (dest_format) {
- case GST_FORMAT_BYTES:{
- if (src_val < 0) {
- GST_DEBUG_OBJECT (src, "sample source value negative");
- goto wrong_value;
- }
- *dest_val = src_val << 2; /* 4 bytes per sample */
- break;
- }
- case GST_FORMAT_TIME:{
- *dest_val = gst_util_uint64_scale_int (src_val, GST_SECOND, 44100);
- break;
- }
- default:{
- gint64 sector = src_val / SAMPLES_PER_SECTOR;
-
- if (dest_format == sector_format) {
- *dest_val = sector;
- } else if (dest_format == track_format) {
- if (!started)
- goto not_started;
- *dest_val = gst_cdda_base_src_get_track_from_sector (src, sector);
- } else {
- goto unknown_format;
- }
- break;
- }
- }
- break;
- }
- case GST_FORMAT_TIME:{
- gint64 sample_offset;
-
- if (src_val == GST_CLOCK_TIME_NONE) {
- GST_DEBUG_OBJECT (src, "source time value invalid");
- goto wrong_value;
- }
-
- sample_offset = gst_util_uint64_scale_int (src_val, 44100, GST_SECOND);
- switch (dest_format) {
- case GST_FORMAT_BYTES:{
- *dest_val = sample_offset << 2; /* 4 bytes per sample */
- break;
- }
- case GST_FORMAT_DEFAULT:{
- *dest_val = sample_offset;
- break;
- }
- default:{
- gint64 sector = sample_offset / SAMPLES_PER_SECTOR;
-
- if (dest_format == sector_format) {
- *dest_val = sector;
- } else if (dest_format == track_format) {
- if (!started)
- goto not_started;
- *dest_val = gst_cdda_base_src_get_track_from_sector (src, sector);
- } else {
- goto unknown_format;
- }
- break;
- }
- }
- break;
- }
- default:{
- goto unknown_format;
- }
- }
-
-done:
- {
- GST_LOG_OBJECT (src, "returning %" G_GINT64_FORMAT, *dest_val);
- return TRUE;
- }
-
-unknown_format:
- {
- GST_DEBUG_OBJECT (src, "conversion failed: %s", "unsupported format");
- return FALSE;
- }
-
-wrong_value:
- {
- GST_DEBUG_OBJECT (src, "conversion failed: %s",
- "source value not within allowed range");
- return FALSE;
- }
-
-not_started:
- {
- GST_DEBUG_OBJECT (src, "conversion failed: %s",
- "cannot do this conversion, device not open");
- return FALSE;
- }
-}
-
-static gboolean
-gst_cdda_base_src_query (GstBaseSrc * basesrc, GstQuery * query)
-{
- GstCddaBaseSrc *src = GST_CDDA_BASE_SRC (basesrc);
- gboolean started;
-
- started = GST_OBJECT_FLAG_IS_SET (basesrc, GST_BASE_SRC_STARTED);
-
- GST_LOG_OBJECT (src, "handling %s query",
- gst_query_type_get_name (GST_QUERY_TYPE (query)));
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_DURATION:{
- GstFormat dest_format;
- gint64 dest_val;
- guint sectors;
-
- gst_query_parse_duration (query, &dest_format, NULL);
-
- if (!started)
- return FALSE;
-
- g_assert (src->tracks != NULL);
-
- if (dest_format == track_format) {
- GST_LOG_OBJECT (src, "duration: %d tracks", src->num_tracks);
- gst_query_set_duration (query, track_format, src->num_tracks);
- return TRUE;
- }
-
- if (src->cur_track < 0 || src->cur_track >= src->num_tracks)
- return FALSE;
-
- if (src->mode == GST_CDDA_BASE_SRC_MODE_NORMAL) {
- sectors = src->tracks[src->cur_track].end -
- src->tracks[src->cur_track].start + 1;
- } else {
- sectors = src->tracks[src->num_tracks - 1].end -
- src->tracks[0].start + 1;
- }
-
- /* ... and convert into final format */
- if (!gst_cdda_base_src_convert (src, sector_format, sectors,
- dest_format, &dest_val)) {
- return FALSE;
- }
-
- gst_query_set_duration (query, dest_format, dest_val);
-
- GST_LOG ("duration: %u sectors, %" G_GINT64_FORMAT " in format %s",
- sectors, dest_val, gst_format_get_name (dest_format));
- break;
- }
- case GST_QUERY_POSITION:{
- GstFormat dest_format;
- gint64 pos_sector;
- gint64 dest_val;
-
- gst_query_parse_position (query, &dest_format, NULL);
-
- if (!started)
- return FALSE;
-
- g_assert (src->tracks != NULL);
-
- if (dest_format == track_format) {
- GST_LOG_OBJECT (src, "position: track %d", src->cur_track);
- gst_query_set_position (query, track_format, src->cur_track);
- return TRUE;
- }
-
- if (src->cur_track < 0 || src->cur_track >= src->num_tracks)
- return FALSE;
-
- if (src->mode == GST_CDDA_BASE_SRC_MODE_NORMAL) {
- pos_sector = src->cur_sector - src->tracks[src->cur_track].start;
- } else {
- pos_sector = src->cur_sector - src->tracks[0].start;
- }
-
- if (!gst_cdda_base_src_convert (src, sector_format, pos_sector,
- dest_format, &dest_val)) {
- return FALSE;
- }
-
- gst_query_set_position (query, dest_format, dest_val);
-
- GST_LOG ("position: sector %u, %" G_GINT64_FORMAT " in format %s",
- (guint) pos_sector, dest_val, gst_format_get_name (dest_format));
- break;
- }
- case GST_QUERY_CONVERT:{
- GstFormat src_format, dest_format;
- gint64 src_val, dest_val;
-
- gst_query_parse_convert (query, &src_format, &src_val, &dest_format,
- NULL);
-
- if (!gst_cdda_base_src_convert (src, src_format, src_val, dest_format,
- &dest_val)) {
- return FALSE;
- }
-
- gst_query_set_convert (query, src_format, src_val, dest_format, dest_val);
- break;
- }
- default:{
- GST_DEBUG_OBJECT (src, "unhandled query, chaining up to parent class");
- return GST_BASE_SRC_CLASS (parent_class)->query (basesrc, query);
- }
- }
-
- return TRUE;
-}
-
-static gboolean
-gst_cdda_base_src_is_seekable (GstBaseSrc * basesrc)
-{
- return TRUE;
-}
-
-static gboolean
-gst_cdda_base_src_do_seek (GstBaseSrc * basesrc, GstSegment * segment)
-{
- GstCddaBaseSrc *src = GST_CDDA_BASE_SRC (basesrc);
- gint64 seek_sector;
-
- GST_DEBUG_OBJECT (src, "segment %" GST_TIME_FORMAT "-%" GST_TIME_FORMAT,
- GST_TIME_ARGS (segment->start), GST_TIME_ARGS (segment->stop));
-
- if (!gst_cdda_base_src_convert (src, GST_FORMAT_TIME, segment->start,
- sector_format, &seek_sector)) {
- GST_WARNING_OBJECT (src, "conversion failed");
- return FALSE;
- }
-
- /* we should only really be called when open */
- g_assert (src->cur_track >= 0 && src->cur_track < src->num_tracks);
-
- switch (src->mode) {
- case GST_CDDA_BASE_SRC_MODE_NORMAL:
- seek_sector += src->tracks[src->cur_track].start;
- break;
- case GST_CDDA_BASE_SRC_MODE_CONTINUOUS:
- seek_sector += src->tracks[0].start;
- break;
- default:
- g_return_val_if_reached (FALSE);
- }
-
- src->cur_sector = (gint) seek_sector;
-
- GST_DEBUG_OBJECT (src, "seek'd to sector %d", src->cur_sector);
-
- return TRUE;
-}
-
-static gboolean
-gst_cdda_base_src_handle_track_seek (GstCddaBaseSrc * src, gdouble rate,
- GstSeekFlags flags, GstSeekType start_type, gint64 start,
- GstSeekType stop_type, gint64 stop)
-{
- GstBaseSrc *basesrc = GST_BASE_SRC (src);
- GstEvent *event;
-
- if ((flags & GST_SEEK_FLAG_SEGMENT) == GST_SEEK_FLAG_SEGMENT) {
- gint64 start_time = -1;
- gint64 stop_time = -1;
-
- if (src->mode != GST_CDDA_BASE_SRC_MODE_CONTINUOUS) {
- GST_DEBUG_OBJECT (src, "segment seek in track format is only "
- "supported in CONTINUOUS mode, not in mode %d", src->mode);
- return FALSE;
- }
-
- switch (start_type) {
- case GST_SEEK_TYPE_SET:
- if (!gst_cdda_base_src_convert (src, track_format, start,
- GST_FORMAT_TIME, &start_time)) {
- GST_DEBUG_OBJECT (src, "cannot convert track %d to time",
- (gint) start);
- return FALSE;
- }
- break;
- case GST_SEEK_TYPE_END:
- if (!gst_cdda_base_src_convert (src, track_format,
- src->num_tracks - start - 1, GST_FORMAT_TIME, &start_time)) {
- GST_DEBUG_OBJECT (src, "cannot convert track %d to time",
- (gint) start);
- return FALSE;
- }
- start_type = GST_SEEK_TYPE_SET;
- break;
- case GST_SEEK_TYPE_NONE:
- start_time = -1;
- break;
- default:
- g_return_val_if_reached (FALSE);
- }
-
- switch (stop_type) {
- case GST_SEEK_TYPE_SET:
- if (!gst_cdda_base_src_convert (src, track_format, stop,
- GST_FORMAT_TIME, &stop_time)) {
- GST_DEBUG_OBJECT (src, "cannot convert track %d to time",
- (gint) stop);
- return FALSE;
- }
- break;
- case GST_SEEK_TYPE_END:
- if (!gst_cdda_base_src_convert (src, track_format,
- src->num_tracks - stop - 1, GST_FORMAT_TIME, &stop_time)) {
- GST_DEBUG_OBJECT (src, "cannot convert track %d to time",
- (gint) stop);
- return FALSE;
- }
- stop_type = GST_SEEK_TYPE_SET;
- break;
- case GST_SEEK_TYPE_NONE:
- stop_time = -1;
- break;
- default:
- g_return_val_if_reached (FALSE);
- }
-
- GST_LOG_OBJECT (src, "seek segment %" GST_TIME_FORMAT "-%" GST_TIME_FORMAT,
- GST_TIME_ARGS (start_time), GST_TIME_ARGS (stop_time));
-
- /* send fake segment seek event in TIME format to
- * base class, which will hopefully handle the rest */
-
- event = gst_event_new_seek (rate, GST_FORMAT_TIME, flags, start_type,
- start_time, stop_type, stop_time);
-
- return GST_BASE_SRC_CLASS (parent_class)->event (basesrc, event);
- }
-
- /* not a segment seek */
-
- if (start_type == GST_SEEK_TYPE_NONE) {
- GST_LOG_OBJECT (src, "start seek type is NONE, nothing to do");
- return TRUE;
- }
-
- if (stop_type != GST_SEEK_TYPE_NONE) {
- GST_WARNING_OBJECT (src, "ignoring stop seek type (expected NONE)");
- }
-
- if (start < 0 || start >= src->num_tracks) {
- GST_DEBUG_OBJECT (src, "invalid track %" G_GINT64_FORMAT, start);
- return FALSE;
- }
-
- GST_DEBUG_OBJECT (src, "seeking to track %" G_GINT64_FORMAT, start + 1);
-
- src->cur_sector = src->tracks[start].start;
- GST_DEBUG_OBJECT (src, "starting at sector %d", src->cur_sector);
-
- if (src->cur_track != start) {
- src->cur_track = (gint) start;
- src->uri_track = -1;
- src->prev_track = -1;
-
- gst_cdda_base_src_update_duration (src);
- } else {
- GST_DEBUG_OBJECT (src, "is current track, just seeking back to start");
- }
-
- /* send fake segment seek event in TIME format to
- * base class (so we get a newsegment etc.) */
- event = gst_event_new_seek (rate, GST_FORMAT_TIME, flags,
- GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE, -1);
-
- return GST_BASE_SRC_CLASS (parent_class)->event (basesrc, event);
-}
-
-static gboolean
-gst_cdda_base_src_handle_event (GstBaseSrc * basesrc, GstEvent * event)
-{
- GstCddaBaseSrc *src = GST_CDDA_BASE_SRC (basesrc);
- gboolean ret = FALSE;
-
- GST_LOG_OBJECT (src, "handling %s event", GST_EVENT_TYPE_NAME (event));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:{
- GstSeekType start_type, stop_type;
- GstSeekFlags flags;
- GstFormat format;
- gdouble rate;
- gint64 start, stop;
-
- if (!GST_OBJECT_FLAG_IS_SET (basesrc, GST_BASE_SRC_STARTED)) {
- GST_DEBUG_OBJECT (src, "seek failed: device not open");
- break;
- }
-
- gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start,
- &stop_type, &stop);
-
- if (format == sector_format) {
- GST_DEBUG_OBJECT (src, "seek in sector format not supported");
- break;
- }
-
- if (format == track_format) {
- ret = gst_cdda_base_src_handle_track_seek (src, rate, flags,
- start_type, start, stop_type, stop);
- } else {
- GST_LOG_OBJECT (src, "let base class handle seek in %s format",
- gst_format_get_name (format));
- event = gst_event_ref (event);
- ret = GST_BASE_SRC_CLASS (parent_class)->event (basesrc, event);
- }
- break;
- }
- default:{
- GST_LOG_OBJECT (src, "let base class handle event");
- ret = GST_BASE_SRC_CLASS (parent_class)->event (basesrc, event);
- break;
- }
- }
-
- return ret;
-}
-
-static GstURIType
-gst_cdda_base_src_uri_get_type (void)
-{
- return GST_URI_SRC;
-}
-
-static gchar **
-gst_cdda_base_src_uri_get_protocols (void)
-{
- static gchar *protocols[] = { "cdda", NULL };
-
- return protocols;
-}
-
-static const gchar *
-gst_cdda_base_src_uri_get_uri (GstURIHandler * handler)
-{
- GstCddaBaseSrc *src = GST_CDDA_BASE_SRC (handler);
-
- GST_OBJECT_LOCK (src);
-
- g_free (src->uri);
-
- if (GST_OBJECT_FLAG_IS_SET (GST_BASE_SRC (src), GST_BASE_SRC_STARTED)) {
- src->uri =
- g_strdup_printf ("cdda://%s#%d", src->device,
- (src->uri_track > 0) ? src->uri_track : 1);
- } else {
- src->uri = g_strdup ("cdda://1");
- }
-
- GST_OBJECT_UNLOCK (src);
-
- return src->uri;
-}
-
-/* Note: gst_element_make_from_uri() might call us with just 'cdda://' as
- * URI and expects us to return TRUE then (and this might be in any state) */
-
-/* We accept URIs of the format cdda://(device#track)|(track) */
-
-static gboolean
-gst_cdda_base_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
-{
- GstCddaBaseSrc *src = GST_CDDA_BASE_SRC (handler);
- gchar *protocol;
- const gchar *location;
- gchar *track_number;
-
- GST_OBJECT_LOCK (src);
-
- protocol = gst_uri_get_protocol (uri);
- if (!protocol || g_ascii_strcasecmp (protocol, "cdda") != 0) {
- g_free (protocol);
- goto failed;
- }
- g_free (protocol);
-
- location = uri + 7;
- track_number = g_strrstr (location, "#");
- src->uri_track = 0;
- /* FIXME 0.11: ignore URI fragments that look like device paths for
- * the benefit of rhythmbox and possibly other applications.
- */
- if (track_number && track_number[1] != '/') {
- gchar *device, *nuri = g_strdup (uri);
-
- track_number = nuri + (track_number - uri);
- *track_number = '\0';
- device = gst_uri_get_location (nuri);
- gst_cdda_base_src_set_device (src, device);
- g_free (device);
- src->uri_track = strtol (track_number + 1, NULL, 10);
- g_free (nuri);
- } else {
- if (*location == '\0')
- src->uri_track = 1;
- else
- src->uri_track = strtol (location, NULL, 10);
- }
-
- if (src->uri_track < 1)
- goto failed;
-
- if (src->num_tracks > 0
- && src->tracks != NULL && src->uri_track > src->num_tracks)
- goto failed;
-
- if (src->uri_track > 0 && src->tracks != NULL) {
- GST_OBJECT_UNLOCK (src);
-
- gst_pad_send_event (GST_BASE_SRC_PAD (src),
- gst_event_new_seek (1.0, track_format, GST_SEEK_FLAG_FLUSH,
- GST_SEEK_TYPE_SET, src->uri_track - 1, GST_SEEK_TYPE_NONE, -1));
- } else {
- /* seek will be done in start() */
- GST_OBJECT_UNLOCK (src);
- }
-
- GST_LOG_OBJECT (handler, "successfully handled uri '%s'", uri);
-
- return TRUE;
-
-failed:
- {
- GST_OBJECT_UNLOCK (src);
- GST_DEBUG_OBJECT (src, "cannot handle URI '%s'", uri);
- return FALSE;
- }
-}
-
-static void
-gst_cdda_base_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
-{
- GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
-
- iface->get_type = gst_cdda_base_src_uri_get_type;
- iface->get_uri = gst_cdda_base_src_uri_get_uri;
- iface->set_uri = gst_cdda_base_src_uri_set_uri;
- iface->get_protocols = gst_cdda_base_src_uri_get_protocols;
-}
-
-static void
-gst_cdda_base_src_setup_interfaces (GType type)
-{
- static const GInterfaceInfo urihandler_info = {
- gst_cdda_base_src_uri_handler_init,
- NULL,
- NULL,
- };
-
- g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &urihandler_info);
-}
-
-/**
- * gst_cdda_base_src_add_track:
- * @src: a #GstCddaBaseSrc
- * @track: address of #GstCddaBaseSrcTrack to add
- *
- * CDDA sources use this function from their start vfunc to announce the
- * available data and audio tracks to the base source class. The caller
- * should allocate @track on the stack, the base source will do a shallow
- * copy of the structure (and take ownership of the taglist if there is one).
- *
- * Returns: FALSE on error, otherwise TRUE.
- */
-
-gboolean
-gst_cdda_base_src_add_track (GstCddaBaseSrc * src, GstCddaBaseSrcTrack * track)
-{
- g_return_val_if_fail (GST_IS_CDDA_BASE_SRC (src), FALSE);
- g_return_val_if_fail (track != NULL, FALSE);
- g_return_val_if_fail (track->num > 0, FALSE);
-
- GST_DEBUG_OBJECT (src, "adding track %2u (%2u) [%6u-%6u] [%5s], tags: %"
- GST_PTR_FORMAT, src->num_tracks + 1, track->num, track->start,
- track->end, (track->is_audio) ? "AUDIO" : "DATA ", track->tags);
-
- if (src->num_tracks > 0) {
- guint end_of_previous_track = src->tracks[src->num_tracks - 1].end;
-
- if (track->start <= end_of_previous_track) {
- GST_WARNING ("track %2u overlaps with previous tracks", track->num);
- return FALSE;
- }
- }
-
- GST_OBJECT_LOCK (src);
-
- ++src->num_tracks;
- src->tracks = g_renew (GstCddaBaseSrcTrack, src->tracks, src->num_tracks);
- src->tracks[src->num_tracks - 1] = *track;
-
- GST_OBJECT_UNLOCK (src);
-
- return TRUE;
-}
-
-static void
-gst_cdda_base_src_update_duration (GstCddaBaseSrc * src)
-{
- GstBaseSrc *basesrc;
- GstFormat format;
- gint64 duration;
-
- basesrc = GST_BASE_SRC (src);
-
- format = GST_FORMAT_TIME;
- if (gst_pad_query_duration (GST_BASE_SRC_PAD (src), &format, &duration)) {
- gst_segment_set_duration (&basesrc->segment, GST_FORMAT_TIME, duration);
- } else {
- gst_segment_set_duration (&basesrc->segment, GST_FORMAT_TIME, -1);
- duration = GST_CLOCK_TIME_NONE;
- }
-
- gst_element_post_message (GST_ELEMENT (src),
- gst_message_new_duration (GST_OBJECT (src), GST_FORMAT_TIME, -1));
-
- GST_LOG_OBJECT (src, "duration updated to %" GST_TIME_FORMAT,
- GST_TIME_ARGS (duration));
-}
-
-#define CD_MSF_OFFSET 150
-
-/* the cddb hash function */
-static guint
-cddb_sum (gint n)
-{
- guint ret;
-
- ret = 0;
- while (n > 0) {
- ret += (n % 10);
- n /= 10;
- }
- return ret;
-}
-
-static void
-gst_cddabasesrc_calculate_musicbrainz_discid (GstCddaBaseSrc * src)
-{
- GString *s;
- GChecksum *sha;
- guchar digest[20];
- gchar *ptr;
- gchar tmp[9];
- gulong i;
- guint leadout_sector;
- gsize digest_len;
-
- s = g_string_new (NULL);
-
- leadout_sector = src->tracks[src->num_tracks - 1].end + 1 + CD_MSF_OFFSET;
-
- /* generate SHA digest */
- sha = g_checksum_new (G_CHECKSUM_SHA1);
- g_snprintf (tmp, sizeof (tmp), "%02X", src->tracks[0].num);
- g_string_append_printf (s, "%02X", src->tracks[0].num);
- g_checksum_update (sha, (guchar *) tmp, 2);
-
- g_snprintf (tmp, sizeof (tmp), "%02X", src->tracks[src->num_tracks - 1].num);
- g_string_append_printf (s, " %02X", src->tracks[src->num_tracks - 1].num);
- g_checksum_update (sha, (guchar *) tmp, 2);
-
- g_snprintf (tmp, sizeof (tmp), "%08X", leadout_sector);
- g_string_append_printf (s, " %08X", leadout_sector);
- g_checksum_update (sha, (guchar *) tmp, 8);
-
- for (i = 0; i < 99; i++) {
- if (i < src->num_tracks) {
- guint frame_offset = src->tracks[i].start + CD_MSF_OFFSET;
-
- g_snprintf (tmp, sizeof (tmp), "%08X", frame_offset);
- g_string_append_printf (s, " %08X", frame_offset);
- g_checksum_update (sha, (guchar *) tmp, 8);
- } else {
- g_checksum_update (sha, (guchar *) "00000000", 8);
- }
- }
- digest_len = 20;
- g_checksum_get_digest (sha, (guint8 *) & digest, &digest_len);
-
- /* re-encode to base64 */
- ptr = g_base64_encode (digest, digest_len);
- g_checksum_free (sha);
- i = strlen (ptr);
-
- g_assert (i < sizeof (src->mb_discid) + 1);
- memcpy (src->mb_discid, ptr, i);
- src->mb_discid[i] = '\0';
- free (ptr);
-
- /* Replace '/', '+' and '=' by '_', '.' and '-' as specified on
- * http://musicbrainz.org/doc/DiscIDCalculation
- */
- for (ptr = src->mb_discid; *ptr != '\0'; ptr++) {
- if (*ptr == '/')
- *ptr = '_';
- else if (*ptr == '+')
- *ptr = '.';
- else if (*ptr == '=')
- *ptr = '-';
- }
-
- GST_DEBUG_OBJECT (src, "musicbrainz-discid = %s", src->mb_discid);
- GST_DEBUG_OBJECT (src, "musicbrainz-discid-full = %s", s->str);
-
- gst_tag_list_add (src->tags, GST_TAG_MERGE_REPLACE,
- GST_TAG_CDDA_MUSICBRAINZ_DISCID, src->mb_discid,
- GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL, s->str, NULL);
-
- g_string_free (s, TRUE);
-}
-
-static void
-lba_to_msf (guint sector, guint * p_m, guint * p_s, guint * p_f, guint * p_secs)
-{
- guint m, s, f;
-
- m = sector / SECTORS_PER_MINUTE;
- sector = sector % SECTORS_PER_MINUTE;
- s = sector / SECTORS_PER_SECOND;
- f = sector % SECTORS_PER_SECOND;
-
- if (p_m)
- *p_m = m;
- if (p_s)
- *p_s = s;
- if (p_f)
- *p_f = f;
- if (p_secs)
- *p_secs = s + (m * 60);
-}
-
-static void
-gst_cdda_base_src_calculate_cddb_id (GstCddaBaseSrc * src)
-{
- GString *s;
- guint first_sector = 0, last_sector = 0;
- guint start_secs, end_secs, secs, len_secs;
- guint total_secs, num_audio_tracks;
- guint id, t, i;
-
- id = 0;
- total_secs = 0;
- num_audio_tracks = 0;
-
- /* FIXME: do we use offsets and duration of ALL tracks (data + audio)
- * for the CDDB ID calculation, or only audio tracks? */
- for (i = 0; i < src->num_tracks; ++i) {
- if (1) { /* src->tracks[i].is_audio) { */
- if (num_audio_tracks == 0) {
- first_sector = src->tracks[i].start + CD_MSF_OFFSET;
- }
- last_sector = src->tracks[i].end + CD_MSF_OFFSET + 1;
- ++num_audio_tracks;
-
- lba_to_msf (src->tracks[i].start + CD_MSF_OFFSET, NULL, NULL, NULL,
- &secs);
-
- len_secs = (src->tracks[i].end - src->tracks[i].start + 1) / 75;
-
- GST_DEBUG_OBJECT (src, "track %02u: lsn %6u (%02u:%02u), "
- "length: %u seconds (%02u:%02u)",
- num_audio_tracks, src->tracks[i].start + CD_MSF_OFFSET,
- secs / 60, secs % 60, len_secs, len_secs / 60, len_secs % 60);
-
- id += cddb_sum (secs);
- total_secs += len_secs;
- }
- }
-
- /* first_sector = src->tracks[0].start + CD_MSF_OFFSET; */
- lba_to_msf (first_sector, NULL, NULL, NULL, &start_secs);
-
- /* last_sector = src->tracks[src->num_tracks-1].end + CD_MSF_OFFSET; */
- lba_to_msf (last_sector, NULL, NULL, NULL, &end_secs);
-
- GST_DEBUG_OBJECT (src, "first_sector = %u = %u secs (%02u:%02u)",
- first_sector, start_secs, start_secs / 60, start_secs % 60);
- GST_DEBUG_OBJECT (src, "last_sector = %u = %u secs (%02u:%02u)",
- last_sector, end_secs, end_secs / 60, end_secs % 60);
-
- t = end_secs - start_secs;
-
- GST_DEBUG_OBJECT (src, "total length = %u secs (%02u:%02u), added title "
- "lengths = %u seconds (%02u:%02u)", t, t / 60, t % 60, total_secs,
- total_secs / 60, total_secs % 60);
-
- src->discid = ((id % 0xff) << 24 | t << 8 | num_audio_tracks);
-
- s = g_string_new (NULL);
- g_string_append_printf (s, "%08x", src->discid);
-
- gst_tag_list_add (src->tags, GST_TAG_MERGE_REPLACE,
- GST_TAG_CDDA_CDDB_DISCID, s->str, NULL);
-
- g_string_append_printf (s, " %u", src->num_tracks);
- for (i = 0; i < src->num_tracks; ++i) {
- g_string_append_printf (s, " %u", src->tracks[i].start + CD_MSF_OFFSET);
- }
- g_string_append_printf (s, " %u", t);
-
- gst_tag_list_add (src->tags, GST_TAG_MERGE_REPLACE,
- GST_TAG_CDDA_CDDB_DISCID_FULL, s->str, NULL);
-
- GST_DEBUG_OBJECT (src, "cddb discid = %s", s->str);
-
- g_string_free (s, TRUE);
-}
-
-static void
-gst_cdda_base_src_add_tags (GstCddaBaseSrc * src)
-{
- gint i;
-
- /* fill in details for each track */
- for (i = 0; i < src->num_tracks; ++i) {
- gint64 duration;
- guint num_sectors;
-
- if (src->tracks[i].tags == NULL)
- src->tracks[i].tags = gst_tag_list_new ();
-
- num_sectors = src->tracks[i].end - src->tracks[i].start + 1;
- gst_cdda_base_src_convert (src, sector_format, num_sectors,
- GST_FORMAT_TIME, &duration);
-
- gst_tag_list_add (src->tracks[i].tags,
- GST_TAG_MERGE_REPLACE,
- GST_TAG_TRACK_NUMBER, i + 1,
- GST_TAG_TRACK_COUNT, src->num_tracks, GST_TAG_DURATION, duration, NULL);
- }
-
- /* now fill in per-album tags and include each track's tags
- * in the album tags, so that interested parties can retrieve
- * the relevant details for each track in one go */
-
- /* /////////////////////////////// FIXME should we rather insert num_tracks
- * tags by the name of 'track-tags' and have the caller use
- * gst_tag_list_get_value_index() rather than use tag names incl.
- * the track number ?? *////////////////////////////////////////
-
- gst_tag_list_add (src->tags, GST_TAG_MERGE_REPLACE,
- GST_TAG_TRACK_COUNT, src->num_tracks, NULL);
-#if 0
- for (i = 0; i < src->num_tracks; ++i) {
- gst_tag_list_add (src->tags, GST_TAG_MERGE_APPEND,
- GST_TAG_CDDA_TRACK_TAGS, src->tracks[i].tags, NULL);
- }
-#endif
-
- GST_DEBUG ("src->tags = %" GST_PTR_FORMAT, src->tags);
-}
-
-static void
-gst_cdda_base_src_add_index_associations (GstCddaBaseSrc * src)
-{
- gint i;
-
- for (i = 0; i < src->num_tracks; i++) {
- gint64 sector;
-
- sector = src->tracks[i].start;
- gst_index_add_association (src->index, src->index_id, GST_ASSOCIATION_FLAG_KEY_UNIT, track_format, i, /* here we count from 0 */
- sector_format, sector,
- GST_FORMAT_TIME,
- (gint64) (((CD_FRAMESIZE_RAW >> 2) * sector * GST_SECOND) / 44100),
- GST_FORMAT_BYTES, (gint64) (sector << 2), GST_FORMAT_DEFAULT,
- (gint64) ((CD_FRAMESIZE_RAW >> 2) * sector), NULL);
- }
-}
-
-static void
-gst_cdda_base_src_set_index (GstElement * element, GstIndex * index)
-{
- GstCddaBaseSrc *src = GST_CDDA_BASE_SRC (element);
- GstIndex *old;
-
- GST_OBJECT_LOCK (element);
- old = src->index;
- if (old == index) {
- GST_OBJECT_UNLOCK (element);
- return;
- }
- if (index)
- gst_object_ref (index);
- src->index = index;
- GST_OBJECT_UNLOCK (element);
- if (old)
- gst_object_unref (old);
-
- if (index) {
- gst_index_get_writer_id (index, GST_OBJECT (src), &src->index_id);
- gst_index_add_format (index, src->index_id, track_format);
- gst_index_add_format (index, src->index_id, sector_format);
- }
-}
-
-
-static GstIndex *
-gst_cdda_base_src_get_index (GstElement * element)
-{
- GstCddaBaseSrc *src = GST_CDDA_BASE_SRC (element);
- GstIndex *index;
-
- GST_OBJECT_LOCK (element);
- if ((index = src->index))
- gst_object_ref (index);
- GST_OBJECT_UNLOCK (element);
-
- return index;
-}
-
-static gint
-gst_cdda_base_src_track_sort_func (gconstpointer a, gconstpointer b,
- gpointer foo)
-{
- GstCddaBaseSrcTrack *track_a = ((GstCddaBaseSrcTrack *) a);
- GstCddaBaseSrcTrack *track_b = ((GstCddaBaseSrcTrack *) b);
-
- /* sort data tracks to the end, and audio tracks by track number */
- if (track_a->is_audio == track_b->is_audio)
- return (gint) track_a->num - (gint) track_b->num;
-
- if (track_a->is_audio) {
- return -1;
- } else {
- return 1;
- }
-}
-
-static gboolean
-gst_cdda_base_src_start (GstBaseSrc * basesrc)
-{
- GstCddaBaseSrcClass *klass = GST_CDDA_BASE_SRC_GET_CLASS (basesrc);
- GstCddaBaseSrc *src = GST_CDDA_BASE_SRC (basesrc);
- gboolean ret;
- gchar *device = NULL;
-
- src->discid = 0;
- src->mb_discid[0] = '\0';
-
- g_assert (klass->open != NULL);
-
- if (src->device != NULL) {
- device = g_strdup (src->device);
- } else if (klass->get_default_device != NULL) {
- device = klass->get_default_device (src);
- }
-
- if (device == NULL)
- device = g_strdup (DEFAULT_DEVICE);
-
- GST_LOG_OBJECT (basesrc, "opening device %s", device);
-
- src->tags = gst_tag_list_new ();
-
- ret = klass->open (src, device);
- g_free (device);
- device = NULL;
-
- if (!ret) {
- GST_DEBUG_OBJECT (basesrc, "failed to open device");
- /* subclass (should have) posted an error message with the details */
- gst_cdda_base_src_stop (basesrc);
- return FALSE;
- }
-
- if (src->num_tracks == 0 || src->tracks == NULL) {
- GST_DEBUG_OBJECT (src, "no tracks");
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
- (_("This CD has no audio tracks")), (NULL));
- gst_cdda_base_src_stop (basesrc);
- return FALSE;
- }
-
- /* need to calculate disc IDs before we ditch the data tracks */
- gst_cdda_base_src_calculate_cddb_id (src);
- gst_cddabasesrc_calculate_musicbrainz_discid (src);
-
-#if 0
- /* adjust sector offsets if necessary */
- if (src->toc_bias) {
- src->toc_offset -= src->tracks[0].start;
- }
- for (i = 0; i < src->num_tracks; ++i) {
- src->tracks[i].start += src->toc_offset;
- src->tracks[i].end += src->toc_offset;
- }
-#endif
-
- /* now that we calculated the various disc IDs,
- * sort the data tracks to end and ignore them */
- src->num_all_tracks = src->num_tracks;
-
- g_qsort_with_data (src->tracks, src->num_tracks,
- sizeof (GstCddaBaseSrcTrack), gst_cdda_base_src_track_sort_func, NULL);
-
- while (src->num_tracks > 0 && !src->tracks[src->num_tracks - 1].is_audio)
- --src->num_tracks;
-
- if (src->num_tracks == 0) {
- GST_DEBUG_OBJECT (src, "no audio tracks");
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
- (_("This CD has no audio tracks")), (NULL));
- gst_cdda_base_src_stop (basesrc);
- return FALSE;
- }
-
- gst_cdda_base_src_add_tags (src);
-
- if (src->index && GST_INDEX_IS_WRITABLE (src->index))
- gst_cdda_base_src_add_index_associations (src);
-
- src->cur_track = 0;
- src->prev_track = -1;
-
- if (src->uri_track > 0 && src->uri_track <= src->num_tracks) {
- GST_LOG_OBJECT (src, "seek to track %d", src->uri_track);
- src->cur_track = src->uri_track - 1;
- src->uri_track = -1;
- src->mode = GST_CDDA_BASE_SRC_MODE_NORMAL;
- }
-
- src->cur_sector = src->tracks[src->cur_track].start;
- GST_LOG_OBJECT (src, "starting at sector %d", src->cur_sector);
-
- gst_cdda_base_src_update_duration (src);
-
- return TRUE;
-}
-
-static void
-gst_cdda_base_src_clear_tracks (GstCddaBaseSrc * src)
-{
- if (src->tracks != NULL) {
- gint i;
-
- for (i = 0; i < src->num_all_tracks; ++i) {
- if (src->tracks[i].tags)
- gst_tag_list_free (src->tracks[i].tags);
- }
-
- g_free (src->tracks);
- src->tracks = NULL;
- }
- src->num_tracks = 0;
- src->num_all_tracks = 0;
-}
-
-static gboolean
-gst_cdda_base_src_stop (GstBaseSrc * basesrc)
-{
- GstCddaBaseSrcClass *klass = GST_CDDA_BASE_SRC_GET_CLASS (basesrc);
- GstCddaBaseSrc *src = GST_CDDA_BASE_SRC (basesrc);
-
- g_assert (klass->close != NULL);
-
- klass->close (src);
-
- gst_cdda_base_src_clear_tracks (src);
-
- if (src->tags) {
- gst_tag_list_free (src->tags);
- src->tags = NULL;
- }
-
- src->prev_track = -1;
- src->cur_track = -1;
-
- return TRUE;
-}
-
-
-static GstFlowReturn
-gst_cdda_base_src_create (GstPushSrc * pushsrc, GstBuffer ** buffer)
-{
- GstCddaBaseSrcClass *klass = GST_CDDA_BASE_SRC_GET_CLASS (pushsrc);
- GstCddaBaseSrc *src = GST_CDDA_BASE_SRC (pushsrc);
- GstBuffer *buf;
- GstFormat format;
- gboolean eos;
-
- GstClockTime position = GST_CLOCK_TIME_NONE;
- GstClockTime duration = GST_CLOCK_TIME_NONE;
- gint64 qry_position;
-
- g_assert (klass->read_sector != NULL);
-
- switch (src->mode) {
- case GST_CDDA_BASE_SRC_MODE_NORMAL:
- eos = (src->cur_sector > src->tracks[src->cur_track].end);
- break;
- case GST_CDDA_BASE_SRC_MODE_CONTINUOUS:
- eos = (src->cur_sector > src->tracks[src->num_tracks - 1].end);
- src->cur_track = gst_cdda_base_src_get_track_from_sector (src,
- src->cur_sector);
- break;
- default:
- g_return_val_if_reached (GST_FLOW_ERROR);
- }
-
- if (eos) {
- src->prev_track = -1;
- GST_DEBUG_OBJECT (src, "EOS at sector %d, cur_track=%d, mode=%d",
- src->cur_sector, src->cur_track, src->mode);
- /* base class will send EOS for us */
- return GST_FLOW_UNEXPECTED;
- }
-
- if (src->prev_track != src->cur_track) {
- GstTagList *tags;
-
- tags = gst_tag_list_merge (src->tags, src->tracks[src->cur_track].tags,
- GST_TAG_MERGE_REPLACE);
- GST_LOG_OBJECT (src, "announcing tags: %" GST_PTR_FORMAT, tags);
- gst_element_found_tags_for_pad (GST_ELEMENT (src),
- GST_BASE_SRC_PAD (src), tags);
- src->prev_track = src->cur_track;
-
- gst_cdda_base_src_update_duration (src);
-
- g_object_notify (G_OBJECT (src), "track");
- }
-
- GST_LOG_OBJECT (src, "asking for sector %u", src->cur_sector);
-
- buf = klass->read_sector (src, src->cur_sector);
-
- if (buf == NULL) {
- GST_WARNING_OBJECT (src, "failed to read sector %u", src->cur_sector);
- return GST_FLOW_ERROR;
- }
-
- if (GST_BUFFER_CAPS (buf) == NULL) {
- gst_buffer_set_caps (buf, GST_PAD_CAPS (GST_BASE_SRC_PAD (src)));
- }
-
- format = GST_FORMAT_TIME;
- if (gst_pad_query_position (GST_BASE_SRC_PAD (src), &format, &qry_position)) {
- gint64 next_ts = 0;
-
- position = (GstClockTime) qry_position;
-
- ++src->cur_sector;
- if (gst_pad_query_position (GST_BASE_SRC_PAD (src), &format, &next_ts)) {
- duration = (GstClockTime) (next_ts - qry_position);
- }
- --src->cur_sector;
- }
-
- /* fallback duration: 4 bytes per sample, 44100 samples per second */
- if (duration == GST_CLOCK_TIME_NONE) {
- duration = gst_util_uint64_scale_int (GST_BUFFER_SIZE (buf) >> 2,
- GST_SECOND, 44100);
- }
-
- GST_BUFFER_TIMESTAMP (buf) = position;
- GST_BUFFER_DURATION (buf) = duration;
-
- GST_LOG_OBJECT (src, "pushing sector %d with timestamp %" GST_TIME_FORMAT,
- src->cur_sector, GST_TIME_ARGS (position));
-
- ++src->cur_sector;
-
- *buffer = buf;
-
- return GST_FLOW_OK;
-}
diff --git a/gst-libs/gst/cdda/gstcddabasesrc.h b/gst-libs/gst/cdda/gstcddabasesrc.h
deleted file mode 100644
index b4c6f8e1..00000000
--- a/gst-libs/gst/cdda/gstcddabasesrc.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999 Erik Walthinsen <omega@cse.ogi.edu>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_CDDA_BASE_SRC_H__
-#define __GST_CDDA_BASE_SRC_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstpushsrc.h>
-
-/* must include this for backwards-compatibility so the
- * GST_TAG_CDDA_* defines are included. Remove in 0.11 */
-#include <gst/tag/tag.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_CDDA_BASE_SRC (gst_cdda_base_src_get_type())
-#define GST_CDDA_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_CDDA_BASE_SRC, GstCddaBaseSrc))
-#define GST_CDDA_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_CDDA_BASE_SRC, GstCddaBaseSrcClass))
-#define GST_IS_CDDA_BASE_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_CDDA_BASE_SRC))
-#define GST_IS_CDDA_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_CDDA_BASE_SRC))
-#define GST_CDDA_BASE_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CDDA_BASE_SRC, GstCddaBaseSrcClass))
-
-typedef struct _GstCddaBaseSrc GstCddaBaseSrc;
-typedef struct _GstCddaBaseSrcClass GstCddaBaseSrcClass;
-typedef struct _GstCddaBaseSrcTrack GstCddaBaseSrcTrack;
-
-/**
- * GstCddaBaseSrcMode:
- * @GST_CDDA_BASE_SRC_MODE_NORMAL : each single track is a stream
- * @GST_CDDA_BASE_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_CDDA_BASE_SRC_MODE_NORMAL, /* stream = one track */
- GST_CDDA_BASE_SRC_MODE_CONTINUOUS /* stream = whole disc */
-} GstCddaBaseSrcMode;
-
-#define GST_TYPE_CDDA_BASE_SRC_MODE (gst_cdda_base_src_mode_get_type ())
-
-/**
- * GstCddaBaseSrcTrack:
- * @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.
- */
-struct _GstCddaBaseSrcTrack {
- 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 _GstCddaBaseSrc {
- GstPushSrc pushsrc;
-
- /*< protected >*/ /* for use by sub-classes only */
- GstTagList *tags; /* tags that apply to all tracks */
-
- /*< private >*/
- GstCddaBaseSrcMode mode;
-
- gchar *device;
-
- guint num_tracks;
- guint num_all_tracks;
- GstCddaBaseSrcTrack *tracks;
-
- gint cur_track; /* current track (starting from 0) */
- gint prev_track; /* current track last time */
- gint cur_sector; /* current sector */
- gint seek_sector; /* -1 or sector to seek to */
-
- gint uri_track;
- gchar *uri;
-
- guint32 discid; /* cddb disc id (for unit test) */
- gchar mb_discid[32]; /* musicbrainz discid */
-
- GstIndex *index;
- gint index_id;
-
- gint toc_offset;
- gboolean toc_bias;
-
- /*< private >*/
- guint _gst_reserved1[GST_PADDING/2];
- gpointer _gst_reserved2[GST_PADDING/2];
-};
-
-struct _GstCddaBaseSrcClass {
- GstPushSrcClass pushsrc_class;
-
- /* open/close the CD device */
- gboolean (*open) (GstCddaBaseSrc *src, const gchar *device);
- void (*close) (GstCddaBaseSrc *src);
-
- /* read one sector (LBA) */
- GstBuffer * (*read_sector) (GstCddaBaseSrc *src, gint sector);
-
- /* return default device or NULL (optional) */
- gchar * (*get_default_device) (GstCddaBaseSrc *src);
-
- /* return NULL-terminated string array of CD devices, or NULL (optional) */
- gchar ** (*probe_devices) (GstCddaBaseSrc *src);
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_cdda_base_src_get_type (void);
-GType gst_cdda_base_src_mode_get_type (void);
-
-gboolean gst_cdda_base_src_add_track (GstCddaBaseSrc * src,
- GstCddaBaseSrcTrack * track);
-
-#if 0
-/*
- * GST_TAG_CDDA_TRACK_TAGS:
- *
- * Tag details for all available tracks
- * FiXME: find out which type we want for this!
- */
-#define GST_TAG_CDDA_TRACK_TAGS "track-tags"
-#endif
-
-G_END_DECLS
-
-#endif /* __GST_CDDA_BASE_SRC_H__ */
-
diff --git a/gst-libs/gst/fft/Makefile.am b/gst-libs/gst/fft/Makefile.am
deleted file mode 100644
index b45b813c..00000000
--- a/gst-libs/gst/fft/Makefile.am
+++ /dev/null
@@ -1,82 +0,0 @@
-lib_LTLIBRARIES = libgstfft-@GST_MAJORMINOR@.la
-
-libgstfft_@GST_MAJORMINOR@_includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/fft
-
-libgstfft_@GST_MAJORMINOR@_include_HEADERS = \
- gstfft.h \
- gstffts16.h \
- gstffts32.h \
- gstfftf32.h \
- gstfftf64.h
-
-noinst_HEADERS = \
- kiss_fft_s16.h \
- kiss_fft_s32.h \
- kiss_fft_f32.h \
- kiss_fft_f64.h \
- kiss_fftr_s16.h \
- kiss_fftr_s32.h \
- kiss_fftr_f32.h \
- kiss_fftr_f64.h \
- _kiss_fft_guts_s16.h \
- _kiss_fft_guts_s32.h \
- _kiss_fft_guts_f32.h \
- _kiss_fft_guts_f64.h
-
-libgstfft_@GST_MAJORMINOR@_la_SOURCES = \
- gstfft.c \
- gstffts16.c \
- gstffts32.c \
- gstfftf32.c \
- gstfftf64.c \
- kiss_fft_s16.c \
- kiss_fft_s32.c \
- kiss_fft_f32.c \
- kiss_fft_f64.c \
- kiss_fftr_s16.c \
- kiss_fftr_s32.c \
- kiss_fftr_f32.c \
- kiss_fftr_f64.c
-
-libgstfft_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS) $(LIBM)
-libgstfft_@GST_MAJORMINOR@_la_CFLAGS = $(GST_CFLAGS)
-libgstfft_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
-
-EXTRA_DIST = kiss_version
-
-if HAVE_INTROSPECTION
-BUILT_GIRSOURCES = GstFft-@GST_MAJORMINOR@.gir
-
-gir_headers=$(patsubst %,$(srcdir)/%, $(libgstfft_@GST_MAJORMINOR@_include_HEADERS))
-gir_sources=$(patsubst %,$(srcdir)/%, $(libgstfft_@GST_MAJORMINOR@_la_SOURCES))
-gir_cincludes=$(patsubst %,--c-include='gst/fft/%',$(libgstfft_@GST_MAJORMINOR@_include_HEADERS))
-
-GstFft-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstfft-@GST_MAJORMINOR@.la
- PKG_CONFIG_PATH="$(PKG_CONFIG_PATH):$(top_builddir)/pkgconfig" \
- $(INTROSPECTION_SCANNER) -v --namespace GstFft \
- --nsversion=@GST_MAJORMINOR@ \
- --strip-prefix=Gst \
- $(gir_cincludes) \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst \
- --library=gstfft-0.10 \
- --include=Gst-0.10 \
- --libtool="$(top_builddir)/libtool" \
- --pkg gstreamer-0.10 \
- --output $@ \
- $(gir_headers) \
- $(gir_sources)
-
-# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
-# install anything - we need to install inside our prefix.
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(BUILT_GIRSOURCES)
-
-typelibsdir = $(libdir)/girepository-1.0/
-
-typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
-
-%.typelib: %.gir $(INTROSPECTION_COMPILER)
- $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=$(builddir) --includedir=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
-CLEANFILES = $(BUILT_GIRSOURCES) $(typelibs_DATA)
-endif
diff --git a/gst-libs/gst/fft/_kiss_fft_guts_f32.h b/gst-libs/gst/fft/_kiss_fft_guts_f32.h
deleted file mode 100644
index 78d2e2e8..00000000
--- a/gst-libs/gst/fft/_kiss_fft_guts_f32.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-Copyright (c) 2003-2004, Mark Borgerding
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * 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.
- * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-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 OWNER 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.
-*/
-
-/* kiss_fft.h
- defines kiss_fft_f32_scalar as either short or a float type
- and defines
- typedef struct { kiss_fft_f32_scalar r; kiss_fft_f32_scalar i; }kiss_fft_f32_cpx; */
-#include "kiss_fft_f32.h"
-#include <limits.h>
-
-/* The 2*sizeof(size_t) alignment here is borrowed from
- * GNU libc, so it should be good most everywhere.
- * It is more conservative than is needed on some 64-bit
- * platforms, but ia64 does require a 16-byte alignment.
- * The SIMD extensions for x86 and ppc32 would want a
- * larger alignment than this, but we don't need to
- * do better than malloc.
- *
- * Borrowed from GLib's gobject/gtype.c
- */
-#define STRUCT_ALIGNMENT (2 * sizeof (size_t))
-#define ALIGN_STRUCT(offset) \
- ((offset + (STRUCT_ALIGNMENT - 1)) & -STRUCT_ALIGNMENT)
-
-#define MAXFACTORS 32
-/* e.g. an fft of length 128 has 4 factors
- as far as kissfft is concerned
- 4*4*4*2
- */
-
-struct kiss_fft_f32_state{
- int nfft;
- int inverse;
- int factors[2*MAXFACTORS];
- kiss_fft_f32_cpx twiddles[1];
-};
-
-/*
- Explanation of macros dealing with complex math:
-
- C_MUL(m,a,b) : m = a*b
- C_FIXDIV( c , div ) : if a fixed point impl., c /= div. noop otherwise
- C_SUB( res, a,b) : res = a - b
- C_SUBFROM( res , a) : res -= a
- C_ADDTO( res , a) : res += a
- * */
-
-#define S_MUL(a,b) ( (a)*(b) )
-#define C_MUL(m,a,b) \
- do{ (m).r = (a).r*(b).r - (a).i*(b).i;\
- (m).i = (a).r*(b).i + (a).i*(b).r; }while(0)
-#define C_FIXDIV(c,div) /* NOOP */
-#define C_MULBYSCALAR( c, s ) \
- do{ (c).r *= (s);\
- (c).i *= (s); }while(0)
-
-#ifndef CHECK_OVERFLOW_OP
-# define CHECK_OVERFLOW_OP(a,op,b) /* noop */
-#endif
-
-#define C_ADD( res, a,b)\
- do { \
- CHECK_OVERFLOW_OP((a).r,+,(b).r)\
- CHECK_OVERFLOW_OP((a).i,+,(b).i)\
- (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; \
- }while(0)
-#define C_SUB( res, a,b)\
- do { \
- CHECK_OVERFLOW_OP((a).r,-,(b).r)\
- CHECK_OVERFLOW_OP((a).i,-,(b).i)\
- (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; \
- }while(0)
-#define C_ADDTO( res , a)\
- do { \
- CHECK_OVERFLOW_OP((res).r,+,(a).r)\
- CHECK_OVERFLOW_OP((res).i,+,(a).i)\
- (res).r += (a).r; (res).i += (a).i;\
- }while(0)
-
-#define C_SUBFROM( res , a)\
- do {\
- CHECK_OVERFLOW_OP((res).r,-,(a).r)\
- CHECK_OVERFLOW_OP((res).i,-,(a).i)\
- (res).r -= (a).r; (res).i -= (a).i; \
- }while(0)
-
-
-#define KISS_FFT_F32_COS(phase) (kiss_fft_f32_scalar) cos(phase)
-#define KISS_FFT_F32_SIN(phase) (kiss_fft_f32_scalar) sin(phase)
-#define HALF_OF(x) ((x)*.5)
-
-#define kf_cexp(x,phase) \
- do{ \
- (x)->r = KISS_FFT_F32_COS(phase);\
- (x)->i = KISS_FFT_F32_SIN(phase);\
- }while(0)
-
-
-/* a debugging function */
-#define pcpx(c)\
- fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) )
diff --git a/gst-libs/gst/fft/_kiss_fft_guts_f64.h b/gst-libs/gst/fft/_kiss_fft_guts_f64.h
deleted file mode 100644
index 4202716d..00000000
--- a/gst-libs/gst/fft/_kiss_fft_guts_f64.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-Copyright (c) 2003-2004, Mark Borgerding
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * 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.
- * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-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 OWNER 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.
-*/
-
-/* kiss_fft.h
- defines kiss_fft_f64_scalar as either short or a float type
- and defines
- typedef struct { kiss_fft_f64_scalar r; kiss_fft_f64_scalar i; }kiss_fft_f64_cpx; */
-#include "kiss_fft_f64.h"
-#include <limits.h>
-
-/* The 2*sizeof(size_t) alignment here is borrowed from
- * GNU libc, so it should be good most everywhere.
- * It is more conservative than is needed on some 64-bit
- * platforms, but ia64 does require a 16-byte alignment.
- * The SIMD extensions for x86 and ppc32 would want a
- * larger alignment than this, but we don't need to
- * do better than malloc.
- *
- * Borrowed from GLib's gobject/gtype.c
- */
-#define STRUCT_ALIGNMENT (2 * sizeof (size_t))
-#define ALIGN_STRUCT(offset) \
- ((offset + (STRUCT_ALIGNMENT - 1)) & -STRUCT_ALIGNMENT)
-
-#define MAXFACTORS 32
-/* e.g. an fft of length 128 has 4 factors
- as far as kissfft is concerned
- 4*4*4*2
- */
-
-struct kiss_fft_f64_state{
- int nfft;
- int inverse;
- int factors[2*MAXFACTORS];
- kiss_fft_f64_cpx twiddles[1];
-};
-
-/*
- Explanation of macros dealing with complex math:
-
- C_MUL(m,a,b) : m = a*b
- C_FIXDIV( c , div ) : if a fixed point impl., c /= div. noop otherwise
- C_SUB( res, a,b) : res = a - b
- C_SUBFROM( res , a) : res -= a
- C_ADDTO( res , a) : res += a
- * */
-
-#define S_MUL(a,b) ( (a)*(b) )
-#define C_MUL(m,a,b) \
- do{ (m).r = (a).r*(b).r - (a).i*(b).i;\
- (m).i = (a).r*(b).i + (a).i*(b).r; }while(0)
-#define C_FIXDIV(c,div) /* NOOP */
-#define C_MULBYSCALAR( c, s ) \
- do{ (c).r *= (s);\
- (c).i *= (s); }while(0)
-
-#ifndef CHECK_OVERFLOW_OP
-# define CHECK_OVERFLOW_OP(a,op,b) /* noop */
-#endif
-
-#define C_ADD( res, a,b)\
- do { \
- CHECK_OVERFLOW_OP((a).r,+,(b).r)\
- CHECK_OVERFLOW_OP((a).i,+,(b).i)\
- (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; \
- }while(0)
-#define C_SUB( res, a,b)\
- do { \
- CHECK_OVERFLOW_OP((a).r,-,(b).r)\
- CHECK_OVERFLOW_OP((a).i,-,(b).i)\
- (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; \
- }while(0)
-#define C_ADDTO( res , a)\
- do { \
- CHECK_OVERFLOW_OP((res).r,+,(a).r)\
- CHECK_OVERFLOW_OP((res).i,+,(a).i)\
- (res).r += (a).r; (res).i += (a).i;\
- }while(0)
-
-#define C_SUBFROM( res , a)\
- do {\
- CHECK_OVERFLOW_OP((res).r,-,(a).r)\
- CHECK_OVERFLOW_OP((res).i,-,(a).i)\
- (res).r -= (a).r; (res).i -= (a).i; \
- }while(0)
-
-
-#define KISS_FFT_F64_COS(phase) (kiss_fft_f64_scalar) cos(phase)
-#define KISS_FFT_F64_SIN(phase) (kiss_fft_f64_scalar) sin(phase)
-#define HALF_OF(x) ((x)*.5)
-
-#define kf_cexp(x,phase) \
- do{ \
- (x)->r = KISS_FFT_F64_COS(phase);\
- (x)->i = KISS_FFT_F64_SIN(phase);\
- }while(0)
-
-
-/* a debugging function */
-#define pcpx(c)\
- fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) )
diff --git a/gst-libs/gst/fft/_kiss_fft_guts_s16.h b/gst-libs/gst/fft/_kiss_fft_guts_s16.h
deleted file mode 100644
index 2d8256e0..00000000
--- a/gst-libs/gst/fft/_kiss_fft_guts_s16.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
-Copyright (c) 2003-2004, Mark Borgerding
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * 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.
- * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-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 OWNER 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.
-*/
-
-/* kiss_fft.h
- defines kiss_fft_s16_scalar as either short or a float type
- and defines
- typedef struct { kiss_fft_s16_scalar r; kiss_fft_s16_scalar i; }kiss_fft_s16_cpx; */
-#include "kiss_fft_s16.h"
-#include <limits.h>
-
-/* The 2*sizeof(size_t) alignment here is borrowed from
- * GNU libc, so it should be good most everywhere.
- * It is more conservative than is needed on some 64-bit
- * platforms, but ia64 does require a 16-byte alignment.
- * The SIMD extensions for x86 and ppc32 would want a
- * larger alignment than this, but we don't need to
- * do better than malloc.
- *
- * Borrowed from GLib's gobject/gtype.c
- */
-#define STRUCT_ALIGNMENT (2 * sizeof (size_t))
-#define ALIGN_STRUCT(offset) \
- ((offset + (STRUCT_ALIGNMENT - 1)) & -STRUCT_ALIGNMENT)
-
-#define MAXFACTORS 32
-/* e.g. an fft of length 128 has 4 factors
- as far as kissfft is concerned
- 4*4*4*2
- */
-
-struct kiss_fft_s16_state{
- int nfft;
- int inverse;
- int factors[2*MAXFACTORS];
- kiss_fft_s16_cpx twiddles[1];
-};
-
-/*
- Explanation of macros dealing with complex math:
-
- C_MUL(m,a,b) : m = a*b
- C_FIXDIV( c , div ) : if a fixed point impl., c /= div. noop otherwise
- C_SUB( res, a,b) : res = a - b
- C_SUBFROM( res , a) : res -= a
- C_ADDTO( res , a) : res += a
- * */
-#define FRACBITS 15
-#define SAMPPROD int32_t
-#define SAMP_MAX 32767
-
-#define SAMP_MIN -SAMP_MAX
-
-#if defined(CHECK_OVERFLOW)
-# define CHECK_OVERFLOW_OP(a,op,b) \
- if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \
- fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) ); }
-#endif
-
-
-# define smul(a,b) ( (SAMPPROD)(a)*(b) )
-# define sround( x ) (kiss_fft_s16_scalar)( ( (x) + (1<<(FRACBITS-1)) ) >> FRACBITS )
-
-# define S_MUL(a,b) sround( smul(a,b) )
-
-# define C_MUL(m,a,b) \
- do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \
- (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0)
-
-# define DIVSCALAR(x,k) \
- (x) = sround( smul( x, SAMP_MAX/k ) )
-
-# define C_FIXDIV(c,div) \
- do { DIVSCALAR( (c).r , div); \
- DIVSCALAR( (c).i , div); }while (0)
-
-# define C_MULBYSCALAR( c, s ) \
- do{ (c).r = sround( smul( (c).r , s ) ) ;\
- (c).i = sround( smul( (c).i , s ) ) ; }while(0)
-
-#ifndef CHECK_OVERFLOW_OP
-# define CHECK_OVERFLOW_OP(a,op,b) /* noop */
-#endif
-
-#define C_ADD( res, a,b)\
- do { \
- CHECK_OVERFLOW_OP((a).r,+,(b).r)\
- CHECK_OVERFLOW_OP((a).i,+,(b).i)\
- (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; \
- }while(0)
-#define C_SUB( res, a,b)\
- do { \
- CHECK_OVERFLOW_OP((a).r,-,(b).r)\
- CHECK_OVERFLOW_OP((a).i,-,(b).i)\
- (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; \
- }while(0)
-#define C_ADDTO( res , a)\
- do { \
- CHECK_OVERFLOW_OP((res).r,+,(a).r)\
- CHECK_OVERFLOW_OP((res).i,+,(a).i)\
- (res).r += (a).r; (res).i += (a).i;\
- }while(0)
-
-#define C_SUBFROM( res , a)\
- do {\
- CHECK_OVERFLOW_OP((res).r,-,(a).r)\
- CHECK_OVERFLOW_OP((res).i,-,(a).i)\
- (res).r -= (a).r; (res).i -= (a).i; \
- }while(0)
-
-
-# define KISS_FFT_S16_COS(phase) floor(.5+SAMP_MAX * cos (phase))
-# define KISS_FFT_S16_SIN(phase) floor(.5+SAMP_MAX * sin (phase))
-# define HALF_OF(x) ((x)>>1)
-
-#define kf_cexp(x,phase) \
- do{ \
- (x)->r = KISS_FFT_S16_COS(phase);\
- (x)->i = KISS_FFT_S16_SIN(phase);\
- }while(0)
-
-
-/* a debugging function */
-#define pcpx(c)\
- fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) )
diff --git a/gst-libs/gst/fft/_kiss_fft_guts_s32.h b/gst-libs/gst/fft/_kiss_fft_guts_s32.h
deleted file mode 100644
index f0ec9c0f..00000000
--- a/gst-libs/gst/fft/_kiss_fft_guts_s32.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
-Copyright (c) 2003-2004, Mark Borgerding
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * 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.
- * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-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 OWNER 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.
-*/
-
-/* kiss_fft.h
- defines kiss_fft_s32_scalar as either short or a float type
- and defines
- typedef struct { kiss_fft_s32_scalar r; kiss_fft_s32_scalar i; }kiss_fft_s32_cpx; */
-#include "kiss_fft_s32.h"
-#include <limits.h>
-
-/* The 2*sizeof(size_t) alignment here is borrowed from
- * GNU libc, so it should be good most everywhere.
- * It is more conservative than is needed on some 64-bit
- * platforms, but ia64 does require a 16-byte alignment.
- * The SIMD extensions for x86 and ppc32 would want a
- * larger alignment than this, but we don't need to
- * do better than malloc.
- *
- * Borrowed from GLib's gobject/gtype.c
- */
-#define STRUCT_ALIGNMENT (2 * sizeof (size_t))
-#define ALIGN_STRUCT(offset) \
- ((offset + (STRUCT_ALIGNMENT - 1)) & -STRUCT_ALIGNMENT)
-
-#define MAXFACTORS 32
-/* e.g. an fft of length 128 has 4 factors
- as far as kissfft is concerned
- 4*4*4*2
- */
-
-struct kiss_fft_s32_state{
- int nfft;
- int inverse;
- int factors[2*MAXFACTORS];
- kiss_fft_s32_cpx twiddles[1];
-};
-
-/*
- Explanation of macros dealing with complex math:
-
- C_MUL(m,a,b) : m = a*b
- C_FIXDIV( c , div ) : if a fixed point impl., c /= div. noop otherwise
- C_SUB( res, a,b) : res = a - b
- C_SUBFROM( res , a) : res -= a
- C_ADDTO( res , a) : res += a
- * */
-
-#define FRACBITS 31
-#define SAMPPROD int64_t
-#define SAMP_MAX 2147483647
-
-#define SAMP_MIN -SAMP_MAX
-
-#if defined(CHECK_OVERFLOW)
-# define CHECK_OVERFLOW_OP(a,op,b) \
- if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \
- fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) ); }
-#endif
-
-
-# define smul(a,b) ( (SAMPPROD)(a)*(b) )
-# define sround( x ) (kiss_fft_s32_scalar)( ( (x) + (1<<(FRACBITS-1)) ) >> FRACBITS )
-
-# define S_MUL(a,b) sround( smul(a,b) )
-
-# define C_MUL(m,a,b) \
- do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \
- (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0)
-
-# define DIVSCALAR(x,k) \
- (x) = sround( smul( x, SAMP_MAX/k ) )
-
-# define C_FIXDIV(c,div) \
- do { DIVSCALAR( (c).r , div); \
- DIVSCALAR( (c).i , div); }while (0)
-
-# define C_MULBYSCALAR( c, s ) \
- do{ (c).r = sround( smul( (c).r , s ) ) ;\
- (c).i = sround( smul( (c).i , s ) ) ; }while(0)
-
-#ifndef CHECK_OVERFLOW_OP
-# define CHECK_OVERFLOW_OP(a,op,b) /* noop */
-#endif
-
-#define C_ADD( res, a,b)\
- do { \
- CHECK_OVERFLOW_OP((a).r,+,(b).r)\
- CHECK_OVERFLOW_OP((a).i,+,(b).i)\
- (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; \
- }while(0)
-#define C_SUB( res, a,b)\
- do { \
- CHECK_OVERFLOW_OP((a).r,-,(b).r)\
- CHECK_OVERFLOW_OP((a).i,-,(b).i)\
- (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; \
- }while(0)
-#define C_ADDTO( res , a)\
- do { \
- CHECK_OVERFLOW_OP((res).r,+,(a).r)\
- CHECK_OVERFLOW_OP((res).i,+,(a).i)\
- (res).r += (a).r; (res).i += (a).i;\
- }while(0)
-
-#define C_SUBFROM( res , a)\
- do {\
- CHECK_OVERFLOW_OP((res).r,-,(a).r)\
- CHECK_OVERFLOW_OP((res).i,-,(a).i)\
- (res).r -= (a).r; (res).i -= (a).i; \
- }while(0)
-
-
-# define KISS_FFT_S32_COS(phase) floor(.5+SAMP_MAX * cos (phase))
-# define KISS_FFT_S32_SIN(phase) floor(.5+SAMP_MAX * sin (phase))
-# define HALF_OF(x) ((x)>>1)
-
-#define kf_cexp(x,phase) \
- do{ \
- (x)->r = KISS_FFT_S32_COS(phase);\
- (x)->i = KISS_FFT_S32_SIN(phase);\
- }while(0)
-
-
-/* a debugging function */
-#define pcpx(c)\
- fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) )
diff --git a/gst-libs/gst/fft/gstfft.c b/gst-libs/gst/fft/gstfft.c
deleted file mode 100644
index b1708c77..00000000
--- a/gst-libs/gst/fft/gstfft.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstfft
- * @short_description: General FFT functions and declarations
- *
- * This library includes general definitions and functions, useful for
- * all typed FFT classes.
- */
-
-#include <glib.h>
-
-#include "gstfft.h"
-#include "kiss_fft_s16.h"
-
-/**
- * gst_fft_next_fast_length:
- * @n: Number for which the next fast length should be returned
- *
- * Returns the next number to @n that is entirely a product
- * of 2, 3 and 5. Using this as the @len parameter for
- * the different GstFFT types will provide the best performance.
- *
- * Returns: the next fast FFT length.
- *
- */
-gint
-gst_fft_next_fast_length (gint n)
-{
- gint half = (n + 1) / 2;
-
- /* It's the same for all data types so call the s16
- * version */
-
- /* The real FFT needs an even length so calculate that */
- return 2 * kiss_fft_s16_next_fast_size (half);
-}
diff --git a/gst-libs/gst/fft/gstfft.h b/gst-libs/gst/fft/gstfft.h
deleted file mode 100644
index fa5defe2..00000000
--- a/gst-libs/gst/fft/gstfft.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <glib.h>
-#include <math.h>
-
-#ifndef __GST_FFT_H__
-#define __GST_FFT_H__
-
-/**
- * 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 */
-
-gint gst_fft_next_fast_length (gint n) G_GNUC_CONST;
-
-#endif /* __GST_FFT_H__ */
diff --git a/gst-libs/gst/fft/gstfftf32.c b/gst-libs/gst/fft/gstfftf32.c
deleted file mode 100644
index 4facb353..00000000
--- a/gst-libs/gst/fft/gstfftf32.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <glib.h>
-#include <math.h>
-
-#include "_kiss_fft_guts_f32.h"
-#include "kiss_fftr_f32.h"
-#include "gstfft.h"
-#include "gstfftf32.h"
-
-/**
- * SECTION:gstfftf32
- * @short_description: FFT functions for 32 bit float samples
- *
- * #GstFFTF32 provides a FFT implementation and related functions for
- * 32 bit float samples. To use this call gst_fft_f32_new() for
- * allocating a #GstFFTF32 instance with the appropiate parameters and
- * then call gst_fft_f32_fft() or gst_fft_f32_inverse_fft() to perform the
- * FFT or inverse FFT on a buffer of samples.
- *
- * After use free the #GstFFTF32 instance with gst_fft_f32_free().
- *
- * For the best performance use gst_fft_next_fast_length() to get a
- * number that is entirely a product of 2, 3 and 5 and use this as the
- * @len parameter for gst_fft_f32_new().
- *
- * The @len parameter specifies the number of samples in the time domain that
- * will be processed or generated. The number of samples in the frequency domain
- * is @len/2 + 1. To get n samples in the frequency domain use 2*n - 2 as @len.
- *
- * Before performing the FFT on time domain data it usually makes sense
- * to apply a window function to it. For this gst_fft_f32_window() can comfortably
- * be used.
- *
- * Be aware, that you can't simply run gst_fft_f32_inverse_fft() on the
- * resulting frequency data of gst_fft_f32_fft() to get the original data back.
- * The relation between them is iFFT (FFT (x)) = x * nfft where nfft is the
- * length of the FFT. This also has to be taken into account when calculation
- * the magnitude of the frequency data.
- *
- */
-
-/**
- * gst_fft_f32_new:
- * @len: Length of the FFT in the time domain
- * @inverse: %TRUE if the #GstFFTF32 instance should be used for the inverse FFT
- *
- * This returns a new #GstFFTF32 instance with the given parameters. It makes
- * sense to keep one instance for several calls for speed reasons.
- *
- * @len must be even and to get the best performance a product of
- * 2, 3 and 5. To get the next number with this characteristics use
- * gst_fft_next_fast_length().
- *
- * Returns: a new #GstFFTF32 instance.
- */
-GstFFTF32 *
-gst_fft_f32_new (gint len, gboolean inverse)
-{
- GstFFTF32 *self;
- gsize subsize = 0, memneeded;
-
- g_return_val_if_fail (len > 0, NULL);
- g_return_val_if_fail (len % 2 == 0, NULL);
-
- kiss_fftr_f32_alloc (len, (inverse) ? 1 : 0, NULL, &subsize);
- memneeded = ALIGN_STRUCT (sizeof (GstFFTF32)) + subsize;
-
- self = (GstFFTF32 *) g_malloc0 (memneeded);
-
- self->cfg = (((guint8 *) self) + ALIGN_STRUCT (sizeof (GstFFTF32)));
- self->cfg = kiss_fftr_f32_alloc (len, (inverse) ? 1 : 0, self->cfg, &subsize);
- g_assert (self->cfg);
-
- self->inverse = inverse;
- self->len = len;
-
- return self;
-}
-
-/**
- * gst_fft_f32_fft:
- * @self: #GstFFTF32 instance for this call
- * @timedata: Buffer of the samples in the time domain
- * @freqdata: Target buffer for the samples in the frequency domain
- *
- * This performs the FFT on @timedata and puts the result in @freqdata.
- *
- * @timedata must have as many samples as specified with the @len parameter while
- * allocating the #GstFFTF32 instance with gst_fft_f32_new().
- *
- * @freqdata must be large enough to hold @len/2 + 1 #GstFFTF32Complex frequency
- * domain samples.
- *
- */
-void
-gst_fft_f32_fft (GstFFTF32 * self, const gfloat * timedata,
- GstFFTF32Complex * freqdata)
-{
- g_return_if_fail (self);
- g_return_if_fail (!self->inverse);
- g_return_if_fail (timedata);
- g_return_if_fail (freqdata);
-
- kiss_fftr_f32 (self->cfg, timedata, (kiss_fft_f32_cpx *) freqdata);
-}
-
-/**
- * gst_fft_f32_inverse_fft:
- * @self: #GstFFTF32 instance for this call
- * @freqdata: Buffer of the samples in the frequency domain
- * @timedata: Target buffer for the samples in the time domain
- *
- * This performs the inverse FFT on @freqdata and puts the result in @timedata.
- *
- * @freqdata must have @len/2 + 1 samples, where @len is the parameter specified
- * while allocating the #GstFFTF32 instance with gst_fft_f32_new().
- *
- * @timedata must be large enough to hold @len time domain samples.
- *
- */
-void
-gst_fft_f32_inverse_fft (GstFFTF32 * self, const GstFFTF32Complex * freqdata,
- gfloat * timedata)
-{
- g_return_if_fail (self);
- g_return_if_fail (self->inverse);
- g_return_if_fail (timedata);
- g_return_if_fail (freqdata);
-
- kiss_fftri_f32 (self->cfg, (kiss_fft_f32_cpx *) freqdata, timedata);
-}
-
-/**
- * gst_fft_f32_free:
- * @self: #GstFFTF32 instance for this call
- *
- * This frees the memory allocated for @self.
- *
- */
-void
-gst_fft_f32_free (GstFFTF32 * self)
-{
- g_free (self);
-}
-
-/**
- * gst_fft_f32_window:
- * @self: #GstFFTF32 instance for this call
- * @timedata: Time domain samples
- * @window: Window function to apply
- *
- * This calls the window function @window on the @timedata sample buffer.
- *
- */
-void
-gst_fft_f32_window (GstFFTF32 * self, gfloat * timedata, GstFFTWindow window)
-{
- gint i, len;
-
- g_return_if_fail (self);
- g_return_if_fail (timedata);
-
- len = self->len;
-
- switch (window) {
- case GST_FFT_WINDOW_RECTANGULAR:
- /* do nothing */
- break;
- case GST_FFT_WINDOW_HAMMING:
- for (i = 0; i < len; i++)
- timedata[i] *= (0.53836 - 0.46164 * cos (2.0 * M_PI * i / len));
- break;
- case GST_FFT_WINDOW_HANN:
- for (i = 0; i < len; i++)
- timedata[i] *= (0.5 - 0.5 * cos (2.0 * M_PI * i / len));
- break;
- case GST_FFT_WINDOW_BARTLETT:
- for (i = 0; i < len; i++)
- timedata[i] *= (1.0 - fabs ((2.0 * i - len) / len));
- break;
- case GST_FFT_WINDOW_BLACKMAN:
- for (i = 0; i < len; i++)
- timedata[i] *= (0.42 - 0.5 * cos ((2.0 * i) / len) +
- 0.08 * cos ((4.0 * i) / len));
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-}
diff --git a/gst-libs/gst/fft/gstfftf32.h b/gst-libs/gst/fft/gstfftf32.h
deleted file mode 100644
index 3b56b483..00000000
--- a/gst-libs/gst/fft/gstfftf32.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_FFT_F32_H__
-#define __GST_FFT_F32_H__
-
-#include <glib.h>
-#include <gst/gst.h>
-
-#include "gstfft.h"
-
-typedef struct _GstFFTF32 GstFFTF32;
-typedef struct _GstFFTF32Complex GstFFTF32Complex;
-
-/* FIXME 0.11: Move the struct definition to the sources,
- * there's no reason to have it public.
- */
-/**
- * GstFFTF32:
- *
- * Instance structure for #GstFFTF32.
- *
- */
-struct _GstFFTF32 {
- /* <private> */
- void * cfg;
- gboolean inverse;
- gint len;
- gpointer _padding[GST_PADDING];
-};
-
-/* 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 */
-
-GstFFTF32 * gst_fft_f32_new (gint len, gboolean inverse);
-void gst_fft_f32_fft (GstFFTF32 *self, const gfloat *timedata, GstFFTF32Complex *freqdata);
-void gst_fft_f32_inverse_fft (GstFFTF32 *self, const GstFFTF32Complex *freqdata, gfloat *timedata);
-void gst_fft_f32_free (GstFFTF32 *self);
-
-void gst_fft_f32_window (GstFFTF32 *self, gfloat *timedata, GstFFTWindow window);
-
-#endif /* __GST_FFT_F32_H__ */
diff --git a/gst-libs/gst/fft/gstfftf64.c b/gst-libs/gst/fft/gstfftf64.c
deleted file mode 100644
index 5291f628..00000000
--- a/gst-libs/gst/fft/gstfftf64.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <glib.h>
-#include <math.h>
-
-#include "_kiss_fft_guts_f64.h"
-#include "kiss_fftr_f64.h"
-#include "gstfft.h"
-#include "gstfftf64.h"
-
-/**
- * SECTION:gstfftf64
- * @short_description: FFT functions for 64 bit float samples
- *
- * #GstFFTF64 provides a FFT implementation and related functions for
- * 64 bit float samples. To use this call gst_fft_f64_new() for
- * allocating a #GstFFTF64 instance with the appropiate parameters and
- * then call gst_fft_f64_fft() or gst_fft_f64_inverse_fft() to perform the
- * FFT or inverse FFT on a buffer of samples.
- *
- * After use free the #GstFFTF64 instance with gst_fft_f64_free().
- *
- * For the best performance use gst_fft_next_fast_length() to get a
- * number that is entirely a product of 2, 3 and 5 and use this as the
- * @len parameter for gst_fft_f64_new().
- *
- * The @len parameter specifies the number of samples in the time domain that
- * will be processed or generated. The number of samples in the frequency domain
- * is @len/2 + 1. To get n samples in the frequency domain use 2*n - 2 as @len.
- *
- * Before performing the FFT on time domain data it usually makes sense
- * to apply a window function to it. For this gst_fft_f64_window() can comfortably
- * be used.
- *
- * Be aware, that you can't simply run gst_fft_f32_inverse_fft() on the
- * resulting frequency data of gst_fft_f32_fft() to get the original data back.
- * The relation between them is iFFT (FFT (x)) = x * nfft where nfft is the
- * length of the FFT. This also has to be taken into account when calculation
- * the magnitude of the frequency data.
- *
- */
-
-/**
- * gst_fft_f64_new:
- * @len: Length of the FFT in the time domain
- * @inverse: %TRUE if the #GstFFTF64 instance should be used for the inverse FFT
- *
- * This returns a new #GstFFTF64 instance with the given parameters. It makes
- * sense to keep one instance for several calls for speed reasons.
- *
- * @len must be even and to get the best performance a product of
- * 2, 3 and 5. To get the next number with this characteristics use
- * gst_fft_next_fast_length().
- *
- * Returns: a new #GstFFTF64 instance.
- */
-GstFFTF64 *
-gst_fft_f64_new (gint len, gboolean inverse)
-{
- GstFFTF64 *self;
- gsize subsize = 0, memneeded;
-
- g_return_val_if_fail (len > 0, NULL);
- g_return_val_if_fail (len % 2 == 0, NULL);
-
- kiss_fftr_f64_alloc (len, (inverse) ? 1 : 0, NULL, &subsize);
- memneeded = ALIGN_STRUCT (sizeof (GstFFTF64)) + subsize;
-
- self = (GstFFTF64 *) g_malloc0 (memneeded);
-
- self->cfg = (((guint8 *) self) + ALIGN_STRUCT (sizeof (GstFFTF64)));
- self->cfg = kiss_fftr_f64_alloc (len, (inverse) ? 1 : 0, self->cfg, &subsize);
- g_assert (self->cfg);
-
- self->inverse = inverse;
- self->len = len;
-
- return self;
-}
-
-/**
- * gst_fft_f64_fft:
- * @self: #GstFFTF64 instance for this call
- * @timedata: Buffer of the samples in the time domain
- * @freqdata: Target buffer for the samples in the frequency domain
- *
- * This performs the FFT on @timedata and puts the result in @freqdata.
- *
- * @timedata must have as many samples as specified with the @len parameter while
- * allocating the #GstFFTF64 instance with gst_fft_f64_new().
- *
- * @freqdata must be large enough to hold @len/2 + 1 #GstFFTF64Complex frequency
- * domain samples.
- *
- */
-void
-gst_fft_f64_fft (GstFFTF64 * self, const gdouble * timedata,
- GstFFTF64Complex * freqdata)
-{
- g_return_if_fail (self);
- g_return_if_fail (!self->inverse);
- g_return_if_fail (timedata);
- g_return_if_fail (freqdata);
-
- kiss_fftr_f64 (self->cfg, timedata, (kiss_fft_f64_cpx *) freqdata);
-}
-
-/**
- * gst_fft_f64_inverse_fft:
- * @self: #GstFFTF64 instance for this call
- * @freqdata: Buffer of the samples in the frequency domain
- * @timedata: Target buffer for the samples in the time domain
- *
- * This performs the inverse FFT on @freqdata and puts the result in @timedata.
- *
- * @freqdata must have @len/2 + 1 samples, where @len is the parameter specified
- * while allocating the #GstFFTF64 instance with gst_fft_f64_new().
- *
- * @timedata must be large enough to hold @len time domain samples.
- *
- */
-void
-gst_fft_f64_inverse_fft (GstFFTF64 * self, const GstFFTF64Complex * freqdata,
- gdouble * timedata)
-{
- g_return_if_fail (self);
- g_return_if_fail (self->inverse);
- g_return_if_fail (timedata);
- g_return_if_fail (freqdata);
-
- kiss_fftri_f64 (self->cfg, (kiss_fft_f64_cpx *) freqdata, timedata);
-}
-
-/**
- * gst_fft_f64_free:
- * @self: #GstFFTF64 instance for this call
- *
- * This frees the memory allocated for @self.
- *
- */
-void
-gst_fft_f64_free (GstFFTF64 * self)
-{
- g_free (self);
-}
-
-/**
- * gst_fft_f64_window:
- * @self: #GstFFTF64 instance for this call
- * @timedata: Time domain samples
- * @window: Window function to apply
- *
- * This calls the window function @window on the @timedata sample buffer.
- *
- */
-void
-gst_fft_f64_window (GstFFTF64 * self, gdouble * timedata, GstFFTWindow window)
-{
- gint i, len;
-
- g_return_if_fail (self);
- g_return_if_fail (timedata);
-
- len = self->len;
-
- switch (window) {
- case GST_FFT_WINDOW_RECTANGULAR:
- /* do nothing */
- break;
- case GST_FFT_WINDOW_HAMMING:
- for (i = 0; i < len; i++)
- timedata[i] *= (0.53836 - 0.46164 * cos (2.0 * M_PI * i / len));
- break;
- case GST_FFT_WINDOW_HANN:
- for (i = 0; i < len; i++)
- timedata[i] *= (0.5 - 0.5 * cos (2.0 * M_PI * i / len));
- break;
- case GST_FFT_WINDOW_BARTLETT:
- for (i = 0; i < len; i++)
- timedata[i] *= (1.0 - fabs ((2.0 * i - len) / len));
- break;
- case GST_FFT_WINDOW_BLACKMAN:
- for (i = 0; i < len; i++)
- timedata[i] *= (0.42 - 0.5 * cos ((2.0 * i) / len) +
- 0.08 * cos ((4.0 * i) / len));
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-}
diff --git a/gst-libs/gst/fft/gstfftf64.h b/gst-libs/gst/fft/gstfftf64.h
deleted file mode 100644
index 8ebbee49..00000000
--- a/gst-libs/gst/fft/gstfftf64.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_FFT_F64_H__
-#define __GST_FFT_F64_H__
-
-#include <glib.h>
-#include <gst/gst.h>
-
-#include "gstfft.h"
-
-typedef struct _GstFFTF64 GstFFTF64;
-typedef struct _GstFFTF64Complex GstFFTF64Complex;
-
-/* FIXME 0.11: Move the struct definition to the sources,
- * there's no reason to have it public.
- */
-/**
- * GstFFTF64:
- *
- * Instance structure for #GstFFTF64.
- *
- */
-struct _GstFFTF64 {
- /* <private> */
- void * cfg;
- gboolean inverse;
- gint len;
- gpointer _padding[GST_PADDING];
-};
-
-/* 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 */
-
-GstFFTF64 * gst_fft_f64_new (gint len, gboolean inverse);
-void gst_fft_f64_fft (GstFFTF64 *self, const gdouble *timedata, GstFFTF64Complex *freqdata);
-void gst_fft_f64_inverse_fft (GstFFTF64 *self, const GstFFTF64Complex *freqdata, gdouble *timedata);
-void gst_fft_f64_free (GstFFTF64 *self);
-
-void gst_fft_f64_window (GstFFTF64 *self, gdouble *timedata, GstFFTWindow window);
-
-#endif /* __GST_FFT_F64_H__ */
diff --git a/gst-libs/gst/fft/gstffts16.c b/gst-libs/gst/fft/gstffts16.c
deleted file mode 100644
index 53135d8b..00000000
--- a/gst-libs/gst/fft/gstffts16.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <glib.h>
-#include <math.h>
-
-#include "_kiss_fft_guts_s16.h"
-#include "kiss_fftr_s16.h"
-#include "gstfft.h"
-#include "gstffts16.h"
-
-/**
- * SECTION:gstffts16
- * @short_description: FFT functions for signed 16 bit integer samples
- *
- * #GstFFTS16 provides a FFT implementation and related functions for
- * signed 16 bit integer samples. To use this call gst_fft_s16_new() for
- * allocating a #GstFFTS16 instance with the appropiate parameters and
- * then call gst_fft_s16_fft() or gst_fft_s16_inverse_fft() to perform the
- * FFT or inverse FFT on a buffer of samples.
- *
- * After use free the #GstFFTS16 instance with gst_fft_s16_free().
- *
- * For the best performance use gst_fft_next_fast_length() to get a
- * number that is entirely a product of 2, 3 and 5 and use this as the
- * @len parameter for gst_fft_s16_new().
- *
- * The @len parameter specifies the number of samples in the time domain that
- * will be processed or generated. The number of samples in the frequency domain
- * is @len/2 + 1. To get n samples in the frequency domain use 2*n - 2 as @len.
- *
- * Before performing the FFT on time domain data it usually makes sense
- * to apply a window function to it. For this gst_fft_s16_window() can comfortably
- * be used.
- *
- * Be aware, that you can't simply run gst_fft_s16_inverse_fft() on the
- * resulting frequency data of gst_fft_s16_fft() to get the original data back.
- * The relation between them is iFFT (FFT (x)) = x / nfft where nfft is the
- * length of the FFT. This also has to be taken into account when calculation
- * the magnitude of the frequency data.
- *
- */
-
-/**
- * gst_fft_s16_new:
- * @len: Length of the FFT in the time domain
- * @inverse: %TRUE if the #GstFFTS16 instance should be used for the inverse FFT
- *
- * This returns a new #GstFFTS16 instance with the given parameters. It makes
- * sense to keep one instance for several calls for speed reasons.
- *
- * @len must be even and to get the best performance a product of
- * 2, 3 and 5. To get the next number with this characteristics use
- * gst_fft_next_fast_length().
- *
- * Returns: a new #GstFFTS16 instance.
- */
-GstFFTS16 *
-gst_fft_s16_new (gint len, gboolean inverse)
-{
- GstFFTS16 *self;
- gsize subsize = 0, memneeded;
-
- g_return_val_if_fail (len > 0, NULL);
- g_return_val_if_fail (len % 2 == 0, NULL);
-
- kiss_fftr_s16_alloc (len, (inverse) ? 1 : 0, NULL, &subsize);
- memneeded = ALIGN_STRUCT (sizeof (GstFFTS16)) + subsize;
-
- self = (GstFFTS16 *) g_malloc0 (memneeded);
-
- self->cfg = (((guint8 *) self) + ALIGN_STRUCT (sizeof (GstFFTS16)));
- self->cfg = kiss_fftr_s16_alloc (len, (inverse) ? 1 : 0, self->cfg, &subsize);
- g_assert (self->cfg);
-
- self->inverse = inverse;
- self->len = len;
-
- return self;
-}
-
-/**
- * gst_fft_s16_fft:
- * @self: #GstFFTS16 instance for this call
- * @timedata: Buffer of the samples in the time domain
- * @freqdata: Target buffer for the samples in the frequency domain
- *
- * This performs the FFT on @timedata and puts the result in @freqdata.
- *
- * @timedata must have as many samples as specified with the @len parameter while
- * allocating the #GstFFTS16 instance with gst_fft_s16_new().
- *
- * @freqdata must be large enough to hold @len/2 + 1 #GstFFTS16Complex frequency
- * domain samples.
- *
- */
-void
-gst_fft_s16_fft (GstFFTS16 * self, const gint16 * timedata,
- GstFFTS16Complex * freqdata)
-{
- g_return_if_fail (self);
- g_return_if_fail (!self->inverse);
- g_return_if_fail (timedata);
- g_return_if_fail (freqdata);
-
- kiss_fftr_s16 (self->cfg, timedata, (kiss_fft_s16_cpx *) freqdata);
-}
-
-/**
- * gst_fft_s16_inverse_fft:
- * @self: #GstFFTS16 instance for this call
- * @freqdata: Buffer of the samples in the frequency domain
- * @timedata: Target buffer for the samples in the time domain
- *
- * This performs the inverse FFT on @freqdata and puts the result in @timedata.
- *
- * @freqdata must have @len/2 + 1 samples, where @len is the parameter specified
- * while allocating the #GstFFTS16 instance with gst_fft_s16_new().
- *
- * @timedata must be large enough to hold @len time domain samples.
- *
- */
-void
-gst_fft_s16_inverse_fft (GstFFTS16 * self, const GstFFTS16Complex * freqdata,
- gint16 * timedata)
-{
- g_return_if_fail (self);
- g_return_if_fail (self->inverse);
- g_return_if_fail (timedata);
- g_return_if_fail (freqdata);
-
- kiss_fftri_s16 (self->cfg, (kiss_fft_s16_cpx *) freqdata, timedata);
-}
-
-/**
- * gst_fft_s16_free:
- * @self: #GstFFTS16 instance for this call
- *
- * This frees the memory allocated for @self.
- *
- */
-void
-gst_fft_s16_free (GstFFTS16 * self)
-{
- g_free (self);
-}
-
-/**
- * gst_fft_s16_window:
- * @self: #GstFFTS16 instance for this call
- * @timedata: Time domain samples
- * @window: Window function to apply
- *
- * This calls the window function @window on the @timedata sample buffer.
- *
- */
-void
-gst_fft_s16_window (GstFFTS16 * self, gint16 * timedata, GstFFTWindow window)
-{
- gint i, len;
-
- g_return_if_fail (self);
- g_return_if_fail (timedata);
-
- len = self->len;
-
- switch (window) {
- case GST_FFT_WINDOW_RECTANGULAR:
- /* do nothing */
- break;
- case GST_FFT_WINDOW_HAMMING:
- for (i = 0; i < len; i++)
- timedata[i] *= (0.53836 - 0.46164 * cos (2.0 * M_PI * i / len));
- break;
- case GST_FFT_WINDOW_HANN:
- for (i = 0; i < len; i++)
- timedata[i] *= (0.5 - 0.5 * cos (2.0 * M_PI * i / len));
- break;
- case GST_FFT_WINDOW_BARTLETT:
- for (i = 0; i < len; i++)
- timedata[i] *= (1.0 - fabs ((2.0 * i - len) / len));
- break;
- case GST_FFT_WINDOW_BLACKMAN:
- for (i = 0; i < len; i++)
- timedata[i] *= (0.42 - 0.5 * cos ((2.0 * i) / len) +
- 0.08 * cos ((4.0 * i) / len));
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-}
diff --git a/gst-libs/gst/fft/gstffts16.h b/gst-libs/gst/fft/gstffts16.h
deleted file mode 100644
index 9a752f1f..00000000
--- a/gst-libs/gst/fft/gstffts16.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_FFT_S16_H__
-#define __GST_FFT_S16_H__
-
-#include <glib.h>
-#include <gst/gst.h>
-
-#include "gstfft.h"
-
-typedef struct _GstFFTS16 GstFFTS16;
-typedef struct _GstFFTS16Complex GstFFTS16Complex;
-
-/* FIXME 0.11: Move the struct definition to the sources,
- * there's no reason to have it public.
- */
-/**
- * GstFFTS16:
- *
- * Instance structure for #GstFFTS16.
- *
- */
-struct _GstFFTS16 {
- /* <private> */
- void *cfg;
- gboolean inverse;
- gint len;
- gpointer _padding[GST_PADDING];
-};
-
-/* 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 */
-
-GstFFTS16 * gst_fft_s16_new (gint len, gboolean inverse);
-void gst_fft_s16_fft (GstFFTS16 *self, const gint16 *timedata, GstFFTS16Complex *freqdata);
-void gst_fft_s16_inverse_fft (GstFFTS16 *self, const GstFFTS16Complex *freqdata, gint16 *timedata);
-void gst_fft_s16_free (GstFFTS16 *self);
-
-void gst_fft_s16_window (GstFFTS16 *self, gint16 *timedata, GstFFTWindow window);
-#endif /* __GST_FFT_S16_H__ */
diff --git a/gst-libs/gst/fft/gstffts32.c b/gst-libs/gst/fft/gstffts32.c
deleted file mode 100644
index 2581318f..00000000
--- a/gst-libs/gst/fft/gstffts32.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <glib.h>
-#include <math.h>
-
-#include "_kiss_fft_guts_s32.h"
-#include "kiss_fftr_s32.h"
-#include "gstfft.h"
-#include "gstffts32.h"
-
-/**
- * SECTION:gstffts32
- * @short_description: FFT functions for signed 32 bit integer samples
- *
- * #GstFFTS32 provides a FFT implementation and related functions for
- * signed 32 bit integer samples. To use this call gst_fft_s32_new() for
- * allocating a #GstFFTS32 instance with the appropiate parameters and
- * then call gst_fft_s32_fft() or gst_fft_s32_inverse_fft() to perform the
- * FFT or inverse FFT on a buffer of samples.
- *
- * After use free the #GstFFTS32 instance with gst_fft_s32_free().
- *
- * For the best performance use gst_fft_next_fast_length() to get a
- * number that is entirely a product of 2, 3 and 5 and use this as the
- * @len parameter for gst_fft_s32_new().
- *
- * The @len parameter specifies the number of samples in the time domain that
- * will be processed or generated. The number of samples in the frequency domain
- * is @len/2 + 1. To get n samples in the frequency domain use 2*n - 2 as @len.
- *
- * Before performing the FFT on time domain data it usually makes sense
- * to apply a window function to it. For this gst_fft_s32_window() can comfortably
- * be used.
- *
- * Be aware, that you can't simply run gst_fft_s32_inverse_fft() on the
- * resulting frequency data of gst_fft_s32_fft() to get the original data back.
- * The relation between them is iFFT (FFT (x)) = x / nfft where nfft is the
- * length of the FFT. This also has to be taken into account when calculation
- * the magnitude of the frequency data.
- */
-
-/**
- * gst_fft_s32_new:
- * @len: Length of the FFT in the time domain
- * @inverse: %TRUE if the #GstFFTS32 instance should be used for the inverse FFT
- *
- * This returns a new #GstFFTS32 instance with the given parameters. It makes
- * sense to keep one instance for several calls for speed reasons.
- *
- * @len must be even and to get the best performance a product of
- * 2, 3 and 5. To get the next number with this characteristics use
- * gst_fft_next_fast_length().
- *
- * Returns: a new #GstFFTS32 instance.
- */
-GstFFTS32 *
-gst_fft_s32_new (gint len, gboolean inverse)
-{
- GstFFTS32 *self;
- gsize subsize = 0, memneeded;
-
- g_return_val_if_fail (len > 0, NULL);
- g_return_val_if_fail (len % 2 == 0, NULL);
-
- kiss_fftr_s32_alloc (len, (inverse) ? 1 : 0, NULL, &subsize);
- memneeded = ALIGN_STRUCT (sizeof (GstFFTS32)) + subsize;
-
- self = (GstFFTS32 *) g_malloc0 (memneeded);
-
- self->cfg = (((guint8 *) self) + ALIGN_STRUCT (sizeof (GstFFTS32)));
- self->cfg = kiss_fftr_s32_alloc (len, (inverse) ? 1 : 0, self->cfg, &subsize);
- g_assert (self->cfg);
-
- self->inverse = inverse;
- self->len = len;
-
- return self;
-}
-
-/**
- * gst_fft_s32_fft:
- * @self: #GstFFTS32 instance for this call
- * @timedata: Buffer of the samples in the time domain
- * @freqdata: Target buffer for the samples in the frequency domain
- *
- * This performs the FFT on @timedata and puts the result in @freqdata.
- *
- * @timedata must have as many samples as specified with the @len parameter while
- * allocating the #GstFFTS32 instance with gst_fft_s32_new().
- *
- * @freqdata must be large enough to hold @len/2 + 1 #GstFFTS32Complex frequency
- * domain samples.
- *
- */
-void
-gst_fft_s32_fft (GstFFTS32 * self, const gint32 * timedata,
- GstFFTS32Complex * freqdata)
-{
- g_return_if_fail (self);
- g_return_if_fail (!self->inverse);
- g_return_if_fail (timedata);
- g_return_if_fail (freqdata);
-
- kiss_fftr_s32 (self->cfg, timedata, (kiss_fft_s32_cpx *) freqdata);
-}
-
-/**
- * gst_fft_s32_inverse_fft:
- * @self: #GstFFTS32 instance for this call
- * @freqdata: Buffer of the samples in the frequency domain
- * @timedata: Target buffer for the samples in the time domain
- *
- * This performs the inverse FFT on @freqdata and puts the result in @timedata.
- *
- * @freqdata must have @len/2 + 1 samples, where @len is the parameter specified
- * while allocating the #GstFFTS32 instance with gst_fft_s32_new().
- *
- * @timedata must be large enough to hold @len time domain samples.
- *
- */
-void
-gst_fft_s32_inverse_fft (GstFFTS32 * self, const GstFFTS32Complex * freqdata,
- gint32 * timedata)
-{
- g_return_if_fail (self);
- g_return_if_fail (self->inverse);
- g_return_if_fail (timedata);
- g_return_if_fail (freqdata);
-
- kiss_fftri_s32 (self->cfg, (kiss_fft_s32_cpx *) freqdata, timedata);
-}
-
-/**
- * gst_fft_s32_free:
- * @self: #GstFFTS32 instance for this call
- *
- * This frees the memory allocated for @self.
- *
- */
-void
-gst_fft_s32_free (GstFFTS32 * self)
-{
- g_free (self);
-}
-
-/**
- * gst_fft_s32_window:
- * @self: #GstFFTS32 instance for this call
- * @timedata: Time domain samples
- * @window: Window function to apply
- *
- * This calls the window function @window on the @timedata sample buffer.
- *
- */
-void
-gst_fft_s32_window (GstFFTS32 * self, gint32 * timedata, GstFFTWindow window)
-{
- gint i, len;
-
- g_return_if_fail (self);
- g_return_if_fail (timedata);
-
- len = self->len;
-
- switch (window) {
- case GST_FFT_WINDOW_RECTANGULAR:
- /* do nothing */
- break;
- case GST_FFT_WINDOW_HAMMING:
- for (i = 0; i < len; i++)
- timedata[i] *= (0.53836 - 0.46164 * cos (2.0 * M_PI * i / len));
- break;
- case GST_FFT_WINDOW_HANN:
- for (i = 0; i < len; i++)
- timedata[i] *= (0.5 - 0.5 * cos (2.0 * M_PI * i / len));
- break;
- case GST_FFT_WINDOW_BARTLETT:
- for (i = 0; i < len; i++)
- timedata[i] *= (1.0 - fabs ((2.0 * i - len) / len));
- break;
- case GST_FFT_WINDOW_BLACKMAN:
- for (i = 0; i < len; i++)
- timedata[i] *= (0.42 - 0.5 * cos ((2.0 * i) / len) +
- 0.08 * cos ((4.0 * i) / len));
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-}
diff --git a/gst-libs/gst/fft/gstffts32.h b/gst-libs/gst/fft/gstffts32.h
deleted file mode 100644
index fd3b2798..00000000
--- a/gst-libs/gst/fft/gstffts32.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_FFT_S32_H__
-#define __GST_FFT_S32_H__
-
-#include <glib.h>
-#include <gst/gst.h>
-
-#include "gstfft.h"
-
-typedef struct _GstFFTS32 GstFFTS32;
-typedef struct _GstFFTS32Complex GstFFTS32Complex;
-
-/* FIXME 0.11: Move the struct definition to the sources,
- * there's no reason to have it public.
- */
-/**
- * GstFFTS32:
- *
- * Instance structure for #GstFFTS32.
- *
- */
-struct _GstFFTS32 {
- /* <private> */
- void * cfg;
- gboolean inverse;
- gint len;
- gpointer _padding[GST_PADDING];
-};
-
-/* 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 */
-
-GstFFTS32 * gst_fft_s32_new (gint len, gboolean inverse);
-void gst_fft_s32_fft (GstFFTS32 *self, const gint32 *timedata, GstFFTS32Complex *freqdata);
-void gst_fft_s32_inverse_fft (GstFFTS32 *self, const GstFFTS32Complex *freqdata, gint32 *timedata);
-void gst_fft_s32_free (GstFFTS32 *self);
-
-void gst_fft_s32_window (GstFFTS32 *self, gint32 *timedata, GstFFTWindow window);
-
-#endif /* __GST_FFT_S32_H__ */
diff --git a/gst-libs/gst/fft/kiss_fft_f32.c b/gst-libs/gst/fft/kiss_fft_f32.c
deleted file mode 100644
index f53d1d78..00000000
--- a/gst-libs/gst/fft/kiss_fft_f32.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/*
-Copyright (c) 2003-2004, Mark Borgerding
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * 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.
- * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-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 OWNER 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.
-*/
-
-
-#include "_kiss_fft_guts_f32.h"
-/* The guts header contains all the multiplication and addition macros that are defined for
- fixed or floating point complex numbers. It also delares the kf_ internal functions.
- */
-
-static kiss_fft_f32_cpx *scratchbuf = NULL;
-static size_t nscratchbuf = 0;
-static kiss_fft_f32_cpx *tmpbuf = NULL;
-static size_t ntmpbuf = 0;
-
-#define CHECKBUF(buf,nbuf,n) \
- do { \
- if ( nbuf < (size_t)(n) ) {\
- free(buf); \
- buf = (kiss_fft_f32_cpx*)KISS_FFT_F32_MALLOC(sizeof(kiss_fft_f32_cpx)*(n)); \
- nbuf = (size_t)(n); \
- } \
- }while(0)
-
-
-static void
-kf_bfly2 (kiss_fft_f32_cpx * Fout,
- const size_t fstride, const kiss_fft_f32_cfg st, int m)
-{
- kiss_fft_f32_cpx *Fout2;
- kiss_fft_f32_cpx *tw1 = st->twiddles;
- kiss_fft_f32_cpx t;
-
- Fout2 = Fout + m;
- do {
- C_FIXDIV (*Fout, 2);
- C_FIXDIV (*Fout2, 2);
-
- C_MUL (t, *Fout2, *tw1);
- tw1 += fstride;
- C_SUB (*Fout2, *Fout, t);
- C_ADDTO (*Fout, t);
- ++Fout2;
- ++Fout;
- } while (--m);
-}
-
-static void
-kf_bfly4 (kiss_fft_f32_cpx * Fout,
- const size_t fstride, const kiss_fft_f32_cfg st, const size_t m)
-{
- kiss_fft_f32_cpx *tw1, *tw2, *tw3;
- kiss_fft_f32_cpx scratch[6];
- size_t k = m;
- const size_t m2 = 2 * m;
- const size_t m3 = 3 * m;
-
- tw3 = tw2 = tw1 = st->twiddles;
-
- do {
- C_FIXDIV (*Fout, 4);
- C_FIXDIV (Fout[m], 4);
- C_FIXDIV (Fout[m2], 4);
- C_FIXDIV (Fout[m3], 4);
-
- C_MUL (scratch[0], Fout[m], *tw1);
- C_MUL (scratch[1], Fout[m2], *tw2);
- C_MUL (scratch[2], Fout[m3], *tw3);
-
- C_SUB (scratch[5], *Fout, scratch[1]);
- C_ADDTO (*Fout, scratch[1]);
- C_ADD (scratch[3], scratch[0], scratch[2]);
- C_SUB (scratch[4], scratch[0], scratch[2]);
- C_SUB (Fout[m2], *Fout, scratch[3]);
- tw1 += fstride;
- tw2 += fstride * 2;
- tw3 += fstride * 3;
- C_ADDTO (*Fout, scratch[3]);
-
- if (st->inverse) {
- Fout[m].r = scratch[5].r - scratch[4].i;
- Fout[m].i = scratch[5].i + scratch[4].r;
- Fout[m3].r = scratch[5].r + scratch[4].i;
- Fout[m3].i = scratch[5].i - scratch[4].r;
- } else {
- Fout[m].r = scratch[5].r + scratch[4].i;
- Fout[m].i = scratch[5].i - scratch[4].r;
- Fout[m3].r = scratch[5].r - scratch[4].i;
- Fout[m3].i = scratch[5].i + scratch[4].r;
- }
- ++Fout;
- } while (--k);
-}
-
-static void
-kf_bfly3 (kiss_fft_f32_cpx * Fout,
- const size_t fstride, const kiss_fft_f32_cfg st, size_t m)
-{
- size_t k = m;
- const size_t m2 = 2 * m;
- kiss_fft_f32_cpx *tw1, *tw2;
- kiss_fft_f32_cpx scratch[5];
- kiss_fft_f32_cpx epi3;
-
- epi3 = st->twiddles[fstride * m];
-
- tw1 = tw2 = st->twiddles;
-
- do {
- C_FIXDIV (*Fout, 3);
- C_FIXDIV (Fout[m], 3);
- C_FIXDIV (Fout[m2], 3);
-
- C_MUL (scratch[1], Fout[m], *tw1);
- C_MUL (scratch[2], Fout[m2], *tw2);
-
- C_ADD (scratch[3], scratch[1], scratch[2]);
- C_SUB (scratch[0], scratch[1], scratch[2]);
- tw1 += fstride;
- tw2 += fstride * 2;
-
- Fout[m].r = Fout->r - HALF_OF (scratch[3].r);
- Fout[m].i = Fout->i - HALF_OF (scratch[3].i);
-
- C_MULBYSCALAR (scratch[0], epi3.i);
-
- C_ADDTO (*Fout, scratch[3]);
-
- Fout[m2].r = Fout[m].r + scratch[0].i;
- Fout[m2].i = Fout[m].i - scratch[0].r;
-
- Fout[m].r -= scratch[0].i;
- Fout[m].i += scratch[0].r;
-
- ++Fout;
- } while (--k);
-}
-
-static void
-kf_bfly5 (kiss_fft_f32_cpx * Fout,
- const size_t fstride, const kiss_fft_f32_cfg st, int m)
-{
- kiss_fft_f32_cpx *Fout0, *Fout1, *Fout2, *Fout3, *Fout4;
- int u;
- kiss_fft_f32_cpx scratch[13];
- kiss_fft_f32_cpx *twiddles = st->twiddles;
- kiss_fft_f32_cpx *tw;
- kiss_fft_f32_cpx ya, yb;
-
- ya = twiddles[fstride * m];
- yb = twiddles[fstride * 2 * m];
-
- Fout0 = Fout;
- Fout1 = Fout0 + m;
- Fout2 = Fout0 + 2 * m;
- Fout3 = Fout0 + 3 * m;
- Fout4 = Fout0 + 4 * m;
-
- tw = st->twiddles;
- for (u = 0; u < m; ++u) {
- C_FIXDIV (*Fout0, 5);
- C_FIXDIV (*Fout1, 5);
- C_FIXDIV (*Fout2, 5);
- C_FIXDIV (*Fout3, 5);
- C_FIXDIV (*Fout4, 5);
- scratch[0] = *Fout0;
-
- C_MUL (scratch[1], *Fout1, tw[u * fstride]);
- C_MUL (scratch[2], *Fout2, tw[2 * u * fstride]);
- C_MUL (scratch[3], *Fout3, tw[3 * u * fstride]);
- C_MUL (scratch[4], *Fout4, tw[4 * u * fstride]);
-
- C_ADD (scratch[7], scratch[1], scratch[4]);
- C_SUB (scratch[10], scratch[1], scratch[4]);
- C_ADD (scratch[8], scratch[2], scratch[3]);
- C_SUB (scratch[9], scratch[2], scratch[3]);
-
- Fout0->r += scratch[7].r + scratch[8].r;
- Fout0->i += scratch[7].i + scratch[8].i;
-
- scratch[5].r =
- scratch[0].r + S_MUL (scratch[7].r, ya.r) + S_MUL (scratch[8].r, yb.r);
- scratch[5].i =
- scratch[0].i + S_MUL (scratch[7].i, ya.r) + S_MUL (scratch[8].i, yb.r);
-
- scratch[6].r = S_MUL (scratch[10].i, ya.i) + S_MUL (scratch[9].i, yb.i);
- scratch[6].i = -S_MUL (scratch[10].r, ya.i) - S_MUL (scratch[9].r, yb.i);
-
- C_SUB (*Fout1, scratch[5], scratch[6]);
- C_ADD (*Fout4, scratch[5], scratch[6]);
-
- scratch[11].r =
- scratch[0].r + S_MUL (scratch[7].r, yb.r) + S_MUL (scratch[8].r, ya.r);
- scratch[11].i =
- scratch[0].i + S_MUL (scratch[7].i, yb.r) + S_MUL (scratch[8].i, ya.r);
- scratch[12].r = -S_MUL (scratch[10].i, yb.i) + S_MUL (scratch[9].i, ya.i);
- scratch[12].i = S_MUL (scratch[10].r, yb.i) - S_MUL (scratch[9].r, ya.i);
-
- C_ADD (*Fout2, scratch[11], scratch[12]);
- C_SUB (*Fout3, scratch[11], scratch[12]);
-
- ++Fout0;
- ++Fout1;
- ++Fout2;
- ++Fout3;
- ++Fout4;
- }
-}
-
-/* perform the butterfly for one stage of a mixed radix FFT */
-static void
-kf_bfly_generic (kiss_fft_f32_cpx * Fout,
- const size_t fstride, const kiss_fft_f32_cfg st, int m, int p)
-{
- int u, k, q1, q;
- kiss_fft_f32_cpx *twiddles = st->twiddles;
- kiss_fft_f32_cpx t;
- int Norig = st->nfft;
-
- CHECKBUF (scratchbuf, nscratchbuf, p);
-
- for (u = 0; u < m; ++u) {
- k = u;
- for (q1 = 0; q1 < p; ++q1) {
- scratchbuf[q1] = Fout[k];
- C_FIXDIV (scratchbuf[q1], p);
- k += m;
- }
-
- k = u;
- for (q1 = 0; q1 < p; ++q1) {
- int twidx = 0;
-
- Fout[k] = scratchbuf[0];
- for (q = 1; q < p; ++q) {
- twidx += fstride * k;
- if (twidx >= Norig)
- twidx -= Norig;
- C_MUL (t, scratchbuf[q], twiddles[twidx]);
- C_ADDTO (Fout[k], t);
- }
- k += m;
- }
- }
-}
-
-static void
-kf_work (kiss_fft_f32_cpx * Fout,
- const kiss_fft_f32_cpx * f,
- const size_t fstride,
- int in_stride, int *factors, const kiss_fft_f32_cfg st)
-{
- kiss_fft_f32_cpx *Fout_beg = Fout;
- const int p = *factors++; /* the radix */
- const int m = *factors++; /* stage's fft length/p */
- const kiss_fft_f32_cpx *Fout_end = Fout + p * m;
-
- if (m == 1) {
- do {
- *Fout = *f;
- f += fstride * in_stride;
- } while (++Fout != Fout_end);
- } else {
- do {
- kf_work (Fout, f, fstride * p, in_stride, factors, st);
- f += fstride * in_stride;
- } while ((Fout += m) != Fout_end);
- }
-
- Fout = Fout_beg;
-
- switch (p) {
- case 2:
- kf_bfly2 (Fout, fstride, st, m);
- break;
- case 3:
- kf_bfly3 (Fout, fstride, st, m);
- break;
- case 4:
- kf_bfly4 (Fout, fstride, st, m);
- break;
- case 5:
- kf_bfly5 (Fout, fstride, st, m);
- break;
- default:
- kf_bfly_generic (Fout, fstride, st, m, p);
- break;
- }
-}
-
-/* facbuf is populated by p1,m1,p2,m2, ...
- where
- p[i] * m[i] = m[i-1]
- m0 = n */
-static void
-kf_factor (int n, int *facbuf)
-{
- int p = 4;
- double floor_sqrt;
-
- floor_sqrt = floor (sqrt ((double) n));
-
- /*factor out powers of 4, powers of 2, then any remaining primes */
- do {
- while (n % p) {
- switch (p) {
- case 4:
- p = 2;
- break;
- case 2:
- p = 3;
- break;
- default:
- p += 2;
- break;
- }
- if (p > floor_sqrt)
- p = n; /* no more factors, skip to end */
- }
- n /= p;
- *facbuf++ = p;
- *facbuf++ = n;
- } while (n > 1);
-}
-
-/*
- *
- * User-callable function to allocate all necessary storage space for the fft.
- *
- * The return value is a contiguous block of memory, allocated with malloc. As such,
- * It can be freed with free(), rather than a kiss_fft-specific function.
- * */
-kiss_fft_f32_cfg
-kiss_fft_f32_alloc (int nfft, int inverse_fft, void *mem, size_t * lenmem)
-{
- kiss_fft_f32_cfg st = NULL;
- size_t memneeded = sizeof (struct kiss_fft_f32_state)
- + sizeof (kiss_fft_f32_cpx) * (nfft - 1); /* twiddle factors */
-
- if (lenmem == NULL) {
- st = (kiss_fft_f32_cfg) KISS_FFT_F32_MALLOC (memneeded);
- } else {
- if (mem != NULL && *lenmem >= memneeded)
- st = (kiss_fft_f32_cfg) mem;
- *lenmem = memneeded;
- }
- if (st) {
- int i;
-
- st->nfft = nfft;
- st->inverse = inverse_fft;
-
- for (i = 0; i < nfft; ++i) {
- const double pi =
- 3.141592653589793238462643383279502884197169399375105820974944;
- double phase = -2 * pi * i / nfft;
-
- if (st->inverse)
- phase *= -1;
- kf_cexp (st->twiddles + i, phase);
- }
-
- kf_factor (nfft, st->factors);
- }
- return st;
-}
-
-
-
-
-void
-kiss_fft_f32_stride (kiss_fft_f32_cfg st, const kiss_fft_f32_cpx * fin,
- kiss_fft_f32_cpx * fout, int in_stride)
-{
- if (fin == fout) {
- CHECKBUF (tmpbuf, ntmpbuf, st->nfft);
- kf_work (tmpbuf, fin, 1, in_stride, st->factors, st);
- memcpy (fout, tmpbuf, sizeof (kiss_fft_f32_cpx) * st->nfft);
- } else {
- kf_work (fout, fin, 1, in_stride, st->factors, st);
- }
-}
-
-void
-kiss_fft_f32 (kiss_fft_f32_cfg cfg, const kiss_fft_f32_cpx * fin,
- kiss_fft_f32_cpx * fout)
-{
- kiss_fft_f32_stride (cfg, fin, fout, 1);
-}
-
-
-/* not really necessary to call, but if someone is doing in-place ffts, they may want to free the
- buffers from CHECKBUF
- */
-void
-kiss_fft_f32_cleanup (void)
-{
- free (scratchbuf);
- scratchbuf = NULL;
- nscratchbuf = 0;
- free (tmpbuf);
- tmpbuf = NULL;
- ntmpbuf = 0;
-}
-
-int
-kiss_fft_f32_next_fast_size (int n)
-{
- while (1) {
- int m = n;
-
- while ((m % 2) == 0)
- m /= 2;
- while ((m % 3) == 0)
- m /= 3;
- while ((m % 5) == 0)
- m /= 5;
- if (m <= 1)
- break; /* n is completely factorable by twos, threes, and fives */
- n++;
- }
- return n;
-}
diff --git a/gst-libs/gst/fft/kiss_fft_f32.h b/gst-libs/gst/fft/kiss_fft_f32.h
deleted file mode 100644
index 06a893d2..00000000
--- a/gst-libs/gst/fft/kiss_fft_f32.h
+++ /dev/null
@@ -1,99 +0,0 @@
-#ifndef KISS_FFT_F32_H
-#define KISS_FFT_F32_H
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <memory.h>
-#include <glib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- ATTENTION!
- If you would like a :
- -- a utility that will handle the caching of fft objects
- -- real-only (no imaginary time component ) FFT
- -- a multi-dimensional FFT
- -- a command-line utility to perform ffts
- -- a command-line utility to perform fast-convolution filtering
-
- Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c
- in the tools/ directory.
-*/
-
-#define KISS_FFT_F32_MALLOC g_malloc
-#define kiss_fft_f32_scalar float
-
-typedef struct {
- kiss_fft_f32_scalar r;
- kiss_fft_f32_scalar i;
-}kiss_fft_f32_cpx;
-
-typedef struct kiss_fft_f32_state* kiss_fft_f32_cfg;
-
-/*
- * kiss_fft_f32_alloc
- *
- * Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
- *
- * typical usage: kiss_fft_f32_cfg mycfg=kiss_fft_f32_alloc(1024,0,NULL,NULL);
- *
- * The return value from fft_alloc is a cfg buffer used internally
- * by the fft routine or NULL.
- *
- * If lenmem is NULL, then kiss_fft_f32_alloc will allocate a cfg buffer using malloc.
- * The returned value should be free()d when done to avoid memory leaks.
- *
- * The state can be placed in a user supplied buffer 'mem':
- * If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
- * then the function places the cfg in mem and the size used in *lenmem
- * and returns mem.
- *
- * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
- * then the function returns NULL and places the minimum cfg
- * buffer size in *lenmem.
- * */
-
-kiss_fft_f32_cfg kiss_fft_f32_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
-
-/*
- * kiss_fft(cfg,in_out_buf)
- *
- * Perform an FFT on a complex input buffer.
- * for a forward FFT,
- * fin should be f[0] , f[1] , ... ,f[nfft-1]
- * fout will be F[0] , F[1] , ... ,F[nfft-1]
- * Note that each element is complex and can be accessed like
- f[k].r and f[k].i
- * */
-void kiss_fft_f32(kiss_fft_f32_cfg cfg,const kiss_fft_f32_cpx *fin,kiss_fft_f32_cpx *fout);
-
-/*
- A more generic version of the above function. It reads its input from every Nth sample.
- * */
-void kiss_fft_f32_stride(kiss_fft_f32_cfg cfg,const kiss_fft_f32_cpx *fin,kiss_fft_f32_cpx *fout,int fin_stride);
-
-/* If kiss_fft_f32_alloc allocated a buffer, it is one contiguous
- buffer and can be simply free()d when no longer needed*/
-#define kiss_fft_f32_free g_free
-
-/*
- Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up
- your compiler output to call this before you exit.
-*/
-void kiss_fft_f32_cleanup(void);
-
-
-/*
- * Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5)
- */
-int kiss_fft_f32_next_fast_size(int n);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/gst-libs/gst/fft/kiss_fft_f64.c b/gst-libs/gst/fft/kiss_fft_f64.c
deleted file mode 100644
index 4f0cbc5a..00000000
--- a/gst-libs/gst/fft/kiss_fft_f64.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/*
-Copyright (c) 2003-2004, Mark Borgerding
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * 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.
- * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-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 OWNER 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.
-*/
-
-
-#include "_kiss_fft_guts_f64.h"
-/* The guts header contains all the multiplication and addition macros that are defined for
- fixed or floating point complex numbers. It also delares the kf_ internal functions.
- */
-
-static kiss_fft_f64_cpx *scratchbuf = NULL;
-static size_t nscratchbuf = 0;
-static kiss_fft_f64_cpx *tmpbuf = NULL;
-static size_t ntmpbuf = 0;
-
-#define CHECKBUF(buf,nbuf,n) \
- do { \
- if ( nbuf < (size_t)(n) ) {\
- free(buf); \
- buf = (kiss_fft_f64_cpx*)KISS_FFT_F64_MALLOC(sizeof(kiss_fft_f64_cpx)*(n)); \
- nbuf = (size_t)(n); \
- } \
- }while(0)
-
-
-static void
-kf_bfly2 (kiss_fft_f64_cpx * Fout,
- const size_t fstride, const kiss_fft_f64_cfg st, int m)
-{
- kiss_fft_f64_cpx *Fout2;
- kiss_fft_f64_cpx *tw1 = st->twiddles;
- kiss_fft_f64_cpx t;
-
- Fout2 = Fout + m;
- do {
- C_FIXDIV (*Fout, 2);
- C_FIXDIV (*Fout2, 2);
-
- C_MUL (t, *Fout2, *tw1);
- tw1 += fstride;
- C_SUB (*Fout2, *Fout, t);
- C_ADDTO (*Fout, t);
- ++Fout2;
- ++Fout;
- } while (--m);
-}
-
-static void
-kf_bfly4 (kiss_fft_f64_cpx * Fout,
- const size_t fstride, const kiss_fft_f64_cfg st, const size_t m)
-{
- kiss_fft_f64_cpx *tw1, *tw2, *tw3;
- kiss_fft_f64_cpx scratch[6];
- size_t k = m;
- const size_t m2 = 2 * m;
- const size_t m3 = 3 * m;
-
- tw3 = tw2 = tw1 = st->twiddles;
-
- do {
- C_FIXDIV (*Fout, 4);
- C_FIXDIV (Fout[m], 4);
- C_FIXDIV (Fout[m2], 4);
- C_FIXDIV (Fout[m3], 4);
-
- C_MUL (scratch[0], Fout[m], *tw1);
- C_MUL (scratch[1], Fout[m2], *tw2);
- C_MUL (scratch[2], Fout[m3], *tw3);
-
- C_SUB (scratch[5], *Fout, scratch[1]);
- C_ADDTO (*Fout, scratch[1]);
- C_ADD (scratch[3], scratch[0], scratch[2]);
- C_SUB (scratch[4], scratch[0], scratch[2]);
- C_SUB (Fout[m2], *Fout, scratch[3]);
- tw1 += fstride;
- tw2 += fstride * 2;
- tw3 += fstride * 3;
- C_ADDTO (*Fout, scratch[3]);
-
- if (st->inverse) {
- Fout[m].r = scratch[5].r - scratch[4].i;
- Fout[m].i = scratch[5].i + scratch[4].r;
- Fout[m3].r = scratch[5].r + scratch[4].i;
- Fout[m3].i = scratch[5].i - scratch[4].r;
- } else {
- Fout[m].r = scratch[5].r + scratch[4].i;
- Fout[m].i = scratch[5].i - scratch[4].r;
- Fout[m3].r = scratch[5].r - scratch[4].i;
- Fout[m3].i = scratch[5].i + scratch[4].r;
- }
- ++Fout;
- } while (--k);
-}
-
-static void
-kf_bfly3 (kiss_fft_f64_cpx * Fout,
- const size_t fstride, const kiss_fft_f64_cfg st, size_t m)
-{
- size_t k = m;
- const size_t m2 = 2 * m;
- kiss_fft_f64_cpx *tw1, *tw2;
- kiss_fft_f64_cpx scratch[5];
- kiss_fft_f64_cpx epi3;
-
- epi3 = st->twiddles[fstride * m];
-
- tw1 = tw2 = st->twiddles;
-
- do {
- C_FIXDIV (*Fout, 3);
- C_FIXDIV (Fout[m], 3);
- C_FIXDIV (Fout[m2], 3);
-
- C_MUL (scratch[1], Fout[m], *tw1);
- C_MUL (scratch[2], Fout[m2], *tw2);
-
- C_ADD (scratch[3], scratch[1], scratch[2]);
- C_SUB (scratch[0], scratch[1], scratch[2]);
- tw1 += fstride;
- tw2 += fstride * 2;
-
- Fout[m].r = Fout->r - HALF_OF (scratch[3].r);
- Fout[m].i = Fout->i - HALF_OF (scratch[3].i);
-
- C_MULBYSCALAR (scratch[0], epi3.i);
-
- C_ADDTO (*Fout, scratch[3]);
-
- Fout[m2].r = Fout[m].r + scratch[0].i;
- Fout[m2].i = Fout[m].i - scratch[0].r;
-
- Fout[m].r -= scratch[0].i;
- Fout[m].i += scratch[0].r;
-
- ++Fout;
- } while (--k);
-}
-
-static void
-kf_bfly5 (kiss_fft_f64_cpx * Fout,
- const size_t fstride, const kiss_fft_f64_cfg st, int m)
-{
- kiss_fft_f64_cpx *Fout0, *Fout1, *Fout2, *Fout3, *Fout4;
- int u;
- kiss_fft_f64_cpx scratch[13];
- kiss_fft_f64_cpx *twiddles = st->twiddles;
- kiss_fft_f64_cpx *tw;
- kiss_fft_f64_cpx ya, yb;
-
- ya = twiddles[fstride * m];
- yb = twiddles[fstride * 2 * m];
-
- Fout0 = Fout;
- Fout1 = Fout0 + m;
- Fout2 = Fout0 + 2 * m;
- Fout3 = Fout0 + 3 * m;
- Fout4 = Fout0 + 4 * m;
-
- tw = st->twiddles;
- for (u = 0; u < m; ++u) {
- C_FIXDIV (*Fout0, 5);
- C_FIXDIV (*Fout1, 5);
- C_FIXDIV (*Fout2, 5);
- C_FIXDIV (*Fout3, 5);
- C_FIXDIV (*Fout4, 5);
- scratch[0] = *Fout0;
-
- C_MUL (scratch[1], *Fout1, tw[u * fstride]);
- C_MUL (scratch[2], *Fout2, tw[2 * u * fstride]);
- C_MUL (scratch[3], *Fout3, tw[3 * u * fstride]);
- C_MUL (scratch[4], *Fout4, tw[4 * u * fstride]);
-
- C_ADD (scratch[7], scratch[1], scratch[4]);
- C_SUB (scratch[10], scratch[1], scratch[4]);
- C_ADD (scratch[8], scratch[2], scratch[3]);
- C_SUB (scratch[9], scratch[2], scratch[3]);
-
- Fout0->r += scratch[7].r + scratch[8].r;
- Fout0->i += scratch[7].i + scratch[8].i;
-
- scratch[5].r =
- scratch[0].r + S_MUL (scratch[7].r, ya.r) + S_MUL (scratch[8].r, yb.r);
- scratch[5].i =
- scratch[0].i + S_MUL (scratch[7].i, ya.r) + S_MUL (scratch[8].i, yb.r);
-
- scratch[6].r = S_MUL (scratch[10].i, ya.i) + S_MUL (scratch[9].i, yb.i);
- scratch[6].i = -S_MUL (scratch[10].r, ya.i) - S_MUL (scratch[9].r, yb.i);
-
- C_SUB (*Fout1, scratch[5], scratch[6]);
- C_ADD (*Fout4, scratch[5], scratch[6]);
-
- scratch[11].r =
- scratch[0].r + S_MUL (scratch[7].r, yb.r) + S_MUL (scratch[8].r, ya.r);
- scratch[11].i =
- scratch[0].i + S_MUL (scratch[7].i, yb.r) + S_MUL (scratch[8].i, ya.r);
- scratch[12].r = -S_MUL (scratch[10].i, yb.i) + S_MUL (scratch[9].i, ya.i);
- scratch[12].i = S_MUL (scratch[10].r, yb.i) - S_MUL (scratch[9].r, ya.i);
-
- C_ADD (*Fout2, scratch[11], scratch[12]);
- C_SUB (*Fout3, scratch[11], scratch[12]);
-
- ++Fout0;
- ++Fout1;
- ++Fout2;
- ++Fout3;
- ++Fout4;
- }
-}
-
-/* perform the butterfly for one stage of a mixed radix FFT */
-static void
-kf_bfly_generic (kiss_fft_f64_cpx * Fout,
- const size_t fstride, const kiss_fft_f64_cfg st, int m, int p)
-{
- int u, k, q1, q;
- kiss_fft_f64_cpx *twiddles = st->twiddles;
- kiss_fft_f64_cpx t;
- int Norig = st->nfft;
-
- CHECKBUF (scratchbuf, nscratchbuf, p);
-
- for (u = 0; u < m; ++u) {
- k = u;
- for (q1 = 0; q1 < p; ++q1) {
- scratchbuf[q1] = Fout[k];
- C_FIXDIV (scratchbuf[q1], p);
- k += m;
- }
-
- k = u;
- for (q1 = 0; q1 < p; ++q1) {
- int twidx = 0;
-
- Fout[k] = scratchbuf[0];
- for (q = 1; q < p; ++q) {
- twidx += fstride * k;
- if (twidx >= Norig)
- twidx -= Norig;
- C_MUL (t, scratchbuf[q], twiddles[twidx]);
- C_ADDTO (Fout[k], t);
- }
- k += m;
- }
- }
-}
-
-static void
-kf_work (kiss_fft_f64_cpx * Fout,
- const kiss_fft_f64_cpx * f,
- const size_t fstride,
- int in_stride, int *factors, const kiss_fft_f64_cfg st)
-{
- kiss_fft_f64_cpx *Fout_beg = Fout;
- const int p = *factors++; /* the radix */
- const int m = *factors++; /* stage's fft length/p */
- const kiss_fft_f64_cpx *Fout_end = Fout + p * m;
-
- if (m == 1) {
- do {
- *Fout = *f;
- f += fstride * in_stride;
- } while (++Fout != Fout_end);
- } else {
- do {
- kf_work (Fout, f, fstride * p, in_stride, factors, st);
- f += fstride * in_stride;
- } while ((Fout += m) != Fout_end);
- }
-
- Fout = Fout_beg;
-
- switch (p) {
- case 2:
- kf_bfly2 (Fout, fstride, st, m);
- break;
- case 3:
- kf_bfly3 (Fout, fstride, st, m);
- break;
- case 4:
- kf_bfly4 (Fout, fstride, st, m);
- break;
- case 5:
- kf_bfly5 (Fout, fstride, st, m);
- break;
- default:
- kf_bfly_generic (Fout, fstride, st, m, p);
- break;
- }
-}
-
-/* facbuf is populated by p1,m1,p2,m2, ...
- where
- p[i] * m[i] = m[i-1]
- m0 = n */
-static void
-kf_factor (int n, int *facbuf)
-{
- int p = 4;
- double floor_sqrt;
-
- floor_sqrt = floor (sqrt ((double) n));
-
- /*factor out powers of 4, powers of 2, then any remaining primes */
- do {
- while (n % p) {
- switch (p) {
- case 4:
- p = 2;
- break;
- case 2:
- p = 3;
- break;
- default:
- p += 2;
- break;
- }
- if (p > floor_sqrt)
- p = n; /* no more factors, skip to end */
- }
- n /= p;
- *facbuf++ = p;
- *facbuf++ = n;
- } while (n > 1);
-}
-
-/*
- *
- * User-callable function to allocate all necessary storage space for the fft.
- *
- * The return value is a contiguous block of memory, allocated with malloc. As such,
- * It can be freed with free(), rather than a kiss_fft-specific function.
- * */
-kiss_fft_f64_cfg
-kiss_fft_f64_alloc (int nfft, int inverse_fft, void *mem, size_t * lenmem)
-{
- kiss_fft_f64_cfg st = NULL;
- const double pi =
- 3.141592653589793238462643383279502884197169399375105820974944;
- size_t memneeded = sizeof (struct kiss_fft_f64_state)
- + sizeof (kiss_fft_f64_cpx) * (nfft - 1); /* twiddle factors */
-
- if (lenmem == NULL) {
- st = (kiss_fft_f64_cfg) KISS_FFT_F64_MALLOC (memneeded);
- } else {
- if (mem != NULL && *lenmem >= memneeded)
- st = (kiss_fft_f64_cfg) mem;
- *lenmem = memneeded;
- }
- if (st) {
- int i;
-
- st->nfft = nfft;
- st->inverse = inverse_fft;
-
- for (i = 0; i < nfft; ++i) {
- double phase = -2 * pi * i / nfft;
-
- if (st->inverse)
- phase *= -1;
- kf_cexp (st->twiddles + i, phase);
- }
-
- kf_factor (nfft, st->factors);
- }
- return st;
-}
-
-
-
-
-void
-kiss_fft_f64_stride (kiss_fft_f64_cfg st, const kiss_fft_f64_cpx * fin,
- kiss_fft_f64_cpx * fout, int in_stride)
-{
- if (fin == fout) {
- CHECKBUF (tmpbuf, ntmpbuf, st->nfft);
- kf_work (tmpbuf, fin, 1, in_stride, st->factors, st);
- memcpy (fout, tmpbuf, sizeof (kiss_fft_f64_cpx) * st->nfft);
- } else {
- kf_work (fout, fin, 1, in_stride, st->factors, st);
- }
-}
-
-void
-kiss_fft_f64 (kiss_fft_f64_cfg cfg, const kiss_fft_f64_cpx * fin,
- kiss_fft_f64_cpx * fout)
-{
- kiss_fft_f64_stride (cfg, fin, fout, 1);
-}
-
-
-/* not really necessary to call, but if someone is doing in-place ffts, they may want to free the
- buffers from CHECKBUF
- */
-void
-kiss_fft_f64_cleanup (void)
-{
- free (scratchbuf);
- scratchbuf = NULL;
- nscratchbuf = 0;
- free (tmpbuf);
- tmpbuf = NULL;
- ntmpbuf = 0;
-}
-
-int
-kiss_fft_f64_next_fast_size (int n)
-{
- while (1) {
- int m = n;
-
- while ((m % 2) == 0)
- m /= 2;
- while ((m % 3) == 0)
- m /= 3;
- while ((m % 5) == 0)
- m /= 5;
- if (m <= 1)
- break; /* n is completely factorable by twos, threes, and fives */
- n++;
- }
- return n;
-}
diff --git a/gst-libs/gst/fft/kiss_fft_f64.h b/gst-libs/gst/fft/kiss_fft_f64.h
deleted file mode 100644
index 572b33ab..00000000
--- a/gst-libs/gst/fft/kiss_fft_f64.h
+++ /dev/null
@@ -1,99 +0,0 @@
-#ifndef KISS_FFT_F64_H
-#define KISS_FFT_F64_H
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <memory.h>
-#include <glib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- ATTENTION!
- If you would like a :
- -- a utility that will handle the caching of fft objects
- -- real-only (no imaginary time component ) FFT
- -- a multi-dimensional FFT
- -- a command-line utility to perform ffts
- -- a command-line utility to perform fast-convolution filtering
-
- Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c
- in the tools/ directory.
-*/
-
-#define KISS_FFT_F64_MALLOC g_malloc
-#define kiss_fft_f64_scalar double
-
-typedef struct {
- kiss_fft_f64_scalar r;
- kiss_fft_f64_scalar i;
-}kiss_fft_f64_cpx;
-
-typedef struct kiss_fft_f64_state* kiss_fft_f64_cfg;
-
-/*
- * kiss_fft_f64_alloc
- *
- * Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
- *
- * typical usage: kiss_fft_f64_cfg mycfg=kiss_fft_f64_alloc(1024,0,NULL,NULL);
- *
- * The return value from fft_alloc is a cfg buffer used internally
- * by the fft routine or NULL.
- *
- * If lenmem is NULL, then kiss_fft_f64_alloc will allocate a cfg buffer using malloc.
- * The returned value should be free()d when done to avoid memory leaks.
- *
- * The state can be placed in a user supplied buffer 'mem':
- * If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
- * then the function places the cfg in mem and the size used in *lenmem
- * and returns mem.
- *
- * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
- * then the function returns NULL and places the minimum cfg
- * buffer size in *lenmem.
- * */
-
-kiss_fft_f64_cfg kiss_fft_f64_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
-
-/*
- * kiss_fft(cfg,in_out_buf)
- *
- * Perform an FFT on a complex input buffer.
- * for a forward FFT,
- * fin should be f[0] , f[1] , ... ,f[nfft-1]
- * fout will be F[0] , F[1] , ... ,F[nfft-1]
- * Note that each element is complex and can be accessed like
- f[k].r and f[k].i
- * */
-void kiss_fft_f64(kiss_fft_f64_cfg cfg,const kiss_fft_f64_cpx *fin,kiss_fft_f64_cpx *fout);
-
-/*
- A more generic version of the above function. It reads its input from every Nth sample.
- * */
-void kiss_fft_f64_stride(kiss_fft_f64_cfg cfg,const kiss_fft_f64_cpx *fin,kiss_fft_f64_cpx *fout,int fin_stride);
-
-/* If kiss_fft_f64_alloc allocated a buffer, it is one contiguous
- buffer and can be simply free()d when no longer needed*/
-#define kiss_fft_f64_free g_free
-
-/*
- Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up
- your compiler output to call this before you exit.
-*/
-void kiss_fft_f64_cleanup(void);
-
-
-/*
- * Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5)
- */
-int kiss_fft_f64_next_fast_size(int n);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/gst-libs/gst/fft/kiss_fft_s16.c b/gst-libs/gst/fft/kiss_fft_s16.c
deleted file mode 100644
index ca20004b..00000000
--- a/gst-libs/gst/fft/kiss_fft_s16.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/*
-Copyright (c) 2003-2004, Mark Borgerding
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * 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.
- * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-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 OWNER 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.
-*/
-
-
-#include "_kiss_fft_guts_s16.h"
-/* The guts header contains all the multiplication and addition macros that are defined for
- fixed or floating point complex numbers. It also delares the kf_ internal functions.
- */
-
-static kiss_fft_s16_cpx *scratchbuf = NULL;
-static size_t nscratchbuf = 0;
-static kiss_fft_s16_cpx *tmpbuf = NULL;
-static size_t ntmpbuf = 0;
-
-#define CHECKBUF(buf,nbuf,n) \
- do { \
- if ( nbuf < (size_t)(n) ) {\
- free(buf); \
- buf = (kiss_fft_s16_cpx*)KISS_FFT_S16_MALLOC(sizeof(kiss_fft_s16_cpx)*(n)); \
- nbuf = (size_t)(n); \
- } \
- }while(0)
-
-
-static void
-kf_bfly2 (kiss_fft_s16_cpx * Fout,
- const size_t fstride, const kiss_fft_s16_cfg st, int m)
-{
- kiss_fft_s16_cpx *Fout2;
- kiss_fft_s16_cpx *tw1 = st->twiddles;
- kiss_fft_s16_cpx t;
-
- Fout2 = Fout + m;
- do {
- C_FIXDIV (*Fout, 2);
- C_FIXDIV (*Fout2, 2);
-
- C_MUL (t, *Fout2, *tw1);
- tw1 += fstride;
- C_SUB (*Fout2, *Fout, t);
- C_ADDTO (*Fout, t);
- ++Fout2;
- ++Fout;
- } while (--m);
-}
-
-static void
-kf_bfly4 (kiss_fft_s16_cpx * Fout,
- const size_t fstride, const kiss_fft_s16_cfg st, const size_t m)
-{
- kiss_fft_s16_cpx *tw1, *tw2, *tw3;
- kiss_fft_s16_cpx scratch[6];
- size_t k = m;
- const size_t m2 = 2 * m;
- const size_t m3 = 3 * m;
-
- tw3 = tw2 = tw1 = st->twiddles;
-
- do {
- C_FIXDIV (*Fout, 4);
- C_FIXDIV (Fout[m], 4);
- C_FIXDIV (Fout[m2], 4);
- C_FIXDIV (Fout[m3], 4);
-
- C_MUL (scratch[0], Fout[m], *tw1);
- C_MUL (scratch[1], Fout[m2], *tw2);
- C_MUL (scratch[2], Fout[m3], *tw3);
-
- C_SUB (scratch[5], *Fout, scratch[1]);
- C_ADDTO (*Fout, scratch[1]);
- C_ADD (scratch[3], scratch[0], scratch[2]);
- C_SUB (scratch[4], scratch[0], scratch[2]);
- C_SUB (Fout[m2], *Fout, scratch[3]);
- tw1 += fstride;
- tw2 += fstride * 2;
- tw3 += fstride * 3;
- C_ADDTO (*Fout, scratch[3]);
-
- if (st->inverse) {
- Fout[m].r = scratch[5].r - scratch[4].i;
- Fout[m].i = scratch[5].i + scratch[4].r;
- Fout[m3].r = scratch[5].r + scratch[4].i;
- Fout[m3].i = scratch[5].i - scratch[4].r;
- } else {
- Fout[m].r = scratch[5].r + scratch[4].i;
- Fout[m].i = scratch[5].i - scratch[4].r;
- Fout[m3].r = scratch[5].r - scratch[4].i;
- Fout[m3].i = scratch[5].i + scratch[4].r;
- }
- ++Fout;
- } while (--k);
-}
-
-static void
-kf_bfly3 (kiss_fft_s16_cpx * Fout,
- const size_t fstride, const kiss_fft_s16_cfg st, size_t m)
-{
- size_t k = m;
- const size_t m2 = 2 * m;
- kiss_fft_s16_cpx *tw1, *tw2;
- kiss_fft_s16_cpx scratch[5];
- kiss_fft_s16_cpx epi3;
-
- epi3 = st->twiddles[fstride * m];
-
- tw1 = tw2 = st->twiddles;
-
- do {
- C_FIXDIV (*Fout, 3);
- C_FIXDIV (Fout[m], 3);
- C_FIXDIV (Fout[m2], 3);
-
- C_MUL (scratch[1], Fout[m], *tw1);
- C_MUL (scratch[2], Fout[m2], *tw2);
-
- C_ADD (scratch[3], scratch[1], scratch[2]);
- C_SUB (scratch[0], scratch[1], scratch[2]);
- tw1 += fstride;
- tw2 += fstride * 2;
-
- Fout[m].r = Fout->r - HALF_OF (scratch[3].r);
- Fout[m].i = Fout->i - HALF_OF (scratch[3].i);
-
- C_MULBYSCALAR (scratch[0], epi3.i);
-
- C_ADDTO (*Fout, scratch[3]);
-
- Fout[m2].r = Fout[m].r + scratch[0].i;
- Fout[m2].i = Fout[m].i - scratch[0].r;
-
- Fout[m].r -= scratch[0].i;
- Fout[m].i += scratch[0].r;
-
- ++Fout;
- } while (--k);
-}
-
-static void
-kf_bfly5 (kiss_fft_s16_cpx * Fout,
- const size_t fstride, const kiss_fft_s16_cfg st, int m)
-{
- kiss_fft_s16_cpx *Fout0, *Fout1, *Fout2, *Fout3, *Fout4;
- int u;
- kiss_fft_s16_cpx scratch[13];
- kiss_fft_s16_cpx *twiddles = st->twiddles;
- kiss_fft_s16_cpx *tw;
- kiss_fft_s16_cpx ya, yb;
-
- ya = twiddles[fstride * m];
- yb = twiddles[fstride * 2 * m];
-
- Fout0 = Fout;
- Fout1 = Fout0 + m;
- Fout2 = Fout0 + 2 * m;
- Fout3 = Fout0 + 3 * m;
- Fout4 = Fout0 + 4 * m;
-
- tw = st->twiddles;
- for (u = 0; u < m; ++u) {
- C_FIXDIV (*Fout0, 5);
- C_FIXDIV (*Fout1, 5);
- C_FIXDIV (*Fout2, 5);
- C_FIXDIV (*Fout3, 5);
- C_FIXDIV (*Fout4, 5);
- scratch[0] = *Fout0;
-
- C_MUL (scratch[1], *Fout1, tw[u * fstride]);
- C_MUL (scratch[2], *Fout2, tw[2 * u * fstride]);
- C_MUL (scratch[3], *Fout3, tw[3 * u * fstride]);
- C_MUL (scratch[4], *Fout4, tw[4 * u * fstride]);
-
- C_ADD (scratch[7], scratch[1], scratch[4]);
- C_SUB (scratch[10], scratch[1], scratch[4]);
- C_ADD (scratch[8], scratch[2], scratch[3]);
- C_SUB (scratch[9], scratch[2], scratch[3]);
-
- Fout0->r += scratch[7].r + scratch[8].r;
- Fout0->i += scratch[7].i + scratch[8].i;
-
- scratch[5].r =
- scratch[0].r + S_MUL (scratch[7].r, ya.r) + S_MUL (scratch[8].r, yb.r);
- scratch[5].i =
- scratch[0].i + S_MUL (scratch[7].i, ya.r) + S_MUL (scratch[8].i, yb.r);
-
- scratch[6].r = S_MUL (scratch[10].i, ya.i) + S_MUL (scratch[9].i, yb.i);
- scratch[6].i = -S_MUL (scratch[10].r, ya.i) - S_MUL (scratch[9].r, yb.i);
-
- C_SUB (*Fout1, scratch[5], scratch[6]);
- C_ADD (*Fout4, scratch[5], scratch[6]);
-
- scratch[11].r =
- scratch[0].r + S_MUL (scratch[7].r, yb.r) + S_MUL (scratch[8].r, ya.r);
- scratch[11].i =
- scratch[0].i + S_MUL (scratch[7].i, yb.r) + S_MUL (scratch[8].i, ya.r);
- scratch[12].r = -S_MUL (scratch[10].i, yb.i) + S_MUL (scratch[9].i, ya.i);
- scratch[12].i = S_MUL (scratch[10].r, yb.i) - S_MUL (scratch[9].r, ya.i);
-
- C_ADD (*Fout2, scratch[11], scratch[12]);
- C_SUB (*Fout3, scratch[11], scratch[12]);
-
- ++Fout0;
- ++Fout1;
- ++Fout2;
- ++Fout3;
- ++Fout4;
- }
-}
-
-/* perform the butterfly for one stage of a mixed radix FFT */
-static void
-kf_bfly_generic (kiss_fft_s16_cpx * Fout,
- const size_t fstride, const kiss_fft_s16_cfg st, int m, int p)
-{
- int u, k, q1, q;
- kiss_fft_s16_cpx *twiddles = st->twiddles;
- kiss_fft_s16_cpx t;
- int Norig = st->nfft;
-
- CHECKBUF (scratchbuf, nscratchbuf, p);
-
- for (u = 0; u < m; ++u) {
- k = u;
- for (q1 = 0; q1 < p; ++q1) {
- scratchbuf[q1] = Fout[k];
- C_FIXDIV (scratchbuf[q1], p);
- k += m;
- }
-
- k = u;
- for (q1 = 0; q1 < p; ++q1) {
- int twidx = 0;
-
- Fout[k] = scratchbuf[0];
- for (q = 1; q < p; ++q) {
- twidx += fstride * k;
- if (twidx >= Norig)
- twidx -= Norig;
- C_MUL (t, scratchbuf[q], twiddles[twidx]);
- C_ADDTO (Fout[k], t);
- }
- k += m;
- }
- }
-}
-
-static void
-kf_work (kiss_fft_s16_cpx * Fout,
- const kiss_fft_s16_cpx * f,
- const size_t fstride,
- int in_stride, int *factors, const kiss_fft_s16_cfg st)
-{
- kiss_fft_s16_cpx *Fout_beg = Fout;
- const int p = *factors++; /* the radix */
- const int m = *factors++; /* stage's fft length/p */
- const kiss_fft_s16_cpx *Fout_end = Fout + p * m;
-
- if (m == 1) {
- do {
- *Fout = *f;
- f += fstride * in_stride;
- } while (++Fout != Fout_end);
- } else {
- do {
- kf_work (Fout, f, fstride * p, in_stride, factors, st);
- f += fstride * in_stride;
- } while ((Fout += m) != Fout_end);
- }
-
- Fout = Fout_beg;
-
- switch (p) {
- case 2:
- kf_bfly2 (Fout, fstride, st, m);
- break;
- case 3:
- kf_bfly3 (Fout, fstride, st, m);
- break;
- case 4:
- kf_bfly4 (Fout, fstride, st, m);
- break;
- case 5:
- kf_bfly5 (Fout, fstride, st, m);
- break;
- default:
- kf_bfly_generic (Fout, fstride, st, m, p);
- break;
- }
-}
-
-/* facbuf is populated by p1,m1,p2,m2, ...
- where
- p[i] * m[i] = m[i-1]
- m0 = n */
-static void
-kf_factor (int n, int *facbuf)
-{
- int p = 4;
- double floor_sqrt;
-
- floor_sqrt = floor (sqrt ((double) n));
-
- /*factor out powers of 4, powers of 2, then any remaining primes */
- do {
- while (n % p) {
- switch (p) {
- case 4:
- p = 2;
- break;
- case 2:
- p = 3;
- break;
- default:
- p += 2;
- break;
- }
- if (p > floor_sqrt)
- p = n; /* no more factors, skip to end */
- }
- n /= p;
- *facbuf++ = p;
- *facbuf++ = n;
- } while (n > 1);
-}
-
-/*
- *
- * User-callable function to allocate all necessary storage space for the fft.
- *
- * The return value is a contiguous block of memory, allocated with malloc. As such,
- * It can be freed with free(), rather than a kiss_fft-specific function.
- * */
-kiss_fft_s16_cfg
-kiss_fft_s16_alloc (int nfft, int inverse_fft, void *mem, size_t * lenmem)
-{
- kiss_fft_s16_cfg st = NULL;
- size_t memneeded = sizeof (struct kiss_fft_s16_state)
- + sizeof (kiss_fft_s16_cpx) * (nfft - 1); /* twiddle factors */
-
- if (lenmem == NULL) {
- st = (kiss_fft_s16_cfg) KISS_FFT_S16_MALLOC (memneeded);
- } else {
- if (mem != NULL && *lenmem >= memneeded)
- st = (kiss_fft_s16_cfg) mem;
- *lenmem = memneeded;
- }
- if (st) {
- int i;
-
- st->nfft = nfft;
- st->inverse = inverse_fft;
-
- for (i = 0; i < nfft; ++i) {
- const double pi =
- 3.141592653589793238462643383279502884197169399375105820974944;
- double phase = -2 * pi * i / nfft;
-
- if (st->inverse)
- phase *= -1;
- kf_cexp (st->twiddles + i, phase);
- }
-
- kf_factor (nfft, st->factors);
- }
- return st;
-}
-
-
-
-
-void
-kiss_fft_s16_stride (kiss_fft_s16_cfg st, const kiss_fft_s16_cpx * fin,
- kiss_fft_s16_cpx * fout, int in_stride)
-{
- if (fin == fout) {
- CHECKBUF (tmpbuf, ntmpbuf, st->nfft);
- kf_work (tmpbuf, fin, 1, in_stride, st->factors, st);
- memcpy (fout, tmpbuf, sizeof (kiss_fft_s16_cpx) * st->nfft);
- } else {
- kf_work (fout, fin, 1, in_stride, st->factors, st);
- }
-}
-
-void
-kiss_fft_s16 (kiss_fft_s16_cfg cfg, const kiss_fft_s16_cpx * fin,
- kiss_fft_s16_cpx * fout)
-{
- kiss_fft_s16_stride (cfg, fin, fout, 1);
-}
-
-
-/* not really necessary to call, but if someone is doing in-place ffts, they may want to free the
- buffers from CHECKBUF
- */
-void
-kiss_fft_s16_cleanup (void)
-{
- free (scratchbuf);
- scratchbuf = NULL;
- nscratchbuf = 0;
- free (tmpbuf);
- tmpbuf = NULL;
- ntmpbuf = 0;
-}
-
-int
-kiss_fft_s16_next_fast_size (int n)
-{
- while (1) {
- int m = n;
-
- while ((m % 2) == 0)
- m /= 2;
- while ((m % 3) == 0)
- m /= 3;
- while ((m % 5) == 0)
- m /= 5;
- if (m <= 1)
- break; /* n is completely factorable by twos, threes, and fives */
- n++;
- }
- return n;
-}
diff --git a/gst-libs/gst/fft/kiss_fft_s16.h b/gst-libs/gst/fft/kiss_fft_s16.h
deleted file mode 100644
index 9e229055..00000000
--- a/gst-libs/gst/fft/kiss_fft_s16.h
+++ /dev/null
@@ -1,102 +0,0 @@
-#ifndef KISS_FFT_S16_H
-#define KISS_FFT_S16_H
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <memory.h>
-#include <glib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- ATTENTION!
- If you would like a :
- -- a utility that will handle the caching of fft objects
- -- real-only (no imaginary time component ) FFT
- -- a multi-dimensional FFT
- -- a command-line utility to perform ffts
- -- a command-line utility to perform fast-convolution filtering
-
- Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c
- in the tools/ directory.
-*/
-
-#define KISS_FFT_S16_MALLOC g_malloc
-
-#include "_stdint.h"
-
-#define kiss_fft_s16_scalar int16_t
-
-typedef struct {
- kiss_fft_s16_scalar r;
- kiss_fft_s16_scalar i;
-}kiss_fft_s16_cpx;
-
-typedef struct kiss_fft_s16_state* kiss_fft_s16_cfg;
-
-/*
- * kiss_fft_s16_alloc
- *
- * Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
- *
- * typical usage: kiss_fft_s16_cfg mycfg=kiss_fft_s16_alloc(1024,0,NULL,NULL);
- *
- * The return value from fft_alloc is a cfg buffer used internally
- * by the fft routine or NULL.
- *
- * If lenmem is NULL, then kiss_fft_s16_alloc will allocate a cfg buffer using malloc.
- * The returned value should be free()d when done to avoid memory leaks.
- *
- * The state can be placed in a user supplied buffer 'mem':
- * If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
- * then the function places the cfg in mem and the size used in *lenmem
- * and returns mem.
- *
- * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
- * then the function returns NULL and places the minimum cfg
- * buffer size in *lenmem.
- * */
-
-kiss_fft_s16_cfg kiss_fft_s16_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
-
-/*
- * kiss_fft(cfg,in_out_buf)
- *
- * Perform an FFT on a complex input buffer.
- * for a forward FFT,
- * fin should be f[0] , f[1] , ... ,f[nfft-1]
- * fout will be F[0] , F[1] , ... ,F[nfft-1]
- * Note that each element is complex and can be accessed like
- f[k].r and f[k].i
- * */
-void kiss_fft_s16(kiss_fft_s16_cfg cfg,const kiss_fft_s16_cpx *fin,kiss_fft_s16_cpx *fout);
-
-/*
- A more generic version of the above function. It reads its input from every Nth sample.
- * */
-void kiss_fft_s16_stride(kiss_fft_s16_cfg cfg,const kiss_fft_s16_cpx *fin,kiss_fft_s16_cpx *fout,int fin_stride);
-
-/* If kiss_fft_s16_alloc allocated a buffer, it is one contiguous
- buffer and can be simply free()d when no longer needed*/
-#define kiss_fft_s16_free g_free
-
-/*
- Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up
- your compiler output to call this before you exit.
-*/
-void kiss_fft_s16_cleanup(void);
-
-
-/*
- * Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5)
- */
-int kiss_fft_s16_next_fast_size(int n);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/gst-libs/gst/fft/kiss_fft_s32.c b/gst-libs/gst/fft/kiss_fft_s32.c
deleted file mode 100644
index 760013c2..00000000
--- a/gst-libs/gst/fft/kiss_fft_s32.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/*
-Copyright (c) 2003-2004, Mark Borgerding
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * 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.
- * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-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 OWNER 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.
-*/
-
-
-#include "_kiss_fft_guts_s32.h"
-/* The guts header contains all the multiplication and addition macros that are defined for
- fixed or floating point complex numbers. It also delares the kf_ internal functions.
- */
-
-static kiss_fft_s32_cpx *scratchbuf = NULL;
-static size_t nscratchbuf = 0;
-static kiss_fft_s32_cpx *tmpbuf = NULL;
-static size_t ntmpbuf = 0;
-
-#define CHECKBUF(buf,nbuf,n) \
- do { \
- if ( nbuf < (size_t)(n) ) {\
- free(buf); \
- buf = (kiss_fft_s32_cpx*)KISS_FFT_S32_MALLOC(sizeof(kiss_fft_s32_cpx)*(n)); \
- nbuf = (size_t)(n); \
- } \
- }while(0)
-
-
-static void
-kf_bfly2 (kiss_fft_s32_cpx * Fout,
- const size_t fstride, const kiss_fft_s32_cfg st, int m)
-{
- kiss_fft_s32_cpx *Fout2;
- kiss_fft_s32_cpx *tw1 = st->twiddles;
- kiss_fft_s32_cpx t;
-
- Fout2 = Fout + m;
- do {
- C_FIXDIV (*Fout, 2);
- C_FIXDIV (*Fout2, 2);
-
- C_MUL (t, *Fout2, *tw1);
- tw1 += fstride;
- C_SUB (*Fout2, *Fout, t);
- C_ADDTO (*Fout, t);
- ++Fout2;
- ++Fout;
- } while (--m);
-}
-
-static void
-kf_bfly4 (kiss_fft_s32_cpx * Fout,
- const size_t fstride, const kiss_fft_s32_cfg st, const size_t m)
-{
- kiss_fft_s32_cpx *tw1, *tw2, *tw3;
- kiss_fft_s32_cpx scratch[6];
- size_t k = m;
- const size_t m2 = 2 * m;
- const size_t m3 = 3 * m;
-
- tw3 = tw2 = tw1 = st->twiddles;
-
- do {
- C_FIXDIV (*Fout, 4);
- C_FIXDIV (Fout[m], 4);
- C_FIXDIV (Fout[m2], 4);
- C_FIXDIV (Fout[m3], 4);
-
- C_MUL (scratch[0], Fout[m], *tw1);
- C_MUL (scratch[1], Fout[m2], *tw2);
- C_MUL (scratch[2], Fout[m3], *tw3);
-
- C_SUB (scratch[5], *Fout, scratch[1]);
- C_ADDTO (*Fout, scratch[1]);
- C_ADD (scratch[3], scratch[0], scratch[2]);
- C_SUB (scratch[4], scratch[0], scratch[2]);
- C_SUB (Fout[m2], *Fout, scratch[3]);
- tw1 += fstride;
- tw2 += fstride * 2;
- tw3 += fstride * 3;
- C_ADDTO (*Fout, scratch[3]);
-
- if (st->inverse) {
- Fout[m].r = scratch[5].r - scratch[4].i;
- Fout[m].i = scratch[5].i + scratch[4].r;
- Fout[m3].r = scratch[5].r + scratch[4].i;
- Fout[m3].i = scratch[5].i - scratch[4].r;
- } else {
- Fout[m].r = scratch[5].r + scratch[4].i;
- Fout[m].i = scratch[5].i - scratch[4].r;
- Fout[m3].r = scratch[5].r - scratch[4].i;
- Fout[m3].i = scratch[5].i + scratch[4].r;
- }
- ++Fout;
- } while (--k);
-}
-
-static void
-kf_bfly3 (kiss_fft_s32_cpx * Fout,
- const size_t fstride, const kiss_fft_s32_cfg st, size_t m)
-{
- size_t k = m;
- const size_t m2 = 2 * m;
- kiss_fft_s32_cpx *tw1, *tw2;
- kiss_fft_s32_cpx scratch[5];
- kiss_fft_s32_cpx epi3;
-
- epi3 = st->twiddles[fstride * m];
-
- tw1 = tw2 = st->twiddles;
-
- do {
- C_FIXDIV (*Fout, 3);
- C_FIXDIV (Fout[m], 3);
- C_FIXDIV (Fout[m2], 3);
-
- C_MUL (scratch[1], Fout[m], *tw1);
- C_MUL (scratch[2], Fout[m2], *tw2);
-
- C_ADD (scratch[3], scratch[1], scratch[2]);
- C_SUB (scratch[0], scratch[1], scratch[2]);
- tw1 += fstride;
- tw2 += fstride * 2;
-
- Fout[m].r = Fout->r - HALF_OF (scratch[3].r);
- Fout[m].i = Fout->i - HALF_OF (scratch[3].i);
-
- C_MULBYSCALAR (scratch[0], epi3.i);
-
- C_ADDTO (*Fout, scratch[3]);
-
- Fout[m2].r = Fout[m].r + scratch[0].i;
- Fout[m2].i = Fout[m].i - scratch[0].r;
-
- Fout[m].r -= scratch[0].i;
- Fout[m].i += scratch[0].r;
-
- ++Fout;
- } while (--k);
-}
-
-static void
-kf_bfly5 (kiss_fft_s32_cpx * Fout,
- const size_t fstride, const kiss_fft_s32_cfg st, int m)
-{
- kiss_fft_s32_cpx *Fout0, *Fout1, *Fout2, *Fout3, *Fout4;
- int u;
- kiss_fft_s32_cpx scratch[13];
- kiss_fft_s32_cpx *twiddles = st->twiddles;
- kiss_fft_s32_cpx *tw;
- kiss_fft_s32_cpx ya, yb;
-
- ya = twiddles[fstride * m];
- yb = twiddles[fstride * 2 * m];
-
- Fout0 = Fout;
- Fout1 = Fout0 + m;
- Fout2 = Fout0 + 2 * m;
- Fout3 = Fout0 + 3 * m;
- Fout4 = Fout0 + 4 * m;
-
- tw = st->twiddles;
- for (u = 0; u < m; ++u) {
- C_FIXDIV (*Fout0, 5);
- C_FIXDIV (*Fout1, 5);
- C_FIXDIV (*Fout2, 5);
- C_FIXDIV (*Fout3, 5);
- C_FIXDIV (*Fout4, 5);
- scratch[0] = *Fout0;
-
- C_MUL (scratch[1], *Fout1, tw[u * fstride]);
- C_MUL (scratch[2], *Fout2, tw[2 * u * fstride]);
- C_MUL (scratch[3], *Fout3, tw[3 * u * fstride]);
- C_MUL (scratch[4], *Fout4, tw[4 * u * fstride]);
-
- C_ADD (scratch[7], scratch[1], scratch[4]);
- C_SUB (scratch[10], scratch[1], scratch[4]);
- C_ADD (scratch[8], scratch[2], scratch[3]);
- C_SUB (scratch[9], scratch[2], scratch[3]);
-
- Fout0->r += scratch[7].r + scratch[8].r;
- Fout0->i += scratch[7].i + scratch[8].i;
-
- scratch[5].r =
- scratch[0].r + S_MUL (scratch[7].r, ya.r) + S_MUL (scratch[8].r, yb.r);
- scratch[5].i =
- scratch[0].i + S_MUL (scratch[7].i, ya.r) + S_MUL (scratch[8].i, yb.r);
-
- scratch[6].r = S_MUL (scratch[10].i, ya.i) + S_MUL (scratch[9].i, yb.i);
- scratch[6].i = -S_MUL (scratch[10].r, ya.i) - S_MUL (scratch[9].r, yb.i);
-
- C_SUB (*Fout1, scratch[5], scratch[6]);
- C_ADD (*Fout4, scratch[5], scratch[6]);
-
- scratch[11].r =
- scratch[0].r + S_MUL (scratch[7].r, yb.r) + S_MUL (scratch[8].r, ya.r);
- scratch[11].i =
- scratch[0].i + S_MUL (scratch[7].i, yb.r) + S_MUL (scratch[8].i, ya.r);
- scratch[12].r = -S_MUL (scratch[10].i, yb.i) + S_MUL (scratch[9].i, ya.i);
- scratch[12].i = S_MUL (scratch[10].r, yb.i) - S_MUL (scratch[9].r, ya.i);
-
- C_ADD (*Fout2, scratch[11], scratch[12]);
- C_SUB (*Fout3, scratch[11], scratch[12]);
-
- ++Fout0;
- ++Fout1;
- ++Fout2;
- ++Fout3;
- ++Fout4;
- }
-}
-
-/* perform the butterfly for one stage of a mixed radix FFT */
-static void
-kf_bfly_generic (kiss_fft_s32_cpx * Fout,
- const size_t fstride, const kiss_fft_s32_cfg st, int m, int p)
-{
- int u, k, q1, q;
- kiss_fft_s32_cpx *twiddles = st->twiddles;
- kiss_fft_s32_cpx t;
- int Norig = st->nfft;
-
- CHECKBUF (scratchbuf, nscratchbuf, p);
-
- for (u = 0; u < m; ++u) {
- k = u;
- for (q1 = 0; q1 < p; ++q1) {
- scratchbuf[q1] = Fout[k];
- C_FIXDIV (scratchbuf[q1], p);
- k += m;
- }
-
- k = u;
- for (q1 = 0; q1 < p; ++q1) {
- int twidx = 0;
-
- Fout[k] = scratchbuf[0];
- for (q = 1; q < p; ++q) {
- twidx += fstride * k;
- if (twidx >= Norig)
- twidx -= Norig;
- C_MUL (t, scratchbuf[q], twiddles[twidx]);
- C_ADDTO (Fout[k], t);
- }
- k += m;
- }
- }
-}
-
-static void
-kf_work (kiss_fft_s32_cpx * Fout,
- const kiss_fft_s32_cpx * f,
- const size_t fstride,
- int in_stride, int *factors, const kiss_fft_s32_cfg st)
-{
- kiss_fft_s32_cpx *Fout_beg = Fout;
- const int p = *factors++; /* the radix */
- const int m = *factors++; /* stage's fft length/p */
- const kiss_fft_s32_cpx *Fout_end = Fout + p * m;
-
- if (m == 1) {
- do {
- *Fout = *f;
- f += fstride * in_stride;
- } while (++Fout != Fout_end);
- } else {
- do {
- kf_work (Fout, f, fstride * p, in_stride, factors, st);
- f += fstride * in_stride;
- } while ((Fout += m) != Fout_end);
- }
-
- Fout = Fout_beg;
-
- switch (p) {
- case 2:
- kf_bfly2 (Fout, fstride, st, m);
- break;
- case 3:
- kf_bfly3 (Fout, fstride, st, m);
- break;
- case 4:
- kf_bfly4 (Fout, fstride, st, m);
- break;
- case 5:
- kf_bfly5 (Fout, fstride, st, m);
- break;
- default:
- kf_bfly_generic (Fout, fstride, st, m, p);
- break;
- }
-}
-
-/* facbuf is populated by p1,m1,p2,m2, ...
- where
- p[i] * m[i] = m[i-1]
- m0 = n */
-static void
-kf_factor (int n, int *facbuf)
-{
- int p = 4;
- double floor_sqrt;
-
- floor_sqrt = floor (sqrt ((double) n));
-
- /*factor out powers of 4, powers of 2, then any remaining primes */
- do {
- while (n % p) {
- switch (p) {
- case 4:
- p = 2;
- break;
- case 2:
- p = 3;
- break;
- default:
- p += 2;
- break;
- }
- if (p > floor_sqrt)
- p = n; /* no more factors, skip to end */
- }
- n /= p;
- *facbuf++ = p;
- *facbuf++ = n;
- } while (n > 1);
-}
-
-/*
- *
- * User-callable function to allocate all necessary storage space for the fft.
- *
- * The return value is a contiguous block of memory, allocated with malloc. As such,
- * It can be freed with free(), rather than a kiss_fft-specific function.
- * */
-kiss_fft_s32_cfg
-kiss_fft_s32_alloc (int nfft, int inverse_fft, void *mem, size_t * lenmem)
-{
- kiss_fft_s32_cfg st = NULL;
- size_t memneeded = sizeof (struct kiss_fft_s32_state)
- + sizeof (kiss_fft_s32_cpx) * (nfft - 1); /* twiddle factors */
-
- if (lenmem == NULL) {
- st = (kiss_fft_s32_cfg) KISS_FFT_S32_MALLOC (memneeded);
- } else {
- if (mem != NULL && *lenmem >= memneeded)
- st = (kiss_fft_s32_cfg) mem;
- *lenmem = memneeded;
- }
- if (st) {
- int i;
-
- st->nfft = nfft;
- st->inverse = inverse_fft;
-
- for (i = 0; i < nfft; ++i) {
- const double pi =
- 3.141592653589793238462643383279502884197169399375105820974944;
- double phase = -2 * pi * i / nfft;
-
- if (st->inverse)
- phase *= -1;
- kf_cexp (st->twiddles + i, phase);
- }
-
- kf_factor (nfft, st->factors);
- }
- return st;
-}
-
-
-
-
-void
-kiss_fft_s32_stride (kiss_fft_s32_cfg st, const kiss_fft_s32_cpx * fin,
- kiss_fft_s32_cpx * fout, int in_stride)
-{
- if (fin == fout) {
- CHECKBUF (tmpbuf, ntmpbuf, st->nfft);
- kf_work (tmpbuf, fin, 1, in_stride, st->factors, st);
- memcpy (fout, tmpbuf, sizeof (kiss_fft_s32_cpx) * st->nfft);
- } else {
- kf_work (fout, fin, 1, in_stride, st->factors, st);
- }
-}
-
-void
-kiss_fft_s32 (kiss_fft_s32_cfg cfg, const kiss_fft_s32_cpx * fin,
- kiss_fft_s32_cpx * fout)
-{
- kiss_fft_s32_stride (cfg, fin, fout, 1);
-}
-
-
-/* not really necessary to call, but if someone is doing in-place ffts, they may want to free the
- buffers from CHECKBUF
- */
-void
-kiss_fft_s32_cleanup (void)
-{
- free (scratchbuf);
- scratchbuf = NULL;
- nscratchbuf = 0;
- free (tmpbuf);
- tmpbuf = NULL;
- ntmpbuf = 0;
-}
-
-int
-kiss_fft_s32_next_fast_size (int n)
-{
- while (1) {
- int m = n;
-
- while ((m % 2) == 0)
- m /= 2;
- while ((m % 3) == 0)
- m /= 3;
- while ((m % 5) == 0)
- m /= 5;
- if (m <= 1)
- break; /* n is completely factorable by twos, threes, and fives */
- n++;
- }
- return n;
-}
diff --git a/gst-libs/gst/fft/kiss_fft_s32.h b/gst-libs/gst/fft/kiss_fft_s32.h
deleted file mode 100644
index b1c1d707..00000000
--- a/gst-libs/gst/fft/kiss_fft_s32.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef KISS_FFT_S32_H
-#define KISS_FFT_S32_H
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <memory.h>
-#include <glib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- ATTENTION!
- If you would like a :
- -- a utility that will handle the caching of fft objects
- -- real-only (no imaginary time component ) FFT
- -- a multi-dimensional FFT
- -- a command-line utility to perform ffts
- -- a command-line utility to perform fast-convolution filtering
-
- Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c
- in the tools/ directory.
-*/
-
-#define KISS_FFT_S32_MALLOC g_malloc
-
-
-#include "_stdint.h"
-
-#define kiss_fft_s32_scalar int32_t
-
-typedef struct {
- kiss_fft_s32_scalar r;
- kiss_fft_s32_scalar i;
-}kiss_fft_s32_cpx;
-
-typedef struct kiss_fft_s32_state* kiss_fft_s32_cfg;
-
-/*
- * kiss_fft_s32_alloc
- *
- * Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
- *
- * typical usage: kiss_fft_s32_cfg mycfg=kiss_fft_s32_alloc(1024,0,NULL,NULL);
- *
- * The return value from fft_alloc is a cfg buffer used internally
- * by the fft routine or NULL.
- *
- * If lenmem is NULL, then kiss_fft_s32_alloc will allocate a cfg buffer using malloc.
- * The returned value should be free()d when done to avoid memory leaks.
- *
- * The state can be placed in a user supplied buffer 'mem':
- * If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
- * then the function places the cfg in mem and the size used in *lenmem
- * and returns mem.
- *
- * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
- * then the function returns NULL and places the minimum cfg
- * buffer size in *lenmem.
- * */
-
-kiss_fft_s32_cfg kiss_fft_s32_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
-
-/*
- * kiss_fft(cfg,in_out_buf)
- *
- * Perform an FFT on a complex input buffer.
- * for a forward FFT,
- * fin should be f[0] , f[1] , ... ,f[nfft-1]
- * fout will be F[0] , F[1] , ... ,F[nfft-1]
- * Note that each element is complex and can be accessed like
- f[k].r and f[k].i
- * */
-void kiss_fft_s32(kiss_fft_s32_cfg cfg,const kiss_fft_s32_cpx *fin,kiss_fft_s32_cpx *fout);
-
-/*
- A more generic version of the above function. It reads its input from every Nth sample.
- * */
-void kiss_fft_s32_stride(kiss_fft_s32_cfg cfg,const kiss_fft_s32_cpx *fin,kiss_fft_s32_cpx *fout,int fin_stride);
-
-/* If kiss_fft_s32_alloc allocated a buffer, it is one contiguous
- buffer and can be simply free()d when no longer needed*/
-#define kiss_fft_s32_free g_free
-
-/*
- Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up
- your compiler output to call this before you exit.
-*/
-void kiss_fft_s32_cleanup(void);
-
-
-/*
- * Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5)
- */
-int kiss_fft_s32_next_fast_size(int n);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/gst-libs/gst/fft/kiss_fftr_f32.c b/gst-libs/gst/fft/kiss_fftr_f32.c
deleted file mode 100644
index ea45206e..00000000
--- a/gst-libs/gst/fft/kiss_fftr_f32.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
-Copyright (c) 2003-2004, Mark Borgerding
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * 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.
- * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-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 OWNER 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.
-*/
-
-#include "kiss_fftr_f32.h"
-#include "_kiss_fft_guts_f32.h"
-
-struct kiss_fftr_f32_state
-{
- kiss_fft_f32_cfg substate;
- kiss_fft_f32_cpx *tmpbuf;
- kiss_fft_f32_cpx *super_twiddles;
-#ifdef USE_SIMD
- long pad;
-#endif
-};
-
-kiss_fftr_f32_cfg
-kiss_fftr_f32_alloc (int nfft, int inverse_fft, void *mem, size_t * lenmem)
-{
- int i;
- kiss_fftr_f32_cfg st = NULL;
- size_t subsize, memneeded;
-
- if (nfft & 1) {
- fprintf (stderr, "Real FFT optimization must be even.\n");
- return NULL;
- }
- nfft >>= 1;
-
- kiss_fft_f32_alloc (nfft, inverse_fft, NULL, &subsize);
- memneeded = ALIGN_STRUCT (sizeof (struct kiss_fftr_f32_state))
- + ALIGN_STRUCT (subsize) + sizeof (kiss_fft_f32_cpx) * (nfft * 2);
-
- if (lenmem == NULL) {
- st = (kiss_fftr_f32_cfg) KISS_FFT_F32_MALLOC (memneeded);
- } else {
- if (*lenmem >= memneeded)
- st = (kiss_fftr_f32_cfg) mem;
- *lenmem = memneeded;
- }
- if (!st)
- return NULL;
-
- st->substate = (kiss_fft_f32_cfg) (((char *) st) + ALIGN_STRUCT (sizeof (struct kiss_fftr_f32_state))); /*just beyond kiss_fftr_f32_state struct */
- st->tmpbuf =
- (kiss_fft_f32_cpx *) (((char *) st->substate) + ALIGN_STRUCT (subsize));
- st->super_twiddles = st->tmpbuf + nfft;
- kiss_fft_f32_alloc (nfft, inverse_fft, st->substate, &subsize);
-
- for (i = 0; i < nfft; ++i) {
- double phase = -3.14159265358979323846264338327 * ((double) i / nfft + .5);
-
- if (inverse_fft)
- phase *= -1;
- kf_cexp (st->super_twiddles + i, phase);
- }
- return st;
-}
-
-void
-kiss_fftr_f32 (kiss_fftr_f32_cfg st, const kiss_fft_f32_scalar * timedata,
- kiss_fft_f32_cpx * freqdata)
-{
- /* input buffer timedata is stored row-wise */
- int k, ncfft;
- kiss_fft_f32_cpx fpnk, fpk, f1k, f2k, tw, tdc;
-
- if (st->substate->inverse) {
- fprintf (stderr, "kiss fft usage error: improper alloc\n");
- exit (1);
- }
-
- ncfft = st->substate->nfft;
-
- /*perform the parallel fft of two real signals packed in real,imag */
- kiss_fft_f32 (st->substate, (const kiss_fft_f32_cpx *) timedata, st->tmpbuf);
- /* The real part of the DC element of the frequency spectrum in st->tmpbuf
- * contains the sum of the even-numbered elements of the input time sequence
- * The imag part is the sum of the odd-numbered elements
- *
- * The sum of tdc.r and tdc.i is the sum of the input time sequence.
- * yielding DC of input time sequence
- * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1...
- * yielding Nyquist bin of input time sequence
- */
-
- tdc.r = st->tmpbuf[0].r;
- tdc.i = st->tmpbuf[0].i;
- C_FIXDIV (tdc, 2);
- CHECK_OVERFLOW_OP (tdc.r, +, tdc.i);
- CHECK_OVERFLOW_OP (tdc.r, -, tdc.i);
- freqdata[0].r = tdc.r + tdc.i;
- freqdata[ncfft].r = tdc.r - tdc.i;
-#ifdef USE_SIMD
- freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps (0);
-#else
- freqdata[ncfft].i = freqdata[0].i = 0;
-#endif
-
- for (k = 1; k <= ncfft / 2; ++k) {
- fpk = st->tmpbuf[k];
- fpnk.r = st->tmpbuf[ncfft - k].r;
- fpnk.i = -st->tmpbuf[ncfft - k].i;
- C_FIXDIV (fpk, 2);
- C_FIXDIV (fpnk, 2);
-
- C_ADD (f1k, fpk, fpnk);
- C_SUB (f2k, fpk, fpnk);
- C_MUL (tw, f2k, st->super_twiddles[k]);
-
- freqdata[k].r = HALF_OF (f1k.r + tw.r);
- freqdata[k].i = HALF_OF (f1k.i + tw.i);
- freqdata[ncfft - k].r = HALF_OF (f1k.r - tw.r);
- freqdata[ncfft - k].i = HALF_OF (tw.i - f1k.i);
- }
-}
-
-void
-kiss_fftri_f32 (kiss_fftr_f32_cfg st, const kiss_fft_f32_cpx * freqdata,
- kiss_fft_f32_scalar * timedata)
-{
- /* input buffer timedata is stored row-wise */
- int k, ncfft;
-
- if (st->substate->inverse == 0) {
- fprintf (stderr, "kiss fft usage error: improper alloc\n");
- exit (1);
- }
-
- ncfft = st->substate->nfft;
-
- st->tmpbuf[0].r = freqdata[0].r + freqdata[ncfft].r;
- st->tmpbuf[0].i = freqdata[0].r - freqdata[ncfft].r;
- C_FIXDIV (st->tmpbuf[0], 2);
-
- for (k = 1; k <= ncfft / 2; ++k) {
- kiss_fft_f32_cpx fk, fnkc, fek, fok, tmp;
-
- fk = freqdata[k];
- fnkc.r = freqdata[ncfft - k].r;
- fnkc.i = -freqdata[ncfft - k].i;
- C_FIXDIV (fk, 2);
- C_FIXDIV (fnkc, 2);
-
- C_ADD (fek, fk, fnkc);
- C_SUB (tmp, fk, fnkc);
- C_MUL (fok, tmp, st->super_twiddles[k]);
- C_ADD (st->tmpbuf[k], fek, fok);
- C_SUB (st->tmpbuf[ncfft - k], fek, fok);
-#ifdef USE_SIMD
- st->tmpbuf[ncfft - k].i *= _mm_set1_ps (-1.0);
-#else
- st->tmpbuf[ncfft - k].i *= -1;
-#endif
- }
- kiss_fft_f32 (st->substate, st->tmpbuf, (kiss_fft_f32_cpx *) timedata);
-}
diff --git a/gst-libs/gst/fft/kiss_fftr_f32.h b/gst-libs/gst/fft/kiss_fftr_f32.h
deleted file mode 100644
index 91f2085e..00000000
--- a/gst-libs/gst/fft/kiss_fftr_f32.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef KISS_FTR_F32_H
-#define KISS_FTR_F32_H
-
-#include "kiss_fft_f32.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
-
- Real optimized version can save about 45% cpu time vs. complex fft of a real seq.
-
-
-
- */
-
-typedef struct kiss_fftr_f32_state *kiss_fftr_f32_cfg;
-
-
-kiss_fftr_f32_cfg kiss_fftr_f32_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem);
-/*
- nfft must be even
-
- If you don't care to allocate space, use mem = lenmem = NULL
-*/
-
-
-void kiss_fftr_f32(kiss_fftr_f32_cfg cfg,const kiss_fft_f32_scalar *timedata,kiss_fft_f32_cpx *freqdata);
-/*
- input timedata has nfft scalar points
- output freqdata has nfft/2+1 complex points
-*/
-
-void kiss_fftri_f32(kiss_fftr_f32_cfg cfg,const kiss_fft_f32_cpx *freqdata,kiss_fft_f32_scalar *timedata);
-/*
- input freqdata has nfft/2+1 complex points
- output timedata has nfft scalar points
-*/
-
-#define kiss_fftr_f32_free free
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/gst-libs/gst/fft/kiss_fftr_f64.c b/gst-libs/gst/fft/kiss_fftr_f64.c
deleted file mode 100644
index 59587147..00000000
--- a/gst-libs/gst/fft/kiss_fftr_f64.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
-Copyright (c) 2003-2004, Mark Borgerding
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * 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.
- * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-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 OWNER 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.
-*/
-
-#include "kiss_fftr_f64.h"
-#include "_kiss_fft_guts_f64.h"
-
-struct kiss_fftr_f64_state
-{
- kiss_fft_f64_cfg substate;
- kiss_fft_f64_cpx *tmpbuf;
- kiss_fft_f64_cpx *super_twiddles;
-#ifdef USE_SIMD
- long pad;
-#endif
-};
-
-kiss_fftr_f64_cfg
-kiss_fftr_f64_alloc (int nfft, int inverse_fft, void *mem, size_t * lenmem)
-{
- int i;
- kiss_fftr_f64_cfg st = NULL;
- size_t subsize, memneeded;
-
- if (nfft & 1) {
- fprintf (stderr, "Real FFT optimization must be even.\n");
- return NULL;
- }
- nfft >>= 1;
-
- kiss_fft_f64_alloc (nfft, inverse_fft, NULL, &subsize);
- memneeded = ALIGN_STRUCT (sizeof (struct kiss_fftr_f64_state))
- + ALIGN_STRUCT (subsize)
- + sizeof (kiss_fft_f64_cpx) * (nfft * 2);
-
- if (lenmem == NULL) {
- st = (kiss_fftr_f64_cfg) KISS_FFT_F64_MALLOC (memneeded);
- } else {
- if (*lenmem >= memneeded)
- st = (kiss_fftr_f64_cfg) mem;
- *lenmem = memneeded;
- }
- if (!st)
- return NULL;
-
- st->substate = (kiss_fft_f64_cfg) (((char *) st) + ALIGN_STRUCT (sizeof (struct kiss_fftr_f64_state))); /*just beyond kiss_fftr_f64_state struct */
- st->tmpbuf =
- (kiss_fft_f64_cpx *) (((char *) st->substate) + ALIGN_STRUCT (subsize));
- st->super_twiddles = st->tmpbuf + nfft;
- kiss_fft_f64_alloc (nfft, inverse_fft, st->substate, &subsize);
-
- for (i = 0; i < nfft; ++i) {
- double phase = -3.14159265358979323846264338327 * ((double) i / nfft + .5);
-
- if (inverse_fft)
- phase *= -1;
- kf_cexp (st->super_twiddles + i, phase);
- }
- return st;
-}
-
-void
-kiss_fftr_f64 (kiss_fftr_f64_cfg st, const kiss_fft_f64_scalar * timedata,
- kiss_fft_f64_cpx * freqdata)
-{
- /* input buffer timedata is stored row-wise */
- int k, ncfft;
- kiss_fft_f64_cpx fpnk, fpk, f1k, f2k, tw, tdc;
-
- if (st->substate->inverse) {
- fprintf (stderr, "kiss fft usage error: improper alloc\n");
- exit (1);
- }
-
- ncfft = st->substate->nfft;
-
- /*perform the parallel fft of two real signals packed in real,imag */
- kiss_fft_f64 (st->substate, (const kiss_fft_f64_cpx *) timedata, st->tmpbuf);
- /* The real part of the DC element of the frequency spectrum in st->tmpbuf
- * contains the sum of the even-numbered elements of the input time sequence
- * The imag part is the sum of the odd-numbered elements
- *
- * The sum of tdc.r and tdc.i is the sum of the input time sequence.
- * yielding DC of input time sequence
- * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1...
- * yielding Nyquist bin of input time sequence
- */
-
- tdc.r = st->tmpbuf[0].r;
- tdc.i = st->tmpbuf[0].i;
- C_FIXDIV (tdc, 2);
- CHECK_OVERFLOW_OP (tdc.r, +, tdc.i);
- CHECK_OVERFLOW_OP (tdc.r, -, tdc.i);
- freqdata[0].r = tdc.r + tdc.i;
- freqdata[ncfft].r = tdc.r - tdc.i;
-#ifdef USE_SIMD
- freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps (0);
-#else
- freqdata[ncfft].i = freqdata[0].i = 0;
-#endif
-
- for (k = 1; k <= ncfft / 2; ++k) {
- fpk = st->tmpbuf[k];
- fpnk.r = st->tmpbuf[ncfft - k].r;
- fpnk.i = -st->tmpbuf[ncfft - k].i;
- C_FIXDIV (fpk, 2);
- C_FIXDIV (fpnk, 2);
-
- C_ADD (f1k, fpk, fpnk);
- C_SUB (f2k, fpk, fpnk);
- C_MUL (tw, f2k, st->super_twiddles[k]);
-
- freqdata[k].r = HALF_OF (f1k.r + tw.r);
- freqdata[k].i = HALF_OF (f1k.i + tw.i);
- freqdata[ncfft - k].r = HALF_OF (f1k.r - tw.r);
- freqdata[ncfft - k].i = HALF_OF (tw.i - f1k.i);
- }
-}
-
-void
-kiss_fftri_f64 (kiss_fftr_f64_cfg st, const kiss_fft_f64_cpx * freqdata,
- kiss_fft_f64_scalar * timedata)
-{
- /* input buffer timedata is stored row-wise */
- int k, ncfft;
-
- if (st->substate->inverse == 0) {
- fprintf (stderr, "kiss fft usage error: improper alloc\n");
- exit (1);
- }
-
- ncfft = st->substate->nfft;
-
- st->tmpbuf[0].r = freqdata[0].r + freqdata[ncfft].r;
- st->tmpbuf[0].i = freqdata[0].r - freqdata[ncfft].r;
- C_FIXDIV (st->tmpbuf[0], 2);
-
- for (k = 1; k <= ncfft / 2; ++k) {
- kiss_fft_f64_cpx fk, fnkc, fek, fok, tmp;
-
- fk = freqdata[k];
- fnkc.r = freqdata[ncfft - k].r;
- fnkc.i = -freqdata[ncfft - k].i;
- C_FIXDIV (fk, 2);
- C_FIXDIV (fnkc, 2);
-
- C_ADD (fek, fk, fnkc);
- C_SUB (tmp, fk, fnkc);
- C_MUL (fok, tmp, st->super_twiddles[k]);
- C_ADD (st->tmpbuf[k], fek, fok);
- C_SUB (st->tmpbuf[ncfft - k], fek, fok);
-#ifdef USE_SIMD
- st->tmpbuf[ncfft - k].i *= _mm_set1_ps (-1.0);
-#else
- st->tmpbuf[ncfft - k].i *= -1;
-#endif
- }
- kiss_fft_f64 (st->substate, st->tmpbuf, (kiss_fft_f64_cpx *) timedata);
-}
diff --git a/gst-libs/gst/fft/kiss_fftr_f64.h b/gst-libs/gst/fft/kiss_fftr_f64.h
deleted file mode 100644
index 0b35cb6a..00000000
--- a/gst-libs/gst/fft/kiss_fftr_f64.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef KISS_FTR_F64_H
-#define KISS_FTR_F64_H
-
-#include "kiss_fft_f64.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
-
- Real optimized version can save about 45% cpu time vs. complex fft of a real seq.
-
-
-
- */
-
-typedef struct kiss_fftr_f64_state *kiss_fftr_f64_cfg;
-
-
-kiss_fftr_f64_cfg kiss_fftr_f64_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem);
-/*
- nfft must be even
-
- If you don't care to allocate space, use mem = lenmem = NULL
-*/
-
-
-void kiss_fftr_f64(kiss_fftr_f64_cfg cfg,const kiss_fft_f64_scalar *timedata,kiss_fft_f64_cpx *freqdata);
-/*
- input timedata has nfft scalar points
- output freqdata has nfft/2+1 complex points
-*/
-
-void kiss_fftri_f64(kiss_fftr_f64_cfg cfg,const kiss_fft_f64_cpx *freqdata,kiss_fft_f64_scalar *timedata);
-/*
- input freqdata has nfft/2+1 complex points
- output timedata has nfft scalar points
-*/
-
-#define kiss_fftr_f64_free free
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/gst-libs/gst/fft/kiss_fftr_s16.c b/gst-libs/gst/fft/kiss_fftr_s16.c
deleted file mode 100644
index 803fa633..00000000
--- a/gst-libs/gst/fft/kiss_fftr_s16.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
-Copyright (c) 2003-2004, Mark Borgerding
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * 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.
- * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-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 OWNER 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.
-*/
-
-#include "kiss_fftr_s16.h"
-#include "_kiss_fft_guts_s16.h"
-
-struct kiss_fftr_s16_state
-{
- kiss_fft_s16_cfg substate;
- kiss_fft_s16_cpx *tmpbuf;
- kiss_fft_s16_cpx *super_twiddles;
-#ifdef USE_SIMD
- long pad;
-#endif
-};
-
-kiss_fftr_s16_cfg
-kiss_fftr_s16_alloc (int nfft, int inverse_fft, void *mem, size_t * lenmem)
-{
- int i;
- kiss_fftr_s16_cfg st = NULL;
- size_t subsize, memneeded;
-
- if (nfft & 1) {
- fprintf (stderr, "Real FFT optimization must be even.\n");
- return NULL;
- }
- nfft >>= 1;
-
- kiss_fft_s16_alloc (nfft, inverse_fft, NULL, &subsize);
- memneeded = ALIGN_STRUCT (sizeof (struct kiss_fftr_s16_state))
- + ALIGN_STRUCT (subsize)
- + sizeof (kiss_fft_s16_cpx) * (nfft * 2);
-
- if (lenmem == NULL) {
- st = (kiss_fftr_s16_cfg) KISS_FFT_S16_MALLOC (memneeded);
- } else {
- if (*lenmem >= memneeded)
- st = (kiss_fftr_s16_cfg) mem;
- *lenmem = memneeded;
- }
- if (!st)
- return NULL;
-
- st->substate = (kiss_fft_s16_cfg) (((char *) st) + ALIGN_STRUCT (sizeof (struct kiss_fftr_s16_state))); /*just beyond kiss_fftr_s16_state struct */
- st->tmpbuf =
- (kiss_fft_s16_cpx *) (((char *) st->substate) + ALIGN_STRUCT (subsize));
- st->super_twiddles = st->tmpbuf + nfft;
- kiss_fft_s16_alloc (nfft, inverse_fft, st->substate, &subsize);
-
- for (i = 0; i < nfft; ++i) {
- double phase = -3.14159265358979323846264338327 * ((double) i / nfft + .5);
-
- if (inverse_fft)
- phase *= -1;
- kf_cexp (st->super_twiddles + i, phase);
- }
- return st;
-}
-
-void
-kiss_fftr_s16 (kiss_fftr_s16_cfg st, const kiss_fft_s16_scalar * timedata,
- kiss_fft_s16_cpx * freqdata)
-{
- /* input buffer timedata is stored row-wise */
- int k, ncfft;
- kiss_fft_s16_cpx fpnk, fpk, f1k, f2k, tw, tdc;
-
- if (st->substate->inverse) {
- fprintf (stderr, "kiss fft usage error: improper alloc\n");
- exit (1);
- }
-
- ncfft = st->substate->nfft;
-
- /*perform the parallel fft of two real signals packed in real,imag */
- kiss_fft_s16 (st->substate, (const kiss_fft_s16_cpx *) timedata, st->tmpbuf);
- /* The real part of the DC element of the frequency spectrum in st->tmpbuf
- * contains the sum of the even-numbered elements of the input time sequence
- * The imag part is the sum of the odd-numbered elements
- *
- * The sum of tdc.r and tdc.i is the sum of the input time sequence.
- * yielding DC of input time sequence
- * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1...
- * yielding Nyquist bin of input time sequence
- */
-
- tdc.r = st->tmpbuf[0].r;
- tdc.i = st->tmpbuf[0].i;
- C_FIXDIV (tdc, 2);
- CHECK_OVERFLOW_OP (tdc.r, +, tdc.i);
- CHECK_OVERFLOW_OP (tdc.r, -, tdc.i);
- freqdata[0].r = tdc.r + tdc.i;
- freqdata[ncfft].r = tdc.r - tdc.i;
-#ifdef USE_SIMD
- freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps (0);
-#else
- freqdata[ncfft].i = freqdata[0].i = 0;
-#endif
-
- for (k = 1; k <= ncfft / 2; ++k) {
- fpk = st->tmpbuf[k];
- fpnk.r = st->tmpbuf[ncfft - k].r;
- fpnk.i = -st->tmpbuf[ncfft - k].i;
- C_FIXDIV (fpk, 2);
- C_FIXDIV (fpnk, 2);
-
- C_ADD (f1k, fpk, fpnk);
- C_SUB (f2k, fpk, fpnk);
- C_MUL (tw, f2k, st->super_twiddles[k]);
-
- freqdata[k].r = HALF_OF (f1k.r + tw.r);
- freqdata[k].i = HALF_OF (f1k.i + tw.i);
- freqdata[ncfft - k].r = HALF_OF (f1k.r - tw.r);
- freqdata[ncfft - k].i = HALF_OF (tw.i - f1k.i);
- }
-}
-
-void
-kiss_fftri_s16 (kiss_fftr_s16_cfg st, const kiss_fft_s16_cpx * freqdata,
- kiss_fft_s16_scalar * timedata)
-{
- /* input buffer timedata is stored row-wise */
- int k, ncfft;
-
- if (st->substate->inverse == 0) {
- fprintf (stderr, "kiss fft usage error: improper alloc\n");
- exit (1);
- }
-
- ncfft = st->substate->nfft;
-
- st->tmpbuf[0].r = freqdata[0].r + freqdata[ncfft].r;
- st->tmpbuf[0].i = freqdata[0].r - freqdata[ncfft].r;
- C_FIXDIV (st->tmpbuf[0], 2);
-
- for (k = 1; k <= ncfft / 2; ++k) {
- kiss_fft_s16_cpx fk, fnkc, fek, fok, tmp;
-
- fk = freqdata[k];
- fnkc.r = freqdata[ncfft - k].r;
- fnkc.i = -freqdata[ncfft - k].i;
- C_FIXDIV (fk, 2);
- C_FIXDIV (fnkc, 2);
-
- C_ADD (fek, fk, fnkc);
- C_SUB (tmp, fk, fnkc);
- C_MUL (fok, tmp, st->super_twiddles[k]);
- C_ADD (st->tmpbuf[k], fek, fok);
- C_SUB (st->tmpbuf[ncfft - k], fek, fok);
-#ifdef USE_SIMD
- st->tmpbuf[ncfft - k].i *= _mm_set1_ps (-1.0);
-#else
- st->tmpbuf[ncfft - k].i *= -1;
-#endif
- }
- kiss_fft_s16 (st->substate, st->tmpbuf, (kiss_fft_s16_cpx *) timedata);
-}
diff --git a/gst-libs/gst/fft/kiss_fftr_s16.h b/gst-libs/gst/fft/kiss_fftr_s16.h
deleted file mode 100644
index 20bc9ef5..00000000
--- a/gst-libs/gst/fft/kiss_fftr_s16.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef KISS_FTR_S16_H
-#define KISS_FTR_S16_H
-
-#include "kiss_fft_s16.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
-
- Real optimized version can save about 45% cpu time vs. complex fft of a real seq.
-
-
-
- */
-
-typedef struct kiss_fftr_s16_state *kiss_fftr_s16_cfg;
-
-
-kiss_fftr_s16_cfg kiss_fftr_s16_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem);
-/*
- nfft must be even
-
- If you don't care to allocate space, use mem = lenmem = NULL
-*/
-
-
-void kiss_fftr_s16(kiss_fftr_s16_cfg cfg,const kiss_fft_s16_scalar *timedata,kiss_fft_s16_cpx *freqdata);
-/*
- input timedata has nfft scalar points
- output freqdata has nfft/2+1 complex points
-*/
-
-void kiss_fftri_s16(kiss_fftr_s16_cfg cfg,const kiss_fft_s16_cpx *freqdata,kiss_fft_s16_scalar *timedata);
-/*
- input freqdata has nfft/2+1 complex points
- output timedata has nfft scalar points
-*/
-
-#define kiss_fftr_s16_free free
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/gst-libs/gst/fft/kiss_fftr_s32.c b/gst-libs/gst/fft/kiss_fftr_s32.c
deleted file mode 100644
index e2a8541a..00000000
--- a/gst-libs/gst/fft/kiss_fftr_s32.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
-Copyright (c) 2003-2004, Mark Borgerding
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * 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.
- * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-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 OWNER 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.
-*/
-
-#include "kiss_fftr_s32.h"
-#include "_kiss_fft_guts_s32.h"
-
-struct kiss_fftr_s32_state
-{
- kiss_fft_s32_cfg substate;
- kiss_fft_s32_cpx *tmpbuf;
- kiss_fft_s32_cpx *super_twiddles;
-#ifdef USE_SIMD
- long pad;
-#endif
-};
-
-kiss_fftr_s32_cfg
-kiss_fftr_s32_alloc (int nfft, int inverse_fft, void *mem, size_t * lenmem)
-{
- int i;
- kiss_fftr_s32_cfg st = NULL;
- size_t subsize, memneeded;
-
- if (nfft & 1) {
- fprintf (stderr, "Real FFT optimization must be even.\n");
- return NULL;
- }
- nfft >>= 1;
-
- kiss_fft_s32_alloc (nfft, inverse_fft, NULL, &subsize);
- memneeded = ALIGN_STRUCT (sizeof (struct kiss_fftr_s32_state))
- + ALIGN_STRUCT (subsize)
- + sizeof (kiss_fft_s32_cpx) * (nfft * 2);
-
- if (lenmem == NULL) {
- st = (kiss_fftr_s32_cfg) KISS_FFT_S32_MALLOC (memneeded);
- } else {
- if (*lenmem >= memneeded)
- st = (kiss_fftr_s32_cfg) mem;
- *lenmem = memneeded;
- }
- if (!st)
- return NULL;
-
- st->substate = (kiss_fft_s32_cfg) (((char *) st) + ALIGN_STRUCT (sizeof (struct kiss_fftr_s32_state))); /*just beyond kiss_fftr_s32_state struct */
- st->tmpbuf =
- (kiss_fft_s32_cpx *) (((char *) st->substate) + ALIGN_STRUCT (subsize));
- st->super_twiddles = st->tmpbuf + nfft;
- kiss_fft_s32_alloc (nfft, inverse_fft, st->substate, &subsize);
-
- for (i = 0; i < nfft; ++i) {
- double phase = -3.14159265358979323846264338327 * ((double) i / nfft + .5);
-
- if (inverse_fft)
- phase *= -1;
- kf_cexp (st->super_twiddles + i, phase);
- }
- return st;
-}
-
-void
-kiss_fftr_s32 (kiss_fftr_s32_cfg st, const kiss_fft_s32_scalar * timedata,
- kiss_fft_s32_cpx * freqdata)
-{
- /* input buffer timedata is stored row-wise */
- int k, ncfft;
- kiss_fft_s32_cpx fpnk, fpk, f1k, f2k, tw, tdc;
-
- if (st->substate->inverse) {
- fprintf (stderr, "kiss fft usage error: improper alloc\n");
- exit (1);
- }
-
- ncfft = st->substate->nfft;
-
- /*perform the parallel fft of two real signals packed in real,imag */
- kiss_fft_s32 (st->substate, (const kiss_fft_s32_cpx *) timedata, st->tmpbuf);
- /* The real part of the DC element of the frequency spectrum in st->tmpbuf
- * contains the sum of the even-numbered elements of the input time sequence
- * The imag part is the sum of the odd-numbered elements
- *
- * The sum of tdc.r and tdc.i is the sum of the input time sequence.
- * yielding DC of input time sequence
- * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1...
- * yielding Nyquist bin of input time sequence
- */
-
- tdc.r = st->tmpbuf[0].r;
- tdc.i = st->tmpbuf[0].i;
- C_FIXDIV (tdc, 2);
- CHECK_OVERFLOW_OP (tdc.r, +, tdc.i);
- CHECK_OVERFLOW_OP (tdc.r, -, tdc.i);
- freqdata[0].r = tdc.r + tdc.i;
- freqdata[ncfft].r = tdc.r - tdc.i;
-#ifdef USE_SIMD
- freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps (0);
-#else
- freqdata[ncfft].i = freqdata[0].i = 0;
-#endif
-
- for (k = 1; k <= ncfft / 2; ++k) {
- fpk = st->tmpbuf[k];
- fpnk.r = st->tmpbuf[ncfft - k].r;
- fpnk.i = -st->tmpbuf[ncfft - k].i;
- C_FIXDIV (fpk, 2);
- C_FIXDIV (fpnk, 2);
-
- C_ADD (f1k, fpk, fpnk);
- C_SUB (f2k, fpk, fpnk);
- C_MUL (tw, f2k, st->super_twiddles[k]);
-
- freqdata[k].r = HALF_OF (f1k.r + tw.r);
- freqdata[k].i = HALF_OF (f1k.i + tw.i);
- freqdata[ncfft - k].r = HALF_OF (f1k.r - tw.r);
- freqdata[ncfft - k].i = HALF_OF (tw.i - f1k.i);
- }
-}
-
-void
-kiss_fftri_s32 (kiss_fftr_s32_cfg st, const kiss_fft_s32_cpx * freqdata,
- kiss_fft_s32_scalar * timedata)
-{
- /* input buffer timedata is stored row-wise */
- int k, ncfft;
-
- if (st->substate->inverse == 0) {
- fprintf (stderr, "kiss fft usage error: improper alloc\n");
- exit (1);
- }
-
- ncfft = st->substate->nfft;
-
- st->tmpbuf[0].r = freqdata[0].r + freqdata[ncfft].r;
- st->tmpbuf[0].i = freqdata[0].r - freqdata[ncfft].r;
- C_FIXDIV (st->tmpbuf[0], 2);
-
- for (k = 1; k <= ncfft / 2; ++k) {
- kiss_fft_s32_cpx fk, fnkc, fek, fok, tmp;
-
- fk = freqdata[k];
- fnkc.r = freqdata[ncfft - k].r;
- fnkc.i = -freqdata[ncfft - k].i;
- C_FIXDIV (fk, 2);
- C_FIXDIV (fnkc, 2);
-
- C_ADD (fek, fk, fnkc);
- C_SUB (tmp, fk, fnkc);
- C_MUL (fok, tmp, st->super_twiddles[k]);
- C_ADD (st->tmpbuf[k], fek, fok);
- C_SUB (st->tmpbuf[ncfft - k], fek, fok);
-#ifdef USE_SIMD
- st->tmpbuf[ncfft - k].i *= _mm_set1_ps (-1.0);
-#else
- st->tmpbuf[ncfft - k].i *= -1;
-#endif
- }
- kiss_fft_s32 (st->substate, st->tmpbuf, (kiss_fft_s32_cpx *) timedata);
-}
diff --git a/gst-libs/gst/fft/kiss_fftr_s32.h b/gst-libs/gst/fft/kiss_fftr_s32.h
deleted file mode 100644
index 8e8fecb1..00000000
--- a/gst-libs/gst/fft/kiss_fftr_s32.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef KISS_FTR_S32_H
-#define KISS_FTR_S32_H
-
-#include "kiss_fft_s32.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
-
- Real optimized version can save about 45% cpu time vs. complex fft of a real seq.
-
-
-
- */
-
-typedef struct kiss_fftr_s32_state *kiss_fftr_s32_cfg;
-
-
-kiss_fftr_s32_cfg kiss_fftr_s32_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem);
-/*
- nfft must be even
-
- If you don't care to allocate space, use mem = lenmem = NULL
-*/
-
-
-void kiss_fftr_s32(kiss_fftr_s32_cfg cfg,const kiss_fft_s32_scalar *timedata,kiss_fft_s32_cpx *freqdata);
-/*
- input timedata has nfft scalar points
- output freqdata has nfft/2+1 complex points
-*/
-
-void kiss_fftri_s32(kiss_fftr_s32_cfg cfg,const kiss_fft_s32_cpx *freqdata,kiss_fft_s32_scalar *timedata);
-/*
- input freqdata has nfft/2+1 complex points
- output timedata has nfft scalar points
-*/
-
-#define kiss_fftr_s32_free free
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/gst-libs/gst/fft/kiss_version b/gst-libs/gst/fft/kiss_version
deleted file mode 100644
index c55188bb..00000000
--- a/gst-libs/gst/fft/kiss_version
+++ /dev/null
@@ -1,4 +0,0 @@
-Based on Kiss FFT version 1.2.6. http://kissfft.sourceforge.net
-
-Only changes are limitation to one data type for each version in
-kiss_fft.h and _kiss_fft_guts.h.
diff --git a/gst-libs/gst/floatcast/Makefile.am b/gst-libs/gst/floatcast/Makefile.am
deleted file mode 100644
index b18029c4..00000000
--- a/gst-libs/gst/floatcast/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-floatcastincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/floatcast
-floatcastinclude_HEADERS = floatcast.h
diff --git a/gst-libs/gst/floatcast/floatcast.h b/gst-libs/gst/floatcast/floatcast.h
deleted file mode 100644
index 279af282..00000000
--- a/gst-libs/gst/floatcast/floatcast.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Library <2002> Steve Baker <stevebaker_org@yahoo.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstfloatcast
- * @short_description: Floating point platform independence macros
- *
- * The floatcast.h header file contains a couple of convenience macros for
- * floating point numbers.
- *
- * If you include this header, your application or library must link against
- * libm (for maths.h support).
- *
- * For optimal results, your application&apos;s or library&apos;s build
- * system should check whether the C99 functions lrint and lrintf are supported
- * and define the preprocessor symbols HAVE_LRINT and HAVE_LRINTF if so. If
- * you are using autoconf, you can do this by using the AC_C99_FUNC_LRINT and
- * AC_C99_FUNC_LRINTF checks in your configure.ac or configure.in file and
- * including your application's config.h header before you include floatcast.h.
- */
-
-#ifndef __FLOATCAST_H__
-#define __FLOATCAST_H__
-
-#include <string.h>
-#include <glib.h>
-
-#if defined (_MSC_VER) && !defined (inline)
-#define inline __inline
-#endif
-
-G_BEGIN_DECLS
-
-/* FIXME 0.11: these gst_cast_*() functions are not used anywhere, so we could
- * just as well get rid of them and move the float/double swap macros into
- * gstutils.h in core */
-
-/**
- * gst_cast_float:
- * @x: input value
- *
- * Casts a 32-bit floating point value (float) to an integer without bias.
- */
-/**
- * gst_cast_double:
- * @x: input value
- *
- * Casts a 64-bit floating point value (double) to an integer without bias.
- */
-
-/* FIXME: HAVE_LRINT && HAVE_LRINTF are defined by config.h - they should
- * not be used in an installed header. */
-#if defined(HAVE_LRINT) && defined(HAVE_LRINTF)
-
- /* These defines enable functionality introduced with the 1999 ISO C
- ** standard. They must be defined before the inclusion of math.h to
- ** engage them. If optimisation is enabled, these functions will be
- ** inlined. With optimisation switched off, you have to link in the
- ** maths library using -lm.
- */
-
- #define _ISOC9X_SOURCE 1
- #define _ISOC99_SOURCE 1
-
- #define __USE_ISOC9X 1
- #define __USE_ISOC99 1
-
- #include <math.h>
-
- #define gst_cast_float(x) ((gint)lrintf(x))
- #define gst_cast_double(x) ((gint)lrint(x))
-
-#else
- #include <math.h>
-
- /* use a standard c cast, but do rounding correctly */
- #define gst_cast_float(x) ((gint)floor((x)+0.5))
- #define gst_cast_double(x) ((gint)floor((x)+0.5))
-
-#endif
-
-G_END_DECLS
-
-#endif /* __FLOATCAST_H__ */
-
diff --git a/gst-libs/gst/gettext.h b/gst-libs/gst/gettext.h
deleted file mode 100644
index 8b262f4c..00000000
--- a/gst-libs/gst/gettext.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Convenience header for conditional use of GNU <libintl.h>.
- Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published
- by the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- USA. */
-
-#ifndef _LIBGETTEXT_H
-#define _LIBGETTEXT_H 1
-
-/* NLS can be disabled through the configure --disable-nls option. */
-#if ENABLE_NLS
-
-/* Get declarations of GNU message catalog functions. */
-# include <libintl.h>
-
-#else
-
-/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
- chokes if dcgettext is defined as a macro. So include it now, to make
- later inclusions of <locale.h> a NOP. We don't include <libintl.h>
- as well because people using "gettext.h" will not include <libintl.h>,
- and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
- is OK. */
-#if defined(__sun)
-# include <locale.h>
-#endif
-
-/* Disabled NLS.
- The casts to 'const char *' serve the purpose of producing warnings
- for invalid uses of the value returned from these functions.
- On pre-ANSI systems without 'const', the config.h file is supposed to
- contain "#define const". */
-# define gettext(Msgid) ((const char *) (Msgid))
-# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
-# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
-# define ngettext(Msgid1, Msgid2, N) \
- ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
-# define dngettext(Domainname, Msgid1, Msgid2, N) \
- ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
-# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
- ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
-# define textdomain(Domainname) ((const char *) (Domainname))
-# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
-# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
-
-#endif
-
-/* A pseudo function call that serves as a marker for the automated
- extraction of messages, but does not call gettext(). The run-time
- translation is done at a different place in the code.
- The argument, String, should be a literal string. Concatenated strings
- and other string expressions won't work.
- The macro's expansion is not parenthesized, so that it is suitable as
- initializer for static 'char[]' or 'const char[]' variables. */
-#define gettext_noop(String) String
-
-#endif /* _LIBGETTEXT_H */
diff --git a/gst-libs/gst/gst-i18n-plugin.h b/gst-libs/gst/gst-i18n-plugin.h
deleted file mode 100644
index 2c37a615..00000000
--- a/gst-libs/gst/gst-i18n-plugin.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* GStreamer
- * Copyright (C) 2004 Thomas Vander Stichele <thomas@apestaart.org>
- *
- * gst-i18n-plugins.h: internationalization macros for the GStreamer 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_I18N_PLUGIN_H__
-#define __GST_I18N_PLUGIN_H__
-
-#include <locale.h> /* some people need it and some people don't */
-#include "gettext.h" /* included with gettext distribution and copied */
-
-#ifndef GETTEXT_PACKAGE
-#error You must define GETTEXT_PACKAGE before including this header.
-#endif
-
-/* we want to use shorthand _() for translating and N_() for marking */
-#define _(String) dgettext (GETTEXT_PACKAGE, String)
-#define N_(String) gettext_noop (String)
-/* FIXME: if we need it, we can add Q_ as well, like in glib */
-
-#endif /* __GST_I18N_PLUGIN_H__ */
diff --git a/gst-libs/gst/interfaces/.gitignore b/gst-libs/gst/interfaces/.gitignore
deleted file mode 100644
index d96df0c8..00000000
--- a/gst-libs/gst/interfaces/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-interfaces-enumtypes.c
-interfaces-enumtypes.h
-interfaces-marshal.c
-interfaces-marshal.h
-
diff --git a/gst-libs/gst/interfaces/Makefile.am b/gst-libs/gst/interfaces/Makefile.am
deleted file mode 100644
index 64943cba..00000000
--- a/gst-libs/gst/interfaces/Makefile.am
+++ /dev/null
@@ -1,113 +0,0 @@
-lib_LTLIBRARIES = libgstinterfaces-@GST_MAJORMINOR@.la
-libgstinterfacesincludedir = \
- $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/interfaces
-
-headers_interfaces = \
- colorbalance.h \
- colorbalancechannel.h \
- mixer.h \
- mixeroptions.h \
- mixertrack.h \
- navigation.h \
- propertyprobe.h \
- streamvolume.h \
- tuner.h \
- tunernorm.h \
- tunerchannel.h \
- videoorientation.h \
- xoverlay.h
-
-# variables used for enum/marshal generation
-glib_enum_headers = $(headers_interfaces)
-glib_enum_define = GST_INTERFACES
-glib_gen_prefix = gst_interfaces
-glib_gen_basename = interfaces
-
-built_sources = \
- interfaces-marshal.c \
- interfaces-enumtypes.c
-
-built_headers = \
- interfaces-marshal.h \
- interfaces-enumtypes.h
-
-libgstinterfacesinclude_HEADERS = \
- $(headers_interfaces)
-
-nodist_libgstinterfacesinclude_HEADERS = \
- interfaces-enumtypes.h
-
-libgstinterfaces_@GST_MAJORMINOR@_la_SOURCES = \
- colorbalance.c \
- colorbalancechannel.c \
- mixer.c \
- mixeroptions.c \
- mixertrack.c \
- navigation.c \
- propertyprobe.c \
- streamvolume.c \
- tuner.c \
- tunernorm.c \
- tunerchannel.c \
- videoorientation.c \
- xoverlay.c
-
-nodist_libgstinterfaces_@GST_MAJORMINOR@_la_SOURCES = \
- $(built_sources) \
- interfaces-marshal.h
-
-libgstinterfaces_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-libgstinterfaces_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS) $(LIBM)
-libgstinterfaces_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
-
-BUILT_SOURCES = \
- $(built_sources) \
- $(built_headers)
-
-EXTRA_DIST = interfaces-marshal.list
-
-CLEANFILES = $(BUILT_SOURCES)
-
-include $(top_srcdir)/common/gst-glib-gen.mak
-
-if HAVE_INTROSPECTION
-BUILT_GIRSOURCES = GstInterfaces-@GST_MAJORMINOR@.gir
-
-gir_headers=$(patsubst %,$(srcdir)/%, $(libgstinterfacesinclude_HEADERS))
-gir_headers+=$(patsubst %,$(builddir)/%, $(nodist_libgstinterfacesinclude_HEADERS))
-gir_sources=$(patsubst %,$(srcdir)/%, $(libgstinterfaces_@GST_MAJORMINOR@_la_SOURCES))
-gir_sources+=$(patsubst %,$(builddir)/%, $(nodist_libgstinterfaces_@GST_MAJORMINOR@_la_SOURCES))
-gir_cincludes=$(patsubst %,--c-include='gst/interfaces/%',$(libgstinterfacesinclude_HEADERS))
-gir_cincludes+=$(patsubst %,--c-include='gst/interfaces/%',$(nodist_libgstinterfacesinclude_HEADERS))
-
-GstInterfaces-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstinterfaces-@GST_MAJORMINOR@.la
- PKG_CONFIG_PATH="$(PKG_CONFIG_PATH):$(top_builddir)/pkgconfig" \
- $(INTROSPECTION_SCANNER) -v --namespace GstInterfaces \
- --nsversion=@GST_MAJORMINOR@ \
- --strip-prefix=Gst \
- $(gir_cincludes) \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst \
- --library=gstinterfaces-0.10 \
- --include=Gst-0.10 \
- --libtool="$(top_builddir)/libtool" \
- --pkg gstreamer-0.10 \
- --output $@ \
- $(gir_headers) \
- $(gir_sources)
-
-# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
-# install anything - we need to install inside our prefix.
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(BUILT_GIRSOURCES)
-
-typelibsdir = $(libdir)/girepository-1.0/
-
-typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
-
-%.typelib: %.gir $(INTROSPECTION_COMPILER)
- $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=$(builddir) --includedir=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
-CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
-endif
diff --git a/gst-libs/gst/interfaces/colorbalance.c b/gst-libs/gst/interfaces/colorbalance.c
deleted file mode 100644
index 319c1b92..00000000
--- a/gst-libs/gst/interfaces/colorbalance.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/* GStreamer Color Balance
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * colorbalance.c: image color balance interface design
- * virtual class function wrappers
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "colorbalance.h"
-#include "interfaces-marshal.h"
-
-/**
- * SECTION:gstcolorbalance
- * @short_description: Interface for adjusting color balance settings
- *
- * <refsect2><para>
- * This interface is implemented by elements which can perform some color
- * balance operation on video frames they process. For example, modifying
- * the brightness, contrast, hue or saturation.
- * </para><para>
- * Example elements are 'xvimagesink' and 'colorbalance'
- * </para>
- * </refsect2>
- */
-
-enum
-{
- VALUE_CHANGED,
- LAST_SIGNAL
-};
-
-static void gst_color_balance_class_init (GstColorBalanceClass * klass);
-
-static guint gst_color_balance_signals[LAST_SIGNAL] = { 0 };
-
-GType
-gst_color_balance_get_type (void)
-{
- static GType gst_color_balance_type = 0;
-
- if (!gst_color_balance_type) {
- static const GTypeInfo gst_color_balance_info = {
- sizeof (GstColorBalanceClass),
- (GBaseInitFunc) gst_color_balance_class_init,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- 0,
- NULL,
- };
-
- gst_color_balance_type = g_type_register_static (G_TYPE_INTERFACE,
- "GstColorBalance", &gst_color_balance_info, 0);
- g_type_interface_add_prerequisite (gst_color_balance_type,
- GST_TYPE_IMPLEMENTS_INTERFACE);
- }
-
- return gst_color_balance_type;
-}
-
-static void
-gst_color_balance_class_init (GstColorBalanceClass * klass)
-{
- static gboolean initialized = FALSE;
-
- if (!initialized) {
- /**
- * GstColorBalance::value-changed:
- * @colorbalance: The GstColorBalance instance
- * @channel: The #GstColorBalanceChannel
- * @value: The new value
- *
- * Fired when the value of the indicated channel has changed.
- */
- gst_color_balance_signals[VALUE_CHANGED] =
- g_signal_new ("value-changed",
- GST_TYPE_COLOR_BALANCE, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstColorBalanceClass, value_changed),
- NULL, NULL,
- gst_interfaces_marshal_VOID__OBJECT_INT,
- G_TYPE_NONE, 2, GST_TYPE_COLOR_BALANCE_CHANNEL, G_TYPE_INT);
-
- initialized = TRUE;
- }
-
- klass->balance_type = GST_COLOR_BALANCE_SOFTWARE;
-
- /* default virtual functions */
- klass->list_channels = NULL;
- klass->set_value = NULL;
- klass->get_value = NULL;
-}
-
-/**
- * gst_color_balance_list_channels:
- * @balance: A #GstColorBalance instance
- *
- * Retrieve a list of the available channels.
- *
- * Returns: A GList containing pointers to #GstColorBalanceChannel objects.
- * The list is owned by the #GstColorBalance instance and must not
- * be freed.
- */
-const GList *
-gst_color_balance_list_channels (GstColorBalance * balance)
-{
- GstColorBalanceClass *klass = GST_COLOR_BALANCE_GET_CLASS (balance);
-
- if (klass->list_channels) {
- return klass->list_channels (balance);
- }
-
- return NULL;
-}
-
-/**
- * gst_color_balance_set_value:
- * @balance: A #GstColorBalance instance
- * @channel: A #GstColorBalanceChannel instance
- * @value: The new value for the channel.
- *
- * Sets the current value of the channel to the passed value, which must
- * be between min_value and max_value.
- *
- * See Also: The #GstColorBalanceChannel::min_value and
- * #GstColorBalanceChannel::max_value members of the
- * #GstColorBalanceChannel object.
- */
-void
-gst_color_balance_set_value (GstColorBalance * balance,
- GstColorBalanceChannel * channel, gint value)
-{
- GstColorBalanceClass *klass = GST_COLOR_BALANCE_GET_CLASS (balance);
-
- if (klass->set_value) {
- klass->set_value (balance, channel, value);
- }
-}
-
-/**
- * gst_color_balance_get_value:
- * @balance: A #GstColorBalance instance
- * @channel: A #GstColorBalanceChannel instance
- *
- * Retrieve the current value of the indicated channel, between min_value
- * and max_value.
- *
- * See Also: The #GstColorBalanceChannel::min_value and
- * #GstColorBalanceChannel::max_value members of the
- * #GstColorBalanceChannel object.
- *
- * Returns: The current value of the channel.
- */
-gint
-gst_color_balance_get_value (GstColorBalance * balance,
- GstColorBalanceChannel * channel)
-{
- GstColorBalanceClass *klass = GST_COLOR_BALANCE_GET_CLASS (balance);
-
- if (klass->get_value) {
- return klass->get_value (balance, channel);
- }
-
- return channel->min_value;
-}
-
-/**
- * gst_color_balance_get_balance_type:
- * @balance: The #GstColorBalance implementation
- *
- * Get the #GstColorBalanceType of this implementation.
- *
- * Returns: A the #GstColorBalanceType.
- *
- * Since: 0.10.24
- */
-GstColorBalanceType
-gst_color_balance_get_balance_type (GstColorBalance * balance)
-{
- GstColorBalanceClass *klass = GST_COLOR_BALANCE_GET_CLASS (balance);
-
- return klass->balance_type;
-}
-
-/**
- * gst_color_balance_value_changed:
- * @balance: A #GstColorBalance instance
- * @channel: A #GstColorBalanceChannel whose value has changed
- * @value: The new value of the channel
- *
- * A helper function called by implementations of the GstColorBalance
- * interface. It fires the #GstColorBalance::value-changed signal on the
- * instance, and the #GstColorBalanceChannel::value-changed signal on the
- * channel object.
- */
-void
-gst_color_balance_value_changed (GstColorBalance * balance,
- GstColorBalanceChannel * channel, gint value)
-{
- g_signal_emit (G_OBJECT (balance),
- gst_color_balance_signals[VALUE_CHANGED], 0, channel, value);
-
- g_signal_emit_by_name (G_OBJECT (channel), "value_changed", value);
-}
diff --git a/gst-libs/gst/interfaces/colorbalance.h b/gst-libs/gst/interfaces/colorbalance.h
deleted file mode 100644
index 2be7db6c..00000000
--- a/gst-libs/gst/interfaces/colorbalance.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_COLOR_BALANCE_H__
-#define __GST_COLOR_BALANCE_H__
-
-#include <gst/gst.h>
-#include <gst/interfaces/colorbalancechannel.h>
-#include <gst/interfaces/interfaces-enumtypes.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_COLOR_BALANCE \
- (gst_color_balance_get_type ())
-#define GST_COLOR_BALANCE(obj) \
- (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_COLOR_BALANCE, \
- GstColorBalance))
-#define GST_COLOR_BALANCE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_COLOR_BALANCE, \
- GstColorBalanceClass))
-#define GST_IS_COLOR_BALANCE(obj) \
- (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_COLOR_BALANCE))
-#define GST_IS_COLOR_BALANCE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_COLOR_BALANCE))
-#define GST_COLOR_BALANCE_GET_CLASS(inst) \
- (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_COLOR_BALANCE, GstColorBalanceClass))
-
-#define GST_COLOR_BALANCE_TYPE(klass) (klass->balance_type)
-
-typedef struct _GstColorBalance GstColorBalance;
-typedef struct _GstColorBalanceClass GstColorBalanceClass;
-
-/**
- * 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;
-
-struct _GstColorBalanceClass {
- GTypeInterface klass;
-
- GstColorBalanceType balance_type;
-
- /* virtual functions */
- const GList * (* list_channels) (GstColorBalance *balance);
-
- void (* set_value) (GstColorBalance *balance,
- GstColorBalanceChannel *channel,
- gint value);
- gint (* get_value) (GstColorBalance *balance,
- GstColorBalanceChannel *channel);
-
- /* signals */
- void (* value_changed) (GstColorBalance *balance,
- GstColorBalanceChannel *channel,
- gint value);
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_color_balance_get_type (void);
-
-/* virtual class function wrappers */
-const GList *
- gst_color_balance_list_channels (GstColorBalance *balance);
-void gst_color_balance_set_value (GstColorBalance *balance,
- GstColorBalanceChannel *channel,
- gint value);
-gint gst_color_balance_get_value (GstColorBalance *balance,
- GstColorBalanceChannel *channel);
-
-GstColorBalanceType
- gst_color_balance_get_balance_type (GstColorBalance *balance);
-
-/* trigger signal */
-void gst_color_balance_value_changed (GstColorBalance *balance,
- GstColorBalanceChannel *channel,
- gint value);
-
-G_END_DECLS
-
-#endif /* __GST_COLOR_BALANCE_H__ */
diff --git a/gst-libs/gst/interfaces/colorbalancechannel.c b/gst-libs/gst/interfaces/colorbalancechannel.c
deleted file mode 100644
index ae22fba8..00000000
--- a/gst-libs/gst/interfaces/colorbalancechannel.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* GStreamer Color Balance
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * colorbalancechannel.c: colorbalance channel object 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "colorbalancechannel.h"
-
-/**
- * SECTION:gstcolorbalancechannel
- * @short_description: Object representing a channel from the #GstColorBalance
- * interface.
- *
- * <refsect2><para>The #GstColorBalanceChannel object represents a parameter
- * for modifying the color balance implemented by an element providing the
- * #GstColorBalance interface. For example, Hue or Saturation.
- * </para></refsect2>
- */
-
-enum
-{
- /* FILL ME */
- SIGNAL_VALUE_CHANGED,
- LAST_SIGNAL
-};
-
-static void gst_color_balance_channel_class_init (GstColorBalanceChannelClass *
- klass);
-static void gst_color_balance_channel_init (GstColorBalanceChannel * balance);
-static void gst_color_balance_channel_dispose (GObject * object);
-
-static GObjectClass *parent_class = NULL;
-static guint signals[LAST_SIGNAL] = { 0 };
-
-GType
-gst_color_balance_channel_get_type (void)
-{
- static GType gst_color_balance_channel_type = 0;
-
- if (!gst_color_balance_channel_type) {
- static const GTypeInfo color_balance_channel_info = {
- sizeof (GstColorBalanceChannelClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_color_balance_channel_class_init,
- NULL,
- NULL,
- sizeof (GstColorBalanceChannel),
- 0,
- (GInstanceInitFunc) gst_color_balance_channel_init,
- NULL
- };
-
- gst_color_balance_channel_type =
- g_type_register_static (G_TYPE_OBJECT,
- "GstColorBalanceChannel", &color_balance_channel_info, 0);
- }
-
- return gst_color_balance_channel_type;
-}
-
-static void
-gst_color_balance_channel_class_init (GstColorBalanceChannelClass * klass)
-{
- GObjectClass *object_klass = (GObjectClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- /**
- * GstColorBalanceChannel::value-changed:
- * @channel: The #GstColorBalanceChannel
- * @value: The new value
- *
- * Fired when the value of the indicated channel has changed.
- */
- signals[SIGNAL_VALUE_CHANGED] =
- g_signal_new ("value-changed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstColorBalanceChannelClass,
- value_changed),
- NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
-
- object_klass->dispose = gst_color_balance_channel_dispose;
-}
-
-static void
-gst_color_balance_channel_init (GstColorBalanceChannel * channel)
-{
- channel->label = NULL;
- channel->min_value = channel->max_value = 0;
-}
-
-static void
-gst_color_balance_channel_dispose (GObject * object)
-{
- GstColorBalanceChannel *channel = GST_COLOR_BALANCE_CHANNEL (object);
-
- if (channel->label)
- g_free (channel->label);
-
- channel->label = NULL;
-
- if (parent_class->dispose)
- parent_class->dispose (object);
-}
diff --git a/gst-libs/gst/interfaces/colorbalancechannel.h b/gst-libs/gst/interfaces/colorbalancechannel.h
deleted file mode 100644
index f279f38a..00000000
--- a/gst-libs/gst/interfaces/colorbalancechannel.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_COLOR_BALANCE_CHANNEL_H__
-#define __GST_COLOR_BALANCE_CHANNEL_H__
-
-#include <gst/gst.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;
-};
-
-
-struct _GstColorBalanceChannelClass {
- GObjectClass parent;
-
- /* signals */
- void (* value_changed) (GstColorBalanceChannel *channel,
- gint value);
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_color_balance_channel_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_COLOR_BALANCE_CHANNEL_H__ */
diff --git a/gst-libs/gst/interfaces/interfaces-marshal.list b/gst-libs/gst/interfaces/interfaces-marshal.list
deleted file mode 100644
index cb7469c2..00000000
--- a/gst-libs/gst/interfaces/interfaces-marshal.list
+++ /dev/null
@@ -1,5 +0,0 @@
-VOID:OBJECT,BOOLEAN
-VOID:OBJECT,POINTER
-VOID:OBJECT,STRING
-VOID:OBJECT,ULONG
-VOID:OBJECT,INT
diff --git a/gst-libs/gst/interfaces/mixer.c b/gst-libs/gst/interfaces/mixer.c
deleted file mode 100644
index 57907c03..00000000
--- a/gst-libs/gst/interfaces/mixer.c
+++ /dev/null
@@ -1,872 +0,0 @@
-/* GStreamer Mixer
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * mixer.c: mixer design virtual class function wrappers
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "mixer.h"
-#include "interfaces-marshal.h"
-
-#define GST_MIXER_MESSAGE_NAME "gst-mixer-message"
-
-/**
- * SECTION:gstmixer
- * @short_description: Interface for elements that provide mixer operations
- * @see_also: alsamixer, oss4mixer, sunaudiomixer
- *
- * Basic interface for hardware mixer controls.
- *
- * Applications rarely need to use this interface, it is provided mainly
- * for system-level mixer applets and the like. Volume control in playback
- * applications should be done using a <classname>volume</classname>
- * element or, if available, using the <quote>volume</quote> property of
- * the audio sink element used (as provided by <classname>pulsesink</classname>
- * for example), or even better: just use the <classname>playbin2</classname>
- * element's <quote>volume</quote> property.
- *
- * Usage: In order to use the <classname>GstMixer</classname> interface, the
- * element needs to be at least in READY state (so that the element has opened
- * the mixer device). Once the element has been set to READY state or higher,
- * it can be cast to a <classname>GstMixer</classname> using the GST_MIXER
- * macro (in C) and the mixer API can be used.
- */
-
-#ifndef GST_DISABLE_DEPRECATED
-enum
-{
- SIGNAL_MUTE_TOGGLED,
- SIGNAL_RECORD_TOGGLED,
- SIGNAL_VOLUME_CHANGED,
- SIGNAL_OPTION_CHANGED,
- LAST_SIGNAL
-};
-
-static guint gst_mixer_signals[LAST_SIGNAL] = { 0 };
-
-#endif
-
-static void gst_mixer_class_init (GstMixerClass * klass);
-
-GType
-gst_mixer_get_type (void)
-{
- static GType gst_mixer_type = 0;
-
- if (!gst_mixer_type) {
- static const GTypeInfo gst_mixer_info = {
- sizeof (GstMixerClass),
- (GBaseInitFunc) gst_mixer_class_init,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- 0,
- NULL,
- };
-
- gst_mixer_type = g_type_register_static (G_TYPE_INTERFACE,
- "GstMixer", &gst_mixer_info, 0);
- g_type_interface_add_prerequisite (gst_mixer_type,
- GST_TYPE_IMPLEMENTS_INTERFACE);
- }
-
- return gst_mixer_type;
-}
-
-static void
-gst_mixer_class_init (GstMixerClass * klass)
-{
-#ifndef GST_DISABLE_DEPRECATED
- static gboolean initialized = FALSE;
-
- /* signals (deprecated) */
- if (!initialized) {
- gst_mixer_signals[SIGNAL_RECORD_TOGGLED] =
- g_signal_new ("record-toggled",
- GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstMixerClass, record_toggled),
- NULL, NULL,
- gst_interfaces_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2,
- GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN);
- gst_mixer_signals[SIGNAL_MUTE_TOGGLED] =
- g_signal_new ("mute-toggled",
- GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstMixerClass, mute_toggled),
- NULL, NULL,
- gst_interfaces_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2,
- GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN);
- gst_mixer_signals[SIGNAL_VOLUME_CHANGED] =
- g_signal_new ("volume-changed",
- GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstMixerClass, volume_changed),
- NULL, NULL,
- gst_interfaces_marshal_VOID__OBJECT_POINTER, G_TYPE_NONE, 2,
- GST_TYPE_MIXER_TRACK, G_TYPE_POINTER);
- gst_mixer_signals[SIGNAL_OPTION_CHANGED] =
- g_signal_new ("option-changed",
- GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstMixerClass, option_changed),
- NULL, NULL,
- gst_interfaces_marshal_VOID__OBJECT_STRING, G_TYPE_NONE, 2,
- GST_TYPE_MIXER_OPTIONS, G_TYPE_STRING);
-
- initialized = TRUE;
- }
-#endif
-
- klass->mixer_type = GST_MIXER_SOFTWARE;
-
- /* default virtual functions */
- klass->list_tracks = NULL;
- klass->set_volume = NULL;
- klass->get_volume = NULL;
- klass->set_mute = NULL;
- klass->set_record = NULL;
- klass->set_option = NULL;
- klass->get_option = NULL;
-}
-
-/**
- * gst_mixer_list_tracks:
- * @mixer: the #GstMixer (a #GstElement) to get the tracks from.
- *
- * Returns a list of available tracks for this mixer/element. Note
- * that it is allowed for sink (output) elements to only provide
- * the output tracks in this list. Likewise, for sources (inputs),
- * it is allowed to only provide input elements in this list.
- *
- * Returns: A #GList consisting of zero or more #GstMixerTracks.
- * The list is owned by the #GstMixer instance and must not be freed
- * or modified.
- */
-
-const GList *
-gst_mixer_list_tracks (GstMixer * mixer)
-{
- GstMixerClass *klass;
-
- g_return_val_if_fail (mixer != NULL, NULL);
-
- klass = GST_MIXER_GET_CLASS (mixer);
-
- if (klass->list_tracks) {
- return klass->list_tracks (mixer);
- }
-
- return NULL;
-}
-
-/**
- * gst_mixer_set_volume:
- * @mixer: The #GstMixer (a #GstElement) that owns the track.
- * @track: The #GstMixerTrack to set the volume on.
- * @volumes: an array of integers (of size track->num_channels)
- * that gives the wanted volume for each channel in
- * this track.
- *
- * Sets the volume on each channel in a track. Short note about
- * naming: a track is defined as one separate stream owned by
- * the mixer/element, such as 'Line-in' or 'Microphone'. A
- * channel is said to be a mono-stream inside this track. A
- * stereo track thus contains two channels.
- */
-
-void
-gst_mixer_set_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
-{
- GstMixerClass *klass;
-
- g_return_if_fail (mixer != NULL);
- g_return_if_fail (track != NULL);
- g_return_if_fail (volumes != NULL);
-
- klass = GST_MIXER_GET_CLASS (mixer);
-
- if (klass->set_volume) {
- klass->set_volume (mixer, track, volumes);
- }
-}
-
-/**
- * gst_mixer_get_volume:
- * @mixer: the #GstMixer (a #GstElement) that owns the track
- * @track: the GstMixerTrack to get the volume from.
- * @volumes: a pre-allocated array of integers (of size
- * track->num_channels) to store the current volume
- * of each channel in the given track in.
- *
- * Get the current volume(s) on the given track.
- */
-
-void
-gst_mixer_get_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
-{
- GstMixerClass *klass;
-
- g_return_if_fail (mixer != NULL);
- g_return_if_fail (track != NULL);
- g_return_if_fail (volumes != NULL);
-
- klass = GST_MIXER_GET_CLASS (mixer);
-
- if (klass->get_volume) {
- klass->get_volume (mixer, track, volumes);
- } else {
- gint i;
-
- for (i = 0; i < track->num_channels; i++) {
- volumes[i] = 0;
- }
- }
-}
-
-/**
- * gst_mixer_set_mute:
- * @mixer: the #GstMixer (a #GstElement) that owns the track.
- * @track: the #GstMixerTrack to operate on.
- * @mute: a boolean value indicating whether to turn on or off
- * muting.
- *
- * Mutes or unmutes the given channel. To find out whether a
- * track is currently muted, use GST_MIXER_TRACK_HAS_FLAG ().
- */
-
-void
-gst_mixer_set_mute (GstMixer * mixer, GstMixerTrack * track, gboolean mute)
-{
- GstMixerClass *klass;
-
- g_return_if_fail (mixer != NULL);
- g_return_if_fail (track != NULL);
-
- klass = GST_MIXER_GET_CLASS (mixer);
-
- if (klass->set_mute) {
- klass->set_mute (mixer, track, mute);
- }
-}
-
-/**
- * gst_mixer_set_record:
- * @mixer: The #GstMixer (a #GstElement) that owns the track.
- * @track: the #GstMixerTrack to operate on.
- * @record: a boolean value that indicates whether to turn on
- * or off recording.
- *
- * Enables or disables recording on the given track. Note that
- * this is only possible on input tracks, not on output tracks
- * (see GST_MIXER_TRACK_HAS_FLAG () and the GST_MIXER_TRACK_INPUT
- * flag).
- */
-
-void
-gst_mixer_set_record (GstMixer * mixer, GstMixerTrack * track, gboolean record)
-{
- GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
-
- if (klass->set_record) {
- klass->set_record (mixer, track, record);
- }
-}
-
-/**
- * gst_mixer_set_option:
- * @mixer: The #GstMixer (a #GstElement) that owns the optionlist.
- * @opts: The #GstMixerOptions that we operate on.
- * @value: The requested new option value.
- *
- * Sets a name/value option in the mixer to the requested value.
- */
-
-void
-gst_mixer_set_option (GstMixer * mixer, GstMixerOptions * opts, gchar * value)
-{
- GstMixerClass *klass;
-
- g_return_if_fail (mixer != NULL);
- g_return_if_fail (opts != NULL);
-
- klass = GST_MIXER_GET_CLASS (mixer);
-
- if (klass->set_option) {
- klass->set_option (mixer, opts, value);
- }
-}
-
-/**
- * gst_mixer_get_option:
- * @mixer: The #GstMixer (a #GstElement) that owns the optionlist.
- * @opts: The #GstMixerOptions that we operate on.
- *
- * Get the current value of a name/value option in the mixer.
- *
- * Returns: current value of the name/value option.
- */
-
-const gchar *
-gst_mixer_get_option (GstMixer * mixer, GstMixerOptions * opts)
-{
- GstMixerClass *klass;
-
- g_return_val_if_fail (mixer != NULL, NULL);
- g_return_val_if_fail (opts != NULL, NULL);
-
- klass = GST_MIXER_GET_CLASS (mixer);
-
- if (klass->get_option) {
- return klass->get_option (mixer, opts);
- }
-
- return NULL;
-}
-
-/**
- * gst_mixer_get_mixer_type:
- * @mixer: The #GstMixer implementation
- *
- * Get the #GstMixerType of this mixer implementation.
- *
- * Returns: A the #GstMixerType.
- *
- * Since: 0.10.24
- */
-GstMixerType
-gst_mixer_get_mixer_type (GstMixer * mixer)
-{
- GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
-
- return klass->mixer_type;
-}
-
-/**
- * gst_mixer_get_mixer_flags:
- * @mixer: The #GstMixer implementation
- *
- * Get the set of supported flags for this mixer implementation.
- *
- * Returns: A set of or-ed GstMixerFlags for supported features.
- */
-GstMixerFlags
-gst_mixer_get_mixer_flags (GstMixer * mixer)
-{
- GstMixerClass *klass;
-
- g_return_val_if_fail (mixer != NULL, FALSE);
- klass = GST_MIXER_GET_CLASS (mixer);
-
- if (klass->get_mixer_flags) {
- return klass->get_mixer_flags (mixer);
- }
- return GST_MIXER_FLAG_NONE;
-}
-
-/**
- * gst_mixer_mute_toggled:
- * @mixer: the #GstMixer (a #GstElement) that owns the track
- * @track: the GstMixerTrack that has change mute state.
- * @mute: the new state of the mute flag on the track
- *
- * This function is called by the mixer implementation to produce
- * a notification message on the bus indicating that the given track
- * has changed mute state.
- *
- * This function only works for GstElements that are implementing the
- * GstMixer interface, and the element needs to have been provided a bus.
- */
-void
-gst_mixer_mute_toggled (GstMixer * mixer, GstMixerTrack * track, gboolean mute)
-{
- GstStructure *s;
- GstMessage *m;
-
- g_return_if_fail (mixer != NULL);
- g_return_if_fail (GST_IS_ELEMENT (mixer));
- g_return_if_fail (track != NULL);
-
- s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
- "type", G_TYPE_STRING, "mute-toggled",
- "track", GST_TYPE_MIXER_TRACK, track, "mute", G_TYPE_BOOLEAN, mute, NULL);
-
- m = gst_message_new_element (GST_OBJECT (mixer), s);
- if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
- GST_WARNING ("This element has no bus, therefore no message sent!");
- }
-}
-
-/**
- * gst_mixer_record_toggled:
- * @mixer: the #GstMixer (a #GstElement) that owns the track
- * @track: the GstMixerTrack that has changed recording state.
- * @record: the new state of the record flag on the track
- *
- * This function is called by the mixer implementation to produce
- * a notification message on the bus indicating that the given track
- * has changed recording state.
- *
- * This function only works for GstElements that are implementing the
- * GstMixer interface, and the element needs to have been provided a bus.
- */
-void
-gst_mixer_record_toggled (GstMixer * mixer,
- GstMixerTrack * track, gboolean record)
-{
- GstStructure *s;
- GstMessage *m;
-
- g_return_if_fail (mixer != NULL);
- g_return_if_fail (GST_IS_ELEMENT (mixer));
- g_return_if_fail (track != NULL);
-
- s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
- "type", G_TYPE_STRING, "record-toggled",
- "track", GST_TYPE_MIXER_TRACK, track,
- "record", G_TYPE_BOOLEAN, record, NULL);
-
- m = gst_message_new_element (GST_OBJECT (mixer), s);
- if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
- GST_WARNING ("This element has no bus, therefore no message sent!");
- }
-}
-
-/**
- * gst_mixer_volume_changed:
- * @mixer: the #GstMixer (a #GstElement) that owns the track
- * @track: the GstMixerTrack that has changed.
- * @volumes: Array of volume values, one per channel on the mixer track.
- *
- * This function is called by the mixer implementation to produce
- * a notification message on the bus indicating that the volume(s) for the
- * given track have changed.
- *
- * This function only works for GstElements that are implementing the
- * GstMixer interface, and the element needs to have been provided a bus.
- */
-void
-gst_mixer_volume_changed (GstMixer * mixer,
- GstMixerTrack * track, gint * volumes)
-{
- GstStructure *s;
- GstMessage *m;
- GValue l = { 0, };
- GValue v = { 0, };
- gint i;
-
- g_return_if_fail (mixer != NULL);
- g_return_if_fail (GST_IS_ELEMENT (mixer));
- g_return_if_fail (track != NULL);
-
- s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
- "type", G_TYPE_STRING, "volume-changed",
- "track", GST_TYPE_MIXER_TRACK, track, NULL);
-
- g_value_init (&l, GST_TYPE_ARRAY);
-
- g_value_init (&v, G_TYPE_INT);
-
- /* FIXME 0.11: pass track->num_channels to the function */
- for (i = 0; i < track->num_channels; ++i) {
- g_value_set_int (&v, volumes[i]);
- gst_value_array_append_value (&l, &v);
- }
- g_value_unset (&v);
-
- gst_structure_set_value (s, "volumes", &l);
- g_value_unset (&l);
-
- m = gst_message_new_element (GST_OBJECT (mixer), s);
- if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
- GST_WARNING ("This element has no bus, therefore no message sent!");
- }
-}
-
-/**
- * gst_mixer_option_changed:
- * @mixer: the #GstMixer (a #GstElement) that owns the options
- * @opts: the GstMixerOptions that has changed value.
- * @value: the new value of the GstMixerOptions.
- *
- * This function is called by the mixer implementation to produce
- * a notification message on the bus indicating that the given options
- * object has changed state.
- *
- * This function only works for GstElements that are implementing the
- * GstMixer interface, and the element needs to have been provided a bus.
- */
-void
-gst_mixer_option_changed (GstMixer * mixer,
- GstMixerOptions * opts, gchar * value)
-{
- GstStructure *s;
- GstMessage *m;
-
- g_return_if_fail (mixer != NULL);
- g_return_if_fail (GST_IS_ELEMENT (mixer));
- g_return_if_fail (opts != NULL);
-
- s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
- "type", G_TYPE_STRING, "option-changed",
- "options", GST_TYPE_MIXER_OPTIONS, opts,
- "value", G_TYPE_STRING, value, NULL);
-
- m = gst_message_new_element (GST_OBJECT (mixer), s);
- if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
- GST_WARNING ("This element has no bus, therefore no message sent!");
- }
-}
-
-/**
- * gst_mixer_options_list_changed:
- * @mixer: the #GstMixer (a #GstElement) that owns the options
- * @opts: the GstMixerOptions whose list of values has changed
- *
- * This function is called by the mixer implementation to produce
- * a notification message on the bus indicating that the list of possible
- * options of a given options object has changed.
- *
- * The new options are not contained in the message on purpose. Applications
- * should call gst_mixer_option_get_values() on @opts to make @opts update
- * its internal state and obtain the new list of values.
- *
- * This function only works for GstElements that are implementing the
- * GstMixer interface, and the element needs to have been provided a bus
- * for this to work.
- *
- * Since: 0.10.18
- */
-void
-gst_mixer_options_list_changed (GstMixer * mixer, GstMixerOptions * opts)
-{
- GstStructure *s;
- GstMessage *m;
-
- g_return_if_fail (mixer != NULL);
- g_return_if_fail (GST_IS_ELEMENT (mixer));
- g_return_if_fail (opts != NULL);
- g_return_if_fail (GST_IS_MIXER_OPTIONS (opts));
-
- /* we do not include the new list here on purpose, so that the application
- * has to use gst_mixer_options_get_values() to get the new list, which then
- * allows the mixer options object to update the internal GList in a somewhat
- * thread-safe way at least */
- s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
- "type", G_TYPE_STRING, "options-list-changed",
- "options", GST_TYPE_MIXER_OPTIONS, opts, NULL);
-
- m = gst_message_new_element (GST_OBJECT (mixer), s);
- if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
- GST_WARNING ("This element has no bus, therefore no message sent!");
- }
-}
-
-/**
- * gst_mixer_mixer_changed:
- * @mixer: the #GstMixer (a #GstElement) which has changed
- *
- * This function is called by the mixer implementation to produce
- * a notification message on the bus indicating that the list of available
- * mixer tracks for a given mixer object has changed. Applications should
- * rebuild their interface when they receive this message.
- *
- * This function only works for GstElements that are implementing the
- * GstMixer interface, and the element needs to have been provided a bus.
- *
- * Since: 0.10.18
- */
-void
-gst_mixer_mixer_changed (GstMixer * mixer)
-{
- GstStructure *s;
- GstMessage *m;
-
- g_return_if_fail (mixer != NULL);
- g_return_if_fail (GST_IS_ELEMENT (mixer));
-
- s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
- "type", G_TYPE_STRING, "mixer-changed", NULL);
-
- m = gst_message_new_element (GST_OBJECT (mixer), s);
- if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
- GST_WARNING ("This element has no bus, therefore no message sent!");
- }
-}
-
-static gboolean
-gst_mixer_message_is_mixer_message (GstMessage * message)
-{
- const GstStructure *s;
-
- if (message == NULL)
- return FALSE;
- if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- return FALSE;
-
- s = gst_message_get_structure (message);
- return gst_structure_has_name (s, GST_MIXER_MESSAGE_NAME);
-}
-
-/**
- * gst_mixer_message_get_type:
- * @message: A GstMessage to inspect.
- *
- * Check a bus message to see if it is a GstMixer notification
- * message and return the GstMixerMessageType identifying which
- * type of notification it is.
- *
- * Returns: The type of the GstMixerMessage, or GST_MIXER_MESSAGE_INVALID
- * if the message is not a GstMixer notification.
- *
- * Since: 0.10.14
- */
-GstMixerMessageType
-gst_mixer_message_get_type (GstMessage * message)
-{
- const GstStructure *s;
- const gchar *m_type;
-
- if (!gst_mixer_message_is_mixer_message (message))
- return GST_MIXER_MESSAGE_INVALID;
-
- s = gst_message_get_structure (message);
- m_type = gst_structure_get_string (s, "type");
- g_return_val_if_fail (m_type != NULL, GST_MIXER_MESSAGE_INVALID);
-
- if (g_str_equal (m_type, "mute-toggled"))
- return GST_MIXER_MESSAGE_MUTE_TOGGLED;
- else if (g_str_equal (m_type, "record-toggled"))
- return GST_MIXER_MESSAGE_RECORD_TOGGLED;
- else if (g_str_equal (m_type, "volume-changed"))
- return GST_MIXER_MESSAGE_VOLUME_CHANGED;
- else if (g_str_equal (m_type, "option-changed"))
- return GST_MIXER_MESSAGE_OPTION_CHANGED;
- else if (g_str_equal (m_type, "options-list-changed"))
- return GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED;
- else if (g_str_equal (m_type, "mixer-changed"))
- return GST_MIXER_MESSAGE_MIXER_CHANGED;
-
- return GST_MIXER_MESSAGE_INVALID;
-}
-
-#define GST_MIXER_MESSAGE_HAS_TYPE(msg,msg_type) \
-(gst_mixer_message_get_type (msg) == GST_MIXER_MESSAGE_ ## msg_type)
-
-/**
- * gst_mixer_message_parse_mute_toggled:
- * @message: A mute-toggled change notification message.
- * @track: Pointer to hold a GstMixerTrack object, or NULL.
- * @mute: A pointer to a gboolean variable, or NULL.
- *
- * Extracts the contents of a mute-toggled bus message. Reads
- * the GstMixerTrack that has changed, and the new value of the mute
- * flag.
- *
- * The GstMixerTrack remains valid until the message is freed.
- *
- * Since: 0.10.14
- */
-void
-gst_mixer_message_parse_mute_toggled (GstMessage * message,
- GstMixerTrack ** track, gboolean * mute)
-{
- const GstStructure *s;
-
- g_return_if_fail (gst_mixer_message_is_mixer_message (message));
- g_return_if_fail (GST_MIXER_MESSAGE_HAS_TYPE (message, MUTE_TOGGLED));
-
- s = gst_message_get_structure (message);
-
- if (track) {
- const GValue *v = gst_structure_get_value (s, "track");
-
- g_return_if_fail (v != NULL);
- *track = (GstMixerTrack *) g_value_get_object (v);
- g_return_if_fail (GST_IS_MIXER_TRACK (*track));
- }
-
- if (mute)
- g_return_if_fail (gst_structure_get_boolean (s, "mute", mute));
-}
-
-/**
- * gst_mixer_message_parse_record_toggled:
- * @message: A record-toggled change notification message.
- * @track: Pointer to hold a GstMixerTrack object, or NULL.
- * @record: A pointer to a gboolean variable, or NULL.
- *
- * Extracts the contents of a record-toggled bus message. Reads
- * the GstMixerTrack that has changed, and the new value of the
- * recording flag.
- *
- * The GstMixerTrack remains valid until the message is freed.
- *
- * Since: 0.10.14
- */
-void
-gst_mixer_message_parse_record_toggled (GstMessage * message,
- GstMixerTrack ** track, gboolean * record)
-{
- const GstStructure *s;
-
- g_return_if_fail (gst_mixer_message_is_mixer_message (message));
- g_return_if_fail (GST_MIXER_MESSAGE_HAS_TYPE (message, RECORD_TOGGLED));
-
- s = gst_message_get_structure (message);
-
- if (track) {
- const GValue *v = gst_structure_get_value (s, "track");
-
- g_return_if_fail (v != NULL);
- *track = (GstMixerTrack *) g_value_get_object (v);
- g_return_if_fail (GST_IS_MIXER_TRACK (*track));
- }
-
- if (record)
- g_return_if_fail (gst_structure_get_boolean (s, "record", record));
-}
-
-/**
- * gst_mixer_message_parse_volume_changed:
- * @message: A volume-changed change notification message.
- * @track: Pointer to hold a GstMixerTrack object, or NULL.
- * @volumes: A pointer to receive an array of gint values, or NULL.
- * @num_channels: Result location to receive the number of channels, or NULL.
- *
- * Parses a volume-changed notification message and extracts the track object
- * it refers to, as well as an array of volumes and the size of the volumes array.
- *
- * The track object remains valid until the message is freed.
- *
- * The caller must free the array returned in the volumes parameter using g_free
- * when they are done with it.
- *
- * Since: 0.10.14
- */
-void
-gst_mixer_message_parse_volume_changed (GstMessage * message,
- GstMixerTrack ** track, gint ** volumes, gint * num_channels)
-{
- const GstStructure *s;
-
- g_return_if_fail (gst_mixer_message_is_mixer_message (message));
- g_return_if_fail (GST_MIXER_MESSAGE_HAS_TYPE (message, VOLUME_CHANGED));
-
- s = gst_message_get_structure (message);
-
- if (track) {
- const GValue *v = gst_structure_get_value (s, "track");
-
- g_return_if_fail (v != NULL);
- *track = (GstMixerTrack *) g_value_get_object (v);
- g_return_if_fail (GST_IS_MIXER_TRACK (*track));
- }
-
- if (volumes || num_channels) {
- gint n_chans, i;
- const GValue *v = gst_structure_get_value (s, "volumes");
-
- g_return_if_fail (v != NULL);
- g_return_if_fail (GST_VALUE_HOLDS_ARRAY (v));
-
- n_chans = gst_value_array_get_size (v);
- if (num_channels)
- *num_channels = n_chans;
-
- if (volumes) {
- *volumes = g_new (gint, n_chans);
- for (i = 0; i < n_chans; i++) {
- const GValue *e = gst_value_array_get_value (v, i);
-
- g_return_if_fail (e != NULL && G_VALUE_HOLDS_INT (e));
- (*volumes)[i] = g_value_get_int (e);
- }
- }
- }
-}
-
-/**
- * gst_mixer_message_parse_option_changed:
- * @message: A volume-changed change notification message.
- * @options: Pointer to hold a GstMixerOptions object, or NULL.
- * @value: Result location to receive the new options value, or NULL.
- *
- * Extracts the GstMixerOptions and new value from a option-changed bus notification
- * message.
- *
- * The options and value returned remain valid until the message is freed.
- *
- * Since: 0.10.14
- */
-void
-gst_mixer_message_parse_option_changed (GstMessage * message,
- GstMixerOptions ** options, const gchar ** value)
-{
- const GstStructure *s;
-
- g_return_if_fail (gst_mixer_message_is_mixer_message (message));
- g_return_if_fail (GST_MIXER_MESSAGE_HAS_TYPE (message, OPTION_CHANGED));
-
- s = gst_message_get_structure (message);
-
- if (options) {
- const GValue *v = gst_structure_get_value (s, "options");
-
- g_return_if_fail (v != NULL);
- *options = (GstMixerOptions *) g_value_get_object (v);
- g_return_if_fail (GST_IS_MIXER_OPTIONS (*options));
- }
-
- if (value)
- *value = gst_structure_get_string (s, "value");
-}
-
-/**
- * gst_mixer_message_parse_options_list_changed:
- * @message: A volume-changed change notification message.
- * @options: Pointer to hold a GstMixerOptions object, or NULL.
- *
- * Extracts the GstMixerOptions whose value list has changed from an
- * options-list-changed bus notification message.
- *
- * The options object returned remains valid until the message is freed. You
- * do not need to unref it.
- *
- * Since: 0.10.18
- */
-void
-gst_mixer_message_parse_options_list_changed (GstMessage * message,
- GstMixerOptions ** options)
-{
- const GstStructure *s;
-
- g_return_if_fail (gst_mixer_message_is_mixer_message (message));
- g_return_if_fail (GST_MIXER_MESSAGE_HAS_TYPE (message, OPTIONS_LIST_CHANGED));
-
- s = gst_message_get_structure (message);
-
- if (options) {
- const GValue *v = gst_structure_get_value (s, "options");
-
- g_return_if_fail (v != NULL);
- *options = (GstMixerOptions *) g_value_get_object (v);
- g_return_if_fail (GST_IS_MIXER_OPTIONS (*options));
- }
-}
diff --git a/gst-libs/gst/interfaces/mixer.h b/gst-libs/gst/interfaces/mixer.h
deleted file mode 100644
index ce580636..00000000
--- a/gst-libs/gst/interfaces/mixer.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/* GStreamer Mixer
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * mixer.h: mixer 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_MIXER_H__
-#define __GST_MIXER_H__
-
-#include <gst/gst.h>
-#include <gst/interfaces/mixeroptions.h>
-#include <gst/interfaces/mixertrack.h>
-#include <gst/interfaces/interfaces-enumtypes.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_MIXER \
- (gst_mixer_get_type ())
-#define GST_MIXER(obj) \
- (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER, GstMixer))
-#define GST_MIXER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MIXER, GstMixerClass))
-#define GST_IS_MIXER(obj) \
- (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER))
-#define GST_IS_MIXER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER))
-#define GST_MIXER_GET_CLASS(inst) \
- (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_MIXER, GstMixerClass))
-
-#define GST_MIXER_TYPE(klass) (klass->mixer_type)
-
-typedef struct _GstMixer GstMixer;
-typedef struct _GstMixerClass GstMixerClass;
-
-typedef enum
-{
- GST_MIXER_HARDWARE,
- GST_MIXER_SOFTWARE
-} GstMixerType;
-
-/**
- * GstMixerMessageType:
- * @GST_MIXER_MESSAGE_INVALID: Not a GstMixer message
- * @GST_MIXER_MESSAGE_MUTE_TOGGLED: A mute-toggled GstMixer message
- * @GST_MIXER_MESSAGE_RECORD_TOGGLED: A record-toggled GstMixer message
- * @GST_MIXER_MESSAGE_VOLUME_CHANGED: A volume-changed GstMixer message
- * @GST_MIXER_MESSAGE_OPTION_CHANGED: An option-changed GstMixer message
- * @GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED: An options-list-changed
- * GstMixer message, posted when the list of available options for a
- * GstMixerOptions object has changed (Since: 0.10.18)
- * @GST_MIXER_MESSAGE_MIXER_CHANGED: A mixer-changed GstMixer message, posted
- * when the list of available mixer tracks has changed. The application
- * should re-build its interface in this case (Since: 0.10.18)
- *
- * An enumeration for the type of a GstMixer message received on the bus
- *
- * Since: 0.10.14
- */
-typedef enum
-{
- GST_MIXER_MESSAGE_INVALID,
- GST_MIXER_MESSAGE_MUTE_TOGGLED,
- GST_MIXER_MESSAGE_RECORD_TOGGLED,
- GST_MIXER_MESSAGE_VOLUME_CHANGED,
- GST_MIXER_MESSAGE_OPTION_CHANGED,
- GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED,
- GST_MIXER_MESSAGE_MIXER_CHANGED
-} GstMixerMessageType;
-
-/**
- * GstMixerFlags:
- * @GST_MIXER_FLAG_NONE: No flags
- * @GST_MIXER_FLAG_AUTO_NOTIFICATIONS: The mixer implementation automatically
- * sends notification messages.
- * @GST_MIXER_FLAG_HAS_WHITELIST: The mixer implementation flags tracks that
- * should be displayed by default (whitelisted). Since: 0.10.23
- * @GST_MIXER_FLAG_GROUPING: The mixer implementation will leave some controls
- * marked without either input or output. Controls marked as input or
- * output should be grouped with input & output sliders, even if they
- * are options or bare switches. Since: 0.10.23
- *
- * Flags indicating which optional features are supported by a mixer
- * implementation.
- *
- * Since: 0.10.14
- */
-typedef enum
-{
- GST_MIXER_FLAG_NONE = 0,
- GST_MIXER_FLAG_AUTO_NOTIFICATIONS = (1<<0),
- GST_MIXER_FLAG_HAS_WHITELIST = (1<<1),
- GST_MIXER_FLAG_GROUPING = (1<<2),
-} GstMixerFlags;
-
-struct _GstMixerClass {
- GTypeInterface klass;
-
- GstMixerType mixer_type;
-
- /* virtual functions */
- const GList * (* list_tracks) (GstMixer *mixer);
-
- void (* set_volume) (GstMixer *mixer,
- GstMixerTrack *track,
- gint *volumes);
- void (* get_volume) (GstMixer *mixer,
- GstMixerTrack *track,
- gint *volumes);
-
- void (* set_mute) (GstMixer *mixer,
- GstMixerTrack *track,
- gboolean mute);
- void (* set_record) (GstMixer *mixer,
- GstMixerTrack *track,
- gboolean record);
-#ifndef GST_DISABLE_DEPRECATED
- /* signals (deprecated) */
- void (* mute_toggled) (GstMixer *mixer,
- GstMixerTrack *channel,
- gboolean mute);
- void (* record_toggled) (GstMixer *mixer,
- GstMixerTrack *channel,
- gboolean record);
- void (* volume_changed) (GstMixer *mixer,
- GstMixerTrack *channel,
- gint *volumes);
-#else
- gpointer padding1[3];
-#endif /* not GST_DISABLE_DEPRECATED */
-
- void (* set_option) (GstMixer *mixer,
- GstMixerOptions *opts,
- gchar *value);
- const gchar * (* get_option) (GstMixer *mixer,
- GstMixerOptions *opts);
-
-#ifndef GST_DISABLE_DEPRECATED
- void (* option_changed) (GstMixer *mixer,
- GstMixerOptions *opts,
- gchar *option);
-#else
- gpointer padding2;
-#endif /* not GST_DISABLE_DEPRECATED */
-
- GstMixerFlags (* get_mixer_flags) (GstMixer *mixer);
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING-1];
-};
-
-GType gst_mixer_get_type (void);
-
-/* virtual class function wrappers */
-const GList * gst_mixer_list_tracks (GstMixer *mixer);
-void gst_mixer_set_volume (GstMixer *mixer,
- GstMixerTrack *track,
- gint *volumes);
-void gst_mixer_get_volume (GstMixer *mixer,
- GstMixerTrack *track,
- gint *volumes);
-void gst_mixer_set_mute (GstMixer *mixer,
- GstMixerTrack *track,
- gboolean mute);
-void gst_mixer_set_record (GstMixer *mixer,
- GstMixerTrack *track,
- gboolean record);
-void gst_mixer_set_option (GstMixer *mixer,
- GstMixerOptions *opts,
- gchar *value);
-const gchar * gst_mixer_get_option (GstMixer *mixer,
- GstMixerOptions *opts);
-
-/* trigger bus messages */
-void gst_mixer_mute_toggled (GstMixer *mixer,
- GstMixerTrack *track,
- gboolean mute);
-void gst_mixer_record_toggled (GstMixer *mixer,
- GstMixerTrack *track,
- gboolean record);
-void gst_mixer_volume_changed (GstMixer *mixer,
- GstMixerTrack *track,
- gint *volumes);
-void gst_mixer_option_changed (GstMixer *mixer,
- GstMixerOptions *opts,
- gchar *value);
-
-void gst_mixer_mixer_changed (GstMixer *mixer);
-
-void gst_mixer_options_list_changed (GstMixer *mixer,
- GstMixerOptions *opts);
-
-GstMixerType gst_mixer_get_mixer_type (GstMixer *mixer);
-
-GstMixerFlags gst_mixer_get_mixer_flags (GstMixer *mixer);
-
-/* Functions for recognising and parsing GstMixerMessages on the bus */
-GstMixerMessageType gst_mixer_message_get_type (GstMessage *message);
-void gst_mixer_message_parse_mute_toggled (GstMessage *message,
- GstMixerTrack **track,
- gboolean *mute);
-void gst_mixer_message_parse_record_toggled (GstMessage *message,
- GstMixerTrack **track,
- gboolean *record);
-void gst_mixer_message_parse_volume_changed (GstMessage *message,
- GstMixerTrack **track,
- gint **volumes,
- gint *num_channels);
-void gst_mixer_message_parse_option_changed (GstMessage *message,
- GstMixerOptions **options,
- const gchar **value);
-void gst_mixer_message_parse_options_list_changed (GstMessage *message,
- GstMixerOptions **options);
-
-G_END_DECLS
-
-#endif /* __GST_MIXER_H__ */
diff --git a/gst-libs/gst/interfaces/mixeroptions.c b/gst-libs/gst/interfaces/mixeroptions.c
deleted file mode 100644
index 01b75b43..00000000
--- a/gst-libs/gst/interfaces/mixeroptions.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/* GStreamer Mixer
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * mixeroptions.c: mixer track options object 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstmixeroptions
- * @short_description: Multi-option mixer control
- * @see_also: GstMixer, GstMixerTrack
- *
- * Mixer control object that allows switching between multiple options.
- * Note that <classname>GstMixerOptions</classname> is a subclass of
- * <classname>GstMixerTrack</classname>.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "mixeroptions.h"
-
-#if 0
-enum
-{
- /* FILL ME */
- SIGNAL_OPTION_CHANGED,
- LAST_SIGNAL
-};
-static guint signals[LAST_SIGNAL] = { 0 };
-#endif
-
-static void gst_mixer_options_class_init (GstMixerOptionsClass * klass);
-static void gst_mixer_options_init (GstMixerOptions * mixer);
-static void gst_mixer_options_dispose (GObject * object);
-
-static GObjectClass *parent_class = NULL;
-
-GType
-gst_mixer_options_get_type (void)
-{
- static GType gst_mixer_options_type = 0;
-
- if (!gst_mixer_options_type) {
- static const GTypeInfo mixer_options_info = {
- sizeof (GstMixerOptionsClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_mixer_options_class_init,
- NULL,
- NULL,
- sizeof (GstMixerOptions),
- 0,
- (GInstanceInitFunc) gst_mixer_options_init,
- NULL
- };
-
- gst_mixer_options_type =
- g_type_register_static (GST_TYPE_MIXER_TRACK,
- "GstMixerOptions", &mixer_options_info, 0);
- }
-
- return gst_mixer_options_type;
-}
-
-static void
-gst_mixer_options_class_init (GstMixerOptionsClass * klass)
-{
- GObjectClass *object_klass = (GObjectClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-#if 0
- signals[SIGNAL_OPTION_CHANGED] =
- g_signal_new ("option_changed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstMixerOptionsClass, option_changed),
- NULL, NULL, g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
-#endif
-
- object_klass->dispose = gst_mixer_options_dispose;
-}
-
-static void
-gst_mixer_options_init (GstMixerOptions * mixer_options)
-{
- mixer_options->values = NULL;
-}
-
-/**
- * gst_mixer_options_get_values:
- * @mixer_options: The #GstMixerOptions item that owns the values.
- *
- * Get the values for the mixer option.
- *
- * Returns: A list of strings with all the possible values for the mixer
- * option. You must not free or modify the list or its contents, it belongs
- * to the @mixer_options object.
- */
-GList *
-gst_mixer_options_get_values (GstMixerOptions * mixer_options)
-{
- GstMixerOptionsClass *klass;
- GList *ret = NULL;
-
- g_return_val_if_fail (GST_IS_MIXER_OPTIONS (mixer_options), NULL);
-
- klass = GST_MIXER_OPTIONS_GET_CLASS (mixer_options);
-
- if (klass->get_values != NULL) {
- ret = klass->get_values (mixer_options);
- } else {
- ret = mixer_options->values;
- }
-
- return ret;
-}
-
-
-static void
-gst_mixer_options_dispose (GObject * object)
-{
- GstMixerOptions *opts = GST_MIXER_OPTIONS (object);
-
- g_list_foreach (opts->values, (GFunc) g_free, NULL);
- g_list_free (opts->values);
- opts->values = NULL;
-
- if (parent_class->dispose)
- parent_class->dispose (object);
-}
diff --git a/gst-libs/gst/interfaces/mixeroptions.h b/gst-libs/gst/interfaces/mixeroptions.h
deleted file mode 100644
index 2724da59..00000000
--- a/gst-libs/gst/interfaces/mixeroptions.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* GStreamer Mixer
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * mixeroptions.h: mixer track options object
- * This should be a subclass of MixerItem, along with MixerOptions,
- * but that's not possible because of API/ABI in 0.8.x. FIXME.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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_MIXER_OPTIONS_H__
-#define __GST_MIXER_OPTIONS_H__
-
-#include <gst/gst.h>
-#include <gst/interfaces/mixertrack.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_MIXER_OPTIONS \
- (gst_mixer_options_get_type ())
-#define GST_MIXER_OPTIONS(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER_OPTIONS, \
- GstMixerOptions))
-#define GST_MIXER_OPTIONS_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MIXER_OPTIONS, GstMixerOptionsClass))
-#define GST_MIXER_OPTIONS_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MIXER_OPTIONS, \
- GstMixerOptionsClass))
-#define GST_IS_MIXER_OPTIONS(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER_OPTIONS))
-#define GST_IS_MIXER_OPTIONS_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER_OPTIONS))
-
-typedef struct _GstMixerOptions GstMixerOptions;
-typedef struct _GstMixerOptionsClass GstMixerOptionsClass;
-
-/**
- * GstMixerOptions:
- * @parent: Parent object
- * @values: List of option strings. Do not access this member directly,
- * always use gst_mixer_options_get_values() instead.
- */
-struct _GstMixerOptions {
- GstMixerTrack parent;
-
- /* list of strings (do not access directly) (FIXME 0.11: make private) */
- GList *values;
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-/**
- * GstMixerOptionsClass:
- * @parent: Parent class
- * @get_values: Optional implementation of gst_mixer_options_get_values().
- * (Since: 0.10.18)
- */
-struct _GstMixerOptionsClass {
- GstMixerTrackClass parent;
-
-#ifdef GST_MIXER_NEED_DEPRECATED
- /* signals */
- void (* option_changed) (GstMixerOptions *opts,
- gchar *value);
-#endif /* GST_MIXER_NEED_DEPRECATED */
-
- GList * (* get_values) (GstMixerOptions *opts);
-
- gpointer _gst_reserved[GST_PADDING-1];
-};
-
-GType gst_mixer_options_get_type (void);
-
-GList * gst_mixer_options_get_values (GstMixerOptions *mixer_options);
-
-G_END_DECLS
-
-#endif /* __GST_MIXER_OPTIONS_H__ */
diff --git a/gst-libs/gst/interfaces/mixertrack.c b/gst-libs/gst/interfaces/mixertrack.c
deleted file mode 100644
index 108f7be0..00000000
--- a/gst-libs/gst/interfaces/mixertrack.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/* GStreamer Mixer
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * mixertrack.c: mixer track object 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstmixertrack
- * @short_description: Basic mixer control object (volume slider, switch)
- * @see_also: GstMixer, GstMixerOptions
- *
- * Basic mixer control object (note that it is a GObject and not a GstObject).
- *
- * A mixer track represents a single slider control of none, one or more
- * channels. A mixer track with no channels is usually interpreted as a
- * on/off switch control.
- *
- * Note the presence of both min_volume and max_volume fields. Applications
- * must not assume that min_volume is 0 or max_volume is any particular
- * value.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "mixertrack.h"
-#if 0
-enum
-{
- /* FILL ME */
- SIGNAL_VOLUME_CHANGED,
- SIGNAL_RECORD_TOGGLED,
- SIGNAL_MUTE_TOGGLED,
- LAST_SIGNAL
-};
-static guint signals[LAST_SIGNAL] = { 0 };
-#endif
-
-enum
-{
- ARG_0,
- ARG_LABEL,
- ARG_UNTRANSLATED_LABEL,
- ARG_INDEX,
- ARG_MIN_VOLUME,
- ARG_MAX_VOLUME,
- ARG_FLAGS,
- ARG_NUM_CHANNELS
-};
-
-static void gst_mixer_track_class_init (GstMixerTrackClass * klass);
-static void gst_mixer_track_init (GstMixerTrack * mixer);
-static void gst_mixer_track_dispose (GObject * object);
-
-static void gst_mixer_track_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_mixer_track_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-
-static GObjectClass *parent_class = NULL;
-
-GType
-gst_mixer_track_get_type (void)
-{
- static GType gst_mixer_track_type = 0;
-
- if (!gst_mixer_track_type) {
- static const GTypeInfo mixer_track_info = {
- sizeof (GstMixerTrackClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_mixer_track_class_init,
- NULL,
- NULL,
- sizeof (GstMixerTrack),
- 0,
- (GInstanceInitFunc) gst_mixer_track_init,
- NULL
- };
-
- gst_mixer_track_type =
- g_type_register_static (G_TYPE_OBJECT,
- "GstMixerTrack", &mixer_track_info, 0);
- }
-
- return gst_mixer_track_type;
-}
-
-static void
-gst_mixer_track_class_init (GstMixerTrackClass * klass)
-{
- GObjectClass *object_klass = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_klass->get_property = gst_mixer_track_get_property;
- object_klass->set_property = gst_mixer_track_set_property;
-
- g_object_class_install_property (object_klass, ARG_LABEL,
- g_param_spec_string ("label", "Track label",
- "The label assigned to the track (may be translated)", NULL,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstMixerTrack:untranslated-label
- *
- * The untranslated label of the mixer track, if available. Mixer track
- * implementations must set this at construct time. Applications may find
- * this useful to determine icons for various kind of tracks. However,
- * applications mustn't make any assumptions about the naming of tracks,
- * the untranslated labels are purely informational and may change.
- *
- * Since: 0.10.13
- **/
- g_object_class_install_property (object_klass, ARG_UNTRANSLATED_LABEL,
- g_param_spec_string ("untranslated-label", "Untranslated track label",
- "The untranslated label assigned to the track (since 0.10.13)",
- NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstMixerTrack:index
- *
- * Index of the mixer track, if available. Mixer track implementations
- * must set this at construct time. This can be used to discern between
- * multiple tracks with identical labels.
- *
- * Since: 0.10.21
- */
- g_object_class_install_property (object_klass, ARG_INDEX,
- g_param_spec_uint ("index", "Index",
- "Track index", 0, G_MAXUINT,
- 0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
- g_object_class_install_property (object_klass, ARG_MIN_VOLUME,
- g_param_spec_int ("min-volume", "Minimum volume level",
- "The minimum possible volume level", G_MININT, G_MAXINT,
- 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (object_klass, ARG_MAX_VOLUME,
- g_param_spec_int ("max-volume", "Maximum volume level",
- "The maximum possible volume level", G_MININT, G_MAXINT,
- 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (object_klass, ARG_FLAGS,
- g_param_spec_uint ("flags", "Flags",
- "Flags indicating the type of mixer track",
- 0, G_MAXUINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (object_klass, ARG_NUM_CHANNELS,
- g_param_spec_int ("num-channels", "Number of channels",
- "The number of channels contained within the track",
- 0, G_MAXINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
-#if 0
- signals[SIGNAL_RECORD_TOGGLED] =
- g_signal_new ("record_toggled", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstMixerTrackClass,
- record_toggled),
- NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
- G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
- signals[SIGNAL_MUTE_TOGGLED] =
- g_signal_new ("mute_toggled", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstMixerTrackClass,
- mute_toggled),
- NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
- G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
- signals[SIGNAL_VOLUME_CHANGED] =
- g_signal_new ("volume_changed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstMixerTrackClass,
- volume_changed),
- NULL, NULL, g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-#endif
-
- object_klass->dispose = gst_mixer_track_dispose;
-}
-
-static void
-gst_mixer_track_init (GstMixerTrack * mixer_track)
-{
- mixer_track->label = NULL;
- mixer_track->min_volume = mixer_track->max_volume = 0;
- mixer_track->flags = 0;
- mixer_track->num_channels = 0;
-}
-
-/* FIXME 0.11: move these as members into the mixer track structure */
-#define MIXER_TRACK_OBJECT_DATA_KEY_UNTRANSLATED_LABEL "gst-mixer-track-ulabel"
-#define MIXER_TRACK_OBJECT_DATA_KEY_INDEX "index"
-
-static void
-gst_mixer_track_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstMixerTrack *mixer_track;
-
- mixer_track = GST_MIXER_TRACK (object);
-
- switch (prop_id) {
- case ARG_LABEL:
- g_value_set_string (value, mixer_track->label);
- break;
- case ARG_UNTRANSLATED_LABEL:
- g_value_set_string (value,
- (const gchar *) g_object_get_data (G_OBJECT (mixer_track),
- MIXER_TRACK_OBJECT_DATA_KEY_UNTRANSLATED_LABEL));
- break;
- case ARG_INDEX:
- g_value_set_uint (value,
- GPOINTER_TO_INT (g_object_get_data (G_OBJECT (mixer_track),
- MIXER_TRACK_OBJECT_DATA_KEY_INDEX)));
- break;
- case ARG_MIN_VOLUME:
- g_value_set_int (value, mixer_track->min_volume);
- break;
- case ARG_MAX_VOLUME:
- g_value_set_int (value, mixer_track->max_volume);
- break;
- case ARG_FLAGS:
- g_value_set_uint (value, (guint32) mixer_track->flags);
- break;
- case ARG_NUM_CHANNELS:
- g_value_set_int (value, mixer_track->num_channels);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_mixer_track_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstMixerTrack *mixer_track;
-
- mixer_track = GST_MIXER_TRACK (object);
-
- switch (prop_id) {
- case ARG_UNTRANSLATED_LABEL:
- g_object_set_data_full (G_OBJECT (mixer_track),
- MIXER_TRACK_OBJECT_DATA_KEY_UNTRANSLATED_LABEL,
- g_value_dup_string (value), (GDestroyNotify) g_free);
- break;
- case ARG_INDEX:
- g_object_set_data (G_OBJECT (mixer_track),
- MIXER_TRACK_OBJECT_DATA_KEY_INDEX,
- GINT_TO_POINTER (g_value_get_uint (value)));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_mixer_track_dispose (GObject * object)
-{
- GstMixerTrack *channel = GST_MIXER_TRACK (object);
-
- if (channel->label) {
- g_free (channel->label);
- channel->label = NULL;
- }
-
- if (parent_class->dispose)
- parent_class->dispose (object);
-}
diff --git a/gst-libs/gst/interfaces/mixertrack.h b/gst-libs/gst/interfaces/mixertrack.h
deleted file mode 100644
index 33296b9b..00000000
--- a/gst-libs/gst/interfaces/mixertrack.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* GStreamer Mixer
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * mixertrack.h: mixer track 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_MIXER_TRACK_H__
-#define __GST_MIXER_TRACK_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_MIXER_TRACK \
- (gst_mixer_track_get_type ())
-#define GST_MIXER_TRACK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER_TRACK, \
- GstMixerTrack))
-#define GST_MIXER_TRACK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MIXER_TRACK, \
- GstMixerTrackClass))
-#define GST_IS_MIXER_TRACK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER_TRACK))
-#define GST_IS_MIXER_TRACK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER_TRACK))
-
-/*
- * Naming:
- *
- * A track is a single input/output stream (e.g. line-in,
- * microphone, etc.). Channels are then single streams
- * within a track. A mono stream has one channel, a stereo
- * stream has two, etc.
- *
- * Input tracks can have 'recording' enabled, which means
- * that any input will be hearable into the speakers that
- * are attached to the output. Mute is obvious. A track
- * flagged as master is the master volume track on this
- * mixer, which means that setting this track will change
- * the hearable volume on any output.
- */
-/**
- * GstMixerTrackFlags:
- * @GST_MIXER_TRACK_INPUT: mixer track is for input
- * @GST_MIXER_TRACK_OUTPUT: mixer track is for output
- * @GST_MIXER_TRACK_MUTE: input or output is muted
- * @GST_MIXER_TRACK_RECORD: input is audible in speakers attached to output
- * (for #GST_MIXER_TRACK_INPUT mixer tracks only)
- * @GST_MIXER_TRACK_MASTER: this mixer track is likely to be the master control
- * @GST_MIXER_TRACK_SOFTWARE: mixer track's' volume control is implemented
- * in software (as opposed to a hardware control)
- * @GST_MIXER_TRACK_NO_RECORD: input track lacks support for recordable.
- * Since: 0.10.23
- * @GST_MIXER_TRACK_NO_MUTE: play track doesn't support mute. Since: 0.10.23
- * @GST_MIXER_TRACK_WHITELIST: track should be displayed "by default" in apps.
- * Since: 0.10.23
- * @GST_MIXER_TRACK_READONLY: track is read-only. Since: 0.10.25
- * @GST_MIXER_TRACK_WRITEONLY: track is write-only. Since: 0.10.25
- *
- * Mixer track flags.
- */
-typedef enum {
- GST_MIXER_TRACK_INPUT = (1<<0),
- GST_MIXER_TRACK_OUTPUT = (1<<1),
- GST_MIXER_TRACK_MUTE = (1<<2),
- GST_MIXER_TRACK_RECORD = (1<<3),
- GST_MIXER_TRACK_MASTER = (1<<4),
- GST_MIXER_TRACK_SOFTWARE = (1<<5),
- GST_MIXER_TRACK_NO_RECORD = (1<<6),
- GST_MIXER_TRACK_NO_MUTE = (1<<7),
- GST_MIXER_TRACK_WHITELIST = (1<<8),
- GST_MIXER_TRACK_READONLY = (1<<9),
- GST_MIXER_TRACK_WRITEONLY = (1<<10)
-} GstMixerTrackFlags;
-
-/* FIXME 0.11: READONLY/WRITEONLY -> READABLE/WRITABLE etc. */
-
-#define GST_MIXER_TRACK_HAS_FLAG(channel, flag) \
- ((channel)->flags & flag)
-
-typedef struct _GstMixerTrack GstMixerTrack;
-typedef struct _GstMixerTrackClass GstMixerTrackClass;
-
-struct _GstMixerTrack {
- GObject parent;
-
- gchar *label;
-
- /* FIXME 0.11: flags should be guint32 */
- GstMixerTrackFlags flags;
-
- gint num_channels;
- gint min_volume;
- gint max_volume;
-
- /* FIXME 0.11: add padding */
-};
-
-struct _GstMixerTrackClass {
- GObjectClass parent;
-
-#ifdef GST_MIXER_NEED_DEPRECATED
- /* signals (deprecated) */
- void (* mute_toggled) (GstMixerTrack *channel,
- gboolean mute);
- void (* record_toggled) (GstMixerTrack *channel,
- gboolean record);
- void (* volume_changed) (GstMixerTrack *channel,
- gint *volumes);
-#endif /* GST_MIXER_NEED_DEPRECATED */
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_mixer_track_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_MIXER_TRACK_H__ */
diff --git a/gst-libs/gst/interfaces/navigation.c b/gst-libs/gst/interfaces/navigation.c
deleted file mode 100644
index 14da7d3e..00000000
--- a/gst-libs/gst/interfaces/navigation.c
+++ /dev/null
@@ -1,841 +0,0 @@
-/* GStreamer Navigation
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- * Copyright (C) 2007-2009 Jan Schmidt <thaytan@noraisin.net>
- *
- * navigation.c: navigation event virtual class function wrappers
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-/**
- * SECTION:gstnavigation
- * @short_description: Interface for creating, sending and parsing navigation
- * events.
- *
- * The Navigation interface is used for creating and injecting navigation related
- * events such as mouse button presses, cursor motion and key presses. The associated
- * library also provides methods for parsing received events, and for sending and
- * receiving navigation related bus events. One main usecase is DVD menu navigation.
- *
- * The main parts of the API are:
- * <itemizedlist>
- * <listitem>
- * <para>
- * The GstNavigation interface, implemented by elements which provide an application
- * with the ability to create and inject navigation events into the pipeline.
- * </para>
- * </listitem>
- * <listitem>
- * <para>
- * GstNavigation event handling API. GstNavigation events are created in response to
- * calls on a GstNavigation interface implementation, and sent in the pipeline. Upstream
- * elements can use the navigation event API functions to parse the contents of received
- * messages.
- * </para>
- * </listitem>
- * <listitem>
- * <para>
- * GstNavigation message handling API. GstNavigation messages may be sent on the message
- * bus to inform applications of navigation related changes in the pipeline, such as the
- * mouse moving over a clickable region, or the set of available angles changing.
- * </para><para>
- * The GstNavigation message functions provide functions for creating and parsing
- * custom bus messages for signalling GstNavigation changes.
- * </para>
- * </listitem>
- * </itemizedlist>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/interfaces/navigation.h>
-#include <gst/interfaces/interfaces-enumtypes.h>
-
-static void gst_navigation_class_init (GstNavigationInterface * iface);
-
-#define GST_NAVIGATION_MESSAGE_NAME "GstNavigationMessage"
-#define GST_NAVIGATION_QUERY_NAME "GstNavigationQuery"
-#define GST_NAVIGATION_EVENT_NAME "application/x-gst-navigation"
-
-#define WARN_IF_FAIL(exp,msg) if(G_UNLIKELY(!(exp))){g_warning("%s",(msg));}
-
-GType
-gst_navigation_get_type (void)
-{
- static GType gst_navigation_type = 0;
-
- if (!gst_navigation_type) {
- static const GTypeInfo gst_navigation_info = {
- sizeof (GstNavigationInterface),
- (GBaseInitFunc) gst_navigation_class_init,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- 0,
- NULL,
- };
-
- gst_navigation_type = g_type_register_static (G_TYPE_INTERFACE,
- "GstNavigation", &gst_navigation_info, 0);
- }
-
- return gst_navigation_type;
-}
-
-static void
-gst_navigation_class_init (GstNavigationInterface * iface)
-{
- /* default virtual functions */
- iface->send_event = NULL;
-}
-
-/* The interface implementer should make sure that the object can handle
- * the event. */
-void
-gst_navigation_send_event (GstNavigation * navigation, GstStructure * structure)
-{
- GstNavigationInterface *iface = GST_NAVIGATION_GET_IFACE (navigation);
-
- if (iface->send_event) {
- iface->send_event (navigation, structure);
- }
-}
-
-/**
- * gst_navigation_send_key_event:
- * @navigation: The navigation interface instance
- * @event: The type of the key event. Recognised values are "key-press" and
- * "key-release"
- * @key: Character representation of the key. This is typically as produced
- * by XKeysymToString.
- */
-void
-gst_navigation_send_key_event (GstNavigation * navigation, const char *event,
- const char *key)
-{
- gst_navigation_send_event (navigation,
- gst_structure_new (GST_NAVIGATION_EVENT_NAME, "event", G_TYPE_STRING,
- event, "key", G_TYPE_STRING, key, NULL));
-}
-
-/**
- * gst_navigation_send_mouse_event:
- * @navigation: The navigation interface instance
- * @event: The type of mouse event, as a text string. Recognised values are
- * "mouse-button-press", "mouse-button-release" and "mouse-move".
- * @button: The button number of the button being pressed or released. Pass 0
- * for mouse-move events.
- * @x: The x coordinate of the mouse event.
- * @y: The y coordinate of the mouse event.
- *
- * Sends a mouse event to the navigation interface. Mouse event coordinates
- * are sent relative to the display space of the related output area. This is
- * usually the size in pixels of the window associated with the element
- * implementing the #GstNavigation interface.
- *
- */
-void
-gst_navigation_send_mouse_event (GstNavigation * navigation, const char *event,
- int button, double x, double y)
-{
- gst_navigation_send_event (navigation,
- gst_structure_new (GST_NAVIGATION_EVENT_NAME, "event", G_TYPE_STRING,
- event, "button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x,
- "pointer_y", G_TYPE_DOUBLE, y, NULL));
-}
-
-/**
- * gst_navigation_send_command:
- * @navigation: The navigation interface instance
- * @command: The command to issue
- *
- * Sends the indicated command to the navigation interface.
- *
- * Since: 0.10.23
- */
-void
-gst_navigation_send_command (GstNavigation * navigation,
- GstNavigationCommand command)
-{
- gst_navigation_send_event (navigation,
- gst_structure_new (GST_NAVIGATION_EVENT_NAME, "event", G_TYPE_STRING,
- "command", "command-code", G_TYPE_UINT, (guint) command, NULL));
-}
-
-/* Navigation Queries */
-
-#define GST_NAVIGATION_QUERY_HAS_TYPE(query,query_type) \
-(gst_navigation_query_get_type (query) == GST_NAVIGATION_QUERY_ ## query_type)
-
-/**
- * gst_navigation_query_get_type:
- * @query: The query to inspect
- *
- * Inspect a #GstQuery and return the #GstNavigationQueryType associated with
- * it if it is a #GstNavigation query.
- *
- * Returns: The #GstNavigationQueryType of the query, or
- * #GST_NAVIGATION_QUERY_INVALID
- * Since: 0.10.23
- */
-GstNavigationQueryType
-gst_navigation_query_get_type (GstQuery * query)
-{
- const GstStructure *s;
- const gchar *q_type;
-
- if (query == NULL || GST_QUERY_TYPE (query) != GST_QUERY_CUSTOM)
- return GST_NAVIGATION_QUERY_INVALID;
-
- s = gst_query_get_structure (query);
- if (s == NULL || !gst_structure_has_name (s, GST_NAVIGATION_QUERY_NAME))
- return GST_NAVIGATION_QUERY_INVALID;
-
- q_type = gst_structure_get_string (s, "type");
- if (q_type == NULL)
- return GST_NAVIGATION_QUERY_INVALID;
-
- if (g_str_equal (q_type, "commands"))
- return GST_NAVIGATION_QUERY_COMMANDS;
- else if (g_str_equal (q_type, "angles"))
- return GST_NAVIGATION_QUERY_ANGLES;
-
- return GST_NAVIGATION_QUERY_INVALID;
-}
-
-/**
- * gst_navigation_query_new_commands:
- *
- * Create a new #GstNavigation commands query. When executed, it will
- * query the pipeline for the set of currently available commands.
- *
- * Returns: The new query.
- * Since: 0.10.23
- */
-GstQuery *
-gst_navigation_query_new_commands (void)
-{
- GstQuery *query;
- GstStructure *structure;
-
- structure = gst_structure_new (GST_NAVIGATION_QUERY_NAME,
- "type", G_TYPE_STRING, "commands", NULL);
- query = gst_query_new_application (GST_QUERY_CUSTOM, structure);
-
- return query;
-}
-
-static void
-gst_query_list_add_command (GValue * list, GstNavigationCommand val)
-{
- GValue item = { 0, };
-
- g_value_init (&item, GST_TYPE_NAVIGATION_COMMAND);
- g_value_set_enum (&item, val);
- gst_value_list_append_value (list, &item);
- g_value_unset (&item);
-}
-
-/**
- * gst_navigation_query_set_commands:
- * @query: a #GstQuery
- * @n_cmds: the number of commands to set.
- * @...: A list of @GstNavigationCommand values, @n_cmds entries long.
- *
- * Set the #GstNavigation command query result fields in @query. The number
- * of commands passed must be equal to @n_commands.
- *
- * Since: 0.10.23
- */
-void
-gst_navigation_query_set_commands (GstQuery * query, gint n_cmds, ...)
-{
- va_list ap;
- GValue list = { 0, };
- GstStructure *structure;
- gint i;
-
- g_return_if_fail (GST_NAVIGATION_QUERY_HAS_TYPE (query, COMMANDS));
-
- g_value_init (&list, GST_TYPE_LIST);
-
- va_start (ap, n_cmds);
- for (i = 0; i < n_cmds; i++) {
- GstNavigationCommand val = va_arg (ap, GstNavigationCommand);
- gst_query_list_add_command (&list, val);
- }
- va_end (ap);
-
- structure = gst_query_get_structure (query);
- gst_structure_set_value (structure, "commands", &list);
-
- g_value_unset (&list);
-}
-
-/**
- * gst_navigation_query_set_commandsv:
- * @query: a #GstQuery
- * @n_cmds: the number of commands to set.
- * @cmds: An array containing @n_cmds @GstNavigationCommand values.
- *
- * Set the #GstNavigation command query result fields in @query. The number
- * of commands passed must be equal to @n_commands.
- *
- * Since: 0.10.23
- */
-void
-gst_navigation_query_set_commandsv (GstQuery * query, gint n_cmds,
- GstNavigationCommand * cmds)
-{
- GValue list = { 0, };
- GstStructure *structure;
- gint i;
-
- g_return_if_fail (GST_NAVIGATION_QUERY_HAS_TYPE (query, COMMANDS));
-
- g_value_init (&list, GST_TYPE_LIST);
- for (i = 0; i < n_cmds; i++) {
- gst_query_list_add_command (&list, cmds[i]);
- }
- structure = gst_query_get_structure (query);
- gst_structure_set_value (structure, "commands", &list);
-
- g_value_unset (&list);
-}
-
-/**
- * gst_navigation_query_parse_commands_length:
- * @query: a #GstQuery
- * @n_cmds: the number of commands in this query.
- *
- * Parse the number of commands in the #GstNavigation commands @query.
- *
- * Returns: %TRUE if the query could be successfully parsed. %FALSE if not.
- * Since: 0.10.23
- */
-gboolean
-gst_navigation_query_parse_commands_length (GstQuery * query, guint * n_cmds)
-{
- GstStructure *structure;
- const GValue *list;
-
- g_return_val_if_fail (GST_NAVIGATION_QUERY_HAS_TYPE (query, COMMANDS), FALSE);
-
- if (n_cmds == NULL)
- return TRUE;
-
- structure = gst_query_get_structure (query);
- list = gst_structure_get_value (structure, "commands");
- if (list == NULL)
- *n_cmds = 0;
- else
- *n_cmds = gst_value_list_get_size (list);
-
- return TRUE;
-}
-
-/**
- * gst_navigation_query_parse_commands_nth:
- * @query: a #GstQuery
- * @nth: the nth command to retrieve.
- * @cmd: a pointer to store the nth command into.
- *
- * Parse the #GstNavigation command query and retrieve the @nth command from
- * it into @cmd. If the list contains less elements than @nth, @cmd will be
- * set to #GST_NAVIGATION_COMMAND_INVALID.
- *
- * Returns: %TRUE if the query could be successfully parsed. %FALSE if not.
- * Since: 0.10.23
- */
-gboolean
-gst_navigation_query_parse_commands_nth (GstQuery * query, guint nth,
- GstNavigationCommand * cmd)
-{
- GstStructure *structure;
- const GValue *list;
-
- g_return_val_if_fail (GST_NAVIGATION_QUERY_HAS_TYPE (query, COMMANDS), FALSE);
-
- if (cmd == NULL)
- return TRUE;
-
- structure = gst_query_get_structure (query);
- list = gst_structure_get_value (structure, "commands");
- if (list == NULL) {
- *cmd = GST_NAVIGATION_COMMAND_INVALID;
- } else {
- if (nth < gst_value_list_get_size (list)) {
- *cmd = (GstNavigationCommand)
- g_value_get_enum (gst_value_list_get_value (list, nth));
- } else
- *cmd = GST_NAVIGATION_COMMAND_INVALID;
- }
-
- return TRUE;
-}
-
-/**
- * gst_navigation_query_new_angles:
- *
- * Create a new #GstNavigation angles query. When executed, it will
- * query the pipeline for the set of currently available angles, which may be
- * greater than one in a multiangle video.
- *
- * Returns: The new query.
- * Since: 0.10.23
- */
-GstQuery *
-gst_navigation_query_new_angles (void)
-{
- GstQuery *query;
- GstStructure *structure;
-
- structure = gst_structure_new (GST_NAVIGATION_QUERY_NAME,
- "type", G_TYPE_STRING, "angles", NULL);
- query = gst_query_new_application (GST_QUERY_CUSTOM, structure);
-
- return query;
-}
-
-/**
- * gst_navigation_query_set_angles:
- * @query: a #GstQuery
- * @cur_angle: the current viewing angle to set.
- * @n_angles: the number of viewing angles to set.
- *
- * Set the #GstNavigation angles query result field in @query.
- *
- * Since: 0.10.23
- */
-void
-gst_navigation_query_set_angles (GstQuery * query, guint cur_angle,
- guint n_angles)
-{
- GstStructure *structure;
-
- g_return_if_fail (GST_NAVIGATION_QUERY_HAS_TYPE (query, ANGLES));
-
- structure = gst_query_get_structure (query);
- gst_structure_set (structure,
- "angle", G_TYPE_UINT, cur_angle, "angles", G_TYPE_UINT, n_angles, NULL);
-}
-
-/**
- * gst_navigation_query_parse_angles:
- * @query: a #GstQuery
- * @cur_angle: Pointer to a #guint into which to store the currently selected
- * angle value from the query, or NULL
- * @n_angles: Pointer to a #guint into which to store the number of angles
- * value from the query, or NULL
- *
- * Parse the current angle number in the #GstNavigation angles @query into the
- * #guint pointed to by the @cur_angle variable, and the number of available
- * angles into the #guint pointed to by the @n_angles variable.
- *
- * Returns: %TRUE if the query could be successfully parsed. %FALSE if not.
- * Since: 0.10.23
- */
-gboolean
-gst_navigation_query_parse_angles (GstQuery * query, guint * cur_angle,
- guint * n_angles)
-{
- GstStructure *structure;
- gboolean ret = TRUE;
-
- g_return_val_if_fail (GST_NAVIGATION_QUERY_HAS_TYPE (query, ANGLES), FALSE);
-
- structure = gst_query_get_structure (query);
-
- if (cur_angle)
- ret &= gst_structure_get_uint (structure, "angle", cur_angle);
-
- if (n_angles)
- ret &= gst_structure_get_uint (structure, "angles", n_angles);
-
- WARN_IF_FAIL (ret, "Couldn't extract details from angles query");
-
- return ret;
-}
-
-/* Navigation Messages */
-
-#define GST_NAVIGATION_MESSAGE_HAS_TYPE(msg,msg_type) \
-(gst_navigation_message_get_type (msg) == GST_NAVIGATION_MESSAGE_ ## msg_type)
-
-/**
- * gst_navigation_message_get_type:
- * @message: A #GstMessage to inspect.
- *
- * Check a bus message to see if it is a #GstNavigation event, and return
- * the #GstNavigationMessageType identifying the type of the message if so.
- *
- * Returns: The type of the #GstNavigationMessage, or
- * #GST_NAVIGATION_MESSAGE_INVALID if the message is not a #GstNavigation
- * notification.
- *
- * Since: 0.10.23
- */
-GstNavigationMessageType
-gst_navigation_message_get_type (GstMessage * message)
-{
- const GstStructure *s;
- const gchar *m_type;
-
- if (message == NULL || GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- return GST_NAVIGATION_MESSAGE_INVALID;
-
- s = gst_message_get_structure (message);
- if (s == NULL || !gst_structure_has_name (s, GST_NAVIGATION_MESSAGE_NAME))
- return GST_NAVIGATION_MESSAGE_INVALID;
-
- m_type = gst_structure_get_string (s, "type");
- if (m_type == NULL)
- return GST_NAVIGATION_MESSAGE_INVALID;
-
- if (g_str_equal (m_type, "mouse-over"))
- return GST_NAVIGATION_MESSAGE_MOUSE_OVER;
- else if (g_str_equal (m_type, "commands-changed"))
- return GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED;
- else if (g_str_equal (m_type, "angles-changed"))
- return GST_NAVIGATION_MESSAGE_ANGLES_CHANGED;
-
- return GST_NAVIGATION_MESSAGE_INVALID;
-}
-
-/**
- * gst_navigation_message_new_mouse_over:
- * @src: A #GstObject to set as source of the new message.
- * @active: %TRUE if the mouse has entered a clickable area of the display.
- * %FALSE if it over a non-clickable area.
- *
- * Creates a new #GstNavigation message with type
- * #GST_NAVIGATION_MESSAGE_MOUSE_OVER.
- *
- * Returns: The new #GstMessage.
- * Since: 0.10.23
- */
-GstMessage *
-gst_navigation_message_new_mouse_over (GstObject * src, gboolean active)
-{
- GstStructure *s;
- GstMessage *m;
-
- s = gst_structure_new (GST_NAVIGATION_MESSAGE_NAME,
- "type", G_TYPE_STRING, "mouse-over", "active", G_TYPE_BOOLEAN, active,
- NULL);
-
- m = gst_message_new_custom (GST_MESSAGE_ELEMENT, src, s);
-
- return m;
-}
-
-/**
- * gst_navigation_message_parse_mouse_over:
- * @message: A #GstMessage to inspect.
- * @active: A pointer to a gboolean to receive the active/inactive state,
- * or NULL.
- *
- * Parse a #GstNavigation message of type #GST_NAVIGATION_MESSAGE_MOUSE_OVER
- * and extract the active/inactive flag. If the mouse over event is marked
- * active, it indicates that the mouse is over a clickable area.
- *
- * Returns: %TRUE if the message could be successfully parsed. %FALSE if not.
- * Since: 0.10.23
- */
-gboolean
-gst_navigation_message_parse_mouse_over (GstMessage * message,
- gboolean * active)
-{
- if (!GST_NAVIGATION_MESSAGE_HAS_TYPE (message, MOUSE_OVER))
- return FALSE;
-
- if (active) {
- const GstStructure *s = gst_message_get_structure (message);
- if (gst_structure_get_boolean (s, "active", active) == FALSE)
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- * gst_navigation_message_new_commands_changed:
- * @src: A #GstObject to set as source of the new message.
- *
- * Creates a new #GstNavigation message with type
- * #GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED
- *
- * Returns: The new #GstMessage.
- * Since: 0.10.23
- */
-GstMessage *
-gst_navigation_message_new_commands_changed (GstObject * src)
-{
- GstStructure *s;
- GstMessage *m;
-
- s = gst_structure_new (GST_NAVIGATION_MESSAGE_NAME,
- "type", G_TYPE_STRING, "commands-changed", NULL);
-
- m = gst_message_new_custom (GST_MESSAGE_ELEMENT, src, s);
-
- return m;
-}
-
-/**
- * gst_navigation_message_new_angles_changed:
- * @src: A #GstObject to set as source of the new message.
- * @cur_angle: The currently selected angle.
- * @n_angles: The number of viewing angles now available.
- *
- * Creates a new #GstNavigation message with type
- * #GST_NAVIGATION_MESSAGE_ANGLES_CHANGED for notifying an application
- * that the current angle, or current number of angles available in a
- * multiangle video has changed.
- *
- * Returns: The new #GstMessage.
- * Since: 0.10.23
- */
-GstMessage *
-gst_navigation_message_new_angles_changed (GstObject * src, guint cur_angle,
- guint n_angles)
-{
- GstStructure *s;
- GstMessage *m;
-
- s = gst_structure_new (GST_NAVIGATION_MESSAGE_NAME,
- "type", G_TYPE_STRING, "angles-changed",
- "angle", G_TYPE_UINT, cur_angle, "angles", G_TYPE_UINT, n_angles, NULL);
-
- m = gst_message_new_custom (GST_MESSAGE_ELEMENT, src, s);
-
- return m;
-}
-
-/**
- * gst_navigation_message_parse_angles_changed:
- * @message: A #GstMessage to inspect.
- * @cur_angle: A pointer to a #guint to receive the new current angle number,
- * or NULL
- * @n_angles: A pointer to a #guint to receive the new angle count, or NULL.
- *
- * Parse a #GstNavigation message of type GST_NAVIGATION_MESSAGE_ANGLES_CHANGED
- * and extract the @cur_angle and @n_angles parameters.
- *
- * Returns: %TRUE if the message could be successfully parsed. %FALSE if not.
- * Since: 0.10.23
- */
-gboolean
-gst_navigation_message_parse_angles_changed (GstMessage * message,
- guint * cur_angle, guint * n_angles)
-{
- const GstStructure *s;
- gboolean ret = TRUE;
-
- g_return_val_if_fail (GST_NAVIGATION_MESSAGE_HAS_TYPE (message,
- ANGLES_CHANGED), FALSE);
-
- s = gst_message_get_structure (message);
- if (cur_angle)
- ret &= gst_structure_get_uint (s, "angle", cur_angle);
-
- if (n_angles)
- ret &= gst_structure_get_uint (s, "angles", n_angles);
-
- WARN_IF_FAIL (ret, "Couldn't extract details from angles-changed event");
-
- return ret;
-}
-
-#define GST_NAVIGATION_EVENT_HAS_TYPE(event,event_type) \
-(gst_navigation_event_get_type (event) == GST_NAVIGATION_EVENT_ ## event_type)
-
-/**
- * gst_navigation_event_get_type:
- * @event: A #GstEvent to inspect.
- *
- * Inspect a #GstEvent and return the #GstNavigationEventType of the event, or
- * #GST_NAVIGATION_EVENT_INVALID if the event is not a #GstNavigation event.
- *
- * Since: 0.10.23
- */
-GstNavigationEventType
-gst_navigation_event_get_type (GstEvent * event)
-{
- const GstStructure *s;
- const gchar *e_type;
-
- if (event == NULL || GST_EVENT_TYPE (event) != GST_EVENT_NAVIGATION)
- return GST_NAVIGATION_EVENT_INVALID;
-
- s = gst_event_get_structure (event);
- if (s == NULL || !gst_structure_has_name (s, GST_NAVIGATION_EVENT_NAME))
- return GST_NAVIGATION_EVENT_INVALID;
-
- e_type = gst_structure_get_string (s, "event");
- if (e_type == NULL)
- return GST_NAVIGATION_EVENT_INVALID;
-
- if (g_str_equal (e_type, "mouse-button-press"))
- return GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS;
- else if (g_str_equal (e_type, "mouse-button-release"))
- return GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE;
- else if (g_str_equal (e_type, "mouse-move"))
- return GST_NAVIGATION_EVENT_MOUSE_MOVE;
- else if (g_str_equal (e_type, "key-press"))
- return GST_NAVIGATION_EVENT_KEY_PRESS;
- else if (g_str_equal (e_type, "key-release"))
- return GST_NAVIGATION_EVENT_KEY_RELEASE;
- else if (g_str_equal (e_type, "command"))
- return GST_NAVIGATION_EVENT_COMMAND;
-
- return GST_NAVIGATION_EVENT_INVALID;
-}
-
-/**
- * gst_navigation_event_parse_key_event:
- * @event: A #GstEvent to inspect.
- * @key: A pointer to a location to receive the string identifying the key
- * press. The returned string is owned by the event, and valid only until the
- * event is unreffed.
- *
- * Since: 0.10.23
- */
-gboolean
-gst_navigation_event_parse_key_event (GstEvent * event, const gchar ** key)
-{
- GstNavigationEventType e_type;
- const GstStructure *s;
-
- e_type = gst_navigation_event_get_type (event);
- g_return_val_if_fail (e_type == GST_NAVIGATION_EVENT_KEY_PRESS ||
- e_type == GST_NAVIGATION_EVENT_KEY_RELEASE, FALSE);
-
- if (key) {
- s = gst_event_get_structure (event);
- *key = gst_structure_get_string (s, "key");
- if (*key == NULL)
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- * gst_navigation_event_parse_mouse_button_event:
- * @event: A #GstEvent to inspect.
- * @button: Pointer to a gint that will receive the button number associated
- * with the event.
- * @x: Pointer to a gdouble to receive the x coordinate of the mouse button
- * event.
- * @y: Pointer to a gdouble to receive the y coordinate of the mouse button
- * event.
- *
- * Retrieve the details of either a #GstNavigation mouse button press event or
- * a mouse button release event. Determine which type the event is using
- * gst_navigation_event_get_type() to retrieve the #GstNavigationEventType.
- *
- * Since: 0.10.23
- */
-gboolean
-gst_navigation_event_parse_mouse_button_event (GstEvent * event, gint * button,
- gdouble * x, gdouble * y)
-{
- GstNavigationEventType e_type;
- const GstStructure *s;
- gboolean ret = TRUE;
-
- e_type = gst_navigation_event_get_type (event);
- g_return_val_if_fail (e_type == GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS ||
- e_type == GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE, FALSE);
-
- s = gst_event_get_structure (event);
- if (x)
- ret &= gst_structure_get_double (s, "pointer_x", x);
- if (y)
- ret &= gst_structure_get_double (s, "pointer_y", y);
- if (button)
- ret &= gst_structure_get_int (s, "button", button);
-
- WARN_IF_FAIL (ret, "Couldn't extract details from mouse button event");
-
- return ret;
-}
-
-/**
- * gst_navigation_event_parse_mouse_move_event:
- * @event: A #GstEvent to inspect.
- * @x: Pointer to a gdouble to receive the x coordinate of the mouse movement.
- * @y: Pointer to a gdouble to receive the y coordinate of the mouse movement.
- *
- * Inspect a #GstNavigation mouse movement event and extract the coordinates
- * of the event.
- *
- * Since: 0.10.23
- */
-gboolean
-gst_navigation_event_parse_mouse_move_event (GstEvent * event, gdouble * x,
- gdouble * y)
-{
- const GstStructure *s;
- gboolean ret = TRUE;
-
- g_return_val_if_fail (GST_NAVIGATION_EVENT_HAS_TYPE (event, MOUSE_MOVE),
- FALSE);
-
- s = gst_event_get_structure (event);
- if (x)
- ret &= gst_structure_get_double (s, "pointer_x", x);
- if (y)
- ret &= gst_structure_get_double (s, "pointer_y", y);
-
- WARN_IF_FAIL (ret, "Couldn't extract positions from mouse move event");
-
- return ret;
-}
-
-/**
- * gst_navigation_event_parse_command:
- * @event: A #GstEvent to inspect.
- * @command: Pointer to GstNavigationCommand to receive the type of the
- * navigation event.
- *
- * Inspect a #GstNavigation command event and retrieve the enum value of the
- * associated command.
- *
- * Since: 0.10.23
- */
-gboolean
-gst_navigation_event_parse_command (GstEvent * event,
- GstNavigationCommand * command)
-{
- const GstStructure *s;
- gboolean ret = TRUE;
-
- g_return_val_if_fail (GST_NAVIGATION_EVENT_HAS_TYPE (event, COMMAND), FALSE);
-
- if (command) {
- s = gst_event_get_structure (event);
- ret = gst_structure_get_uint (s, "command-code", (guint *) command);
- WARN_IF_FAIL (ret, "Couldn't extract command code from command event");
- }
-
- return ret;
-}
diff --git a/gst-libs/gst/interfaces/navigation.h b/gst-libs/gst/interfaces/navigation.h
deleted file mode 100644
index cf7f7b97..00000000
--- a/gst-libs/gst/interfaces/navigation.h
+++ /dev/null
@@ -1,257 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_NAVIGATION_H__
-#define __GST_NAVIGATION_H__
-
-#include <gst/gst.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_IFACE(obj) \
- (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_NAVIGATION, GstNavigationInterface))
-
-typedef struct _GstNavigation GstNavigation;
-typedef struct _GstNavigationInterface GstNavigationInterface;
-
-struct _GstNavigationInterface {
- GTypeInterface g_iface;
-
- /* virtual functions */
- void (*send_event) (GstNavigation *navigation, GstStructure *structure);
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-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
- *
- * Since: 0.10.23
- */
-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 */
-typedef enum
-{
- GST_NAVIGATION_QUERY_INVALID = 0,
- GST_NAVIGATION_QUERY_COMMANDS = 1,
- GST_NAVIGATION_QUERY_ANGLES = 2
-} GstNavigationQueryType;
-
-GstNavigationQueryType gst_navigation_query_get_type (GstQuery *query);
-
-GstQuery *gst_navigation_query_new_commands (void);
-void gst_navigation_query_set_commands (GstQuery *query, gint n_cmds, ...);
-void gst_navigation_query_set_commandsv (GstQuery *query, gint n_cmds,
- GstNavigationCommand *cmds);
-gboolean gst_navigation_query_parse_commands_length (GstQuery *query,
- guint *n_cmds);
-gboolean gst_navigation_query_parse_commands_nth (GstQuery *query, guint nth,
- GstNavigationCommand *cmd);
-
-GstQuery *gst_navigation_query_new_angles (void);
-void gst_navigation_query_set_angles (GstQuery *query, guint cur_angle,
- guint n_angles);
-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.
- *
- * A set of notifications that may be received on the bus when navigation
- * related status changes.
- *
- * Since: 0.10.23
- */
-typedef enum {
- GST_NAVIGATION_MESSAGE_INVALID,
- GST_NAVIGATION_MESSAGE_MOUSE_OVER,
- GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED,
- GST_NAVIGATION_MESSAGE_ANGLES_CHANGED
-} GstNavigationMessageType;
-
-GstNavigationMessageType gst_navigation_message_get_type (GstMessage *message);
-
-GstMessage *gst_navigation_message_new_mouse_over (GstObject *src,
- gboolean active);
-gboolean gst_navigation_message_parse_mouse_over (GstMessage *message,
- gboolean *active);
-
-GstMessage *gst_navigation_message_new_commands_changed (GstObject *src);
-
-GstMessage *gst_navigation_message_new_angles_changed (GstObject *src,
- guint cur_angle,
- guint n_angles);
-gboolean gst_navigation_message_parse_angles_changed (GstMessage *message,
- guint *cur_angle,
- guint *n_angles);
-
-/* 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.
- *
- * Enum values for the various events that an element implementing the
- * GstNavigation interface might send up the pipeline.
- *
- * Since: 0.10.23
- */
-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
-} GstNavigationEventType;
-
-GstNavigationEventType gst_navigation_event_get_type (GstEvent *event);
-gboolean gst_navigation_event_parse_key_event (GstEvent *event,
- const gchar **key);
-gboolean gst_navigation_event_parse_mouse_button_event (GstEvent *event,
- gint *button, gdouble *x, gdouble *y);
-gboolean gst_navigation_event_parse_mouse_move_event (GstEvent *event,
- gdouble *x, gdouble *y);
-gboolean gst_navigation_event_parse_command (GstEvent *event,
- GstNavigationCommand *command);
-
-/* interface virtual function wrappers */
-void gst_navigation_send_event (GstNavigation *navigation,
- GstStructure *structure);
-void gst_navigation_send_key_event (GstNavigation *navigation,
- const char *event, const char *key);
-void gst_navigation_send_mouse_event (GstNavigation *navigation,
- const char *event, int button, double x, double y);
-void gst_navigation_send_command (GstNavigation *navigation,
- GstNavigationCommand command);
-
-G_END_DECLS
-
-#endif /* __GST_NAVIGATION_H__ */
diff --git a/gst-libs/gst/interfaces/propertyprobe.c b/gst-libs/gst/interfaces/propertyprobe.c
deleted file mode 100644
index fb896a12..00000000
--- a/gst-libs/gst/interfaces/propertyprobe.c
+++ /dev/null
@@ -1,378 +0,0 @@
-/* GStreamer PropertyProbe
- * Copyright (C) 2003 David Schleef <ds@schleef.org>
- *
- * property_probe.c: property_probe design virtual class function wrappers
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-/**
- * SECTION:gstpropertyprobe
- * @short_description: Interface for probing possible property values
- *
- * The property probe is a way to autodetect allowed values for a GObject
- * property. It's primary use is to autodetect device-names in several elements.
- *
- * The interface is implemented by many hardware sources and sinks.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include "propertyprobe.h"
-
-enum
-{
- SIGNAL_PROBE_NEEDED,
- LAST_SIGNAL
-};
-
-static void gst_property_probe_iface_init (GstPropertyProbeInterface * iface);
-
-static guint gst_property_probe_signals[LAST_SIGNAL] = { 0 };
-
-GType
-gst_property_probe_get_type (void)
-{
- static GType gst_property_probe_type = 0;
-
- if (!gst_property_probe_type) {
- static const GTypeInfo gst_property_probe_info = {
- sizeof (GstPropertyProbeInterface),
- (GBaseInitFunc) gst_property_probe_iface_init,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- 0,
- NULL,
- };
-
- gst_property_probe_type =
- g_type_register_static (G_TYPE_INTERFACE,
- "GstPropertyProbe", &gst_property_probe_info, 0);
- }
-
- return gst_property_probe_type;
-}
-
-static void
-gst_property_probe_iface_init (GstPropertyProbeInterface * iface)
-{
- static gboolean initialized = FALSE;
-
- if (!initialized) {
- /**
- * GstPropertyProbe::probe-needed
- * @pspec: #GParamSpec that needs a probe
- *
- */
- /* FIXME:
- * what is the purpose of this signal, I can't find any usage of it
- * according to proto n *.h, it should be g_cclosure_marshal_VOID__PARAM
- */
- gst_property_probe_signals[SIGNAL_PROBE_NEEDED] =
- g_signal_new ("probe-needed", G_TYPE_FROM_CLASS (iface),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstPropertyProbeInterface,
- probe_needed), NULL, NULL, g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
- initialized = TRUE;
- }
-
- /* default virtual functions */
- iface->get_properties = NULL;
- iface->get_values = NULL;
-}
-
-/**
- * gst_property_probe_get_properties:
- * @probe: the #GstPropertyProbe to get the properties for.
- *
- * Get a list of properties for which probing is supported.
- *
- * Returns: the list of properties for which probing is supported
- * by this element.
- */
-const GList *
-gst_property_probe_get_properties (GstPropertyProbe * probe)
-{
- GstPropertyProbeInterface *iface;
-
- g_return_val_if_fail (probe != NULL, NULL);
- g_return_val_if_fail (GST_IS_PROPERTY_PROBE (probe), NULL);
-
- iface = GST_PROPERTY_PROBE_GET_IFACE (probe);
-
- if (iface->get_properties)
- return iface->get_properties (probe);
-
- return NULL;
-}
-
-/**
- * gst_property_probe_get_property:
- * @probe: the #GstPropertyProbe to get the properties for.
- * @name: name of the property.
- *
- * Get #GParamSpec for a property for which probing is supported.
- *
- * Returns: the #GParamSpec of %NULL.
- */
-const GParamSpec *
-gst_property_probe_get_property (GstPropertyProbe * probe, const gchar * name)
-{
- const GList *pspecs;
-
- g_return_val_if_fail (probe != NULL, NULL);
- g_return_val_if_fail (GST_IS_PROPERTY_PROBE (probe), NULL);
- g_return_val_if_fail (name != NULL, NULL);
-
- pspecs = gst_property_probe_get_properties (probe);
-
- while (pspecs) {
- const GParamSpec *pspec = pspecs->data;
-
- if (pspec) {
- if (!strcmp (pspec->name, name))
- return pspec;
- } else {
- GST_WARNING_OBJECT (probe, "NULL paramspec in property probe list");
- }
-
- pspecs = pspecs->next;
- }
-
- return NULL;
-}
-
-/**
- * gst_property_probe_probe_property:
- * @probe: the #GstPropertyProbe to check.
- * @pspec: #GParamSpec of the property.
- *
- * Runs a probe on the property specified by %pspec
- */
-void
-gst_property_probe_probe_property (GstPropertyProbe * probe,
- const GParamSpec * pspec)
-{
- GstPropertyProbeInterface *iface;
-
- g_return_if_fail (probe != NULL);
- g_return_if_fail (GST_IS_PROPERTY_PROBE (probe));
- g_return_if_fail (pspec != NULL);
-
- iface = GST_PROPERTY_PROBE_GET_IFACE (probe);
-
- if (iface->probe_property)
- iface->probe_property (probe, pspec->param_id, pspec);
-}
-
-/**
- * gst_property_probe_probe_property_name:
- * @probe: the #GstPropertyProbe to check.
- * @name: name of the property.
- *
- * Runs a probe on the property specified by %name.
- */
-void
-gst_property_probe_probe_property_name (GstPropertyProbe * probe,
- const gchar * name)
-{
- const GParamSpec *pspec;
-
- g_return_if_fail (probe != NULL);
- g_return_if_fail (GST_IS_PROPERTY_PROBE (probe));
- g_return_if_fail (name != NULL);
-
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (probe), name);
- if (!pspec) {
- g_warning ("No such property %s", name);
- return;
- }
-
- gst_property_probe_probe_property (probe, pspec);
-}
-
-/**
- * gst_property_probe_needs_probe:
- * @probe: the #GstPropertyProbe object to which the given property belongs.
- * @pspec: a #GParamSpec that identifies the property to check.
- *
- * Checks whether a property needs a probe. This might be because
- * the property wasn't initialized before, or because host setup
- * changed. This might be, for example, because a new device was
- * added, and thus device probing needs to be refreshed to display
- * the new device.
- *
- * Returns: TRUE if the property needs a new probe, FALSE if not.
- */
-gboolean
-gst_property_probe_needs_probe (GstPropertyProbe * probe,
- const GParamSpec * pspec)
-{
- GstPropertyProbeInterface *iface;
-
- g_return_val_if_fail (probe != NULL, FALSE);
- g_return_val_if_fail (GST_IS_PROPERTY_PROBE (probe), FALSE);
- g_return_val_if_fail (pspec != NULL, FALSE);
-
- iface = GST_PROPERTY_PROBE_GET_IFACE (probe);
-
- if (iface->needs_probe)
- return iface->needs_probe (probe, pspec->param_id, pspec);
-
- return FALSE;
-}
-
-/**
- * gst_property_probe_needs_probe_name:
- * @probe: the #GstPropertyProbe object to which the given property belongs.
- * @name: the name of the property to check.
- *
- * Same as gst_property_probe_needs_probe ().
- *
- * Returns: TRUE if the property needs a new probe, FALSE if not.
- */
-gboolean
-gst_property_probe_needs_probe_name (GstPropertyProbe * probe,
- const gchar * name)
-{
- const GParamSpec *pspec;
-
- g_return_val_if_fail (probe != NULL, FALSE);
- g_return_val_if_fail (GST_IS_PROPERTY_PROBE (probe), FALSE);
- g_return_val_if_fail (name != NULL, FALSE);
-
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (probe), name);
- if (!pspec) {
- g_warning ("No such property %s", name);
- return FALSE;
- }
-
- return gst_property_probe_needs_probe (probe, pspec);
-}
-
-/**
- * gst_property_probe_get_values:
- * @probe: the #GstPropertyProbe object.
- * @pspec: the #GParamSpec property identifier.
- *
- * Gets the possible (probed) values for the given property,
- * requires the property to have been probed before.
- *
- * Returns: A list of valid values for the given property.
- */
-GValueArray *
-gst_property_probe_get_values (GstPropertyProbe * probe,
- const GParamSpec * pspec)
-{
- GstPropertyProbeInterface *iface;
-
- g_return_val_if_fail (probe != NULL, NULL);
- g_return_val_if_fail (GST_IS_PROPERTY_PROBE (probe), NULL);
- g_return_val_if_fail (pspec != NULL, NULL);
-
- iface = GST_PROPERTY_PROBE_GET_IFACE (probe);
-
- if (iface->get_values)
- return iface->get_values (probe, pspec->param_id, pspec);
-
- return NULL;
-}
-
-/**
- * gst_property_probe_get_values_name:
- * @probe: the #GstPropertyProbe object.
- * @name: the name of the property to get values for.
- *
- * Same as gst_property_probe_get_values ().
- *
- * Returns: A list of valid values for the given property.
- */
-GValueArray *
-gst_property_probe_get_values_name (GstPropertyProbe * probe,
- const gchar * name)
-{
- const GParamSpec *pspec;
-
- g_return_val_if_fail (probe != NULL, NULL);
- g_return_val_if_fail (GST_IS_PROPERTY_PROBE (probe), NULL);
- g_return_val_if_fail (name != NULL, NULL);
-
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (probe), name);
- if (!pspec) {
- g_warning ("No such property %s", name);
- return NULL;
- }
-
- return gst_property_probe_get_values (probe, pspec);
-}
-
-/**
- * gst_property_probe_probe_and_get_values:
- * @probe: the #GstPropertyProbe object.
- * @pspec: The #GParamSpec property identifier.
- *
- * Check whether the given property requires a new probe. If so,
- * fo the probe. After that, retrieve a value list. Meant as a
- * utility function that wraps the above functions.
- *
- * Returns: the list of valid values for this property.
- */
-GValueArray *
-gst_property_probe_probe_and_get_values (GstPropertyProbe * probe,
- const GParamSpec * pspec)
-{
- g_return_val_if_fail (probe != NULL, NULL);
- g_return_val_if_fail (GST_IS_PROPERTY_PROBE (probe), NULL);
- g_return_val_if_fail (pspec != NULL, NULL);
-
- if (gst_property_probe_needs_probe (probe, pspec))
- gst_property_probe_probe_property (probe, pspec);
-
- return gst_property_probe_get_values (probe, pspec);
-}
-
-/**
- * gst_property_probe_probe_and_get_values_name:
- * @probe: the #GstPropertyProbe object.
- * @name: the name of the property to get values for.
- *
- * Same as gst_property_probe_probe_and_get_values ().
- *
- * Returns: the list of valid values for this property.
- */
-GValueArray *
-gst_property_probe_probe_and_get_values_name (GstPropertyProbe * probe,
- const gchar * name)
-{
- const GParamSpec *pspec;
-
- g_return_val_if_fail (probe != NULL, NULL);
- g_return_val_if_fail (GST_IS_PROPERTY_PROBE (probe), NULL);
- g_return_val_if_fail (name != NULL, NULL);
-
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (probe), name);
- if (!pspec) {
- g_warning ("No such property %s", name);
- return NULL;
- }
-
- return gst_property_probe_probe_and_get_values (probe, pspec);
-}
diff --git a/gst-libs/gst/interfaces/propertyprobe.h b/gst-libs/gst/interfaces/propertyprobe.h
deleted file mode 100644
index 5b67af2d..00000000
--- a/gst-libs/gst/interfaces/propertyprobe.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* GStreamer PropertyProbe
- * Copyright (C) 2003 David A. Schleef <ds@schleef.org>
- *
- * property_probe.h: property_probe 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_PROPERTY_PROBE_H__
-#define __GST_PROPERTY_PROBE_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_PROPERTY_PROBE \
- (gst_property_probe_get_type ())
-#define GST_PROPERTY_PROBE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PROPERTY_PROBE, GstPropertyProbe))
-#define GST_IS_PROPERTY_PROBE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PROPERTY_PROBE))
-#define GST_PROPERTY_PROBE_GET_IFACE(obj) \
- (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_PROPERTY_PROBE, GstPropertyProbeInterface))
-
-/**
- * GstPropertyProbe:
- *
- * Opaque #GstPropertyProbe data structure.
- */
-typedef struct _GstPropertyProbe GstPropertyProbe; /* dummy typedef */
-typedef struct _GstPropertyProbeInterface GstPropertyProbeInterface;
-
-/**
- * GstPropertyProbeInterface:
- * @klass: parent interface type.
- * @probe_needed: default signal handler
- * @get_properties: virtual method to get list of probable properties
- * @needs_probe: virtual method to tell if probe need update
- * @probe_property: virtual method to probe a property
- * @get_values: virtual method to get probe results for a property
- *
- * #GstPropertyProbe interface.
- */
-struct _GstPropertyProbeInterface {
- GTypeInterface klass;
-
- /* signals */
- void (*probe_needed) (GstPropertyProbe *probe,
- const GParamSpec *pspec);
-
- /* virtual functions */
- const GList * (*get_properties) (GstPropertyProbe *probe);
- gboolean (*needs_probe) (GstPropertyProbe *probe,
- guint prop_id,
- const GParamSpec *pspec);
- void (*probe_property) (GstPropertyProbe *probe,
- guint prop_id,
- const GParamSpec *pspec);
- GValueArray * (*get_values) (GstPropertyProbe *probe,
- guint prop_id,
- const GParamSpec *pspec);
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_property_probe_get_type (void);
-
-/* virtual class function wrappers */
-
-/* returns list of GParamSpecs */
-const GList * gst_property_probe_get_properties (GstPropertyProbe *probe);
-const GParamSpec *gst_property_probe_get_property (GstPropertyProbe *probe,
- const gchar *name);
-
-/* probe one property */
-void gst_property_probe_probe_property (GstPropertyProbe *probe,
- const GParamSpec *pspec);
-void gst_property_probe_probe_property_name (GstPropertyProbe *probe,
- const gchar *name);
-
-/* do we need a probe? */
-gboolean gst_property_probe_needs_probe (GstPropertyProbe *probe,
- const GParamSpec *pspec);
-gboolean gst_property_probe_needs_probe_name (GstPropertyProbe *probe,
- const gchar *name);
-
-/* returns list of GValues */
-GValueArray * gst_property_probe_get_values (GstPropertyProbe *probe,
- const GParamSpec *pspec);
-GValueArray * gst_property_probe_get_values_name (GstPropertyProbe *probe,
- const gchar *name);
-
-/* sugar */
-GValueArray * gst_property_probe_probe_and_get_values (GstPropertyProbe *probe,
- const GParamSpec *pspec);
-GValueArray * gst_property_probe_probe_and_get_values_name (GstPropertyProbe *probe,
- const gchar *name);
-
-G_END_DECLS
-
-#endif /* __GST_PROPERTY_PROBE_H__ */
diff --git a/gst-libs/gst/interfaces/streamvolume.c b/gst-libs/gst/interfaces/streamvolume.c
deleted file mode 100644
index a3efe468..00000000
--- a/gst-libs/gst/interfaces/streamvolume.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/* GStreamer Mixer
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gststreamvolume
- * @short_description: Interface for elements that provide a stream volume
- *
- * <refsect2>
- * <para>
- * This interface is implemented by elements that provide a stream volume. Examples for
- * such elements are #volume and #playbin2.
- * </para>
- * <para>
- * Applications can use this interface to get or set the current stream volume. For this
- * the "volume" #GObject property can be used or the helper functions gst_stream_volume_set_volume()
- * and gst_stream_volume_get_volume(). This volume is always a linear factor, i.e. 0.0 is muted
- * 1.0 is 100%. For showing the volume in a GUI it might make sense to convert it to
- * a different format by using gst_stream_volume_convert_volume(). Volume sliders should usually
- * use a cubic volume.
- *
- * Separate from the volume the stream can also be muted by the "mute" #GObject property or
- * gst_stream_volume_set_mute() and gst_stream_volume_get_mute().
- * </para>
- * <para>
- * Elements that provide some kind of stream volume should implement the "volume" and
- * "mute" #GObject properties and handle setting and getting of them properly.
- * The volume property is defined to be a linear volume factor.
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "streamvolume.h"
-#include <math.h>
-
-#ifndef HAVE_CBRT
-#define cbrt(x) (pow(abs(x),1.0/3.0))
-#endif
-
-static void
-gst_stream_volume_class_init (GstStreamVolumeInterface * iface)
-{
- g_object_interface_install_property (iface,
- g_param_spec_double ("volume",
- "Volume",
- "Linear volume factor, 1.0=100%",
- 0.0, G_MAXDOUBLE, 1.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_interface_install_property (iface,
- g_param_spec_boolean ("mute",
- "Mute",
- "Mute the audio channel without changing the volume",
- FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-}
-
-GType
-gst_stream_volume_get_type (void)
-{
- static volatile gsize type = 0;
- if (g_once_init_enter (&type)) {
- GType tmp;
- static const GTypeInfo info = {
- sizeof (GstStreamVolumeInterface),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gst_stream_volume_class_init, /* class_init */
- NULL, /* class_finalize */
- NULL, /* class_data */
- 0,
- 0, /* n_preallocs */
- NULL /* instance_init */
- };
- tmp = g_type_register_static (G_TYPE_INTERFACE,
- "GstStreamVolume", &info, 0);
- g_type_interface_add_prerequisite (tmp, G_TYPE_OBJECT);
-
- g_once_init_leave (&type, tmp);
- }
- return type;
-}
-
-/**
- * gst_stream_volume_get_volume:
- * @volume: #GstStreamVolume that should be used
- * @format: #GstStreamVolumeFormat which should be returned
- *
- * Returns: The current stream volume as linear factor
- *
- * Since: 0.10.25
- */
-gdouble
-gst_stream_volume_get_volume (GstStreamVolume * volume,
- GstStreamVolumeFormat format)
-{
- gdouble val;
-
- g_return_val_if_fail (GST_IS_STREAM_VOLUME (volume), 1.0);
-
- g_object_get (volume, "volume", &val, NULL);
- if (format != GST_STREAM_VOLUME_FORMAT_LINEAR)
- val =
- gst_stream_volume_convert_volume (GST_STREAM_VOLUME_FORMAT_LINEAR,
- format, val);
- return val;
-}
-
-/**
- * gst_stream_volume_set_volume:
- * @volume: #GstStreamVolume that should be used
- * @format: #GstStreamVolumeFormat of @val
- * @val: Linear volume factor that should be set
- *
- * Since: 0.10.25
- */
-void
-gst_stream_volume_set_volume (GstStreamVolume * volume,
- GstStreamVolumeFormat format, gdouble val)
-{
- g_return_if_fail (GST_IS_STREAM_VOLUME (volume));
-
- if (format != GST_STREAM_VOLUME_FORMAT_LINEAR)
- val =
- gst_stream_volume_convert_volume (format,
- GST_STREAM_VOLUME_FORMAT_LINEAR, val);
- g_object_set (volume, "volume", val, NULL);
-}
-
-/**
- * gst_stream_volume_get_mute:
- * @volume: #GstStreamVolume that should be used
- *
- * Returns: Returns %TRUE if the stream is muted
- *
- * Since: 0.10.25
- */
-gboolean
-gst_stream_volume_get_mute (GstStreamVolume * volume)
-{
- gboolean val;
-
- g_return_val_if_fail (GST_IS_STREAM_VOLUME (volume), FALSE);
-
- g_object_get (volume, "mute", &val, NULL);
- return val;
-}
-
-/**
- * gst_stream_volume_set_mute:
- * @volume: #GstStreamVolume that should be used
- * @mute: Mute state that should be set
- *
- * Since: 0.10.25
- */
-void
-gst_stream_volume_set_mute (GstStreamVolume * volume, gboolean mute)
-{
- g_return_if_fail (GST_IS_STREAM_VOLUME (volume));
-
- g_object_set (volume, "mute", mute, NULL);
-}
-
-/**
- * gst_stream_volume_convert_volume:
- * @from: #GstStreamVolumeFormat to convert from
- * @to: #GstStreamVolumeFormat to convert to
- * @val: Volume in @from format that should be converted
- *
- * Returns: the converted volume
- *
- * Since: 0.10.25
- */
-gdouble
-gst_stream_volume_convert_volume (GstStreamVolumeFormat from,
- GstStreamVolumeFormat to, gdouble val)
-{
- switch (from) {
- case GST_STREAM_VOLUME_FORMAT_LINEAR:
- g_return_val_if_fail (val >= 0.0, 0.0);
- switch (to) {
- case GST_STREAM_VOLUME_FORMAT_LINEAR:
- return val;
- case GST_STREAM_VOLUME_FORMAT_CUBIC:
- return cbrt (val);
- case GST_STREAM_VOLUME_FORMAT_DB:
- return 20.0 * log10 (val);
- }
- break;
- case GST_STREAM_VOLUME_FORMAT_CUBIC:
- g_return_val_if_fail (val >= 0.0, 0.0);
- switch (to) {
- case GST_STREAM_VOLUME_FORMAT_LINEAR:
- return val * val * val;
- case GST_STREAM_VOLUME_FORMAT_CUBIC:
- return val;
- case GST_STREAM_VOLUME_FORMAT_DB:
- return 3.0 * 20.0 * log10 (val);
- }
- break;
- case GST_STREAM_VOLUME_FORMAT_DB:
- switch (to) {
- case GST_STREAM_VOLUME_FORMAT_LINEAR:
- return pow (10.0, val / 20.0);
- case GST_STREAM_VOLUME_FORMAT_CUBIC:
- return pow (10.0, val / (3.0 * 20.0));
- case GST_STREAM_VOLUME_FORMAT_DB:
- return val;
- }
- break;
- }
- g_return_val_if_reached (0.0);
-}
diff --git a/gst-libs/gst/interfaces/streamvolume.h b/gst-libs/gst/interfaces/streamvolume.h
deleted file mode 100644
index 32a824c7..00000000
--- a/gst-libs/gst/interfaces/streamvolume.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_STREAM_VOLUME_H__
-#define __GST_STREAM_VOLUME_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_STREAM_VOLUME \
- (gst_stream_volume_get_type ())
-#define GST_STREAM_VOLUME(obj) \
- (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_STREAM_VOLUME, GstStreamVolume))
-#define GST_STREAM_VOLUME_INTERFACE(iface) \
- (G_TYPE_CHECK_INTERFACE_CAST ((iface), GST_TYPE_STREAM_VOLUME, GstStreamVolumeInterface))
-#define GST_IS_STREAM_VOLUME(obj) \
- (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_STREAM_VOLUME))
-#define GST_IS_STREAM_VOLUME_INTERFACE(iface) \
- (G_TYPE_CHECK_INTERFACE_TYPE ((iface), GST_TYPE_STREAM_VOLUME))
-#define GST_STREAM_VOLUME_GET_INTERFACE(inst) \
- (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_STREAM_VOLUME, GstStreamVolumeInterface))
-
-typedef struct _GstStreamVolume GstStreamVolume;
-typedef struct _GstStreamVolumeInterface GstStreamVolumeInterface;
-
-struct _GstStreamVolumeInterface {
- GTypeInterface parent;
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
-};
-
-/**
- * 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()
- * 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).
- *
- * Since: 0.10.25
- */
-typedef enum {
- GST_STREAM_VOLUME_FORMAT_LINEAR = 0,
- GST_STREAM_VOLUME_FORMAT_CUBIC,
- GST_STREAM_VOLUME_FORMAT_DB
-} GstStreamVolumeFormat;
-
-GType gst_stream_volume_get_type (void);
-void gst_stream_volume_set_volume (GstStreamVolume *volume,
- GstStreamVolumeFormat format,
- gdouble val);
-gdouble gst_stream_volume_get_volume (GstStreamVolume *volume,
- GstStreamVolumeFormat format);
-
-void gst_stream_volume_set_mute (GstStreamVolume *volume,
- gboolean mute);
-gboolean gst_stream_volume_get_mute (GstStreamVolume *volume);
-
-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/gst-libs/gst/interfaces/tuner.c b/gst-libs/gst/interfaces/tuner.c
deleted file mode 100644
index a7ba61a8..00000000
--- a/gst-libs/gst/interfaces/tuner.c
+++ /dev/null
@@ -1,574 +0,0 @@
-/* GStreamer Tuner
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * tuner.c: tuner design virtual class function wrappers
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "tuner.h"
-#include "interfaces-marshal.h"
-
-#include <string.h>
-
-/**
- * SECTION:gsttuner
- * @short_description: Interface for elements providing tuner operations
- *
- * <refsect2>
- * <para>
- * The GstTuner interface is provided by elements that have the ability to
- * tune into multiple input signals, for example TV or radio capture cards.
- * </para><para>
- * The interpretation of 'tuning into' an input stream depends on the element
- * implementing the interface. For v4lsrc, it might imply selection of an
- * input source and/or frequency to be configured on a TV card. Another
- * GstTuner implementation might be to allow selection of an active input pad
- * from multiple input pads.
- * </para><para>
- * That said, the GstTuner interface functions are biased toward the
- * TV capture scenario.
- * </para><para>
- * The general parameters provided are for configuration are:
- * <itemizedlist>
- * <listitem>Selection of a current #GstTunerChannel. The current channel
- * represents the input source (e.g. Composite, S-Video etc for TV capture).
- * </listitem>
- * <listitem>The #GstTunerNorm for the channel. The norm chooses the
- * interpretation of the incoming signal for the current channel. For example,
- * PAL or NTSC, or more specific variants there-of.
- * </listitem>
- * <listitem>Channel frequency. If the current channel has the ability to tune
- * between multiple frequencies (if it has the GST_TUNER_CHANNEL_FREQUENCY flag)
- * then the frequency can be changed/retrieved via the
- * gst_tuner_set_frequency() and gst_tuner_get_frequency() methods.
- * </listitem>
- * </itemizedlist>
- * </para>
- * <para>
- * Where applicable, the signal strength can be retrieved and/or monitored
- * via a signal.
- * </para>
- * </refsect2>
- */
-
-enum
-{
- NORM_CHANGED,
- CHANNEL_CHANGED,
- FREQUENCY_CHANGED,
- SIGNAL_CHANGED,
- LAST_SIGNAL
-};
-
-static void gst_tuner_class_init (GstTunerClass * klass);
-
-static guint gst_tuner_signals[LAST_SIGNAL] = { 0 };
-
-GType
-gst_tuner_get_type (void)
-{
- static GType gst_tuner_type = 0;
-
- if (!gst_tuner_type) {
- static const GTypeInfo gst_tuner_info = {
- sizeof (GstTunerClass),
- (GBaseInitFunc) gst_tuner_class_init,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- 0,
- NULL,
- };
-
- gst_tuner_type = g_type_register_static (G_TYPE_INTERFACE,
- "GstTuner", &gst_tuner_info, 0);
- g_type_interface_add_prerequisite (gst_tuner_type,
- GST_TYPE_IMPLEMENTS_INTERFACE);
- }
-
- return gst_tuner_type;
-}
-
-static void
-gst_tuner_class_init (GstTunerClass * klass)
-{
- static gboolean initialized = FALSE;
-
- if (!initialized) {
- /**
- * GstTuner::norm-changed:
- * @tuner: The element providing the GstTuner interface
- * @norm: The new configured norm.
- *
- * Reports that the current #GstTunerNorm has changed.
- */
- gst_tuner_signals[NORM_CHANGED] =
- g_signal_new ("norm-changed",
- GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstTunerClass, norm_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_TUNER_NORM);
- /**
- * GstTuner::channel-changed:
- * @tuner: The element providing the GstTuner interface
- * @channel: The new configured channel.
- *
- * Reports that the current #GstTunerChannel has changed.
- */
- gst_tuner_signals[CHANNEL_CHANGED] =
- g_signal_new ("channel-changed",
- GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstTunerClass, channel_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
- GST_TYPE_TUNER_CHANNEL);
- /**
- * GstTuner::frequency-changed:
- * @tuner: The element providing the GstTuner interface
- * @frequency: The new frequency (an unsigned long)
- *
- * Reports that the current frequency has changed.
- */
- gst_tuner_signals[FREQUENCY_CHANGED] =
- g_signal_new ("frequency-changed",
- GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstTunerClass, frequency_changed),
- NULL, NULL,
- gst_interfaces_marshal_VOID__OBJECT_ULONG, G_TYPE_NONE, 2,
- GST_TYPE_TUNER_CHANNEL, G_TYPE_ULONG);
- /**
- * GstTuner::signal-changed:
- * @tuner: The element providing the GstTuner interface
- * @channel: The current #GstTunerChannel
- * @signal: The new signal strength (an integer)
- *
- * Reports that the signal strength has changed.
- *
- * See Also: gst_tuner_signal_strength()
- */
- gst_tuner_signals[SIGNAL_CHANGED] =
- g_signal_new ("signal-changed",
- GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstTunerClass, signal_changed),
- NULL, NULL,
- gst_interfaces_marshal_VOID__OBJECT_INT, G_TYPE_NONE, 2,
- GST_TYPE_TUNER_CHANNEL, G_TYPE_INT);
-
- initialized = TRUE;
- }
-
- /* default virtual functions */
- klass->list_channels = NULL;
- klass->set_channel = NULL;
- klass->get_channel = NULL;
-
- klass->list_norms = NULL;
- klass->set_norm = NULL;
- klass->get_norm = NULL;
-
- klass->set_frequency = NULL;
- klass->get_frequency = NULL;
- klass->signal_strength = NULL;
-}
-
-/**
- * gst_tuner_list_channels:
- * @tuner: the #GstTuner (a #GstElement) to get the channels from.
- *
- * Retrieve a #GList of #GstTunerChannels available
- * (e.g. 'composite', 's-video', ...) from the given tuner object.
- *
- * Returns: A list of channels available on this tuner. The list is
- * owned by the GstTuner and must not be freed.
- */
-const GList *
-gst_tuner_list_channels (GstTuner * tuner)
-{
- GstTunerClass *klass;
-
- g_return_val_if_fail (GST_IS_TUNER (tuner), NULL);
-
- klass = GST_TUNER_GET_CLASS (tuner);
- if (klass->list_channels) {
- return klass->list_channels (tuner);
- }
-
- return NULL;
-}
-
-/**
- * gst_tuner_set_channel:
- * @tuner: the #GstTuner (a #GstElement) that owns the channel.
- * @channel: the channel to tune to.
- *
- * Tunes the object to the given channel, which should be one of the
- * channels returned by gst_tuner_list_channels().
- */
-
-void
-gst_tuner_set_channel (GstTuner * tuner, GstTunerChannel * channel)
-{
- GstTunerClass *klass;
-
- g_return_if_fail (GST_IS_TUNER (tuner));
-
- klass = GST_TUNER_GET_CLASS (tuner);
- if (klass->set_channel) {
- klass->set_channel (tuner, channel);
- }
-}
-
-/**
- * gst_tuner_get_channel:
- * @tuner: the #GstTuner (a #GstElement) to get the current channel from.
- *
- * Retrieve the current channel from the tuner.
- *
- * Returns: the current channel of the tuner object.
- */
-
-GstTunerChannel *
-gst_tuner_get_channel (GstTuner * tuner)
-{
- GstTunerClass *klass;
-
- g_return_val_if_fail (GST_IS_TUNER (tuner), NULL);
-
- klass = GST_TUNER_GET_CLASS (tuner);
- if (klass->get_channel) {
- return klass->get_channel (tuner);
- }
-
- return NULL;
-}
-
-/**
- * gst_tuner_list_norms:
- * @tuner: the #GstTuner (*a #GstElement) to get the list of norms from.
- *
- * Retrieve a GList of available #GstTunerNorm settings for the currently
- * tuned channel on the given tuner object.
- *
- * Returns: A list of norms available on the current channel for this
- * tuner object. The list is owned by the GstTuner and must not
- * be freed.
- */
-
-const GList *
-gst_tuner_list_norms (GstTuner * tuner)
-{
- GstTunerClass *klass;
-
- g_return_val_if_fail (GST_IS_TUNER (tuner), NULL);
-
- klass = GST_TUNER_GET_CLASS (tuner);
- if (klass->list_norms) {
- return klass->list_norms (tuner);
- }
-
- return NULL;
-}
-
-/**
- * gst_tuner_set_norm:
- * @tuner: the #GstTuner (a #GstElement) to set the norm on.
- * @norm: the norm to use for the current channel.
- *
- * Changes the video norm on this tuner to the given norm, which should be
- * one of the norms returned by gst_tuner_list_norms().
- */
-
-void
-gst_tuner_set_norm (GstTuner * tuner, GstTunerNorm * norm)
-{
- GstTunerClass *klass;
-
- g_return_if_fail (GST_IS_TUNER (tuner));
-
- klass = GST_TUNER_GET_CLASS (tuner);
- if (klass->set_norm) {
- klass->set_norm (tuner, norm);
- }
-}
-
-/**
- * gst_tuner_get_norm:
- * @tuner: the #GstTuner (a #GstElement) to get the current norm from.
- *
- * Get the current video norm from the given tuner object for the
- * currently selected channel.
- *
- * Returns: the current norm.
- */
-
-GstTunerNorm *
-gst_tuner_get_norm (GstTuner * tuner)
-{
- GstTunerClass *klass;
-
- g_return_val_if_fail (GST_IS_TUNER (tuner), NULL);
-
- klass = GST_TUNER_GET_CLASS (tuner);
- if (klass->get_norm) {
- return klass->get_norm (tuner);
- }
-
- return NULL;
-}
-
-/**
- * gst_tuner_set_frequency:
- * @tuner: The #Gsttuner (a #GstElement) that owns the given channel.
- * @channel: The #GstTunerChannel to set the frequency on.
- * @frequency: The frequency to tune in to.
- *
- * Sets a tuning frequency on the given tuner/channel. Note that this
- * requires the given channel to be a "tuning" channel, which can be
- * checked using GST_TUNER_CHANNEL_HAS_FLAG (), with the proper flag
- * being GST_TUNER_CHANNEL_FREQUENCY.
- *
- * The frequency is in Hz, with minimum steps indicated by the
- * frequency_multiplicator provided in the #GstTunerChannel. The
- * valid range is provided in the min_frequency and max_frequency properties
- * of the #GstTunerChannel.
- */
-
-void
-gst_tuner_set_frequency (GstTuner * tuner,
- GstTunerChannel * channel, gulong frequency)
-{
- GstTunerClass *klass;
-
- g_return_if_fail (GST_IS_TUNER (tuner));
- g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
- g_return_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
- GST_TUNER_CHANNEL_FREQUENCY));
-
- klass = GST_TUNER_GET_CLASS (tuner);
- if (klass->set_frequency) {
- klass->set_frequency (tuner, channel, frequency);
- }
-}
-
-/**
- * gst_tuner_get_frequency:
- * @tuner: The #GstTuner (a #GstElement) that owns the given channel.
- * @channel: The #GstTunerChannel to retrieve the frequency from.
- *
- * Retrieve the current frequency from the given channel. As for
- * gst_tuner_set_frequency(), the #GstTunerChannel must support frequency
- * operations, as indicated by the GST_TUNER_CHANNEL_FREQUENCY flag.
- *
- * Returns: The current frequency, or 0 on error.
- */
-
-gulong
-gst_tuner_get_frequency (GstTuner * tuner, GstTunerChannel * channel)
-{
- GstTunerClass *klass;
-
- g_return_val_if_fail (GST_IS_TUNER (tuner), 0);
- g_return_val_if_fail (GST_IS_TUNER_CHANNEL (channel), 0);
- g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
- GST_TUNER_CHANNEL_FREQUENCY), 0);
-
- klass = GST_TUNER_GET_CLASS (tuner);
-
- if (klass->get_frequency) {
- return klass->get_frequency (tuner, channel);
- }
-
- return 0;
-}
-
-/**
- * gst_tuner_signal_strength:
- * @tuner: the #GstTuner (a #GstElement) that owns the given channel.
- * @channel: the #GstTunerChannel to get the signal strength from.
- *
- * Get the strength of the signal on this channel. Note that this
- * requires the current channel to be a "tuning" channel, i.e. a
- * channel on which frequency can be set. This can be checked using
- * GST_TUNER_CHANNEL_HAS_FLAG (), and the appropriate flag to check
- * for is GST_TUNER_CHANNEL_FREQUENCY.
- *
- * The valid range of the signal strength is indicated in the
- * min_signal and max_signal properties of the #GstTunerChannel.
- *
- * Returns: Signal strength, or 0 on error.
- */
-gint
-gst_tuner_signal_strength (GstTuner * tuner, GstTunerChannel * channel)
-{
- GstTunerClass *klass;
-
- g_return_val_if_fail (GST_IS_TUNER (tuner), 0);
- g_return_val_if_fail (GST_IS_TUNER_CHANNEL (channel), 0);
- g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
- GST_TUNER_CHANNEL_FREQUENCY), 0);
-
- klass = GST_TUNER_GET_CLASS (tuner);
- if (klass->signal_strength) {
- return klass->signal_strength (tuner, channel);
- }
-
- return 0;
-}
-
-/**
- * gst_tuner_find_norm_by_name:
- * @tuner: A #GstTuner instance
- * @norm: A string containing the name of a #GstTunerNorm
- *
- * Look up a #GstTunerNorm by name.
- *
- * Returns: A #GstTunerNorm, or NULL if no norm with the provided name
- * is available.
- */
-GstTunerNorm *
-gst_tuner_find_norm_by_name (GstTuner * tuner, gchar * norm)
-{
- GList *walk;
-
- g_return_val_if_fail (GST_IS_TUNER (tuner), NULL);
- g_return_val_if_fail (norm != NULL, NULL);
-
- walk = (GList *) gst_tuner_list_norms (tuner);
- while (walk) {
- if (strcmp (GST_TUNER_NORM (walk->data)->label, norm) == 0)
- return GST_TUNER_NORM (walk->data);
- walk = g_list_next (walk);
- }
- return NULL;
-}
-
-/**
- * gst_tuner_find_channel_by_name:
- * @tuner: A #GstTuner instance
- * @channel: A string containing the name of a #GstTunerChannel
- *
- * Look up a #GstTunerChannel by name.
- *
- * Returns: A #GstTunerChannel, or NULL if no channel with the provided name
- * is available.
- */
-GstTunerChannel *
-gst_tuner_find_channel_by_name (GstTuner * tuner, gchar * channel)
-{
- GList *walk;
-
- g_return_val_if_fail (GST_IS_TUNER (tuner), NULL);
- g_return_val_if_fail (channel != NULL, NULL);
-
- walk = (GList *) gst_tuner_list_channels (tuner);
- while (walk) {
- if (strcmp (GST_TUNER_CHANNEL (walk->data)->label, channel) == 0)
- return GST_TUNER_CHANNEL (walk->data);
- walk = g_list_next (walk);
- }
- return NULL;
-}
-
-/**
- * gst_tuner_channel_changed:
- * @tuner: A #GstTuner instance
- * @channel: A #GstTunerChannel instance
- *
- * Called by elements implementing the #GstTuner interface when the
- * current channel changes. Fires the #GstTuner::channel-changed signal.
- */
-void
-gst_tuner_channel_changed (GstTuner * tuner, GstTunerChannel * channel)
-{
- g_return_if_fail (GST_IS_TUNER (tuner));
- g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
-
- g_signal_emit (G_OBJECT (tuner),
- gst_tuner_signals[CHANNEL_CHANGED], 0, channel);
-}
-
-/**
- * gst_tuner_norm_changed:
- * @tuner: A #GstTuner instance
- * @norm: A #GstTunerNorm instance
- *
- * Called by elements implementing the #GstTuner interface when the
- * current norm changes. Fires the #GstTuner::norm-changed signal.
- *
- */
-void
-gst_tuner_norm_changed (GstTuner * tuner, GstTunerNorm * norm)
-{
- g_return_if_fail (GST_IS_TUNER (tuner));
- g_return_if_fail (GST_IS_TUNER_NORM (norm));
-
- g_signal_emit (G_OBJECT (tuner), gst_tuner_signals[NORM_CHANGED], 0, norm);
-}
-
-/**
- * gst_tuner_frequency_changed:
- * @tuner: A #GstTuner instance
- * @channel: The current #GstTunerChannel
- * @frequency: The new frequency setting
- *
- * Called by elements implementing the #GstTuner interface when the
- * configured frequency changes. Fires the #GstTuner::frequency-changed
- * signal on the tuner, and the #GstTunerChannel::frequency-changed signal
- * on the channel.
- */
-void
-gst_tuner_frequency_changed (GstTuner * tuner,
- GstTunerChannel * channel, gulong frequency)
-{
- g_return_if_fail (GST_IS_TUNER (tuner));
- g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
-
- g_signal_emit (G_OBJECT (tuner),
- gst_tuner_signals[FREQUENCY_CHANGED], 0, channel, frequency);
-
- g_signal_emit_by_name (G_OBJECT (channel), "frequency_changed", frequency);
-}
-
-/**
- * gst_tuner_signal_changed:
- * @tuner: A #GstTuner instance
- * @channel: The current #GstTunerChannel
- * @signal: The new signal strength
- *
- * Called by elements implementing the #GstTuner interface when the
- * incoming signal strength changes. Fires the #GstTuner::signal-changed
- * signal on the tuner and the #GstTunerChannel::signal-changed signal on
- * the channel.
- */
-void
-gst_tuner_signal_changed (GstTuner * tuner,
- GstTunerChannel * channel, gint signal)
-{
- g_return_if_fail (GST_IS_TUNER (tuner));
- g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
-
- g_signal_emit (G_OBJECT (tuner),
- gst_tuner_signals[SIGNAL_CHANGED], 0, channel, signal);
-
- g_signal_emit_by_name (G_OBJECT (channel), "signal_changed", signal);
-}
diff --git a/gst-libs/gst/interfaces/tuner.h b/gst-libs/gst/interfaces/tuner.h
deleted file mode 100644
index e7ca24e6..00000000
--- a/gst-libs/gst/interfaces/tuner.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* GStreamer Tuner
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * tuner.h: tuner 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_TUNER_H__
-#define __GST_TUNER_H__
-
-#include <gst/gst.h>
-#include <gst/interfaces/tunernorm.h>
-#include <gst/interfaces/tunerchannel.h>
-#include <gst/interfaces/interfaces-enumtypes.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_TUNER \
- (gst_tuner_get_type ())
-#define GST_TUNER(obj) \
- (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TUNER, GstTuner))
-#define GST_TUNER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TUNER, GstTunerClass))
-#define GST_IS_TUNER(obj) \
- (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER))
-#define GST_IS_TUNER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER))
-#define GST_TUNER_GET_CLASS(inst) \
- (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_TUNER, GstTunerClass))
-
-typedef struct _GstTuner GstTuner;
-typedef struct _GstTunerClass GstTunerClass;
-
-struct _GstTunerClass {
- GTypeInterface klass;
-
- /* virtual functions */
- const GList * (* list_channels) (GstTuner *tuner);
- void (* set_channel) (GstTuner *tuner,
- GstTunerChannel *channel);
- GstTunerChannel *
- (* get_channel) (GstTuner *tuner);
-
- const GList * (* list_norms) (GstTuner *tuner);
- void (* set_norm) (GstTuner *tuner,
- GstTunerNorm *norm);
- GstTunerNorm *(* get_norm) (GstTuner *tuner);
-
- void (* set_frequency) (GstTuner *tuner,
- GstTunerChannel *channel,
- gulong frequency);
- gulong (* get_frequency) (GstTuner *tuner,
- GstTunerChannel *channel);
- gint (* signal_strength) (GstTuner *tuner,
- GstTunerChannel *channel);
-
- /* signals */
- void (*channel_changed) (GstTuner *tuner,
- GstTunerChannel *channel);
- void (*norm_changed) (GstTuner *tuner,
- GstTunerNorm *norm);
- void (*frequency_changed) (GstTuner *tuner,
- GstTunerChannel *channel,
- gulong frequency);
- void (*signal_changed) (GstTuner *tuner,
- GstTunerChannel *channel,
- gint signal);
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_tuner_get_type (void);
-
-/* virtual class function wrappers */
-const GList * gst_tuner_list_channels (GstTuner *tuner);
-void gst_tuner_set_channel (GstTuner *tuner,
- GstTunerChannel *channel);
-GstTunerChannel *
- gst_tuner_get_channel (GstTuner *tuner);
-
-const GList * gst_tuner_list_norms (GstTuner *tuner);
-void gst_tuner_set_norm (GstTuner *tuner,
- GstTunerNorm *norm);
-GstTunerNorm * gst_tuner_get_norm (GstTuner *tuner);
-
-void gst_tuner_set_frequency (GstTuner *tuner,
- GstTunerChannel *channel,
- gulong frequency);
-gulong gst_tuner_get_frequency (GstTuner *tuner,
- GstTunerChannel *channel);
-gint gst_tuner_signal_strength (GstTuner *tuner,
- GstTunerChannel *channel);
-
-/* helper functions */
-GstTunerNorm * gst_tuner_find_norm_by_name (GstTuner *tuner,
- gchar *norm);
-GstTunerChannel *gst_tuner_find_channel_by_name (GstTuner *tuner,
- gchar *channel);
-
-/* trigger signals */
-void gst_tuner_channel_changed (GstTuner *tuner,
- GstTunerChannel *channel);
-void gst_tuner_norm_changed (GstTuner *tuner,
- GstTunerNorm *norm);
-void gst_tuner_frequency_changed (GstTuner *tuner,
- GstTunerChannel *channel,
- gulong frequency);
-void gst_tuner_signal_changed (GstTuner *tuner,
- GstTunerChannel *channel,
- gint signal);
-
-G_END_DECLS
-
-#endif /* __GST_TUNER_H__ */
diff --git a/gst-libs/gst/interfaces/tunerchannel.c b/gst-libs/gst/interfaces/tunerchannel.c
deleted file mode 100644
index ac2b74e8..00000000
--- a/gst-libs/gst/interfaces/tunerchannel.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/* GStreamer Tuner
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * tunerchannel.c: tuner channel object 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "tunerchannel.h"
-
-/**
- * SECTION:gsttunerchannel
- * @short_description: A channel from an element implementing the #GstTuner
- * interface.
- *
- * <refsect2>
- * <para>The #GstTunerChannel object is provided by an element implementing
- * the #GstTuner interface.
- * </para>
- * <para>
- * GstTunerChannel provides a name and flags to determine the type and
- * capabilities of the channel. If the GST_TUNER_CHANNEL_FREQUENCY flag is
- * set, then the channel also information about the minimum and maximum
- * frequency, and range of the reported signal strength.
- * </para>
- * </refsect2>
- */
-
-enum
-{
- /* FILL ME */
- SIGNAL_FREQUENCY_CHANGED,
- SIGNAL_SIGNAL_CHANGED,
- LAST_SIGNAL
-};
-
-static void gst_tuner_channel_class_init (GstTunerChannelClass * klass);
-static void gst_tuner_channel_init (GstTunerChannel * channel);
-static void gst_tuner_channel_dispose (GObject * object);
-
-static GObjectClass *parent_class = NULL;
-static guint signals[LAST_SIGNAL] = { 0 };
-
-GType
-gst_tuner_channel_get_type (void)
-{
- static GType gst_tuner_channel_type = 0;
-
- if (!gst_tuner_channel_type) {
- static const GTypeInfo tuner_channel_info = {
- sizeof (GstTunerChannelClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_tuner_channel_class_init,
- NULL,
- NULL,
- sizeof (GstTunerChannel),
- 0,
- (GInstanceInitFunc) gst_tuner_channel_init,
- NULL
- };
-
- gst_tuner_channel_type =
- g_type_register_static (G_TYPE_OBJECT,
- "GstTunerChannel", &tuner_channel_info, 0);
- }
-
- return gst_tuner_channel_type;
-}
-
-static void
-gst_tuner_channel_class_init (GstTunerChannelClass * klass)
-{
- GObjectClass *object_klass = (GObjectClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- /**
- * GstTunerChannel::frequency-changed:
- * @tunerchannel: The #GstTunerChannel
- * @frequency: The new frequency (an unsigned long)
- *
- * Reports that the current frequency has changed.
- */
- signals[SIGNAL_FREQUENCY_CHANGED] =
- g_signal_new ("frequency-changed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstTunerChannelClass,
- frequency_changed),
- NULL, NULL, g_cclosure_marshal_VOID__ULONG, G_TYPE_NONE, 1, G_TYPE_ULONG);
- /**
- * GstTunerChannel::signal-changed:
- * @tunerchannel: The #GstTunerChannel
- * @signal: The new signal strength (an integer)
- *
- * Reports that the signal strength has changed.
- *
- * See Also: gst_tuner_signal_strength()
- */
- signals[SIGNAL_SIGNAL_CHANGED] =
- g_signal_new ("signal-changed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstTunerChannelClass,
- signal_changed),
- NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
-
- object_klass->dispose = gst_tuner_channel_dispose;
-}
-
-static void
-gst_tuner_channel_init (GstTunerChannel * channel)
-{
- channel->label = NULL;
- channel->flags = 0;
- channel->min_frequency = channel->max_frequency = 0;
- channel->min_signal = channel->max_signal = 0;
-}
-
-static void
-gst_tuner_channel_dispose (GObject * object)
-{
- GstTunerChannel *channel = GST_TUNER_CHANNEL (object);
-
- if (channel->label) {
- g_free (channel->label);
- channel->label = NULL;
- }
-
- if (parent_class->dispose)
- parent_class->dispose (object);
-}
diff --git a/gst-libs/gst/interfaces/tunerchannel.h b/gst-libs/gst/interfaces/tunerchannel.h
deleted file mode 100644
index 45c9c3fe..00000000
--- a/gst-libs/gst/interfaces/tunerchannel.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* GStreamer Tuner
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * tunerchannel.h: tuner channel object 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_TUNER_CHANNEL_H__
-#define __GST_TUNER_CHANNEL_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_TUNER_CHANNEL \
- (gst_tuner_channel_get_type ())
-#define GST_TUNER_CHANNEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TUNER_CHANNEL, \
- GstTunerChannel))
-#define GST_TUNER_CHANNEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TUNER_CHANNEL, \
- GstTunerChannelClass))
-#define GST_IS_TUNER_CHANNEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER_CHANNEL))
-#define GST_IS_TUNER_CHANNEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER_CHANNEL))
-
-typedef struct _GstTunerChannel GstTunerChannel;
-typedef struct _GstTunerChannelClass GstTunerChannelClass;
-
-/**
- * GstTunerChannelFlags:
- * @GST_TUNER_CHANNEL_INPUT: The channel is for input
- * @GST_TUNER_CHANNEL_OUTPUT: The channel is for output
- * @GST_TUNER_CHANNEL_FREQUENCY: The channel has a frequency setting
- * and signal strength.
- * @GST_TUNER_CHANNEL_AUDIO: The channel carries audio.
- *
- * An enumeration for flags indicating the available capabilities
- * of a #GstTunerChannel.
- */
-typedef enum {
- GST_TUNER_CHANNEL_INPUT = (1<<0),
- GST_TUNER_CHANNEL_OUTPUT = (1<<1),
- GST_TUNER_CHANNEL_FREQUENCY = (1<<2),
- GST_TUNER_CHANNEL_AUDIO = (1<<3)
-} GstTunerChannelFlags;
-
-/**
- * GST_TUNER_CHANNEL_HAS_FLAG:
- * @channel: A #GstTunerChannel
- * @flag: The flag to check for
- *
- * Macro to check if the given flag is set on a channel
- */
-#define GST_TUNER_CHANNEL_HAS_FLAG(channel, flag) \
- ((channel)->flags & flag)
-
-/**
- * GstTunerChannel:
- * @label: A string containing a descriptive name for this channel
- * @flags: A set of #GstTunerChannelFlags for this channel
- * @freq_multiplicator: The step size (in Hz) for the frequency setting.
- * @min_frequency: Minimum valid frequency setting (in Hz).
- * @max_frequency: Maximum valid frequency setting (in Hz).
- * @min_signal: Minimum reported signal strength value.
- * @max_signal: Maximum reported signal strength value.
- */
-struct _GstTunerChannel {
- GObject parent;
-
- /*< public >*/
- gchar *label;
- GstTunerChannelFlags flags;
- gfloat freq_multiplicator;
- gulong min_frequency;
- gulong max_frequency;
- gint min_signal;
- gint max_signal;
-};
-
-struct _GstTunerChannelClass {
- GObjectClass parent;
-
- /*< private >*/
- /* signals */
- void (*frequency_changed) (GstTunerChannel *channel,
- gulong frequency);
- void (*signal_changed) (GstTunerChannel *channel,
- gint signal);
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_tuner_channel_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_TUNER_CHANNEL_H__ */
diff --git a/gst-libs/gst/interfaces/tunernorm.c b/gst-libs/gst/interfaces/tunernorm.c
deleted file mode 100644
index 47260b0e..00000000
--- a/gst-libs/gst/interfaces/tunernorm.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* GStreamer Tuner
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * tunernorm.c: tuner norm object 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "tunernorm.h"
-
-/**
- * SECTION:gsttunernorm
- * @short_description: Encapsulates information about the data format(s)
- * for a #GstTunerChannel.
- *
- * <refsect2>
- * <para>The #GstTunerNorm object is created by an element implementing the
- * #GstTuner interface and encapsulates the selection of a capture/output format
- * for a selected #GstTunerChannel.
- * </para>
- * </refsect2>
- */
-
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-static void gst_tuner_norm_class_init (GstTunerNormClass * klass);
-static void gst_tuner_norm_init (GstTunerNorm * norm);
-static void gst_tuner_norm_dispose (GObject * object);
-
-static GObjectClass *parent_class = NULL;
-
-/*static guint signals[LAST_SIGNAL] = { 0 };*/
-
-GType
-gst_tuner_norm_get_type (void)
-{
- static GType gst_tuner_norm_type = 0;
-
- if (!gst_tuner_norm_type) {
- static const GTypeInfo tuner_norm_info = {
- sizeof (GstTunerNormClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_tuner_norm_class_init,
- NULL,
- NULL,
- sizeof (GstTunerNorm),
- 0,
- (GInstanceInitFunc) gst_tuner_norm_init,
- NULL
- };
-
- gst_tuner_norm_type =
- g_type_register_static (G_TYPE_OBJECT,
- "GstTunerNorm", &tuner_norm_info, 0);
- }
-
- return gst_tuner_norm_type;
-}
-
-static void
-gst_tuner_norm_class_init (GstTunerNormClass * klass)
-{
- GObjectClass *object_klass = (GObjectClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_klass->dispose = gst_tuner_norm_dispose;
-}
-
-static void
-gst_tuner_norm_init (GstTunerNorm * norm)
-{
- norm->label = NULL;
- g_value_init (&norm->framerate, GST_TYPE_FRACTION);
-}
-
-static void
-gst_tuner_norm_dispose (GObject * object)
-{
- GstTunerNorm *norm = GST_TUNER_NORM (object);
-
- if (norm->label) {
- g_free (norm->label);
- norm->label = NULL;
- }
-
- if (parent_class->dispose)
- parent_class->dispose (object);
-}
diff --git a/gst-libs/gst/interfaces/tunernorm.h b/gst-libs/gst/interfaces/tunernorm.h
deleted file mode 100644
index d93cb13c..00000000
--- a/gst-libs/gst/interfaces/tunernorm.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* GStreamer Tuner
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * tunernorm.h: tuner norm object 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_TUNER_NORM_H__
-#define __GST_TUNER_NORM_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_TUNER_NORM \
- (gst_tuner_norm_get_type ())
-#define GST_TUNER_NORM(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TUNER_NORM, GstTunerNorm))
-#define GST_TUNER_NORM_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TUNER_NORM, GstTunerNormClass))
-#define GST_IS_TUNER_NORM(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER_NORM))
-#define GST_IS_TUNER_NORM_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER_NORM))
-
-typedef struct _GstTunerNorm GstTunerNorm;
-typedef struct _GstTunerNormClass GstTunerNormClass;
-
-/**
- * GstTunerNorm:
- * @label: A string containing a descriptive name for the norm
- * @framerate: A GValue containing the framerate associated with this norm,
- * if any. (May be unset).
- */
-struct _GstTunerNorm {
- GObject parent;
-
- /*< public >*/
- gchar *label;
- GValue framerate;
-};
-
-struct _GstTunerNormClass {
- GObjectClass parent;
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_tuner_norm_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_TUNER_NORM_H__ */
diff --git a/gst-libs/gst/interfaces/videoorientation.c b/gst-libs/gst/interfaces/videoorientation.c
deleted file mode 100644
index 35ded695..00000000
--- a/gst-libs/gst/interfaces/videoorientation.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/* GStreamer
- * Copyright (C) 2006 Nokia <stefan.kost@nokia.com>
- *
- * videoorientation.c: 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "videoorientation.h"
-#include "interfaces-marshal.h"
-
-#include <string.h>
-
-/**
- * SECTION:gstvideoorientation
- * @short_description: Interface for elements providing video orientation
- * controls
- *
- * The interface allows unified access to control flipping and autocenter
- * operation of video-sources or operators.
- *
- * Since: 0.10.11
- */
-
-static void gst_video_orientation_iface_init (GstVideoOrientationInterface *
- iface);
-
-GType
-gst_video_orientation_get_type (void)
-{
- static GType gst_video_orientation_type = 0;
-
- if (!gst_video_orientation_type) {
- static const GTypeInfo gst_video_orientation_info = {
- sizeof (GstVideoOrientationInterface),
- (GBaseInitFunc) gst_video_orientation_iface_init,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- 0,
- NULL,
- };
-
- gst_video_orientation_type = g_type_register_static (G_TYPE_INTERFACE,
- "GstVideoOrientation", &gst_video_orientation_info, 0);
- g_type_interface_add_prerequisite (gst_video_orientation_type,
- GST_TYPE_IMPLEMENTS_INTERFACE);
- }
-
- return gst_video_orientation_type;
-}
-
-static void
-gst_video_orientation_iface_init (GstVideoOrientationInterface * iface)
-{
- /* default virtual functions */
-
- iface->get_hflip = NULL;
- iface->get_vflip = NULL;
- iface->get_hcenter = NULL;
- iface->get_vcenter = NULL;
-
- iface->set_hflip = NULL;
- iface->set_vflip = NULL;
- iface->set_hcenter = NULL;
- iface->set_vcenter = NULL;
-}
-
-/**
- * gst_video_orientation_get_hflip:
- * @video_orientation: #GstVideoOrientation interface of a #GstElement
- * @flip: return location for the result
- *
- * Get the horizontal flipping state (%TRUE for flipped) from the given object.
- *
- * Since: 0.10.11
- * Returns: %TRUE in case the element supports flipping
- */
-gboolean
-gst_video_orientation_get_hflip (GstVideoOrientation * video_orientation,
- gboolean * flip)
-{
- GstVideoOrientationInterface *iface =
- GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
-
- if (iface->get_hflip) {
- return iface->get_hflip (video_orientation, flip);
- }
- return FALSE;
-}
-
-/**
- * gst_video_orientation_get_vflip:
- * @video_orientation: #GstVideoOrientation interface of a #GstElement
- * @flip: return location for the result
- *
- * Get the vertical flipping state (%TRUE for flipped) from the given object.
- *
- * Since: 0.10.11
- * Returns: %TRUE in case the element supports flipping
- */
-gboolean
-gst_video_orientation_get_vflip (GstVideoOrientation * video_orientation,
- gboolean * flip)
-{
- GstVideoOrientationInterface *iface =
- GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
-
- if (iface->get_vflip) {
- return iface->get_vflip (video_orientation, flip);
- }
- return FALSE;
-}
-
-/**
- * gst_video_orientation_get_hcenter:
- * @video_orientation: #GstVideoOrientation interface of a #GstElement
- * @center: return location for the result
- *
- * Get the horizontal centering offset from the given object.
- *
- * Since: 0.10.11
- * Returns: %TRUE in case the element supports centering
- */
-gboolean
-gst_video_orientation_get_hcenter (GstVideoOrientation * video_orientation,
- gint * center)
-{
- GstVideoOrientationInterface *iface =
- GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
-
- if (iface->get_hcenter) {
- return iface->get_hcenter (video_orientation, center);
- }
- return FALSE;
-}
-
-/**
- * gst_video_orientation_get_vcenter:
- * @video_orientation: #GstVideoOrientation interface of a #GstElement
- * @center: return location for the result
- *
- * Get the vertical centering offset from the given object.
- *
- * Since: 0.10.11
- * Returns: %TRUE in case the element supports centering
- */
-gboolean
-gst_video_orientation_get_vcenter (GstVideoOrientation * video_orientation,
- gint * center)
-{
- GstVideoOrientationInterface *iface =
- GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
-
- if (iface->get_vcenter) {
- return iface->get_vcenter (video_orientation, center);
- }
- return FALSE;
-}
-
-/**
- * gst_video_orientation_set_hflip:
- * @video_orientation: #GstVideoOrientation interface of a #GstElement
- * @flip: use flipping
- *
- * Set the horizontal flipping state (%TRUE for flipped) for the given object.
- *
- * Since: 0.10.11
- * Returns: %TRUE in case the element supports flipping
- */
-gboolean
-gst_video_orientation_set_hflip (GstVideoOrientation * video_orientation,
- gboolean flip)
-{
- GstVideoOrientationInterface *iface =
- GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
-
- if (iface->set_hflip) {
- return iface->set_hflip (video_orientation, flip);
- }
- return FALSE;
-}
-
-/**
- * gst_video_orientation_set_vflip:
- * @video_orientation: #GstVideoOrientation interface of a #GstElement
- * @flip: use flipping
- *
- * Set the vertical flipping state (%TRUE for flipped) for the given object.
- *
- * Since: 0.10.11
- * Returns: %TRUE in case the element supports flipping
- */
-gboolean
-gst_video_orientation_set_vflip (GstVideoOrientation * video_orientation,
- gboolean flip)
-{
- GstVideoOrientationInterface *iface =
- GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
-
- if (iface->set_vflip) {
- return iface->set_vflip (video_orientation, flip);
- }
- return FALSE;
-}
-
-/**
- * gst_video_orientation_set_hcenter:
- * @video_orientation: #GstVideoOrientation interface of a #GstElement
- * @center: centering offset
- *
- * Set the horizontal centering offset for the given object.
- *
- * Since: 0.10.11
- * Returns: %TRUE in case the element supports centering
- */
-gboolean
-gst_video_orientation_set_hcenter (GstVideoOrientation * video_orientation,
- gint center)
-{
- GstVideoOrientationInterface *iface =
- GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
-
- if (iface->set_hcenter) {
- return iface->set_hcenter (video_orientation, center);
- }
- return FALSE;
-}
-
-/**
- * gst_video_orientation_set_vcenter:
- * @video_orientation: #GstVideoOrientation interface of a #GstElement
- * @center: centering offset
- *
- * Set the vertical centering offset for the given object.
- *
- * Since: 0.10.11
- * Returns: %TRUE in case the element supports centering
- */
-gboolean
-gst_video_orientation_set_vcenter (GstVideoOrientation * video_orientation,
- gint center)
-{
- GstVideoOrientationInterface *iface =
- GST_VIDEO_ORIENTATION_GET_IFACE (video_orientation);
-
- if (iface->set_vcenter) {
- return iface->set_vcenter (video_orientation, center);
- }
- return FALSE;
-}
diff --git a/gst-libs/gst/interfaces/videoorientation.h b/gst-libs/gst/interfaces/videoorientation.h
deleted file mode 100644
index c02d08b3..00000000
--- a/gst-libs/gst/interfaces/videoorientation.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_VIDEO_ORIENTATION_H__
-#define __GST_VIDEO_ORIENTATION_H__
-
-#include <gst/gst.h>
-#include <gst/interfaces/interfaces-enumtypes.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_VIDEO_ORIENTATION \
- (gst_video_orientation_get_type ())
-#define GST_VIDEO_ORIENTATION(obj) \
- (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_ORIENTATION, GstVideoOrientation))
-#define GST_IS_VIDEO_ORIENTATION(obj) \
- (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_ORIENTATION))
-#define GST_VIDEO_ORIENTATION_GET_IFACE(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:
- * @parent: 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 parent;
-
- /* 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);
-
- /*< private > */
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_video_orientation_get_type (void);
-
-/* virtual class function wrappers */
-gboolean gst_video_orientation_get_hflip (GstVideoOrientation *video_orientation, gboolean *flip);
-gboolean gst_video_orientation_get_vflip (GstVideoOrientation *video_orientation, gboolean *flip);
-gboolean gst_video_orientation_get_hcenter (GstVideoOrientation *video_orientation, gint *center);
-gboolean gst_video_orientation_get_vcenter (GstVideoOrientation *video_orientation, gint *center);
-
-gboolean gst_video_orientation_set_hflip (GstVideoOrientation *video_orientation, gboolean flip);
-gboolean gst_video_orientation_set_vflip (GstVideoOrientation *video_orientation, gboolean flip);
-gboolean gst_video_orientation_set_hcenter (GstVideoOrientation *video_orientation, gint center);
-gboolean gst_video_orientation_set_vcenter (GstVideoOrientation *video_orientation, gint center);
-
-G_END_DECLS
-
-#endif /* __GST_VIDEO_ORIENTATION_H__ */
diff --git a/gst-libs/gst/interfaces/xoverlay.c b/gst-libs/gst/interfaces/xoverlay.c
deleted file mode 100644
index 224505a5..00000000
--- a/gst-libs/gst/interfaces/xoverlay.c
+++ /dev/null
@@ -1,458 +0,0 @@
-/* GStreamer X-based Overlay
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * x-overlay.c: X-based overlay 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-/**
- * SECTION:gstxoverlay
- * @short_description: Interface for setting/getting a Window on elements
- * supporting it
- *
- * <refsect2>
- * <para>
- * The XOverlay interface is used for 2 main purposes :
- * <itemizedlist>
- * <listitem>
- * <para>
- * To get a grab on the Window where the video sink element is going to render.
- * This is achieved by either being informed about the Window identifier that
- * the video sink element generated, or by forcing the video sink element to use
- * a specific Window identifier for rendering.
- * </para>
- * </listitem>
- * <listitem>
- * <para>
- * To force a redrawing of the latest video frame the video sink element
- * displayed on the Window. Indeed if the #GstPipeline is in #GST_STATE_PAUSED
- * state, moving the Window around will damage its content. Application
- * developers will want to handle the Expose events themselves and force the
- * video sink element to refresh the Window's content.
- * </para>
- * </listitem>
- * </itemizedlist>
- * </para>
- * <para>
- * Using the Window created by the video sink is probably the simplest scenario,
- * in some cases, though, it might not be flexible enough for application
- * developers if they need to catch events such as mouse moves and button
- * clicks.
- * </para>
- * <para>
- * Setting a specific Window identifier on the video sink element is the most
- * flexible solution but it has some issues. Indeed the application needs to set
- * its Window identifier at the right time to avoid internal Window creation
- * from the video sink element. To solve this issue a #GstMessage is posted on
- * the bus to inform the application that it should set the Window identifier
- * immediately. Here is an example on how to do that correctly:
- * |[
- * static GstBusSyncReply
- * create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
- * {
- * // ignore anything but 'prepare-xwindow-id' element messages
- * if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- * return GST_BUS_PASS;
- *
- * if (!gst_structure_has_name (message-&gt;structure, "prepare-xwindow-id"))
- * return GST_BUS_PASS;
- *
- * win = XCreateSimpleWindow (disp, root, 0, 0, 320, 240, 0, 0, 0);
- *
- * XSetWindowBackgroundPixmap (disp, win, None);
- *
- * XMapRaised (disp, win);
- *
- * XSync (disp, FALSE);
- *
- * gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)),
- * win);
- *
- * gst_message_unref (message);
- *
- * return GST_BUS_DROP;
- * }
- * ...
- * int
- * main (int argc, char **argv)
- * {
- * ...
- * bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- * gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, pipeline);
- * ...
- * }
- * ]|
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>Two basic usage scenarios</title>
- * <para>
- * There are two basic usage scenarios: in the simplest case, the application
- * knows exactly what particular element is used for video output, which is
- * usually the case when the application creates the videosink to use
- * (e.g. #xvimagesink, #ximagesink, etc.) itself; in this case, the application
- * can just create the videosink element, create and realize the window to
- * render the video on and then call gst_x_overlay_set_xwindow_id() directly
- * with the XID or native window handle, before starting up the pipeline.
- * </para>
- * <para>
- * In the other and more common case, the application does not know in advance
- * what GStreamer video sink element will be used for video output. This is
- * usually the case when an element such as #autovideosink or #gconfvideosink
- * is used. In this case, the video sink element itself is created
- * asynchronously from a GStreamer streaming thread some time after the
- * pipeline has been started up. When that happens, however, the video sink
- * will need to know right then whether to render onto an already existing
- * application window or whether to create its own window. This is when it
- * posts a prepare-xwindow-id message, and that is also why this message needs
- * to be handled in a sync bus handler which will be called from the streaming
- * thread directly (because the video sink will need an answer right then).
- * </para>
- * <para>
- * As response to the prepare-xwindow-id element message in the bus sync
- * handler, the application may use gst_x_overlay_set_xwindow_id() to tell
- * the video sink to render onto an existing window surface. At this point the
- * application should already have obtained the window handle / XID, so it
- * just needs to set it. It is generally not advisable to call any GUI toolkit
- * functions or window system functions from the streaming thread in which the
- * prepare-xwindow-id message is handled, because most GUI toolkits and
- * windowing systems are not thread-safe at all and a lot of care would be
- * required to co-ordinate the toolkit and window system calls of the
- * different threads (Gtk+ users please note: prior to Gtk+ 2.18
- * GDK_WINDOW_XID() was just a simple structure access, so generally fine to do
- * within the bus sync handler; this macro was changed to a function call in
- * Gtk+ 2.18 and later, which is likely to cause problems when called from a
- * sync handler; see below for a better approach without GDK_WINDOW_XID()
- * used in the callback).
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>GstXOverlay and Gtk+</title>
- * <para>
- * |[
- * #include &lt;gtk/gtk.h&gt;
- * #ifdef GDK_WINDOWING_X11
- * #include &lt;gdk/gdkx.h&gt; // for GDK_WINDOW_XID
- * #endif
- * ...
- * static gulong video_window_xid = 0;
- * ...
- * static GstBusSyncReply
- * bus_sync_handler (GstBus * bus, GstMessage * message, gpointer user_data)
- * {
- * // ignore anything but 'prepare-xwindow-id' element messages
- * if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- * return GST_BUS_PASS;
- * if (!gst_structure_has_name (message-&gt;structure, "prepare-xwindow-id"))
- * return GST_BUS_PASS;
- *
- * if (video_window_xid != 0) {
- * GstXOverlay *xoverlay;
- *
- * // GST_MESSAGE_SRC (message) will be the video sink element
- * xoverlay = GST_X_OVERLAY (GST_MESSAGE_SRC (message));
- * gst_x_overlay_set_xwindow_id (xoverlay, video_window_xid);
- * } else {
- * g_warning ("Should have obtained video_window_xid by now!");
- * }
- *
- * gst_message_unref (message);
- * return GST_BUS_DROP;
- * }
- * ...
- * static void
- * video_widget_realize_cb (GtkWidget * widget, gpointer data)
- * {
- * #if GTK_CHECK_VERSION(2,18,0)
- * // This is here just for pedagogical purposes, GDK_WINDOW_XID will call
- * // it as well in newer Gtk versions
- * if (!gdk_window_ensure_native (widget->window))
- * g_error ("Couldn't create native window needed for GstXOverlay!");
- * #endif
- *
- * #ifdef GDK_WINDOWING_X11
- * video_window_xid = GDK_WINDOW_XID (video_window->window);
- * #endif
- * }
- * ...
- * int
- * main (int argc, char **argv)
- * {
- * GtkWidget *video_window;
- * GtkWidget *app_window;
- * ...
- * app_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- * ...
- * video_window = gtk_drawing_area_new ();
- * g_signal_connect (video_window, "realize",
- * G_CALLBACK (video_widget_realize_cb), NULL);
- * gtk_widget_set_double_buffered (video_window, FALSE);
- * ...
- * // usually the video_window will not be directly embedded into the
- * // application window like this, but there will be many other widgets
- * // and the video window will be embedded in one of them instead
- * gtk_container_add (GTK_CONTAINER (ap_window), video_window);
- * ...
- * // show the GUI
- * gtk_widget_show_all (app_window);
- *
- * // realize window now so that the video window gets created and we can
- * // obtain its XID before the pipeline is started up and the videosink
- * // asks for the XID of the window to render onto
- * gtk_widget_realize (window);
- *
- * // we should have the XID now
- * g_assert (video_window_xid != 0);
- * ...
- * // set up sync handler for setting the xid once the pipeline is started
- * bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- * gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bus_sync_handler, NULL);
- * gst_object_unref (bus);
- * ...
- * gst_element_set_state (pipeline, GST_STATE_PLAYING);
- * ...
- * }
- * ]|
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>GstXOverlay and Qt</title>
- * <para>
- * |[
- * #include &lt;glib.h&gt;
- * #include &lt;gst/gst.h&gt;
- * #include &lt;gst/interfaces/xoverlay.h&gt;
- *
- * #include &lt;QApplication&gt;
- * #include &lt;QTimer&gt;
- * #include &lt;QWidget&gt;
- *
- * int main(int argc, char *argv[])
- * {
- * if (!g_thread_supported ())
- * g_thread_init (NULL);
- *
- * gst_init (&argc, &argv);
- * QApplication app(argc, argv);
- * app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit ()));
- *
- * // prepare the pipeline
- *
- * GstElement *pipeline = gst_pipeline_new ("xvoverlay");
- * GstElement *src = gst_element_factory_make ("videotestsrc", NULL);
- * GstElement *sink = gst_element_factory_make ("xvimagesink", NULL);
- * gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
- * gst_element_link (src, sink);
- *
- * // prepare the ui
- *
- * QWidget window;
- * window.resize(320, 240);
- * window.show();
- *
- * WId xwinid = window.winId();
- * gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), xwinid);
- *
- * // run the pipeline
- *
- * GstStateChangeReturn sret = gst_element_set_state (pipeline,
- * GST_STATE_PLAYING);
- * if (sret == GST_STATE_CHANGE_FAILURE) {
- * gst_element_set_state (pipeline, GST_STATE_NULL);
- * gst_object_unref (pipeline);
- * // Exit application
- * QTimer::singleShot(0, QApplication::activeWindow(), SLOT(quit()));
- * }
- *
- * int ret = app.exec();
- *
- * window.hide();
- * gst_element_set_state (pipeline, GST_STATE_NULL);
- * gst_object_unref (pipeline);
- *
- * return ret;
- * }
- * ]|
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "xoverlay.h"
-
-static void gst_x_overlay_base_init (gpointer g_class);
-
-GType
-gst_x_overlay_get_type (void)
-{
- static GType gst_x_overlay_type = 0;
-
- if (!gst_x_overlay_type) {
- static const GTypeInfo gst_x_overlay_info = {
- sizeof (GstXOverlayClass),
- gst_x_overlay_base_init,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- 0,
- NULL,
- };
-
- gst_x_overlay_type = g_type_register_static (G_TYPE_INTERFACE,
- "GstXOverlay", &gst_x_overlay_info, 0);
- g_type_interface_add_prerequisite (gst_x_overlay_type,
- GST_TYPE_IMPLEMENTS_INTERFACE);
- }
-
- return gst_x_overlay_type;
-}
-
-static void
-gst_x_overlay_base_init (gpointer g_class)
-{
- GstXOverlayClass *overlay_class = (GstXOverlayClass *) g_class;
-
- overlay_class->set_xwindow_id = NULL;
-}
-
-/**
- * gst_x_overlay_set_xwindow_id:
- * @overlay: a #GstXOverlay to set the XWindow on.
- * @xwindow_id: a #XID referencing the XWindow.
- *
- * This will call the video overlay's set_xwindow_id method. You should
- * use this method to tell to a XOverlay to display video output to a
- * specific XWindow. Passing 0 as the xwindow_id will tell the overlay to
- * stop using that window and create an internal one.
- */
-void
-gst_x_overlay_set_xwindow_id (GstXOverlay * overlay, gulong xwindow_id)
-{
- GstXOverlayClass *klass;
-
- g_return_if_fail (overlay != NULL);
- g_return_if_fail (GST_IS_X_OVERLAY (overlay));
-
- klass = GST_X_OVERLAY_GET_CLASS (overlay);
-
- if (klass->set_xwindow_id) {
- klass->set_xwindow_id (overlay, xwindow_id);
- }
-}
-
-/**
- * gst_x_overlay_got_xwindow_id:
- * @overlay: a #GstXOverlay which got a XWindow.
- * @xwindow_id: a #XID referencing the XWindow.
- *
- * This will post a "have-xwindow-id" element message on the bus.
- *
- * This function should only be used by video overlay plugin developers.
- */
-void
-gst_x_overlay_got_xwindow_id (GstXOverlay * overlay, gulong xwindow_id)
-{
- GstStructure *s;
- GstMessage *msg;
-
- g_return_if_fail (overlay != NULL);
- g_return_if_fail (GST_IS_X_OVERLAY (overlay));
-
- GST_LOG_OBJECT (GST_OBJECT (overlay), "xwindow_id = %lu", xwindow_id);
- s = gst_structure_new ("have-xwindow-id", "xwindow-id", G_TYPE_ULONG,
- xwindow_id, NULL);
- msg = gst_message_new_element (GST_OBJECT (overlay), s);
- gst_element_post_message (GST_ELEMENT (overlay), msg);
-}
-
-/**
- * gst_x_overlay_prepare_xwindow_id:
- * @overlay: a #GstXOverlay which does not yet have an XWindow.
- *
- * This will post a "prepare-xwindow-id" element message on the bus
- * to give applications an opportunity to call
- * gst_x_overlay_set_xwindow_id() before a plugin creates its own
- * window.
- *
- * This function should only be used by video overlay plugin developers.
- */
-void
-gst_x_overlay_prepare_xwindow_id (GstXOverlay * overlay)
-{
- GstStructure *s;
- GstMessage *msg;
-
- g_return_if_fail (overlay != NULL);
- g_return_if_fail (GST_IS_X_OVERLAY (overlay));
-
- GST_LOG_OBJECT (GST_OBJECT (overlay), "prepare xwindow_id");
- s = gst_structure_new ("prepare-xwindow-id", NULL);
- msg = gst_message_new_element (GST_OBJECT (overlay), s);
- gst_element_post_message (GST_ELEMENT (overlay), msg);
-}
-
-/**
- * gst_x_overlay_expose:
- * @overlay: a #GstXOverlay to expose.
- *
- * Tell an overlay that it has been exposed. This will redraw the current frame
- * in the drawable even if the pipeline is PAUSED.
- */
-void
-gst_x_overlay_expose (GstXOverlay * overlay)
-{
- GstXOverlayClass *klass;
-
- g_return_if_fail (overlay != NULL);
- g_return_if_fail (GST_IS_X_OVERLAY (overlay));
-
- klass = GST_X_OVERLAY_GET_CLASS (overlay);
-
- if (klass->expose) {
- klass->expose (overlay);
- }
-}
-
-/**
- * gst_x_overlay_handle_events:
- * @overlay: a #GstXOverlay to expose.
- * @handle_events: a #gboolean indicating if events should be handled or not.
- *
- * Tell an overlay that it should handle events from the window system. These
- * events are forwared upstream as navigation events. In some window system,
- * events are not propagated in the window hierarchy if a client is listening
- * for them. This method allows you to disable events handling completely
- * from the XOverlay.
- */
-void
-gst_x_overlay_handle_events (GstXOverlay * overlay, gboolean handle_events)
-{
- GstXOverlayClass *klass;
-
- g_return_if_fail (overlay != NULL);
- g_return_if_fail (GST_IS_X_OVERLAY (overlay));
-
- klass = GST_X_OVERLAY_GET_CLASS (overlay);
-
- if (klass->handle_events) {
- klass->handle_events (overlay, handle_events);
- }
-}
diff --git a/gst-libs/gst/interfaces/xoverlay.h b/gst-libs/gst/interfaces/xoverlay.h
deleted file mode 100644
index d6609a4f..00000000
--- a/gst-libs/gst/interfaces/xoverlay.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* GStreamer X-based Overlay
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
- *
- * x-overlay.h: X-based overlay 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_X_OVERLAY_H__
-#define __GST_X_OVERLAY_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_X_OVERLAY \
- (gst_x_overlay_get_type ())
-#define GST_X_OVERLAY(obj) \
- (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_X_OVERLAY, \
- GstXOverlay))
-#define GST_X_OVERLAY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_X_OVERLAY, GstXOverlayClass))
-#define GST_IS_X_OVERLAY(obj) \
- (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_X_OVERLAY))
-#define GST_IS_X_OVERLAY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_X_OVERLAY))
-#define GST_X_OVERLAY_GET_CLASS(inst) \
- (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_X_OVERLAY, GstXOverlayClass))
-
-/**
- * GstXOverlay:
- *
- * Opaque #GstXOverlay data structure.
- */
-typedef struct _GstXOverlay GstXOverlay;
-typedef struct _GstXOverlayClass GstXOverlayClass;
-
-/**
- * GstXOverlayClass:
- * @klass: parent interface type.
- * @set_xwindow_id: virtual method to configure the XWindow id
- * @expose: virtual method to handle expose events
- * @handle_events: virtual method to handle events
- *
- * #GstXOverlay interface
- */
-struct _GstXOverlayClass {
- GTypeInterface klass;
-
- /* virtual functions */
- void (* set_xwindow_id) (GstXOverlay *overlay,
- gulong xwindow_id);
-
- void (* expose) (GstXOverlay *overlay);
-
- void (* handle_events) (GstXOverlay *overlay,
- gboolean handle_events);
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING - 1];
-};
-
-GType gst_x_overlay_get_type (void);
-
-/* virtual class function wrappers */
-void gst_x_overlay_set_xwindow_id (GstXOverlay *overlay, gulong xwindow_id);
-
-void gst_x_overlay_expose (GstXOverlay *overlay);
-
-void gst_x_overlay_handle_events (GstXOverlay *overlay,
- gboolean handle_events);
-
-/* public methods to dispatch bus messages */
-void gst_x_overlay_got_xwindow_id (GstXOverlay *overlay, gulong xwindow_id);
-
-void gst_x_overlay_prepare_xwindow_id (GstXOverlay *overlay);
-
-G_END_DECLS
-
-#endif /* __GST_X_OVERLAY_H__ */
diff --git a/gst-libs/gst/netbuffer/Makefile.am b/gst-libs/gst/netbuffer/Makefile.am
deleted file mode 100644
index 7a581098..00000000
--- a/gst-libs/gst/netbuffer/Makefile.am
+++ /dev/null
@@ -1,47 +0,0 @@
-libgstnetbufferincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/netbuffer
-
-libgstnetbufferinclude_HEADERS = gstnetbuffer.h
-
-lib_LTLIBRARIES = libgstnetbuffer-@GST_MAJORMINOR@.la
-
-libgstnetbuffer_@GST_MAJORMINOR@_la_SOURCES = gstnetbuffer.c
-libgstnetbuffer_@GST_MAJORMINOR@_la_CFLAGS = $(GST_CFLAGS)
-libgstnetbuffer_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS)
-libgstnetbuffer_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
-
-if HAVE_INTROSPECTION
-BUILT_GIRSOURCES = GstNetbuffer-@GST_MAJORMINOR@.gir
-
-gir_headers=$(patsubst %,$(srcdir)/%, $(libgstnetbufferinclude_HEADERS))
-gir_sources=$(patsubst %,$(srcdir)/%, $(libgstnetbuffer_@GST_MAJORMINOR@_la_SOURCES))
-gir_cincludes=$(patsubst %,--c-include='gst/netbuffer/%',$(libgstnetbufferinclude_HEADERS))
-
-GstNetbuffer-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstnetbuffer-@GST_MAJORMINOR@.la
- PKG_CONFIG_PATH="$(PKG_CONFIG_PATH):$(top_builddir)/pkgconfig" \
- $(INTROSPECTION_SCANNER) -v --namespace GstNetbuffer \
- --nsversion=@GST_MAJORMINOR@ \
- --strip-prefix=Gst \
- $(gir_cincludes) \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst \
- --library=gstnetbuffer-0.10 \
- --include=Gst-0.10 \
- --libtool="$(top_builddir)/libtool" \
- --pkg gstreamer-0.10 \
- --output $@ \
- $(gir_headers) \
- $(gir_sources)
-
-# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
-# install anything - we need to install inside our prefix.
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(BUILT_GIRSOURCES)
-
-typelibsdir = $(libdir)/girepository-1.0/
-
-typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
-
-%.typelib: %.gir $(INTROSPECTION_COMPILER)
- $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=$(builddir) --includedir=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
-CLEANFILES = $(BUILT_GIRSOURCES) $(typelibs_DATA)
-endif
diff --git a/gst-libs/gst/netbuffer/README b/gst-libs/gst/netbuffer/README
deleted file mode 100644
index d55ceb1f..00000000
--- a/gst-libs/gst/netbuffer/README
+++ /dev/null
@@ -1,9 +0,0 @@
-The network libraries
----------------------
-
-GstNetBuffer:
-
- A GstBuffer subclass that can be used by network sources or sinks to
- store additional to and from addresses. This is required for plugins
- that operate on this data like RTP.
-
diff --git a/gst-libs/gst/netbuffer/gstnetbuffer.c b/gst-libs/gst/netbuffer/gstnetbuffer.c
deleted file mode 100644
index 3d389f9b..00000000
--- a/gst-libs/gst/netbuffer/gstnetbuffer.c
+++ /dev/null
@@ -1,448 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstnetbuffer
- * @short_description: Buffer for use in network sources and sinks
- *
- * #GstNetBuffer is a subclass of a normal #GstBuffer that contains two
- * additional metadata fields of type #GstNetAddress named 'to' and 'from'. The
- * buffer can be used to store additional information about the origin of the
- * buffer data and is used in various network elements to track the to and from
- * addresses.
- *
- * Last reviewed on 2006-08-21 (0.10.10)
- */
-
-#include <string.h>
-
-#include "gstnetbuffer.h"
-
-static void gst_netbuffer_init (GTypeInstance * instance, gpointer g_class);
-static void gst_netbuffer_class_init (gpointer g_class, gpointer class_data);
-static void gst_netbuffer_finalize (GstNetBuffer * nbuf);
-static GstNetBuffer *gst_netbuffer_copy (GstNetBuffer * nbuf);
-
-static GstBufferClass *parent_class;
-
-GType
-gst_netbuffer_get_type (void)
-{
- static GType _gst_netbuffer_type = 0;
-
- if (G_UNLIKELY (_gst_netbuffer_type == 0)) {
- static const GTypeInfo netbuffer_info = {
- sizeof (GstNetBufferClass),
- NULL,
- NULL,
- gst_netbuffer_class_init,
- NULL,
- NULL,
- sizeof (GstNetBuffer),
- 0,
- gst_netbuffer_init,
- NULL
- };
-
- _gst_netbuffer_type = g_type_register_static (GST_TYPE_BUFFER,
- "GstNetBuffer", &netbuffer_info, 0);
- }
- return _gst_netbuffer_type;
-}
-
-static void
-gst_netbuffer_class_init (gpointer g_class, gpointer class_data)
-{
- GstMiniObjectClass *mo_class = GST_MINI_OBJECT_CLASS (g_class);
-
- parent_class = g_type_class_peek_parent (g_class);
-
- mo_class->copy = (GstMiniObjectCopyFunction) gst_netbuffer_copy;
- mo_class->finalize = (GstMiniObjectFinalizeFunction) gst_netbuffer_finalize;
-}
-
-static void
-gst_netbuffer_init (GTypeInstance * instance, gpointer g_class)
-{
-}
-
-static void
-gst_netbuffer_finalize (GstNetBuffer * nbuf)
-{
- GST_MINI_OBJECT_CLASS (parent_class)->finalize (GST_MINI_OBJECT (nbuf));
-}
-
-static GstNetBuffer *
-gst_netbuffer_copy (GstNetBuffer * nbuf)
-{
- GstNetBuffer *copy;
-
- copy = gst_netbuffer_new ();
-
- /* we simply copy everything from our parent */
- GST_BUFFER_DATA (copy) =
- g_memdup (GST_BUFFER_DATA (nbuf), GST_BUFFER_SIZE (nbuf));
- /* make sure it gets freed (even if the parent is subclassed, we return a
- normal buffer) */
- GST_BUFFER_MALLOCDATA (copy) = GST_BUFFER_DATA (copy);
- GST_BUFFER_SIZE (copy) = GST_BUFFER_SIZE (nbuf);
-
- memcpy (&copy->to, &nbuf->to, sizeof (nbuf->to));
- memcpy (&copy->from, &nbuf->from, sizeof (nbuf->from));
-
- /* copy metadata */
- gst_buffer_copy_metadata (GST_BUFFER_CAST (copy),
- GST_BUFFER_CAST (nbuf), GST_BUFFER_COPY_ALL);
-
- return copy;
-}
-
-/**
- * gst_netbuffer_new:
- *
- * Create a new network buffer.
- *
- * Returns: a new #GstNetBuffer.
- */
-GstNetBuffer *
-gst_netbuffer_new (void)
-{
- GstNetBuffer *buf;
-
- buf = (GstNetBuffer *) gst_mini_object_new (GST_TYPE_NETBUFFER);
-
- return buf;
-}
-
-/**
- * gst_netaddress_set_ip4_address:
- * @naddr: a network address
- * @address: an IPv4 network address.
- * @port: a port number to set.
- *
- * Set @naddr with the IPv4 @address and @port pair.
- *
- * Note that @port and @address must be expressed in network byte order,
- * use g_htons() and g_htonl() to convert them to network byte order.
- */
-void
-gst_netaddress_set_ip4_address (GstNetAddress * naddr, guint32 address,
- guint16 port)
-{
- g_return_if_fail (naddr != NULL);
-
- naddr->type = GST_NET_TYPE_IP4;
- naddr->address.ip4 = address;
- naddr->port = port;
-}
-
-/**
- * gst_netaddress_set_ip6_address:
- * @naddr: a network address
- * @address: an IPv6 network address.
- * @port: a port number to set.
- *
- * Set @naddr with the IPv6 @address and @port pair.
- *
- * Note that @port must be expressed in network byte order, use g_htons() to convert
- * it to network byte order.
- */
-void
-gst_netaddress_set_ip6_address (GstNetAddress * naddr, guint8 address[16],
- guint16 port)
-{
- g_return_if_fail (naddr != NULL);
-
- naddr->type = GST_NET_TYPE_IP6;
- memcpy (&naddr->address.ip6, address, 16);
- naddr->port = port;
-}
-
-/**
- * gst_netaddress_get_net_type:
- * @naddr: a network address
- *
- * Get the type of address stored in @naddr.
- *
- * Returns: the network type stored in @naddr.
- */
-GstNetType
-gst_netaddress_get_net_type (const GstNetAddress * naddr)
-{
- g_return_val_if_fail (naddr != NULL, GST_NET_TYPE_UNKNOWN);
-
- return naddr->type;
-}
-
-/**
- * gst_netaddress_get_ip4_address:
- * @naddr: a network address
- * @address: a location to store the address.
- * @port: a location to store the port.
- *
- * Get the IPv4 address stored in @naddr into @address. This function requires
- * that the address type of @naddr is of type #GST_NET_TYPE_IP4.
- *
- * Note that @port and @address are expressed in network byte order, use
- * g_ntohs() and g_ntohl() to convert them to host order.
- *
- * Returns: TRUE if the address could be retrieved.
- */
-gboolean
-gst_netaddress_get_ip4_address (const GstNetAddress * naddr, guint32 * address,
- guint16 * port)
-{
- g_return_val_if_fail (naddr != NULL, FALSE);
-
- if (naddr->type == GST_NET_TYPE_UNKNOWN || naddr->type == GST_NET_TYPE_IP6)
- return FALSE;
-
- if (address)
- *address = naddr->address.ip4;
- if (port)
- *port = naddr->port;
-
- return TRUE;
-}
-
-/**
- * gst_netaddress_get_ip6_address:
- * @naddr: a network address
- * @address: a location to store the result.
- * @port: a location to store the port.
- *
- * Get the IPv6 address stored in @naddr into @address.
- *
- * If @naddr is of type GST_NET_TYPE_IP4, the transitional IP6 address is
- * returned.
- *
- * Note that @port is expressed in network byte order, use g_ntohs() to convert
- * it to host order.
- *
- * Returns: TRUE if the address could be retrieved.
- */
-gboolean
-gst_netaddress_get_ip6_address (const GstNetAddress * naddr, guint8 address[16],
- guint16 * port)
-{
- static guint8 ip4_transition[16] =
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF };
- g_return_val_if_fail (naddr != NULL, FALSE);
-
- if (naddr->type == GST_NET_TYPE_UNKNOWN)
- return FALSE;
-
- if (address) {
- if (naddr->type == GST_NET_TYPE_IP6) {
- memcpy (address, naddr->address.ip6, 16);
- } else { /* naddr->type == GST_NET_TYPE_IP4 */
- memcpy (address, ip4_transition, 12);
- memcpy (address + 12, (guint8 *) & (naddr->address.ip4), 4);
- }
- }
- if (port)
- *port = naddr->port;
-
- return TRUE;
-}
-
-/**
- * gst_netaddress_get_address_bytes:
- * @naddr: a network address
- * @address: a location to store the result.
- * @port: a location to store the port.
- *
- * Get just the address bytes stored in @naddr into @address.
- *
- * Note that @port is expressed in network byte order, use g_ntohs() to convert
- * it to host order. IP4 addresses are also stored in network byte order.
- *
- * Returns: number of bytes actually copied
- *
- * Since: 0.10.22
- */
-gint
-gst_netaddress_get_address_bytes (const GstNetAddress * naddr,
- guint8 address[16], guint16 * port)
-{
- gint ret = 0;
-
- g_return_val_if_fail (naddr != NULL, FALSE);
-
- if (naddr->type == GST_NET_TYPE_UNKNOWN)
- return 0;
-
- if (address) {
- if (naddr->type == GST_NET_TYPE_IP6) {
- memcpy (address, naddr->address.ip6, 16);
- ret = 16;
- } else { /* naddr->type == GST_NET_TYPE_IP4 */
- memcpy (address, (guint8 *) & (naddr->address.ip4), 4);
- ret = 4;
- }
- }
- if (port)
- *port = naddr->port;
-
- return ret;
-}
-
-/**
- * gst_netaddress_set_address_bytes:
- * @naddr: a network address
- * @type: the address type (IPv4 or IPV6)
- * @address: a location to store the result.
- * @port: a location to store the port.
- *
- * Set just the address bytes stored in @naddr into @address.
- *
- * Note that @port must be expressed in network byte order, use g_htons() to
- * convert it to network byte order order. IP4 address bytes must also be
- * stored in network byte order.
- *
- * Returns: number of bytes actually copied
- *
- * Since: 0.10.22
- */
-gint
-gst_netaddress_set_address_bytes (GstNetAddress * naddr, GstNetType type,
- guint8 address[16], guint16 port)
-{
- gint len = 0;
-
- g_return_val_if_fail (naddr != NULL, 0);
-
- naddr->type = type;
- switch (naddr->type) {
- case GST_NET_TYPE_UNKNOWN:
- case GST_NET_TYPE_IP6:
- len = 16;
- memcpy (naddr->address.ip6, address, 16);
- break;
- case GST_NET_TYPE_IP4:
- len = 4;
- memcpy ((guint8 *) & (naddr->address.ip4), address, 4);
- break;
- }
-
- if (port)
- naddr->port = port;
-
- return len;
-}
-
-/**
- * gst_netaddress_equal:
- * @naddr1: The first #GstNetAddress
- * @naddr2: The second #GstNetAddress
- *
- * Compare two #GstNetAddress structures
- *
- * Returns: TRUE if they are identical, FALSE otherwise
- *
- * Since: 0.10.18
- */
-gboolean
-gst_netaddress_equal (const GstNetAddress * naddr1,
- const GstNetAddress * naddr2)
-{
- g_return_val_if_fail (naddr1 != NULL, FALSE);
- g_return_val_if_fail (naddr2 != NULL, FALSE);
-
- if (naddr1->type != naddr2->type)
- return FALSE;
-
- if (naddr1->port != naddr2->port)
- return FALSE;
-
- switch (naddr1->type) {
- case GST_NET_TYPE_IP4:
- if (naddr1->address.ip4 != naddr2->address.ip4)
- return FALSE;
- break;
- case GST_NET_TYPE_IP6:
- if (memcmp (naddr1->address.ip6, naddr2->address.ip6,
- sizeof (naddr1->address.ip6)))
- return FALSE;
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-/**
- * gst_netaddress_to_string:
- * @naddr: a #GstNetAddress
- * @dest: destination
- * @len: len of @dest
- *
- * Copies a string representation of @naddr into @dest. Up to @len bytes are
- * copied.
- *
- * Returns: the number of bytes which would be produced if the buffer was large
- * enough
- *
- * Since: 0.10.24
- */
-gint
-gst_netaddress_to_string (const GstNetAddress * naddr, gchar * dest, gulong len)
-{
- gint result;
-
- g_return_val_if_fail (naddr != NULL, FALSE);
- g_return_val_if_fail (dest != NULL, FALSE);
-
- switch (naddr->type) {
- case GST_NET_TYPE_IP4:
- {
- guint32 address;
- guint16 port;
-
- gst_netaddress_get_ip4_address (naddr, &address, &port);
- address = g_ntohl (address);
-
- result = g_snprintf (dest, len, "%d.%d.%d.%d:%d", (address >> 24) & 0xff,
- (address >> 16) & 0xff, (address >> 8) & 0xff, address & 0xff,
- g_ntohs (port));
- break;
- }
- case GST_NET_TYPE_IP6:
- {
- guint8 address[16];
- guint16 port;
-
- gst_netaddress_get_ip6_address (naddr, address, &port);
-
- result =
- g_snprintf (dest, len, "[%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]:%d",
- (address[0] << 8) | address[1], (address[2] << 8) | address[3],
- (address[4] << 8) | address[5], (address[6] << 8) | address[7],
- (address[8] << 8) | address[9], (address[10] << 8) | address[11],
- (address[12] << 8) | address[13], (address[14] << 8) | address[15],
- g_ntohs (port));
- break;
- }
- default:
- dest[0] = 0;
- result = 0;
- break;
- }
- return result;
-}
diff --git a/gst-libs/gst/netbuffer/gstnetbuffer.h b/gst-libs/gst/netbuffer/gstnetbuffer.h
deleted file mode 100644
index 91770e4d..00000000
--- a/gst-libs/gst/netbuffer/gstnetbuffer.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_NETBUFFER_H__
-#define __GST_NETBUFFER_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-typedef struct _GstNetBuffer GstNetBuffer;
-typedef struct _GstNetBufferClass GstNetBufferClass;
-typedef struct _GstNetAddress GstNetAddress;
-
-#define GST_TYPE_NETBUFFER (gst_netbuffer_get_type())
-#define GST_IS_NETBUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NETBUFFER))
-#define GST_IS_NETBUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_NETBUFFER))
-#define GST_NETBUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_NETBUFFER, GstNetBufferClass))
-#define GST_NETBUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NETBUFFER, GstNetBuffer))
-#define GST_NETBUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_NETBUFFER, GstNetBufferClass))
-
-/**
- * GstNetType:
- * @GST_NET_TYPE_UNKNOWN: unknown address type
- * @GST_NET_TYPE_IP4: an IPv4 address type
- * @GST_NET_TYPE_IP6: and IPv6 address type
- *
- * The Address type used in #GstNetAddress.
- */
-typedef enum {
- GST_NET_TYPE_UNKNOWN,
- GST_NET_TYPE_IP4,
- GST_NET_TYPE_IP6,
-} GstNetType;
-
-/**
- * GST_NETADDRESS_MAX_LEN:
- *
- * The maximum length of a string representation of a GstNetAddress as produced
- * by gst_netaddress_to_string().
- *
- * Since: 0.10.24
- */
-#define GST_NETADDRESS_MAX_LEN 64
-
-/**
- * GstNetAddress:
- *
- * An opaque network address as used in #GstNetBuffer.
- */
-struct _GstNetAddress {
- /*< private >*/
- GstNetType type;
- union {
- guint8 ip6[16];
- guint32 ip4;
- } address;
- guint16 port;
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
-};
-
-/**
- * GstNetBuffer:
- * @buffer: the parent #GstBuffer
- * @from: the address where this buffer came from.
- * @to: the address where this buffer should go to.
- *
- * buffer for use in network sources and sinks.
- * It contains the source or destination address of the buffer.
- */
-struct _GstNetBuffer {
- GstBuffer buffer;
-
- GstNetAddress from;
- GstNetAddress to;
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
-};
-
-struct _GstNetBufferClass {
- GstBufferClass buffer_class;
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING];
-};
-
-/* creating buffers */
-GType gst_netbuffer_get_type (void);
-
-GstNetBuffer* gst_netbuffer_new (void);
-
-/* address operations */
-void gst_netaddress_set_ip4_address (GstNetAddress *naddr, guint32 address, guint16 port);
-void gst_netaddress_set_ip6_address (GstNetAddress *naddr, guint8 address[16], guint16 port);
-gint gst_netaddress_set_address_bytes (GstNetAddress *naddr, GstNetType type,
- guint8 address[16], guint16 port);
-
-GstNetType gst_netaddress_get_net_type (const GstNetAddress *naddr);
-gboolean gst_netaddress_get_ip4_address (const GstNetAddress *naddr, guint32 *address, guint16 *port);
-gboolean gst_netaddress_get_ip6_address (const GstNetAddress *naddr, guint8 address[16], guint16 *port);
-gint gst_netaddress_get_address_bytes (const GstNetAddress *naddr, guint8 address[16], guint16 *port);
-
-gboolean gst_netaddress_equal (const GstNetAddress *naddr1,
- const GstNetAddress *naddr2);
-
-gint gst_netaddress_to_string (const GstNetAddress *naddr, gchar *dest, gulong len);
-
-G_END_DECLS
-
-#endif /* __GST_NETBUFFER_H__ */
-
diff --git a/gst-libs/gst/pbutils/.gitignore b/gst-libs/gst/pbutils/.gitignore
deleted file mode 100644
index c66f944a..00000000
--- a/gst-libs/gst/pbutils/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-pbutils-enumtypes.c
-pbutils-enumtypes.h
diff --git a/gst-libs/gst/pbutils/Makefile.am b/gst-libs/gst/pbutils/Makefile.am
deleted file mode 100644
index fbcd1f60..00000000
--- a/gst-libs/gst/pbutils/Makefile.am
+++ /dev/null
@@ -1,89 +0,0 @@
-lib_LTLIBRARIES = libgstpbutils-@GST_MAJORMINOR@.la
-
-headers_pbutils = \
- pbutils.h \
- descriptions.h \
- install-plugins.h \
- missing-plugins.h
-
-# variables used for enum/marshal generation
-glib_enum_headers = $(headers_pbutils)
-glib_enum_define = GST_INSTALL
-glib_gen_prefix = gst_install
-glib_gen_basename = pbutils
-
-built_sources = \
- pbutils-enumtypes.c
-
-built_headers = \
- pbutils-enumtypes.h
-
-libgstpbutils_@GST_MAJORMINOR@_la_SOURCES = \
- pbutils.c \
- descriptions.c \
- install-plugins.c \
- missing-plugins.c
-
-nodist_libgstpbutils_@GST_MAJORMINOR@_la_SOURCES = \
- $(built_sources)
-
-libgstpbutils_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/pbutils
-libgstpbutils_@GST_MAJORMINOR@include_HEADERS = \
- $(headers_pbutils)
-nodist_libgstpbutils_@GST_MAJORMINOR@include_HEADERS = \
- pbutils-enumtypes.h
-
-libgstpbutils_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS)
-libgstpbutils_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-libgstpbutils_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
-
-BUILT_SOURCES = \
- $(built_sources) \
- $(built_headers)
-
-CLEANFILES = $(BUILT_SOURCES)
-
-
-include $(top_srcdir)/common/gst-glib-gen.mak
-
-if HAVE_INTROSPECTION
-BUILT_GIRSOURCES = GstPbutils-@GST_MAJORMINOR@.gir
-
-gir_headers=$(patsubst %,$(srcdir)/%, $(libgstpbutils_@GST_MAJORMINOR@include_HEADERS))
-gir_headers+=$(patsubst %,$(builddir)/%, $(nodist_libgstpbutils_@GST_MAJORMINOR@include_HEADERS))
-gir_sources=$(patsubst %,$(srcdir)/%, $(libgstpbutils_@GST_MAJORMINOR@_la_SOURCES))
-gir_sources+=$(patsubst %,$(builddir)/%, $(nodist_libgstpbutils_@GST_MAJORMINOR@_la_SOURCES))
-gir_cincludes=$(patsubst %,--c-include='gst/pbutils/%',$(libgstpbutils_@GST_MAJORMINOR@include_HEADERS))
-gir_cincludes+=$(patsubst %,--c-include='gst/pbutils/%',$(nodist_libgstpbutils_@GST_MAJORMINOR@include_HEADERS))
-
-GstPbutils-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstpbutils-@GST_MAJORMINOR@.la
- PKG_CONFIG_PATH="$(PKG_CONFIG_PATH):$(top_builddir)/pkgconfig" \
- $(INTROSPECTION_SCANNER) -v --namespace GstPbutils \
- --nsversion=@GST_MAJORMINOR@ \
- --strip-prefix=Gst \
- $(gir_cincludes) \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst \
- --library=gstpbutils-0.10 \
- --include=Gst-0.10 \
- --libtool="$(top_builddir)/libtool" \
- --pkg gstreamer-0.10 \
- --output $@ \
- $(gir_headers) \
- $(gir_sources)
-
-# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
-# install anything - we need to install inside our prefix.
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(BUILT_GIRSOURCES)
-
-typelibsdir = $(libdir)/girepository-1.0/
-
-typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
-
-%.typelib: %.gir $(INTROSPECTION_COMPILER)
- $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=$(builddir) --includedir=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
-CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
-endif
diff --git a/gst-libs/gst/pbutils/descriptions.c b/gst-libs/gst/pbutils/descriptions.c
deleted file mode 100644
index f17fc7aa..00000000
--- a/gst-libs/gst/pbutils/descriptions.c
+++ /dev/null
@@ -1,985 +0,0 @@
-/* GStreamer Plugins 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstpbutilsdescriptions
- * @short_description: Provides human-readable descriptions for caps/codecs
- * and encoder, decoder, URI source and URI sink elements
- *
- * <refsect2>
- * <para>
- * The above functions provide human-readable strings for media formats
- * and decoder/demuxer/depayloader/encoder/muxer/payloader elements for use
- * in error dialogs or other messages shown to users.
- * </para>
- * <para>
- * gst_pb_utils_add_codec_description_to_tag_list() is a utility function
- * for demuxer and decoder elements to add audio/video codec tags from a
- * given (fixed) #GstCaps.
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "gst/gst-i18n-plugin.h"
-
-#include "pbutils.h"
-
-#include <string.h>
-
-typedef enum
-{
- FLAG_CONTAINER = (1 << 0), /* format is a container format (muxed) */
- FLAG_SYSTEMSTREAM = (1 << 1) /* match record only if caps have systemstream=true */
-} FormatFlags;
-
-typedef struct
-{
- const gchar *type;
- const gchar *desc;
- FormatFlags flags;
-} FormatInfo;
-
-static const FormatInfo formats[] = {
- /* container/tag formats with static descriptions */
- {"application/ogg", "Ogg", FLAG_CONTAINER},
- {"application/mxf", "MXF", FLAG_CONTAINER},
- {"application/vnd.rn-realmedia", "Realmedia", FLAG_CONTAINER},
- {"application/x-id3", N_("ID3 tag"), FLAG_CONTAINER},
- {"application/x-ape", N_("APE tag"), FLAG_CONTAINER},
- {"application/x-apetag", N_("APE tag"), FLAG_CONTAINER},
- {"application/x-icy", N_("ICY internet radio"), FLAG_CONTAINER},
- {"application/x-3gp", "3GP", FLAG_CONTAINER},
- {"application/x-yuv4mpeg", "Y4M", FLAG_CONTAINER},
- {"multipart/x-mixed-replace", "Multipart", FLAG_CONTAINER},
- {"video/x-fli", "FLI/FLC/FLX Animation", FLAG_CONTAINER},
- {"video/x-flv", "Flash", FLAG_CONTAINER},
- {"video/x-matroska", "Matroska", FLAG_CONTAINER},
- {"video/x-ms-asf", "Advanced Streaming Format (ASF)", FLAG_CONTAINER},
- {"video/x-msvideo", "AVI", FLAG_CONTAINER},
- {"video/x-quicktime", "Quicktime", FLAG_CONTAINER},
- {"video/quicktime", "Quicktime", FLAG_CONTAINER},
- {"video/mj2", "Motion JPEG 2000", FLAG_CONTAINER},
-
- /* audio formats with static descriptions */
- {"audio/x-ac3", "AC-3 (ATSC A/52)", 0},
- {"audio/ac3", "AC-3 (ATSC A/52)", 0},
- {"audio/x-private-ac3", "DVD AC-3 (ATSC A/52)", 0},
- {"audio/x-private1-ac3", "DVD AC-3 (ATSC A/52)", 0},
- {"audio/x-alaw", "A-Law", 0},
- {"audio/amr", "Adaptive Multi Rate (AMR)", 0},
- {"audio/AMR", "Adaptive Multi Rate (AMR)", 0},
- {"audio/AMR-WB", "Adaptive Multi Rate WideBand (AMR-WB)", 0},
- {"audio/iLBC-sh", "Internet Low Bitrate Codec (iLBC)", 0},
- {"audio/ms-gsm", "MS GSM", 0},
- {"audio/qcelp", "QCELP", 0},
- {"audio/aiff", "Audio Interchange File Format (AIFF)", 0},
- {"audio/x-aiff", "Audio Interchange File Format (AIFF)", 0},
- {"audio/x-alac", N_("Apple Lossless Audio (ALAC)"), 0},
- {"audio/x-amr-nb-sh", "Adaptive Multi Rate NarrowBand (AMR-NB)", 0},
- {"audio/x-amr-wb-sh", "Adaptive Multi Rate WideBand (AMR-WB)", 0},
- {"audio/x-au", "Sun .au", 0},
- {"audio/x-cinepak", "Cinepak Audio", 0},
- {"audio/x-dpcm", "DPCM", 0},
- {"audio/x-dts", "DTS", 0},
- {"audio/x-private1-dts", "DTS", 0},
- {"audio/x-dv", "DV Audio", 0},
- {"audio/x-flac", N_("Free Lossless Audio Codec (FLAC)"), 0},
- {"audio/x-gsm", "GSM", 0},
- {"audio/x-iec958", "S/PDIF IEC958", 0}, /* TODO: check description */
- {"audio/x-iLBC", "Internet Low Bitrate Codec (iLBC)", 0},
- {"audio/x-ircam", "Berkeley/IRCAM/CARL", 0},
- {"audio/x-lpcm", "LPCM", 0},
- {"audio/x-private1-lpcm", "DVD LPCM", 0},
- {"audio/x-m4a", "MPEG-4 AAC", FLAG_CONTAINER},
- {"audio/x-mod", "Module Music Format (MOD)", 0},
- {"audio/x-mulaw", "Mu-Law", 0},
- {"audio/x-musepack", "Musepack (MPC)", 0},
- {"audio/x-nellymoser", "Nellymoser Asao", 0},
- {"audio/x-nist", "Sphere NIST", 0},
- {"audio/x-nsf", "Nintendo NSF", 0},
- {"audio/x-paris", "Ensoniq PARIS", 0},
- {"audio/x-qdm", "QDesign Music (QDM)", 0},
- {"audio/x-qdm2", "QDesign Music (QDM) 2", 0},
- {"audio/x-ralf-mpeg4-generic", "Real Audio Lossless (RALF)", 0},
- {"audio/x-sds", "SDS", 0},
- {"audio/x-shorten", "Shorten Lossless", 0},
- {"audio/x-sid", "Sid", 0},
- {"audio/x-sipro", "Sipro/ACELP.NET Voice", 0},
- {"audio/x-siren", "Siren", 0},
- {"audio/x-spc", "SNES-SPC700 Sound File Data", 0},
- {"audio/x-speex", "Speex", 0},
- {"audio/x-svx", "Amiga IFF / SVX8 / SV16", 0},
- {"audio/x-tta", N_("Lossless True Audio (TTA)"), 0},
- {"audio/x-ttafile", N_("Lossless True Audio (TTA)"), 0},
- {"audio/x-vnd.sony.atrac3", "Sony ATRAC3", 0},
- {"audio/x-vorbis", "Vorbis", 0},
- {"audio/x-voc", "SoundBlaster VOC", 0},
- {"audio/x-w64", "Sonic Foundry Wave64", 0},
- {"audio/x-wav", "WAV", 0},
- {"audio/x-wavpack", "Wavpack", 0},
- {"audio/x-wavpack-correction", "Wavpack", 0},
- {"audio/x-wms", N_("Windows Media Speech"), 0},
- {"audio/x-voxware", "Voxware", 0},
-
-
- /* video formats with static descriptions */
- {"video/sp5x", "Sunplus JPEG 5.x", 0},
- {"video/vivo", "Vivo", 0},
- {"video/x-3ivx", "3ivx", 0},
- {"video/x-4xm", "4X Techologies Video", 0},
- {"video/x-apple-video", "Apple video", 0},
- {"video/x-aasc", "Autodesk Animator", 0},
- {"video/x-camtasia", "TechSmith Camtasia", 0},
- {"video/x-cdxa", "RIFF/CDXA (VCD)", 0},
- {"video/x-cinepak", "Cinepak Video", 0},
- {"video/x-cirrus-logic-accupak", "Cirrus Logipak AccuPak", 0},
- {"video/x-compressed-yuv", N_("CYUV Lossless"), 0},
- {"video/x-dirac", "Dirac", 0},
- {"video/x-dvd-subpicture", "DVD subpicture", 0},
- {"video/x-ffv", N_("FFMpeg v1"), 0},
- {"video/x-flash-screen", "Flash Screen Video", 0},
- {"video/x-flash-video", "Sorenson Spark Video", 0},
- {"video/x-h261", "H.261", 0},
- {"video/x-huffyuv", "Huffyuv", 0},
- {"video/x-intel-h263", "Intel H.263", 0},
- {"video/x-jpeg", "Motion JPEG", 0},
- /* { "video/x-jpeg-b", "", 0 }, does this actually exist? */
- {"video/x-loco", "LOCO Lossless", 0},
- {"video/x-mjpeg", "Motion-JPEG", 0},
- {"video/x-mjpeg-b", "Motion-JPEG format B", 0},
- {"video/mpegts", "MPEG-2 Transport Stream", FLAG_CONTAINER},
- {"video/x-mng", "Multiple Image Network Graphics (MNG)", 0},
- {"video/x-mszh", N_("Lossless MSZH"), 0},
- {"video/x-msvideocodec", "Microsoft Video 1", 0},
- {"video/x-mve", "Interplay MVE", FLAG_CONTAINER},
- {"video/x-nut", "NUT", FLAG_CONTAINER},
- {"video/x-nuv", "MythTV NuppelVideo (NUV)", FLAG_CONTAINER},
- {"video/x-qdrw", "Apple QuickDraw", 0},
- {"video/x-raw-gray", N_("Uncompressed Gray Image"), 0},
- {"video/x-smc", "Apple SMC", 0},
- {"video/x-smoke", "Smoke", 0},
- {"video/x-tarkin", "Tarkin", 0},
- {"video/x-theora", "Theora", 0},
- {"video/x-rle", N_("Run-length encoding"), 0},
- {"video/x-ultimotion", "IBM UltiMotion", 0},
- {"video/x-vcd", "VideoCD (VCD)", 0},
- {"video/x-vmnc", "VMWare NC", 0},
- {"video/x-vp3", "On2 VP3", 0},
- {"video/x-vp5", "On2 VP5", 0},
- {"video/x-vp6", "On2 VP6", 0},
- {"video/x-vp6-flash", "On2 VP6/Flash", 0},
- {"video/x-vp7", "On2 VP7", 0},
- {"video/x-xvid", "XVID MPEG-4", 0},
- {"video/x-zlib", "Lossless zlib video", 0},
- {"video/x-zmbv", "Zip Motion Block video", 0},
-
- /* image formats with static descriptions */
- {"image/bmp", "BMP", 0},
- {"image/x-bmp", "BMP", 0},
- {"image/x-MS-bmp", "BMP", 0},
- {"image/gif", "GIF", 0},
- {"image/jpeg", "JPEG", 0},
- {"image/jng", "JPEG Network Graphics (JNG)", 0},
- {"image/png", "PNG", 0},
- {"image/pbm", "PBM", 0},
- {"image/ppm", "PPM", 0},
- {"image/svg+xml", "Scalable Vector Graphics (SVG)", 0},
- {"image/tiff", "TIFF", 0},
- {"image/x-cmu-raster", "CMU Raster Format", 0},
- {"image/x-icon", "ICO", 0},
- {"image/x-j2c", "JPEG 2000", 0},
- {"image/x-jpc", "JPEG 2000", 0},
- {"image/jp2", "JPEG 2000", 0},
- {"image/x-xcf", "XFC", 0},
- {"image/x-pixmap", "XPM", 0},
- {"image/x-xpixmap", "XPM", 0},
- {"image/x-quicktime", "QuickTime Image Format (QTIF)", 0},
- {"image/x-sun-raster", "Sun Raster Format (RAS)", 0},
- {"image/x-tga", "TGA", 0},
-
- /* subtitle formats with static descriptions */
- {"application/x-subtitle-sami", N_("Sami subtitle format"), 0},
- {"application/x-subtitle-tmplayer", N_("TMPlayer subtitle format"), 0},
- {"application/x-kate", "Kate", 0},
- {"subtitle/x-kate", N_("Kate subtitle format"), 0},
- /* add variant field to typefinder? { "application/x-subtitle", N_("subtitle"), 0}, */
-
- /* non-audio/video/container formats */
- {"hdv/aux-v", "HDV AUX-V", 0},
- {"hdv/aux-a", "HDV AUX-A", 0},
-
- /* formats with dynamic descriptions */
- {"audio/mpeg", NULL, 0},
- {"audio/x-adpcm", NULL, 0},
- {"audio/x-mace", NULL, 0},
- {"audio/x-pn-realaudio", NULL, 0},
- {"audio/x-raw-int", NULL, 0},
- {"audio/x-raw-float", NULL, 0},
- {"audio/x-wma", NULL, 0},
- {"video/mpeg", NULL, FLAG_CONTAINER | FLAG_SYSTEMSTREAM},
- {"video/mpeg", NULL, 0},
- {"video/x-asus", NULL, 0},
- {"video/x-ati-vcr", NULL, 0},
- {"video/x-divx", NULL, 0},
- {"video/x-dv", "Digital Video (DV) System Stream",
- FLAG_CONTAINER | FLAG_SYSTEMSTREAM},
- {"video/x-dv", "Digital Video (DV)", 0},
- {"video/x-h263", NULL, 0},
- {"video/x-h264", NULL, 0},
- {"video/x-indeo", NULL, 0},
- {"video/x-msmpeg", NULL, 0},
- {"video/x-pn-realvideo", NULL, 0},
-#if 0
- /* do these exist? are they used anywhere? */
- {"video/x-pn-multirate-realvideo", NULL, 0},
- {"audio/x-pn-multirate-realaudio", NULL, 0},
- {"audio/x-pn-multirate-realaudio-live", NULL, 0},
-#endif
- {"video/x-truemotion", NULL, 0},
- {"video/x-raw-rgb", NULL, 0},
- {"video/x-raw-yuv", NULL, 0},
- {"video/x-svq", NULL, 0},
- {"video/x-wmv", NULL, 0},
- {"video/x-xan", NULL, 0}
-};
-
-/* returns static descriptions and dynamic ones (such as video/x-raw-yuv),
- * or NULL if caps aren't known at all */
-static gchar *
-format_info_get_desc (const FormatInfo * info, const GstCaps * caps)
-{
- const GstStructure *s;
-
- g_assert (info != NULL);
-
- if (info->desc != NULL)
- return g_strdup (_(info->desc));
-
- s = gst_caps_get_structure (caps, 0);
-
- if (strcmp (info->type, "video/x-raw-yuv") == 0) {
- const gchar *ret = NULL;
- guint32 fourcc = 0;
-
- gst_structure_get_fourcc (s, "format", &fourcc);
- switch (fourcc) {
- case GST_MAKE_FOURCC ('I', '4', '2', '0'):
- ret = _("Uncompressed planar YUV 4:2:0");
- break;
- case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
- ret = _("Uncompressed planar YVU 4:2:0");
- break;
- case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
- ret = _("Uncompressed packed YUV 4:2:2");
- break;
- case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'):
- ret = _("Uncompressed packed YUV 4:1:0");
- break;
- case GST_MAKE_FOURCC ('Y', 'V', 'U', '9'):
- ret = _("Uncompressed packed YVU 4:1:0");
- break;
- case GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'):
- case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
- ret = _("Uncompressed packed YUV 4:2:2");
- break;
- case GST_MAKE_FOURCC ('Y', '4', '1', 'P'):
- ret = _("Uncompressed packed YUV 4:1:1");
- break;
- case GST_MAKE_FOURCC ('I', 'Y', 'U', '2'):
- ret = _("Uncompressed packed YUV 4:4:4");
- break;
- case GST_MAKE_FOURCC ('Y', '4', '2', 'B'):
- ret = _("Uncompressed planar YUV 4:2:2");
- break;
- case GST_MAKE_FOURCC ('Y', '4', '1', 'B'):
- ret = _("Uncompressed planar YUV 4:1:1");
- break;
- case GST_MAKE_FOURCC ('Y', '8', '0', '0'):
- ret = _("Uncompressed black and white Y-plane");
- break;
- default:
- ret = _("Uncompressed YUV");
- break;
- }
- return g_strdup (ret);
- } else if (strcmp (info->type, "video/x-raw-rgb") == 0) {
- const gchar *rgb_str;
- gint depth = 0;
-
- gst_structure_get_int (s, "depth", &depth);
- rgb_str = gst_structure_has_field (s, "alpha_mask") ? "RGBA" : "RGB";
- if (gst_structure_has_field (s, "paletted_data")) {
- return g_strdup_printf (_("Uncompressed palettized %d-bit %s"), depth,
- rgb_str);
- } else {
- return g_strdup_printf ("Uncompressed %d-bit %s", depth, rgb_str);
- }
- } else if (strcmp (info->type, "video/x-h263") == 0) {
- const gchar *variant, *ret;
-
- variant = gst_structure_get_string (s, "variant");
- if (variant == NULL)
- ret = "H.263";
- else if (strcmp (variant, "itu") == 0)
- ret = "ITU H.26n"; /* why not ITU H.263? (tpm) */
- else if (strcmp (variant, "lead") == 0)
- ret = "Lead H.263";
- else if (strcmp (variant, "microsoft") == 0)
- ret = "Microsoft H.263";
- else if (strcmp (variant, "vdolive") == 0)
- ret = "VDOLive";
- else if (strcmp (variant, "vivo") == 0)
- ret = "Vivo H.263";
- else if (strcmp (variant, "xirlink") == 0)
- ret = "Xirlink H.263";
- else {
- GST_WARNING ("Unknown H263 variant '%s'", variant);
- ret = "H.263";
- }
- return g_strdup (ret);
- } else if (strcmp (info->type, "video/x-h264") == 0) {
- const gchar *variant, *ret;
-
- variant = gst_structure_get_string (s, "variant");
- if (variant == NULL)
- ret = "H.264";
- else if (strcmp (variant, "itu") == 0)
- ret = "ITU H.264";
- else if (strcmp (variant, "videosoft") == 0)
- ret = "Videosoft H.264";
- else if (strcmp (variant, "lead") == 0)
- ret = "Lead H.264";
- else {
- GST_WARNING ("Unknown H264 variant '%s'", variant);
- ret = "H.264";
- }
- return g_strdup (ret);
- } else if (strcmp (info->type, "video/x-divx") == 0) {
- gint ver = 0;
-
- if (!gst_structure_get_int (s, "divxversion", &ver) || ver <= 2) {
- GST_WARNING ("Unexpected DivX version in %" GST_PTR_FORMAT, caps);
- return g_strdup ("DivX MPEG-4");
- }
- return g_strdup_printf (_("DivX MPEG-4 Version %d"), ver);
- } else if (strcmp (info->type, "video/x-msmpeg") == 0) {
- gint ver = 0;
-
- if (!gst_structure_get_int (s, "msmpegversion", &ver) ||
- ver < 40 || ver > 49) {
- GST_WARNING ("Unexpected msmpegversion in %" GST_PTR_FORMAT, caps);
- return g_strdup ("Microsoft MPEG-4 4.x");
- }
- return g_strdup_printf ("Microsoft MPEG-4 4.%d", ver % 10);
- } else if (strcmp (info->type, "video/x-truemotion") == 0) {
- gint ver = 0;
-
- gst_structure_get_int (s, "trueversion", &ver);
- switch (ver) {
- case 1:
- return g_strdup_printf ("Duck TrueMotion 1");
- case 2:
- return g_strdup_printf ("TrueMotion 2.0");
- default:
- GST_WARNING ("Unexpected trueversion in %" GST_PTR_FORMAT, caps);
- break;
- }
- return g_strdup_printf ("TrueMotion");
- } else if (strcmp (info->type, "video/x-xan") == 0) {
- gint ver = 0;
-
- if (!gst_structure_get_int (s, "wcversion", &ver) || ver < 1) {
- GST_WARNING ("Unexpected wcversion in %" GST_PTR_FORMAT, caps);
- return g_strdup ("Xan Wing Commander");
- }
- return g_strdup_printf ("Xan Wing Commander %u", ver);
- } else if (strcmp (info->type, "video/x-indeo") == 0) {
- gint ver = 0;
-
- if (!gst_structure_get_int (s, "indeoversion", &ver) || ver < 2) {
- GST_WARNING ("Unexpected indeoversion in %" GST_PTR_FORMAT, caps);
- return g_strdup ("Intel Indeo");
- }
- return g_strdup_printf ("Intel Indeo %u", ver);
- } else if (strcmp (info->type, "audio/x-wma") == 0) {
- gint ver = 0;
-
- gst_structure_get_int (s, "wmaversion", &ver);
- switch (ver) {
- case 1:
- case 2:
- case 3:
- return g_strdup_printf ("Windows Media Audio %d", ver + 6);
- default:
- break;
- }
- GST_WARNING ("Unexpected wmaversion in %" GST_PTR_FORMAT, caps);
- return g_strdup ("Windows Media Audio");
- } else if (strcmp (info->type, "video/x-wmv") == 0) {
- gint ver = 0;
-
- gst_structure_get_int (s, "wmvversion", &ver);
- switch (ver) {
- case 1:
- case 2:
- case 3:
- return g_strdup_printf ("Windows Media Video %d", ver + 6);
- default:
- break;
- }
- GST_WARNING ("Unexpected wmvversion in %" GST_PTR_FORMAT, caps);
- return g_strdup ("Windows Media Video");
- } else if (strcmp (info->type, "audio/x-mace") == 0) {
- gint ver = 0;
-
- gst_structure_get_int (s, "maceversion", &ver);
- if (ver == 3 || ver == 6) {
- return g_strdup_printf ("MACE-%d", ver);
- } else {
- GST_WARNING ("Unexpected maceversion in %" GST_PTR_FORMAT, caps);
- return g_strdup ("MACE");
- }
- } else if (strcmp (info->type, "video/x-svq") == 0) {
- gint ver = 0;
-
- gst_structure_get_int (s, "svqversion", &ver);
- if (ver == 1 || ver == 3) {
- return g_strdup_printf ("Sorensen Video %d", ver);
- } else {
- GST_WARNING ("Unexpected svqversion in %" GST_PTR_FORMAT, caps);
- return g_strdup ("Sorensen Video");
- }
- } else if (strcmp (info->type, "video/x-asus") == 0) {
- gint ver = 0;
-
- gst_structure_get_int (s, "asusversion", &ver);
- if (ver == 1 || ver == 2) {
- return g_strdup_printf ("Asus Video %d", ver);
- } else {
- GST_WARNING ("Unexpected asusversion in %" GST_PTR_FORMAT, caps);
- return g_strdup ("Asus Video");
- }
- } else if (strcmp (info->type, "video/x-ati-vcr") == 0) {
- gint ver = 0;
-
- gst_structure_get_int (s, "vcrversion", &ver);
- if (ver == 1 || ver == 2) {
- return g_strdup_printf ("ATI VCR %d", ver);
- } else {
- GST_WARNING ("Unexpected acrversion in %" GST_PTR_FORMAT, caps);
- return g_strdup ("ATI VCR");
- }
- } else if (strcmp (info->type, "audio/x-adpcm") == 0) {
- const GValue *layout_val;
-
- layout_val = gst_structure_get_value (s, "layout");
- if (layout_val != NULL && G_VALUE_HOLDS_STRING (layout_val)) {
- const gchar *layout;
-
- if ((layout = g_value_get_string (layout_val))) {
- gchar *layout_upper, *ret;
-
- if (strcmp (layout, "swf") == 0)
- return g_strdup ("Shockwave ADPCM");
- if (strcmp (layout, "microsoft") == 0)
- return g_strdup ("Microsoft ADPCM");
- if (strcmp (layout, "quicktime") == 0)
- return g_strdup ("Quicktime ADPCM");
- if (strcmp (layout, "westwood") == 0)
- return g_strdup ("Westwood ADPCM");
- if (strcmp (layout, "yamaha") == 0)
- return g_strdup ("Yamaha ADPCM");
- /* FIXME: other layouts: sbpro2, sbpro3, sbpro4, ct, g726, ea,
- * adx, xa, 4xm, smjpeg, dk4, dk3, dvi */
- layout_upper = g_ascii_strup (layout, -1);
- ret = g_strdup_printf ("%s ADPCM", layout_upper);
- g_free (layout_upper);
- return ret;
- }
- }
- return g_strdup ("ADPCM");
- } else if (strcmp (info->type, "audio/mpeg") == 0) {
- gint ver = 0, layer = 0;
-
- gst_structure_get_int (s, "mpegversion", &ver);
-
- switch (ver) {
- case 1:
- gst_structure_get_int (s, "layer", &layer);
- switch (layer) {
- case 1:
- case 2:
- case 3:
- return g_strdup_printf ("MPEG-1 Layer %d (MP%d)", layer, layer);
- default:
- break;
- }
- GST_WARNING ("Unexpected MPEG-1 layer in %" GST_PTR_FORMAT, caps);
- return g_strdup ("MPEG-1 Audio");
- case 4:
- return g_strdup ("MPEG-4 AAC");
- default:
- break;
- }
- GST_WARNING ("Unexpected audio mpegversion in %" GST_PTR_FORMAT, caps);
- return g_strdup ("MPEG Audio");
- } else if (strcmp (info->type, "audio/x-pn-realaudio") == 0) {
- gint ver = 0;
-
- gst_structure_get_int (s, "raversion", &ver);
- switch (ver) {
- case 1:
- return g_strdup ("RealAudio 14k4bps");
- case 2:
- return g_strdup ("RealAudio 28k8bps");
- case 8:
- return g_strdup ("RealAudio G2 (Cook)");
- default:
- break;
- }
- GST_WARNING ("Unexpected raversion in %" GST_PTR_FORMAT, caps);
- return g_strdup ("RealAudio");
- } else if (strcmp (info->type, "video/x-pn-realvideo") == 0) {
- gint ver = 0;
-
- gst_structure_get_int (s, "rmversion", &ver);
- switch (ver) {
- case 1:
- return g_strdup ("RealVideo 1.0");
- case 2:
- return g_strdup ("RealVideo 2.0");
- case 3:
- return g_strdup ("RealVideo 3.0");
- case 4:
- return g_strdup ("RealVideo 4.0");
- default:
- break;
- }
- GST_WARNING ("Unexpected rmversion in %" GST_PTR_FORMAT, caps);
- return g_strdup ("RealVideo");
- } else if (strcmp (info->type, "video/mpeg") == 0) {
- gboolean sysstream;
- gint ver = 0;
-
- if (!gst_structure_get_boolean (s, "systemstream", &sysstream) ||
- !gst_structure_get_int (s, "mpegversion", &ver) || ver < 1 || ver > 4) {
- GST_WARNING ("Missing fields in mpeg video caps %" GST_PTR_FORMAT, caps);
- } else {
- if (sysstream) {
- return g_strdup_printf ("MPEG-%d System Stream", ver);
- } else {
- return g_strdup_printf ("MPEG-%d Video", ver);
- }
- }
- return g_strdup ("MPEG Video");
- } else if (strcmp (info->type, "audio/x-raw-int") == 0) {
- gint bitdepth = 0;
-
- /* 8-bit pcm might not have depth field (?) */
- if (!gst_structure_get_int (s, "depth", &bitdepth))
- gst_structure_get_int (s, "width", &bitdepth);
- if (bitdepth != 0)
- return g_strdup_printf (_("Raw %d-bit PCM audio"), bitdepth);
- else
- return g_strdup (_("Raw PCM audio"));
- } else if (strcmp (info->type, "audio/x-raw-float") == 0) {
- gint bitdepth = 0;
-
- gst_structure_get_int (s, "width", &bitdepth);
- if (bitdepth != 0)
- return g_strdup_printf (_("Raw %d-bit floating-point audio"), bitdepth);
- else
- return g_strdup (_("Raw floating-point audio"));
- }
-
- return NULL;
-}
-
-/* returns format info structure, will return NULL for dynamic media types! */
-static const FormatInfo *
-find_format_info (const GstCaps * caps)
-{
- const GstStructure *s;
- const gchar *media_type;
- guint i;
-
- s = gst_caps_get_structure (caps, 0);
- media_type = gst_structure_get_name (s);
-
- for (i = 0; i < G_N_ELEMENTS (formats); ++i) {
- if (strcmp (media_type, formats[i].type) == 0) {
- gboolean is_sys = FALSE;
-
- if ((formats[i].flags & FLAG_SYSTEMSTREAM) == 0)
- return &formats[i];
-
- /* this record should only be matched if the systemstream field is set */
- if (gst_structure_get_boolean (s, "systemstream", &is_sys) && is_sys)
- return &formats[i];
- }
- }
-
- return NULL;
-}
-
-static gboolean
-caps_are_rtp_caps (const GstCaps * caps, const gchar * media, gchar ** format)
-{
- const GstStructure *s;
- const gchar *str;
-
- g_assert (media != NULL && format != NULL);
-
- s = gst_caps_get_structure (caps, 0);
- if (!gst_structure_has_name (s, "application/x-rtp"))
- return FALSE;
- if (!gst_structure_has_field_typed (s, "media", G_TYPE_STRING))
- return FALSE;
- str = gst_structure_get_string (s, "media");
- if (str == NULL || !g_str_equal (str, media))
- return FALSE;
- str = gst_structure_get_string (s, "encoding-name");
- if (str == NULL || *str == '\0')
- return FALSE;
-
- if (strcmp (str, "X-ASF-PF") == 0) {
- *format = g_strdup ("Windows Media");
- } else if (g_str_has_prefix (str, "X-")) {
- *format = g_strdup (str + 2);
- } else {
- *format = g_strdup (str);
- }
-
- return TRUE;
-}
-
-/**
- * gst_pb_utils_get_source_description:
- * @protocol: the protocol the source element needs to handle, e.g. "http"
- *
- * Returns a localised string describing a source element handling the protocol
- * specified in @protocol, for use in error dialogs or other messages to be
- * seen by the user. Should never return NULL unless @protocol is invalid.
- *
- * This function is mainly for internal use, applications would typically
- * use gst_missing_plugin_message_get_description() to get a description of
- * a missing feature from a missing-plugin message.
- *
- * Returns: a newly-allocated description string, or NULL on error. Free
- * string with g_free() when not needed any longer.
- */
-gchar *
-gst_pb_utils_get_source_description (const gchar * protocol)
-{
- gchar *proto_uc, *ret;
-
- g_return_val_if_fail (protocol != NULL, NULL);
-
- if (strcmp (protocol, "cdda") == 0)
- return g_strdup (_("Audio CD source"));
-
- if (strcmp (protocol, "dvd") == 0)
- return g_strdup (_("DVD source"));
-
- if (strcmp (protocol, "rtsp") == 0)
- return g_strdup (_("Real Time Streaming Protocol (RTSP) source"));
-
- /* TODO: what about mmst, mmsu, mmsh? */
- if (strcmp (protocol, "mms") == 0)
- return g_strdup (_("Microsoft Media Server (MMS) protocol source"));
-
- /* make protocol uppercase */
- proto_uc = g_ascii_strup (protocol, -1);
-
- /* TODO: find out how to add a comment for translators to the source code
- * (and tell them to make the first letter uppercase below if they move
- * the protocol to the middle or end of the string) */
- ret = g_strdup_printf (_("%s protocol source"), proto_uc);
-
- g_free (proto_uc);
-
- return ret;
-}
-
-/**
- * gst_pb_utils_get_sink_description:
- * @protocol: the protocol the sink element needs to handle, e.g. "http"
- *
- * Returns a localised string describing a sink element handling the protocol
- * specified in @protocol, for use in error dialogs or other messages to be
- * seen by the user. Should never return NULL unless @protocol is invalid.
- *
- * This function is mainly for internal use, applications would typically
- * use gst_missing_plugin_message_get_description() to get a description of
- * a missing feature from a missing-plugin message.
- *
- * Returns: a newly-allocated description string, or NULL on error. Free
- * string with g_free() when not needed any longer.
- */
-gchar *
-gst_pb_utils_get_sink_description (const gchar * protocol)
-{
- gchar *proto_uc, *ret;
-
- g_return_val_if_fail (protocol != NULL, NULL);
-
- /* make protocol uppercase */
- proto_uc = g_ascii_strup (protocol, -1);
-
- /* TODO: find out how to add a comment for translators to the source code
- * (and tell them to make the first letter uppercase below if they move
- * the protocol to the middle or end of the string) */
- ret = g_strdup_printf ("%s protocol sink", proto_uc);
-
- g_free (proto_uc);
-
- return ret;
-}
-
-/**
- * gst_pb_utils_get_decoder_description:
- * @caps: the (fixed) #GstCaps for which an decoder description is needed
- *
- * Returns a localised string describing an decoder for the format specified
- * in @caps, for use in error dialogs or other messages to be seen by the user.
- * Should never return NULL unless @factory_name or @caps are invalid.
- *
- * This function is mainly for internal use, applications would typically
- * use gst_missing_plugin_message_get_description() to get a description of
- * a missing feature from a missing-plugin message.
- *
- * Returns: a newly-allocated description string, or NULL on error. Free
- * string with g_free() when not needed any longer.
- */
-gchar *
-gst_pb_utils_get_decoder_description (const GstCaps * caps)
-{
- gchar *str, *ret;
-
- g_return_val_if_fail (caps != NULL, NULL);
- g_return_val_if_fail (GST_IS_CAPS (caps), NULL);
- g_return_val_if_fail (gst_caps_is_fixed (caps), NULL);
-
- /* special-case RTP caps */
- if (caps_are_rtp_caps (caps, "video", &str)) {
- ret = g_strdup_printf (_("%s video RTP depayloader"), str);
- } else if (caps_are_rtp_caps (caps, "audio", &str)) {
- ret = g_strdup_printf (_("%s audio RTP depayloader"), str);
- } else if (caps_are_rtp_caps (caps, "application", &str)) {
- ret = g_strdup_printf (_("%s RTP depayloader"), str);
- } else {
- const FormatInfo *info;
-
- str = gst_pb_utils_get_codec_description (caps);
- info = find_format_info (caps);
- if (info != NULL && (info->flags & FLAG_CONTAINER) != 0) {
- ret = g_strdup_printf (_("%s demuxer"), str);
- } else {
- ret = g_strdup_printf (_("%s decoder"), str);
- }
- }
-
- g_free (str);
-
- return ret;
-}
-
-/**
- * gst_pb_utils_get_encoder_description:
- * @caps: the (fixed) #GstCaps for which an encoder description is needed
- *
- * Returns a localised string describing an encoder for the format specified
- * in @caps, for use in error dialogs or other messages to be seen by the user.
- * Should never return NULL unless @factory_name or @caps are invalid.
- *
- * This function is mainly for internal use, applications would typically
- * use gst_missing_plugin_message_get_description() to get a description of
- * a missing feature from a missing-plugin message.
- *
- * Returns: a newly-allocated description string, or NULL on error. Free
- * string with g_free() when not needed any longer.
- */
-gchar *
-gst_pb_utils_get_encoder_description (const GstCaps * caps)
-{
- gchar *str, *ret;
-
- g_return_val_if_fail (caps != NULL, NULL);
- g_return_val_if_fail (GST_IS_CAPS (caps), NULL);
- g_return_val_if_fail (gst_caps_is_fixed (caps), NULL);
-
- /* special-case RTP caps */
- if (caps_are_rtp_caps (caps, "video", &str)) {
- ret = g_strdup_printf (_("%s video RTP payloader"), str);
- } else if (caps_are_rtp_caps (caps, "audio", &str)) {
- ret = g_strdup_printf (_("%s audio RTP payloader"), str);
- } else if (caps_are_rtp_caps (caps, "application", &str)) {
- ret = g_strdup_printf (_("%s RTP payloader"), str);
- } else {
- const FormatInfo *info;
-
- str = gst_pb_utils_get_codec_description (caps);
- info = find_format_info (caps);
- if (info != NULL && (info->flags & FLAG_CONTAINER) != 0) {
- ret = g_strdup_printf (_("%s muxer"), str);
- } else {
- ret = g_strdup_printf (_("%s encoder"), str);
- }
- }
-
- g_free (str);
-
- return ret;
-}
-
-/**
- * gst_pb_utils_get_element_description:
- * @factory_name: the name of the element, e.g. "gnomevfssrc"
- *
- * Returns a localised string describing the given element, for use in
- * error dialogs or other messages to be seen by the user. Should never
- * return NULL unless @factory_name is invalid.
- *
- * This function is mainly for internal use, applications would typically
- * use gst_missing_plugin_message_get_description() to get a description of
- * a missing feature from a missing-plugin message.
- *
- * Returns: a newly-allocated description string, or NULL on error. Free
- * string with g_free() when not needed any longer.
- */
-gchar *
-gst_pb_utils_get_element_description (const gchar * factory_name)
-{
- gchar *ret;
-
- g_return_val_if_fail (factory_name != NULL, NULL);
-
- ret = g_strdup_printf (_("GStreamer element %s"), factory_name);
- if (ret && g_str_has_prefix (ret, factory_name))
- *ret = g_ascii_toupper (*ret);
-
- return ret;
-}
-
-/**
- * gst_pb_utils_add_codec_description_to_tag_list:
- * @taglist: a #GstTagList
- * @codec_tag: a GStreamer codec tag such as #GST_TAG_AUDIO_CODEC,
- * #GST_TAG_VIDEO_CODEC or #GST_TAG_CODEC
- * @caps: the (fixed) #GstCaps for which a codec tag should be added.
- *
- * Adds a codec tag describing the format specified by @caps to @taglist.
- *
- * Returns: TRUE if a codec tag was added, FALSE otherwise.
- */
-gboolean
-gst_pb_utils_add_codec_description_to_tag_list (GstTagList * taglist,
- const gchar * codec_tag, const GstCaps * caps)
-{
- const FormatInfo *info;
- gchar *desc;
-
- g_return_val_if_fail (taglist != NULL, FALSE);
- g_return_val_if_fail (GST_IS_TAG_LIST (taglist), FALSE);
- g_return_val_if_fail (codec_tag != NULL, FALSE);
- g_return_val_if_fail (gst_tag_exists (codec_tag), FALSE);
- g_return_val_if_fail (gst_tag_get_type (codec_tag) == G_TYPE_STRING, FALSE);
- g_return_val_if_fail (caps != NULL, FALSE);
- g_return_val_if_fail (GST_IS_CAPS (caps), FALSE);
-
- info = find_format_info (caps);
- if (info == NULL)
- return FALSE;
-
- desc = format_info_get_desc (info, caps);
- gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, codec_tag, desc, NULL);
- g_free (desc);
-
- return TRUE;
-}
-
-/**
- * gst_pb_utils_get_codec_description:
- * @caps: the (fixed) #GstCaps for which an format description is needed
- *
- * Returns a localised (as far as this is possible) string describing the
- * media format specified in @caps, for use in error dialogs or other messages
- * to be seen by the user. Should never return NULL unless @caps is invalid.
- *
- * Also see the convenience function
- * gst_pb_utils_add_codec_description_to_tag_list().
- *
- * Returns: a newly-allocated description string, or NULL on error. Free
- * string with g_free() when not needed any longer.
- */
-gchar *
-gst_pb_utils_get_codec_description (const GstCaps * caps)
-{
- const FormatInfo *info;
- gchar *str, *comma;
-
- g_return_val_if_fail (caps != NULL, NULL);
- g_return_val_if_fail (GST_IS_CAPS (caps), NULL);
- g_return_val_if_fail (gst_caps_is_fixed (caps), NULL);
-
- info = find_format_info (caps);
-
- if (info) {
- str = format_info_get_desc (info, caps);
- } else {
- str = gst_caps_to_string (caps);
-
- /* cut off everything after the media type, if there is anything */
- if ((comma = strchr (str, ','))) {
- *comma = '\0';
- g_strchomp (str);
- /* we could do something more elaborate here, like taking into account
- * audio/, video/, image/ and application/ prefixes etc. */
- }
-
- GST_WARNING ("No description available for media type: %s", str);
- }
-
- return str;
-}
-
-#if 0
-void
-gst_pb_utils_list_all (void)
-{
- gint i;
-
- g_print ("static const gchar *caps_strings[] = { ");
-
- for (i = 0; i < G_N_ELEMENTS (formats); ++i) {
- if (formats[i].desc != NULL)
- g_print (" \"%s\", ", formats[i].type);
- }
- g_print ("\n#if 0\n");
- for (i = 0; i < G_N_ELEMENTS (formats); ++i) {
- if (formats[i].desc == NULL)
- g_print (" \"%s\", \n", formats[i].type);
- }
- g_print ("\n#endif\n");
-}
-#endif
diff --git a/gst-libs/gst/pbutils/descriptions.h b/gst-libs/gst/pbutils/descriptions.h
deleted file mode 100644
index 5b19ecca..00000000
--- a/gst-libs/gst/pbutils/descriptions.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_PB_UTILS_DESCRIPTIONS_H__
-#define __GST_PB_UTILS_DESCRIPTIONS_H__
-
-#include <gst/gsttaglist.h>
-#include <gst/gstcaps.h>
-
-G_BEGIN_DECLS
-
-/*
- * functions for use by demuxers or decoders to add CODEC tags to tag lists
- * from caps
- */
-
-gboolean gst_pb_utils_add_codec_description_to_tag_list (GstTagList * taglist,
- const gchar * codec_tag,
- const GstCaps * caps);
-
-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
- */
-
-gchar * gst_pb_utils_get_source_description (const gchar * protocol);
-
-gchar * gst_pb_utils_get_sink_description (const gchar * protocol);
-
-gchar * gst_pb_utils_get_decoder_description (const GstCaps * caps);
-
-gchar * gst_pb_utils_get_encoder_description (const GstCaps * caps);
-
-gchar * gst_pb_utils_get_element_description (const gchar * factory_name);
-
-
-G_END_DECLS
-
-#endif /* __GST_PB_UTILS_DESCRIPTIONS_H__ */
-
diff --git a/gst-libs/gst/pbutils/install-plugins.c b/gst-libs/gst/pbutils/install-plugins.c
deleted file mode 100644
index 7ca19dee..00000000
--- a/gst-libs/gst/pbutils/install-plugins.c
+++ /dev/null
@@ -1,783 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstpbutilsinstallplugins
- * @short_description: Missing plugin installation support for applications
- *
- * <refsect2>
- * <title>Overview</title>
- * <para>
- * Using this API, applications can request the installation of missing
- * GStreamer plugins. These may be missing decoders/demuxers or encoders/muxers
- * for a certain format, sources or sinks for a certain URI protocol
- * (e.g. 'http'), or certain elements known by their element factory name
- * ('audioresample').
- * </para>
- * <para>
- * Whether plugin installation is supported or not depends on the operating
- * system and/or distribution in question. The vendor of the operating system
- * needs to make sure the necessary hooks and mechanisms are in place for
- * plugin installation to work. See below for more detailed information.
- * </para>
- * <para>
- * From the application perspective, plugin installation is usually triggered
- * either
- * <itemizedlist>
- * <listitem><para>
- * when the application itself has found that it wants or needs to install a
- * certain element
- * </para></listitem>
- * <listitem><para>
- * when the application has been notified by an element (such as playbin or
- * decodebin) that one or more plugins are missing <emphasis>and</emphasis>
- * the application has decided that it wants to install one or more of those
- * missing plugins
- * </para></listitem>
- * </itemizedlist>
- * </para>
- * <title>Detail Strings</title>
- * <para>
- * The install functions in this section all take one or more 'detail strings'.
- * These detail strings contain information about the type of plugin that
- * needs to be installed (decoder, encoder, source, sink, or named element),
- * and some additional information such GStreamer version used and a
- * human-readable description of the component to install for user dialogs.
- * </para>
- * <para>
- * Applications should not concern themselves with the composition of the
- * string itself. They should regard the string as if it was a shared secret
- * between GStreamer and the plugin installer application.
- * </para>
- * <para>
- * Detail strings can be obtained using the function
- * gst_missing_plugin_message_get_installer_detail() on a missing-plugin
- * message. Such a message will either have been found by the application on
- * a pipeline's #GstBus, or the application will have created it itself using
- * gst_missing_element_message_new(), gst_missing_decoder_message_new(),
- * gst_missing_encoder_message_new(), gst_missing_uri_sink_message_new(), or
- * gst_missing_uri_source_message_new().
- * </para>
- * <title>Plugin Installation from the Application Perspective</title>
- * <para>
- * For each GStreamer element/plugin/component that should be installed, the
- * application needs one of those 'installer detail' string mentioned in the
- * previous section. This string can be obtained, as already mentioned above,
- * from a missing-plugin message using the function
- * gst_missing_plugin_message_get_installer_detail(). The missing-plugin
- * message is either posted by another element and then found on the bus
- * by the application, or the application has created it itself as described
- * above.
- * </para>
- * <para>
- * The application will then call gst_install_plugins_async(), passing a
- * #NULL-terminated array of installer detail strings, and a function that
- * should be called when the installation of the plugins has finished
- * (successfully or not). Optionally, a #GstInstallPluginsContext created
- * with gst_install_plugins_context_new() may be passed as well. This way
- * additional optional arguments like the application window's XID can be
- * passed to the external installer application.
- * </para>
- * <para>
- * gst_install_plugins_async() will return almost immediately, with the
- * return code indicating whether plugin installation was started or not.
- * If the necessary hooks for plugin installation are in place and an
- * external installer application has in fact been called, the passed in
- * function will be called with a result code as soon as the external installer
- * has finished. If the result code indicates that new plugins have been
- * installed, the application will want to call gst_update_registry() so the
- * run-time plugin registry is updated and the new plugins are made available
- * to the application.
- * <note>
- * A Gtk/GLib main loop must be running in order for the result function to
- * be called when the external installer has finished. If this is not the case,
- * make sure to regularly call
- * <programlisting>
- * g_main_context_iteration (NULL,FALSE);
- * </programlisting>
- * from your code.
- * </note>
- * </para>
- * <title>Plugin Installation from the Vendor/Distribution Perspective</title>
- * <para>
- * <emphasis>1. Installer hook</emphasis>
- * </para>
- * <para>
- * When GStreamer applications initiate plugin installation via
- * gst_install_plugins_async() or gst_install_plugins_sync(), a pre-defined
- * helper application will be called.
- * </para>
- * <para>
- * The exact path of the helper application to be called is set at compile
- * time, usually by the <literal>./configure</literal> script based on the
- * install prefix. For a normal package build into the <literal>/usr</literal>
- * prefix, this will usually default to
- * <filename>/usr/libexec/gst-install-plugins-helper</filename> or
- * <filename>/usr/lib/gst-install-plugins-helper</filename>.
- * </para>
- * <para>
- * Vendors/distros who want to support GStreamer plugin installation should
- * either provide such a helper script/application or use the
- * <literal>./configure</literal> option
- * <literal>--with-install-plugins-helper=/path/to/installer</literal> to
- * make GStreamer call an installer of their own directly.
- * </para>
- * <para>
- * It is strongly recommended that vendors provide a small helper application
- * as interlocutor to the real installer though, even more so if command line
- * argument munging is required to transform the command line arguments
- * passed by GStreamer to the helper application into arguments that are
- * understood by the real installer.
- * </para>
- * <para>
- * The helper application path defined at compile time can be overriden at
- * runtime by setting the <envar>GST_INSTALL_PLUGINS_HELPER</envar>
- * environment variable. This can be useful for testing/debugging purposes.
- * </para>
- * <para>
- * <emphasis>2. Arguments passed to the install helper</emphasis>
- * </para>
- * <para>
- * GStreamer will pass the following arguments to the install helper (this is
- * in addition to the path of the executable itself, which is by convention
- * argv[0]):
- * <itemizedlist>
- * <listitem><para>
- * none to many optional arguments in the form of
- * <literal>--foo-bar=val</literal>. Example:
- * <literal>--transient-for=XID</literal> where XID is the X Window ID of
- * the main window of the calling application (so the installer can make
- * itself transient to that window). Unknown optional arguments should
- * be ignored by the installer.
- * </para></listitem>
- * <listitem><para>
- * one 'installer detail string' argument for each plugin to be installed;
- * these strings will have a <literal>gstreamer</literal> prefix; the
- * exact format of the detail string is explained below
- * </para></listitem>
- * </itemizedlist>
- * </para>
- * <para>
- * <emphasis>3. Detail string describing the missing plugin</emphasis>
- * </para>
- * <para>
- * The string is in UTF-8 encoding and is made up of several fields, separated
- * by '|' characters (but neither the first nor the last character is a '|').
- * The fields are:
- * <itemizedlist>
- * <listitem><para>
- * plugin system identifier, ie. "gstreamer"
- * </para><para>
- * This identifier determines the format of the rest of the detail string.
- * Automatic plugin installers should not process detail strings with
- * unknown identifiers. This allows other plugin-based libraries to use
- * the same mechanism for their automatic plugin installation needs, or
- * for the format to be changed should it turn out to be insufficient.
- * </para></listitem>
- * <listitem><para>
- * plugin system version, e.g. "0.10"
- * </para><para>
- * This is required so that when there is a GStreamer-0.12 or GStreamer-1.0
- * at some point in future, the different major versions can still co-exist
- * and use the same plugin install mechanism in the same way.
- * </para></listitem>
- * <listitem><para>
- * application identifier, e.g. "totem"
- * </para><para>
- * This may also be in the form of "pid/12345" if the program name can't
- * be obtained for some reason.
- * </para></listitem>
- * <listitem><para>
- * human-readable localised description of the required component,
- * e.g. "Vorbis audio decoder"
- * </para></listitem>
- * <listitem><para>
- * identifier string for the required component (see below for details about
- * how to map this to the package/plugin that needs installing), e.g.
- * <itemizedlist>
- * <listitem><para>
- * urisource-$(PROTOCOL_REQUIRED), e.g. urisource-http or urisource-mms
- * </para></listitem>
- * <listitem><para>
- * element-$(ELEMENT_REQUIRED), e.g. element-ffmpegcolorspace
- * </para></listitem>
- * <listitem><para>
- * decoder-$(CAPS_REQUIRED), e.g. (do read below for more details!):
- * <itemizedlist>
- * <listitem><para>decoder-audio/x-vorbis</para></listitem>
- * <listitem><para>decoder-application/ogg</para></listitem>
- * <listitem><para>decoder-audio/mpeg, mpegversion=(int)4</para></listitem>
- * <listitem><para>decoder-video/mpeg, systemstream=(boolean)true, mpegversion=(int)2</para></listitem>
- </itemizedlist>
- * </para></listitem>
- * <listitem><para>
- * encoder-$(CAPS_REQUIRED), e.g. encoder-audio/x-vorbis
- * </para></listitem>
- * </itemizedlist>
- * </para></listitem>
- * <listitem><para>
- * optional further fields not yet specified
- * </para></listitem>
- * </itemizedlist>
- * </para>
- * <para>
- * An entire ID string might then look like this, for example:
- * <literal>
- * gstreamer|0.10|totem|Vorbis audio decoder|decoder-audio/x-vorbis
- * </literal>
- * </para>
- * <para>
- * Plugin installers parsing this ID string should expect further fields also
- * separated by '|' symbols and either ignore them, warn the user, or error
- * out when encountering them.
- * </para>
- * <para>
- * Those unfamiliar with the GStreamer 'caps' system should note a few things
- * about the caps string used in the above decoder/encoder case:
- * <itemizedlist>
- * <listitem><para>
- * the first part ("video/mpeg") of the caps string is a GStreamer media
- * type and <emphasis>not</emphasis> a MIME type. Wherever possible, the
- * GStreamer media type will be the same as the corresponding MIME type,
- * but often it is not.
- * </para></listitem>
- * <listitem><para>
- * a caps string may or may not have additional comma-separated fields
- * of various types (as seen in the examples above)
- * </para></listitem>
- * <listitem><para>
- * the caps string of a 'required' component (as above) will always have
- * fields with fixed values, whereas an introspected string (see below)
- * may have fields with non-fixed values. Compare for example:
- * <itemizedlist>
- * <listitem><para>
- * <literal>audio/mpeg, mpegversion=(int)4</literal> vs.
- * <literal>audio/mpeg, mpegversion=(int){2, 4}</literal>
- * </para></listitem>
- * <listitem><para>
- * <literal>video/mpeg, mpegversion=(int)2</literal> vs.
- * <literal>video/mpeg, systemstream=(boolean){ true, false}, mpegversion=(int)[1, 2]</literal>
- * </para></listitem>
- * </itemizedlist>
- * </para></listitem>
- * </itemizedlist>
- * </para>
- * <para>
- * <emphasis>4. Exit codes the installer should return</emphasis>
- * </para>
- * <para>
- * The installer should return one of the following exit codes when it exits:
- * <itemizedlist>
- * <listitem><para>
- * 0 if all of the requested plugins could be installed
- * (#GST_INSTALL_PLUGINS_SUCCESS)
- * </para></listitem>
- * <listitem><para>
- * 1 if no appropriate installation candidate for any of the requested
- * plugins could be found. Only return this if nothing has been installed
- * (#GST_INSTALL_PLUGINS_NOT_FOUND)
- * </para></listitem>
- * <listitem><para>
- * 2 if an error occured during the installation. The application will
- * assume that the user will already have seen an error message by the
- * installer in this case and will usually not show another one
- * (#GST_INSTALL_PLUGINS_ERROR)
- * </para></listitem>
- * <listitem><para>
- * 3 if some of the requested plugins could be installed, but not all
- * (#GST_INSTALL_PLUGINS_PARTIAL_SUCCESS)
- * </para></listitem>
- * <listitem><para>
- * 4 if the user aborted the installation (#GST_INSTALL_PLUGINS_USER_ABORT)
- * </para></listitem>
- * </itemizedlist>
- * </para>
- * <para>
- * <emphasis>5. How to map the required detail string to packages</emphasis>
- * </para>
- * <para>
- * It is up to the vendor to find mechanism to map required components from
- * the detail string to the actual packages/plugins to install. This could
- * be a hardcoded list of mappings, for example, or be part of the packaging
- * system metadata.
- * </para>
- * <para>
- * GStreamer plugin files can be introspected for this information. The
- * <literal>gst-inspect</literal> utility has a special command line option
- * that will output information similar to what is required. For example
- * <command>
- * $ gst-inspect-0.10 --print-plugin-auto-install-info /path/to/libgstvorbis.so
- * </command>
- * should output something along the lines of
- * <computeroutput>
- * decoder-audio/x-vorbis
- * element-vorbisdec
- * element-vorbisenc
- * element-vorbisparse
- * element-vorbistag
- * encoder-audio/x-vorbis
- * </computeroutput>
- * Note that in the encoder and decoder case the introspected caps can be more
- * complex with additional fields, e.g.
- * <literal>audio/mpeg,mpegversion=(int){2,4}</literal>, so they will not
- * always exactly match the caps wanted by the application. It is up to the
- * installer to deal with this (either by doing proper caps intersection using
- * the GStreamer #GstCaps API, or by only taking into account the media type).
- * </para>
- * <para>
- * Another potential source of problems are plugins such as ladspa or
- * libvisual where the list of elements depends on the installed
- * ladspa/libvisual plugins at the time. This is also up to the distribution
- * to handle (but usually not relevant for playback applications).
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "install-plugins.h"
-
-#include <gst/gstinfo.h>
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-#include <string.h>
-
-/* best effort to make things compile and possibly even work on win32 */
-#ifndef WEXITSTATUS
-# define WEXITSTATUS(status) ((((guint)(status)) & 0xff00) >> 8)
-#endif
-#ifndef WIFEXITED
-# define WIFEXITED(status) ((((guint)(status)) & 0x7f) == 0)
-#endif
-
-static gboolean install_in_progress; /* FALSE */
-
-/* private struct */
-struct _GstInstallPluginsContext
-{
- guint xid;
-};
-
-/**
- * gst_install_plugins_context_set_xid:
- * @ctx: a #GstInstallPluginsContext
- * @xid: the XWindow ID (XID) of the top-level application
- *
- * This function is for X11-based applications (such as most Gtk/Qt
- * applications on linux/unix) only. You can use it to tell the external
- * installer the XID of your main application window. That way the installer
- * can make its own window transient to your application window during the
- * installation.
- *
- * If set, the XID will be passed to the installer via a --transient-for=XID
- * command line option.
- *
- * Gtk+/Gnome application should be able to obtain the XID of the top-level
- * window like this:
- * <programlisting>
- * ##include &lt;gtk/gtk.h&gt;
- * ##ifdef GDK_WINDOWING_X11
- * ##include &lt;gdk/gdkx.h&gt;
- * ##endif
- * ...
- * ##ifdef GDK_WINDOWING_X11
- * xid = GDK_WINDOW_XWINDOW (GTK_WIDGET (application_window)-&gt;window);
- * ##endif
- * ...
- * </programlisting>
- *
- * Since: 0.10.12
- */
-void
-gst_install_plugins_context_set_xid (GstInstallPluginsContext * ctx, guint xid)
-{
- g_return_if_fail (ctx != NULL);
-
- ctx->xid = xid;
-}
-
-/**
- * gst_install_plugins_context_new:
- *
- * Creates a new #GstInstallPluginsContext.
- *
- * Returns: a new #GstInstallPluginsContext. Free with
- * gst_install_plugins_context_free() when no longer needed
- *
- * Since: 0.10.12
- */
-GstInstallPluginsContext *
-gst_install_plugins_context_new (void)
-{
- return g_new0 (GstInstallPluginsContext, 1);
-}
-
-/**
- * gst_install_plugins_context_free:
- * @ctx: a #GstInstallPluginsContext
- *
- * Frees a #GstInstallPluginsContext.
- *
- * Since: 0.10.12
- */
-void
-gst_install_plugins_context_free (GstInstallPluginsContext * ctx)
-{
- g_return_if_fail (ctx != NULL);
-
- g_free (ctx);
-}
-
-static GstInstallPluginsContext *
-gst_install_plugins_context_copy (GstInstallPluginsContext * ctx)
-{
- GstInstallPluginsContext *ret;
-
- ret = gst_install_plugins_context_new ();
- ret->xid = ctx->xid;
-
- return ret;
-}
-
-GType
-gst_install_plugins_context_get_type (void)
-{
- static GType gst_ipc_type = 0;
-
- if (G_UNLIKELY (gst_ipc_type == 0)) {
- gst_ipc_type = g_boxed_type_register_static ("GstInstallPluginsContext",
- (GBoxedCopyFunc) gst_install_plugins_context_copy,
- (GBoxedFreeFunc) gst_install_plugins_context_free);
- }
- return gst_ipc_type;
-}
-
-static const gchar *
-gst_install_plugins_get_helper (void)
-{
- const gchar *helper;
-
- helper = g_getenv ("GST_INSTALL_PLUGINS_HELPER");
- if (helper == NULL)
- helper = GST_INSTALL_PLUGINS_HELPER;
-
- GST_LOG ("Using plugin install helper '%s'", helper);
- return helper;
-}
-
-static gboolean
-ptr_array_contains_string (GPtrArray * arr, const gchar * s)
-{
- gint i;
-
- for (i = 0; i < arr->len; ++i) {
- if (strcmp ((const char *) g_ptr_array_index (arr, i), s) == 0)
- return TRUE;
- }
- return FALSE;
-}
-
-static gboolean
-gst_install_plugins_spawn_child (gchar ** details,
- GstInstallPluginsContext * ctx, GPid * child_pid, gint * exit_status)
-{
- GPtrArray *arr;
- gboolean ret;
- GError *err = NULL;
- gchar **argv, xid_str[64] = { 0, };
-
- arr = g_ptr_array_new ();
-
- /* argv[0] = helper path */
- g_ptr_array_add (arr, (gchar *) gst_install_plugins_get_helper ());
-
- /* add any additional command line args from the context */
- if (ctx != NULL && ctx->xid != 0) {
- g_snprintf (xid_str, sizeof (xid_str), "--transient-for=%u", ctx->xid);
- g_ptr_array_add (arr, xid_str);
- }
-
- /* finally, add the detail strings, but without duplicates */
- while (details != NULL && details[0] != NULL) {
- if (!ptr_array_contains_string (arr, details[0]))
- g_ptr_array_add (arr, details[0]);
- ++details;
- }
-
- /* and NULL-terminate */
- g_ptr_array_add (arr, NULL);
-
- argv = (gchar **) arr->pdata;
-
- if (child_pid == NULL && exit_status != NULL) {
- install_in_progress = TRUE;
- ret = g_spawn_sync (NULL, argv, NULL, (GSpawnFlags) 0, NULL, NULL,
- NULL, NULL, exit_status, &err);
- install_in_progress = FALSE;
- } else if (child_pid != NULL && exit_status == NULL) {
- install_in_progress = TRUE;
- ret = g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL,
- NULL, child_pid, &err);
- } else {
- g_return_val_if_reached (FALSE);
- }
-
- if (!ret) {
- GST_ERROR ("Error spawning plugin install helper: %s", err->message);
- g_error_free (err);
- }
-
- g_ptr_array_free (arr, TRUE);
- return ret;
-}
-
-static GstInstallPluginsReturn
-gst_install_plugins_return_from_status (gint status)
-{
- GstInstallPluginsReturn ret;
-
- /* did we exit cleanly? */
- if (!WIFEXITED (status)) {
- ret = GST_INSTALL_PLUGINS_CRASHED;
- } else {
- ret = (GstInstallPluginsReturn) WEXITSTATUS (status);
-
- /* did the helper return an invalid status code? */
- if ((ret < 0 || ret >= GST_INSTALL_PLUGINS_STARTED_OK) &&
- ret != GST_INSTALL_PLUGINS_INTERNAL_FAILURE) {
- ret = GST_INSTALL_PLUGINS_INVALID;
- }
- }
-
- GST_LOG ("plugin installer exited with status 0x%04x = %s", status,
- gst_install_plugins_return_get_name (ret));
-
- return ret;
-}
-
-typedef struct
-{
- GstInstallPluginsResultFunc func;
- gpointer user_data;
-} GstInstallPluginsAsyncHelper;
-
-static void
-gst_install_plugins_installer_exited (GPid pid, gint status, gpointer data)
-{
- GstInstallPluginsAsyncHelper *helper;
- GstInstallPluginsReturn ret;
-
- install_in_progress = FALSE;
-
- helper = (GstInstallPluginsAsyncHelper *) data;
- ret = gst_install_plugins_return_from_status (status);
-
- GST_LOG ("calling plugin install result function %p", helper->func);
- helper->func (ret, helper->user_data);
-
- g_free (helper);
-}
-
-/**
- * gst_install_plugins_async:
- * @details: NULL-terminated array of installer string details (see below)
- * @ctx: a #GstInstallPluginsContext, or NULL
- * @func: the function to call when the installer program returns
- * @user_data: the user data to pass to @func when called, or NULL
- *
- * Requests plugin installation without blocking. Once the plugins have been
- * installed or installation has failed, @func will be called with the result
- * of the installation and your provided @user_data pointer.
- *
- * This function requires a running GLib/Gtk main loop. If you are not
- * running a GLib/Gtk main loop, make sure to regularly call
- * g_main_context_iteration(NULL,FALSE).
- *
- * The installer strings that make up @detail are typically obtained by
- * calling gst_missing_plugin_message_get_installer_detail() on missing-plugin
- * messages that have been caught on a pipeline's bus or created by the
- * application via the provided API, such as gst_missing_element_message_new().
- *
- * It is possible to request the installation of multiple missing plugins in
- * one go (as might be required if there is a demuxer for a certain format
- * installed but no suitable video decoder and no suitable audio decoder).
- *
- * Returns: result code whether an external installer could be started
- *
- * Since: 0.10.12
- */
-
-GstInstallPluginsReturn
-gst_install_plugins_async (gchar ** details, GstInstallPluginsContext * ctx,
- GstInstallPluginsResultFunc func, gpointer user_data)
-{
- GstInstallPluginsAsyncHelper *helper;
- GPid pid;
-
- g_return_val_if_fail (details != NULL, GST_INSTALL_PLUGINS_INTERNAL_FAILURE);
- g_return_val_if_fail (func != NULL, GST_INSTALL_PLUGINS_INTERNAL_FAILURE);
-
- if (install_in_progress)
- return GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS;
-
- /* if we can't access our helper, don't bother */
- if (!g_file_test (gst_install_plugins_get_helper (),
- G_FILE_TEST_IS_EXECUTABLE))
- return GST_INSTALL_PLUGINS_HELPER_MISSING;
-
- if (!gst_install_plugins_spawn_child (details, ctx, &pid, NULL))
- return GST_INSTALL_PLUGINS_INTERNAL_FAILURE;
-
- helper = g_new (GstInstallPluginsAsyncHelper, 1);
- helper->func = func;
- helper->user_data = user_data;
-
- g_child_watch_add (pid, gst_install_plugins_installer_exited, helper);
-
- return GST_INSTALL_PLUGINS_STARTED_OK;
-}
-
-/**
- * gst_install_plugins_sync:
- * @details: NULL-terminated array of installer string details
- * @ctx: a #GstInstallPluginsContext, or NULL
- *
- * Requests plugin installation and block until the plugins have been
- * installed or installation has failed.
- *
- * This function should almost never be used, it only exists for cases where
- * a non-GLib main loop is running and the user wants to run it in a separate
- * thread and marshal the result back asynchronously into the main thread
- * using the other non-GLib main loop. You should almost always use
- * gst_install_plugins_async() instead of this function.
- *
- * Returns: the result of the installation.
- *
- * Since: 0.10.12
- */
-GstInstallPluginsReturn
-gst_install_plugins_sync (gchar ** details, GstInstallPluginsContext * ctx)
-{
- gint status;
-
- g_return_val_if_fail (details != NULL, GST_INSTALL_PLUGINS_INTERNAL_FAILURE);
-
- if (install_in_progress)
- return GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS;
-
- /* if we can't access our helper, don't bother */
- if (!g_file_test (gst_install_plugins_get_helper (),
- G_FILE_TEST_IS_EXECUTABLE))
- return GST_INSTALL_PLUGINS_HELPER_MISSING;
-
- if (!gst_install_plugins_spawn_child (details, ctx, NULL, &status))
- return GST_INSTALL_PLUGINS_INTERNAL_FAILURE;
-
- return gst_install_plugins_return_from_status (status);
-}
-
-/**
- * gst_install_plugins_return_get_name:
- * @ret: the return status code
- *
- * Convenience function to return the descriptive string associated
- * with a status code. This function returns English strings and
- * should not be used for user messages. It is here only to assist
- * in debugging.
- *
- * Returns: a descriptive string for the status code in @ret
- *
- * Since: 0.10.12
- */
-const gchar *
-gst_install_plugins_return_get_name (GstInstallPluginsReturn ret)
-{
- switch (ret) {
- case GST_INSTALL_PLUGINS_SUCCESS:
- return "success";
- case GST_INSTALL_PLUGINS_NOT_FOUND:
- return "not-found";
- case GST_INSTALL_PLUGINS_ERROR:
- return "install-error";
- case GST_INSTALL_PLUGINS_CRASHED:
- return "installer-exit-unclean";
- case GST_INSTALL_PLUGINS_PARTIAL_SUCCESS:
- return "partial-success";
- case GST_INSTALL_PLUGINS_USER_ABORT:
- return "user-abort";
- case GST_INSTALL_PLUGINS_STARTED_OK:
- return "started-ok";
- case GST_INSTALL_PLUGINS_INTERNAL_FAILURE:
- return "internal-failure";
- case GST_INSTALL_PLUGINS_HELPER_MISSING:
- return "helper-missing";
- case GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS:
- return "install-in-progress";
- case GST_INSTALL_PLUGINS_INVALID:
- return "invalid";
- default:
- break;
- }
- return "(UNKNOWN)";
-}
-
-/**
- * gst_install_plugins_installation_in_progress:
- *
- * Checks whether plugin installation (initiated by this application only)
- * is currently in progress.
- *
- * Returns: TRUE if plugin installation is in progress, otherwise FALSE
- *
- * Since: 0.10.12
- */
-gboolean
-gst_install_plugins_installation_in_progress (void)
-{
- return install_in_progress;
-}
-
-/**
- * gst_install_plugins_supported:
- *
- * Checks whether plugin installation is likely to be supported by the
- * current environment. This currently only checks whether the helper script
- * that is to be provided by the distribution or operating system vendor
- * exists.
- *
- * Returns: TRUE if plugin installation is likely to be supported.
- *
- * Since: 0.10.15
- */
-gboolean
-gst_install_plugins_supported (void)
-{
- return g_file_test (gst_install_plugins_get_helper (),
- G_FILE_TEST_IS_EXECUTABLE);
-}
diff --git a/gst-libs/gst/pbutils/install-plugins.h b/gst-libs/gst/pbutils/install-plugins.h
deleted file mode 100644
index e57d8ac5..00000000
--- a/gst-libs/gst/pbutils/install-plugins.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_PB_UTILS_INSTALL_PLUGINS_H__
-#define __GST_PB_UTILS_INSTALL_PLUGINS_H__
-
-#include <glib-object.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 occured 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
- * occured 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_plugin_async().
- *
- * These codes indicate success or failure of starting an external installer
- * program and to what extent the requested plugins could be installed.
- *
- * Since: 0.10.12
- */
-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.
- *
- * Since: 0.10.12
- */
-
-#define GST_TYPE_INSTALL_PLUGINS_CONTEXT (gst_install_plugins_context_get_type())
-
-typedef struct _GstInstallPluginsContext GstInstallPluginsContext;
-
-GstInstallPluginsContext * gst_install_plugins_context_new (void);
-
-void gst_install_plugins_context_free (GstInstallPluginsContext * ctx);
-
-void gst_install_plugins_context_set_xid (GstInstallPluginsContext * ctx,
- guint xid);
-
-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.
- *
- * Since: 0.10.12
- */
-typedef void (*GstInstallPluginsResultFunc) (GstInstallPluginsReturn result,
- gpointer user_data);
-
-GstInstallPluginsReturn gst_install_plugins_async (gchar ** details,
- GstInstallPluginsContext * ctx,
- GstInstallPluginsResultFunc func,
- gpointer user_data);
-
-GstInstallPluginsReturn gst_install_plugins_sync (gchar ** details,
- GstInstallPluginsContext * ctx);
-
-const gchar * gst_install_plugins_return_get_name (GstInstallPluginsReturn ret);
-
-gboolean gst_install_plugins_installation_in_progress (void);
-
-gboolean gst_install_plugins_supported (void);
-
-G_END_DECLS
-
-#endif /* __GST_PB_UTILS_INSTALL_PLUGINS_H__ */
-
diff --git a/gst-libs/gst/pbutils/missing-plugins.c b/gst-libs/gst/pbutils/missing-plugins.c
deleted file mode 100644
index cc02bbf6..00000000
--- a/gst-libs/gst/pbutils/missing-plugins.c
+++ /dev/null
@@ -1,801 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstpbutilsmissingplugins
- * @short_description: Create, recognise and parse missing-plugins messages
- *
- * <refsect2>
- * <para>
- * Functions to create, recognise and parse missing-plugins messages for
- * applications and elements.
- * </para>
- * <para>
- * Missing-plugin messages are posted on the bus by elements like decodebin
- * or playbin if they can't find an appropriate source element or decoder
- * element. The application can use these messages for two things:
- * <itemizedlist>
- * <listitem><para>
- * concise error/problem reporting to the user mentioning what exactly
- * is missing, see gst_missing_plugin_message_get_description()
- * </para></listitem>
- * <listitem><para>
- * initiate installation of missing plugins, see
- * gst_missing_plugin_message_get_installer_detail() and
- * gst_install_plugins_async()
- * </para></listitem>
- * </itemizedlist>
- * </para>
- * <para>
- * Applications may also create missing-plugin messages themselves to install
- * required elements that are missing, using the install mechanism mentioned
- * above.
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h> /* getpid on UNIX */
-#endif
-#ifdef HAVE_PROCESS_H
-# include <process.h> /* getpid on win32 */
-#endif
-
-#include "gst/gst-i18n-plugin.h"
-
-#include "pbutils.h"
-
-#include <string.h>
-
-#define GST_DETAIL_STRING_MARKER "gstreamer"
-
-typedef enum
-{
- GST_MISSING_TYPE_UNKNOWN = 0,
- GST_MISSING_TYPE_URISOURCE,
- GST_MISSING_TYPE_URISINK,
- GST_MISSING_TYPE_ELEMENT,
- GST_MISSING_TYPE_DECODER,
- GST_MISSING_TYPE_ENCODER
-} GstMissingType;
-
-static const struct
-{
- GstMissingType type;
- const gchar type_string[12];
-} missing_type_mapping[] = {
- {
- GST_MISSING_TYPE_URISOURCE, "urisource"}, {
- GST_MISSING_TYPE_URISINK, "urisink"}, {
- GST_MISSING_TYPE_ELEMENT, "element"}, {
- GST_MISSING_TYPE_DECODER, "decoder"}, {
- GST_MISSING_TYPE_ENCODER, "encoder"}
-};
-
-static GstMissingType
-missing_structure_get_type (const GstStructure * s)
-{
- const gchar *type;
- guint i;
-
- type = gst_structure_get_string (s, "type");
- g_return_val_if_fail (type != NULL, GST_MISSING_TYPE_UNKNOWN);
-
- for (i = 0; i < G_N_ELEMENTS (missing_type_mapping); ++i) {
- if (strcmp (missing_type_mapping[i].type_string, type) == 0)
- return missing_type_mapping[i].type;
- }
-
- return GST_MISSING_TYPE_UNKNOWN;
-}
-
-static GstCaps *
-copy_and_clean_caps (const GstCaps * caps)
-{
- GstStructure *s;
- GstCaps *ret;
-
- ret = gst_caps_copy (caps);
-
- /* make caps easier to interpret, remove common fields that are likely
- * to be irrelevant for determining the right plugin (ie. mostly fields
- * where template caps usually have the standard MIN - MAX range as value) */
- s = gst_caps_get_structure (ret, 0);
- gst_structure_remove_field (s, "codec_data");
- gst_structure_remove_field (s, "palette_data");
- gst_structure_remove_field (s, "pixel-aspect-ratio");
- gst_structure_remove_field (s, "framerate");
- gst_structure_remove_field (s, "leaf_size");
- gst_structure_remove_field (s, "packet_size");
- gst_structure_remove_field (s, "block_align");
- gst_structure_remove_field (s, "metadata-interval"); /* icy caps */
- /* decoders/encoders almost always handle the usual width/height/channel/rate
- * range (and if we don't remove this then the app will have a much harder
- * time blacklisting formats it has unsuccessfully tried to install before) */
- gst_structure_remove_field (s, "width");
- gst_structure_remove_field (s, "depth");
- gst_structure_remove_field (s, "height");
- gst_structure_remove_field (s, "channels");
- gst_structure_remove_field (s, "rate");
- /* rtp fields */
- gst_structure_remove_field (s, "config");
- gst_structure_remove_field (s, "clock-rate");
- gst_structure_remove_field (s, "clock-base");
- gst_structure_remove_field (s, "maxps");
- gst_structure_remove_field (s, "seqnum-base");
- gst_structure_remove_field (s, "npt-start");
- gst_structure_remove_field (s, "npt-stop");
- gst_structure_remove_field (s, "play-speed");
- gst_structure_remove_field (s, "play-scale");
- gst_structure_remove_field (s, "dynamic_range");
-
- return ret;
-}
-
-/**
- * gst_missing_uri_source_message_new:
- * @element: the #GstElement posting the message
- * @protocol: the URI protocol the missing source needs to implement,
- * e.g. "http" or "mms"
- *
- * Creates a missing-plugin message for @element to notify the application
- * that a source element for a particular URI protocol is missing. This
- * function is mainly for use in plugins.
- *
- * Returns: a new #GstMessage, or NULL on error
- */
-GstMessage *
-gst_missing_uri_source_message_new (GstElement * element,
- const gchar * protocol)
-{
- GstStructure *s;
- gchar *description;
-
- g_return_val_if_fail (element != NULL, NULL);
- g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
- g_return_val_if_fail (protocol != NULL, NULL);
-
- description = gst_pb_utils_get_source_description (protocol);
-
- s = gst_structure_new ("missing-plugin", "type", G_TYPE_STRING,
- "urisource", "detail", G_TYPE_STRING, protocol, "name", G_TYPE_STRING,
- description, NULL);
-
- g_free (description);
- return gst_message_new_element (GST_OBJECT_CAST (element), s);
-}
-
-/**
- * gst_missing_uri_sink_message_new:
- * @element: the #GstElement posting the message
- * @protocol: the URI protocol the missing sink needs to implement,
- * e.g. "http" or "smb"
- *
- * Creates a missing-plugin message for @element to notify the application
- * that a sink element for a particular URI protocol is missing. This
- * function is mainly for use in plugins.
- *
- * Returns: a new #GstMessage, or NULL on error
- */
-GstMessage *
-gst_missing_uri_sink_message_new (GstElement * element, const gchar * protocol)
-{
- GstStructure *s;
- gchar *description;
-
- g_return_val_if_fail (element != NULL, NULL);
- g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
- g_return_val_if_fail (protocol != NULL, NULL);
-
- description = gst_pb_utils_get_sink_description (protocol);
-
- s = gst_structure_new ("missing-plugin", "type", G_TYPE_STRING,
- "urisink", "detail", G_TYPE_STRING, protocol, "name", G_TYPE_STRING,
- description, NULL);
-
- g_free (description);
- return gst_message_new_element (GST_OBJECT_CAST (element), s);
-}
-
-/**
- * gst_missing_element_message_new:
- * @element: the #GstElement posting the message
- * @factory_name: the name of the missing element (element factory),
- * e.g. "videoscale" or "cdparanoiasrc"
- *
- * Creates a missing-plugin message for @element to notify the application
- * that a certain required element is missing. This function is mainly for
- * use in plugins.
- *
- * Returns: a new #GstMessage, or NULL on error
- */
-GstMessage *
-gst_missing_element_message_new (GstElement * element,
- const gchar * factory_name)
-{
- GstStructure *s;
- gchar *description;
-
- g_return_val_if_fail (element != NULL, NULL);
- g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
- g_return_val_if_fail (factory_name != NULL, NULL);
-
- description = gst_pb_utils_get_element_description (factory_name);
-
- s = gst_structure_new ("missing-plugin", "type", G_TYPE_STRING,
- "element", "detail", G_TYPE_STRING, factory_name, "name", G_TYPE_STRING,
- description, NULL);
-
- g_free (description);
- return gst_message_new_element (GST_OBJECT_CAST (element), s);
-}
-
-/**
- * gst_missing_decoder_message_new:
- * @element: the #GstElement posting the message
- * @decode_caps: the (fixed) caps for which a decoder element is needed
- *
- * Creates a missing-plugin message for @element to notify the application
- * that a decoder element for a particular set of (fixed) caps is missing.
- * This function is mainly for use in plugins.
- *
- * Returns: a new #GstMessage, or NULL on error
- */
-GstMessage *
-gst_missing_decoder_message_new (GstElement * element,
- const GstCaps * decode_caps)
-{
- GstStructure *s;
- GstCaps *caps;
- gchar *description;
-
- g_return_val_if_fail (element != NULL, NULL);
- g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
- g_return_val_if_fail (decode_caps != NULL, NULL);
- g_return_val_if_fail (GST_IS_CAPS (decode_caps), NULL);
- g_return_val_if_fail (!gst_caps_is_any (decode_caps), NULL);
- g_return_val_if_fail (!gst_caps_is_empty (decode_caps), NULL);
- g_return_val_if_fail (gst_caps_is_fixed (decode_caps), NULL);
-
- description = gst_pb_utils_get_decoder_description (decode_caps);
- caps = copy_and_clean_caps (decode_caps);
-
- s = gst_structure_new ("missing-plugin", "type", G_TYPE_STRING,
- "decoder", "detail", GST_TYPE_CAPS, caps, "name", G_TYPE_STRING,
- description, NULL);
-
- gst_caps_unref (caps);
- g_free (description);
-
- return gst_message_new_element (GST_OBJECT_CAST (element), s);
-}
-
-/**
- * gst_missing_encoder_message_new:
- * @element: the #GstElement posting the message
- * @encode_caps: the (fixed) caps for which an encoder element is needed
- *
- * Creates a missing-plugin message for @element to notify the application
- * that an encoder element for a particular set of (fixed) caps is missing.
- * This function is mainly for use in plugins.
- *
- * Returns: a new #GstMessage, or NULL on error
- */
-GstMessage *
-gst_missing_encoder_message_new (GstElement * element,
- const GstCaps * encode_caps)
-{
- GstStructure *s;
- GstCaps *caps;
- gchar *description;
-
- g_return_val_if_fail (element != NULL, NULL);
- g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
- g_return_val_if_fail (encode_caps != NULL, NULL);
- g_return_val_if_fail (GST_IS_CAPS (encode_caps), NULL);
- g_return_val_if_fail (!gst_caps_is_any (encode_caps), NULL);
- g_return_val_if_fail (!gst_caps_is_empty (encode_caps), NULL);
- g_return_val_if_fail (gst_caps_is_fixed (encode_caps), NULL);
-
- description = gst_pb_utils_get_encoder_description (encode_caps);
- caps = copy_and_clean_caps (encode_caps);
-
- s = gst_structure_new ("missing-plugin", "type", G_TYPE_STRING,
- "encoder", "detail", GST_TYPE_CAPS, caps, "name", G_TYPE_STRING,
- description, NULL);
-
- gst_caps_unref (caps);
- g_free (description);
-
- return gst_message_new_element (GST_OBJECT_CAST (element), s);
-}
-
-static gboolean
-missing_structure_get_string_detail (const GstStructure * s, gchar ** p_detail)
-{
- const gchar *detail;
- GType detail_type;
-
- *p_detail = NULL;
-
- detail_type = gst_structure_get_field_type (s, "detail");
- if (!g_type_is_a (detail_type, G_TYPE_STRING)) {
- GST_WARNING ("expected 'detail' field to be of G_TYPE_STRING");
- return FALSE;
- }
-
- detail = gst_structure_get_string (s, "detail");
- if (detail == NULL || *detail == '\0') {
- GST_WARNING ("empty 'detail' field");
- return FALSE;
- }
- *p_detail = g_strdup (detail);
- return TRUE;
-}
-
-static gboolean
-missing_structure_get_caps_detail (const GstStructure * s, GstCaps ** p_caps)
-{
- const GstCaps *caps;
- const GValue *val;
- GType detail_type;
-
- *p_caps = NULL;
-
- detail_type = gst_structure_get_field_type (s, "detail");
- if (!g_type_is_a (detail_type, GST_TYPE_CAPS)) {
- GST_WARNING ("expected 'detail' field to be of GST_TYPE_CAPS");
- return FALSE;
- }
-
- val = gst_structure_get_value (s, "detail");
- caps = gst_value_get_caps (val);
- if (gst_caps_is_empty (caps) || gst_caps_is_any (caps)) {
- GST_WARNING ("EMPTY or ANY caps not allowed");
- return FALSE;
- }
-
- *p_caps = gst_caps_copy (caps);
- return TRUE;
-}
-
-/**
- * gst_missing_plugin_message_get_installer_detail:
- * @msg: a missing-plugin #GstMessage of type #GST_MESSAGE_ELEMENT
- *
- * Returns an opaque string containing all the details about the missing
- * element to be passed to an external installer called via
- * gst_install_plugins_async() or gst_install_plugins_sync().
- *
- * This function is mainly for applications that call external plugin
- * installation mechanisms using one of the two above-mentioned functions.
- *
- * Returns: a newly-allocated detail string, or NULL on error. Free string
- * with g_free() when not needed any longer.
- */
-gchar *
-gst_missing_plugin_message_get_installer_detail (GstMessage * msg)
-{
- GstMissingType missing_type;
- const gchar *progname;
- const gchar *type;
- GString *str = NULL;
- gchar *detail = NULL;
- gchar *desc;
-
- g_return_val_if_fail (gst_is_missing_plugin_message (msg), NULL);
-
- GST_LOG ("Parsing missing-plugin message: %" GST_PTR_FORMAT, msg->structure);
-
- missing_type = missing_structure_get_type (msg->structure);
- if (missing_type == GST_MISSING_TYPE_UNKNOWN) {
- GST_WARNING ("couldn't parse 'type' field");
- goto error;
- }
-
- type = gst_structure_get_string (msg->structure, "type");
- g_assert (type != NULL); /* validity already checked above */
-
- /* FIXME: use gst_installer_detail_new() here too */
- str = g_string_new (GST_DETAIL_STRING_MARKER "|");
- g_string_append_printf (str, "%u.%u|", GST_VERSION_MAJOR, GST_VERSION_MINOR);
-
- progname = (const gchar *) g_get_prgname ();
- if (progname) {
- g_string_append_printf (str, "%s|", progname);
- } else {
- g_string_append_printf (str, "pid/%lu|", (gulong) getpid ());
- }
-
- desc = gst_missing_plugin_message_get_description (msg);
- if (desc) {
- g_strdelimit (desc, "|", '#');
- g_string_append_printf (str, "%s|", desc);
- g_free (desc);
- } else {
- g_string_append (str, "|");
- }
-
- switch (missing_type) {
- case GST_MISSING_TYPE_URISOURCE:
- case GST_MISSING_TYPE_URISINK:
- case GST_MISSING_TYPE_ELEMENT:
- if (!missing_structure_get_string_detail (msg->structure, &detail))
- goto error;
- break;
- case GST_MISSING_TYPE_DECODER:
- case GST_MISSING_TYPE_ENCODER:{
- GstCaps *caps = NULL;
-
- if (!missing_structure_get_caps_detail (msg->structure, &caps))
- goto error;
-
- detail = gst_caps_to_string (caps);
- gst_caps_unref (caps);
- break;
- }
- default:
- g_return_val_if_reached (NULL);
- }
-
- g_string_append_printf (str, "%s-%s", type, detail);
- g_free (detail);
-
- return g_string_free (str, FALSE);
-
-/* ERRORS */
-error:
- {
- GST_WARNING ("Failed to parse missing-plugin msg: %" GST_PTR_FORMAT, msg);
- if (str)
- g_string_free (str, TRUE);
- return NULL;
- }
-}
-
-/**
- * gst_missing_plugin_message_get_description:
- * @msg: a missing-plugin #GstMessage of type #GST_MESSAGE_ELEMENT
- *
- * Returns a localised string describing the missing feature, for use in
- * error dialogs and the like. Should never return NULL unless @msg is not
- * a valid missing-plugin message.
- *
- * This function is mainly for applications that need a human-readable string
- * describing a missing plugin, given a previously collected missing-plugin
- * message
- *
- * Returns: a newly-allocated description string, or NULL on error. Free
- * string with g_free() when not needed any longer.
- */
-gchar *
-gst_missing_plugin_message_get_description (GstMessage * msg)
-{
- GstMissingType missing_type;
- const gchar *desc;
- gchar *ret = NULL;
-
- g_return_val_if_fail (gst_is_missing_plugin_message (msg), NULL);
-
- GST_LOG ("Parsing missing-plugin message: %" GST_PTR_FORMAT, msg->structure);
-
- desc = gst_structure_get_string (msg->structure, "name");
- if (desc != NULL && *desc != '\0') {
- ret = g_strdup (desc);
- goto done;
- }
-
- /* fallback #1 */
- missing_type = missing_structure_get_type (msg->structure);
-
- switch (missing_type) {
- case GST_MISSING_TYPE_URISOURCE:
- case GST_MISSING_TYPE_URISINK:
- case GST_MISSING_TYPE_ELEMENT:{
- gchar *detail = NULL;
-
- if (missing_structure_get_string_detail (msg->structure, &detail)) {
- if (missing_type == GST_MISSING_TYPE_URISOURCE)
- ret = gst_pb_utils_get_source_description (detail);
- else if (missing_type == GST_MISSING_TYPE_URISINK)
- ret = gst_pb_utils_get_sink_description (detail);
- else
- ret = gst_pb_utils_get_sink_description (detail);
- g_free (detail);
- }
- break;
- }
- case GST_MISSING_TYPE_DECODER:
- case GST_MISSING_TYPE_ENCODER:{
- GstCaps *caps = NULL;
-
- if (missing_structure_get_caps_detail (msg->structure, &caps)) {
- if (missing_type == GST_MISSING_TYPE_DECODER)
- ret = gst_pb_utils_get_decoder_description (caps);
- else
- ret = gst_pb_utils_get_encoder_description (caps);
- gst_caps_unref (caps);
- }
- break;
- }
- default:
- break;
- }
-
- if (ret)
- goto done;
-
- /* fallback #2 */
- switch (missing_type) {
- case GST_MISSING_TYPE_URISOURCE:
- desc = _("Unknown source element");
- break;
- case GST_MISSING_TYPE_URISINK:
- desc = _("Unknown sink element");
- break;
- case GST_MISSING_TYPE_ELEMENT:
- desc = _("Unknown element");
- break;
- case GST_MISSING_TYPE_DECODER:
- desc = _("Unknown decoder element");
- break;
- case GST_MISSING_TYPE_ENCODER:
- desc = _("Unknown encoder element");
- break;
- default:
- /* we should really never get here, but we better still return
- * something if we do */
- desc = _("Plugin or element of unknown type");
- break;
- }
- ret = g_strdup (desc);
-
-done:
-
- GST_LOG ("returning '%s'", ret);
- return ret;
-}
-
-/**
- * gst_is_missing_plugin_message:
- * @msg: a #GstMessage
- *
- * Checks whether @msg is a missing plugins message.
- *
- * Returns: %TRUE if @msg is a missing-plugins message, otherwise %FALSE.
- */
-gboolean
-gst_is_missing_plugin_message (GstMessage * msg)
-{
- g_return_val_if_fail (msg != NULL, FALSE);
- g_return_val_if_fail (GST_IS_MESSAGE (msg), FALSE);
-
- if (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ELEMENT || msg->structure == NULL)
- return FALSE;
-
- return gst_structure_has_name (msg->structure, "missing-plugin");
-}
-
-/* takes ownership of the description */
-static gchar *
-gst_installer_detail_new (gchar * description, const gchar * type,
- const gchar * detail)
-{
- const gchar *progname;
- GString *s;
-
- s = g_string_new (GST_DETAIL_STRING_MARKER "|");
- g_string_append_printf (s, "%u.%u|", GST_VERSION_MAJOR, GST_VERSION_MINOR);
-
- progname = (const gchar *) g_get_prgname ();
- if (progname) {
- g_string_append_printf (s, "%s|", progname);
- } else {
- g_string_append_printf (s, "pid/%lu|", (gulong) getpid ());
- }
-
- if (description) {
- g_strdelimit (description, "|", '#');
- g_string_append_printf (s, "%s|", description);
- g_free (description);
- } else {
- g_string_append (s, "|");
- }
-
- g_string_append_printf (s, "%s-%s", type, detail);
-
- return g_string_free (s, FALSE);
-}
-
-/**
- * gst_missing_uri_source_installer_detail_new:
- * @protocol: the URI protocol the missing source needs to implement,
- * e.g. "http" or "mms"
- *
- * Returns an opaque string containing all the details about the missing
- * element to be passed to an external installer called via
- * gst_install_plugins_async() or gst_install_plugins_sync().
- *
- * This function is mainly for applications that call external plugin
- * installation mechanisms using one of the two above-mentioned functions in
- * the case where the application knows exactly what kind of plugin it is
- * missing.
- *
- * Returns: a newly-allocated detail string, or NULL on error. Free string
- * with g_free() when not needed any longer.
- *
- * Since: 0.10.15
- */
-gchar *
-gst_missing_uri_source_installer_detail_new (const gchar * protocol)
-{
- gchar *desc;
-
- g_return_val_if_fail (protocol != NULL, NULL);
-
- desc = gst_pb_utils_get_source_description (protocol);
- return gst_installer_detail_new (desc, "urisource", protocol);
-}
-
-/**
- * gst_missing_uri_sink_installer_detail_new:
- * @protocol: the URI protocol the missing source needs to implement,
- * e.g. "http" or "mms"
- *
- * Returns an opaque string containing all the details about the missing
- * element to be passed to an external installer called via
- * gst_install_plugins_async() or gst_install_plugins_sync().
- *
- * This function is mainly for applications that call external plugin
- * installation mechanisms using one of the two above-mentioned functions in
- * the case where the application knows exactly what kind of plugin it is
- * missing.
- *
- * Returns: a newly-allocated detail string, or NULL on error. Free string
- * with g_free() when not needed any longer.
- *
- * Since: 0.10.15
- */
-gchar *
-gst_missing_uri_sink_installer_detail_new (const gchar * protocol)
-{
- gchar *desc;
-
- g_return_val_if_fail (protocol != NULL, NULL);
-
- desc = gst_pb_utils_get_sink_description (protocol);
- return gst_installer_detail_new (desc, "urisink", protocol);
-}
-
-/**
- * gst_missing_element_installer_detail_new:
- * @factory_name: the name of the missing element (element factory),
- * e.g. "videoscale" or "cdparanoiasrc"
- *
- * Returns an opaque string containing all the details about the missing
- * element to be passed to an external installer called via
- * gst_install_plugins_async() or gst_install_plugins_sync().
- *
- * This function is mainly for applications that call external plugin
- * installation mechanisms using one of the two above-mentioned functions in
- * the case where the application knows exactly what kind of plugin it is
- * missing.
- *
- * Returns: a newly-allocated detail string, or NULL on error. Free string
- * with g_free() when not needed any longer.
- *
- * Since: 0.10.15
- */
-gchar *
-gst_missing_element_installer_detail_new (const gchar * factory_name)
-{
- gchar *desc;
-
- g_return_val_if_fail (factory_name != NULL, NULL);
-
- desc = gst_pb_utils_get_element_description (factory_name);
- return gst_installer_detail_new (desc, "element", factory_name);
-}
-
-/**
- * gst_missing_decoder_installer_detail_new:
- * @decode_caps: the (fixed) caps for which a decoder element is needed
- *
- * Returns an opaque string containing all the details about the missing
- * element to be passed to an external installer called via
- * gst_install_plugins_async() or gst_install_plugins_sync().
- *
- * This function is mainly for applications that call external plugin
- * installation mechanisms using one of the two above-mentioned functions in
- * the case where the application knows exactly what kind of plugin it is
- * missing.
- *
- * Returns: a newly-allocated detail string, or NULL on error. Free string
- * with g_free() when not needed any longer.
- *
- * Since: 0.10.15
- */
-gchar *
-gst_missing_decoder_installer_detail_new (const GstCaps * decode_caps)
-{
- GstCaps *caps;
- gchar *detail_str, *caps_str, *desc;
-
- g_return_val_if_fail (decode_caps != NULL, NULL);
- g_return_val_if_fail (GST_IS_CAPS (decode_caps), NULL);
- g_return_val_if_fail (!gst_caps_is_any (decode_caps), NULL);
- g_return_val_if_fail (!gst_caps_is_empty (decode_caps), NULL);
- g_return_val_if_fail (gst_caps_is_fixed (decode_caps), NULL);
-
- desc = gst_pb_utils_get_decoder_description (decode_caps);
- caps = copy_and_clean_caps (decode_caps);
- caps_str = gst_caps_to_string (caps);
- detail_str = gst_installer_detail_new (desc, "decoder", caps_str);
- g_free (caps_str);
- gst_caps_unref (caps);
-
- return detail_str;
-}
-
-/**
- * gst_missing_encoder_installer_detail_new:
- * @encode_caps: the (fixed) caps for which an encoder element is needed
- *
- * Returns an opaque string containing all the details about the missing
- * element to be passed to an external installer called via
- * gst_install_plugins_async() or gst_install_plugins_sync().
- *
- * This function is mainly for applications that call external plugin
- * installation mechanisms using one of the two above-mentioned functions in
- * the case where the application knows exactly what kind of plugin it is
- * missing.
- *
- * Returns: a newly-allocated detail string, or NULL on error. Free string
- * with g_free() when not needed any longer.
- *
- * Since: 0.10.15
- */
-gchar *
-gst_missing_encoder_installer_detail_new (const GstCaps * encode_caps)
-{
- GstCaps *caps;
- gchar *detail_str, *caps_str, *desc;
-
- g_return_val_if_fail (encode_caps != NULL, NULL);
- g_return_val_if_fail (GST_IS_CAPS (encode_caps), NULL);
- g_return_val_if_fail (!gst_caps_is_any (encode_caps), NULL);
- g_return_val_if_fail (!gst_caps_is_empty (encode_caps), NULL);
- g_return_val_if_fail (gst_caps_is_fixed (encode_caps), NULL);
-
- desc = gst_pb_utils_get_encoder_description (encode_caps);
- caps = copy_and_clean_caps (encode_caps);
- caps_str = gst_caps_to_string (caps);
- detail_str = gst_installer_detail_new (desc, "encoder", caps_str);
- g_free (caps_str);
- gst_caps_unref (caps);
-
- return detail_str;
-}
diff --git a/gst-libs/gst/pbutils/missing-plugins.h b/gst-libs/gst/pbutils/missing-plugins.h
deleted file mode 100644
index 508304e4..00000000
--- a/gst-libs/gst/pbutils/missing-plugins.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_PB_UTILS_MISSING_PLUGINS_H__
-#define __GST_PB_UTILS_MISSING_PLUGINS_H__
-
-#include <gst/gstmessage.h>
-#include <gst/gstcaps.h>
-
-G_BEGIN_DECLS
-
-/*
- * functions to create missing-plugin messages, for use by plugins primarily
- */
-
-GstMessage * gst_missing_uri_source_message_new (GstElement * element,
- const gchar * protocol);
-
-GstMessage * gst_missing_uri_sink_message_new (GstElement * element,
- const gchar * protocol);
-
-GstMessage * gst_missing_element_message_new (GstElement * element,
- const gchar * factory_name);
-
-GstMessage * gst_missing_decoder_message_new (GstElement * element,
- const GstCaps * decode_caps);
-
-GstMessage * gst_missing_encoder_message_new (GstElement * element,
- const GstCaps * encode_caps);
-
-/*
- * functions for use by applications when dealing with missing-plugin messages
- */
-
-gchar * gst_missing_plugin_message_get_installer_detail (GstMessage * msg);
-
-gchar * gst_missing_plugin_message_get_description (GstMessage * msg);
-
-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
- */
-
-gchar * gst_missing_uri_source_installer_detail_new (const gchar * protocol);
-
-gchar * gst_missing_uri_sink_installer_detail_new (const gchar * protocol);
-
-gchar * gst_missing_element_installer_detail_new (const gchar * factory_name);
-
-gchar * gst_missing_decoder_installer_detail_new (const GstCaps * decode_caps);
-
-gchar * gst_missing_encoder_installer_detail_new (const GstCaps * encode_caps);
-
-G_END_DECLS
-
-#endif /* __GST_PB_UTILS_MISSING_PLUGINS_H__ */
-
diff --git a/gst-libs/gst/pbutils/pbutils.c b/gst-libs/gst/pbutils/pbutils.c
deleted file mode 100644
index 8accb8d6..00000000
--- a/gst-libs/gst/pbutils/pbutils.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstpbutils
- * @short_description: General Application and Plugin Utility Library
- *
- * <refsect2>
- * <para>
- * libgstpbutils is a general utility library for plugins and applications,
- * available since gst-plugins-base 0.10.12. It currently provides the
- * following:
- * </para>
- * <itemizedlist>
- * <listitem>
- * <para>
- * human-readable description strings of codecs, elements, sources, decoders,
- * encoders, or sinks from decoder/encoder caps, element names, or protocol
- * names.
- * </para>
- * </listitem>
- * <listitem>
- * <para>
- * support for applications to initiate installation of missing plugins (if
- * this is supported by the distribution or operating system used)
- * </para>
- * </listitem>
- * <listitem>
- * <para>
- * API for GStreamer elements to create missing-plugin messages in order to
- * communicate to the application that a certain type of plugin is missing
- * (decoder, encoder, URI protocol source, URI protocol sink, named element)
- * </para>
- * </listitem>
- * <listitem>
- * <para>
- * API for applications to recognise and handle missing-plugin messages
- * </para>
- * </listitem>
- * </itemizedlist>
- * <title>Linking to this library</title>
- * <para>
- * You should obtain the required CFLAGS and LIBS using pkg-config on the
- * gstreamer-plugins-base-0.10 module. You will then also need to add
- * '-lgstpbutils-0.10' manually to your LIBS line.
- * </para>
- * <title>Library initialisation</title>
- * <para>
- * Before using any of its functions, applications and plugins must call
- * gst_pb_utils_init() to initialise the library.
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "pbutils.h"
-
-#include "gst/gst-i18n-plugin.h"
-
-/**
- * gst_pb_utils_init:
- *
- * Initialises the base utils support library. This function is not
- * thread-safe. Applications should call it after calling gst_init(),
- * plugins should call it from their plugin_init function.
- *
- * This function may be called multiple times. It will do nothing if the
- * library has already been initialised.
- *
- * Since: 0.10.12
- */
-void
-gst_pb_utils_init (void)
-{
- static gboolean inited; /* FALSE */
-
- if (inited) {
- GST_LOG ("already initialised");
- return;
- }
-#ifdef ENABLE_NLS
- GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
- LOCALEDIR);
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif
-
- inited = TRUE;
-}
diff --git a/gst-libs/gst/pbutils/pbutils.h b/gst-libs/gst/pbutils/pbutils.h
deleted file mode 100644
index 02f7f6bf..00000000
--- a/gst-libs/gst/pbutils/pbutils.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_PB_UTILS_BASE_UTILS_H__
-#define __GST_PB_UTILS_BASE_UTILS_H__
-
-#include <gst/gst.h>
-
-#include <gst/pbutils/descriptions.h>
-#include <gst/pbutils/missing-plugins.h>
-#include <gst/pbutils/install-plugins.h>
-#include <gst/pbutils/pbutils-enumtypes.h>
-
-G_BEGIN_DECLS
-
-void gst_pb_utils_init (void);
-
-G_END_DECLS
-
-#endif /* __GST_PB_UTILS_BASE_UTILS_H__ */
-
diff --git a/gst-libs/gst/riff/Makefile.am b/gst-libs/gst/riff/Makefile.am
deleted file mode 100644
index ef10cdcd..00000000
--- a/gst-libs/gst/riff/Makefile.am
+++ /dev/null
@@ -1,57 +0,0 @@
-lib_LTLIBRARIES = libgstriff-@GST_MAJORMINOR@.la
-
-libgstriff_@GST_MAJORMINOR@_la_SOURCES = \
- riff.c \
- riff-media.c \
- riff-read.c
-
-libgstriff_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/riff
-libgstriff_@GST_MAJORMINOR@include_HEADERS = \
- riff-ids.h \
- riff-media.h \
- riff-read.h
-
-libgstriff_@GST_MAJORMINOR@_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/tag/libgsttag-@GST_MAJORMINOR@.la \
- $(GST_BASE_LIBS) $(GST_LIBS)
-
-libgstriff_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
-libgstriff_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
-
-if HAVE_INTROSPECTION
-BUILT_GIRSOURCES = GstRiff-@GST_MAJORMINOR@.gir
-
-gir_headers=$(patsubst %,$(srcdir)/%, $(libgstriff_@GST_MAJORMINOR@include_HEADERS))
-gir_sources=$(patsubst %,$(srcdir)/%, $(libgstriff_@GST_MAJORMINOR@_la_SOURCES))
-gir_cincludes=$(patsubst %,--c-include='gst/riff/%',$(libgstriff_@GST_MAJORMINOR@include_HEADERS))
-
-GstRiff-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstriff-@GST_MAJORMINOR@.la
- PKG_CONFIG_PATH="$(PKG_CONFIG_PATH):$(top_builddir)/pkgconfig" \
- $(INTROSPECTION_SCANNER) -v --namespace GstRiff \
- --nsversion=@GST_MAJORMINOR@ \
- --strip-prefix=Gst \
- $(gir_cincludes) \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst \
- --library=gstriff-0.10 \
- --include=Gst-0.10 \
- --libtool="$(top_builddir)/libtool" \
- --pkg gstreamer-0.10 \
- --output $@ \
- $(gir_headers) \
- $(gir_sources)
-
-# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
-# install anything - we need to install inside our prefix.
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(BUILT_GIRSOURCES)
-
-typelibsdir = $(libdir)/girepository-1.0/
-
-typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
-
-%.typelib: %.gir $(INTROSPECTION_COMPILER)
- $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=$(builddir) --includedir=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
-CLEANFILES = $(BUILT_GIRSOURCES) $(typelibs_DATA)
-endif
diff --git a/gst-libs/gst/riff/riff-ids.h b/gst-libs/gst/riff/riff-ids.h
deleted file mode 100644
index 3d5c6f15..00000000
--- a/gst-libs/gst/riff/riff-ids.h
+++ /dev/null
@@ -1,513 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_RIFF_IDS_H__
-#define __GST_RIFF_IDS_H__
-
-#include <gst/gst.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_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')
-/* 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')
-
-/* 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')
-
-/* 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 */
-#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) */
-
-/*********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', 'V', 'U', '9')
-#define GST_RIFF_YVU9 GST_MAKE_FOURCC ('Y', 'U', 'V', '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_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_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 size;
-} 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: Strech 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/gst-libs/gst/riff/riff-media.c b/gst-libs/gst/riff/riff-media.c
deleted file mode 100644
index b596b381..00000000
--- a/gst-libs/gst/riff/riff-media.c
+++ /dev/null
@@ -1,1863 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "riff-ids.h"
-#include "riff-media.h"
-
-#include <gst/audio/multichannel.h>
-
-#include <string.h>
-#include <math.h>
-
-GST_DEBUG_CATEGORY_EXTERN (riff_debug);
-#define GST_CAT_DEFAULT riff_debug
-
-/**
- * gst_riff_create_video_caps:
- * @codec_fcc: fourCC codec for this codec.
- * @strh: pointer to the strh stream header structure.
- * @strf: pointer to the strf stream header structure, including any
- * data that is within the range of strf.size, but excluding any
- * additional data withint this chunk but outside strf.size.
- * @strf_data: a #GstBuffer containing the additional data in the strf
- * chunk outside reach of strf.size. Ususally a palette.
- * @strd_data: a #GstBuffer containing the data in the strd stream header
- * chunk. Usually codec initialization data.
- * @codec_name: if given, will be filled with a human-readable codec name.
- */
-
-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)
-{
- GstCaps *caps = NULL;
- GstBuffer *palette = NULL;
-
- GST_DEBUG ("video fourcc %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (codec_fcc));
-
- switch (codec_fcc) {
- case GST_MAKE_FOURCC ('D', 'I', 'B', ' '): /* uncompressed RGB */
- case GST_MAKE_FOURCC (0x00, 0x00, 0x00, 0x00):
- case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
- case GST_MAKE_FOURCC ('R', 'A', 'W', ' '):
- {
- gint bpp = (strf && strf->bit_cnt != 0) ? strf->bit_cnt : 8;
-
- if (strf) {
- if (bpp == 8) {
- caps = gst_caps_new_simple ("video/x-raw-rgb",
- "bpp", G_TYPE_INT, 8, "depth", G_TYPE_INT, 8,
- "endianness", G_TYPE_INT, G_BYTE_ORDER, NULL);
- } else if (bpp == 24) {
- caps = gst_caps_new_simple ("video/x-raw-rgb",
- "bpp", G_TYPE_INT, 24, "depth", G_TYPE_INT, 24,
- "endianness", G_TYPE_INT, G_BIG_ENDIAN,
- "red_mask", G_TYPE_INT, 0xff, "green_mask", G_TYPE_INT, 0xff00,
- "blue_mask", G_TYPE_INT, 0xff0000, NULL);
- } else if (bpp == 32) {
- caps = gst_caps_new_simple ("video/x-raw-rgb",
- "bpp", G_TYPE_INT, 32, "depth", G_TYPE_INT, 24,
- "endianness", G_TYPE_INT, G_BIG_ENDIAN,
- "red_mask", G_TYPE_INT, 0xff00, "green_mask", G_TYPE_INT,
- 0xff0000, "blue_mask", G_TYPE_INT, 0xff000000, NULL);
- } else {
- GST_WARNING ("Unhandled DIB RGB depth: %d", bpp);
- return NULL;
- }
- } else {
- /* for template */
- caps =
- gst_caps_from_string ("video/x-raw-rgb, bpp = (int) { 8, 24, 32 }, "
- "depth = (int) { 8, 24}");
- }
-
- palette = strf_data;
- strf_data = NULL;
- if (codec_name) {
- if (bpp == 8)
- *codec_name = g_strdup_printf ("Palettized %d-bit RGB", bpp);
- else
- *codec_name = g_strdup_printf ("%d-bit RGB", bpp);
- }
- break;
- }
- case GST_MAKE_FOURCC ('I', '4', '2', '0'):
- caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, codec_fcc, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Uncompressed planar YUV 4:2:0");
- break;
-
- case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
- case GST_MAKE_FOURCC ('Y', 'U', 'N', 'V'):
- caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
- NULL);
- if (codec_name)
- *codec_name = g_strdup ("Uncompressed packed YUV 4:2:2");
- break;
-
- case GST_MAKE_FOURCC ('Y', 'V', 'U', '9'):
- caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, codec_fcc, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Uncompressed packed YVU 4:1:0");
- break;
-
- case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
- caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, codec_fcc, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Uncompressed packed YUV 4:2:2");
- break;
-
- case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
- caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, codec_fcc, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Uncompressed packed YVU 4:2:2");
- break;
-
- case GST_MAKE_FOURCC ('M', 'J', 'P', 'G'): /* YUY2 MJPEG */
- case GST_MAKE_FOURCC ('A', 'V', 'R', 'n'):
- case GST_MAKE_FOURCC ('I', 'J', 'P', 'G'):
- case GST_MAKE_FOURCC ('i', 'j', 'p', 'g'):
- case GST_MAKE_FOURCC ('d', 'm', 'b', '1'):
- case GST_MAKE_FOURCC ('A', 'C', 'D', 'V'):
- case GST_MAKE_FOURCC ('Q', 'I', 'V', 'G'):
- caps = gst_caps_new_simple ("image/jpeg", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Motion JPEG");
- break;
-
- case GST_MAKE_FOURCC ('J', 'P', 'E', 'G'): /* generic (mostly RGB) MJPEG */
- case GST_MAKE_FOURCC ('j', 'p', 'e', 'g'): /* generic (mostly RGB) MJPEG */
- caps = gst_caps_new_simple ("image/jpeg", NULL);
- if (codec_name)
- *codec_name = g_strdup ("JPEG Still Image");
- break;
-
- case GST_MAKE_FOURCC ('P', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */
- case GST_MAKE_FOURCC ('V', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */
- caps = gst_caps_new_simple ("image/jpeg", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Miro/Pinnacle Motion JPEG");
- break;
-
- case GST_MAKE_FOURCC ('C', 'J', 'P', 'G'):
- caps = gst_caps_new_simple ("image/jpeg", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Creative Webcam JPEG");
- break;
-
- case GST_MAKE_FOURCC ('S', 'L', 'M', 'J'):
- caps = gst_caps_new_simple ("image/jpeg", NULL);
- if (codec_name)
- *codec_name = g_strdup ("SL Motion JPEG");
- break;
-
- case GST_MAKE_FOURCC ('J', 'P', 'G', 'L'):
- caps = gst_caps_new_simple ("image/jpeg", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Pegasus Lossless JPEG");
- break;
-
- case GST_MAKE_FOURCC ('L', 'O', 'C', 'O'):
- caps = gst_caps_new_simple ("video/x-loco", NULL);
- if (codec_name)
- *codec_name = g_strdup ("LOCO Lossless");
- break;
-
- case GST_MAKE_FOURCC ('S', 'P', '5', '3'):
- case GST_MAKE_FOURCC ('S', 'P', '5', '4'):
- case GST_MAKE_FOURCC ('S', 'P', '5', '5'):
- case GST_MAKE_FOURCC ('S', 'P', '5', '6'):
- case GST_MAKE_FOURCC ('S', 'P', '5', '7'):
- case GST_MAKE_FOURCC ('S', 'P', '5', '8'):
- caps = gst_caps_new_simple ("video/sp5x", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Sp5x-like JPEG");
- break;
-
- case GST_MAKE_FOURCC ('Z', 'M', 'B', 'V'):
- caps = gst_caps_new_simple ("video/x-zmbv", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Zip Motion Block video");
- break;
-
- case GST_MAKE_FOURCC ('H', 'F', 'Y', 'U'):
- caps = gst_caps_new_simple ("video/x-huffyuv", NULL);
- if (strf) {
- gst_caps_set_simple (caps, "bpp",
- G_TYPE_INT, (int) strf->bit_cnt, NULL);
- }
- if (codec_name)
- *codec_name = g_strdup ("Huffman Lossless Codec");
- break;
-
- case GST_MAKE_FOURCC ('M', 'P', 'E', 'G'):
- case GST_MAKE_FOURCC ('M', 'P', 'G', 'I'):
- case GST_MAKE_FOURCC ('m', 'p', 'g', '1'):
- case GST_MAKE_FOURCC ('M', 'P', 'G', '1'):
- case GST_MAKE_FOURCC ('P', 'I', 'M', '1'):
- case GST_MAKE_FOURCC (0x01, 0x00, 0x00, 0x10):
- caps = gst_caps_new_simple ("video/mpeg",
- "systemstream", G_TYPE_BOOLEAN, FALSE,
- "mpegversion", G_TYPE_INT, 1, NULL);
- if (codec_name)
- *codec_name = g_strdup ("MPEG-1 video");
- break;
-
- case GST_MAKE_FOURCC ('M', 'P', 'G', '2'):
- case GST_MAKE_FOURCC ('m', 'p', 'g', '2'):
- case GST_MAKE_FOURCC ('P', 'I', 'M', '2'):
- case GST_MAKE_FOURCC ('D', 'V', 'R', ' '):
- case GST_MAKE_FOURCC (0x02, 0x00, 0x00, 0x10):
- caps = gst_caps_new_simple ("video/mpeg",
- "systemstream", G_TYPE_BOOLEAN, FALSE,
- "mpegversion", G_TYPE_INT, 2, NULL);
- if (codec_name)
- *codec_name = g_strdup ("MPEG-2 video");
- break;
-
- case GST_MAKE_FOURCC ('L', 'M', 'P', '2'):
- caps = gst_caps_new_simple ("video/mpeg",
- "systemstream", G_TYPE_BOOLEAN, FALSE,
- "mpegversion", G_TYPE_INT, 2, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Lead MPEG-2 video");
- break;
-
- case GST_MAKE_FOURCC ('H', '2', '6', '3'):
- case GST_MAKE_FOURCC ('h', '2', '6', '3'):
- case GST_MAKE_FOURCC ('i', '2', '6', '3'):
- case GST_MAKE_FOURCC ('U', '2', '6', '3'):
- case GST_MAKE_FOURCC ('v', 'i', 'v', '1'):
- case GST_MAKE_FOURCC ('T', '2', '6', '3'):
- caps = gst_caps_new_simple ("video/x-h263",
- "variant", G_TYPE_STRING, "itu", NULL);
- if (codec_name)
- *codec_name = g_strdup ("ITU H.26n");
- break;
-
- case GST_MAKE_FOURCC ('L', '2', '6', '3'):
- /* http://www.leadcodecs.com/Codecs/LEAD-H263.htm */
- caps = gst_caps_new_simple ("video/x-h263",
- "variant", G_TYPE_STRING, "lead", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Lead H.263");
- break;
-
- case GST_MAKE_FOURCC ('M', '2', '6', '3'):
- case GST_MAKE_FOURCC ('m', '2', '6', '3'):
- caps = gst_caps_new_simple ("video/x-h263",
- "variant", G_TYPE_STRING, "microsoft", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Microsoft H.263");
- break;
-
- case GST_MAKE_FOURCC ('V', 'D', 'O', 'W'):
- caps = gst_caps_new_simple ("video/x-h263",
- "variant", G_TYPE_STRING, "vdolive", NULL);
- if (codec_name)
- *codec_name = g_strdup ("VDOLive");
- break;
-
- case GST_MAKE_FOURCC ('V', 'I', 'V', 'O'):
- caps = gst_caps_new_simple ("video/x-h263",
- "variant", G_TYPE_STRING, "vivo", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Vivo H.263");
- break;
-
- case GST_MAKE_FOURCC ('x', '2', '6', '3'):
- caps = gst_caps_new_simple ("video/x-h263",
- "variant", G_TYPE_STRING, "xirlink", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Xirlink H.263");
- break;
-
- /* apparently not standard H.263...? */
- case GST_MAKE_FOURCC ('I', '2', '6', '3'):
- caps = gst_caps_new_simple ("video/x-intel-h263",
- "variant", G_TYPE_STRING, "intel", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Intel H.263");
- break;
-
- case GST_MAKE_FOURCC ('V', 'X', '1', 'K'):
- caps = gst_caps_new_simple ("video/x-h263",
- "variant", G_TYPE_STRING, "lucent", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Lucent VX1000S H.263");
- break;
-
- case GST_MAKE_FOURCC ('X', '2', '6', '4'):
- case GST_MAKE_FOURCC ('x', '2', '6', '4'):
- case GST_MAKE_FOURCC ('H', '2', '6', '4'):
- case GST_MAKE_FOURCC ('h', '2', '6', '4'):
- case GST_MAKE_FOURCC ('a', 'v', 'c', '1'):
- case GST_MAKE_FOURCC ('A', 'V', 'C', '1'):
- caps = gst_caps_new_simple ("video/x-h264",
- "variant", G_TYPE_STRING, "itu", NULL);
- if (codec_name)
- *codec_name = g_strdup ("ITU H.264");
- break;
-
- case GST_MAKE_FOURCC ('V', 'S', 'S', 'H'):
- caps = gst_caps_new_simple ("video/x-h264",
- "variant", G_TYPE_STRING, "videosoft", NULL);
- if (codec_name)
- *codec_name = g_strdup ("VideoSoft H.264");
- break;
-
- case GST_MAKE_FOURCC ('L', '2', '6', '4'):
- /* http://www.leadcodecs.com/Codecs/LEAD-H264.htm */
- caps = gst_caps_new_simple ("video/x-h264",
- "variant", G_TYPE_STRING, "lead", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Lead H.264");
- break;
-
- case GST_MAKE_FOURCC ('S', 'E', 'D', 'G'):
- caps = gst_caps_new_simple ("video/mpeg",
- "mpegversion", G_TYPE_INT, 4, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Samsung MPEG-4");
- break;
-
- case GST_MAKE_FOURCC ('M', '4', 'C', 'C'):
- caps = gst_caps_new_simple ("video/mpeg",
- "mpegversion", G_TYPE_INT, 4, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Divio MPEG-4");
- break;
-
- case GST_MAKE_FOURCC ('D', 'I', 'V', '3'):
- case GST_MAKE_FOURCC ('d', 'i', 'v', '3'):
- case GST_MAKE_FOURCC ('D', 'V', 'X', '3'):
- case GST_MAKE_FOURCC ('d', 'v', 'x', '3'):
- case GST_MAKE_FOURCC ('D', 'I', 'V', '4'):
- case GST_MAKE_FOURCC ('d', 'i', 'v', '4'):
- case GST_MAKE_FOURCC ('D', 'I', 'V', '5'):
- case GST_MAKE_FOURCC ('d', 'i', 'v', '5'):
- case GST_MAKE_FOURCC ('D', 'I', 'V', '6'):
- case GST_MAKE_FOURCC ('d', 'i', 'v', '6'):
- case GST_MAKE_FOURCC ('M', 'P', 'G', '3'):
- case GST_MAKE_FOURCC ('m', 'p', 'g', '3'):
- case GST_MAKE_FOURCC ('c', 'o', 'l', '0'):
- case GST_MAKE_FOURCC ('C', 'O', 'L', '0'):
- case GST_MAKE_FOURCC ('c', 'o', 'l', '1'):
- case GST_MAKE_FOURCC ('C', 'O', 'L', '1'):
- case GST_MAKE_FOURCC ('A', 'P', '4', '1'):
- caps = gst_caps_new_simple ("video/x-divx",
- "divxversion", G_TYPE_INT, 3, NULL);
- if (codec_name)
- *codec_name = g_strdup ("DivX MS-MPEG-4 Version 3");
- break;
-
- case GST_MAKE_FOURCC ('d', 'i', 'v', 'x'):
- case GST_MAKE_FOURCC ('D', 'I', 'V', 'X'):
- caps = gst_caps_new_simple ("video/x-divx",
- "divxversion", G_TYPE_INT, 4, NULL);
- if (codec_name)
- *codec_name = g_strdup ("DivX MPEG-4 Version 4");
- break;
-
- case GST_MAKE_FOURCC ('B', 'L', 'Z', '0'):
- caps = gst_caps_new_simple ("video/x-divx",
- "divxversion", G_TYPE_INT, 4, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Blizzard DivX");
- break;
-
- case GST_MAKE_FOURCC ('D', 'X', '5', '0'):
- caps = gst_caps_new_simple ("video/x-divx",
- "divxversion", G_TYPE_INT, 5, NULL);
- if (codec_name)
- *codec_name = g_strdup ("DivX MPEG-4 Version 5");
- break;
-
- case GST_MAKE_FOURCC ('X', 'V', 'I', 'D'):
- case GST_MAKE_FOURCC ('x', 'v', 'i', 'd'):
- caps = gst_caps_new_simple ("video/x-xvid", NULL);
- if (codec_name)
- *codec_name = g_strdup ("XVID MPEG-4");
- break;
-
- case GST_MAKE_FOURCC ('R', 'M', 'P', '4'):
- caps = gst_caps_new_simple ("video/x-xvid", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Sigma-Designs MPEG-4");
- break;
-
- case GST_MAKE_FOURCC ('M', 'P', 'G', '4'):
- case GST_MAKE_FOURCC ('M', 'P', '4', '1'):
- case GST_MAKE_FOURCC ('m', 'p', '4', '1'):
- caps = gst_caps_new_simple ("video/x-msmpeg",
- "msmpegversion", G_TYPE_INT, 41, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Microsoft MPEG-4 4.1");
- break;
-
- case GST_MAKE_FOURCC ('m', 'p', '4', '2'):
- case GST_MAKE_FOURCC ('M', 'P', '4', '2'):
- caps = gst_caps_new_simple ("video/x-msmpeg",
- "msmpegversion", G_TYPE_INT, 42, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Microsoft MPEG-4 4.2");
- break;
-
- case GST_MAKE_FOURCC ('m', 'p', '4', '3'):
- case GST_MAKE_FOURCC ('M', 'P', '4', '3'):
- caps = gst_caps_new_simple ("video/x-msmpeg",
- "msmpegversion", G_TYPE_INT, 43, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Microsoft MPEG-4 4.3");
- break;
-
- case GST_MAKE_FOURCC ('M', 'P', '4', 'S'):
- case GST_MAKE_FOURCC ('M', '4', 'S', '2'):
- caps = gst_caps_new_simple ("video/mpeg",
- "mpegversion", G_TYPE_INT, 4, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Microsoft ISO MPEG-4 1.1");
- break;
-
- case GST_MAKE_FOURCC ('F', 'M', 'P', '4'):
- case GST_MAKE_FOURCC ('U', 'M', 'P', '4'):
- case GST_MAKE_FOURCC ('F', 'F', 'D', 'S'):
- caps = gst_caps_new_simple ("video/mpeg",
- "mpegversion", G_TYPE_INT, 4, NULL);
- if (codec_name)
- *codec_name = g_strdup ("FFmpeg MPEG-4");
- break;
-
- case GST_MAKE_FOURCC ('E', 'M', '4', 'A'):
- case GST_MAKE_FOURCC ('E', 'P', 'V', 'H'):
- case GST_MAKE_FOURCC ('F', 'V', 'F', 'W'):
- case GST_MAKE_FOURCC ('I', 'N', 'M', 'C'):
- case GST_MAKE_FOURCC ('D', 'I', 'G', 'I'):
- case GST_MAKE_FOURCC ('D', 'M', '2', 'K'):
- case GST_MAKE_FOURCC ('D', 'C', 'O', 'D'):
- case GST_MAKE_FOURCC ('M', 'V', 'X', 'M'):
- case GST_MAKE_FOURCC ('P', 'M', '4', 'V'):
- case GST_MAKE_FOURCC ('S', 'M', 'P', '4'):
- case GST_MAKE_FOURCC ('D', 'X', 'G', 'M'):
- case GST_MAKE_FOURCC ('V', 'I', 'D', 'M'):
- case GST_MAKE_FOURCC ('M', '4', 'T', '3'):
- case GST_MAKE_FOURCC ('G', 'E', 'O', 'X'):
- caps = gst_caps_new_simple ("video/mpeg",
- "mpegversion", G_TYPE_INT, 4, NULL);
- if (codec_name)
- *codec_name = g_strdup ("MPEG-4");
- break;
-
- case GST_MAKE_FOURCC ('3', 'i', 'v', 'd'):
- case GST_MAKE_FOURCC ('3', 'I', 'V', 'D'):
- caps = gst_caps_new_simple ("video/x-msmpeg",
- "msmpegversion", G_TYPE_INT, 43, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Microsoft MPEG-4 4.3"); /* FIXME? */
- break;
-
- case GST_MAKE_FOURCC ('3', 'I', 'V', '1'):
- case GST_MAKE_FOURCC ('3', 'I', 'V', '2'):
- caps = gst_caps_new_simple ("video/x-3ivx", NULL);
- if (codec_name)
- *codec_name = g_strdup ("3ivx");
- break;
-
- case GST_MAKE_FOURCC ('D', 'V', 'S', 'D'):
- case GST_MAKE_FOURCC ('d', 'v', 's', 'd'):
- case GST_MAKE_FOURCC ('d', 'v', 'c', ' '):
- case GST_MAKE_FOURCC ('d', 'v', '2', '5'):
- caps = gst_caps_new_simple ("video/x-dv",
- "systemstream", G_TYPE_BOOLEAN, FALSE,
- "dvversion", G_TYPE_INT, 25, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Generic DV");
- break;
-
- case GST_MAKE_FOURCC ('C', 'D', 'V', 'C'):
- case GST_MAKE_FOURCC ('c', 'd', 'v', 'c'):
- caps = gst_caps_new_simple ("video/x-dv",
- "systemstream", G_TYPE_BOOLEAN, FALSE,
- "dvversion", G_TYPE_INT, 25, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Canopus DV");
- break;
-
- case GST_MAKE_FOURCC ('D', 'V', '5', '0'):
- case GST_MAKE_FOURCC ('d', 'v', '5', '0'):
- caps = gst_caps_new_simple ("video/x-dv",
- "systemstream", G_TYPE_BOOLEAN, FALSE,
- "dvversion", G_TYPE_INT, 50, NULL);
- if (codec_name)
- *codec_name = g_strdup ("DVCPro50 Video");
- break;
-
- case GST_MAKE_FOURCC ('W', 'M', 'V', '1'):
- caps = gst_caps_new_simple ("video/x-wmv",
- "wmvversion", G_TYPE_INT, 1, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Microsoft Windows Media 7");
- break;
-
- case GST_MAKE_FOURCC ('W', 'M', 'V', '2'):
- caps = gst_caps_new_simple ("video/x-wmv",
- "wmvversion", G_TYPE_INT, 2, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Microsoft Windows Media 8");
- break;
-
- case GST_MAKE_FOURCC ('W', 'M', 'V', '3'):
- caps = gst_caps_new_simple ("video/x-wmv",
- "wmvversion", G_TYPE_INT, 3, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Microsoft Windows Media 9");
- break;
-
- case GST_MAKE_FOURCC ('W', 'M', 'V', 'A'):
- caps = gst_caps_new_simple ("video/x-wmv",
- "wmvversion", G_TYPE_INT, 3, "format", GST_TYPE_FOURCC,
- codec_fcc, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Microsoft Windows Media Advanced Profile");
- break;
-
- case GST_MAKE_FOURCC ('W', 'V', 'C', '1'):
- caps = gst_caps_new_simple ("video/x-wmv",
- "wmvversion", G_TYPE_INT, 3, "format", GST_TYPE_FOURCC,
- codec_fcc, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Microsoft Windows Media VC-1");
- break;
-
- case GST_MAKE_FOURCC ('c', 'v', 'i', 'd'):
- caps = gst_caps_new_simple ("video/x-cinepak", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Cinepak video");
- break;
-
- case GST_MAKE_FOURCC ('M', 'S', 'V', 'C'):
- case GST_MAKE_FOURCC ('m', 's', 'v', 'c'):
- case GST_MAKE_FOURCC ('C', 'R', 'A', 'M'):
- case GST_MAKE_FOURCC ('c', 'r', 'a', 'm'):
- case GST_MAKE_FOURCC ('W', 'H', 'A', 'M'):
- case GST_MAKE_FOURCC ('w', 'h', 'a', 'm'):
- caps = gst_caps_new_simple ("video/x-msvideocodec",
- "msvideoversion", G_TYPE_INT, 1, NULL);
- if (codec_name)
- *codec_name = g_strdup ("MS video v1");
- palette = strf_data;
- strf_data = NULL;
- break;
-
- case GST_MAKE_FOURCC ('R', 'L', 'E', ' '):
- case GST_MAKE_FOURCC ('m', 'r', 'l', 'e'):
- case GST_MAKE_FOURCC (0x1, 0x0, 0x0, 0x0): /* why, why, why? */
- case GST_MAKE_FOURCC (0x2, 0x0, 0x0, 0x0): /* why, why, why? */
- caps = gst_caps_new_simple ("video/x-rle",
- "layout", G_TYPE_STRING, "microsoft", NULL);
- palette = strf_data;
- strf_data = NULL;
- if (strf) {
- gst_caps_set_simple (caps,
- "depth", G_TYPE_INT, (gint) strf->bit_cnt, NULL);
- } else {
- gst_caps_set_simple (caps, "depth", GST_TYPE_INT_RANGE, 1, 64, NULL);
- }
- if (codec_name)
- *codec_name = g_strdup ("Microsoft RLE");
- break;
-
- case GST_MAKE_FOURCC ('A', 'A', 'S', 'C'):
- caps = gst_caps_new_simple ("video/x-aasc", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Autodesk Animator");
- break;
-
- case GST_MAKE_FOURCC ('X', 'x', 'a', 'n'):
- caps = gst_caps_new_simple ("video/x-xan",
- "wcversion", G_TYPE_INT, 4, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Xan Wing Commander 4");
- break;
-
- case GST_MAKE_FOURCC ('R', 'T', '2', '1'):
- caps = gst_caps_new_simple ("video/x-indeo",
- "indeoversion", G_TYPE_INT, 2, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Intel Video 2");
- break;
-
- case GST_MAKE_FOURCC ('I', 'V', '3', '1'):
- case GST_MAKE_FOURCC ('I', 'V', '3', '2'):
- case GST_MAKE_FOURCC ('i', 'v', '3', '1'):
- case GST_MAKE_FOURCC ('i', 'v', '3', '2'):
- caps = gst_caps_new_simple ("video/x-indeo",
- "indeoversion", G_TYPE_INT, 3, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Intel Video 3");
- break;
-
- case GST_MAKE_FOURCC ('I', 'V', '4', '1'):
- case GST_MAKE_FOURCC ('i', 'v', '4', '1'):
- caps = gst_caps_new_simple ("video/x-indeo",
- "indeoversion", G_TYPE_INT, 4, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Intel Video 4");
- break;
-
- case GST_MAKE_FOURCC ('I', 'V', '5', '0'):
- caps = gst_caps_new_simple ("video/x-indeo",
- "indeoversion", G_TYPE_INT, 5, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Intel Video 5");
- break;
-
- case GST_MAKE_FOURCC ('M', 'S', 'Z', 'H'):
- caps = gst_caps_new_simple ("video/x-mszh", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Lossless MSZH Video");
- break;
-
- case GST_MAKE_FOURCC ('Z', 'L', 'I', 'B'):
- caps = gst_caps_new_simple ("video/x-zlib", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Lossless zlib video");
- break;
-
- case GST_MAKE_FOURCC ('C', 'L', 'J', 'R'):
- case GST_MAKE_FOURCC ('c', 'l', 'j', 'r'):
- caps = gst_caps_new_simple ("video/x-cirrus-logic-accupak", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Cirrus Logipak AccuPak");
- break;
-
- case GST_MAKE_FOURCC ('C', 'Y', 'U', 'V'):
- case GST_MAKE_FOURCC ('c', 'y', 'u', 'v'):
- caps = gst_caps_new_simple ("video/x-compressed-yuv", NULL);
- if (codec_name)
- *codec_name = g_strdup ("CYUV Lossless");
- break;
-
- case GST_MAKE_FOURCC ('D', 'U', 'C', 'K'):
- case GST_MAKE_FOURCC ('P', 'V', 'E', 'Z'):
- caps = gst_caps_new_simple ("video/x-truemotion",
- "trueversion", G_TYPE_INT, 1, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Duck Truemotion1");
- break;
-
- case GST_MAKE_FOURCC ('T', 'M', '2', '0'):
- caps = gst_caps_new_simple ("video/x-truemotion",
- "trueversion", G_TYPE_INT, 2, NULL);
- if (codec_name)
- *codec_name = g_strdup ("TrueMotion 2.0");
- break;
-
- case GST_MAKE_FOURCC ('V', 'P', '3', '0'):
- case GST_MAKE_FOURCC ('v', 'p', '3', '0'):
- case GST_MAKE_FOURCC ('V', 'P', '3', '1'):
- case GST_MAKE_FOURCC ('v', 'p', '3', '1'):
- case GST_MAKE_FOURCC ('V', 'P', '3', ' '):
- caps = gst_caps_new_simple ("video/x-vp3", NULL);
- if (codec_name)
- *codec_name = g_strdup ("VP3");
- break;
-
- case GST_MAKE_FOURCC ('U', 'L', 'T', 'I'):
- caps = gst_caps_new_simple ("video/x-ultimotion", NULL);
- if (codec_name)
- *codec_name = g_strdup ("IBM UltiMotion");
- break;
-
- case GST_MAKE_FOURCC ('T', 'S', 'C', 'C'):
- case GST_MAKE_FOURCC ('t', 's', 'c', 'c'):{
- if (strf) {
- gint depth = (strf->bit_cnt != 0) ? (gint) strf->bit_cnt : 24;
-
- caps = gst_caps_new_simple ("video/x-camtasia", "depth", G_TYPE_INT,
- depth, NULL);
- } else {
- /* template caps */
- caps = gst_caps_new_simple ("video/x-camtasia", NULL);
- }
- if (codec_name)
- *codec_name = g_strdup ("TechSmith Camtasia");
- break;
- }
-
- case GST_MAKE_FOURCC ('V', 'C', 'R', '1'):
- caps = gst_caps_new_simple ("video/x-ati-vcr",
- "vcrversion", G_TYPE_INT, 1, NULL);
- if (codec_name)
- *codec_name = g_strdup ("ATI VCR 1");
- break;
-
- case GST_MAKE_FOURCC ('V', 'C', 'R', '2'):
- caps = gst_caps_new_simple ("video/x-ati-vcr",
- "vcrversion", G_TYPE_INT, 2, NULL);
- if (codec_name)
- *codec_name = g_strdup ("ATI VCR 2");
- break;
-
- case GST_MAKE_FOURCC ('A', 'S', 'V', '1'):
- caps = gst_caps_new_simple ("video/x-asus",
- "asusversion", G_TYPE_INT, 1, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Asus Video 1");
- break;
-
- case GST_MAKE_FOURCC ('A', 'S', 'V', '2'):
- caps = gst_caps_new_simple ("video/x-asus",
- "asusversion", G_TYPE_INT, 2, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Asus Video 2");
- break;
-
- case GST_MAKE_FOURCC ('M', 'P', 'N', 'G'):
- case GST_MAKE_FOURCC ('m', 'p', 'n', 'g'):
- case GST_MAKE_FOURCC ('P', 'N', 'G', ' '):
- caps = gst_caps_new_simple ("image/png", NULL);
- if (codec_name)
- *codec_name = g_strdup ("PNG image");
- break;
-
- case GST_MAKE_FOURCC ('F', 'L', 'V', '1'):
- caps = gst_caps_new_simple ("video/x-flash-video",
- "flvversion", G_TYPE_INT, 1, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Flash Video 1");
- break;
-
- case GST_MAKE_FOURCC ('V', 'M', 'n', 'c'):
- caps = gst_caps_new_simple ("video/x-vmnc",
- "version", G_TYPE_INT, 1, NULL);
- if (codec_name)
- *codec_name = g_strdup ("VMWare NC Video");
- break;
-
- case GST_MAKE_FOURCC ('d', 'r', 'a', 'c'):
- caps = gst_caps_new_simple ("video/x-dirac", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Dirac");
- break;
-
- case GST_RIFF_rpza:
- case GST_RIFF_azpr:
- case GST_MAKE_FOURCC ('R', 'P', 'Z', 'A'):
- caps = gst_caps_new_simple ("video/x-apple-video", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Apple Video (RPZA)");
- break;
-
-
- case GST_MAKE_FOURCC ('F', 'F', 'V', '1'):
- caps = gst_caps_new_simple ("video/x-ffv",
- "ffvversion", G_TYPE_INT, 1, NULL);
- if (codec_name)
- *codec_name = g_strdup ("FFmpeg lossless video codec");
- break;
-
- case GST_MAKE_FOURCC ('K', 'M', 'V', 'C'):
- caps = gst_caps_new_simple ("video/x-kmvc", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Karl Morton's video codec");
- break;
-
- case GST_MAKE_FOURCC ('v', 'p', '5', '0'):
- case GST_MAKE_FOURCC ('V', 'P', '5', '0'):
- caps = gst_caps_new_simple ("video/x-vp5", NULL);
- if (codec_name)
- *codec_name = g_strdup ("On2 VP5");
- break;
-
- case GST_MAKE_FOURCC ('v', 'p', '6', '0'):
- case GST_MAKE_FOURCC ('V', 'P', '6', '0'):
- case GST_MAKE_FOURCC ('v', 'p', '6', '1'):
- case GST_MAKE_FOURCC ('V', 'P', '6', '1'):
- caps = gst_caps_new_simple ("video/x-vp6", NULL);
- if (codec_name)
- *codec_name = g_strdup ("On2 VP6");
- break;
-
- case GST_MAKE_FOURCC ('L', 'M', '2', '0'):
- caps = gst_caps_new_simple ("video/x-mimic", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Mimic webcam");
- break;
-
- case GST_MAKE_FOURCC ('T', 'H', 'E', 'O'):
- case GST_MAKE_FOURCC ('t', 'h', 'e', 'o'):
- caps = gst_caps_new_simple ("video/x-theora", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Theora video codec");
-
- break;
-
- case GST_MAKE_FOURCC ('F', 'P', 'S', '1'):
- caps = gst_caps_new_simple ("video/x-fraps", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Fraps video");
-
- break;
-
- default:
- GST_WARNING ("Unknown video fourcc %" GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (codec_fcc));
- return NULL;
- }
-
- if (strh != NULL) {
- gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION,
- strh->rate, strh->scale, NULL);
- } else {
- gst_caps_set_simple (caps,
- "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
- }
-
- if (strf != NULL) {
- gst_caps_set_simple (caps,
- "width", G_TYPE_INT, strf->width,
- "height", G_TYPE_INT, strf->height, NULL);
- } else {
- gst_caps_set_simple (caps,
- "width", GST_TYPE_INT_RANGE, 16, 4096,
- "height", GST_TYPE_INT_RANGE, 16, 4096, NULL);
- }
-
- /* extradata */
- if (strf_data || strd_data) {
- GstBuffer *codec_data;
-
- codec_data = strf_data ? strf_data : strd_data;
-
- gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, codec_data, NULL);
- }
-
- /* palette */
- if (palette) {
- GstBuffer *copy;
- guint num_colors;
-
- if (strf != NULL)
- num_colors = strf->num_colors;
- else
- num_colors = 256;
-
- if (GST_BUFFER_SIZE (palette) >= (num_colors * 4)) {
- /* palette is always at least 256*4 bytes */
- copy =
- gst_buffer_new_and_alloc (MAX (GST_BUFFER_SIZE (palette), 256 * 4));
- memcpy (GST_BUFFER_DATA (copy), GST_BUFFER_DATA (palette),
- GST_BUFFER_SIZE (palette));
-
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- {
- guint8 *data = GST_BUFFER_DATA (copy);
- gint n;
-
- /* own endianness */
- for (n = 0; n < num_colors; n++) {
- GST_WRITE_UINT32_BE (data, GST_READ_UINT32_LE (data));
- data += sizeof (guint32);
- }
- }
-#endif
- gst_caps_set_simple (caps, "palette_data", GST_TYPE_BUFFER, copy, NULL);
- gst_buffer_unref (copy);
- } else {
- GST_WARNING ("Palette smaller than expected: broken file");
- }
- }
-
- return caps;
-}
-
-static const struct
-{
- const guint32 ms_mask;
- const GstAudioChannelPosition gst_pos;
-} layout_mapping[] = {
- {
- 0x00001, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, {
- 0x00002, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, {
- 0x00004, GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER}, {
- 0x00008, GST_AUDIO_CHANNEL_POSITION_LFE}, {
- 0x00010, GST_AUDIO_CHANNEL_POSITION_REAR_LEFT}, {
- 0x00020, GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, {
- 0x00040, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER}, {
- 0x00080, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER}, {
- 0x00100, GST_AUDIO_CHANNEL_POSITION_REAR_CENTER}, {
- 0x00200, GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT}, {
- 0x00400, GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT}, {
- 0x00800, GST_AUDIO_CHANNEL_POSITION_INVALID}, /* TOP_CENTER */
- {
- 0x01000, GST_AUDIO_CHANNEL_POSITION_INVALID}, /* TOP_FRONT_LEFT */
- {
- 0x02000, GST_AUDIO_CHANNEL_POSITION_INVALID}, /* TOP_FRONT_CENTER */
- {
- 0x04000, GST_AUDIO_CHANNEL_POSITION_INVALID}, /* TOP_FRONT_RIGHT */
- {
- 0x08000, GST_AUDIO_CHANNEL_POSITION_INVALID}, /* TOP_BACK_LEFT */
- {
- 0x10000, GST_AUDIO_CHANNEL_POSITION_INVALID}, /* TOP_BACK_CENTER */
- {
- 0x20000, GST_AUDIO_CHANNEL_POSITION_INVALID} /* TOP_BACK_RIGHT */
-};
-
-#define MAX_CHANNEL_POSITIONS G_N_ELEMENTS (layout_mapping)
-
-static gboolean
-gst_riff_wavext_add_channel_layout (GstCaps * caps, guint32 layout)
-{
- GstAudioChannelPosition pos[MAX_CHANNEL_POSITIONS];
- GstStructure *s;
- gint num_channels, i, p;
-
- s = gst_caps_get_structure (caps, 0);
- if (!gst_structure_get_int (s, "channels", &num_channels))
- g_return_val_if_reached (FALSE);
-
- /* In theory this should be done for 1 and 2 channels too but
- * apparently breaks too many things currently.
- */
- if (num_channels <= 2 || num_channels > MAX_CHANNEL_POSITIONS) {
- GST_DEBUG ("invalid number of channels: %d", num_channels);
- return FALSE;
- }
-
- p = 0;
- for (i = 0; i < MAX_CHANNEL_POSITIONS; ++i) {
- if ((layout & layout_mapping[i].ms_mask) != 0) {
- if (p >= num_channels) {
- GST_WARNING ("More bits set in the channel layout map than there "
- "are channels! Broken file");
- return FALSE;
- }
- if (layout_mapping[i].gst_pos == GST_AUDIO_CHANNEL_POSITION_INVALID) {
- GST_WARNING ("Unsupported channel position (mask 0x%08x) in channel "
- "layout map - ignoring those channels", layout_mapping[i].ms_mask);
- /* what to do? just ignore it and let downstream deal with a channel
- * layout that has INVALID positions in it for now ... */
- }
- pos[p] = layout_mapping[i].gst_pos;
- ++p;
- }
- }
-
- if (p != num_channels) {
- GST_WARNING ("Only %d bits set in the channel layout map, but there are "
- "supposed to be %d channels! Broken file", p, num_channels);
- return FALSE;
- }
-
- gst_audio_set_channel_positions (s, pos);
- return TRUE;
-}
-
-static gboolean
-gst_riff_wave_add_default_channel_layout (GstCaps * caps)
-{
- GstAudioChannelPosition pos[8] = { GST_AUDIO_CHANNEL_POSITION_NONE, };
- GstStructure *s;
- gint nchannels;
-
- s = gst_caps_get_structure (caps, 0);
-
- if (!gst_structure_get_int (s, "channels", &nchannels))
- g_return_val_if_reached (FALSE);
-
- if (nchannels > 8) {
- GST_DEBUG ("invalid number of channels: %d", nchannels);
- return FALSE;
- }
-
- /* This uses the default channel mapping from ALSA which
- * is used in quite a few surround test files and seems to be
- * the defacto standard. The channel mapping from
- * WAVE_FORMAT_EXTENSIBLE doesn't seem to be used in normal
- * wav files like chan-id.wav.
- * http://bugzilla.gnome.org/show_bug.cgi?id=489010
- */
- switch (nchannels) {
- case 1:
- pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_MONO;
- break;
- case 8:
- pos[7] = GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT;
- pos[6] = GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT;
- /* fall through */
- case 6:
- pos[5] = GST_AUDIO_CHANNEL_POSITION_LFE;
- /* fall through */
- case 5:
- pos[4] = GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER;
- /* fall through */
- case 4:
- pos[3] = GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT;
- pos[2] = GST_AUDIO_CHANNEL_POSITION_REAR_LEFT;
- /* fall through */
- case 2:
- pos[1] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
- pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
- break;
- default:
- return FALSE;
- }
-
- gst_audio_set_channel_positions (s, pos);
- return TRUE;
-}
-
-static guint32
-gst_riff_wavext_get_default_channel_mask (guint nchannels)
-{
- guint32 channel_mask = 0;
-
- /* Set the default channel mask for the given number of channels.
- * http://www.microsoft.com/whdc/device/audio/multichaud.mspx
- */
- switch (nchannels) {
- case 11:
- channel_mask |= 0x00400;
- channel_mask |= 0x00200;
- case 9:
- channel_mask |= 0x00100;
- case 8:
- channel_mask |= 0x00080;
- channel_mask |= 0x00040;
- case 6:
- channel_mask |= 0x00020;
- channel_mask |= 0x00010;
- case 4:
- channel_mask |= 0x00008;
- case 3:
- channel_mask |= 0x00004;
- case 2:
- channel_mask |= 0x00002;
- channel_mask |= 0x00001;
- break;
- }
-
- return channel_mask;
-}
-
-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)
-{
- gboolean block_align = FALSE, rate_chan = TRUE;
- GstCaps *caps = NULL;
- gint rate_min = 1000, rate_max = 96000;
- gint channels_max = 2;
-
- switch (codec_id) {
- case GST_RIFF_WAVE_FORMAT_PCM: /* PCM */
- rate_max = 192000;
- channels_max = 8;
-
- if (strf != NULL) {
- gint ba = strf->blockalign;
- gint ch = strf->channels;
- gint wd, ws;
-
- /* If we have an empty blockalign, we take the width contained in
- * strf->size */
- if (ba != 0)
- wd = ba * 8 / ch;
- else
- wd = strf->size;
-
- if (strf->size > 32) {
- GST_WARNING ("invalid depth (%d) of pcm audio, overwriting.",
- strf->size);
- strf->size = 8 * ((wd + 7) / 8);
- }
-
- /* in riff, the depth is stored in the size field but it just means that
- * the _least_ significant bits are cleared. We can therefore just play
- * the sample as if it had a depth == width */
- /* For reference, the actual depth is in strf->size */
- ws = wd;
-
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
- "channels", G_TYPE_INT, ch,
- "width", G_TYPE_INT, wd,
- "depth", G_TYPE_INT, ws, "signed", G_TYPE_BOOLEAN, wd != 8, NULL);
-
- /* Add default channel layout. In theory this should be done
- * for 1 and 2 channels too but apparently breaks too many
- * things currently. Also we know no default layout for more than
- * 8 channels. */
- if (ch > 2) {
- if (ch > 8)
- GST_WARNING ("don't know default layout for %d channels", ch);
- else if (gst_riff_wave_add_default_channel_layout (caps))
- GST_DEBUG ("using default channel layout for %d channels", ch);
- else
- GST_WARNING ("failed to add channel layout");
- }
- } else {
- /* FIXME: this is pretty useless - we need fixed caps */
- caps = gst_caps_from_string ("audio/x-raw-int, "
- "endianness = (int) LITTLE_ENDIAN, "
- "signed = (boolean) { true, false }, "
- "width = (int) { 8, 16, 24, 32 }, " "depth = (int) [ 1, 32 ]");
- }
- if (codec_name && strf)
- *codec_name = g_strdup_printf ("Uncompressed %d-bit PCM audio",
- strf->size);
- break;
-
- case GST_RIFF_WAVE_FORMAT_ADPCM:
- caps = gst_caps_new_simple ("audio/x-adpcm",
- "layout", G_TYPE_STRING, "microsoft", NULL);
- if (codec_name)
- *codec_name = g_strdup ("ADPCM audio");
- block_align = TRUE;
- break;
-
- case GST_RIFF_WAVE_FORMAT_IEEE_FLOAT:
- rate_max = 192000;
- channels_max = 8;
-
- if (strf != NULL) {
- gint ba = strf->blockalign;
- gint ch = strf->channels;
- gint wd = ba * 8 / ch;
-
- caps = gst_caps_new_simple ("audio/x-raw-float",
- "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
- "channels", G_TYPE_INT, ch, "width", G_TYPE_INT, wd, NULL);
-
- /* Add default channel layout. In theory this should be done
- * for 1 and 2 channels too but apparently breaks too many
- * things currently. Also we know no default layout for more than
- * 8 channels. */
- if (ch > 2) {
- if (ch > 8)
- GST_WARNING ("don't know default layout for %d channels", ch);
- else if (gst_riff_wave_add_default_channel_layout (caps))
- GST_DEBUG ("using default channel layout for %d channels", ch);
- else
- GST_WARNING ("failed to add channel layout");
- }
- } else {
- /* FIXME: this is pretty useless - we need fixed caps */
- caps = gst_caps_from_string ("audio/x-raw-float, "
- "endianness = (int) LITTLE_ENDIAN, " "width = (int) { 32, 64 }");
- }
- if (codec_name && strf)
- *codec_name = g_strdup_printf ("Uncompressed %d-bit IEEE float audio",
- strf->size);
- break;
-
- case GST_RIFF_WAVE_FORMAT_IBM_CVSD:
- goto unknown;
-
- case GST_RIFF_WAVE_FORMAT_ALAW:
- if (strf != NULL) {
- if (strf->size != 8) {
- GST_WARNING ("invalid depth (%d) of alaw audio, overwriting.",
- strf->size);
- strf->size = 8;
- strf->blockalign = (strf->size * strf->channels) / 8;
- strf->av_bps = strf->blockalign * strf->rate;
- }
- if (strf->av_bps == 0 || strf->blockalign == 0) {
- GST_WARNING ("fixing av_bps (%d) and blockalign (%d) of alaw audio",
- strf->av_bps, strf->blockalign);
- strf->blockalign = (strf->size * strf->channels) / 8;
- strf->av_bps = strf->blockalign * strf->rate;
- }
- }
- rate_max = 48000;
- caps = gst_caps_new_simple ("audio/x-alaw", NULL);
- if (codec_name)
- *codec_name = g_strdup ("A-law audio");
- break;
-
- case GST_RIFF_WAVE_FORMAT_WMS:
- caps = gst_caps_new_simple ("audio/x-wms", NULL);
- if (strf != NULL) {
- gst_caps_set_simple (caps,
- "bitrate", G_TYPE_INT, strf->av_bps * 8,
- "width", G_TYPE_INT, strf->size,
- "depth", G_TYPE_INT, strf->size, NULL);
- } else {
- gst_caps_set_simple (caps,
- "bitrate", GST_TYPE_INT_RANGE, 0, G_MAXINT, NULL);
- }
- if (codec_name)
- *codec_name = g_strdup ("Windows Media Audio Speech");
- block_align = TRUE;
- break;
-
- case GST_RIFF_WAVE_FORMAT_MULAW:
- if (strf != NULL) {
- if (strf->size != 8) {
- GST_WARNING ("invalid depth (%d) of mulaw audio, overwriting.",
- strf->size);
- strf->size = 8;
- strf->blockalign = (strf->size * strf->channels) / 8;
- strf->av_bps = strf->blockalign * strf->rate;
- }
- if (strf->av_bps == 0 || strf->blockalign == 0) {
- GST_WARNING ("fixing av_bps (%d) and blockalign (%d) of mulaw audio",
- strf->av_bps, strf->blockalign);
- strf->blockalign = (strf->size * strf->channels) / 8;
- strf->av_bps = strf->blockalign * strf->rate;
- }
- }
- rate_max = 48000;
- caps = gst_caps_new_simple ("audio/x-mulaw", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Mu-law audio");
- break;
-
- case GST_RIFF_WAVE_FORMAT_OKI_ADPCM:
- goto unknown;
-
- case GST_RIFF_WAVE_FORMAT_DVI_ADPCM:
- rate_max = 48000;
- caps = gst_caps_new_simple ("audio/x-adpcm",
- "layout", G_TYPE_STRING, "dvi", NULL);
- if (codec_name)
- *codec_name = g_strdup ("DVI ADPCM audio");
- block_align = TRUE;
- break;
-
- case GST_RIFF_WAVE_FORMAT_DSP_TRUESPEECH:
- rate_min = 8000;
- rate_max = 8000;
- caps = gst_caps_new_simple ("audio/x-truespeech", NULL);
- if (codec_name)
- *codec_name = g_strdup ("DSP Group TrueSpeech");
- break;
-
- case GST_RIFF_WAVE_FORMAT_GSM610:
- case GST_RIFF_WAVE_FORMAT_MSN:
- rate_min = 1;
- caps = gst_caps_new_simple ("audio/ms-gsm", NULL);
- if (codec_name)
- *codec_name = g_strdup ("MS GSM audio");
- break;
-
- case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */
- rate_min = 16000;
- rate_max = 48000;
- caps = gst_caps_new_simple ("audio/mpeg",
- "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 2, NULL);
- if (codec_name)
- *codec_name = g_strdup ("MPEG-1 layer 2");
- break;
-
- case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */
- rate_min = 8000;
- rate_max = 48000;
- caps = gst_caps_new_simple ("audio/mpeg",
- "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL);
- if (codec_name)
- *codec_name = g_strdup ("MPEG-1 layer 3");
- break;
-
- case GST_RIFF_WAVE_FORMAT_AMR_NB: /* amr-nb */
- rate_min = 8000;
- rate_max = 8000;
- channels_max = 1;
- caps = gst_caps_new_simple ("audio/AMR", NULL);
- if (codec_name)
- *codec_name = g_strdup ("AMR Narrow Band (NB)");
- break;
-
- case GST_RIFF_WAVE_FORMAT_AMR_WB: /* amr-wb */
- rate_min = 16000;
- rate_max = 16000;
- channels_max = 1;
- caps = gst_caps_new_simple ("audio/AMR-WB", NULL);
- if (codec_name)
- *codec_name = g_strdup ("AMR Wide Band (WB)");
- break;
-
- case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */
- case GST_RIFF_WAVE_FORMAT_VORBIS2: /* ogg/vorbis mode 2 */
- case GST_RIFF_WAVE_FORMAT_VORBIS3: /* ogg/vorbis mode 3 */
- case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* ogg/vorbis mode 1+ */
- case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* ogg/vorbis mode 2+ */
- case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* ogg/vorbis mode 3+ */
- rate_max = 192000;
- caps = gst_caps_new_simple ("audio/x-vorbis", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Vorbis");
- break;
-
- case GST_RIFF_WAVE_FORMAT_A52:
- channels_max = 6;
- caps = gst_caps_new_simple ("audio/x-ac3", NULL);
- if (codec_name)
- *codec_name = g_strdup ("AC-3 audio");
- break;
- case GST_RIFF_WAVE_FORMAT_DTS:
- channels_max = 6;
- caps = gst_caps_new_simple ("audio/x-dts", NULL);
- if (codec_name)
- *codec_name = g_strdup ("DTS audio");
- /* wavparse is not always able to specify rate/channels for DTS-in-wav */
- rate_chan = FALSE;
- break;
- case GST_RIFF_WAVE_FORMAT_AAC:
- case GST_RIFF_WAVE_FORMAT_AAC_AC:
- case GST_RIFF_WAVE_FORMAT_AAC_pm:
- {
- channels_max = 8;
- caps = gst_caps_new_simple ("audio/mpeg",
- "mpegversion", G_TYPE_INT, 4, NULL);
- if (codec_name)
- *codec_name = g_strdup ("MPEG-4 AAC audio");
- break;
- }
- case GST_RIFF_WAVE_FORMAT_WMAV1:
- case GST_RIFF_WAVE_FORMAT_WMAV2:
- case GST_RIFF_WAVE_FORMAT_WMAV3:
- case GST_RIFF_WAVE_FORMAT_WMAV3_L:
- {
- gint version = (codec_id - GST_RIFF_WAVE_FORMAT_WMAV1) + 1;
-
- channels_max = 6;
- block_align = TRUE;
-
- caps = gst_caps_new_simple ("audio/x-wma",
- "wmaversion", G_TYPE_INT, version, NULL);
-
- if (codec_name) {
- if (codec_id == GST_RIFF_WAVE_FORMAT_WMAV3_L)
- *codec_name = g_strdup ("WMA Lossless");
- else
- *codec_name = g_strdup_printf ("WMA Version %d", version + 6);
- }
-
- if (strf != NULL) {
- gst_caps_set_simple (caps,
- "bitrate", G_TYPE_INT, strf->av_bps * 8,
- "depth", G_TYPE_INT, strf->size, NULL);
- } else {
- gst_caps_set_simple (caps,
- "bitrate", GST_TYPE_INT_RANGE, 0, G_MAXINT, NULL);
- }
- break;
- }
- case GST_RIFF_WAVE_FORMAT_SONY_ATRAC3:
- caps = gst_caps_new_simple ("audio/x-vnd.sony.atrac3", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Sony ATRAC3");
- break;
-
- case GST_RIFF_WAVE_FORMAT_SIREN:
- caps = gst_caps_new_simple ("audio/x-siren", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Siren7");
- rate_chan = FALSE;
- break;
-
- case GST_RIFF_WAVE_FORMAT_ADPCM_IMA_DK4:
- rate_min = 8000;
- rate_max = 96000;
- channels_max = 2;
- caps =
- gst_caps_new_simple ("audio/x-adpcm", "layout", G_TYPE_STRING, "dk4",
- NULL);
- if (codec_name)
- *codec_name = g_strdup ("IMA/DK4 ADPCM");
- break;
- case GST_RIFF_WAVE_FORMAT_ADPCM_IMA_DK3:
- rate_min = 8000;
- rate_max = 96000;
- channels_max = 2;
- caps =
- gst_caps_new_simple ("audio/x-adpcm", "layout", G_TYPE_STRING, "dk3",
- NULL);
- if (codec_name)
- *codec_name = g_strdup ("IMA/DK3 ADPCM");
- break;
-
- case GST_RIFF_WAVE_FORMAT_ADPCM_IMA_WAV:
- rate_min = 8000;
- rate_max = 96000;
- channels_max = 2;
- caps =
- gst_caps_new_simple ("audio/x-adpcm", "layout", G_TYPE_STRING, "dvi",
- NULL);
- if (codec_name)
- *codec_name = g_strdup ("IMA/WAV ADPCM");
- break;
- case GST_RIFF_WAVE_FORMAT_EXTENSIBLE:{
- guint16 valid_bits_per_sample;
- guint32 channel_mask;
- guint32 subformat_guid[4];
- const guint8 *data;
-
- channels_max = 8;
-
- /* should be at least 22 bytes */
- if (strf_data == NULL || GST_BUFFER_SIZE (strf_data) < 22) {
- GST_WARNING ("WAVE_FORMAT_EXTENSIBLE data size is %d (expected: 22)",
- (strf_data) ? GST_BUFFER_SIZE (strf_data) : -1);
- return NULL;
- }
-
- data = GST_BUFFER_DATA (strf_data);
-
- valid_bits_per_sample = GST_READ_UINT16_LE (data);
- channel_mask = GST_READ_UINT32_LE (data + 2);
- subformat_guid[0] = GST_READ_UINT32_LE (data + 6);
- subformat_guid[1] = GST_READ_UINT32_LE (data + 10);
- subformat_guid[2] = GST_READ_UINT32_LE (data + 14);
- subformat_guid[3] = GST_READ_UINT32_LE (data + 18);
-
- GST_DEBUG ("valid bps = %u", valid_bits_per_sample);
- GST_DEBUG ("channel mask = 0x%08x", channel_mask);
- GST_DEBUG ("GUID = %08x-%08x-%08x-%08x", subformat_guid[0],
- subformat_guid[1], subformat_guid[2], subformat_guid[3]);
-
- if (subformat_guid[1] == 0x00100000 &&
- subformat_guid[2] == 0xaa000080 && subformat_guid[3] == 0x719b3800) {
- if (subformat_guid[0] == 0x00000001) {
- GST_DEBUG ("PCM");
- if (strf != NULL) {
- gint ba = strf->blockalign;
- gint wd = ba * 8 / strf->channels;
- gint ws;
-
- /* in riff, the depth is stored in the size field but it just
- * means that the _least_ significant bits are cleared. We can
- * therefore just play the sample as if it had a depth == width */
- ws = wd;
-
- /* For reference, use this to get the actual depth:
- * ws = strf->size;
- * if (valid_bits_per_sample != 0)
- * ws = valid_bits_per_sample; */
-
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
- "channels", G_TYPE_INT, strf->channels,
- "width", G_TYPE_INT, wd,
- "depth", G_TYPE_INT, ws,
- "rate", G_TYPE_INT, strf->rate,
- "signed", G_TYPE_BOOLEAN, wd != 8, NULL);
-
- /* If channel_mask == 0 and channels > 2 let's
- * assume default layout as some wav files don't have the
- * channel mask set. Don't set the layout for 1 or 2
- * channels as it apparently breaks too many things currently. */
- if (channel_mask == 0 && strf->channels > 2)
- channel_mask =
- gst_riff_wavext_get_default_channel_mask (strf->channels);
-
- if ((channel_mask != 0 || strf->channels > 2) &&
- !gst_riff_wavext_add_channel_layout (caps, channel_mask)) {
- GST_WARNING ("failed to add channel layout");
- gst_caps_unref (caps);
- caps = NULL;
- }
- rate_chan = FALSE;
-
- if (codec_name) {
- *codec_name = g_strdup_printf ("Uncompressed %d-bit PCM audio",
- strf->size);
- }
- }
- } else if (subformat_guid[0] == 0x00000003) {
- GST_DEBUG ("FLOAT");
- if (strf != NULL) {
- gint ba = strf->blockalign;
- gint wd = ba * 8 / strf->channels;
-
- caps = gst_caps_new_simple ("audio/x-raw-float",
- "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
- "channels", G_TYPE_INT, strf->channels,
- "width", G_TYPE_INT, wd, "rate", G_TYPE_INT, strf->rate, NULL);
-
- /* If channel_mask == 0 and channels > 2 let's
- * assume default layout as some wav files don't have the
- * channel mask set. Don't set the layout for 1 or 2
- * channels as it apparently breaks too many things currently. */
- if (channel_mask == 0 && strf->channels > 2)
- channel_mask =
- gst_riff_wavext_get_default_channel_mask (strf->channels);
-
- if ((channel_mask != 0 || strf->channels > 2) &&
- !gst_riff_wavext_add_channel_layout (caps, channel_mask)) {
- GST_WARNING ("failed to add channel layout");
- gst_caps_unref (caps);
- caps = NULL;
- }
- rate_chan = FALSE;
-
- if (codec_name) {
- *codec_name =
- g_strdup_printf ("Uncompressed %d-bit IEEE float audio",
- strf->size);
- }
- }
- } else if (subformat_guid[0] == 00000006) {
- GST_DEBUG ("ALAW");
- if (strf != NULL) {
- if (strf->size != 8) {
- GST_WARNING ("invalid depth (%d) of alaw audio, overwriting.",
- strf->size);
- strf->size = 8;
- strf->av_bps = 8;
- strf->blockalign = strf->av_bps * strf->channels;
- }
- if (strf->av_bps == 0 || strf->blockalign == 0) {
- GST_WARNING
- ("fixing av_bps (%d) and blockalign (%d) of alaw audio",
- strf->av_bps, strf->blockalign);
- strf->av_bps = strf->size;
- strf->blockalign = strf->av_bps * strf->channels;
- }
- }
- rate_max = 48000;
- caps = gst_caps_new_simple ("audio/x-alaw", NULL);
-
- if (codec_name)
- *codec_name = g_strdup ("A-law audio");
- } else if (subformat_guid[0] == 0x00000007) {
- GST_DEBUG ("MULAW");
- if (strf != NULL) {
- if (strf->size != 8) {
- GST_WARNING ("invalid depth (%d) of mulaw audio, overwriting.",
- strf->size);
- strf->size = 8;
- strf->av_bps = 8;
- strf->blockalign = strf->av_bps * strf->channels;
- }
- if (strf->av_bps == 0 || strf->blockalign == 0) {
- GST_WARNING
- ("fixing av_bps (%d) and blockalign (%d) of mulaw audio",
- strf->av_bps, strf->blockalign);
- strf->av_bps = strf->size;
- strf->blockalign = strf->av_bps * strf->channels;
- }
- }
- rate_max = 48000;
- caps = gst_caps_new_simple ("audio/x-mulaw", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Mu-law audio");
- } else if (subformat_guid[0] == 0x00000092) {
- GST_DEBUG ("FIXME: handle DOLBY AC3 SPDIF format");
- }
- } else if (subformat_guid[0] == 0x6ba47966 &&
- subformat_guid[1] == 0x41783f83 &&
- subformat_guid[2] == 0xf0006596 && subformat_guid[3] == 0xe59262bf) {
- caps = gst_caps_new_simple ("application/x-ogg-avi", NULL);
- if (codec_name)
- *codec_name = g_strdup ("Ogg-AVI");
- }
-
- if (caps == NULL) {
- GST_WARNING ("Unknown WAVE_FORMAT_EXTENSIBLE audio format");
- return NULL;
- }
- break;
- }
- /* can anything decode these? pitfdll? */
- case GST_RIFF_WAVE_FORMAT_VOXWARE_AC8:
- case GST_RIFF_WAVE_FORMAT_VOXWARE_AC10:
- case GST_RIFF_WAVE_FORMAT_VOXWARE_AC16:
- case GST_RIFF_WAVE_FORMAT_VOXWARE_AC20:
- case GST_RIFF_WAVE_FORMAT_VOXWARE_METAVOICE:
- case GST_RIFF_WAVE_FORMAT_VOXWARE_METASOUND:
- case GST_RIFF_WAVE_FORMAT_VOXWARE_RT29HW:
- case GST_RIFF_WAVE_FORMAT_VOXWARE_VR12:
- case GST_RIFF_WAVE_FORMAT_VOXWARE_VR18:
- case GST_RIFF_WAVE_FORMAT_VOXWARE_TQ40:
- case GST_RIFF_WAVE_FORMAT_VOXWARE_TQ60:{
- caps = gst_caps_new_simple ("audio/x-voxware",
- "voxwaretype", G_TYPE_INT, (gint) codec_id, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Voxware");
- break;
- }
- default:
- unknown:
- GST_WARNING ("Unknown audio tag 0x%04x", codec_id);
- return NULL;
- }
-
- if (strf != NULL) {
- if (rate_chan) {
- if (strf->channels > channels_max)
- goto too_many_channels;
- if (strf->rate < rate_min || strf->rate > rate_max)
- goto invalid_rate;
-
- gst_caps_set_simple (caps,
- "rate", G_TYPE_INT, strf->rate,
- "channels", G_TYPE_INT, strf->channels, NULL);
- }
- if (block_align) {
- gst_caps_set_simple (caps,
- "block_align", G_TYPE_INT, strf->blockalign, NULL);
- }
- } else {
- if (rate_chan) {
- if (rate_min == rate_max)
- gst_caps_set_simple (caps, "rate", G_TYPE_INT, rate_min, NULL);
- else
- gst_caps_set_simple (caps,
- "rate", GST_TYPE_INT_RANGE, rate_min, rate_max, NULL);
- if (channels_max == 1)
- gst_caps_set_simple (caps, "channels", G_TYPE_INT, 1, NULL);
- else
- gst_caps_set_simple (caps,
- "channels", GST_TYPE_INT_RANGE, 1, channels_max, NULL);
- }
- if (block_align) {
- gst_caps_set_simple (caps,
- "block_align", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
- }
- }
-
- /* extradata */
- if (strf_data || strd_data) {
- gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER,
- strf_data ? strf_data : strd_data, NULL);
- }
-
- return caps;
-
- /* ERROR */
-too_many_channels:
- GST_WARNING
- ("Stream claims to contain %u channels, but format only supports %d",
- strf->channels, channels_max);
- gst_caps_unref (caps);
- return NULL;
-invalid_rate:
- GST_WARNING
- ("Stream with sample_rate %u, but format only supports %d .. %d",
- strf->rate, rate_min, rate_max);
- gst_caps_unref (caps);
- return NULL;
-}
-
-GstCaps *
-gst_riff_create_iavs_caps (guint32 codec_fcc,
- gst_riff_strh * strh, gst_riff_strf_iavs * strf,
- GstBuffer * init_data, GstBuffer * extra_data, char **codec_name)
-{
- GstCaps *caps = NULL;
-
- switch (codec_fcc) {
- /* is this correct? */
- case GST_MAKE_FOURCC ('D', 'V', 'S', 'D'):
- case GST_MAKE_FOURCC ('d', 'v', 's', 'd'):
- caps = gst_caps_new_simple ("video/x-dv",
- "systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
- if (codec_name)
- *codec_name = g_strdup ("Generic DV");
- break;
-
- default:
- GST_WARNING ("Unknown IAVS fourcc %" GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (codec_fcc));
- return NULL;
- }
-
- return caps;
-}
-
-/*
- * Functions below are for template caps. All is variable.
- */
-
-GstCaps *
-gst_riff_create_video_template_caps (void)
-{
- static const guint32 tags[] = {
- GST_MAKE_FOURCC ('3', 'I', 'V', '1'),
- GST_MAKE_FOURCC ('A', 'S', 'V', '1'),
- GST_MAKE_FOURCC ('A', 'S', 'V', '2'),
- GST_MAKE_FOURCC ('C', 'L', 'J', 'R'),
- GST_MAKE_FOURCC ('C', 'Y', 'U', 'V'),
- GST_MAKE_FOURCC ('D', 'I', 'B', ' '),
- GST_MAKE_FOURCC ('D', 'I', 'V', '3'),
- GST_MAKE_FOURCC ('D', 'I', 'V', 'X'),
- GST_MAKE_FOURCC ('D', 'U', 'C', 'K'),
- GST_MAKE_FOURCC ('D', 'V', 'S', 'D'),
- GST_MAKE_FOURCC ('D', 'V', '5', '0'),
- GST_MAKE_FOURCC ('D', 'X', '5', '0'),
- GST_MAKE_FOURCC ('M', '4', 'C', 'C'),
- GST_MAKE_FOURCC ('F', 'L', 'V', '1'),
- GST_MAKE_FOURCC ('H', '2', '6', '3'),
- GST_MAKE_FOURCC ('V', 'X', '1', 'K'),
- GST_MAKE_FOURCC ('H', '2', '6', '4'),
- GST_MAKE_FOURCC ('H', 'F', 'Y', 'U'),
- GST_MAKE_FOURCC ('I', '2', '6', '3'),
- GST_MAKE_FOURCC ('I', '4', '2', '0'),
- GST_MAKE_FOURCC ('I', 'V', '3', '2'),
- GST_MAKE_FOURCC ('I', 'V', '4', '1'),
- GST_MAKE_FOURCC ('I', 'V', '5', '0'),
- GST_MAKE_FOURCC ('L', '2', '6', '3'),
- GST_MAKE_FOURCC ('L', '2', '6', '4'),
- GST_MAKE_FOURCC ('M', '2', '6', '3'),
- GST_MAKE_FOURCC ('M', '4', 'S', '2'),
- GST_MAKE_FOURCC ('M', 'J', 'P', 'G'),
- GST_MAKE_FOURCC ('M', 'P', '4', '2'),
- GST_MAKE_FOURCC ('M', 'P', '4', '3'),
- GST_MAKE_FOURCC ('M', 'P', 'E', 'G'),
- GST_MAKE_FOURCC ('M', 'P', 'G', '2'),
- GST_MAKE_FOURCC ('M', 'P', 'G', '4'),
- GST_MAKE_FOURCC ('M', 'S', 'Z', 'H'),
- GST_MAKE_FOURCC ('P', 'N', 'G', ' '),
- GST_MAKE_FOURCC ('R', 'L', 'E', ' '),
- GST_MAKE_FOURCC ('R', 'T', '2', '1'),
- GST_MAKE_FOURCC ('S', 'P', '5', '3'),
- GST_MAKE_FOURCC ('T', 'M', '2', '0'),
- GST_MAKE_FOURCC ('T', 'S', 'C', 'C'),
- GST_MAKE_FOURCC ('U', 'L', 'T', 'I'),
- GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'),
- GST_MAKE_FOURCC ('V', 'C', 'R', '1'),
- GST_MAKE_FOURCC ('V', 'C', 'R', '2'),
- GST_MAKE_FOURCC ('V', 'D', 'O', 'W'),
- GST_MAKE_FOURCC ('V', 'I', 'V', 'O'),
- GST_MAKE_FOURCC ('V', 'M', 'n', 'c'),
- GST_MAKE_FOURCC ('V', 'P', '3', ' '),
- GST_MAKE_FOURCC ('V', 'S', 'S', 'H'),
- GST_MAKE_FOURCC ('W', 'M', 'V', '1'),
- GST_MAKE_FOURCC ('W', 'M', 'V', '2'),
- GST_MAKE_FOURCC ('W', 'M', 'V', '3'),
- GST_MAKE_FOURCC ('X', 'V', 'I', 'D'),
- GST_MAKE_FOURCC ('X', 'x', 'a', 'n'),
- GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
- GST_MAKE_FOURCC ('Y', 'V', 'U', '9'),
- GST_MAKE_FOURCC ('Z', 'L', 'I', 'B'),
- GST_MAKE_FOURCC ('c', 'v', 'i', 'd'),
- GST_MAKE_FOURCC ('h', '2', '6', '4'),
- GST_MAKE_FOURCC ('m', 's', 'v', 'c'),
- GST_MAKE_FOURCC ('x', '2', '6', '3'),
- GST_MAKE_FOURCC ('d', 'r', 'a', 'c'),
- GST_MAKE_FOURCC ('F', 'F', 'V', '1'),
- GST_MAKE_FOURCC ('K', 'M', 'V', 'C'),
- GST_MAKE_FOURCC ('V', 'P', '5', '0'),
- GST_MAKE_FOURCC ('V', 'P', '6', '0'),
- GST_MAKE_FOURCC ('L', 'M', '2', '0'),
- GST_MAKE_FOURCC ('R', 'P', 'Z', 'A'),
- GST_MAKE_FOURCC ('T', 'H', 'E', 'O'),
- GST_MAKE_FOURCC ('F', 'P', 'S', '1'),
- GST_MAKE_FOURCC ('A', 'A', 'S', 'C'),
- GST_MAKE_FOURCC ('Y', 'V', '1', '2'),
- GST_MAKE_FOURCC ('L', 'O', 'C', 'O'),
- GST_MAKE_FOURCC ('Z', 'M', 'B', 'V'),
- /* FILL ME */
- };
- guint i;
- GstCaps *caps, *one;
-
- caps = gst_caps_new_empty ();
- for (i = 0; i < G_N_ELEMENTS (tags); i++) {
- one = gst_riff_create_video_caps (tags[i], NULL, NULL, NULL, NULL, NULL);
- if (one)
- gst_caps_append (caps, one);
- }
-
- return caps;
-}
-
-GstCaps *
-gst_riff_create_audio_template_caps (void)
-{
- static const guint16 tags[] = {
- GST_RIFF_WAVE_FORMAT_GSM610,
- GST_RIFF_WAVE_FORMAT_MPEGL3,
- GST_RIFF_WAVE_FORMAT_MPEGL12,
- GST_RIFF_WAVE_FORMAT_PCM,
- GST_RIFF_WAVE_FORMAT_VORBIS1,
- GST_RIFF_WAVE_FORMAT_A52,
- GST_RIFF_WAVE_FORMAT_DTS,
- GST_RIFF_WAVE_FORMAT_AAC,
- GST_RIFF_WAVE_FORMAT_ALAW,
- GST_RIFF_WAVE_FORMAT_MULAW,
- GST_RIFF_WAVE_FORMAT_WMS,
- GST_RIFF_WAVE_FORMAT_ADPCM,
- GST_RIFF_WAVE_FORMAT_DVI_ADPCM,
- GST_RIFF_WAVE_FORMAT_DSP_TRUESPEECH,
- GST_RIFF_WAVE_FORMAT_WMAV1,
- GST_RIFF_WAVE_FORMAT_WMAV2,
- GST_RIFF_WAVE_FORMAT_WMAV3,
- GST_RIFF_WAVE_FORMAT_SONY_ATRAC3,
- GST_RIFF_WAVE_FORMAT_IEEE_FLOAT,
- GST_RIFF_WAVE_FORMAT_VOXWARE_METASOUND,
- GST_RIFF_WAVE_FORMAT_ADPCM_IMA_DK4,
- GST_RIFF_WAVE_FORMAT_ADPCM_IMA_DK3,
- GST_RIFF_WAVE_FORMAT_ADPCM_IMA_WAV,
- GST_RIFF_WAVE_FORMAT_AMR_NB,
- GST_RIFF_WAVE_FORMAT_AMR_WB,
- GST_RIFF_WAVE_FORMAT_SIREN,
- /* FILL ME */
- };
- guint i;
- GstCaps *caps, *one;
-
- caps = gst_caps_new_empty ();
- for (i = 0; i < G_N_ELEMENTS (tags); i++) {
- one = gst_riff_create_audio_caps (tags[i], NULL, NULL, NULL, NULL, NULL);
- if (one)
- gst_caps_append (caps, one);
- }
- one = gst_caps_new_simple ("application/x-ogg-avi", NULL);
- gst_caps_append (caps, one);
-
- return caps;
-}
-
-GstCaps *
-gst_riff_create_iavs_template_caps (void)
-{
- static const guint32 tags[] = {
- GST_MAKE_FOURCC ('D', 'V', 'S', 'D')
- /* FILL ME */
- };
- guint i;
- GstCaps *caps, *one;
-
- caps = gst_caps_new_empty ();
- for (i = 0; i < G_N_ELEMENTS (tags); i++) {
- one = gst_riff_create_iavs_caps (tags[i], NULL, NULL, NULL, NULL, NULL);
- if (one)
- gst_caps_append (caps, one);
- }
-
- return caps;
-}
diff --git a/gst-libs/gst/riff/riff-media.h b/gst-libs/gst/riff/riff-media.h
deleted file mode 100644
index cc09fd8b..00000000
--- a/gst-libs/gst/riff/riff-media.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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.
- */
-
-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);
-
-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);
-
-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).
- */
-
-GstCaps * gst_riff_create_video_template_caps (void);
-GstCaps * gst_riff_create_audio_template_caps (void);
-GstCaps * gst_riff_create_iavs_template_caps (void);
-
-G_END_DECLS
-
-#endif /* __GST_RIFF_READ_H__ */
diff --git a/gst-libs/gst/riff/riff-read.c b/gst-libs/gst/riff/riff-read.c
deleted file mode 100644
index e5983be5..00000000
--- a/gst-libs/gst/riff/riff-read.c
+++ /dev/null
@@ -1,749 +0,0 @@
-/* GStreamer RIFF I/O
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * riff-read.c: RIFF input file parsing
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <gst/gstutils.h>
-#include <gst/tag/tag.h>
-
-#include "riff-read.h"
-
-GST_DEBUG_CATEGORY_EXTERN (riff_debug);
-#define GST_CAT_DEFAULT riff_debug
-
-/**
- * gst_riff_read_chunk:
- * @element: caller element (used for debugging).
- * @pad: pad to pull data from.
- * @offset: offset to pull from, incremented by this function.
- * @tag: fourcc of the chunk (returned by this function).
- * @chunk_data: buffer (returned by this function).
- *
- * Reads a single chunk of data. Since 0.10.8 'JUNK' chunks
- * are skipped automatically.
- *
- * Returns: flow status.
- */
-
-GstFlowReturn
-gst_riff_read_chunk (GstElement * element,
- GstPad * pad, guint64 * _offset, guint32 * tag, GstBuffer ** _chunk_data)
-{
- GstBuffer *buf;
- GstFlowReturn res;
- guint size;
- guint64 offset = *_offset;
-
- g_return_val_if_fail (element != NULL, GST_FLOW_ERROR);
- g_return_val_if_fail (pad != NULL, GST_FLOW_ERROR);
- g_return_val_if_fail (_offset != NULL, GST_FLOW_ERROR);
- g_return_val_if_fail (tag != NULL, GST_FLOW_ERROR);
- g_return_val_if_fail (_chunk_data != NULL, GST_FLOW_ERROR);
-
-skip_junk:
- size = 8;
- if ((res = gst_pad_pull_range (pad, offset, size, &buf)) != GST_FLOW_OK)
- return res;
- else if (GST_BUFFER_SIZE (buf) < size)
- goto too_small;
-
- *tag = GST_READ_UINT32_LE (GST_BUFFER_DATA (buf));
- size = GST_READ_UINT32_LE (GST_BUFFER_DATA (buf) + 4);
- gst_buffer_unref (buf);
-
- GST_DEBUG_OBJECT (element, "fourcc=%" GST_FOURCC_FORMAT ", size=%u",
- GST_FOURCC_ARGS (*tag), size);
-
- /* skip 'JUNK' chunks */
- if (*tag == GST_RIFF_TAG_JUNK || *tag == GST_RIFF_TAG_JUNQ) {
- size = GST_ROUND_UP_2 (size);
- *_offset += 8 + size;
- offset += 8 + size;
- GST_DEBUG_OBJECT (element, "skipping JUNK chunk");
- goto skip_junk;
- }
-
- if ((res = gst_pad_pull_range (pad, offset + 8, size, &buf)) != GST_FLOW_OK)
- return res;
- else if (GST_BUFFER_SIZE (buf) < size)
- goto too_small;
-
- *_chunk_data = buf;
- *_offset += 8 + GST_ROUND_UP_2 (size);
-
- return GST_FLOW_OK;
-
- /* ERRORS */
-too_small:
- {
- /* short read, we return UNEXPECTED to mark the EOS case */
- GST_DEBUG_OBJECT (element, "not enough data (available=%u, needed=%u)",
- GST_BUFFER_SIZE (buf), size);
- gst_buffer_unref (buf);
- return GST_FLOW_UNEXPECTED;
- }
-}
-
-/**
- * gst_riff_parse_chunk:
- * @element: caller element (used for debugging).
- * @buf: input buffer.
- * @offset: offset in the buffer in the caller. Is incremented
- * by the read size by this function.
- * @fourcc: fourcc (returned by this function0 of the chunk.
- * @chunk_data: buffer (returned by the function) containing the
- * chunk data, which may be NULL if chunksize == 0
- *
- * Reads a single chunk.
- *
- * Returns: FALSE on error, TRUE otherwise
- */
-gboolean
-gst_riff_parse_chunk (GstElement * element, GstBuffer * buf,
- guint * _offset, guint32 * _fourcc, GstBuffer ** chunk_data)
-{
- guint size, bufsize;
- guint32 fourcc;
- guint8 *data;
- guint offset = *_offset;
-
- g_return_val_if_fail (element != NULL, FALSE);
- g_return_val_if_fail (buf != NULL, FALSE);
- g_return_val_if_fail (_offset != NULL, FALSE);
- g_return_val_if_fail (_fourcc != NULL, FALSE);
- g_return_val_if_fail (chunk_data != NULL, FALSE);
-
- *chunk_data = NULL;
- *_fourcc = 0;
-
- bufsize = GST_BUFFER_SIZE (buf);
-
- if (bufsize == offset)
- goto end_offset;
-
- if (bufsize < offset + 8)
- goto too_small;
-
- /* read header */
- data = GST_BUFFER_DATA (buf) + offset;
- fourcc = GST_READ_UINT32_LE (data);
- size = GST_READ_UINT32_LE (data + 4);
-
- GST_DEBUG_OBJECT (element, "fourcc=%" GST_FOURCC_FORMAT ", size=%u",
- GST_FOURCC_ARGS (fourcc), size);
-
- /* be paranoid: size may be nonsensical value here, such as (guint) -1 */
- if (G_UNLIKELY (size > G_MAXINT))
- goto bogus_size;
-
- if (bufsize < size + 8 + offset) {
- GST_DEBUG_OBJECT (element,
- "Needed chunk data (%d) is more than available (%d), shortcutting",
- size, bufsize - 8 - offset);
- size = bufsize - 8 - offset;
- }
-
- if (size)
- *chunk_data = gst_buffer_create_sub (buf, offset + 8, size);
- else
- *chunk_data = NULL;
-
- *_fourcc = fourcc;
- *_offset += 8 + GST_ROUND_UP_2 (size);
-
- return TRUE;
-
- /* ERRORS */
-end_offset:
- {
- GST_DEBUG_OBJECT (element, "End of chunk (offset %d)", offset);
- return FALSE;
- }
-too_small:
- {
- GST_DEBUG_OBJECT (element,
- "Failed to parse chunk header (offset %d, %d available, %d needed)",
- offset, bufsize, 8);
- return FALSE;
- }
-bogus_size:
- {
- GST_ERROR_OBJECT (element, "Broken file: bogus chunk size %u", size);
- return FALSE;
- }
-}
-
-/**
- * gst_riff_parse_file_header:
- * @element: caller element (used for debugging/error).
- * @buf: input buffer from which the file header will be parsed,
- * should be at least 12 bytes long.
- * @doctype: a fourcc (returned by this function) to indicate the
- * type of document (according to the header).
- *
- * Reads the first few bytes from the provided buffer, checks
- * if this stream is a RIFF stream, and determines document type.
- * This function takes ownership of @buf so it should not be used anymore
- * after calling this function.
- *
- * Returns: FALSE if this is not a RIFF stream (in which case the
- * caller should error out; we already throw an error), or TRUE
- * if it is.
- */
-gboolean
-gst_riff_parse_file_header (GstElement * element,
- GstBuffer * buf, guint32 * doctype)
-{
- guint8 *data;
- guint32 tag;
-
- g_return_val_if_fail (buf != NULL, FALSE);
- g_return_val_if_fail (doctype != NULL, FALSE);
-
- if (GST_BUFFER_SIZE (buf) < 12)
- goto too_small;
-
- data = GST_BUFFER_DATA (buf);
- tag = GST_READ_UINT32_LE (data);
- if (tag != GST_RIFF_TAG_RIFF && tag != GST_RIFF_TAG_AVF0)
- goto not_riff;
-
- *doctype = GST_READ_UINT32_LE (data + 8);
-
- gst_buffer_unref (buf);
-
- return TRUE;
-
- /* ERRORS */
-too_small:
- {
- GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL),
- ("Not enough data to parse RIFF header (%d available, %d needed)",
- GST_BUFFER_SIZE (buf), 12));
- gst_buffer_unref (buf);
- return FALSE;
- }
-not_riff:
- {
- GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL),
- ("Stream is no RIFF stream: %" GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (tag)));
- gst_buffer_unref (buf);
- return FALSE;
- }
-}
-
-/**
- * gst_riff_parse_strh:
- * @element: caller element (used for debugging/error).
- * @buf: input data to be used for parsing, stripped from header.
- * @strh: a pointer (returned by this function) to a filled-in
- * strh structure. Caller should free it.
- *
- * Parses a strh structure from input data. Takes ownership of @buf.
- *
- * Returns: TRUE if parsing succeeded, otherwise FALSE. The stream
- * should be skipped on error, but it is not fatal.
- */
-
-gboolean
-gst_riff_parse_strh (GstElement * element,
- GstBuffer * buf, gst_riff_strh ** _strh)
-{
- gst_riff_strh *strh;
-
- g_return_val_if_fail (buf != NULL, FALSE);
- g_return_val_if_fail (_strh != NULL, FALSE);
-
- if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strh))
- goto too_small;
-
- strh = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
- gst_buffer_unref (buf);
-
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- strh->type = GUINT32_FROM_LE (strh->type);
- strh->fcc_handler = GUINT32_FROM_LE (strh->fcc_handler);
- strh->flags = GUINT32_FROM_LE (strh->flags);
- strh->priority = GUINT32_FROM_LE (strh->priority);
- strh->init_frames = GUINT32_FROM_LE (strh->init_frames);
- strh->scale = GUINT32_FROM_LE (strh->scale);
- strh->rate = GUINT32_FROM_LE (strh->rate);
- strh->start = GUINT32_FROM_LE (strh->start);
- strh->length = GUINT32_FROM_LE (strh->length);
- strh->bufsize = GUINT32_FROM_LE (strh->bufsize);
- strh->quality = GUINT32_FROM_LE (strh->quality);
- strh->samplesize = GUINT32_FROM_LE (strh->samplesize);
-#endif
-
- /* avoid divisions by zero */
- if (!strh->scale)
- strh->scale = 1;
- if (!strh->rate)
- strh->rate = 1;
-
- /* debug */
- GST_INFO_OBJECT (element, "strh tag found:");
- GST_INFO_OBJECT (element, " type %" GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (strh->type));
- GST_INFO_OBJECT (element, " fcc_handler %" GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (strh->fcc_handler));
- GST_INFO_OBJECT (element, " flags 0x%08x", strh->flags);
- GST_INFO_OBJECT (element, " priority %d", strh->priority);
- GST_INFO_OBJECT (element, " init_frames %d", strh->init_frames);
- GST_INFO_OBJECT (element, " scale %d", strh->scale);
- GST_INFO_OBJECT (element, " rate %d", strh->rate);
- GST_INFO_OBJECT (element, " start %d", strh->start);
- GST_INFO_OBJECT (element, " length %d", strh->length);
- GST_INFO_OBJECT (element, " bufsize %d", strh->bufsize);
- GST_INFO_OBJECT (element, " quality %d", strh->quality);
- GST_INFO_OBJECT (element, " samplesize %d", strh->samplesize);
-
- *_strh = strh;
-
- return TRUE;
-
- /* ERRORS */
-too_small:
- {
- GST_ERROR_OBJECT (element,
- "Too small strh (%d available, %d needed)",
- GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strh));
- gst_buffer_unref (buf);
- return FALSE;
- }
-}
-
-/**
- * gst_riff_parse_strf_vids:
- * @element: caller element (used for debugging/error).
- * @buf: input data to be used for parsing, stripped from header.
- * @strf: a pointer (returned by this function) to a filled-in
- * strf/vids structure. Caller should free it.
- * @data: a pointer (returned by this function) to a buffer
- * containing extradata for this particular stream (e.g.
- * palette, codec initialization data).
- *
- * Parses a video stream´s strf structure plus optionally some
- * extradata from input data. This function takes ownership of @buf.
- *
- * Returns: TRUE if parsing succeeded, otherwise FALSE. The stream
- * should be skipped on error, but it is not fatal.
- */
-
-gboolean
-gst_riff_parse_strf_vids (GstElement * element,
- GstBuffer * buf, gst_riff_strf_vids ** _strf, GstBuffer ** data)
-{
- gst_riff_strf_vids *strf;
-
- g_return_val_if_fail (buf != NULL, FALSE);
- g_return_val_if_fail (_strf != NULL, FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
-
- if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_vids))
- goto too_small;
-
- strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
-
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- strf->size = GUINT32_FROM_LE (strf->size);
- strf->width = GUINT32_FROM_LE (strf->width);
- strf->height = GUINT32_FROM_LE (strf->height);
- strf->planes = GUINT16_FROM_LE (strf->planes);
- strf->bit_cnt = GUINT16_FROM_LE (strf->bit_cnt);
- strf->compression = GUINT32_FROM_LE (strf->compression);
- strf->image_size = GUINT32_FROM_LE (strf->image_size);
- strf->xpels_meter = GUINT32_FROM_LE (strf->xpels_meter);
- strf->ypels_meter = GUINT32_FROM_LE (strf->ypels_meter);
- strf->num_colors = GUINT32_FROM_LE (strf->num_colors);
- strf->imp_colors = GUINT32_FROM_LE (strf->imp_colors);
-#endif
-
- /* size checking */
- *data = NULL;
- if (strf->size > GST_BUFFER_SIZE (buf)) {
- GST_WARNING_OBJECT (element,
- "strf_vids header gave %d bytes data, only %d available",
- strf->size, GST_BUFFER_SIZE (buf));
- strf->size = GST_BUFFER_SIZE (buf);
- }
- if (sizeof (gst_riff_strf_vids) < GST_BUFFER_SIZE (buf)) {
- *data = gst_buffer_create_sub (buf, sizeof (gst_riff_strf_vids),
- GST_BUFFER_SIZE (buf) - sizeof (gst_riff_strf_vids));
- }
-
- /* debug */
- GST_INFO_OBJECT (element, "strf tag found in context vids:");
- GST_INFO_OBJECT (element, " size %d", strf->size);
- GST_INFO_OBJECT (element, " width %d", strf->width);
- GST_INFO_OBJECT (element, " height %d", strf->height);
- GST_INFO_OBJECT (element, " planes %d", strf->planes);
- GST_INFO_OBJECT (element, " bit_cnt %d", strf->bit_cnt);
- GST_INFO_OBJECT (element, " compression %" GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (strf->compression));
- GST_INFO_OBJECT (element, " image_size %d", strf->image_size);
- GST_INFO_OBJECT (element, " xpels_meter %d", strf->xpels_meter);
- GST_INFO_OBJECT (element, " ypels_meter %d", strf->ypels_meter);
- GST_INFO_OBJECT (element, " num_colors %d", strf->num_colors);
- GST_INFO_OBJECT (element, " imp_colors %d", strf->imp_colors);
- if (*data)
- GST_INFO_OBJECT (element, " %d bytes extradata", GST_BUFFER_SIZE (*data));
-
- gst_buffer_unref (buf);
-
- *_strf = strf;
-
- return TRUE;
-
- /* ERRORS */
-too_small:
- {
- GST_ERROR_OBJECT (element,
- "Too small strf_vids (%d available, %d needed)",
- GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_vids));
- gst_buffer_unref (buf);
- return FALSE;
- }
-}
-
-/**
- * gst_riff_parse_strf_auds:
- * @element: caller element (used for debugging/error).
- * @buf: input data to be used for parsing, stripped from header.
- * @strf: a pointer (returned by this function) to a filled-in
- * strf/auds structure. Caller should free it.
- * @data: a pointer (returned by this function) to a buffer
- * containing extradata for this particular stream (e.g.
- * codec initialization data).
- *
- * Parses an audio stream´s strf structure plus optionally some
- * extradata from input data. This function takes ownership of @buf.
- * use.
- *
- * Returns: TRUE if parsing succeeded, otherwise FALSE. The stream
- * should be skipped on error, but it is not fatal.
- */
-gboolean
-gst_riff_parse_strf_auds (GstElement * element,
- GstBuffer * buf, gst_riff_strf_auds ** _strf, GstBuffer ** data)
-{
- gst_riff_strf_auds *strf;
- guint bufsize;
-
- g_return_val_if_fail (buf != NULL, FALSE);
- g_return_val_if_fail (_strf != NULL, FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
-
- bufsize = GST_BUFFER_SIZE (buf);
-
- if (bufsize < sizeof (gst_riff_strf_auds))
- goto too_small;
-
- strf = g_memdup (GST_BUFFER_DATA (buf), bufsize);
-
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- strf->format = GUINT16_FROM_LE (strf->format);
- strf->channels = GUINT16_FROM_LE (strf->channels);
- strf->rate = GUINT32_FROM_LE (strf->rate);
- strf->av_bps = GUINT32_FROM_LE (strf->av_bps);
- strf->blockalign = GUINT16_FROM_LE (strf->blockalign);
- strf->size = GUINT16_FROM_LE (strf->size);
-#endif
-
- /* size checking */
- *data = NULL;
- if (bufsize > sizeof (gst_riff_strf_auds) + 2) {
- gint len;
-
- len = GST_READ_UINT16_LE (&GST_BUFFER_DATA (buf)[16]);
- if (len + 2 + sizeof (gst_riff_strf_auds) > bufsize) {
- GST_WARNING_OBJECT (element,
- "Extradata indicated %d bytes, but only %" G_GSSIZE_FORMAT
- " available", len, bufsize - 2 - sizeof (gst_riff_strf_auds));
- len = bufsize - 2 - sizeof (gst_riff_strf_auds);
- }
- if (len)
- *data = gst_buffer_create_sub (buf, sizeof (gst_riff_strf_auds) + 2, len);
- }
-
- /* debug */
- GST_INFO_OBJECT (element, "strf tag found in context auds:");
- GST_INFO_OBJECT (element, " format %d", strf->format);
- GST_INFO_OBJECT (element, " channels %d", strf->channels);
- GST_INFO_OBJECT (element, " rate %d", strf->rate);
- GST_INFO_OBJECT (element, " av_bps %d", strf->av_bps);
- GST_INFO_OBJECT (element, " blockalign %d", strf->blockalign);
- GST_INFO_OBJECT (element, " size %d", strf->size);
- if (*data)
- GST_INFO_OBJECT (element, " %d bytes extradata", GST_BUFFER_SIZE (*data));
-
- gst_buffer_unref (buf);
-
- *_strf = strf;
-
- return TRUE;
-
- /* ERROR */
-too_small:
- {
- GST_ERROR_OBJECT (element,
- "Too small strf_auds (%d available, %" G_GSSIZE_FORMAT " needed)",
- bufsize, sizeof (gst_riff_strf_auds));
- gst_buffer_unref (buf);
- return FALSE;
- }
-}
-
-/**
- * gst_riff_parse_strf_iavs:
- * @element: caller element (used for debugging/error).
- * @buf: input data to be used for parsing, stripped from header.
- * @strf: a pointer (returned by this function) to a filled-in
- * strf/iavs structure. Caller should free it.
- * @data: a pointer (returned by this function) to a buffer
- * containing extradata for this particular stream (e.g.
- * codec initialization data).
- *
- * Parses a interleaved (also known as "complex") stream´s strf
- * structure plus optionally some extradata from input data. This
- * function takes ownership of @buf.
- *
- * Returns: TRUE if parsing succeeded, otherwise FALSE.
- */
-
-gboolean
-gst_riff_parse_strf_iavs (GstElement * element,
- GstBuffer * buf, gst_riff_strf_iavs ** _strf, GstBuffer ** data)
-{
- gst_riff_strf_iavs *strf;
-
- g_return_val_if_fail (buf != NULL, FALSE);
- g_return_val_if_fail (_strf != NULL, FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
-
- if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_iavs))
- goto too_small;
-
- strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
- gst_buffer_unref (buf);
-
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- strf->DVAAuxSrc = GUINT32_FROM_LE (strf->DVAAuxSrc);
- strf->DVAAuxCtl = GUINT32_FROM_LE (strf->DVAAuxCtl);
- strf->DVAAuxSrc1 = GUINT32_FROM_LE (strf->DVAAuxSrc1);
- strf->DVAAuxCtl1 = GUINT32_FROM_LE (strf->DVAAuxCtl1);
- strf->DVVAuxSrc = GUINT32_FROM_LE (strf->DVVAuxSrc);
- strf->DVVAuxCtl = GUINT32_FROM_LE (strf->DVVAuxCtl);
- strf->DVReserved1 = GUINT32_FROM_LE (strf->DVReserved1);
- strf->DVReserved2 = GUINT32_FROM_LE (strf->DVReserved2);
-#endif
-
- /* debug */
- GST_INFO_OBJECT (element, "strf tag found in context iavs:");
- GST_INFO_OBJECT (element, " DVAAuxSrc %08x", strf->DVAAuxSrc);
- GST_INFO_OBJECT (element, " DVAAuxCtl %08x", strf->DVAAuxCtl);
- GST_INFO_OBJECT (element, " DVAAuxSrc1 %08x", strf->DVAAuxSrc1);
- GST_INFO_OBJECT (element, " DVAAuxCtl1 %08x", strf->DVAAuxCtl1);
- GST_INFO_OBJECT (element, " DVVAuxSrc %08x", strf->DVVAuxSrc);
- GST_INFO_OBJECT (element, " DVVAuxCtl %08x", strf->DVVAuxCtl);
- GST_INFO_OBJECT (element, " DVReserved1 %08x", strf->DVReserved1);
- GST_INFO_OBJECT (element, " DVReserved2 %08x", strf->DVReserved2);
-
- *_strf = strf;
- *data = NULL;
-
- return TRUE;
-
- /* ERRORS */
-too_small:
- {
- GST_ERROR_OBJECT (element,
- "Too small strf_iavs (%d available, %" G_GSSIZE_FORMAT " needed)",
- GST_BUFFER_SIZE (buf), sizeof (gst_riff_strf_iavs));
- gst_buffer_unref (buf);
- return FALSE;
- }
-}
-
-/**
- * gst_riff_parse_info:
- * @element: caller element (used for debugging/error).
- * @buf: input data to be used for parsing, stripped from header.
- * @taglist: a pointer to a taglist (returned by this function)
- * containing information about this stream. May be
- * NULL if no supported tags were found.
- *
- * Parses stream metadata from input data.
- */
-void
-gst_riff_parse_info (GstElement * element,
- GstBuffer * buf, GstTagList ** _taglist)
-{
- guint8 *data;
- guint size, tsize;
- guint32 tag;
- const gchar *type;
- GstTagList *taglist;
-
- g_return_if_fail (_taglist != NULL);
- g_return_if_fail (buf != NULL);
-
- if (!buf) {
- *_taglist = NULL;
- return;
- }
- data = GST_BUFFER_DATA (buf);
- size = GST_BUFFER_SIZE (buf);
- taglist = gst_tag_list_new ();
-
- while (size > 8) {
- tag = GST_READ_UINT32_LE (data);
- tsize = GST_READ_UINT32_LE (data + 4);
- size -= 8;
- data += 8;
-
- GST_DEBUG ("tag %" GST_FOURCC_FORMAT ", size %u",
- GST_FOURCC_ARGS (tag), tsize);
-
- if (tsize > size) {
- GST_WARNING_OBJECT (element,
- "Tagsize %d is larger than available data %d", tsize, size);
- tsize = size;
- }
-
- /* find out the type of metadata */
- switch (tag) {
- case GST_RIFF_INFO_IARL:
- type = GST_TAG_LOCATION;
- break;
- case GST_RIFF_INFO_IART:
- type = GST_TAG_ARTIST;
- break;
- case GST_RIFF_INFO_ICMS:
- type = NULL; /*"Commissioner"; */
- break;
- case GST_RIFF_INFO_ICMT:
- type = GST_TAG_COMMENT;
- break;
- case GST_RIFF_INFO_ICOP:
- type = GST_TAG_COPYRIGHT;
- break;
- case GST_RIFF_INFO_ICRD:
- type = GST_TAG_DATE;
- break;
- case GST_RIFF_INFO_ICRP:
- type = NULL; /*"Cropped"; */
- break;
- case GST_RIFF_INFO_IDIM:
- type = NULL; /*"Dimensions"; */
- break;
- case GST_RIFF_INFO_IDPI:
- type = NULL; /*"Dots per Inch"; */
- break;
- case GST_RIFF_INFO_IENG:
- type = NULL; /*"Engineer"; */
- break;
- case GST_RIFF_INFO_IGNR:
- type = GST_TAG_GENRE;
- break;
- case GST_RIFF_INFO_IKEY:
- type = GST_TAG_KEYWORDS;
- break;
- case GST_RIFF_INFO_ILGT:
- type = NULL; /*"Lightness"; */
- break;
- case GST_RIFF_INFO_IMED:
- type = NULL; /*"Medium"; */
- break;
- case GST_RIFF_INFO_INAM:
- type = GST_TAG_TITLE;
- break;
- case GST_RIFF_INFO_IPLT:
- type = NULL; /*"Palette"; */
- break;
- case GST_RIFF_INFO_IPRD:
- type = NULL; /*"Product"; */
- break;
- case GST_RIFF_INFO_ISBJ:
- type = NULL; /*"Subject"; */
- break;
- case GST_RIFF_INFO_ISFT:
- type = GST_TAG_ENCODER;
- break;
- case GST_RIFF_INFO_ISHP:
- type = NULL; /*"Sharpness"; */
- break;
- case GST_RIFF_INFO_ISRC:
- type = GST_TAG_ISRC;
- break;
- case GST_RIFF_INFO_ISRF:
- type = NULL; /*"Source Form"; */
- break;
- case GST_RIFF_INFO_ITCH:
- type = NULL; /*"Technician"; */
- break;
- default:
- type = NULL;
- GST_WARNING_OBJECT (element,
- "Unknown INFO (metadata) tag entry %" GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (tag));
- break;
- }
-
- if (type != NULL && data[0] != '\0') {
- static const gchar *env_vars[] = { "GST_AVI_TAG_ENCODING",
- "GST_RIFF_TAG_ENCODING", "GST_TAG_ENCODING", NULL
- };
- gchar *val;
-
- val = gst_tag_freeform_string_to_utf8 ((gchar *) data, tsize, env_vars);
-
- if (val) {
- gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, type, val, NULL);
- g_free (val);
- } else {
- GST_WARNING_OBJECT (element, "could not extract %s tag", type);
- }
- }
-
- if (tsize & 1) {
- tsize++;
- if (tsize > size)
- tsize = size;
- }
-
- data += tsize;
- size -= tsize;
- }
-
- if (!gst_tag_list_is_empty (taglist)) {
- *_taglist = taglist;
- } else {
- *_taglist = NULL;
- gst_tag_list_free (taglist);
- }
-
- return;
-}
diff --git a/gst-libs/gst/riff/riff-read.h b/gst-libs/gst/riff/riff-read.h
deleted file mode 100644
index cf07dda2..00000000
--- a/gst-libs/gst/riff/riff-read.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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().
- */
-
-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.
- */
-
-gboolean gst_riff_parse_chunk (GstElement * element,
- GstBuffer * buf,
- guint * offset,
- guint32 * fourcc,
- GstBuffer ** chunk_data);
-
-gboolean gst_riff_parse_file_header (GstElement * element,
- GstBuffer * buf,
- guint32 * doctype);
-
-gboolean gst_riff_parse_strh (GstElement * element,
- GstBuffer * buf,
- gst_riff_strh ** strh);
-
-gboolean gst_riff_parse_strf_vids (GstElement * element,
- GstBuffer * buf,
- gst_riff_strf_vids ** strf,
- GstBuffer ** data);
-gboolean gst_riff_parse_strf_auds (GstElement * element,
- GstBuffer * buf,
- gst_riff_strf_auds ** strf,
- GstBuffer ** data);
-gboolean gst_riff_parse_strf_iavs (GstElement * element,
- GstBuffer * buf,
- gst_riff_strf_iavs ** strf,
- GstBuffer ** data);
-
-void gst_riff_parse_info (GstElement * element,
- GstBuffer * buf,
- GstTagList ** taglist);
-
-/*
- * Init.
- */
-void gst_riff_init (void);
-
-G_END_DECLS
-
-#endif /* __GST_RIFF_READ_H__ */
diff --git a/gst-libs/gst/riff/riff.c b/gst-libs/gst/riff/riff.c
deleted file mode 100644
index a8e267c6..00000000
--- a/gst-libs/gst/riff/riff.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* GStreamer RIFF I/O
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * riff.c: library initialisation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-/**
- * SECTION:gstriff
- * @short_description: Riff fileformat utillity functions.
- *
- * A collection of functions to handle riff base files, such as avi, wav and
- * asf.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-GST_DEBUG_CATEGORY (riff_debug);
-
-/**
- * gst_riff_init:
- *
- * Initialize riff library.
- */
-void
-gst_riff_init (void)
-{
- GST_DEBUG_CATEGORY_INIT (riff_debug, "riff", 0, "RIFF I/O");
-}
diff --git a/gst-libs/gst/riff/riff.def b/gst-libs/gst/riff/riff.def
deleted file mode 100644
index c6ea2089..00000000
--- a/gst-libs/gst/riff/riff.def
+++ /dev/null
@@ -1,27 +0,0 @@
-EXPORTS
- gst_plugin_desc
- gst_riff_read_get_type
- gst_riff_read_element_data
- gst_riff_create_video_template_caps
- gst_riff_create_video_caps
- gst_riff_create_video_caps_with_data
- gst_riff_create_audio_template_caps
- gst_riff_create_audio_caps
- gst_riff_create_audio_caps_with_data
- gst_riff_create_iavs_template_caps
- gst_riff_create_iavs_caps
- gst_riff_read_header
- gst_riff_read_data
- gst_riff_read_seek
- gst_riff_read_skip
- gst_riff_read_info
- gst_riff_read_list
- gst_riff_read_ascii
- gst_riff_read_strh
- gst_riff_read_strf_iavs
- gst_riff_read_strf_auds
- gst_riff_read_strf_auds_with_data
- gst_riff_read_strf_vids_with_data
- gst_riff_peek_tag
- gst_riff_peek_list
- gst_riff_peek_head
diff --git a/gst-libs/gst/riff/riff.vcproj b/gst-libs/gst/riff/riff.vcproj
deleted file mode 100644
index dde87c07..00000000
--- a/gst-libs/gst/riff/riff.vcproj
+++ /dev/null
@@ -1,158 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="riff"
- ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D67890}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../../win32/Debug"
- IntermediateDirectory="../../../win32/Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;RIFF_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstriff.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../../gstreamer/win32/Debug;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
- ModuleDefinitionFile="riff.def"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/riff.pdb"
- SubSystem="2"
- OptimizeReferences="2"
- ImportLibrary="$(OutDir)/gstriff.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../../win32/Release"
- IntermediateDirectory="../../../win32/Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;RIFF_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstriff.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../../gstreamer/win32/Release;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
- ModuleDefinitionFile="riff.def"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/gstriff.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath=".\riff-media.c">
- </File>
- <File
- RelativePath=".\riff-read.c">
- </File>
- <File
- RelativePath=".\riff.c">
- </File>
- <File
- RelativePath=".\riff.def">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- <File
- RelativePath=".\riff-ids.h">
- </File>
- <File
- RelativePath=".\riff-media.h">
- </File>
- <File
- RelativePath=".\riff-read.h">
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/gst-libs/gst/rtp/Makefile.am b/gst-libs/gst/rtp/Makefile.am
deleted file mode 100644
index 42a3bba2..00000000
--- a/gst-libs/gst/rtp/Makefile.am
+++ /dev/null
@@ -1,62 +0,0 @@
-libgstrtpincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/rtp
-
-libgstrtpinclude_HEADERS = gstrtpbuffer.h \
- gstrtcpbuffer.h \
- gstrtppayloads.h \
- gstbasertpaudiopayload.h \
- gstbasertppayload.h \
- gstbasertpdepayload.h
-
-lib_LTLIBRARIES = libgstrtp-@GST_MAJORMINOR@.la
-
-libgstrtp_@GST_MAJORMINOR@_la_SOURCES = gstrtpbuffer.c \
- gstrtcpbuffer.c \
- gstrtppayloads.c \
- gstbasertpaudiopayload.c \
- gstbasertppayload.c \
- gstbasertpdepayload.c
-
-libgstrtp_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
-libgstrtp_@GST_MAJORMINOR@_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS)
-libgstrtp_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
-
-if HAVE_INTROSPECTION
-BUILT_GIRSOURCES = GstRtp-@GST_MAJORMINOR@.gir
-
-gir_headers=$(patsubst %,$(srcdir)/%, $(libgstrtpinclude_HEADERS))
-gir_sources=$(patsubst %,$(srcdir)/%, $(libgstrtp_@GST_MAJORMINOR@_la_SOURCES))
-gir_cincludes=$(patsubst %,--c-include='gst/rtp/%',$(libgstrtpinclude_HEADERS))
-
-GstRtp-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstrtp-@GST_MAJORMINOR@.la
- PKG_CONFIG_PATH="$(PKG_CONFIG_PATH):$(top_builddir)/pkgconfig" \
- $(INTROSPECTION_SCANNER) -v --namespace GstRtp \
- --nsversion=@GST_MAJORMINOR@ \
- --strip-prefix=Gst \
- $(gir_cincludes) \
- -I$(top_srcdir)/gst-libs \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-base-0.10` \
- --library=gstrtp-0.10 \
- --include=Gst-0.10 \
- --include=GstBase-0.10 \
- --libtool="$(top_builddir)/libtool" \
- --pkg gstreamer-0.10 \
- --pkg gstreamer-base-0.10 \
- --output $@ \
- $(gir_headers) \
- $(gir_sources)
-
-# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
-# install anything - we need to install inside our prefix.
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(BUILT_GIRSOURCES)
-
-typelibsdir = $(libdir)/girepository-1.0/
-
-typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
-
-%.typelib: %.gir $(INTROSPECTION_COMPILER)
- $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=$(builddir) --includedir=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst --includedir=`$(PKG_CONFIG) --variable=libdir gstreamer-base-0.10` $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
-CLEANFILES = $(BUILT_GIRSOURCES) $(typelibs_DATA)
-endif
diff --git a/gst-libs/gst/rtp/README b/gst-libs/gst/rtp/README
deleted file mode 100644
index 77253b78..00000000
--- a/gst-libs/gst/rtp/README
+++ /dev/null
@@ -1,66 +0,0 @@
-The RTP libraries
----------------------
-
- RTP Buffers
- -----------
- The real time protocol as described in RFC 3550 requires the use of special
- packets containing an additional RTP header of at least 12 bytes. GStreamer
- provides some helper functions for creating and parsing these RTP headers.
- The result is a normal #GstBuffer with an additional RTP header.
-
- RTP buffers are usually created with gst_rtp_buffer_new_allocate() or
- gst_rtp_buffer_new_allocate_len(). These functions create buffers with a
- preallocated space of memory. It will also ensure that enough memory
- is allocated for the RTP header. The first function is used when the payload
- size is known. gst_rtp_buffer_new_allocate_len() should be used when the size
- of the whole RTP buffer (RTP header + payload) is known.
-
- When receiving RTP buffers from a network, gst_rtp_buffer_new_take_data()
- should be used when the user would like to parse that RTP packet. (TODO Ask
- Wim what the real purpose of this function is as it seems to simply create a
- duplicate GstBuffer with the same data as the previous one). The
- function will create a new RTP buffer with the given data as the whole RTP
- packet. Alternatively, gst_rtp_buffer_new_copy_data() can be used if the user
- wishes to make a copy of the data before using it in the new RTP buffer. An
- important function is gst_rtp_buffer_validate() that is used to verify that
- the buffer a well formed RTP buffer.
-
- It is now possible to use all the gst_rtp_buffer_get_*() or
- gst_rtp_buffer_set_*() functions to read or write the different parts of the
- RTP header such as the payload type, the sequence number or the RTP
- timestamp. The use can also retreive a pointer to the actual RTP payload data
- using the gst_rtp_buffer_get_payload() function.
-
- RTP Base Payloader Class (GstBaseRTPPayload)
- --------------------------------------------
-
- All RTP payloader elements (audio or video) should derive from this class.
-
- RTP Base Audio Payloader Class (GstBaseRTPAudioPayload)
- -------------------------------------------------------
-
- This base class can be tested through it's children classes. Here is an
- example using the iLBC payloader (frame based).
-
- For 20ms mode :
-
- GST_DEBUG="basertpaudiopayload:5" gst-launch-0.10 fakesrc sizetype=2
- sizemax=114 datarate=1900 ! audio/x-iLBC, mode=20 ! rtpilbcpay
- max-ptime="40000000" ! fakesink
-
- For 30ms mode :
-
- GST_DEBUG="basertpaudiopayload:5" gst-launch-0.10 fakesrc sizetype=2
- sizemax=150 datarate=1662 ! audio/x-iLBC, mode=30 ! rtpilbcpay
- max-ptime="60000000" ! fakesink
-
- Here is an example using the uLaw payloader (sample based).
-
- GST_DEBUG="basertpaudiopayload:5" gst-launch-0.10 fakesrc sizetype=2
- sizemax=150 datarate=8000 ! audio/x-mulaw ! rtppcmupay max-ptime="6000000" !
- fakesink
-
- RTP Base Depayloader Class (GstBaseRTPDepayload)
- ------------------------------------------------
-
- All RTP depayloader elements (audio or video) should derive from this class.
diff --git a/gst-libs/gst/rtp/gstbasertpaudiopayload.c b/gst-libs/gst/rtp/gstbasertpaudiopayload.c
deleted file mode 100644
index dddbf498..00000000
--- a/gst-libs/gst/rtp/gstbasertpaudiopayload.c
+++ /dev/null
@@ -1,968 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstbasertpaudiopayload
- * @short_description: Base class for audio RTP payloader
- *
- * <refsect2>
- * <para>
- * Provides a base class for audio RTP payloaders for frame or sample based
- * audio codecs (constant bitrate)
- * </para>
- * <para>
- * This class derives from GstBaseRTPPayload. It can be used for payloading
- * audio codecs. It will only work with constant bitrate codecs. It supports
- * both frame based and sample based codecs. It takes care of packing up the
- * audio data into RTP packets and filling up the headers accordingly. The
- * payloading is done based on the maximum MTU (mtu) and the maximum time per
- * packet (max-ptime). The general idea is to divide large data buffers into
- * smaller RTP packets. The RTP packet size is the minimum of either the MTU,
- * max-ptime (if set) or available data. The RTP packet size is always larger or
- * equal to min-ptime (if set). If min-ptime is not set, any residual data is
- * sent in a last RTP packet. In the case of frame based codecs, the resulting
- * RTP packets always contain full frames.
- * </para>
- * <title>Usage</title>
- * <para>
- * To use this base class, your child element needs to call either
- * gst_base_rtp_audio_payload_set_frame_based() or
- * gst_base_rtp_audio_payload_set_sample_based(). This is usually done in the
- * element's _init() function. Then, the child element must call either
- * gst_base_rtp_audio_payload_set_frame_options(),
- * gst_base_rtp_audio_payload_set_sample_options() or
- * gst_base_rtp_audio_payload_set_samplebits_options. Since
- * GstBaseRTPAudioPayload derives from GstBaseRTPPayload, the child element
- * must set any variables or call/override any functions required by that base
- * class. The child element does not need to override any other functions
- * specific to GstBaseRTPAudioPayload.
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <gst/rtp/gstrtpbuffer.h>
-#include <gst/base/gstadapter.h>
-
-#include "gstbasertpaudiopayload.h"
-
-GST_DEBUG_CATEGORY_STATIC (basertpaudiopayload_debug);
-#define GST_CAT_DEFAULT (basertpaudiopayload_debug)
-
-#define DEFAULT_BUFFER_LIST FALSE
-
-enum
-{
- PROP_0,
- PROP_BUFFER_LIST,
- PROP_LAST
-};
-
-/* function to convert bytes to a time */
-typedef GstClockTime (*GetBytesToTimeFunc) (GstBaseRTPAudioPayload * payload,
- guint64 bytes);
-/* function to convert bytes to a RTP time */
-typedef guint32 (*GetBytesToRTPTimeFunc) (GstBaseRTPAudioPayload * payload,
- guint64 bytes);
-/* function to convert time to bytes */
-typedef guint64 (*GetTimeToBytesFunc) (GstBaseRTPAudioPayload * payload,
- GstClockTime time);
-
-struct _GstBaseRTPAudioPayloadPrivate
-{
- GetBytesToTimeFunc bytes_to_time;
- GetBytesToRTPTimeFunc bytes_to_rtptime;
- GetTimeToBytesFunc time_to_bytes;
-
- GstAdapter *adapter;
- guint fragment_size;
- GstClockTime frame_duration_ns;
- gboolean discont;
- guint64 offset;
- GstClockTime last_timestamp;
- guint32 last_rtptime;
- guint align;
-
- guint cached_mtu;
- guint cached_min_ptime;
- guint cached_max_ptime;
- guint cached_ptime;
- guint cached_min_length;
- guint cached_max_length;
-
- gboolean buffer_list;
-};
-
-
-#define GST_BASE_RTP_AUDIO_PAYLOAD_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), GST_TYPE_BASE_RTP_AUDIO_PAYLOAD, \
- GstBaseRTPAudioPayloadPrivate))
-
-static void gst_base_rtp_audio_payload_finalize (GObject * object);
-
-static void gst_base_rtp_audio_payload_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_base_rtp_audio_payload_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-/* bytes to time functions */
-static GstClockTime
-gst_base_rtp_audio_payload_frame_bytes_to_time (GstBaseRTPAudioPayload *
- payload, guint64 bytes);
-static GstClockTime
-gst_base_rtp_audio_payload_sample_bytes_to_time (GstBaseRTPAudioPayload *
- payload, guint64 bytes);
-
-/* bytes to RTP time functions */
-static guint32
-gst_base_rtp_audio_payload_frame_bytes_to_rtptime (GstBaseRTPAudioPayload *
- payload, guint64 bytes);
-static guint32
-gst_base_rtp_audio_payload_sample_bytes_to_rtptime (GstBaseRTPAudioPayload *
- payload, guint64 bytes);
-
-/* time to bytes functions */
-static guint64
-gst_base_rtp_audio_payload_frame_time_to_bytes (GstBaseRTPAudioPayload *
- payload, GstClockTime time);
-static guint64
-gst_base_rtp_audio_payload_sample_time_to_bytes (GstBaseRTPAudioPayload *
- payload, GstClockTime time);
-
-static GstFlowReturn gst_base_rtp_audio_payload_handle_buffer (GstBaseRTPPayload
- * payload, GstBuffer * buffer);
-
-static GstStateChangeReturn gst_base_rtp_payload_audio_change_state (GstElement
- * element, GstStateChange transition);
-
-static gboolean gst_base_rtp_payload_audio_handle_event (GstPad * pad,
- GstEvent * event);
-
-GST_BOILERPLATE (GstBaseRTPAudioPayload, gst_base_rtp_audio_payload,
- GstBaseRTPPayload, GST_TYPE_BASE_RTP_PAYLOAD);
-
-static void
-gst_base_rtp_audio_payload_base_init (gpointer klass)
-{
-}
-
-static void
-gst_base_rtp_audio_payload_class_init (GstBaseRTPAudioPayloadClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- GstBaseRTPPayloadClass *gstbasertppayload_class;
-
- g_type_class_add_private (klass, sizeof (GstBaseRTPAudioPayloadPrivate));
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
- gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
-
- gobject_class->finalize = gst_base_rtp_audio_payload_finalize;
- gobject_class->set_property = gst_base_rtp_audio_payload_set_property;
- gobject_class->get_property = gst_base_rtp_audio_payload_get_property;
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BUFFER_LIST,
- g_param_spec_boolean ("buffer-list", "Buffer List",
- "Use Buffer Lists",
- DEFAULT_BUFFER_LIST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_base_rtp_payload_audio_change_state);
-
- gstbasertppayload_class->handle_buffer =
- GST_DEBUG_FUNCPTR (gst_base_rtp_audio_payload_handle_buffer);
- gstbasertppayload_class->handle_event =
- GST_DEBUG_FUNCPTR (gst_base_rtp_payload_audio_handle_event);
-
- GST_DEBUG_CATEGORY_INIT (basertpaudiopayload_debug, "basertpaudiopayload", 0,
- "base audio RTP payloader");
-}
-
-static void
-gst_base_rtp_audio_payload_init (GstBaseRTPAudioPayload * payload,
- GstBaseRTPAudioPayloadClass * klass)
-{
- payload->priv = GST_BASE_RTP_AUDIO_PAYLOAD_GET_PRIVATE (payload);
-
- /* these need to be set by child object if frame based */
- payload->frame_size = 0;
- payload->frame_duration = 0;
-
- /* these need to be set by child object if sample based */
- payload->sample_size = 0;
-
- payload->priv->adapter = gst_adapter_new ();
-
- payload->priv->buffer_list = DEFAULT_BUFFER_LIST;
-}
-
-static void
-gst_base_rtp_audio_payload_finalize (GObject * object)
-{
- GstBaseRTPAudioPayload *payload;
-
- payload = GST_BASE_RTP_AUDIO_PAYLOAD (object);
-
- g_object_unref (payload->priv->adapter);
-
- GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
-}
-
-static void
-gst_base_rtp_audio_payload_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
-{
- GstBaseRTPAudioPayload *payload;
-
- payload = GST_BASE_RTP_AUDIO_PAYLOAD (object);
-
- switch (prop_id) {
- case PROP_BUFFER_LIST:
- payload->priv->buffer_list = g_value_get_boolean (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_base_rtp_audio_payload_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- GstBaseRTPAudioPayload *payload;
-
- payload = GST_BASE_RTP_AUDIO_PAYLOAD (object);
-
- switch (prop_id) {
- case PROP_BUFFER_LIST:
- g_value_set_boolean (value, payload->priv->buffer_list);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/**
- * gst_base_rtp_audio_payload_set_frame_based:
- * @basertpaudiopayload: a pointer to the element.
- *
- * Tells #GstBaseRTPAudioPayload that the child element is for a frame based
- * audio codec
- */
-void
-gst_base_rtp_audio_payload_set_frame_based (GstBaseRTPAudioPayload *
- basertpaudiopayload)
-{
- g_return_if_fail (basertpaudiopayload != NULL);
- g_return_if_fail (basertpaudiopayload->priv->time_to_bytes == NULL);
- g_return_if_fail (basertpaudiopayload->priv->bytes_to_time == NULL);
- g_return_if_fail (basertpaudiopayload->priv->bytes_to_rtptime == NULL);
-
- basertpaudiopayload->priv->bytes_to_time =
- gst_base_rtp_audio_payload_frame_bytes_to_time;
- basertpaudiopayload->priv->bytes_to_rtptime =
- gst_base_rtp_audio_payload_frame_bytes_to_rtptime;
- basertpaudiopayload->priv->time_to_bytes =
- gst_base_rtp_audio_payload_frame_time_to_bytes;
-}
-
-/**
- * gst_base_rtp_audio_payload_set_sample_based:
- * @basertpaudiopayload: a pointer to the element.
- *
- * Tells #GstBaseRTPAudioPayload that the child element is for a sample based
- * audio codec
- */
-void
-gst_base_rtp_audio_payload_set_sample_based (GstBaseRTPAudioPayload *
- basertpaudiopayload)
-{
- g_return_if_fail (basertpaudiopayload != NULL);
- g_return_if_fail (basertpaudiopayload->priv->time_to_bytes == NULL);
- g_return_if_fail (basertpaudiopayload->priv->bytes_to_time == NULL);
- g_return_if_fail (basertpaudiopayload->priv->bytes_to_rtptime == NULL);
-
- basertpaudiopayload->priv->bytes_to_time =
- gst_base_rtp_audio_payload_sample_bytes_to_time;
- basertpaudiopayload->priv->bytes_to_rtptime =
- gst_base_rtp_audio_payload_sample_bytes_to_rtptime;
- basertpaudiopayload->priv->time_to_bytes =
- gst_base_rtp_audio_payload_sample_time_to_bytes;
-}
-
-/**
- * gst_base_rtp_audio_payload_set_frame_options:
- * @basertpaudiopayload: a pointer to the element.
- * @frame_duration: The duraction of an audio frame in milliseconds.
- * @frame_size: The size of an audio frame in bytes.
- *
- * Sets the options for frame based audio codecs.
- *
- */
-void
-gst_base_rtp_audio_payload_set_frame_options (GstBaseRTPAudioPayload
- * basertpaudiopayload, gint frame_duration, gint frame_size)
-{
- GstBaseRTPAudioPayloadPrivate *priv;
-
- g_return_if_fail (basertpaudiopayload != NULL);
-
- priv = basertpaudiopayload->priv;
-
- basertpaudiopayload->frame_duration = frame_duration;
- priv->frame_duration_ns = frame_duration * GST_MSECOND;
- basertpaudiopayload->frame_size = frame_size;
- priv->align = frame_size;
-
- gst_adapter_clear (priv->adapter);
-
- GST_DEBUG_OBJECT (basertpaudiopayload, "frame set to %d ms and size %d",
- frame_duration, frame_size);
-}
-
-/**
- * gst_base_rtp_audio_payload_set_sample_options:
- * @basertpaudiopayload: a pointer to the element.
- * @sample_size: Size per sample in bytes.
- *
- * Sets the options for sample based audio codecs.
- */
-void
-gst_base_rtp_audio_payload_set_sample_options (GstBaseRTPAudioPayload
- * basertpaudiopayload, gint sample_size)
-{
- g_return_if_fail (basertpaudiopayload != NULL);
-
- /* sample_size is in bits internally */
- gst_base_rtp_audio_payload_set_samplebits_options (basertpaudiopayload,
- sample_size * 8);
-}
-
-/**
- * gst_base_rtp_audio_payload_set_samplebits_options:
- * @basertpaudiopayload: a pointer to the element.
- * @sample_size: Size per sample in bits.
- *
- * Sets the options for sample based audio codecs.
- *
- * Since: 0.10.18
- */
-void
-gst_base_rtp_audio_payload_set_samplebits_options (GstBaseRTPAudioPayload
- * basertpaudiopayload, gint sample_size)
-{
- guint fragment_size;
- GstBaseRTPAudioPayloadPrivate *priv;
-
- g_return_if_fail (basertpaudiopayload != NULL);
-
- priv = basertpaudiopayload->priv;
-
- basertpaudiopayload->sample_size = sample_size;
-
- /* sample_size is in bits and is converted into multiple bytes */
- fragment_size = sample_size;
- while ((fragment_size % 8) != 0)
- fragment_size += fragment_size;
- priv->fragment_size = fragment_size / 8;
- priv->align = priv->fragment_size;
-
- gst_adapter_clear (priv->adapter);
-
- GST_DEBUG_OBJECT (basertpaudiopayload,
- "Samplebits set to sample size %d bits", sample_size);
-}
-
-static void
-gst_base_rtp_audio_payload_set_meta (GstBaseRTPAudioPayload * payload,
- GstBuffer * buffer, guint payload_len, GstClockTime timestamp)
-{
- GstBaseRTPPayload *basepayload;
- GstBaseRTPAudioPayloadPrivate *priv;
-
- basepayload = GST_BASE_RTP_PAYLOAD_CAST (payload);
- priv = payload->priv;
-
- /* set payload type */
- gst_rtp_buffer_set_payload_type (buffer, basepayload->pt);
- /* set marker bit for disconts */
- if (priv->discont) {
- GST_DEBUG_OBJECT (payload, "Setting marker and DISCONT");
- gst_rtp_buffer_set_marker (buffer, TRUE);
- GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
- priv->discont = FALSE;
- }
- GST_BUFFER_TIMESTAMP (buffer) = timestamp;
-
- /* get the offset in RTP time */
- GST_BUFFER_OFFSET (buffer) = priv->bytes_to_rtptime (payload, priv->offset);
-
- priv->offset += payload_len;
-
- /* remember the last rtptime/timestamp pair. We will use this to realign our
- * RTP timestamp after a buffer discont */
- priv->last_rtptime = GST_BUFFER_OFFSET (buffer);
- priv->last_timestamp = timestamp;
-}
-
-/**
- * gst_base_rtp_audio_payload_push:
- * @baseaudiopayload: a #GstBaseRTPPayload
- * @data: data to set as payload
- * @payload_len: length of payload
- * @timestamp: a #GstClockTime
- *
- * Create an RTP buffer and store @payload_len bytes of @data as the
- * payload. Set the timestamp on the new buffer to @timestamp before pushing
- * the buffer downstream.
- *
- * Returns: a #GstFlowReturn
- *
- * Since: 0.10.13
- */
-GstFlowReturn
-gst_base_rtp_audio_payload_push (GstBaseRTPAudioPayload * baseaudiopayload,
- const guint8 * data, guint payload_len, GstClockTime timestamp)
-{
- GstBaseRTPPayload *basepayload;
- GstBuffer *outbuf;
- guint8 *payload;
- GstFlowReturn ret;
-
- basepayload = GST_BASE_RTP_PAYLOAD (baseaudiopayload);
-
- GST_DEBUG_OBJECT (baseaudiopayload, "Pushing %d bytes ts %" GST_TIME_FORMAT,
- payload_len, GST_TIME_ARGS (timestamp));
-
- /* create buffer to hold the payload */
- outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
-
- /* copy payload */
- payload = gst_rtp_buffer_get_payload (outbuf);
- memcpy (payload, data, payload_len);
-
- /* set metadata */
- gst_base_rtp_audio_payload_set_meta (baseaudiopayload, outbuf, payload_len,
- timestamp);
-
- ret = gst_basertppayload_push (basepayload, outbuf);
-
- return ret;
-}
-
-static GstFlowReturn
-gst_base_rtp_audio_payload_push_buffer (GstBaseRTPAudioPayload *
- baseaudiopayload, GstBuffer * buffer)
-{
- GstBaseRTPPayload *basepayload;
- GstBaseRTPAudioPayloadPrivate *priv;
- GstBuffer *outbuf;
- GstClockTime timestamp;
- guint8 *payload;
- guint payload_len;
- GstFlowReturn ret;
-
- priv = baseaudiopayload->priv;
- basepayload = GST_BASE_RTP_PAYLOAD (baseaudiopayload);
-
- payload_len = GST_BUFFER_SIZE (buffer);
- timestamp = GST_BUFFER_TIMESTAMP (buffer);
-
- GST_DEBUG_OBJECT (baseaudiopayload, "Pushing %d bytes ts %" GST_TIME_FORMAT,
- payload_len, GST_TIME_ARGS (timestamp));
-
- if (priv->buffer_list) {
- /* create just the RTP header buffer */
- outbuf = gst_rtp_buffer_new_allocate (0, 0, 0);
- } else {
- /* create buffer to hold the payload */
- outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
- }
-
- /* set metadata */
- gst_base_rtp_audio_payload_set_meta (baseaudiopayload, outbuf, payload_len,
- timestamp);
-
- if (priv->buffer_list) {
- GstBufferList *list;
- GstBufferListIterator *it;
-
- list = gst_buffer_list_new ();
- it = gst_buffer_list_iterate (list);
-
- /* add both buffers to the buffer list */
- gst_buffer_list_iterator_add_group (it);
- gst_buffer_list_iterator_add (it, outbuf);
- gst_buffer_list_iterator_add (it, buffer);
-
- gst_buffer_list_iterator_free (it);
-
- GST_DEBUG_OBJECT (baseaudiopayload, "Pushing list %p", list);
- ret = gst_basertppayload_push_list (basepayload, list);
- } else {
- /* copy payload */
- payload = gst_rtp_buffer_get_payload (outbuf);
- memcpy (payload, GST_BUFFER_DATA (buffer), payload_len);
- gst_buffer_unref (buffer);
-
- GST_DEBUG_OBJECT (baseaudiopayload, "Pushing buffer %p", outbuf);
- ret = gst_basertppayload_push (basepayload, outbuf);
- }
-
- return ret;
-}
-
-/**
- * gst_base_rtp_audio_payload_flush:
- * @baseaudiopayload: a #GstBaseRTPPayload
- * @payload_len: length of payload
- * @timestamp: a #GstClockTime
- *
- * Create an RTP buffer and store @payload_len bytes of the adapter as the
- * payload. Set the timestamp on the new buffer to @timestamp before pushing
- * the buffer downstream.
- *
- * If @payload_len is -1, all pending bytes will be flushed. If @timestamp is
- * -1, the timestamp will be calculated automatically.
- *
- * Returns: a #GstFlowReturn
- *
- * Since: 0.10.25
- */
-GstFlowReturn
-gst_base_rtp_audio_payload_flush (GstBaseRTPAudioPayload * baseaudiopayload,
- guint payload_len, GstClockTime timestamp)
-{
- GstBaseRTPPayload *basepayload;
- GstBaseRTPAudioPayloadPrivate *priv;
- GstBuffer *outbuf;
- guint8 *payload;
- GstFlowReturn ret;
- GstAdapter *adapter;
- guint64 distance;
-
- priv = baseaudiopayload->priv;
- adapter = priv->adapter;
-
- basepayload = GST_BASE_RTP_PAYLOAD (baseaudiopayload);
-
- if (payload_len == -1)
- payload_len = gst_adapter_available (adapter);
-
- /* nothing to do, just return */
- if (payload_len == 0)
- return GST_FLOW_OK;
-
- if (timestamp == -1) {
- /* calculate the timestamp */
- timestamp = gst_adapter_prev_timestamp (adapter, &distance);
-
- GST_LOG_OBJECT (baseaudiopayload,
- "last timestamp %" GST_TIME_FORMAT ", distance %" G_GUINT64_FORMAT,
- GST_TIME_ARGS (timestamp), distance);
-
- if (GST_CLOCK_TIME_IS_VALID (timestamp) && distance > 0) {
- /* convert the number of bytes since the last timestamp to time and add to
- * the last seen timestamp */
- timestamp += priv->bytes_to_time (baseaudiopayload, distance);
- }
- }
-
- GST_DEBUG_OBJECT (baseaudiopayload, "Pushing %d bytes ts %" GST_TIME_FORMAT,
- payload_len, GST_TIME_ARGS (timestamp));
-
- if (priv->buffer_list && gst_adapter_available_fast (adapter) >= payload_len) {
- GstBuffer *buffer;
- /* we can quickly take a buffer out of the adapter without having to copy
- * anything. */
- buffer = gst_adapter_take_buffer (adapter, payload_len);
-
- ret = gst_base_rtp_audio_payload_push_buffer (baseaudiopayload, buffer);
- } else {
- /* create buffer to hold the payload */
- outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
-
- /* copy payload */
- payload = gst_rtp_buffer_get_payload (outbuf);
- gst_adapter_copy (adapter, payload, 0, payload_len);
- gst_adapter_flush (adapter, payload_len);
-
- /* set metadata */
- gst_base_rtp_audio_payload_set_meta (baseaudiopayload, outbuf, payload_len,
- timestamp);
-
- ret = gst_basertppayload_push (basepayload, outbuf);
- }
-
- return ret;
-}
-
-#define ALIGN_DOWN(val,len) ((val) - ((val) % (len)))
-
-/* calculate the min and max length of a packet. This depends on the configured
- * mtu and min/max_ptime values. We cache those so that we don't have to redo
- * all the calculations */
-static gboolean
-gst_base_rtp_audio_payload_get_lengths (GstBaseRTPPayload *
- basepayload, guint * min_payload_len, guint * max_payload_len,
- guint * align)
-{
- GstBaseRTPAudioPayload *payload;
- GstBaseRTPAudioPayloadPrivate *priv;
- guint max_mtu, mtu;
- guint maxptime_octets;
- guint minptime_octets;
-
- payload = GST_BASE_RTP_AUDIO_PAYLOAD_CAST (basepayload);
- priv = payload->priv;
-
- if (priv->align == 0)
- return FALSE;
-
- *align = priv->align;
-
- mtu = GST_BASE_RTP_PAYLOAD_MTU (payload);
-
- /* check cached values */
- if (G_LIKELY (priv->cached_mtu == mtu
- && priv->cached_ptime == basepayload->abidata.ABI.ptime
- && priv->cached_max_ptime == basepayload->max_ptime
- && priv->cached_min_ptime == basepayload->min_ptime)) {
- /* if nothing changed, return cached values */
- *min_payload_len = priv->cached_min_length;
- *max_payload_len = priv->cached_max_length;
- return TRUE;
- }
-
- /* ptime max */
- if (basepayload->max_ptime != -1) {
- maxptime_octets = priv->time_to_bytes (payload, basepayload->max_ptime);
- } else {
- maxptime_octets = G_MAXUINT;
- }
- /* MTU max */
- max_mtu = gst_rtp_buffer_calc_payload_len (mtu, 0, 0);
- /* round down to alignment */
- max_mtu = ALIGN_DOWN (max_mtu, *align);
-
- /* combine max ptime and max payload length */
- *max_payload_len = MIN (max_mtu, maxptime_octets);
-
- /* min number of bytes based on a given ptime */
- minptime_octets = priv->time_to_bytes (payload, basepayload->min_ptime);
- /* must be at least one frame size */
- *min_payload_len = MAX (minptime_octets, *align);
-
- if (*min_payload_len > *max_payload_len)
- *min_payload_len = *max_payload_len;
-
- /* If the ptime is specified in the caps, tried to adhere to it exactly */
- if (basepayload->abidata.ABI.ptime) {
- guint ptime_in_bytes = priv->time_to_bytes (payload,
- basepayload->abidata.ABI.ptime);
-
- /* clip to computed min and max lengths */
- ptime_in_bytes = MAX (*min_payload_len, ptime_in_bytes);
- ptime_in_bytes = MIN (*max_payload_len, ptime_in_bytes);
-
- *min_payload_len = *max_payload_len = ptime_in_bytes;
- }
-
- /* cache values */
- priv->cached_mtu = mtu;
- priv->cached_ptime = basepayload->abidata.ABI.ptime;
- priv->cached_min_ptime = basepayload->min_ptime;
- priv->cached_max_ptime = basepayload->max_ptime;
- priv->cached_min_length = *min_payload_len;
- priv->cached_max_length = *max_payload_len;
-
- return TRUE;
-}
-
-/* frame conversions functions */
-static GstClockTime
-gst_base_rtp_audio_payload_frame_bytes_to_time (GstBaseRTPAudioPayload *
- payload, guint64 bytes)
-{
- return (bytes / payload->frame_size) * (payload->priv->frame_duration_ns);
-}
-
-static guint32
-gst_base_rtp_audio_payload_frame_bytes_to_rtptime (GstBaseRTPAudioPayload *
- payload, guint64 bytes)
-{
- guint64 time;
-
- time = (bytes / payload->frame_size) * (payload->priv->frame_duration_ns);
-
- return gst_util_uint64_scale_int (time,
- GST_BASE_RTP_PAYLOAD (payload)->clock_rate, GST_SECOND);
-}
-
-static guint64
-gst_base_rtp_audio_payload_frame_time_to_bytes (GstBaseRTPAudioPayload *
- payload, GstClockTime time)
-{
- return gst_util_uint64_scale (time, payload->frame_size,
- payload->priv->frame_duration_ns);
-}
-
-/* sample conversion functions */
-static GstClockTime
-gst_base_rtp_audio_payload_sample_bytes_to_time (GstBaseRTPAudioPayload *
- payload, guint64 bytes)
-{
- guint64 rtptime;
-
- /* avoid division when we can */
- if (G_LIKELY (payload->sample_size != 8))
- rtptime = gst_util_uint64_scale_int (bytes, 8, payload->sample_size);
- else
- rtptime = bytes;
-
- return gst_util_uint64_scale_int (rtptime, GST_SECOND,
- GST_BASE_RTP_PAYLOAD (payload)->clock_rate);
-}
-
-static guint32
-gst_base_rtp_audio_payload_sample_bytes_to_rtptime (GstBaseRTPAudioPayload *
- payload, guint64 bytes)
-{
- /* avoid division when we can */
- if (G_LIKELY (payload->sample_size != 8))
- return gst_util_uint64_scale_int (bytes, 8, payload->sample_size);
- else
- return bytes;
-}
-
-static guint64
-gst_base_rtp_audio_payload_sample_time_to_bytes (GstBaseRTPAudioPayload *
- payload, guint64 time)
-{
- guint64 samples;
-
- samples = gst_util_uint64_scale_int (time,
- GST_BASE_RTP_PAYLOAD (payload)->clock_rate, GST_SECOND);
-
- /* avoid multiplication when we can */
- if (G_LIKELY (payload->sample_size != 8))
- return gst_util_uint64_scale_int (samples, payload->sample_size, 8);
- else
- return samples;
-}
-
-static GstFlowReturn
-gst_base_rtp_audio_payload_handle_buffer (GstBaseRTPPayload *
- basepayload, GstBuffer * buffer)
-{
- GstBaseRTPAudioPayload *payload;
- GstBaseRTPAudioPayloadPrivate *priv;
- guint payload_len;
- GstFlowReturn ret;
- guint available;
- guint min_payload_len;
- guint max_payload_len;
- guint align;
- guint size;
- gboolean discont;
-
- ret = GST_FLOW_OK;
-
- payload = GST_BASE_RTP_AUDIO_PAYLOAD_CAST (basepayload);
- priv = payload->priv;
-
- discont = GST_BUFFER_IS_DISCONT (buffer);
- if (discont) {
- GstClockTime timestamp;
-
- GST_DEBUG_OBJECT (payload, "Got DISCONT");
- /* flush everything out of the adapter, mark DISCONT */
- ret = gst_base_rtp_audio_payload_flush (payload, -1, -1);
- priv->discont = TRUE;
-
- timestamp = GST_BUFFER_TIMESTAMP (buffer);
-
- /* get the distance between the timestamp gap and produce the same gap in
- * the RTP timestamps */
- if (priv->last_timestamp != -1 && timestamp != -1) {
- /* we had a last timestamp, compare it to the new timestamp and update the
- * offset counter for RTP timestamps. The effect is that we will produce
- * output buffers containing the same RTP timestamp gap as the gap
- * between the GST timestamps. */
- if (timestamp > priv->last_timestamp) {
- GstClockTime diff;
- guint64 bytes;
- /* we're only going to apply a positive gap, otherwise we let the marker
- * bit do its thing. simply convert to bytes and add the the current
- * offset */
- diff = timestamp - priv->last_timestamp;
- bytes = priv->time_to_bytes (payload, diff);
- priv->offset += bytes;
-
- GST_DEBUG_OBJECT (payload,
- "elapsed time %" GST_TIME_FORMAT ", bytes %" G_GUINT64_FORMAT
- ", new offset %" G_GUINT64_FORMAT, GST_TIME_ARGS (diff), bytes,
- priv->offset);
- }
- }
- }
-
- if (!gst_base_rtp_audio_payload_get_lengths (basepayload, &min_payload_len,
- &max_payload_len, &align))
- goto config_error;
-
- GST_DEBUG_OBJECT (payload,
- "Calculated min_payload_len %u and max_payload_len %u",
- min_payload_len, max_payload_len);
-
- size = GST_BUFFER_SIZE (buffer);
-
- /* shortcut, we don't need to use the adapter when the packet can be pushed
- * through directly. */
- available = gst_adapter_available (priv->adapter);
-
- GST_DEBUG_OBJECT (payload, "got buffer size %u, available %u",
- size, available);
-
- if (available == 0 && (size >= min_payload_len && size <= max_payload_len)) {
- /* If buffer fits on an RTP packet, let's just push it through
- * this will check against max_ptime and max_mtu */
- GST_DEBUG_OBJECT (payload, "Fast packet push");
- ret = gst_base_rtp_audio_payload_push_buffer (payload, buffer);
- } else {
- /* push the buffer in the adapter */
- gst_adapter_push (priv->adapter, buffer);
- available += size;
-
- GST_DEBUG_OBJECT (payload, "available now %u", available);
-
- /* as long as we have full frames */
- while (available >= min_payload_len) {
- /* get multiple of alignment */
- payload_len = MIN (max_payload_len, available);
- payload_len = ALIGN_DOWN (payload_len, align);
-
- /* and flush out the bytes from the adapter, automatically set the
- * timestamp. */
- ret = gst_base_rtp_audio_payload_flush (payload, payload_len, -1);
-
- available -= payload_len;
- GST_DEBUG_OBJECT (payload, "available after push %u", available);
- }
- }
- return ret;
-
- /* ERRORS */
-config_error:
- {
- GST_ELEMENT_ERROR (payload, STREAM, NOT_IMPLEMENTED, (NULL),
- ("subclass did not configure us properly"));
- gst_buffer_unref (buffer);
- return GST_FLOW_ERROR;
- }
-}
-
-static GstStateChangeReturn
-gst_base_rtp_payload_audio_change_state (GstElement * element,
- GstStateChange transition)
-{
- GstBaseRTPAudioPayload *basertppayload;
- GstStateChangeReturn ret;
-
- basertppayload = GST_BASE_RTP_AUDIO_PAYLOAD (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- basertppayload->priv->cached_mtu = -1;
- basertppayload->priv->last_rtptime = -1;
- basertppayload->priv->last_timestamp = -1;
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- gst_adapter_clear (basertppayload->priv->adapter);
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-static gboolean
-gst_base_rtp_payload_audio_handle_event (GstPad * pad, GstEvent * event)
-{
- GstBaseRTPAudioPayload *payload;
- gboolean res = FALSE;
-
- payload = GST_BASE_RTP_AUDIO_PAYLOAD (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_EOS:
- /* flush remaining bytes in the adapter */
- gst_base_rtp_audio_payload_flush (payload, -1, -1);
- break;
- case GST_EVENT_FLUSH_STOP:
- gst_adapter_clear (payload->priv->adapter);
- break;
- default:
- break;
- }
-
- gst_object_unref (payload);
-
- /* return FALSE to let parent handle the remainder of the event */
- return res;
-}
-
-/**
- * gst_base_rtp_audio_payload_get_adapter:
- * @basertpaudiopayload: a #GstBaseRTPAudioPayload
- *
- * Gets the internal adapter used by the depayloader.
- *
- * Returns: a #GstAdapter.
- *
- * Since: 0.10.13
- */
-GstAdapter *
-gst_base_rtp_audio_payload_get_adapter (GstBaseRTPAudioPayload
- * basertpaudiopayload)
-{
- GstAdapter *adapter;
-
- if ((adapter = basertpaudiopayload->priv->adapter))
- g_object_ref (adapter);
-
- return adapter;
-}
diff --git a/gst-libs/gst/rtp/gstbasertpaudiopayload.h b/gst-libs/gst/rtp/gstbasertpaudiopayload.h
deleted file mode 100644
index 3fdb488a..00000000
--- a/gst-libs/gst/rtp/gstbasertpaudiopayload.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_BASE_RTP_AUDIO_PAYLOAD_H__
-#define __GST_BASE_RTP_AUDIO_PAYLOAD_H__
-
-#include <gst/gst.h>
-#include <gst/rtp/gstbasertppayload.h>
-#include <gst/base/gstadapter.h>
-
-G_BEGIN_DECLS
-
-typedef struct _GstBaseRTPAudioPayload GstBaseRTPAudioPayload;
-typedef struct _GstBaseRTPAudioPayloadClass GstBaseRTPAudioPayloadClass;
-
-typedef struct _GstBaseRTPAudioPayloadPrivate GstBaseRTPAudioPayloadPrivate;
-
-#define GST_TYPE_BASE_RTP_AUDIO_PAYLOAD \
- (gst_base_rtp_audio_payload_get_type())
-#define GST_BASE_RTP_AUDIO_PAYLOAD(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), \
- GST_TYPE_BASE_RTP_AUDIO_PAYLOAD,GstBaseRTPAudioPayload))
-#define GST_BASE_RTP_AUDIO_PAYLOAD_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), \
- GST_TYPE_BASE_RTP_AUDIO_PAYLOAD,GstBaseRTPAudioPayloadClass))
-#define GST_IS_BASE_RTP_AUDIO_PAYLOAD(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_RTP_AUDIO_PAYLOAD))
-#define GST_IS_BASE_RTP_AUDIO_PAYLOAD_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_RTP_AUDIO_PAYLOAD))
-#define GST_BASE_RTP_AUDIO_PAYLOAD_CAST(obj) \
- ((GstBaseRTPAudioPayload *) (obj))
-
-struct _GstBaseRTPAudioPayload
-{
- GstBaseRTPPayload payload;
-
- GstBaseRTPAudioPayloadPrivate *priv;
-
- GstClockTime base_ts;
- gint frame_size;
- gint frame_duration;
-
- gint sample_size;
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-struct _GstBaseRTPAudioPayloadClass
-{
- GstBaseRTPPayloadClass parent_class;
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_base_rtp_audio_payload_get_type (void);
-
-/* configure frame based */
-void gst_base_rtp_audio_payload_set_frame_based (GstBaseRTPAudioPayload *basertpaudiopayload);
-
-void gst_base_rtp_audio_payload_set_frame_options (GstBaseRTPAudioPayload *basertpaudiopayload,
- gint frame_duration, gint frame_size);
-
-/* configure sample based */
-void gst_base_rtp_audio_payload_set_sample_based (GstBaseRTPAudioPayload *basertpaudiopayload);
-void gst_base_rtp_audio_payload_set_sample_options (GstBaseRTPAudioPayload *basertpaudiopayload,
- gint sample_size);
-void gst_base_rtp_audio_payload_set_samplebits_options (GstBaseRTPAudioPayload *basertpaudiopayload,
- gint sample_size);
-
-/* get the internal adapter */
-GstAdapter* gst_base_rtp_audio_payload_get_adapter (GstBaseRTPAudioPayload *basertpaudiopayload);
-
-/* push and flushing data */
-GstFlowReturn gst_base_rtp_audio_payload_push (GstBaseRTPAudioPayload * baseaudiopayload,
- const guint8 * data, guint payload_len,
- GstClockTime timestamp);
-GstFlowReturn gst_base_rtp_audio_payload_flush (GstBaseRTPAudioPayload * baseaudiopayload,
- guint payload_len, GstClockTime timestamp);
-
-G_END_DECLS
-
-#endif /* __GST_BASE_RTP_AUDIO_PAYLOAD_H__ */
diff --git a/gst-libs/gst/rtp/gstbasertpdepayload.c b/gst-libs/gst/rtp/gstbasertpdepayload.c
deleted file mode 100644
index 7afa5dde..00000000
--- a/gst-libs/gst/rtp/gstbasertpdepayload.c
+++ /dev/null
@@ -1,696 +0,0 @@
-/* GStreamer
- * Copyright (C) <2005> Philippe Khalaf <burger@speedy.org>
- * Copyright (C) <2005> Nokia Corporation <kai.vehmanen@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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstbasertpdepayload
- * @short_description: Base class for RTP depayloader
- *
- * <refsect2>
- * <para>
- * Provides a base class for RTP depayloaders
- * </para>
- * </refsect2>
- */
-
-#include "gstbasertpdepayload.h"
-
-#ifdef GST_DISABLE_DEPRECATED
-#define QUEUE_LOCK_INIT(base) (g_static_rec_mutex_init(&base->queuelock))
-#define QUEUE_LOCK_FREE(base) (g_static_rec_mutex_free(&base->queuelock))
-#define QUEUE_LOCK(base) (g_static_rec_mutex_lock(&base->queuelock))
-#define QUEUE_UNLOCK(base) (g_static_rec_mutex_unlock(&base->queuelock))
-#else
-/* otherwise it's already been defined in the header (FIXME 0.11)*/
-#endif
-
-GST_DEBUG_CATEGORY_STATIC (basertpdepayload_debug);
-#define GST_CAT_DEFAULT (basertpdepayload_debug)
-
-#define GST_BASE_RTP_DEPAYLOAD_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BASE_RTP_DEPAYLOAD, GstBaseRTPDepayloadPrivate))
-
-struct _GstBaseRTPDepayloadPrivate
-{
- GstClockTime npt_start;
- GstClockTime npt_stop;
- gdouble play_speed;
- gdouble play_scale;
-
- gboolean discont;
- GstClockTime timestamp;
- GstClockTime duration;
-
- guint32 next_seqnum;
-
- gboolean negotiated;
-};
-
-/* Filter signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-#define DEFAULT_QUEUE_DELAY 0
-
-enum
-{
- PROP_0,
- PROP_QUEUE_DELAY,
- PROP_LAST
-};
-
-static void gst_base_rtp_depayload_finalize (GObject * object);
-static void gst_base_rtp_depayload_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_base_rtp_depayload_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static gboolean gst_base_rtp_depayload_setcaps (GstPad * pad, GstCaps * caps);
-static GstFlowReturn gst_base_rtp_depayload_chain (GstPad * pad,
- GstBuffer * in);
-static gboolean gst_base_rtp_depayload_handle_sink_event (GstPad * pad,
- GstEvent * event);
-
-static GstStateChangeReturn gst_base_rtp_depayload_change_state (GstElement *
- element, GstStateChange transition);
-
-static void gst_base_rtp_depayload_set_gst_timestamp
- (GstBaseRTPDepayload * filter, guint32 rtptime, GstBuffer * buf);
-static gboolean gst_base_rtp_depayload_packet_lost (GstBaseRTPDepayload *
- filter, GstEvent * event);
-
-GST_BOILERPLATE (GstBaseRTPDepayload, gst_base_rtp_depayload, GstElement,
- GST_TYPE_ELEMENT);
-
-static void
-gst_base_rtp_depayload_base_init (gpointer klass)
-{
- /*GstElementClass *element_class = GST_ELEMENT_CLASS (klass); */
-}
-
-static void
-gst_base_rtp_depayload_class_init (GstBaseRTPDepayloadClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = G_OBJECT_CLASS (klass);
- gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_peek_parent (klass);
-
- g_type_class_add_private (klass, sizeof (GstBaseRTPDepayloadPrivate));
-
- gobject_class->finalize = gst_base_rtp_depayload_finalize;
- gobject_class->set_property = gst_base_rtp_depayload_set_property;
- gobject_class->get_property = gst_base_rtp_depayload_get_property;
-
- /**
- * GstBaseRTPDepayload::queue-delay
- *
- * Control the amount of packets to buffer.
- *
- * Deprecated: Use a jitterbuffer or RTP session manager to delay packet
- * playback. This property has no effect anymore since 0.10.15.
- */
-#ifndef GST_REMOVE_DEPRECATED
- g_object_class_install_property (gobject_class, PROP_QUEUE_DELAY,
- g_param_spec_uint ("queue-delay", "Queue Delay",
- "Amount of ms to queue/buffer, deprecated", 0, G_MAXUINT,
- DEFAULT_QUEUE_DELAY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-#endif
-
- gstelement_class->change_state = gst_base_rtp_depayload_change_state;
-
- klass->set_gst_timestamp = gst_base_rtp_depayload_set_gst_timestamp;
- klass->packet_lost = gst_base_rtp_depayload_packet_lost;
-
- GST_DEBUG_CATEGORY_INIT (basertpdepayload_debug, "basertpdepayload", 0,
- "Base class for RTP Depayloaders");
-}
-
-static void
-gst_base_rtp_depayload_init (GstBaseRTPDepayload * filter,
- GstBaseRTPDepayloadClass * klass)
-{
- GstPadTemplate *pad_template;
- GstBaseRTPDepayloadPrivate *priv;
-
- priv = GST_BASE_RTP_DEPAYLOAD_GET_PRIVATE (filter);
- filter->priv = priv;
-
- GST_DEBUG_OBJECT (filter, "init");
-
- pad_template =
- gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass), "sink");
- g_return_if_fail (pad_template != NULL);
- filter->sinkpad = gst_pad_new_from_template (pad_template, "sink");
- gst_pad_set_setcaps_function (filter->sinkpad,
- gst_base_rtp_depayload_setcaps);
- gst_pad_set_chain_function (filter->sinkpad, gst_base_rtp_depayload_chain);
- gst_pad_set_event_function (filter->sinkpad,
- gst_base_rtp_depayload_handle_sink_event);
- gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
-
- pad_template =
- gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass), "src");
- g_return_if_fail (pad_template != NULL);
- filter->srcpad = gst_pad_new_from_template (pad_template, "src");
- gst_pad_use_fixed_caps (filter->srcpad);
- gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
-
- filter->queue = g_queue_new ();
- filter->queue_delay = DEFAULT_QUEUE_DELAY;
-
- gst_segment_init (&filter->segment, GST_FORMAT_UNDEFINED);
-}
-
-static void
-gst_base_rtp_depayload_finalize (GObject * object)
-{
- GstBaseRTPDepayload *filter = GST_BASE_RTP_DEPAYLOAD (object);
-
- g_queue_free (filter->queue);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static gboolean
-gst_base_rtp_depayload_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstBaseRTPDepayload *filter;
- GstBaseRTPDepayloadClass *bclass;
- GstBaseRTPDepayloadPrivate *priv;
- gboolean res;
- GstStructure *caps_struct;
- const GValue *value;
-
- filter = GST_BASE_RTP_DEPAYLOAD (gst_pad_get_parent (pad));
- priv = filter->priv;
-
- bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter);
-
- GST_DEBUG_OBJECT (filter, "Set caps");
-
- caps_struct = gst_caps_get_structure (caps, 0);
-
- /* get other values for newsegment */
- value = gst_structure_get_value (caps_struct, "npt-start");
- if (value && G_VALUE_HOLDS_UINT64 (value))
- priv->npt_start = g_value_get_uint64 (value);
- else
- priv->npt_start = 0;
- GST_DEBUG_OBJECT (filter, "NPT start %" G_GUINT64_FORMAT, priv->npt_start);
-
- value = gst_structure_get_value (caps_struct, "npt-stop");
- if (value && G_VALUE_HOLDS_UINT64 (value))
- priv->npt_stop = g_value_get_uint64 (value);
- else
- priv->npt_stop = -1;
-
- GST_DEBUG_OBJECT (filter, "NPT stop %" G_GUINT64_FORMAT, priv->npt_stop);
-
- value = gst_structure_get_value (caps_struct, "play-speed");
- if (value && G_VALUE_HOLDS_DOUBLE (value))
- priv->play_speed = g_value_get_double (value);
- else
- priv->play_speed = 1.0;
-
- value = gst_structure_get_value (caps_struct, "play-scale");
- if (value && G_VALUE_HOLDS_DOUBLE (value))
- priv->play_scale = g_value_get_double (value);
- else
- priv->play_scale = 1.0;
-
- if (bclass->set_caps)
- res = bclass->set_caps (filter, caps);
- else
- res = TRUE;
-
- priv->negotiated = res;
-
- gst_object_unref (filter);
-
- return res;
-}
-
-static GstFlowReturn
-gst_base_rtp_depayload_chain (GstPad * pad, GstBuffer * in)
-{
- GstBaseRTPDepayload *filter;
- GstBaseRTPDepayloadPrivate *priv;
- GstBaseRTPDepayloadClass *bclass;
- GstFlowReturn ret = GST_FLOW_OK;
- GstBuffer *out_buf;
- GstClockTime timestamp;
- guint16 seqnum;
- guint32 rtptime;
- gboolean reset_seq, discont;
- gint gap;
-
- filter = GST_BASE_RTP_DEPAYLOAD (GST_OBJECT_PARENT (pad));
- priv = filter->priv;
-
- /* we must have a setcaps first */
- if (G_UNLIKELY (!priv->negotiated))
- goto not_negotiated;
-
- /* we must validate, it's possible that this element is plugged right after a
- * network receiver and we don't want to operate on invalid data */
- if (G_UNLIKELY (!gst_rtp_buffer_validate (in)))
- goto invalid_buffer;
-
- priv->discont = GST_BUFFER_IS_DISCONT (in);
-
- timestamp = GST_BUFFER_TIMESTAMP (in);
- /* convert to running_time and save the timestamp, this is the timestamp
- * we put on outgoing buffers. */
- timestamp = gst_segment_to_running_time (&filter->segment, GST_FORMAT_TIME,
- timestamp);
- priv->timestamp = timestamp;
- priv->duration = GST_BUFFER_DURATION (in);
-
- seqnum = gst_rtp_buffer_get_seq (in);
- rtptime = gst_rtp_buffer_get_timestamp (in);
- reset_seq = TRUE;
- discont = FALSE;
-
- GST_LOG_OBJECT (filter, "discont %d, seqnum %u, rtptime %u, timestamp %"
- GST_TIME_FORMAT, priv->discont, seqnum, rtptime,
- GST_TIME_ARGS (timestamp));
-
- /* Check seqnum. This is a very simple check that makes sure that the seqnums
- * are striclty increasing, dropping anything that is out of the ordinary. We
- * can only do this when the next_seqnum is known. */
- if (G_LIKELY (priv->next_seqnum != -1)) {
- gap = gst_rtp_buffer_compare_seqnum (seqnum, priv->next_seqnum);
-
- /* if we have no gap, all is fine */
- if (G_UNLIKELY (gap != 0)) {
- GST_LOG_OBJECT (filter, "got packet %u, expected %u, gap %d", seqnum,
- priv->next_seqnum, gap);
- if (gap < 0) {
- /* seqnum > next_seqnum, we are missing some packets, this is always a
- * DISCONT. */
- GST_LOG_OBJECT (filter, "%d missing packets", gap);
- discont = TRUE;
- } else {
- /* seqnum < next_seqnum, we have seen this packet before or the sender
- * could be restarted. If the packet is not too old, we throw it away as
- * a duplicate, otherwise we mark discont and continue. 100 misordered
- * packets is a good threshold. See also RFC 4737. */
- if (gap < 100)
- goto dropping;
-
- GST_LOG_OBJECT (filter,
- "%d > 100, packet too old, sender likely restarted", gap);
- discont = TRUE;
- }
- }
- }
- priv->next_seqnum = (seqnum + 1) & 0xffff;
-
- if (G_UNLIKELY (discont && !priv->discont)) {
- GST_LOG_OBJECT (filter, "mark DISCONT on input buffer");
- /* we detected a seqnum discont but the buffer was not flagged with a discont,
- * set the discont flag so that the subclass can throw away old data. */
- priv->discont = TRUE;
- GST_BUFFER_FLAG_SET (in, GST_BUFFER_FLAG_DISCONT);
- }
-
- bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter);
-
- if (G_UNLIKELY (bclass->process == NULL))
- goto no_process;
-
- /* let's send it out to processing */
- out_buf = bclass->process (filter, in);
- if (out_buf) {
- /* we pass rtptime as backward compatibility, in reality, the incomming
- * buffer timestamp is always applied to the outgoing packet. */
- ret = gst_base_rtp_depayload_push_ts (filter, rtptime, out_buf);
- }
- gst_buffer_unref (in);
-
- return ret;
-
- /* ERRORS */
-not_negotiated:
- {
- /* this is not fatal but should be filtered earlier */
- GST_ELEMENT_ERROR (filter, CORE, NEGOTIATION, (NULL),
- ("Not RTP format was negotiated"));
- gst_buffer_unref (in);
- return GST_FLOW_NOT_NEGOTIATED;
- }
-invalid_buffer:
- {
- /* this is not fatal but should be filtered earlier */
- GST_ELEMENT_WARNING (filter, STREAM, DECODE, (NULL),
- ("Received invalid RTP payload, dropping"));
- gst_buffer_unref (in);
- return GST_FLOW_OK;
- }
-dropping:
- {
- GST_WARNING_OBJECT (filter, "%d <= 100, dropping old packet", gap);
- gst_buffer_unref (in);
- return GST_FLOW_OK;
- }
-no_process:
- {
- /* this is not fatal but should be filtered earlier */
- GST_ELEMENT_ERROR (filter, STREAM, NOT_IMPLEMENTED, (NULL),
- ("The subclass does not have a process method"));
- gst_buffer_unref (in);
- return GST_FLOW_ERROR;
- }
-}
-
-static gboolean
-gst_base_rtp_depayload_handle_sink_event (GstPad * pad, GstEvent * event)
-{
- GstBaseRTPDepayload *filter;
- gboolean res = TRUE;
- gboolean forward = TRUE;
-
- filter = GST_BASE_RTP_DEPAYLOAD (GST_OBJECT_PARENT (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_STOP:
- gst_segment_init (&filter->segment, GST_FORMAT_UNDEFINED);
- filter->need_newsegment = TRUE;
- filter->priv->next_seqnum = -1;
- break;
- case GST_EVENT_NEWSEGMENT:
- {
- gboolean update;
- gdouble rate;
- GstFormat fmt;
- gint64 start, stop, position;
-
- gst_event_parse_new_segment (event, &update, &rate, &fmt, &start, &stop,
- &position);
-
- gst_segment_set_newsegment (&filter->segment, update, rate, fmt,
- start, stop, position);
-
- /* don't pass the event downstream, we generate our own segment including
- * the NTP time and other things we receive in caps */
- forward = FALSE;
- break;
- }
- case GST_EVENT_CUSTOM_DOWNSTREAM:
- {
- GstBaseRTPDepayloadClass *bclass;
-
- bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter);
-
- if (gst_event_has_name (event, "GstRTPPacketLost")) {
- /* we get this event from the jitterbuffer when it considers a packet as
- * being lost. We send it to our packet_lost vmethod. The default
- * implementation will make time progress by pushing out a NEWSEGMENT
- * update event. Subclasses can override and to one of the following:
- * - Adjust timestamp/duration to something more accurate before
- * calling the parent (default) packet_lost method.
- * - do some more advanced error concealing on the already received
- * (fragmented) packets.
- * - ignore the packet lost.
- */
- if (bclass->packet_lost)
- res = bclass->packet_lost (filter, event);
- forward = FALSE;
- }
- break;
- }
- default:
- break;
- }
-
- if (forward)
- res = gst_pad_push_event (filter->srcpad, event);
- else
- gst_event_unref (event);
-
- return res;
-}
-
-static GstEvent *
-create_segment_event (GstBaseRTPDepayload * filter, gboolean update,
- GstClockTime position)
-{
- GstEvent *event;
- GstClockTime stop;
- GstBaseRTPDepayloadPrivate *priv;
-
- priv = filter->priv;
-
- if (priv->npt_stop != -1)
- stop = priv->npt_stop - priv->npt_start;
- else
- stop = -1;
-
- event = gst_event_new_new_segment_full (update, priv->play_speed,
- priv->play_scale, GST_FORMAT_TIME, position, stop,
- position + priv->npt_start);
-
- return event;
-}
-
-static GstFlowReturn
-gst_base_rtp_depayload_push_full (GstBaseRTPDepayload * filter,
- gboolean do_ts, guint32 rtptime, GstBuffer * out_buf)
-{
- GstFlowReturn ret;
- GstCaps *srccaps;
- GstBaseRTPDepayloadClass *bclass;
- GstBaseRTPDepayloadPrivate *priv;
-
- priv = filter->priv;
-
- /* set the caps if any */
- srccaps = GST_PAD_CAPS (filter->srcpad);
- if (G_LIKELY (srccaps))
- gst_buffer_set_caps (out_buf, srccaps);
-
- bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter);
-
- /* set the timestamp if we must and can */
- if (bclass->set_gst_timestamp && do_ts)
- bclass->set_gst_timestamp (filter, rtptime, out_buf);
-
- /* if this is the first buffer send a NEWSEGMENT */
- if (G_UNLIKELY (filter->need_newsegment)) {
- GstEvent *event;
-
- event = create_segment_event (filter, FALSE, 0);
-
- gst_pad_push_event (filter->srcpad, event);
-
- filter->need_newsegment = FALSE;
- GST_DEBUG_OBJECT (filter, "Pushed newsegment event on this first buffer");
- }
-
- if (G_UNLIKELY (priv->discont)) {
- GST_LOG_OBJECT (filter, "Marking DISCONT on output buffer");
- GST_BUFFER_FLAG_SET (out_buf, GST_BUFFER_FLAG_DISCONT);
- priv->discont = FALSE;
- }
-
- /* push it */
- GST_LOG_OBJECT (filter, "Pushing buffer size %d, timestamp %" GST_TIME_FORMAT,
- GST_BUFFER_SIZE (out_buf),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (out_buf)));
-
- ret = gst_pad_push (filter->srcpad, out_buf);
-
- return ret;
-}
-
-/**
- * gst_base_rtp_depayload_push_ts:
- * @filter: a #GstBaseRTPDepayload
- * @timestamp: an RTP timestamp to apply
- * @out_buf: a #GstBuffer
- *
- * Push @out_buf to the peer of @filter. This function takes ownership of
- * @out_buf.
- *
- * Unlike gst_base_rtp_depayload_push(), this function will apply @timestamp
- * on the outgoing buffer, using the configured clock_rate to convert the
- * timestamp to a valid GStreamer clock time.
- *
- * Returns: a #GstFlowReturn.
- */
-GstFlowReturn
-gst_base_rtp_depayload_push_ts (GstBaseRTPDepayload * filter, guint32 timestamp,
- GstBuffer * out_buf)
-{
- return gst_base_rtp_depayload_push_full (filter, TRUE, timestamp, out_buf);
-}
-
-/**
- * gst_base_rtp_depayload_push:
- * @filter: a #GstBaseRTPDepayload
- * @out_buf: a #GstBuffer
- *
- * Push @out_buf to the peer of @filter. This function takes ownership of
- * @out_buf.
- *
- * Unlike gst_base_rtp_depayload_push_ts(), this function will not apply
- * any timestamp on the outgoing buffer.
- *
- * Returns: a #GstFlowReturn.
- */
-GstFlowReturn
-gst_base_rtp_depayload_push (GstBaseRTPDepayload * filter, GstBuffer * out_buf)
-{
- return gst_base_rtp_depayload_push_full (filter, FALSE, 0, out_buf);
-}
-
-/* convert the PacketLost event form a jitterbuffer to a segment update.
- * subclasses can override this. */
-static gboolean
-gst_base_rtp_depayload_packet_lost (GstBaseRTPDepayload * filter,
- GstEvent * event)
-{
- GstClockTime timestamp, duration, position;
- GstEvent *sevent;
- const GstStructure *s;
-
- s = gst_event_get_structure (event);
-
- /* first start by parsing the timestamp and duration */
- timestamp = -1;
- duration = -1;
-
- gst_structure_get_clock_time (s, "timestamp", &timestamp);
- gst_structure_get_clock_time (s, "duration", &duration);
-
- position = timestamp;
- if (duration != -1)
- position += duration;
-
- /* update the current segment with the elapsed time */
- sevent = create_segment_event (filter, TRUE, position);
-
- return gst_pad_push_event (filter->srcpad, sevent);
-}
-
-static void
-gst_base_rtp_depayload_set_gst_timestamp (GstBaseRTPDepayload * filter,
- guint32 rtptime, GstBuffer * buf)
-{
- GstBaseRTPDepayloadPrivate *priv;
- GstClockTime timestamp, duration;
-
- priv = filter->priv;
-
- timestamp = GST_BUFFER_TIMESTAMP (buf);
- duration = GST_BUFFER_DURATION (buf);
-
- /* apply last incomming timestamp and duration to outgoing buffer if
- * not otherwise set. */
- if (!GST_CLOCK_TIME_IS_VALID (timestamp))
- GST_BUFFER_TIMESTAMP (buf) = priv->timestamp;
- if (!GST_CLOCK_TIME_IS_VALID (duration))
- GST_BUFFER_DURATION (buf) = priv->duration;
-}
-
-static GstStateChangeReturn
-gst_base_rtp_depayload_change_state (GstElement * element,
- GstStateChange transition)
-{
- GstBaseRTPDepayload *filter;
- GstBaseRTPDepayloadPrivate *priv;
- GstStateChangeReturn ret;
-
- filter = GST_BASE_RTP_DEPAYLOAD (element);
- priv = filter->priv;
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- filter->need_newsegment = TRUE;
- priv->npt_start = 0;
- priv->npt_stop = -1;
- priv->play_speed = 1.0;
- priv->play_scale = 1.0;
- priv->next_seqnum = -1;
- priv->negotiated = FALSE;
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- break;
- default:
- break;
- }
- return ret;
-}
-
-static void
-gst_base_rtp_depayload_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstBaseRTPDepayload *filter;
-
- filter = GST_BASE_RTP_DEPAYLOAD (object);
-
- switch (prop_id) {
- case PROP_QUEUE_DELAY:
- filter->queue_delay = g_value_get_uint (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_base_rtp_depayload_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstBaseRTPDepayload *filter;
-
- filter = GST_BASE_RTP_DEPAYLOAD (object);
-
- switch (prop_id) {
- case PROP_QUEUE_DELAY:
- g_value_set_uint (value, filter->queue_delay);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
diff --git a/gst-libs/gst/rtp/gstbasertpdepayload.h b/gst-libs/gst/rtp/gstbasertpdepayload.h
deleted file mode 100644
index d20ed914..00000000
--- a/gst-libs/gst/rtp/gstbasertpdepayload.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_BASE_RTP_DEPAYLOAD_H__
-#define __GST_BASE_RTP_DEPAYLOAD_H__
-
-#include <gst/gst.h>
-#include <gst/rtp/gstrtpbuffer.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_BASE_RTP_DEPAYLOAD (gst_base_rtp_depayload_get_type())
-#define GST_BASE_RTP_DEPAYLOAD(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayload))
-#define GST_BASE_RTP_DEPAYLOAD_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayloadClass))
-#define GST_BASE_RTP_DEPAYLOAD_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayloadClass))
-#define GST_IS_BASE_RTP_DEPAYLOAD(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_RTP_DEPAYLOAD))
-#define GST_IS_BASE_RTP_DEPAYLOAD_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_RTP_DEPAYLOAD))
-
-#define GST_BASE_RTP_DEPAYLOAD_SINKPAD(depayload) (GST_BASE_RTP_DEPAYLOAD (depayload)->sinkpad)
-#define GST_BASE_RTP_DEPAYLOAD_SRCPAD(depayload) (GST_BASE_RTP_DEPAYLOAD (depayload)->srcpad)
-
-#ifndef GST_DISABLE_DEPRECATED
-/* this was presumably never meant to be public API, or should at least
- * have been prefixed if it was. Don't use. (FIXME: remove in 0.11) */
-#define QUEUE_LOCK_INIT(base) (g_static_rec_mutex_init(&base->queuelock))
-#define QUEUE_LOCK_FREE(base) (g_static_rec_mutex_free(&base->queuelock))
-#define QUEUE_LOCK(base) (g_static_rec_mutex_lock(&base->queuelock))
-#define QUEUE_UNLOCK(base) (g_static_rec_mutex_unlock(&base->queuelock))
-#endif
-
-typedef struct _GstBaseRTPDepayload GstBaseRTPDepayload;
-typedef struct _GstBaseRTPDepayloadClass GstBaseRTPDepayloadClass;
-typedef struct _GstBaseRTPDepayloadPrivate GstBaseRTPDepayloadPrivate;
-
-struct _GstBaseRTPDepayload
-{
- GstElement parent;
-
- GstPad *sinkpad, *srcpad;
-
-#ifndef GST_REMOVE_DEPRECATED
- /* lock to protect the queue, deprecated */
- GStaticRecMutex queuelock;
-
- /* deprecated */
- gboolean thread_running;
- /* the releaser thread, deprecated */
- GThread *thread;
-#endif
-
- /* this attribute must be set by the child */
- guint clock_rate;
-
-#ifndef GST_REMOVE_DEPRECATED
- /* this value can be modified by the child if needed, deprecated */
- guint queue_delay;
-#endif
-
- /* we will queue up to RTP_QUEUEDELAY ms of packets,
- * reordering them if necessary
- * dropping any packets that are more than
- * RTP_QUEUEDELAY ms late, deprecated */
- GQueue *queue;
-
- GstSegment segment;
- gboolean need_newsegment;
-
- /*< private >*/
- GstBaseRTPDepayloadPrivate *priv;
-
- gpointer _gst_reserved[GST_PADDING-1];
-};
-
-struct _GstBaseRTPDepayloadClass
-{
- GstElementClass parent_class;
-
- /* virtuals, inform the subclass of the caps. */
- gboolean (*set_caps) (GstBaseRTPDepayload *filter, GstCaps *caps);
-
- /* non-pure function, default implementation in base class
- * this does buffering, reordering and dropping, deprecated */
- GstFlowReturn (*add_to_queue) (GstBaseRTPDepayload *filter, GstBuffer *in);
-
- /* pure virtual function, child must use this to process incoming
- * rtp packets. If the child returns a buffer without a valid timestamp,
- * the timestamp of @in will be applied to the result buffer and the
- * buffer will be pushed. If this function returns %NULL, nothing is
- * pushed. */
- GstBuffer * (*process) (GstBaseRTPDepayload *base, GstBuffer *in);
-
- /* non-pure function used to convert from RTP timestamp to GST timestamp
- * this function is used by the child class before gst_pad_pushing */
- void (*set_gst_timestamp) (GstBaseRTPDepayload *filter, guint32 timestamp, GstBuffer *buf);
-
- /* 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) (GstBaseRTPDepayload *filter, GstEvent *event);
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING-1];
-};
-
-GType gst_base_rtp_depayload_get_type (void);
-
-GstFlowReturn gst_base_rtp_depayload_push (GstBaseRTPDepayload *filter, GstBuffer *out_buf);
-GstFlowReturn gst_base_rtp_depayload_push_ts (GstBaseRTPDepayload *filter,
- guint32 timestamp, GstBuffer *out_buf);
-
-G_END_DECLS
-
-#endif /* __GST_BASE_RTP_DEPAYLOAD_H__ */
diff --git a/gst-libs/gst/rtp/gstbasertppayload.c b/gst-libs/gst/rtp/gstbasertppayload.c
deleted file mode 100644
index 783e4020..00000000
--- a/gst-libs/gst/rtp/gstbasertppayload.c
+++ /dev/null
@@ -1,1018 +0,0 @@
-/* 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
- */
-
-/**
- * SECTION:gstbasertppayload
- * @short_description: Base class for RTP payloader
- *
- * <refsect2>
- * <para>
- * Provides a base class for RTP payloaders
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <string.h>
-
-#include <gst/rtp/gstrtpbuffer.h>
-
-#include "gstbasertppayload.h"
-
-GST_DEBUG_CATEGORY_STATIC (basertppayload_debug);
-#define GST_CAT_DEFAULT (basertppayload_debug)
-
-#define GST_BASE_RTP_PAYLOAD_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BASE_RTP_PAYLOAD, GstBaseRTPPayloadPrivate))
-
-struct _GstBaseRTPPayloadPrivate
-{
- gboolean ts_offset_random;
- gboolean seqnum_offset_random;
- gboolean ssrc_random;
- guint16 next_seqnum;
- gboolean perfect_rtptime;
-
- gint64 prop_max_ptime;
- gint64 caps_max_ptime;
-};
-
-/* BaseRTPPayload signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-/* FIXME 0.11, a better default is the Ethernet MTU of
- * 1500 - sizeof(headers) as pointed out by marcelm in IRC:
- * So an Ethernet MTU of 1500, minus 60 for the max IP, minus 8 for UDP, gives
- * 1432 bytes or so. And that should be adjusted downward further for other
- * encapsulations like PPPoE, so 1400 at most.
- */
-#define DEFAULT_MTU 1400
-#define DEFAULT_PT 96
-#define DEFAULT_SSRC -1
-#define DEFAULT_TIMESTAMP_OFFSET -1
-#define DEFAULT_SEQNUM_OFFSET -1
-#define DEFAULT_MAX_PTIME -1
-#define DEFAULT_MIN_PTIME 0
-#define DEFAULT_PERFECT_RTPTIME TRUE
-
-enum
-{
- PROP_0,
- PROP_MTU,
- PROP_PT,
- PROP_SSRC,
- PROP_TIMESTAMP_OFFSET,
- PROP_SEQNUM_OFFSET,
- PROP_MAX_PTIME,
- PROP_MIN_PTIME,
- PROP_TIMESTAMP,
- PROP_SEQNUM,
- PROP_PERFECT_RTPTIME,
- PROP_LAST
-};
-
-static void gst_basertppayload_class_init (GstBaseRTPPayloadClass * klass);
-static void gst_basertppayload_base_init (GstBaseRTPPayloadClass * klass);
-static void gst_basertppayload_init (GstBaseRTPPayload * basertppayload,
- gpointer g_class);
-static void gst_basertppayload_finalize (GObject * object);
-
-static gboolean gst_basertppayload_sink_setcaps (GstPad * pad, GstCaps * caps);
-static GstCaps *gst_basertppayload_sink_getcaps (GstPad * pad);
-static gboolean gst_basertppayload_event (GstPad * pad, GstEvent * event);
-static GstFlowReturn gst_basertppayload_chain (GstPad * pad,
- GstBuffer * buffer);
-
-static void gst_basertppayload_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_basertppayload_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static GstStateChangeReturn gst_basertppayload_change_state (GstElement *
- element, GstStateChange transition);
-
-static GstElementClass *parent_class = NULL;
-
-/* FIXME 0.11: API should be changed to gst_base_typ_payload_xyz */
-
-GType
-gst_basertppayload_get_type (void)
-{
- static GType basertppayload_type = 0;
-
- if (!basertppayload_type) {
- static const GTypeInfo basertppayload_info = {
- sizeof (GstBaseRTPPayloadClass),
- (GBaseInitFunc) gst_basertppayload_base_init,
- NULL,
- (GClassInitFunc) gst_basertppayload_class_init,
- NULL,
- NULL,
- sizeof (GstBaseRTPPayload),
- 0,
- (GInstanceInitFunc) gst_basertppayload_init,
- };
-
- basertppayload_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstBaseRTPPayload",
- &basertppayload_info, G_TYPE_FLAG_ABSTRACT);
- }
- return basertppayload_type;
-}
-
-static void
-gst_basertppayload_base_init (GstBaseRTPPayloadClass * klass)
-{
-}
-
-static void
-gst_basertppayload_class_init (GstBaseRTPPayloadClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- g_type_class_add_private (klass, sizeof (GstBaseRTPPayloadPrivate));
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->finalize = gst_basertppayload_finalize;
-
- gobject_class->set_property = gst_basertppayload_set_property;
- gobject_class->get_property = gst_basertppayload_get_property;
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_MTU,
- g_param_spec_uint ("mtu", "MTU",
- "Maximum size of one packet",
- 28, G_MAXUINT, DEFAULT_MTU,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PT,
- g_param_spec_uint ("pt", "payload type",
- "The payload type of the packets", 0, 0x80, DEFAULT_PT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SSRC,
- g_param_spec_uint ("ssrc", "SSRC",
- "The SSRC of the packets (default == random)", 0, G_MAXUINT32,
- DEFAULT_SSRC, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass),
- PROP_TIMESTAMP_OFFSET, g_param_spec_uint ("timestamp-offset",
- "Timestamp Offset",
- "Offset to add to all outgoing timestamps (default = random)", 0,
- G_MAXUINT32, DEFAULT_TIMESTAMP_OFFSET,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SEQNUM_OFFSET,
- g_param_spec_int ("seqnum-offset", "Sequence number Offset",
- "Offset to add to all outgoing seqnum (-1 = random)", -1, G_MAXUINT16,
- DEFAULT_SEQNUM_OFFSET, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_MAX_PTIME,
- g_param_spec_int64 ("max-ptime", "Max packet time",
- "Maximum duration of the packet data in ns (-1 = unlimited up to MTU)",
- -1, G_MAXINT64, DEFAULT_MAX_PTIME,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstBaseRTPAudioPayload:min-ptime:
- *
- * Minimum duration of the packet data in ns (can't go above MTU)
- *
- * Since: 0.10.13
- **/
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_MIN_PTIME,
- g_param_spec_int64 ("min-ptime", "Min packet time",
- "Minimum duration of the packet data in ns (can't go above MTU)",
- 0, G_MAXINT64, DEFAULT_MIN_PTIME,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_TIMESTAMP,
- g_param_spec_uint ("timestamp", "Timestamp",
- "The RTP timestamp of the last processed packet",
- 0, G_MAXUINT32, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SEQNUM,
- g_param_spec_uint ("seqnum", "Sequence number",
- "The RTP sequence number of the last processed packet",
- 0, G_MAXUINT16, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstBaseRTPAudioPayload:perfect-rtptime:
- *
- * Try to use the offset fields to generate perfect RTP timestamps. when this
- * option is disabled, RTP timestamps are generated from the GStreamer
- * timestamps, which could result in RTP timestamps that don't increment with
- * the amount of data in the packet.
- *
- * Since: 0.10.25
- */
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PERFECT_RTPTIME,
- g_param_spec_boolean ("perfect-rtptime", "Perfect RTP Time",
- "Generate perfect RTP timestamps when possible",
- DEFAULT_PERFECT_RTPTIME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstelement_class->change_state = gst_basertppayload_change_state;
-
- GST_DEBUG_CATEGORY_INIT (basertppayload_debug, "basertppayload", 0,
- "Base class for RTP Payloaders");
-}
-
-static void
-gst_basertppayload_init (GstBaseRTPPayload * basertppayload, gpointer g_class)
-{
- GstPadTemplate *templ;
- GstBaseRTPPayloadPrivate *priv;
-
- basertppayload->priv = priv =
- GST_BASE_RTP_PAYLOAD_GET_PRIVATE (basertppayload);
-
- templ =
- gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "src");
- g_return_if_fail (templ != NULL);
-
- basertppayload->srcpad = gst_pad_new_from_template (templ, "src");
- gst_element_add_pad (GST_ELEMENT (basertppayload), basertppayload->srcpad);
-
- templ =
- gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "sink");
- g_return_if_fail (templ != NULL);
-
- basertppayload->sinkpad = gst_pad_new_from_template (templ, "sink");
- gst_pad_set_setcaps_function (basertppayload->sinkpad,
- gst_basertppayload_sink_setcaps);
- gst_pad_set_getcaps_function (basertppayload->sinkpad,
- gst_basertppayload_sink_getcaps);
- gst_pad_set_event_function (basertppayload->sinkpad,
- gst_basertppayload_event);
- gst_pad_set_chain_function (basertppayload->sinkpad,
- gst_basertppayload_chain);
- gst_element_add_pad (GST_ELEMENT (basertppayload), basertppayload->sinkpad);
-
- basertppayload->seq_rand = g_rand_new_with_seed (g_random_int ());
- basertppayload->ssrc_rand = g_rand_new_with_seed (g_random_int ());
- basertppayload->ts_rand = g_rand_new_with_seed (g_random_int ());
-
- basertppayload->mtu = DEFAULT_MTU;
- basertppayload->pt = DEFAULT_PT;
- basertppayload->seqnum_offset = DEFAULT_SEQNUM_OFFSET;
- basertppayload->ssrc = DEFAULT_SSRC;
- basertppayload->ts_offset = DEFAULT_TIMESTAMP_OFFSET;
- priv->seqnum_offset_random = (basertppayload->seqnum_offset == -1);
- priv->ts_offset_random = (basertppayload->ts_offset == -1);
- priv->ssrc_random = (basertppayload->ssrc == -1);
-
- basertppayload->max_ptime = DEFAULT_MAX_PTIME;
- basertppayload->min_ptime = DEFAULT_MIN_PTIME;
- basertppayload->priv->perfect_rtptime = DEFAULT_PERFECT_RTPTIME;
-
- basertppayload->media = NULL;
- basertppayload->encoding_name = NULL;
-
- basertppayload->clock_rate = 0;
-
- basertppayload->priv->caps_max_ptime = DEFAULT_MAX_PTIME;
- basertppayload->priv->prop_max_ptime = DEFAULT_MAX_PTIME;
-}
-
-static void
-gst_basertppayload_finalize (GObject * object)
-{
- GstBaseRTPPayload *basertppayload;
-
- basertppayload = GST_BASE_RTP_PAYLOAD (object);
-
- g_rand_free (basertppayload->seq_rand);
- basertppayload->seq_rand = NULL;
- g_rand_free (basertppayload->ssrc_rand);
- basertppayload->ssrc_rand = NULL;
- g_rand_free (basertppayload->ts_rand);
- basertppayload->ts_rand = NULL;
-
- g_free (basertppayload->media);
- basertppayload->media = NULL;
- g_free (basertppayload->encoding_name);
- basertppayload->encoding_name = NULL;
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static gboolean
-gst_basertppayload_sink_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstBaseRTPPayload *basertppayload;
- GstBaseRTPPayloadClass *basertppayload_class;
- gboolean ret = TRUE;
-
- GST_DEBUG_OBJECT (pad, "setting caps %" GST_PTR_FORMAT, caps);
- basertppayload = GST_BASE_RTP_PAYLOAD (gst_pad_get_parent (pad));
- basertppayload_class = GST_BASE_RTP_PAYLOAD_GET_CLASS (basertppayload);
-
- if (basertppayload_class->set_caps)
- ret = basertppayload_class->set_caps (basertppayload, caps);
-
- gst_object_unref (basertppayload);
-
- return ret;
-}
-
-static GstCaps *
-gst_basertppayload_sink_getcaps (GstPad * pad)
-{
- GstBaseRTPPayload *basertppayload;
- GstBaseRTPPayloadClass *basertppayload_class;
- GstCaps *caps = NULL;
-
- GST_DEBUG_OBJECT (pad, "getting caps");
-
- basertppayload = GST_BASE_RTP_PAYLOAD (gst_pad_get_parent (pad));
- basertppayload_class = GST_BASE_RTP_PAYLOAD_GET_CLASS (basertppayload);
-
- if (basertppayload_class->get_caps)
- caps = basertppayload_class->get_caps (basertppayload, pad);
-
- if (!caps) {
- caps = GST_PAD_TEMPLATE_CAPS (GST_PAD_PAD_TEMPLATE (pad));
- GST_DEBUG_OBJECT (pad,
- "using pad template %p with caps %p %" GST_PTR_FORMAT,
- GST_PAD_PAD_TEMPLATE (pad), caps, caps);
-
- caps = gst_caps_ref (caps);
- }
-
- gst_object_unref (basertppayload);
-
- return caps;
-}
-
-static gboolean
-gst_basertppayload_event (GstPad * pad, GstEvent * event)
-{
- GstBaseRTPPayload *basertppayload;
- GstBaseRTPPayloadClass *basertppayload_class;
- gboolean res;
-
- basertppayload = GST_BASE_RTP_PAYLOAD (gst_pad_get_parent (pad));
- basertppayload_class = GST_BASE_RTP_PAYLOAD_GET_CLASS (basertppayload);
-
- if (basertppayload_class->handle_event) {
- res = basertppayload_class->handle_event (pad, event);
- if (res)
- goto done;
- }
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_START:
- res = gst_pad_event_default (pad, event);
- break;
- case GST_EVENT_FLUSH_STOP:
- res = gst_pad_event_default (pad, event);
- gst_segment_init (&basertppayload->segment, GST_FORMAT_UNDEFINED);
- break;
- case GST_EVENT_NEWSEGMENT:
- {
- gboolean update;
- gdouble rate;
- GstFormat fmt;
- gint64 start, stop, position;
-
- gst_event_parse_new_segment (event, &update, &rate, &fmt, &start, &stop,
- &position);
- gst_segment_set_newsegment (&basertppayload->segment, update, rate, fmt,
- start, stop, position);
-
- /* fallthrough */
- }
- default:
- res = gst_pad_event_default (pad, event);
- break;
- }
-
-done:
- gst_object_unref (basertppayload);
-
- return res;
-}
-
-
-static GstFlowReturn
-gst_basertppayload_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstBaseRTPPayload *basertppayload;
- GstBaseRTPPayloadClass *basertppayload_class;
- GstFlowReturn ret;
-
- basertppayload = GST_BASE_RTP_PAYLOAD (gst_pad_get_parent (pad));
- basertppayload_class = GST_BASE_RTP_PAYLOAD_GET_CLASS (basertppayload);
-
- if (!basertppayload_class->handle_buffer)
- goto no_function;
-
- ret = basertppayload_class->handle_buffer (basertppayload, buffer);
-
- gst_object_unref (basertppayload);
-
- return ret;
-
- /* ERRORS */
-no_function:
- {
- GST_ELEMENT_ERROR (basertppayload, STREAM, NOT_IMPLEMENTED, (NULL),
- ("subclass did not implement handle_buffer function"));
- gst_object_unref (basertppayload);
- gst_buffer_unref (buffer);
- return GST_FLOW_ERROR;
- }
-}
-
-/**
- * gst_basertppayload_set_options:
- * @payload: a #GstBaseRTPPayload
- * @media: the media type (typically "audio" or "video")
- * @dynamic: if the payload type is dynamic
- * @encoding_name: the encoding name
- * @clock_rate: the clock rate of the media
- *
- * Set the rtp options of the payloader. These options will be set in the caps
- * of the payloader. Subclasses must call this method before calling
- * gst_basertppayload_push() or gst_basertppayload_set_outcaps().
- */
-void
-gst_basertppayload_set_options (GstBaseRTPPayload * payload,
- gchar * media, gboolean dynamic, gchar * encoding_name, guint32 clock_rate)
-{
- g_return_if_fail (payload != NULL);
- g_return_if_fail (clock_rate != 0);
-
- g_free (payload->media);
- payload->media = g_strdup (media);
- payload->dynamic = dynamic;
- g_free (payload->encoding_name);
- payload->encoding_name = g_strdup (encoding_name);
- payload->clock_rate = clock_rate;
-}
-
-static gboolean
-copy_fixed (GQuark field_id, const GValue * value, GstStructure * dest)
-{
- if (gst_value_is_fixed (value)) {
- gst_structure_id_set_value (dest, field_id, value);
- }
- return TRUE;
-}
-
-static void
-update_max_ptime (GstBaseRTPPayload * basertppayload)
-{
- if (basertppayload->priv->caps_max_ptime != -1 &&
- basertppayload->priv->prop_max_ptime != -1)
- basertppayload->max_ptime = MIN (basertppayload->priv->caps_max_ptime,
- basertppayload->priv->prop_max_ptime);
- else if (basertppayload->priv->caps_max_ptime != -1)
- basertppayload->max_ptime = basertppayload->priv->caps_max_ptime;
- else if (basertppayload->priv->prop_max_ptime != -1)
- basertppayload->max_ptime = basertppayload->priv->prop_max_ptime;
- else
- basertppayload->max_ptime = DEFAULT_MAX_PTIME;
-}
-
-/**
- * gst_basertppayload_set_outcaps:
- * @payload: a #GstBaseRTPPayload
- * @fieldname: the first field name or %NULL
- * @...: field values
- *
- * Configure the output caps with the optional parameters.
- *
- * Variable arguments should be in the form field name, field type
- * (as a GType), value(s). The last variable argument should be NULL.
- *
- * Returns: %TRUE if the caps could be set.
- */
-gboolean
-gst_basertppayload_set_outcaps (GstBaseRTPPayload * payload, gchar * fieldname,
- ...)
-{
- GstCaps *srccaps, *peercaps;
- gboolean res;
-
- /* fill in the defaults, their properties cannot be negotiated. */
- srccaps = gst_caps_new_simple ("application/x-rtp",
- "media", G_TYPE_STRING, payload->media,
- "clock-rate", G_TYPE_INT, payload->clock_rate,
- "encoding-name", G_TYPE_STRING, payload->encoding_name, NULL);
-
- GST_DEBUG_OBJECT (payload, "defaults: %" GST_PTR_FORMAT, srccaps);
-
- if (fieldname) {
- va_list varargs;
-
- /* override with custom properties */
- va_start (varargs, fieldname);
- gst_caps_set_simple_valist (srccaps, fieldname, varargs);
- va_end (varargs);
-
- GST_DEBUG_OBJECT (payload, "custom added: %" GST_PTR_FORMAT, srccaps);
- }
-
- payload->priv->caps_max_ptime = DEFAULT_MAX_PTIME;
- payload->abidata.ABI.ptime = 0;
-
- /* the peer caps can override some of the defaults */
- peercaps = gst_pad_peer_get_caps (payload->srcpad);
- if (peercaps == NULL) {
- /* no peer caps, just add the other properties */
- gst_caps_set_simple (srccaps,
- "payload", G_TYPE_INT, GST_BASE_RTP_PAYLOAD_PT (payload),
- "ssrc", G_TYPE_UINT, payload->current_ssrc,
- "clock-base", G_TYPE_UINT, payload->ts_base,
- "seqnum-base", G_TYPE_UINT, payload->seqnum_base, NULL);
-
- GST_DEBUG_OBJECT (payload, "no peer caps: %" GST_PTR_FORMAT, srccaps);
- } else {
- GstCaps *temp;
- GstStructure *s, *d;
- const GValue *value;
- gint pt;
- guint max_ptime, ptime;
-
- /* peer provides caps we can use to fixate, intersect. This always returns a
- * writable caps. */
- temp = gst_caps_intersect (srccaps, peercaps);
- gst_caps_unref (srccaps);
- gst_caps_unref (peercaps);
-
- if (gst_caps_is_empty (temp)) {
- gst_caps_unref (temp);
- return FALSE;
- }
-
- /* now fixate, start by taking the first caps */
- gst_caps_truncate (temp);
-
- /* get first structure */
- s = gst_caps_get_structure (temp, 0);
-
- if (gst_structure_get_uint (s, "maxptime", &max_ptime))
- payload->priv->caps_max_ptime = max_ptime * GST_MSECOND;
-
- if (gst_structure_get_uint (s, "ptime", &ptime))
- payload->abidata.ABI.ptime = ptime * GST_MSECOND;
-
- if (gst_structure_get_int (s, "payload", &pt)) {
- /* use peer pt */
- GST_BASE_RTP_PAYLOAD_PT (payload) = pt;
- GST_LOG_OBJECT (payload, "using peer pt %d", pt);
- } else {
- if (gst_structure_has_field (s, "payload")) {
- /* can only fixate if there is a field */
- gst_structure_fixate_field_nearest_int (s, "payload",
- GST_BASE_RTP_PAYLOAD_PT (payload));
- gst_structure_get_int (s, "payload", &pt);
- GST_LOG_OBJECT (payload, "using peer pt %d", pt);
- } else {
- /* no pt field, use the internal pt */
- pt = GST_BASE_RTP_PAYLOAD_PT (payload);
- gst_structure_set (s, "payload", G_TYPE_INT, pt, NULL);
- GST_LOG_OBJECT (payload, "using internal pt %d", pt);
- }
- }
-
- if (gst_structure_has_field_typed (s, "ssrc", G_TYPE_UINT)) {
- value = gst_structure_get_value (s, "ssrc");
- payload->current_ssrc = g_value_get_uint (value);
- GST_LOG_OBJECT (payload, "using peer ssrc %08x", payload->current_ssrc);
- } else {
- /* FIXME, fixate_nearest_uint would be even better */
- gst_structure_set (s, "ssrc", G_TYPE_UINT, payload->current_ssrc, NULL);
- GST_LOG_OBJECT (payload, "using internal ssrc %08x",
- payload->current_ssrc);
- }
-
- if (gst_structure_has_field_typed (s, "clock-base", G_TYPE_UINT)) {
- value = gst_structure_get_value (s, "clock-base");
- payload->ts_base = g_value_get_uint (value);
- GST_LOG_OBJECT (payload, "using peer clock-base %u", payload->ts_base);
- } else {
- /* FIXME, fixate_nearest_uint would be even better */
- gst_structure_set (s, "clock-base", G_TYPE_UINT, payload->ts_base, NULL);
- GST_LOG_OBJECT (payload, "using internal clock-base %u",
- payload->ts_base);
- }
- if (gst_structure_has_field_typed (s, "seqnum-base", G_TYPE_UINT)) {
- value = gst_structure_get_value (s, "seqnum-base");
- payload->seqnum_base = g_value_get_uint (value);
- GST_LOG_OBJECT (payload, "using peer seqnum-base %u",
- payload->seqnum_base);
- } else {
- /* FIXME, fixate_nearest_uint would be even better */
- gst_structure_set (s, "seqnum-base", G_TYPE_UINT, payload->seqnum_base,
- NULL);
- GST_LOG_OBJECT (payload, "using internal seqnum-base %u",
- payload->seqnum_base);
- }
-
- /* make the target caps by copying over all the fixed caps, removing the
- * unfixed caps. */
- srccaps = gst_caps_new_simple (gst_structure_get_name (s), NULL);
- d = gst_caps_get_structure (srccaps, 0);
-
- gst_structure_foreach (s, (GstStructureForeachFunc) copy_fixed, d);
-
- gst_caps_unref (temp);
-
- GST_DEBUG_OBJECT (payload, "with peer caps: %" GST_PTR_FORMAT, srccaps);
- }
-
- update_max_ptime (payload);
-
- res = gst_pad_set_caps (GST_BASE_RTP_PAYLOAD_SRCPAD (payload), srccaps);
- gst_caps_unref (srccaps);
-
- return res;
-}
-
-/**
- * gst_basertppayload_is_filled:
- * @payload: a #GstBaseRTPPayload
- * @size: the size of the packet
- * @duration: the duration of the packet
- *
- * Check if the packet with @size and @duration would exceed the configured
- * maximum size.
- *
- * Returns: %TRUE if the packet of @size and @duration would exceed the
- * configured MTU or max_ptime.
- */
-gboolean
-gst_basertppayload_is_filled (GstBaseRTPPayload * payload,
- guint size, GstClockTime duration)
-{
- if (size > payload->mtu)
- return TRUE;
-
- if (payload->max_ptime != -1 && duration >= payload->max_ptime)
- return TRUE;
-
- return FALSE;
-}
-
-typedef struct
-{
- GstBaseRTPPayload *payload;
- guint32 ssrc;
- guint16 seqnum;
- guint8 pt;
- GstCaps *caps;
- GstClockTime timestamp;
- guint64 offset;
- guint32 rtptime;
-} HeaderData;
-
-static GstBufferListItem
-find_timestamp (GstBuffer ** buffer, guint group, guint idx, HeaderData * data)
-{
- data->timestamp = GST_BUFFER_TIMESTAMP (*buffer);
- data->offset = GST_BUFFER_OFFSET (*buffer);
-
- /* stop when we find a timestamp. We take whatever offset is associated with
- * the timestamp (if any) to do perfect timestamps when we need to. */
- if (data->timestamp != -1)
- return GST_BUFFER_LIST_END;
- else
- return GST_BUFFER_LIST_CONTINUE;
-}
-
-static GstBufferListItem
-set_headers (GstBuffer ** buffer, guint group, guint idx, HeaderData * data)
-{
- gst_rtp_buffer_set_ssrc (*buffer, data->ssrc);
- gst_rtp_buffer_set_payload_type (*buffer, data->pt);
- gst_rtp_buffer_set_seq (*buffer, data->seqnum);
- gst_rtp_buffer_set_timestamp (*buffer, data->rtptime);
- gst_buffer_set_caps (*buffer, data->caps);
- /* increment the seqnum for each buffer */
- data->seqnum++;
-
- return GST_BUFFER_LIST_SKIP_GROUP;
-}
-
-/* Updates the SSRC, payload type, seqnum and timestamp of the RTP buffer
- * before the buffer is pushed. */
-static GstFlowReturn
-gst_basertppayload_prepare_push (GstBaseRTPPayload * payload,
- gpointer obj, gboolean is_list)
-{
- GstBaseRTPPayloadPrivate *priv;
- HeaderData data;
-
- if (payload->clock_rate == 0)
- goto no_rate;
-
- priv = payload->priv;
-
- /* update first, so that the property is set to the last
- * seqnum pushed */
- payload->seqnum = priv->next_seqnum;
-
- /* fill in the fields we want to set on all headers */
- data.payload = payload;
- data.seqnum = payload->seqnum;
- data.ssrc = payload->current_ssrc;
- data.pt = payload->pt;
- data.caps = GST_PAD_CAPS (payload->srcpad);
-
- /* find the first buffer with a timestamp */
- if (is_list) {
- data.timestamp = -1;
- data.offset = GST_BUFFER_OFFSET_NONE;
- gst_buffer_list_foreach (GST_BUFFER_LIST_CAST (obj),
- (GstBufferListFunc) find_timestamp, &data);
- } else {
- data.timestamp = GST_BUFFER_TIMESTAMP (GST_BUFFER_CAST (obj));
- data.offset = GST_BUFFER_OFFSET (GST_BUFFER_CAST (obj));
- }
-
- /* convert to RTP time */
- if (priv->perfect_rtptime && data.offset != GST_BUFFER_OFFSET_NONE) {
- /* if we have an offset, use that for making an RTP timestamp */
- data.rtptime = payload->ts_base + data.offset;
- GST_LOG_OBJECT (payload,
- "Using offset %" G_GUINT64_FORMAT " for RTP timestamp", data.offset);
- } else if (GST_CLOCK_TIME_IS_VALID (data.timestamp)) {
- gint64 rtime;
-
- /* no offset, use the gstreamer timestamp */
- rtime = gst_segment_to_running_time (&payload->segment, GST_FORMAT_TIME,
- data.timestamp);
-
- GST_LOG_OBJECT (payload,
- "Using running_time %" GST_TIME_FORMAT " for RTP timestamp",
- GST_TIME_ARGS (rtime));
-
- rtime = gst_util_uint64_scale_int (rtime, payload->clock_rate, GST_SECOND);
-
- /* add running_time in clock-rate units to the base timestamp */
- data.rtptime = payload->ts_base + rtime;
- } else {
- GST_LOG_OBJECT (payload,
- "Using previous RTP timestamp %" G_GUINT32_FORMAT, payload->timestamp);
- /* no timestamp to convert, take previous timestamp */
- data.rtptime = payload->timestamp;
- }
-
- /* set ssrc, payload type, seq number, caps and rtptime */
- if (is_list) {
- gst_buffer_list_foreach (GST_BUFFER_LIST_CAST (obj),
- (GstBufferListFunc) set_headers, &data);
- } else {
- GstBuffer *buf = GST_BUFFER_CAST (obj);
- set_headers (&buf, 0, 0, &data);
- }
-
- priv->next_seqnum = data.seqnum;
- payload->timestamp = data.rtptime;
-
- GST_LOG_OBJECT (payload,
- "Preparing to push packet with size %d, seq=%d, rtptime=%u, timestamp %"
- GST_TIME_FORMAT, (is_list) ? -1 :
- GST_BUFFER_SIZE (GST_BUFFER (obj)), payload->seqnum, data.rtptime,
- GST_TIME_ARGS (data.timestamp));
-
- return GST_FLOW_OK;
-
- /* ERRORS */
-no_rate:
- {
- GST_ELEMENT_ERROR (payload, STREAM, NOT_IMPLEMENTED, (NULL),
- ("subclass did not specify clock-rate"));
- return GST_FLOW_ERROR;
- }
-}
-
-/**
- * gst_basertppayload_push_list:
- * @payload: a #GstBaseRTPPayload
- * @list: a #GstBufferList
- *
- * Push @list to the peer element of the payloader. The SSRC, payload type,
- * seqnum and timestamp of the RTP buffer will be updated first.
- *
- * This function takes ownership of @list.
- *
- * Returns: a #GstFlowReturn.
- *
- * Since: 0.10.24
- */
-GstFlowReturn
-gst_basertppayload_push_list (GstBaseRTPPayload * payload, GstBufferList * list)
-{
- GstFlowReturn res;
-
- res = gst_basertppayload_prepare_push (payload, list, TRUE);
-
- if (G_LIKELY (res == GST_FLOW_OK))
- res = gst_pad_push_list (payload->srcpad, list);
- else
- gst_buffer_list_unref (list);
-
- return res;
-}
-
-/**
- * gst_basertppayload_push:
- * @payload: a #GstBaseRTPPayload
- * @buffer: a #GstBuffer
- *
- * Push @buffer to the peer element of the payloader. The SSRC, payload type,
- * seqnum and timestamp of the RTP buffer will be updated first.
- *
- * This function takes ownership of @buffer.
- *
- * Returns: a #GstFlowReturn.
- */
-GstFlowReturn
-gst_basertppayload_push (GstBaseRTPPayload * payload, GstBuffer * buffer)
-{
- GstFlowReturn res;
-
- res = gst_basertppayload_prepare_push (payload, buffer, FALSE);
-
- if (G_LIKELY (res == GST_FLOW_OK))
- res = gst_pad_push (payload->srcpad, buffer);
- else
- gst_buffer_unref (buffer);
-
- return res;
-}
-
-static void
-gst_basertppayload_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstBaseRTPPayload *basertppayload;
- GstBaseRTPPayloadPrivate *priv;
- gint64 val;
-
- basertppayload = GST_BASE_RTP_PAYLOAD (object);
- priv = basertppayload->priv;
-
- switch (prop_id) {
- case PROP_MTU:
- basertppayload->mtu = g_value_get_uint (value);
- break;
- case PROP_PT:
- basertppayload->pt = g_value_get_uint (value);
- break;
- case PROP_SSRC:
- val = g_value_get_uint (value);
- basertppayload->ssrc = val;
- priv->ssrc_random = FALSE;
- break;
- case PROP_TIMESTAMP_OFFSET:
- val = g_value_get_uint (value);
- basertppayload->ts_offset = val;
- priv->ts_offset_random = FALSE;
- break;
- case PROP_SEQNUM_OFFSET:
- val = g_value_get_int (value);
- basertppayload->seqnum_offset = val;
- priv->seqnum_offset_random = (val == -1);
- GST_DEBUG_OBJECT (basertppayload, "seqnum offset 0x%04x, random %d",
- basertppayload->seqnum_offset, priv->seqnum_offset_random);
- break;
- case PROP_MAX_PTIME:
- basertppayload->priv->prop_max_ptime = g_value_get_int64 (value);
- update_max_ptime (basertppayload);
- break;
- case PROP_MIN_PTIME:
- basertppayload->min_ptime = g_value_get_int64 (value);
- break;
- case PROP_PERFECT_RTPTIME:
- priv->perfect_rtptime = g_value_get_boolean (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_basertppayload_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstBaseRTPPayload *basertppayload;
- GstBaseRTPPayloadPrivate *priv;
-
- basertppayload = GST_BASE_RTP_PAYLOAD (object);
- priv = basertppayload->priv;
-
- switch (prop_id) {
- case PROP_MTU:
- g_value_set_uint (value, basertppayload->mtu);
- break;
- case PROP_PT:
- g_value_set_uint (value, basertppayload->pt);
- break;
- case PROP_SSRC:
- if (priv->ssrc_random)
- g_value_set_uint (value, -1);
- else
- g_value_set_uint (value, basertppayload->ssrc);
- break;
- case PROP_TIMESTAMP_OFFSET:
- if (priv->ts_offset_random)
- g_value_set_uint (value, -1);
- else
- g_value_set_uint (value, (guint32) basertppayload->ts_offset);
- break;
- case PROP_SEQNUM_OFFSET:
- if (priv->seqnum_offset_random)
- g_value_set_int (value, -1);
- else
- g_value_set_int (value, (guint16) basertppayload->seqnum_offset);
- break;
- case PROP_MAX_PTIME:
- g_value_set_int64 (value, basertppayload->max_ptime);
- break;
- case PROP_MIN_PTIME:
- g_value_set_int64 (value, basertppayload->min_ptime);
- break;
- case PROP_TIMESTAMP:
- g_value_set_uint (value, basertppayload->timestamp);
- break;
- case PROP_SEQNUM:
- g_value_set_uint (value, basertppayload->seqnum);
- break;
- case PROP_PERFECT_RTPTIME:
- g_value_set_boolean (value, priv->perfect_rtptime);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstStateChangeReturn
-gst_basertppayload_change_state (GstElement * element,
- GstStateChange transition)
-{
- GstBaseRTPPayload *basertppayload;
- GstBaseRTPPayloadPrivate *priv;
- GstStateChangeReturn ret;
-
- basertppayload = GST_BASE_RTP_PAYLOAD (element);
- priv = basertppayload->priv;
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- gst_segment_init (&basertppayload->segment, GST_FORMAT_UNDEFINED);
-
- if (priv->seqnum_offset_random)
- basertppayload->seqnum_base = g_random_int_range (0, G_MAXUINT16);
- else
- basertppayload->seqnum_base = basertppayload->seqnum_offset;
- priv->next_seqnum = basertppayload->seqnum_base;
- basertppayload->seqnum = basertppayload->seqnum_base;
-
- if (priv->ssrc_random)
- basertppayload->current_ssrc = g_random_int ();
- else
- basertppayload->current_ssrc = basertppayload->ssrc;
-
- if (priv->ts_offset_random)
- basertppayload->ts_base = g_random_int ();
- else
- basertppayload->ts_base = basertppayload->ts_offset;
- basertppayload->timestamp = basertppayload->ts_base;
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_NULL:
- break;
- default:
- break;
- }
- return ret;
-}
diff --git a/gst-libs/gst/rtp/gstbasertppayload.h b/gst-libs/gst/rtp/gstbasertppayload.h
deleted file mode 100644
index 4802ae88..00000000
--- a/gst-libs/gst/rtp/gstbasertppayload.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_BASE_RTP_PAYLOAD_H__
-#define __GST_BASE_RTP_PAYLOAD_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_BASE_RTP_PAYLOAD \
- (gst_basertppayload_get_type())
-#define GST_BASE_RTP_PAYLOAD(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_RTP_PAYLOAD,GstBaseRTPPayload))
-#define GST_BASE_RTP_PAYLOAD_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_RTP_PAYLOAD,GstBaseRTPPayloadClass))
-#define GST_BASE_RTP_PAYLOAD_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_RTP_PAYLOAD, GstBaseRTPPayloadClass))
-#define GST_IS_BASE_RTP_PAYLOAD(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_RTP_PAYLOAD))
-#define GST_IS_BASE_RTP_PAYLOAD_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_RTP_PAYLOAD))
-#define GST_BASE_RTP_PAYLOAD_CAST(obj) \
- ((GstBaseRTPPayload*)(obj))
-
-typedef struct _GstBaseRTPPayload GstBaseRTPPayload;
-typedef struct _GstBaseRTPPayloadPrivate GstBaseRTPPayloadPrivate;
-typedef struct _GstBaseRTPPayloadClass GstBaseRTPPayloadClass;
-
-/**
- * GST_BASE_RTP_PAYLOAD_SINKPAD:
- * @payload: a #GstBaseRTPPayload
- *
- * Get access to the sinkpad of @payload.
- */
-#define GST_BASE_RTP_PAYLOAD_SINKPAD(payload) (GST_BASE_RTP_PAYLOAD (payload)->sinkpad)
-/**
- * GST_BASE_RTP_PAYLOAD_SRCPAD:
- * @payload: a #GstBaseRTPPayload
- *
- * Get access to the srcpad of @payload.
- */
-#define GST_BASE_RTP_PAYLOAD_SRCPAD(payload) (GST_BASE_RTP_PAYLOAD (payload)->srcpad)
-
-/**
- * GST_BASE_RTP_PAYLOAD_PT:
- * @payload: a #GstBaseRTPPayload
- *
- * Get access to the configured payload type of @payload.
- */
-#define GST_BASE_RTP_PAYLOAD_PT(payload) (GST_BASE_RTP_PAYLOAD (payload)->pt)
-/**
- * GST_BASE_RTP_PAYLOAD_MTU:
- * @payload: a #GstBaseRTPPayload
- *
- * Get access to the configured MTU of @payload.
- */
-#define GST_BASE_RTP_PAYLOAD_MTU(payload) (GST_BASE_RTP_PAYLOAD (payload)->mtu)
-
-struct _GstBaseRTPPayload
-{
- GstElement element;
-
- /*< private >*/
- GstPad *sinkpad;
- GstPad *srcpad;
-
- /* FIXME 0.11: none of these GRands are used anymore, remove them */
- GRand *seq_rand;
- GRand *ssrc_rand;
- GRand *ts_rand;
-
- 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;
-
- /*< private >*/
- GstBaseRTPPayloadPrivate *priv;
-
- union {
- struct {
- guint64 ptime; /* in ns */
- } ABI;
- gpointer _gst_reserved[GST_PADDING - (sizeof(guint64)/sizeof(gpointer)) - 1];
- } abidata;
-};
-
-struct _GstBaseRTPPayloadClass
-{
- GstElementClass parent_class;
-
- /* receive caps on the sink pad, configure the payloader. */
- gboolean (*set_caps) (GstBaseRTPPayload *payload, GstCaps *caps);
- /* handle a buffer, perform 0 or more gst_basertppayload_push() on
- * the RTP buffers. This function takes ownership of the buffer. */
- GstFlowReturn (*handle_buffer) (GstBaseRTPPayload *payload,
- GstBuffer *buffer);
- gboolean (*handle_event) (GstPad * pad, GstEvent * event);
- GstCaps * (*get_caps) (GstBaseRTPPayload *payload, GstPad * pad);
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING-2];
-};
-
-GType gst_basertppayload_get_type (void);
-
-void gst_basertppayload_set_options (GstBaseRTPPayload *payload,
- gchar *media, gboolean dynamic,
- gchar *encoding_name,
- guint32 clock_rate);
-
-gboolean gst_basertppayload_set_outcaps (GstBaseRTPPayload *payload,
- gchar *fieldname, ...);
-
-gboolean gst_basertppayload_is_filled (GstBaseRTPPayload *payload,
- guint size, GstClockTime duration);
-
-GstFlowReturn gst_basertppayload_push (GstBaseRTPPayload *payload,
- GstBuffer *buffer);
-
-GstFlowReturn gst_basertppayload_push_list (GstBaseRTPPayload *payload,
- GstBufferList *list);
-
-G_END_DECLS
-
-#endif /* __GST_BASE_RTP_PAYLOAD_H__ */
diff --git a/gst-libs/gst/rtp/gstrtcpbuffer.c b/gst-libs/gst/rtp/gstrtcpbuffer.c
deleted file mode 100644
index 9177b398..00000000
--- a/gst-libs/gst/rtp/gstrtcpbuffer.c
+++ /dev/null
@@ -1,1945 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstrtcpbuffer
- * @short_description: Helper methods for dealing with RTCP buffers
- * @see_also: #GstBaseRTPPayload, #GstBaseRTPDepayload, #gstrtpbuffer
- *
- * Note: The API in this module is not yet declared stable.
- *
- * <refsect2>
- * <para>
- * The GstRTPCBuffer helper functions makes it easy to parse and create regular
- * #GstBuffer objects that contain compound RTCP packets. These buffers are typically
- * of 'application/x-rtcp' #GstCaps.
- * </para>
- * <para>
- * An RTCP buffer consists of 1 or more #GstRTCPPacket structures that you can
- * retrieve with gst_rtcp_buffer_get_first_packet(). #GstRTCPPacket acts as a pointer
- * into the RTCP buffer; you can move to the next packet with
- * gst_rtcp_packet_move_to_next().
- * </para>
- * </refsect2>
- *
- * Last reviewed on 2007-03-26 (0.10.13)
- *
- * Since: 0.10.13
- */
-
-#include <string.h>
-
-#include "gstrtcpbuffer.h"
-
-/**
- * gst_rtcp_buffer_new_take_data:
- * @data: data for the new buffer
- * @len: the length of data
- *
- * Create a new buffer and set the data and size of the buffer to @data and @len
- * respectively. @data will be freed when the buffer is unreffed, so this
- * function transfers ownership of @data to the new buffer.
- *
- * Returns: A newly allocated buffer with @data and of size @len.
- */
-GstBuffer *
-gst_rtcp_buffer_new_take_data (gpointer data, guint len)
-{
- GstBuffer *result;
-
- g_return_val_if_fail (data != NULL, NULL);
- g_return_val_if_fail (len > 0, NULL);
-
- result = gst_buffer_new ();
-
- GST_BUFFER_MALLOCDATA (result) = data;
- GST_BUFFER_DATA (result) = data;
- GST_BUFFER_SIZE (result) = len;
-
- return result;
-}
-
-/**
- * gst_rtcp_buffer_new_copy_data:
- * @data: data for the new buffer
- * @len: the length of data
- *
- * Create a new buffer and set the data to a copy of @len
- * bytes of @data and the size to @len. The data will be freed when the buffer
- * is freed.
- *
- * Returns: A newly allocated buffer with a copy of @data and of size @len.
- */
-GstBuffer *
-gst_rtcp_buffer_new_copy_data (gpointer data, guint len)
-{
- return gst_rtcp_buffer_new_take_data (g_memdup (data, len), len);
-}
-
-/**
- * gst_rtcp_buffer_validate_data:
- * @data: the data to validate
- * @len: the length of @data to validate
- *
- * Check if the @data and @size point to the data of a valid RTCP (compound)
- * packet.
- * Use this function to validate a packet before using the other functions in
- * this module.
- *
- * Returns: TRUE if the data points to a valid RTCP packet.
- */
-gboolean
-gst_rtcp_buffer_validate_data (guint8 * data, guint len)
-{
- guint16 header_mask;
- guint16 header_len;
- guint8 version;
- guint data_len;
- gboolean padding;
- guint8 pad_bytes;
-
- g_return_val_if_fail (data != NULL, FALSE);
-
- /* we need 4 bytes for the type and length */
- if (G_UNLIKELY (len < 4))
- goto wrong_length;
-
- /* first packet must be RR or SR and version must be 2 */
- header_mask = ((data[0] << 8) | data[1]) & GST_RTCP_VALID_MASK;
- if (G_UNLIKELY (header_mask != GST_RTCP_VALID_VALUE))
- goto wrong_mask;
-
- /* no padding when mask succeeds */
- padding = FALSE;
-
- /* store len */
- data_len = len;
-
- while (TRUE) {
- /* get packet length */
- header_len = (((data[2] << 8) | data[3]) + 1) << 2;
- if (data_len < header_len)
- goto wrong_length;
-
- /* move to next compount packet */
- data += header_len;
- data_len -= header_len;
-
- /* we are at the end now */
- if (data_len < 4)
- break;
-
- /* check version of new packet */
- version = data[0] & 0xc0;
- if (version != (GST_RTCP_VERSION << 6))
- goto wrong_version;
-
- /* padding only allowed on last packet */
- if ((padding = data[0] & 0x20))
- break;
- }
- if (data_len > 0) {
- /* some leftover bytes, check padding */
- if (!padding)
- goto wrong_length;
-
- /* get padding */
- pad_bytes = data[len - 1];
- if (data_len != pad_bytes)
- goto wrong_padding;
- }
- return TRUE;
-
- /* ERRORS */
-wrong_length:
- {
- GST_DEBUG ("len check failed");
- return FALSE;
- }
-wrong_mask:
- {
- GST_DEBUG ("mask check failed (%04x != %04x)", header_mask,
- GST_RTCP_VALID_VALUE);
- return FALSE;
- }
-wrong_version:
- {
- GST_DEBUG ("wrong version (%d < 2)", version >> 6);
- return FALSE;
- }
-wrong_padding:
- {
- GST_DEBUG ("padding check failed");
- return FALSE;
- }
-}
-
-/**
- * gst_rtcp_buffer_validate:
- * @buffer: the buffer to validate
- *
- * Check if the data pointed to by @buffer is a valid RTCP packet using
- * gst_rtcp_buffer_validate_data().
- *
- * Returns: TRUE if @buffer is a valid RTCP packet.
- */
-gboolean
-gst_rtcp_buffer_validate (GstBuffer * buffer)
-{
- guint8 *data;
- guint len;
-
- g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
-
- data = GST_BUFFER_DATA (buffer);
- len = GST_BUFFER_SIZE (buffer);
-
- return gst_rtcp_buffer_validate_data (data, len);
-}
-
-/**
- * gst_rtcp_buffer_new:
- * @mtu: the maximum mtu size.
- *
- * Create a new buffer for constructing RTCP packets. The packet will have a
- * maximum size of @mtu.
- *
- * Returns: A newly allocated buffer.
- */
-GstBuffer *
-gst_rtcp_buffer_new (guint mtu)
-{
- GstBuffer *result;
-
- g_return_val_if_fail (mtu > 0, NULL);
-
- result = gst_buffer_new ();
- GST_BUFFER_MALLOCDATA (result) = g_malloc0 (mtu);
- GST_BUFFER_DATA (result) = GST_BUFFER_MALLOCDATA (result);
- GST_BUFFER_SIZE (result) = mtu;
-
- return result;
-}
-
-/**
- * gst_rtcp_buffer_end:
- * @buffer: a buffer with an RTCP packet
- *
- * Finish @buffer after being constructured. This function is usually called
- * after gst_rtcp_buffer_new() and after adding the RTCP items to the new buffer.
- *
- * The function adjusts the size of @buffer with the total length of all the
- * added packets.
- */
-void
-gst_rtcp_buffer_end (GstBuffer * buffer)
-{
- GstRTCPPacket packet;
-
- g_return_if_fail (GST_IS_BUFFER (buffer));
-
- /* move to the first free space */
- if (gst_rtcp_buffer_get_first_packet (buffer, &packet))
- while (gst_rtcp_packet_move_to_next (&packet));
-
- /* shrink size */
- GST_BUFFER_SIZE (buffer) = packet.offset;
-}
-
-/**
- * gst_rtcp_buffer_get_packet_count:
- * @buffer: a valid RTCP buffer
- *
- * Get the number of RTCP packets in @buffer.
- *
- * Returns: the number of RTCP packets in @buffer.
- */
-guint
-gst_rtcp_buffer_get_packet_count (GstBuffer * buffer)
-{
- GstRTCPPacket packet;
- guint count;
-
- g_return_val_if_fail (GST_IS_BUFFER (buffer), 0);
-
- count = 0;
- if (gst_rtcp_buffer_get_first_packet (buffer, &packet)) {
- do {
- count++;
- } while (gst_rtcp_packet_move_to_next (&packet));
- }
-
- return count;
-}
-
-/**
- * read_packet_header:
- * @packet: a packet
- *
- * Read the packet headers for the packet pointed to by @packet.
- *
- * Returns: TRUE if @packet pointed to a valid header.
- */
-static gboolean
-read_packet_header (GstRTCPPacket * packet)
-{
- guint8 *data;
- guint size;
- guint offset;
-
- g_return_val_if_fail (packet != NULL, FALSE);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
-
- data = GST_BUFFER_DATA (packet->buffer);
- size = GST_BUFFER_SIZE (packet->buffer);
-
- offset = packet->offset;
-
- /* check if we are at the end of the buffer, we add 4 because we also want to
- * ensure we can read the header. */
- if (offset + 4 > size)
- return FALSE;
-
- if ((data[offset] & 0xc0) != (GST_RTCP_VERSION << 6))
- return FALSE;
-
- /* read count, type and length */
- packet->padding = (data[offset] & 0x20) == 0x20;
- packet->count = data[offset] & 0x1f;
- packet->type = data[offset + 1];
- packet->length = (data[offset + 2] << 8) | data[offset + 3];
- packet->item_offset = 4;
- packet->item_count = 0;
- packet->entry_offset = 4;
-
- return TRUE;
-}
-
-/**
- * gst_rtcp_buffer_get_first_packet:
- * @buffer: a valid RTCP buffer
- * @packet: a #GstRTCPPacket
- *
- * Initialize a new #GstRTCPPacket pointer that points to the first packet in
- * @buffer.
- *
- * Returns: TRUE if the packet existed in @buffer.
- */
-gboolean
-gst_rtcp_buffer_get_first_packet (GstBuffer * buffer, GstRTCPPacket * packet)
-{
- g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
- g_return_val_if_fail (packet != NULL, FALSE);
-
- /* init to 0 */
- packet->buffer = buffer;
- packet->offset = 0;
- packet->type = GST_RTCP_TYPE_INVALID;
-
- if (!read_packet_header (packet))
- return FALSE;
-
- return TRUE;
-}
-
-/**
- * gst_rtcp_packet_move_to_next:
- * @packet: a #GstRTCPPacket
- *
- * Move the packet pointer @packet to the next packet in the payload.
- * Use gst_rtcp_buffer_get_first_packet() to initialize @packet.
- *
- * Returns: TRUE if @packet is pointing to a valid packet after calling this
- * function.
- */
-gboolean
-gst_rtcp_packet_move_to_next (GstRTCPPacket * packet)
-{
- g_return_val_if_fail (packet != NULL, FALSE);
- g_return_val_if_fail (packet->type != GST_RTCP_TYPE_INVALID, FALSE);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
-
- /* if we have a padding or invalid packet, it must be the last,
- * return FALSE */
- if (packet->type == GST_RTCP_TYPE_INVALID || packet->padding)
- goto end;
-
- /* move to next packet. Add 4 because the header is not included in length */
- packet->offset += (packet->length << 2) + 4;
-
- /* try to read new header */
- if (!read_packet_header (packet))
- goto end;
-
- return TRUE;
-
- /* ERRORS */
-end:
- {
- packet->type = GST_RTCP_TYPE_INVALID;
- return FALSE;
- }
-}
-
-/**
- * gst_rtcp_buffer_add_packet:
- * @buffer: a valid RTCP buffer
- * @type: the #GstRTCPType of the new packet
- * @packet: pointer to new packet
- *
- * Add a new packet of @type to @buffer. @packet will point to the newly created
- * packet.
- *
- * Returns: %TRUE if the packet could be created. This function returns %FALSE
- * if the max mtu is exceeded for the buffer.
- */
-gboolean
-gst_rtcp_buffer_add_packet (GstBuffer * buffer, GstRTCPType type,
- GstRTCPPacket * packet)
-{
- guint len, size;
- guint8 *data;
- gboolean result;
-
- g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
- g_return_val_if_fail (type != GST_RTCP_TYPE_INVALID, FALSE);
- g_return_val_if_fail (packet != NULL, FALSE);
-
- /* find free space */
- if (gst_rtcp_buffer_get_first_packet (buffer, packet))
- while (gst_rtcp_packet_move_to_next (packet));
-
- size = GST_BUFFER_SIZE (buffer);
-
- /* packet->offset is now pointing to the next free offset in the buffer to
- * start a compount packet. Next we figure out if we have enough free space in
- * the buffer to continue. */
- switch (type) {
- case GST_RTCP_TYPE_SR:
- len = 28;
- break;
- case GST_RTCP_TYPE_RR:
- len = 8;
- break;
- case GST_RTCP_TYPE_SDES:
- len = 4;
- break;
- case GST_RTCP_TYPE_BYE:
- len = 4;
- break;
- case GST_RTCP_TYPE_APP:
- len = 12;
- break;
- case GST_RTCP_TYPE_RTPFB:
- len = 12;
- break;
- case GST_RTCP_TYPE_PSFB:
- len = 12;
- break;
- default:
- goto unknown_type;
- }
- if (packet->offset + len >= size)
- goto no_space;
-
- data = GST_BUFFER_DATA (buffer) + packet->offset;
-
- data[0] = (GST_RTCP_VERSION << 6);
- data[1] = type;
- /* length is stored in multiples of 32 bit words minus the length of the
- * header */
- len = (len - 4) >> 2;
- data[2] = len >> 8;
- data[3] = len & 0xff;
-
- /* now try to position to the packet */
- result = read_packet_header (packet);
-
- return result;
-
- /* ERRORS */
-unknown_type:
- {
- g_warning ("unknown type %d", type);
- return FALSE;
- }
-no_space:
- {
- return FALSE;
- }
-}
-
-/**
- * gst_rtcp_packet_remove:
- * @packet: a #GstRTCPPacket
- *
- * Removes the packet pointed to by @packet and moves pointer to the next one
- *
- * Returns: TRUE if @packet is pointing to a valid packet after calling this
- * function.
- */
-gboolean
-gst_rtcp_packet_remove (GstRTCPPacket * packet)
-{
- gboolean ret = FALSE;
- guint offset = 0;
-
- g_return_val_if_fail (packet != NULL, FALSE);
- g_return_val_if_fail (packet->type != GST_RTCP_TYPE_INVALID, FALSE);
-
- /* The next packet starts at offset + length + 4 (the header) */
- offset = packet->offset + (packet->length << 2) + 4;
-
- /* Overwrite this packet with the rest of the data */
- memmove (GST_BUFFER_DATA (packet->buffer) + packet->offset,
- GST_BUFFER_DATA (packet->buffer) + offset,
- GST_BUFFER_SIZE (packet->buffer) - offset);
-
- /* try to read next header */
- ret = read_packet_header (packet);
- if (!ret)
- packet->type = GST_RTCP_TYPE_INVALID;
-
- return ret;
-}
-
-/**
- * gst_rtcp_packet_get_padding:
- * @packet: a valid #GstRTCPPacket
- *
- * Get the packet padding of the packet pointed to by @packet.
- *
- * Returns: If the packet has the padding bit set.
- */
-gboolean
-gst_rtcp_packet_get_padding (GstRTCPPacket * packet)
-{
- g_return_val_if_fail (packet != NULL, FALSE);
- g_return_val_if_fail (packet->type != GST_RTCP_TYPE_INVALID, FALSE);
-
- return packet->padding;
-}
-
-/**
- * gst_rtcp_packet_get_type:
- * @packet: a valid #GstRTCPPacket
- *
- * Get the packet type of the packet pointed to by @packet.
- *
- * Returns: The packet type or GST_RTCP_TYPE_INVALID when @packet is not
- * pointing to a valid packet.
- */
-GstRTCPType
-gst_rtcp_packet_get_type (GstRTCPPacket * packet)
-{
- g_return_val_if_fail (packet != NULL, GST_RTCP_TYPE_INVALID);
-
- return packet->type;
-}
-
-/**
- * gst_rtcp_packet_get_count:
- * @packet: a valid #GstRTCPPacket
- *
- * Get the count field in @packet.
- *
- * Returns: The count field in @packet or -1 if @packet does not point to a
- * valid packet.
- */
-guint8
-gst_rtcp_packet_get_count (GstRTCPPacket * packet)
-{
- g_return_val_if_fail (packet != NULL, -1);
- g_return_val_if_fail (packet->type != GST_RTCP_TYPE_INVALID, -1);
-
- return packet->count;
-}
-
-/**
- * gst_rtcp_packet_get_length:
- * @packet: a valid #GstRTCPPacket
- *
- * Get the length field of @packet. This is the length of the packet in
- * 32-bit words minus one.
- *
- * Returns: The length field of @packet.
- */
-guint16
-gst_rtcp_packet_get_length (GstRTCPPacket * packet)
-{
- g_return_val_if_fail (packet != NULL, 0);
- g_return_val_if_fail (packet->type != GST_RTCP_TYPE_INVALID, 0);
-
- return packet->length;
-}
-
-/**
- * gst_rtcp_packet_sr_get_sender_info:
- * @packet: a valid SR #GstRTCPPacket
- * @ssrc: result SSRC
- * @ntptime: result NTP time
- * @rtptime: result RTP time
- * @packet_count: result packet count
- * @octet_count: result octect count
- *
- * Parse the SR sender info and store the values.
- */
-void
-gst_rtcp_packet_sr_get_sender_info (GstRTCPPacket * packet, guint32 * ssrc,
- guint64 * ntptime, guint32 * rtptime, guint32 * packet_count,
- guint32 * octet_count)
-{
- guint8 *data;
-
- g_return_if_fail (packet != NULL);
- g_return_if_fail (packet->type == GST_RTCP_TYPE_SR);
- g_return_if_fail (GST_IS_BUFFER (packet->buffer));
-
- data = GST_BUFFER_DATA (packet->buffer);
-
- /* skip header */
- data += packet->offset + 4;
- if (ssrc)
- *ssrc = GST_READ_UINT32_BE (data);
- data += 4;
- if (ntptime)
- *ntptime = GST_READ_UINT64_BE (data);
- data += 8;
- if (rtptime)
- *rtptime = GST_READ_UINT32_BE (data);
- data += 4;
- if (packet_count)
- *packet_count = GST_READ_UINT32_BE (data);
- data += 4;
- if (octet_count)
- *octet_count = GST_READ_UINT32_BE (data);
-}
-
-/**
- * gst_rtcp_packet_sr_set_sender_info:
- * @packet: a valid SR #GstRTCPPacket
- * @ssrc: the SSRC
- * @ntptime: the NTP time
- * @rtptime: the RTP time
- * @packet_count: the packet count
- * @octet_count: the octect count
- *
- * Set the given values in the SR packet @packet.
- */
-void
-gst_rtcp_packet_sr_set_sender_info (GstRTCPPacket * packet, guint32 ssrc,
- guint64 ntptime, guint32 rtptime, guint32 packet_count, guint32 octet_count)
-{
- guint8 *data;
-
- g_return_if_fail (packet != NULL);
- g_return_if_fail (packet->type == GST_RTCP_TYPE_SR);
- g_return_if_fail (GST_IS_BUFFER (packet->buffer));
-
- data = GST_BUFFER_DATA (packet->buffer);
-
- /* skip header */
- data += packet->offset + 4;
- GST_WRITE_UINT32_BE (data, ssrc);
- data += 4;
- GST_WRITE_UINT64_BE (data, ntptime);
- data += 8;
- GST_WRITE_UINT32_BE (data, rtptime);
- data += 4;
- GST_WRITE_UINT32_BE (data, packet_count);
- data += 4;
- GST_WRITE_UINT32_BE (data, octet_count);
-}
-
-/**
- * gst_rtcp_packet_rr_get_ssrc:
- * @packet: a valid RR #GstRTCPPacket
- *
- * Get the ssrc field of the RR @packet.
- *
- * Returns: the ssrc.
- */
-guint32
-gst_rtcp_packet_rr_get_ssrc (GstRTCPPacket * packet)
-{
- guint8 *data;
- guint32 ssrc;
-
- g_return_val_if_fail (packet != NULL, 0);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_RR, 0);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
-
- data = GST_BUFFER_DATA (packet->buffer);
-
- /* skip header */
- data += packet->offset + 4;
- ssrc = GST_READ_UINT32_BE (data);
-
- return ssrc;
-}
-
-/**
- * gst_rtcp_packet_rr_set_ssrc:
- * @packet: a valid RR #GstRTCPPacket
- * @ssrc: the SSRC to set
- *
- * Set the ssrc field of the RR @packet.
- */
-void
-gst_rtcp_packet_rr_set_ssrc (GstRTCPPacket * packet, guint32 ssrc)
-{
- guint8 *data;
-
- g_return_if_fail (packet != NULL);
- g_return_if_fail (packet->type == GST_RTCP_TYPE_RR);
- g_return_if_fail (GST_IS_BUFFER (packet->buffer));
-
- data = GST_BUFFER_DATA (packet->buffer);
-
- /* skip header */
- data += packet->offset + 4;
- GST_WRITE_UINT32_BE (data, ssrc);
-}
-
-/**
- * gst_rtcp_packet_get_rb_count:
- * @packet: a valid SR or RR #GstRTCPPacket
- *
- * Get the number of report blocks in @packet.
- *
- * Returns: The number of report blocks in @packet.
- */
-guint
-gst_rtcp_packet_get_rb_count (GstRTCPPacket * packet)
-{
- g_return_val_if_fail (packet != NULL, 0);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_RR ||
- packet->type == GST_RTCP_TYPE_SR, 0);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
-
- return packet->count;
-}
-
-/**
- * gst_rtcp_packet_get_rb:
- * @packet: a valid SR or RR #GstRTCPPacket
- * @nth: the nth report block in @packet
- * @ssrc: result for data source being reported
- * @fractionlost: result for fraction lost since last SR/RR
- * @packetslost: result for the cumululative number of packets lost
- * @exthighestseq: result for the extended last sequence number received
- * @jitter: result for the interarrival jitter
- * @lsr: result for the last SR packet from this source
- * @dlsr: result for the delay since last SR packet
- *
- * Parse the values of the @nth report block in @packet and store the result in
- * the values.
- */
-void
-gst_rtcp_packet_get_rb (GstRTCPPacket * packet, guint nth, guint32 * ssrc,
- guint8 * fractionlost, gint32 * packetslost, guint32 * exthighestseq,
- guint32 * jitter, guint32 * lsr, guint32 * dlsr)
-{
- guint8 *data;
- guint32 tmp;
-
- g_return_if_fail (packet != NULL);
- g_return_if_fail (packet->type == GST_RTCP_TYPE_RR ||
- packet->type == GST_RTCP_TYPE_SR);
- g_return_if_fail (GST_IS_BUFFER (packet->buffer));
-
- data = GST_BUFFER_DATA (packet->buffer);
-
- /* skip header */
- data += packet->offset + 4;
- if (packet->type == GST_RTCP_TYPE_RR)
- data += 4;
- else
- data += 24;
-
- /* move to requested index */
- data += (nth * 24);
-
- if (ssrc)
- *ssrc = GST_READ_UINT32_BE (data);
- data += 4;
- tmp = GST_READ_UINT32_BE (data);
- if (fractionlost)
- *fractionlost = (tmp >> 24);
- if (packetslost) {
- /* sign extend */
- if (tmp & 0x00800000)
- tmp |= 0xff000000;
- else
- tmp &= 0x00ffffff;
- *packetslost = (gint32) tmp;
- }
- data += 4;
- if (exthighestseq)
- *exthighestseq = GST_READ_UINT32_BE (data);
- data += 4;
- if (jitter)
- *jitter = GST_READ_UINT32_BE (data);
- data += 4;
- if (lsr)
- *lsr = GST_READ_UINT32_BE (data);
- data += 4;
- if (dlsr)
- *dlsr = GST_READ_UINT32_BE (data);
-}
-
-/**
- * gst_rtcp_packet_add_rb:
- * @packet: a valid SR or RR #GstRTCPPacket
- * @ssrc: data source being reported
- * @fractionlost: fraction lost since last SR/RR
- * @packetslost: the cumululative number of packets lost
- * @exthighestseq: the extended last sequence number received
- * @jitter: the interarrival jitter
- * @lsr: the last SR packet from this source
- * @dlsr: the delay since last SR packet
- *
- * Add a new report block to @packet with the given values.
- *
- * Returns: %TRUE if the packet was created. This function can return %FALSE if
- * the max MTU is exceeded or the number of report blocks is greater than
- * #GST_RTCP_MAX_RB_COUNT.
- */
-gboolean
-gst_rtcp_packet_add_rb (GstRTCPPacket * packet, guint32 ssrc,
- guint8 fractionlost, gint32 packetslost, guint32 exthighestseq,
- guint32 jitter, guint32 lsr, guint32 dlsr)
-{
- guint8 *data;
- guint size, offset;
-
- g_return_val_if_fail (packet != NULL, FALSE);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_RR ||
- packet->type == GST_RTCP_TYPE_SR, FALSE);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
-
- if (packet->count >= GST_RTCP_MAX_RB_COUNT)
- goto no_space;
-
- data = GST_BUFFER_DATA (packet->buffer);
- size = GST_BUFFER_SIZE (packet->buffer);
-
- /* skip header */
- offset = packet->offset + 4;
- if (packet->type == GST_RTCP_TYPE_RR)
- offset += 4;
- else
- offset += 24;
-
- /* move to current index */
- offset += (packet->count * 24);
-
- /* we need 24 free bytes now */
- if (offset + 24 >= size)
- goto no_space;
-
- /* increment packet count and length */
- packet->count++;
- data[packet->offset]++;
- packet->length += 6;
- data[packet->offset + 2] = (packet->length) >> 8;
- data[packet->offset + 3] = (packet->length) & 0xff;
-
- /* move to new report block offset */
- data += offset;
-
- GST_WRITE_UINT32_BE (data, ssrc);
- data += 4;
- GST_WRITE_UINT32_BE (data, (fractionlost << 24) | (packetslost & 0xffffff));
- data += 4;
- GST_WRITE_UINT32_BE (data, exthighestseq);
- data += 4;
- GST_WRITE_UINT32_BE (data, jitter);
- data += 4;
- GST_WRITE_UINT32_BE (data, lsr);
- data += 4;
- GST_WRITE_UINT32_BE (data, dlsr);
-
- return TRUE;
-
-no_space:
- {
- return FALSE;
- }
-}
-
-/**
- * gst_rtcp_packet_set_rb:
- * @packet: a valid SR or RR #GstRTCPPacket
- * @nth: the nth report block to set
- * @ssrc: data source being reported
- * @fractionlost: fraction lost since last SR/RR
- * @packetslost: the cumululative number of packets lost
- * @exthighestseq: the extended last sequence number received
- * @jitter: the interarrival jitter
- * @lsr: the last SR packet from this source
- * @dlsr: the delay since last SR packet
- *
- * Set the @nth new report block in @packet with the given values.
- *
- * Note: Not implemented.
- */
-void
-gst_rtcp_packet_set_rb (GstRTCPPacket * packet, guint nth, guint32 ssrc,
- guint8 fractionlost, gint32 packetslost, guint32 exthighestseq,
- guint32 jitter, guint32 lsr, guint32 dlsr)
-{
- g_return_if_fail (packet != NULL);
- g_return_if_fail (packet->type == GST_RTCP_TYPE_RR ||
- packet->type == GST_RTCP_TYPE_SR);
- g_return_if_fail (GST_IS_BUFFER (packet->buffer));
-
- g_warning ("not implemented");
-}
-
-
-/**
- * gst_rtcp_packet_sdes_get_item_count:
- * @packet: a valid SDES #GstRTCPPacket
- *
- * Get the number of items in the SDES packet @packet.
- *
- * Returns: The number of items in @packet.
- */
-guint
-gst_rtcp_packet_sdes_get_item_count (GstRTCPPacket * packet)
-{
- g_return_val_if_fail (packet != NULL, 0);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, 0);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
-
- return packet->count;
-}
-
-/**
- * gst_rtcp_packet_sdes_first_item:
- * @packet: a valid SDES #GstRTCPPacket
- *
- * Move to the first SDES item in @packet.
- *
- * Returns: TRUE if there was a first item.
- */
-gboolean
-gst_rtcp_packet_sdes_first_item (GstRTCPPacket * packet)
-{
- g_return_val_if_fail (packet != NULL, FALSE);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
-
- packet->item_offset = 4;
- packet->item_count = 0;
- packet->entry_offset = 4;
-
- if (packet->count == 0)
- return FALSE;
-
- return TRUE;
-}
-
-/**
- * gst_rtcp_packet_sdes_next_item:
- * @packet: a valid SDES #GstRTCPPacket
- *
- * Move to the next SDES item in @packet.
- *
- * Returns: TRUE if there was a next item.
- */
-gboolean
-gst_rtcp_packet_sdes_next_item (GstRTCPPacket * packet)
-{
- guint8 *data;
- guint offset;
- guint len;
-
- g_return_val_if_fail (packet != NULL, FALSE);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
-
- /* if we are at the last item, we are done */
- if (packet->item_count == packet->count)
- return FALSE;
-
- /* move to SDES */
- data = GST_BUFFER_DATA (packet->buffer);
- data += packet->offset;
- /* move to item */
- offset = packet->item_offset;
- /* skip SSRC */
- offset += 4;
-
- /* don't overrun */
- len = (packet->length << 2);
-
- while (offset < len) {
- if (data[offset] == 0) {
- /* end of list, round to next 32-bit word */
- offset = (offset + 3) & ~3;
- break;
- }
- offset += data[offset + 1] + 2;
- }
- if (offset >= len)
- return FALSE;
-
- packet->item_offset = offset;
- packet->item_count++;
- packet->entry_offset = 4;
-
- return TRUE;
-}
-
-/**
- * gst_rtcp_packet_sdes_get_ssrc:
- * @packet: a valid SDES #GstRTCPPacket
- *
- * Get the SSRC of the current SDES item.
- *
- * Returns: the SSRC of the current item.
- */
-guint32
-gst_rtcp_packet_sdes_get_ssrc (GstRTCPPacket * packet)
-{
- guint32 ssrc;
- guint8 *data;
-
- g_return_val_if_fail (packet != NULL, 0);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, 0);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
-
- /* move to SDES */
- data = GST_BUFFER_DATA (packet->buffer);
- data += packet->offset;
- /* move to item */
- data += packet->item_offset;
-
- ssrc = GST_READ_UINT32_BE (data);
-
- return ssrc;
-}
-
-/**
- * gst_rtcp_packet_sdes_first_entry:
- * @packet: a valid SDES #GstRTCPPacket
- *
- * Move to the first SDES entry in the current item.
- *
- * Returns: %TRUE if there was a first entry.
- */
-gboolean
-gst_rtcp_packet_sdes_first_entry (GstRTCPPacket * packet)
-{
- guint8 *data;
- guint len, offset;
-
- g_return_val_if_fail (packet != NULL, FALSE);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
-
- /* move to SDES */
- data = GST_BUFFER_DATA (packet->buffer);
- data += packet->offset;
- /* move to item */
- offset = packet->item_offset;
- /* skip SSRC */
- offset += 4;
-
- packet->entry_offset = 4;
-
- /* don't overrun */
- len = (packet->length << 2);
- if (offset >= len)
- return FALSE;
-
- if (data[offset] == 0)
- return FALSE;
-
- return TRUE;
-}
-
-/**
- * gst_rtcp_packet_sdes_next_entry:
- * @packet: a valid SDES #GstRTCPPacket
- *
- * Move to the next SDES entry in the current item.
- *
- * Returns: %TRUE if there was a next entry.
- */
-gboolean
-gst_rtcp_packet_sdes_next_entry (GstRTCPPacket * packet)
-{
- guint8 *data;
- guint len, offset, item_len;
-
- g_return_val_if_fail (packet != NULL, FALSE);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
-
- /* move to SDES */
- data = GST_BUFFER_DATA (packet->buffer);
- data += packet->offset;
- /* move to item */
- offset = packet->item_offset;
- /* move to entry */
- offset += packet->entry_offset;
-
- item_len = data[offset + 1] + 2;
- /* skip item */
- offset += item_len;
-
- /* don't overrun */
- len = (packet->length << 2);
- if (offset >= len)
- return FALSE;
-
- packet->entry_offset += item_len;
-
- /* check for end of list */
- if (data[offset] == 0)
- return FALSE;
-
- return TRUE;
-}
-
-/**
- * gst_rtcp_packet_sdes_get_entry:
- * @packet: a valid SDES #GstRTCPPacket
- * @type: result of the entry type
- * @len: result length of the entry data
- * @data: result entry data
- *
- * Get the data of the current SDES item entry. @type (when not NULL) will
- * contain the type of the entry. @data (when not NULL) will point to @len
- * bytes.
- *
- * When @type refers to a text item, @data will point to a UTF8 string. Note
- * that this UTF8 string is NOT null-terminated. Use
- * gst_rtcp_packet_sdes_copy_entry() to get a null-termined copy of the entry.
- *
- * Returns: %TRUE if there was valid data.
- */
-gboolean
-gst_rtcp_packet_sdes_get_entry (GstRTCPPacket * packet,
- GstRTCPSDESType * type, guint8 * len, guint8 ** data)
-{
- guint8 *bdata;
- guint offset;
-
- g_return_val_if_fail (packet != NULL, FALSE);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
-
- /* move to SDES */
- bdata = GST_BUFFER_DATA (packet->buffer);
- bdata += packet->offset;
- /* move to item */
- offset = packet->item_offset;
- /* move to entry */
- offset += packet->entry_offset;
-
- if (bdata[offset] == 0)
- return FALSE;
-
- if (type)
- *type = bdata[offset];
- if (len)
- *len = bdata[offset + 1];
- if (data)
- *data = &bdata[offset + 2];
-
- return TRUE;
-}
-
-/**
- * gst_rtcp_packet_sdes_copy_entry:
- * @packet: a valid SDES #GstRTCPPacket
- * @type: result of the entry type
- * @len: result length of the entry data
- * @data: result entry data
- *
- * This function is like gst_rtcp_packet_sdes_get_entry() but it returns a
- * null-terminated copy of the data instead. use g_free() after usage.
- *
- * Returns: %TRUE if there was valid data.
- */
-gboolean
-gst_rtcp_packet_sdes_copy_entry (GstRTCPPacket * packet,
- GstRTCPSDESType * type, guint8 * len, guint8 ** data)
-{
- guint8 *tdata;
- guint8 tlen;
-
- g_return_val_if_fail (packet != NULL, FALSE);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
-
- if (!gst_rtcp_packet_sdes_get_entry (packet, type, &tlen, &tdata))
- return FALSE;
-
- if (len)
- *len = tlen;
- if (data)
- *data = (guint8 *) g_strndup ((gchar *) tdata, tlen);
-
- return TRUE;
-}
-
-/**
- * gst_rtcp_packet_sdes_add_item:
- * @packet: a valid SDES #GstRTCPPacket
- * @ssrc: the SSRC of the new item to add
- *
- * Add a new SDES item for @ssrc to @packet.
- *
- * Returns: %TRUE if the item could be added, %FALSE if the maximum amount of
- * items has been exceeded for the SDES packet or the MTU has been reached.
- */
-gboolean
-gst_rtcp_packet_sdes_add_item (GstRTCPPacket * packet, guint32 ssrc)
-{
- guint8 *data;
- guint offset, size;
-
- g_return_val_if_fail (packet != NULL, FALSE);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
-
- /* increment item count when possible */
- if (packet->count >= GST_RTCP_MAX_SDES_ITEM_COUNT)
- goto no_space;
-
- /* pretend there is a next packet for the next call */
- packet->count++;
-
- /* jump over current item */
- gst_rtcp_packet_sdes_next_item (packet);
-
- /* move to SDES */
- data = GST_BUFFER_DATA (packet->buffer);
- size = GST_BUFFER_SIZE (packet->buffer);
- data += packet->offset;
- /* move to current item */
- offset = packet->item_offset;
-
- /* we need 2 free words now */
- if (offset + 8 >= size)
- goto no_next;
-
- /* write SSRC */
- GST_WRITE_UINT32_BE (&data[offset], ssrc);
- /* write 0 entry with padding */
- GST_WRITE_UINT32_BE (&data[offset + 4], 0);
-
- /* update count */
- data[0] = (data[0] & 0xe0) | packet->count;
- /* update length, we added 2 words */
- packet->length += 2;
- data[2] = (packet->length) >> 8;
- data[3] = (packet->length) & 0xff;
-
- return TRUE;
-
- /* ERRORS */
-no_space:
- {
- return FALSE;
- }
-no_next:
- {
- packet->count--;
- return FALSE;
- }
-}
-
-/**
- * gst_rtcp_packet_sdes_add_entry:
- * @packet: a valid SDES #GstRTCPPacket
- * @type: the #GstRTCPSDESType of the SDES entry
- * @len: the data length
- * @data: the data
- *
- * Add a new SDES entry to the current item in @packet.
- *
- * Returns: %TRUE if the item could be added, %FALSE if the MTU has been
- * reached.
- */
-gboolean
-gst_rtcp_packet_sdes_add_entry (GstRTCPPacket * packet, GstRTCPSDESType type,
- guint8 len, const guint8 * data)
-{
- guint8 *bdata;
- guint offset, size, padded;
-
- g_return_val_if_fail (packet != NULL, FALSE);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
-
- /* move to SDES */
- bdata = GST_BUFFER_DATA (packet->buffer);
- size = GST_BUFFER_SIZE (packet->buffer);
- bdata += packet->offset;
- /* move to item */
- offset = packet->item_offset;
- /* move to entry */
- offset += packet->entry_offset;
-
- /* add 1 byte end and up to 3 bytes padding to fill a full 32 bit word */
- padded = (offset + 2 + len + 1 + 3) & ~3;
-
- /* we need enough space for type, len, data and padding */
- if (packet->offset + padded >= size)
- goto no_space;
-
- bdata[offset] = type;
- bdata[offset + 1] = len;
- memcpy (&bdata[offset + 2], data, len);
- bdata[offset + 2 + len] = 0;
-
- /* calculate new packet length */
- packet->length = (padded - 4) >> 2;
- bdata[2] = (packet->length) >> 8;
- bdata[3] = (packet->length) & 0xff;
-
- /* position to new next entry */
- packet->entry_offset += 2 + len;
-
- return TRUE;
-
- /* ERRORS */
-no_space:
- {
- return FALSE;
- }
-}
-
-/**
- * gst_rtcp_packet_bye_get_ssrc_count:
- * @packet: a valid BYE #GstRTCPPacket
- *
- * Get the number of SSRC fields in @packet.
- *
- * Returns: The number of SSRC fields in @packet.
- */
-guint
-gst_rtcp_packet_bye_get_ssrc_count (GstRTCPPacket * packet)
-{
- g_return_val_if_fail (packet != NULL, -1);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, -1);
-
- return packet->count;
-}
-
-/**
- * gst_rtcp_packet_bye_get_nth_ssrc:
- * @packet: a valid BYE #GstRTCPPacket
- * @nth: the nth SSRC to get
- *
- * Get the @nth SSRC of the BYE @packet.
- *
- * Returns: The @nth SSRC of @packet.
- */
-guint32
-gst_rtcp_packet_bye_get_nth_ssrc (GstRTCPPacket * packet, guint nth)
-{
- guint8 *data;
- guint offset;
- guint32 ssrc;
- guint8 sc;
-
- g_return_val_if_fail (packet != NULL, 0);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, 0);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
-
- /* get amount of sources and check that we don't read too much */
- sc = packet->count;
- if (nth >= sc)
- return 0;
-
- /* get offset in 32-bits words into packet, skip the header */
- offset = 1 + nth;
- /* check that we don't go past the packet length */
- if (offset > packet->length)
- return 0;
-
- /* scale to bytes */
- offset <<= 2;
- offset += packet->offset;
-
- /* check if the packet is valid */
- if (offset + 4 > GST_BUFFER_SIZE (packet->buffer))
- return 0;
-
- data = GST_BUFFER_DATA (packet->buffer);
- data += offset;
-
- ssrc = GST_READ_UINT32_BE (data);
-
- return ssrc;
-}
-
-/**
- * gst_rtcp_packet_bye_add_ssrc:
- * @packet: a valid BYE #GstRTCPPacket
- * @ssrc: an SSRC to add
- *
- * Add @ssrc to the BYE @packet.
- *
- * Returns: %TRUE if the ssrc was added. This function can return %FALSE if
- * the max MTU is exceeded or the number of sources blocks is greater than
- * #GST_RTCP_MAX_BYE_SSRC_COUNT.
- */
-gboolean
-gst_rtcp_packet_bye_add_ssrc (GstRTCPPacket * packet, guint32 ssrc)
-{
- guint8 *data;
- guint size, offset;
-
- g_return_val_if_fail (packet != NULL, FALSE);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, FALSE);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
-
- if (packet->count >= GST_RTCP_MAX_BYE_SSRC_COUNT)
- goto no_space;
-
- data = GST_BUFFER_DATA (packet->buffer);
- size = GST_BUFFER_SIZE (packet->buffer);
-
- /* skip header */
- offset = packet->offset + 4;
-
- /* move to current index */
- offset += (packet->count * 4);
-
- if (offset + 4 >= size)
- goto no_space;
-
- /* increment packet count and length */
- packet->count++;
- data[packet->offset]++;
- packet->length += 1;
- data[packet->offset + 2] = (packet->length) >> 8;
- data[packet->offset + 3] = (packet->length) & 0xff;
-
- /* move to new SSRC offset and write ssrc */
- data += offset;
- GST_WRITE_UINT32_BE (data, ssrc);
-
- return TRUE;
-
- /* ERRORS */
-no_space:
- {
- return FALSE;
- }
-}
-
-/**
- * gst_rtcp_packet_bye_add_ssrcs:
- * @packet: a valid BYE #GstRTCPPacket
- * @ssrc: an array of SSRCs to add
- * @len: number of elements in @ssrc
- *
- * Adds @len SSRCs in @ssrc to BYE @packet.
- *
- * Returns: %TRUE if the all the SSRCs were added. This function can return %FALSE if
- * the max MTU is exceeded or the number of sources blocks is greater than
- * #GST_RTCP_MAX_BYE_SSRC_COUNT.
- */
-gboolean
-gst_rtcp_packet_bye_add_ssrcs (GstRTCPPacket * packet, guint32 * ssrc,
- guint len)
-{
- guint i;
- gboolean res;
-
- g_return_val_if_fail (packet != NULL, FALSE);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, FALSE);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
-
- res = TRUE;
- for (i = 0; i < len && res; i++) {
- res = gst_rtcp_packet_bye_add_ssrc (packet, ssrc[i]);
- }
- return res;
-}
-
-/* get the offset in packet of the reason length */
-static guint
-get_reason_offset (GstRTCPPacket * packet)
-{
- guint offset;
-
- /* get amount of sources plus header */
- offset = 1 + packet->count;
-
- /* check that we don't go past the packet length */
- if (offset > packet->length)
- return 0;
-
- /* scale to bytes */
- offset <<= 2;
- offset += packet->offset;
-
- /* check if the packet is valid */
- if (offset + 1 > GST_BUFFER_SIZE (packet->buffer))
- return 0;
-
- return offset;
-}
-
-/**
- * gst_rtcp_packet_bye_get_reason_len:
- * @packet: a valid BYE #GstRTCPPacket
- *
- * Get the length of the reason string.
- *
- * Returns: The length of the reason string or 0 when there is no reason string
- * present.
- */
-guint8
-gst_rtcp_packet_bye_get_reason_len (GstRTCPPacket * packet)
-{
- guint8 *data;
- guint roffset;
-
- g_return_val_if_fail (packet != NULL, 0);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, 0);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
-
- roffset = get_reason_offset (packet);
- if (roffset == 0)
- return 0;
-
- data = GST_BUFFER_DATA (packet->buffer);
-
- return data[roffset];
-}
-
-/**
- * gst_rtcp_packet_bye_get_reason:
- * @packet: a valid BYE #GstRTCPPacket
- *
- * Get the reason in @packet.
- *
- * Returns: The reason for the BYE @packet or NULL if the packet did not contain
- * a reason string. The string must be freed with g_free() after usage.
- */
-gchar *
-gst_rtcp_packet_bye_get_reason (GstRTCPPacket * packet)
-{
- guint8 *data;
- guint roffset;
- guint8 len;
-
- g_return_val_if_fail (packet != NULL, NULL);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, NULL);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), NULL);
-
- roffset = get_reason_offset (packet);
- if (roffset == 0)
- return NULL;
-
- data = GST_BUFFER_DATA (packet->buffer);
-
- /* get length of reason string */
- len = data[roffset];
- if (len == 0)
- return NULL;
-
- /* move to string */
- roffset += 1;
-
- /* check if enough data to copy */
- if (roffset + len > GST_BUFFER_SIZE (packet->buffer))
- return NULL;
-
- return g_strndup ((gconstpointer) (data + roffset), len);
-}
-
-/**
- * gst_rtcp_packet_bye_set_reason:
- * @packet: a valid BYE #GstRTCPPacket
- * @reason: a reason string
- *
- * Set the reason string to @reason in @packet.
- *
- * Returns: TRUE if the string could be set.
- */
-gboolean
-gst_rtcp_packet_bye_set_reason (GstRTCPPacket * packet, const gchar * reason)
-{
- guint8 *data;
- guint roffset, size;
- guint8 len, padded;
-
- g_return_val_if_fail (packet != NULL, FALSE);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, FALSE);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
-
- if (reason == NULL)
- return TRUE;
-
- len = strlen (reason);
- if (len == 0)
- return TRUE;
-
- /* make room for the string before we get the offset */
- packet->length++;
-
- roffset = get_reason_offset (packet);
- if (roffset == 0)
- goto no_space;
-
- data = GST_BUFFER_DATA (packet->buffer);
- size = GST_BUFFER_SIZE (packet->buffer);
-
- /* we have 1 byte length and we need to pad to 4 bytes */
- padded = ((len + 1) + 3) & ~3;
-
- /* we need enough space for the padded length */
- if (roffset + padded >= size)
- goto no_space;
-
- data[roffset] = len;
- memcpy (&data[roffset + 1], reason, len);
-
- /* update packet length, we made room for 1 double word already */
- packet->length += (padded >> 2) - 1;
- data[packet->offset + 2] = (packet->length) >> 8;
- data[packet->offset + 3] = (packet->length) & 0xff;
-
- return TRUE;
-
- /* ERRORS */
-no_space:
- {
- packet->length--;
- return FALSE;
- }
-}
-
-/**
- * gst_rtcp_packet_fb_get_sender_ssrc:
- * @packet: a valid RTPFB or PSFB #GstRTCPPacket
- *
- * Get the sender SSRC field of the RTPFB or PSFB @packet.
- *
- * Returns: the sender SSRC.
- *
- * Since: 0.10.23
- */
-guint32
-gst_rtcp_packet_fb_get_sender_ssrc (GstRTCPPacket * packet)
-{
- guint8 *data;
- guint32 ssrc;
-
- g_return_val_if_fail (packet != NULL, 0);
- g_return_val_if_fail ((packet->type == GST_RTCP_TYPE_RTPFB ||
- packet->type == GST_RTCP_TYPE_PSFB), 0);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
-
- data = GST_BUFFER_DATA (packet->buffer);
-
- /* skip header */
- data += packet->offset + 4;
- ssrc = GST_READ_UINT32_BE (data);
-
- return ssrc;
-}
-
-/**
- * gst_rtcp_packet_fb_set_sender_ssrc:
- * @packet: a valid RTPFB or PSFB #GstRTCPPacket
- * @ssrc: a sender SSRC
- *
- * Set the sender SSRC field of the RTPFB or PSFB @packet.
- *
- * Since: 0.10.23
- */
-void
-gst_rtcp_packet_fb_set_sender_ssrc (GstRTCPPacket * packet, guint32 ssrc)
-{
- guint8 *data;
-
- g_return_if_fail (packet != NULL);
- g_return_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
- packet->type == GST_RTCP_TYPE_PSFB);
- g_return_if_fail (GST_IS_BUFFER (packet->buffer));
-
- data = GST_BUFFER_DATA (packet->buffer);
-
- /* skip header */
- data += packet->offset + 4;
- GST_WRITE_UINT32_BE (data, ssrc);
-}
-
-/**
- * gst_rtcp_packet_fb_get_media_ssrc:
- * @packet: a valid RTPFB or PSFB #GstRTCPPacket
- *
- * Get the media SSRC field of the RTPFB or PSFB @packet.
- *
- * Returns: the media SSRC.
- *
- * Since: 0.10.23
- */
-guint32
-gst_rtcp_packet_fb_get_media_ssrc (GstRTCPPacket * packet)
-{
- guint8 *data;
- guint32 ssrc;
-
- g_return_val_if_fail (packet != NULL, 0);
- g_return_val_if_fail ((packet->type == GST_RTCP_TYPE_RTPFB ||
- packet->type == GST_RTCP_TYPE_PSFB), 0);
- g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
-
- data = GST_BUFFER_DATA (packet->buffer);
-
- /* skip header and sender ssrc */
- data += packet->offset + 8;
- ssrc = GST_READ_UINT32_BE (data);
-
- return ssrc;
-}
-
-/**
- * gst_rtcp_packet_fb_set_media_ssrc:
- * @packet: a valid RTPFB or PSFB #GstRTCPPacket
- * @ssrc: a media SSRC
- *
- * Set the media SSRC field of the RTPFB or PSFB @packet.
- *
- * Since: 0.10.23
- */
-void
-gst_rtcp_packet_fb_set_media_ssrc (GstRTCPPacket * packet, guint32 ssrc)
-{
- guint8 *data;
-
- g_return_if_fail (packet != NULL);
- g_return_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
- packet->type == GST_RTCP_TYPE_PSFB);
- g_return_if_fail (GST_IS_BUFFER (packet->buffer));
-
- data = GST_BUFFER_DATA (packet->buffer);
-
- /* skip header and sender ssrc */
- data += packet->offset + 8;
- GST_WRITE_UINT32_BE (data, ssrc);
-}
-
-/**
- * gst_rtcp_packet_fb_get_type:
- * @packet: a valid RTPFB or PSFB #GstRTCPPacket
- *
- * Get the feedback message type of the FB @packet.
- *
- * Returns: The feedback message type.
- *
- * Since: 0.10.23
- */
-GstRTCPFBType
-gst_rtcp_packet_fb_get_type (GstRTCPPacket * packet)
-{
- g_return_val_if_fail (packet != NULL, GST_RTCP_FB_TYPE_INVALID);
- g_return_val_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
- packet->type == GST_RTCP_TYPE_PSFB, GST_RTCP_FB_TYPE_INVALID);
-
- return packet->count;
-}
-
-/**
- * gst_rtcp_packet_fb_set_type:
- * @packet: a valid RTPFB or PSFB #GstRTCPPacket
- * @type: the #GstRTCPFBType to set
- *
- * Set the feedback message type of the FB @packet.
- *
- * Since: 0.10.23
- */
-void
-gst_rtcp_packet_fb_set_type (GstRTCPPacket * packet, GstRTCPFBType type)
-{
- guint8 *data;
-
- g_return_if_fail (packet != NULL);
- g_return_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
- packet->type == GST_RTCP_TYPE_PSFB);
- g_return_if_fail (GST_IS_BUFFER (packet->buffer));
-
- data = GST_BUFFER_DATA (packet->buffer);
-
- data[packet->offset] = (data[packet->offset] & 0xe0) | type;
- packet->count = type;
-}
-
-/**
- * gst_rtcp_ntp_to_unix:
- * @ntptime: an NTP timestamp
- *
- * Converts an NTP time to UNIX nanoseconds. @ntptime can typically be
- * the NTP time of an SR RTCP message and contains, in the upper 32 bits, the
- * number of seconds since 1900 and, in the lower 32 bits, the fractional
- * seconds. The resulting value will be the number of nanoseconds since 1970.
- *
- * Returns: the UNIX time for @ntptime in nanoseconds.
- */
-guint64
-gst_rtcp_ntp_to_unix (guint64 ntptime)
-{
- guint64 unixtime;
-
- /* conversion from NTP timestamp (seconds since 1900) to seconds since
- * 1970. */
- unixtime = ntptime - (G_GUINT64_CONSTANT (2208988800) << 32);
- /* conversion to nanoseconds */
- unixtime =
- gst_util_uint64_scale (unixtime, GST_SECOND,
- (G_GINT64_CONSTANT (1) << 32));
-
- return unixtime;
-}
-
-/**
- * gst_rtcp_unix_to_ntp:
- * @unixtime: an UNIX timestamp in nanoseconds
- *
- * Converts a UNIX timestamp in nanoseconds to an NTP time. The caller should
- * pass a value with nanoseconds since 1970. The NTP time will, in the upper
- * 32 bits, contain the number of seconds since 1900 and, in the lower 32
- * bits, the fractional seconds. The resulting value can be used as an ntptime
- * for constructing SR RTCP packets.
- *
- * Returns: the NTP time for @unixtime.
- */
-guint64
-gst_rtcp_unix_to_ntp (guint64 unixtime)
-{
- guint64 ntptime;
-
- /* convert clock time to NTP time. upper 32 bits should contain the seconds
- * and the lower 32 bits, the fractions of a second. */
- ntptime =
- gst_util_uint64_scale (unixtime, (G_GINT64_CONSTANT (1) << 32),
- GST_SECOND);
- /* conversion from UNIX timestamp (seconds since 1970) to NTP (seconds
- * since 1900). */
- ntptime += (G_GUINT64_CONSTANT (2208988800) << 32);
-
- return ntptime;
-}
-
-/**
- * gst_rtcp_sdes_type_to_name:
- * @type: a #GstRTCPSDESType
- *
- * Converts @type to the string equivalent. The string is typically used as a
- * key in a #GstStructure containing SDES items.
- *
- * Returns: the string equivalent of @type
- *
- * Since: 0.10.26
- */
-const gchar *
-gst_rtcp_sdes_type_to_name (GstRTCPSDESType type)
-{
- const gchar *result;
-
- switch (type) {
- case GST_RTCP_SDES_CNAME:
- result = "cname";
- break;
- case GST_RTCP_SDES_NAME:
- result = "name";
- break;
- case GST_RTCP_SDES_EMAIL:
- result = "email";
- break;
- case GST_RTCP_SDES_PHONE:
- result = "phone";
- break;
- case GST_RTCP_SDES_LOC:
- result = "location";
- break;
- case GST_RTCP_SDES_TOOL:
- result = "tool";
- break;
- case GST_RTCP_SDES_NOTE:
- result = "note";
- break;
- case GST_RTCP_SDES_PRIV:
- result = "priv";
- break;
- default:
- result = NULL;
- break;
- }
- return result;
-}
-
-/**
- * gst_rtcp_sdes_name_to_type:
- * @name: a SDES name
- *
- * Convert @name into a @GstRTCPSDESType. @name is typically a key in a
- * #GstStructure containing SDES items.
- *
- * Returns: the #GstRTCPSDESType for @name or #GST_RTCP_SDES_PRIV when @name
- * is a private sdes item.
- *
- * Since: 0.10.26
- */
-GstRTCPSDESType
-gst_rtcp_sdes_name_to_type (const gchar * name)
-{
- if (name == NULL || strlen (name) == 0)
- return GST_RTCP_SDES_INVALID;
-
- if (strcmp ("cname", name) == 0)
- return GST_RTCP_SDES_CNAME;
-
- if (strcmp ("name", name) == 0)
- return GST_RTCP_SDES_NAME;
-
- if (strcmp ("email", name) == 0)
- return GST_RTCP_SDES_EMAIL;
-
- if (strcmp ("phone", name) == 0)
- return GST_RTCP_SDES_PHONE;
-
- if (strcmp ("location", name) == 0)
- return GST_RTCP_SDES_LOC;
-
- if (strcmp ("tool", name) == 0)
- return GST_RTCP_SDES_TOOL;
-
- if (strcmp ("note", name) == 0)
- return GST_RTCP_SDES_NOTE;
-
- return GST_RTCP_SDES_PRIV;
-}
diff --git a/gst-libs/gst/rtp/gstrtcpbuffer.h b/gst-libs/gst/rtp/gstrtcpbuffer.h
deleted file mode 100644
index b051571f..00000000
--- a/gst-libs/gst/rtp/gstrtcpbuffer.h
+++ /dev/null
@@ -1,283 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_RTCPBUFFER_H__
-#define __GST_RTCPBUFFER_H__
-
-#include <gst/gst.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. Since: 0.10.23
- * @GST_RTCP_TYPE_PSFB: Payload-specific feedback. Since: 0.10.23
- *
- * 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
-} GstRTCPType;
-
-/**
- * GstRTCPFBType:
- * @GST_RTCP_FB_TYPE_INVALID: Invalid type
- * @GST_RTCP_RTPFB_TYPE_NACK: Generic NACK
- * @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
- *
- * Different types of feedback messages.
- *
- * Since: 0.10.23
- */
-typedef enum
-{
- /* generic */
- GST_RTCP_FB_TYPE_INVALID = 0,
- /* RTPFB types */
- GST_RTCP_RTPFB_TYPE_NACK = 1,
- /* 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
-} 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.
- */
-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
-} GstRTCPSDESType;
-
-/**
- * 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_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 _GstRTCPPacket GstRTCPPacket;
-
-/**
- * GstRTCPPacket:
- * @buffer: 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
-{
- GstBuffer *buffer;
- 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 */
-
- 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 */
-GstBuffer* gst_rtcp_buffer_new_take_data (gpointer data, guint len);
-GstBuffer* gst_rtcp_buffer_new_copy_data (gpointer data, guint len);
-
-gboolean gst_rtcp_buffer_validate_data (guint8 *data, guint len);
-gboolean gst_rtcp_buffer_validate (GstBuffer *buffer);
-
-GstBuffer* gst_rtcp_buffer_new (guint mtu);
-void gst_rtcp_buffer_end (GstBuffer *buffer);
-
-/* adding/retrieving packets */
-guint gst_rtcp_buffer_get_packet_count (GstBuffer *buffer);
-gboolean gst_rtcp_buffer_get_first_packet (GstBuffer *buffer, GstRTCPPacket *packet);
-gboolean gst_rtcp_packet_move_to_next (GstRTCPPacket *packet);
-
-gboolean gst_rtcp_buffer_add_packet (GstBuffer *buffer, GstRTCPType type,
- GstRTCPPacket *packet);
-gboolean gst_rtcp_packet_remove (GstRTCPPacket *packet);
-
-/* working with packets */
-gboolean gst_rtcp_packet_get_padding (GstRTCPPacket *packet);
-guint8 gst_rtcp_packet_get_count (GstRTCPPacket *packet);
-GstRTCPType gst_rtcp_packet_get_type (GstRTCPPacket *packet);
-guint16 gst_rtcp_packet_get_length (GstRTCPPacket *packet);
-
-
-/* sender reports */
-void gst_rtcp_packet_sr_get_sender_info (GstRTCPPacket *packet, guint32 *ssrc,
- guint64 *ntptime, guint32 *rtptime,
- guint32 *packet_count, guint32 *octet_count);
-void gst_rtcp_packet_sr_set_sender_info (GstRTCPPacket *packet, guint32 ssrc,
- guint64 ntptime, guint32 rtptime,
- guint32 packet_count, guint32 octet_count);
-/* receiver reports */
-guint32 gst_rtcp_packet_rr_get_ssrc (GstRTCPPacket *packet);
-void gst_rtcp_packet_rr_set_ssrc (GstRTCPPacket *packet, guint32 ssrc);
-
-
-/* report blocks for SR and RR */
-guint gst_rtcp_packet_get_rb_count (GstRTCPPacket *packet);
-void gst_rtcp_packet_get_rb (GstRTCPPacket *packet, guint nth, guint32 *ssrc,
- guint8 *fractionlost, gint32 *packetslost,
- guint32 *exthighestseq, guint32 *jitter,
- guint32 *lsr, guint32 *dlsr);
-gboolean gst_rtcp_packet_add_rb (GstRTCPPacket *packet, guint32 ssrc,
- guint8 fractionlost, gint32 packetslost,
- guint32 exthighestseq, guint32 jitter,
- guint32 lsr, guint32 dlsr);
-void gst_rtcp_packet_set_rb (GstRTCPPacket *packet, guint nth, guint32 ssrc,
- guint8 fractionlost, gint32 packetslost,
- guint32 exthighestseq, guint32 jitter,
- guint32 lsr, guint32 dlsr);
-
-/* source description packet */
-guint gst_rtcp_packet_sdes_get_item_count (GstRTCPPacket *packet);
-gboolean gst_rtcp_packet_sdes_first_item (GstRTCPPacket *packet);
-gboolean gst_rtcp_packet_sdes_next_item (GstRTCPPacket *packet);
-guint32 gst_rtcp_packet_sdes_get_ssrc (GstRTCPPacket *packet);
-gboolean gst_rtcp_packet_sdes_first_entry (GstRTCPPacket *packet);
-gboolean gst_rtcp_packet_sdes_next_entry (GstRTCPPacket *packet);
-gboolean gst_rtcp_packet_sdes_get_entry (GstRTCPPacket *packet,
- GstRTCPSDESType *type, guint8 *len,
- guint8 **data);
-gboolean gst_rtcp_packet_sdes_copy_entry (GstRTCPPacket *packet,
- GstRTCPSDESType *type, guint8 *len,
- guint8 **data);
-
-gboolean gst_rtcp_packet_sdes_add_item (GstRTCPPacket *packet, guint32 ssrc);
-gboolean gst_rtcp_packet_sdes_add_entry (GstRTCPPacket *packet, GstRTCPSDESType type,
- guint8 len, const guint8 *data);
-
-/* bye packet */
-guint gst_rtcp_packet_bye_get_ssrc_count (GstRTCPPacket *packet);
-guint32 gst_rtcp_packet_bye_get_nth_ssrc (GstRTCPPacket *packet, guint nth);
-gboolean gst_rtcp_packet_bye_add_ssrc (GstRTCPPacket *packet, guint32 ssrc);
-gboolean gst_rtcp_packet_bye_add_ssrcs (GstRTCPPacket *packet, guint32 *ssrc, guint len);
-guint8 gst_rtcp_packet_bye_get_reason_len (GstRTCPPacket *packet);
-gchar* gst_rtcp_packet_bye_get_reason (GstRTCPPacket *packet);
-gboolean gst_rtcp_packet_bye_set_reason (GstRTCPPacket *packet, const gchar *reason);
-
-/* feedback packets */
-guint32 gst_rtcp_packet_fb_get_sender_ssrc (GstRTCPPacket *packet);
-void gst_rtcp_packet_fb_set_sender_ssrc (GstRTCPPacket *packet, guint32 ssrc);
-guint32 gst_rtcp_packet_fb_get_media_ssrc (GstRTCPPacket *packet);
-void gst_rtcp_packet_fb_set_media_ssrc (GstRTCPPacket *packet, guint32 ssrc);
-GstRTCPFBType gst_rtcp_packet_fb_get_type (GstRTCPPacket *packet);
-void gst_rtcp_packet_fb_set_type (GstRTCPPacket *packet, GstRTCPFBType type);
-
-/* helper functions */
-guint64 gst_rtcp_ntp_to_unix (guint64 ntptime);
-guint64 gst_rtcp_unix_to_ntp (guint64 unixtime);
-
-const gchar * gst_rtcp_sdes_type_to_name (GstRTCPSDESType type);
-GstRTCPSDESType gst_rtcp_sdes_name_to_type (const gchar *name);
-
-G_END_DECLS
-
-#endif /* __GST_RTCPBUFFER_H__ */
-
diff --git a/gst-libs/gst/rtp/gstrtpbuffer.c b/gst-libs/gst/rtp/gstrtpbuffer.c
deleted file mode 100644
index b050b080..00000000
--- a/gst-libs/gst/rtp/gstrtpbuffer.c
+++ /dev/null
@@ -1,1388 +0,0 @@
-/* GStreamer
- * Copyright (C) <2005> Philippe Khalaf <burger@speedy.org>
- * Copyright (C) <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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstrtpbuffer
- * @short_description: Helper methods for dealing with RTP buffers
- * @see_also: #GstBaseRTPPayload, #GstBaseRTPDepayload, gstrtcpbuffer
- *
- * <refsect2>
- * <para>
- * The GstRTPBuffer helper functions makes it easy to parse and create regular
- * #GstBuffer objects that contain RTP payloads. These buffers are typically of
- * 'application/x-rtp' #GstCaps.
- * </para>
- * </refsect2>
- *
- * Last reviewed on 2006-07-17 (0.10.10)
- */
-
-#include "gstrtpbuffer.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#define GST_RTP_HEADER_LEN 12
-
-/* Note: we use bitfields here to make sure the compiler doesn't add padding
- * between fields on certain architectures; can't assume aligned access either
- */
-typedef struct _GstRTPHeader
-{
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
- unsigned int csrc_count:4; /* CSRC count */
- unsigned int extension:1; /* header extension flag */
- unsigned int padding:1; /* padding flag */
- unsigned int version:2; /* protocol version */
- unsigned int payload_type:7; /* payload type */
- unsigned int marker:1; /* marker bit */
-#elif G_BYTE_ORDER == G_BIG_ENDIAN
- unsigned int version:2; /* protocol version */
- unsigned int padding:1; /* padding flag */
- unsigned int extension:1; /* header extension flag */
- unsigned int csrc_count:4; /* CSRC count */
- unsigned int marker:1; /* marker bit */
- unsigned int payload_type:7; /* payload type */
-#else
-#error "G_BYTE_ORDER should be big or little endian."
-#endif
- unsigned int seq:16; /* sequence number */
- unsigned int timestamp:32; /* timestamp */
- unsigned int ssrc:32; /* synchronization source */
- guint8 csrclist[4]; /* optional CSRC list, 32 bits each */
-} GstRTPHeader;
-
-#define GST_RTP_HEADER_VERSION(data) (((GstRTPHeader *)(data))->version)
-#define GST_RTP_HEADER_PADDING(data) (((GstRTPHeader *)(data))->padding)
-#define GST_RTP_HEADER_EXTENSION(data) (((GstRTPHeader *)(data))->extension)
-#define GST_RTP_HEADER_CSRC_COUNT(data) (((GstRTPHeader *)(data))->csrc_count)
-#define GST_RTP_HEADER_MARKER(data) (((GstRTPHeader *)(data))->marker)
-#define GST_RTP_HEADER_PAYLOAD_TYPE(data) (((GstRTPHeader *)(data))->payload_type)
-#define GST_RTP_HEADER_SEQ(data) (((GstRTPHeader *)(data))->seq)
-#define GST_RTP_HEADER_TIMESTAMP(data) (((GstRTPHeader *)(data))->timestamp)
-#define GST_RTP_HEADER_SSRC(data) (((GstRTPHeader *)(data))->ssrc)
-#define GST_RTP_HEADER_CSRC_LIST_OFFSET(data,i) \
- data + G_STRUCT_OFFSET(GstRTPHeader, csrclist) + \
- ((i) * sizeof(guint32))
-#define GST_RTP_HEADER_CSRC_SIZE(data) (GST_RTP_HEADER_CSRC_COUNT(data) * sizeof (guint32))
-
-/**
- * gst_rtp_buffer_allocate_data:
- * @buffer: a #GstBuffer
- * @payload_len: the length of the payload
- * @pad_len: the amount of padding
- * @csrc_count: the number of CSRC entries
- *
- * Allocate enough data in @buffer to hold an RTP packet with @csrc_count CSRCs,
- * a payload length of @payload_len and padding of @pad_len.
- * MALLOCDATA of @buffer will be overwritten and will not be freed.
- * All other RTP header fields will be set to 0/FALSE.
- */
-void
-gst_rtp_buffer_allocate_data (GstBuffer * buffer, guint payload_len,
- guint8 pad_len, guint8 csrc_count)
-{
- guint len;
- guint8 *data;
-
- g_return_if_fail (csrc_count <= 15);
- g_return_if_fail (GST_IS_BUFFER (buffer));
-
- len = GST_RTP_HEADER_LEN + csrc_count * sizeof (guint32)
- + payload_len + pad_len;
-
- data = g_malloc (len);
- GST_BUFFER_MALLOCDATA (buffer) = data;
- GST_BUFFER_DATA (buffer) = data;
- GST_BUFFER_SIZE (buffer) = len;
-
- /* fill in defaults */
- GST_RTP_HEADER_VERSION (data) = GST_RTP_VERSION;
- GST_RTP_HEADER_PADDING (data) = FALSE;
- GST_RTP_HEADER_EXTENSION (data) = FALSE;
- GST_RTP_HEADER_CSRC_COUNT (data) = csrc_count;
- memset (GST_RTP_HEADER_CSRC_LIST_OFFSET (data, 0), 0,
- csrc_count * sizeof (guint32));
- GST_RTP_HEADER_MARKER (data) = FALSE;
- GST_RTP_HEADER_PAYLOAD_TYPE (data) = 0;
- GST_RTP_HEADER_SEQ (data) = 0;
- GST_RTP_HEADER_TIMESTAMP (data) = 0;
- GST_RTP_HEADER_SSRC (data) = 0;
-}
-
-/**
- * gst_rtp_buffer_new_take_data:
- * @data: data for the new buffer
- * @len: the length of data
- *
- * Create a new buffer and set the data and size of the buffer to @data and @len
- * respectively. @data will be freed when the buffer is unreffed, so this
- * function transfers ownership of @data to the new buffer.
- *
- * Returns: A newly allocated buffer with @data and of size @len.
- */
-GstBuffer *
-gst_rtp_buffer_new_take_data (gpointer data, guint len)
-{
- GstBuffer *result;
-
- g_return_val_if_fail (data != NULL, NULL);
- g_return_val_if_fail (len > 0, NULL);
-
- result = gst_buffer_new ();
-
- GST_BUFFER_MALLOCDATA (result) = data;
- GST_BUFFER_DATA (result) = data;
- GST_BUFFER_SIZE (result) = len;
-
- return result;
-}
-
-/**
- * gst_rtp_buffer_new_copy_data:
- * @data: data for the new buffer
- * @len: the length of data
- *
- * Create a new buffer and set the data to a copy of @len
- * bytes of @data and the size to @len. The data will be freed when the buffer
- * is freed.
- *
- * Returns: A newly allocated buffer with a copy of @data and of size @len.
- */
-GstBuffer *
-gst_rtp_buffer_new_copy_data (gpointer data, guint len)
-{
- return gst_rtp_buffer_new_take_data (g_memdup (data, len), len);
-}
-
-/**
- * gst_rtp_buffer_new_allocate:
- * @payload_len: the length of the payload
- * @pad_len: the amount of padding
- * @csrc_count: the number of CSRC entries
- *
- * Allocate a new #Gstbuffer with enough data to hold an RTP packet with @csrc_count CSRCs,
- * a payload length of @payload_len and padding of @pad_len.
- * All other RTP header fields will be set to 0/FALSE.
- *
- * Returns: A newly allocated buffer that can hold an RTP packet with given
- * parameters.
- */
-GstBuffer *
-gst_rtp_buffer_new_allocate (guint payload_len, guint8 pad_len,
- guint8 csrc_count)
-{
- GstBuffer *result;
-
- g_return_val_if_fail (csrc_count <= 15, NULL);
-
- result = gst_buffer_new ();
- gst_rtp_buffer_allocate_data (result, payload_len, pad_len, csrc_count);
-
- return result;
-}
-
-/**
- * gst_rtp_buffer_new_allocate_len:
- * @packet_len: the total length of the packet
- * @pad_len: the amount of padding
- * @csrc_count: the number of CSRC entries
- *
- * Create a new #GstBuffer that can hold an RTP packet that is exactly
- * @packet_len long. The length of the payload depends on @pad_len and
- * @csrc_count and can be calculated with gst_rtp_buffer_calc_payload_len().
- * All RTP header fields will be set to 0/FALSE.
- *
- * Returns: A newly allocated buffer that can hold an RTP packet of @packet_len.
- */
-GstBuffer *
-gst_rtp_buffer_new_allocate_len (guint packet_len, guint8 pad_len,
- guint8 csrc_count)
-{
- guint len;
-
- g_return_val_if_fail (csrc_count <= 15, NULL);
-
- len = gst_rtp_buffer_calc_payload_len (packet_len, pad_len, csrc_count);
-
- return gst_rtp_buffer_new_allocate (len, pad_len, csrc_count);
-}
-
-/**
- * gst_rtp_buffer_calc_header_len:
- * @csrc_count: the number of CSRC entries
- *
- * Calculate the header length of an RTP packet with @csrc_count CSRC entries.
- * An RTP packet can have at most 15 CSRC entries.
- *
- * Returns: The length of an RTP header with @csrc_count CSRC entries.
- */
-guint
-gst_rtp_buffer_calc_header_len (guint8 csrc_count)
-{
- g_return_val_if_fail (csrc_count <= 15, 0);
-
- return GST_RTP_HEADER_LEN + (csrc_count * sizeof (guint32));
-}
-
-/**
- * gst_rtp_buffer_calc_packet_len:
- * @payload_len: the length of the payload
- * @pad_len: the amount of padding
- * @csrc_count: the number of CSRC entries
- *
- * Calculate the total length of an RTP packet with a payload size of @payload_len,
- * a padding of @pad_len and a @csrc_count CSRC entries.
- *
- * Returns: The total length of an RTP header with given parameters.
- */
-guint
-gst_rtp_buffer_calc_packet_len (guint payload_len, guint8 pad_len,
- guint8 csrc_count)
-{
- g_return_val_if_fail (csrc_count <= 15, 0);
-
- return payload_len + GST_RTP_HEADER_LEN + (csrc_count * sizeof (guint32))
- + pad_len;
-}
-
-/**
- * gst_rtp_buffer_calc_payload_len:
- * @packet_len: the length of the total RTP packet
- * @pad_len: the amount of padding
- * @csrc_count: the number of CSRC entries
- *
- * Calculate the length of the payload of an RTP packet with size @packet_len,
- * a padding of @pad_len and a @csrc_count CSRC entries.
- *
- * Returns: The length of the payload of an RTP packet with given parameters.
- */
-guint
-gst_rtp_buffer_calc_payload_len (guint packet_len, guint8 pad_len,
- guint8 csrc_count)
-{
- g_return_val_if_fail (csrc_count <= 15, 0);
-
- return packet_len - GST_RTP_HEADER_LEN - (csrc_count * sizeof (guint32))
- - pad_len;
-}
-
-/**
- * validate_data:
- * @data: the data to validate
- * @len: the length of @data to validate
- * @payload: the payload if @data represents the header only
- * @payload_len: the len of the payload
- *
- * Checks if @data is a valid RTP packet.
- *
- * Returns: TRUE if @data is a valid RTP packet
- */
-static gboolean
-validate_data (guint8 * data, guint len, guint8 * payload, guint payload_len)
-{
- guint8 padding;
- guint8 csrc_count;
- guint header_len;
- guint8 version;
-
- g_return_val_if_fail (data != NULL, FALSE);
-
- header_len = GST_RTP_HEADER_LEN;
- if (G_UNLIKELY (len < header_len))
- goto wrong_length;
-
- /* check version */
- version = (data[0] & 0xc0);
- if (G_UNLIKELY (version != (GST_RTP_VERSION << 6)))
- goto wrong_version;
-
- /* calc header length with csrc */
- csrc_count = (data[0] & 0x0f);
- header_len += csrc_count * sizeof (guint32);
-
- /* calc extension length when present. */
- if (data[0] & 0x10) {
- guint8 *extpos;
- guint16 extlen;
-
- /* this points to the extenstion bits and header length */
- extpos = &data[header_len];
-
- /* skip the header and check that we have enough space */
- header_len += 4;
- if (G_UNLIKELY (len < header_len))
- goto wrong_length;
-
- /* skip id */
- extpos += 2;
- /* read length as the number of 32 bits words */
- extlen = GST_READ_UINT16_BE (extpos);
-
- header_len += extlen * sizeof (guint32);
- }
-
- /* check for padding */
- if (data[0] & 0x20) {
- if (payload)
- padding = payload[payload_len - 1];
- else
- padding = data[len - 1];
- } else {
- padding = 0;
- }
-
- /* check if padding and header not bigger than packet length */
- if (G_UNLIKELY (len < padding + header_len))
- goto wrong_padding;
-
- return TRUE;
-
- /* ERRORS */
-wrong_length:
- {
- GST_DEBUG ("len < header_len check failed (%d < %d)", len, header_len);
- goto dump_packet;
- }
-wrong_version:
- {
- GST_DEBUG ("version check failed (%d != %d)", version, GST_RTP_VERSION);
- goto dump_packet;
- }
-wrong_padding:
- {
- GST_DEBUG ("padding check failed (%d - %d < %d)", len, header_len, padding);
- goto dump_packet;
- }
-dump_packet:
- {
- GST_MEMDUMP ("buffer", data, len);
- return FALSE;
- }
-}
-
-/**
- * gst_rtp_buffer_validate_data:
- * @data: the data to validate
- * @len: the length of @data to validate
- *
- * Check if the @data and @size point to the data of a valid RTP packet.
- * This function checks the length, version and padding of the packet data.
- * Use this function to validate a packet before using the other functions in
- * this module.
- *
- * Returns: TRUE if the data points to a valid RTP packet.
- */
-gboolean
-gst_rtp_buffer_validate_data (guint8 * data, guint len)
-{
- return validate_data (data, len, NULL, 0);
-}
-
-/**
- * gst_rtp_buffer_validate:
- * @buffer: the buffer to validate
- *
- * Check if the data pointed to by @buffer is a valid RTP packet using
- * validate_data().
- * Use this function to validate a packet before using the other functions in
- * this module.
- *
- * Returns: TRUE if @buffer is a valid RTP packet.
- */
-gboolean
-gst_rtp_buffer_validate (GstBuffer * buffer)
-{
- guint8 *data;
- guint len;
-
- g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
-
- data = GST_BUFFER_DATA (buffer);
- len = GST_BUFFER_SIZE (buffer);
-
- return validate_data (data, len, NULL, 0);
-}
-
-/**
- * gst_rtp_buffer_list_validate:
- * @list: the buffer list to validate
- *
- * Check if all RTP packets in the @list are valid using validate_data().
- * Use this function to validate an list before using the other functions in
- * this module.
- *
- * Returns: TRUE if @list consists only of valid RTP packets.
- *
- * Since: 0.10.24
- */
-gboolean
-gst_rtp_buffer_list_validate (GstBufferList * list)
-{
- guint16 prev_seqnum = 0;
- GstBufferListIterator *it;
- guint i = 0;
-
- g_return_val_if_fail (GST_IS_BUFFER_LIST (list), FALSE);
-
- it = gst_buffer_list_iterate (list);
- g_return_val_if_fail (it != NULL, FALSE);
-
- /* iterate through all the RTP packets in the list */
- while (gst_buffer_list_iterator_next_group (it)) {
- GstBuffer *rtpbuf;
- GstBuffer *paybuf;
- guint8 *packet_header;
- guint8 *packet_payload;
- guint payload_size;
- guint packet_size;
-
- /* each group should consists of 2 buffers: one containing the RTP header
- * and the other one the payload, FIXME, relax the requirement of only one
- * payload buffer. */
- if (gst_buffer_list_iterator_n_buffers (it) != 2)
- goto invalid_list;
-
- /* get the RTP header */
- rtpbuf = gst_buffer_list_iterator_next (it);
- packet_header = GST_BUFFER_DATA (rtpbuf);
- if (packet_header == NULL)
- goto invalid_list;
-
- /* get the payload */
- paybuf = gst_buffer_list_iterator_next (it);
- packet_payload = GST_BUFFER_DATA (paybuf);
- if (packet_payload == NULL) {
- goto invalid_list;
- }
- payload_size = GST_BUFFER_SIZE (paybuf);
- if (payload_size == 0) {
- goto invalid_list;
- }
-
- /* the size of the RTP packet within the current group */
- packet_size = GST_BUFFER_SIZE (rtpbuf) + payload_size;
-
- /* check the sequence number */
- if (G_UNLIKELY (i == 0)) {
- prev_seqnum = g_ntohs (GST_RTP_HEADER_SEQ (packet_header));
- i++;
- } else {
- if (++prev_seqnum != g_ntohs (GST_RTP_HEADER_SEQ (packet_header)))
- goto invalid_list;
- }
-
- /* validate packet */
- if (!validate_data (packet_header, packet_size, packet_payload,
- payload_size)) {
- goto invalid_list;
- }
- }
-
- gst_buffer_list_iterator_free (it);
-
- return TRUE;
-
- /* ERRORS */
-invalid_list:
- {
- gst_buffer_list_iterator_free (it);
- return FALSE;
- }
-}
-
-/**
- * gst_rtp_buffer_set_packet_len:
- * @buffer: the buffer
- * @len: the new packet length
- *
- * Set the total @buffer size to @len. The data in the buffer will be made
- * larger if needed. Any padding will be removed from the packet.
- */
-void
-gst_rtp_buffer_set_packet_len (GstBuffer * buffer, guint len)
-{
- guint oldlen;
- guint8 *data;
-
- oldlen = GST_BUFFER_SIZE (buffer);
- data = GST_BUFFER_DATA (buffer);
-
- if (oldlen < len) {
- data = g_realloc (GST_BUFFER_MALLOCDATA (buffer), len);
- GST_BUFFER_MALLOCDATA (buffer) = data;
- GST_BUFFER_DATA (buffer) = data;
- }
- GST_BUFFER_SIZE (buffer) = len;
-
- /* remove any padding */
- GST_RTP_HEADER_PADDING (data) = FALSE;
-}
-
-/**
- * gst_rtp_buffer_get_packet_len:
- * @buffer: the buffer
- *
- * Return the total length of the packet in @buffer.
- *
- * Returns: The total length of the packet in @buffer.
- */
-guint
-gst_rtp_buffer_get_packet_len (GstBuffer * buffer)
-{
- return GST_BUFFER_SIZE (buffer);
-}
-
-/**
- * gst_rtp_buffer_get_header_len:
- * @buffer: the buffer
- *
- * Return the total length of the header in @buffer. This include the length of
- * the fixed header, the CSRC list and the extension header.
- *
- * Returns: The total length of the header in @buffer.
- */
-guint
-gst_rtp_buffer_get_header_len (GstBuffer * buffer)
-{
- guint len;
- guint8 *data;
-
- data = GST_BUFFER_DATA (buffer);
-
- len = GST_RTP_HEADER_LEN + GST_RTP_HEADER_CSRC_SIZE (data);
- if (GST_RTP_HEADER_EXTENSION (data))
- len += GST_READ_UINT16_BE (data + len + 2) * 4 + 4;
-
- return len;
-}
-
-/**
- * gst_rtp_buffer_get_version:
- * @buffer: the buffer
- *
- * Get the version number of the RTP packet in @buffer.
- *
- * Returns: The version of @buffer.
- */
-guint8
-gst_rtp_buffer_get_version (GstBuffer * buffer)
-{
- return GST_RTP_HEADER_VERSION (GST_BUFFER_DATA (buffer));
-}
-
-/**
- * gst_rtp_buffer_set_version:
- * @buffer: the buffer
- * @version: the new version
- *
- * Set the version of the RTP packet in @buffer to @version.
- */
-void
-gst_rtp_buffer_set_version (GstBuffer * buffer, guint8 version)
-{
- g_return_if_fail (version < 0x04);
-
- GST_RTP_HEADER_VERSION (GST_BUFFER_DATA (buffer)) = version;
-}
-
-/**
- * gst_rtp_buffer_get_padding:
- * @buffer: the buffer
- *
- * Check if the padding bit is set on the RTP packet in @buffer.
- *
- * Returns: TRUE if @buffer has the padding bit set.
- */
-gboolean
-gst_rtp_buffer_get_padding (GstBuffer * buffer)
-{
- return GST_RTP_HEADER_PADDING (GST_BUFFER_DATA (buffer));
-}
-
-/**
- * gst_rtp_buffer_set_padding:
- * @buffer: the buffer
- * @padding: the new padding
- *
- * Set the padding bit on the RTP packet in @buffer to @padding.
- */
-void
-gst_rtp_buffer_set_padding (GstBuffer * buffer, gboolean padding)
-{
- GST_RTP_HEADER_PADDING (GST_BUFFER_DATA (buffer)) = padding;
-}
-
-/**
- * gst_rtp_buffer_pad_to:
- * @buffer: the buffer
- * @len: the new amount of padding
- *
- * Set the amount of padding in the RTP packet in @buffer to
- * @len. If @len is 0, the padding is removed.
- *
- * NOTE: This function does not work correctly.
- */
-void
-gst_rtp_buffer_pad_to (GstBuffer * buffer, guint len)
-{
- guint8 *data;
-
- data = GST_BUFFER_DATA (buffer);
-
- if (len > 0)
- GST_RTP_HEADER_PADDING (data) = TRUE;
- else
- GST_RTP_HEADER_PADDING (data) = FALSE;
-
- /* FIXME, set the padding byte at the end of the payload data */
-}
-
-/**
- * gst_rtp_buffer_get_extension:
- * @buffer: the buffer
- *
- * Check if the extension bit is set on the RTP packet in @buffer.
- *
- * Returns: TRUE if @buffer has the extension bit set.
- */
-gboolean
-gst_rtp_buffer_get_extension (GstBuffer * buffer)
-{
- return GST_RTP_HEADER_EXTENSION (GST_BUFFER_DATA (buffer));
-}
-
-/**
- * gst_rtp_buffer_set_extension:
- * @buffer: the buffer
- * @extension: the new extension
- *
- * Set the extension bit on the RTP packet in @buffer to @extension.
- */
-void
-gst_rtp_buffer_set_extension (GstBuffer * buffer, gboolean extension)
-{
- GST_RTP_HEADER_EXTENSION (GST_BUFFER_DATA (buffer)) = extension;
-}
-
-/**
- * gst_rtp_buffer_get_extension_data:
- * @buffer: the buffer
- * @bits: location for result bits
- * @data: location for data
- * @wordlen: location for length of @data in 32 bits words
- *
- * Get the extension data. @bits will contain the extension 16 bits of custom
- * data. @data will point to the data in the extension and @wordlen will contain
- * the length of @data in 32 bits words.
- *
- * If @buffer did not contain an extension, this function will return %FALSE
- * with @bits, @data and @wordlen unchanged.
- *
- * Returns: TRUE if @buffer had the extension bit set.
- *
- * Since: 0.10.15
- */
-gboolean
-gst_rtp_buffer_get_extension_data (GstBuffer * buffer, guint16 * bits,
- gpointer * data, guint * wordlen)
-{
- guint len;
- guint8 *pdata;
-
- pdata = GST_BUFFER_DATA (buffer);
-
- if (!GST_RTP_HEADER_EXTENSION (pdata))
- return FALSE;
-
- /* move to the extension */
- len = GST_RTP_HEADER_LEN + GST_RTP_HEADER_CSRC_SIZE (pdata);
- pdata += len;
-
- if (bits)
- *bits = GST_READ_UINT16_BE (pdata);
- if (wordlen)
- *wordlen = GST_READ_UINT16_BE (pdata + 2);
- if (data)
- *data = pdata + 4;
-
- return TRUE;
-}
-
-/**
- * gst_rtp_buffer_set_extension_data:
- * @buffer: the buffer
- * @bits: the bits specific for the extension
- * @length: the length that counts the number of 32-bit words in
- * the extension, excluding the extension header ( therefore zero is a valid length)
- *
- * Set the extension bit of the rtp buffer and fill in the @bits and @length of the
- * extension header. It will refuse to set the extension data if the buffer is not
- * large enough.
- *
- * Returns: True if done.
- *
- * Since : 0.10.18
- */
-gboolean
-gst_rtp_buffer_set_extension_data (GstBuffer * buffer, guint16 bits,
- guint16 length)
-{
- guint32 min_size = 0;
- guint8 *data;
-
- data = GST_BUFFER_DATA (buffer);
-
- /* check if the buffer is big enough to hold the extension */
- min_size =
- GST_RTP_HEADER_LEN + GST_RTP_HEADER_CSRC_SIZE (data) + 4 +
- length * sizeof (guint32);
- if (G_UNLIKELY (min_size > GST_BUFFER_SIZE (buffer)))
- goto too_small;
-
- /* now we can set the extension bit */
- gst_rtp_buffer_set_extension (buffer, TRUE);
-
- data += GST_RTP_HEADER_LEN + GST_RTP_HEADER_CSRC_SIZE (data);
- GST_WRITE_UINT16_BE (data, bits);
- GST_WRITE_UINT16_BE (data + 2, length);
-
- return TRUE;
-
- /* ERRORS */
-too_small:
- {
- g_warning
- ("rtp buffer too small: need more than %d bytes but only have %d bytes",
- min_size, GST_BUFFER_SIZE (buffer));
- return FALSE;
- }
-}
-
-/**
- * gst_rtp_buffer_get_ssrc:
- * @buffer: the buffer
- *
- * Get the SSRC of the RTP packet in @buffer.
- *
- * Returns: the SSRC of @buffer in host order.
- */
-guint32
-gst_rtp_buffer_get_ssrc (GstBuffer * buffer)
-{
- return g_ntohl (GST_RTP_HEADER_SSRC (GST_BUFFER_DATA (buffer)));
-}
-
-/**
- * gst_rtp_buffer_list_get_ssrc:
- * @list: the buffer list
- *
- * Get the SSRC of the first RTP packet in @list.
- * All RTP packets within @list have the same SSRC.
- *
- * Returns: the SSRC of @list in host order.
- *
- * Since: 0.10.24
- */
-guint32
-gst_rtp_buffer_list_get_ssrc (GstBufferList * list)
-{
- GstBuffer *buffer;
-
- buffer = gst_buffer_list_get (list, 0, 0);
- g_return_val_if_fail (buffer != NULL, 0);
-
- return g_ntohl (GST_RTP_HEADER_SSRC (GST_BUFFER_DATA (buffer)));
-}
-
-/**
- * gst_rtp_buffer_set_ssrc:
- * @buffer: the buffer
- * @ssrc: the new SSRC
- *
- * Set the SSRC on the RTP packet in @buffer to @ssrc.
- */
-void
-gst_rtp_buffer_set_ssrc (GstBuffer * buffer, guint32 ssrc)
-{
- GST_RTP_HEADER_SSRC (GST_BUFFER_DATA (buffer)) = g_htonl (ssrc);
-}
-
-static GstBufferListItem
-set_ssrc_header (GstBuffer ** buffer, guint group, guint idx, guint32 * ssrc)
-{
- GST_RTP_HEADER_SSRC (GST_BUFFER_DATA (*buffer)) = g_htonl (*ssrc);
- return GST_BUFFER_LIST_SKIP_GROUP;
-}
-
-/**
- * gst_rtp_buffer_list_set_ssrc:
- * @list: the buffer list
- * @ssrc: the new SSRC
- *
- * Set the SSRC on each RTP packet in @list to @ssrc.
- *
- * Since: 0.10.24
- */
-void
-gst_rtp_buffer_list_set_ssrc (GstBufferList * list, guint32 ssrc)
-{
- gst_buffer_list_foreach (list, (GstBufferListFunc) set_ssrc_header, &ssrc);
-}
-
-/**
- * gst_rtp_buffer_get_csrc_count:
- * @buffer: the buffer
- *
- * Get the CSRC count of the RTP packet in @buffer.
- *
- * Returns: the CSRC count of @buffer.
- */
-guint8
-gst_rtp_buffer_get_csrc_count (GstBuffer * buffer)
-{
- return GST_RTP_HEADER_CSRC_COUNT (GST_BUFFER_DATA (buffer));
-}
-
-/**
- * gst_rtp_buffer_get_csrc:
- * @buffer: the buffer
- * @idx: the index of the CSRC to get
- *
- * Get the CSRC at index @idx in @buffer.
- *
- * Returns: the CSRC at index @idx in host order.
- */
-guint32
-gst_rtp_buffer_get_csrc (GstBuffer * buffer, guint8 idx)
-{
- guint8 *data;
-
- data = GST_BUFFER_DATA (buffer);
-
- g_return_val_if_fail (idx < GST_RTP_HEADER_CSRC_COUNT (data), 0);
-
- return GST_READ_UINT32_BE (GST_RTP_HEADER_CSRC_LIST_OFFSET (data, idx));
-}
-
-/**
- * gst_rtp_buffer_set_csrc:
- * @buffer: the buffer
- * @idx: the CSRC index to set
- * @csrc: the CSRC in host order to set at @idx
- *
- * Modify the CSRC at index @idx in @buffer to @csrc.
- */
-void
-gst_rtp_buffer_set_csrc (GstBuffer * buffer, guint8 idx, guint32 csrc)
-{
- guint8 *data;
-
- data = GST_BUFFER_DATA (buffer);
-
- g_return_if_fail (idx < GST_RTP_HEADER_CSRC_COUNT (data));
-
- GST_WRITE_UINT32_BE (GST_RTP_HEADER_CSRC_LIST_OFFSET (data, idx), csrc);
-}
-
-/**
- * gst_rtp_buffer_get_marker:
- * @buffer: the buffer
- *
- * Check if the marker bit is set on the RTP packet in @buffer.
- *
- * Returns: TRUE if @buffer has the marker bit set.
- */
-gboolean
-gst_rtp_buffer_get_marker (GstBuffer * buffer)
-{
- return GST_RTP_HEADER_MARKER (GST_BUFFER_DATA (buffer));
-}
-
-/**
- * gst_rtp_buffer_set_marker:
- * @buffer: the buffer
- * @marker: the new marker
- *
- * Set the marker bit on the RTP packet in @buffer to @marker.
- */
-void
-gst_rtp_buffer_set_marker (GstBuffer * buffer, gboolean marker)
-{
- GST_RTP_HEADER_MARKER (GST_BUFFER_DATA (buffer)) = marker;
-}
-
-/**
- * gst_rtp_buffer_get_payload_type:
- * @buffer: the buffer
- *
- * Get the payload type of the RTP packet in @buffer.
- *
- * Returns: The payload type.
- */
-guint8
-gst_rtp_buffer_get_payload_type (GstBuffer * buffer)
-{
- return GST_RTP_HEADER_PAYLOAD_TYPE (GST_BUFFER_DATA (buffer));
-}
-
-/**
- * gst_rtp_buffer_list_get_payload_type:
- * @list: the buffer list
- *
- * Get the payload type of the first RTP packet in @list.
- * All packets in @list should have the same payload type.
- *
- * Returns: The payload type.
- *
- * Since: 0.10.24
- */
-guint8
-gst_rtp_buffer_list_get_payload_type (GstBufferList * list)
-{
- GstBuffer *buffer;
-
- buffer = gst_buffer_list_get (list, 0, 0);
- g_return_val_if_fail (buffer != NULL, 0);
-
- return GST_RTP_HEADER_PAYLOAD_TYPE (GST_BUFFER_DATA (buffer));
-}
-
-/**
- * gst_rtp_buffer_set_payload_type:
- * @buffer: the buffer
- * @payload_type: the new type
- *
- * Set the payload type of the RTP packet in @buffer to @payload_type.
- */
-void
-gst_rtp_buffer_set_payload_type (GstBuffer * buffer, guint8 payload_type)
-{
- g_return_if_fail (payload_type < 0x80);
-
- GST_RTP_HEADER_PAYLOAD_TYPE (GST_BUFFER_DATA (buffer)) = payload_type;
-}
-
-static GstBufferListItem
-set_pt_header (GstBuffer ** buffer, guint group, guint idx, guint8 * pt)
-{
- GST_RTP_HEADER_PAYLOAD_TYPE (GST_BUFFER_DATA (*buffer)) = *pt;
- return GST_BUFFER_LIST_SKIP_GROUP;
-}
-
-/**
- * gst_rtp_buffer_list_set_payload_type:
- * @list: the buffer list
- * @payload_type: the new type
- *
- * Set the payload type of each RTP packet in @list to @payload_type.
- *
- * Since: 0.10.24
- */
-void
-gst_rtp_buffer_list_set_payload_type (GstBufferList * list, guint8 payload_type)
-{
- g_return_if_fail (payload_type < 0x80);
-
- gst_buffer_list_foreach (list, (GstBufferListFunc) set_pt_header,
- &payload_type);
-}
-
-/**
- * gst_rtp_buffer_get_seq:
- * @buffer: the buffer
- *
- * Get the sequence number of the RTP packet in @buffer.
- *
- * Returns: The sequence number in host order.
- */
-guint16
-gst_rtp_buffer_get_seq (GstBuffer * buffer)
-{
- return g_ntohs (GST_RTP_HEADER_SEQ (GST_BUFFER_DATA (buffer)));
-}
-
-/**
- * gst_rtp_buffer_set_seq:
- * @buffer: the buffer
- * @seq: the new sequence number
- *
- * Set the sequence number of the RTP packet in @buffer to @seq.
- */
-void
-gst_rtp_buffer_set_seq (GstBuffer * buffer, guint16 seq)
-{
- GST_RTP_HEADER_SEQ (GST_BUFFER_DATA (buffer)) = g_htons (seq);
-}
-
-static GstBufferListItem
-set_seq_header (GstBuffer ** buffer, guint group, guint idx, guint16 * seq)
-{
- GST_RTP_HEADER_SEQ (GST_BUFFER_DATA (*buffer)) = g_htons (*seq);
- (*seq)++;
- return GST_BUFFER_LIST_SKIP_GROUP;
-}
-
-/**
- * gst_rtp_buffer_list_set_seq:
- * @list: the buffer list
- * @seq: the new sequence number
- *
- * Set the sequence number of each RTP packet in @list to @seq.
- *
- * Returns: The seq number of the last packet in the list + 1.
- *
- * Since: 0.10.24
- */
-guint16
-gst_rtp_buffer_list_set_seq (GstBufferList * list, guint16 seq)
-{
- gst_buffer_list_foreach (list, (GstBufferListFunc) set_seq_header, &seq);
- return seq;
-}
-
-/**
- * gst_rtp_buffer_list_get_seq:
- * @list: the buffer list
- *
- * Get the sequence number of the first RTP packet in @list.
- * All packets within @list have the same sequence number.
- *
- * Returns: The seq number
- *
- * Since: 0.10.24
- */
-guint16
-gst_rtp_buffer_list_get_seq (GstBufferList * list)
-{
- GstBuffer *buffer;
-
- buffer = gst_buffer_list_get (list, 0, 0);
- g_return_val_if_fail (buffer != NULL, 0);
-
- return g_ntohl (GST_RTP_HEADER_SEQ (GST_BUFFER_DATA (buffer)));
-}
-
-
-/**
- * gst_rtp_buffer_get_timestamp:
- * @buffer: the buffer
- *
- * Get the timestamp of the RTP packet in @buffer.
- *
- * Returns: The timestamp in host order.
- */
-guint32
-gst_rtp_buffer_get_timestamp (GstBuffer * buffer)
-{
- return g_ntohl (GST_RTP_HEADER_TIMESTAMP (GST_BUFFER_DATA (buffer)));
-}
-
-/**
- * gst_rtp_buffer_list_get_timestamp:
- * @list: the buffer list
- *
- * Get the timestamp of the first RTP packet in @list.
- * All packets within @list have the same timestamp.
- *
- * Returns: The timestamp in host order.
- *
- * Since: 0.10.24
- */
-guint32
-gst_rtp_buffer_list_get_timestamp (GstBufferList * list)
-{
- GstBuffer *buffer;
-
- buffer = gst_buffer_list_get (list, 0, 0);
- g_return_val_if_fail (buffer != NULL, 0);
-
- return g_ntohl (GST_RTP_HEADER_TIMESTAMP (GST_BUFFER_DATA (buffer)));
-}
-
-/**
- * gst_rtp_buffer_set_timestamp:
- * @buffer: the buffer
- * @timestamp: the new timestamp
- *
- * Set the timestamp of the RTP packet in @buffer to @timestamp.
- */
-void
-gst_rtp_buffer_set_timestamp (GstBuffer * buffer, guint32 timestamp)
-{
- GST_RTP_HEADER_TIMESTAMP (GST_BUFFER_DATA (buffer)) = g_htonl (timestamp);
-}
-
-
-static GstBufferListItem
-set_timestamp_header (GstBuffer ** buffer, guint group, guint idx,
- guint32 * timestamp)
-{
- GST_RTP_HEADER_TIMESTAMP (GST_BUFFER_DATA (*buffer)) = g_htonl (*timestamp);
- return GST_BUFFER_LIST_SKIP_GROUP;
-}
-
-/**
- * gst_rtp_buffer_list_set_timestamp:
- * @list: the buffer list
- * @timestamp: the new timestamp
- *
- * Set the timestamp of each RTP packet in @list to @timestamp.
- *
- * Since: 0.10.24
- */
-void
-gst_rtp_buffer_list_set_timestamp (GstBufferList * list, guint32 timestamp)
-{
- gst_buffer_list_foreach (list, (GstBufferListFunc) set_timestamp_header,
- &timestamp);
-}
-
-/**
- * gst_rtp_buffer_get_payload_subbuffer:
- * @buffer: the buffer
- * @offset: the offset in the payload
- * @len: the length in the payload
- *
- * Create a subbuffer of the payload of the RTP packet in @buffer. @offset bytes
- * are skipped in the payload and the subbuffer will be of size @len.
- * If @len is -1 the total payload starting from @offset if subbuffered.
- *
- * Returns: A new buffer with the specified data of the payload.
- *
- * Since: 0.10.10
- */
-GstBuffer *
-gst_rtp_buffer_get_payload_subbuffer (GstBuffer * buffer, guint offset,
- guint len)
-{
- guint poffset, plen;
-
- plen = gst_rtp_buffer_get_payload_len (buffer);
- /* we can't go past the length */
- if (G_UNLIKELY (offset >= plen))
- goto wrong_offset;
-
- /* apply offset */
- poffset = gst_rtp_buffer_get_header_len (buffer) + offset;
- plen -= offset;
-
- /* see if we need to shrink the buffer based on @len */
- if (len != -1 && len < plen)
- plen = len;
-
- return gst_buffer_create_sub (buffer, poffset, plen);
-
- /* ERRORS */
-wrong_offset:
- {
- g_warning ("offset=%u should be less then plen=%u", offset, plen);
- return NULL;
- }
-}
-
-/**
- * gst_rtp_buffer_get_payload_buffer:
- * @buffer: the buffer
- *
- * Create a buffer of the payload of the RTP packet in @buffer. This function
- * will internally create a subbuffer of @buffer so that a memcpy can be
- * avoided.
- *
- * Returns: A new buffer with the data of the payload.
- */
-GstBuffer *
-gst_rtp_buffer_get_payload_buffer (GstBuffer * buffer)
-{
- return gst_rtp_buffer_get_payload_subbuffer (buffer, 0, -1);
-}
-
-/**
- * gst_rtp_buffer_get_payload_len:
- * @buffer: the buffer
- *
- * Get the length of the payload of the RTP packet in @buffer.
- *
- * Returns: The length of the payload in @buffer.
- */
-guint
-gst_rtp_buffer_get_payload_len (GstBuffer * buffer)
-{
- guint len, size;
- guint8 *data;
-
- size = GST_BUFFER_SIZE (buffer);
- data = GST_BUFFER_DATA (buffer);
-
- len = size - gst_rtp_buffer_get_header_len (buffer);
-
- if (GST_RTP_HEADER_PADDING (data))
- len -= data[size - 1];
-
- return len;
-}
-
-/**
- * gst_rtp_buffer_list_get_payload_len:
- * @list: the buffer list
- *
- * Get the length of the payload of the RTP packet in @list.
- *
- * Returns: The length of the payload in @list.
- *
- * Since: 0.10.24
- */
-guint
-gst_rtp_buffer_list_get_payload_len (GstBufferList * list)
-{
- guint len;
- GstBufferListIterator *it;
-
- it = gst_buffer_list_iterate (list);
- len = 0;
-
- while (gst_buffer_list_iterator_next_group (it)) {
- guint i;
- GstBuffer *buf;
-
- i = 0;
- while ((buf = gst_buffer_list_iterator_next (it))) {
- /* skip the RTP header */
- if (!i++)
- continue;
- /* take the size of the current buffer */
- len += GST_BUFFER_SIZE (buf);
- }
- }
-
- gst_buffer_list_iterator_free (it);
-
- return len;
-}
-
-/**
- * gst_rtp_buffer_get_payload:
- * @buffer: the buffer
- *
- * Get a pointer to the payload data in @buffer. This pointer is valid as long
- * as a reference to @buffer is held.
- *
- * Returns: A pointer to the payload data in @buffer.
- */
-gpointer
-gst_rtp_buffer_get_payload (GstBuffer * buffer)
-{
- return GST_BUFFER_DATA (buffer) + gst_rtp_buffer_get_header_len (buffer);
-}
-
-/**
- * gst_rtp_buffer_default_clock_rate:
- * @payload_type: the static payload type
- *
- * Get the default clock-rate for the static payload type @payload_type.
- *
- * Returns: the default clock rate or -1 if the payload type is not static or
- * the clock-rate is undefined.
- *
- * Since: 0.10.13
- */
-guint32
-gst_rtp_buffer_default_clock_rate (guint8 payload_type)
-{
- const GstRTPPayloadInfo *info;
- guint32 res;
-
- info = gst_rtp_payload_info_for_pt (payload_type);
- if (!info)
- return -1;
-
- res = info->clock_rate;
- /* 0 means unknown so we have to return -1 from this function */
- if (res == 0)
- res = -1;
-
- return res;
-}
-
-/**
- * gst_rtp_buffer_compare_seqnum:
- * @seqnum1: a sequence number
- * @seqnum2: a sequence number
- *
- * Compare two sequence numbers, taking care of wraparounds. This function
- * returns the difference between @seqnum1 and @seqnum2.
- *
- * Returns: a negative value if @seqnum1 is bigger than @seqnum2, 0 if they
- * are equal or a positive value if @seqnum1 is smaller than @segnum2.
- *
- * Since: 0.10.15
- */
-gint
-gst_rtp_buffer_compare_seqnum (guint16 seqnum1, guint16 seqnum2)
-{
- return (gint16) (seqnum2 - seqnum1);
-}
-
-/**
- * gst_rtp_buffer_ext_timestamp:
- * @exttimestamp: a previous extended timestamp
- * @timestamp: a new timestamp
- *
- * Update the @exttimestamp field with @timestamp. For the first call of the
- * method, @exttimestamp should point to a location with a value of -1.
- *
- * This function makes sure that the returned value is a constantly increasing
- * value even in the case where there is a timestamp wraparound.
- *
- * Returns: The extended timestamp of @timestamp.
- *
- * Since: 0.10.15
- */
-guint64
-gst_rtp_buffer_ext_timestamp (guint64 * exttimestamp, guint32 timestamp)
-{
- guint64 result, diff, ext;
-
- g_return_val_if_fail (exttimestamp != NULL, -1);
-
- ext = *exttimestamp;
-
- if (ext == -1) {
- result = timestamp;
- } else {
- /* pick wraparound counter from previous timestamp and add to new timestamp */
- result = timestamp + (ext & ~(G_GINT64_CONSTANT (0xffffffff)));
-
- /* check for timestamp wraparound */
- if (result < ext)
- diff = ext - result;
- else
- diff = result - ext;
-
- if (diff > G_MAXINT32) {
- /* timestamp went backwards more than allowed, we wrap around and get
- * updated extended timestamp. */
- result += (G_GINT64_CONSTANT (1) << 32);
- }
- }
- *exttimestamp = result;
-
- return result;
-}
diff --git a/gst-libs/gst/rtp/gstrtpbuffer.h b/gst-libs/gst/rtp/gstrtpbuffer.h
deleted file mode 100644
index c9680b03..00000000
--- a/gst-libs/gst/rtp/gstrtpbuffer.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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
-
-/* creating buffers */
-void gst_rtp_buffer_allocate_data (GstBuffer *buffer, guint payload_len,
- guint8 pad_len, guint8 csrc_count);
-
-GstBuffer* gst_rtp_buffer_new_take_data (gpointer data, guint len);
-GstBuffer* gst_rtp_buffer_new_copy_data (gpointer data, guint len);
-GstBuffer* gst_rtp_buffer_new_allocate (guint payload_len, guint8 pad_len, guint8 csrc_count);
-GstBuffer* gst_rtp_buffer_new_allocate_len (guint packet_len, guint8 pad_len, guint8 csrc_count);
-
-guint gst_rtp_buffer_calc_header_len (guint8 csrc_count);
-guint gst_rtp_buffer_calc_packet_len (guint payload_len, guint8 pad_len, guint8 csrc_count);
-guint gst_rtp_buffer_calc_payload_len (guint packet_len, guint8 pad_len, guint8 csrc_count);
-
-gboolean gst_rtp_buffer_validate_data (guint8 *data, guint len);
-gboolean gst_rtp_buffer_validate (GstBuffer *buffer);
-gboolean gst_rtp_buffer_list_validate (GstBufferList *list);
-
-void gst_rtp_buffer_set_packet_len (GstBuffer *buffer, guint len);
-guint gst_rtp_buffer_get_packet_len (GstBuffer *buffer);
-
-guint gst_rtp_buffer_get_header_len (GstBuffer *buffer);
-
-guint8 gst_rtp_buffer_get_version (GstBuffer *buffer);
-void gst_rtp_buffer_set_version (GstBuffer *buffer, guint8 version);
-
-gboolean gst_rtp_buffer_get_padding (GstBuffer *buffer);
-void gst_rtp_buffer_set_padding (GstBuffer *buffer, gboolean padding);
-void gst_rtp_buffer_pad_to (GstBuffer *buffer, guint len);
-
-gboolean gst_rtp_buffer_get_extension (GstBuffer *buffer);
-void gst_rtp_buffer_set_extension (GstBuffer *buffer, gboolean extension);
-gboolean gst_rtp_buffer_get_extension_data (GstBuffer *buffer, guint16 *bits,
- gpointer *data, guint *wordlen);
-gboolean gst_rtp_buffer_set_extension_data (GstBuffer *buffer, guint16 bits, guint16 length);
-
-guint32 gst_rtp_buffer_get_ssrc (GstBuffer *buffer);
-guint32 gst_rtp_buffer_list_get_ssrc (GstBufferList *list);
-void gst_rtp_buffer_set_ssrc (GstBuffer *buffer, guint32 ssrc);
-void gst_rtp_buffer_list_set_ssrc (GstBufferList *list, guint32 ssrc);
-
-guint8 gst_rtp_buffer_get_csrc_count (GstBuffer *buffer);
-guint32 gst_rtp_buffer_get_csrc (GstBuffer *buffer, guint8 idx);
-void gst_rtp_buffer_set_csrc (GstBuffer *buffer, guint8 idx, guint32 csrc);
-
-gboolean gst_rtp_buffer_get_marker (GstBuffer *buffer);
-void gst_rtp_buffer_set_marker (GstBuffer *buffer, gboolean marker);
-
-guint8 gst_rtp_buffer_get_payload_type (GstBuffer *buffer);
-guint8 gst_rtp_buffer_list_get_payload_type (GstBufferList *list);
-void gst_rtp_buffer_set_payload_type (GstBuffer *buffer, guint8 payload_type);
-void gst_rtp_buffer_list_set_payload_type (GstBufferList *list, guint8 payload_type);
-
-guint16 gst_rtp_buffer_get_seq (GstBuffer *buffer);
-guint16 gst_rtp_buffer_list_get_seq (GstBufferList *list);
-void gst_rtp_buffer_set_seq (GstBuffer *buffer, guint16 seq);
-guint16 gst_rtp_buffer_list_set_seq (GstBufferList *list, guint16 seq);
-
-guint32 gst_rtp_buffer_get_timestamp (GstBuffer *buffer);
-guint32 gst_rtp_buffer_list_get_timestamp (GstBufferList *list);
-void gst_rtp_buffer_set_timestamp (GstBuffer *buffer, guint32 timestamp);
-void gst_rtp_buffer_list_set_timestamp (GstBufferList *list, guint32 timestamp);
-
-GstBuffer* gst_rtp_buffer_get_payload_buffer (GstBuffer *buffer);
-GstBuffer* gst_rtp_buffer_get_payload_subbuffer (GstBuffer *buffer, guint offset, guint len);
-
-guint gst_rtp_buffer_get_payload_len (GstBuffer *buffer);
-guint gst_rtp_buffer_list_get_payload_len (GstBufferList *list);
-gpointer gst_rtp_buffer_get_payload (GstBuffer *buffer);
-
-/* some helpers */
-guint32 gst_rtp_buffer_default_clock_rate (guint8 payload_type);
-gint gst_rtp_buffer_compare_seqnum (guint16 seqnum1, guint16 seqnum2);
-guint64 gst_rtp_buffer_ext_timestamp (guint64 *exttimestamp, guint32 timestamp);
-
-G_END_DECLS
-
-#endif /* __GST_RTPBUFFER_H__ */
-
diff --git a/gst-libs/gst/rtp/gstrtppayloads.c b/gst-libs/gst/rtp/gstrtppayloads.c
deleted file mode 100644
index 97c0fa95..00000000
--- a/gst-libs/gst/rtp/gstrtppayloads.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstrtppayloads
- * @short_description: Helper methods for dealing with RTP payloads
- * @see_also: gstrtpbuffer
- *
- * <refsect2>
- * <para>
- * The GstRTPPayloads helper functions makes it easy to deal with static and dynamic
- * payloads. Its main purpose is to retrieve properties such as the default clock-rate
- * and get session bandwidth information.
- * </para>
- * </refsect2>
- *
- * Last reviewed on 2007-10-01 (0.10.15)
- */
-
-#include <string.h>
-
-#include "gstrtppayloads.h"
-
-/* pt, encoding_name, media, rate, params, bitrate */
-static const GstRTPPayloadInfo info[] = {
- /* static audio */
- {0, "audio", "PCMU", 8000, "1", 64000},
- /* { 1, "audio", "reserved", 0, NULL, 0 }, */
- /* { 2, "audio", "reserved", 0, NULL, 0 }, */
- {3, "audio", "GSM", 8000, "1", 0},
- {4, "audio", "G723", 8000, "1", 0},
- {5, "audio", "DVI4", 8000, "1", 32000},
- {6, "audio", "DVI4", 16000, "1", 64000},
- {7, "audio", "LPC", 8000, "1", 0},
- {8, "audio", "PCMA", 8000, "1", 64000},
- {9, "audio", "G722", 8000, "1", 64000},
- {10, "audio", "L16", 44100, "2", 1411200},
- {11, "audio", "L16", 44100, "1", 705600},
- {12, "audio", "QCELP", 8000, "1", 0},
- {13, "audio", "CN", 8000, "1", 0},
- {14, "audio", "MPA", 90000, NULL, 0},
- {15, "audio", "G728", 8000, "1", 0},
- {16, "audio", "DVI4", 11025, "1", 44100},
- {17, "audio", "DVI4", 22050, "1", 88200},
- {18, "audio", "G729", 8000, "1", 0},
- /* { 19, "audio", "reserved", 0, NULL, 0 }, */
- /* { 20, "audio", "unassigned", 0, NULL, 0 }, */
- /* { 21, "audio", "unassigned", 0, NULL, 0 }, */
- /* { 22, "audio", "unassigned", 0, NULL, 0 }, */
- /* { 23, "audio", "unassigned", 0, NULL, 0 }, */
-
- /* video and video/audio */
- /* { 24, "video", "unassigned", 0, NULL, 0 }, */
- {25, "video", "CelB", 90000, NULL, 0},
- {26, "video", "JPEG", 90000, NULL, 0},
- /* { 27, "video", "unassigned", 0, NULL, 0 }, */
- {28, "video", "nv", 90000, NULL, 0},
- /* { 29, "video", "unassigned", 0, NULL, 0 }, */
- /* { 30, "video", "unassigned", 0, NULL, 0 }, */
- {31, "video", "H261", 90000, NULL, 0},
- {32, "video", "MPV", 90000, NULL, 0},
- {33, "video", "MP2T", 90000, NULL, 0},
- {34, "video", "H263", 90000, NULL, 0},
- /* { 35-71, "unassigned", 0, 0, NULL, 0 }, */
- /* { 72-76, "reserved", 0, 0, NULL, 0 }, */
- /* { 77-95, "unassigned", 0, 0, NULL, 0 }, */
- /* { 96-127, "dynamic", 0, 0, NULL, 0 }, */
-
- /* dynamic stuff */
- {G_MAXUINT8, "application", "parityfec", 0, NULL, 0}, /* [RFC3009] */
- {G_MAXUINT8, "application", "rtx", 0, NULL, 0}, /* [RFC4588] */
- {G_MAXUINT8, "audio", "AMR", 8000, NULL, 0}, /* [RFC4867][RFC3267] */
- {G_MAXUINT8, "audio", "AMR-WB", 16000, NULL, 0}, /* [RFC4867][RFC3267] */
- {G_MAXUINT8, "audio", "DAT12", 0, NULL, 0}, /* [RFC3190] */
- {G_MAXUINT8, "audio", "dsr-es201108", 0, NULL, 0}, /* [RFC3557] */
- {G_MAXUINT8, "audio", "EVRC", 8000, "1", 0}, /* [RFC4788] */
- {G_MAXUINT8, "audio", "EVRC0", 8000, "1", 0}, /* [RFC4788] */
- {G_MAXUINT8, "audio", "EVRC1", 8000, "1", 0}, /* [RFC4788] */
- {G_MAXUINT8, "audio", "EVRCB", 8000, "1", 0}, /* [RFC4788] */
- {G_MAXUINT8, "audio", "EVRCB0", 8000, "1", 0}, /* [RFC4788] */
- {G_MAXUINT8, "audio", "EVRCB1", 8000, "1", 0}, /* [RFC4788] */
- {G_MAXUINT8, "audio", "G7221", 16000, "1", 0}, /* [RFC3047] */
- {G_MAXUINT8, "audio", "G726-16", 8000, "1", 0}, /* [RFC3551][RFC4856] */
- {G_MAXUINT8, "audio", "G726-24", 8000, "1", 0}, /* [RFC3551][RFC4856] */
- {G_MAXUINT8, "audio", "G726-32", 8000, "1", 0}, /* [RFC3551][RFC4856] */
- {G_MAXUINT8, "audio", "G726-40", 8000, "1", 0}, /* [RFC3551][RFC4856] */
- {G_MAXUINT8, "audio", "G729D", 8000, "1", 0}, /* [RFC3551][RFC4856] */
- {G_MAXUINT8, "audio", "G729E", 8000, "1", 0}, /* [RFC3551][RFC4856] */
- {G_MAXUINT8, "audio", "GSM-EFR", 8000, "1", 0}, /* [RFC3551][RFC4856] */
- {G_MAXUINT8, "audio", "L8", 0, NULL, 0}, /* [RFC3551][RFC4856] */
- {G_MAXUINT8, "audio", "RED", 0, NULL, 0}, /* [RFC2198][RFC3555] */
- {G_MAXUINT8, "audio", "rtx", 0, NULL, 0}, /* [RFC4588] */
- {G_MAXUINT8, "audio", "VDVI", 0, "1", 0}, /* [RFC3551][RFC4856] */
- {G_MAXUINT8, "audio", "L20", 0, NULL, 0}, /* [RFC3190] */
- {G_MAXUINT8, "audio", "L24", 0, NULL, 0}, /* [RFC3190] */
- {G_MAXUINT8, "audio", "MP4A-LATM", 0, NULL, 0}, /* [RFC3016] */
- {G_MAXUINT8, "audio", "mpa-robust", 90000, NULL, 0}, /* [RFC3119] */
- {G_MAXUINT8, "audio", "parityfec", 0, NULL, 0}, /* [RFC3009] */
- {G_MAXUINT8, "audio", "SMV", 8000, "1", 0}, /* [RFC3558] */
- {G_MAXUINT8, "audio", "SMV0", 8000, "1", 0}, /* [RFC3558] */
- {G_MAXUINT8, "audio", "t140c", 0, NULL, 0}, /* [RFC4351] */
- {G_MAXUINT8, "audio", "t38", 0, NULL, 0}, /* [RFC4612] */
- {G_MAXUINT8, "audio", "telephone-event", 0, NULL, 0}, /* [RFC4733] */
- {G_MAXUINT8, "audio", "tone", 0, NULL, 0}, /* [RFC4733] */
- {G_MAXUINT8, "audio", "DVI4", 0, NULL, 0}, /* [RFC4856] */
- {G_MAXUINT8, "audio", "G722", 0, NULL, 0}, /* [RFC4856] */
- {G_MAXUINT8, "audio", "G723", 0, NULL, 0}, /* [RFC4856] */
- {G_MAXUINT8, "audio", "G728", 0, NULL, 0}, /* [RFC4856] */
- {G_MAXUINT8, "audio", "G729", 0, NULL, 0}, /* [RFC4856] */
- {G_MAXUINT8, "audio", "GSM", 0, NULL, 0}, /* [RFC4856] */
- {G_MAXUINT8, "audio", "L16", 0, NULL, 0}, /* [RFC4856] */
- {G_MAXUINT8, "audio", "LPC", 0, NULL, 0}, /* [RFC4856] */
- {G_MAXUINT8, "audio", "PCMA", 0, NULL, 0}, /* [RFC4856] */
- {G_MAXUINT8, "audio", "PCMU", 0, NULL, 0}, /* [RFC4856] */
- {G_MAXUINT8, "text", "parityfec", 0, NULL, 0}, /* [RFC3009] */
- {G_MAXUINT8, "text", "red", 1000, NULL, 0}, /* [RFC4102] */
- {G_MAXUINT8, "text", "rtx", 0, NULL, 0}, /* [RFC4588] */
- {G_MAXUINT8, "text", "t140", 1000, NULL, 0}, /* [RFC4103] */
- {G_MAXUINT8, "video", "BMPEG", 90000, NULL, 0}, /* [RFC2343][RFC3555] */
- {G_MAXUINT8, "video", "BT656", 90000, NULL, 0}, /* [RFC2431][RFC3555] */
- {G_MAXUINT8, "video", "DV", 90000, NULL, 0}, /* [RFC3189] */
- {G_MAXUINT8, "video", "H263-1998", 90000, NULL, 0}, /* [RFC2429][RFC3555] */
- {G_MAXUINT8, "video", "H263-2000", 90000, NULL, 0}, /* [RFC2429][RFC3555] */
- {G_MAXUINT8, "video", "MP1S", 90000, NULL, 0}, /* [RFC2250][RFC3555] */
- {G_MAXUINT8, "video", "MP2P", 90000, NULL, 0}, /* [RFC2250][RFC3555] */
- {G_MAXUINT8, "video", "MP4V-ES", 90000, NULL, 0}, /* [RFC3016] */
- {G_MAXUINT8, "video", "parityfec", 0, NULL, 0}, /* [RFC3009] */
- {G_MAXUINT8, "video", "pointer", 90000, NULL, 0}, /* [RFC2862] */
- {G_MAXUINT8, "video", "raw", 90000, NULL, 0}, /* [RFC4175] */
- {G_MAXUINT8, "video", "rtx", 0, NULL, 0}, /* [RFC4588] */
- {G_MAXUINT8, "video", "SMPTE292M", 0, NULL, 0}, /* [RFC3497] */
- {G_MAXUINT8, "video", "vc1", 90000, NULL, 0}, /* [RFC4425] */
-
- /* not in http://www.iana.org/assignments/rtp-parameters */
- {G_MAXUINT8, "audio", "AC3", 0, NULL, 0},
- {G_MAXUINT8, "audio", "ILBC", 8000, NULL, 0},
- {G_MAXUINT8, "audio", "MPEG4-GENERIC", 0, NULL, 0},
- {G_MAXUINT8, "audio", "SPEEX", 0, NULL, 0},
-
- {G_MAXUINT8, "application", "MPEG4-GENERIC", 0, NULL, 0},
-
- {G_MAXUINT8, "video", "H264", 90000, NULL, 0},
- {G_MAXUINT8, "video", "MPEG4-GENERIC", 90000, NULL, 0},
- {G_MAXUINT8, "video", "THEORA", 0, NULL, 0},
- {G_MAXUINT8, "video", "VORBIS", 0, NULL, 0},
- {G_MAXUINT8, "video", "X-SV3V-ES", 90000, NULL, 0},
- {G_MAXUINT8, "video", "X-SORENSON-VIDEO", 90000, NULL, 0},
-
- /* real stuff */
- {G_MAXUINT8, "video", "x-pn-realvideo", 1000, NULL, 0},
- {G_MAXUINT8, "audio", "x-pn-realaudio", 1000, NULL, 0},
- {G_MAXUINT8, "application", "x-pn-realmedia", 1000, NULL, 0},
-
- /* terminator */
- {G_MAXUINT8, NULL, NULL, 0, NULL, 0}
-};
-
-/**
- * gst_rtp_payload_info_for_pt:
- * @payload_type: the payload_type to find
- *
- * Get the #GstRTPPayloadInfo for @payload_type. This function is
- * mostly used to get the default clock-rate and bandwidth for static payload
- * types specified with @payload_type.
- *
- * Returns: a #GstRTPPayloadInfo or NULL when no info could be found.
- */
-const GstRTPPayloadInfo *
-gst_rtp_payload_info_for_pt (guint8 payload_type)
-{
- const GstRTPPayloadInfo *result = NULL;
- gint i;
-
- for (i = 0; info[i].media; i++) {
- if (info[i].payload_type == payload_type) {
- result = &info[i];
- break;
- }
- }
- return result;
-}
-
-/**
- * gst_rtp_payload_info_for_name:
- * @media: the media to find
- * @encoding_name: the encoding name to find
- *
- * Get the #GstRTPPayloadInfo for @media and @encoding_name. This function is
- * mostly used to get the default clock-rate and bandwidth for dynamic payload
- * types specified with @media and @encoding name.
- *
- * The search for @encoding_name will be performed in a case insensitve way.
- *
- * Returns: a #GstRTPPayloadInfo or NULL when no info could be found.
- */
-const GstRTPPayloadInfo *
-gst_rtp_payload_info_for_name (const gchar * media, const gchar * encoding_name)
-{
- const GstRTPPayloadInfo *result = NULL;
- gint i;
-
- for (i = 0; info[i].media; i++) {
- if (strcmp (media, info[i].media) == 0
- && g_ascii_strcasecmp (encoding_name, info[i].encoding_name) == 0) {
- result = &info[i];
- break;
- }
- }
- return result;
-}
diff --git a/gst-libs/gst/rtp/gstrtppayloads.h b/gst-libs/gst/rtp/gstrtppayloads.h
deleted file mode 100644
index 3563468b..00000000
--- a/gst-libs/gst/rtp/gstrtppayloads.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_RTPPAYLOADS_H__
-#define __GST_RTPPAYLOADS_H__
-
-#include <gst/gst.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;
-};
-
-const GstRTPPayloadInfo * gst_rtp_payload_info_for_pt (guint8 payload_type);
-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/gst-libs/gst/rtsp/.gitignore b/gst-libs/gst/rtsp/.gitignore
deleted file mode 100644
index 27308e66..00000000
--- a/gst-libs/gst/rtsp/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-gstrtsp-enumtypes.c
-gstrtsp-enumtypes.h
-gstrtsp-marshal.c
-gstrtsp-marshal.h
diff --git a/gst-libs/gst/rtsp/Makefile.am b/gst-libs/gst/rtsp/Makefile.am
deleted file mode 100644
index 902c0311..00000000
--- a/gst-libs/gst/rtsp/Makefile.am
+++ /dev/null
@@ -1,95 +0,0 @@
-libgstrtspincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/rtsp
-
-libgstrtspinclude_HEADERS = gstrtspbase64.h \
- gstrtsptransport.h \
- gstrtspurl.h \
- gstrtspmessage.h \
- gstrtspconnection.h \
- gstrtspdefs.h \
- gstrtspextension.h \
- gstrtsprange.h
-
-#gstrtspextreal.h
-#gstrtspextwms.h
-
-lib_LTLIBRARIES = libgstrtsp-@GST_MAJORMINOR@.la
-
-built_sources = gstrtsp-marshal.c gstrtsp-enumtypes.c
-built_headers = gstrtsp-marshal.h gstrtsp-enumtypes.h
-
-libgstrtsp_@GST_MAJORMINOR@_la_SOURCES = gstrtspbase64.c \
- gstrtsptransport.c \
- gstrtspurl.c \
- gstrtspmessage.c \
- gstrtspconnection.c \
- gstrtspdefs.c \
- gstrtspextension.c \
- gstrtsprange.c
-
-nodist_libgstrtsp_@GST_MAJORMINOR@_la_SOURCES = $(built_sources)
-nodist_libgstrtspinclude_HEADERS = gstrtsp-enumtypes.h
-
-noinst_HEADERS = gstrtsp.h
-
-#gstrtspextwms.c
-#rtspextreal.c
-
-libgstrtsp_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
-libgstrtsp_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS) $(WIN32_LIBS) $(HSTRERROR_LIBS)
-libgstrtsp_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
-
-BUILT_SOURCES = $(built_headers) $(built_sources)
-EXTRA_DIST = gstrtsp-marshal.list
-CLEANFILES = $(BUILT_SOURCES)
-
-glib_gen_prefix = gst_rtsp
-glib_enum_define = gst_rtsp
-glib_enum_headers = gstrtspdefs.h
-glib_gen_basename = gstrtsp
-
-include $(top_srcdir)/common/gst-glib-gen.mak
-
-if HAVE_INTROSPECTION
-BUILT_GIRSOURCES = GstRtsp-@GST_MAJORMINOR@.gir
-
-gir_headers=$(patsubst %,$(srcdir)/%, $(libgstrtspinclude_HEADERS))
-gir_headers+=$(patsubst %,$(builddir)/%, $(nodist_libgstrtspinclude_HEADERS))
-gir_sources=$(patsubst %,$(srcdir)/%, $(libgstrtsp_@GST_MAJORMINOR@_la_SOURCES))
-gir_sources+=$(patsubst %,$(builddir)/%, $(nodist_libgstrtsp_@GST_MAJORMINOR@_la_SOURCES))
-gir_cincludes=$(patsubst %,--c-include='gst/audio/%',$(libgstrtspinclude_HEADERS))
-gir_cincludes+=$(patsubst %,--c-include='gst/audio/%',$(nodist_libgstrtspinclude_HEADERS))
-
-GstRtsp-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstrtsp-@GST_MAJORMINOR@.la
- PKG_CONFIG_PATH="$(PKG_CONFIG_PATH):$(top_builddir)/pkgconfig" \
- $(INTROSPECTION_SCANNER) -v --namespace GstRtsp \
- --nsversion=@GST_MAJORMINOR@ \
- --strip-prefix=Gst \
- $(gir_cincludes) \
- -I$(top_builddir)/gst-libs \
- -I$(top_srcdir)/gst-libs \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst \
- --add-include-path=$(builddir)/../sdp \
- --library=gstrtsp-0.10 \
- --include=Gst-0.10 \
- --include=GstSdp-0.10 \
- --libtool="$(top_builddir)/libtool" \
- --pkg gstreamer-0.10 \
- --pkg gstreamer-sdp-0.10 \
- --output $@ \
- $(gir_headers) \
- $(gir_sources)
-
-# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
-# install anything - we need to install inside our prefix.
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(BUILT_GIRSOURCES)
-
-typelibsdir = $(libdir)/girepository-1.0/
-
-typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
-
-%.typelib: %.gir $(INTROSPECTION_COMPILER)
- $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=$(builddir) --includedir=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst --includedir=$(builddir)/../sdp $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
-CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
-endif
diff --git a/gst-libs/gst/rtsp/gstrtsp-marshal.list b/gst-libs/gst/rtsp/gstrtsp-marshal.list
deleted file mode 100644
index 246d37e9..00000000
--- a/gst-libs/gst/rtsp/gstrtsp-marshal.list
+++ /dev/null
@@ -1 +0,0 @@
-ENUM:POINTER,POINTER
diff --git a/gst-libs/gst/rtsp/gstrtsp.h b/gst-libs/gst/rtsp/gstrtsp.h
deleted file mode 100644
index 06321961..00000000
--- a/gst-libs/gst/rtsp/gstrtsp.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __RTSP_H__
-#define __RTSP_H__
-
-#include <gst/rtsp/gstrtspdefs.h>
-#include <gst/rtsp/gstrtsp-enumtypes.h>
-
-#endif
diff --git a/gst-libs/gst/rtsp/gstrtspbase64.c b/gst-libs/gst/rtsp/gstrtspbase64.c
deleted file mode 100644
index 9aca1e05..00000000
--- a/gst-libs/gst/rtsp/gstrtspbase64.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Mike Smith <msmith@xiph.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstrtspbase64
- * @short_description: Helper functions to handle Base64
- *
- * Last reviewed on 2007-07-24 (0.10.14)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include "gstrtspbase64.h"
-
-/**
- * gst_rtsp_base64_encode:
- * @data: the binary data to encode
- * @len: the length of @data
- *
- * Encode a sequence of binary data into its Base-64 stringified representation.
- *
- * Deprecated: Use g_base64_encode()
- *
- * Returns: a newly allocated, zero-terminated Base-64 encoded string
- * representing @data.
- */
-/* This isn't efficient, but it doesn't need to be */
-#ifndef GST_REMOVE_DEPRECATED
-gchar *
-gst_rtsp_base64_encode (const gchar * data, gsize len)
-{
- return g_base64_encode ((const guchar *) data, len);
-}
-#endif
-
-/**
- * gst_rtsp_base64_decode_ip:
- * @data: the base64 encoded data
- * @len: location for output length or NULL
- *
- * Decode the base64 string pointed to by @data in-place. When @len is not #NULL
- * it will contain the length of the decoded data.
- */
-/* FIXME: Deprecate this once we depend on GLib 2.20 and
- * use g_base64_decode_inplace then.
- */
-void
-gst_rtsp_base64_decode_ip (gchar * data, gsize * len)
-{
- gint input_length, output_length, state = 0;
- guint save = 0;
-
- g_return_if_fail (data != NULL);
-
- input_length = strlen (data);
-
- g_return_if_fail (input_length > 1);
-
- output_length =
- g_base64_decode_step (data, input_length, (guchar *) data, &state, &save);
-
- if (len)
- *len = output_length;
-}
diff --git a/gst-libs/gst/rtsp/gstrtspbase64.h b/gst-libs/gst/rtsp/gstrtspbase64.h
deleted file mode 100644
index a92e9962..00000000
--- a/gst-libs/gst/rtsp/gstrtspbase64.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Mike Smith <msmith@xiph.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __BASE64_H__
-#define __BASE64_H__
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-#ifndef GST_DISABLE_DEPRECATED
-gchar *gst_rtsp_base64_encode (const gchar *data, gsize len);
-#endif
-
-void gst_rtsp_base64_decode_ip (gchar *data, gsize *len);
-
-G_END_DECLS
-
-#endif
diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c b/gst-libs/gst/rtsp/gstrtspconnection.c
deleted file mode 100644
index e501fe6c..00000000
--- a/gst-libs/gst/rtsp/gstrtspconnection.c
+++ /dev/null
@@ -1,3578 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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.
- */
-
-/**
- * SECTION:gstrtspconnection
- * @short_description: manage RTSP connections
- * @see_also: gstrtspurl
- *
- * <refsect2>
- * <para>
- * This object manages the RTSP connection to the server. It provides function
- * to receive and send bytes and messages.
- * </para>
- * </refsect2>
- *
- * Last reviewed on 2007-07-24 (0.10.14)
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-/* we include this here to get the G_OS_* defines */
-#include <glib.h>
-#include <gst/gst.h>
-
-#ifdef G_OS_WIN32
-/* ws2_32.dll has getaddrinfo and freeaddrinfo on Windows XP and later.
- * minwg32 headers check WINVER before allowing the use of these */
-#ifndef WINVER
-#define WINVER 0x0501
-#endif
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#define EINPROGRESS WSAEINPROGRESS
-#else
-#include <sys/ioctl.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <fcntl.h>
-#include <netinet/in.h>
-#endif
-
-#ifdef HAVE_FIONREAD_IN_SYS_FILIO
-#include <sys/filio.h>
-#endif
-
-#include "gstrtspconnection.h"
-#include "gstrtspbase64.h"
-
-union gst_sockaddr
-{
- struct sockaddr sa;
- struct sockaddr_in sa_in;
- struct sockaddr_in6 sa_in6;
- struct sockaddr_storage sa_stor;
-};
-
-typedef struct
-{
- gint state;
- guint save;
- guchar out[3]; /* the size must be evenly divisible by 3 */
- guint cout;
- guint coutl;
-} DecodeCtx;
-
-#ifdef MSG_NOSIGNAL
-#define SEND_FLAGS MSG_NOSIGNAL
-#else
-#define SEND_FLAGS 0
-#endif
-
-#ifdef G_OS_WIN32
-#define READ_SOCKET(fd, buf, len) recv (fd, (char *)buf, len, 0)
-#define WRITE_SOCKET(fd, buf, len) send (fd, (const char *)buf, len, SEND_FLAGS)
-#define SETSOCKOPT(sock, level, name, val, len) setsockopt (sock, level, name, (const char *)val, len)
-#define CLOSE_SOCKET(sock) closesocket (sock)
-#define ERRNO_IS_EAGAIN (WSAGetLastError () == WSAEWOULDBLOCK)
-#define ERRNO_IS_EINTR (WSAGetLastError () == WSAEINTR)
-/* According to Microsoft's connect() documentation this one returns
- * WSAEWOULDBLOCK and not WSAEINPROGRESS. */
-#define ERRNO_IS_EINPROGRESS (WSAGetLastError () == WSAEWOULDBLOCK)
-#else
-#define READ_SOCKET(fd, buf, len) read (fd, buf, len)
-#define WRITE_SOCKET(fd, buf, len) send (fd, buf, len, SEND_FLAGS)
-#define SETSOCKOPT(sock, level, name, val, len) setsockopt (sock, level, name, val, len)
-#define CLOSE_SOCKET(sock) close (sock)
-#define ERRNO_IS_EAGAIN (errno == EAGAIN)
-#define ERRNO_IS_EINTR (errno == EINTR)
-#define ERRNO_IS_EINPROGRESS (errno == EINPROGRESS)
-#endif
-
-#define ADD_POLLFD(fdset, pfd, fd) \
-G_STMT_START { \
- (pfd)->fd = fd; \
- gst_poll_add_fd (fdset, pfd); \
-} G_STMT_END
-
-#define REMOVE_POLLFD(fdset, pfd) \
-G_STMT_START { \
- if ((pfd)->fd != -1) { \
- GST_DEBUG ("remove fd %d", (pfd)->fd); \
- gst_poll_remove_fd (fdset, pfd); \
- CLOSE_SOCKET ((pfd)->fd); \
- (pfd)->fd = -1; \
- } \
-} G_STMT_END
-
-typedef enum
-{
- TUNNEL_STATE_NONE,
- TUNNEL_STATE_GET,
- TUNNEL_STATE_POST,
- TUNNEL_STATE_COMPLETE
-} GstRTSPTunnelState;
-
-#define TUNNELID_LEN 24
-
-struct _GstRTSPConnection
-{
- /*< private > */
- /* URL for the connection */
- GstRTSPUrl *url;
-
- /* connection state */
- GstPollFD fd0;
- GstPollFD fd1;
-
- GstPollFD *readfd;
- GstPollFD *writefd;
-
- gboolean manual_http;
-
- gchar tunnelid[TUNNELID_LEN];
- gboolean tunneled;
- GstRTSPTunnelState tstate;
-
- GstPoll *fdset;
- gchar *ip;
-
- gint read_ahead;
-
- gchar *initial_buffer;
- gsize initial_buffer_offset;
-
- /* Session state */
- gint cseq; /* sequence number */
- gchar session_id[512]; /* session id */
- gint timeout; /* session timeout in seconds */
- GTimer *timer; /* timeout timer */
-
- /* Authentication */
- GstRTSPAuthMethod auth_method;
- gchar *username;
- gchar *passwd;
- GHashTable *auth_params;
-
- DecodeCtx ctx;
- DecodeCtx *ctxp;
-
- gchar *proxy_host;
- guint proxy_port;
-};
-
-enum
-{
- STATE_START = 0,
- STATE_DATA_HEADER,
- STATE_DATA_BODY,
- STATE_READ_LINES,
- STATE_END,
- STATE_LAST
-};
-
-enum
-{
- READ_AHEAD_EOH = -1, /* end of headers */
- READ_AHEAD_CRLF = -2,
- READ_AHEAD_CRLFCR = -3
-};
-
-/* a structure for constructing RTSPMessages */
-typedef struct
-{
- gint state;
- GstRTSPResult status;
- guint8 buffer[4096];
- guint offset;
-
- guint line;
- guint8 *body_data;
- glong body_len;
-} GstRTSPBuilder;
-
-static void
-build_reset (GstRTSPBuilder * builder)
-{
- g_free (builder->body_data);
- memset (builder, 0, sizeof (GstRTSPBuilder));
-}
-
-/**
- * gst_rtsp_connection_create:
- * @url: a #GstRTSPUrl
- * @conn: storage for a #GstRTSPConnection
- *
- * Create a newly allocated #GstRTSPConnection from @url and store it in @conn.
- * The connection will not yet attempt to connect to @url, use
- * gst_rtsp_connection_connect().
- *
- * A copy of @url will be made.
- *
- * Returns: #GST_RTSP_OK when @conn contains a valid connection.
- */
-GstRTSPResult
-gst_rtsp_connection_create (const GstRTSPUrl * url, GstRTSPConnection ** conn)
-{
- GstRTSPConnection *newconn;
-#ifdef G_OS_WIN32
- WSADATA w;
- int error;
-#endif
-
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
-
-#ifdef G_OS_WIN32
- error = WSAStartup (0x0202, &w);
-
- if (error)
- goto startup_error;
-
- if (w.wVersion != 0x0202)
- goto version_error;
-#endif
-
- newconn = g_new0 (GstRTSPConnection, 1);
-
- if ((newconn->fdset = gst_poll_new (TRUE)) == NULL)
- goto no_fdset;
-
- newconn->url = gst_rtsp_url_copy (url);
- newconn->fd0.fd = -1;
- newconn->fd1.fd = -1;
- newconn->timer = g_timer_new ();
- newconn->timeout = 60;
- newconn->cseq = 1;
-
- newconn->auth_method = GST_RTSP_AUTH_NONE;
- newconn->username = NULL;
- newconn->passwd = NULL;
- newconn->auth_params = NULL;
-
- *conn = newconn;
-
- return GST_RTSP_OK;
-
- /* ERRORS */
-#ifdef G_OS_WIN32
-startup_error:
- {
- g_warning ("Error %d on WSAStartup", error);
- return GST_RTSP_EWSASTART;
- }
-version_error:
- {
- g_warning ("Windows sockets are not version 0x202 (current 0x%x)",
- w.wVersion);
- WSACleanup ();
- return GST_RTSP_EWSAVERSION;
- }
-#endif
-no_fdset:
- {
- g_free (newconn);
-#ifdef G_OS_WIN32
- WSACleanup ();
-#endif
- return GST_RTSP_ESYS;
- }
-}
-
-/**
- * gst_rtsp_connection_create_from_fd:
- * @fd: a file descriptor
- * @ip: the IP address of the other end
- * @port: the port used by the other end
- * @initial_buffer: data already read from @fd
- * @conn: storage for a #GstRTSPConnection
- *
- * Create a new #GstRTSPConnection for handling communication on the existing
- * file descriptor @fd. The @initial_buffer contains any data already read from
- * @fd which should be used before starting to read new data.
- *
- * Returns: #GST_RTSP_OK when @conn contains a valid connection.
- *
- * Since: 0.10.25
- */
-GstRTSPResult
-gst_rtsp_connection_create_from_fd (gint fd, const gchar * ip, guint16 port,
- const gchar * initial_buffer, GstRTSPConnection ** conn)
-{
- GstRTSPConnection *newconn = NULL;
- GstRTSPUrl *url;
-#ifdef G_OS_WIN32
- gulong flags = 1;
-#endif
- GstRTSPResult res;
-
- g_return_val_if_fail (fd >= 0, GST_RTSP_EINVAL);
- g_return_val_if_fail (ip != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
-
- /* set to non-blocking mode so that we can cancel the communication */
-#ifndef G_OS_WIN32
- fcntl (fd, F_SETFL, O_NONBLOCK);
-#else
- ioctlsocket (fd, FIONBIO, &flags);
-#endif /* G_OS_WIN32 */
-
- /* create a url for the client address */
- url = g_new0 (GstRTSPUrl, 1);
- url->host = g_strdup (ip);
- url->port = port;
-
- /* now create the connection object */
- GST_RTSP_CHECK (gst_rtsp_connection_create (url, &newconn), newconn_failed);
- gst_rtsp_url_free (url);
-
- ADD_POLLFD (newconn->fdset, &newconn->fd0, fd);
-
- /* both read and write initially */
- newconn->readfd = &newconn->fd0;
- newconn->writefd = &newconn->fd0;
-
- newconn->ip = g_strdup (ip);
-
- newconn->initial_buffer = g_strdup (initial_buffer);
-
- *conn = newconn;
-
- return GST_RTSP_OK;
-
- /* ERRORS */
-newconn_failed:
- {
- gst_rtsp_url_free (url);
- return res;
- }
-}
-
-/**
- * gst_rtsp_connection_accept:
- * @sock: a socket
- * @conn: storage for a #GstRTSPConnection
- *
- * Accept a new connection on @sock and create a new #GstRTSPConnection for
- * handling communication on new socket.
- *
- * Returns: #GST_RTSP_OK when @conn contains a valid connection.
- *
- * Since: 0.10.23
- */
-GstRTSPResult
-gst_rtsp_connection_accept (gint sock, GstRTSPConnection ** conn)
-{
- int fd;
- union gst_sockaddr sa;
- socklen_t slen = sizeof (sa);
- gchar ip[INET6_ADDRSTRLEN];
- guint16 port;
-
- g_return_val_if_fail (sock >= 0, GST_RTSP_EINVAL);
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
-
- memset (&sa, 0, slen);
-
-#ifndef G_OS_WIN32
- fd = accept (sock, &sa.sa, &slen);
-#else
- fd = accept (sock, &sa.sa, (gint *) & slen);
-#endif /* G_OS_WIN32 */
- if (fd == -1)
- goto accept_failed;
-
- if (getnameinfo (&sa.sa, slen, ip, sizeof (ip), NULL, 0, NI_NUMERICHOST) != 0)
- goto getnameinfo_failed;
-
- if (sa.sa.sa_family == AF_INET)
- port = sa.sa_in.sin_port;
- else if (sa.sa.sa_family == AF_INET6)
- port = sa.sa_in6.sin6_port;
- else
- goto wrong_family;
-
- return gst_rtsp_connection_create_from_fd (fd, ip, port, NULL, conn);
-
- /* ERRORS */
-accept_failed:
- {
- return GST_RTSP_ESYS;
- }
-getnameinfo_failed:
-wrong_family:
- {
- CLOSE_SOCKET (fd);
- return GST_RTSP_ERROR;
- }
-}
-
-static gchar *
-do_resolve (const gchar * host)
-{
- static gchar ip[INET6_ADDRSTRLEN];
- struct addrinfo *aires;
- struct addrinfo *ai;
- gint aierr;
-
- aierr = getaddrinfo (host, NULL, NULL, &aires);
- if (aierr != 0)
- goto no_addrinfo;
-
- for (ai = aires; ai; ai = ai->ai_next) {
- if (ai->ai_family == AF_INET || ai->ai_family == AF_INET6) {
- break;
- }
- }
- if (ai == NULL)
- goto no_family;
-
- aierr = getnameinfo (ai->ai_addr, ai->ai_addrlen, ip, sizeof (ip), NULL, 0,
- NI_NUMERICHOST | NI_NUMERICSERV);
- if (aierr != 0)
- goto no_address;
-
- freeaddrinfo (aires);
-
- return g_strdup (ip);
-
- /* ERRORS */
-no_addrinfo:
- {
- GST_ERROR ("no addrinfo found for %s: %s", host, gai_strerror (aierr));
- return NULL;
- }
-no_family:
- {
- GST_ERROR ("no family found for %s", host);
- freeaddrinfo (aires);
- return NULL;
- }
-no_address:
- {
- GST_ERROR ("no address found for %s: %s", host, gai_strerror (aierr));
- freeaddrinfo (aires);
- return NULL;
- }
-}
-
-static GstRTSPResult
-do_connect (const gchar * ip, guint16 port, GstPollFD * fdout,
- GstPoll * fdset, GTimeVal * timeout)
-{
- gint fd;
- struct addrinfo hints;
- struct addrinfo *aires;
- struct addrinfo *ai;
- gint aierr;
- gchar service[NI_MAXSERV];
- gint ret;
-#ifdef G_OS_WIN32
- unsigned long flags = 1;
-#endif /* G_OS_WIN32 */
- GstClockTime to;
- gint retval;
-
- memset (&hints, 0, sizeof hints);
- hints.ai_flags = AI_NUMERICHOST;
- hints.ai_family = AF_UNSPEC;
- hints.ai_socktype = SOCK_STREAM;
- g_snprintf (service, sizeof (service) - 1, "%hu", port);
- service[sizeof (service) - 1] = '\0';
-
- aierr = getaddrinfo (ip, service, &hints, &aires);
- if (aierr != 0)
- goto no_addrinfo;
-
- for (ai = aires; ai; ai = ai->ai_next) {
- if (ai->ai_family == AF_INET || ai->ai_family == AF_INET6) {
- break;
- }
- }
- if (ai == NULL)
- goto no_family;
-
- fd = socket (ai->ai_family, SOCK_STREAM, 0);
- if (fd == -1)
- goto no_socket;
-
- /* set to non-blocking mode so that we can cancel the connect */
-#ifndef G_OS_WIN32
- fcntl (fd, F_SETFL, O_NONBLOCK);
-#else
- ioctlsocket (fd, FIONBIO, &flags);
-#endif /* G_OS_WIN32 */
-
- /* add the socket to our fdset */
- ADD_POLLFD (fdset, fdout, fd);
-
- /* we are going to connect ASYNC now */
- ret = connect (fd, ai->ai_addr, ai->ai_addrlen);
- if (ret == 0)
- goto done;
- if (!ERRNO_IS_EINPROGRESS)
- goto sys_error;
-
- /* wait for connect to complete up to the specified timeout or until we got
- * interrupted. */
- gst_poll_fd_ctl_write (fdset, fdout, TRUE);
-
- to = timeout ? GST_TIMEVAL_TO_TIME (*timeout) : GST_CLOCK_TIME_NONE;
-
- do {
- retval = gst_poll_wait (fdset, to);
- } while (retval == -1 && (errno == EINTR || errno == EAGAIN));
-
- if (retval == 0)
- goto timeout;
- else if (retval == -1)
- goto sys_error;
-
- /* we can still have an error connecting on windows */
- if (gst_poll_fd_has_error (fdset, fdout)) {
- socklen_t len = sizeof (errno);
-#ifndef G_OS_WIN32
- getsockopt (fd, SOL_SOCKET, SO_ERROR, &errno, &len);
-#else
- getsockopt (fd, SOL_SOCKET, SO_ERROR, (char *) &errno, &len);
-#endif
- goto sys_error;
- }
-
- gst_poll_fd_ignored (fdset, fdout);
-
-done:
- freeaddrinfo (aires);
-
- return GST_RTSP_OK;
-
- /* ERRORS */
-no_addrinfo:
- {
- GST_ERROR ("no addrinfo found for %s: %s", ip, gai_strerror (aierr));
- return GST_RTSP_ERROR;
- }
-no_family:
- {
- GST_ERROR ("no family found for %s", ip);
- freeaddrinfo (aires);
- return GST_RTSP_ERROR;
- }
-no_socket:
- {
- GST_ERROR ("no socket %d (%s)", errno, g_strerror (errno));
- freeaddrinfo (aires);
- return GST_RTSP_ESYS;
- }
-sys_error:
- {
- GST_ERROR ("system error %d (%s)", errno, g_strerror (errno));
- REMOVE_POLLFD (fdset, fdout);
- freeaddrinfo (aires);
- return GST_RTSP_ESYS;
- }
-timeout:
- {
- GST_ERROR ("timeout");
- REMOVE_POLLFD (fdset, fdout);
- freeaddrinfo (aires);
- return GST_RTSP_ETIMEOUT;
- }
-}
-
-static GstRTSPResult
-setup_tunneling (GstRTSPConnection * conn, GTimeVal * timeout)
-{
- gint i;
- GstRTSPResult res;
- gchar *ip;
- gchar *uri;
- gchar *value;
- guint16 port, url_port;
- GstRTSPUrl *url;
- gchar *hostparam;
- GstRTSPMessage *msg;
- GstRTSPMessage response;
- gboolean old_http;
-
- memset (&response, 0, sizeof (response));
- gst_rtsp_message_init (&response);
-
- /* create a random sessionid */
- for (i = 0; i < TUNNELID_LEN; i++)
- conn->tunnelid[i] = g_random_int_range ('a', 'z');
- conn->tunnelid[TUNNELID_LEN - 1] = '\0';
-
- url = conn->url;
- /* get the port from the url */
- gst_rtsp_url_get_port (url, &url_port);
-
- if (conn->proxy_host) {
- uri = g_strdup_printf ("http://%s:%d%s%s%s", url->host, url_port,
- url->abspath, url->query ? "?" : "", url->query ? url->query : "");
- hostparam = g_strdup_printf ("%s:%d", url->host, url_port);
- ip = conn->proxy_host;
- port = conn->proxy_port;
- } else {
- uri = g_strdup_printf ("%s%s%s", url->abspath, url->query ? "?" : "",
- url->query ? url->query : "");
- hostparam = NULL;
- ip = conn->ip;
- port = url_port;
- }
-
- /* create the GET request for the read connection */
- GST_RTSP_CHECK (gst_rtsp_message_new_request (&msg, GST_RTSP_GET, uri),
- no_message);
- msg->type = GST_RTSP_MESSAGE_HTTP_REQUEST;
-
- if (hostparam != NULL)
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_HOST, hostparam);
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_X_SESSIONCOOKIE,
- conn->tunnelid);
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_ACCEPT,
- "application/x-rtsp-tunnelled");
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_CACHE_CONTROL, "no-cache");
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_PRAGMA, "no-cache");
-
- /* we start by writing to this fd */
- conn->writefd = &conn->fd0;
-
- /* we need to temporarily set conn->tunneled to FALSE to prevent the HTTP
- * request from being base64 encoded */
- conn->tunneled = FALSE;
- GST_RTSP_CHECK (gst_rtsp_connection_send (conn, msg, timeout), write_failed);
- gst_rtsp_message_free (msg);
- conn->tunneled = TRUE;
-
- /* receive the response to the GET request */
- /* we need to temporarily set manual_http to TRUE since
- * gst_rtsp_connection_receive() will treat the HTTP response as a parsing
- * failure otherwise */
- old_http = conn->manual_http;
- conn->manual_http = TRUE;
- GST_RTSP_CHECK (gst_rtsp_connection_receive (conn, &response, timeout),
- read_failed);
- conn->manual_http = old_http;
-
- if (response.type != GST_RTSP_MESSAGE_HTTP_RESPONSE ||
- response.type_data.response.code != GST_RTSP_STS_OK)
- goto wrong_result;
-
- if (gst_rtsp_message_get_header (&response, GST_RTSP_HDR_X_SERVER_IP_ADDRESS,
- &value, 0) != GST_RTSP_OK) {
- if (conn->proxy_host) {
- /* if we use a proxy we need to change the destination url */
- g_free (url->host);
- url->host = g_strdup (value);
- g_free (hostparam);
- hostparam = g_strdup_printf ("%s:%d", url->host, url_port);
- } else {
- /* and resolve the new ip address */
- if (!(ip = do_resolve (conn->ip)))
- goto not_resolved;
- g_free (conn->ip);
- conn->ip = ip;
- }
- }
-
- /* connect to the host/port */
- res = do_connect (ip, port, &conn->fd1, conn->fdset, timeout);
- if (res != GST_RTSP_OK)
- goto connect_failed;
-
- /* this is now our writing socket */
- conn->writefd = &conn->fd1;
-
- /* create the POST request for the write connection */
- GST_RTSP_CHECK (gst_rtsp_message_new_request (&msg, GST_RTSP_POST, uri),
- no_message);
- msg->type = GST_RTSP_MESSAGE_HTTP_REQUEST;
-
- if (hostparam != NULL)
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_HOST, hostparam);
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_X_SESSIONCOOKIE,
- conn->tunnelid);
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_ACCEPT,
- "application/x-rtsp-tunnelled");
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_CACHE_CONTROL, "no-cache");
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_PRAGMA, "no-cache");
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_EXPIRES,
- "Sun, 9 Jan 1972 00:00:00 GMT");
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_CONTENT_LENGTH, "32767");
-
- /* we need to temporarily set conn->tunneled to FALSE to prevent the HTTP
- * request from being base64 encoded */
- conn->tunneled = FALSE;
- GST_RTSP_CHECK (gst_rtsp_connection_send (conn, msg, timeout), write_failed);
- gst_rtsp_message_free (msg);
- conn->tunneled = TRUE;
-
-exit:
- gst_rtsp_message_unset (&response);
- g_free (hostparam);
- g_free (uri);
-
- return res;
-
- /* ERRORS */
-no_message:
- {
- GST_ERROR ("failed to create request (%d)", res);
- goto exit;
- }
-write_failed:
- {
- GST_ERROR ("write failed (%d)", res);
- gst_rtsp_message_free (msg);
- conn->tunneled = TRUE;
- goto exit;
- }
-read_failed:
- {
- GST_ERROR ("read failed (%d)", res);
- conn->manual_http = FALSE;
- goto exit;
- }
-wrong_result:
- {
- GST_ERROR ("got failure response %d %s", response.type_data.response.code,
- response.type_data.response.reason);
- res = GST_RTSP_ERROR;
- goto exit;
- }
-not_resolved:
- {
- GST_ERROR ("could not resolve %s", conn->ip);
- res = GST_RTSP_ENET;
- goto exit;
- }
-connect_failed:
- {
- GST_ERROR ("failed to connect");
- goto exit;
- }
-}
-
-/**
- * gst_rtsp_connection_connect:
- * @conn: a #GstRTSPConnection
- * @timeout: a #GTimeVal timeout
- *
- * Attempt to connect to the url of @conn made with
- * gst_rtsp_connection_create(). If @timeout is #NULL this function can block
- * forever. If @timeout contains a valid timeout, this function will return
- * #GST_RTSP_ETIMEOUT after the timeout expired.
- *
- * This function can be cancelled with gst_rtsp_connection_flush().
- *
- * Returns: #GST_RTSP_OK when a connection could be made.
- */
-GstRTSPResult
-gst_rtsp_connection_connect (GstRTSPConnection * conn, GTimeVal * timeout)
-{
- GstRTSPResult res;
- gchar *ip;
- guint16 port;
- GstRTSPUrl *url;
-
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (conn->url != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (conn->fd0.fd < 0, GST_RTSP_EINVAL);
-
- url = conn->url;
-
- if (conn->proxy_host && conn->tunneled) {
- if (!(ip = do_resolve (conn->proxy_host))) {
- GST_ERROR ("could not resolve %s", conn->proxy_host);
- goto not_resolved;
- }
- port = conn->proxy_port;
- g_free (conn->proxy_host);
- conn->proxy_host = ip;
- } else {
- if (!(ip = do_resolve (url->host))) {
- GST_ERROR ("could not resolve %s", url->host);
- goto not_resolved;
- }
- /* get the port from the url */
- gst_rtsp_url_get_port (url, &port);
-
- g_free (conn->ip);
- conn->ip = ip;
- }
-
- /* connect to the host/port */
- res = do_connect (ip, port, &conn->fd0, conn->fdset, timeout);
- if (res != GST_RTSP_OK)
- goto connect_failed;
-
- /* this is our read URL */
- conn->readfd = &conn->fd0;
-
- if (conn->tunneled) {
- res = setup_tunneling (conn, timeout);
- if (res != GST_RTSP_OK)
- goto tunneling_failed;
- } else {
- conn->writefd = &conn->fd0;
- }
-
- return GST_RTSP_OK;
-
-not_resolved:
- {
- return GST_RTSP_ENET;
- }
-connect_failed:
- {
- GST_ERROR ("failed to connect");
- return res;
- }
-tunneling_failed:
- {
- GST_ERROR ("failed to setup tunneling");
- return res;
- }
-}
-
-static void
-auth_digest_compute_hex_urp (const gchar * username,
- const gchar * realm, const gchar * password, gchar hex_urp[33])
-{
- GChecksum *md5_context = g_checksum_new (G_CHECKSUM_MD5);
- const gchar *digest_string;
-
- g_checksum_update (md5_context, (const guchar *) username, strlen (username));
- g_checksum_update (md5_context, (const guchar *) ":", 1);
- g_checksum_update (md5_context, (const guchar *) realm, strlen (realm));
- g_checksum_update (md5_context, (const guchar *) ":", 1);
- g_checksum_update (md5_context, (const guchar *) password, strlen (password));
- digest_string = g_checksum_get_string (md5_context);
-
- memset (hex_urp, 0, 33);
- memcpy (hex_urp, digest_string, strlen (digest_string));
-
- g_checksum_free (md5_context);
-}
-
-static void
-auth_digest_compute_response (const gchar * method,
- const gchar * uri, const gchar * hex_a1, const gchar * nonce,
- gchar response[33])
-{
- char hex_a2[33] = { 0, };
- GChecksum *md5_context = g_checksum_new (G_CHECKSUM_MD5);
- const gchar *digest_string;
-
- /* compute A2 */
- g_checksum_update (md5_context, (const guchar *) method, strlen (method));
- g_checksum_update (md5_context, (const guchar *) ":", 1);
- g_checksum_update (md5_context, (const guchar *) uri, strlen (uri));
- digest_string = g_checksum_get_string (md5_context);
- memcpy (hex_a2, digest_string, strlen (digest_string));
-
- /* compute KD */
- g_checksum_reset (md5_context);
- g_checksum_update (md5_context, (const guchar *) hex_a1, strlen (hex_a1));
- g_checksum_update (md5_context, (const guchar *) ":", 1);
- g_checksum_update (md5_context, (const guchar *) nonce, strlen (nonce));
- g_checksum_update (md5_context, (const guchar *) ":", 1);
-
- g_checksum_update (md5_context, (const guchar *) hex_a2, 32);
- digest_string = g_checksum_get_string (md5_context);
- memset (response, 0, 33);
- memcpy (response, digest_string, strlen (digest_string));
-
- g_checksum_free (md5_context);
-}
-
-static void
-add_auth_header (GstRTSPConnection * conn, GstRTSPMessage * message)
-{
- switch (conn->auth_method) {
- case GST_RTSP_AUTH_BASIC:{
- gchar *user_pass;
- gchar *user_pass64;
- gchar *auth_string;
-
- if (conn->username == NULL || conn->passwd == NULL)
- break;
-
- user_pass = g_strdup_printf ("%s:%s", conn->username, conn->passwd);
- user_pass64 = g_base64_encode ((guchar *) user_pass, strlen (user_pass));
- auth_string = g_strdup_printf ("Basic %s", user_pass64);
-
- gst_rtsp_message_take_header (message, GST_RTSP_HDR_AUTHORIZATION,
- auth_string);
-
- g_free (user_pass);
- g_free (user_pass64);
- break;
- }
- case GST_RTSP_AUTH_DIGEST:{
- gchar response[33], hex_urp[33];
- gchar *auth_string, *auth_string2;
- gchar *realm;
- gchar *nonce;
- gchar *opaque;
- const gchar *uri;
- const gchar *method;
-
- /* we need to have some params set */
- if (conn->auth_params == NULL || conn->username == NULL ||
- conn->passwd == NULL)
- break;
-
- /* we need the realm and nonce */
- realm = (gchar *) g_hash_table_lookup (conn->auth_params, "realm");
- nonce = (gchar *) g_hash_table_lookup (conn->auth_params, "nonce");
- if (realm == NULL || nonce == NULL)
- break;
-
- auth_digest_compute_hex_urp (conn->username, realm, conn->passwd,
- hex_urp);
-
- method = gst_rtsp_method_as_text (message->type_data.request.method);
- uri = message->type_data.request.uri;
-
- /* Assume no qop, algorithm=md5, stale=false */
- /* For algorithm MD5, a1 = urp. */
- auth_digest_compute_response (method, uri, hex_urp, nonce, response);
- auth_string = g_strdup_printf ("Digest username=\"%s\", "
- "realm=\"%s\", nonce=\"%s\", uri=\"%s\", response=\"%s\"",
- conn->username, realm, nonce, uri, response);
-
- opaque = (gchar *) g_hash_table_lookup (conn->auth_params, "opaque");
- if (opaque) {
- auth_string2 = g_strdup_printf ("%s, opaque=\"%s\"", auth_string,
- opaque);
- g_free (auth_string);
- auth_string = auth_string2;
- }
- gst_rtsp_message_take_header (message, GST_RTSP_HDR_AUTHORIZATION,
- auth_string);
- break;
- }
- default:
- /* Nothing to do */
- break;
- }
-}
-
-static void
-gen_date_string (gchar * date_string, guint len)
-{
- GTimeVal tv;
- time_t t;
-#ifdef HAVE_GMTIME_R
- struct tm tm_;
-#endif
-
- g_get_current_time (&tv);
- t = (time_t) tv.tv_sec;
-
-#ifdef HAVE_GMTIME_R
- strftime (date_string, len, "%a, %d %b %Y %H:%M:%S GMT", gmtime_r (&t, &tm_));
-#else
- strftime (date_string, len, "%a, %d %b %Y %H:%M:%S GMT", gmtime (&t));
-#endif
-}
-
-static GstRTSPResult
-write_bytes (gint fd, const guint8 * buffer, guint * idx, guint size)
-{
- guint left;
-
- if (G_UNLIKELY (*idx > size))
- return GST_RTSP_ERROR;
-
- left = size - *idx;
-
- while (left) {
- gint r;
-
- r = WRITE_SOCKET (fd, &buffer[*idx], left);
- if (G_UNLIKELY (r == 0)) {
- return GST_RTSP_EINTR;
- } else if (G_UNLIKELY (r < 0)) {
- if (ERRNO_IS_EAGAIN)
- return GST_RTSP_EINTR;
- if (!ERRNO_IS_EINTR)
- return GST_RTSP_ESYS;
- } else {
- left -= r;
- *idx += r;
- }
- }
- return GST_RTSP_OK;
-}
-
-static gint
-fill_raw_bytes (GstRTSPConnection * conn, guint8 * buffer, guint size)
-{
- gint out = 0;
-
- if (G_UNLIKELY (conn->initial_buffer != NULL)) {
- gsize left = strlen (&conn->initial_buffer[conn->initial_buffer_offset]);
-
- out = MIN (left, size);
- memcpy (buffer, &conn->initial_buffer[conn->initial_buffer_offset], out);
-
- if (left == (gsize) out) {
- g_free (conn->initial_buffer);
- conn->initial_buffer = NULL;
- conn->initial_buffer_offset = 0;
- } else
- conn->initial_buffer_offset += out;
- }
-
- if (G_LIKELY (size > (guint) out)) {
- gint r;
-
- r = READ_SOCKET (conn->readfd->fd, &buffer[out], size - out);
- if (r <= 0) {
- if (out == 0)
- out = r;
- } else
- out += r;
- }
-
- return out;
-}
-
-static gint
-fill_bytes (GstRTSPConnection * conn, guint8 * buffer, guint size)
-{
- DecodeCtx *ctx = conn->ctxp;
- gint out = 0;
-
- if (ctx) {
- while (size > 0) {
- guint8 in[sizeof (ctx->out) * 4 / 3];
- gint r;
-
- while (size > 0 && ctx->cout < ctx->coutl) {
- /* we have some leftover bytes */
- *buffer++ = ctx->out[ctx->cout++];
- size--;
- out++;
- }
-
- /* got what we needed? */
- if (size == 0)
- break;
-
- /* try to read more bytes */
- r = fill_raw_bytes (conn, in, sizeof (in));
- if (r <= 0) {
- if (out == 0)
- out = r;
- break;
- }
-
- ctx->cout = 0;
- ctx->coutl =
- g_base64_decode_step ((gchar *) in, r, ctx->out, &ctx->state,
- &ctx->save);
- }
- } else {
- out = fill_raw_bytes (conn, buffer, size);
- }
-
- return out;
-}
-
-static GstRTSPResult
-read_bytes (GstRTSPConnection * conn, guint8 * buffer, guint * idx, guint size)
-{
- guint left;
-
- if (G_UNLIKELY (*idx > size))
- return GST_RTSP_ERROR;
-
- left = size - *idx;
-
- while (left) {
- gint r;
-
- r = fill_bytes (conn, &buffer[*idx], left);
- if (G_UNLIKELY (r == 0)) {
- return GST_RTSP_EEOF;
- } else if (G_UNLIKELY (r < 0)) {
- if (ERRNO_IS_EAGAIN)
- return GST_RTSP_EINTR;
- if (!ERRNO_IS_EINTR)
- return GST_RTSP_ESYS;
- } else {
- left -= r;
- *idx += r;
- }
- }
- return GST_RTSP_OK;
-}
-
-/* The code below tries to handle clients using \r, \n or \r\n to indicate the
- * end of a line. It even does its best to handle clients which mix them (even
- * though this is a really stupid idea (tm).) It also handles Line White Space
- * (LWS), where a line end followed by whitespace is considered LWS. This is
- * the method used in RTSP (and HTTP) to break long lines.
- */
-static GstRTSPResult
-read_line (GstRTSPConnection * conn, guint8 * buffer, guint * idx, guint size)
-{
- while (TRUE) {
- guint8 c;
- gint r;
-
- if (conn->read_ahead == READ_AHEAD_EOH) {
- /* the last call to read_line() already determined that we have reached
- * the end of the headers, so convey that information now */
- conn->read_ahead = 0;
- break;
- } else if (conn->read_ahead == READ_AHEAD_CRLF) {
- /* the last call to read_line() left off after having read \r\n */
- c = '\n';
- } else if (conn->read_ahead == READ_AHEAD_CRLFCR) {
- /* the last call to read_line() left off after having read \r\n\r */
- c = '\r';
- } else if (conn->read_ahead != 0) {
- /* the last call to read_line() left us with a character to start with */
- c = (guint8) conn->read_ahead;
- conn->read_ahead = 0;
- } else {
- /* read the next character */
- r = fill_bytes (conn, &c, 1);
- if (G_UNLIKELY (r == 0)) {
- return GST_RTSP_EEOF;
- } else if (G_UNLIKELY (r < 0)) {
- if (ERRNO_IS_EAGAIN)
- return GST_RTSP_EINTR;
- if (!ERRNO_IS_EINTR)
- return GST_RTSP_ESYS;
- continue;
- }
- }
-
- /* special treatment of line endings */
- if (c == '\r' || c == '\n') {
- guint8 read_ahead;
-
- retry:
- /* need to read ahead one more character to know what to do... */
- r = fill_bytes (conn, &read_ahead, 1);
- if (G_UNLIKELY (r == 0)) {
- return GST_RTSP_EEOF;
- } else if (G_UNLIKELY (r < 0)) {
- if (ERRNO_IS_EAGAIN) {
- /* remember the original character we read and try again next time */
- if (conn->read_ahead == 0)
- conn->read_ahead = c;
- return GST_RTSP_EINTR;
- }
- if (!ERRNO_IS_EINTR)
- return GST_RTSP_ESYS;
- goto retry;
- }
-
- if (read_ahead == ' ' || read_ahead == '\t') {
- if (conn->read_ahead == READ_AHEAD_CRLFCR) {
- /* got \r\n\r followed by whitespace, treat it as a normal line
- * followed by one starting with LWS */
- conn->read_ahead = read_ahead;
- break;
- } else {
- /* got LWS, change the line ending to a space and continue */
- c = ' ';
- conn->read_ahead = read_ahead;
- }
- } else if (conn->read_ahead == READ_AHEAD_CRLFCR) {
- if (read_ahead == '\r' || read_ahead == '\n') {
- /* got \r\n\r\r or \r\n\r\n, treat it as the end of the headers */
- conn->read_ahead = READ_AHEAD_EOH;
- break;
- } else {
- /* got \r\n\r followed by something else, this is not really
- * supported since we have probably just eaten the first character
- * of the body or the next message, so just ignore the second \r
- * and live with it... */
- conn->read_ahead = read_ahead;
- break;
- }
- } else if (conn->read_ahead == READ_AHEAD_CRLF) {
- if (read_ahead == '\r') {
- /* got \r\n\r so far, need one more character... */
- conn->read_ahead = READ_AHEAD_CRLFCR;
- goto retry;
- } else if (read_ahead == '\n') {
- /* got \r\n\n, treat it as the end of the headers */
- conn->read_ahead = READ_AHEAD_EOH;
- break;
- } else {
- /* found the end of a line, keep read_ahead for the next line */
- conn->read_ahead = read_ahead;
- break;
- }
- } else if (c == read_ahead) {
- /* got double \r or \n, treat it as the end of the headers */
- conn->read_ahead = READ_AHEAD_EOH;
- break;
- } else if (c == '\r' && read_ahead == '\n') {
- /* got \r\n so far, still need more to know what to do... */
- conn->read_ahead = READ_AHEAD_CRLF;
- goto retry;
- } else {
- /* found the end of a line, keep read_ahead for the next line */
- conn->read_ahead = read_ahead;
- break;
- }
- }
-
- if (G_LIKELY (*idx < size - 1))
- buffer[(*idx)++] = c;
- }
- buffer[*idx] = '\0';
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_connection_write:
- * @conn: a #GstRTSPConnection
- * @data: the data to write
- * @size: the size of @data
- * @timeout: a timeout value or #NULL
- *
- * Attempt to write @size bytes of @data to the connected @conn, blocking up to
- * the specified @timeout. @timeout can be #NULL, in which case this function
- * might block forever.
- *
- * This function can be cancelled with gst_rtsp_connection_flush().
- *
- * Returns: #GST_RTSP_OK on success.
- */
-GstRTSPResult
-gst_rtsp_connection_write (GstRTSPConnection * conn, const guint8 * data,
- guint size, GTimeVal * timeout)
-{
- guint offset;
- gint retval;
- GstClockTime to;
- GstRTSPResult res;
-
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (data != NULL || size == 0, GST_RTSP_EINVAL);
- g_return_val_if_fail (conn->writefd != NULL, GST_RTSP_EINVAL);
-
- gst_poll_set_controllable (conn->fdset, TRUE);
- gst_poll_fd_ctl_write (conn->fdset, conn->writefd, TRUE);
- gst_poll_fd_ctl_read (conn->fdset, conn->readfd, FALSE);
- /* clear all previous poll results */
- gst_poll_fd_ignored (conn->fdset, conn->writefd);
- gst_poll_fd_ignored (conn->fdset, conn->readfd);
-
- to = timeout ? GST_TIMEVAL_TO_TIME (*timeout) : GST_CLOCK_TIME_NONE;
-
- offset = 0;
-
- while (TRUE) {
- /* try to write */
- res = write_bytes (conn->writefd->fd, data, &offset, size);
- if (G_LIKELY (res == GST_RTSP_OK))
- break;
- if (G_UNLIKELY (res != GST_RTSP_EINTR))
- goto write_error;
-
- /* not all is written, wait until we can write more */
- do {
- retval = gst_poll_wait (conn->fdset, to);
- } while (retval == -1 && (errno == EINTR || errno == EAGAIN));
-
- if (G_UNLIKELY (retval == 0))
- goto timeout;
-
- if (G_UNLIKELY (retval == -1)) {
- if (errno == EBUSY)
- goto stopped;
- else
- goto select_error;
- }
-
- /* could also be an error with read socket */
- if (gst_poll_fd_has_error (conn->fdset, conn->readfd))
- goto socket_error;
- }
- return GST_RTSP_OK;
-
- /* ERRORS */
-timeout:
- {
- return GST_RTSP_ETIMEOUT;
- }
-select_error:
- {
- return GST_RTSP_ESYS;
- }
-stopped:
- {
- return GST_RTSP_EINTR;
- }
-socket_error:
- {
- return GST_RTSP_ENET;
- }
-write_error:
- {
- return res;
- }
-}
-
-static GString *
-message_to_string (GstRTSPConnection * conn, GstRTSPMessage * message)
-{
- GString *str = NULL;
-
- str = g_string_new ("");
-
- switch (message->type) {
- case GST_RTSP_MESSAGE_REQUEST:
- /* create request string, add CSeq */
- g_string_append_printf (str, "%s %s RTSP/1.0\r\n"
- "CSeq: %d\r\n",
- gst_rtsp_method_as_text (message->type_data.request.method),
- message->type_data.request.uri, conn->cseq++);
- /* add session id if we have one */
- if (conn->session_id[0] != '\0') {
- gst_rtsp_message_remove_header (message, GST_RTSP_HDR_SESSION, -1);
- gst_rtsp_message_add_header (message, GST_RTSP_HDR_SESSION,
- conn->session_id);
- }
- /* add any authentication headers */
- add_auth_header (conn, message);
- break;
- case GST_RTSP_MESSAGE_RESPONSE:
- /* create response string */
- g_string_append_printf (str, "RTSP/1.0 %d %s\r\n",
- message->type_data.response.code, message->type_data.response.reason);
- break;
- case GST_RTSP_MESSAGE_HTTP_REQUEST:
- /* create request string */
- g_string_append_printf (str, "%s %s HTTP/%s\r\n",
- gst_rtsp_method_as_text (message->type_data.request.method),
- message->type_data.request.uri,
- gst_rtsp_version_as_text (message->type_data.request.version));
- /* add any authentication headers */
- add_auth_header (conn, message);
- break;
- case GST_RTSP_MESSAGE_HTTP_RESPONSE:
- /* create response string */
- g_string_append_printf (str, "HTTP/%s %d %s\r\n",
- gst_rtsp_version_as_text (message->type_data.request.version),
- message->type_data.response.code, message->type_data.response.reason);
- break;
- case GST_RTSP_MESSAGE_DATA:
- {
- guint8 data_header[4];
-
- /* prepare data header */
- data_header[0] = '$';
- data_header[1] = message->type_data.data.channel;
- data_header[2] = (message->body_size >> 8) & 0xff;
- data_header[3] = message->body_size & 0xff;
-
- /* create string with header and data */
- str = g_string_append_len (str, (gchar *) data_header, 4);
- str =
- g_string_append_len (str, (gchar *) message->body,
- message->body_size);
- break;
- }
- default:
- g_string_free (str, TRUE);
- g_return_val_if_reached (NULL);
- break;
- }
-
- /* append headers and body */
- if (message->type != GST_RTSP_MESSAGE_DATA) {
- gchar date_string[100];
-
- gen_date_string (date_string, sizeof (date_string));
-
- /* add date header */
- gst_rtsp_message_remove_header (message, GST_RTSP_HDR_DATE, -1);
- gst_rtsp_message_add_header (message, GST_RTSP_HDR_DATE, date_string);
-
- /* append headers */
- gst_rtsp_message_append_headers (message, str);
-
- /* append Content-Length and body if needed */
- if (message->body != NULL && message->body_size > 0) {
- gchar *len;
-
- len = g_strdup_printf ("%d", message->body_size);
- g_string_append_printf (str, "%s: %s\r\n",
- gst_rtsp_header_as_text (GST_RTSP_HDR_CONTENT_LENGTH), len);
- g_free (len);
- /* header ends here */
- g_string_append (str, "\r\n");
- str =
- g_string_append_len (str, (gchar *) message->body,
- message->body_size);
- } else {
- /* just end headers */
- g_string_append (str, "\r\n");
- }
- }
-
- return str;
-}
-
-/**
- * gst_rtsp_connection_send:
- * @conn: a #GstRTSPConnection
- * @message: the message to send
- * @timeout: a timeout value or #NULL
- *
- * Attempt to send @message to the connected @conn, blocking up to
- * the specified @timeout. @timeout can be #NULL, in which case this function
- * might block forever.
- *
- * This function can be cancelled with gst_rtsp_connection_flush().
- *
- * Returns: #GST_RTSP_OK on success.
- */
-GstRTSPResult
-gst_rtsp_connection_send (GstRTSPConnection * conn, GstRTSPMessage * message,
- GTimeVal * timeout)
-{
- GString *string = NULL;
- GstRTSPResult res;
- gchar *str;
- gsize len;
-
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (message != NULL, GST_RTSP_EINVAL);
-
- if (G_UNLIKELY (!(string = message_to_string (conn, message))))
- goto no_message;
-
- if (conn->tunneled) {
- str = g_base64_encode ((const guchar *) string->str, string->len);
- g_string_free (string, TRUE);
- len = strlen (str);
- } else {
- str = string->str;
- len = string->len;
- g_string_free (string, FALSE);
- }
-
- /* write request */
- res = gst_rtsp_connection_write (conn, (guint8 *) str, len, timeout);
-
- g_free (str);
-
- return res;
-
-no_message:
- {
- g_warning ("Wrong message");
- return GST_RTSP_EINVAL;
- }
-}
-
-static GstRTSPResult
-parse_string (gchar * dest, gint size, gchar ** src)
-{
- GstRTSPResult res = GST_RTSP_OK;
- gint idx;
-
- idx = 0;
- /* skip spaces */
- while (g_ascii_isspace (**src))
- (*src)++;
-
- while (!g_ascii_isspace (**src) && **src != '\0') {
- if (idx < size - 1)
- dest[idx++] = **src;
- else
- res = GST_RTSP_EPARSE;
- (*src)++;
- }
- if (size > 0)
- dest[idx] = '\0';
-
- return res;
-}
-
-static GstRTSPResult
-parse_protocol_version (gchar * protocol, GstRTSPMsgType * type,
- GstRTSPVersion * version)
-{
- GstRTSPResult res = GST_RTSP_OK;
- gchar *ver;
-
- if (G_LIKELY ((ver = strchr (protocol, '/')) != NULL)) {
- guint major;
- guint minor;
- gchar dummychar;
-
- *ver++ = '\0';
-
- /* the version number must be formatted as X.Y with nothing following */
- if (sscanf (ver, "%u.%u%c", &major, &minor, &dummychar) != 2)
- res = GST_RTSP_EPARSE;
-
- if (g_ascii_strcasecmp (protocol, "RTSP") == 0) {
- if (major != 1 || minor != 0) {
- *version = GST_RTSP_VERSION_INVALID;
- res = GST_RTSP_ERROR;
- }
- } else if (g_ascii_strcasecmp (protocol, "HTTP") == 0) {
- if (*type == GST_RTSP_MESSAGE_REQUEST)
- *type = GST_RTSP_MESSAGE_HTTP_REQUEST;
- else if (*type == GST_RTSP_MESSAGE_RESPONSE)
- *type = GST_RTSP_MESSAGE_HTTP_RESPONSE;
-
- if (major == 1 && minor == 1) {
- *version = GST_RTSP_VERSION_1_1;
- } else if (major != 1 || minor != 0) {
- *version = GST_RTSP_VERSION_INVALID;
- res = GST_RTSP_ERROR;
- }
- } else
- res = GST_RTSP_EPARSE;
- } else
- res = GST_RTSP_EPARSE;
-
- return res;
-}
-
-static GstRTSPResult
-parse_response_status (guint8 * buffer, GstRTSPMessage * msg)
-{
- GstRTSPResult res = GST_RTSP_OK;
- GstRTSPResult res2;
- gchar versionstr[20];
- gchar codestr[4];
- gint code;
- gchar *bptr;
-
- bptr = (gchar *) buffer;
-
- if (parse_string (versionstr, sizeof (versionstr), &bptr) != GST_RTSP_OK)
- res = GST_RTSP_EPARSE;
-
- if (parse_string (codestr, sizeof (codestr), &bptr) != GST_RTSP_OK)
- res = GST_RTSP_EPARSE;
- code = atoi (codestr);
- if (G_UNLIKELY (*codestr == '\0' || code < 0 || code >= 600))
- res = GST_RTSP_EPARSE;
-
- while (g_ascii_isspace (*bptr))
- bptr++;
-
- if (G_UNLIKELY (gst_rtsp_message_init_response (msg, code, bptr,
- NULL) != GST_RTSP_OK))
- res = GST_RTSP_EPARSE;
-
- res2 = parse_protocol_version (versionstr, &msg->type,
- &msg->type_data.response.version);
- if (G_LIKELY (res == GST_RTSP_OK))
- res = res2;
-
- return res;
-}
-
-static GstRTSPResult
-parse_request_line (guint8 * buffer, GstRTSPMessage * msg)
-{
- GstRTSPResult res = GST_RTSP_OK;
- GstRTSPResult res2;
- gchar versionstr[20];
- gchar methodstr[20];
- gchar urlstr[4096];
- gchar *bptr;
- GstRTSPMethod method;
-
- bptr = (gchar *) buffer;
-
- if (parse_string (methodstr, sizeof (methodstr), &bptr) != GST_RTSP_OK)
- res = GST_RTSP_EPARSE;
- method = gst_rtsp_find_method (methodstr);
-
- if (parse_string (urlstr, sizeof (urlstr), &bptr) != GST_RTSP_OK)
- res = GST_RTSP_EPARSE;
- if (G_UNLIKELY (*urlstr == '\0'))
- res = GST_RTSP_EPARSE;
-
- if (parse_string (versionstr, sizeof (versionstr), &bptr) != GST_RTSP_OK)
- res = GST_RTSP_EPARSE;
-
- if (G_UNLIKELY (*bptr != '\0'))
- res = GST_RTSP_EPARSE;
-
- if (G_UNLIKELY (gst_rtsp_message_init_request (msg, method,
- urlstr) != GST_RTSP_OK))
- res = GST_RTSP_EPARSE;
-
- res2 = parse_protocol_version (versionstr, &msg->type,
- &msg->type_data.request.version);
- if (G_LIKELY (res == GST_RTSP_OK))
- res = res2;
-
- if (G_LIKELY (msg->type == GST_RTSP_MESSAGE_REQUEST)) {
- /* GET and POST are not allowed as RTSP methods */
- if (msg->type_data.request.method == GST_RTSP_GET ||
- msg->type_data.request.method == GST_RTSP_POST) {
- msg->type_data.request.method = GST_RTSP_INVALID;
- if (res == GST_RTSP_OK)
- res = GST_RTSP_ERROR;
- }
- } else if (msg->type == GST_RTSP_MESSAGE_HTTP_REQUEST) {
- /* only GET and POST are allowed as HTTP methods */
- if (msg->type_data.request.method != GST_RTSP_GET &&
- msg->type_data.request.method != GST_RTSP_POST) {
- msg->type_data.request.method = GST_RTSP_INVALID;
- if (res == GST_RTSP_OK)
- res = GST_RTSP_ERROR;
- }
- }
-
- return res;
-}
-
-/* parsing lines means reading a Key: Value pair */
-static GstRTSPResult
-parse_line (guint8 * buffer, GstRTSPMessage * msg)
-{
- GstRTSPHeaderField field;
- gchar *line = (gchar *) buffer;
- gchar *value;
-
- if ((value = strchr (line, ':')) == NULL || value == line)
- goto parse_error;
-
- /* trim space before the colon */
- if (value[-1] == ' ')
- value[-1] = '\0';
-
- /* replace the colon with a NUL */
- *value++ = '\0';
-
- /* find the header */
- field = gst_rtsp_find_header_field (line);
- if (field == GST_RTSP_HDR_INVALID)
- goto done;
-
- /* split up the value in multiple key:value pairs if it contains comma(s) */
- while (*value != '\0') {
- gchar *next_value;
- gchar *comma = NULL;
- gboolean quoted = FALSE;
- guint comment = 0;
-
- /* trim leading space */
- if (*value == ' ')
- value++;
-
- /* for headers which may not appear multiple times, and thus may not
- * contain multiple values on the same line, we can short-circuit the loop
- * below and the entire value results in just one key:value pair*/
- if (!gst_rtsp_header_allow_multiple (field))
- next_value = value + strlen (value);
- else
- next_value = value;
-
- /* find the next value, taking special care of quotes and comments */
- while (*next_value != '\0') {
- if ((quoted || comment != 0) && *next_value == '\\' &&
- next_value[1] != '\0')
- next_value++;
- else if (comment == 0 && *next_value == '"')
- quoted = !quoted;
- else if (!quoted && *next_value == '(')
- comment++;
- else if (comment != 0 && *next_value == ')')
- comment--;
- else if (!quoted && comment == 0) {
- /* To quote RFC 2068: "User agents MUST take special care in parsing
- * the WWW-Authenticate field value if it contains more than one
- * challenge, or if more than one WWW-Authenticate header field is
- * provided, since the contents of a challenge may itself contain a
- * comma-separated list of authentication parameters."
- *
- * What this means is that we cannot just look for an unquoted comma
- * when looking for multiple values in Proxy-Authenticate and
- * WWW-Authenticate headers. Instead we need to look for the sequence
- * "comma [space] token space token" before we can split after the
- * comma...
- */
- if (field == GST_RTSP_HDR_PROXY_AUTHENTICATE ||
- field == GST_RTSP_HDR_WWW_AUTHENTICATE) {
- if (*next_value == ',') {
- if (next_value[1] == ' ') {
- /* skip any space following the comma so we do not mistake it for
- * separating between two tokens */
- next_value++;
- }
- comma = next_value;
- } else if (*next_value == ' ' && next_value[1] != ',' &&
- next_value[1] != '=' && comma != NULL) {
- next_value = comma;
- comma = NULL;
- break;
- }
- } else if (*next_value == ',')
- break;
- }
-
- next_value++;
- }
-
- /* trim space */
- if (value != next_value && next_value[-1] == ' ')
- next_value[-1] = '\0';
-
- if (*next_value != '\0')
- *next_value++ = '\0';
-
- /* add the key:value pair */
- if (*value != '\0')
- gst_rtsp_message_add_header (msg, field, value);
-
- value = next_value;
- }
-
-done:
- return GST_RTSP_OK;
-
- /* ERRORS */
-parse_error:
- {
- return GST_RTSP_EPARSE;
- }
-}
-
-/* convert all consecutive whitespace to a single space */
-static void
-normalize_line (guint8 * buffer)
-{
- while (*buffer) {
- if (g_ascii_isspace (*buffer)) {
- guint8 *tmp;
-
- *buffer++ = ' ';
- for (tmp = buffer; g_ascii_isspace (*tmp); tmp++) {
- }
- if (buffer != tmp)
- memmove (buffer, tmp, strlen ((gchar *) tmp) + 1);
- } else {
- buffer++;
- }
- }
-}
-
-/* returns:
- * GST_RTSP_OK when a complete message was read.
- * GST_RTSP_EEOF: when the socket is closed
- * GST_RTSP_EINTR: when more data is needed.
- * GST_RTSP_..: some other error occured.
- */
-static GstRTSPResult
-build_next (GstRTSPBuilder * builder, GstRTSPMessage * message,
- GstRTSPConnection * conn)
-{
- GstRTSPResult res;
-
- while (TRUE) {
- switch (builder->state) {
- case STATE_START:
- {
- guint8 c;
-
- builder->offset = 0;
- res =
- read_bytes (conn, (guint8 *) builder->buffer, &builder->offset, 1);
- if (res != GST_RTSP_OK)
- goto done;
-
- c = builder->buffer[0];
-
- /* we have 1 bytes now and we can see if this is a data message or
- * not */
- if (c == '$') {
- /* data message, prepare for the header */
- builder->state = STATE_DATA_HEADER;
- } else if (c == '\n' || c == '\r') {
- /* skip \n and \r */
- builder->offset = 0;
- } else {
- builder->line = 0;
- builder->state = STATE_READ_LINES;
- }
- break;
- }
- case STATE_DATA_HEADER:
- {
- res =
- read_bytes (conn, (guint8 *) builder->buffer, &builder->offset, 4);
- if (res != GST_RTSP_OK)
- goto done;
-
- gst_rtsp_message_init_data (message, builder->buffer[1]);
-
- builder->body_len = (builder->buffer[2] << 8) | builder->buffer[3];
- builder->body_data = g_malloc (builder->body_len + 1);
- builder->body_data[builder->body_len] = '\0';
- builder->offset = 0;
- builder->state = STATE_DATA_BODY;
- break;
- }
- case STATE_DATA_BODY:
- {
- res =
- read_bytes (conn, builder->body_data, &builder->offset,
- builder->body_len);
- if (res != GST_RTSP_OK)
- goto done;
-
- /* we have the complete body now, store in the message adjusting the
- * length to include the traling '\0' */
- gst_rtsp_message_take_body (message,
- (guint8 *) builder->body_data, builder->body_len + 1);
- builder->body_data = NULL;
- builder->body_len = 0;
-
- builder->state = STATE_END;
- break;
- }
- case STATE_READ_LINES:
- {
- res = read_line (conn, builder->buffer, &builder->offset,
- sizeof (builder->buffer));
- if (res != GST_RTSP_OK)
- goto done;
-
- /* we have a regular response */
- if (builder->buffer[0] == '\0') {
- gchar *hdrval;
-
- /* empty line, end of message header */
- /* see if there is a Content-Length header, but ignore it if this
- * is a POST request with an x-sessioncookie header */
- if (gst_rtsp_message_get_header (message,
- GST_RTSP_HDR_CONTENT_LENGTH, &hdrval, 0) == GST_RTSP_OK &&
- (message->type != GST_RTSP_MESSAGE_HTTP_REQUEST ||
- message->type_data.request.method != GST_RTSP_POST ||
- gst_rtsp_message_get_header (message,
- GST_RTSP_HDR_X_SESSIONCOOKIE, NULL, 0) != GST_RTSP_OK)) {
- /* there is, prepare to read the body */
- builder->body_len = atol (hdrval);
- builder->body_data = g_try_malloc (builder->body_len + 1);
- /* we can't do much here, we need the length to know how many bytes
- * we need to read next and when allocation fails, something is
- * probably wrong with the length. */
- if (builder->body_data == NULL)
- goto invalid_body_len;
-
- builder->body_data[builder->body_len] = '\0';
- builder->offset = 0;
- builder->state = STATE_DATA_BODY;
- } else {
- builder->state = STATE_END;
- }
- break;
- }
-
- /* we have a line */
- normalize_line (builder->buffer);
- if (builder->line == 0) {
- /* first line, check for response status */
- if (memcmp (builder->buffer, "RTSP", 4) == 0 ||
- memcmp (builder->buffer, "HTTP", 4) == 0) {
- builder->status = parse_response_status (builder->buffer, message);
- } else {
- builder->status = parse_request_line (builder->buffer, message);
- }
- } else {
- /* else just parse the line */
- res = parse_line (builder->buffer, message);
- if (res != GST_RTSP_OK)
- builder->status = res;
- }
- builder->line++;
- builder->offset = 0;
- break;
- }
- case STATE_END:
- {
- gchar *session_cookie;
- gchar *session_id;
-
- if (message->type == GST_RTSP_MESSAGE_DATA) {
- /* data messages don't have headers */
- res = GST_RTSP_OK;
- goto done;
- }
-
- /* save the tunnel session in the connection */
- if (message->type == GST_RTSP_MESSAGE_HTTP_REQUEST &&
- !conn->manual_http &&
- conn->tstate == TUNNEL_STATE_NONE &&
- gst_rtsp_message_get_header (message, GST_RTSP_HDR_X_SESSIONCOOKIE,
- &session_cookie, 0) == GST_RTSP_OK) {
- strncpy (conn->tunnelid, session_cookie, TUNNELID_LEN);
- conn->tunnelid[TUNNELID_LEN - 1] = '\0';
- conn->tunneled = TRUE;
- }
-
- /* save session id in the connection for further use */
- if (message->type == GST_RTSP_MESSAGE_RESPONSE &&
- gst_rtsp_message_get_header (message, GST_RTSP_HDR_SESSION,
- &session_id, 0) == GST_RTSP_OK) {
- gint maxlen, i;
-
- maxlen = sizeof (conn->session_id) - 1;
- /* the sessionid can have attributes marked with ;
- * Make sure we strip them */
- for (i = 0; session_id[i] != '\0'; i++) {
- if (session_id[i] == ';') {
- maxlen = i;
- /* parse timeout */
- do {
- i++;
- } while (g_ascii_isspace (session_id[i]));
- if (g_str_has_prefix (&session_id[i], "timeout=")) {
- gint to;
-
- /* if we parsed something valid, configure */
- if ((to = atoi (&session_id[i + 8])) > 0)
- conn->timeout = to;
- }
- break;
- }
- }
-
- /* make sure to not overflow */
- strncpy (conn->session_id, session_id, maxlen);
- conn->session_id[maxlen] = '\0';
- }
- res = builder->status;
- goto done;
- }
- default:
- res = GST_RTSP_ERROR;
- break;
- }
- }
-done:
- return res;
-
- /* ERRORS */
-invalid_body_len:
- {
- GST_DEBUG ("could not allocate body");
- return GST_RTSP_ERROR;
- }
-}
-
-/**
- * gst_rtsp_connection_read:
- * @conn: a #GstRTSPConnection
- * @data: the data to read
- * @size: the size of @data
- * @timeout: a timeout value or #NULL
- *
- * Attempt to read @size bytes into @data from the connected @conn, blocking up to
- * the specified @timeout. @timeout can be #NULL, in which case this function
- * might block forever.
- *
- * This function can be cancelled with gst_rtsp_connection_flush().
- *
- * Returns: #GST_RTSP_OK on success.
- */
-GstRTSPResult
-gst_rtsp_connection_read (GstRTSPConnection * conn, guint8 * data, guint size,
- GTimeVal * timeout)
-{
- guint offset;
- gint retval;
- GstClockTime to;
- GstRTSPResult res;
-
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (data != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (conn->readfd != NULL, GST_RTSP_EINVAL);
-
- if (G_UNLIKELY (size == 0))
- return GST_RTSP_OK;
-
- offset = 0;
-
- /* configure timeout if any */
- to = timeout ? GST_TIMEVAL_TO_TIME (*timeout) : GST_CLOCK_TIME_NONE;
-
- gst_poll_set_controllable (conn->fdset, TRUE);
- gst_poll_fd_ctl_write (conn->fdset, conn->writefd, FALSE);
- gst_poll_fd_ctl_read (conn->fdset, conn->readfd, TRUE);
-
- while (TRUE) {
- res = read_bytes (conn, data, &offset, size);
- if (G_UNLIKELY (res == GST_RTSP_EEOF))
- goto eof;
- if (G_LIKELY (res == GST_RTSP_OK))
- break;
- if (G_UNLIKELY (res != GST_RTSP_EINTR))
- goto read_error;
-
- do {
- retval = gst_poll_wait (conn->fdset, to);
- } while (retval == -1 && (errno == EINTR || errno == EAGAIN));
-
- /* check for timeout */
- if (G_UNLIKELY (retval == 0))
- goto select_timeout;
-
- if (G_UNLIKELY (retval == -1)) {
- if (errno == EBUSY)
- goto stopped;
- else
- goto select_error;
- }
-
- /* could also be an error with write socket */
- if (gst_poll_fd_has_error (conn->fdset, conn->writefd))
- goto socket_error;
-
- gst_poll_set_controllable (conn->fdset, FALSE);
- }
- return GST_RTSP_OK;
-
- /* ERRORS */
-select_error:
- {
- return GST_RTSP_ESYS;
- }
-select_timeout:
- {
- return GST_RTSP_ETIMEOUT;
- }
-stopped:
- {
- return GST_RTSP_EINTR;
- }
-eof:
- {
- return GST_RTSP_EEOF;
- }
-socket_error:
- {
- res = GST_RTSP_ENET;
- }
-read_error:
- {
- return res;
- }
-}
-
-static GstRTSPMessage *
-gen_tunnel_reply (GstRTSPConnection * conn, GstRTSPStatusCode code,
- const GstRTSPMessage * request)
-{
- GstRTSPMessage *msg;
- GstRTSPResult res;
-
- if (gst_rtsp_status_as_text (code) == NULL)
- code = GST_RTSP_STS_INTERNAL_SERVER_ERROR;
-
- GST_RTSP_CHECK (gst_rtsp_message_new_response (&msg, code, NULL, request),
- no_message);
-
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_SERVER,
- "GStreamer RTSP Server");
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_CONNECTION, "close");
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_CACHE_CONTROL, "no-store");
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_PRAGMA, "no-cache");
-
- if (code == GST_RTSP_STS_OK) {
- if (conn->ip)
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_X_SERVER_IP_ADDRESS,
- conn->ip);
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_CONTENT_TYPE,
- "application/x-rtsp-tunnelled");
- }
-
- return msg;
-
- /* ERRORS */
-no_message:
- {
- return NULL;
- }
-}
-
-/**
- * gst_rtsp_connection_receive:
- * @conn: a #GstRTSPConnection
- * @message: the message to read
- * @timeout: a timeout value or #NULL
- *
- * Attempt to read into @message from the connected @conn, blocking up to
- * the specified @timeout. @timeout can be #NULL, in which case this function
- * might block forever.
- *
- * This function can be cancelled with gst_rtsp_connection_flush().
- *
- * Returns: #GST_RTSP_OK on success.
- */
-GstRTSPResult
-gst_rtsp_connection_receive (GstRTSPConnection * conn, GstRTSPMessage * message,
- GTimeVal * timeout)
-{
- GstRTSPResult res;
- GstRTSPBuilder builder;
- gint retval;
- GstClockTime to;
-
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (message != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (conn->readfd != NULL, GST_RTSP_EINVAL);
-
- /* configure timeout if any */
- to = timeout ? GST_TIMEVAL_TO_TIME (*timeout) : GST_CLOCK_TIME_NONE;
-
- gst_poll_set_controllable (conn->fdset, TRUE);
- gst_poll_fd_ctl_write (conn->fdset, conn->writefd, FALSE);
- gst_poll_fd_ctl_read (conn->fdset, conn->readfd, TRUE);
-
- memset (&builder, 0, sizeof (GstRTSPBuilder));
- while (TRUE) {
- res = build_next (&builder, message, conn);
- if (G_UNLIKELY (res == GST_RTSP_EEOF))
- goto eof;
- else if (G_LIKELY (res == GST_RTSP_OK)) {
- if (!conn->manual_http) {
- if (message->type == GST_RTSP_MESSAGE_HTTP_REQUEST) {
- if (conn->tstate == TUNNEL_STATE_NONE &&
- message->type_data.request.method == GST_RTSP_GET) {
- GstRTSPMessage *response;
-
- conn->tstate = TUNNEL_STATE_GET;
-
- /* tunnel GET request, we can reply now */
- response = gen_tunnel_reply (conn, GST_RTSP_STS_OK, message);
- res = gst_rtsp_connection_send (conn, response, timeout);
- gst_rtsp_message_free (response);
- if (res == GST_RTSP_OK)
- res = GST_RTSP_ETGET;
- goto cleanup;
- } else if (conn->tstate == TUNNEL_STATE_NONE &&
- message->type_data.request.method == GST_RTSP_POST) {
- conn->tstate = TUNNEL_STATE_POST;
-
- /* tunnel POST request, the caller now has to link the two
- * connections. */
- res = GST_RTSP_ETPOST;
- goto cleanup;
- } else {
- res = GST_RTSP_EPARSE;
- goto cleanup;
- }
- } else if (message->type == GST_RTSP_MESSAGE_HTTP_RESPONSE) {
- res = GST_RTSP_EPARSE;
- goto cleanup;
- }
- }
-
- break;
- } else if (G_UNLIKELY (res != GST_RTSP_EINTR))
- goto read_error;
-
- do {
- retval = gst_poll_wait (conn->fdset, to);
- } while (retval == -1 && (errno == EINTR || errno == EAGAIN));
-
- /* check for timeout */
- if (G_UNLIKELY (retval == 0))
- goto select_timeout;
-
- if (G_UNLIKELY (retval == -1)) {
- if (errno == EBUSY)
- goto stopped;
- else
- goto select_error;
- }
-
- /* could also be an error with write socket */
- if (gst_poll_fd_has_error (conn->fdset, conn->writefd))
- goto socket_error;
-
- gst_poll_set_controllable (conn->fdset, FALSE);
- }
-
- /* we have a message here */
- build_reset (&builder);
-
- return GST_RTSP_OK;
-
- /* ERRORS */
-select_error:
- {
- res = GST_RTSP_ESYS;
- goto cleanup;
- }
-select_timeout:
- {
- res = GST_RTSP_ETIMEOUT;
- goto cleanup;
- }
-stopped:
- {
- res = GST_RTSP_EINTR;
- goto cleanup;
- }
-eof:
- {
- res = GST_RTSP_EEOF;
- goto cleanup;
- }
-socket_error:
- {
- res = GST_RTSP_ENET;
- goto cleanup;
- }
-read_error:
-cleanup:
- {
- build_reset (&builder);
- gst_rtsp_message_unset (message);
- return res;
- }
-}
-
-/**
- * gst_rtsp_connection_close:
- * @conn: a #GstRTSPConnection
- *
- * Close the connected @conn. After this call, the connection is in the same
- * state as when it was first created.
- *
- * Returns: #GST_RTSP_OK on success.
- */
-GstRTSPResult
-gst_rtsp_connection_close (GstRTSPConnection * conn)
-{
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
-
- g_free (conn->ip);
- conn->ip = NULL;
-
- conn->read_ahead = 0;
-
- g_free (conn->initial_buffer);
- conn->initial_buffer = NULL;
- conn->initial_buffer_offset = 0;
-
- REMOVE_POLLFD (conn->fdset, &conn->fd0);
- REMOVE_POLLFD (conn->fdset, &conn->fd1);
- conn->writefd = NULL;
- conn->readfd = NULL;
- conn->tunneled = FALSE;
- conn->tstate = TUNNEL_STATE_NONE;
- conn->ctxp = NULL;
- g_free (conn->username);
- conn->username = NULL;
- g_free (conn->passwd);
- conn->passwd = NULL;
- gst_rtsp_connection_clear_auth_params (conn);
- conn->timeout = 60;
- conn->cseq = 0;
- conn->session_id[0] = '\0';
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_connection_free:
- * @conn: a #GstRTSPConnection
- *
- * Close and free @conn.
- *
- * Returns: #GST_RTSP_OK on success.
- */
-GstRTSPResult
-gst_rtsp_connection_free (GstRTSPConnection * conn)
-{
- GstRTSPResult res;
-
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
-
- res = gst_rtsp_connection_close (conn);
- gst_poll_free (conn->fdset);
- g_timer_destroy (conn->timer);
- gst_rtsp_url_free (conn->url);
- g_free (conn->proxy_host);
- g_free (conn);
-#ifdef G_OS_WIN32
- WSACleanup ();
-#endif
-
- return res;
-}
-
-/**
- * gst_rtsp_connection_poll:
- * @conn: a #GstRTSPConnection
- * @events: a bitmask of #GstRTSPEvent flags to check
- * @revents: location for result flags
- * @timeout: a timeout
- *
- * Wait up to the specified @timeout for the connection to become available for
- * at least one of the operations specified in @events. When the function returns
- * with #GST_RTSP_OK, @revents will contain a bitmask of available operations on
- * @conn.
- *
- * @timeout can be #NULL, in which case this function might block forever.
- *
- * This function can be cancelled with gst_rtsp_connection_flush().
- *
- * Returns: #GST_RTSP_OK on success.
- *
- * Since: 0.10.15
- */
-GstRTSPResult
-gst_rtsp_connection_poll (GstRTSPConnection * conn, GstRTSPEvent events,
- GstRTSPEvent * revents, GTimeVal * timeout)
-{
- GstClockTime to;
- gint retval;
-
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (events != 0, GST_RTSP_EINVAL);
- g_return_val_if_fail (revents != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (conn->readfd != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (conn->writefd != NULL, GST_RTSP_EINVAL);
-
- gst_poll_set_controllable (conn->fdset, TRUE);
-
- /* add fd to writer set when asked to */
- gst_poll_fd_ctl_write (conn->fdset, conn->writefd,
- events & GST_RTSP_EV_WRITE);
-
- /* add fd to reader set when asked to */
- gst_poll_fd_ctl_read (conn->fdset, conn->readfd, events & GST_RTSP_EV_READ);
-
- /* configure timeout if any */
- to = timeout ? GST_TIMEVAL_TO_TIME (*timeout) : GST_CLOCK_TIME_NONE;
-
- do {
- retval = gst_poll_wait (conn->fdset, to);
- } while (retval == -1 && (errno == EINTR || errno == EAGAIN));
-
- if (G_UNLIKELY (retval == 0))
- goto select_timeout;
-
- if (G_UNLIKELY (retval == -1)) {
- if (errno == EBUSY)
- goto stopped;
- else
- goto select_error;
- }
-
- *revents = 0;
- if (events & GST_RTSP_EV_READ) {
- if (gst_poll_fd_can_read (conn->fdset, conn->readfd))
- *revents |= GST_RTSP_EV_READ;
- }
- if (events & GST_RTSP_EV_WRITE) {
- if (gst_poll_fd_can_write (conn->fdset, conn->writefd))
- *revents |= GST_RTSP_EV_WRITE;
- }
- return GST_RTSP_OK;
-
- /* ERRORS */
-select_timeout:
- {
- return GST_RTSP_ETIMEOUT;
- }
-select_error:
- {
- return GST_RTSP_ESYS;
- }
-stopped:
- {
- return GST_RTSP_EINTR;
- }
-}
-
-/**
- * gst_rtsp_connection_next_timeout:
- * @conn: a #GstRTSPConnection
- * @timeout: a timeout
- *
- * Calculate the next timeout for @conn, storing the result in @timeout.
- *
- * Returns: #GST_RTSP_OK.
- */
-GstRTSPResult
-gst_rtsp_connection_next_timeout (GstRTSPConnection * conn, GTimeVal * timeout)
-{
- gdouble elapsed;
- glong sec;
- gulong usec;
-
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (timeout != NULL, GST_RTSP_EINVAL);
-
- elapsed = g_timer_elapsed (conn->timer, &usec);
- if (elapsed >= conn->timeout) {
- sec = 0;
- usec = 0;
- } else {
- sec = conn->timeout - elapsed;
- }
-
- timeout->tv_sec = sec;
- timeout->tv_usec = usec;
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_connection_reset_timeout:
- * @conn: a #GstRTSPConnection
- *
- * Reset the timeout of @conn.
- *
- * Returns: #GST_RTSP_OK.
- */
-GstRTSPResult
-gst_rtsp_connection_reset_timeout (GstRTSPConnection * conn)
-{
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
-
- g_timer_start (conn->timer);
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_connection_flush:
- * @conn: a #GstRTSPConnection
- * @flush: start or stop the flush
- *
- * Start or stop the flushing action on @conn. When flushing, all current
- * and future actions on @conn will return #GST_RTSP_EINTR until the connection
- * is set to non-flushing mode again.
- *
- * Returns: #GST_RTSP_OK.
- */
-GstRTSPResult
-gst_rtsp_connection_flush (GstRTSPConnection * conn, gboolean flush)
-{
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
-
- gst_poll_set_flushing (conn->fdset, flush);
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_connection_set_proxy:
- * @conn: a #GstRTSPConnection
- * @host: the proxy host
- * @port: the proxy port
- *
- * Set the proxy host and port.
- *
- * Returns: #GST_RTSP_OK.
- *
- * Since: 0.10.23
- */
-GstRTSPResult
-gst_rtsp_connection_set_proxy (GstRTSPConnection * conn,
- const gchar * host, guint port)
-{
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
-
- g_free (conn->proxy_host);
- conn->proxy_host = g_strdup (host);
- conn->proxy_port = port;
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_connection_set_auth:
- * @conn: a #GstRTSPConnection
- * @method: authentication method
- * @user: the user
- * @pass: the password
- *
- * Configure @conn for authentication mode @method with @user and @pass as the
- * user and password respectively.
- *
- * Returns: #GST_RTSP_OK.
- */
-GstRTSPResult
-gst_rtsp_connection_set_auth (GstRTSPConnection * conn,
- GstRTSPAuthMethod method, const gchar * user, const gchar * pass)
-{
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
-
- if (method == GST_RTSP_AUTH_DIGEST && ((user == NULL || pass == NULL)
- || g_strrstr (user, ":") != NULL))
- return GST_RTSP_EINVAL;
-
- /* Make sure the username and passwd are being set for authentication */
- if (method == GST_RTSP_AUTH_NONE && (user == NULL || pass == NULL))
- return GST_RTSP_EINVAL;
-
- /* ":" chars are not allowed in usernames for basic auth */
- if (method == GST_RTSP_AUTH_BASIC && g_strrstr (user, ":") != NULL)
- return GST_RTSP_EINVAL;
-
- g_free (conn->username);
- g_free (conn->passwd);
-
- conn->auth_method = method;
- conn->username = g_strdup (user);
- conn->passwd = g_strdup (pass);
-
- return GST_RTSP_OK;
-}
-
-/**
- * str_case_hash:
- * @key: ASCII string to hash
- *
- * Hashes @key in a case-insensitive manner.
- *
- * Returns: the hash code.
- **/
-static guint
-str_case_hash (gconstpointer key)
-{
- const char *p = key;
- guint h = g_ascii_toupper (*p);
-
- if (h)
- for (p += 1; *p != '\0'; p++)
- h = (h << 5) - h + g_ascii_toupper (*p);
-
- return h;
-}
-
-/**
- * str_case_equal:
- * @v1: an ASCII string
- * @v2: another ASCII string
- *
- * Compares @v1 and @v2 in a case-insensitive manner
- *
- * Returns: %TRUE if they are equal (modulo case)
- **/
-static gboolean
-str_case_equal (gconstpointer v1, gconstpointer v2)
-{
- const char *string1 = v1;
- const char *string2 = v2;
-
- return g_ascii_strcasecmp (string1, string2) == 0;
-}
-
-/**
- * gst_rtsp_connection_set_auth_param:
- * @conn: a #GstRTSPConnection
- * @param: authentication directive
- * @value: value
- *
- * Setup @conn with authentication directives. This is not necesary for
- * methods #GST_RTSP_AUTH_NONE and #GST_RTSP_AUTH_BASIC. For
- * #GST_RTSP_AUTH_DIGEST, directives should be taken from the digest challenge
- * in the WWW-Authenticate response header and can include realm, domain,
- * nonce, opaque, stale, algorithm, qop as per RFC2617.
- *
- * Since: 0.10.20
- */
-void
-gst_rtsp_connection_set_auth_param (GstRTSPConnection * conn,
- const gchar * param, const gchar * value)
-{
- g_return_if_fail (conn != NULL);
- g_return_if_fail (param != NULL);
-
- if (conn->auth_params == NULL) {
- conn->auth_params =
- g_hash_table_new_full (str_case_hash, str_case_equal, g_free, g_free);
- }
- g_hash_table_insert (conn->auth_params, g_strdup (param), g_strdup (value));
-}
-
-/**
- * gst_rtsp_connection_clear_auth_params:
- * @conn: a #GstRTSPConnection
- *
- * Clear the list of authentication directives stored in @conn.
- *
- * Since: 0.10.20
- */
-void
-gst_rtsp_connection_clear_auth_params (GstRTSPConnection * conn)
-{
- g_return_if_fail (conn != NULL);
-
- if (conn->auth_params != NULL) {
- g_hash_table_destroy (conn->auth_params);
- conn->auth_params = NULL;
- }
-}
-
-static GstRTSPResult
-set_qos_dscp (gint fd, guint qos_dscp)
-{
- union gst_sockaddr sa;
- socklen_t slen = sizeof (sa);
- gint af;
- gint tos;
-
- if (fd == -1)
- return GST_RTSP_OK;
-
- if (getsockname (fd, &sa.sa, &slen) < 0)
- goto no_getsockname;
-
- af = sa.sa.sa_family;
-
- /* if this is an IPv4-mapped address then do IPv4 QoS */
- if (af == AF_INET6) {
- if (IN6_IS_ADDR_V4MAPPED (&sa.sa_in6.sin6_addr))
- af = AF_INET;
- }
-
- /* extract and shift 6 bits of the DSCP */
- tos = (qos_dscp & 0x3f) << 2;
-
- switch (af) {
- case AF_INET:
- if (SETSOCKOPT (fd, IPPROTO_IP, IP_TOS, &tos, sizeof (tos)) < 0)
- goto no_setsockopt;
- break;
- case AF_INET6:
-#ifdef IPV6_TCLASS
- if (SETSOCKOPT (fd, IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof (tos)) < 0)
- goto no_setsockopt;
- break;
-#endif
- default:
- goto wrong_family;
- }
-
- return GST_RTSP_OK;
-
- /* ERRORS */
-no_getsockname:
-no_setsockopt:
- {
- return GST_RTSP_ESYS;
- }
-
-wrong_family:
- {
- return GST_RTSP_ERROR;
- }
-}
-
-/**
- * gst_rtsp_connection_set_qos_dscp:
- * @conn: a #GstRTSPConnection
- * @qos_dscp: DSCP value
- *
- * Configure @conn to use the specified DSCP value.
- *
- * Returns: #GST_RTSP_OK on success.
- *
- * Since: 0.10.20
- */
-GstRTSPResult
-gst_rtsp_connection_set_qos_dscp (GstRTSPConnection * conn, guint qos_dscp)
-{
- GstRTSPResult res;
-
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (conn->readfd != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (conn->writefd != NULL, GST_RTSP_EINVAL);
-
- res = set_qos_dscp (conn->fd0.fd, qos_dscp);
- if (res == GST_RTSP_OK)
- res = set_qos_dscp (conn->fd1.fd, qos_dscp);
-
- return res;
-}
-
-
-/**
- * gst_rtsp_connection_get_url:
- * @conn: a #GstRTSPConnection
- *
- * Retrieve the URL of the other end of @conn.
- *
- * Returns: The URL. This value remains valid until the
- * connection is freed.
- *
- * Since: 0.10.23
- */
-GstRTSPUrl *
-gst_rtsp_connection_get_url (const GstRTSPConnection * conn)
-{
- g_return_val_if_fail (conn != NULL, NULL);
-
- return conn->url;
-}
-
-/**
- * gst_rtsp_connection_get_ip:
- * @conn: a #GstRTSPConnection
- *
- * Retrieve the IP address of the other end of @conn.
- *
- * Returns: The IP address as a string. this value remains valid until the
- * connection is closed.
- *
- * Since: 0.10.20
- */
-const gchar *
-gst_rtsp_connection_get_ip (const GstRTSPConnection * conn)
-{
- g_return_val_if_fail (conn != NULL, NULL);
-
- return conn->ip;
-}
-
-/**
- * gst_rtsp_connection_set_ip:
- * @conn: a #GstRTSPConnection
- * @ip: an ip address
- *
- * Set the IP address of the server.
- *
- * Since: 0.10.23
- */
-void
-gst_rtsp_connection_set_ip (GstRTSPConnection * conn, const gchar * ip)
-{
- g_return_if_fail (conn != NULL);
-
- g_free (conn->ip);
- conn->ip = g_strdup (ip);
-}
-
-/**
- * gst_rtsp_connection_get_readfd:
- * @conn: a #GstRTSPConnection
- *
- * Get the file descriptor for reading.
- *
- * Returns: the file descriptor used for reading or -1 on error. The file
- * descriptor remains valid until the connection is closed.
- *
- * Since: 0.10.23
- */
-gint
-gst_rtsp_connection_get_readfd (const GstRTSPConnection * conn)
-{
- g_return_val_if_fail (conn != NULL, -1);
- g_return_val_if_fail (conn->readfd != NULL, -1);
-
- return conn->readfd->fd;
-}
-
-/**
- * gst_rtsp_connection_get_writefd:
- * @conn: a #GstRTSPConnection
- *
- * Get the file descriptor for writing.
- *
- * Returns: the file descriptor used for writing or -1 on error. The file
- * descriptor remains valid until the connection is closed.
- *
- * Since: 0.10.23
- */
-gint
-gst_rtsp_connection_get_writefd (const GstRTSPConnection * conn)
-{
- g_return_val_if_fail (conn != NULL, -1);
- g_return_val_if_fail (conn->writefd != NULL, -1);
-
- return conn->writefd->fd;
-}
-
-/**
- * gst_rtsp_connection_set_http_mode:
- * @conn: a #GstRTSPConnection
- * @enable: %TRUE to enable manual HTTP mode
- *
- * By setting the HTTP mode to %TRUE the message parsing will support HTTP
- * messages in addition to the RTSP messages. It will also disable the
- * automatic handling of setting up an HTTP tunnel.
- *
- * Since: 0.10.25
- */
-void
-gst_rtsp_connection_set_http_mode (GstRTSPConnection * conn, gboolean enable)
-{
- g_return_if_fail (conn != NULL);
-
- conn->manual_http = enable;
-}
-
-/**
- * gst_rtsp_connection_set_tunneled:
- * @conn: a #GstRTSPConnection
- * @tunneled: the new state
- *
- * Set the HTTP tunneling state of the connection. This must be configured before
- * the @conn is connected.
- *
- * Since: 0.10.23
- */
-void
-gst_rtsp_connection_set_tunneled (GstRTSPConnection * conn, gboolean tunneled)
-{
- g_return_if_fail (conn != NULL);
- g_return_if_fail (conn->readfd == NULL);
- g_return_if_fail (conn->writefd == NULL);
-
- conn->tunneled = tunneled;
-}
-
-/**
- * gst_rtsp_connection_is_tunneled:
- * @conn: a #GstRTSPConnection
- *
- * Get the tunneling state of the connection.
- *
- * Returns: if @conn is using HTTP tunneling.
- *
- * Since: 0.10.23
- */
-gboolean
-gst_rtsp_connection_is_tunneled (const GstRTSPConnection * conn)
-{
- g_return_val_if_fail (conn != NULL, FALSE);
-
- return conn->tunneled;
-}
-
-/**
- * gst_rtsp_connection_get_tunnelid:
- * @conn: a #GstRTSPConnection
- *
- * Get the tunnel session id the connection.
- *
- * Returns: returns a non-empty string if @conn is being tunneled over HTTP.
- *
- * Since: 0.10.23
- */
-const gchar *
-gst_rtsp_connection_get_tunnelid (const GstRTSPConnection * conn)
-{
- g_return_val_if_fail (conn != NULL, NULL);
-
- if (!conn->tunneled)
- return NULL;
-
- return conn->tunnelid;
-}
-
-/**
- * gst_rtsp_connection_do_tunnel:
- * @conn: a #GstRTSPConnection
- * @conn2: a #GstRTSPConnection or %NULL
- *
- * If @conn received the first tunnel connection and @conn2 received
- * the second tunnel connection, link the two connections together so that
- * @conn manages the tunneled connection.
- *
- * After this call, @conn2 cannot be used anymore and must be freed with
- * gst_rtsp_connection_free().
- *
- * If @conn2 is %NULL then only the base64 decoding context will be setup for
- * @conn.
- *
- * Returns: return GST_RTSP_OK on success.
- *
- * Since: 0.10.23
- */
-GstRTSPResult
-gst_rtsp_connection_do_tunnel (GstRTSPConnection * conn,
- GstRTSPConnection * conn2)
-{
- g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
-
- if (conn2 != NULL) {
- g_return_val_if_fail (conn->tstate == TUNNEL_STATE_GET, GST_RTSP_EINVAL);
- g_return_val_if_fail (conn2->tstate == TUNNEL_STATE_POST, GST_RTSP_EINVAL);
- g_return_val_if_fail (!memcmp (conn2->tunnelid, conn->tunnelid,
- TUNNELID_LEN), GST_RTSP_EINVAL);
-
- /* both connections have fd0 as the read/write socket. start by taking the
- * socket from conn2 and set it as the socket in conn */
- conn->fd1 = conn2->fd0;
-
- /* clean up some of the state of conn2 */
- gst_poll_remove_fd (conn2->fdset, &conn2->fd0);
- conn2->fd0.fd = -1;
- conn2->readfd = conn2->writefd = NULL;
-
- /* We make fd0 the write socket and fd1 the read socket. */
- conn->writefd = &conn->fd0;
- conn->readfd = &conn->fd1;
-
- conn->tstate = TUNNEL_STATE_COMPLETE;
- }
-
- /* we need base64 decoding for the readfd */
- conn->ctx.state = 0;
- conn->ctx.save = 0;
- conn->ctx.cout = 0;
- conn->ctx.coutl = 0;
- conn->ctxp = &conn->ctx;
-
- return GST_RTSP_OK;
-}
-
-#define READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR)
-#define WRITE_COND (G_IO_OUT | G_IO_ERR)
-
-typedef struct
-{
- guint8 *data;
- guint size;
- guint id;
-} GstRTSPRec;
-
-/* async functions */
-struct _GstRTSPWatch
-{
- GSource source;
-
- GstRTSPConnection *conn;
-
- GstRTSPBuilder builder;
- GstRTSPMessage message;
-
- GPollFD readfd;
- GPollFD writefd;
- gboolean write_added;
-
- /* queued message for transmission */
- guint id;
- GMutex *mutex;
- GQueue *messages;
- guint8 *write_data;
- guint write_off;
- guint write_size;
- guint write_id;
-
- GstRTSPWatchFuncs funcs;
-
- gpointer user_data;
- GDestroyNotify notify;
-};
-
-static gboolean
-gst_rtsp_source_prepare (GSource * source, gint * timeout)
-{
- GstRTSPWatch *watch = (GstRTSPWatch *) source;
-
- if (watch->conn->initial_buffer != NULL)
- return TRUE;
-
- *timeout = (watch->conn->timeout * 1000);
-
- return FALSE;
-}
-
-static gboolean
-gst_rtsp_source_check (GSource * source)
-{
- GstRTSPWatch *watch = (GstRTSPWatch *) source;
-
- if (watch->readfd.revents & READ_COND)
- return TRUE;
-
- if (watch->writefd.revents & WRITE_COND)
- return TRUE;
-
- return FALSE;
-}
-
-static gboolean
-gst_rtsp_source_dispatch (GSource * source, GSourceFunc callback G_GNUC_UNUSED,
- gpointer user_data G_GNUC_UNUSED)
-{
- GstRTSPWatch *watch = (GstRTSPWatch *) source;
- GstRTSPResult res;
-
- /* first read as much as we can */
- if (watch->readfd.revents & READ_COND || watch->conn->initial_buffer != NULL) {
- do {
- res = build_next (&watch->builder, &watch->message, watch->conn);
- if (res == GST_RTSP_EINTR)
- break;
- else if (G_UNLIKELY (res == GST_RTSP_EEOF))
- goto eof;
- else if (G_LIKELY (res == GST_RTSP_OK)) {
- if (!watch->conn->manual_http &&
- watch->message.type == GST_RTSP_MESSAGE_HTTP_REQUEST) {
- if (watch->conn->tstate == TUNNEL_STATE_NONE &&
- watch->message.type_data.request.method == GST_RTSP_GET) {
- GstRTSPMessage *response;
- GstRTSPStatusCode code;
-
- watch->conn->tstate = TUNNEL_STATE_GET;
-
- if (watch->funcs.tunnel_start)
- code = watch->funcs.tunnel_start (watch, watch->user_data);
- else
- code = GST_RTSP_STS_OK;
-
- /* queue the response */
- response = gen_tunnel_reply (watch->conn, code, &watch->message);
- gst_rtsp_watch_send_message (watch, response, NULL);
- gst_rtsp_message_free (response);
- goto read_done;
- } else if (watch->conn->tstate == TUNNEL_STATE_NONE &&
- watch->message.type_data.request.method == GST_RTSP_POST) {
- watch->conn->tstate = TUNNEL_STATE_POST;
-
- /* in the callback the connection should be tunneled with the
- * GET connection */
- if (watch->funcs.tunnel_complete)
- watch->funcs.tunnel_complete (watch, watch->user_data);
- goto read_done;
- }
- }
- }
-
- if (!watch->conn->manual_http) {
- /* if manual HTTP support is not enabled, then restore the message to
- * what it would have looked like without the support for parsing HTTP
- * messages being present */
- if (watch->message.type == GST_RTSP_MESSAGE_HTTP_REQUEST) {
- watch->message.type = GST_RTSP_MESSAGE_REQUEST;
- watch->message.type_data.request.method = GST_RTSP_INVALID;
- if (watch->message.type_data.request.version != GST_RTSP_VERSION_1_0)
- watch->message.type_data.request.version = GST_RTSP_VERSION_INVALID;
- res = GST_RTSP_EPARSE;
- } else if (watch->message.type == GST_RTSP_MESSAGE_HTTP_RESPONSE) {
- watch->message.type = GST_RTSP_MESSAGE_RESPONSE;
- if (watch->message.type_data.response.version != GST_RTSP_VERSION_1_0)
- watch->message.type_data.response.version =
- GST_RTSP_VERSION_INVALID;
- res = GST_RTSP_EPARSE;
- }
- }
-
- if (G_LIKELY (res == GST_RTSP_OK)) {
- if (watch->funcs.message_received)
- watch->funcs.message_received (watch, &watch->message,
- watch->user_data);
- } else {
- if (watch->funcs.error_full)
- GST_RTSP_CHECK (watch->funcs.error_full (watch, res, &watch->message,
- 0, watch->user_data), error);
- else
- goto error;
- }
-
- read_done:
- gst_rtsp_message_unset (&watch->message);
- build_reset (&watch->builder);
- } while (FALSE);
- }
-
- if (watch->writefd.revents & WRITE_COND) {
- g_mutex_lock (watch->mutex);
- do {
- if (watch->write_data == NULL) {
- GstRTSPRec *rec;
-
- /* get a new message from the queue */
- rec = g_queue_pop_tail (watch->messages);
- if (rec == NULL)
- goto done;
-
- watch->write_off = 0;
- watch->write_data = rec->data;
- watch->write_size = rec->size;
- watch->write_id = rec->id;
-
- g_slice_free (GstRTSPRec, rec);
- }
-
- res = write_bytes (watch->writefd.fd, watch->write_data,
- &watch->write_off, watch->write_size);
- g_mutex_unlock (watch->mutex);
- if (res == GST_RTSP_EINTR)
- goto write_blocked;
- else if (G_LIKELY (res == GST_RTSP_OK)) {
- if (watch->funcs.message_sent)
- watch->funcs.message_sent (watch, watch->write_id, watch->user_data);
- } else {
- if (watch->funcs.error_full)
- GST_RTSP_CHECK (watch->funcs.error_full (watch, res, NULL,
- watch->write_id, watch->user_data), error);
- else
- goto error;
- }
- g_mutex_lock (watch->mutex);
-
- g_free (watch->write_data);
- watch->write_data = NULL;
- } while (TRUE);
-
- done:
- if (watch->write_added) {
- g_source_remove_poll ((GSource *) watch, &watch->writefd);
- watch->write_added = FALSE;
- watch->writefd.revents = 0;
- }
-
- g_mutex_unlock (watch->mutex);
- }
-
-write_blocked:
- return TRUE;
-
- /* ERRORS */
-eof:
- {
- if (watch->funcs.closed)
- watch->funcs.closed (watch, watch->user_data);
- return FALSE;
- }
-error:
- {
- if (watch->funcs.error)
- watch->funcs.error (watch, res, watch->user_data);
- return FALSE;
- }
-}
-
-static void
-gst_rtsp_rec_free (gpointer data)
-{
- GstRTSPRec *rec = data;
-
- g_free (rec->data);
- g_slice_free (GstRTSPRec, rec);
-}
-
-static void
-gst_rtsp_source_finalize (GSource * source)
-{
- GstRTSPWatch *watch = (GstRTSPWatch *) source;
-
- build_reset (&watch->builder);
- gst_rtsp_message_unset (&watch->message);
-
- g_queue_foreach (watch->messages, (GFunc) gst_rtsp_rec_free, NULL);
- g_queue_free (watch->messages);
- watch->messages = NULL;
-
- g_mutex_free (watch->mutex);
-
- g_free (watch->write_data);
-
- if (watch->notify)
- watch->notify (watch->user_data);
-}
-
-static GSourceFuncs gst_rtsp_source_funcs = {
- gst_rtsp_source_prepare,
- gst_rtsp_source_check,
- gst_rtsp_source_dispatch,
- gst_rtsp_source_finalize,
- NULL,
- NULL
-};
-
-/**
- * gst_rtsp_watch_new:
- * @conn: a #GstRTSPConnection
- * @funcs: watch functions
- * @user_data: user data to pass to @funcs
- * @notify: notify when @user_data is not referenced anymore
- *
- * Create a watch object for @conn. The functions provided in @funcs will be
- * called with @user_data when activity happened on the watch.
- *
- * The new watch is usually created so that it can be attached to a
- * maincontext with gst_rtsp_watch_attach().
- *
- * @conn must exist for the entire lifetime of the watch.
- *
- * Returns: a #GstRTSPWatch that can be used for asynchronous RTSP
- * communication. Free with gst_rtsp_watch_unref () after usage.
- *
- * Since: 0.10.23
- */
-GstRTSPWatch *
-gst_rtsp_watch_new (GstRTSPConnection * conn,
- GstRTSPWatchFuncs * funcs, gpointer user_data, GDestroyNotify notify)
-{
- GstRTSPWatch *result;
-
- g_return_val_if_fail (conn != NULL, NULL);
- g_return_val_if_fail (funcs != NULL, NULL);
- g_return_val_if_fail (conn->readfd != NULL, NULL);
- g_return_val_if_fail (conn->writefd != NULL, NULL);
-
- result = (GstRTSPWatch *) g_source_new (&gst_rtsp_source_funcs,
- sizeof (GstRTSPWatch));
-
- result->conn = conn;
- result->builder.state = STATE_START;
-
- result->mutex = g_mutex_new ();
- result->messages = g_queue_new ();
-
- result->readfd.fd = -1;
- result->writefd.fd = -1;
-
- gst_rtsp_watch_reset (result);
-
- result->funcs = *funcs;
- result->user_data = user_data;
- result->notify = notify;
-
- /* only add the read fd, the write fd is only added when we have data
- * to send. */
- g_source_add_poll ((GSource *) result, &result->readfd);
-
- return result;
-}
-
-/**
- * gst_rtsp_watch_reset:
- * @watch: a #GstRTSPWatch
- *
- * Reset @watch, this is usually called after gst_rtsp_connection_do_tunnel()
- * when the file descriptors of the connection might have changed.
- *
- * Since: 0.10.23
- */
-void
-gst_rtsp_watch_reset (GstRTSPWatch * watch)
-{
- if (watch->readfd.fd != -1)
- g_source_remove_poll ((GSource *) watch, &watch->readfd);
- if (watch->writefd.fd != -1)
- g_source_remove_poll ((GSource *) watch, &watch->writefd);
-
- watch->readfd.fd = watch->conn->readfd->fd;
- watch->readfd.events = READ_COND;
- watch->readfd.revents = 0;
-
- watch->writefd.fd = watch->conn->writefd->fd;
- watch->writefd.events = WRITE_COND;
- watch->writefd.revents = 0;
- watch->write_added = FALSE;
-
- g_source_add_poll ((GSource *) watch, &watch->readfd);
-}
-
-/**
- * gst_rtsp_watch_attach:
- * @watch: a #GstRTSPWatch
- * @context: a GMainContext (if NULL, the default context will be used)
- *
- * Adds a #GstRTSPWatch to a context so that it will be executed within that context.
- *
- * Returns: the ID (greater than 0) for the watch within the GMainContext.
- *
- * Since: 0.10.23
- */
-guint
-gst_rtsp_watch_attach (GstRTSPWatch * watch, GMainContext * context)
-{
- g_return_val_if_fail (watch != NULL, 0);
-
- return g_source_attach ((GSource *) watch, context);
-}
-
-/**
- * gst_rtsp_watch_unref:
- * @watch: a #GstRTSPWatch
- *
- * Decreases the reference count of @watch by one. If the resulting reference
- * count is zero the watch and associated memory will be destroyed.
- *
- * Since: 0.10.23
- */
-void
-gst_rtsp_watch_unref (GstRTSPWatch * watch)
-{
- g_return_if_fail (watch != NULL);
-
- g_source_unref ((GSource *) watch);
-}
-
-/**
- * gst_rtsp_watch_write_data:
- * @watch: a #GstRTSPWatch
- * @data: the data to queue
- * @size: the size of @data
- * @id: location for a message ID or %NULL
- *
- * Write @data using the connection of the @watch. If it cannot be sent
- * immediately, it will be queued for transmission in @watch. The contents of
- * @message will then be serialized and transmitted when the connection of the
- * @watch becomes writable. In case the @message is queued, the ID returned in
- * @id will be non-zero and used as the ID argument in the message_sent
- * callback.
- *
- * This function will take ownership of @data and g_free() it after use.
- *
- * Returns: #GST_RTSP_OK on success.
- *
- * Since: 0.10.25
- */
-GstRTSPResult
-gst_rtsp_watch_write_data (GstRTSPWatch * watch, const guint8 * data,
- guint size, guint * id)
-{
- GstRTSPResult res;
- GstRTSPRec *rec;
- guint off = 0;
-
- g_return_val_if_fail (watch != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (data != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (size != 0, GST_RTSP_EINVAL);
-
- g_mutex_lock (watch->mutex);
-
- if (watch->messages->length == 0) {
- res = write_bytes (watch->writefd.fd, data, &off, size);
- if (res != GST_RTSP_EINTR) {
- if (id != NULL)
- *id = 0;
- g_free ((gpointer) data);
- goto done;
- }
- }
-
- /* make a record with the data and id */
- rec = g_slice_new (GstRTSPRec);
- if (off == 0) {
- rec->data = (guint8 *) data;
- rec->size = size;
- } else {
- rec->data = g_memdup (data + off, size - off);
- rec->size = size - off;
- g_free ((gpointer) data);
- }
-
- do {
- /* make sure rec->id is never 0 */
- rec->id = ++watch->id;
- } while (G_UNLIKELY (rec->id == 0));
-
- /* add the record to a queue. FIXME we would like to have an upper limit here */
- g_queue_push_head (watch->messages, rec);
-
- /* make sure the main context will now also check for writability on the
- * socket */
- if (!watch->write_added) {
- g_source_add_poll ((GSource *) watch, &watch->writefd);
- watch->write_added = TRUE;
- }
-
- if (id != NULL)
- *id = rec->id;
- res = GST_RTSP_OK;
-
-done:
- g_mutex_unlock (watch->mutex);
- return res;
-}
-
-/**
- * gst_rtsp_watch_send_message:
- * @watch: a #GstRTSPWatch
- * @message: a #GstRTSPMessage
- * @id: location for a message ID or %NULL
- *
- * Send a @message using the connection of the @watch. If it cannot be sent
- * immediately, it will be queued for transmission in @watch. The contents of
- * @message will then be serialized and transmitted when the connection of the
- * @watch becomes writable. In case the @message is queued, the ID returned in
- * @id will be non-zero and used as the ID argument in the message_sent
- * callback.
- *
- * Returns: #GST_RTSP_OK on success.
- *
- * Since: 0.10.25
- */
-GstRTSPResult
-gst_rtsp_watch_send_message (GstRTSPWatch * watch, GstRTSPMessage * message,
- guint * id)
-{
- GString *str;
- guint size;
-
- g_return_val_if_fail (watch != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (message != NULL, GST_RTSP_EINVAL);
-
- /* make a record with the message as a string and id */
- str = message_to_string (watch->conn, message);
- size = str->len;
- return gst_rtsp_watch_write_data (watch,
- (guint8 *) g_string_free (str, FALSE), size, id);
-}
-
-/**
- * gst_rtsp_watch_queue_data:
- * @watch: a #GstRTSPWatch
- * @data: the data to queue
- * @size: the size of @data
- *
- * Queue @data for transmission in @watch. It will be transmitted when the
- * connection of the @watch becomes writable.
- *
- * This function will take ownership of @data and g_free() it after use.
- *
- * The return value of this function will be used as the id argument in the
- * message_sent callback.
- *
- * Deprecated: Use gst_rtsp_watch_write_data()
- *
- * Returns: an id.
- *
- * Since: 0.10.24
- */
-#ifndef GST_REMOVE_DEPRECATED
-guint
-gst_rtsp_watch_queue_data (GstRTSPWatch * watch, const guint8 * data,
- guint size)
-{
- GstRTSPRec *rec;
-
- g_return_val_if_fail (watch != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (data != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (size != 0, GST_RTSP_EINVAL);
-
- g_mutex_lock (watch->mutex);
-
- /* make a record with the data and id */
- rec = g_slice_new (GstRTSPRec);
- rec->data = (guint8 *) data;
- rec->size = size;
- do {
- /* make sure rec->id is never 0 */
- rec->id = ++watch->id;
- } while (G_UNLIKELY (rec->id == 0));
-
- /* add the record to a queue. FIXME we would like to have an upper limit here */
- g_queue_push_head (watch->messages, rec);
-
- /* make sure the main context will now also check for writability on the
- * socket */
- if (!watch->write_added) {
- g_source_add_poll ((GSource *) watch, &watch->writefd);
- watch->write_added = TRUE;
- }
-
- g_mutex_unlock (watch->mutex);
- return rec->id;
-}
-#endif /* GST_REMOVE_DEPRECATED */
-
-/**
- * gst_rtsp_watch_queue_message:
- * @watch: a #GstRTSPWatch
- * @message: a #GstRTSPMessage
- *
- * Queue a @message for transmission in @watch. The contents of this
- * message will be serialized and transmitted when the connection of the
- * @watch becomes writable.
- *
- * The return value of this function will be used as the id argument in the
- * message_sent callback.
- *
- * Deprecated: Use gst_rtsp_watch_send_message()
- *
- * Returns: an id.
- *
- * Since: 0.10.23
- */
-#ifndef GST_REMOVE_DEPRECATED
-guint
-gst_rtsp_watch_queue_message (GstRTSPWatch * watch, GstRTSPMessage * message)
-{
- GString *str;
- guint size;
-
- g_return_val_if_fail (watch != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (message != NULL, GST_RTSP_EINVAL);
-
- /* make a record with the message as a string and id */
- str = message_to_string (watch->conn, message);
- size = str->len;
- return gst_rtsp_watch_queue_data (watch,
- (guint8 *) g_string_free (str, FALSE), size);
-}
-#endif /* GST_REMOVE_DEPRECATED */
diff --git a/gst-libs/gst/rtsp/gstrtspconnection.h b/gst-libs/gst/rtsp/gstrtspconnection.h
deleted file mode 100644
index c811b127..00000000
--- a/gst-libs/gst/rtsp/gstrtspconnection.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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>
-
-G_BEGIN_DECLS
-
-/**
- * GstRTSPConnection:
- *
- * Opaque RTSP connection object.
- */
-typedef struct _GstRTSPConnection GstRTSPConnection;
-
-/* opening/closing a connection */
-GstRTSPResult gst_rtsp_connection_create (const GstRTSPUrl *url, GstRTSPConnection **conn);
-GstRTSPResult gst_rtsp_connection_create_from_fd (gint fd,
- const gchar * ip,
- guint16 port,
- const gchar * initial_buffer,
- GstRTSPConnection ** conn);
-GstRTSPResult gst_rtsp_connection_accept (gint sock, GstRTSPConnection **conn);
-GstRTSPResult gst_rtsp_connection_connect (GstRTSPConnection *conn, GTimeVal *timeout);
-GstRTSPResult gst_rtsp_connection_close (GstRTSPConnection *conn);
-GstRTSPResult gst_rtsp_connection_free (GstRTSPConnection *conn);
-
-
-/* sending/receiving raw bytes */
-GstRTSPResult gst_rtsp_connection_read (GstRTSPConnection * conn, guint8 * data,
- guint size, GTimeVal * timeout);
-GstRTSPResult gst_rtsp_connection_write (GstRTSPConnection * conn, const guint8 * data,
- guint size, GTimeVal * timeout);
-
-/* sending/receiving messages */
-GstRTSPResult gst_rtsp_connection_send (GstRTSPConnection *conn, GstRTSPMessage *message,
- GTimeVal *timeout);
-GstRTSPResult gst_rtsp_connection_receive (GstRTSPConnection *conn, GstRTSPMessage *message,
- GTimeVal *timeout);
-
-/* status management */
-GstRTSPResult gst_rtsp_connection_poll (GstRTSPConnection *conn, GstRTSPEvent events,
- GstRTSPEvent *revents, GTimeVal *timeout);
-
-/* reset the timeout */
-GstRTSPResult gst_rtsp_connection_next_timeout (GstRTSPConnection *conn, GTimeVal *timeout);
-GstRTSPResult gst_rtsp_connection_reset_timeout (GstRTSPConnection *conn);
-
-/* flushing state */
-GstRTSPResult gst_rtsp_connection_flush (GstRTSPConnection *conn, gboolean flush);
-
-/* HTTP proxy support */
-GstRTSPResult gst_rtsp_connection_set_proxy (GstRTSPConnection *conn,
- const gchar *host, guint port);
-
-/* configure authentication data */
-GstRTSPResult gst_rtsp_connection_set_auth (GstRTSPConnection *conn, GstRTSPAuthMethod method,
- const gchar *user, const gchar *pass);
-
-void gst_rtsp_connection_set_auth_param (GstRTSPConnection *conn,
- const gchar * param,
- const gchar *value);
-void gst_rtsp_connection_clear_auth_params (GstRTSPConnection *conn);
-
-/* configure DSCP */
-GstRTSPResult gst_rtsp_connection_set_qos_dscp (GstRTSPConnection *conn,
- guint qos_dscp);
-
-/* accessors */
-GstRTSPUrl * gst_rtsp_connection_get_url (const GstRTSPConnection *conn);
-const gchar * gst_rtsp_connection_get_ip (const GstRTSPConnection *conn);
-void gst_rtsp_connection_set_ip (GstRTSPConnection *conn, const gchar *ip);
-
-gint gst_rtsp_connection_get_readfd (const GstRTSPConnection *conn);
-gint gst_rtsp_connection_get_writefd (const GstRTSPConnection *conn);
-
-void gst_rtsp_connection_set_http_mode (GstRTSPConnection *conn,
- gboolean enable);
-
-/* tunneling */
-void gst_rtsp_connection_set_tunneled (GstRTSPConnection *conn, gboolean tunneled);
-gboolean gst_rtsp_connection_is_tunneled (const GstRTSPConnection *conn);
-
-const gchar * gst_rtsp_connection_get_tunnelid (const GstRTSPConnection *conn);
-GstRTSPResult gst_rtsp_connection_do_tunnel (GstRTSPConnection *conn, GstRTSPConnection *conn2);
-
-/* 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 occured
- * @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 occured with more information than
- * the @error callback. Since 0.10.25
- *
- * Callback functions from a #GstRTSPWatch.
- *
- * Since: 0.10.23
- */
-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);
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING - 1];
-} GstRTSPWatchFuncs;
-
-GstRTSPWatch * gst_rtsp_watch_new (GstRTSPConnection *conn,
- GstRTSPWatchFuncs *funcs,
- gpointer user_data,
- GDestroyNotify notify);
-void gst_rtsp_watch_reset (GstRTSPWatch *watch);
-void gst_rtsp_watch_unref (GstRTSPWatch *watch);
-
-guint gst_rtsp_watch_attach (GstRTSPWatch *watch,
- GMainContext *context);
-
-GstRTSPResult gst_rtsp_watch_write_data (GstRTSPWatch *watch,
- const guint8 *data,
- guint size, guint *id);
-GstRTSPResult gst_rtsp_watch_send_message (GstRTSPWatch *watch,
- GstRTSPMessage *message,
- guint *id);
-
-#ifndef GST_DISABLE_DEPRECATED
-guint gst_rtsp_watch_queue_data (GstRTSPWatch * watch,
- const guint8 * data,
- guint size);
-guint gst_rtsp_watch_queue_message (GstRTSPWatch *watch,
- GstRTSPMessage *message);
-#endif
-
-G_END_DECLS
-
-#endif /* __GST_RTSP_CONNECTION_H__ */
diff --git a/gst-libs/gst/rtsp/gstrtspdefs.c b/gst-libs/gst/rtsp/gstrtspdefs.c
deleted file mode 100644
index 09de33b8..00000000
--- a/gst-libs/gst/rtsp/gstrtspdefs.c
+++ /dev/null
@@ -1,510 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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.
- */
-
-/**
- * SECTION:gstrtspdefs
- * @short_description: common RTSP defines
- * @see_also: gstrtspurl, gstrtspconnection
- *
- * <refsect2>
- * <para>
- * Provides common defines for the RTSP library.
- * </para>
- * </refsect2>
- *
- * Last reviewed on 2007-07-24 (0.10.14)
- */
-
-#include <errno.h>
-
-#include "gstrtspdefs.h"
-
-#ifdef G_OS_WIN32
-#include <winsock2.h>
-#else
-#include <netdb.h>
-#endif
-
-struct rtsp_header
-{
- const gchar *name;
- gboolean multiple;
-};
-
-static const gchar *rtsp_results[] = {
- "OK",
- /* errors */
- "Generic error",
- "Invalid parameter specified",
- "Operation interrupted",
- "Out of memory",
- "Cannot resolve host",
- "Function not implemented",
- "System error: %s",
- "Parse error",
- "Error on WSAStartup",
- "Windows sockets are not version 0x202",
- "Received end-of-file",
- "Network error: %s",
- "Host is not a valid IP address",
- "Timeout while waiting for server response",
- "Tunnel GET request received",
- "Tunnel POST request received",
- "Unknown error (%d)",
- NULL
-};
-
-static const gchar *rtsp_methods[] = {
- "DESCRIBE",
- "ANNOUNCE",
- "GET_PARAMETER",
- "OPTIONS",
- "PAUSE",
- "PLAY",
- "RECORD",
- "REDIRECT",
- "SETUP",
- "SET_PARAMETER",
- "TEARDOWN",
- "GET",
- "POST",
- NULL
-};
-
-static struct rtsp_header rtsp_headers[] = {
- {"Accept", TRUE},
- {"Accept-Encoding", TRUE},
- {"Accept-Language", TRUE},
- {"Allow", TRUE},
- {"Authorization", FALSE},
- {"Bandwidth", FALSE},
- {"Blocksize", FALSE},
- {"Cache-Control", TRUE},
- {"Conference", FALSE},
- {"Connection", TRUE},
- {"Content-Base", FALSE},
- {"Content-Encoding", TRUE},
- {"Content-Language", TRUE},
- {"Content-Length", FALSE},
- {"Content-Location", FALSE},
- {"Content-Type", FALSE},
- {"CSeq", FALSE},
- {"Date", FALSE},
- {"Expires", FALSE},
- {"From", FALSE},
- {"If-Modified-Since", FALSE},
- {"Last-Modified", FALSE},
- {"Proxy-Authenticate", TRUE},
- {"Proxy-Require", TRUE},
- {"Public", TRUE},
- {"Range", FALSE},
- {"Referer", FALSE},
- {"Require", TRUE},
- {"Retry-After", FALSE},
- {"RTP-Info", TRUE},
- {"Scale", FALSE},
- {"Session", FALSE},
- {"Server", FALSE},
- {"Speed", FALSE},
- {"Transport", TRUE},
- {"Unsupported", FALSE},
- {"User-Agent", FALSE},
- {"Via", TRUE},
- {"WWW-Authenticate", TRUE},
-
- /* Real extensions */
- {"ClientChallenge", FALSE},
- {"RealChallenge1", FALSE},
- {"RealChallenge2", FALSE},
- {"RealChallenge3", FALSE},
- {"Subscribe", FALSE},
- {"Alert", FALSE},
- {"ClientID", FALSE},
- {"CompanyID", FALSE},
- {"GUID", FALSE},
- {"RegionData", FALSE},
- {"SupportsMaximumASMBandwidth", FALSE},
- {"Language", FALSE},
- {"PlayerStarttime", FALSE},
-
- /* Since 0.10.16 */
- {"Location", FALSE},
-
- /* Since 0.10.23 */
- {"ETag", FALSE},
- {"If-Match", TRUE},
-
- /* WM extensions [MS-RTSP] Since 0.10.23 */
- {"Accept-Charset", TRUE},
- {"Supported", TRUE},
- {"Vary", TRUE},
- {"X-Accelerate-Streaming", FALSE},
- {"X-Accept-Authentication", FALSE},
- {"X-Accept-Proxy-Authentication", FALSE},
- {"X-Broadcast-Id", FALSE},
- {"X-Burst-Streaming", FALSE},
- {"X-Notice", FALSE},
- {"X-Player-Lag-Time", FALSE},
- {"X-Playlist", FALSE},
- {"X-Playlist-Change-Notice", FALSE},
- {"X-Playlist-Gen-Id", FALSE},
- {"X-Playlist-Seek-Id", FALSE},
- {"X-Proxy-Client-Agent", FALSE},
- {"X-Proxy-Client-Verb", FALSE},
- {"X-Receding-PlaylistChange", FALSE},
- {"X-RTP-Info", FALSE},
- {"X-StartupProfile", FALSE},
-
- /* Since 0.10.24 */
- {"Timestamp", FALSE},
-
- /* Since 0.10.25 */
- {"Authentication-Info", FALSE},
- {"Host", FALSE},
- {"Pragma", TRUE},
- {"X-Server-IP-Address", FALSE},
- {"X-Sessioncookie", FALSE},
-
- {NULL, FALSE}
-};
-
-#define DEF_STATUS(c, t) \
- g_hash_table_insert (statuses, GUINT_TO_POINTER(c), t)
-
-static GHashTable *
-rtsp_init_status (void)
-{
- GHashTable *statuses = g_hash_table_new (NULL, NULL);
-
- DEF_STATUS (GST_RTSP_STS_CONTINUE, "Continue");
- DEF_STATUS (GST_RTSP_STS_OK, "OK");
- DEF_STATUS (GST_RTSP_STS_CREATED, "Created");
- DEF_STATUS (GST_RTSP_STS_LOW_ON_STORAGE, "Low on Storage Space");
- DEF_STATUS (GST_RTSP_STS_MULTIPLE_CHOICES, "Multiple Choices");
- DEF_STATUS (GST_RTSP_STS_MOVED_PERMANENTLY, "Moved Permanently");
- DEF_STATUS (GST_RTSP_STS_MOVE_TEMPORARILY, "Move Temporarily");
- DEF_STATUS (GST_RTSP_STS_SEE_OTHER, "See Other");
- DEF_STATUS (GST_RTSP_STS_NOT_MODIFIED, "Not Modified");
- DEF_STATUS (GST_RTSP_STS_USE_PROXY, "Use Proxy");
- DEF_STATUS (GST_RTSP_STS_BAD_REQUEST, "Bad Request");
- DEF_STATUS (GST_RTSP_STS_UNAUTHORIZED, "Unauthorized");
- DEF_STATUS (GST_RTSP_STS_PAYMENT_REQUIRED, "Payment Required");
- DEF_STATUS (GST_RTSP_STS_FORBIDDEN, "Forbidden");
- DEF_STATUS (GST_RTSP_STS_NOT_FOUND, "Not Found");
- DEF_STATUS (GST_RTSP_STS_METHOD_NOT_ALLOWED, "Method Not Allowed");
- DEF_STATUS (GST_RTSP_STS_NOT_ACCEPTABLE, "Not Acceptable");
- DEF_STATUS (GST_RTSP_STS_PROXY_AUTH_REQUIRED,
- "Proxy Authentication Required");
- DEF_STATUS (GST_RTSP_STS_REQUEST_TIMEOUT, "Request Time-out");
- DEF_STATUS (GST_RTSP_STS_GONE, "Gone");
- DEF_STATUS (GST_RTSP_STS_LENGTH_REQUIRED, "Length Required");
- DEF_STATUS (GST_RTSP_STS_PRECONDITION_FAILED, "Precondition Failed");
- DEF_STATUS (GST_RTSP_STS_REQUEST_ENTITY_TOO_LARGE,
- "Request Entity Too Large");
- DEF_STATUS (GST_RTSP_STS_REQUEST_URI_TOO_LARGE, "Request-URI Too Large");
- DEF_STATUS (GST_RTSP_STS_UNSUPPORTED_MEDIA_TYPE, "Unsupported Media Type");
- DEF_STATUS (GST_RTSP_STS_PARAMETER_NOT_UNDERSTOOD,
- "Parameter Not Understood");
- DEF_STATUS (GST_RTSP_STS_CONFERENCE_NOT_FOUND, "Conference Not Found");
- DEF_STATUS (GST_RTSP_STS_NOT_ENOUGH_BANDWIDTH, "Not Enough Bandwidth");
- DEF_STATUS (GST_RTSP_STS_SESSION_NOT_FOUND, "Session Not Found");
- DEF_STATUS (GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE,
- "Method Not Valid in This State");
- DEF_STATUS (GST_RTSP_STS_HEADER_FIELD_NOT_VALID_FOR_RESOURCE,
- "Header Field Not Valid for Resource");
- DEF_STATUS (GST_RTSP_STS_INVALID_RANGE, "Invalid Range");
- DEF_STATUS (GST_RTSP_STS_PARAMETER_IS_READONLY, "Parameter Is Read-Only");
- DEF_STATUS (GST_RTSP_STS_AGGREGATE_OPERATION_NOT_ALLOWED,
- "Aggregate operation not allowed");
- DEF_STATUS (GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED,
- "Only aggregate operation allowed");
- DEF_STATUS (GST_RTSP_STS_UNSUPPORTED_TRANSPORT, "Unsupported transport");
- DEF_STATUS (GST_RTSP_STS_DESTINATION_UNREACHABLE, "Destination unreachable");
- DEF_STATUS (GST_RTSP_STS_INTERNAL_SERVER_ERROR, "Internal Server Error");
- DEF_STATUS (GST_RTSP_STS_NOT_IMPLEMENTED, "Not Implemented");
- DEF_STATUS (GST_RTSP_STS_BAD_GATEWAY, "Bad Gateway");
- DEF_STATUS (GST_RTSP_STS_SERVICE_UNAVAILABLE, "Service Unavailable");
- DEF_STATUS (GST_RTSP_STS_GATEWAY_TIMEOUT, "Gateway Time-out");
- DEF_STATUS (GST_RTSP_STS_RTSP_VERSION_NOT_SUPPORTED,
- "RTSP Version not supported");
- DEF_STATUS (GST_RTSP_STS_OPTION_NOT_SUPPORTED, "Option not supported");
-
- return statuses;
-}
-
-/**
- * gst_rtsp_strresult:
- * @result: a #GstRTSPResult
- *
- * Convert @result in a human readable string.
- *
- * Returns: a newly allocated string. g_free() after usage.
- */
-gchar *
-gst_rtsp_strresult (GstRTSPResult result)
-{
- gint idx;
- gchar *res;
-
- idx = ABS (result);
- idx = CLAMP (idx, 0, -GST_RTSP_ELAST);
-
- switch (idx) {
-#ifdef G_OS_WIN32
- case -GST_RTSP_ESYS:
- case -GST_RTSP_ENET:
- {
- gchar *msg = g_win32_error_message (WSAGetLastError ());
- res = g_strdup_printf (rtsp_results[idx], msg);
- g_free (msg);
- break;
- }
-#else
- case -GST_RTSP_ESYS:
- res = g_strdup_printf (rtsp_results[idx], g_strerror (errno));
- break;
- case -GST_RTSP_ENET:
- res = g_strdup_printf (rtsp_results[idx], hstrerror (h_errno));
-#endif
- break;
- case -GST_RTSP_ELAST:
- res = g_strdup_printf (rtsp_results[idx], result);
- break;
- default:
- res = g_strdup (rtsp_results[idx]);
- break;
- }
- return res;
-}
-
-/**
- * gst_rtsp_method_as_text:
- * @method: a #GstRTSPMethod
- *
- * Convert @method to a string.
- *
- * Returns: a string representation of @method.
- */
-const gchar *
-gst_rtsp_method_as_text (GstRTSPMethod method)
-{
- gint i;
-
- if (method == GST_RTSP_INVALID)
- return NULL;
-
- i = 0;
- while ((method & 1) == 0) {
- i++;
- method >>= 1;
- }
- return rtsp_methods[i];
-}
-
-/**
- * gst_rtsp_version_as_text:
- * @version: a #GstRTSPVersion
- *
- * Convert @version to a string.
- *
- * Returns: a string representation of @version.
- */
-const gchar *
-gst_rtsp_version_as_text (GstRTSPVersion version)
-{
- switch (version) {
- case GST_RTSP_VERSION_1_0:
- return "1.0";
-
- case GST_RTSP_VERSION_1_1:
- return "1.1";
-
- default:
- return "0.0";
- }
-}
-
-/**
- * gst_rtsp_header_as_text:
- * @field: a #GstRTSPHeaderField
- *
- * Convert @field to a string.
- *
- * Returns: a string representation of @field.
- */
-const gchar *
-gst_rtsp_header_as_text (GstRTSPHeaderField field)
-{
- if (field == GST_RTSP_HDR_INVALID)
- return NULL;
- else
- return rtsp_headers[field - 1].name;
-}
-
-/**
- * gst_rtsp_status_as_text:
- * @code: a #GstRTSPStatusCode
- *
- * Convert @code to a string.
- *
- * Returns: a string representation of @code.
- */
-const gchar *
-gst_rtsp_status_as_text (GstRTSPStatusCode code)
-{
- static GHashTable *statuses;
-
- if (G_UNLIKELY (statuses == NULL))
- statuses = rtsp_init_status ();
-
- return g_hash_table_lookup (statuses, GUINT_TO_POINTER (code));
-}
-
-/**
- * gst_rtsp_find_header_field:
- * @header: a header string
- *
- * Convert @header to a #GstRTSPHeaderField.
- *
- * Returns: a #GstRTSPHeaderField for @header or #GST_RTSP_HDR_INVALID if the
- * header field is unknown.
- */
-GstRTSPHeaderField
-gst_rtsp_find_header_field (const gchar * header)
-{
- gint idx;
-
- for (idx = 0; rtsp_headers[idx].name; idx++) {
- if (g_ascii_strcasecmp (rtsp_headers[idx].name, header) == 0) {
- return idx + 1;
- }
- }
- return GST_RTSP_HDR_INVALID;
-}
-
-/**
- * gst_rtsp_find_method:
- * @method: a method
- *
- * Convert @method to a #GstRTSPMethod.
- *
- * Returns: a #GstRTSPMethod for @method or #GST_RTSP_INVALID if the
- * method is unknown.
- */
-GstRTSPMethod
-gst_rtsp_find_method (const gchar * method)
-{
- gint idx;
-
- for (idx = 0; rtsp_methods[idx]; idx++) {
- if (g_ascii_strcasecmp (rtsp_methods[idx], method) == 0) {
- return (1 << idx);
- }
- }
- return GST_RTSP_INVALID;
-}
-
-/**
- * gst_rtsp_options_as_text:
- * @options: one or more #GstRTSPMethod
- *
- * Convert @options to a string.
- *
- * Returns: a new string of @options. g_free() after usage.
- *
- * Since: 0.10.23
- */
-gchar *
-gst_rtsp_options_as_text (GstRTSPMethod options)
-{
- GString *str;
-
- str = g_string_new ("");
-
- if (options & GST_RTSP_OPTIONS)
- g_string_append (str, "OPTIONS, ");
- if (options & GST_RTSP_DESCRIBE)
- g_string_append (str, "DESCRIBE, ");
- if (options & GST_RTSP_ANNOUNCE)
- g_string_append (str, "ANNOUNCE, ");
- if (options & GST_RTSP_GET_PARAMETER)
- g_string_append (str, "GET_PARAMETER, ");
- if (options & GST_RTSP_PAUSE)
- g_string_append (str, "PAUSE, ");
- if (options & GST_RTSP_PLAY)
- g_string_append (str, "PLAY, ");
- if (options & GST_RTSP_RECORD)
- g_string_append (str, "RECORD, ");
- if (options & GST_RTSP_REDIRECT)
- g_string_append (str, "REDIRECT, ");
- if (options & GST_RTSP_SETUP)
- g_string_append (str, "SETUP, ");
- if (options & GST_RTSP_SET_PARAMETER)
- g_string_append (str, "SET_PARAMETER, ");
- if (options & GST_RTSP_TEARDOWN)
- g_string_append (str, "TEARDOWN, ");
-
- /* remove trailing ", " if there is one */
- if (str->len > 2)
- str = g_string_truncate (str, str->len - 2);
-
- return g_string_free (str, FALSE);
-}
-
-/**
- * gst_rtsp_header_allow_multiple:
- * @field: a #GstRTSPHeaderField
- *
- * Check whether @field may appear multiple times in a message.
- *
- * Returns: %TRUE if multiple headers are allowed.
- *
- * Since: 0.10.25
- */
-gboolean
-gst_rtsp_header_allow_multiple (GstRTSPHeaderField field)
-{
- if (field == GST_RTSP_HDR_INVALID)
- return FALSE;
- else
- return rtsp_headers[field - 1].multiple;
-}
diff --git a/gst-libs/gst/rtsp/gstrtspdefs.h b/gst-libs/gst/rtsp/gstrtspdefs.h
deleted file mode 100644
index 4986c904..00000000
--- a/gst-libs/gst/rtsp/gstrtspdefs.h
+++ /dev/null
@@ -1,396 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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 <glib.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 occured
- * @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 occured
- * @GST_RTSP_ENOTIMPL: function not implemented
- * @GST_RTSP_ESYS: a system error occured, errno contains more details
- * @GST_RTSP_EPARSE: a persing error occured
- * @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 occured, h_errno contains more details
- * @GST_RTSP_ENOTIP: the host is not an IP host
- * @GST_RTSP_ETIMEOUT: a timeout occured
- * @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. Since 0.10.25
- *
- * The supported RTSP versions.
- */
-typedef enum {
- GST_RTSP_VERSION_INVALID = 0x00,
- GST_RTSP_VERSION_1_0 = 0x10,
- GST_RTSP_VERSION_1_1 = 0x11
-} 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). Since 0.10.25
- * @GST_RTSP_POST: the POST method (HTTP). Since 0.10.25
- *
- * 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
-
-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, /* Referer 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 */
-
- /* Since 0.10.16 */
- GST_RTSP_HDR_LOCATION, /* Location */
-
- /* Since 0.10.23 */
- GST_RTSP_HDR_ETAG, /* ETag */
- GST_RTSP_HDR_IF_MATCH, /* If-Match */
-
- /* WM extensions [MS-RTSP] Since 0.10.23 */
- 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 */
-
- /* Since 0.10.24 */
- GST_RTSP_HDR_TIMESTAMP, /* Timestamp */
-
- /* Since 0.10.25 */
- 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_LAST
-} GstRTSPHeaderField;
-
-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_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;
-
-gchar* gst_rtsp_strresult (GstRTSPResult result);
-
-const gchar* gst_rtsp_method_as_text (GstRTSPMethod method);
-const gchar* gst_rtsp_version_as_text (GstRTSPVersion version);
-const gchar* gst_rtsp_header_as_text (GstRTSPHeaderField field);
-const gchar* gst_rtsp_status_as_text (GstRTSPStatusCode code);
-
-gchar* gst_rtsp_options_as_text (GstRTSPMethod options);
-
-GstRTSPHeaderField gst_rtsp_find_header_field (const gchar *header);
-GstRTSPMethod gst_rtsp_find_method (const gchar *method);
-
-gboolean gst_rtsp_header_allow_multiple (GstRTSPHeaderField field);
-
-G_END_DECLS
-
-#endif /* __GST_RTSP_DEFS_H__ */
diff --git a/gst-libs/gst/rtsp/gstrtspextension.c b/gst-libs/gst/rtsp/gstrtspextension.c
deleted file mode 100644
index 140f82fc..00000000
--- a/gst-libs/gst/rtsp/gstrtspextension.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/* GStreamer RTSP extension
- * Copyright (C) 2007 Wim Taymans <wim.taymans@gmail.com>
- *
- * gstrtspextension.c: RTSP extension mechanism
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-/**
- * SECTION:gstrtspextension
- * @short_description: Interface for extending RTSP protocols
- *
- * <refsect2>
- * <para>
- * </para>
- * </refsect2>
- *
- * Last reviewed on 2007-07-25 (0.10.14)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstrtsp-marshal.h"
-#include "gstrtsp-enumtypes.h"
-#include "gstrtspextension.h"
-
-static void gst_rtsp_extension_iface_init (GstRTSPExtension * iface);
-
-enum
-{
- SIGNAL_SEND,
- LAST_SIGNAL
-};
-
-static guint gst_rtsp_extension_signals[LAST_SIGNAL] = { 0 };
-
-GType
-gst_rtsp_extension_get_type (void)
-{
- static GType gst_rtsp_extension_type = 0;
-
- if (!gst_rtsp_extension_type) {
- static const GTypeInfo gst_rtsp_extension_info = {
- sizeof (GstRTSPExtensionInterface),
- (GBaseInitFunc) gst_rtsp_extension_iface_init,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- 0,
- NULL,
- };
-
- gst_rtsp_extension_type = g_type_register_static (G_TYPE_INTERFACE,
- "GstRTSPExtension", &gst_rtsp_extension_info, 0);
- }
- return gst_rtsp_extension_type;
-}
-
-static void
-gst_rtsp_extension_iface_init (GstRTSPExtension * iface)
-{
- static gboolean initialized = FALSE;
-
- if (!initialized) {
- gst_rtsp_extension_signals[SIGNAL_SEND] =
- g_signal_new ("send", G_TYPE_FROM_CLASS (iface),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRTSPExtensionInterface,
- send), NULL, NULL, gst_rtsp_marshal_ENUM__POINTER_POINTER,
- GST_TYPE_RTSP_RESULT, 2, G_TYPE_POINTER, G_TYPE_POINTER);
- initialized = TRUE;
- }
-}
-
-gboolean
-gst_rtsp_extension_detect_server (GstRTSPExtension * ext, GstRTSPMessage * resp)
-{
- GstRTSPExtensionInterface *iface;
- gboolean res = TRUE;
-
- iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
- if (iface->detect_server)
- res = iface->detect_server (ext, resp);
-
- return res;
-}
-
-GstRTSPResult
-gst_rtsp_extension_before_send (GstRTSPExtension * ext, GstRTSPMessage * req)
-{
- GstRTSPExtensionInterface *iface;
- GstRTSPResult res = GST_RTSP_OK;
-
- iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
- if (iface->before_send)
- res = iface->before_send (ext, req);
-
- return res;
-}
-
-GstRTSPResult
-gst_rtsp_extension_after_send (GstRTSPExtension * ext, GstRTSPMessage * req,
- GstRTSPMessage * resp)
-{
- GstRTSPExtensionInterface *iface;
- GstRTSPResult res = GST_RTSP_OK;
-
- iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
- if (iface->after_send)
- res = iface->after_send (ext, req, resp);
-
- return res;
-}
-
-GstRTSPResult
-gst_rtsp_extension_parse_sdp (GstRTSPExtension * ext, GstSDPMessage * sdp,
- GstStructure * s)
-{
- GstRTSPExtensionInterface *iface;
- GstRTSPResult res = GST_RTSP_OK;
-
- iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
- if (iface->parse_sdp)
- res = iface->parse_sdp (ext, sdp, s);
-
- return res;
-}
-
-GstRTSPResult
-gst_rtsp_extension_setup_media (GstRTSPExtension * ext, GstSDPMedia * media)
-{
- GstRTSPExtensionInterface *iface;
- GstRTSPResult res = GST_RTSP_OK;
-
- iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
- if (iface->setup_media)
- res = iface->setup_media (ext, media);
-
- return res;
-}
-
-gboolean
-gst_rtsp_extension_configure_stream (GstRTSPExtension * ext, GstCaps * caps)
-{
- GstRTSPExtensionInterface *iface;
- gboolean res = TRUE;
-
- iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
- if (iface->configure_stream)
- res = iface->configure_stream (ext, caps);
-
- return res;
-}
-
-GstRTSPResult
-gst_rtsp_extension_get_transports (GstRTSPExtension * ext,
- GstRTSPLowerTrans protocols, gchar ** transport)
-{
- GstRTSPExtensionInterface *iface;
- GstRTSPResult res = GST_RTSP_OK;
-
- iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
- if (iface->get_transports)
- res = iface->get_transports (ext, protocols, transport);
-
- return res;
-}
-
-GstRTSPResult
-gst_rtsp_extension_stream_select (GstRTSPExtension * ext, GstRTSPUrl * url)
-{
- GstRTSPExtensionInterface *iface;
- GstRTSPResult res = GST_RTSP_OK;
-
- iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
- if (iface->stream_select)
- res = iface->stream_select (ext, url);
-
- return res;
-}
-
-GstRTSPResult
-gst_rtsp_extension_receive_request (GstRTSPExtension * ext,
- GstRTSPMessage * msg)
-{
- GstRTSPExtensionInterface *iface;
- GstRTSPResult res = GST_RTSP_ENOTIMPL;
-
- iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
- if (iface->receive_request)
- res = iface->receive_request (ext, msg);
-
- return res;
-}
-
-GstRTSPResult
-gst_rtsp_extension_send (GstRTSPExtension * ext, GstRTSPMessage * req,
- GstRTSPMessage * resp)
-{
- GstRTSPResult res = GST_RTSP_OK;
-
- g_signal_emit (ext, gst_rtsp_extension_signals[SIGNAL_SEND], 0,
- req, resp, &res);
-
- return res;
-}
diff --git a/gst-libs/gst/rtsp/gstrtspextension.h b/gst-libs/gst/rtsp/gstrtspextension.h
deleted file mode 100644
index a697c90c..00000000
--- a/gst-libs/gst/rtsp/gstrtspextension.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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) \
- (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_EXTENSION, GstRTSPExtension))
-#define GST_IS_RTSP_EXTENSION(obj) \
- (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_EXTENSION))
-#define GST_RTSP_EXTENSION_GET_IFACE(inst) \
- (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_RTSP_EXTENSION, GstRTSPExtensionInterface))
-
-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 - 1];
-};
-
-GType gst_rtsp_extension_get_type (void);
-
-/* invoke vfunction on interface */
-gboolean gst_rtsp_extension_detect_server (GstRTSPExtension *ext, GstRTSPMessage *resp);
-
-GstRTSPResult gst_rtsp_extension_before_send (GstRTSPExtension *ext, GstRTSPMessage *req);
-GstRTSPResult gst_rtsp_extension_after_send (GstRTSPExtension *ext, GstRTSPMessage *req,
- GstRTSPMessage *resp);
-GstRTSPResult gst_rtsp_extension_parse_sdp (GstRTSPExtension *ext, GstSDPMessage *sdp,
- GstStructure *s);
-GstRTSPResult gst_rtsp_extension_setup_media (GstRTSPExtension *ext, GstSDPMedia *media);
-gboolean gst_rtsp_extension_configure_stream (GstRTSPExtension *ext, GstCaps *caps);
-GstRTSPResult gst_rtsp_extension_get_transports (GstRTSPExtension *ext, GstRTSPLowerTrans protocols,
- gchar **transport);
-GstRTSPResult gst_rtsp_extension_stream_select (GstRTSPExtension *ext, GstRTSPUrl *url);
-GstRTSPResult gst_rtsp_extension_receive_request (GstRTSPExtension *ext, GstRTSPMessage *req);
-
-/* signal emision */
-GstRTSPResult gst_rtsp_extension_send (GstRTSPExtension *ext, GstRTSPMessage *req,
- GstRTSPMessage *resp);
-
-G_END_DECLS
-
-#endif /* __GST_RTSP_EXTENSION_H__ */
diff --git a/gst-libs/gst/rtsp/gstrtspmessage.c b/gst-libs/gst/rtsp/gstrtspmessage.c
deleted file mode 100644
index 28e44049..00000000
--- a/gst-libs/gst/rtsp/gstrtspmessage.c
+++ /dev/null
@@ -1,846 +0,0 @@
-/* GStreamer
- * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com>
- * <2006> Lutz Mueller <lutz at topfrose dot de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-/*
- * 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.
- */
-
-/**
- * SECTION:gstrtspmessage
- * @short_description: RTSP messages
- * @see_also: gstrtspconnection
- *
- * <refsect2>
- * <para>
- * Provides methods for creating and parsing request, response and data messages.
- * </para>
- * </refsect2>
- *
- * Last reviewed on 2007-07-25 (0.10.14)
- */
-
-#include <string.h>
-
-#include <gst/gstutils.h>
-#include "gstrtspmessage.h"
-
-typedef struct _RTSPKeyValue
-{
- GstRTSPHeaderField field;
- gchar *value;
-} RTSPKeyValue;
-
-static void
-key_value_foreach (GArray * array, GFunc func, gpointer user_data)
-{
- guint i;
-
- g_return_if_fail (array != NULL);
-
- for (i = 0; i < array->len; i++) {
- (*func) (&g_array_index (array, RTSPKeyValue, i), user_data);
- }
-}
-
-/**
- * gst_rtsp_message_new:
- * @msg: a location for the new #GstRTSPMessage
- *
- * Create a new initialized #GstRTSPMessage. Free with gst_rtsp_message_free().
- *
- * Returns: a #GstRTSPResult.
- */
-GstRTSPResult
-gst_rtsp_message_new (GstRTSPMessage ** msg)
-{
- GstRTSPMessage *newmsg;
-
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
-
- newmsg = g_new0 (GstRTSPMessage, 1);
-
- *msg = newmsg;
-
- return gst_rtsp_message_init (newmsg);
-}
-
-/**
- * gst_rtsp_message_init:
- * @msg: a #GstRTSPMessage
- *
- * Initialize @msg. This function is mostly used when @msg is allocated on the
- * stack. The reverse operation of this is gst_rtsp_message_unset().
- *
- * Returns: a #GstRTSPResult.
- */
-GstRTSPResult
-gst_rtsp_message_init (GstRTSPMessage * msg)
-{
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
-
- gst_rtsp_message_unset (msg);
-
- msg->type = GST_RTSP_MESSAGE_INVALID;
- msg->hdr_fields = g_array_new (FALSE, FALSE, sizeof (RTSPKeyValue));
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_message_get_type:
- * @msg: a #GstRTSPMessage
- *
- * Get the message type of @msg.
- *
- * Returns: the message type.
- */
-GstRTSPMsgType
-gst_rtsp_message_get_type (GstRTSPMessage * msg)
-{
- g_return_val_if_fail (msg != NULL, GST_RTSP_MESSAGE_INVALID);
-
- return msg->type;
-}
-
-/**
- * gst_rtsp_message_new_request:
- * @msg: a location for the new #GstRTSPMessage
- * @method: the request method to use
- * @uri: the uri of the request
- *
- * Create a new #GstRTSPMessage with @method and @uri and store the result
- * request message in @msg. Free with gst_rtsp_message_free().
- *
- * Returns: a #GstRTSPResult.
- */
-GstRTSPResult
-gst_rtsp_message_new_request (GstRTSPMessage ** msg, GstRTSPMethod method,
- const gchar * uri)
-{
- GstRTSPMessage *newmsg;
-
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (uri != NULL, GST_RTSP_EINVAL);
-
- newmsg = g_new0 (GstRTSPMessage, 1);
-
- *msg = newmsg;
-
- return gst_rtsp_message_init_request (newmsg, method, uri);
-}
-
-/**
- * gst_rtsp_message_init_request:
- * @msg: a #GstRTSPMessage
- * @method: the request method to use
- * @uri: the uri of the request
- *
- * Initialize @msg as a request message with @method and @uri. To clear @msg
- * again, use gst_rtsp_message_unset().
- *
- * Returns: a #GstRTSPResult.
- */
-GstRTSPResult
-gst_rtsp_message_init_request (GstRTSPMessage * msg, GstRTSPMethod method,
- const gchar * uri)
-{
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (uri != NULL, GST_RTSP_EINVAL);
-
- gst_rtsp_message_unset (msg);
-
- msg->type = GST_RTSP_MESSAGE_REQUEST;
- msg->type_data.request.method = method;
- msg->type_data.request.uri = g_strdup (uri);
- msg->type_data.request.version = GST_RTSP_VERSION_1_0;
- msg->hdr_fields = g_array_new (FALSE, FALSE, sizeof (RTSPKeyValue));
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_message_parse_request:
- * @msg: a #GstRTSPMessage
- * @method: location to hold the method
- * @uri: location to hold the uri
- * @version: location to hold the version
- *
- * Parse the request message @msg and store the values @method, @uri and
- * @version. The result locations can be #NULL if one is not interested in its
- * value.
- *
- * @uri remains valid for as long as @msg is valid and unchanged.
- *
- * Returns: a #GstRTSPResult.
- */
-GstRTSPResult
-gst_rtsp_message_parse_request (GstRTSPMessage * msg,
- GstRTSPMethod * method, const gchar ** uri, GstRTSPVersion * version)
-{
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (msg->type == GST_RTSP_MESSAGE_REQUEST ||
- msg->type == GST_RTSP_MESSAGE_HTTP_REQUEST, GST_RTSP_EINVAL);
-
- if (method)
- *method = msg->type_data.request.method;
- if (uri)
- *uri = msg->type_data.request.uri;
- if (version)
- *version = msg->type_data.request.version;
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_message_new_response:
- * @msg: a location for the new #GstRTSPMessage
- * @code: the status code
- * @reason: the status reason or #NULL
- * @request: the request that triggered the response or #NULL
- *
- * Create a new response #GstRTSPMessage with @code and @reason and store the
- * result message in @msg. Free with gst_rtsp_message_free().
- *
- * When @reason is #NULL, the default reason for @code will be used.
- *
- * When @request is not #NULL, the relevant headers will be copied to the new
- * response message.
- *
- * Returns: a #GstRTSPResult.
- */
-GstRTSPResult
-gst_rtsp_message_new_response (GstRTSPMessage ** msg, GstRTSPStatusCode code,
- const gchar * reason, const GstRTSPMessage * request)
-{
- GstRTSPMessage *newmsg;
-
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
-
- newmsg = g_new0 (GstRTSPMessage, 1);
-
- *msg = newmsg;
-
- return gst_rtsp_message_init_response (newmsg, code, reason, request);
-}
-
-/**
- * gst_rtsp_message_init_response:
- * @msg: a #GstRTSPMessage
- * @code: the status code
- * @reason: the status reason or #NULL
- * @request: the request that triggered the response or #NULL
- *
- * Initialize @msg with @code and @reason.
- *
- * When @reason is #NULL, the default reason for @code will be used.
- *
- * When @request is not #NULL, the relevant headers will be copied to the new
- * response message.
- *
- * Returns: a #GstRTSPResult.
- */
-GstRTSPResult
-gst_rtsp_message_init_response (GstRTSPMessage * msg, GstRTSPStatusCode code,
- const gchar * reason, const GstRTSPMessage * request)
-{
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
-
- gst_rtsp_message_unset (msg);
-
- if (reason == NULL)
- reason = gst_rtsp_status_as_text (code);
-
- msg->type = GST_RTSP_MESSAGE_RESPONSE;
- msg->type_data.response.code = code;
- msg->type_data.response.reason = g_strdup (reason);
- msg->type_data.response.version = GST_RTSP_VERSION_1_0;
- msg->hdr_fields = g_array_new (FALSE, FALSE, sizeof (RTSPKeyValue));
-
- if (request) {
- if (request->type == GST_RTSP_MESSAGE_HTTP_REQUEST) {
- msg->type = GST_RTSP_MESSAGE_HTTP_RESPONSE;
- if (request->type_data.request.version != GST_RTSP_VERSION_INVALID)
- msg->type_data.response.version = request->type_data.request.version;
- else
- msg->type_data.response.version = GST_RTSP_VERSION_1_1;
- } else {
- gchar *header;
-
- /* copy CSEQ */
- if (gst_rtsp_message_get_header (request, GST_RTSP_HDR_CSEQ, &header,
- 0) == GST_RTSP_OK) {
- gst_rtsp_message_add_header (msg, GST_RTSP_HDR_CSEQ, header);
- }
-
- /* copy session id */
- if (gst_rtsp_message_get_header (request, GST_RTSP_HDR_SESSION, &header,
- 0) == GST_RTSP_OK) {
- char *pos;
-
- header = g_strdup (header);
- if ((pos = strchr (header, ';'))) {
- *pos = '\0';
- }
- g_strchomp (header);
- gst_rtsp_message_take_header (msg, GST_RTSP_HDR_SESSION, header);
- }
-
- /* FIXME copy more headers? */
- }
- }
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_message_parse_response:
- * @msg: a #GstRTSPMessage
- * @code: location to hold the status code
- * @reason: location to hold the status reason
- * @version: location to hold the version
- *
- * Parse the response message @msg and store the values @code, @reason and
- * @version. The result locations can be #NULL if one is not interested in its
- * value.
- *
- * @reason remains valid for as long as @msg is valid and unchanged.
- *
- * Returns: a #GstRTSPResult.
- */
-GstRTSPResult
-gst_rtsp_message_parse_response (GstRTSPMessage * msg,
- GstRTSPStatusCode * code, const gchar ** reason, GstRTSPVersion * version)
-{
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (msg->type == GST_RTSP_MESSAGE_RESPONSE ||
- msg->type == GST_RTSP_MESSAGE_HTTP_RESPONSE, GST_RTSP_EINVAL);
-
- if (code)
- *code = msg->type_data.response.code;
- if (reason)
- *reason = msg->type_data.response.reason;
- if (version)
- *version = msg->type_data.response.version;
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_message_new_data:
- * @msg: a location for the new #GstRTSPMessage
- * @channel: the channel
- *
- * Create a new data #GstRTSPMessage with @channel and store the
- * result message in @msg. Free with gst_rtsp_message_free().
- *
- * Returns: a #GstRTSPResult.
- */
-GstRTSPResult
-gst_rtsp_message_new_data (GstRTSPMessage ** msg, guint8 channel)
-{
- GstRTSPMessage *newmsg;
-
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
-
- newmsg = g_new0 (GstRTSPMessage, 1);
-
- *msg = newmsg;
-
- return gst_rtsp_message_init_data (newmsg, channel);
-}
-
-/**
- * gst_rtsp_message_init_data:
- * @msg: a #GstRTSPMessage
- * @channel: a channel
- *
- * Initialize a new data #GstRTSPMessage for @channel.
- *
- * Returns: a #GstRTSPResult.
- */
-GstRTSPResult
-gst_rtsp_message_init_data (GstRTSPMessage * msg, guint8 channel)
-{
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
-
- gst_rtsp_message_unset (msg);
-
- msg->type = GST_RTSP_MESSAGE_DATA;
- msg->type_data.data.channel = channel;
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_message_parse_data:
- * @msg: a #GstRTSPMessage
- * @channel: location to hold the channel
- *
- * Parse the data message @msg and store the channel in @channel.
- *
- * Returns: a #GstRTSPResult.
- */
-GstRTSPResult
-gst_rtsp_message_parse_data (GstRTSPMessage * msg, guint8 * channel)
-{
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (msg->type == GST_RTSP_MESSAGE_DATA, GST_RTSP_EINVAL);
-
- if (channel)
- *channel = msg->type_data.data.channel;
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_message_unset:
- * @msg: a #GstRTSPMessage
- *
- * Unset the contents of @msg so that it becomes an uninitialized
- * #GstRTSPMessage again. This function is mostly used in combination with
- * gst_rtsp_message_init_request(), gst_rtsp_message_init_response() and
- * gst_rtsp_message_init_data() on stack allocated #GstRTSPMessage structures.
- *
- * Returns: #GST_RTSP_OK.
- */
-GstRTSPResult
-gst_rtsp_message_unset (GstRTSPMessage * msg)
-{
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
-
- switch (msg->type) {
- case GST_RTSP_MESSAGE_INVALID:
- break;
- case GST_RTSP_MESSAGE_REQUEST:
- case GST_RTSP_MESSAGE_HTTP_REQUEST:
- g_free (msg->type_data.request.uri);
- break;
- case GST_RTSP_MESSAGE_RESPONSE:
- case GST_RTSP_MESSAGE_HTTP_RESPONSE:
- g_free (msg->type_data.response.reason);
- break;
- case GST_RTSP_MESSAGE_DATA:
- break;
- default:
- g_return_val_if_reached (GST_RTSP_EINVAL);
- }
-
- if (msg->hdr_fields != NULL) {
- guint i;
-
- for (i = 0; i < msg->hdr_fields->len; i++) {
- RTSPKeyValue *keyval = &g_array_index (msg->hdr_fields, RTSPKeyValue, i);
-
- g_free (keyval->value);
- }
- g_array_free (msg->hdr_fields, TRUE);
- }
- g_free (msg->body);
-
- memset (msg, 0, sizeof (GstRTSPMessage));
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_message_free:
- * @msg: a #GstRTSPMessage
- *
- * Free the memory used by @msg.
- *
- * Returns: a #GstRTSPResult.
- */
-GstRTSPResult
-gst_rtsp_message_free (GstRTSPMessage * msg)
-{
- GstRTSPResult res;
-
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
-
- res = gst_rtsp_message_unset (msg);
- if (res == GST_RTSP_OK)
- g_free (msg);
-
- return res;
-}
-
-/**
- * gst_rtsp_message_take_header:
- * @msg: a #GstRTSPMessage
- * @field: a #GstRTSPHeaderField
- * @value: the value of the header
- *
- * Add a header with key @field and @value to @msg. This function takes
- * ownership of @value.
- *
- * Returns: a #GstRTSPResult.
- *
- * Since: 0.10.23
- */
-GstRTSPResult
-gst_rtsp_message_take_header (GstRTSPMessage * msg, GstRTSPHeaderField field,
- gchar * value)
-{
- RTSPKeyValue key_value;
-
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (value != NULL, GST_RTSP_EINVAL);
-
- key_value.field = field;
- key_value.value = value;
-
- g_array_append_val (msg->hdr_fields, key_value);
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_message_add_header:
- * @msg: a #GstRTSPMessage
- * @field: a #GstRTSPHeaderField
- * @value: the value of the header
- *
- * Add a header with key @field and @value to @msg. This function takes a copy
- * of @value.
- *
- * Returns: a #GstRTSPResult.
- */
-GstRTSPResult
-gst_rtsp_message_add_header (GstRTSPMessage * msg, GstRTSPHeaderField field,
- const gchar * value)
-{
- return gst_rtsp_message_take_header (msg, field, g_strdup (value));
-}
-
-/**
- * gst_rtsp_message_remove_header:
- * @msg: a #GstRTSPMessage
- * @field: a #GstRTSPHeaderField
- * @indx: the index of the header
- *
- * Remove the @indx header with key @field from @msg. If @indx equals -1, all
- * headers will be removed.
- *
- * Returns: a #GstRTSPResult.
- */
-GstRTSPResult
-gst_rtsp_message_remove_header (GstRTSPMessage * msg, GstRTSPHeaderField field,
- gint indx)
-{
- GstRTSPResult res = GST_RTSP_ENOTIMPL;
- guint i = 0;
- gint cnt = 0;
-
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
-
- while (i < msg->hdr_fields->len) {
- RTSPKeyValue *key_value = &g_array_index (msg->hdr_fields, RTSPKeyValue, i);
-
- if (key_value->field == field && (indx == -1 || cnt++ == indx)) {
- g_free (key_value->value);
- g_array_remove_index (msg->hdr_fields, i);
- res = GST_RTSP_OK;
- if (indx != -1)
- break;
- } else {
- i++;
- }
- }
- return res;
-}
-
-/**
- * gst_rtsp_message_get_header:
- * @msg: a #GstRTSPMessage
- * @field: a #GstRTSPHeaderField
- * @value: pointer to hold the result
- * @indx: the index of the header
- *
- * Get the @indx header value with key @field from @msg. The result in @value
- * stays valid as long as it remains present in @msg.
- *
- * Returns: #GST_RTSP_OK when @field was found, #GST_RTSP_ENOTIMPL if the key
- * was not found.
- */
-GstRTSPResult
-gst_rtsp_message_get_header (const GstRTSPMessage * msg,
- GstRTSPHeaderField field, gchar ** value, gint indx)
-{
- guint i;
- gint cnt = 0;
-
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
-
- /* no header initialized, there are no headers */
- if (msg->hdr_fields == NULL)
- return GST_RTSP_ENOTIMPL;
-
- for (i = 0; i < msg->hdr_fields->len; i++) {
- RTSPKeyValue *key_value = &g_array_index (msg->hdr_fields, RTSPKeyValue, i);
-
- if (key_value->field == field && cnt++ == indx) {
- if (value)
- *value = key_value->value;
- return GST_RTSP_OK;
- }
- }
-
- return GST_RTSP_ENOTIMPL;
-}
-
-/**
- * gst_rtsp_message_append_headers:
- * @msg: a #GstRTSPMessage
- * @str: a string
- *
- * Append the currently configured headers in @msg to the #GString @str suitable
- * for transmission.
- *
- * Returns: #GST_RTSP_OK.
- */
-GstRTSPResult
-gst_rtsp_message_append_headers (const GstRTSPMessage * msg, GString * str)
-{
- guint i;
-
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (str != NULL, GST_RTSP_EINVAL);
-
- for (i = 0; i < msg->hdr_fields->len; i++) {
- RTSPKeyValue *key_value;
- const gchar *keystr;
-
- key_value = &g_array_index (msg->hdr_fields, RTSPKeyValue, i);
- keystr = gst_rtsp_header_as_text (key_value->field);
-
- g_string_append_printf (str, "%s: %s\r\n", keystr, key_value->value);
- }
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_message_set_body:
- * @msg: a #GstRTSPMessage
- * @data: the data
- * @size: the size of @data
- *
- * Set the body of @msg to a copy of @data.
- *
- * Returns: #GST_RTSP_OK.
- */
-GstRTSPResult
-gst_rtsp_message_set_body (GstRTSPMessage * msg, const guint8 * data,
- guint size)
-{
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
-
- return gst_rtsp_message_take_body (msg, g_memdup (data, size), size);
-}
-
-/**
- * gst_rtsp_message_take_body:
- * @msg: a #GstRTSPMessage
- * @data: the data
- * @size: the size of @data
- *
- * Set the body of @msg to @data and @size. This method takes ownership of
- * @data.
- *
- * Returns: #GST_RTSP_OK.
- */
-GstRTSPResult
-gst_rtsp_message_take_body (GstRTSPMessage * msg, guint8 * data, guint size)
-{
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (data != NULL || size == 0, GST_RTSP_EINVAL);
-
- if (msg->body)
- g_free (msg->body);
-
- msg->body = data;
- msg->body_size = size;
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_message_get_body:
- * @msg: a #GstRTSPMessage
- * @data: location for the data
- * @size: location for the size of @data
- *
- * Get the body of @msg. @data remains valid for as long as @msg is valid and
- * unchanged.
- *
- * Returns: #GST_RTSP_OK.
- */
-GstRTSPResult
-gst_rtsp_message_get_body (const GstRTSPMessage * msg, guint8 ** data,
- guint * size)
-{
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (data != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (size != NULL, GST_RTSP_EINVAL);
-
- *data = msg->body;
- *size = msg->body_size;
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_message_steal_body:
- * @msg: a #GstRTSPMessage
- * @data: location for the data
- * @size: location for the size of @data
- *
- * Take the body of @msg and store it in @data and @size. After this method,
- * the body and size of @msg will be set to #NULL and 0 respectively.
- *
- * Returns: #GST_RTSP_OK.
- */
-GstRTSPResult
-gst_rtsp_message_steal_body (GstRTSPMessage * msg, guint8 ** data, guint * size)
-{
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (data != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (size != NULL, GST_RTSP_EINVAL);
-
- *data = msg->body;
- *size = msg->body_size;
-
- msg->body = NULL;
- msg->body_size = 0;
-
- return GST_RTSP_OK;
-}
-
-static void
-dump_key_value (gpointer data, gpointer user_data G_GNUC_UNUSED)
-{
- RTSPKeyValue *key_value = (RTSPKeyValue *) data;
-
- g_print (" key: '%s', value: '%s'\n",
- gst_rtsp_header_as_text (key_value->field), key_value->value);
-}
-
-/**
- * gst_rtsp_message_dump:
- * @msg: a #GstRTSPMessage
- *
- * Dump the contents of @msg to stdout.
- *
- * Returns: #GST_RTSP_OK.
- */
-GstRTSPResult
-gst_rtsp_message_dump (GstRTSPMessage * msg)
-{
- guint8 *data;
- guint size;
-
- g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
-
- switch (msg->type) {
- case GST_RTSP_MESSAGE_REQUEST:
- g_print ("RTSP request message %p\n", msg);
- g_print (" request line:\n");
- g_print (" method: '%s'\n",
- gst_rtsp_method_as_text (msg->type_data.request.method));
- g_print (" uri: '%s'\n", msg->type_data.request.uri);
- g_print (" version: '%s'\n",
- gst_rtsp_version_as_text (msg->type_data.request.version));
- g_print (" headers:\n");
- key_value_foreach (msg->hdr_fields, dump_key_value, NULL);
- g_print (" body:\n");
- gst_rtsp_message_get_body (msg, &data, &size);
- gst_util_dump_mem (data, size);
- break;
- case GST_RTSP_MESSAGE_RESPONSE:
- g_print ("RTSP response message %p\n", msg);
- g_print (" status line:\n");
- g_print (" code: '%d'\n", msg->type_data.response.code);
- g_print (" reason: '%s'\n", msg->type_data.response.reason);
- g_print (" version: '%s'\n",
- gst_rtsp_version_as_text (msg->type_data.response.version));
- g_print (" headers:\n");
- key_value_foreach (msg->hdr_fields, dump_key_value, NULL);
- gst_rtsp_message_get_body (msg, &data, &size);
- g_print (" body: length %d\n", size);
- gst_util_dump_mem (data, size);
- break;
- case GST_RTSP_MESSAGE_HTTP_REQUEST:
- g_print ("HTTP request message %p\n", msg);
- g_print (" request line:\n");
- g_print (" method: '%s'\n",
- gst_rtsp_method_as_text (msg->type_data.request.method));
- g_print (" uri: '%s'\n", msg->type_data.request.uri);
- g_print (" version: '%s'\n",
- gst_rtsp_version_as_text (msg->type_data.request.version));
- g_print (" headers:\n");
- key_value_foreach (msg->hdr_fields, dump_key_value, NULL);
- g_print (" body:\n");
- gst_rtsp_message_get_body (msg, &data, &size);
- gst_util_dump_mem (data, size);
- break;
- case GST_RTSP_MESSAGE_HTTP_RESPONSE:
- g_print ("HTTP response message %p\n", msg);
- g_print (" status line:\n");
- g_print (" code: '%d'\n", msg->type_data.response.code);
- g_print (" reason: '%s'\n", msg->type_data.response.reason);
- g_print (" version: '%s'\n",
- gst_rtsp_version_as_text (msg->type_data.response.version));
- g_print (" headers:\n");
- key_value_foreach (msg->hdr_fields, dump_key_value, NULL);
- gst_rtsp_message_get_body (msg, &data, &size);
- g_print (" body: length %d\n", size);
- gst_util_dump_mem (data, size);
- break;
- case GST_RTSP_MESSAGE_DATA:
- g_print ("RTSP data message %p\n", msg);
- g_print (" channel: '%d'\n", msg->type_data.data.channel);
- g_print (" size: '%d'\n", msg->body_size);
- gst_rtsp_message_get_body (msg, &data, &size);
- gst_util_dump_mem (data, size);
- break;
- default:
- g_print ("unsupported message type %d\n", msg->type);
- return GST_RTSP_EINVAL;
- }
- return GST_RTSP_OK;
-}
diff --git a/gst-libs/gst/rtsp/gstrtspmessage.h b/gst-libs/gst/rtsp/gstrtspmessage.h
deleted file mode 100644
index dda16047..00000000
--- a/gst-libs/gst/rtsp/gstrtspmessage.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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 <glib.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. Since 0.10.25
- * @GST_RTSP_MESSAGE_HTTP_RESPONSE: HTTP response message. Since 0.10.25
- * @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;
-};
-
-/* memory management */
-GstRTSPResult gst_rtsp_message_new (GstRTSPMessage **msg);
-GstRTSPResult gst_rtsp_message_init (GstRTSPMessage *msg);
-GstRTSPResult gst_rtsp_message_unset (GstRTSPMessage *msg);
-GstRTSPResult gst_rtsp_message_free (GstRTSPMessage *msg);
-
-GstRTSPMsgType gst_rtsp_message_get_type (GstRTSPMessage *msg);
-
-/* request */
-GstRTSPResult gst_rtsp_message_new_request (GstRTSPMessage **msg,
- GstRTSPMethod method,
- const gchar *uri);
-GstRTSPResult gst_rtsp_message_init_request (GstRTSPMessage *msg,
- GstRTSPMethod method,
- const gchar *uri);
-GstRTSPResult gst_rtsp_message_parse_request (GstRTSPMessage *msg,
- GstRTSPMethod *method,
- const gchar **uri,
- GstRTSPVersion *version);
-
-/* response */
-GstRTSPResult gst_rtsp_message_new_response (GstRTSPMessage **msg,
- GstRTSPStatusCode code,
- const gchar *reason,
- const GstRTSPMessage *request);
-GstRTSPResult gst_rtsp_message_init_response (GstRTSPMessage *msg,
- GstRTSPStatusCode code,
- const gchar *reason,
- const GstRTSPMessage *request);
-GstRTSPResult gst_rtsp_message_parse_response (GstRTSPMessage *msg,
- GstRTSPStatusCode *code,
- const gchar **reason,
- GstRTSPVersion *version);
-
-/* data */
-GstRTSPResult gst_rtsp_message_new_data (GstRTSPMessage **msg,
- guint8 channel);
-GstRTSPResult gst_rtsp_message_init_data (GstRTSPMessage *msg,
- guint8 channel);
-GstRTSPResult gst_rtsp_message_parse_data (GstRTSPMessage *msg,
- guint8 *channel);
-
-/* headers */
-GstRTSPResult gst_rtsp_message_add_header (GstRTSPMessage *msg,
- GstRTSPHeaderField field,
- const gchar *value);
-GstRTSPResult gst_rtsp_message_take_header (GstRTSPMessage *msg,
- GstRTSPHeaderField field,
- gchar *value);
-GstRTSPResult gst_rtsp_message_remove_header (GstRTSPMessage *msg,
- GstRTSPHeaderField field,
- gint indx);
-GstRTSPResult gst_rtsp_message_get_header (const GstRTSPMessage *msg,
- GstRTSPHeaderField field,
- gchar **value,
- gint indx);
-GstRTSPResult gst_rtsp_message_append_headers (const GstRTSPMessage *msg,
- GString *str);
-
-/* handling the body */
-GstRTSPResult gst_rtsp_message_set_body (GstRTSPMessage *msg,
- const guint8 *data,
- guint size);
-GstRTSPResult gst_rtsp_message_take_body (GstRTSPMessage *msg,
- guint8 *data,
- guint size);
-GstRTSPResult gst_rtsp_message_get_body (const GstRTSPMessage *msg,
- guint8 **data,
- guint *size);
-GstRTSPResult gst_rtsp_message_steal_body (GstRTSPMessage *msg,
- guint8 **data,
- guint *size);
-
-/* debug */
-GstRTSPResult gst_rtsp_message_dump (GstRTSPMessage *msg);
-
-G_END_DECLS
-
-#endif /* __GST_RTSP_MESSAGE_H__ */
diff --git a/gst-libs/gst/rtsp/gstrtsprange.c b/gst-libs/gst/rtsp/gstrtsprange.c
deleted file mode 100644
index bbfcc0fb..00000000
--- a/gst-libs/gst/rtsp/gstrtsprange.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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.
- */
-
-/**
- * SECTION:gstrtsprange
- * @short_description: dealing with time ranges
- *
- * <refsect2>
- * <para>
- * Provides helper functions to deal with time ranges.
- * </para>
- * </refsect2>
- *
- * Last reviewed on 2007-07-25 (0.10.14)
- */
-
-
-#include <stdio.h>
-#include <string.h>
-
-#include "gstrtsprange.h"
-
-/* npt-time = "now" | npt-sec | npt-hhmmss
- * npt-sec = 1*DIGIT [ "." *DIGIT ]
- * npt-hhmmss = npt-hh ":" npt-mm ":" npt-ss [ "." *DIGIT ]
- * npt-hh = 1*DIGIT ; any positive number
- * npt-mm = 1*2DIGIT ; 0-59
- * npt-ss = 1*2DIGIT ; 0-59
- */
-static GstRTSPResult
-parse_npt_time (const gchar * str, GstRTSPTime * time)
-{
- if (strncmp (str, "now", 3) == 0) {
- time->type = GST_RTSP_TIME_NOW;
- } else if (str[0] == '\0') {
- time->type = GST_RTSP_TIME_END;
- } else if (strstr (str, ":")) {
- gfloat seconds;
- gint hours, mins;
-
- sscanf (str, "%2d:%2d:%f", &hours, &mins, &seconds);
-
- time->type = GST_RTSP_TIME_SECONDS;
- time->seconds = ((hours * 60) + mins) * 60 + seconds;
- } else {
- gfloat seconds;
-
- sscanf (str, "%f", &seconds);
-
- time->type = GST_RTSP_TIME_SECONDS;
- time->seconds = seconds;
- }
- return GST_RTSP_OK;
-}
-
-/* npt-range = ( npt-time "-" [ npt-time ] ) | ( "-" npt-time )
- */
-static GstRTSPResult
-parse_npt_range (const gchar * str, GstRTSPTimeRange * range)
-{
- GstRTSPResult res;
- gchar *p;
-
- range->unit = GST_RTSP_RANGE_NPT;
-
- /* find '-' separator */
- p = strstr (str, "-");
- if (p == NULL)
- return GST_RTSP_EINVAL;
-
- if ((res = parse_npt_time (str, &range->min)) != GST_RTSP_OK)
- goto done;
-
- res = parse_npt_time (p + 1, &range->max);
-
-done:
- return res;
-}
-
-static GstRTSPResult
-parse_clock_range (const gchar * str, GstRTSPTimeRange * range)
-{
- return GST_RTSP_ENOTIMPL;
-}
-
-static GstRTSPResult
-parse_smpte_range (const gchar * str, GstRTSPTimeRange * range)
-{
- return GST_RTSP_ENOTIMPL;
-}
-
-/**
- * gst_rtsp_range_parse:
- * @rangestr: a range string to parse
- * @range: location to hold the #GstRTSPTimeRange result
- *
- * Parse @rangestr to a #GstRTSPTimeRange.
- *
- * Returns: #GST_RTSP_OK on success.
- */
-GstRTSPResult
-gst_rtsp_range_parse (const gchar * rangestr, GstRTSPTimeRange ** range)
-{
- GstRTSPResult ret;
- GstRTSPTimeRange *res;
- gchar *p;
-
- g_return_val_if_fail (rangestr != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (range != NULL, GST_RTSP_EINVAL);
-
- res = g_new0 (GstRTSPTimeRange, 1);
-
- p = (gchar *) rangestr;
- /* first figure out the units of the range */
- if (g_str_has_prefix (p, "npt=")) {
- ret = parse_npt_range (p + 4, res);
- } else if (g_str_has_prefix (p, "clock=")) {
- ret = parse_clock_range (p + 6, res);
- } else if (g_str_has_prefix (p, "smpte=")) {
- res->unit = GST_RTSP_RANGE_SMPTE;
- ret = parse_smpte_range (p + 6, res);
- } else if (g_str_has_prefix (p, "smpte-30-drop=")) {
- res->unit = GST_RTSP_RANGE_SMPTE_30_DROP;
- ret = parse_smpte_range (p + 14, res);
- } else if (g_str_has_prefix (p, "smpte-25=")) {
- res->unit = GST_RTSP_RANGE_SMPTE_25;
- ret = parse_smpte_range (p + 9, res);
- } else
- goto invalid;
-
- if (ret != GST_RTSP_OK)
- goto invalid;
-
- *range = res;
- return ret;
-
- /* ERRORS */
-invalid:
- {
- gst_rtsp_range_free (res);
- return GST_RTSP_EINVAL;
- }
-}
-
-static gboolean
-npt_time_string (const GstRTSPTime * time, GString * string)
-{
- gboolean res = TRUE;;
-
- switch (time->type) {
- case GST_RTSP_TIME_SECONDS:
- g_string_append_printf (string, "%f", time->seconds);
- break;
- case GST_RTSP_TIME_NOW:
- g_string_append (string, "now");
- break;
- case GST_RTSP_TIME_END:
- break;
- default:
- res = FALSE;
- break;
- }
- return res;
-}
-
-static gboolean
-npt_range_string (const GstRTSPTimeRange * range, GString * string)
-{
- gboolean res;
-
- if (!(res = npt_time_string (&range->min, string)))
- goto done;
-
- g_string_append (string, "-");
-
- if (!(res = npt_time_string (&range->max, string)))
- goto done;
-
-done:
- return res;
-}
-
-/**
- * gst_rtsp_range_to_string:
- * @range: a #GstRTSPTimeRange
- *
- * Convert @range into a string representation.
- *
- * Returns: The string representation of @range. g_free() after usage.
- *
- * Since: 0.10.23
- */
-gchar *
-gst_rtsp_range_to_string (const GstRTSPTimeRange * range)
-{
- gchar *result = NULL;
- GString *string;
-
- g_return_val_if_fail (range != NULL, NULL);
-
- string = g_string_new ("");
-
- switch (range->unit) {
- case GST_RTSP_RANGE_NPT:
- g_string_append (string, "npt=");
- if (!npt_range_string (range, string)) {
- g_string_free (string, TRUE);
- string = NULL;
- }
- break;
- case GST_RTSP_RANGE_SMPTE:
- case GST_RTSP_RANGE_SMPTE_30_DROP:
- case GST_RTSP_RANGE_SMPTE_25:
- case GST_RTSP_RANGE_CLOCK:
- default:
- g_warning ("time range unit not yet implemented");
- g_string_free (string, TRUE);
- string = NULL;
- break;
- }
- if (string)
- result = g_string_free (string, FALSE);
-
- return result;
-}
-
-/**
- * gst_rtsp_range_free:
- * @range: a #GstRTSPTimeRange
- *
- * Free the memory alocated by @range.
- */
-void
-gst_rtsp_range_free (GstRTSPTimeRange * range)
-{
- g_free (range);
-}
diff --git a/gst-libs/gst/rtsp/gstrtsprange.h b/gst-libs/gst/rtsp/gstrtsprange.h
deleted file mode 100644
index 9d2c062f..00000000
--- a/gst-libs/gst/rtsp/gstrtsprange.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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/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;
-
-/**
- * GstRTSPTimeType:
- * @GST_RTSP_TIME_SECONDS: seconds
- * @GST_RTSP_TIME_NOW: now
- * @GST_RTSP_TIME_END: end
- *
- * Possible time types.
- */
-typedef enum {
- GST_RTSP_TIME_SECONDS,
- GST_RTSP_TIME_NOW,
- GST_RTSP_TIME_END
-} GstRTSPTimeType;
-
-/**
- * GstRTSPTime:
- * @type: the time of the time
- * @seconds: seconds when @type is GST_RTSP_TIME_SECONDS
- *
- * A time indication.
- */
-struct _GstRTSPTime {
- GstRTSPTimeType type;
- gdouble seconds;
-};
-
-/**
- * GstRTSPTimeRange:
- * @unit: the time units used
- * @min: the minimum interval
- * @max: the maximum interval
- *
- * A time range.
- */
-struct _GstRTSPTimeRange {
- GstRTSPRangeUnit unit;
-
- GstRTSPTime min;
- GstRTSPTime max;
-};
-
-GstRTSPResult gst_rtsp_range_parse (const gchar *rangestr, GstRTSPTimeRange **range);
-gchar * gst_rtsp_range_to_string (const GstRTSPTimeRange *range);
-void gst_rtsp_range_free (GstRTSPTimeRange *range);
-
-G_END_DECLS
-
-#endif /* __GST_RTSP_RANGE_H__ */
diff --git a/gst-libs/gst/rtsp/gstrtsptransport.c b/gst-libs/gst/rtsp/gstrtsptransport.c
deleted file mode 100644
index f509ca90..00000000
--- a/gst-libs/gst/rtsp/gstrtsptransport.c
+++ /dev/null
@@ -1,685 +0,0 @@
-/* GStreamer
- * Copyright (C) <2005,2006,2007> Wim Taymans <wim@fluendo.com>
- * <2007> Peter Kjellerstedt <pkj at 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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.
- */
-
-/**
- * SECTION:gstrtsptransport
- * @short_description: dealing with RTSP transports
- *
- * <refsect2>
- * <para>
- * Provides helper functions to deal with RTSP transport strings.
- * </para>
- * </refsect2>
- *
- * Last reviewed on 2007-07-25 (0.10.14)
- */
-
-#include <string.h>
-#include <stdlib.h>
-
-#include "gstrtsptransport.h"
-
-#define MAX_MANAGERS 2
-
-typedef enum
-{
- RTSP_TRANSPORT_DELIVERY = 1 << 0, /* multicast | unicast */
- RTSP_TRANSPORT_DESTINATION = 1 << 1,
- RTSP_TRANSPORT_SOURCE = 1 << 2,
- RTSP_TRANSPORT_INTERLEAVED = 1 << 3,
- RTSP_TRANSPORT_APPEND = 1 << 4,
- RTSP_TRANSPORT_TTL = 1 << 5,
- RTSP_TRANSPORT_LAYERS = 1 << 6,
- RTSP_TRANSPORT_PORT = 1 << 7,
- RTSP_TRANSPORT_CLIENT_PORT = 1 << 8,
- RTSP_TRANSPORT_SERVER_PORT = 1 << 9,
- RTSP_TRANSPORT_SSRC = 1 << 10,
- RTSP_TRANSPORT_MODE = 1 << 11,
-} RTSPTransportParameter;
-
-typedef struct
-{
- const gchar *name;
- const GstRTSPTransMode mode;
- const gchar *gst_mime;
- const gchar *manager[MAX_MANAGERS];
-} GstRTSPTransMap;
-
-static const GstRTSPTransMap transports[] = {
- {"rtp", GST_RTSP_TRANS_RTP, "application/x-rtp", {"gstrtpbin", "rtpdec"}},
- {"x-real-rdt", GST_RTSP_TRANS_RDT, "application/x-rdt", {"rdtmanager", NULL}},
- {"x-pn-tng", GST_RTSP_TRANS_RDT, "application/x-rdt", {"rdtmanager", NULL}},
- {NULL, GST_RTSP_TRANS_UNKNOWN, NULL, {NULL, NULL}}
-};
-
-typedef struct
-{
- const gchar *name;
- const GstRTSPProfile profile;
-} RTSPProfileMap;
-
-static const RTSPProfileMap profiles[] = {
- {"avp", GST_RTSP_PROFILE_AVP},
- {"savp", GST_RTSP_PROFILE_SAVP},
- {NULL, GST_RTSP_PROFILE_UNKNOWN}
-};
-
-typedef struct
-{
- const gchar *name;
- const GstRTSPLowerTrans ltrans;
-} RTSPLTransMap;
-
-static const RTSPLTransMap ltrans[] = {
- {"udp", GST_RTSP_LOWER_TRANS_UDP},
- {"mcast", GST_RTSP_LOWER_TRANS_UDP_MCAST},
- {"tcp", GST_RTSP_LOWER_TRANS_TCP},
- {NULL, GST_RTSP_LOWER_TRANS_UNKNOWN}
-};
-
-#define RTSP_TRANSPORT_PARAMETER_IS_UNIQUE(param) \
-G_STMT_START { \
- if ((transport_params & (param)) != 0) \
- goto invalid_transport; \
- transport_params |= (param); \
-} G_STMT_END
-
-/**
- * gst_rtsp_transport_new:
- * @transport: location to hold the new #GstRTSPTransport
- *
- * Allocate a new initialized #GstRTSPTransport. Use gst_rtsp_transport_free()
- * after usage.
- *
- * Returns: a #GstRTSPResult.
- */
-GstRTSPResult
-gst_rtsp_transport_new (GstRTSPTransport ** transport)
-{
- GstRTSPTransport *trans;
-
- g_return_val_if_fail (transport != NULL, GST_RTSP_EINVAL);
-
- trans = g_new0 (GstRTSPTransport, 1);
-
- *transport = trans;
-
- return gst_rtsp_transport_init (trans);
-}
-
-/**
- * gst_rtsp_transport_init:
- * @transport: a #GstRTSPTransport
- *
- * Initialize @transport so that it can be used.
- *
- * Returns: #GST_RTSP_OK.
- */
-GstRTSPResult
-gst_rtsp_transport_init (GstRTSPTransport * transport)
-{
- g_return_val_if_fail (transport != NULL, GST_RTSP_EINVAL);
-
- g_free (transport->destination);
- g_free (transport->source);
-
- memset (transport, 0, sizeof (GstRTSPTransport));
-
- transport->trans = GST_RTSP_TRANS_RTP;
- transport->profile = GST_RTSP_PROFILE_AVP;
- transport->lower_transport = GST_RTSP_LOWER_TRANS_UDP_MCAST;
- transport->mode_play = TRUE;
- transport->mode_record = FALSE;
- transport->interleaved.min = -1;
- transport->interleaved.max = -1;
- transport->port.min = -1;
- transport->port.max = -1;
- transport->client_port.min = -1;
- transport->client_port.max = -1;
- transport->server_port.min = -1;
- transport->server_port.max = -1;
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_transport_get_mime:
- * @trans: a #GstRTSPTransMode
- * @mime: location to hold the result
- *
- * Get the mime type of the transport mode @trans. This mime type is typically
- * used to generate #GstCaps on buffers.
- *
- * Returns: #GST_RTSP_OK.
- */
-GstRTSPResult
-gst_rtsp_transport_get_mime (GstRTSPTransMode trans, const gchar ** mime)
-{
- gint i;
-
- g_return_val_if_fail (mime != NULL, GST_RTSP_EINVAL);
-
- for (i = 0; transports[i].name; i++)
- if (transports[i].mode == trans)
- break;
- *mime = transports[i].gst_mime;
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_transport_get_manager:
- * @trans: a #GstRTSPTransMode
- * @manager: location to hold the result
- * @option: option index.
- *
- * Get the #GStreamer element that can handle the buffers transported over
- * @trans.
- *
- * It is possible that there are several managers available, use @option to
- * selected one.
- *
- * @manager will contain an element name or #NULL when no manager is
- * needed/available for @trans.
- *
- * Returns: #GST_RTSP_OK.
- */
-GstRTSPResult
-gst_rtsp_transport_get_manager (GstRTSPTransMode trans, const gchar ** manager,
- guint option)
-{
- gint i;
-
- g_return_val_if_fail (manager != NULL, GST_RTSP_EINVAL);
-
- for (i = 0; transports[i].name; i++)
- if (transports[i].mode == trans)
- break;
-
- if (option < MAX_MANAGERS)
- *manager = transports[i].manager[option];
- else
- *manager = NULL;
-
- return GST_RTSP_OK;
-}
-
-static void
-parse_mode (GstRTSPTransport * transport, const gchar * str)
-{
- transport->mode_play = (strstr (str, "play") != NULL);
- transport->mode_record = (strstr (str, "record") != NULL);
-}
-
-static void
-parse_range (const gchar * str, GstRTSPRange * range)
-{
- gchar *minus;
- gchar *tmp;
-
- /* even though strtol() allows white space, plus and minus in front of
- * the number, we do not allow it
- */
- if (g_ascii_isspace (*str) || *str == '+' || *str == '-')
- goto invalid_range;
-
- minus = strstr (str, "-");
- if (minus) {
- if (g_ascii_isspace (minus[1]) || minus[1] == '+' || minus[1] == '-')
- goto invalid_range;
-
- range->min = strtol (str, &tmp, 10);
- if (str == tmp || tmp != minus)
- goto invalid_range;
-
- range->max = strtol (minus + 1, &tmp, 10);
- if (*tmp && *tmp != ';')
- goto invalid_range;
- } else {
- range->min = strtol (str, &tmp, 10);
- if (str == tmp || (*tmp && *tmp != ';'))
- goto invalid_range;
-
- range->max = -1;
- }
-
- return;
-
-invalid_range:
- {
- range->min = -1;
- range->max = -1;
- return;
- }
-}
-
-static gchar *
-range_as_text (const GstRTSPRange * range)
-{
- if (range->min < 0)
- return NULL;
- else if (range->max < 0)
- return g_strdup_printf ("%d", range->min);
- else
- return g_strdup_printf ("%d-%d", range->min, range->max);
-}
-
-static const gchar *
-rtsp_transport_mode_as_text (const GstRTSPTransport * transport)
-{
- gint i;
-
- for (i = 0; transports[i].name; i++)
- if (transports[i].mode == transport->trans)
- return transports[i].name;
-
- return NULL;
-}
-
-static const gchar *
-rtsp_transport_profile_as_text (const GstRTSPTransport * transport)
-{
- gint i;
-
- for (i = 0; profiles[i].name; i++)
- if (profiles[i].profile == transport->profile)
- return profiles[i].name;
-
- return NULL;
-}
-
-static const gchar *
-rtsp_transport_ltrans_as_text (const GstRTSPTransport * transport)
-{
- gint i;
-
- /* need to special case GST_RTSP_LOWER_TRANS_UDP_MCAST */
- if (transport->lower_transport == GST_RTSP_LOWER_TRANS_UDP_MCAST)
- return "udp";
-
- for (i = 0; ltrans[i].name; i++)
- if (ltrans[i].ltrans == transport->lower_transport)
- return ltrans[i].name;
-
- return NULL;
-}
-
-/**
- * gst_rtsp_transport_parse:
- * @str: a transport string
- * @transport: a #GstRTSPTransport
- *
- * Parse the RTSP transport string @str into @transport.
- *
- * Returns: a #GstRTSPResult.
- */
-GstRTSPResult
-gst_rtsp_transport_parse (const gchar * str, GstRTSPTransport * transport)
-{
- gchar **split, *down, **transp = NULL;
- guint transport_params = 0;
- gint i, count;
-
- g_return_val_if_fail (transport != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (str != NULL, GST_RTSP_EINVAL);
-
- gst_rtsp_transport_init (transport);
-
- /* case insensitive */
- down = g_ascii_strdown (str, -1);
-
- split = g_strsplit (down, ";", 0);
- g_free (down);
-
- /* First field contains the transport/profile/lower_transport */
- if (split[0] == NULL)
- goto invalid_transport;
-
- transp = g_strsplit (split[0], "/", 0);
-
- if (transp[0] == NULL || transp[1] == NULL)
- goto invalid_transport;
-
- for (i = 0; transports[i].name; i++)
- if (strcmp (transp[0], transports[i].name) == 0)
- break;
- transport->trans = transports[i].mode;
-
- if (transport->trans != GST_RTSP_TRANS_RDT) {
- for (i = 0; profiles[i].name; i++)
- if (strcmp (transp[1], profiles[i].name) == 0)
- break;
- transport->profile = profiles[i].profile;
- count = 2;
- } else {
- /* RDT has transport/lower_transport */
- transport->profile = GST_RTSP_PROFILE_AVP;
- count = 1;
- }
-
- if (transp[count] != NULL) {
- for (i = 0; ltrans[i].name; i++)
- if (strcmp (transp[count], ltrans[i].name) == 0)
- break;
- transport->lower_transport = ltrans[i].ltrans;
- } else {
- /* specifying the lower transport is optional */
- if (transport->trans == GST_RTSP_TRANS_RTP &&
- transport->profile == GST_RTSP_PROFILE_AVP)
- transport->lower_transport = GST_RTSP_LOWER_TRANS_UDP_MCAST;
- else
- transport->lower_transport = GST_RTSP_LOWER_TRANS_UNKNOWN;
- }
-
- g_strfreev (transp);
- transp = NULL;
-
- if (transport->trans == GST_RTSP_TRANS_UNKNOWN ||
- transport->profile == GST_RTSP_PROFILE_UNKNOWN ||
- transport->lower_transport == GST_RTSP_LOWER_TRANS_UNKNOWN)
- goto unsupported_transport;
-
- i = 1;
- while (split[i]) {
- if (strcmp (split[i], "multicast") == 0) {
- RTSP_TRANSPORT_PARAMETER_IS_UNIQUE (RTSP_TRANSPORT_DELIVERY);
- if (transport->lower_transport == GST_RTSP_LOWER_TRANS_TCP)
- goto invalid_transport;
- transport->lower_transport = GST_RTSP_LOWER_TRANS_UDP_MCAST;
- } else if (strcmp (split[i], "unicast") == 0) {
- RTSP_TRANSPORT_PARAMETER_IS_UNIQUE (RTSP_TRANSPORT_DELIVERY);
- if (transport->lower_transport == GST_RTSP_LOWER_TRANS_UDP_MCAST)
- transport->lower_transport = GST_RTSP_LOWER_TRANS_UDP;
- } else if (g_str_has_prefix (split[i], "destination=")) {
- RTSP_TRANSPORT_PARAMETER_IS_UNIQUE (RTSP_TRANSPORT_DESTINATION);
- transport->destination = g_strdup (split[i] + 12);
- } else if (g_str_has_prefix (split[i], "source=")) {
- RTSP_TRANSPORT_PARAMETER_IS_UNIQUE (RTSP_TRANSPORT_SOURCE);
- transport->source = g_strdup (split[i] + 7);
- } else if (g_str_has_prefix (split[i], "layers=")) {
- RTSP_TRANSPORT_PARAMETER_IS_UNIQUE (RTSP_TRANSPORT_LAYERS);
- transport->layers = strtoul (split[i] + 7, NULL, 10);
- } else if (g_str_has_prefix (split[i], "mode=")) {
- RTSP_TRANSPORT_PARAMETER_IS_UNIQUE (RTSP_TRANSPORT_MODE);
- parse_mode (transport, split[i] + 5);
- if (!transport->mode_play && !transport->mode_record)
- goto invalid_transport;
- } else if (strcmp (split[i], "append") == 0) {
- RTSP_TRANSPORT_PARAMETER_IS_UNIQUE (RTSP_TRANSPORT_APPEND);
- transport->append = TRUE;
- } else if (g_str_has_prefix (split[i], "interleaved=")) {
- RTSP_TRANSPORT_PARAMETER_IS_UNIQUE (RTSP_TRANSPORT_INTERLEAVED);
- parse_range (split[i] + 12, &transport->interleaved);
- if (transport->interleaved.min < 0 ||
- transport->interleaved.min >= 256 ||
- transport->interleaved.max >= 256)
- goto invalid_transport;
- } else if (g_str_has_prefix (split[i], "ttl=")) {
- RTSP_TRANSPORT_PARAMETER_IS_UNIQUE (RTSP_TRANSPORT_TTL);
- transport->ttl = strtoul (split[i] + 4, NULL, 10);
- if (transport->ttl >= 256)
- goto invalid_transport;
- } else if (g_str_has_prefix (split[i], "port=")) {
- RTSP_TRANSPORT_PARAMETER_IS_UNIQUE (RTSP_TRANSPORT_PORT);
- parse_range (split[i] + 5, &transport->port);
- if (transport->port.min < 0 ||
- transport->port.min >= 65536 || transport->port.max >= 65536)
- goto invalid_transport;
- } else if (g_str_has_prefix (split[i], "client_port=")) {
- RTSP_TRANSPORT_PARAMETER_IS_UNIQUE (RTSP_TRANSPORT_CLIENT_PORT);
- parse_range (split[i] + 12, &transport->client_port);
- if (transport->client_port.min < 0 ||
- transport->client_port.min >= 65536 ||
- transport->client_port.max >= 65536)
- goto invalid_transport;
- } else if (g_str_has_prefix (split[i], "server_port=")) {
- RTSP_TRANSPORT_PARAMETER_IS_UNIQUE (RTSP_TRANSPORT_SERVER_PORT);
- parse_range (split[i] + 12, &transport->server_port);
- if (transport->server_port.min < 0 ||
- transport->server_port.min >= 65536 ||
- transport->server_port.max >= 65536)
- goto invalid_transport;
- } else if (g_str_has_prefix (split[i], "ssrc=")) {
- RTSP_TRANSPORT_PARAMETER_IS_UNIQUE (RTSP_TRANSPORT_SSRC);
- transport->ssrc = strtoul (split[i] + 5, NULL, 16);
- } else {
- /* unknown field... */
- g_warning ("unknown transport field \"%s\"", split[i]);
- }
- i++;
- }
- g_strfreev (split);
-
- return GST_RTSP_OK;
-
-unsupported_transport:
- {
- g_strfreev (split);
- return GST_RTSP_ERROR;
- }
-invalid_transport:
- {
- g_strfreev (transp);
- g_strfreev (split);
- return GST_RTSP_EINVAL;
- }
-}
-
-/**
- * gst_rtsp_transport_as_text:
- * @transport: a #GstRTSPTransport
- *
- * Convert @transport into a string that can be used to signal the transport in
- * an RTSP SETUP response.
- *
- * Returns: a string describing the RTSP transport or #NULL when the transport
- * is invalid.
- */
-gchar *
-gst_rtsp_transport_as_text (GstRTSPTransport * transport)
-{
- GPtrArray *strs;
- gchar *res;
- const gchar *tmp;
-
- g_return_val_if_fail (transport != NULL, NULL);
-
- strs = g_ptr_array_new ();
-
- /* add the transport specifier */
- if ((tmp = rtsp_transport_mode_as_text (transport)) == NULL)
- goto invalid_transport;
- g_ptr_array_add (strs, g_ascii_strup (tmp, -1));
-
- g_ptr_array_add (strs, g_strdup ("/"));
-
- if ((tmp = rtsp_transport_profile_as_text (transport)) == NULL)
- goto invalid_transport;
- g_ptr_array_add (strs, g_ascii_strup (tmp, -1));
-
- if (transport->trans != GST_RTSP_TRANS_RTP ||
- transport->profile != GST_RTSP_PROFILE_AVP ||
- transport->lower_transport == GST_RTSP_LOWER_TRANS_TCP) {
- g_ptr_array_add (strs, g_strdup ("/"));
-
- if ((tmp = rtsp_transport_ltrans_as_text (transport)) == NULL)
- goto invalid_transport;
-
- g_ptr_array_add (strs, g_ascii_strup (tmp, -1));
- }
-
- /*
- * the order of the following parameters is the same as the one specified in
- * RFC 2326 to please some weird RTSP clients that require it
- */
-
- /* add the unicast/multicast parameter */
- if (transport->lower_transport == GST_RTSP_LOWER_TRANS_UDP_MCAST)
- g_ptr_array_add (strs, g_strdup (";multicast"));
- else
- g_ptr_array_add (strs, g_strdup (";unicast"));
-
- /* add the destination parameter */
- if (transport->destination != NULL) {
- g_ptr_array_add (strs, g_strdup (";destination="));
- g_ptr_array_add (strs, g_strdup (transport->destination));
- }
-
- /* add the source parameter */
- if (transport->source != NULL) {
- g_ptr_array_add (strs, g_strdup (";source="));
- g_ptr_array_add (strs, g_strdup (transport->source));
- }
-
- /* add the interleaved parameter */
- if (transport->lower_transport == GST_RTSP_LOWER_TRANS_TCP &&
- transport->interleaved.min >= 0) {
- if (transport->interleaved.min < 256 && transport->interleaved.max < 256) {
- g_ptr_array_add (strs, g_strdup (";interleaved="));
- g_ptr_array_add (strs, range_as_text (&transport->interleaved));
- } else
- goto invalid_transport;
- }
-
- /* add the append parameter */
- if (transport->mode_record && transport->append)
- g_ptr_array_add (strs, g_strdup (";append"));
-
- /* add the ttl parameter */
- if (transport->lower_transport == GST_RTSP_LOWER_TRANS_UDP_MCAST &&
- transport->ttl != 0) {
- if (transport->ttl < 256) {
- g_ptr_array_add (strs, g_strdup (";ttl="));
- g_ptr_array_add (strs, g_strdup_printf ("%u", transport->ttl));
- } else
- goto invalid_transport;
- }
-
- /* add the layers parameter */
- if (transport->layers != 0) {
- g_ptr_array_add (strs, g_strdup (";layers="));
- g_ptr_array_add (strs, g_strdup_printf ("%u", transport->layers));
- }
-
- /* add the port parameter */
- if (transport->lower_transport != GST_RTSP_LOWER_TRANS_TCP) {
- if (transport->trans == GST_RTSP_TRANS_RTP && transport->port.min >= 0) {
- if (transport->port.min < 65536 && transport->port.max < 65536) {
- g_ptr_array_add (strs, g_strdup (";port="));
- g_ptr_array_add (strs, range_as_text (&transport->port));
- } else
- goto invalid_transport;
- }
-
- /* add the client_port parameter */
- if (transport->trans == GST_RTSP_TRANS_RTP
- && transport->client_port.min >= 0) {
- if (transport->client_port.min < 65536
- && transport->client_port.max < 65536) {
- g_ptr_array_add (strs, g_strdup (";client_port="));
- g_ptr_array_add (strs, range_as_text (&transport->client_port));
- } else
- goto invalid_transport;
- }
-
- /* add the server_port parameter */
- if (transport->trans == GST_RTSP_TRANS_RTP
- && transport->server_port.min >= 0) {
- if (transport->server_port.min < 65536
- && transport->server_port.max < 65536) {
- g_ptr_array_add (strs, g_strdup (";server_port="));
- g_ptr_array_add (strs, range_as_text (&transport->server_port));
- } else
- goto invalid_transport;
- }
- }
-
- /* add the ssrc parameter */
- if (transport->lower_transport != GST_RTSP_LOWER_TRANS_UDP_MCAST &&
- transport->ssrc != 0) {
- g_ptr_array_add (strs, g_strdup (";ssrc="));
- g_ptr_array_add (strs, g_strdup_printf ("%08X", transport->ssrc));
- }
-
- /* add the mode parameter */
- if (transport->mode_play && transport->mode_record)
- g_ptr_array_add (strs, g_strdup (";mode=\"PLAY,RECORD\""));
- else if (transport->mode_record)
- g_ptr_array_add (strs, g_strdup (";mode=\"RECORD\""));
- else if (transport->mode_play)
- g_ptr_array_add (strs, g_strdup (";mode=\"PLAY\""));
-
- /* add a terminating NULL */
- g_ptr_array_add (strs, NULL);
-
- res = g_strjoinv (NULL, (gchar **) strs->pdata);
- g_strfreev ((gchar **) g_ptr_array_free (strs, FALSE));
-
- return res;
-
-invalid_transport:
- {
- g_ptr_array_add (strs, NULL);
- g_strfreev ((gchar **) g_ptr_array_free (strs, FALSE));
- return NULL;
- }
-}
-
-/**
- * gst_rtsp_transport_free:
- * @transport: a #GstRTSPTransport
- *
- * Free the memory used by @transport.
- *
- * Returns: #GST_RTSP_OK.
- */
-GstRTSPResult
-gst_rtsp_transport_free (GstRTSPTransport * transport)
-{
- g_return_val_if_fail (transport != NULL, GST_RTSP_EINVAL);
-
- gst_rtsp_transport_init (transport);
- g_free (transport);
-
- return GST_RTSP_OK;
-}
diff --git a/gst-libs/gst/rtsp/gstrtsptransport.h b/gst-libs/gst/rtsp/gstrtsptransport.h
deleted file mode 100644
index 389abd96..00000000
--- a/gst-libs/gst/rtsp/gstrtsptransport.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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/rtsp/gstrtspdefs.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
- * @GST_RTSP_PROFILE_SAVP: the secure Audio/Visual profile
- *
- * The transfer profile to use.
- */
-typedef enum {
- GST_RTSP_PROFILE_UNKNOWN = 0,
- GST_RTSP_PROFILE_AVP = (1 << 0),
- GST_RTSP_PROFILE_SAVP = (1 << 1)
-} 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. Since: 0.10.23
- *
- * 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)
-} GstRTSPLowerTrans;
-
-/**
- * RTSPRange:
- * @min: minimum value of the range
- * @max: maximum value of the range
- *
- * A type to specify a range.
- */
-typedef struct
-{
- gint min;
- gint max;
-} GstRTSPRange;
-
-/**
- * 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
- * @server_port: the server port pair for receiving data
- * @ssrc: the ssrc that the sender/receiver will use
- *
- * A structure holding the RTSP transport values.
- */
-typedef 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;
-
- /* UDP specific */
- GstRTSPRange port;
- GstRTSPRange client_port;
- GstRTSPRange server_port;
- /* RTP specific */
- guint ssrc;
-
-} GstRTSPTransport;
-
-GstRTSPResult gst_rtsp_transport_new (GstRTSPTransport **transport);
-GstRTSPResult gst_rtsp_transport_init (GstRTSPTransport *transport);
-
-GstRTSPResult gst_rtsp_transport_parse (const gchar *str, GstRTSPTransport *transport);
-gchar* gst_rtsp_transport_as_text (GstRTSPTransport *transport);
-
-GstRTSPResult gst_rtsp_transport_get_mime (GstRTSPTransMode trans, const gchar **mime);
-GstRTSPResult gst_rtsp_transport_get_manager (GstRTSPTransMode trans, const gchar **manager, guint option);
-
-GstRTSPResult gst_rtsp_transport_free (GstRTSPTransport *transport);
-
-G_END_DECLS
-
-#endif /* __GST_RTSP_TRANSPORT_H__ */
diff --git a/gst-libs/gst/rtsp/gstrtspurl.c b/gst-libs/gst/rtsp/gstrtspurl.c
deleted file mode 100644
index 98f1ac24..00000000
--- a/gst-libs/gst/rtsp/gstrtspurl.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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.
- */
-
-/**
- * SECTION:gstrtspurl
- * @short_description: handling RTSP urls
- *
- * <refsect2>
- * <para>
- * Provides helper functions to handle RTSP urls.
- * </para>
- * </refsect2>
- *
- * Last reviewed on 2007-07-25 (0.10.14)
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "gstrtspurl.h"
-
-static void
-register_rtsp_url_type (GType * id)
-{
- *id = g_boxed_type_register_static ("GstRTSPUrl",
- (GBoxedCopyFunc) gst_rtsp_url_copy, (GBoxedFreeFunc) gst_rtsp_url_free);
-}
-
-GType
-gst_rtsp_url_get_type (void)
-{
- static GType id;
- static GOnce once = G_ONCE_INIT;
-
- g_once (&once, (GThreadFunc) register_rtsp_url_type, &id);
- return id;
-}
-
-static const gchar *rtsp_url_schemes[] = {
- "rtsp",
- "rtspu",
- "rtspt",
- "rtsph",
- NULL
-};
-
-static GstRTSPLowerTrans rtsp_url_transports[] = {
- GST_RTSP_LOWER_TRANS_TCP | GST_RTSP_LOWER_TRANS_UDP |
- GST_RTSP_LOWER_TRANS_UDP_MCAST,
- GST_RTSP_LOWER_TRANS_UDP | GST_RTSP_LOWER_TRANS_UDP_MCAST,
- GST_RTSP_LOWER_TRANS_TCP,
- GST_RTSP_LOWER_TRANS_HTTP | GST_RTSP_LOWER_TRANS_TCP,
-};
-
-/* format is rtsp[u]://[user:passwd@]host[:port]/abspath[?query] where host
- * is a host name, an IPv4 dotted decimal address ("aaa.bbb.ccc.ddd") or an
- * [IPv6] address ("[aabb:ccdd:eeff:gghh::sstt]" note the brackets around the
- * address to allow the distinction between ':' as an IPv6 hexgroup separator
- * and as a host/port separator) */
-
-/**
- * gst_rtsp_url_parse:
- * @urlstr: the url string to parse
- * @url: location to hold the result.
- *
- * Parse the RTSP @urlstr into a newly allocated #GstRTSPUrl. Free after usage
- * with gst_rtsp_url_free().
- *
- * Returns: a #GstRTSPResult.
- */
-GstRTSPResult
-gst_rtsp_url_parse (const gchar * urlstr, GstRTSPUrl ** url)
-{
- GstRTSPUrl *res;
- gchar *p, *delim, *at, *col;
- gchar *host_end = NULL;
- guint scheme;
-
- g_return_val_if_fail (urlstr != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (url != NULL, GST_RTSP_EINVAL);
-
- res = g_new0 (GstRTSPUrl, 1);
-
- p = (gchar *) urlstr;
-
- col = strstr (p, "://");
- if (col == NULL)
- goto invalid;
-
- for (scheme = 0; rtsp_url_schemes[scheme] != NULL; scheme++) {
- if (g_ascii_strncasecmp (rtsp_url_schemes[scheme], p, col - p) == 0) {
- res->transports = rtsp_url_transports[scheme];
- p = col + 3;
- break;
- }
- }
-
- if (res->transports == GST_RTSP_LOWER_TRANS_UNKNOWN)
- goto invalid;
-
- delim = strpbrk (p, "/?");
- at = strchr (p, '@');
-
- if (at && delim && at > delim)
- at = NULL;
-
- if (at) {
- col = strchr (p, ':');
-
- /* must have a ':' and it must be before the '@' */
- if (col == NULL || col > at)
- goto invalid;
-
- res->user = g_strndup (p, col - p);
- col++;
- res->passwd = g_strndup (col, at - col);
-
- /* move to host */
- p = at + 1;
- }
-
- if (*p == '[') {
- res->family = GST_RTSP_FAM_INET6;
-
- /* we have an IPv6 address in the URL, find the ending ] which must be
- * before any delimiter */
- host_end = strchr (++p, ']');
- if (!host_end || (delim && host_end >= delim))
- goto invalid;
-
- /* a port specifier must follow the address immediately */
- col = host_end[1] == ':' ? host_end + 1 : NULL;
- } else {
- res->family = GST_RTSP_FAM_INET;
-
- col = strchr (p, ':');
-
- /* we have a ':' and a delimiter but the ':' is after the delimiter, it's
- * not really part of the hostname */
- if (col && delim && col >= delim)
- col = NULL;
-
- host_end = col ? col : delim;
- }
-
- if (!host_end)
- res->host = g_strdup (p);
- else {
- res->host = g_strndup (p, host_end - p);
-
- if (col) {
- res->port = strtoul (col + 1, NULL, 10);
- } else {
- /* no port specified, set to 0. gst_rtsp_url_get_port() will return the
- * default port */
- res->port = 0;
- }
- }
- p = delim;
-
- if (p && *p == '/') {
- delim = strchr (p, '?');
- if (!delim)
- res->abspath = g_strdup (p);
- else
- res->abspath = g_strndup (p, delim - p);
- p = delim;
- } else {
- res->abspath = g_strdup ("/");
- }
-
- if (p && *p == '?')
- res->query = g_strdup (p + 1);
-
- *url = res;
-
- return GST_RTSP_OK;
-
- /* ERRORS */
-invalid:
- {
- gst_rtsp_url_free (res);
- return GST_RTSP_EINVAL;
- }
-}
-
-/**
- * gst_rtsp_url_copy:
- * @url: a #GstRTSPUrl
- *
- * Make a copy of @url.
- *
- * Returns: a copy of @url. Free with gst_rtsp_url_free () after usage.
- *
- * Since: 0.10.22
- */
-GstRTSPUrl *
-gst_rtsp_url_copy (const GstRTSPUrl * url)
-{
- GstRTSPUrl *res;
-
- g_return_val_if_fail (url != NULL, NULL);
-
- res = g_new0 (GstRTSPUrl, 1);
-
- res->transports = url->transports;
- res->family = url->family;
- res->user = g_strdup (url->user);
- res->passwd = g_strdup (url->passwd);
- res->host = g_strdup (url->host);
- res->port = url->port;
- res->abspath = g_strdup (url->abspath);
- res->query = g_strdup (url->query);
-
- return res;
-}
-
-/**
- * gst_rtsp_url_free:
- * @url: a #GstRTSPUrl
- *
- * Free the memory used by @url.
- */
-void
-gst_rtsp_url_free (GstRTSPUrl * url)
-{
- if (url == NULL)
- return;
-
- g_free (url->user);
- g_free (url->passwd);
- g_free (url->host);
- g_free (url->abspath);
- g_free (url->query);
- g_free (url);
-}
-
-/**
- * gst_rtsp_url_set_port:
- * @url: a #GstRTSPUrl
- * @port: the port
- *
- * Set the port number in @url to @port.
- *
- * Returns: #GST_RTSP_OK.
- */
-GstRTSPResult
-gst_rtsp_url_set_port (GstRTSPUrl * url, guint16 port)
-{
- g_return_val_if_fail (url != NULL, GST_RTSP_EINVAL);
-
- url->port = port;
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_url_get_port:
- * @url: a #GstRTSPUrl
- * @port: location to hold the port
- *
- * Get the port number of @url.
- *
- * Returns: #GST_RTSP_OK.
- */
-GstRTSPResult
-gst_rtsp_url_get_port (const GstRTSPUrl * url, guint16 * port)
-{
- g_return_val_if_fail (url != NULL, GST_RTSP_EINVAL);
- g_return_val_if_fail (port != NULL, GST_RTSP_EINVAL);
-
- /* if a port was specified, use that else use the default port. */
- if (url->port != 0)
- *port = url->port;
- else
- *port = GST_RTSP_DEFAULT_PORT;
-
- return GST_RTSP_OK;
-}
-
-/**
- * gst_rtsp_url_get_request_uri:
- * @url: a #GstRTSPUrl
- *
- * Get a newly allocated string describing the request URI for @url.
- *
- * Returns: a string with the request URI. g_free() after usage.
- */
-gchar *
-gst_rtsp_url_get_request_uri (const GstRTSPUrl * url)
-{
- gchar *uri;
- gchar *pre_host;
- gchar *post_host;
- gchar *pre_query;
- gchar *query;
-
- g_return_val_if_fail (url != NULL, NULL);
-
- pre_host = url->family == GST_RTSP_FAM_INET6 ? "[" : "";
- post_host = url->family == GST_RTSP_FAM_INET6 ? "]" : "";
- pre_query = url->query ? "?" : "";
- query = url->query ? url->query : "";
-
- if (url->port != 0) {
- uri = g_strdup_printf ("rtsp://%s%s%s:%u%s%s%s", pre_host, url->host,
- post_host, url->port, url->abspath, pre_query, query);
- } else {
- uri = g_strdup_printf ("rtsp://%s%s%s%s%s%s", pre_host, url->host,
- post_host, url->abspath, pre_query, query);
- }
-
- return uri;
-}
diff --git a/gst-libs/gst/rtsp/gstrtspurl.h b/gst-libs/gst/rtsp/gstrtspurl.h
deleted file mode 100644
index db9620ec..00000000
--- a/gst-libs/gst/rtsp/gstrtspurl.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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;
-};
-
-GType gst_rtsp_url_get_type (void);
-
-GstRTSPResult gst_rtsp_url_parse (const gchar *urlstr, GstRTSPUrl **url);
-GstRTSPUrl* gst_rtsp_url_copy (const GstRTSPUrl *url);
-void gst_rtsp_url_free (GstRTSPUrl *url);
-gchar* gst_rtsp_url_get_request_uri (const GstRTSPUrl *url);
-
-GstRTSPResult gst_rtsp_url_set_port (GstRTSPUrl *url, guint16 port);
-GstRTSPResult gst_rtsp_url_get_port (const GstRTSPUrl *url, guint16 *port);
-
-G_END_DECLS
-
-#endif /* __GST_RTSP_URL_H__ */
diff --git a/gst-libs/gst/sdp/Makefile.am b/gst-libs/gst/sdp/Makefile.am
deleted file mode 100644
index d1ad5c38..00000000
--- a/gst-libs/gst/sdp/Makefile.am
+++ /dev/null
@@ -1,50 +0,0 @@
-libgstsdpincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/sdp
-
-libgstsdpinclude_HEADERS = gstsdp.h \
- gstsdpmessage.h
-
-lib_LTLIBRARIES = libgstsdp-@GST_MAJORMINOR@.la
-
-libgstsdp_@GST_MAJORMINOR@_la_SOURCES = gstsdpmessage.c
-
-libgstsdp_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
-libgstsdp_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS) $(WIN32_LIBS)
-libgstsdp_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
-
-if HAVE_INTROSPECTION
-BUILT_GIRSOURCES = GstSdp-@GST_MAJORMINOR@.gir
-
-gir_headers=$(patsubst %,$(srcdir)/%, $(libgstsdpinclude_HEADERS))
-gir_sources=$(patsubst %,$(srcdir)/%, $(libgstsdp_@GST_MAJORMINOR@_la_SOURCES))
-gir_cincludes=$(patsubst %,--c-include='gst/audio/%',$(libgstsdpinclude_HEADERS))
-
-GstSdp-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstsdp-@GST_MAJORMINOR@.la
- PKG_CONFIG_PATH="$(PKG_CONFIG_PATH):$(top_builddir)/pkgconfig" \
- $(INTROSPECTION_SCANNER) -v --namespace GstSdp \
- --nsversion=@GST_MAJORMINOR@ \
- --strip-prefix=Gst \
- $(gir_cincludes) \
- -I$(top_srcdir)/gst-libs \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst \
- --library=gstsdp-0.10 \
- --include=Gst-0.10 \
- --libtool="$(top_builddir)/libtool" \
- --pkg gstreamer-0.10 \
- --output $@ \
- $(gir_headers) \
- $(gir_sources)
-
-# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
-# install anything - we need to install inside our prefix.
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(BUILT_GIRSOURCES)
-
-typelibsdir = $(libdir)/girepository-1.0/
-
-typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
-
-%.typelib: %.gir $(INTROSPECTION_COMPILER)
- $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=$(builddir) --includedir=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
-CLEANFILES = $(BUILT_GIRSOURCES) $(typelibs_DATA)
-endif
diff --git a/gst-libs/gst/sdp/gstsdp.h b/gst-libs/gst/sdp/gstsdp.h
deleted file mode 100644
index 3dbd86d2..00000000
--- a/gst-libs/gst/sdp/gstsdp.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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/gst-libs/gst/sdp/gstsdpmessage.c b/gst-libs/gst/sdp/gstsdpmessage.c
deleted file mode 100644
index 5495abc3..00000000
--- a/gst-libs/gst/sdp/gstsdpmessage.c
+++ /dev/null
@@ -1,2039 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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.
- */
-
-/**
- * SECTION:gstsdpmessage
- * @short_description: Helper methods for dealing with SDP messages
- *
- * <refsect2>
- * <para>
- * The GstSDPMessage helper functions makes it easy to parse and create SDP
- * messages.
- * </para>
- * </refsect2>
- *
- * Last reviewed on 2007-07-24 (0.10.14)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#include <glib.h> /* for G_OS_WIN32 */
-#include <gst/gstinfo.h> /* For GST_STR_NULL */
-
-#ifdef G_OS_WIN32
-/* ws2_32.dll has getaddrinfo and freeaddrinfo on Windows XP and later.
- * minwg32 headers check WINVER before allowing the use of these */
-#ifndef WINVER
-#define WINVER 0x0501
-#endif
-#ifdef _MSC_VER
-#include <Winsock2.h>
-#endif
-#include <ws2tcpip.h>
-#else
-#include <sys/socket.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#endif
-
-#include "gstsdpmessage.h"
-
-/* FIXME, is currently allocated on the stack */
-#define MAX_LINE_LEN 1024 * 16
-
-#define FREE_STRING(field) g_free (field); (field) = NULL
-#define REPLACE_STRING(field, val) FREE_STRING(field); (field) = g_strdup (val)
-
-#define INIT_ARRAY(field, type, init_func) \
-G_STMT_START { \
- if (field) { \
- guint i; \
- for(i = 0; i < (field)->len; i++) \
- init_func (&g_array_index ((field), type, i)); \
- g_array_set_size ((field), 0); \
- } \
- else \
- (field) = g_array_new (FALSE, TRUE, sizeof (type)); \
-} G_STMT_END
-
-#define FREE_ARRAY(field) \
-G_STMT_START { \
- if (field) \
- g_array_free ((field), TRUE); \
- (field) = NULL; \
-} G_STMT_END
-
-#define INIT_PTR_ARRAY(field, type, init_func) \
-G_STMT_START { \
- if (field) { \
- guint i; \
- for(i = 0; i < (field)->len; i++) \
- init_func (g_array_index ((field), type, i)); \
- g_array_set_size ((field), 0); \
- } \
- else \
- (field) = g_array_new (FALSE, TRUE, sizeof (type)); \
-} G_STMT_END
-
-#define FREE_PTR_ARRAY(field) FREE_ARRAY(field)
-
-#define DEFINE_STRING_SETTER(field) \
-GstSDPResult gst_sdp_message_set_##field (GstSDPMessage *msg, const gchar *val) { \
- g_free (msg->field); \
- msg->field = g_strdup (val); \
- return GST_SDP_OK; \
-}
-#define DEFINE_STRING_GETTER(field) \
-const gchar* gst_sdp_message_get_##field (const GstSDPMessage *msg) { \
- return msg->field; \
-}
-
-#define DEFINE_ARRAY_LEN(field) \
-guint gst_sdp_message_##field##_len (const GstSDPMessage *msg) { \
- return msg->field->len; \
-}
-#define DEFINE_ARRAY_GETTER(method, field, type) \
-type * gst_sdp_message_get_##method (const GstSDPMessage *msg, guint idx) { \
- return &g_array_index (msg->field, type, idx); \
-}
-
-#define DEFINE_PTR_ARRAY_LEN(field) DEFINE_ARRAY_LEN(field)
-#define DEFINE_PTR_ARRAY_GETTER(method, field, type) \
-type gst_sdp_message_get_##method (const GstSDPMessage *msg, guint idx) { \
- return g_array_index (msg->field, type, idx); \
-}
-#define DEFINE_PTR_ARRAY_ADDER(method, field, type, dup_method) \
-GstSDPResult gst_sdp_message_add_##method (GstSDPMessage *msg, type val) { \
- type v = dup_method (val); \
- g_array_append_val (msg->field, v); \
- return GST_SDP_OK; \
-}
-
-static void
-gst_sdp_origin_init (GstSDPOrigin * origin)
-{
- FREE_STRING (origin->username);
- FREE_STRING (origin->sess_id);
- FREE_STRING (origin->sess_version);
- FREE_STRING (origin->nettype);
- FREE_STRING (origin->addrtype);
- FREE_STRING (origin->addr);
-}
-
-static void
-gst_sdp_connection_init (GstSDPConnection * connection)
-{
- FREE_STRING (connection->nettype);
- FREE_STRING (connection->addrtype);
- FREE_STRING (connection->address);
- connection->ttl = 0;
- connection->addr_number = 0;
-}
-
-static void
-gst_sdp_bandwidth_init (GstSDPBandwidth * bandwidth)
-{
- FREE_STRING (bandwidth->bwtype);
- bandwidth->bandwidth = 0;
-}
-
-static void
-gst_sdp_time_init (GstSDPTime * t)
-{
- FREE_STRING (t->start);
- FREE_STRING (t->stop);
- INIT_PTR_ARRAY (t->repeat, gchar *, g_free);
- FREE_PTR_ARRAY (t->repeat);
-}
-
-static void
-gst_sdp_zone_init (GstSDPZone * zone)
-{
- FREE_STRING (zone->time);
- FREE_STRING (zone->typed_time);
-}
-
-static void
-gst_sdp_key_init (GstSDPKey * key)
-{
- FREE_STRING (key->type);
- FREE_STRING (key->data);
-}
-
-static void
-gst_sdp_attribute_init (GstSDPAttribute * attr)
-{
- FREE_STRING (attr->key);
- FREE_STRING (attr->value);
-}
-
-/**
- * gst_sdp_message_new:
- * @msg: pointer to new #GstSDPMessage
- *
- * Allocate a new GstSDPMessage and store the result in @msg.
- *
- * Returns: a #GstSDPResult.
- */
-GstSDPResult
-gst_sdp_message_new (GstSDPMessage ** msg)
-{
- GstSDPMessage *newmsg;
-
- g_return_val_if_fail (msg != NULL, GST_SDP_EINVAL);
-
- newmsg = g_new0 (GstSDPMessage, 1);
-
- *msg = newmsg;
-
- return gst_sdp_message_init (newmsg);
-}
-
-/**
- * gst_sdp_message_init:
- * @msg: a #GstSDPMessage
- *
- * Initialize @msg so that its contents are as if it was freshly allocated
- * with gst_sdp_message_new(). This function is mostly used to initialize a message
- * allocated on the stack. gst_sdp_message_uninit() undoes this operation.
- *
- * When this function is invoked on newly allocated data (with malloc or on the
- * stack), its contents should be set to 0 before calling this function.
- *
- * Returns: a #GstSDPResult.
- */
-GstSDPResult
-gst_sdp_message_init (GstSDPMessage * msg)
-{
- g_return_val_if_fail (msg != NULL, GST_SDP_EINVAL);
-
- FREE_STRING (msg->version);
- gst_sdp_origin_init (&msg->origin);
- FREE_STRING (msg->session_name);
- FREE_STRING (msg->information);
- FREE_STRING (msg->uri);
- INIT_PTR_ARRAY (msg->emails, gchar *, g_free);
- INIT_PTR_ARRAY (msg->phones, gchar *, g_free);
- gst_sdp_connection_init (&msg->connection);
- INIT_ARRAY (msg->bandwidths, GstSDPBandwidth, gst_sdp_bandwidth_init);
- INIT_ARRAY (msg->times, GstSDPTime, gst_sdp_time_init);
- INIT_ARRAY (msg->zones, GstSDPZone, gst_sdp_zone_init);
- gst_sdp_key_init (&msg->key);
- INIT_ARRAY (msg->attributes, GstSDPAttribute, gst_sdp_attribute_init);
- INIT_ARRAY (msg->medias, GstSDPMedia, gst_sdp_media_uninit);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_message_uninit:
- * @msg: a #GstSDPMessage
- *
- * Free all resources allocated in @msg. @msg should not be used anymore after
- * this function. This function should be used when @msg was allocated on the
- * stack and initialized with gst_sdp_message_init().
- *
- * Returns: a #GstSDPResult.
- */
-GstSDPResult
-gst_sdp_message_uninit (GstSDPMessage * msg)
-{
- g_return_val_if_fail (msg != NULL, GST_SDP_EINVAL);
-
- gst_sdp_message_init (msg);
-
- FREE_PTR_ARRAY (msg->emails);
- FREE_PTR_ARRAY (msg->phones);
- FREE_ARRAY (msg->bandwidths);
- FREE_ARRAY (msg->times);
- FREE_ARRAY (msg->zones);
- FREE_ARRAY (msg->attributes);
- FREE_ARRAY (msg->medias);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_message_free:
- * @msg: a #GstSDPMessage
- *
- * Free all resources allocated by @msg. @msg should not be used anymore after
- * this function. This function should be used when @msg was dynamically
- * allocated with gst_sdp_message_new().
- *
- * Returns: a #GstSDPResult.
- */
-GstSDPResult
-gst_sdp_message_free (GstSDPMessage * msg)
-{
- g_return_val_if_fail (msg != NULL, GST_SDP_EINVAL);
-
- gst_sdp_message_uninit (msg);
- g_free (msg);
-
- return GST_SDP_OK;
-}
-
-static gboolean
-is_multicast_address (const gchar * host_name, guint * family)
-{
- struct addrinfo hints;
- struct addrinfo *ai;
- struct addrinfo *res;
- gboolean ret = FALSE;
-
- memset (&hints, 0, sizeof (hints));
- hints.ai_socktype = SOCK_DGRAM;
-
- g_return_val_if_fail (host_name, FALSE);
-
- if (getaddrinfo (host_name, NULL, &hints, &res) < 0)
- return FALSE;
-
- for (ai = res; !ret && ai; ai = ai->ai_next) {
- if (ai->ai_family == AF_INET)
- ret =
- IN_MULTICAST (ntohl (((struct sockaddr_in *) ai->ai_addr)->sin_addr.
- s_addr));
- else
- ret =
- IN6_IS_ADDR_MULTICAST (&((struct sockaddr_in6 *) ai->ai_addr)->
- sin6_addr);
- if (ret && family)
- *family = ai->ai_family;
- }
-
- freeaddrinfo (res);
-
- return ret;
-}
-
-/**
- * gst_sdp_message_as_text:
- * @msg: a #GstSDPMessage
- *
- * Convert the contents of @msg to a text string.
- *
- * Returns: A dynamically allocated string representing the SDP description.
- */
-gchar *
-gst_sdp_message_as_text (const GstSDPMessage * msg)
-{
- /* change all vars so they match rfc? */
- GString *lines;
- guint i;
-
- g_return_val_if_fail (msg != NULL, NULL);
-
- lines = g_string_new ("");
-
- if (msg->version)
- g_string_append_printf (lines, "v=%s\r\n", msg->version);
-
- if (msg->origin.sess_id && msg->origin.sess_version && msg->origin.nettype &&
- msg->origin.addrtype && msg->origin.addr)
- g_string_append_printf (lines, "o=%s %s %s %s %s %s\r\n",
- msg->origin.username ? msg->origin.username : "-", msg->origin.sess_id,
- msg->origin.sess_version, msg->origin.nettype, msg->origin.addrtype,
- msg->origin.addr);
-
- if (msg->session_name)
- g_string_append_printf (lines, "s=%s\r\n", msg->session_name);
-
- if (msg->information)
- g_string_append_printf (lines, "i=%s\r\n", msg->information);
-
- if (msg->uri)
- g_string_append_printf (lines, "u=%s\r\n", msg->uri);
-
- for (i = 0; i < gst_sdp_message_emails_len (msg); i++)
- g_string_append_printf (lines, "e=%s\r\n",
- gst_sdp_message_get_email (msg, i));
-
- for (i = 0; i < gst_sdp_message_phones_len (msg); i++)
- g_string_append_printf (lines, "p=%s\r\n",
- gst_sdp_message_get_phone (msg, i));
-
- if (gst_sdp_message_emails_len (msg) == 0 &&
- gst_sdp_message_phones_len (msg) == 0)
- g_string_append_printf (lines, "e=NONE\r\n");
-
- if (msg->connection.nettype && msg->connection.addrtype &&
- msg->connection.address) {
- guint family;
-
- g_string_append_printf (lines, "c=%s %s %s", msg->connection.nettype,
- msg->connection.addrtype, msg->connection.address);
- if (is_multicast_address (msg->connection.address, &family)) {
- if (family == AF_INET)
- g_string_append_printf (lines, "/%u", msg->connection.ttl);
- if (msg->connection.addr_number > 1)
- g_string_append_printf (lines, "/%u", msg->connection.addr_number);
- }
- g_string_append_printf (lines, "\r\n");
- }
-
- for (i = 0; i < gst_sdp_message_bandwidths_len (msg); i++) {
- const GstSDPBandwidth *bandwidth = gst_sdp_message_get_bandwidth (msg, i);
-
- g_string_append_printf (lines, "b=%s:%u\r\n", bandwidth->bwtype,
- bandwidth->bandwidth);
- }
-
- for (i = 0; i < gst_sdp_message_times_len (msg); i++) {
- const GstSDPTime *times = gst_sdp_message_get_time (msg, i);
-
- g_string_append_printf (lines, "t=%s %s\r\n", times->start, times->stop);
-
- if (times->repeat != NULL) {
- guint j;
-
- g_string_append_printf (lines, "r=%s",
- g_array_index (times->repeat, gchar *, 0));
- for (j = 1; j < times->repeat->len; j++)
- g_string_append_printf (lines, " %s",
- g_array_index (times->repeat, gchar *, j));
- g_string_append_printf (lines, "\r\n");
- }
- }
-
- if (gst_sdp_message_zones_len (msg) > 0) {
- const GstSDPZone *zone = gst_sdp_message_get_zone (msg, 0);
-
- g_string_append_printf (lines, "z=%s %s", zone->time, zone->typed_time);
- for (i = 1; i < gst_sdp_message_zones_len (msg); i++) {
- zone = gst_sdp_message_get_zone (msg, i);
- g_string_append_printf (lines, " %s %s", zone->time, zone->typed_time);
- }
- g_string_append_printf (lines, "\r\n");
- }
-
- if (msg->key.type) {
- g_string_append_printf (lines, "k=%s", msg->key.type);
- if (msg->key.data)
- g_string_append_printf (lines, ":%s", msg->key.data);
- g_string_append_printf (lines, "\r\n");
- }
-
- for (i = 0; i < gst_sdp_message_attributes_len (msg); i++) {
- const GstSDPAttribute *attr = gst_sdp_message_get_attribute (msg, i);
-
- if (attr->key) {
- g_string_append_printf (lines, "a=%s", attr->key);
- if (attr->value)
- g_string_append_printf (lines, ":%s", attr->value);
- g_string_append_printf (lines, "\r\n");
- }
- }
-
- for (i = 0; i < gst_sdp_message_medias_len (msg); i++) {
- const GstSDPMedia *media = gst_sdp_message_get_media (msg, i);
- gchar *sdp_media_str;
-
- sdp_media_str = gst_sdp_media_as_text (media);
- g_string_append_printf (lines, "%s", sdp_media_str);
- g_free (sdp_media_str);
- }
-
- return g_string_free (lines, FALSE);
-}
-
-/**
- * gst_sdp_message_set_version:
- * @msg: a #GstSDPMessage
- * @version: the version
- *
- * Set the version in @msg.
- *
- * Returns: a #GstSDPResult.
- */
-DEFINE_STRING_SETTER (version);
-/**
- * gst_sdp_message_get_version:
- * @msg: a #GstSDPMessage
- *
- * Get the version in @msg.
- *
- * Returns: a #GstSDPResult.
- */
-DEFINE_STRING_GETTER (version);
-
-/**
- * gst_sdp_message_set_origin:
- * @msg: a #GstSDPMessage
- * @username: the user name
- * @sess_id: a session id
- * @sess_version: a session version
- * @nettype: a network type
- * @addrtype: an address type
- * @addr: an address
- *
- * Configure the SDP origin in @msg with the given parameters.
- *
- * Returns: #GST_SDP_OK.
- */
-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)
-{
- REPLACE_STRING (msg->origin.username, username);
- REPLACE_STRING (msg->origin.sess_id, sess_id);
- REPLACE_STRING (msg->origin.sess_version, sess_version);
- REPLACE_STRING (msg->origin.nettype, nettype);
- REPLACE_STRING (msg->origin.addrtype, addrtype);
- REPLACE_STRING (msg->origin.addr, addr);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_message_get_origin:
- * @msg: a #GstSDPMessage
- *
- * Get the origin of @msg.
- *
- * Returns: a #GstSDPOrigin. The result remains valid as long as @msg is valid.
- */
-const GstSDPOrigin *
-gst_sdp_message_get_origin (const GstSDPMessage * msg)
-{
- return &msg->origin;
-}
-
-/**
- * gst_sdp_message_set_session_name:
- * @msg: a #GstSDPMessage
- * @session_name: the session name
- *
- * Set the session name in @msg.
- *
- * Returns: a #GstSDPResult.
- */
-DEFINE_STRING_SETTER (session_name);
-/**
- * gst_sdp_message_get_session_name:
- * @msg: a #GstSDPMessage
- *
- * Get the session name in @msg.
- *
- * Returns: a #GstSDPResult.
- */
-DEFINE_STRING_GETTER (session_name);
-/**
- * gst_sdp_message_set_information:
- * @msg: a #GstSDPMessage
- * @information: the information
- *
- * Set the information in @msg.
- *
- * Returns: a #GstSDPResult.
- */
-DEFINE_STRING_SETTER (information);
-/**
- * gst_sdp_message_get_information:
- * @msg: a #GstSDPMessage
- *
- * Get the information in @msg.
- *
- * Returns: a #GstSDPResult.
- */
-DEFINE_STRING_GETTER (information);
-/**
- * gst_sdp_message_set_uri:
- * @msg: a #GstSDPMessage
- * @uri: the URI
- *
- * Set the URI in @msg.
- *
- * Returns: a #GstSDPResult.
- */
-DEFINE_STRING_SETTER (uri);
-/**
- * gst_sdp_message_get_uri:
- * @msg: a #GstSDPMessage
- *
- * Get the URI in @msg.
- *
- * Returns: a #GstSDPResult.
- */
-DEFINE_STRING_GETTER (uri);
-
-/**
- * gst_sdp_message_emails_len:
- * @msg: a #GstSDPMessage
- *
- * Get the number of emails in @msg.
- *
- * Returns: the number of emails in @msg.
- */
-DEFINE_ARRAY_LEN (emails);
-/**
- * gst_sdp_message_get_email:
- * @msg: a #GstSDPMessage
- * @idx: an email index
- *
- * Get the email with number @idx from @msg.
- *
- * Returns: the email at position @idx.
- */
-DEFINE_PTR_ARRAY_GETTER (email, emails, const gchar *);
-
-/**
- * gst_sdp_message_add_email:
- * @msg: a #GstSDPMessage
- * @email: an email
- *
- * Add @email to the list of emails in @msg.
- *
- * Returns: a #GstSDPResult.
- */
-DEFINE_PTR_ARRAY_ADDER (email, emails, const gchar *, g_strdup);
-
-/**
- * gst_sdp_message_phones_len:
- * @msg: a #GstSDPMessage
- *
- * Get the number of phones in @msg.
- *
- * Returns: the number of phones in @msg.
- */
-DEFINE_ARRAY_LEN (phones);
-/**
- * gst_sdp_message_get_phone:
- * @msg: a #GstSDPMessage
- * @idx: a phone index
- *
- * Get the phone with number @idx from @msg.
- *
- * Returns: the phone at position @idx.
- */
-DEFINE_PTR_ARRAY_GETTER (phone, phones, const gchar *);
-
-/**
- * gst_sdp_message_add_phone:
- * @msg: a #GstSDPMessage
- * @phone: a phone
- *
- * Add @phone to the list of phones in @msg.
- *
- * Returns: a #GstSDPResult.
- */
-DEFINE_PTR_ARRAY_ADDER (phone, phones, const gchar *, g_strdup);
-
-/**
- * gst_sdp_message_set_connection:
- * @msg: a #GstSDPMessage
- * @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
- *
- * Configure the SDP connection in @msg with the given parameters.
- *
- * Returns: a #GstSDPResult.
- */
-GstSDPResult
-gst_sdp_message_set_connection (GstSDPMessage * msg, const gchar * nettype,
- const gchar * addrtype, const gchar * address, guint ttl, guint addr_number)
-{
- REPLACE_STRING (msg->connection.nettype, nettype);
- REPLACE_STRING (msg->connection.addrtype, addrtype);
- REPLACE_STRING (msg->connection.address, address);
- msg->connection.ttl = ttl;
- msg->connection.addr_number = addr_number;
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_message_get_connection:
- * @msg: a #GstSDPMessage
- *
- * Get the connection of @msg.
- *
- * Returns: a #GstSDPConnection. The result remains valid as long as @msg is valid.
- */
-const GstSDPConnection *
-gst_sdp_message_get_connection (const GstSDPMessage * msg)
-{
- return &msg->connection;
-}
-
-/**
- * gst_sdp_message_bandwidths_len:
- * @msg: a #GstSDPMessage
- *
- * Get the number of bandwidth information in @msg.
- *
- * Returns: the number of bandwidth information in @msg.
- */
-DEFINE_ARRAY_LEN (bandwidths);
-/**
- * gst_sdp_message_get_bandwidth:
- * @msg: a #GstSDPMessage
- * @idx: the bandwidth index
- *
- * Get the bandwidth at index @idx from @msg.
- *
- * Returns: a #GstSDPBandwidth.
- */
-DEFINE_ARRAY_GETTER (bandwidth, bandwidths, const GstSDPBandwidth);
-
-/**
- * gst_sdp_message_add_bandwidth:
- * @msg: a #GstSDPMessage
- * @bwtype: the bandwidth modifier type
- * @bandwidth: the bandwidth in kilobits per second
- *
- * Add the specified bandwidth information to @msg.
- *
- * Returns: a #GstSDPResult.
- */
-
-GstSDPResult
-gst_sdp_message_add_bandwidth (GstSDPMessage * msg, const gchar * bwtype,
- guint bandwidth)
-{
- GstSDPBandwidth bw;
-
- bw.bwtype = g_strdup (bwtype);
- bw.bandwidth = bandwidth;
-
- g_array_append_val (msg->bandwidths, bw);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_message_times_len:
- * @msg: a #GstSDPMessage
- *
- * Get the number of time information entries in @msg.
- *
- * Returns: the number of time information entries in @msg.
- */
-DEFINE_ARRAY_LEN (times);
-
-/**
- * gst_sdp_message_get_time:
- * @msg: a #GstSDPMessage
- * @idx: the time index
- *
- * Get time information with index @idx from @msg.
- *
- * Returns: a #GstSDPTime.
- */
-DEFINE_ARRAY_GETTER (time, times, const GstSDPTime);
-
-/**
- * gst_sdp_message_add_time:
- * @msg: a #GstSDPMessage
- * @start: the start time
- * @stop: the stop time
- * @repeat: the repeat times
- *
- * Add time information @start and @stop to @msg.
- *
- * Returns: a #GstSDPResult.
- */
-GstSDPResult
-gst_sdp_message_add_time (GstSDPMessage * msg, const gchar * start,
- const gchar * stop, const gchar ** repeat)
-{
- GstSDPTime times;
-
- times.start = g_strdup (start);
- times.stop = g_strdup (stop);
- if (repeat) {
- times.repeat = g_array_new (FALSE, TRUE, sizeof (gchar *));
- for (; *repeat; repeat++) {
- gchar *r = g_strdup (*repeat);
-
- g_array_append_val (times.repeat, r);
- }
- } else
- times.repeat = NULL;
- g_array_append_val (msg->times, times);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_message_zones_len:
- * @msg: a #GstSDPMessage
- *
- * Get the number of time zone information entries in @msg.
- *
- * Returns: the number of time zone information entries in @msg.
- */
-DEFINE_ARRAY_LEN (zones);
-/**
- * gst_sdp_message_get_zone:
- * @msg: a #GstSDPMessage
- * @idx: the zone index
- *
- * Get time zone information with index @idx from @msg.
- *
- * Returns: a #GstSDPZone.
- */
-DEFINE_ARRAY_GETTER (zone, zones, const GstSDPZone);
-
-/**
- * gst_sdp_message_add_zone:
- * @msg: a #GstSDPMessage
- * @adj_time: the NTP time that a time zone adjustment happens
- * @typed_time: the offset from the time when the session was first scheduled
- *
- * Add time zone information to @msg.
- *
- * Returns: a #GstSDPResult.
- */
-GstSDPResult
-gst_sdp_message_add_zone (GstSDPMessage * msg, const gchar * adj_time,
- const gchar * typed_time)
-{
- GstSDPZone zone;
-
- zone.time = g_strdup (adj_time);
- zone.typed_time = g_strdup (typed_time);
-
- g_array_append_val (msg->zones, zone);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_message_set_key:
- * @msg: a #GstSDPMessage
- * @type: the encryption type
- * @data: the encryption data
- *
- * Adds the encryption information to @msg.
- *
- * Returns: a #GstSDPResult.
- */
-GstSDPResult
-gst_sdp_message_set_key (GstSDPMessage * msg, const gchar * type,
- const gchar * data)
-{
- REPLACE_STRING (msg->key.type, type);
- REPLACE_STRING (msg->key.data, data);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_message_get_key:
- * @msg: a #GstSDPMessage
- *
- * Get the encryption information from @msg.
- *
- * Returns: a #GstSDPKey.
- */
-const GstSDPKey *
-gst_sdp_message_get_key (const GstSDPMessage * msg)
-{
- return &msg->key;
-}
-
-/**
- * gst_sdp_message_attributes_len:
- * @msg: a #GstSDPMessage
- *
- * Get the number of attributes in @msg.
- *
- * Returns: the number of attributes in @msg.
- */
-DEFINE_ARRAY_LEN (attributes);
-
-/**
- * gst_sdp_message_get_attribute:
- * @msg: a #GstSDPMessage
- * @idx: the index
- *
- * Get the attribute at position @idx in @msg.
- *
- * Returns: the #GstSDPAttribute at position @idx.
- */
-DEFINE_ARRAY_GETTER (attribute, attributes, const GstSDPAttribute);
-
-/**
- * gst_sdp_message_get_attribute_val_n:
- * @msg: a #GstSDPMessage
- * @key: the key
- * @nth: the index
- *
- * Get the @nth attribute with key @key in @msg.
- *
- * Returns: the attribute value of the @nth attribute with @key.
- */
-const gchar *
-gst_sdp_message_get_attribute_val_n (const GstSDPMessage * msg,
- const gchar * key, guint nth)
-{
- guint i;
-
- for (i = 0; i < msg->attributes->len; i++) {
- GstSDPAttribute *attr;
-
- attr = &g_array_index (msg->attributes, GstSDPAttribute, i);
- if (!strcmp (attr->key, key)) {
- if (nth == 0)
- return attr->value;
- else
- nth--;
- }
- }
- return NULL;
-}
-
-/**
- * gst_sdp_message_get_attribute_val:
- * @msg: a #GstSDPMessage
- * @key: the key
- *
- * Get the first attribute with key @key in @msg.
- *
- * Returns: the attribute value of the first attribute with @key.
- */
-const gchar *
-gst_sdp_message_get_attribute_val (const GstSDPMessage * msg, const gchar * key)
-{
- return gst_sdp_message_get_attribute_val_n (msg, key, 0);
-}
-
-/**
- * gst_sdp_message_add_attribute:
- * @msg: a #GstSDPMessage
- * @key: the key
- * @value: the value
- *
- * Add the attribute with @key and @value to @msg.
- *
- * Returns: @GST_SDP_OK.
- */
-GstSDPResult
-gst_sdp_message_add_attribute (GstSDPMessage * msg, const gchar * key,
- const gchar * value)
-{
- GstSDPAttribute attr;
-
- attr.key = g_strdup (key);
- attr.value = g_strdup (value);
-
- g_array_append_val (msg->attributes, attr);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_message_medias_len:
- * @msg: a #GstSDPMessage
- *
- * Get the number of media descriptions in @msg.
- *
- * Returns: the number of media descriptions in @msg.
- */
-DEFINE_ARRAY_LEN (medias);
-/**
- * gst_sdp_message_get_media:
- * @msg: a #GstSDPMessage
- * @idx: the index
- *
- * Get the media description at index @idx in @msg.
- *
- * Returns: a #GstSDPMedia.
- */
-DEFINE_ARRAY_GETTER (media, medias, const GstSDPMedia);
-
-/**
- * gst_sdp_message_add_media:
- * @msg: a #GstSDPMessage
- * @media: a #GstSDPMedia to add
- *
- * Adds @media to the array of medias in @msg. This function takes ownership of
- * the contents of @media so that @media will have to be reinitialized with
- * gst_media_init() before it can be used again.
- *
- * Returns: a #GstSDPResult.
- */
-GstSDPResult
-gst_sdp_message_add_media (GstSDPMessage * msg, GstSDPMedia * media)
-{
- guint len;
- GstSDPMedia *nmedia;
-
- len = msg->medias->len;
- g_array_set_size (msg->medias, len + 1);
- nmedia = &g_array_index (msg->medias, GstSDPMedia, len);
-
- memcpy (nmedia, media, sizeof (GstSDPMedia));
- memset (media, 0, sizeof (GstSDPMedia));
-
- return GST_SDP_OK;
-}
-
-/* media access */
-
-/**
- * gst_sdp_media_new:
- * @media: pointer to new #GstSDPMedia
- *
- * Allocate a new GstSDPMedia and store the result in @media.
- *
- * Returns: a #GstSDPResult.
- */
-GstSDPResult
-gst_sdp_media_new (GstSDPMedia ** media)
-{
- GstSDPMedia *newmedia;
-
- g_return_val_if_fail (media != NULL, GST_SDP_EINVAL);
-
- newmedia = g_new0 (GstSDPMedia, 1);
-
- *media = newmedia;
-
- return gst_sdp_media_init (newmedia);
-}
-
-/**
- * gst_sdp_media_init:
- * @media: a #GstSDPMedia
- *
- * Initialize @media so that its contents are as if it was freshly allocated
- * with gst_sdp_media_new(). This function is mostly used to initialize a media
- * allocated on the stack. gst_sdp_media_uninit() undoes this operation.
- *
- * When this function is invoked on newly allocated data (with malloc or on the
- * stack), its contents should be set to 0 before calling this function.
- *
- * Returns: a #GstSDPResult.
- */
-GstSDPResult
-gst_sdp_media_init (GstSDPMedia * media)
-{
- g_return_val_if_fail (media != NULL, GST_SDP_EINVAL);
-
- FREE_STRING (media->media);
- media->port = 0;
- media->num_ports = 0;
- FREE_STRING (media->proto);
- INIT_PTR_ARRAY (media->fmts, gchar *, g_free);
- FREE_STRING (media->information);
- INIT_ARRAY (media->connections, GstSDPConnection, gst_sdp_connection_init);
- INIT_ARRAY (media->bandwidths, GstSDPBandwidth, gst_sdp_bandwidth_init);
- gst_sdp_key_init (&media->key);
- INIT_ARRAY (media->attributes, GstSDPAttribute, gst_sdp_attribute_init);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_media_uninit:
- * @media: a #GstSDPMedia
- *
- * Free all resources allocated in @media. @media should not be used anymore after
- * this function. This function should be used when @media was allocated on the
- * stack and initialized with gst_sdp_media_init().
- *
- * Returns: a #GstSDPResult.
- */
-GstSDPResult
-gst_sdp_media_uninit (GstSDPMedia * media)
-{
- g_return_val_if_fail (media != NULL, GST_SDP_EINVAL);
-
- gst_sdp_media_init (media);
- FREE_PTR_ARRAY (media->fmts);
- FREE_ARRAY (media->connections);
- FREE_ARRAY (media->bandwidths);
- FREE_ARRAY (media->attributes);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_media_free:
- * @media: a #GstSDPMedia
- *
- * Free all resources allocated by @media. @media should not be used anymore after
- * this function. This function should be used when @media was dynamically
- * allocated with gst_sdp_media_new().
- *
- * Returns: a #GstSDPResult.
- */
-GstSDPResult
-gst_sdp_media_free (GstSDPMedia * media)
-{
- g_return_val_if_fail (media != NULL, GST_SDP_EINVAL);
-
- gst_sdp_media_uninit (media);
- g_free (media);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_media_as_text:
- * @media: a #GstSDPMedia
- *
- * Convert the contents of @media to a text string.
- *
- * Returns: A dynamically allocated string representing the media.
- */
-gchar *
-gst_sdp_media_as_text (const GstSDPMedia * media)
-{
- GString *lines;
- guint i;
-
- g_return_val_if_fail (media != NULL, NULL);
-
- lines = g_string_new ("");
-
- if (media->media)
- g_string_append_printf (lines, "m=%s", media->media);
-
- g_string_append_printf (lines, " %u", media->port);
-
- if (media->num_ports > 1)
- g_string_append_printf (lines, "/%u", media->num_ports);
-
- g_string_append_printf (lines, " %s", media->proto);
-
- for (i = 0; i < gst_sdp_media_formats_len (media); i++)
- g_string_append_printf (lines, " %s", gst_sdp_media_get_format (media, i));
- g_string_append_printf (lines, "\r\n");
-
- if (media->information)
- g_string_append_printf (lines, "i=%s", media->information);
-
- for (i = 0; i < gst_sdp_media_connections_len (media); i++) {
- const GstSDPConnection *conn = gst_sdp_media_get_connection (media, i);
-
- if (conn->nettype && conn->addrtype && conn->address) {
- guint family;
-
- g_string_append_printf (lines, "c=%s %s %s", conn->nettype,
- conn->addrtype, conn->address);
- if (is_multicast_address (conn->address, &family)) {
- if (family == AF_INET)
- g_string_append_printf (lines, "/%u", conn->ttl);
- if (conn->addr_number > 1)
- g_string_append_printf (lines, "/%u", conn->addr_number);
- }
- g_string_append_printf (lines, "\r\n");
- }
- }
-
- for (i = 0; i < gst_sdp_media_bandwidths_len (media); i++) {
- const GstSDPBandwidth *bandwidth = gst_sdp_media_get_bandwidth (media, i);
-
- g_string_append_printf (lines, "b=%s:%u\r\n", bandwidth->bwtype,
- bandwidth->bandwidth);
- }
-
- if (media->key.type) {
- g_string_append_printf (lines, "k=%s", media->key.type);
- if (media->key.data)
- g_string_append_printf (lines, ":%s", media->key.data);
- g_string_append_printf (lines, "\r\n");
- }
-
- for (i = 0; i < gst_sdp_media_attributes_len (media); i++) {
- const GstSDPAttribute *attr = gst_sdp_media_get_attribute (media, i);
-
- if (attr->key) {
- g_string_append_printf (lines, "a=%s", attr->key);
- if (attr->value)
- g_string_append_printf (lines, ":%s", attr->value);
- g_string_append_printf (lines, "\r\n");
- }
- }
-
- return g_string_free (lines, FALSE);
-}
-
-/**
- * gst_sdp_media_get_media:
- * @media: a #GstSDPMedia
- *
- * Get the media description of @media.
- *
- * Returns: the media description.
- */
-const gchar *
-gst_sdp_media_get_media (const GstSDPMedia * media)
-{
- return media->media;
-}
-
-/**
- * gst_sdp_media_set_media:
- * @media: a #GstSDPMedia
- * @med: the media description
- *
- * Set the media description of @media to @med.
- *
- * Returns: #GST_SDP_OK.
- */
-GstSDPResult
-gst_sdp_media_set_media (GstSDPMedia * media, const gchar * med)
-{
- g_free (media->media);
- media->media = g_strdup (med);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_media_get_port:
- * @media: a #GstSDPMedia
- *
- * Get the port number for @media.
- *
- * Returns: the port number of @media.
- */
-guint
-gst_sdp_media_get_port (const GstSDPMedia * media)
-{
- return media->port;
-}
-
-/**
- * gst_sdp_media_get_num_ports:
- * @media: a #GstSDPMedia
- *
- * Get the number of ports for @media.
- *
- * Returns: the number of ports for @media.
- */
-guint
-gst_sdp_media_get_num_ports (const GstSDPMedia * media)
-{
- return media->num_ports;
-}
-
-/**
- * gst_sdp_media_set_port_info:
- * @media: a #GstSDPMedia
- * @port: the port number
- * @num_ports: the number of ports
- *
- * Set the port information in @media.
- *
- * Returns: #GST_SDP_OK.
- */
-GstSDPResult
-gst_sdp_media_set_port_info (GstSDPMedia * media, guint port, guint num_ports)
-{
- media->port = port;
- media->num_ports = num_ports;
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_media_get_proto:
- * @media: a #GstSDPMedia
- *
- * Get the transport protocol of @media
- *
- * Returns: the transport protocol of @media.
- */
-const gchar *
-gst_sdp_media_get_proto (const GstSDPMedia * media)
-{
- return media->proto;
-}
-
-/**
- * gst_sdp_media_set_proto:
- * @media: a #GstSDPMedia
- * @proto: the media transport protocol
- *
- * Set the media transport protocol of @media to @proto.
- *
- * Returns: #GST_SDP_OK.
- */
-GstSDPResult
-gst_sdp_media_set_proto (GstSDPMedia * media, const gchar * proto)
-{
- g_free (media->proto);
- media->proto = g_strdup (proto);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_media_formats_len:
- * @media: a #GstSDPMedia
- *
- * Get the number of formats in @media.
- *
- * Returns: the number of formats in @media.
- */
-guint
-gst_sdp_media_formats_len (const GstSDPMedia * media)
-{
- return media->fmts->len;
-}
-
-/**
- * gst_sdp_media_get_format:
- * @media: a #GstSDPMedia
- * @idx: an index
- *
- * Get the format information at position @idx in @media.
- *
- * Returns: the format at position @idx.
- */
-const gchar *
-gst_sdp_media_get_format (const GstSDPMedia * media, guint idx)
-{
- if (idx >= media->fmts->len)
- return NULL;
- return g_array_index (media->fmts, gchar *, idx);
-}
-
-/**
- * gst_sdp_media_add_format:
- * @media: a #GstSDPMedia
- * @format: the format
- *
- * Add the format information to @media.
- *
- * Returns: #GST_SDP_OK.
- */
-GstSDPResult
-gst_sdp_media_add_format (GstSDPMedia * media, const gchar * format)
-{
- gchar *fmt;
-
- fmt = g_strdup (format);
-
- g_array_append_val (media->fmts, fmt);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_media_get_information:
- * @media: a #GstSDPMedia
- *
- * Get the information of @media
- *
- * Returns: the information of @media.
- */
-const gchar *
-gst_sdp_media_get_information (const GstSDPMedia * media)
-{
- return media->information;
-}
-
-/**
- * gst_sdp_media_set_information:
- * @media: a #GstSDPMedia
- * @information: the media information
- *
- * Set the media information of @media to @information.
- *
- * Returns: #GST_SDP_OK.
- */
-GstSDPResult
-gst_sdp_media_set_information (GstSDPMedia * media, const gchar * information)
-{
- g_free (media->information);
- media->information = g_strdup (information);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_media_connections_len:
- * @media: a #GstSDPMedia
- *
- * Get the number of connection fields in @media.
- *
- * Returns: the number of connections in @media.
- */
-guint
-gst_sdp_media_connections_len (const GstSDPMedia * media)
-{
- return media->connections->len;
-}
-
-/**
- * gst_sdp_media_get_connection:
- * @media: a #GstSDPMedia
- * @idx: an index
- *
- * Get the connection at position @idx in @media.
- *
- * Returns: the #GstSDPConnection at position @idx.
- */
-const GstSDPConnection *
-gst_sdp_media_get_connection (const GstSDPMedia * media, guint idx)
-{
- return &g_array_index (media->connections, GstSDPConnection, idx);
-}
-
-/**
- * gst_sdp_media_add_connection:
- * @media: a #GstSDPMedia
- * @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
- *
- * Add the given connection parameters to @media.
- *
- * Returns: a #GstSDPResult.
- */
-GstSDPResult
-gst_sdp_media_add_connection (GstSDPMedia * media, const gchar * nettype,
- const gchar * addrtype, const gchar * address, guint ttl, guint addr_number)
-{
- GstSDPConnection conn;
-
- conn.nettype = g_strdup (nettype);
- conn.addrtype = g_strdup (addrtype);
- conn.address = g_strdup (address);
- conn.ttl = ttl;
- conn.addr_number = addr_number;
-
- g_array_append_val (media->connections, conn);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_media_bandwidths_len:
- * @media: a #GstSDPMedia
- *
- * Get the number of bandwidth fields in @media.
- *
- * Returns: the number of bandwidths in @media.
- */
-guint
-gst_sdp_media_bandwidths_len (const GstSDPMedia * media)
-{
- return media->bandwidths->len;
-}
-
-/**
- * gst_sdp_media_get_bandwidth:
- * @media: a #GstSDPMedia
- * @idx: an index
- *
- * Get the bandwidth at position @idx in @media.
- *
- * Returns: the #GstSDPBandwidth at position @idx.
- */
-const GstSDPBandwidth *
-gst_sdp_media_get_bandwidth (const GstSDPMedia * media, guint idx)
-{
- return &g_array_index (media->bandwidths, GstSDPBandwidth, idx);
-}
-
-/**
- * gst_sdp_media_add_bandwidth:
- * @media: a #GstSDPMedia
- * @bwtype: the bandwidth modifier type
- * @bandwidth: the bandwidth in kilobits per second
- *
- * Add the bandwidth information with @bwtype and @bandwidth to @media.
- *
- * Returns: #GST_SDP_OK.
- */
-GstSDPResult
-gst_sdp_media_add_bandwidth (GstSDPMedia * media, const gchar * bwtype,
- guint bandwidth)
-{
- GstSDPBandwidth bw;
-
- bw.bwtype = g_strdup (bwtype);
- bw.bandwidth = bandwidth;
-
- g_array_append_val (media->bandwidths, bw);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_media_set_key:
- * @media: a #GstSDPMedia
- * @type: the encryption type
- * @data: the encryption data
- *
- * Adds the encryption information to @media.
- *
- * Returns: a #GstSDPResult.
- */
-GstSDPResult
-gst_sdp_media_set_key (GstSDPMedia * media, const gchar * type,
- const gchar * data)
-{
- g_free (media->key.type);
- media->key.type = g_strdup (type);
- g_free (media->key.data);
- media->key.data = g_strdup (data);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_media_get_key:
- * @media: a #GstSDPMedia
- *
- * Get the encryption information from @media.
- *
- * Returns: a #GstSDPKey.
- */
-const GstSDPKey *
-gst_sdp_media_get_key (const GstSDPMedia * media)
-{
- return &media->key;
-}
-
-/**
- * gst_sdp_media_attributes_len:
- * @media: a #GstSDPMedia
- *
- * Get the number of attribute fields in @media.
- *
- * Returns: the number of attributes in @media.
- */
-guint
-gst_sdp_media_attributes_len (const GstSDPMedia * media)
-{
- return media->attributes->len;
-}
-
-/**
- * gst_sdp_media_add_attribute:
- * @media: a #GstSDPMedia
- * @key: a key
- * @value: a value
- *
- * Add the attribute with @key and @value to @media.
- *
- * Returns: #GST_SDP_OK.
- */
-GstSDPResult
-gst_sdp_media_add_attribute (GstSDPMedia * media, const gchar * key,
- const gchar * value)
-{
- GstSDPAttribute attr;
-
- attr.key = g_strdup (key);
- attr.value = g_strdup (value);
-
- g_array_append_val (media->attributes, attr);
-
- return GST_SDP_OK;
-}
-
-/**
- * gst_sdp_media_get_attribute:
- * @media: a #GstSDPMedia
- * @idx: an index
- *
- * Get the attribute at position @idx in @media.
- *
- * Returns: the #GstSDPAttribute at position @idx.
- */
-const GstSDPAttribute *
-gst_sdp_media_get_attribute (const GstSDPMedia * media, guint idx)
-{
- return &g_array_index (media->attributes, GstSDPAttribute, idx);
-}
-
-/**
- * gst_sdp_media_get_attribute_val_n:
- * @media: a #GstSDPMedia
- * @key: a key
- * @nth: an index
- *
- * Get the @nth attribute value for @key in @media.
- *
- * Returns: the @nth attribute value.
- */
-const gchar *
-gst_sdp_media_get_attribute_val_n (const GstSDPMedia * media, const gchar * key,
- guint nth)
-{
- guint i;
-
- for (i = 0; i < media->attributes->len; i++) {
- GstSDPAttribute *attr;
-
- attr = &g_array_index (media->attributes, GstSDPAttribute, i);
- if (!strcmp (attr->key, key)) {
- if (nth == 0)
- return attr->value;
- else
- nth--;
- }
- }
- return NULL;
-}
-
-/**
- * gst_sdp_media_get_attribute_val:
- * @media: a #GstSDPMedia
- * @key: a key
- *
- * Get the first attribute value for @key in @media.
- *
- * Returns: the first attribute value for @key.
- */
-const gchar *
-gst_sdp_media_get_attribute_val (const GstSDPMedia * media, const gchar * key)
-{
- return gst_sdp_media_get_attribute_val_n (media, key, 0);
-}
-
-static void
-read_string (gchar * dest, guint size, gchar ** src)
-{
- guint idx;
-
- idx = 0;
- /* skip spaces */
- while (g_ascii_isspace (**src))
- (*src)++;
-
- while (!g_ascii_isspace (**src) && **src != '\0') {
- if (idx < size - 1)
- dest[idx++] = **src;
- (*src)++;
- }
- if (size > 0)
- dest[idx] = '\0';
-}
-
-static void
-read_string_del (gchar * dest, guint size, gchar del, gchar ** src)
-{
- guint idx;
-
- idx = 0;
- /* skip spaces */
- while (g_ascii_isspace (**src))
- (*src)++;
-
- while (**src != del && **src != '\0') {
- if (idx < size - 1)
- dest[idx++] = **src;
- (*src)++;
- }
- if (size > 0)
- dest[idx] = '\0';
-}
-
-enum
-{
- SDP_SESSION,
- SDP_MEDIA,
-};
-
-typedef struct
-{
- guint state;
- GstSDPMessage *msg;
- GstSDPMedia *media;
-} SDPContext;
-
-static gboolean
-gst_sdp_parse_line (SDPContext * c, gchar type, gchar * buffer)
-{
- gchar str[8192];
- gchar *p = buffer;
-
-#define READ_STRING(field) read_string (str, sizeof (str), &p); REPLACE_STRING (field, str)
-#define READ_UINT(field) read_string (str, sizeof (str), &p); field = strtoul (str, NULL, 10)
-
- switch (type) {
- case 'v':
- if (buffer[0] != '0')
- g_warning ("wrong SDP version");
- gst_sdp_message_set_version (c->msg, buffer);
- break;
- case 'o':
- READ_STRING (c->msg->origin.username);
- READ_STRING (c->msg->origin.sess_id);
- READ_STRING (c->msg->origin.sess_version);
- READ_STRING (c->msg->origin.nettype);
- READ_STRING (c->msg->origin.addrtype);
- READ_STRING (c->msg->origin.addr);
- break;
- case 's':
- REPLACE_STRING (c->msg->session_name, buffer);
- break;
- case 'i':
- if (c->state == SDP_SESSION) {
- REPLACE_STRING (c->msg->information, buffer);
- } else {
- REPLACE_STRING (c->media->information, buffer);
- }
- break;
- case 'u':
- REPLACE_STRING (c->msg->uri, buffer);
- break;
- case 'e':
- gst_sdp_message_add_email (c->msg, buffer);
- break;
- case 'p':
- gst_sdp_message_add_phone (c->msg, buffer);
- break;
- case 'c':
- {
- GstSDPConnection conn;
- gchar *str2;
-
- memset (&conn, 0, sizeof (conn));
-
- str2 = p;
- while ((str2 = strchr (str2, '/')))
- *str2++ = ' ';
- READ_STRING (conn.nettype);
- READ_STRING (conn.addrtype);
- READ_STRING (conn.address);
- READ_UINT (conn.ttl);
- READ_UINT (conn.addr_number);
-
- if (c->state == SDP_SESSION) {
- gst_sdp_message_set_connection (c->msg, conn.nettype, conn.addrtype,
- conn.address, conn.ttl, conn.addr_number);
- } else {
- gst_sdp_media_add_connection (c->media, conn.nettype, conn.addrtype,
- conn.address, conn.ttl, conn.addr_number);
- }
- gst_sdp_connection_init (&conn);
- break;
- }
- case 'b':
- {
- gchar str2[MAX_LINE_LEN];
-
- read_string_del (str, sizeof (str), ':', &p);
- if (*p != '\0')
- p++;
- read_string (str2, sizeof (str2), &p);
- if (c->state == SDP_SESSION)
- gst_sdp_message_add_bandwidth (c->msg, str, atoi (str2));
- else
- gst_sdp_media_add_bandwidth (c->media, str, atoi (str2));
- break;
- }
- case 't':
- break;
- case 'k':
- break;
- case 'a':
- read_string_del (str, sizeof (str), ':', &p);
- if (*p != '\0')
- p++;
- if (c->state == SDP_SESSION)
- gst_sdp_message_add_attribute (c->msg, str, p);
- else
- gst_sdp_media_add_attribute (c->media, str, p);
- break;
- case 'm':
- {
- gchar *slash;
- GstSDPMedia nmedia;
-
- c->state = SDP_MEDIA;
- memset (&nmedia, 0, sizeof (nmedia));
- gst_sdp_media_init (&nmedia);
-
- /* m=<media> <port>/<number of ports> <proto> <fmt> ... */
- READ_STRING (nmedia.media);
- read_string (str, sizeof (str), &p);
- slash = g_strrstr (str, "/");
- if (slash) {
- *slash = '\0';
- nmedia.port = atoi (str);
- nmedia.num_ports = atoi (slash + 1);
- } else {
- nmedia.port = atoi (str);
- nmedia.num_ports = -1;
- }
- READ_STRING (nmedia.proto);
- do {
- read_string (str, sizeof (str), &p);
- gst_sdp_media_add_format (&nmedia, str);
- } while (*p != '\0');
-
- gst_sdp_message_add_media (c->msg, &nmedia);
- c->media =
- &g_array_index (c->msg->medias, GstSDPMedia, c->msg->medias->len - 1);
- break;
- }
- default:
- break;
- }
- return TRUE;
-}
-
-/**
- * gst_sdp_message_parse_buffer:
- * @data: the start of the buffer
- * @size: the size of the buffer
- * @msg: the result #GstSDPMessage
- *
- * Parse the contents of @size bytes pointed to by @data and store the result in
- * @msg.
- *
- * Returns: #GST_SDP_OK on success.
- */
-GstSDPResult
-gst_sdp_message_parse_buffer (const guint8 * data, guint size,
- GstSDPMessage * msg)
-{
- gchar *p;
- SDPContext c;
- gchar type;
- gchar buffer[MAX_LINE_LEN];
- guint idx = 0;
-
- g_return_val_if_fail (msg != NULL, GST_SDP_EINVAL);
- g_return_val_if_fail (data != NULL, GST_SDP_EINVAL);
- g_return_val_if_fail (size != 0, GST_SDP_EINVAL);
-
- c.state = SDP_SESSION;
- c.msg = msg;
- c.media = NULL;
-
- p = (gchar *) data;
- while (TRUE) {
- while (g_ascii_isspace (*p))
- p++;
-
- type = *p++;
- if (type == '\0')
- break;
-
- if (*p != '=')
- goto line_done;
- p++;
-
- idx = 0;
- while (*p != '\n' && *p != '\r' && *p != '\0') {
- if (idx < sizeof (buffer) - 1)
- buffer[idx++] = *p;
- p++;
- }
- buffer[idx] = '\0';
- gst_sdp_parse_line (&c, type, buffer);
-
- line_done:
- while (*p != '\n' && *p != '\0')
- p++;
- if (*p == '\n')
- p++;
- }
-
- return GST_SDP_OK;
-}
-
-static void
-print_media (GstSDPMedia * media)
-{
- g_print (" media: '%s'\n", GST_STR_NULL (media->media));
- g_print (" port: '%u'\n", media->port);
- g_print (" num_ports: '%u'\n", media->num_ports);
- g_print (" proto: '%s'\n", GST_STR_NULL (media->proto));
- if (media->fmts->len > 0) {
- guint i;
-
- g_print (" formats:\n");
- for (i = 0; i < media->fmts->len; i++) {
- g_print (" format '%s'\n", g_array_index (media->fmts, gchar *, i));
- }
- }
- g_print (" information: '%s'\n", GST_STR_NULL (media->information));
- if (media->connections->len > 0) {
- guint i;
-
- g_print (" connections:\n");
- for (i = 0; i < media->connections->len; i++) {
- GstSDPConnection *conn =
- &g_array_index (media->connections, GstSDPConnection, i);
-
- g_print (" nettype: '%s'\n", GST_STR_NULL (conn->nettype));
- g_print (" addrtype: '%s'\n", GST_STR_NULL (conn->addrtype));
- g_print (" address: '%s'\n", GST_STR_NULL (conn->address));
- g_print (" ttl: '%u'\n", conn->ttl);
- g_print (" addr_number: '%u'\n", conn->addr_number);
- }
- }
- if (media->bandwidths->len > 0) {
- guint i;
-
- g_print (" bandwidths:\n");
- for (i = 0; i < media->bandwidths->len; i++) {
- GstSDPBandwidth *bw =
- &g_array_index (media->bandwidths, GstSDPBandwidth, i);
-
- g_print (" type: '%s'\n", GST_STR_NULL (bw->bwtype));
- g_print (" bandwidth: '%u'\n", bw->bandwidth);
- }
- }
- g_print (" key:\n");
- g_print (" type: '%s'\n", GST_STR_NULL (media->key.type));
- g_print (" data: '%s'\n", GST_STR_NULL (media->key.data));
- if (media->attributes->len > 0) {
- guint i;
-
- g_print (" attributes:\n");
- for (i = 0; i < media->attributes->len; i++) {
- GstSDPAttribute *attr =
- &g_array_index (media->attributes, GstSDPAttribute, i);
-
- g_print (" attribute '%s' : '%s'\n", attr->key, attr->value);
- }
- }
-}
-
-/**
- * gst_sdp_message_dump:
- * @msg: a #GstSDPMessage
- *
- * Dump the parsed contents of @msg to stdout.
- *
- * Returns: a #GstSDPResult.
- */
-GstSDPResult
-gst_sdp_message_dump (const GstSDPMessage * msg)
-{
- g_return_val_if_fail (msg != NULL, GST_SDP_EINVAL);
-
- g_print ("sdp packet %p:\n", msg);
- g_print (" version: '%s'\n", GST_STR_NULL (msg->version));
- g_print (" origin:\n");
- g_print (" username: '%s'\n", GST_STR_NULL (msg->origin.username));
- g_print (" sess_id: '%s'\n", GST_STR_NULL (msg->origin.sess_id));
- g_print (" sess_version: '%s'\n", GST_STR_NULL (msg->origin.sess_version));
- g_print (" nettype: '%s'\n", GST_STR_NULL (msg->origin.nettype));
- g_print (" addrtype: '%s'\n", GST_STR_NULL (msg->origin.addrtype));
- g_print (" addr: '%s'\n", GST_STR_NULL (msg->origin.addr));
- g_print (" session_name: '%s'\n", GST_STR_NULL (msg->session_name));
- g_print (" information: '%s'\n", GST_STR_NULL (msg->information));
- g_print (" uri: '%s'\n", GST_STR_NULL (msg->uri));
-
- if (msg->emails->len > 0) {
- guint i;
-
- g_print (" emails:\n");
- for (i = 0; i < msg->emails->len; i++) {
- g_print (" email '%s'\n", g_array_index (msg->emails, gchar *, i));
- }
- }
- if (msg->phones->len > 0) {
- guint i;
-
- g_print (" phones:\n");
- for (i = 0; i < msg->phones->len; i++) {
- g_print (" phone '%s'\n", g_array_index (msg->phones, gchar *, i));
- }
- }
- g_print (" connection:\n");
- g_print (" nettype: '%s'\n", GST_STR_NULL (msg->connection.nettype));
- g_print (" addrtype: '%s'\n", GST_STR_NULL (msg->connection.addrtype));
- g_print (" address: '%s'\n", GST_STR_NULL (msg->connection.address));
- g_print (" ttl: '%u'\n", msg->connection.ttl);
- g_print (" addr_number: '%u'\n", msg->connection.addr_number);
- if (msg->bandwidths->len > 0) {
- guint i;
-
- g_print (" bandwidths:\n");
- for (i = 0; i < msg->bandwidths->len; i++) {
- GstSDPBandwidth *bw =
- &g_array_index (msg->bandwidths, GstSDPBandwidth, i);
-
- g_print (" type: '%s'\n", GST_STR_NULL (bw->bwtype));
- g_print (" bandwidth: '%u'\n", bw->bandwidth);
- }
- }
- g_print (" key:\n");
- g_print (" type: '%s'\n", GST_STR_NULL (msg->key.type));
- g_print (" data: '%s'\n", GST_STR_NULL (msg->key.data));
- if (msg->attributes->len > 0) {
- guint i;
-
- g_print (" attributes:\n");
- for (i = 0; i < msg->attributes->len; i++) {
- GstSDPAttribute *attr =
- &g_array_index (msg->attributes, GstSDPAttribute, i);
-
- g_print (" attribute '%s' : '%s'\n", attr->key, attr->value);
- }
- }
- if (msg->medias->len > 0) {
- guint i;
-
- g_print (" medias:\n");
- for (i = 0; i < msg->medias->len; i++) {
- g_print (" media %u:\n", i);
- print_media (&g_array_index (msg->medias, GstSDPMedia, i));
- }
- }
- return GST_SDP_OK;
-}
diff --git a/gst-libs/gst/sdp/gstsdpmessage.h b/gst-libs/gst/sdp/gstsdpmessage.h
deleted file mode 100644
index 722ff813..00000000
--- a/gst-libs/gst/sdp/gstsdpmessage.h
+++ /dev/null
@@ -1,408 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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 <glib.h>
-
-#include <gst/sdp/gstsdp.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_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).
- *
- * Since: 0.10.15
- */
-#define GST_SDP_BWTYPE_RS "RS"
-/**
- * GST_SDP_BWTYPE_RR:
- *
- * RTCP bandwidth allocated to data receivers (RFC 3556).
- *
- * Since: 0.10.15
- */
-#define GST_SDP_BWTYPE_RR "RR"
-
-/**
- * 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;
-
-/**
- * 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;
-
-/**
- * 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;
-
-/**
- * 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;
-
-/**
- * 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;
-
-/* Session descriptions */
-GstSDPResult gst_sdp_message_new (GstSDPMessage **msg);
-GstSDPResult gst_sdp_message_init (GstSDPMessage *msg);
-GstSDPResult gst_sdp_message_uninit (GstSDPMessage *msg);
-GstSDPResult gst_sdp_message_free (GstSDPMessage *msg);
-
-GstSDPResult gst_sdp_message_parse_buffer (const guint8 *data, guint size, GstSDPMessage *msg);
-
-gchar* gst_sdp_message_as_text (const GstSDPMessage *msg);
-
-/* v=.. */
-const gchar* gst_sdp_message_get_version (const GstSDPMessage *msg);
-GstSDPResult gst_sdp_message_set_version (GstSDPMessage *msg, const gchar *version);
-
-/* o=<username> <sess-id> <sess-version> <nettype> <addrtype> <unicast-address> */
-const GstSDPOrigin* gst_sdp_message_get_origin (const GstSDPMessage *msg);
-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> */
-const gchar* gst_sdp_message_get_session_name (const GstSDPMessage *msg);
-GstSDPResult gst_sdp_message_set_session_name (GstSDPMessage *msg, const gchar *session_name);
-
-/* i=<session description> */
-const gchar* gst_sdp_message_get_information (const GstSDPMessage *msg);
-GstSDPResult gst_sdp_message_set_information (GstSDPMessage *msg, const gchar *information);
-
-/* u=<uri> */
-const gchar* gst_sdp_message_get_uri (const GstSDPMessage *msg);
-GstSDPResult gst_sdp_message_set_uri (GstSDPMessage *msg, const gchar *uri);
-
-/* e=<email-address> */
-guint gst_sdp_message_emails_len (const GstSDPMessage *msg);
-const gchar* gst_sdp_message_get_email (const GstSDPMessage *msg, guint idx);
-GstSDPResult gst_sdp_message_add_email (GstSDPMessage *msg, const gchar *email);
-
-/* p=<phone-number> */
-guint gst_sdp_message_phones_len (const GstSDPMessage *msg);
-const gchar* gst_sdp_message_get_phone (const GstSDPMessage *msg, guint idx);
-GstSDPResult gst_sdp_message_add_phone (GstSDPMessage *msg, const gchar *phone);
-
-/* c=<nettype> <addrtype> <connection-address>[/<ttl>][/<number of addresses>] */
-const GstSDPConnection* gst_sdp_message_get_connection (const GstSDPMessage *msg);
-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> */
-guint gst_sdp_message_bandwidths_len (const GstSDPMessage *msg);
-const GstSDPBandwidth* gst_sdp_message_get_bandwidth (const GstSDPMessage *msg, guint idx);
-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> */
-guint gst_sdp_message_times_len (const GstSDPMessage *msg);
-const GstSDPTime* gst_sdp_message_get_time (const GstSDPMessage *msg, guint idx);
-GstSDPResult gst_sdp_message_add_time (GstSDPMessage *msg, const gchar *start, const gchar *stop, const gchar **repeat);
-
-/* z=<adjustment time> <offset> <adjustment time> <offset> .... */
-guint gst_sdp_message_zones_len (const GstSDPMessage *msg);
-const GstSDPZone* gst_sdp_message_get_zone (const GstSDPMessage *msg, guint idx);
-GstSDPResult gst_sdp_message_add_zone (GstSDPMessage *msg, const gchar *adj_time,
- const gchar *typed_time);
-
-/* k=<method>[:<encryption key>] */
-const GstSDPKey* gst_sdp_message_get_key (const GstSDPMessage *msg);
-GstSDPResult gst_sdp_message_set_key (GstSDPMessage *msg, const gchar *type,
- const gchar *data);
-/* a=... */
-guint gst_sdp_message_attributes_len (const GstSDPMessage *msg);
-const GstSDPAttribute* gst_sdp_message_get_attribute (const GstSDPMessage *msg, guint idx);
-const gchar* gst_sdp_message_get_attribute_val (const GstSDPMessage *msg, const gchar *key);
-const gchar* gst_sdp_message_get_attribute_val_n (const GstSDPMessage *msg, const gchar *key,
- guint nth);
-GstSDPResult gst_sdp_message_add_attribute (GstSDPMessage *msg, const gchar *key,
- const gchar *value);
-
-/* m=.. sections */
-guint gst_sdp_message_medias_len (const GstSDPMessage *msg);
-const GstSDPMedia* gst_sdp_message_get_media (const GstSDPMessage *msg, guint idx);
-GstSDPResult gst_sdp_message_add_media (GstSDPMessage *msg, GstSDPMedia *media);
-
-GstSDPResult gst_sdp_message_dump (const GstSDPMessage *msg);
-
-/* Media descriptions */
-GstSDPResult gst_sdp_media_new (GstSDPMedia **media);
-GstSDPResult gst_sdp_media_init (GstSDPMedia *media);
-GstSDPResult gst_sdp_media_uninit (GstSDPMedia *media);
-GstSDPResult gst_sdp_media_free (GstSDPMedia *media);
-
-gchar* gst_sdp_media_as_text (const GstSDPMedia *media);
-
-/* m=<media> <port>/<number of ports> <proto> <fmt> ... */
-const gchar* gst_sdp_media_get_media (const GstSDPMedia *media);
-GstSDPResult gst_sdp_media_set_media (GstSDPMedia *media, const gchar *med);
-
-guint gst_sdp_media_get_port (const GstSDPMedia *media);
-guint gst_sdp_media_get_num_ports (const GstSDPMedia *media);
-GstSDPResult gst_sdp_media_set_port_info (GstSDPMedia *media, guint port,
- guint num_ports);
-
-const gchar* gst_sdp_media_get_proto (const GstSDPMedia *media);
-GstSDPResult gst_sdp_media_set_proto (GstSDPMedia *media, const gchar *proto);
-
-guint gst_sdp_media_formats_len (const GstSDPMedia *media);
-const gchar* gst_sdp_media_get_format (const GstSDPMedia *media, guint idx);
-GstSDPResult gst_sdp_media_add_format (GstSDPMedia *media, const gchar *format);
-
-/* i=<session description> */
-const gchar* gst_sdp_media_get_information (const GstSDPMedia *media);
-GstSDPResult gst_sdp_media_set_information (GstSDPMedia *media, const gchar *information);
-
-/* c=<nettype> <addrtype> <connection-address>[/<ttl>][/<number of addresses>] */
-guint gst_sdp_media_connections_len (const GstSDPMedia *media);
-const GstSDPConnection* gst_sdp_media_get_connection (const GstSDPMedia *media, guint idx);
-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> */
-guint gst_sdp_media_bandwidths_len (const GstSDPMedia *media);
-const GstSDPBandwidth* gst_sdp_media_get_bandwidth (const GstSDPMedia *media, guint idx);
-GstSDPResult gst_sdp_media_add_bandwidth (GstSDPMedia *media, const gchar *bwtype,
- guint bandwidth);
-
-/* k=<method>:<encryption key> */
-const GstSDPKey* gst_sdp_media_get_key (const GstSDPMedia *media);
-GstSDPResult gst_sdp_media_set_key (GstSDPMedia *media, const gchar *type,
- const gchar *data);
-/* a=... */
-guint gst_sdp_media_attributes_len (const GstSDPMedia *media);
-const GstSDPAttribute * gst_sdp_media_get_attribute (const GstSDPMedia *media, guint idx);
-const gchar* gst_sdp_media_get_attribute_val (const GstSDPMedia *media, const gchar *key);
-const gchar* gst_sdp_media_get_attribute_val_n (const GstSDPMedia *media, const gchar *key,
- guint nth);
-GstSDPResult gst_sdp_media_add_attribute (GstSDPMedia *media, const gchar *key,
- const gchar *value);
-
-G_END_DECLS
-
-#endif /* __GST_SDP_MESSAGE_H__ */
diff --git a/gst-libs/gst/tag/Makefile.am b/gst-libs/gst/tag/Makefile.am
deleted file mode 100644
index 15888ed6..00000000
--- a/gst-libs/gst/tag/Makefile.am
+++ /dev/null
@@ -1,68 +0,0 @@
-libgsttagincludedir = \
- $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/tag
-
-libgsttaginclude_HEADERS = \
- tag.h gsttagdemux.h
-
-lib_LTLIBRARIES = libgsttag-@GST_MAJORMINOR@.la
-
-libgsttag_@GST_MAJORMINOR@_la_SOURCES = gstvorbistag.c gstid3tag.c lang.c tags.c gsttagdemux.c
-libgsttag_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
-libgsttag_@GST_MAJORMINOR@_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS)
-libgsttag_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
-
-# lang-tables.dat contains generated static data and is included by lang.c
-EXTRA_DIST = lang-tables.dat
-
-noinst_HEADERS = gsttageditingprivate.h
-
-if HAVE_INTROSPECTION
-BUILT_GIRSOURCES = GstTag-@GST_MAJORMINOR@.gir
-
-gir_headers=$(patsubst %,$(srcdir)/%, $(libgsttaginclude_HEADERS))
-gir_sources=$(patsubst %,$(srcdir)/%, $(libgsttag_@GST_MAJORMINOR@_la_SOURCES))
-gir_cincludes=$(patsubst %,--c-include='gst/audio/%',$(libgsttainclude_HEADERS))
-
-GstTag-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgsttag-@GST_MAJORMINOR@.la
- PKG_CONFIG_PATH="$(PKG_CONFIG_PATH):$(top_builddir)/pkgconfig" \
- $(INTROSPECTION_SCANNER) -v --namespace GstTag \
- --nsversion=@GST_MAJORMINOR@ \
- --strip-prefix=Gst \
- $(gir_cincludes) \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst \
- --library=gsttag-0.10 \
- --include=Gst-0.10 \
- --libtool="$(top_builddir)/libtool" \
- --pkg gstreamer-0.10 \
- --output $@ \
- $(gir_headers) \
- $(gir_sources)
-
-# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
-# install anything - we need to install inside our prefix.
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(BUILT_GIRSOURCES)
-
-typelibsdir = $(libdir)/girepository-1.0/
-
-typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
-
-%.typelib: %.gir $(INTROSPECTION_COMPILER)
- $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=$(builddir) --includedir=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
-CLEANFILES = $(BUILT_GIRSOURCES) $(typelibs_DATA)
-endif
-
-# little program that reads iso_639.xml and outputs tables for us as fallback
-# for when iso-codes are not available (and so we don't have to read the xml
-# just to map codes)
-if USE_ISO_CODES
-ISO_CODE_PROGS = mklangtables
-mklangtables_SOURCES = mklangtables.c
-mklangtables_CFLAGS = $(GST_CFLAGS)
-mklangtables_LDADD = $(GST_LIBS)
-else
-ISO_CODE_PROGS =
-endif
-
-noinst_PROGRAMS = $(ISO_CODE_PROGS)
diff --git a/gst-libs/gst/tag/gstid3tag.c b/gst-libs/gst/tag/gstid3tag.c
deleted file mode 100644
index fc13fb2c..00000000
--- a/gst-libs/gst/tag/gstid3tag.c
+++ /dev/null
@@ -1,486 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * gstid3tag.c: plugin for reading / modifying id3 tags
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-/**
- * SECTION:gsttagid3
- * @short_description: tag mappings and support functions for plugins
- * dealing with ID3v1 and ID3v2 tags
- * @see_also: #GstTagList
- *
- * <refsect2>
- * <para>
- * Contains various utility functions for plugins to parse or create
- * ID3 tags and map ID3v2 identifiers to and from GStreamer identifiers.
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gsttageditingprivate.h"
-#include <stdlib.h>
-#include <string.h>
-
-static const gchar *genres[] = {
- "Blues",
- "Classic Rock",
- "Country",
- "Dance",
- "Disco",
- "Funk",
- "Grunge",
- "Hip-Hop",
- "Jazz",
- "Metal",
- "New Age",
- "Oldies",
- "Other",
- "Pop",
- "R&B",
- "Rap",
- "Reggae",
- "Rock",
- "Techno",
- "Industrial",
- "Alternative",
- "Ska",
- "Death Metal",
- "Pranks",
- "Soundtrack",
- "Euro-Techno",
- "Ambient",
- "Trip-Hop",
- "Vocal",
- "Jazz+Funk",
- "Fusion",
- "Trance",
- "Classical",
- "Instrumental",
- "Acid",
- "House",
- "Game",
- "Sound Clip",
- "Gospel",
- "Noise",
- "Alternative Rock",
- "Bass",
- "Soul",
- "Punk",
- "Space",
- "Meditative",
- "Instrumental Pop",
- "Instrumental Rock",
- "Ethnic",
- "Gothic",
- "Darkwave",
- "Techno-Industrial",
- "Electronic",
- "Pop-Folk",
- "Eurodance",
- "Dream",
- "Southern Rock",
- "Comedy",
- "Cult",
- "Gangsta",
- "Top 40",
- "Christian Rap",
- "Pop/Funk",
- "Jungle",
- "Native American",
- "Cabaret",
- "New Wave",
- "Psychadelic",
- "Rave",
- "Showtunes",
- "Trailer",
- "Lo-Fi",
- "Tribal",
- "Acid Punk",
- "Acid Jazz",
- "Polka",
- "Retro",
- "Musical",
- "Rock & Roll",
- "Hard Rock",
- "Folk",
- "Folk/Rock",
- "National Folk",
- "Swing",
- "Fusion",
- "Bebob",
- "Latin",
- "Revival",
- "Celtic",
- "Bluegrass",
- "Avantgarde",
- "Gothic Rock",
- "Progressive Rock",
- "Psychadelic Rock",
- "Symphonic Rock",
- "Slow Rock",
- "Big Band",
- "Chorus",
- "Easy Listening",
- "Acoustic",
- "Humour",
- "Speech",
- "Chanson",
- "Opera",
- "Chamber Music",
- "Sonata",
- "Symphony",
- "Booty Bass",
- "Primus",
- "Porn Groove",
- "Satire",
- "Slow Jam",
- "Club",
- "Tango",
- "Samba",
- "Folklore",
- "Ballad",
- "Power Ballad",
- "Rhythmic Soul",
- "Freestyle",
- "Duet",
- "Punk Rock",
- "Drum Solo",
- "A Capella",
- "Euro-House",
- "Dance Hall",
- "Goa",
- "Drum & Bass",
- "Club-House",
- "Hardcore",
- "Terror",
- "Indie",
- "BritPop",
- "Negerpunk",
- "Polsk Punk",
- "Beat",
- "Christian Gangsta Rap",
- "Heavy Metal",
- "Black Metal",
- "Crossover",
- "Contemporary Christian",
- "Christian Rock",
- "Merengue",
- "Salsa",
- "Thrash Metal",
- "Anime",
- "Jpop",
- "Synthpop"
-};
-
-static const GstTagEntryMatch tag_matches[] = {
- {GST_TAG_TITLE, "TIT2"},
- {GST_TAG_ALBUM, "TALB"},
- {GST_TAG_TRACK_NUMBER, "TRCK"},
- {GST_TAG_ARTIST, "TPE1"},
- {GST_TAG_ALBUM_ARTIST, "TPE2"},
- {GST_TAG_COMPOSER, "TCOM"},
- {GST_TAG_COPYRIGHT, "TCOP"},
- {GST_TAG_COPYRIGHT_URI, "WCOP"},
- {GST_TAG_GENRE, "TCON"},
- {GST_TAG_DATE, "TDRC"},
- {GST_TAG_COMMENT, "COMM"},
- {GST_TAG_ALBUM_VOLUME_NUMBER, "TPOS"},
- {GST_TAG_DURATION, "TLEN"},
- {GST_TAG_ISRC, "TSRC"},
- {GST_TAG_IMAGE, "APIC"},
- {GST_TAG_ENCODER, "TSSE"},
- {GST_TAG_BEATS_PER_MINUTE, "TBPM"},
- {GST_TAG_ARTIST_SORTNAME, "TSOP"},
- {GST_TAG_ALBUM_SORTNAME, "TSOA"},
- {GST_TAG_TITLE_SORTNAME, "TSOT"},
- {NULL, NULL}
-};
-
-/**
- * gst_tag_from_id3_tag:
- * @id3_tag: ID3v2 tag to convert to GStreamer tag
- *
- * Looks up the GStreamer tag for a ID3v2 tag.
- *
- * Returns: The corresponding GStreamer tag or NULL if none exists.
- */
-G_CONST_RETURN gchar *
-gst_tag_from_id3_tag (const gchar * id3_tag)
-{
- int i = 0;
-
- g_return_val_if_fail (id3_tag != NULL, NULL);
-
- while (tag_matches[i].gstreamer_tag != NULL) {
- if (strncmp (id3_tag, tag_matches[i].original_tag, 5) == 0) {
- return tag_matches[i].gstreamer_tag;
- }
- i++;
- }
-
- GST_INFO ("Cannot map ID3v2 tag '%c%c%c%c' to GStreamer tag",
- id3_tag[0], id3_tag[1], id3_tag[2], id3_tag[3]);
-
- return NULL;
-}
-
-static const GstTagEntryMatch user_tag_matches[] = {
- /* musicbrainz identifiers being used in the real world (foobar2000) */
- {GST_TAG_MUSICBRAINZ_ARTISTID, "TXXX|musicbrainz_artistid"},
- {GST_TAG_MUSICBRAINZ_ALBUMID, "TXXX|musicbrainz_albumid"},
- {GST_TAG_MUSICBRAINZ_ALBUMARTISTID, "TXXX|musicbrainz_albumartistid"},
- {GST_TAG_MUSICBRAINZ_TRMID, "TXXX|musicbrainz_trmid"},
- {GST_TAG_CDDA_MUSICBRAINZ_DISCID, "TXXX|musicbrainz_discid"},
- /* musicbrainz identifiers according to spec no one pays
- * attention to (http://musicbrainz.org/docs/specs/metadata_tags.html) */
- {GST_TAG_MUSICBRAINZ_ARTISTID, "TXXX|MusicBrainz Artist Id"},
- {GST_TAG_MUSICBRAINZ_ALBUMID, "TXXX|MusicBrainz Album Id"},
- {GST_TAG_MUSICBRAINZ_ALBUMARTISTID, "TXXX|MusicBrainz Album Artist Id"},
- {GST_TAG_MUSICBRAINZ_TRMID, "TXXX|MusicBrainz TRM Id"},
- /* according to: http://wiki.musicbrainz.org/MusicBrainzTag (yes, no space
- * before 'ID' and not 'Id' either this time, yay for consistency) */
- {GST_TAG_CDDA_MUSICBRAINZ_DISCID, "TXXX|MusicBrainz DiscID"},
- /* foobar2000 uses these identifiers to store gain/peak information in
- * ID3v2 tags <= v2.3.0. In v2.4.0 there's the RVA2 frame for that */
- {GST_TAG_TRACK_GAIN, "TXXX|replaygain_track_gain"},
- {GST_TAG_TRACK_PEAK, "TXXX|replaygain_track_peak"},
- {GST_TAG_ALBUM_GAIN, "TXXX|replaygain_album_gain"},
- {GST_TAG_ALBUM_PEAK, "TXXX|replaygain_album_peak"},
- /* the following two are more or less made up, there seems to be little
- * evidence that any popular application is actually putting this info
- * into TXXX frames; the first one comes from a musicbrainz wiki 'proposed
- * tags' page, the second one is analogue to the vorbis/ape/flac tag. */
- {GST_TAG_CDDA_CDDB_DISCID, "TXXX|discid"},
- {GST_TAG_CDDA_CDDB_DISCID, "TXXX|CDDB DiscID"}
-};
-
-/**
- * gst_tag_from_id3_user_tag:
- * @type: the type of ID3v2 user tag (e.g. "TXXX" or "UDIF")
- * @id3_user_tag: ID3v2 user tag to convert to GStreamer tag
- *
- * Looks up the GStreamer tag for an ID3v2 user tag (e.g. description in
- * TXXX frame or owner in UFID frame).
- *
- * Returns: The corresponding GStreamer tag or NULL if none exists.
- */
-G_CONST_RETURN gchar *
-gst_tag_from_id3_user_tag (const gchar * type, const gchar * id3_user_tag)
-{
- int i = 0;
-
- g_return_val_if_fail (type != NULL && strlen (type) == 4, NULL);
- g_return_val_if_fail (id3_user_tag != NULL, NULL);
-
- for (i = 0; i < G_N_ELEMENTS (user_tag_matches); ++i) {
- if (strncmp (type, user_tag_matches[i].original_tag, 4) == 0 &&
- g_ascii_strcasecmp (id3_user_tag,
- user_tag_matches[i].original_tag + 5) == 0) {
- GST_LOG ("Mapped ID3v2 user tag '%s' to GStreamer tag '%s'",
- user_tag_matches[i].original_tag, user_tag_matches[i].gstreamer_tag);
- return user_tag_matches[i].gstreamer_tag;
- }
- }
-
- GST_INFO ("Cannot map ID3v2 user tag '%s' of type '%s' to GStreamer tag",
- id3_user_tag, type);
-
- return NULL;
-}
-
-/**
- * gst_tag_to_id3_tag:
- * @gst_tag: GStreamer tag to convert to vorbiscomment tag
- *
- * Looks up the ID3v2 tag for a GStreamer tag.
- *
- * Returns: The corresponding ID3v2 tag or NULL if none exists.
- */
-G_CONST_RETURN gchar *
-gst_tag_to_id3_tag (const gchar * gst_tag)
-{
- int i = 0;
-
- g_return_val_if_fail (gst_tag != NULL, NULL);
-
- while (tag_matches[i].gstreamer_tag != NULL) {
- if (strcmp (gst_tag, tag_matches[i].gstreamer_tag) == 0) {
- return tag_matches[i].original_tag;
- }
- i++;
- }
- return NULL;
-}
-
-static void
-gst_tag_extract_id3v1_string (GstTagList * list, const gchar * tag,
- const gchar * start, const guint size)
-{
- const gchar *env_vars[] = { "GST_ID3V1_TAG_ENCODING",
- "GST_ID3_TAG_ENCODING", "GST_TAG_ENCODING", NULL
- };
- gchar *utf8;
-
- utf8 = gst_tag_freeform_string_to_utf8 (start, size, env_vars);
-
- if (utf8 && *utf8 != '\0') {
- gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, tag, utf8, NULL);
- }
-
- g_free (utf8);
-}
-
-/**
- * gst_tag_list_new_from_id3v1:
- * @data: 128 bytes of data containing the ID3v1 tag
- *
- * Parses the data containing an ID3v1 tag and returns a #GstTagList from the
- * parsed data.
- *
- * Returns: A new tag list or NULL if the data was not an ID3v1 tag.
- */
-GstTagList *
-gst_tag_list_new_from_id3v1 (const guint8 * data)
-{
- guint year;
- gchar *ystr;
- GstTagList *list;
-
- g_return_val_if_fail (data != NULL, NULL);
-
- if (data[0] != 'T' || data[1] != 'A' || data[2] != 'G')
- return NULL;
- list = gst_tag_list_new ();
- gst_tag_extract_id3v1_string (list, GST_TAG_TITLE, (gchar *) & data[3], 30);
- gst_tag_extract_id3v1_string (list, GST_TAG_ARTIST, (gchar *) & data[33], 30);
- gst_tag_extract_id3v1_string (list, GST_TAG_ALBUM, (gchar *) & data[63], 30);
- ystr = g_strndup ((gchar *) & data[93], 4);
- year = strtoul (ystr, NULL, 10);
- g_free (ystr);
- if (year > 0) {
- GDate *date = g_date_new_dmy (1, 1, year);
-
- gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_DATE, date, NULL);
- g_date_free (date);
- }
- if (data[125] == 0 && data[126] != 0) {
- gst_tag_extract_id3v1_string (list, GST_TAG_COMMENT, (gchar *) & data[97],
- 28);
- gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_TRACK_NUMBER,
- (guint) data[126], NULL);
- } else {
- gst_tag_extract_id3v1_string (list, GST_TAG_COMMENT, (gchar *) & data[97],
- 30);
- }
- if (data[127] < gst_tag_id3_genre_count () && !gst_tag_list_is_empty (list)) {
- gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_GENRE,
- gst_tag_id3_genre_get (data[127]), NULL);
- }
-
- return list;
-}
-
-/**
- * gst_tag_id3_genre_count:
- *
- * Gets the number of ID3v1 genres that can be identified. Winamp genres are
- * included.
- *
- * Returns: the number of ID3v1 genres that can be identified
- */
-guint
-gst_tag_id3_genre_count (void)
-{
- return G_N_ELEMENTS (genres);
-}
-
-/**
- * gst_tag_id3_genre_get:
- * @id: ID of genre to query
- *
- * Gets the ID3v1 genre name for a given ID.
- *
- * Returns: the genre or NULL if no genre is associated with that ID.
- */
-G_CONST_RETURN gchar *
-gst_tag_id3_genre_get (const guint id)
-{
- if (id >= G_N_ELEMENTS (genres))
- return NULL;
- return genres[id];
-}
-
-/**
- * gst_tag_list_add_id3_image:
- * @tag_list: a tag list
- * @image_data: the (encoded) image
- * @image_data_len: the length of the encoded image data at @image_data
- * @id3_picture_type: picture type as per the ID3 (v2.4.0) specification for
- * the APIC frame (0 = unknown/other)
- *
- * Adds an image from an ID3 APIC frame (or similar, such as used in FLAC)
- * to the given tag list. Also see gst_tag_image_data_to_image_buffer() for
- * more information on image tags in GStreamer.
- *
- * Returns: %TRUE if the image was processed, otherwise %FALSE
- *
- * Since: 0.10.20
- */
-gboolean
-gst_tag_list_add_id3_image (GstTagList * tag_list, const guint8 * image_data,
- guint image_data_len, guint id3_picture_type)
-{
- GstTagImageType tag_image_type;
- const gchar *tag_name;
- GstBuffer *image;
-
- g_return_val_if_fail (GST_IS_TAG_LIST (tag_list), FALSE);
- g_return_val_if_fail (image_data != NULL, FALSE);
- g_return_val_if_fail (image_data_len > 0, FALSE);
-
- if (id3_picture_type == 0x01 || id3_picture_type == 0x02) {
- /* file icon for preview. Don't add image-type to caps, since there
- * is only supposed to be one of these, and the type is already indicated
- * via the special tag */
- tag_name = GST_TAG_PREVIEW_IMAGE;
- tag_image_type = GST_TAG_IMAGE_TYPE_NONE;
- } else {
- tag_name = GST_TAG_IMAGE;
-
- /* Remap the ID3v2 APIC type our ImageType enum */
- if (id3_picture_type >= 0x3 && id3_picture_type <= 0x14)
- tag_image_type = (GstTagImageType) (id3_picture_type - 2);
- else
- tag_image_type = GST_TAG_IMAGE_TYPE_UNDEFINED;
- }
-
- image = gst_tag_image_data_to_image_buffer (image_data, image_data_len,
- tag_image_type);
-
- if (image == NULL)
- return FALSE;
-
- gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, tag_name, image, NULL);
- gst_buffer_unref (image);
- return TRUE;
-}
diff --git a/gst-libs/gst/tag/gsttagdemux.c b/gst-libs/gst/tag/gsttagdemux.c
deleted file mode 100644
index d02718b8..00000000
--- a/gst-libs/gst/tag/gsttagdemux.c
+++ /dev/null
@@ -1,1518 +0,0 @@
-/* GStreamer Base Class for Tag Demuxing
- * Copyright (C) 2005 Jan Schmidt <thaytan@mad.scientist.com>
- * Copyright (C) 2006-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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gsttagdemux
- * @see_also: GstApeDemux, GstID3Demux
- * @short_description: Base class for demuxing tags that are in chunks
- * directly at the beginning or at the end of a file
- *
- * <refsect2>
- * <para>
- * Provides a base class for demuxing tags at the beginning or end of a
- * stream and handles things like typefinding, querying, seeking, and
- * different modes of operation (chain-based, pull_range-based, and providing
- * downstream elements with random access if upstream supports that). The tag
- * is stripped from the output, and all offsets are adjusted for the tag
- * sizes, so that to the downstream element the stream will appear as if
- * there was no tag at all. Also, once the tag has been parsed, GstTagDemux
- * will try to determine the media type of the resulting stream and add a
- * source pad with the appropriate caps in order to facilitate auto-plugging.
- * </para>
- * <title>Deriving from GstTagDemux</title>
- * <para>
- * Subclasses have to do four things:
- * <itemizedlist>
- * <listitem><para>
- * In their base init function, they must add a pad template for the sink
- * pad to the element class, describing the media type they can parse in
- * the caps of the pad template.
- * </para></listitem>
- * <listitem><para>
- * In their class init function, they must override
- * GST_TAG_DEMUX_CLASS(demux_klass)->identify_tag with their own identify
- * function.
- * </para></listitem>
- * <listitem><para>
- * In their class init function, they must override
- * GST_TAG_DEMUX_CLASS(demux_klass)->parse_tag with their own parse
- * function.
- * </para></listitem>
- * <listitem><para>
- * In their class init function, they must also set
- * GST_TAG_DEMUX_CLASS(demux_klass)->min_start_size and/or
- * GST_TAG_DEMUX_CLASS(demux_klass)->min_end_size to the minimum size required
- * for the identify function to decide whether the stream has a supported tag
- * or not. A class parsing ID3v1 tags, for example, would set min_end_size to
- * 128 bytes.
- * </para></listitem>
- * </itemizedlist>
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gsttagdemux.h"
-
-#include <gst/base/gsttypefindhelper.h>
-#include <gst/gst-i18n-plugin.h>
-#include <string.h>
-
-typedef enum
-{
- GST_TAG_DEMUX_READ_START_TAG,
- GST_TAG_DEMUX_TYPEFINDING,
- GST_TAG_DEMUX_STREAMING
-} GstTagDemuxState;
-
-struct _GstTagDemuxPrivate
-{
- GstPad *srcpad;
- GstPad *sinkpad;
-
- /* Number of bytes to remove from the
- * start of file (tag at beginning) */
- guint strip_start;
-
- /* Number of bytes to remove from the
- * end of file (tag at end) */
- guint strip_end;
-
- gint64 upstream_size;
-
- GstTagDemuxState state;
- GstBuffer *collect;
- GstCaps *src_caps;
-
- GstTagList *event_tags;
- GstTagList *parsed_tags;
- gboolean send_tag_event;
-
- GstSegment segment;
- gboolean need_newseg;
- gboolean newseg_update;
-
- GList *pending_events;
-};
-
-/* Require at least 8kB of data before we attempt typefind.
- * Seems a decent value based on test files
- * 40kB is massive overkill for the maximum, I think, but it
- * doesn't do any harm (tpm: increased to 64kB after watching
- * typefinding fail on a wavpack file that needed 42kB to succeed) */
-#define TYPE_FIND_MIN_SIZE 8192
-#define TYPE_FIND_MAX_SIZE 65536
-
-GST_DEBUG_CATEGORY_STATIC (tagdemux_debug);
-#define GST_CAT_DEFAULT (tagdemux_debug)
-
-static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_SOMETIMES,
- GST_STATIC_CAPS ("ANY")
- );
-
-static void gst_tag_demux_dispose (GObject * object);
-
-static GstFlowReturn gst_tag_demux_chain (GstPad * pad, GstBuffer * buf);
-static gboolean gst_tag_demux_sink_event (GstPad * pad, GstEvent * event);
-
-static gboolean gst_tag_demux_src_activate_pull (GstPad * pad, gboolean active);
-static GstFlowReturn gst_tag_demux_read_range (GstTagDemux * tagdemux,
- guint64 offset, guint length, GstBuffer ** buffer);
-
-static gboolean gst_tag_demux_src_checkgetrange (GstPad * srcpad);
-static GstFlowReturn gst_tag_demux_src_getrange (GstPad * srcpad,
- guint64 offset, guint length, GstBuffer ** buffer);
-
-static gboolean gst_tag_demux_add_srcpad (GstTagDemux * tagdemux,
- GstCaps * new_caps);
-static gboolean gst_tag_demux_remove_srcpad (GstTagDemux * tagdemux);
-
-static gboolean gst_tag_demux_srcpad_event (GstPad * pad, GstEvent * event);
-static gboolean gst_tag_demux_sink_activate (GstPad * sinkpad);
-static GstStateChangeReturn gst_tag_demux_change_state (GstElement * element,
- GstStateChange transition);
-static gboolean gst_tag_demux_pad_query (GstPad * pad, GstQuery * query);
-static const GstQueryType *gst_tag_demux_get_query_types (GstPad * pad);
-static gboolean gst_tag_demux_get_upstream_size (GstTagDemux * tagdemux);
-static void gst_tag_demux_send_tag_event (GstTagDemux * tagdemux);
-static gboolean gst_tag_demux_send_new_segment (GstTagDemux * tagdemux);
-
-static void gst_tag_demux_base_init (gpointer g_class);
-static void gst_tag_demux_class_init (gpointer g_class, gpointer d);
-static void gst_tag_demux_init (GstTagDemux * obj, GstTagDemuxClass * klass);
-
-static gpointer parent_class; /* NULL */
-
-GType
-gst_tag_demux_result_get_type (void)
-{
- static GType etype = 0;
- if (etype == 0) {
- static const GEnumValue values[] = {
- {GST_TAG_DEMUX_RESULT_BROKEN_TAG, "GST_TAG_DEMUX_RESULT_BROKEN_TAG",
- "broken-tag"},
- {GST_TAG_DEMUX_RESULT_AGAIN, "GST_TAG_DEMUX_RESULT_AGAIN", "again"},
- {GST_TAG_DEMUX_RESULT_OK, "GST_TAG_DEMUX_RESULT_OK", "ok"},
- {0, NULL, NULL}
- };
- etype = g_enum_register_static ("GstTagDemuxResult", values);
- }
- return etype;
-}
-
-/* Cannot use boilerplate macros here because we want the abstract flag */
-GType
-gst_tag_demux_get_type (void)
-{
- static GType object_type; /* 0 */
-
- if (object_type == 0) {
- static const GTypeInfo object_info = {
- sizeof (GstTagDemuxClass),
- gst_tag_demux_base_init,
- NULL, /* base_finalize */
- gst_tag_demux_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GstTagDemux),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gst_tag_demux_init
- };
-
- object_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstTagDemux", &object_info, G_TYPE_FLAG_ABSTRACT);
- }
-
- return object_type;
-}
-
-static void
-gst_tag_demux_base_init (gpointer klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_factory));
-
- GST_DEBUG_CATEGORY_INIT (tagdemux_debug, "tagdemux", 0,
- "tag demux base class");
-}
-
-static void
-gst_tag_demux_class_init (gpointer klass, gpointer d)
-{
- GstTagDemuxClass *tagdemux_class = GST_TAG_DEMUX_CLASS (klass);
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->dispose = gst_tag_demux_dispose;
-
- element_class->change_state = GST_DEBUG_FUNCPTR (gst_tag_demux_change_state);
-
- g_type_class_add_private (klass, sizeof (GstTagDemuxPrivate));
-
- /* subclasses must set at least one of these */
- tagdemux_class->min_start_size = 0;
- tagdemux_class->min_end_size = 0;
-}
-
-static void
-gst_tag_demux_reset (GstTagDemux * tagdemux)
-{
- GstBuffer **buffer_p = &tagdemux->priv->collect;
- GstCaps **caps_p = &tagdemux->priv->src_caps;
-
- tagdemux->priv->strip_start = 0;
- tagdemux->priv->strip_end = 0;
- tagdemux->priv->upstream_size = -1;
- tagdemux->priv->state = GST_TAG_DEMUX_READ_START_TAG;
- tagdemux->priv->send_tag_event = FALSE;
-
- gst_buffer_replace (buffer_p, NULL);
- gst_caps_replace (caps_p, NULL);
-
- gst_tag_demux_remove_srcpad (tagdemux);
-
- if (tagdemux->priv->event_tags) {
- gst_tag_list_free (tagdemux->priv->event_tags);
- tagdemux->priv->event_tags = NULL;
- }
- if (tagdemux->priv->parsed_tags) {
- gst_tag_list_free (tagdemux->priv->parsed_tags);
- tagdemux->priv->parsed_tags = NULL;
- }
-
- gst_segment_init (&tagdemux->priv->segment, GST_FORMAT_UNDEFINED);
- tagdemux->priv->need_newseg = TRUE;
- tagdemux->priv->newseg_update = FALSE;
-
- g_list_foreach (tagdemux->priv->pending_events,
- (GFunc) gst_mini_object_unref, NULL);
- g_list_free (tagdemux->priv->pending_events);
- tagdemux->priv->pending_events = NULL;
-}
-
-static void
-gst_tag_demux_init (GstTagDemux * demux, GstTagDemuxClass * gclass)
-{
- GstElementClass *element_klass = GST_ELEMENT_CLASS (gclass);
- GstPadTemplate *tmpl;
-
- demux->priv = g_type_instance_get_private ((GTypeInstance *) demux,
- GST_TYPE_TAG_DEMUX);
-
- tmpl = gst_element_class_get_pad_template (element_klass, "sink");
- if (tmpl) {
- demux->priv->sinkpad = gst_pad_new_from_template (tmpl, "sink");
-
- gst_pad_set_activate_function (demux->priv->sinkpad,
- GST_DEBUG_FUNCPTR (gst_tag_demux_sink_activate));
- gst_pad_set_event_function (demux->priv->sinkpad,
- GST_DEBUG_FUNCPTR (gst_tag_demux_sink_event));
- gst_pad_set_chain_function (demux->priv->sinkpad,
- GST_DEBUG_FUNCPTR (gst_tag_demux_chain));
- gst_element_add_pad (GST_ELEMENT (demux), demux->priv->sinkpad);
- }
-
- gst_tag_demux_reset (demux);
-}
-
-static void
-gst_tag_demux_dispose (GObject * object)
-{
- GstTagDemux *tagdemux = GST_TAG_DEMUX (object);
-
- gst_tag_demux_reset (tagdemux);
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static gboolean
-gst_tag_demux_add_srcpad (GstTagDemux * tagdemux, GstCaps * new_caps)
-{
- GstPad *srcpad = NULL;
-
- if (tagdemux->priv->src_caps == NULL ||
- !gst_caps_is_equal (new_caps, tagdemux->priv->src_caps)) {
-
- gst_caps_replace (&tagdemux->priv->src_caps, new_caps);
-
- if (tagdemux->priv->srcpad != NULL) {
- GST_DEBUG_OBJECT (tagdemux, "Changing src pad caps to %" GST_PTR_FORMAT,
- tagdemux->priv->src_caps);
-
- gst_pad_set_caps (tagdemux->priv->srcpad, tagdemux->priv->src_caps);
- }
- } else {
- /* Caps never changed */
- }
-
- if (tagdemux->priv->srcpad == NULL) {
- srcpad = tagdemux->priv->srcpad =
- gst_pad_new_from_template (gst_element_class_get_pad_template
- (GST_ELEMENT_GET_CLASS (tagdemux), "src"), "src");
- g_return_val_if_fail (tagdemux->priv->srcpad != NULL, FALSE);
-
- gst_pad_set_query_type_function (tagdemux->priv->srcpad,
- GST_DEBUG_FUNCPTR (gst_tag_demux_get_query_types));
- gst_pad_set_query_function (tagdemux->priv->srcpad,
- GST_DEBUG_FUNCPTR (gst_tag_demux_pad_query));
- gst_pad_set_event_function (tagdemux->priv->srcpad,
- GST_DEBUG_FUNCPTR (gst_tag_demux_srcpad_event));
- gst_pad_set_activatepull_function (tagdemux->priv->srcpad,
- GST_DEBUG_FUNCPTR (gst_tag_demux_src_activate_pull));
- gst_pad_set_checkgetrange_function (tagdemux->priv->srcpad,
- GST_DEBUG_FUNCPTR (gst_tag_demux_src_checkgetrange));
- gst_pad_set_getrange_function (tagdemux->priv->srcpad,
- GST_DEBUG_FUNCPTR (gst_tag_demux_src_getrange));
-
- gst_pad_use_fixed_caps (tagdemux->priv->srcpad);
-
- if (tagdemux->priv->src_caps)
- gst_pad_set_caps (tagdemux->priv->srcpad, tagdemux->priv->src_caps);
-
- GST_DEBUG_OBJECT (tagdemux, "Adding src pad with caps %" GST_PTR_FORMAT,
- tagdemux->priv->src_caps);
-
- gst_object_ref (tagdemux->priv->srcpad);
- gst_pad_set_active (tagdemux->priv->srcpad, TRUE);
- if (!gst_element_add_pad (GST_ELEMENT (tagdemux), tagdemux->priv->srcpad))
- return FALSE;
- gst_element_no_more_pads (GST_ELEMENT (tagdemux));
- }
-
- return TRUE;
-}
-
-static gboolean
-gst_tag_demux_remove_srcpad (GstTagDemux * demux)
-{
- gboolean res = TRUE;
-
- if (demux->priv->srcpad != NULL) {
- GST_DEBUG_OBJECT (demux, "Removing src pad");
- res = gst_element_remove_pad (GST_ELEMENT (demux), demux->priv->srcpad);
- g_return_val_if_fail (res != FALSE, FALSE);
- gst_object_unref (demux->priv->srcpad);
- demux->priv->srcpad = NULL;
- }
-
- return res;
-};
-
-/* will return FALSE if buffer is beyond end of data; will return TRUE
- * if buffer was trimmed successfully or didn't need trimming, but may
- * also return TRUE and set *buf_ref to NULL if the buffer was before
- * the start of the data */
-static gboolean
-gst_tag_demux_trim_buffer (GstTagDemux * tagdemux, GstBuffer ** buf_ref)
-{
- GstBuffer *buf = *buf_ref;
-
- guint trim_start = 0;
- guint out_size = GST_BUFFER_SIZE (buf);
- guint64 out_offset = GST_BUFFER_OFFSET (buf);
- gboolean need_sub = FALSE;
-
- /* Adjust offset and length */
- if (!GST_BUFFER_OFFSET_IS_VALID (buf)) {
- /* Can't change anything without an offset */
- return TRUE;
- }
-
- /* If the buffer crosses the tag at the end of file, trim it */
- if (tagdemux->priv->strip_end > 0) {
- if (gst_tag_demux_get_upstream_size (tagdemux)) {
- guint64 v1tag_offset =
- tagdemux->priv->upstream_size - tagdemux->priv->strip_end;
-
- if (out_offset >= v1tag_offset) {
- GST_DEBUG_OBJECT (tagdemux, "Buffer is past the end of the data");
- goto no_out_buffer_end;
- }
-
- if (out_offset + out_size > v1tag_offset) {
- out_size = v1tag_offset - out_offset;
- need_sub = TRUE;
- }
- }
- }
-
- if (tagdemux->priv->strip_start > 0) {
- /* If the buffer crosses the tag at the start of file, trim it */
- if (out_offset <= tagdemux->priv->strip_start) {
- if (out_offset + out_size <= tagdemux->priv->strip_start) {
- GST_DEBUG_OBJECT (tagdemux, "Buffer is before the start of the data");
- goto no_out_buffer_start;
- }
-
- trim_start = tagdemux->priv->strip_start - out_offset;
- out_size -= trim_start;
- out_offset = 0;
- } else {
- out_offset -= tagdemux->priv->strip_start;
- }
- need_sub = TRUE;
- }
-
- if (need_sub == TRUE) {
- if (out_size != GST_BUFFER_SIZE (buf) || !gst_buffer_is_writable (buf)) {
- GstBuffer *sub;
-
- GST_DEBUG_OBJECT (tagdemux, "Sub-buffering to trim size %d offset %"
- G_GINT64_FORMAT " to %d offset %" G_GINT64_FORMAT,
- GST_BUFFER_SIZE (buf), GST_BUFFER_OFFSET (buf), out_size, out_offset);
-
- sub = gst_buffer_create_sub (buf, trim_start, out_size);
- g_return_val_if_fail (sub != NULL, FALSE);
- gst_buffer_unref (buf);
- *buf_ref = buf = sub;
- } else {
- GST_DEBUG_OBJECT (tagdemux, "Adjusting buffer from size %d offset %"
- G_GINT64_FORMAT " to %d offset %" G_GINT64_FORMAT,
- GST_BUFFER_SIZE (buf), GST_BUFFER_OFFSET (buf), out_size, out_offset);
- }
-
- GST_BUFFER_OFFSET (buf) = out_offset;
- GST_BUFFER_OFFSET_END (buf) = out_offset + out_size;
- gst_buffer_set_caps (buf, tagdemux->priv->src_caps);
- }
-
- return TRUE;
-
-no_out_buffer_end:
- {
- gst_buffer_unref (buf);
- *buf_ref = NULL;
- return FALSE;
- }
-no_out_buffer_start:
- {
- gst_buffer_unref (buf);
- *buf_ref = NULL;
- return TRUE;
- }
-}
-
-static void
-gst_tag_demux_chain_parse_tag (GstTagDemux * demux, GstBuffer * collect)
-{
- GstTagDemuxResult parse_ret;
- GstTagDemuxClass *klass;
- guint tagsize = 0;
- guint available;
-
- g_assert (gst_buffer_is_metadata_writable (collect));
-
- klass = GST_TAG_DEMUX_CLASS (G_OBJECT_GET_CLASS (demux));
-
- /* If we receive a buffer that's from the middle of the file,
- * we can't read tags so move to typefinding */
- if (GST_BUFFER_OFFSET_IS_VALID (collect) && GST_BUFFER_OFFSET (collect) != 0) {
- GST_DEBUG_OBJECT (demux, "Received buffer from non-zero offset %"
- G_GINT64_FORMAT ". Can't read tags", GST_BUFFER_OFFSET (collect));
- demux->priv->state = GST_TAG_DEMUX_TYPEFINDING;
- return;
- }
-
- g_assert (klass->identify_tag != NULL);
- g_assert (klass->parse_tag != NULL);
-
- available = GST_BUFFER_SIZE (collect);
-
- if (available < klass->min_start_size) {
- GST_DEBUG_OBJECT (demux, "Only %u bytes available, but %u needed "
- "to identify tag", available, klass->min_start_size);
- return; /* wait for more data */
- }
-
- if (!klass->identify_tag (demux, collect, TRUE, &tagsize)) {
- GST_DEBUG_OBJECT (demux, "Could not identify start tag");
- demux->priv->state = GST_TAG_DEMUX_TYPEFINDING;
- return;
- }
-
- /* need to set offset of first buffer to 0 or trimming won't work */
- if (!GST_BUFFER_OFFSET_IS_VALID (collect)) {
- GST_WARNING_OBJECT (demux, "Fixing up first buffer without offset");
- GST_BUFFER_OFFSET (collect) = 0;
- }
-
- GST_DEBUG_OBJECT (demux, "Identified tag, size = %u bytes", tagsize);
-
- do {
- GstTagList *tags = NULL;
- guint newsize, saved_size;
-
- demux->priv->strip_start = tagsize;
-
- if (available < tagsize) {
- GST_DEBUG_OBJECT (demux, "Only %u bytes available, but %u needed "
- "to parse tag", available, tagsize);
- return; /* wait for more data */
- }
-
- saved_size = GST_BUFFER_SIZE (collect);
- GST_BUFFER_SIZE (collect) = tagsize;
- newsize = tagsize;
-
- parse_ret = klass->parse_tag (demux, collect, TRUE, &newsize, &tags);
-
- GST_BUFFER_SIZE (collect) = saved_size;
-
- switch (parse_ret) {
- case GST_TAG_DEMUX_RESULT_OK:
- demux->priv->strip_start = newsize;
- demux->priv->parsed_tags = tags;
- GST_DEBUG_OBJECT (demux, "Read start tag of size %u", newsize);
- break;
- case GST_TAG_DEMUX_RESULT_BROKEN_TAG:
- demux->priv->strip_start = newsize;
- demux->priv->parsed_tags = tags;
- GST_WARNING_OBJECT (demux, "Ignoring broken start tag of size %d",
- demux->priv->strip_start);
- break;
- case GST_TAG_DEMUX_RESULT_AGAIN:
- GST_DEBUG_OBJECT (demux, "Re-parse, this time with %u bytes", newsize);
- g_assert (newsize != tagsize);
- tagsize = newsize;
- break;
- }
- } while (parse_ret == GST_TAG_DEMUX_RESULT_AGAIN);
-
- GST_LOG_OBJECT (demux, "Parsed tag. Proceeding to typefinding");
- demux->priv->state = GST_TAG_DEMUX_TYPEFINDING;
- demux->priv->send_tag_event = TRUE;
-}
-
-static GstFlowReturn
-gst_tag_demux_chain (GstPad * pad, GstBuffer * buf)
-{
- GstTagDemux *demux;
-
- demux = GST_TAG_DEMUX (GST_PAD_PARENT (pad));
-
- /* Update our segment last_stop info */
- if (demux->priv->segment.format == GST_FORMAT_BYTES) {
- if (GST_BUFFER_OFFSET_IS_VALID (buf))
- demux->priv->segment.last_stop = GST_BUFFER_OFFSET (buf);
- demux->priv->segment.last_stop += GST_BUFFER_SIZE (buf);
- } else if (demux->priv->segment.format == GST_FORMAT_TIME) {
- if (GST_BUFFER_TIMESTAMP_IS_VALID (buf))
- demux->priv->segment.last_stop = GST_BUFFER_TIMESTAMP (buf);
- if (GST_BUFFER_DURATION_IS_VALID (buf))
- demux->priv->segment.last_stop += GST_BUFFER_DURATION (buf);
- }
-
- if (demux->priv->collect == NULL) {
- demux->priv->collect = buf;
- } else {
- demux->priv->collect = gst_buffer_join (demux->priv->collect, buf);
- }
- buf = NULL;
-
- switch (demux->priv->state) {
- case GST_TAG_DEMUX_READ_START_TAG:
- demux->priv->collect =
- gst_buffer_make_metadata_writable (demux->priv->collect);
- gst_tag_demux_chain_parse_tag (demux, demux->priv->collect);
- if (demux->priv->state != GST_TAG_DEMUX_TYPEFINDING)
- break;
- /* Fall-through */
- case GST_TAG_DEMUX_TYPEFINDING:{
- GstTypeFindProbability probability = 0;
- GstBuffer *typefind_buf = NULL;
- GstCaps *caps;
-
- if (GST_BUFFER_SIZE (demux->priv->collect) <
- TYPE_FIND_MIN_SIZE + demux->priv->strip_start)
- break; /* Go get more data first */
-
- GST_DEBUG_OBJECT (demux, "Typefinding with size %d",
- GST_BUFFER_SIZE (demux->priv->collect));
-
- /* Trim the buffer and adjust offset for typefinding */
- typefind_buf = demux->priv->collect;
- gst_buffer_ref (typefind_buf);
- if (!gst_tag_demux_trim_buffer (demux, &typefind_buf))
- return GST_FLOW_UNEXPECTED;
-
- if (typefind_buf == NULL)
- break; /* Still need more data */
-
- caps = gst_type_find_helper_for_buffer (GST_OBJECT (demux),
- typefind_buf, &probability);
-
- if (caps == NULL) {
- if (GST_BUFFER_SIZE (typefind_buf) < TYPE_FIND_MAX_SIZE) {
- /* Just break for more data */
- gst_buffer_unref (typefind_buf);
- return GST_FLOW_OK;
- }
-
- /* We failed typefind */
- GST_ELEMENT_ERROR (demux, STREAM, TYPE_NOT_FOUND, (NULL),
- ("Could not detect type for contents within tag"));
- gst_buffer_unref (typefind_buf);
- gst_buffer_unref (demux->priv->collect);
- demux->priv->collect = NULL;
- return GST_FLOW_ERROR;
- }
- gst_buffer_unref (typefind_buf);
-
- GST_DEBUG_OBJECT (demux, "Found type %" GST_PTR_FORMAT " with a "
- "probability of %u", caps, probability);
-
- if (!gst_tag_demux_add_srcpad (demux, caps)) {
- GST_DEBUG_OBJECT (demux, "Failed to add srcpad");
- gst_caps_unref (caps);
- goto error;
- }
- gst_caps_unref (caps);
-
- /* Move onto streaming and fall-through to push out existing
- * data */
- demux->priv->state = GST_TAG_DEMUX_STREAMING;
- /* fall-through */
- }
- case GST_TAG_DEMUX_STREAMING:{
- GstBuffer *outbuf = NULL;
-
- /* Trim the buffer and adjust offset */
- if (demux->priv->collect) {
- outbuf = demux->priv->collect;
- demux->priv->collect = NULL;
- if (!gst_tag_demux_trim_buffer (demux, &outbuf))
- return GST_FLOW_UNEXPECTED;
- }
- if (outbuf) {
- GList *events;
-
- if (G_UNLIKELY (demux->priv->srcpad == NULL)) {
- gst_buffer_unref (outbuf);
- return GST_FLOW_ERROR;
- }
-
- /* Might need a new segment before the buffer */
- if (demux->priv->need_newseg) {
- if (!gst_tag_demux_send_new_segment (demux)) {
- GST_WARNING_OBJECT (demux, "Downstream did not handle newsegment "
- "event as it should");
- }
- demux->priv->need_newseg = FALSE;
- }
-
- /* send any pending events we cached */
- GST_OBJECT_LOCK (demux);
- events = demux->priv->pending_events;
- demux->priv->pending_events = NULL;
- GST_OBJECT_UNLOCK (demux);
-
- while (events != NULL) {
- GST_DEBUG_OBJECT (demux->priv->srcpad, "sending cached %s event: %"
- GST_PTR_FORMAT, GST_EVENT_TYPE_NAME (events->data), events->data);
- gst_pad_push_event (demux->priv->srcpad, GST_EVENT (events->data));
- events = g_list_delete_link (events, events);
- }
-
- /* Send our own pending tag event */
- if (demux->priv->send_tag_event) {
- gst_tag_demux_send_tag_event (demux);
- demux->priv->send_tag_event = FALSE;
- }
-
- /* Ensure the caps are set correctly */
- outbuf = gst_buffer_make_metadata_writable (outbuf);
- gst_buffer_set_caps (outbuf, GST_PAD_CAPS (demux->priv->srcpad));
-
- GST_LOG_OBJECT (demux, "Pushing buffer %p", outbuf);
-
- return gst_pad_push (demux->priv->srcpad, outbuf);
- }
- }
- }
- return GST_FLOW_OK;
-
-error:
- GST_DEBUG_OBJECT (demux, "error in chain function");
-
- return GST_FLOW_ERROR;
-}
-
-static gboolean
-gst_tag_demux_sink_event (GstPad * pad, GstEvent * event)
-{
- GstTagDemux *demux;
- gboolean ret;
-
- demux = GST_TAG_DEMUX (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_EOS:
- if (demux->priv->srcpad == NULL) {
- GST_WARNING_OBJECT (demux, "EOS before we found a type");
- GST_ELEMENT_ERROR (demux, STREAM, TYPE_NOT_FOUND, (NULL), (NULL));
- }
- ret = gst_pad_event_default (pad, event);
- break;
- case GST_EVENT_NEWSEGMENT:{
- gboolean update;
- gdouble rate, arate;
- GstFormat format;
- gint64 start, stop, position;
-
- gst_event_parse_new_segment_full (event, &update, &rate, &arate,
- &format, &start, &stop, &position);
-
- gst_segment_set_newsegment_full (&demux->priv->segment, update, rate,
- arate, format, start, stop, position);
- demux->priv->newseg_update = update;
- demux->priv->need_newseg = TRUE;
- gst_event_unref (event);
- ret = TRUE;
- break;
- }
- default:
- if (demux->priv->need_newseg) {
- /* Cache all events if we have a pending segment, so they don't get
- * lost (esp. tag events) */
- GST_INFO_OBJECT (demux, "caching event: %" GST_PTR_FORMAT, event);
- GST_OBJECT_LOCK (demux);
- demux->priv->pending_events =
- g_list_append (demux->priv->pending_events, event);
- GST_OBJECT_UNLOCK (demux);
- ret = TRUE;
- } else {
- ret = gst_pad_event_default (pad, event);
- }
- break;
- }
-
- gst_object_unref (demux);
- return ret;
-}
-
-static gboolean
-gst_tag_demux_get_upstream_size (GstTagDemux * tagdemux)
-{
- GstFormat format;
- gint64 len;
-
- /* Short-cut if we already queried upstream */
- if (tagdemux->priv->upstream_size > 0)
- return TRUE;
-
- format = GST_FORMAT_BYTES;
- if (!gst_pad_query_peer_duration (tagdemux->priv->sinkpad, &format, &len) ||
- len <= 0) {
- return FALSE;
- }
-
- tagdemux->priv->upstream_size = len;
- return TRUE;
-}
-
-static gboolean
-gst_tag_demux_srcpad_event (GstPad * pad, GstEvent * event)
-{
- GstTagDemux *tagdemux;
- gboolean res = FALSE;
-
- tagdemux = GST_TAG_DEMUX (gst_pad_get_parent (pad));
-
- /* Handle SEEK events, with adjusted byte offsets and sizes. */
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:
- {
- gdouble rate;
- GstFormat format;
- GstSeekType cur_type, stop_type;
- GstSeekFlags flags;
- gint64 cur, stop;
-
- gst_event_parse_seek (event, &rate, &format, &flags,
- &cur_type, &cur, &stop_type, &stop);
-
- if (format == GST_FORMAT_BYTES &&
- tagdemux->priv->state == GST_TAG_DEMUX_STREAMING &&
- gst_pad_is_linked (tagdemux->priv->sinkpad)) {
- GstEvent *upstream;
-
- switch (cur_type) {
- case GST_SEEK_TYPE_SET:
- if (cur == -1)
- cur = 0;
- cur += tagdemux->priv->strip_start;
- break;
- case GST_SEEK_TYPE_CUR:
- break;
- case GST_SEEK_TYPE_END:
- /* Adjust the seek to be relative to the start of any end tag
- * (note: 10 bytes before end is represented by stop=-10) */
- if (cur > 0)
- cur = 0;
- cur -= tagdemux->priv->strip_end;
- break;
- case GST_SEEK_TYPE_NONE:
- default:
- break;
- }
- switch (stop_type) {
- case GST_SEEK_TYPE_SET:
- if (stop != -1) {
- /* -1 means the end of the file, pass it upstream intact */
- stop += tagdemux->priv->strip_start;
- }
- break;
- case GST_SEEK_TYPE_CUR:
- break;
- case GST_SEEK_TYPE_END:
- /* Adjust the seek to be relative to the start of any end tag
- * (note: 10 bytes before end is represented by stop=-10) */
- if (stop > 0)
- stop = 0;
- stop -= tagdemux->priv->strip_end;
- break;
- case GST_SEEK_TYPE_NONE:
- default:
- break;
- }
- upstream = gst_event_new_seek (rate, format, flags,
- cur_type, cur, stop_type, stop);
- res = gst_pad_push_event (tagdemux->priv->sinkpad, upstream);
- }
- break;
- }
- default:
- res = gst_pad_push_event (tagdemux->priv->sinkpad, event);
- event = NULL;
- break;
- }
-
- gst_object_unref (tagdemux);
- if (event)
- gst_event_unref (event);
- return res;
-}
-
-/* Read and interpret any end tag when activating in pull_range.
- * Returns FALSE if pad activation should fail. */
-static gboolean
-gst_tag_demux_pull_end_tag (GstTagDemux * demux, GstTagList ** tags)
-{
- GstTagDemuxResult parse_ret;
- GstTagDemuxClass *klass;
- GstFlowReturn flow_ret;
- GstTagList *new_tags = NULL;
- GstBuffer *buffer = NULL;
- gboolean have_tag;
- gboolean res = FALSE;
- guint64 offset;
- guint tagsize;
-
- klass = GST_TAG_DEMUX_CLASS (G_OBJECT_GET_CLASS (demux));
-
- g_assert (klass->identify_tag != NULL);
- g_assert (klass->parse_tag != NULL);
-
- if (klass->min_end_size == 0) {
- GST_DEBUG_OBJECT (demux, "Not looking for tag at the end");
- return TRUE;
- }
-
- if (demux->priv->upstream_size < klass->min_end_size) {
- GST_DEBUG_OBJECT (demux, "File too small");
- return TRUE;
- }
-
- /* Pull enough to identify the tag and retrieve its total size */
- offset = demux->priv->upstream_size - klass->min_end_size;
-
- flow_ret = gst_pad_pull_range (demux->priv->sinkpad, offset,
- klass->min_end_size, &buffer);
-
- if (flow_ret != GST_FLOW_OK) {
- GST_DEBUG_OBJECT (demux, "Could not read tag header from end of file, "
- "ret = %s", gst_flow_get_name (flow_ret));
- goto done;
- }
-
- if (GST_BUFFER_SIZE (buffer) < klass->min_end_size) {
- GST_DEBUG_OBJECT (demux, "Only managed to read %u bytes from file "
- "(required: %u bytes)", GST_BUFFER_SIZE (buffer), klass->min_end_size);
- goto done;
- }
-
- have_tag = klass->identify_tag (demux, buffer, FALSE, &tagsize);
-
- if (!have_tag) {
- GST_DEBUG_OBJECT (demux, "Could not find tag at end");
- goto done;
- }
-
- /* Now pull the entire tag */
- do {
- guint newsize, saved_size;
-
- GST_DEBUG_OBJECT (demux, "Identified tag at end, size=%u bytes", tagsize);
-
- demux->priv->strip_end = tagsize;
-
- g_assert (tagsize >= klass->min_end_size);
-
- /* Get buffer that's exactly the requested size */
- if (GST_BUFFER_SIZE (buffer) != tagsize) {
- gst_buffer_unref (buffer);
- buffer = NULL;
-
- offset = demux->priv->upstream_size - tagsize;
-
- flow_ret = gst_pad_pull_range (demux->priv->sinkpad, offset,
- tagsize, &buffer);
-
- if (flow_ret != GST_FLOW_OK) {
- GST_DEBUG_OBJECT (demux, "Could not read data from end of file at "
- "offset %" G_GUINT64_FORMAT ". ret = %s", offset,
- gst_flow_get_name (flow_ret));
- goto done;
- }
-
- if (GST_BUFFER_SIZE (buffer) < tagsize) {
- GST_DEBUG_OBJECT (demux, "Only managed to read %u bytes from file",
- GST_BUFFER_SIZE (buffer));
- goto done;
- }
- }
-
- GST_BUFFER_OFFSET (buffer) = offset;
-
- saved_size = GST_BUFFER_SIZE (buffer);
- GST_BUFFER_SIZE (buffer) = tagsize;
- newsize = tagsize;
-
- parse_ret = klass->parse_tag (demux, buffer, FALSE, &newsize, &new_tags);
-
- GST_BUFFER_SIZE (buffer) = saved_size;
-
- switch (parse_ret) {
- case GST_TAG_DEMUX_RESULT_OK:
- res = TRUE;
- demux->priv->strip_end = newsize;
- GST_DEBUG_OBJECT (demux, "Read tag at end, size %d",
- demux->priv->strip_end);
- break;
- case GST_TAG_DEMUX_RESULT_BROKEN_TAG:
- res = TRUE;
- demux->priv->strip_end = newsize;
- GST_WARNING_OBJECT (demux, "Ignoring broken tag at end, size %d",
- demux->priv->strip_end);
- break;
- case GST_TAG_DEMUX_RESULT_AGAIN:
- GST_DEBUG_OBJECT (demux, "Re-parse, this time with %d bytes", newsize);
- g_assert (newsize != tagsize);
- tagsize = newsize;
- break;
- }
- } while (parse_ret == GST_TAG_DEMUX_RESULT_AGAIN);
-
- *tags = new_tags;
- new_tags = NULL;
-
-done:
- if (new_tags)
- gst_tag_list_free (new_tags);
- if (buffer)
- gst_buffer_unref (buffer);
- return res;
-}
-
-/* Read and interpret any tag at the start when activating in
- * pull_range. Returns FALSE if pad activation should fail. */
-static gboolean
-gst_tag_demux_pull_start_tag (GstTagDemux * demux, GstTagList ** tags)
-{
- GstTagDemuxResult parse_ret;
- GstTagDemuxClass *klass;
- GstFlowReturn flow_ret;
- GstTagList *new_tags = NULL;
- GstBuffer *buffer = NULL;
- gboolean have_tag;
- gboolean res = FALSE;
- guint req, tagsize;
-
- klass = GST_TAG_DEMUX_CLASS (G_OBJECT_GET_CLASS (demux));
-
- g_assert (klass->identify_tag != NULL);
- g_assert (klass->parse_tag != NULL);
-
- if (klass->min_start_size == 0) {
- GST_DEBUG_OBJECT (demux, "Not looking for tag at the beginning");
- return TRUE;
- }
-
- /* Handle tag at start. Try with 4kB to start with */
- req = MAX (klass->min_start_size, 4096);
-
- /* Pull enough to identify the tag and retrieve its total size */
- flow_ret = gst_pad_pull_range (demux->priv->sinkpad, 0, req, &buffer);
- if (flow_ret != GST_FLOW_OK) {
- GST_DEBUG_OBJECT (demux, "Could not read data from start of file ret=%s",
- gst_flow_get_name (flow_ret));
- goto done;
- }
-
- if (GST_BUFFER_SIZE (buffer) < klass->min_start_size) {
- GST_DEBUG_OBJECT (demux, "Only managed to read %u bytes from file - "
- "no tag in this file", GST_BUFFER_SIZE (buffer));
- goto done;
- }
-
- have_tag = klass->identify_tag (demux, buffer, TRUE, &tagsize);
-
- if (!have_tag) {
- GST_DEBUG_OBJECT (demux, "Could not find start tag");
- res = TRUE;
- goto done;
- }
-
- GST_DEBUG_OBJECT (demux, "Identified start tag, size = %u bytes", tagsize);
-
- do {
- guint newsize, saved_size;
-
- demux->priv->strip_start = tagsize;
-
- /* Now pull the entire tag */
- g_assert (tagsize >= klass->min_start_size);
-
- if (GST_BUFFER_SIZE (buffer) < tagsize) {
- gst_buffer_unref (buffer);
- buffer = NULL;
-
- flow_ret = gst_pad_pull_range (demux->priv->sinkpad, 0, tagsize, &buffer);
- if (flow_ret != GST_FLOW_OK) {
- GST_DEBUG_OBJECT (demux, "Could not read data from start of file, "
- "ret = %s", gst_flow_get_name (flow_ret));
- goto done;
- }
-
- if (GST_BUFFER_SIZE (buffer) < tagsize) {
- GST_DEBUG_OBJECT (demux, "Only managed to read %u bytes from file",
- GST_BUFFER_SIZE (buffer));
- GST_ELEMENT_ERROR (demux, STREAM, DECODE,
- (_("Failed to read tag: not enough data")), (NULL));
- goto done;
- }
- }
-
- saved_size = GST_BUFFER_SIZE (buffer);
- GST_BUFFER_SIZE (buffer) = tagsize;
- newsize = tagsize;
- parse_ret = klass->parse_tag (demux, buffer, TRUE, &newsize, &new_tags);
-
- GST_BUFFER_SIZE (buffer) = saved_size;
-
- switch (parse_ret) {
- case GST_TAG_DEMUX_RESULT_OK:
- res = TRUE;
- demux->priv->strip_start = newsize;
- GST_DEBUG_OBJECT (demux, "Read start tag of size %d", newsize);
- break;
- case GST_TAG_DEMUX_RESULT_BROKEN_TAG:
- res = TRUE;
- demux->priv->strip_start = newsize;
- GST_WARNING_OBJECT (demux, "Ignoring broken start tag of size %d",
- demux->priv->strip_start);
- break;
- case GST_TAG_DEMUX_RESULT_AGAIN:
- GST_DEBUG_OBJECT (demux, "Re-parse, this time with %d bytes", newsize);
- g_assert (newsize != tagsize);
- tagsize = newsize;
- break;
- }
- } while (parse_ret == GST_TAG_DEMUX_RESULT_AGAIN);
-
- *tags = new_tags;
- new_tags = NULL;
-
-done:
- if (new_tags)
- gst_tag_list_free (new_tags);
- if (buffer)
- gst_buffer_unref (buffer);
- return res;
-}
-
-/* This function operates similarly to gst_type_find_element_activate
- * in the typefind element
- * 1. try to activate in pull mode. if not, switch to push and succeed.
- * 2. try to read tags in pull mode
- * 3. typefind the contents
- * 4. deactivate pull mode.
- * 5. if we didn't find any caps, fail.
- * 6. Add the srcpad
- * 7. if the sink pad is activated, we are in pull mode. succeed.
- * otherwise activate both pads in push mode and succeed.
- */
-static gboolean
-gst_tag_demux_sink_activate (GstPad * sinkpad)
-{
- GstTypeFindProbability probability = 0;
- GstTagDemuxClass *klass;
- GstTagDemux *demux;
- GstTagList *start_tags = NULL;
- GstTagList *end_tags = NULL;
- gboolean e_tag_ok, s_tag_ok;
- gboolean ret = FALSE;
- GstCaps *caps = NULL;
-
- demux = GST_TAG_DEMUX (GST_PAD_PARENT (sinkpad));
- klass = GST_TAG_DEMUX_CLASS (G_OBJECT_GET_CLASS (demux));
-
- /* 1: */
- /* If we can activate pull_range upstream, then read any end and start
- * tags, otherwise activate in push mode and the chain function will
- * collect buffers, read the start tag and output a buffer to end
- * preroll.
- */
- if (!gst_pad_check_pull_range (sinkpad) ||
- !gst_pad_activate_pull (sinkpad, TRUE)) {
- GST_DEBUG_OBJECT (demux, "No pull mode. Changing to push, but won't be "
- "able to read end tags");
- demux->priv->state = GST_TAG_DEMUX_READ_START_TAG;
- return gst_pad_activate_push (sinkpad, TRUE);
- }
-
- /* Look for tags at start and end of file */
- GST_DEBUG_OBJECT (demux, "Activated pull mode. Looking for tags");
- if (!gst_tag_demux_get_upstream_size (demux))
- return FALSE;
-
- demux->priv->strip_start = 0;
- demux->priv->strip_end = 0;
-
- s_tag_ok = gst_tag_demux_pull_start_tag (demux, &start_tags);
- e_tag_ok = gst_tag_demux_pull_end_tag (demux, &end_tags);
-
- if (klass->merge_tags != NULL) {
- demux->priv->parsed_tags = klass->merge_tags (demux, start_tags, end_tags);
- } else {
- /* we merge in REPLACE mode, so put the less important tags first, which
- * we'll just assume is the end tag (subclasses may change this behaviour
- * or make it configurable by overriding the merge_tags vfunc) */
- demux->priv->parsed_tags =
- gst_tag_list_merge (end_tags, start_tags, GST_TAG_MERGE_REPLACE);
- }
-
- if (start_tags)
- gst_tag_list_free (start_tags);
- if (end_tags)
- gst_tag_list_free (end_tags);
-
- if (!e_tag_ok && !s_tag_ok)
- return FALSE;
-
- if (demux->priv->parsed_tags != NULL) {
- demux->priv->send_tag_event = TRUE;
- }
-
- if (demux->priv->upstream_size <=
- demux->priv->strip_start + demux->priv->strip_end) {
- /* There was no data (probably due to a truncated file) */
- GST_DEBUG_OBJECT (demux, "No data in file");
- return FALSE;
- }
-
- /* 3 - Do typefinding on data */
- caps = gst_type_find_helper_get_range (GST_OBJECT (demux),
- (GstTypeFindHelperGetRangeFunction) gst_tag_demux_read_range,
- demux->priv->upstream_size
- - (demux->priv->strip_start + demux->priv->strip_end), &probability);
-
- GST_DEBUG_OBJECT (demux, "Found type %" GST_PTR_FORMAT " with a "
- "probability of %u", caps, probability);
-
- /* 4 - Deactivate pull mode */
- if (!gst_pad_activate_pull (sinkpad, FALSE)) {
- if (caps)
- gst_caps_unref (caps);
- GST_DEBUG_OBJECT (demux, "Could not deactivate sinkpad after reading tags");
- return FALSE;
- }
-
- /* 5 - If we didn't find the caps, fail */
- if (caps == NULL) {
- GST_DEBUG_OBJECT (demux, "Could not detect type of contents");
- GST_ELEMENT_ERROR (demux, STREAM, TYPE_NOT_FOUND, (NULL), (NULL));
- goto done_activate;
- }
-
- /* tag reading and typefinding were already done, don't do them again in
- * the chain function if we end up in push mode */
- demux->priv->state = GST_TAG_DEMUX_STREAMING;
-
- /* 6 Add the srcpad for output now we know caps. */
- if (!gst_tag_demux_add_srcpad (demux, caps)) {
- GST_DEBUG_OBJECT (demux, "Could not add source pad");
- goto done_activate;
- }
-
- /* 7 - if the sinkpad is active, it was done by downstream so we're
- * done, otherwise switch to push */
- ret = TRUE;
- if (!gst_pad_is_active (sinkpad)) {
- ret = gst_pad_activate_push (demux->priv->srcpad, TRUE);
- ret &= gst_pad_activate_push (sinkpad, TRUE);
- }
-
-done_activate:
-
- if (caps)
- gst_caps_unref (caps);
-
- return ret;
-}
-
-static gboolean
-gst_tag_demux_src_activate_pull (GstPad * pad, gboolean active)
-{
- GstTagDemux *demux = GST_TAG_DEMUX (GST_PAD_PARENT (pad));
-
- return gst_pad_activate_pull (demux->priv->sinkpad, active);
-}
-
-static gboolean
-gst_tag_demux_src_checkgetrange (GstPad * srcpad)
-{
- GstTagDemux *demux = GST_TAG_DEMUX (GST_PAD_PARENT (srcpad));
-
- return gst_pad_check_pull_range (demux->priv->sinkpad);
-}
-
-static GstFlowReturn
-gst_tag_demux_read_range (GstTagDemux * demux,
- guint64 offset, guint length, GstBuffer ** buffer)
-{
- GstFlowReturn ret;
- guint64 in_offset;
- guint in_length;
-
- g_return_val_if_fail (buffer != NULL, GST_FLOW_ERROR);
-
- /* Adjust offset and length of the request to trim off tag information.
- * For the returned buffer, adjust the output offset to match what downstream
- * should see */
- in_offset = offset + demux->priv->strip_start;
-
- if (!gst_tag_demux_get_upstream_size (demux))
- return GST_FLOW_ERROR;
-
- if (in_offset + length >= demux->priv->upstream_size - demux->priv->strip_end) {
- if (in_offset + demux->priv->strip_end >= demux->priv->upstream_size)
- return GST_FLOW_UNEXPECTED;
- in_length = demux->priv->upstream_size - demux->priv->strip_end - in_offset;
- } else {
- in_length = length;
- }
-
- ret = gst_pad_pull_range (demux->priv->sinkpad, in_offset, in_length, buffer);
-
- if (ret == GST_FLOW_OK && *buffer) {
- if (!gst_tag_demux_trim_buffer (demux, buffer))
- goto read_beyond_end;
-
- /* this should only happen in streaming mode */
- g_assert (*buffer != NULL);
-
- gst_buffer_set_caps (*buffer, demux->priv->src_caps);
- }
-
- return ret;
-
-read_beyond_end:
- {
- GST_DEBUG_OBJECT (demux, "attempted read beyond end of file");
- if (*buffer != NULL) {
- gst_buffer_unref (*buffer);
- *buffer = NULL;
- }
- return GST_FLOW_UNEXPECTED;
- }
-}
-
-static GstFlowReturn
-gst_tag_demux_src_getrange (GstPad * srcpad,
- guint64 offset, guint length, GstBuffer ** buffer)
-{
- GstTagDemux *demux = GST_TAG_DEMUX (GST_PAD_PARENT (srcpad));
-
- if (demux->priv->send_tag_event) {
- gst_tag_demux_send_tag_event (demux);
- demux->priv->send_tag_event = FALSE;
- }
-
- return gst_tag_demux_read_range (demux, offset, length, buffer);
-}
-
-static GstStateChangeReturn
-gst_tag_demux_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret;
- GstTagDemux *demux = GST_TAG_DEMUX (element);
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- gst_tag_demux_reset (demux);
- break;
- default:
- break;
- }
- return ret;
-}
-
-static gboolean
-gst_tag_demux_pad_query (GstPad * pad, GstQuery * query)
-{
- /* For a position or duration query, adjust the returned
- * bytes to strip off the end and start areas */
-
- GstTagDemux *demux = GST_TAG_DEMUX (GST_PAD_PARENT (pad));
- GstPad *peer = NULL;
- GstFormat format;
- gint64 result;
-
- if ((peer = gst_pad_get_peer (demux->priv->sinkpad)) == NULL)
- return FALSE;
-
- if (!gst_pad_query (peer, query)) {
- gst_object_unref (peer);
- return FALSE;
- }
-
- gst_object_unref (peer);
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_POSITION:
- {
- gst_query_parse_position (query, &format, &result);
- if (format == GST_FORMAT_BYTES) {
- result -= demux->priv->strip_start;
- gst_query_set_position (query, format, result);
- }
- break;
- }
- case GST_QUERY_DURATION:
- {
- gst_query_parse_duration (query, &format, &result);
- if (format == GST_FORMAT_BYTES) {
- result -= demux->priv->strip_start + demux->priv->strip_end;
- gst_query_set_duration (query, format, result);
- }
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-static const GstQueryType *
-gst_tag_demux_get_query_types (GstPad * pad)
-{
- static const GstQueryType types[] = {
- GST_QUERY_POSITION,
- GST_QUERY_DURATION,
- 0
- };
-
- return types;
-}
-
-static void
-gst_tag_demux_send_tag_event (GstTagDemux * demux)
-{
- /* FIXME: what's the correct merge mode? Docs need to tell... */
- GstTagList *merged = gst_tag_list_merge (demux->priv->event_tags,
- demux->priv->parsed_tags, GST_TAG_MERGE_KEEP);
-
- if (demux->priv->parsed_tags)
- gst_element_post_message (GST_ELEMENT (demux),
- gst_message_new_tag (GST_OBJECT (demux),
- gst_tag_list_copy (demux->priv->parsed_tags)));
-
- if (merged) {
- GstEvent *event = gst_event_new_tag (merged);
-
- GST_EVENT_TIMESTAMP (event) = 0;
- GST_DEBUG_OBJECT (demux, "Sending tag event on src pad");
- gst_pad_push_event (demux->priv->srcpad, event);
- }
-}
-
-static gboolean
-gst_tag_demux_send_new_segment (GstTagDemux * tagdemux)
-{
- GstEvent *event;
- gint64 start, stop, position;
- GstSegment *seg = &tagdemux->priv->segment;
-
- if (seg->format == GST_FORMAT_UNDEFINED) {
- GST_LOG_OBJECT (tagdemux,
- "No new segment received before first buffer. Using default");
- gst_segment_set_newsegment (seg, FALSE, 1.0,
- GST_FORMAT_BYTES, tagdemux->priv->strip_start, -1,
- tagdemux->priv->strip_start);
- }
-
- /* Can't adjust segments in non-BYTES formats */
- if (tagdemux->priv->segment.format != GST_FORMAT_BYTES) {
- event = gst_event_new_new_segment_full (tagdemux->priv->newseg_update,
- seg->rate, seg->applied_rate, seg->format, seg->start,
- seg->stop, seg->time);
- return gst_pad_push_event (tagdemux->priv->srcpad, event);
- }
-
- start = seg->start;
- stop = seg->stop;
- position = seg->time;
-
- g_return_val_if_fail (start != -1, FALSE);
- g_return_val_if_fail (position != -1, FALSE);
-
- if (tagdemux->priv->strip_end > 0) {
- if (gst_tag_demux_get_upstream_size (tagdemux)) {
- guint64 v1tag_offset =
- tagdemux->priv->upstream_size - tagdemux->priv->strip_end;
-
- if (start >= v1tag_offset) {
- /* Segment is completely within the end tag, output an open-ended
- * segment, even though all the buffers will get trimmed away */
- start = v1tag_offset;
- stop = -1;
- }
-
- if (stop != -1 && stop >= v1tag_offset) {
- GST_DEBUG_OBJECT (tagdemux,
- "Segment crosses the end tag. Trimming end");
- stop = v1tag_offset;
- }
- }
- }
-
- if (tagdemux->priv->strip_start > 0) {
- if (start > tagdemux->priv->strip_start)
- start -= tagdemux->priv->strip_start;
- else
- start = 0;
-
- if (position > tagdemux->priv->strip_start)
- position -= tagdemux->priv->strip_start;
- else
- position = 0;
-
- if (stop != -1) {
- if (stop > tagdemux->priv->strip_start)
- stop -= tagdemux->priv->strip_start;
- else
- stop = 0;
- }
- }
-
- GST_DEBUG_OBJECT (tagdemux,
- "Sending new segment update %d, rate %g, format %d, "
- "start %" G_GINT64_FORMAT ", stop %" G_GINT64_FORMAT ", position %"
- G_GINT64_FORMAT, tagdemux->priv->newseg_update, seg->rate, seg->format,
- start, stop, position);
-
- event = gst_event_new_new_segment_full (tagdemux->priv->newseg_update,
- seg->rate, seg->applied_rate, seg->format, start, stop, position);
- return gst_pad_push_event (tagdemux->priv->srcpad, event);
-}
diff --git a/gst-libs/gst/tag/gsttagdemux.h b/gst-libs/gst/tag/gsttagdemux.h
deleted file mode 100644
index 1fbff90b..00000000
--- a/gst-libs/gst/tag/gsttagdemux.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_TAG_DEMUX_H__
-#define __GST_TAG_DEMUX_H__
-
-#include <gst/gst.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.
- *
- * Since: 0.10.15
- */
-typedef enum {
- GST_TAG_DEMUX_RESULT_BROKEN_TAG,
- GST_TAG_DEMUX_RESULT_AGAIN,
- GST_TAG_DEMUX_RESULT_OK
-} GstTagDemuxResult;
-
-GType gst_tag_demux_result_get_type (void);
-#define GST_TYPE_TAG_DEMUX_RESULT (gst_tag_demux_result_get_type())
-
-/**
- * GstTagDemux:
- * @element: parent element
- *
- * Opaque #GstTagDemux structure.
- *
- * Since: 0.10.15
- */
-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 prefered over end tags.
- *
- * The #GstTagDemuxClass structure. See documentation at beginning of section
- * for details about what subclasses need to override and do.
- *
- * Since: 0.10.15
- */
-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];
-};
-
-GType gst_tag_demux_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_TAG_DEMUX_H__ */
-
diff --git a/gst-libs/gst/tag/gsttageditingprivate.h b/gst-libs/gst/tag/gsttageditingprivate.h
deleted file mode 100644
index 04275230..00000000
--- a/gst-libs/gst/tag/gsttageditingprivate.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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_TAG_EDIT_PRIVATE_H__
-#define __GST_TAG_EDIT_PRIVATE_H__
-
-#include <gst/tag/tag.h>
-
-G_BEGIN_DECLS
-
-
-typedef struct _GstTagEntryMatch GstTagEntryMatch;
-struct _GstTagEntryMatch {
- const gchar * gstreamer_tag;
- const gchar * original_tag;
-};
-
-
-GType gst_vorbis_tag_get_type (void);
-
-
-G_END_DECLS
-
-#endif /* __GST_TAG_EDIT_PRIVATE_H__ */
diff --git a/gst-libs/gst/tag/gstvorbistag.c b/gst-libs/gst/tag/gstvorbistag.c
deleted file mode 100644
index f3492108..00000000
--- a/gst-libs/gst/tag/gstvorbistag.c
+++ /dev/null
@@ -1,698 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * gstvorbistag.c: library for reading / modifying vorbis tags
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-/**
- * SECTION:gsttagvorbis
- * @short_description: tag mappings and support functions for plugins
- * dealing with vorbiscomments
- * @see_also: #GstTagList
- *
- * <refsect2>
- * <para>
- * Contains various utility functions for plugins to parse or create
- * vorbiscomments and map them to and from #GstTagList<!-- -->s.
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <gst/gsttagsetter.h>
-#include "gsttageditingprivate.h"
-#include <stdlib.h>
-#include <string.h>
-
-/*
- * see http://xiph.org/ogg/vorbis/doc/v-comment.html
- */
-static const GstTagEntryMatch tag_matches[] = {
- {GST_TAG_TITLE, "TITLE"},
- {GST_TAG_VERSION, "VERSION"},
- {GST_TAG_ALBUM, "ALBUM"},
- {GST_TAG_TRACK_NUMBER, "TRACKNUMBER"},
- {GST_TAG_ALBUM_VOLUME_NUMBER, "DISCNUMBER"},
- {GST_TAG_TRACK_COUNT, "TRACKTOTAL"},
- {GST_TAG_ALBUM_VOLUME_COUNT, "DISCTOTAL"},
- {GST_TAG_ARTIST, "ARTIST"},
- {GST_TAG_PERFORMER, "PERFORMER"},
- {GST_TAG_COMPOSER, "COMPOSER"},
- {GST_TAG_COPYRIGHT, "COPYRIGHT"},
- {GST_TAG_LICENSE, "LICENSE"},
- {GST_TAG_LICENSE_URI, "LICENSE"},
- {GST_TAG_GEO_LOCATION_NAME, "LOCATION"},
- {GST_TAG_ORGANIZATION, "ORGANIZATION"},
- {GST_TAG_DESCRIPTION, "DESCRIPTION"},
- {GST_TAG_GENRE, "GENRE"},
- {GST_TAG_DATE, "DATE"},
- {GST_TAG_CONTACT, "CONTACT"},
- {GST_TAG_ISRC, "ISRC"},
- {GST_TAG_COMMENT, "COMMENT"},
- {GST_TAG_TRACK_GAIN, "REPLAYGAIN_TRACK_GAIN"},
- {GST_TAG_TRACK_PEAK, "REPLAYGAIN_TRACK_PEAK"},
- {GST_TAG_ALBUM_GAIN, "REPLAYGAIN_ALBUM_GAIN"},
- {GST_TAG_ALBUM_PEAK, "REPLAYGAIN_ALBUM_PEAK"},
- {GST_TAG_REFERENCE_LEVEL, "REPLAYGAIN_REFERENCE_LOUDNESS"},
- {GST_TAG_MUSICBRAINZ_TRACKID, "MUSICBRAINZ_TRACKID"},
- {GST_TAG_MUSICBRAINZ_ARTISTID, "MUSICBRAINZ_ARTISTID"},
- {GST_TAG_MUSICBRAINZ_ALBUMID, "MUSICBRAINZ_ALBUMID"},
- {GST_TAG_MUSICBRAINZ_ALBUMARTISTID, "MUSICBRAINZ_ALBUMARTISTID"},
- {GST_TAG_MUSICBRAINZ_TRMID, "MUSICBRAINZ_TRMID"},
- {GST_TAG_ARTIST_SORTNAME, "ARTISTSORT"},
- {GST_TAG_ARTIST_SORTNAME, "ARTISTSORTORDER"},
- {GST_TAG_ARTIST_SORTNAME, "MUSICBRAINZ_SORTNAME"},
- {GST_TAG_ALBUM_SORTNAME, "ALBUMSORT"},
- {GST_TAG_ALBUM_SORTNAME, "ALBUMSORTORDER"},
- {GST_TAG_TITLE_SORTNAME, "TITLESORT"},
- {GST_TAG_TITLE_SORTNAME, "TITLESORTORDER"},
- {GST_TAG_ALBUM_ARTIST, "ALBUMARTIST"},
- {GST_TAG_ALBUM_ARTIST_SORTNAME, "ALBUMARTISTSORT"},
- {GST_TAG_ALBUM_ARTIST_SORTNAME, "ALBUMARTISTSORTORDER"},
- {GST_TAG_LANGUAGE_CODE, "LANGUAGE"},
- {GST_TAG_CDDA_MUSICBRAINZ_DISCID, "MUSICBRAINZ_DISCID"},
- {GST_TAG_CDDA_CDDB_DISCID, "DISCID"},
- /* For the apparent de-facto standard for coverart in vorbis comments, see:
- * http://www.hydrogenaudio.org/forums/lofiversion/index.php/t48386.html */
- {GST_TAG_PREVIEW_IMAGE, "COVERART"},
- /* some evidence that "BPM" is used elsewhere:
- * http://mail.kde.org/pipermail/amarok/2006-May/000090.html
- */
- {GST_TAG_BEATS_PER_MINUTE, "BPM"},
- {NULL, NULL}
-};
-
-/**
- * gst_tag_from_vorbis_tag:
- * @vorbis_tag: vorbiscomment tag to convert to GStreamer tag
- *
- * Looks up the GStreamer tag for a vorbiscomment tag.
- *
- * Returns: The corresponding GStreamer tag or NULL if none exists.
- */
-G_CONST_RETURN gchar *
-gst_tag_from_vorbis_tag (const gchar * vorbis_tag)
-{
- int i = 0;
- gchar *real_vorbis_tag;
-
- g_return_val_if_fail (vorbis_tag != NULL, NULL);
-
- gst_tag_register_musicbrainz_tags ();
-
- real_vorbis_tag = g_ascii_strup (vorbis_tag, -1);
- while (tag_matches[i].gstreamer_tag != NULL) {
- if (strcmp (real_vorbis_tag, tag_matches[i].original_tag) == 0) {
- break;
- }
- i++;
- }
- g_free (real_vorbis_tag);
- return tag_matches[i].gstreamer_tag;
-}
-
-/**
- * gst_tag_to_vorbis_tag:
- * @gst_tag: GStreamer tag to convert to vorbiscomment tag
- *
- * Looks up the vorbiscomment tag for a GStreamer tag.
- *
- * Returns: The corresponding vorbiscomment tag or NULL if none exists.
- */
-G_CONST_RETURN gchar *
-gst_tag_to_vorbis_tag (const gchar * gst_tag)
-{
- int i = 0;
-
- g_return_val_if_fail (gst_tag != NULL, NULL);
-
- gst_tag_register_musicbrainz_tags ();
-
- while (tag_matches[i].gstreamer_tag != NULL) {
- if (strcmp (gst_tag, tag_matches[i].gstreamer_tag) == 0) {
- return tag_matches[i].original_tag;
- }
- i++;
- }
- return NULL;
-}
-
-
-/**
- * gst_vorbis_tag_add:
- * @list: a #GstTagList
- * @tag: a vorbiscomment tag string (key in key=value), must be valid UTF-8
- * @value: a vorbiscomment value string (value in key=value), must be valid UTF-8
- *
- * Convenience function using gst_tag_from_vorbis_tag(), parsing
- * a vorbis comment string into the right type and adding it to the
- * given taglist @list.
- *
- * Unknown vorbiscomment tags will be added to the tag list in form
- * of a #GST_TAG_EXTENDED_COMMENT (since 0.10.10 at least).
- */
-void
-gst_vorbis_tag_add (GstTagList * list, const gchar * tag, const gchar * value)
-{
- const gchar *gst_tag;
- GType tag_type;
-
- g_return_if_fail (list != NULL);
- g_return_if_fail (tag != NULL);
- g_return_if_fail (value != NULL);
-
- g_return_if_fail (g_utf8_validate (tag, -1, NULL));
- g_return_if_fail (g_utf8_validate (value, -1, NULL));
- g_return_if_fail (strchr (tag, '=') == NULL);
-
- gst_tag = gst_tag_from_vorbis_tag (tag);
- if (gst_tag == NULL) {
- gchar *ext_comment;
-
- ext_comment = g_strdup_printf ("%s=%s", tag, value);
- gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_EXTENDED_COMMENT,
- ext_comment, NULL);
- g_free (ext_comment);
- return;
- }
-
- tag_type = gst_tag_get_type (gst_tag);
- switch (tag_type) {
- case G_TYPE_UINT:{
- guint tmp;
- gchar *check;
- gboolean is_track_number_tag;
- gboolean is_disc_number_tag;
-
- is_track_number_tag = (strcmp (gst_tag, GST_TAG_TRACK_NUMBER) == 0);
- is_disc_number_tag = (strcmp (gst_tag, GST_TAG_ALBUM_VOLUME_NUMBER) == 0);
- tmp = strtoul (value, &check, 10);
- if (*check == '/' && (is_track_number_tag || is_disc_number_tag)) {
- guint count;
-
- check++;
- count = strtoul (check, &check, 10);
- if (*check != '\0' || count == 0)
- break;
- if (is_track_number_tag) {
- gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_TRACK_COUNT,
- count, NULL);
- } else {
- gst_tag_list_add (list, GST_TAG_MERGE_APPEND,
- GST_TAG_ALBUM_VOLUME_COUNT, count, NULL);
- }
- }
- if (*check == '\0') {
- gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag, tmp, NULL);
- }
- break;
- }
- case G_TYPE_STRING:{
- gchar *valid = NULL;
-
- /* specialcase for language code */
- if (strcmp (tag, "LANGUAGE") == 0) {
- const gchar *s = strchr (value, '[');
-
- /* Accept both ISO-639-1 and ISO-639-2 codes */
- if (s && strchr (s, ']') == s + 4) {
- valid = g_strndup (s + 1, 3);
- } else if (s && strchr (s, ']') == s + 3) {
- valid = g_strndup (s + 1, 2);
- } else if (strlen (value) != 2 && strlen (value) != 3) {
- GST_WARNING ("doesn't contain an ISO-639 language code: %s", value);
- }
- } else if (strcmp (tag, "LICENSE") == 0) {
- /* license tags in vorbis comments must contain an URI representing
- * the license and nothing more, at least according to:
- * http://wiki.xiph.org/index.php/LICENSE_and_COPYRIGHT_tags_on_Vorbis_Comments */
- if (value && gst_uri_is_valid (value))
- gst_tag = GST_TAG_LICENSE_URI;
- }
-
- if (!valid) {
- valid = g_strdup (value);
- }
- gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag, valid, NULL);
- g_free (valid);
- break;
- }
- case G_TYPE_DOUBLE:{
- gchar *c;
-
- c = g_strdup (value);
- g_strdelimit (c, ",", '.');
- gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag,
- g_strtod (c, NULL), NULL);
- g_free (c);
- break;
- }
- default:{
- if (tag_type == GST_TYPE_DATE) {
- guint y, d = 1, m = 1;
- gchar *check = (gchar *) value;
-
- y = strtoul (check, &check, 10);
- if (*check == '-') {
- check++;
- m = strtoul (check, &check, 10);
- if (*check == '-') {
- check++;
- d = strtoul (check, &check, 10);
- }
- }
-
- /* accept dates like 2007-00-00 and 2007-05-00 */
- if (y != 0) {
- if (m == 0 && d == 0)
- m = d = 1;
- else if (m != 0 && d == 0)
- d = 1;
- }
-
- /* date might be followed by a time */
- if ((*check == '\0' || g_ascii_isspace (*check)) && y != 0 &&
- g_date_valid_dmy (d, m, y)) {
- GDate *date;
-
- date = g_date_new_dmy (d, m, y);
- gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag, date, NULL);
- g_date_free (date);
- } else {
- GST_DEBUG ("skipping invalid date '%s' (%u,%u,%u)", value, y, m, d);
- }
- } else {
- GST_WARNING ("Unhandled tag of type '%s' (%d)",
- g_type_name (tag_type), (gint) tag_type);
- }
- break;
- }
- }
-}
-
-static void
-gst_vorbis_tag_add_coverart (GstTagList * tags, gchar * img_data_base64,
- gint base64_len)
-{
- GstBuffer *img;
- gsize img_len;
- guchar *out;
- guint save = 0;
- gint state = 0;
-
- if (base64_len < 2)
- goto not_enough_data;
-
- /* img_data_base64 points to a temporary copy of the base64 encoded data, so
- * it's safe to do inpace decoding here
- * TODO: glib 2.20 and later provides g_base64_decode_inplace, so change this
- * to use glib's API instead once it's in wider use:
- * http://bugzilla.gnome.org/show_bug.cgi?id=564728
- * http://svn.gnome.org/viewvc/glib?view=revision&revision=7807 */
- out = (guchar *) img_data_base64;
- img_len = g_base64_decode_step (img_data_base64, base64_len,
- out, &state, &save);
-
- if (img_len == 0)
- goto decode_failed;
-
- img = gst_tag_image_data_to_image_buffer (out, img_len,
- GST_TAG_IMAGE_TYPE_NONE);
-
- if (img == NULL)
- goto convert_failed;
-
- gst_tag_list_add (tags, GST_TAG_MERGE_APPEND,
- GST_TAG_PREVIEW_IMAGE, img, NULL);
-
- gst_buffer_unref (img);
- return;
-
-/* ERRORS */
-not_enough_data:
- {
- GST_WARNING ("COVERART tag with too little base64-encoded data");
- return;
- }
-decode_failed:
- {
- GST_WARNING ("Couldn't decode base64 image data from COVERART tag");
- return;
- }
-convert_failed:
- {
- GST_WARNING ("Couldn't extract image or image type from COVERART tag");
- return;
- }
-}
-
-/**
- * gst_tag_list_from_vorbiscomment_buffer:
- * @buffer: buffer to convert
- * @id_data: identification data at start of stream
- * @id_data_length: length of identification data
- * @vendor_string: pointer to a string that should take the vendor string
- * of this vorbis comment or NULL if you don't need it.
- *
- * Creates a new tag list that contains the information parsed out of a
- * vorbiscomment packet.
- *
- * Returns: A new #GstTagList with all tags that could be extracted from the
- * given vorbiscomment buffer or NULL on error.
- */
-GstTagList *
-gst_tag_list_from_vorbiscomment_buffer (const GstBuffer * buffer,
- const guint8 * id_data, const guint id_data_length, gchar ** vendor_string)
-{
-#define ADVANCE(x) G_STMT_START{ \
- data += x; \
- size -= x; \
- if (size < 4) goto error; \
- cur_size = GST_READ_UINT32_LE (data); \
- data += 4; \
- size -= 4; \
- if (cur_size > size) goto error; \
- cur = (gchar*)data; \
-}G_STMT_END
- gchar *cur, *value;
- guint cur_size;
- guint iterations;
- guint8 *data;
- guint size, value_len;
- GstTagList *list;
-
- g_return_val_if_fail (GST_IS_BUFFER (buffer), NULL);
- g_return_val_if_fail (id_data != NULL || id_data_length == 0, NULL);
-
- data = GST_BUFFER_DATA (buffer);
- size = GST_BUFFER_SIZE (buffer);
- list = gst_tag_list_new ();
-
- if (size < 11 || size <= id_data_length + 4)
- goto error;
-
- if (id_data_length > 0 && memcmp (data, id_data, id_data_length) != 0)
- goto error;
-
- ADVANCE (id_data_length);
-
- if (vendor_string)
- *vendor_string = g_strndup (cur, cur_size);
-
- ADVANCE (cur_size);
- iterations = cur_size;
- cur_size = 0;
-
- while (iterations) {
- ADVANCE (cur_size);
- iterations--;
- cur = g_strndup (cur, cur_size);
- value = strchr (cur, '=');
- if (value == NULL) {
- g_free (cur);
- continue;
- }
- *value = '\0';
- value++;
- value_len = strlen (value);
- if (value_len == 0 || !g_utf8_validate (value, value_len, NULL)) {
- g_free (cur);
- continue;
- }
- /* we'll just ignore COVERARTMIME and typefind the image data */
- if (g_ascii_strcasecmp (cur, "COVERARTMIME") == 0) {
- continue;
- } else if (g_ascii_strcasecmp (cur, "COVERART") == 0) {
- gst_vorbis_tag_add_coverart (list, value, value_len);
- } else {
- gst_vorbis_tag_add (list, cur, value);
- }
- g_free (cur);
- }
-
- return list;
-
-error:
- gst_tag_list_free (list);
- return NULL;
-#undef ADVANCE
-}
-
-typedef struct
-{
- guint count;
- guint data_count;
- GList *entries;
-}
-MyForEach;
-
-static GList *
-gst_tag_to_coverart (const GValue * image_value)
-{
- gchar *coverart_data, *data_result, *mime_result;
- const gchar *mime_type;
- GstStructure *mime_struct;
- GstBuffer *buffer;
- GList *l = NULL;
-
- g_return_val_if_fail (image_value != NULL, NULL);
-
- buffer = gst_value_get_buffer (image_value);
- g_return_val_if_fail (gst_caps_is_fixed (buffer->caps), NULL);
- mime_struct = gst_caps_get_structure (buffer->caps, 0);
- mime_type = gst_structure_get_name (mime_struct);
-
- if (strcmp (mime_type, "text/uri-list") == 0) {
- /* URI reference */
- coverart_data = g_strndup ((gchar *) buffer->data, buffer->size);
- } else {
- coverart_data = g_base64_encode (buffer->data, buffer->size);
- }
-
- data_result = g_strdup_printf ("COVERART=%s", coverart_data);
- mime_result = g_strdup_printf ("COVERARTMIME=%s", mime_type);
- g_free (coverart_data);
-
- l = g_list_append (l, data_result);
- l = g_list_append (l, mime_result);
-
- return l;
-}
-
-/**
- * gst_tag_to_vorbis_comments:
- * @list: a #GstTagList
- * @tag: a GStreamer tag identifier, such as #GST_TAG_ARTIST
- *
- * Creates a new tag list that contains the information parsed out of a
- * vorbiscomment packet.
- *
- * Returns: A #GList of newly-allowcated key=value strings. Free with
- * g_list_foreach (list, (GFunc) g_free, NULL) plus g_list_free (list)
- */
-GList *
-gst_tag_to_vorbis_comments (const GstTagList * list, const gchar * tag)
-{
- const gchar *vorbis_tag = NULL;
- GList *l = NULL;
- guint i;
-
- g_return_val_if_fail (list != NULL, NULL);
- g_return_val_if_fail (tag != NULL, NULL);
-
- /* Special case: cover art is split into two tags to store data and
- * MIME-type. Even if the tag list contains multiple entries, there is
- * no reasonable way to save more than one.
- * If both, preview image and image, are present we prefer the
- * image tag.
- */
- if ((strcmp (tag, GST_TAG_PREVIEW_IMAGE) == 0 &&
- gst_tag_list_get_tag_size (list, GST_TAG_IMAGE) == 0) ||
- strcmp (tag, GST_TAG_IMAGE) == 0) {
- return gst_tag_to_coverart (gst_tag_list_get_value_index (list, tag, 0));
- }
-
- if (strcmp (tag, GST_TAG_EXTENDED_COMMENT) != 0) {
- vorbis_tag = gst_tag_to_vorbis_tag (tag);
- if (!vorbis_tag)
- return NULL;
- }
-
- /* FIXME: for tags that can map to multiple vorbis comment keys, add all
- * of the possible keys */
- for (i = 0; i < gst_tag_list_get_tag_size (list, tag); i++) {
- GType tag_type = gst_tag_get_type (tag);
- gchar *result = NULL;
-
- switch (tag_type) {
- case G_TYPE_UINT:{
- guint u;
-
- if (!gst_tag_list_get_uint_index (list, tag, i, &u))
- g_return_val_if_reached (NULL);
- result = g_strdup_printf ("%s=%u", vorbis_tag, u);
- break;
- }
- case G_TYPE_STRING:{
- gchar *str = NULL;
-
- if (!gst_tag_list_get_string_index (list, tag, i, &str))
- g_return_val_if_reached (NULL);
-
- /* special case: GST_TAG_EXTENDED_COMMENT */
- if (vorbis_tag == NULL) {
- gchar *key = NULL, *val = NULL;
-
- if (gst_tag_parse_extended_comment (str, &key, NULL, &val, TRUE)) {
- result = g_strdup_printf ("%s=%s", key, val);
- g_free (key);
- g_free (val);
- } else {
- GST_WARNING ("Not a valid extended comment string: %s", str);
- continue;
- }
- } else {
- result = g_strdup_printf ("%s=%s", vorbis_tag, str);
- }
- g_free (str);
- break;
- }
- case G_TYPE_DOUBLE:{
- gdouble value;
- gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
-
- if (!gst_tag_list_get_double_index (list, tag, i, &value))
- g_return_val_if_reached (NULL);
- g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", value);
- result = g_strconcat (vorbis_tag, "=", buf, NULL);
- break;
- }
- default:{
- if (tag_type == GST_TYPE_DATE) {
- GDate *date;
-
- if (!gst_tag_list_get_date_index (list, tag, i, &date))
- g_return_val_if_reached (NULL);
-
- /* vorbis suggests using ISO date formats */
- result =
- g_strdup_printf ("%s=%04d-%02d-%02d", vorbis_tag,
- (gint) g_date_get_year (date), (gint) g_date_get_month (date),
- (gint) g_date_get_day (date));
- g_date_free (date);
- } else {
- GST_DEBUG ("Couldn't write tag %s", tag);
- continue;
- }
- break;
- }
- }
- l = g_list_prepend (l, result);
- }
-
- return g_list_reverse (l);
-}
-
-static void
-write_one_tag (const GstTagList * list, const gchar * tag, gpointer user_data)
-{
- MyForEach *data = (MyForEach *) user_data;
- GList *comments;
- GList *it;
-
- comments = gst_tag_to_vorbis_comments (list, tag);
-
- for (it = comments; it != NULL; it = it->next) {
- gchar *result = it->data;
-
- data->count++;
- data->data_count += strlen (result);
- data->entries = g_list_prepend (data->entries, result);
- }
-
- g_list_free (comments);
-}
-
-/**
- * gst_tag_list_to_vorbiscomment_buffer:
- * @list: tag list to convert
- * @id_data: identification data at start of stream
- * @id_data_length: length of identification data, may be 0 if @id_data is NULL
- * @vendor_string: string that describes the vendor string or NULL
- *
- * Creates a new vorbiscomment buffer from a tag list.
- *
- * Returns: A new #GstBuffer containing a vorbiscomment buffer with all tags
- * that could be converted from the given tag list.
- */
-GstBuffer *
-gst_tag_list_to_vorbiscomment_buffer (const GstTagList * list,
- const guint8 * id_data, const guint id_data_length,
- const gchar * vendor_string)
-{
- GstBuffer *buffer;
- guint8 *data;
- guint i;
- GList *l;
- MyForEach my_data = { 0, 0, NULL };
- guint vendor_len;
- int required_size;
-
- g_return_val_if_fail (GST_IS_TAG_LIST (list), NULL);
- g_return_val_if_fail (id_data != NULL || id_data_length == 0, NULL);
-
- if (vendor_string == NULL)
- vendor_string = "GStreamer encoded vorbiscomment";
- vendor_len = strlen (vendor_string);
- required_size = id_data_length + 4 + vendor_len + 4 + 1;
- gst_tag_list_foreach ((GstTagList *) list, write_one_tag, &my_data);
- required_size += 4 * my_data.count + my_data.data_count;
- buffer = gst_buffer_new_and_alloc (required_size);
- data = GST_BUFFER_DATA (buffer);
- if (id_data_length > 0) {
- memcpy (data, id_data, id_data_length);
- data += id_data_length;
- }
- GST_WRITE_UINT32_LE (data, vendor_len);
- data += 4;
- memcpy (data, vendor_string, vendor_len);
- data += vendor_len;
- l = my_data.entries = g_list_reverse (my_data.entries);
- GST_WRITE_UINT32_LE (data, my_data.count);
- data += 4;
- for (i = 0; i < my_data.count; i++) {
- guint size;
- gchar *cur;
-
- g_assert (l != NULL);
- cur = l->data;
- l = g_list_next (l);
- size = strlen (cur);
- GST_WRITE_UINT32_LE (data, size);
- data += 4;
- memcpy (data, cur, size);
- data += size;
- }
- g_list_foreach (my_data.entries, (GFunc) g_free, NULL);
- g_list_free (my_data.entries);
- *data = 1;
-
- return buffer;
-}
diff --git a/gst-libs/gst/tag/lang-tables.dat b/gst-libs/gst/tag/lang-tables.dat
deleted file mode 100644
index 5e40aafd..00000000
--- a/gst-libs/gst/tag/lang-tables.dat
+++ /dev/null
@@ -1,447 +0,0 @@
-/* generated by mklangtables.c iso-codes 3.12 */
-
-#include <glib.h>
-
-#define ISO_639_FLAG_2T (1 << 0)
-#define ISO_639_FLAG_2B (1 << 1)
-
-/* *INDENT-OFF* */
-
-static const struct
-{
- const gchar iso_639_1[3];
- const gchar iso_639_2[4];
- guint8 flags;
- guint16 name_offset;
-} iso_639_codes[] = {
- /* Afar */
- { "aa", "aar", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 0 },
- /* Abkhazian */
- { "ab", "abk", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 5 },
- /* Avestan */
- { "ae", "ave", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 15 },
- /* Afrikaans */
- { "af", "afr", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 23 },
- /* Akan */
- { "ak", "aka", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 33 },
- /* Amharic */
- { "am", "amh", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 38 },
- /* Aragonese */
- { "an", "arg", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 46 },
- /* Arabic */
- { "ar", "ara", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 56 },
- /* Assamese */
- { "as", "asm", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 63 },
- /* Avaric */
- { "av", "ava", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 72 },
- /* Aymara */
- { "ay", "aym", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 79 },
- /* Azerbaijani */
- { "az", "aze", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 86 },
- /* Bashkir */
- { "ba", "bak", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 98 },
- /* Belarusian */
- { "be", "bel", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 106 },
- /* Bulgarian */
- { "bg", "bul", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 117 },
- /* Bihari languages */
- { "bh", "bih", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 127 },
- /* Bislama */
- { "bi", "bis", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 144 },
- /* Bambara */
- { "bm", "bam", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 152 },
- /* Bengali */
- { "bn", "ben", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 160 },
- /* Tibetan */
- { "bo", "bod", ISO_639_FLAG_2T, 168 },
- { "bo", "tib", ISO_639_FLAG_2B, 168 },
- /* Breton */
- { "br", "bre", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 176 },
- /* Bosnian */
- { "bs", "bos", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 183 },
- /* Catalan; Valencian */
- { "ca", "cat", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 191 },
- /* Chechen */
- { "ce", "che", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 210 },
- /* Chamorro */
- { "ch", "cha", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 218 },
- /* Corsican */
- { "co", "cos", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 227 },
- /* Cree */
- { "cr", "cre", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 236 },
- /* Czech */
- { "cs", "ces", ISO_639_FLAG_2T, 241 },
- { "cs", "cze", ISO_639_FLAG_2B, 241 },
- /* Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic */
- { "cu", "chu", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 247 },
- /* Chuvash */
- { "cv", "chv", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 328 },
- /* Welsh */
- { "cy", "cym", ISO_639_FLAG_2T, 336 },
- { "cy", "wel", ISO_639_FLAG_2B, 336 },
- /* Danish */
- { "da", "dan", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 342 },
- /* German */
- { "de", "deu", ISO_639_FLAG_2T, 349 },
- { "de", "ger", ISO_639_FLAG_2B, 349 },
- /* Divehi; Dhivehi; Maldivian */
- { "dv", "div", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 356 },
- /* Dzongkha */
- { "dz", "dzo", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 383 },
- /* Ewe */
- { "ee", "ewe", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 392 },
- /* Greek, Modern (1453-) */
- { "el", "ell", ISO_639_FLAG_2T, 396 },
- { "el", "gre", ISO_639_FLAG_2B, 396 },
- /* English */
- { "en", "eng", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 418 },
- /* Esperanto */
- { "eo", "epo", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 426 },
- /* Spanish; Castilian */
- { "es", "spa", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 436 },
- /* Estonian */
- { "et", "est", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 455 },
- /* Basque */
- { "eu", "eus", ISO_639_FLAG_2T, 464 },
- { "eu", "baq", ISO_639_FLAG_2B, 464 },
- /* Persian */
- { "fa", "fas", ISO_639_FLAG_2T, 471 },
- { "fa", "per", ISO_639_FLAG_2B, 471 },
- /* Fulah */
- { "ff", "ful", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 479 },
- /* Finnish */
- { "fi", "fin", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 485 },
- /* Fijian */
- { "fj", "fij", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 493 },
- /* Faroese */
- { "fo", "fao", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 500 },
- /* French */
- { "fr", "fra", ISO_639_FLAG_2T, 508 },
- { "fr", "fre", ISO_639_FLAG_2B, 508 },
- /* Western Frisian */
- { "fy", "fry", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 515 },
- /* Irish */
- { "ga", "gle", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 531 },
- /* Gaelic; Scottish Gaelic */
- { "gd", "gla", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 537 },
- /* Galician */
- { "gl", "glg", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 561 },
- /* Guarani */
- { "gn", "grn", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 570 },
- /* Gujarati */
- { "gu", "guj", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 578 },
- /* Manx */
- { "gv", "glv", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 587 },
- /* Hausa */
- { "ha", "hau", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 592 },
- /* Hebrew */
- { "he", "heb", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 598 },
- /* Hindi */
- { "hi", "hin", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 605 },
- /* Hiri Motu */
- { "ho", "hmo", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 611 },
- /* Croatian */
- { "hr", "hrv", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 621 },
- /* Haitian; Haitian Creole */
- { "ht", "hat", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 630 },
- /* Hungarian */
- { "hu", "hun", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 654 },
- /* Armenian */
- { "hy", "hye", ISO_639_FLAG_2T, 664 },
- { "hy", "arm", ISO_639_FLAG_2B, 664 },
- /* Herero */
- { "hz", "her", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 673 },
- /* Interlingua (International Auxiliary Language Association) */
- { "ia", "ina", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 680 },
- /* Indonesian */
- { "id", "ind", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 739 },
- /* Interlingue; Occidental */
- { "ie", "ile", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 750 },
- /* Igbo */
- { "ig", "ibo", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 774 },
- /* Sichuan Yi; Nuosu */
- { "ii", "iii", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 779 },
- /* Inupiaq */
- { "ik", "ipk", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 797 },
- /* Ido */
- { "io", "ido", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 805 },
- /* Icelandic */
- { "is", "isl", ISO_639_FLAG_2T, 809 },
- { "is", "ice", ISO_639_FLAG_2B, 809 },
- /* Italian */
- { "it", "ita", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 819 },
- /* Inuktitut */
- { "iu", "iku", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 827 },
- /* Japanese */
- { "ja", "jpn", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 837 },
- /* Javanese */
- { "jv", "jav", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 846 },
- /* Georgian */
- { "ka", "kat", ISO_639_FLAG_2T, 855 },
- { "ka", "geo", ISO_639_FLAG_2B, 855 },
- /* Kongo */
- { "kg", "kon", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 864 },
- /* Kikuyu; Gikuyu */
- { "ki", "kik", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 870 },
- /* Kuanyama; Kwanyama */
- { "kj", "kua", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 885 },
- /* Kazakh */
- { "kk", "kaz", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 904 },
- /* Kalaallisut; Greenlandic */
- { "kl", "kal", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 911 },
- /* Central Khmer */
- { "km", "khm", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 936 },
- /* Kannada */
- { "kn", "kan", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 950 },
- /* Korean */
- { "ko", "kor", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 958 },
- /* Kanuri */
- { "kr", "kau", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 965 },
- /* Kashmiri */
- { "ks", "kas", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 972 },
- /* Kurdish */
- { "ku", "kur", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 981 },
- /* Komi */
- { "kv", "kom", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 989 },
- /* Cornish */
- { "kw", "cor", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 994 },
- /* Kirghiz; Kyrgyz */
- { "ky", "kir", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1002 },
- /* Latin */
- { "la", "lat", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1018 },
- /* Luxembourgish; Letzeburgesch */
- { "lb", "ltz", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1024 },
- /* Ganda */
- { "lg", "lug", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1053 },
- /* Limburgan; Limburger; Limburgish */
- { "li", "lim", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1059 },
- /* Lingala */
- { "ln", "lin", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1092 },
- /* Lao */
- { "lo", "lao", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1100 },
- /* Lithuanian */
- { "lt", "lit", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1104 },
- /* Luba-Katanga */
- { "lu", "lub", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1115 },
- /* Latvian */
- { "lv", "lav", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1128 },
- /* Malagasy */
- { "mg", "mlg", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1136 },
- /* Marshallese */
- { "mh", "mah", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1145 },
- /* Maori */
- { "mi", "mri", ISO_639_FLAG_2T, 1157 },
- { "mi", "mao", ISO_639_FLAG_2B, 1157 },
- /* Macedonian */
- { "mk", "mkd", ISO_639_FLAG_2T, 1163 },
- { "mk", "mac", ISO_639_FLAG_2B, 1163 },
- /* Malayalam */
- { "ml", "mal", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1174 },
- /* Mongolian */
- { "mn", "mon", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1184 },
- /* Moldavian; Moldovan */
- { "mo", "mol", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1194 },
- /* Marathi */
- { "mr", "mar", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1214 },
- /* Malay */
- { "ms", "msa", ISO_639_FLAG_2T, 1222 },
- { "ms", "may", ISO_639_FLAG_2B, 1222 },
- /* Maltese */
- { "mt", "mlt", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1228 },
- /* Burmese */
- { "my", "mya", ISO_639_FLAG_2T, 1236 },
- { "my", "bur", ISO_639_FLAG_2B, 1236 },
- /* Nauru */
- { "na", "nau", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1244 },
- /* Bokm?l, Norwegian; Norwegian Bokm?l */
- { "nb", "nob", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1250 },
- /* Ndebele, North; North Ndebele */
- { "nd", "nde", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1288 },
- /* Nepali */
- { "ne", "nep", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1318 },
- /* Ndonga */
- { "ng", "ndo", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1325 },
- /* Dutch; Flemish */
- { "nl", "nld", ISO_639_FLAG_2T, 1332 },
- { "nl", "dut", ISO_639_FLAG_2B, 1332 },
- /* Norwegian Nynorsk; Nynorsk, Norwegian */
- { "nn", "nno", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1347 },
- /* Norwegian */
- { "no", "nor", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1385 },
- /* Ndebele, South; South Ndebele */
- { "nr", "nbl", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1395 },
- /* Navajo; Navaho */
- { "nv", "nav", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1425 },
- /* Chichewa; Chewa; Nyanja */
- { "ny", "nya", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1440 },
- /* Occitan (post 1500) */
- { "oc", "oci", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1464 },
- /* Ojibwa */
- { "oj", "oji", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1484 },
- /* Oromo */
- { "om", "orm", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1491 },
- /* Oriya */
- { "or", "ori", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1497 },
- /* Ossetian; Ossetic */
- { "os", "oss", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1503 },
- /* Panjabi; Punjabi */
- { "pa", "pan", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1521 },
- /* Pali */
- { "pi", "pli", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1538 },
- /* Polish */
- { "pl", "pol", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1543 },
- /* Pushto; Pashto */
- { "ps", "pus", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1550 },
- /* Portuguese */
- { "pt", "por", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1565 },
- /* Quechua */
- { "qu", "que", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1576 },
- /* Romansh */
- { "rm", "roh", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1584 },
- /* Rundi */
- { "rn", "run", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1592 },
- /* Romanian */
- { "ro", "ron", ISO_639_FLAG_2T, 1598 },
- { "ro", "rum", ISO_639_FLAG_2B, 1598 },
- /* Russian */
- { "ru", "rus", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1607 },
- /* Kinyarwanda */
- { "rw", "kin", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1615 },
- /* Sanskrit */
- { "sa", "san", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1627 },
- /* Sardinian */
- { "sc", "srd", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1636 },
- /* Sindhi */
- { "sd", "snd", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1646 },
- /* Northern Sami */
- { "se", "sme", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1653 },
- /* Sango */
- { "sg", "sag", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1667 },
- /* Sinhala; Sinhalese */
- { "si", "sin", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1673 },
- /* Slovak */
- { "sk", "slk", ISO_639_FLAG_2T, 1692 },
- { "sk", "slo", ISO_639_FLAG_2B, 1692 },
- /* Slovenian */
- { "sl", "slv", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1699 },
- /* Samoan */
- { "sm", "smo", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1709 },
- /* Shona */
- { "sn", "sna", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1716 },
- /* Somali */
- { "so", "som", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1722 },
- /* Albanian */
- { "sq", "sqi", ISO_639_FLAG_2T, 1729 },
- { "sq", "alb", ISO_639_FLAG_2B, 1729 },
- /* Serbian */
- { "sr", "srp", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1738 },
- /* Swati */
- { "ss", "ssw", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1746 },
- /* Sotho, Southern */
- { "st", "sot", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1752 },
- /* Sundanese */
- { "su", "sun", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1768 },
- /* Swedish */
- { "sv", "swe", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1778 },
- /* Swahili */
- { "sw", "swa", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1786 },
- /* Tamil */
- { "ta", "tam", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1794 },
- /* Telugu */
- { "te", "tel", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1800 },
- /* Tajik */
- { "tg", "tgk", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1807 },
- /* Thai */
- { "th", "tha", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1813 },
- /* Tigrinya */
- { "ti", "tir", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1818 },
- /* Turkmen */
- { "tk", "tuk", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1827 },
- /* Tagalog */
- { "tl", "tgl", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1835 },
- /* Tswana */
- { "tn", "tsn", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1843 },
- /* Tonga (Tonga Islands) */
- { "to", "ton", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1850 },
- /* Turkish */
- { "tr", "tur", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1872 },
- /* Tsonga */
- { "ts", "tso", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1880 },
- /* Tatar */
- { "tt", "tat", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1887 },
- /* Twi */
- { "tw", "twi", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1893 },
- /* Tahitian */
- { "ty", "tah", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1897 },
- /* Uighur; Uyghur */
- { "ug", "uig", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1906 },
- /* Ukrainian */
- { "uk", "ukr", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1921 },
- /* Urdu */
- { "ur", "urd", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1931 },
- /* Uzbek */
- { "uz", "uzb", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1936 },
- /* Venda */
- { "ve", "ven", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1942 },
- /* Vietnamese */
- { "vi", "vie", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1948 },
- /* Volap?k */
- { "vo", "vol", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1959 },
- /* Walloon */
- { "wa", "wln", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1968 },
- /* Wolof */
- { "wo", "wol", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1976 },
- /* Xhosa */
- { "xh", "xho", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1982 },
- /* Yiddish */
- { "yi", "yid", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1988 },
- /* Yoruba */
- { "yo", "yor", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 1996 },
- /* Zhuang; Chuang */
- { "za", "zha", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 2003 },
- /* Chinese */
- { "zh", "zho", ISO_639_FLAG_2T, 2018 },
- { "zh", "chi", ISO_639_FLAG_2B, 2018 },
- /* Zulu */
- { "zu", "zul", ISO_639_FLAG_2T | ISO_639_FLAG_2B, 2026 },
-};
-
-static const gchar iso_639_names[] =
- "Afar\000Abkhazian\000Avestan\000Afrikaans\000Akan\000Amharic\000Aragonese"
- "\000Arabic\000Assamese\000Avaric\000Aymara\000Azerbaijani\000Bashkir\000B"
- "elarusian\000Bulgarian\000Bihari languages\000Bislama\000Bambara\000Benga"
- "li\000Tibetan\000Breton\000Bosnian\000Catalan; Valencian\000Chechen\000Ch"
- "amorro\000Corsican\000Cree\000Czech\000Church Slavic; Old Slavonic; Churc"
- "h Slavonic; Old Bulgarian; Old Church Slavonic\000Chuvash\000Welsh\000Dan"
- "ish\000German\000Divehi; Dhivehi; Maldivian\000Dzongkha\000Ewe\000Greek, "
- "Modern (1453-)\000English\000Esperanto\000Spanish; Castilian\000Estonian"
- "\000Basque\000Persian\000Fulah\000Finnish\000Fijian\000Faroese\000French"
- "\000Western Frisian\000Irish\000Gaelic; Scottish Gaelic\000Galician\000Gu"
- "arani\000Gujarati\000Manx\000Hausa\000Hebrew\000Hindi\000Hiri Motu\000Cro"
- "atian\000Haitian; Haitian Creole\000Hungarian\000Armenian\000Herero\000In"
- "terlingua (International Auxiliary Language Association)\000Indonesian"
- "\000Interlingue; Occidental\000Igbo\000Sichuan Yi; Nuosu\000Inupiaq\000Id"
- "o\000Icelandic\000Italian\000Inuktitut\000Japanese\000Javanese\000Georgia"
- "n\000Kongo\000Kikuyu; Gikuyu\000Kuanyama; Kwanyama\000Kazakh\000Kalaallis"
- "ut; Greenlandic\000Central Khmer\000Kannada\000Korean\000Kanuri\000Kashmi"
- "ri\000Kurdish\000Komi\000Cornish\000Kirghiz; Kyrgyz\000Latin\000Luxembour"
- "gish; Letzeburgesch\000Ganda\000Limburgan; Limburger; Limburgish\000Linga"
- "la\000Lao\000Lithuanian\000Luba-Katanga\000Latvian\000Malagasy\000Marshal"
- "lese\000Maori\000Macedonian\000Malayalam\000Mongolian\000Moldavian; Moldo"
- "van\000Marathi\000Malay\000Maltese\000Burmese\000Nauru\000Bokm\303\245l, "
- "Norwegian; Norwegian Bokm\303\245l\000Ndebele, North; North Ndebele\000Ne"
- "pali\000Ndonga\000Dutch; Flemish\000Norwegian Nynorsk; Nynorsk, Norwegian"
- "\000Norwegian\000Ndebele, South; South Ndebele\000Navajo; Navaho\000Chich"
- "ewa; Chewa; Nyanja\000Occitan (post 1500)\000Ojibwa\000Oromo\000Oriya\000"
- "Ossetian; Ossetic\000Panjabi; Punjabi\000Pali\000Polish\000Pushto; Pashto"
- "\000Portuguese\000Quechua\000Romansh\000Rundi\000Romanian\000Russian\000K"
- "inyarwanda\000Sanskrit\000Sardinian\000Sindhi\000Northern Sami\000Sango"
- "\000Sinhala; Sinhalese\000Slovak\000Slovenian\000Samoan\000Shona\000Somal"
- "i\000Albanian\000Serbian\000Swati\000Sotho, Southern\000Sundanese\000Swed"
- "ish\000Swahili\000Tamil\000Telugu\000Tajik\000Thai\000Tigrinya\000Turkmen"
- "\000Tagalog\000Tswana\000Tonga (Tonga Islands)\000Turkish\000Tsonga\000Ta"
- "tar\000Twi\000Tahitian\000Uighur; Uyghur\000Ukrainian\000Urdu\000Uzbek"
- "\000Venda\000Vietnamese\000Volap\303\274k\000Walloon\000Wolof\000Xhosa"
- "\000Yiddish\000Yoruba\000Zhuang; Chuang\000Chinese\000Zulu";
-
-/* *INDENT-ON* */
diff --git a/gst-libs/gst/tag/lang.c b/gst-libs/gst/tag/lang.c
deleted file mode 100644
index dc212eff..00000000
--- a/gst-libs/gst/tag/lang.c
+++ /dev/null
@@ -1,497 +0,0 @@
-/* GStreamer language codes and names utility functions
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gsttaglanguagecodes
- * @short_description: mappings for ISO-639 language codes and names
- * @see_also: #GstTagList
- *
- * <refsect2>
- * <para>
- * Provides helper functions to convert between the various ISO-639 language
- * codes, and to map language codes to language names.
- * </para>
- * </refsect2>
- */
-
-/* FIXME 0.11: maybe switch to ISO-639-2 everywhere incl. GST_TAG_LANGUAGE? */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#undef GETTEXT_PACKAGE
-#define GETTEXT_PACKAGE "iso_639"
-
-#define ISO_639_XML_PATH ISO_CODES_PREFIX "/share/xml/iso-codes/iso_639.xml"
-#define ISO_CODES_LOCALEDIR ISO_CODES_PREFIX "/share/locale"
-
-#include <gst/gst-i18n-plugin.h>
-#include <gst/gst.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "lang-tables.dat"
-
-/* FIXME: remove once we depend on GLib >= 2.22 */
-#if !GLIB_CHECK_VERSION (2, 22, 0)
-#define g_mapped_file_unref g_mapped_file_free
-#endif
-
-#ifndef GST_DISABLE_GST_DEBUG
-
-#define GST_CAT_DEFAULT ensure_debug_category()
-
-static GstDebugCategory *
-ensure_debug_category (void)
-{
- static gsize cat_gonce = 0;
-
- if (g_once_init_enter (&cat_gonce)) {
- gsize cat_done;
-
- cat_done = (gsize) _gst_debug_category_new ("tag-langcodes", 0,
- "GstTag language codes and names");
-
- g_once_init_leave (&cat_gonce, cat_done);
- }
-
- return (GstDebugCategory *) cat_gonce;
-}
-
-#else
-
-#define ensure_debug_category() /* NOOP */
-
-#endif /* GST_DISABLE_GST_DEBUG */
-
-/* ------------------------------------------------------------------------- */
-
-/* Loading and initing */
-
-#if defined(HAVE_ISO_CODES)
-static const gchar *
-get_val (const gchar ** names, const gchar ** vals, const gchar * name)
-{
- while (names != NULL && *names != NULL) {
- if (strcmp (*names, name) == 0)
- return *vals;
- ++names;
- ++vals;
- }
- return NULL;
-}
-
-static void
-parse_start_element (GMarkupParseContext * ctx, const gchar * element_name,
- const gchar ** attr_names, const gchar ** attr_vals,
- gpointer user_data, GError ** error)
-{
- GHashTable *ht = (GHashTable *) user_data;
- const gchar *c1, *c2t, *c2b, *name, *tname;
-
- if (strcmp (element_name, "iso_639_entry") != 0)
- return;
-
- c1 = get_val (attr_names, attr_vals, "iso_639_1_code");
-
- /* only interested in languages with an ISO 639-1 code for now */
- if (c1 == NULL)
- return;
-
- c2t = get_val (attr_names, attr_vals, "iso_639_2T_code");
- c2b = get_val (attr_names, attr_vals, "iso_639_2B_code");
- name = get_val (attr_names, attr_vals, "name");
-
- if (c2t == NULL || c2b == NULL || name == NULL) {
- GST_WARNING ("broken iso_639.xml entry: c2t=%p, c2b=%p, name=%p", c2t,
- c2b, name);
- return;
- }
-
- /* translate language name */
- tname = _(name);
-
- /* if no translation was found, it will return the input string, which we
- * we don't want to put into the hash table because it will be freed again */
- if (G_UNLIKELY (tname == name))
- tname = g_intern_string (name);
-
- /* now overwrite default/fallback mappings with names in locale language */
- g_hash_table_replace (ht, (gpointer) g_intern_string (c1), (gpointer) tname);
- g_hash_table_replace (ht, (gpointer) g_intern_string (c2b), (gpointer) tname);
- if (strcmp (c2t, c2b) != 0) {
- g_hash_table_replace (ht, (gpointer) g_intern_string (c2t),
- (gpointer) tname);
- }
-
- GST_LOG ("%s %s %s : %s - %s", c1, c2t, c2b, name, tname);
-}
-
-static void
-gst_tag_load_iso_639_xml (GHashTable * ht)
-{
- GMappedFile *f;
- GError *err = NULL;
- gchar *xml_data;
- gsize xml_len;
-
-#ifdef ENABLE_NLS
- GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
- ISO_CODES_LOCALEDIR);
- bindtextdomain (GETTEXT_PACKAGE, ISO_CODES_LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif
-
- f = g_mapped_file_new (ISO_639_XML_PATH, FALSE, NULL);
- if (f != NULL) {
- xml_data = (gchar *) g_mapped_file_get_contents (f);
- xml_len = g_mapped_file_get_length (f);
- } else {
- if (!g_file_get_contents (ISO_639_XML_PATH, &xml_data, &xml_len, &err)) {
- GST_WARNING ("Could not read %s: %s", ISO_639_XML_PATH, err->message);
- g_error_free (err);
- return;
- }
- }
-
- if (g_utf8_validate (xml_data, xml_len, NULL)) {
- GMarkupParser xml_parser = { parse_start_element, NULL, NULL, NULL, NULL };
- GMarkupParseContext *ctx;
-
- ctx = g_markup_parse_context_new (&xml_parser, 0, ht, NULL);
- if (!g_markup_parse_context_parse (ctx, xml_data, xml_len, &err)) {
- GST_WARNING ("Parsing iso_639.xml failed: %s", err->message);
- g_error_free (err);
- }
- g_markup_parse_context_free (ctx);
- } else {
- GST_WARNING ("iso_639.xml file is not valid UTF-8");
- GST_MEMDUMP ("iso_639.xml file", (guint8 *) xml_data, xml_len);
- }
-
- /* ... and clean up */
- if (f != NULL)
- g_mapped_file_unref (f);
- else
- g_free (xml_data);
-}
-#endif /* HAVE_ISO_CODES */
-
-static GHashTable *
-gst_tag_get_iso_639_ht (void)
-{
- static gsize once_val = 0;
- int i;
-
- if (g_once_init_enter (&once_val)) {
- GHashTable *ht;
- gsize done_val;
-
- GST_MEMDUMP ("iso 639 language names (internal default/fallback)",
- (guint8 *) iso_639_names, sizeof (iso_639_names));
-
- /* maps code -> language name; all strings are either interned strings
- * or const static strings from lang-table.c */
- ht = g_hash_table_new (g_str_hash, g_str_equal);
-
- /* set up default/fallback mappings */
- for (i = 0; i < G_N_ELEMENTS (iso_639_codes); ++i) {
- GST_LOG ("%3d %s %s %c%c 0x%04x %s", i, iso_639_codes[i].iso_639_1,
- iso_639_codes[i].iso_639_2,
- ((iso_639_codes[i].flags & ISO_639_FLAG_2B)) ? 'B' : '.',
- ((iso_639_codes[i].flags & ISO_639_FLAG_2T)) ? 'T' : '.',
- iso_639_codes[i].name_offset,
- iso_639_names + iso_639_codes[i].name_offset);
-
-#ifdef HAVE_ISO_CODES
- /* intern these in order to minimise allocations when interning strings
- * read from the xml file later */
- g_intern_static_string (iso_639_codes[i].iso_639_1);
- g_intern_static_string (iso_639_codes[i].iso_639_2);
- g_intern_static_string (iso_639_names + iso_639_codes[i].name_offset);
-#endif
-
- /* and add default mapping (these strings are always valid) */
- g_hash_table_insert (ht, (gpointer) iso_639_codes[i].iso_639_1,
- (gpointer) (iso_639_names + iso_639_codes[i].name_offset));
- g_hash_table_insert (ht, (gpointer) iso_639_codes[i].iso_639_2,
- (gpointer) (iso_639_names + iso_639_codes[i].name_offset));
- }
-
-#ifdef HAVE_ISO_CODES
- {
- GstClockTime ts = gst_util_get_timestamp ();
-
- gst_tag_load_iso_639_xml (ht);
-
- ts = gst_util_get_timestamp () - ts;
- GST_INFO ("iso_639.xml loading took %.2gms", (double) ts / GST_MSECOND);
- }
-#else
- GST_INFO ("iso-codes disabled or not available");
-#endif
-
- done_val = (gsize) ht;
- g_once_init_leave (&once_val, done_val);
- }
-
- return (GHashTable *) once_val;
-}
-
-/* ------------------------------------------------------------------------- */
-
-static int
-qsort_strcmp_func (const void *p1, const void *p2)
-{
- return strcmp (*(char *const *) p1, *(char *const *) p2);
-}
-
-/**
- * gst_tag_get_language_codes:
- *
- * Returns a list of known language codes (in form of two-letter ISO-639-1
- * codes). This is useful for UIs to build a list of available languages for
- * tagging purposes (e.g. to tag an audio track appropriately in a video or
- * audio editor).
- *
- * Returns: NULL-terminated string array with two-letter language codes. Free
- * with g_strfreev() when no longer needed.
- *
- * Since: 0.10.26
- */
-gchar **
-gst_tag_get_language_codes (void)
-{
- GHashTableIter iter;
- GHashTable *ht;
- gpointer key;
- gchar **codes;
- int i;
-
- ensure_debug_category ();
-
- ht = gst_tag_get_iso_639_ht ();
-
- /* we have at least two keys for each language (-1 code and -2 code) */
- codes = g_new (gchar *, (g_hash_table_size (ht) / 2) + 1);
-
- i = 0;
- g_hash_table_iter_init (&iter, ht);
- while (g_hash_table_iter_next (&iter, &key, NULL)) {
- const gchar *lang_code = key;
-
- if (strlen (lang_code) == 2) {
- codes[i] = g_strdup (lang_code);
- ++i;
- }
- }
- codes[i] = NULL;
-
- /* be nice and sort the list */
- qsort (&codes[0], i, sizeof (gchar *), qsort_strcmp_func);
-
- return codes;
-}
-
-/**
- * gst_tag_get_language_name:
- * @language_code: two or three-letter ISO-639 language code
- *
- * Returns the name of the language given an ISO-639 language code, such
- * as often found in a GST_TAG_LANGUAGE tag. The name will be translated
- * according to the current locale (if the library was built against the
- * iso-codes package, otherwise the English name will be returned).
- *
- * Language codes are case-sensitive and expected to be lower case.
- *
- * Returns: language name in UTF-8 format, or NULL if @language_code could
- * not be mapped to a language name. The returned string must not be
- * modified and does not need to freed; it will stay valid until the
- * application is terminated.
- *
- * Since: 0.10.26
- */
-const gchar *
-gst_tag_get_language_name (const gchar * language_code)
-{
- const gchar *lang_name;
- GHashTable *ht;
-
- g_return_val_if_fail (language_code != NULL, NULL);
-
- ensure_debug_category ();
-
- ht = gst_tag_get_iso_639_ht ();
-
- lang_name = g_hash_table_lookup (ht, (gpointer) language_code);
- GST_LOG ("%s -> %s", language_code, GST_STR_NULL (lang_name));
-
- return lang_name;
-}
-
-/**
- * gst_tag_get_language_code_iso_639_1:
- * @lang_code: ISO-639 language code (e.g. "deu" or "ger" or "de")
- *
- * Returns two-letter ISO-639-1 language code given a three-letter ISO-639-2
- * language code or two-letter ISO-639-1 language code (both are accepted for
- * convenience).
- *
- * Language codes are case-sensitive and expected to be lower case.
- *
- * Returns: two-letter ISO-639-1 language code string that maps to @lang_code,
- * or NULL if no mapping is known. The returned string must not be
- * modified or freed.
- *
- * Since: 0.10.26
- */
-const gchar *
-gst_tag_get_language_code_iso_639_1 (const gchar * lang_code)
-{
- const gchar *c = NULL;
- int i;
-
- g_return_val_if_fail (lang_code != NULL, NULL);
-
- ensure_debug_category ();
-
- /* FIXME: we are being a bit inconsistent here in the sense that will only
- * map the language codes from our static table. Theoretically the iso-codes
- * XML file might have had additional codes that are now in the hash table.
- * We keep it simple for now and don't waste memory on additional tables. */
- for (i = 0; i < G_N_ELEMENTS (iso_639_codes); ++i) {
- /* we check both codes here, so function can be used in a more versatile
- * way, to convert a language tag to a two-letter language code and/or
- * verify an existing code */
- if (strcmp (lang_code, iso_639_codes[i].iso_639_1) == 0 ||
- strcmp (lang_code, iso_639_codes[i].iso_639_2) == 0) {
- c = iso_639_codes[i].iso_639_1;
- break;
- }
- }
-
- GST_LOG ("%s -> %s", lang_code, GST_STR_NULL (c));
-
- return c;
-}
-
-static const gchar *
-gst_tag_get_language_code_iso_639_2X (const gchar * lang_code, guint8 flags)
-{
- int i;
-
- /* FIXME: we are being a bit inconsistent here in the sense that we will only
- * map the language codes from our static table. Theoretically the iso-codes
- * XML file might have had additional codes that are now in the hash table.
- * We keep it simple for now and don't waste memory on additional tables.
- * Also, we currently only parse the iso_639.xml file if language names or
- * a list of all codes is requested, and it'd be nice to keep it like that. */
- for (i = 0; i < G_N_ELEMENTS (iso_639_codes); ++i) {
- /* we check both codes here, so function can be used in a more versatile
- * way, to convert a language tag to a three-letter language code and/or
- * verify an existing code */
- if (strcmp (lang_code, iso_639_codes[i].iso_639_1) == 0 ||
- strcmp (lang_code, iso_639_codes[i].iso_639_2) == 0) {
- if ((iso_639_codes[i].flags & flags) == flags) {
- return iso_639_codes[i].iso_639_2;
- } else if (i > 0 && (iso_639_codes[i - 1].flags & flags) == flags &&
- iso_639_codes[i].name_offset == iso_639_codes[i - 1].name_offset) {
- return iso_639_codes[i - 1].iso_639_2;
- } else if (i < G_N_ELEMENTS (iso_639_codes) &&
- (iso_639_codes[i + 1].flags & flags) == flags &&
- iso_639_codes[i].name_offset == iso_639_codes[i + 1].name_offset) {
- return iso_639_codes[i + 1].iso_639_2;
- }
- }
- }
- return NULL;
-}
-
-/**
- * gst_tag_get_language_code_iso_639_2T:
- * @lang_code: ISO-639 language code (e.g. "deu" or "ger" or "de")
- *
- * Returns three-letter ISO-639-2 "terminological" language code given a
- * two-letter ISO-639-1 language code or a three-letter ISO-639-2 language
- * code (both are accepted for convenience).
- *
- * The "terminological" code is derived from the local name of the language
- * (e.g. "deu" for German instead of "ger"). In most scenarios, the
- * "terminological" codes are prefered over the "bibliographic" ones.
- *
- * Language codes are case-sensitive and expected to be lower case.
- *
- * Returns: three-letter ISO-639-2 language code string that maps to @lang_code,
- * or NULL if no mapping is known. The returned string must not be
- * modified or freed.
- *
- * Since: 0.10.26
- */
-const gchar *
-gst_tag_get_language_code_iso_639_2T (const gchar * lang_code)
-{
- const gchar *c;
-
- g_return_val_if_fail (lang_code != NULL, NULL);
-
- ensure_debug_category ();
-
- c = gst_tag_get_language_code_iso_639_2X (lang_code, ISO_639_FLAG_2T);
-
- GST_LOG ("%s -> %s", lang_code, GST_STR_NULL (c));
-
- return c;
-}
-
-/**
- * gst_tag_get_language_code_iso_639_2B:
- * @lang_code: ISO-639 language code (e.g. "deu" or "ger" or "de")
- *
- * Returns three-letter ISO-639-2 "bibliographic" language code given a
- * two-letter ISO-639-1 language code or a three-letter ISO-639-2 language
- * code (both are accepted for convenience).
- *
- * The "bibliographic" code is derived from the English name of the language
- * (e.g. "ger" for German instead of "de" or "deu"). In most scenarios, the
- * "terminological" codes are prefered.
- *
- * Language codes are case-sensitive and expected to be lower case.
- *
- * Returns: three-letter ISO-639-2 language code string that maps to @lang_code,
- * or NULL if no mapping is known. The returned string must not be
- * modified or freed.
- *
- * Since: 0.10.26
- */
-const gchar *
-gst_tag_get_language_code_iso_639_2B (const gchar * lang_code)
-{
- const gchar *c;
-
- g_return_val_if_fail (lang_code != NULL, NULL);
-
- ensure_debug_category ();
-
- c = gst_tag_get_language_code_iso_639_2X (lang_code, ISO_639_FLAG_2B);
-
- GST_LOG ("%s -> %s", lang_code, GST_STR_NULL (c));
-
- return c;
-}
diff --git a/gst-libs/gst/tag/mklangtables.c b/gst-libs/gst/tag/mklangtables.c
deleted file mode 100644
index 0f615ff4..00000000
--- a/gst-libs/gst/tag/mklangtables.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/* GStreamer Language Tag Utility Functions
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/* mklangtables.c:
- * little program that reads iso_639.xml and outputs tables for us as fallback
- * for when iso-codes are not available or we fail to read the file for some
- * reason, and so we don't have to parse the xml file just to map codes.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <glib.h>
-#include <string.h>
-
-#if !GLIB_CHECK_VERSION (2, 22, 0)
-#define g_mapped_file_unref g_mapped_file_free
-#endif
-
-#define ISO_639_XML_PATH ISO_CODES_PREFIX "/share/xml/iso-codes/iso_639.xml"
-
-typedef struct
-{
- gchar code_1[3]; /* de */
- gchar code_2t[4]; /* deu */
- gchar code_2b[4]; /* ger */
- const gchar *name; /* German */
- guint name_offset; /* offset into string table */
-} IsoLang;
-
-static GArray *languages = NULL;
-
-static void
-dump_languages (void)
-{
- GString *names;
- const char *s;
- int i, num_escaped;
-
- g_assert (languages != NULL);
-
- names = g_string_new ("");
-
- g_print ("/* generated by " __FILE__ " iso-codes " ISO_CODES_VERSION " */\n");
- g_print ("\n");
- g_print ("#include <glib.h>\n");
- g_print ("\n");
- g_print ("#define ISO_639_FLAG_2T (1 << 0)\n");
- g_print ("#define ISO_639_FLAG_2B (1 << 1)\n");
- g_print ("\n");
- g_print ("/* *INDENT-OFF* */\n");
- g_print ("\n");
- g_print ("static const struct\n");
- g_print ("{\n");
- g_print (" const gchar iso_639_1[3];\n");
- g_print (" const gchar iso_639_2[4];\n");
- g_print (" guint8 flags;\n");
- g_print (" guint16 name_offset;\n");
- g_print ("} iso_639_codes[] = {\n");
-
- for (i = 0, num_escaped = 0; i < languages->len; ++i) {
- IsoLang *lang = &g_array_index (languages, IsoLang, i);
-
- /* For now just print those where there's both a ISO-639-1 and -2 code */
- if (lang->code_1[0] == '\0')
- continue;
-
- /* save current offset */
- lang->name_offset = names->len;
-
- /* adjust for fact that \000 is 4 chars now but will take up only 1 later */
- lang->name_offset -= num_escaped * 3;
-
- /* append one char at a time, making sure to escape UTF-8 characters */
- for (s = lang->name; s != NULL && *s != '\0'; ++s) {
- if (g_ascii_isprint (*s) && *s != '"' && *s != '\\') {
- g_string_append_c (names, *s);
- } else {
- g_string_append_printf (names, "\\%03o", (unsigned char) *s);
- ++num_escaped;
- }
- }
- g_string_append (names, "\\000");
- ++num_escaped;
-
- g_print (" /* %s */\n", lang->name);
- if (strcmp (lang->code_2b, lang->code_2t) == 0) {
- g_print (" { \"%s\", \"%s\", ISO_639_FLAG_2T | ISO_639_FLAG_2B, %u },\n",
- lang->code_1, lang->code_2t, lang->name_offset);
- } else {
- /* if 639-2T and 639-2B differ, put 639-2T first */
- g_print (" { \"%s\", \"%s\", ISO_639_FLAG_2T, %u },\n",
- lang->code_1, lang->code_2t, lang->name_offset);
- g_print (" { \"%s\", \"%s\", ISO_639_FLAG_2B, %u },\n",
- lang->code_1, lang->code_2b, lang->name_offset);
- }
- }
-
- g_print ("};\n");
- g_print ("\n");
- g_print ("static const gchar iso_639_names[] =\n");
- s = names->str;
- while (s != NULL && *s != '\0') {
- gchar line[74], *lastesc;
- guint left;
-
- left = strlen (s);
- g_strlcpy (line, s, MIN (left, sizeof (line)));
- s += sizeof (line) - 1;
- /* avoid partial escaped codes at the end of a line */
- if ((lastesc = strrchr (line, '\\')) && strlen (lastesc) < 4) {
- s -= strlen (lastesc);
- *lastesc = '\0';
- }
- g_print (" \"%s\"", line);
- if (left < 74)
- break;
- g_print ("\n");
- }
- g_print (";\n");
- g_print ("\n");
- g_print ("/* *INDENT-ON* */\n");
-
- g_string_free (names, TRUE);
-}
-
-static gboolean
-copy_attribute (gchar * dest, guint dest_len, const gchar ** attr_names,
- const gchar ** attr_vals, const gchar * needle)
-{
- while (attr_names != NULL && *attr_names != NULL) {
- if (strcmp (*attr_names, needle) == 0) {
- g_strlcpy (dest, *attr_vals, dest_len);
- return TRUE;
- }
- ++attr_names;
- ++attr_vals;
- }
- dest[0] = '\0';
- return FALSE;
-}
-
-static void
-xml_start_element (GMarkupParseContext * ctx, const gchar * element_name,
- const gchar ** attr_names, const gchar ** attr_vals,
- gpointer user_data, GError ** error)
-{
- gchar name[256];
- IsoLang lang;
-
- if (strcmp (element_name, "iso_639_entry") != 0)
- return;
-
- copy_attribute (lang.code_1, 3, attr_names, attr_vals, "iso_639_1_code");
- copy_attribute (lang.code_2t, 4, attr_names, attr_vals, "iso_639_2T_code");
- copy_attribute (lang.code_2b, 4, attr_names, attr_vals, "iso_639_2B_code");
-
- copy_attribute (name, sizeof (name), attr_names, attr_vals, "name");
- lang.name = g_intern_string (name);
-
- g_array_append_val (languages, lang);
-}
-
-static void
-parse_iso_639_xml (const gchar * data, gsize len)
-{
- GMarkupParser xml_parser = { xml_start_element, NULL, NULL, NULL, NULL };
- GMarkupParseContext *ctx;
- GError *err = NULL;
-
- g_return_if_fail (g_utf8_validate (data, len, NULL));
-
- ctx = g_markup_parse_context_new (&xml_parser, 0, NULL, NULL);
- if (!g_markup_parse_context_parse (ctx, data, len, &err))
- g_error ("Parsing failed: %s", err->message);
-
- g_markup_parse_context_free (ctx);
-}
-
-static gint
-languages_sort_func (IsoLang * l1, IsoLang * l2)
-{
- if (l1 == l2)
- return 0;
-
- if (l1->code_1[0] == '\0' && l2->code_1[0] != '\0')
- return -1;
-
- return strcmp (l1->code_1, l2->code_1);
-}
-
-int
-main (int argc, char **argv)
-{
- GMappedFile *f;
- gchar *xml_data;
- gsize xml_len;
-
- f = g_mapped_file_new (ISO_639_XML_PATH, FALSE, NULL);
- if (f != NULL) {
- xml_data = (gchar *) g_mapped_file_get_contents (f);
- xml_len = g_mapped_file_get_length (f);
- } else {
- GError *err = NULL;
-
- if (!g_file_get_contents (ISO_639_XML_PATH, &xml_data, &xml_len, &err))
- g_error ("Could not read %s: %s", ISO_639_XML_PATH, err->message);
- }
-
- languages = g_array_new (FALSE, TRUE, sizeof (IsoLang));
-
- parse_iso_639_xml (xml_data, xml_len);
-
- g_array_sort (languages, (GCompareFunc) languages_sort_func);
-
- dump_languages ();
-
- g_array_free (languages, TRUE);
-
- if (f != NULL)
- g_mapped_file_unref (f);
- else
- g_free (xml_data);
-
- return 0;
-}
diff --git a/gst-libs/gst/tag/tag.h b/gst-libs/gst/tag/tag.h
deleted file mode 100644
index 0a439c04..00000000
--- a/gst-libs/gst/tag/tag.h
+++ /dev/null
@@ -1,267 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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_TAG_TAG_H__
-#define __GST_TAG_TAG_H__
-
-#include <gst/gst.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_TRMID
- *
- * MusicBrainz track TRM ID
- */
-#define GST_TAG_MUSICBRAINZ_TRMID "musicbrainz-trmid"
-
-/* FIXME 0.11: remove GST_TAG_MUSICBRAINZ_SORTNAME */
-#ifndef GST_DISABLE_DEPRECATED
-/**
- * GST_TAG_MUSICBRAINZ_SORTNAME
- *
- * MusicBrainz artist sort name
- *
- * Deprecated. Use GST_TAG_ARTIST_SORTNAME instead.
- */
-#define GST_TAG_MUSICBRAINZ_SORTNAME GST_TAG_ARTIST_SORTNAME
-#endif
-
-/**
- * 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"
-
-/* 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"
-
-
-
-/* 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_buffer() that no
- * image type should be set. (Since: 0.10.20)
- * @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 field in
- * the image buffer's caps structure)
- *
- * Since: 0.10.9
- */
-/* 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;
-
-#define GST_TYPE_TAG_IMAGE_TYPE (gst_tag_image_type_get_type ())
-GType gst_tag_image_type_get_type (void);
-
-
-/* functions for vorbis comment manipulation */
-
-G_CONST_RETURN gchar * gst_tag_from_vorbis_tag (const gchar * vorbis_tag);
-G_CONST_RETURN gchar * gst_tag_to_vorbis_tag (const gchar * gst_tag);
-void gst_vorbis_tag_add (GstTagList * list,
- const gchar * tag,
- const gchar * value);
-
-GList * gst_tag_to_vorbis_comments (const GstTagList * list,
- const gchar * tag);
-
-/* functions to convert GstBuffers with vorbiscomment contents to GstTagLists and back */
-GstTagList * gst_tag_list_from_vorbiscomment_buffer (const GstBuffer * buffer,
- const guint8 * id_data,
- const guint id_data_length,
- gchar ** vendor_string);
-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 */
-
-guint gst_tag_id3_genre_count (void);
-G_CONST_RETURN gchar * gst_tag_id3_genre_get (const guint id);
-GstTagList * gst_tag_list_new_from_id3v1 (const guint8 * data);
-
-G_CONST_RETURN gchar * gst_tag_from_id3_tag (const gchar * id3_tag);
-G_CONST_RETURN gchar * gst_tag_from_id3_user_tag (const gchar * type,
- const gchar * id3_user_tag);
-G_CONST_RETURN gchar * gst_tag_to_id3_tag (const gchar * gst_tag);
-
-gboolean gst_tag_list_add_id3_image (GstTagList * tag_list,
- const guint8 * image_data,
- guint image_data_len,
- guint id3_picture_type);
-
-/* other tag-related functions */
-
-gboolean gst_tag_parse_extended_comment (const gchar * ext_comment,
- gchar ** key,
- gchar ** lang,
- gchar ** value,
- gboolean fail_if_no_key);
-
-gchar * gst_tag_freeform_string_to_utf8 (const gchar * data,
- gint size,
- const gchar ** env_vars);
-
-GstBuffer * gst_tag_image_data_to_image_buffer (const guint8 * image_data,
- guint image_data_len,
- GstTagImageType image_type);
-
-/* FIXME 0.11: replace with a more general gst_tag_library_init() */
-void gst_tag_register_musicbrainz_tags (void);
-
-
-/* language tag related functions */
-
-gchar ** gst_tag_get_language_codes (void);
-
-const gchar * gst_tag_get_language_name (const gchar * language_code);
-
-const gchar * gst_tag_get_language_code_iso_639_1 (const gchar * lang_code);
-
-const gchar * gst_tag_get_language_code_iso_639_2B (const gchar * lang_code);
-
-const gchar * gst_tag_get_language_code_iso_639_2T (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().
- *
- * Since: 0.10.26
- */
-#define gst_tag_get_language_code(lang_code) \
- gst_tag_get_language_code_iso_639_1(lang_code)
-
-G_END_DECLS
-
-#endif /* __GST_TAG_TAG_H__ */
diff --git a/gst-libs/gst/tag/tags.c b/gst-libs/gst/tag/tags.c
deleted file mode 100644
index 448c698c..00000000
--- a/gst-libs/gst/tag/tags.c
+++ /dev/null
@@ -1,510 +0,0 @@
-/* GStreamer non-core tag registration and tag utility functions
- * Copyright (C) 2005 Ross Burton <ross@burtonini.com>
- * Copyright (C) 2006-2008 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst-i18n-plugin.h>
-#include <gst/base/gsttypefindhelper.h>
-#include <gst/gst.h>
-#include "tag.h"
-
-#include <string.h>
-
-/**
- * SECTION:gsttag
- * @short_description: additional tag definitions for plugins and applications
- * @see_also: #GstTagList
- *
- * <refsect2>
- * <para>
- * Contains additional standardized GStreamer tag definitions for plugins
- * and applications, and functions to register them with the GStreamer
- * tag system.
- * </para>
- * </refsect2>
- */
-
-
-static gpointer
-gst_tag_register_tags_internal (gpointer unused)
-{
-#ifdef ENABLE_NLS
- GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
- LOCALEDIR);
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif
-
- /* musicbrainz tags */
- gst_tag_register (GST_TAG_MUSICBRAINZ_TRACKID, GST_TAG_FLAG_META,
- G_TYPE_STRING, _("track ID"), _("MusicBrainz track ID"), NULL);
- gst_tag_register (GST_TAG_MUSICBRAINZ_ARTISTID, GST_TAG_FLAG_META,
- G_TYPE_STRING, _("artist ID"), _("MusicBrainz artist ID"), NULL);
- gst_tag_register (GST_TAG_MUSICBRAINZ_ALBUMID, GST_TAG_FLAG_META,
- G_TYPE_STRING, _("album ID"), _("MusicBrainz album ID"), NULL);
- gst_tag_register (GST_TAG_MUSICBRAINZ_ALBUMARTISTID, GST_TAG_FLAG_META,
- G_TYPE_STRING,
- _("album artist ID"), _("MusicBrainz album artist ID"), NULL);
- gst_tag_register (GST_TAG_MUSICBRAINZ_TRMID, GST_TAG_FLAG_META,
- G_TYPE_STRING, _("track TRM ID"), _("MusicBrainz TRM ID"), NULL);
-
- /* CDDA tags */
- gst_tag_register (GST_TAG_CDDA_CDDB_DISCID, GST_TAG_FLAG_META,
- G_TYPE_STRING, "discid", "CDDB discid for metadata retrieval",
- gst_tag_merge_use_first);
-
- gst_tag_register (GST_TAG_CDDA_CDDB_DISCID_FULL, GST_TAG_FLAG_META,
- G_TYPE_STRING, "discid full",
- "CDDB discid for metadata retrieval (full)", gst_tag_merge_use_first);
-
- gst_tag_register (GST_TAG_CDDA_MUSICBRAINZ_DISCID, GST_TAG_FLAG_META,
- G_TYPE_STRING, "musicbrainz-discid",
- "Musicbrainz discid for metadata retrieval", gst_tag_merge_use_first);
-
- gst_tag_register (GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL, GST_TAG_FLAG_META,
- G_TYPE_STRING, "musicbrainz-discid-full",
- "Musicbrainz discid for metadata retrieval (full)",
- gst_tag_merge_use_first);
-
- return NULL;
-}
-
-/* FIXME 0.11: rename this to gst_tag_init() or gst_tag_register_tags() */
-/**
- * gst_tag_register_musicbrainz_tags
- *
- * Registers additional musicbrainz-specific tags with the GStreamer tag
- * system. Plugins and applications that use these tags should call this
- * function before using them. Can be called multiple times.
- */
-void
-gst_tag_register_musicbrainz_tags (void)
-{
- static GOnce mb_once = G_ONCE_INIT;
-
- g_once (&mb_once, gst_tag_register_tags_internal, NULL);
-}
-
-static void
-register_tag_image_type_enum (GType * id)
-{
- static const GEnumValue image_types[] = {
- {GST_TAG_IMAGE_TYPE_NONE, "GST_TAG_IMAGE_TYPE_NONE", "none"},
- {GST_TAG_IMAGE_TYPE_UNDEFINED, "GST_TAG_IMAGE_TYPE_UNDEFINED", "undefined"},
- {GST_TAG_IMAGE_TYPE_FRONT_COVER, "GST_TAG_IMAGE_TYPE_FRONT_COVER",
- "front-cover"},
- {GST_TAG_IMAGE_TYPE_BACK_COVER, "GST_TAG_IMAGE_TYPE_BACK_COVER",
- "back-cover"},
- {GST_TAG_IMAGE_TYPE_LEAFLET_PAGE, "GST_TAG_IMAGE_TYPE_LEAFLET_PAGE",
- "leaflet-page"},
- {GST_TAG_IMAGE_TYPE_MEDIUM, "GST_TAG_IMAGE_TYPE_MEDIUM", "medium"},
- {GST_TAG_IMAGE_TYPE_LEAD_ARTIST, "GST_TAG_IMAGE_TYPE_LEAD_ARTIST",
- "lead-artist"},
- {GST_TAG_IMAGE_TYPE_ARTIST, "GST_TAG_IMAGE_TYPE_ARTIST", "artist"},
- {GST_TAG_IMAGE_TYPE_CONDUCTOR, "GST_TAG_IMAGE_TYPE_CONDUCTOR", "conductor"},
- {GST_TAG_IMAGE_TYPE_BAND_ORCHESTRA, "GST_TAG_IMAGE_TYPE_BAND_ORCHESTRA",
- "band-orchestra"},
- {GST_TAG_IMAGE_TYPE_COMPOSER, "GST_TAG_IMAGE_TYPE_COMPOSER", "composer"},
- {GST_TAG_IMAGE_TYPE_LYRICIST, "GST_TAG_IMAGE_TYPE_LYRICIST", "lyricist"},
- {GST_TAG_IMAGE_TYPE_RECORDING_LOCATION,
- "GST_TAG_IMAGE_TYPE_RECORDING_LOCATION",
- "recording-location"},
- {GST_TAG_IMAGE_TYPE_DURING_RECORDING, "GST_TAG_IMAGE_TYPE_DURING_RECORDING",
- "during-recording"},
- {GST_TAG_IMAGE_TYPE_DURING_PERFORMANCE,
- "GST_TAG_IMAGE_TYPE_DURING_PERFORMANCE",
- "during-performance"},
- {GST_TAG_IMAGE_TYPE_VIDEO_CAPTURE, "GST_TAG_IMAGE_TYPE_VIDEO_CAPTURE",
- "video-capture"},
- {GST_TAG_IMAGE_TYPE_FISH, "GST_TAG_IMAGE_TYPE_FISH", "fish"},
- {GST_TAG_IMAGE_TYPE_ILLUSTRATION, "GST_TAG_IMAGE_TYPE_ILLUSTRATION",
- "illustration"},
- {GST_TAG_IMAGE_TYPE_BAND_ARTIST_LOGO, "GST_TAG_IMAGE_TYPE_BAND_ARTIST_LOGO",
- "artist-logo"},
- {GST_TAG_IMAGE_TYPE_PUBLISHER_STUDIO_LOGO,
- "GST_TAG_IMAGE_TYPE_PUBLISHER_STUDIO_LOGO",
- "publisher-studio-logo"},
- {0, NULL, NULL}
- };
-
- *id = g_enum_register_static ("GstTagImageType", image_types);
-
- /* work around thread-safety issue with class creation in GLib */
- g_type_class_ref (*id);
-}
-
-GType
-gst_tag_image_type_get_type (void)
-{
- static GType id;
-
- static GOnce once = G_ONCE_INIT;
-
- g_once (&once, (GThreadFunc) register_tag_image_type_enum, &id);
- return id;
-}
-
-static inline gboolean
-gst_tag_image_type_is_valid (GstTagImageType type)
-{
- GEnumClass *klass;
-
- gboolean res;
-
- klass = g_type_class_ref (gst_tag_image_type_get_type ());
- res = (g_enum_get_value (klass, type) != NULL);
- g_type_class_unref (klass);
-
- return res;
-}
-
-/**
- * gst_tag_parse_extended_comment:
- * @ext_comment: an extended comment string, see #GST_TAG_EXTENDED_COMMENT
- * @key: return location for the comment description key, or NULL
- * @lang: return location for the comment ISO-639 language code, or NULL
- * @value: return location for the actual comment string, or NULL
- * @fail_if_no_key: whether to fail if strings are not in key=value form
- *
- * Convenience function to parse a GST_TAG_EXTENDED_COMMENT string and
- * separate it into its components.
- *
- * If successful, @key, @lang and/or @value will be set to newly allocated
- * strings that you need to free with g_free() when done. @key and @lang
- * may also be set to NULL by this function if there is no key or no language
- * code in the extended comment string.
- *
- * Returns: TRUE if the string could be parsed, otherwise FALSE
- *
- * Since: 0.10.10
- */
-gboolean
-gst_tag_parse_extended_comment (const gchar * ext_comment, gchar ** key,
- gchar ** lang, gchar ** value, gboolean fail_if_no_key)
-{
- const gchar *div, *bop, *bcl;
-
- g_return_val_if_fail (ext_comment != NULL, FALSE);
- g_return_val_if_fail (g_utf8_validate (ext_comment, -1, NULL), FALSE);
-
- if (key)
- *key = NULL;
- if (lang)
- *lang = NULL;
-
- div = strchr (ext_comment, '=');
- bop = strchr (ext_comment, '[');
- bcl = strchr (ext_comment, ']');
-
- if (div == NULL) {
- if (fail_if_no_key)
- return FALSE;
- if (value)
- *value = g_strdup (ext_comment);
- return TRUE;
- }
-
- if (bop != NULL && bop < div) {
- if (bcl < bop || bcl > div)
- return FALSE;
- if (key)
- *key = g_strndup (ext_comment, bop - ext_comment);
- if (lang)
- *lang = g_strndup (bop + 1, bcl - bop - 1);
- } else {
- if (key)
- *key = g_strndup (ext_comment, div - ext_comment);
- }
-
- if (value)
- *value = g_strdup (div + 1);
-
- return TRUE;
-}
-
-/**
- * gst_tag_freeform_string_to_utf8:
- * @data: string data
- * @size: length of string data, or -1 if the string is NUL-terminated
- * @env_vars: a NULL-terminated string array of environment variable names,
- * or NULL
- *
- * Convenience function to read a string with unknown character encoding. If
- * the string is already in UTF-8 encoding, it will be returned right away.
- * If not it tries to detect byte-order-mark for UTF-16/32 cases and use that.
- * Otherwise, the environment will be searched for a number of environment
- * variables (whose names are specified in the NULL-terminated string array
- * @env_vars) containing a list of character encodings to try/use. If none
- * are specified, the current locale will be tried. If that also doesn't work,
- * ISO-8859-1 is assumed (which will almost always succeed).
- *
- * Returns: a newly-allocated string in UTF-8 encoding, or NULL
- *
- * Since: 0.10.13
- */
-gchar *
-gst_tag_freeform_string_to_utf8 (const gchar * data, gint size,
- const gchar ** env_vars)
-{
- const gchar *cur_loc = NULL;
-
- gsize bytes_read;
-
- gchar *utf8 = NULL;
-
- g_return_val_if_fail (data != NULL, NULL);
-
- if (size < 0)
- size = strlen (data);
-
- /* chop off trailing string terminators to make sure utf8_validate doesn't
- * get to see them (since that would make the utf8 check fail) */
- while (size > 0 && data[size - 1] == '\0')
- --size;
-
- /* Should we try the charsets specified
- * via environment variables FIRST ? */
- if (g_utf8_validate (data, size, NULL)) {
- utf8 = g_strndup (data, size);
- GST_LOG ("String '%s' is valid UTF-8 already", utf8);
- goto beach;
- }
-
- /* check for and use byte-order-mark for UTF-16/32 cases */
- if (size >= 2) {
- gchar *c = NULL;
- gint prefix, ssize;
-
- if (size >= 4) {
- prefix = 4;
- ssize = GST_ROUND_DOWN_4 (size - 4);
- switch (GST_READ_UINT32_BE (data)) {
- case 0x0000FEFF:
- c = "UTF-32BE";
- break;
- case 0xFFFE0000:
- c = "UTF-32LE";
- break;
- default:
- break;
- }
- }
- if (!c) {
- prefix = 2;
- ssize = GST_ROUND_DOWN_2 (size - 2);
- switch (GST_READ_UINT16_BE (data)) {
- case 0xFEFF:
- c = "UTF-16BE";
- break;
- case 0xFFFE:
- c = "UTF-16LE";
- break;
- default:
- break;
- }
- }
- if (c) {
- GST_LOG ("Trying to convert freeform string to UTF-8 from '%s'", c);
- if ((utf8 =
- g_convert (data + prefix, ssize, "UTF-8", c, &bytes_read, NULL,
- NULL))) {
- if (bytes_read == ssize)
- goto beach;
- g_free (utf8);
- utf8 = NULL;
- }
- }
- }
-
- while (env_vars && *env_vars != NULL) {
- const gchar *env = NULL;
-
- /* Try charsets specified via the environment */
- env = g_getenv (*env_vars);
- if (env != NULL && *env != '\0') {
- gchar **c, **csets;
-
- csets = g_strsplit (env, G_SEARCHPATH_SEPARATOR_S, -1);
-
- for (c = csets; c && *c; ++c) {
- GST_LOG ("Trying to convert freeform string to UTF-8 from '%s'", *c);
- if ((utf8 =
- g_convert (data, size, "UTF-8", *c, &bytes_read, NULL, NULL))) {
- if (bytes_read == size) {
- g_strfreev (csets);
- goto beach;
- }
- g_free (utf8);
- utf8 = NULL;
- }
- }
-
- g_strfreev (csets);
- }
- ++env_vars;
- }
-
- /* Try current locale (if not UTF-8) */
- if (!g_get_charset (&cur_loc)) {
- GST_LOG ("Trying to convert freeform string using locale ('%s')", cur_loc);
- if ((utf8 = g_locale_to_utf8 (data, size, &bytes_read, NULL, NULL))) {
- if (bytes_read == size) {
- goto beach;
- }
- g_free (utf8);
- utf8 = NULL;
- }
- }
-
- /* Try ISO-8859-1 */
- GST_LOG ("Trying to convert freeform string using ISO-8859-1 fallback");
- utf8 = g_convert (data, size, "UTF-8", "ISO-8859-1", &bytes_read, NULL, NULL);
- if (utf8 != NULL && bytes_read == size) {
- goto beach;
- }
-
- g_free (utf8);
- return NULL;
-
-beach:
-
- g_strchomp (utf8);
- if (utf8 && utf8[0] != '\0') {
- GST_LOG ("Returning '%s'", utf8);
- return utf8;
- }
-
- g_free (utf8);
- return NULL;
-}
-
-/**
- * gst_tag_image_data_to_image_buffer:
- * @image_data: the (encoded) image
- * @image_data_len: the length of the encoded image data at @image_data
- * @image_type: type of the image, or #GST_TAG_IMAGE_TYPE_UNDEFINED. Pass
- * #GST_TAG_IMAGE_TYPE_NONE if no image type should be set at all (e.g.
- * for preview images)
- *
- * Helper function for tag-reading plugins to create a #GstBuffer suitable to
- * add to a #GstTagList as an image tag (such as #GST_TAG_IMAGE or
- * #GST_TAG_PREVIEW_IMAGE) from the encoded image data and an (optional) image
- * type.
- *
- * Background: cover art and other images in tags are usually stored as a
- * blob of binary image data, often accompanied by a MIME type or some other
- * content type string (e.g. 'png', 'jpeg', 'jpg'). Sometimes there is also an
- * 'image type' to indicate what kind of image this is (e.g. front cover,
- * back cover, artist, etc.). The image data may also be an URI to the image
- * rather than the image itself.
- *
- * In GStreamer, image tags are #GstBuffer<!-- -->s containing the raw image
- * data, with the buffer caps describing the content type of the image
- * (e.g. image/jpeg, image/png, text/uri-list). The buffer caps may contain
- * an additional 'image-type' field of #GST_TYPE_TAG_IMAGE_TYPE to describe
- * the type of image (front cover, back cover etc.). #GST_TAG_PREVIEW_IMAGE
- * tags should not carry an image type, their type is already indicated via
- * the special tag name.
- *
- * This function will do various checks and typefind the encoded image
- * data (we can't trust the declared mime type).
- *
- * Returns: a newly-allocated image buffer for use in tag lists, or NULL
- *
- * Since: 0.10.20
- */
-GstBuffer *
-gst_tag_image_data_to_image_buffer (const guint8 * image_data,
- guint image_data_len, GstTagImageType image_type)
-{
- const gchar *name;
-
- GstBuffer *image;
-
- GstCaps *caps;
-
- g_return_val_if_fail (image_data != NULL, NULL);
- g_return_val_if_fail (image_data_len > 0, NULL);
- g_return_val_if_fail (gst_tag_image_type_is_valid (image_type), NULL);
-
- GST_DEBUG ("image data len: %u bytes", image_data_len);
-
- /* allocate space for a NUL terminator for an uri too */
- image = gst_buffer_try_new_and_alloc (image_data_len + 1);
- if (image == NULL) {
- GST_WARNING ("failed to allocate buffer of %d for image", image_data_len);
- return NULL;
- }
-
- memcpy (GST_BUFFER_DATA (image), image_data, image_data_len);
- GST_BUFFER_DATA (image)[image_data_len] = '\0';
-
- /* Find GStreamer media type, can't trust declared type */
- caps = gst_type_find_helper_for_buffer (NULL, image, NULL);
-
- if (caps == NULL)
- goto no_type;
-
- GST_DEBUG ("Found GStreamer media type: %" GST_PTR_FORMAT, caps);
-
- /* sanity check: make sure typefound/declared caps are either URI or image */
- name = gst_structure_get_name (gst_caps_get_structure (caps, 0));
-
- if (!g_str_has_prefix (name, "image/") &&
- !g_str_has_prefix (name, "video/") &&
- !g_str_equal (name, "text/uri-list")) {
- GST_DEBUG ("Unexpected image type '%s', ignoring image frame", name);
- goto error;
- }
-
- /* Decrease size by 1 if we don't have an URI list
- * to keep the original size of the image
- */
- if (!g_str_equal (name, "text/uri-list"))
- GST_BUFFER_SIZE (image) = image_data_len;
-
- if (image_type != GST_TAG_IMAGE_TYPE_NONE) {
- GST_LOG ("Setting image type: %d", image_type);
- caps = gst_caps_make_writable (caps);
- gst_caps_set_simple (caps, "image-type", GST_TYPE_TAG_IMAGE_TYPE,
- image_type, NULL);
- }
-
- gst_buffer_set_caps (image, caps);
- gst_caps_unref (caps);
- return image;
-
-/* ERRORS */
-no_type:
- {
- GST_DEBUG ("Could not determine GStreamer media type, ignoring image");
- /* fall through */
- }
-error:
- {
- if (image)
- gst_buffer_unref (image);
- if (caps)
- gst_caps_unref (caps);
- return NULL;
- }
-}
diff --git a/gst-libs/gst/video/.gitignore b/gst-libs/gst/video/.gitignore
deleted file mode 100644
index 42df1ec5..00000000
--- a/gst-libs/gst/video/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-video-enumtypes.c
-video-enumtypes.h
diff --git a/gst-libs/gst/video/Makefile.am b/gst-libs/gst/video/Makefile.am
deleted file mode 100644
index 81c3d90b..00000000
--- a/gst-libs/gst/video/Makefile.am
+++ /dev/null
@@ -1,73 +0,0 @@
-# variables used for enum/marshal generation
-glib_enum_headers = video.h
-glib_enum_define = GST_VIDEO
-glib_gen_prefix = gst_video
-glib_gen_basename = video
-
-built_sources = video-enumtypes.c
-built_headers = video-enumtypes.h
-BUILT_SOURCES = $(built_sources) $(built_headers)
-
-lib_LTLIBRARIES = libgstvideo-@GST_MAJORMINOR@.la
-
-CLEANFILES = $(BUILT_SOURCES)
-
-libgstvideo_@GST_MAJORMINOR@_la_SOURCES = \
- video.c gstvideosink.c gstvideofilter.c
-nodist_libgstvideo_@GST_MAJORMINOR@_la_SOURCES = $(BUILT_SOURCES)
-
-libgstvideo_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/video
-libgstvideo_@GST_MAJORMINOR@include_HEADERS = \
- video.h gstvideosink.h gstvideofilter.h
-nodist_libgstvideo_@GST_MAJORMINOR@include_HEADERS = $(built_headers)
-
-libgstvideo_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-libgstvideo_@GST_MAJORMINOR@_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS)
-libgstvideo_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
-
-include $(top_srcdir)/common/gst-glib-gen.mak
-
-if HAVE_INTROSPECTION
-BUILT_GIRSOURCES = GstVideo-@GST_MAJORMINOR@.gir
-
-gir_headers=$(patsubst %,$(srcdir)/%, $(libgstvideo_@GST_MAJORMINOR@include_HEADERS))
-gir_headers+=$(patsubst %,$(builddir)/%, $(nodist_libgstvideo_@GST_MAJORMINOR@include_HEADERS))
-gir_sources=$(patsubst %,$(srcdir)/%, $(libgstvideo_@GST_MAJORMINOR@_la_SOURCES))
-gir_sources+=$(patsubst %,$(builddir)/%, $(nodist_libgstvideo_@GST_MAJORMINOR@_la_SOURCES))
-gir_cincludes=$(patsubst %,--c-include='gst/video/%',$(libgstvideo_@GST_MAJORMINOR@include_HEADERS))
-gir_cincludes+=$(patsubst %,--c-include='gst/video/%',$(nodist_libgstvideo_@GST_MAJORMINOR@include_HEADERS))
-
-GstVideo-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstvideo-@GST_MAJORMINOR@.la
- PKG_CONFIG_PATH="$(PKG_CONFIG_PATH):$(top_builddir)/pkgconfig" \
- $(INTROSPECTION_SCANNER) -v --namespace GstVideo \
- --nsversion=@GST_MAJORMINOR@ \
- --strip-prefix=Gst \
- $(gir_cincludes) \
- -I$(top_srcdir)/gst-libs \
- -I$(top_builddir)/gst-libs \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst \
- --add-include-path=`$(PKG_CONFIG) --variable=libdir gstreamer-base-0.10` \
- --library=gstvideo-0.10 \
- --include=Gst-0.10 \
- --include=GstBase-0.10 \
- --libtool="$(top_builddir)/libtool" \
- --pkg gstreamer-0.10 \
- --pkg gstreamer-base-0.10 \
- --output $@ \
- $(gir_headers) \
- $(gir_sources)
-
-# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
-# install anything - we need to install inside our prefix.
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(BUILT_GIRSOURCES)
-
-typelibsdir = $(libdir)/girepository-1.0/
-
-typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
-
-%.typelib: %.gir $(INTROSPECTION_COMPILER)
- $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=$(builddir) --includedir=`$(PKG_CONFIG) --variable=libdir gstreamer-0.10`/gst --includedir=`$(PKG_CONFIG) --variable=libdir gstreamer-base-0.10` $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
-
-CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
-endif
diff --git a/gst-libs/gst/video/gstvideofilter.c b/gst-libs/gst/video/gstvideofilter.c
deleted file mode 100644
index 2d08a600..00000000
--- a/gst-libs/gst/video/gstvideofilter.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) <2003> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
- /**
- * SECTION:gstvideofilter
- * @short_description: Base class for video filters
- *
- * <refsect2>
- * <para>
- * Provides useful functions and a base class for video filters.
- * </para>
- * <para>
- * The videofilter will by default enable QoS on the parent GstBaseTransform
- * to implement frame dropping.
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstvideofilter.h"
-
-#include <gst/video/video.h>
-
-GST_DEBUG_CATEGORY_STATIC (gst_video_filter_debug);
-#define GST_CAT_DEFAULT gst_video_filter_debug
-
-static void gst_video_filter_class_init (gpointer g_class, gpointer class_data);
-static void gst_video_filter_init (GTypeInstance * instance, gpointer g_class);
-
-static GstBaseTransformClass *parent_class = NULL;
-
-GType
-gst_video_filter_get_type (void)
-{
- static GType video_filter_type = 0;
-
- if (!video_filter_type) {
- static const GTypeInfo video_filter_info = {
- sizeof (GstVideoFilterClass),
- NULL,
- NULL,
- gst_video_filter_class_init,
- NULL,
- NULL,
- sizeof (GstVideoFilter),
- 0,
- gst_video_filter_init,
- };
-
- video_filter_type = g_type_register_static (GST_TYPE_BASE_TRANSFORM,
- "GstVideoFilter", &video_filter_info, G_TYPE_FLAG_ABSTRACT);
- }
- return video_filter_type;
-}
-
-static gboolean
-gst_video_filter_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
- guint * size)
-{
- GstVideoFormat fmt;
- gint width, height;
-
- if (!gst_video_format_parse_caps (caps, &fmt, &width, &height)) {
- GST_WARNING_OBJECT (btrans, "Failed to parse caps %" GST_PTR_FORMAT, caps);
- return FALSE;
- }
-
- *size = gst_video_format_get_size (fmt, width, height);
-
- GST_DEBUG_OBJECT (btrans, "Returning size %u bytes for caps %"
- GST_PTR_FORMAT, *size, caps);
-
- return TRUE;
-}
-
-static void
-gst_video_filter_class_init (gpointer g_class, gpointer class_data)
-{
- GstBaseTransformClass *trans_class;
- GstVideoFilterClass *klass;
-
- klass = (GstVideoFilterClass *) g_class;
- trans_class = (GstBaseTransformClass *) klass;
-
- trans_class->get_unit_size =
- GST_DEBUG_FUNCPTR (gst_video_filter_get_unit_size);
-
- parent_class = g_type_class_peek_parent (klass);
-
- GST_DEBUG_CATEGORY_INIT (gst_video_filter_debug, "videofilter", 0,
- "videofilter");
-}
-
-static void
-gst_video_filter_init (GTypeInstance * instance, gpointer g_class)
-{
- GstVideoFilter *videofilter = GST_VIDEO_FILTER (instance);
-
- GST_DEBUG_OBJECT (videofilter, "gst_video_filter_init");
-
- videofilter->inited = FALSE;
- /* enable QoS */
- gst_base_transform_set_qos_enabled (GST_BASE_TRANSFORM (videofilter), TRUE);
-}
diff --git a/gst-libs/gst/video/gstvideofilter.h b/gst-libs/gst/video/gstvideofilter.h
deleted file mode 100644
index 1c02061c..00000000
--- a/gst-libs/gst/video/gstvideofilter.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_VIDEO_FILTER_H__
-#define __GST_VIDEO_FILTER_H__
-
-#include <gst/base/gstbasetransform.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))
-
-struct _GstVideoFilter {
- GstBaseTransform element;
-
- gboolean inited;
-};
-
-struct _GstVideoFilterClass {
- GstBaseTransformClass parent_class;
-};
-
-GType gst_video_filter_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_VIDEO_FILTER_H__ */
diff --git a/gst-libs/gst/video/gstvideosink.c b/gst-libs/gst/video/gstvideosink.c
deleted file mode 100644
index 2e578d3f..00000000
--- a/gst-libs/gst/video/gstvideosink.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:gstvideosink
- * @short_description: Base class for video sinks
- *
- * <refsect2>
- * <para>
- * Provides useful functions and a base class for video sinks.
- * </para>
- * <para>
- * GstVideoSink will configure the default base sink to drop frames that
- * arrive later than 20ms as this is considered the default threshold for
- * observing out-of-sync frames.
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstvideosink.h"
-
-enum
-{
- PROP_SHOW_PREROLL_FRAME = 1
-};
-
-#define DEFAULT_SHOW_PREROLL_FRAME TRUE
-
-struct _GstVideoSinkPrivate
-{
- gboolean show_preroll_frame; /* ATOMIC */
-};
-
-GST_DEBUG_CATEGORY_STATIC (video_sink_debug);
-#define GST_CAT_DEFAULT video_sink_debug
-
-static GstBaseSinkClass *parent_class = NULL;
-
-static void gst_video_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_video_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static GstFlowReturn gst_video_sink_show_preroll_frame (GstBaseSink * bsink,
- GstBuffer * buf);
-static GstFlowReturn gst_video_sink_show_frame (GstBaseSink * bsink,
- GstBuffer * buf);
-
-/**
- * gst_video_sink_center_rect:
- * @src: the #GstVideoRectangle describing the source area
- * @dst: the #GstVideoRectangle describing the destination area
- * @result: a pointer to a #GstVideoRectangle which will receive the result area
- * @scaling: a #gboolean indicating if scaling should be applied or not
- *
- * Takes @src rectangle and position it at the center of @dst rectangle with or
- * without @scaling. It handles clipping if the @src rectangle is bigger than
- * the @dst one and @scaling is set to FALSE.
- */
-void
-gst_video_sink_center_rect (GstVideoRectangle src, GstVideoRectangle dst,
- GstVideoRectangle * result, gboolean scaling)
-{
- g_return_if_fail (result != NULL);
-
- if (!scaling) {
- result->w = MIN (src.w, dst.w);
- result->h = MIN (src.h, dst.h);
- result->x = (dst.w - result->w) / 2;
- result->y = (dst.h - result->h) / 2;
- } else {
- gdouble src_ratio, dst_ratio;
-
- src_ratio = (gdouble) src.w / src.h;
- dst_ratio = (gdouble) dst.w / dst.h;
-
- if (src_ratio > dst_ratio) {
- result->w = dst.w;
- result->h = dst.w / src_ratio;
- result->x = 0;
- result->y = (dst.h - result->h) / 2;
- } else if (src_ratio < dst_ratio) {
- result->w = dst.h * src_ratio;
- result->h = dst.h;
- result->x = (dst.w - result->w) / 2;
- result->y = 0;
- } else {
- result->x = 0;
- result->y = 0;
- result->w = dst.w;
- result->h = dst.h;
- }
- }
-
- GST_DEBUG ("source is %dx%d dest is %dx%d, result is %dx%d with x,y %dx%d",
- src.w, src.h, dst.w, dst.h, result->w, result->h, result->x, result->y);
-}
-
-/* Initing stuff */
-
-static void
-gst_video_sink_init (GstVideoSink * videosink)
-{
- videosink->width = 0;
- videosink->height = 0;
-
- /* 20ms is more than enough, 80-130ms is noticable */
- gst_base_sink_set_max_lateness (GST_BASE_SINK (videosink), 20 * GST_MSECOND);
- gst_base_sink_set_qos_enabled (GST_BASE_SINK (videosink), TRUE);
-
- videosink->priv = G_TYPE_INSTANCE_GET_PRIVATE (videosink,
- GST_TYPE_VIDEO_SINK, GstVideoSinkPrivate);
-}
-
-static void
-gst_video_sink_class_init (GstVideoSinkClass * klass)
-{
- GstBaseSinkClass *basesink_class = (GstBaseSinkClass *) klass;
- GObjectClass *gobject_class = (GObjectClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->set_property = gst_video_sink_set_property;
- gobject_class->get_property = gst_video_sink_get_property;
-
- /**
- * GstVideoSink:show-preroll-frame
- *
- * Whether to show video frames during preroll. If set to #FALSE, video
- * frames will only be rendered in PLAYING state.
- *
- * Since: 0.10.25
- */
- g_object_class_install_property (gobject_class, PROP_SHOW_PREROLL_FRAME,
- g_param_spec_boolean ("show-preroll-frame", "Show preroll frame",
- "Whether to render video frames during preroll",
- DEFAULT_SHOW_PREROLL_FRAME,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
-
- basesink_class->render = GST_DEBUG_FUNCPTR (gst_video_sink_show_frame);
- basesink_class->preroll =
- GST_DEBUG_FUNCPTR (gst_video_sink_show_preroll_frame);
-
- g_type_class_add_private (klass, sizeof (GstVideoSinkPrivate));
-}
-
-static void
-gst_video_sink_base_init (gpointer g_class)
-{
- GST_DEBUG_CATEGORY_INIT (video_sink_debug, "videosink", 0, "GstVideoSink");
-}
-
-static GstFlowReturn
-gst_video_sink_show_preroll_frame (GstBaseSink * bsink, GstBuffer * buf)
-{
- GstVideoSinkClass *klass;
- GstVideoSink *vsink;
- gboolean do_show;
-
- vsink = GST_VIDEO_SINK_CAST (bsink);
- klass = GST_VIDEO_SINK_GET_CLASS (vsink);
-
- do_show = g_atomic_int_get (&vsink->priv->show_preroll_frame);
-
- if (G_UNLIKELY (!do_show)) {
- GST_DEBUG_OBJECT (bsink, "not rendering frame with ts=%" GST_TIME_FORMAT
- ", preroll rendering disabled",
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
- }
-
- if (klass->show_frame == NULL || !do_show) {
- if (parent_class->preroll != NULL)
- return parent_class->preroll (bsink, buf);
- else
- return GST_FLOW_OK;
- }
-
- GST_LOG_OBJECT (bsink, "rendering frame, ts=%" GST_TIME_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
-
- return klass->show_frame (GST_VIDEO_SINK_CAST (bsink), buf);
-}
-
-static GstFlowReturn
-gst_video_sink_show_frame (GstBaseSink * bsink, GstBuffer * buf)
-{
- GstVideoSinkClass *klass;
-
- klass = GST_VIDEO_SINK_GET_CLASS (bsink);
-
- if (klass->show_frame == NULL) {
- if (parent_class->render != NULL)
- return parent_class->render (bsink, buf);
- else
- return GST_FLOW_OK;
- }
-
- GST_LOG_OBJECT (bsink, "rendering frame, ts=%" GST_TIME_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
-
- return klass->show_frame (GST_VIDEO_SINK_CAST (bsink), buf);
-}
-
-static void
-gst_video_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstVideoSink *vsink;
-
- vsink = GST_VIDEO_SINK (object);
-
- switch (prop_id) {
- case PROP_SHOW_PREROLL_FRAME:
- g_atomic_int_set (&vsink->priv->show_preroll_frame,
- g_value_get_boolean (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_video_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstVideoSink *vsink;
-
- vsink = GST_VIDEO_SINK (object);
-
- switch (prop_id) {
- case PROP_SHOW_PREROLL_FRAME:
- g_value_set_boolean (value,
- g_atomic_int_get (&vsink->priv->show_preroll_frame));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/* Public methods */
-
-GType
-gst_video_sink_get_type (void)
-{
- static GType videosink_type = 0;
-
- if (!videosink_type) {
- static const GTypeInfo videosink_info = {
- sizeof (GstVideoSinkClass),
- gst_video_sink_base_init,
- NULL,
- (GClassInitFunc) gst_video_sink_class_init,
- NULL,
- NULL,
- sizeof (GstVideoSink),
- 0,
- (GInstanceInitFunc) gst_video_sink_init,
- };
-
- videosink_type = g_type_register_static (GST_TYPE_BASE_SINK,
- "GstVideoSink", &videosink_info, 0);
- }
-
- return videosink_type;
-}
diff --git a/gst-libs/gst/video/gstvideosink.h b/gst-libs/gst/video/gstvideosink.h
deleted file mode 100644
index d03a2853..00000000
--- a/gst-libs/gst/video/gstvideosink.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, 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>
-
-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.
- *
- * Since: 0.10.12
- */
-#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:
- * @element: the parent object structure (which is GstBaseSink)
- * @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' */
-
- gint width, height;
-
- /*< private >*/
- GstVideoSinkPrivate *priv;
-
- gpointer _gst_reserved[GST_PADDING - 1];
-};
-
-/**
- * GstVideoSinkClass:
- * @parent_class: the parent class structure
- * @show_frame: render a video frame. Maps to #GstBaseSink::render and
- * #GstBaseSink::preroll vfuncs. Rendering during preroll will be
- * suppressed if the 'show-preroll-frame' property is set to #FALSE.
- * Since: 0.10.25
- *
- * 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);
-
- /*< private >*/
- gpointer _gst_reserved[GST_PADDING - 1];
-};
-
-GType gst_video_sink_get_type (void);
-
-void gst_video_sink_center_rect (GstVideoRectangle src, GstVideoRectangle dst,
- GstVideoRectangle *result, gboolean scaling);
-
-G_END_DECLS
-
-#endif /* __GST_VIDEO_SINK_H__ */
diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c
deleted file mode 100644
index 84e32a11..00000000
--- a/gst-libs/gst/video/video.c
+++ /dev/null
@@ -1,1570 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Library <2002> Ronald Bultje <rbultje@ronald.bitfreak.net>
- * Copyright (C) 2007 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "video.h"
-
-/**
- * SECTION:gstvideo
- * @short_description: Support library for video operations
- *
- * <refsect2>
- * <para>
- * This library contains some helper functions and includes the
- * videosink and videofilter base classes.
- * </para>
- * </refsect2>
- */
-
-static GstVideoFormat gst_video_format_from_rgb32_masks (int red_mask,
- int green_mask, int blue_mask);
-static GstVideoFormat gst_video_format_from_rgba32_masks (int red_mask,
- int green_mask, int blue_mask, int alpha_mask);
-static GstVideoFormat gst_video_format_from_rgb24_masks (int red_mask,
- int green_mask, int blue_mask);
-
-
-/**
- * gst_video_frame_rate:
- * @pad: pointer to a #GstPad
- *
- * A convenience function to retrieve a GValue holding the framerate
- * from the caps on a pad.
- *
- * The pad needs to have negotiated caps containing a framerate property.
- *
- * Returns: NULL if the pad has no configured caps or the configured caps
- * do not contain a framerate.
- *
- */
-const GValue *
-gst_video_frame_rate (GstPad * pad)
-{
- const GValue *fps;
- gchar *fps_string;
-
- const GstCaps *caps = NULL;
- GstStructure *structure;
-
- /* get pad caps */
- caps = GST_PAD_CAPS (pad);
- if (caps == NULL) {
- g_warning ("gstvideo: failed to get caps of pad %s:%s",
- GST_DEBUG_PAD_NAME (pad));
- return NULL;
- }
-
- structure = gst_caps_get_structure (caps, 0);
- if ((fps = gst_structure_get_value (structure, "framerate")) == NULL) {
- g_warning ("gstvideo: failed to get framerate property of pad %s:%s",
- GST_DEBUG_PAD_NAME (pad));
- return NULL;
- }
- if (!GST_VALUE_HOLDS_FRACTION (fps)) {
- g_warning
- ("gstvideo: framerate property of pad %s:%s is not of type Fraction",
- GST_DEBUG_PAD_NAME (pad));
- return NULL;
- }
-
- fps_string = gst_value_serialize (fps);
- GST_DEBUG ("Framerate request on pad %s:%s: %s",
- GST_DEBUG_PAD_NAME (pad), fps_string);
- g_free (fps_string);
-
- return fps;
-}
-
-/**
- * gst_video_get_size:
- * @pad: pointer to a #GstPad
- * @width: pointer to integer to hold pixel width of the video frames (output)
- * @height: pointer to integer to hold pixel height of the video frames (output)
- *
- * Inspect the caps of the provided pad and retrieve the width and height of
- * the video frames it is configured for.
- *
- * The pad needs to have negotiated caps containing width and height properties.
- *
- * Returns: TRUE if the width and height could be retrieved.
- *
- */
-gboolean
-gst_video_get_size (GstPad * pad, gint * width, gint * height)
-{
- const GstCaps *caps = NULL;
- GstStructure *structure;
- gboolean ret;
-
- g_return_val_if_fail (pad != NULL, FALSE);
- g_return_val_if_fail (width != NULL, FALSE);
- g_return_val_if_fail (height != NULL, FALSE);
-
- caps = GST_PAD_CAPS (pad);
-
- if (caps == NULL) {
- g_warning ("gstvideo: failed to get caps of pad %s:%s",
- GST_DEBUG_PAD_NAME (pad));
- return FALSE;
- }
-
- structure = gst_caps_get_structure (caps, 0);
- ret = gst_structure_get_int (structure, "width", width);
- ret &= gst_structure_get_int (structure, "height", height);
-
- if (!ret) {
- g_warning ("gstvideo: failed to get size properties on pad %s:%s",
- GST_DEBUG_PAD_NAME (pad));
- return FALSE;
- }
-
- GST_DEBUG ("size request on pad %s:%s: %dx%d",
- GST_DEBUG_PAD_NAME (pad), width ? *width : -1, height ? *height : -1);
-
- return TRUE;
-}
-
-/**
- * gst_video_calculate_display_ratio:
- * @dar_n: Numerator of the calculated display_ratio
- * @dar_d: Denominator of the calculated display_ratio
- * @video_width: Width of the video frame in pixels
- * @video_height: Height of the video frame in pixels
- * @video_par_n: Numerator of the pixel aspect ratio of the input video.
- * @video_par_d: Denominator of the pixel aspect ratio of the input video.
- * @display_par_n: Numerator of the pixel aspect ratio of the display device
- * @display_par_d: Denominator of the pixel aspect ratio of the display device
- *
- * Given the Pixel Aspect Ratio and size of an input video frame, and the
- * pixel aspect ratio of the intended display device, calculates the actual
- * display ratio the video will be rendered with.
- *
- * Returns: A boolean indicating success and a calculated Display Ratio in the
- * dar_n and dar_d parameters.
- * The return value is FALSE in the case of integer overflow or other error.
- *
- * Since: 0.10.7
- */
-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)
-{
- gint num, den;
-
- GValue display_ratio = { 0, };
- GValue tmp = { 0, };
- GValue tmp2 = { 0, };
-
- g_return_val_if_fail (dar_n != NULL, FALSE);
- g_return_val_if_fail (dar_d != NULL, FALSE);
-
- g_value_init (&display_ratio, GST_TYPE_FRACTION);
- g_value_init (&tmp, GST_TYPE_FRACTION);
- g_value_init (&tmp2, GST_TYPE_FRACTION);
-
- /* Calculate (video_width * video_par_n * display_par_d) /
- * (video_height * video_par_d * display_par_n) */
- gst_value_set_fraction (&display_ratio, video_width, video_height);
- gst_value_set_fraction (&tmp, video_par_n, video_par_d);
-
- if (!gst_value_fraction_multiply (&tmp2, &display_ratio, &tmp))
- goto error_overflow;
-
- gst_value_set_fraction (&tmp, display_par_d, display_par_n);
-
- if (!gst_value_fraction_multiply (&display_ratio, &tmp2, &tmp))
- goto error_overflow;
-
- num = gst_value_get_fraction_numerator (&display_ratio);
- den = gst_value_get_fraction_denominator (&display_ratio);
-
- g_value_unset (&display_ratio);
- g_value_unset (&tmp);
- g_value_unset (&tmp2);
-
- g_return_val_if_fail (num > 0, FALSE);
- g_return_val_if_fail (den > 0, FALSE);
-
- *dar_n = num;
- *dar_d = den;
-
- return TRUE;
-error_overflow:
- g_value_unset (&display_ratio);
- g_value_unset (&tmp);
- g_value_unset (&tmp2);
- return FALSE;
-}
-
-/**
- * gst_video_format_parse_caps_interlaced:
- * @caps: the fixed #GstCaps to parse
- * @interlaced: whether @caps represents interlaced video or not, may be NULL (output)
- *
- * Extracts whether the caps represents interlaced content or not and places it
- * in @interlaced.
- *
- * Since: 0.10.23
- *
- * Returns: TRUE if @caps was parsed correctly.
- */
-gboolean
-gst_video_format_parse_caps_interlaced (GstCaps * caps, gboolean * interlaced)
-{
- GstStructure *structure;
-
- if (!gst_caps_is_fixed (caps))
- return FALSE;
-
- structure = gst_caps_get_structure (caps, 0);
-
- if (interlaced) {
- if (!gst_structure_get_boolean (structure, "interlaced", interlaced))
- *interlaced = FALSE;
- }
-
- return TRUE;
-}
-
-/**
- * gst_video_format_parse_caps:
- * @caps: the #GstCaps to parse
- * @format: the #GstVideoFormat of the video represented by @caps (output)
- * @width: the width of the video represented by @caps, may be NULL (output)
- * @height: the height of the video represented by @caps, may be NULL (output)
- *
- * Determines the #GstVideoFormat of @caps and places it in the location
- * pointed to by @format. Extracts the size of the video and places it
- * in the location pointed to by @width and @height. If @caps does not
- * represent one of the raw video formats listed in #GstVideoFormat, the
- * function will fail and return FALSE.
- *
- * Since: 0.10.16
- *
- * Returns: TRUE if @caps was parsed correctly.
- */
-gboolean
-gst_video_format_parse_caps (GstCaps * caps, GstVideoFormat * format,
- int *width, int *height)
-{
- GstStructure *structure;
- gboolean ok = TRUE;
-
- if (!gst_caps_is_fixed (caps))
- return FALSE;
-
- structure = gst_caps_get_structure (caps, 0);
-
- if (format) {
- if (gst_structure_has_name (structure, "video/x-raw-yuv")) {
- guint32 fourcc;
-
- ok &= gst_structure_get_fourcc (structure, "format", &fourcc);
-
- *format = gst_video_format_from_fourcc (fourcc);
- if (*format == GST_VIDEO_FORMAT_UNKNOWN) {
- ok = FALSE;
- }
- } else if (gst_structure_has_name (structure, "video/x-raw-rgb")) {
- int depth;
- int bpp;
- int endianness;
- int red_mask;
- int green_mask;
- int blue_mask;
- int alpha_mask;
- gboolean have_alpha;
-
- ok &= gst_structure_get_int (structure, "depth", &depth);
- ok &= gst_structure_get_int (structure, "bpp", &bpp);
- ok &= gst_structure_get_int (structure, "endianness", &endianness);
- ok &= gst_structure_get_int (structure, "red_mask", &red_mask);
- ok &= gst_structure_get_int (structure, "green_mask", &green_mask);
- ok &= gst_structure_get_int (structure, "blue_mask", &blue_mask);
- have_alpha = gst_structure_get_int (structure, "alpha_mask", &alpha_mask);
-
- if (depth == 24 && bpp == 32 && endianness == G_BIG_ENDIAN) {
- *format = gst_video_format_from_rgb32_masks (red_mask, green_mask,
- blue_mask);
- if (*format == GST_VIDEO_FORMAT_UNKNOWN) {
- ok = FALSE;
- }
- } else if (depth == 32 && bpp == 32 && endianness == G_BIG_ENDIAN &&
- have_alpha) {
- *format = gst_video_format_from_rgba32_masks (red_mask, green_mask,
- blue_mask, alpha_mask);
- if (*format == GST_VIDEO_FORMAT_UNKNOWN) {
- ok = FALSE;
- }
- } else if (depth == 24 && bpp == 24 && endianness == G_BIG_ENDIAN) {
- *format = gst_video_format_from_rgb24_masks (red_mask, green_mask,
- blue_mask);
- if (*format == GST_VIDEO_FORMAT_UNKNOWN) {
- ok = FALSE;
- }
- } else {
- ok = FALSE;
- }
- } else {
- ok = FALSE;
- }
- }
-
- if (width) {
- ok &= gst_structure_get_int (structure, "width", width);
- }
-
- if (height) {
- ok &= gst_structure_get_int (structure, "height", height);
- }
-
- return ok;
-}
-
-
-/**
- * gst_video_parse_caps_framerate:
- * @caps: pointer to a #GstCaps instance
- * @fps_n: pointer to integer to hold numerator of frame rate (output)
- * @fps_d: pointer to integer to hold denominator of frame rate (output)
- *
- * Extracts the frame rate from @caps and places the values in the locations
- * pointed to by @fps_n and @fps_d. Returns TRUE if the values could be
- * parsed correctly, FALSE if not.
- *
- * This function can be used with #GstCaps that have any media type; it
- * is not limited to formats handled by #GstVideoFormat.
- *
- * Since: 0.10.16
- *
- * Returns: TRUE if @caps was parsed correctly.
- */
-gboolean
-gst_video_parse_caps_framerate (GstCaps * caps, int *fps_n, int *fps_d)
-{
- GstStructure *structure;
-
- if (!gst_caps_is_fixed (caps))
- return FALSE;
-
- structure = gst_caps_get_structure (caps, 0);
-
- return gst_structure_get_fraction (structure, "framerate", fps_n, fps_d);
-}
-
-/**
- * gst_video_parse_caps_pixel_aspect_ratio:
- * @caps: pointer to a #GstCaps instance
- * @par_n: pointer to numerator of pixel aspect ratio (output)
- * @par_d: pointer to denominator of pixel aspect ratio (output)
- *
- * Extracts the pixel aspect ratio from @caps and places the values in
- * the locations pointed to by @par_n and @par_d. Returns TRUE if the
- * values could be parsed correctly, FALSE if not.
- *
- * This function can be used with #GstCaps that have any media type; it
- * is not limited to formats handled by #GstVideoFormat.
- *
- * Since: 0.10.16
- *
- * Returns: TRUE if @caps was parsed correctly.
- */
-gboolean
-gst_video_parse_caps_pixel_aspect_ratio (GstCaps * caps, int *par_n, int *par_d)
-{
- GstStructure *structure;
-
- if (!gst_caps_is_fixed (caps))
- return FALSE;
-
- structure = gst_caps_get_structure (caps, 0);
-
- if (!gst_structure_get_fraction (structure, "pixel-aspect-ratio",
- par_n, par_d)) {
- *par_n = 1;
- *par_d = 1;
- }
- return TRUE;
-}
-
-/**
- * gst_video_format_new_caps_interlaced:
- * @format: the #GstVideoFormat describing the raw video format
- * @width: width of video
- * @height: height of video
- * @framerate_n: numerator of frame rate
- * @framerate_d: denominator of frame rate
- * @par_n: numerator of pixel aspect ratio
- * @par_d: denominator of pixel aspect ratio
- * @interlaced: #TRUE if the format is interlaced
- *
- * Creates a new #GstCaps object based on the parameters provided.
- *
- * Since: 0.10.23
- *
- * Returns: a new #GstCaps object, or NULL if there was an error
- */
-GstCaps *
-gst_video_format_new_caps_interlaced (GstVideoFormat format, int width,
- int height, int framerate_n, int framerate_d, int par_n, int par_d,
- gboolean interlaced)
-{
- GstCaps *res;
-
- res =
- gst_video_format_new_caps (format, width, height, framerate_n,
- framerate_d, par_n, par_d);
- if (interlaced && (res != NULL))
- gst_caps_set_simple (res, "interlaced", G_TYPE_BOOLEAN, TRUE, NULL);
-
- return res;
-}
-
-/**
- * gst_video_format_new_caps:
- * @format: the #GstVideoFormat describing the raw video format
- * @width: width of video
- * @height: height of video
- * @framerate_n: numerator of frame rate
- * @framerate_d: denominator of frame rate
- * @par_n: numerator of pixel aspect ratio
- * @par_d: denominator of pixel aspect ratio
- *
- * Creates a new #GstCaps object based on the parameters provided.
- *
- * Since: 0.10.16
- *
- * Returns: a new #GstCaps object, or NULL if there was an error
- */
-GstCaps *
-gst_video_format_new_caps (GstVideoFormat format, int width, int height,
- int framerate_n, int framerate_d, int par_n, int par_d)
-{
- g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, NULL);
- g_return_val_if_fail (width > 0 && height > 0, NULL);
-
- if (gst_video_format_is_yuv (format)) {
- return gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, gst_video_format_to_fourcc (format),
- "width", G_TYPE_INT, width,
- "height", G_TYPE_INT, height,
- "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d,
- "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL);
- }
- if (gst_video_format_is_rgb (format)) {
- GstCaps *caps;
- int red_mask;
- int blue_mask;
- int green_mask;
- int alpha_mask;
- int depth;
- int bpp;
- gboolean have_alpha;
- unsigned int mask;
-
- switch (format) {
- case GST_VIDEO_FORMAT_RGBx:
- case GST_VIDEO_FORMAT_BGRx:
- case GST_VIDEO_FORMAT_xRGB:
- case GST_VIDEO_FORMAT_xBGR:
- bpp = 32;
- depth = 24;
- have_alpha = FALSE;
- break;
- case GST_VIDEO_FORMAT_RGBA:
- case GST_VIDEO_FORMAT_BGRA:
- case GST_VIDEO_FORMAT_ARGB:
- case GST_VIDEO_FORMAT_ABGR:
- bpp = 32;
- depth = 32;
- have_alpha = TRUE;
- break;
- case GST_VIDEO_FORMAT_RGB:
- case GST_VIDEO_FORMAT_BGR:
- bpp = 24;
- depth = 24;
- have_alpha = FALSE;
- break;
- default:
- return NULL;
- }
- if (bpp == 32) {
- mask = 0xff000000;
- } else {
- mask = 0xff0000;
- }
- red_mask =
- mask >> (8 * gst_video_format_get_component_offset (format, 0, width,
- height));
- green_mask =
- mask >> (8 * gst_video_format_get_component_offset (format, 1, width,
- height));
- blue_mask =
- mask >> (8 * gst_video_format_get_component_offset (format, 2, width,
- height));
-
- caps = gst_caps_new_simple ("video/x-raw-rgb",
- "bpp", G_TYPE_INT, bpp,
- "depth", G_TYPE_INT, depth,
- "endianness", G_TYPE_INT, G_BIG_ENDIAN,
- "red_mask", G_TYPE_INT, red_mask,
- "green_mask", G_TYPE_INT, green_mask,
- "blue_mask", G_TYPE_INT, blue_mask,
- "width", G_TYPE_INT, width,
- "height", G_TYPE_INT, height,
- "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d,
- "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL);
- if (have_alpha) {
- alpha_mask =
- mask >> (8 * gst_video_format_get_component_offset (format, 3, width,
- height));
- gst_caps_set_simple (caps, "alpha_mask", G_TYPE_INT, alpha_mask, NULL);
- }
- return caps;
- }
- return NULL;
-}
-
-/**
- * gst_video_format_from_fourcc:
- * @fourcc: a FOURCC value representing raw YUV video
- *
- * Converts a FOURCC value into the corresponding #GstVideoFormat.
- * If the FOURCC cannot be represented by #GstVideoFormat,
- * #GST_VIDEO_FORMAT_UNKNOWN is returned.
- *
- * Since: 0.10.16
- *
- * Returns: the #GstVideoFormat describing the FOURCC value
- */
-GstVideoFormat
-gst_video_format_from_fourcc (guint32 fourcc)
-{
- switch (fourcc) {
- case GST_MAKE_FOURCC ('I', '4', '2', '0'):
- return GST_VIDEO_FORMAT_I420;
- case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
- return GST_VIDEO_FORMAT_YV12;
- case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
- return GST_VIDEO_FORMAT_YUY2;
- case GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'):
- return GST_VIDEO_FORMAT_YVYU;
- case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
- return GST_VIDEO_FORMAT_UYVY;
- case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'):
- return GST_VIDEO_FORMAT_AYUV;
- case GST_MAKE_FOURCC ('Y', '4', '1', 'B'):
- return GST_VIDEO_FORMAT_Y41B;
- case GST_MAKE_FOURCC ('Y', '4', '2', 'B'):
- return GST_VIDEO_FORMAT_Y42B;
- case GST_MAKE_FOURCC ('Y', '4', '4', '4'):
- return GST_VIDEO_FORMAT_Y444;
- case GST_MAKE_FOURCC ('v', '2', '1', '0'):
- return GST_VIDEO_FORMAT_v210;
- case GST_MAKE_FOURCC ('v', '2', '1', '6'):
- return GST_VIDEO_FORMAT_v216;
- case GST_MAKE_FOURCC ('N', 'V', '1', '2'):
- return GST_VIDEO_FORMAT_NV12;
- case GST_MAKE_FOURCC ('N', 'V', '2', '1'):
- return GST_VIDEO_FORMAT_NV21;
- default:
- return GST_VIDEO_FORMAT_UNKNOWN;
- }
-}
-
-/**
- * gst_video_format_to_fourcc:
- * @format: a #GstVideoFormat video format
- *
- * Converts a #GstVideoFormat value into the corresponding FOURCC. Only
- * a few YUV formats have corresponding FOURCC values. If @format has
- * no corresponding FOURCC value, 0 is returned.
- *
- * Since: 0.10.16
- *
- * Returns: the FOURCC corresponding to @format
- */
-guint32
-gst_video_format_to_fourcc (GstVideoFormat format)
-{
- g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
-
- switch (format) {
- case GST_VIDEO_FORMAT_I420:
- return GST_MAKE_FOURCC ('I', '4', '2', '0');
- case GST_VIDEO_FORMAT_YV12:
- return GST_MAKE_FOURCC ('Y', 'V', '1', '2');
- case GST_VIDEO_FORMAT_YUY2:
- return GST_MAKE_FOURCC ('Y', 'U', 'Y', '2');
- case GST_VIDEO_FORMAT_YVYU:
- return GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U');
- case GST_VIDEO_FORMAT_UYVY:
- return GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y');
- case GST_VIDEO_FORMAT_AYUV:
- return GST_MAKE_FOURCC ('A', 'Y', 'U', 'V');
- case GST_VIDEO_FORMAT_Y41B:
- return GST_MAKE_FOURCC ('Y', '4', '1', 'B');
- case GST_VIDEO_FORMAT_Y42B:
- return GST_MAKE_FOURCC ('Y', '4', '2', 'B');
- case GST_VIDEO_FORMAT_Y444:
- return GST_MAKE_FOURCC ('Y', '4', '4', '4');
- case GST_VIDEO_FORMAT_v210:
- return GST_MAKE_FOURCC ('v', '2', '1', '0');
- case GST_VIDEO_FORMAT_v216:
- return GST_MAKE_FOURCC ('v', '2', '1', '6');
- case GST_VIDEO_FORMAT_NV12:
- return GST_MAKE_FOURCC ('N', 'V', '1', '2');
- case GST_VIDEO_FORMAT_NV21:
- return GST_MAKE_FOURCC ('N', 'V', '2', '1');
- default:
- return 0;
- }
-}
-
-/*
- * gst_video_format_from_rgb32_masks:
- * @red_mask: red bit mask
- * @green_mask: green bit mask
- * @blue_mask: blue bit mask
- *
- * Converts red, green, blue bit masks into the corresponding
- * #GstVideoFormat.
- *
- * Since: 0.10.16
- *
- * Returns: the #GstVideoFormat corresponding to the bit masks
- */
-static GstVideoFormat
-gst_video_format_from_rgb32_masks (int red_mask, int green_mask, int blue_mask)
-{
- if (red_mask == 0xff000000 && green_mask == 0x00ff0000 &&
- blue_mask == 0x0000ff00) {
- return GST_VIDEO_FORMAT_RGBx;
- }
- if (red_mask == 0x0000ff00 && green_mask == 0x00ff0000 &&
- blue_mask == 0xff000000) {
- return GST_VIDEO_FORMAT_BGRx;
- }
- if (red_mask == 0x00ff0000 && green_mask == 0x0000ff00 &&
- blue_mask == 0x000000ff) {
- return GST_VIDEO_FORMAT_xRGB;
- }
- if (red_mask == 0x000000ff && green_mask == 0x0000ff00 &&
- blue_mask == 0x00ff0000) {
- return GST_VIDEO_FORMAT_xBGR;
- }
-
- return GST_VIDEO_FORMAT_UNKNOWN;
-}
-
-static GstVideoFormat
-gst_video_format_from_rgba32_masks (int red_mask, int green_mask, int blue_mask,
- int alpha_mask)
-{
- if (red_mask == 0xff000000 && green_mask == 0x00ff0000 &&
- blue_mask == 0x0000ff00 && alpha_mask == 0x000000ff) {
- return GST_VIDEO_FORMAT_RGBA;
- }
- if (red_mask == 0x0000ff00 && green_mask == 0x00ff0000 &&
- blue_mask == 0xff000000 && alpha_mask == 0x000000ff) {
- return GST_VIDEO_FORMAT_BGRA;
- }
- if (red_mask == 0x00ff0000 && green_mask == 0x0000ff00 &&
- blue_mask == 0x000000ff && alpha_mask == 0xff000000) {
- return GST_VIDEO_FORMAT_ARGB;
- }
- if (red_mask == 0x000000ff && green_mask == 0x0000ff00 &&
- blue_mask == 0x00ff0000 && alpha_mask == 0xff000000) {
- return GST_VIDEO_FORMAT_ABGR;
- }
-
- return GST_VIDEO_FORMAT_UNKNOWN;
-}
-
-static GstVideoFormat
-gst_video_format_from_rgb24_masks (int red_mask, int green_mask, int blue_mask)
-{
- if (red_mask == 0xff0000 && green_mask == 0x00ff00 && blue_mask == 0x0000ff) {
- return GST_VIDEO_FORMAT_RGB;
- }
- if (red_mask == 0x0000ff && green_mask == 0x00ff00 && blue_mask == 0xff0000) {
- return GST_VIDEO_FORMAT_BGR;
- }
-
- return GST_VIDEO_FORMAT_UNKNOWN;
-}
-
-/**
- * gst_video_format_is_rgb:
- * @format: a #GstVideoFormat
- *
- * Determine whether the video format is an RGB format.
- *
- * Since: 0.10.16
- *
- * Returns: TRUE if @format represents RGB video
- */
-gboolean
-gst_video_format_is_rgb (GstVideoFormat format)
-{
- switch (format) {
- case GST_VIDEO_FORMAT_I420:
- case GST_VIDEO_FORMAT_YV12:
- case GST_VIDEO_FORMAT_YUY2:
- case GST_VIDEO_FORMAT_YVYU:
- case GST_VIDEO_FORMAT_UYVY:
- case GST_VIDEO_FORMAT_AYUV:
- case GST_VIDEO_FORMAT_Y41B:
- case GST_VIDEO_FORMAT_Y42B:
- case GST_VIDEO_FORMAT_Y444:
- case GST_VIDEO_FORMAT_v210:
- case GST_VIDEO_FORMAT_v216:
- case GST_VIDEO_FORMAT_NV12:
- case GST_VIDEO_FORMAT_NV21:
- return FALSE;
- case GST_VIDEO_FORMAT_RGBx:
- case GST_VIDEO_FORMAT_BGRx:
- case GST_VIDEO_FORMAT_xRGB:
- case GST_VIDEO_FORMAT_xBGR:
- case GST_VIDEO_FORMAT_RGBA:
- case GST_VIDEO_FORMAT_BGRA:
- case GST_VIDEO_FORMAT_ARGB:
- case GST_VIDEO_FORMAT_ABGR:
- case GST_VIDEO_FORMAT_RGB:
- case GST_VIDEO_FORMAT_BGR:
- return TRUE;
- default:
- return FALSE;
- }
-}
-
-/**
- * gst_video_format_is_yuv:
- * @format: a #GstVideoFormat
- *
- * Determine whether the video format is a YUV format.
- *
- * Since: 0.10.16
- *
- * Returns: TRUE if @format represents YUV video
- */
-gboolean
-gst_video_format_is_yuv (GstVideoFormat format)
-{
- switch (format) {
- case GST_VIDEO_FORMAT_I420:
- case GST_VIDEO_FORMAT_YV12:
- case GST_VIDEO_FORMAT_YUY2:
- case GST_VIDEO_FORMAT_YVYU:
- case GST_VIDEO_FORMAT_UYVY:
- case GST_VIDEO_FORMAT_AYUV:
- case GST_VIDEO_FORMAT_Y41B:
- case GST_VIDEO_FORMAT_Y42B:
- case GST_VIDEO_FORMAT_Y444:
- case GST_VIDEO_FORMAT_v210:
- case GST_VIDEO_FORMAT_v216:
- case GST_VIDEO_FORMAT_NV12:
- case GST_VIDEO_FORMAT_NV21:
- return TRUE;
- case GST_VIDEO_FORMAT_RGBx:
- case GST_VIDEO_FORMAT_BGRx:
- case GST_VIDEO_FORMAT_xRGB:
- case GST_VIDEO_FORMAT_xBGR:
- case GST_VIDEO_FORMAT_RGBA:
- case GST_VIDEO_FORMAT_BGRA:
- case GST_VIDEO_FORMAT_ARGB:
- case GST_VIDEO_FORMAT_ABGR:
- case GST_VIDEO_FORMAT_RGB:
- case GST_VIDEO_FORMAT_BGR:
- return FALSE;
- default:
- return FALSE;
- }
-}
-
-/**
- * gst_video_format_has_alpha:
- * @format: a #GstVideoFormat
- *
- * Returns TRUE or FALSE depending on if the video format provides an
- * alpha channel.
- *
- * Since: 0.10.16
- *
- * Returns: TRUE if @format has an alpha channel
- */
-gboolean
-gst_video_format_has_alpha (GstVideoFormat format)
-{
- switch (format) {
- case GST_VIDEO_FORMAT_I420:
- case GST_VIDEO_FORMAT_YV12:
- case GST_VIDEO_FORMAT_YUY2:
- case GST_VIDEO_FORMAT_YVYU:
- case GST_VIDEO_FORMAT_UYVY:
- case GST_VIDEO_FORMAT_Y41B:
- case GST_VIDEO_FORMAT_Y42B:
- case GST_VIDEO_FORMAT_Y444:
- case GST_VIDEO_FORMAT_v210:
- case GST_VIDEO_FORMAT_v216:
- case GST_VIDEO_FORMAT_NV12:
- case GST_VIDEO_FORMAT_NV21:
- return FALSE;
- case GST_VIDEO_FORMAT_AYUV:
- case GST_VIDEO_FORMAT_RGBA:
- case GST_VIDEO_FORMAT_BGRA:
- case GST_VIDEO_FORMAT_ARGB:
- case GST_VIDEO_FORMAT_ABGR:
- return TRUE;
- case GST_VIDEO_FORMAT_RGBx:
- case GST_VIDEO_FORMAT_BGRx:
- case GST_VIDEO_FORMAT_xRGB:
- case GST_VIDEO_FORMAT_xBGR:
- case GST_VIDEO_FORMAT_RGB:
- case GST_VIDEO_FORMAT_BGR:
- return FALSE;
- default:
- return FALSE;
- }
-}
-
-/**
- * gst_video_format_get_row_stride:
- * @format: a #GstVideoFormat
- * @component: the component index
- * @width: the width of video
- *
- * Calculates the row stride (number of bytes from one row of pixels to
- * the next) for the video component with an index of @component. For
- * YUV video, Y, U, and V have component indices of 0, 1, and 2,
- * respectively. For RGB video, R, G, and B have component indicies of
- * 0, 1, and 2, respectively. Alpha channels, if present, have a component
- * index of 3. The @width parameter always represents the width of the
- * video, not the component.
- *
- * Since: 0.10.16
- *
- * Returns: row stride of component @component
- */
-int
-gst_video_format_get_row_stride (GstVideoFormat format, int component,
- int width)
-{
- g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
- g_return_val_if_fail (component >= 0 && component <= 3, 0);
- g_return_val_if_fail (width > 0, 0);
-
- switch (format) {
- case GST_VIDEO_FORMAT_I420:
- case GST_VIDEO_FORMAT_YV12:
- if (component == 0) {
- return GST_ROUND_UP_4 (width);
- } else {
- return GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2);
- }
- case GST_VIDEO_FORMAT_YUY2:
- case GST_VIDEO_FORMAT_YVYU:
- case GST_VIDEO_FORMAT_UYVY:
- return GST_ROUND_UP_4 (width * 2);
- case GST_VIDEO_FORMAT_AYUV:
- case GST_VIDEO_FORMAT_RGBx:
- case GST_VIDEO_FORMAT_BGRx:
- case GST_VIDEO_FORMAT_xRGB:
- case GST_VIDEO_FORMAT_xBGR:
- case GST_VIDEO_FORMAT_RGBA:
- case GST_VIDEO_FORMAT_BGRA:
- case GST_VIDEO_FORMAT_ARGB:
- case GST_VIDEO_FORMAT_ABGR:
- return width * 4;
- case GST_VIDEO_FORMAT_RGB:
- case GST_VIDEO_FORMAT_BGR:
- return GST_ROUND_UP_4 (width * 3);
- case GST_VIDEO_FORMAT_Y41B:
- if (component == 0) {
- return GST_ROUND_UP_4 (width);
- } else {
- return GST_ROUND_UP_16 (width) / 4;
- }
- case GST_VIDEO_FORMAT_Y42B:
- if (component == 0) {
- return GST_ROUND_UP_4 (width);
- } else {
- return GST_ROUND_UP_8 (width) / 2;
- }
- case GST_VIDEO_FORMAT_Y444:
- return GST_ROUND_UP_4 (width);
- case GST_VIDEO_FORMAT_v210:
- return ((width + 47) / 48) * 128;
- case GST_VIDEO_FORMAT_v216:
- return GST_ROUND_UP_8 (width * 4);
- case GST_VIDEO_FORMAT_NV12:
- case GST_VIDEO_FORMAT_NV21:
- return GST_ROUND_UP_4 (width);
- default:
- return 0;
- }
-}
-
-/**
- * gst_video_format_get_pixel_stride:
- * @format: a #GstVideoFormat
- * @component: the component index
- *
- * Calculates the pixel stride (number of bytes from one pixel to the
- * pixel to its immediate left) for the video component with an index
- * of @component. See @gst_video_format_get_row_stride for a description
- * of the component index.
- *
- * Since: 0.10.16
- *
- * Returns: pixel stride of component @component
- */
-int
-gst_video_format_get_pixel_stride (GstVideoFormat format, int component)
-{
- g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
- g_return_val_if_fail (component >= 0 && component <= 3, 0);
-
- switch (format) {
- case GST_VIDEO_FORMAT_I420:
- case GST_VIDEO_FORMAT_YV12:
- case GST_VIDEO_FORMAT_Y41B:
- case GST_VIDEO_FORMAT_Y42B:
- case GST_VIDEO_FORMAT_Y444:
- return 1;
- case GST_VIDEO_FORMAT_YUY2:
- case GST_VIDEO_FORMAT_YVYU:
- case GST_VIDEO_FORMAT_UYVY:
- if (component == 0) {
- return 2;
- } else {
- return 4;
- }
- case GST_VIDEO_FORMAT_AYUV:
- case GST_VIDEO_FORMAT_RGBx:
- case GST_VIDEO_FORMAT_BGRx:
- case GST_VIDEO_FORMAT_xRGB:
- case GST_VIDEO_FORMAT_xBGR:
- case GST_VIDEO_FORMAT_RGBA:
- case GST_VIDEO_FORMAT_BGRA:
- case GST_VIDEO_FORMAT_ARGB:
- case GST_VIDEO_FORMAT_ABGR:
- return 4;
- case GST_VIDEO_FORMAT_RGB:
- case GST_VIDEO_FORMAT_BGR:
- return 3;
- case GST_VIDEO_FORMAT_v210:
- /* v210 is packed at the bit level, so pixel stride doesn't make sense */
- return 0;
- case GST_VIDEO_FORMAT_v216:
- if (component == 0) {
- return 4;
- } else {
- return 8;
- }
- case GST_VIDEO_FORMAT_NV12:
- case GST_VIDEO_FORMAT_NV21:
- if (component == 0) {
- return 1;
- } else {
- return 2;
- }
- default:
- return 0;
- }
-}
-
-/**
- * gst_video_format_get_component_width:
- * @format: a #GstVideoFormat
- * @component: the component index
- * @width: the width of video
- *
- * Calculates the width of the component. See
- * @gst_video_format_get_row_stride for a description
- * of the component index.
- *
- * Since: 0.10.16
- *
- * Returns: width of component @component
- */
-int
-gst_video_format_get_component_width (GstVideoFormat format, int component,
- int width)
-{
- g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
- g_return_val_if_fail (component >= 0 && component <= 3, 0);
- g_return_val_if_fail (width > 0, 0);
-
- switch (format) {
- case GST_VIDEO_FORMAT_I420:
- case GST_VIDEO_FORMAT_YV12:
- case GST_VIDEO_FORMAT_YUY2:
- case GST_VIDEO_FORMAT_YVYU:
- case GST_VIDEO_FORMAT_UYVY:
- case GST_VIDEO_FORMAT_Y42B:
- case GST_VIDEO_FORMAT_v210:
- case GST_VIDEO_FORMAT_v216:
- if (component == 0) {
- return width;
- } else {
- return GST_ROUND_UP_2 (width) / 2;
- }
- case GST_VIDEO_FORMAT_Y41B:
- if (component == 0) {
- return width;
- } else {
- return GST_ROUND_UP_4 (width) / 4;
- }
- case GST_VIDEO_FORMAT_AYUV:
- case GST_VIDEO_FORMAT_RGBx:
- case GST_VIDEO_FORMAT_BGRx:
- case GST_VIDEO_FORMAT_xRGB:
- case GST_VIDEO_FORMAT_xBGR:
- case GST_VIDEO_FORMAT_RGBA:
- case GST_VIDEO_FORMAT_BGRA:
- case GST_VIDEO_FORMAT_ARGB:
- case GST_VIDEO_FORMAT_ABGR:
- case GST_VIDEO_FORMAT_RGB:
- case GST_VIDEO_FORMAT_BGR:
- case GST_VIDEO_FORMAT_Y444:
- case GST_VIDEO_FORMAT_NV12:
- case GST_VIDEO_FORMAT_NV21:
- return width;
- default:
- return 0;
- }
-}
-
-/**
- * gst_video_format_get_component_height:
- * @format: a #GstVideoFormat
- * @component: the component index
- * @height: the height of video
- *
- * Calculates the height of the component. See
- * @gst_video_format_get_row_stride for a description
- * of the component index.
- *
- * Since: 0.10.16
- *
- * Returns: height of component @component
- */
-int
-gst_video_format_get_component_height (GstVideoFormat format, int component,
- int height)
-{
- g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
- g_return_val_if_fail (component >= 0 && component <= 3, 0);
- g_return_val_if_fail (height > 0, 0);
-
- switch (format) {
- case GST_VIDEO_FORMAT_I420:
- case GST_VIDEO_FORMAT_YV12:
- case GST_VIDEO_FORMAT_NV12:
- case GST_VIDEO_FORMAT_NV21:
- if (component == 0) {
- return height;
- } else {
- return GST_ROUND_UP_2 (height) / 2;
- }
- case GST_VIDEO_FORMAT_Y41B:
- case GST_VIDEO_FORMAT_Y42B:
- case GST_VIDEO_FORMAT_YUY2:
- case GST_VIDEO_FORMAT_YVYU:
- case GST_VIDEO_FORMAT_UYVY:
- case GST_VIDEO_FORMAT_AYUV:
- case GST_VIDEO_FORMAT_RGBx:
- case GST_VIDEO_FORMAT_BGRx:
- case GST_VIDEO_FORMAT_xRGB:
- case GST_VIDEO_FORMAT_xBGR:
- case GST_VIDEO_FORMAT_RGBA:
- case GST_VIDEO_FORMAT_BGRA:
- case GST_VIDEO_FORMAT_ARGB:
- case GST_VIDEO_FORMAT_ABGR:
- case GST_VIDEO_FORMAT_RGB:
- case GST_VIDEO_FORMAT_BGR:
- case GST_VIDEO_FORMAT_Y444:
- case GST_VIDEO_FORMAT_v210:
- case GST_VIDEO_FORMAT_v216:
- return height;
- default:
- return 0;
- }
-}
-
-/**
- * gst_video_format_get_component_offset:
- * @format: a #GstVideoFormat
- * @component: the component index
- * @width: the width of video
- * @height: the height of video
- *
- * Calculates the offset (in bytes) of the first pixel of the component
- * with index @component. For packed formats, this will typically be a
- * small integer (0, 1, 2, 3). For planar formats, this will be a
- * (relatively) large offset to the beginning of the second or third
- * component planes. See @gst_video_format_get_row_stride for a description
- * of the component index.
- *
- * Since: 0.10.16
- *
- * Returns: offset of component @component
- */
-int
-gst_video_format_get_component_offset (GstVideoFormat format, int component,
- int width, int height)
-{
- g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
- g_return_val_if_fail (component >= 0 && component <= 3, 0);
- g_return_val_if_fail (width > 0 && height > 0, 0);
-
- switch (format) {
- case GST_VIDEO_FORMAT_I420:
- if (component == 0)
- return 0;
- if (component == 1)
- return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
- if (component == 2) {
- return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) +
- GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
- (GST_ROUND_UP_2 (height) / 2);
- }
- return 0;
- case GST_VIDEO_FORMAT_YV12: /* same as I420, but components 1+2 swapped */
- if (component == 0)
- return 0;
- if (component == 2)
- return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
- if (component == 1) {
- return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) +
- GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
- (GST_ROUND_UP_2 (height) / 2);
- }
- return 0;
- case GST_VIDEO_FORMAT_YUY2:
- if (component == 0)
- return 0;
- if (component == 1)
- return 1;
- if (component == 2)
- return 3;
- return 0;
- case GST_VIDEO_FORMAT_YVYU:
- if (component == 0)
- return 0;
- if (component == 1)
- return 3;
- if (component == 2)
- return 1;
- return 0;
- case GST_VIDEO_FORMAT_UYVY:
- if (component == 0)
- return 1;
- if (component == 1)
- return 0;
- if (component == 2)
- return 2;
- return 0;
- case GST_VIDEO_FORMAT_AYUV:
- if (component == 0)
- return 1;
- if (component == 1)
- return 2;
- if (component == 2)
- return 3;
- if (component == 3)
- return 0;
- return 0;
- case GST_VIDEO_FORMAT_RGBx:
- case GST_VIDEO_FORMAT_RGBA:
- if (component == 0)
- return 0;
- if (component == 1)
- return 1;
- if (component == 2)
- return 2;
- if (component == 3)
- return 3;
- return 0;
- case GST_VIDEO_FORMAT_BGRx:
- case GST_VIDEO_FORMAT_BGRA:
- if (component == 0)
- return 2;
- if (component == 1)
- return 1;
- if (component == 2)
- return 0;
- if (component == 3)
- return 3;
- return 0;
- case GST_VIDEO_FORMAT_xRGB:
- case GST_VIDEO_FORMAT_ARGB:
- if (component == 0)
- return 1;
- if (component == 1)
- return 2;
- if (component == 2)
- return 3;
- if (component == 3)
- return 0;
- return 0;
- case GST_VIDEO_FORMAT_xBGR:
- case GST_VIDEO_FORMAT_ABGR:
- if (component == 0)
- return 3;
- if (component == 1)
- return 2;
- if (component == 2)
- return 1;
- if (component == 3)
- return 0;
- return 0;
- case GST_VIDEO_FORMAT_RGB:
- if (component == 0)
- return 0;
- if (component == 1)
- return 1;
- if (component == 2)
- return 2;
- return 0;
- case GST_VIDEO_FORMAT_BGR:
- if (component == 0)
- return 2;
- if (component == 1)
- return 1;
- if (component == 2)
- return 0;
- return 0;
- case GST_VIDEO_FORMAT_Y41B:
- if (component == 0)
- return 0;
- if (component == 1)
- return GST_ROUND_UP_4 (width) * height;
- if (component == 2)
- return (GST_ROUND_UP_4 (width) +
- (GST_ROUND_UP_16 (width) / 4)) * height;
- return 0;
- case GST_VIDEO_FORMAT_Y42B:
- if (component == 0)
- return 0;
- if (component == 1)
- return GST_ROUND_UP_4 (width) * height;
- if (component == 2)
- return (GST_ROUND_UP_4 (width) + (GST_ROUND_UP_8 (width) / 2)) * height;
- return 0;
- case GST_VIDEO_FORMAT_Y444:
- return GST_ROUND_UP_4 (width) * height * component;
- case GST_VIDEO_FORMAT_v210:
- /* v210 is bit-packed, so this doesn't make sense */
- return 0;
- case GST_VIDEO_FORMAT_v216:
- if (component == 0)
- return 0;
- if (component == 1)
- return 2;
- if (component == 2)
- return 6;
- return 0;
- case GST_VIDEO_FORMAT_NV12:
- if (component == 0)
- return 0;
- if (component == 1)
- return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
- if (component == 2)
- return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) + 1;
- case GST_VIDEO_FORMAT_NV21:
- if (component == 0)
- return 0;
- if (component == 1)
- return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) + 1;
- if (component == 2)
- return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
- default:
- return 0;
- }
-}
-
-/**
- * gst_video_format_get_size:
- * @format: a #GstVideoFormat
- * @width: the width of video
- * @height: the height of video
- *
- * Calculates the total number of bytes in the raw video format. This
- * number should be used when allocating a buffer for raw video.
- *
- * Since: 0.10.16
- *
- * Returns: size (in bytes) of raw video format
- */
-int
-gst_video_format_get_size (GstVideoFormat format, int width, int height)
-{
- int size;
-
- g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
- g_return_val_if_fail (width > 0 && height > 0, 0);
-
- switch (format) {
- case GST_VIDEO_FORMAT_I420:
- case GST_VIDEO_FORMAT_YV12:
- size = GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
- size += GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
- (GST_ROUND_UP_2 (height) / 2) * 2;
- return size;
- case GST_VIDEO_FORMAT_YUY2:
- case GST_VIDEO_FORMAT_YVYU:
- case GST_VIDEO_FORMAT_UYVY:
- return GST_ROUND_UP_4 (width * 2) * height;
- case GST_VIDEO_FORMAT_AYUV:
- case GST_VIDEO_FORMAT_RGBx:
- case GST_VIDEO_FORMAT_BGRx:
- case GST_VIDEO_FORMAT_xRGB:
- case GST_VIDEO_FORMAT_xBGR:
- case GST_VIDEO_FORMAT_RGBA:
- case GST_VIDEO_FORMAT_BGRA:
- case GST_VIDEO_FORMAT_ARGB:
- case GST_VIDEO_FORMAT_ABGR:
- return width * 4 * height;
- case GST_VIDEO_FORMAT_RGB:
- case GST_VIDEO_FORMAT_BGR:
- return GST_ROUND_UP_4 (width * 3) * height;
- case GST_VIDEO_FORMAT_Y41B:
- /* simplification of ROUNDUP4(w)*h + 2*((ROUNDUP8(w)/4)*h */
- return (GST_ROUND_UP_4 (width) + (GST_ROUND_UP_16 (width) / 2)) * height;
- case GST_VIDEO_FORMAT_Y42B:
- /* simplification of ROUNDUP4(w)*h + 2*(ROUNDUP8(w)/2)*h: */
- return (GST_ROUND_UP_4 (width) + GST_ROUND_UP_8 (width)) * height;
- case GST_VIDEO_FORMAT_Y444:
- return GST_ROUND_UP_4 (width) * height * 3;
- case GST_VIDEO_FORMAT_v210:
- return ((width + 47) / 48) * 128 * height;
- case GST_VIDEO_FORMAT_v216:
- return GST_ROUND_UP_8 (width * 4) * height;
- case GST_VIDEO_FORMAT_NV12:
- case GST_VIDEO_FORMAT_NV21:
- return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) * 3 / 2;
- default:
- return 0;
- }
-}
-
-/**
- * gst_video_format_convert:
- * @format: a #GstVideoFormat
- * @width: the width of video
- * @height: the height of video
- * @fps_n: frame rate numerator
- * @fps_d: frame rate denominator
- * @src_format: #GstFormat of the @src_value
- * @src_value: value to convert
- * @dest_format: #GstFormat of the @dest_value
- * @dest_value: pointer to destination value
- *
- * Converts among various #GstFormat types. This function handles
- * GST_FORMAT_BYTES, GST_FORMAT_TIME, and GST_FORMAT_DEFAULT. For
- * raw video, GST_FORMAT_DEFAULT corresponds to video frames. This
- * function can be to handle pad queries of the type GST_QUERY_CONVERT.
- *
- * Since: 0.10.16
- *
- * Returns: TRUE if the conversion was successful.
- */
-gboolean
-gst_video_format_convert (GstVideoFormat format, int width, int height,
- int fps_n, int fps_d,
- GstFormat src_format, gint64 src_value,
- GstFormat dest_format, gint64 * dest_value)
-{
- gboolean ret = FALSE;
- int size;
-
- g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
- g_return_val_if_fail (width > 0 && height > 0, 0);
-
- size = gst_video_format_get_size (format, width, height);
-
- GST_DEBUG ("converting value %" G_GINT64_FORMAT " from %s to %s",
- src_value, gst_format_get_name (src_format),
- gst_format_get_name (dest_format));
-
- if (src_format == dest_format) {
- *dest_value = src_value;
- ret = TRUE;
- goto done;
- }
-
- if (src_value == -1) {
- *dest_value = -1;
- ret = TRUE;
- goto done;
- }
-
- /* bytes to frames */
- if (src_format == GST_FORMAT_BYTES && dest_format == GST_FORMAT_DEFAULT) {
- if (size != 0) {
- *dest_value = gst_util_uint64_scale_int (src_value, 1, size);
- } else {
- GST_ERROR ("blocksize is 0");
- *dest_value = 0;
- }
- ret = TRUE;
- goto done;
- }
-
- /* frames to bytes */
- if (src_format == GST_FORMAT_DEFAULT && dest_format == GST_FORMAT_BYTES) {
- *dest_value = gst_util_uint64_scale_int (src_value, size, 1);
- ret = TRUE;
- goto done;
- }
-
- /* time to frames */
- if (src_format == GST_FORMAT_TIME && dest_format == GST_FORMAT_DEFAULT) {
- if (fps_d != 0) {
- *dest_value = gst_util_uint64_scale (src_value,
- fps_n, GST_SECOND * fps_d);
- } else {
- GST_ERROR ("framerate denominator is 0");
- *dest_value = 0;
- }
- ret = TRUE;
- goto done;
- }
-
- /* frames to time */
- if (src_format == GST_FORMAT_DEFAULT && dest_format == GST_FORMAT_TIME) {
- if (fps_n != 0) {
- *dest_value = gst_util_uint64_scale (src_value,
- GST_SECOND * fps_d, fps_n);
- } else {
- GST_ERROR ("framerate numerator is 0");
- *dest_value = 0;
- }
- ret = TRUE;
- goto done;
- }
-
- /* time to bytes */
- if (src_format == GST_FORMAT_TIME && dest_format == GST_FORMAT_BYTES) {
- if (fps_d != 0) {
- *dest_value = gst_util_uint64_scale (src_value,
- fps_n * size, GST_SECOND * fps_d);
- } else {
- GST_ERROR ("framerate denominator is 0");
- *dest_value = 0;
- }
- ret = TRUE;
- goto done;
- }
-
- /* bytes to time */
- if (src_format == GST_FORMAT_BYTES && dest_format == GST_FORMAT_TIME) {
- if (fps_n != 0 && size != 0) {
- *dest_value = gst_util_uint64_scale (src_value,
- GST_SECOND * fps_d, fps_n * size);
- } else {
- GST_ERROR ("framerate denominator and/or blocksize is 0");
- *dest_value = 0;
- }
- ret = TRUE;
- }
-
-done:
-
- GST_DEBUG ("ret=%d result %" G_GINT64_FORMAT, ret, *dest_value);
-
- return ret;
-}
-
-#define GST_VIDEO_EVENT_STILL_STATE_NAME "GstEventStillFrame"
-
-/**
- * gst_video_event_new_still_frame:
- * @in_still: boolean value for the still-frame state of the event.
- *
- * Creates a new Still Frame event. If @in_still is %TRUE, then the event
- * represents the start of a still frame sequence. If it is %FALSE, then
- * the event ends a still frame sequence.
- *
- * To parse an event created by gst_video_event_new_still_frame() use
- * gst_video_event_parse_still_frame().
- *
- * Returns: The new GstEvent
- * Since: 0.10.26
- */
-GstEvent *
-gst_video_event_new_still_frame (gboolean in_still)
-{
- GstEvent *still_event;
- GstStructure *s;
-
- s = gst_structure_new (GST_VIDEO_EVENT_STILL_STATE_NAME,
- "still-state", G_TYPE_BOOLEAN, in_still, NULL);
- still_event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, s);
-
- return still_event;
-}
-
-/**
- * gst_video_event_parse_still_frame:
- * @event: A #GstEvent to parse
- * @in_still: A boolean to receive the still-frame status from the event, or NULL
- *
- * Parse a #GstEvent, identify if it is a Still Frame event, and
- * return the still-frame state from the event if it is.
- * If the event represents the start of a still frame, the in_still
- * variable will be set to TRUE, otherwise FALSE. It is OK to pass NULL for the
- * in_still variable order to just check whether the event is a valid still-frame
- * event.
- *
- * Create a still frame event using gst_video_event_new_still_frame()
- *
- * Returns: %TRUE if the event is a valid still-frame event. %FALSE if not
- * Since: 0.10.26
- */
-gboolean
-gst_video_event_parse_still_frame (GstEvent * event, gboolean * in_still)
-{
- const GstStructure *s;
- gboolean ev_still_state;
-
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GST_EVENT_TYPE (event) != GST_EVENT_CUSTOM_DOWNSTREAM)
- return FALSE; /* Not a still frame event */
-
- s = gst_event_get_structure (event);
- if (s == NULL
- || !gst_structure_has_name (s, GST_VIDEO_EVENT_STILL_STATE_NAME))
- return FALSE; /* Not a still frame event */
- if (!gst_structure_get_boolean (s, "still-state", &ev_still_state))
- return FALSE; /* Not a still frame event */
- if (in_still)
- *in_still = ev_still_state;
- return TRUE;
-}
diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h
deleted file mode 100644
index 20946dc6..00000000
--- a/gst-libs/gst/video/video.h
+++ /dev/null
@@ -1,325 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Library <2002> Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_VIDEO_H__
-#define __GST_VIDEO_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#include <gst/video/video-enumtypes.h>
-
-/**
- * GstVideoFormat:
- * @GST_VIDEO_FORMAT_UNKNOWN: Unknown or unset video format id
- * @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_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
- * @GST_VIDEO_FORMAT_BGR: reverse rgb
- * @GST_VIDEO_FORMAT_Y41B: planar 4:1:1 YUV (Since: 0.10.18)
- * @GST_VIDEO_FORMAT_Y42B: planar 4:2:2 YUV (Since: 0.10.18)
- * @GST_VIDEO_FORMAT_YVYU: packed 4:2:2 YUV (Y0-V0-Y1-U0 Y2-V2-Y3-U2 Y4 ...) (Since: 0.10.23)
- * @GST_VIDEO_FORMAT_Y444: planar 4:4:4 YUV (Since: 0.10.24)
- * @GST_VIDEO_FORMAT_v210: packed 4:2:2 10-bit YUV, complex format (Since: 0.10.24)
- * @GST_VIDEO_FORMAT_v216: packed 4:2:2 16-bit YUV, Y0-U0-Y1-V1 order (Since: 0.10.24)
- * @GST_VIDEO_FORMAT_NV12: planar 4:2:0 YUV with interleaved UV plane (Since: 0.10.26)
- * @GST_VIDEO_FORMAT_NV21: planar 4:2:0 YUV with interleaved VU plane (Since: 0.10.26)
- *
- * Enum value describing the most common video formats.
- */
-typedef enum {
- GST_VIDEO_FORMAT_UNKNOWN,
- 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
-} GstVideoFormat;
-
-#define GST_VIDEO_BYTE1_MASK_32 "0xFF000000"
-#define GST_VIDEO_BYTE2_MASK_32 "0x00FF0000"
-#define GST_VIDEO_BYTE3_MASK_32 "0x0000FF00"
-#define GST_VIDEO_BYTE4_MASK_32 "0x000000FF"
-
-#define GST_VIDEO_BYTE1_MASK_24 "0x00FF0000"
-#define GST_VIDEO_BYTE2_MASK_24 "0x0000FF00"
-#define GST_VIDEO_BYTE3_MASK_24 "0x000000FF"
-
-#define GST_VIDEO_BYTE1_MASK_32_INT 0xFF000000
-#define GST_VIDEO_BYTE2_MASK_32_INT 0x00FF0000
-#define GST_VIDEO_BYTE3_MASK_32_INT 0x0000FF00
-#define GST_VIDEO_BYTE4_MASK_32_INT 0x000000FF
-
-#define GST_VIDEO_BYTE1_MASK_24_INT 0x00FF0000
-#define GST_VIDEO_BYTE2_MASK_24_INT 0x0000FF00
-#define GST_VIDEO_BYTE3_MASK_24_INT 0x000000FF
-
-#define GST_VIDEO_RED_MASK_16 "0xf800"
-#define GST_VIDEO_GREEN_MASK_16 "0x07e0"
-#define GST_VIDEO_BLUE_MASK_16 "0x001f"
-
-#define GST_VIDEO_RED_MASK_15 "0x7c00"
-#define GST_VIDEO_GREEN_MASK_15 "0x03e0"
-#define GST_VIDEO_BLUE_MASK_15 "0x001f"
-
-#define GST_VIDEO_RED_MASK_16_INT 0xf800
-#define GST_VIDEO_GREEN_MASK_16_INT 0x07e0
-#define GST_VIDEO_BLUE_MASK_16_INT 0x001f
-
-#define GST_VIDEO_RED_MASK_15_INT 0x7c00
-#define GST_VIDEO_GREEN_MASK_15_INT 0x03e0
-#define GST_VIDEO_BLUE_MASK_15_INT 0x001f
-
-#define GST_VIDEO_SIZE_RANGE "(int) [ 1, max ]"
-#define GST_VIDEO_FPS_RANGE "(fraction) [ 0, max ]"
-
-/* consider the next 2 protected */
-#define __GST_VIDEO_CAPS_MAKE_32A(R, G, B, A) \
- "video/x-raw-rgb, " \
- "bpp = (int) 32, " \
- "depth = (int) 32, " \
- "endianness = (int) BIG_ENDIAN, " \
- "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", " \
- "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", " \
- "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", " \
- "alpha_mask = (int) " GST_VIDEO_BYTE ## A ## _MASK_32 ", " \
- "width = " GST_VIDEO_SIZE_RANGE ", " \
- "height = " GST_VIDEO_SIZE_RANGE ", " \
- "framerate = " GST_VIDEO_FPS_RANGE
-
-#define __GST_VIDEO_CAPS_MAKE_32(R, G, B) \
- "video/x-raw-rgb, " \
- "bpp = (int) 32, " \
- "depth = (int) 24, " \
- "endianness = (int) BIG_ENDIAN, " \
- "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_32 ", " \
- "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_32 ", " \
- "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_32 ", " \
- "width = " GST_VIDEO_SIZE_RANGE ", " \
- "height = " GST_VIDEO_SIZE_RANGE ", " \
- "framerate = " GST_VIDEO_FPS_RANGE
-
-#define __GST_VIDEO_CAPS_MAKE_24(R, G, B) \
- "video/x-raw-rgb, " \
- "bpp = (int) 24, " \
- "depth = (int) 24, " \
- "endianness = (int) BIG_ENDIAN, " \
- "red_mask = (int) " GST_VIDEO_BYTE ## R ## _MASK_24 ", " \
- "green_mask = (int) " GST_VIDEO_BYTE ## G ## _MASK_24 ", " \
- "blue_mask = (int) " GST_VIDEO_BYTE ## B ## _MASK_24 ", " \
- "width = " GST_VIDEO_SIZE_RANGE ", " \
- "height = " GST_VIDEO_SIZE_RANGE ", " \
- "framerate = " GST_VIDEO_FPS_RANGE
-
-
-/* 24 bit */
-
-#define GST_VIDEO_CAPS_RGB \
- __GST_VIDEO_CAPS_MAKE_24 (1, 2, 3)
-
-#define GST_VIDEO_CAPS_BGR \
- __GST_VIDEO_CAPS_MAKE_24 (3, 2, 1)
-
-/* 32 bit */
-
-#define GST_VIDEO_CAPS_RGBx \
- __GST_VIDEO_CAPS_MAKE_32 (1, 2, 3)
-
-#define GST_VIDEO_CAPS_xRGB \
- __GST_VIDEO_CAPS_MAKE_32 (2, 3, 4)
-
-#define GST_VIDEO_CAPS_BGRx \
- __GST_VIDEO_CAPS_MAKE_32 (3, 2, 1)
-
-#define GST_VIDEO_CAPS_xBGR \
- __GST_VIDEO_CAPS_MAKE_32 (4, 3, 2)
-
-/* 32 bit alpha */
-
-#define GST_VIDEO_CAPS_RGBA \
- __GST_VIDEO_CAPS_MAKE_32A (1, 2, 3, 4)
-
-#define GST_VIDEO_CAPS_ARGB \
- __GST_VIDEO_CAPS_MAKE_32A (2, 3, 4, 1)
-
-#define GST_VIDEO_CAPS_BGRA \
- __GST_VIDEO_CAPS_MAKE_32A (3, 2, 1, 4)
-
-#define GST_VIDEO_CAPS_ABGR \
- __GST_VIDEO_CAPS_MAKE_32A (4, 3, 2, 1)
-
-/* note: the macro name uses the order on BE systems */
-#if G_BYTE_ORDER == G_BIG_ENDIAN
- #define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \
- GST_VIDEO_CAPS_xRGB
- #define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \
- GST_VIDEO_CAPS_BGRx
-#else
- #define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \
- GST_VIDEO_CAPS_BGRx
- #define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \
- GST_VIDEO_CAPS_xRGB
-#endif
-
-/* 15/16 bit */
-
-#define GST_VIDEO_CAPS_RGB_16 \
- "video/x-raw-rgb, " \
- "bpp = (int) 16, " \
- "depth = (int) 16, " \
- "endianness = (int) BYTE_ORDER, " \
- "red_mask = (int) " GST_VIDEO_RED_MASK_16 ", " \
- "green_mask = (int) " GST_VIDEO_GREEN_MASK_16 ", " \
- "blue_mask = (int) " GST_VIDEO_BLUE_MASK_16 ", " \
- "width = " GST_VIDEO_SIZE_RANGE ", " \
- "height = " GST_VIDEO_SIZE_RANGE ", " \
- "framerate = " GST_VIDEO_FPS_RANGE
-
-#define GST_VIDEO_CAPS_RGB_15 \
- "video/x-raw-rgb, " \
- "bpp = (int) 16, " \
- "depth = (int) 15, " \
- "endianness = (int) BYTE_ORDER, " \
- "red_mask = (int) " GST_VIDEO_RED_MASK_15 ", " \
- "green_mask = (int) " GST_VIDEO_GREEN_MASK_15 ", " \
- "blue_mask = (int) " GST_VIDEO_BLUE_MASK_15 ", " \
- "width = " GST_VIDEO_SIZE_RANGE ", " \
- "height = " GST_VIDEO_SIZE_RANGE ", " \
- "framerate = " GST_VIDEO_FPS_RANGE
-
-#define GST_VIDEO_CAPS_YUV(fourcc) \
- "video/x-raw-yuv, " \
- "format = (fourcc) " fourcc ", " \
- "width = " GST_VIDEO_SIZE_RANGE ", " \
- "height = " GST_VIDEO_SIZE_RANGE ", " \
- "framerate = " GST_VIDEO_FPS_RANGE
-
-/* buffer flags */
-
-/**
- * GST_VIDEO_BUFFER_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.
- *
- * Since: 0.10.23
- */
-#define GST_VIDEO_BUFFER_TFF GST_BUFFER_FLAG_MEDIA1
-
-/**
- * GST_VIDEO_BUFFER_RFF:
- *
- * If the #GstBuffer is interlaced, then the first field (as defined by the
- * %GST_VIDEO_BUFFER_TFF flag setting) is repeated.
- *
- * Since: 0.10.23
- */
-#define GST_VIDEO_BUFFER_RFF GST_BUFFER_FLAG_MEDIA2
-
-/**
- * GST_VIDEO_BUFFER_ONEFIELD:
- *
- * If the #GstBuffer is interlaced, then only the first field (as defined by the
- * %GST_VIDEO_BUFFER_TFF flag setting) is to be displayed.
- *
- * Since: 0.10.23
- */
-#define GST_VIDEO_BUFFER_ONEFIELD GST_BUFFER_FLAG_MEDIA3
-
-/* functions */
-const GValue *gst_video_frame_rate (GstPad *pad);
-gboolean gst_video_get_size (GstPad *pad,
- gint *width,
- gint *height);
-
-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);
-
-gboolean gst_video_format_parse_caps (GstCaps *caps, GstVideoFormat *format,
- int *width, int *height);
-gboolean gst_video_format_parse_caps_interlaced (GstCaps *caps, gboolean *interlaced);
-gboolean gst_video_parse_caps_framerate (GstCaps *caps,
- int *fps_n, int *fps_d);
-gboolean gst_video_parse_caps_pixel_aspect_ratio (GstCaps *caps,
- int *par_n, int *par_d);
-GstCaps * gst_video_format_new_caps (GstVideoFormat format,
- int width, int height, int framerate_n, int framerate_d,
- int par_n, int par_d);
-GstCaps * gst_video_format_new_caps_interlaced (GstVideoFormat format,
- int width, int height, int framerate_n, int framerate_d,
- int par_n, int par_d, gboolean interlaced);
-GstVideoFormat gst_video_format_from_fourcc (guint32 fourcc);
-guint32 gst_video_format_to_fourcc (GstVideoFormat format);
-gboolean gst_video_format_is_rgb (GstVideoFormat format);
-gboolean gst_video_format_is_yuv (GstVideoFormat format);
-gboolean gst_video_format_has_alpha (GstVideoFormat format);
-int gst_video_format_get_row_stride (GstVideoFormat format, int component,
- int width);
-int gst_video_format_get_pixel_stride (GstVideoFormat format, int component);
-int gst_video_format_get_component_width (GstVideoFormat format, int component,
- int width);
-int gst_video_format_get_component_height (GstVideoFormat format, int component,
- int height);
-int gst_video_format_get_component_offset (GstVideoFormat format, int component,
- int width, int height);
-int gst_video_format_get_size (GstVideoFormat format, int width, int height);
-gboolean gst_video_format_convert (GstVideoFormat format, int width, int height,
- int fps_n, int fps_d,
- GstFormat src_format, gint64 src_value,
- GstFormat dest_format, gint64 * dest_value);
-
-GstEvent *gst_video_event_new_still_frame (gboolean in_still);
-gboolean gst_video_event_parse_still_frame (GstEvent *event, gboolean *in_still);
-
-G_END_DECLS
-
-#endif /* __GST_VIDEO_H__ */
diff --git a/gst-libs/gst/video/video.vcproj b/gst-libs/gst/video/video.vcproj
deleted file mode 100644
index 24402944..00000000
--- a/gst-libs/gst/video/video.vcproj
+++ /dev/null
@@ -1,150 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="video"
- ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D6789D}"
- RootNamespace="video"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../../win32/Debug"
- IntermediateDirectory="../../../win32/Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstvideo.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../../gstreamer/win32/Debug;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/video.pdb"
- SubSystem="2"
- OptimizeReferences="2"
- ImportLibrary="$(OutDir)/gstvideo.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../../win32/Release"
- IntermediateDirectory="../../../win32/Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstvideo.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../../gstreamer/win32/Release;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/gstvideo.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath=".\gstvideosink.c">
- </File>
- <File
- RelativePath=".\video.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- <File
- RelativePath=".\video.h">
- </File>
- <File
- RelativePath=".\videosink.h">
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/gst-plugins-base.doap b/gst-plugins-base.doap
deleted file mode 100644
index 5497e9ae..00000000
--- a/gst-plugins-base.doap
+++ /dev/null
@@ -1,335 +0,0 @@
-<Project
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
- xmlns="http://usefulinc.com/ns/doap#"
- xmlns:foaf="http://xmlns.com/foaf/0.1/"
- xmlns:admin="http://webns.net/mvcb/">
-
- <name>GStreamer Base Plug-ins</name>
- <shortname>gst-plugins-base</shortname>
- <homepage rdf:resource="http://gstreamer.freedesktop.org/modules/gst-plugins-base.html" />
- <created>2005-06-17</created>
- <shortdesc xml:lang="en">
-a basic collection of elements
- </shortdesc>
- <description xml:lang="en">
-GStreamer Base Plug-ins is a well-groomed and well-maintained collection of
-GStreamer plug-ins and elements, spanning the range of possible types of
-elements one would want to write for GStreamer. It also contains helper
-libraries and base classes useful for writing elements.
-A wide range of video and audio decoders, encoders, and filters are included.
-</description>
- <category></category>
- <bug-database rdf:resource="http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer&amp;component=gst-plugins-base" />
- <screenshots></screenshots>
- <mailing-list rdf:resource="http://lists.sourceforge.net/lists/listinfo/gstreamer-devel/" />
- <programming-language>C</programming-language>
- <license rdf:resource="http://usefulinc.com/doap/licenses/lgpl"/>
- <download-page rdf:resource="http://gstreamer.freedesktop.org/download/" />
-
- <repository>
- <CVSRepository>
- <anon-root>:pserver:anonymous@cvs.freedesktop.org:/cvs/gstreamer</anon-root>
- <module>gst-plugins-base</module>
- <browse rdf:resource="http://webcvs.freedesktop.org/gstreamer/gst-plugins-base/" />
- </CVSRepository>
- </repository>
-
- <release>
- <Version>
- <revision>0.10.26</revision>
- <branch>0.10</branch>
- <name>You will know when you get there</name>
- <created>2010-02-10</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.26.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.26.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.25</revision>
- <branch>0.10</branch>
- <name>Standard disclaimers apply</name>
- <created>2009-10-05</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.25.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.25.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.24</revision>
- <branch>0.10</branch>
- <name>Counting the days</name>
- <created>2009-08-04</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.24.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.24.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.23</revision>
- <branch>0.10</branch>
- <name>Emergency de-stress call</name>
- <created>2009-05-10</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.23.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.23.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.22</revision>
- <branch>0.10</branch>
- <name>Hidey Hidey Hidey Ho</name>
- <created>2009-01-19</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.22.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.22.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.21</revision>
- <branch>0.10</branch>
- <name>We Could Be Wrong</name>
- <created>2008-10-02</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.21.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.21.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.20</revision>
- <branch>0.10</branch>
- <name>Here I Go Again</name>
- <created>2008-06-18</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.20.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.20.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.19</revision>
- <branch>0.10</branch>
- <name>Good Times</name>
- <created>2008-04-04</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.19.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.19.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.18</revision>
- <branch>0.10</branch>
- <name>I will follow</name>
- <created>2008-03-21</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.18.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.18.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.17</revision>
- <branch>0.10</branch>
- <name>Peanut Butter and Jelly</name>
- <created>2008-01-30</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.17.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.17.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.16</revision>
- <branch>0.10</branch>
- <name>Scheduled Interruption</name>
- <created>2008-01-28</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.16.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.16.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.15</revision>
- <branch>0.10</branch>
- <name>No need to argue</name>
- <created>2007-11-15</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.15.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.15.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.14</revision>
- <branch>0.10</branch>
- <name>Light Years Ahead</name>
- <created>2007-08-03</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.14.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.14.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.13</revision>
- <branch>0.10</branch>
- <name>What's going on?</name>
- <created>2007-06-05</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.13.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.13.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.12</revision>
- <branch>0.10</branch>
- <name>Zombie Horde</name>
- <created>2007-03-07</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.12.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.12.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.11</revision>
- <branch>0.10</branch>
- <name>Dumb things</name>
- <created>2006-12-06</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.11.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.11.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.10</revision>
- <branch>0.10</branch>
- <name>Chorizo</name>
- <created>2006-09-14</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.10.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.10.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.9</revision>
- <branch>0.10</branch>
- <name>I walk the line</name>
- <created>2006-07-14</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.9.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.9.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.8</revision>
- <branch>0.10</branch>
- <name>Moar gij zie mij nie</name>
- <created>2006-06-10</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.8.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.8.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.7</revision>
- <branch>0.10</branch>
- <name>Leave the gun</name>
- <created>2006-05-14</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.7.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.7.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.6</revision>
- <branch>0.10</branch>
- <name>Chao</name>
- <created>2006-04-28</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.6.tar.bz2" />
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.6.tar.gz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.5</revision>
- <branch>0.10</branch>
- <name>Net</name>
- <created>2006-03-13</created>
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.4</revision>
- <branch>0.10</branch>
- <name>Power</name>
- <created>2006-03-10</created>
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.3</revision>
- <branch>0.10</branch>
- <name>Under Pressure</name>
- <created>2006-02-09</created>
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.2</revision>
- <branch>0.10</branch>
- <name>Then the devil is six</name>
- <created>2006-01-16</created>
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.1</revision>
- <branch>0.10</branch>
- <name>Dobro Dedek</name>
- <created>2005-12-23</created>
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>0.10.0</revision>
- <branch>0.10</branch>
- <name>Mont-d'or</name>
- <created>2005-12-05</created>
- </Version>
- </release>
-
- <maintainer>
- <foaf:Person>
- <foaf:name>Wim Taymans</foaf:name>
- <foaf:mbox_sha1sum>0d93fde052812d51a05fd86de9bdbf674423daa2</foaf:mbox_sha1sum>
- </foaf:Person>
- </maintainer>
- <maintainer>
- <foaf:Person>
- <foaf:name>Thomas Vander Stichele</foaf:name>
- </foaf:Person>
- </maintainer>
-
-</Project>
diff --git a/gst-plugins-base.spec.in b/gst-plugins-base.spec.in
deleted file mode 100644
index 0e580348..00000000
--- a/gst-plugins-base.spec.in
+++ /dev/null
@@ -1,266 +0,0 @@
-%define majorminor @GST_MAJORMINOR@
-%define gstreamer gstreamer
-
-%define gst_minver 0.10.0
-
-Name: %{gstreamer}-plugins-base
-Version: @VERSION@
-Release: @PACKAGE_VERSION_RELEASE@.gst
-Summary: GStreamer streaming media framework plug-ins
-
-Group: Applications/Multimedia
-License: LGPL
-URL: http://gstreamer.freedesktop.org/
-Vendor: GStreamer Backpackers Team <package@gstreamer.freedesktop.org>
-Source: http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
-Requires: %{gstreamer} >= %{gst_minver}
-BuildRequires: %{gstreamer}-devel >= %{gst_minver}
-
-BuildRequires: gcc-c++
-BuildRequires: gtk-doc >= 1.3
-BuildRequires: liboil-devel >= 0.3.14
-Requires: liboil => 0.3.14
-
-@USE_GNOME_VFS_TRUE@Requires: gnome-vfs2 > 1.9.4.00
-@USE_GNOME_VFS_TRUE@BuildRequires: gnome-vfs2-devel > 1.9.4.00
-@USE_VORBIS_TRUE@Requires: libogg >= 1.0
-@USE_VORBIS_TRUE@Requires: libvorbis >= 1.0
-@USE_VORBIS_TRUE@BuildRequires: libogg-devel >= 1.0
-@USE_VORBIS_TRUE@BuildRequires: libvorbis-devel >= 1.0
-@USE_XVIDEO_TRUE@BuildRequires: libXv-devel
-@USE_XVIDEO_TRUE@Requires: libXv-devel
-@USE_ALSA_TRUE@BuildRequires: alsa-lib-devel
-@USE_ALSA_TRUE@Requires: alsa-lib
-@USE_CDPARANOIA_TRUE@BuildRequires: cdparanoia-devel
-@USE_CDPARANOIA_TRUE@Requires: cdparanoia
-@USE_LIBVISUAL_TRUE@BuildRequires: libvisual-devel
-@USE_LIBVISUAL_TRUE@Requires: libvisual
-@USE_PANGO_TRUE@BuildRequires: pango-devel
-@USE_PANGO_TRUE@Requires: pango
-@USE_THEORA_TRUE@BuildRequires: libtheora-devel >= 1.0
-@USE_THEORA_TRUE@Requires: libtheora >= 1.0
-
-%description
-GStreamer is a streaming media framework, based on graphs of filters which
-operate on media data. Applications using this library can do anything
-from real-time sound processing to playing videos, and just about anything
-else media-related. Its plugin-based architecture means that new data
-types or processing capabilities can be added simply by installing new
-plug-ins.
-
-%prep
-%setup -q -n gst-plugins-base-%{version}
-export DOCS_ARE_INCOMPLETE_PLEASE_FIXME=0
-%build
-%configure \
- --enable-gtk-doc --enable-introspection=no
-
-make %{?_smp_mflags}
-
-%install
-rm -rf $RPM_BUILD_ROOT
-
-%makeinstall
-
-# Clean out files that should not be part of the rpm.
-rm -f $RPM_BUILD_ROOT%{_libdir}/gstreamer-%{majorminor}/*.la
-rm -f $RPM_BUILD_ROOT%{_libdir}/gstreamer-%{majorminor}/*.a
-rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
-rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
-
-%find_lang gst-plugins-base-%{majorminor}
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files -f gst-plugins-base-%{majorminor}.lang
-%defattr(-, root, root)
-%doc AUTHORS COPYING README REQUIREMENTS gst-plugins-base.doap
-
-# helper programs
-%{_bindir}/gst-visualise-%{majorminor}
-%{_mandir}/man1/gst-visualise-%{majorminor}*
-
-# libraries
-%{_libdir}/libgstaudio-%{majorminor}.so.*
-%{_libdir}/libgstcdda-%{majorminor}.so*
-%{_libdir}/libgstinterfaces-%{majorminor}.so.*
-%{_libdir}/libgstnetbuffer-%{majorminor}.so*
-%{_libdir}/libgstpbutils-%{majorminor}.so*
-%{_libdir}/libgstriff-%{majorminor}.so.*
-%{_libdir}/libgstrtp-%{majorminor}.so*
-%{_libdir}/libgsttag-%{majorminor}.so.*
-%{_libdir}/libgstvideo-%{majorminor}.so.*
-%{_libdir}/libgstfft-%{majorminor}.so.*
-%{_libdir}/libgstrtsp-%{majorminor}.so.*
-%{_libdir}/libgstsdp-%{majorminor}.so.*
-%{_libdir}/libgstapp-%{majorminor}.so.*
-
-# base plugins without external dependencies
-%{_libdir}/gstreamer-%{majorminor}/libgstadder.so
-%{_libdir}/gstreamer-%{majorminor}/libgstaudioconvert.so
-%{_libdir}/gstreamer-%{majorminor}/libgstffmpegcolorspace.so
-%{_libdir}/gstreamer-%{majorminor}/libgstdecodebin.so
-%{_libdir}/gstreamer-%{majorminor}/libgstdecodebin2.so
-%{_libdir}/gstreamer-%{majorminor}/libgstplaybin.so
-%{_libdir}/gstreamer-%{majorminor}/libgsttypefindfunctions.so
-%{_libdir}/gstreamer-%{majorminor}/libgstvideotestsrc.so
-%{_libdir}/gstreamer-%{majorminor}/libgstaudiorate.so
-%{_libdir}/gstreamer-%{majorminor}/libgstsubparse.so
-%{_libdir}/gstreamer-%{majorminor}/libgstvolume.so
-%{_libdir}/gstreamer-%{majorminor}/libgstvideorate.so
-%{_libdir}/gstreamer-%{majorminor}/libgstvideoscale.so
-%{_libdir}/gstreamer-%{majorminor}/libgsttcp.so
-%{_libdir}/gstreamer-%{majorminor}/libgstvideo4linux.so
-%{_libdir}/gstreamer-%{majorminor}/libgstaudioresample.so
-%{_libdir}/gstreamer-%{majorminor}/libgstaudiotestsrc.so
-%{_libdir}/gstreamer-%{majorminor}/libgstgdp.so
-%{_libdir}/gstreamer-%{majorminor}/libgstapp.so
-
-# Here are packages not in the base plugins package but not dependant
-# on an external lib
-
-# @USE_GST_V4L2_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstvideo4linux2.so
-
-# base plugins with dependencies
-@USE_ALSA_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstalsa.so
-@USE_THEORA_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgsttheora.so
-@USE_GNOME_VFS_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstgnomevfs.so
-@USE_VORBIS_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstvorbis.so
-@USE_VORBIS_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstogg.so
-@USE_XVIDEO_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstximage*.so
-@USE_XVIDEO_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstxvimagesink.so
-@USE_LIBVISUAL_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstlibvisual.so
-@USE_PANGO_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstpango.so
-@USE_CDPARANOIA_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstcdparanoia.so
-@USE_GIO_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstgio.so
-# @USE_SCHRO_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstschro.so
-%package devel
-Summary: GStreamer Plugin Library Headers
-Group: Development/Libraries
-Requires: %{gstreamer}-plugins-base = %{version}
-
-%description devel
-GStreamer Plugins Base library development and header files.
-
-%files devel
-%defattr(-, root, root)
-# plugin helper library headers
-%{_includedir}/gstreamer-%{majorminor}/gst/audio/audio.h
-%{_includedir}/gstreamer-%{majorminor}/gst/audio/gstaudiofilter.h
-%{_includedir}/gstreamer-%{majorminor}/gst/audio/multichannel.h
-%{_includedir}/gstreamer-%{majorminor}/gst/floatcast/floatcast.h
-%{_includedir}/gstreamer-%{majorminor}/gst/riff/riff-ids.h
-%{_includedir}/gstreamer-%{majorminor}/gst/riff/riff-media.h
-%{_includedir}/gstreamer-%{majorminor}/gst/riff/riff-read.h
-%{_includedir}/gstreamer-%{majorminor}/gst/video/video.h
-%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/colorbalance.h
-%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/colorbalancechannel.h
-%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/interfaces-enumtypes.h
-%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/mixer.h
-%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/mixeroptions.h
-%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/mixertrack.h
-%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/navigation.h
-%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/propertyprobe.h
-%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/tuner.h
-%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/tunerchannel.h
-%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/tunernorm.h
-%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/xoverlay.h
-%{_includedir}/gstreamer-%{majorminor}/gst/audio/gstaudiosrc.h
-%{_includedir}/gstreamer-%{majorminor}/gst/audio/gstbaseaudiosrc.h
-%{_includedir}/gstreamer-%{majorminor}/gst/rtp/gstbasertpaudiopayload.h
-%{_includedir}/gstreamer-%{majorminor}/gst/rtp/gstbasertpdepayload.h
-%{_includedir}/gstreamer-%{majorminor}/gst/rtp/gstrtpbuffer.h
-%{_includedir}/gstreamer-%{majorminor}/gst/audio/gstaudioclock.h
-%{_includedir}/gstreamer-%{majorminor}/gst/audio/gstaudiosink.h
-%{_includedir}/gstreamer-%{majorminor}/gst/audio/gstbaseaudiosink.h
-%{_includedir}/gstreamer-%{majorminor}/gst/audio/gstringbuffer.h
-%{_includedir}/gstreamer-%{majorminor}/gst/tag/tag.h
-%{_includedir}/gstreamer-%{majorminor}/gst/rtp/gstbasertppayload.h
-%{_includedir}/gstreamer-%{majorminor}/gst/video/gstvideofilter.h
-%{_includedir}/gstreamer-%{majorminor}/gst/video/gstvideosink.h
-%{_includedir}/gstreamer-%{majorminor}/gst/netbuffer/gstnetbuffer.h
-%{_includedir}/gstreamer-%{majorminor}/gst/cdda/gstcddabasesrc.h
-%{_includedir}/gstreamer-%{majorminor}/gst/audio/mixerutils.h
-%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/videoorientation.h
-%{_includedir}/gstreamer-%{majorminor}/gst/pbutils/descriptions.h
-%{_includedir}/gstreamer-%{majorminor}/gst/pbutils/install-plugins.h
-%{_includedir}/gstreamer-%{majorminor}/gst/pbutils/missing-plugins.h
-%{_includedir}/gstreamer-%{majorminor}/gst/pbutils/pbutils.h
-%{_includedir}/gstreamer-%{majorminor}/gst/rtp/gstrtcpbuffer.h
-%{_includedir}/gstreamer-%{majorminor}/gst/fft/gstfft.h
-%{_includedir}/gstreamer-%{majorminor}/gst/fft/gstfftf32.h
-%{_includedir}/gstreamer-%{majorminor}/gst/fft/gstfftf64.h
-%{_includedir}/gstreamer-%{majorminor}/gst/fft/gstffts16.h
-%{_includedir}/gstreamer-%{majorminor}/gst/fft/gstffts32.h
-%{_includedir}/gstreamer-%{majorminor}/gst/rtsp/gstrtsp-enumtypes.h
-%{_includedir}/gstreamer-%{majorminor}/gst/rtsp/gstrtspbase64.h
-%{_includedir}/gstreamer-%{majorminor}/gst/rtsp/gstrtspconnection.h
-%{_includedir}/gstreamer-%{majorminor}/gst/rtsp/gstrtspdefs.h
-%{_includedir}/gstreamer-%{majorminor}/gst/rtsp/gstrtspextension.h
-%{_includedir}/gstreamer-%{majorminor}/gst/rtsp/gstrtspmessage.h
-%{_includedir}/gstreamer-%{majorminor}/gst/rtsp/gstrtsprange.h
-%{_includedir}/gstreamer-%{majorminor}/gst/rtsp/gstrtsptransport.h
-%{_includedir}/gstreamer-%{majorminor}/gst/rtsp/gstrtspurl.h
-%{_includedir}/gstreamer-%{majorminor}/gst/sdp/gstsdp.h
-%{_includedir}/gstreamer-%{majorminor}/gst/sdp/gstsdpmessage.h
-%{_includedir}/gstreamer-%{majorminor}/gst/rtp/gstrtppayloads.h
-%{_includedir}/gstreamer-%{majorminor}/gst/tag/gsttagdemux.h
-%{_includedir}/gstreamer-%{majorminor}/gst/pbutils/pbutils-enumtypes.h
-%{_includedir}/gstreamer-%{majorminor}/gst/app/gstappbuffer.h
-%{_includedir}/gstreamer-%{majorminor}/gst/app/gstappsink.h
-%{_includedir}/gstreamer-%{majorminor}/gst/app/gstappsrc.h
-%{_includedir}/gstreamer-%{majorminor}/gst/audio/audio-enumtypes.h
-%{_includedir}/gstreamer-%{majorminor}/gst/video/video-enumtypes.h
-%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/streamvolume.h
-
-%{_libdir}/libgstfft-%{majorminor}.so
-%{_libdir}/libgstrtsp-%{majorminor}.so
-%{_libdir}/libgstsdp-%{majorminor}.so
-%{_libdir}/libgstaudio-%{majorminor}.so
-%{_libdir}/libgstriff-%{majorminor}.so
-%{_libdir}/libgsttag-%{majorminor}.so
-%{_libdir}/libgstvideo-%{majorminor}.so
-%{_libdir}/libgstrtp-%{majorminor}.so
-%{_libdir}/libgstinterfaces-%{majorminor}.so
-%{_libdir}/libgstnetbuffer-%{majorminor}.so
-%{_libdir}/libgstpbutils-%{majorminor}.so
-%{_libdir}/libgstcdda-%{majorminor}.so
-%{_libdir}/libgstapp-%{majorminor}.so
-
-# pkg-config files
-%{_libdir}/pkgconfig/gstreamer-plugins-base-%{majorminor}.pc
-%{_libdir}/pkgconfig/gstreamer-audio-%{majorminor}.pc
-%{_libdir}/pkgconfig/gstreamer-cdda-%{majorminor}.pc
-%{_libdir}/pkgconfig/gstreamer-fft-%{majorminor}.pc
-%{_libdir}/pkgconfig/gstreamer-floatcast-%{majorminor}.pc
-%{_libdir}/pkgconfig/gstreamer-interfaces-%{majorminor}.pc
-%{_libdir}/pkgconfig/gstreamer-netbuffer-%{majorminor}.pc
-%{_libdir}/pkgconfig/gstreamer-pbutils-%{majorminor}.pc
-%{_libdir}/pkgconfig/gstreamer-riff-%{majorminor}.pc
-%{_libdir}/pkgconfig/gstreamer-rtp-%{majorminor}.pc
-%{_libdir}/pkgconfig/gstreamer-rtsp-%{majorminor}.pc
-%{_libdir}/pkgconfig/gstreamer-sdp-%{majorminor}.pc
-%{_libdir}/pkgconfig/gstreamer-tag-%{majorminor}.pc
-%{_libdir}/pkgconfig/gstreamer-video-%{majorminor}.pc
-%{_libdir}/pkgconfig/gstreamer-app-%{majorminor}.pc
-
-# gtk-doc documentation
-%doc %{_datadir}/gtk-doc/html/gst-plugins-base-libs-%{majorminor}
-%doc %{_datadir}/gtk-doc/html/gst-plugins-base-plugins-%{majorminor}
-
-%changelog
-* Fri Dec 15 2006 Thomas Vander Stichele <thomas at apestaart dot org>
-- add doap file
-- cleanups
-
-* Fri Sep 02 2005 Thomas Vander Stichele <thomas at apestaart dot org>
-- clean up a little
-
-* Fri May 6 2005 Christian Schaller <christian at fluendo dot com>
-- Added libgstaudiorate and libgstsubparse to spec file
-
-* Thu May 5 2005 Christian Schaller <christian at fluendo dot com>
-- first attempt at spec file for gst-plugins-base
diff --git a/gst-plugins-xvbo.spec.in b/gst-plugins-xvbo.spec.in
new file mode 100644
index 00000000..29d87975
--- /dev/null
+++ b/gst-plugins-xvbo.spec.in
@@ -0,0 +1,85 @@
+%define majorminor @GST_MAJORMINOR@
+%define gstreamer gstreamer
+
+%define gst_minver 0.10.0
+
+Name: %{gstreamer}-plugins-xvbo
+Version: @VERSION@
+Release: @PACKAGE_VERSION_RELEASE@.gst
+Summary: GStreamer streaming media framework plug-ins
+
+Group: Applications/Multimedia
+License: LGPL
+URL: http://gstreamer.freedesktop.org/
+Vendor: GStreamer Backpackers Team <package@gstreamer.freedesktop.org>
+Source: gst-plugins-xvbo-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+Requires: %{gstreamer} >= %{gst_minver}
+BuildRequires: %{gstreamer}-devel >= %{gst_minver}
+
+BuildRequires: gcc-c++
+BuildRequires: gtk-doc >= 1.3
+BuildRequires: libXv-devel
+Requires: libXv
+BuildRequires: libdrm-devel
+Requires: libdrm
+BuildRequires: libbmm-devel >= 2.0.0
+Requires: libbmm
+
+%description
+GStreamer is a streaming media framework, based on graphs of filters which
+operate on media data. Applications using this library can do anything
+from real-time sound processing to playing videos, and just about anything
+else media-related. Its plugin-based architecture means that new data
+types or processing capabilities can be added simply by installing new
+plug-ins.
+
+%prep
+%setup -q -n gst-plugins-xvbo-%{version}
+export DOCS_ARE_INCOMPLETE_PLEASE_FIXME=0
+%build
+%configure \
+ --enable-gtk-doc --enable-introspection=no
+
+make %{?_smp_mflags}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%makeinstall
+
+# Clean out files that should not be part of the rpm.
+rm -f $RPM_BUILD_ROOT%{_libdir}/gstreamer-%{majorminor}/*.la
+rm -f $RPM_BUILD_ROOT%{_libdir}/gstreamer-%{majorminor}/*.a
+rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
+rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
+
+%find_lang gst-plugins-xvbo-%{majorminor}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files -f gst-plugins-xvbo-%{majorminor}.lang
+%defattr(-, root, root)
+%doc AUTHORS COPYING README REQUIREMENTS
+
+# plugins with dependencies
+%{_libdir}/gstreamer-%{majorminor}/libgstxvboimagesink.so
+
+# gtk-doc documentation
+%doc %{_datadir}/gtk-doc/html/gst-plugins-xvbo-%{majorminor}
+
+%changelog
+* Fri Dec 15 2006 Thomas Vander Stichele <thomas at apestaart dot org>
+- add doap file
+- cleanups
+
+* Fri Sep 02 2005 Thomas Vander Stichele <thomas at apestaart dot org>
+- clean up a little
+
+* Fri May 6 2005 Christian Schaller <christian at fluendo dot com>
+- Added libgstaudiorate and libgstsubparse to spec file
+
+* Thu May 5 2005 Christian Schaller <christian at fluendo dot com>
+- first attempt at spec file for gst-plugins-base
diff --git a/gst/Makefile.am b/gst/Makefile.am
deleted file mode 100644
index 93522195..00000000
--- a/gst/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-SUBDIRS = $(GST_PLUGINS_SELECTED)
-DIST_SUBDIRS = $(GST_PLUGINS_ALL)
diff --git a/gst/adder/.gitignore b/gst/adder/.gitignore
deleted file mode 100644
index 08f5ed37..00000000
--- a/gst/adder/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-Makefile
-Makefile.in
-*.o
-*.lo
-*.la
-.deps
-.libs
diff --git a/gst/adder/Makefile.am b/gst/adder/Makefile.am
deleted file mode 100644
index 7ec0a40e..00000000
--- a/gst/adder/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-plugin_LTLIBRARIES = libgstadder.la
-
-libgstadder_la_SOURCES = gstadder.c
-libgstadder_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
-#$(LIBOIL_CFLAGS)
-libgstadder_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstadder_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
- $(GST_BASE_LIBS) $(GST_LIBS)
-#$(LIBOIL_LIBS)
-libgstadder_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = gstadder.h
diff --git a/gst/adder/adder.vcproj b/gst/adder/adder.vcproj
deleted file mode 100644
index b2f193fa..00000000
--- a/gst/adder/adder.vcproj
+++ /dev/null
@@ -1,148 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="adder"
- ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D678A1}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../win32/Debug"
- IntermediateDirectory="../../win32/Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;adder_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstadder.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Debug;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/adder.pdb"
- SubSystem="2"
- OptimizeReferences="2"
- ImportLibrary="$(OutDir)/gstadder.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../win32/Release"
- IntermediateDirectory="../../win32/Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;adder_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstadder.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Release;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/gstadder.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath=".\gstadder.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- <File
- RelativePath=".\gstadder.h">
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/gst/adder/gstadder.c b/gst/adder/gstadder.c
deleted file mode 100644
index 8d0b300f..00000000
--- a/gst/adder/gstadder.c
+++ /dev/null
@@ -1,1327 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2001 Thomas <thomas@apestaart.org>
- * 2005,2006 Wim Taymans <wim@fluendo.com>
- *
- * adder.c: Adder element, N in, one out, samples are added
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-/**
- * SECTION:element-adder
- *
- * The adder allows to mix several streams into one by adding the data.
- * Mixed data is clamped to the min/max values of the data format.
- *
- * The adder currently mixes all data received on the sinkpads as soon as
- * possible without trying to synchronize the streams.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch audiotestsrc freq=100 ! adder name=mix ! audioconvert ! alsasink audiotestsrc freq=500 ! mix.
- * ]| This pipeline produces two sine waves mixed together.
- * </refsect2>
- *
- * Last reviewed on 2006-05-09 (0.10.7)
- */
-/* Element-Checklist-Version: 5 */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "gstadder.h"
-#include <gst/audio/audio.h>
-#include <string.h> /* strcmp */
-/*#include <liboil/liboil.h>*/
-
-/* highest positive/lowest negative x-bit value we can use for clamping */
-#define MAX_INT_32 ((gint32) (0x7fffffff))
-#define MAX_INT_16 ((gint16) (0x7fff))
-#define MAX_INT_8 ((gint8) (0x7f))
-#define MAX_UINT_32 ((guint32)(0xffffffff))
-#define MAX_UINT_16 ((guint16)(0xffff))
-#define MAX_UINT_8 ((guint8) (0xff))
-
-#define MIN_INT_32 ((gint32) (0x80000000))
-#define MIN_INT_16 ((gint16) (0x8000))
-#define MIN_INT_8 ((gint8) (0x80))
-#define MIN_UINT_32 ((guint32)(0x00000000))
-#define MIN_UINT_16 ((guint16)(0x0000))
-#define MIN_UINT_8 ((guint8) (0x00))
-
-enum
-{
- PROP_0,
- PROP_FILTER_CAPS
-};
-
-#define GST_CAT_DEFAULT gst_adder_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-/* elementfactory information */
-
-#define CAPS \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 32, " \
- "depth = (int) 32, " \
- "signed = (boolean) { true, false } ;" \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 16, " \
- "depth = (int) 16, " \
- "signed = (boolean) { true, false } ;" \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 8, " \
- "depth = (int) 8, " \
- "signed = (boolean) { true, false } ;" \
- "audio/x-raw-float, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) { 32, 64 }"
-
-static GstStaticPadTemplate gst_adder_src_template =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (CAPS)
- );
-
-static GstStaticPadTemplate gst_adder_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink%d",
- GST_PAD_SINK,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS (CAPS)
- );
-
-static void gst_adder_class_init (GstAdderClass * klass);
-static void gst_adder_init (GstAdder * adder);
-static void gst_adder_dispose (GObject * object);
-static void gst_adder_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_adder_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static gboolean gst_adder_setcaps (GstPad * pad, GstCaps * caps);
-static gboolean gst_adder_query (GstPad * pad, GstQuery * query);
-static gboolean gst_adder_src_event (GstPad * pad, GstEvent * event);
-static gboolean gst_adder_sink_event (GstPad * pad, GstEvent * event);
-
-static GstPad *gst_adder_request_new_pad (GstElement * element,
- GstPadTemplate * temp, const gchar * unused);
-static void gst_adder_release_pad (GstElement * element, GstPad * pad);
-
-static GstStateChangeReturn gst_adder_change_state (GstElement * element,
- GstStateChange transition);
-
-static GstBuffer *gst_adder_do_clip (GstCollectPads * pads,
- GstCollectData * data, GstBuffer * buffer, gpointer user_data);
-static GstFlowReturn gst_adder_collected (GstCollectPads * pads,
- gpointer user_data);
-
-static GstElementClass *parent_class = NULL;
-
-GType
-gst_adder_get_type (void)
-{
- static GType adder_type = 0;
-
- if (G_UNLIKELY (adder_type == 0)) {
- static const GTypeInfo adder_info = {
- sizeof (GstAdderClass), NULL, NULL,
- (GClassInitFunc) gst_adder_class_init, NULL, NULL,
- sizeof (GstAdder), 0,
- (GInstanceInitFunc) gst_adder_init,
- };
-
- adder_type = g_type_register_static (GST_TYPE_ELEMENT, "GstAdder",
- &adder_info, 0);
- GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "adder", 0,
- "audio channel mixing element");
- }
- return adder_type;
-}
-
-/* clipping versions (for int)
- * FIXME: what about: oil_add_s16 (out, out, in, bytes / sizeof (type))
- */
-#define MAKE_FUNC(name,type,ttype,min,max) \
-static void name (type *out, type *in, gint bytes) { \
- gint i; \
- ttype add; \
- for (i = 0; i < bytes / sizeof (type); i++) { \
- add = (ttype)out[i] + (ttype)in[i]; \
- out[i] = CLAMP (add, min, max); \
- } \
-}
-
-/* unsigned versions (for int) */
-#define MAKE_FUNC_US(name,type,ttype,max) \
-static void name (type *out, type *in, gint bytes) { \
- gint i; \
- ttype add; \
- for (i = 0; i < bytes / sizeof (type); i++) { \
- add = (ttype)out[i] + (ttype)in[i]; \
- out[i] = ((add <= max) ? add : max); \
- } \
-}
-
-/* non-clipping versions (for float) */
-#define MAKE_FUNC_NC(name,type) \
-static void name (type *out, type *in, gint bytes) { \
- gint i; \
- for (i = 0; i < bytes / sizeof (type); i++) \
- out[i] += in[i]; \
-}
-
-#if 0
-/* right now, the liboil function don't seems to be faster on x86
- * time gst-launch audiotestsrc num-buffers=50000 ! audio/x-raw-float ! adder name=m ! fakesink audiotestsrc num-buffers=50000 ! audio/x-raw-float ! m.
- * time gst-launch audiotestsrc num-buffers=50000 ! audio/x-raw-float,width=32 ! adder name=m ! fakesink audiotestsrc num-buffers=50000 ! audio/x-raw-float,width=32 ! m.
- */
-static void
-add_float32 (gfloat * out, gfloat * in, gint bytes)
-{
- oil_add_f32 (out, out, in, bytes / sizeof (gfloat));
-}
-
-static void
-add_float64 (gdouble * out, gdouble * in, gint bytes)
-{
- oil_add_f64 (out, out, in, bytes / sizeof (gdouble));
-}
-#endif
-
-/* *INDENT-OFF* */
-MAKE_FUNC (add_int32, gint32, gint64, MIN_INT_32, MAX_INT_32)
-MAKE_FUNC (add_int16, gint16, gint32, MIN_INT_16, MAX_INT_16)
-MAKE_FUNC (add_int8, gint8, gint16, MIN_INT_8, MAX_INT_8)
-MAKE_FUNC_US (add_uint32, guint32, guint64, MAX_UINT_32)
-MAKE_FUNC_US (add_uint16, guint16, guint32, MAX_UINT_16)
-MAKE_FUNC_US (add_uint8, guint8, guint16, MAX_UINT_8)
-MAKE_FUNC_NC (add_float64, gdouble)
-MAKE_FUNC_NC (add_float32, gfloat)
-/* *INDENT-ON* */
-
-/* we can only accept caps that we and downstream can handle.
- * if we have filtercaps set, use those to constrain the target caps.
- */
-static GstCaps *
-gst_adder_sink_getcaps (GstPad * pad)
-{
- GstAdder *adder;
- GstCaps *result, *peercaps, *sinkcaps, *filter_caps;
-
- adder = GST_ADDER (GST_PAD_PARENT (pad));
-
- GST_OBJECT_LOCK (adder);
- /* take filter */
- if ((filter_caps = adder->filter_caps))
- gst_caps_ref (filter_caps);
- GST_OBJECT_UNLOCK (adder);
-
- /* get the downstream possible caps */
- peercaps = gst_pad_peer_get_caps (adder->srcpad);
-
- /* get the allowed caps on this sinkpad, we use the fixed caps function so
- * that it does not call recursively in this function. */
- sinkcaps = gst_pad_get_fixed_caps_func (pad);
- if (peercaps) {
- /* restrict with filter-caps if any */
- if (filter_caps) {
- GST_DEBUG_OBJECT (adder, "filtering peer caps");
- result = gst_caps_intersect (peercaps, filter_caps);
- gst_caps_unref (peercaps);
- peercaps = result;
- }
- /* if the peer has caps, intersect */
- GST_DEBUG_OBJECT (adder, "intersecting peer and template caps");
- result = gst_caps_intersect (peercaps, sinkcaps);
- gst_caps_unref (peercaps);
- gst_caps_unref (sinkcaps);
- } else {
- /* the peer has no caps (or there is no peer), just use the allowed caps
- * of this sinkpad. */
- /* restrict with filter-caps if any */
- if (filter_caps) {
- GST_DEBUG_OBJECT (adder, "no peer caps, using filtered sinkcaps");
- result = gst_caps_intersect (sinkcaps, filter_caps);
- gst_caps_unref (sinkcaps);
- } else {
- GST_DEBUG_OBJECT (adder, "no peer caps, using sinkcaps");
- result = sinkcaps;
- }
- }
-
- if (filter_caps)
- gst_caps_unref (filter_caps);
-
- GST_LOG_OBJECT (adder, "getting caps on pad %p,%s to %" GST_PTR_FORMAT, pad,
- GST_PAD_NAME (pad), result);
-
- return result;
-}
-
-/* the first caps we receive on any of the sinkpads will define the caps for all
- * the other sinkpads because we can only mix streams with the same caps.
- */
-static gboolean
-gst_adder_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstAdder *adder;
- GList *pads;
- GstStructure *structure;
- const char *media_type;
-
- adder = GST_ADDER (GST_PAD_PARENT (pad));
-
- GST_LOG_OBJECT (adder, "setting caps on pad %p,%s to %" GST_PTR_FORMAT, pad,
- GST_PAD_NAME (pad), caps);
-
- /* FIXME, see if the other pads can accept the format. Also lock the
- * format on the other pads to this new format. */
- GST_OBJECT_LOCK (adder);
- pads = GST_ELEMENT (adder)->pads;
- while (pads) {
- GstPad *otherpad = GST_PAD (pads->data);
-
- if (otherpad != pad) {
- gst_caps_replace (&GST_PAD_CAPS (otherpad), caps);
- }
- pads = g_list_next (pads);
- }
- GST_OBJECT_UNLOCK (adder);
-
- /* parse caps now */
- structure = gst_caps_get_structure (caps, 0);
- media_type = gst_structure_get_name (structure);
- if (strcmp (media_type, "audio/x-raw-int") == 0) {
- adder->format = GST_ADDER_FORMAT_INT;
- gst_structure_get_int (structure, "width", &adder->width);
- gst_structure_get_int (structure, "depth", &adder->depth);
- gst_structure_get_int (structure, "endianness", &adder->endianness);
- gst_structure_get_boolean (structure, "signed", &adder->is_signed);
-
- GST_INFO_OBJECT (pad, "parse_caps sets adder to format int, %d bit",
- adder->width);
-
- if (adder->endianness != G_BYTE_ORDER)
- goto not_supported;
-
- switch (adder->width) {
- case 8:
- adder->func = (adder->is_signed ?
- (GstAdderFunction) add_int8 : (GstAdderFunction) add_uint8);
- break;
- case 16:
- adder->func = (adder->is_signed ?
- (GstAdderFunction) add_int16 : (GstAdderFunction) add_uint16);
- break;
- case 32:
- adder->func = (adder->is_signed ?
- (GstAdderFunction) add_int32 : (GstAdderFunction) add_uint32);
- break;
- default:
- goto not_supported;
- }
- } else if (strcmp (media_type, "audio/x-raw-float") == 0) {
- adder->format = GST_ADDER_FORMAT_FLOAT;
- gst_structure_get_int (structure, "width", &adder->width);
- gst_structure_get_int (structure, "endianness", &adder->endianness);
-
- GST_INFO_OBJECT (pad, "parse_caps sets adder to format float, %d bit",
- adder->width);
-
- if (adder->endianness != G_BYTE_ORDER)
- goto not_supported;
-
- switch (adder->width) {
- case 32:
- adder->func = (GstAdderFunction) add_float32;
- break;
- case 64:
- adder->func = (GstAdderFunction) add_float64;
- break;
- default:
- goto not_supported;
- }
- } else {
- goto not_supported;
- }
-
- gst_structure_get_int (structure, "channels", &adder->channels);
- gst_structure_get_int (structure, "rate", &adder->rate);
- /* precalc bps */
- adder->bps = (adder->width / 8) * adder->channels;
-
- return TRUE;
-
- /* ERRORS */
-not_supported:
- {
- GST_DEBUG_OBJECT (adder, "unsupported format set as caps");
- return FALSE;
- }
-}
-
-/* FIXME, the duration query should reflect how long you will produce
- * data, that is the amount of stream time until you will emit EOS.
- *
- * For synchronized mixing this is always the max of all the durations
- * of upstream since we emit EOS when all of them finished.
- *
- * We don't do synchronized mixing so this really depends on where the
- * streams where punched in and what their relative offsets are against
- * eachother which we can get from the first timestamps we see.
- *
- * When we add a new stream (or remove a stream) the duration might
- * also become invalid again and we need to post a new DURATION
- * message to notify this fact to the parent.
- * For now we take the max of all the upstream elements so the simple
- * cases work at least somewhat.
- */
-static gboolean
-gst_adder_query_duration (GstAdder * adder, GstQuery * query)
-{
- gint64 max;
- gboolean res;
- GstFormat format;
- GstIterator *it;
- gboolean done;
-
- /* parse format */
- gst_query_parse_duration (query, &format, NULL);
-
- max = -1;
- res = TRUE;
- done = FALSE;
-
- it = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (adder));
- while (!done) {
- GstIteratorResult ires;
-
- gpointer item;
-
- ires = gst_iterator_next (it, &item);
- switch (ires) {
- case GST_ITERATOR_DONE:
- done = TRUE;
- break;
- case GST_ITERATOR_OK:
- {
- GstPad *pad = GST_PAD_CAST (item);
-
- gint64 duration;
-
- /* ask sink peer for duration */
- res &= gst_pad_query_peer_duration (pad, &format, &duration);
- /* take max from all valid return values */
- if (res) {
- /* valid unknown length, stop searching */
- if (duration == -1) {
- max = duration;
- done = TRUE;
- }
- /* else see if bigger than current max */
- else if (duration > max)
- max = duration;
- }
- gst_object_unref (pad);
- break;
- }
- case GST_ITERATOR_RESYNC:
- max = -1;
- res = TRUE;
- gst_iterator_resync (it);
- break;
- default:
- res = FALSE;
- done = TRUE;
- break;
- }
- }
- gst_iterator_free (it);
-
- if (res) {
- /* and store the max */
- GST_DEBUG_OBJECT (adder, "Total duration in format %s: %"
- GST_TIME_FORMAT, gst_format_get_name (format), GST_TIME_ARGS (max));
- gst_query_set_duration (query, format, max);
- }
-
- return res;
-}
-
-static gboolean
-gst_adder_query_latency (GstAdder * adder, GstQuery * query)
-{
- GstClockTime min, max;
- gboolean live;
- gboolean res;
- GstIterator *it;
- gboolean done;
-
- res = TRUE;
- done = FALSE;
-
- live = FALSE;
- min = 0;
- max = GST_CLOCK_TIME_NONE;
-
- /* Take maximum of all latency values */
- it = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (adder));
- while (!done) {
- GstIteratorResult ires;
-
- gpointer item;
-
- ires = gst_iterator_next (it, &item);
- switch (ires) {
- case GST_ITERATOR_DONE:
- done = TRUE;
- break;
- case GST_ITERATOR_OK:
- {
- GstPad *pad = GST_PAD_CAST (item);
- GstQuery *peerquery;
- GstClockTime min_cur, max_cur;
- gboolean live_cur;
-
- peerquery = gst_query_new_latency ();
-
- /* Ask peer for latency */
- res &= gst_pad_peer_query (pad, peerquery);
-
- /* take max from all valid return values */
- if (res) {
- gst_query_parse_latency (peerquery, &live_cur, &min_cur, &max_cur);
-
- if (min_cur > min)
- min = min_cur;
-
- if (max_cur != GST_CLOCK_TIME_NONE &&
- ((max != GST_CLOCK_TIME_NONE && max_cur > max) ||
- (max == GST_CLOCK_TIME_NONE)))
- max = max_cur;
-
- live = live || live_cur;
- }
-
- gst_query_unref (peerquery);
- gst_object_unref (pad);
- break;
- }
- case GST_ITERATOR_RESYNC:
- live = FALSE;
- min = 0;
- max = GST_CLOCK_TIME_NONE;
- res = TRUE;
- gst_iterator_resync (it);
- break;
- default:
- res = FALSE;
- done = TRUE;
- break;
- }
- }
- gst_iterator_free (it);
-
- if (res) {
- /* store the results */
- GST_DEBUG_OBJECT (adder, "Calculated total latency: live %s, min %"
- GST_TIME_FORMAT ", max %" GST_TIME_FORMAT,
- (live ? "yes" : "no"), GST_TIME_ARGS (min), GST_TIME_ARGS (max));
- gst_query_set_latency (query, live, min, max);
- }
-
- return res;
-}
-
-static gboolean
-gst_adder_query (GstPad * pad, GstQuery * query)
-{
- GstAdder *adder = GST_ADDER (gst_pad_get_parent (pad));
- gboolean res = FALSE;
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_POSITION:
- {
- GstFormat format;
-
- gst_query_parse_position (query, &format, NULL);
-
- switch (format) {
- case GST_FORMAT_TIME:
- /* FIXME, bring to stream time, might be tricky */
- gst_query_set_position (query, format, adder->timestamp);
- res = TRUE;
- break;
- case GST_FORMAT_DEFAULT:
- gst_query_set_position (query, format, adder->offset);
- res = TRUE;
- break;
- default:
- break;
- }
- break;
- }
- case GST_QUERY_DURATION:
- res = gst_adder_query_duration (adder, query);
- break;
- case GST_QUERY_LATENCY:
- res = gst_adder_query_latency (adder, query);
- break;
- default:
- /* FIXME, needs a custom query handler because we have multiple
- * sinkpads */
- res = gst_pad_query_default (pad, query);
- break;
- }
-
- gst_object_unref (adder);
- return res;
-}
-
-typedef struct
-{
- GstEvent *event;
- gboolean flush;
-} EventData;
-
-static gboolean
-forward_event_func (GstPad * pad, GValue * ret, EventData * data)
-{
- GstEvent *event = data->event;
-
- gst_event_ref (event);
- GST_LOG_OBJECT (pad, "About to send event %s", GST_EVENT_TYPE_NAME (event));
- if (!gst_pad_push_event (pad, event)) {
- GST_WARNING_OBJECT (pad, "Sending event %p (%s) failed.",
- event, GST_EVENT_TYPE_NAME (event));
- /* quick hack to unflush the pads, ideally we need a way to just unflush
- * this single collect pad */
- if (data->flush)
- gst_pad_send_event (pad, gst_event_new_flush_stop ());
- } else {
- g_value_set_boolean (ret, TRUE);
- GST_LOG_OBJECT (pad, "Sent event %p (%s).",
- event, GST_EVENT_TYPE_NAME (event));
- }
- gst_object_unref (pad);
-
- /* continue on other pads, even if one failed */
- return TRUE;
-}
-
-/* forwards the event to all sinkpads, takes ownership of the
- * event
- *
- * Returns: TRUE if the event could be forwarded on all
- * sinkpads.
- */
-static gboolean
-forward_event (GstAdder * adder, GstEvent * event, gboolean flush)
-{
- gboolean ret;
- GstIterator *it;
- GstIteratorResult ires;
- GValue vret = { 0 };
- EventData data;
-
- GST_LOG_OBJECT (adder, "Forwarding event %p (%s)", event,
- GST_EVENT_TYPE_NAME (event));
-
- data.event = event;
- data.flush = flush;
-
- g_value_init (&vret, G_TYPE_BOOLEAN);
- g_value_set_boolean (&vret, FALSE);
- it = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (adder));
- while (TRUE) {
- ires = gst_iterator_fold (it, (GstIteratorFoldFunction) forward_event_func,
- &vret, &data);
- switch (ires) {
- case GST_ITERATOR_RESYNC:
- GST_WARNING ("resync");
- gst_iterator_resync (it);
- g_value_set_boolean (&vret, TRUE);
- break;
- case GST_ITERATOR_OK:
- case GST_ITERATOR_DONE:
- ret = g_value_get_boolean (&vret);
- goto done;
- default:
- ret = FALSE;
- goto done;
- }
- }
-done:
- gst_iterator_free (it);
- GST_LOG_OBJECT (adder, "Forwarded event %p (%s), ret=%d", event,
- GST_EVENT_TYPE_NAME (event), ret);
- gst_event_unref (event);
-
- return ret;
-}
-
-static gboolean
-gst_adder_src_event (GstPad * pad, GstEvent * event)
-{
- GstAdder *adder;
- gboolean result;
-
- adder = GST_ADDER (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:
- {
- GstSeekFlags flags;
- GstSeekType curtype;
- gint64 cur;
- gboolean flush;
-
- /* parse the seek parameters */
- gst_event_parse_seek (event, &adder->segment_rate, NULL, &flags, &curtype,
- &cur, NULL, NULL);
-
- flush = (flags & GST_SEEK_FLAG_FLUSH) == GST_SEEK_FLAG_FLUSH;
-
- /* check if we are flushing */
- if (flush) {
- /* make sure we accept nothing anymore and return WRONG_STATE */
- gst_collect_pads_set_flushing (adder->collect, TRUE);
-
- /* flushing seek, start flush downstream, the flush will be done
- * when all pads received a FLUSH_STOP. */
- gst_pad_push_event (adder->srcpad, gst_event_new_flush_start ());
- }
- GST_DEBUG_OBJECT (adder, "handling seek event: %" GST_PTR_FORMAT, event);
-
- /* now wait for the collected to be finished and mark a new
- * segment. After we have the lock, no collect function is running and no
- * new collect function will be called for as long as we're flushing. */
- GST_OBJECT_LOCK (adder->collect);
- if (curtype == GST_SEEK_TYPE_SET)
- adder->segment_position = cur;
- else
- adder->segment_position = 0;
- /* make sure we push a new segment, to inform about new basetime
- * see FIXME in gst_adder_collected() */
- adder->segment_pending = TRUE;
- if (flush) {
- /* Yes, we need to call _set_flushing again *WHEN* the streaming threads
- * have stopped so that the cookie gets properly updated. */
- gst_collect_pads_set_flushing (adder->collect, TRUE);
- }
- /* we might have a pending flush_stop event now. This event will either be
- * sent by an upstream element when it completes the seek or we will push
- * one in the collected callback ourself */
- adder->flush_stop_pending = flush;
- GST_OBJECT_UNLOCK (adder->collect);
- GST_DEBUG_OBJECT (adder, "forwarding seek event: %" GST_PTR_FORMAT,
- event);
-
- result = forward_event (adder, event, flush);
- if (!result) {
- /* seek failed. maybe source is a live source. */
- GST_DEBUG_OBJECT (adder, "seeking failed");
- }
- /* FIXME: ideally we would like to send a flush-stop event from here but
- * collectpads does not have a method that allows us to do that. Instead
- * we forward all flush-stop events we receive on the sinkpads. We might
- * be sending too many flush-stop events. */
- break;
- }
- case GST_EVENT_QOS:
- /* QoS might be tricky */
- result = FALSE;
- break;
- case GST_EVENT_NAVIGATION:
- /* navigation is rather pointless. */
- result = FALSE;
- break;
- default:
- /* just forward the rest for now */
- GST_DEBUG_OBJECT (adder, "forward unhandled event: %s",
- GST_EVENT_TYPE_NAME (event));
- result = forward_event (adder, event, FALSE);
- break;
- }
- gst_object_unref (adder);
-
- return result;
-}
-
-static gboolean
-gst_adder_sink_event (GstPad * pad, GstEvent * event)
-{
- GstAdder *adder;
- gboolean ret = TRUE;
-
- adder = GST_ADDER (gst_pad_get_parent (pad));
-
- GST_DEBUG ("Got %s event on pad %s:%s", GST_EVENT_TYPE_NAME (event),
- GST_DEBUG_PAD_NAME (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_STOP:
- /* we received a flush-stop. The collect_event function will push the
- * event past our element. We simply forward all flush-stop events, even
- * when no flush-stop was pending, this is required because collectpads
- * does not provide an API to handle-but-not-forward the flush-stop.
- * We unset the pending flush-stop flag so that we don't send anymore
- * flush-stop from the collect function later.
- */
- GST_OBJECT_LOCK (adder->collect);
- adder->segment_pending = TRUE;
- adder->flush_stop_pending = FALSE;
- /* Clear pending tags */
- if (adder->pending_events) {
- g_list_foreach (adder->pending_events, (GFunc) gst_event_unref, NULL);
- g_list_free (adder->pending_events);
- adder->pending_events = NULL;
- }
- GST_OBJECT_UNLOCK (adder->collect);
- break;
- case GST_EVENT_TAG:
- GST_OBJECT_LOCK (adder->collect);
- /* collect tags here so we can push them out when we collect data */
- adder->pending_events = g_list_append (adder->pending_events, event);
- GST_OBJECT_UNLOCK (adder->collect);
- goto beach;
- default:
- break;
- }
-
- /* now GstCollectPads can take care of the rest, e.g. EOS */
- ret = adder->collect_event (pad, event);
-
-beach:
- gst_object_unref (adder);
- return ret;
-}
-
-static void
-gst_adder_class_init (GstAdderClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
- GstElementClass *gstelement_class = (GstElementClass *) klass;
-
- gobject_class->set_property = gst_adder_set_property;
- gobject_class->get_property = gst_adder_get_property;
- gobject_class->dispose = gst_adder_dispose;
-
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&gst_adder_src_template));
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&gst_adder_sink_template));
- gst_element_class_set_details_simple (gstelement_class, "Adder",
- "Generic/Audio",
- "Add N audio channels together",
- "Thomas Vander Stichele <thomas at apestaart dot org>");
-
- parent_class = g_type_class_peek_parent (klass);
-
- /**
- * GstAdder:caps:
- *
- * Since: 0.10.24
- */
- g_object_class_install_property (gobject_class, PROP_FILTER_CAPS,
- g_param_spec_boxed ("caps", "Target caps",
- "Set target format for mixing (NULL means ANY). "
- "Setting this property takes a reference to the supplied GstCaps "
- "object.", GST_TYPE_CAPS,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstelement_class->request_new_pad =
- GST_DEBUG_FUNCPTR (gst_adder_request_new_pad);
- gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_adder_release_pad);
- gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_adder_change_state);
-}
-
-static void
-gst_adder_init (GstAdder * adder)
-{
- GstPadTemplate *template;
-
- template = gst_static_pad_template_get (&gst_adder_src_template);
- adder->srcpad = gst_pad_new_from_template (template, "src");
- gst_object_unref (template);
-
- gst_pad_set_getcaps_function (adder->srcpad,
- GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
- gst_pad_set_setcaps_function (adder->srcpad,
- GST_DEBUG_FUNCPTR (gst_adder_setcaps));
- gst_pad_set_query_function (adder->srcpad,
- GST_DEBUG_FUNCPTR (gst_adder_query));
- gst_pad_set_event_function (adder->srcpad,
- GST_DEBUG_FUNCPTR (gst_adder_src_event));
- gst_element_add_pad (GST_ELEMENT (adder), adder->srcpad);
-
- adder->format = GST_ADDER_FORMAT_UNSET;
- adder->padcount = 0;
- adder->func = NULL;
-
- adder->filter_caps = NULL;
-
- /* keep track of the sinkpads requested */
- adder->collect = gst_collect_pads_new ();
- gst_collect_pads_set_function (adder->collect,
- GST_DEBUG_FUNCPTR (gst_adder_collected), adder);
- gst_collect_pads_set_clip_function (adder->collect,
- GST_DEBUG_FUNCPTR (gst_adder_do_clip), adder);
-}
-
-static void
-gst_adder_dispose (GObject * object)
-{
- GstAdder *adder = GST_ADDER (object);
-
- if (adder->collect) {
- gst_object_unref (adder->collect);
- adder->collect = NULL;
- }
- gst_caps_replace (&adder->filter_caps, NULL);
- if (adder->pending_events) {
- g_list_foreach (adder->pending_events, (GFunc) gst_event_unref, NULL);
- g_list_free (adder->pending_events);
- adder->pending_events = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_adder_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstAdder *adder = GST_ADDER (object);
-
- switch (prop_id) {
- case PROP_FILTER_CAPS:{
- GstCaps *new_caps = NULL;
- GstCaps *old_caps;
- const GstCaps *new_caps_val = gst_value_get_caps (value);
-
- if (new_caps_val != NULL) {
- new_caps = (GstCaps *) new_caps_val;
- gst_caps_ref (new_caps);
- }
-
- GST_OBJECT_LOCK (adder);
- old_caps = adder->filter_caps;
- adder->filter_caps = new_caps;
- GST_OBJECT_UNLOCK (adder);
-
- if (old_caps)
- gst_caps_unref (old_caps);
-
- GST_DEBUG_OBJECT (adder, "set new caps %" GST_PTR_FORMAT, new_caps);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_adder_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstAdder *adder = GST_ADDER (object);
-
- switch (prop_id) {
- case PROP_FILTER_CAPS:
- GST_OBJECT_LOCK (adder);
- gst_value_set_caps (value, adder->filter_caps);
- GST_OBJECT_UNLOCK (adder);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static GstPad *
-gst_adder_request_new_pad (GstElement * element, GstPadTemplate * templ,
- const gchar * unused)
-{
- gchar *name;
- GstAdder *adder;
- GstPad *newpad;
- gint padcount;
-
- if (templ->direction != GST_PAD_SINK)
- goto not_sink;
-
- adder = GST_ADDER (element);
-
- /* increment pad counter */
- padcount = g_atomic_int_exchange_and_add (&adder->padcount, 1);
-
- name = g_strdup_printf ("sink%d", padcount);
- newpad = gst_pad_new_from_template (templ, name);
- GST_DEBUG_OBJECT (adder, "request new pad %s", name);
- g_free (name);
-
- gst_pad_set_getcaps_function (newpad,
- GST_DEBUG_FUNCPTR (gst_adder_sink_getcaps));
- gst_pad_set_setcaps_function (newpad, GST_DEBUG_FUNCPTR (gst_adder_setcaps));
- gst_collect_pads_add_pad (adder->collect, newpad, sizeof (GstCollectData));
-
- /* FIXME: hacked way to override/extend the event function of
- * GstCollectPads; because it sets its own event function giving the
- * element no access to events */
- adder->collect_event = (GstPadEventFunction) GST_PAD_EVENTFUNC (newpad);
- gst_pad_set_event_function (newpad, GST_DEBUG_FUNCPTR (gst_adder_sink_event));
-
- /* takes ownership of the pad */
- if (!gst_element_add_pad (GST_ELEMENT (adder), newpad))
- goto could_not_add;
-
- return newpad;
-
- /* errors */
-not_sink:
- {
- g_warning ("gstadder: request new pad that is not a SINK pad\n");
- return NULL;
- }
-could_not_add:
- {
- GST_DEBUG_OBJECT (adder, "could not add pad");
- gst_collect_pads_remove_pad (adder->collect, newpad);
- gst_object_unref (newpad);
- return NULL;
- }
-}
-
-static void
-gst_adder_release_pad (GstElement * element, GstPad * pad)
-{
- GstAdder *adder;
-
- adder = GST_ADDER (element);
-
- GST_DEBUG_OBJECT (adder, "release pad %s:%s", GST_DEBUG_PAD_NAME (pad));
-
- gst_collect_pads_remove_pad (adder->collect, pad);
- gst_element_remove_pad (element, pad);
-}
-
-static GstBuffer *
-gst_adder_do_clip (GstCollectPads * pads, GstCollectData * data,
- GstBuffer * buffer, gpointer user_data)
-{
- GstAdder *adder = GST_ADDER (user_data);
-
- buffer = gst_audio_buffer_clip (buffer, &data->segment, adder->rate,
- adder->bps);
-
- return buffer;
-}
-
-static GstFlowReturn
-gst_adder_collected (GstCollectPads * pads, gpointer user_data)
-{
- /*
- * combine streams by adding data values
- * basic algorithm :
- * - this function is called when all pads have a buffer
- * - get available bytes on all pads.
- * - repeat for each input pad :
- * - read available bytes, copy or add to target buffer
- * - if there's an EOS event, remove the input channel
- * - push out the output buffer
- *
- * todo:
- * - would be nice to have a mixing mode, where instead of adding we mix
- * - for float we could downscale after collect loop
- * - for int we need to downscale each input to avoid clipping or
- * mix into a temp (float) buffer and scale afterwards as well
- */
- GstAdder *adder;
- GSList *collected, *next = NULL;
- GstFlowReturn ret;
- GstBuffer *outbuf = NULL, *gapbuf = NULL;
- gpointer outdata = NULL;
- guint outsize;
-
- adder = GST_ADDER (user_data);
-
- /* this is fatal */
- if (G_UNLIKELY (adder->func == NULL))
- goto not_negotiated;
-
- if (adder->flush_stop_pending) {
- gst_pad_push_event (adder->srcpad, gst_event_new_flush_stop ());
- adder->flush_stop_pending = FALSE;
- }
-
- /* get available bytes for reading, this can be 0 which could mean empty
- * buffers or EOS, which we will catch when we loop over the pads. */
- outsize = gst_collect_pads_available (pads);
- /* can only happen when no pads to collect or all EOS */
- if (outsize == 0)
- goto eos;
-
- GST_LOG_OBJECT (adder,
- "starting to cycle through channels, %d bytes available (bps = %d)",
- outsize, adder->bps);
-
- for (collected = pads->data; collected; collected = next) {
- GstCollectData *collect_data;
- GstBuffer *inbuf;
- gboolean is_gap;
-
- /* take next to see if this is the last collectdata */
- next = g_slist_next (collected);
-
- collect_data = (GstCollectData *) collected->data;
-
- /* get a buffer of size bytes, if we get a buffer, it is at least outsize
- * bytes big. */
- inbuf = gst_collect_pads_take_buffer (pads, collect_data, outsize);
- /* NULL means EOS or an empty buffer so we still need to flush in
- * case of an empty buffer. */
- if (inbuf == NULL) {
- GST_LOG_OBJECT (adder, "channel %p: no bytes available", collect_data);
- continue;
- }
-
- is_gap = GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP);
-
- /* Try to make an output buffer */
- if (outbuf == NULL) {
- /* if this is a gap buffer but we have some more pads to check, skip it.
- * If we are at the last buffer, take it, regardless if it is a GAP
- * buffer or not. */
- if (is_gap && next) {
- GST_DEBUG_OBJECT (adder, "skipping, non-last GAP buffer");
- /* we keep the GAP buffer, if we don't have anymore buffers (all pads
- * EOS, we can use this one as the output buffer. */
- if (gapbuf == NULL)
- gapbuf = inbuf;
- else
- gst_buffer_unref (inbuf);
- continue;
- }
-
- GST_LOG_OBJECT (adder, "channel %p: preparing output buffer of %d bytes",
- collect_data, outsize);
- /* make data and metadata writable, can simply return the inbuf when we
- * are the only one referencing this buffer. If this is the last (and
- * only) GAP buffer, it will automatically copy the GAP flag. */
- outbuf = gst_buffer_make_writable (inbuf);
- outdata = GST_BUFFER_DATA (outbuf);
- gst_buffer_set_caps (outbuf, GST_PAD_CAPS (adder->srcpad));
- } else {
- if (!is_gap) {
- /* we had a previous output buffer, mix this non-GAP buffer */
- guint8 *indata;
- guint insize;
-
- indata = GST_BUFFER_DATA (inbuf);
- insize = GST_BUFFER_SIZE (inbuf);
-
- /* all buffers should have outsize, there are no short buffers because we
- * asked for the max size above */
- g_assert (insize == outsize);
-
- GST_LOG_OBJECT (adder, "channel %p: mixing %d bytes from data %p",
- collect_data, insize, indata);
-
- /* further buffers, need to add them */
- adder->func ((gpointer) outdata, (gpointer) indata, insize);
- } else {
- /* skip gap buffer */
- GST_LOG_OBJECT (adder, "channel %p: skipping GAP buffer", collect_data);
- }
- gst_buffer_unref (inbuf);
- }
- }
-
- if (outbuf == NULL) {
- /* no output buffer, reuse one of the GAP buffers then if we have one */
- if (gapbuf) {
- GST_LOG_OBJECT (adder, "reusing GAP buffer %p", gapbuf);
- outbuf = gapbuf;
- } else
- /* assume EOS otherwise, this should not happen, really */
- goto eos;
- } else if (gapbuf)
- /* we had an output buffer, unref the gapbuffer we kept */
- gst_buffer_unref (gapbuf);
-
- /* our timestamping is very simple, just an ever incrementing
- * counter, the new segment time will take care of their respective
- * stream time. */
- if (adder->segment_pending) {
- GstEvent *event;
-
- /* FIXME, use rate/applied_rate as set on all sinkpads.
- * - currently we just set rate as received from last seek-event
- * We could potentially figure out the duration as well using
- * the current segment positions and the stated stop positions.
- * Also we just start from stream time 0 which is rather
- * weird. For non-synchronized mixing, the time should be
- * the min of the stream times of all received segments,
- * rationale being that the duration is at least going to
- * be as long as the earliest stream we start mixing. This
- * would also be correct for synchronized mixing but then
- * the later streams would be delayed until the stream times
- * match.
- */
- event = gst_event_new_new_segment_full (FALSE, adder->segment_rate,
- 1.0, GST_FORMAT_TIME, adder->timestamp, -1, adder->segment_position);
-
- if (event) {
- if (!gst_pad_push_event (adder->srcpad, event)) {
- GST_WARNING_OBJECT (adder->srcpad, "Sending event %p (%s) failed.",
- event, GST_EVENT_TYPE_NAME (event));
- }
- adder->segment_pending = FALSE;
- adder->segment_position = 0;
- } else {
- GST_WARNING_OBJECT (adder->srcpad, "Creating new segment event for "
- "start:%" G_GINT64_FORMAT " pos:%" G_GINT64_FORMAT " failed",
- adder->timestamp, adder->segment_position);
- }
- }
-
- if (G_UNLIKELY (adder->pending_events)) {
- GList *tmp = adder->pending_events;
-
- while (tmp) {
- GstEvent *ev = (GstEvent *) tmp->data;
-
- gst_pad_push_event (adder->srcpad, ev);
- tmp = g_list_next (tmp);
- }
- g_list_free (adder->pending_events);
- adder->pending_events = NULL;
- }
-
- /* set timestamps on the output buffer */
- GST_BUFFER_TIMESTAMP (outbuf) = adder->timestamp;
- GST_BUFFER_OFFSET (outbuf) = adder->offset;
-
- /* for the next timestamp, use the sample counter, which will
- * never accumulate rounding errors */
- adder->offset += outsize / adder->bps;
- adder->timestamp = gst_util_uint64_scale_int (adder->offset,
- GST_SECOND, adder->rate);
-
- /* now we can set the duration of the buffer */
- GST_BUFFER_DURATION (outbuf) = adder->timestamp -
- GST_BUFFER_TIMESTAMP (outbuf);
-
- /* send it out */
- GST_LOG_OBJECT (adder, "pushing outbuf %p, timestamp %" GST_TIME_FORMAT,
- outbuf, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)));
- ret = gst_pad_push (adder->srcpad, outbuf);
-
- GST_LOG_OBJECT (adder, "pushed outbuf, result = %s", gst_flow_get_name (ret));
-
- return ret;
-
- /* ERRORS */
-not_negotiated:
- {
- GST_ELEMENT_ERROR (adder, STREAM, FORMAT, (NULL),
- ("Unknown data received, not negotiated"));
- return GST_FLOW_NOT_NEGOTIATED;
- }
-eos:
- {
- GST_DEBUG_OBJECT (adder, "no data available, must be EOS");
- gst_pad_push_event (adder->srcpad, gst_event_new_eos ());
- return GST_FLOW_UNEXPECTED;
- }
-}
-
-static GstStateChangeReturn
-gst_adder_change_state (GstElement * element, GstStateChange transition)
-{
- GstAdder *adder;
- GstStateChangeReturn ret;
-
- adder = GST_ADDER (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- adder->timestamp = 0;
- adder->offset = 0;
- adder->flush_stop_pending = FALSE;
- adder->segment_pending = TRUE;
- adder->segment_position = 0;
- adder->segment_rate = 1.0;
- gst_segment_init (&adder->segment, GST_FORMAT_UNDEFINED);
- gst_collect_pads_start (adder->collect);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- /* need to unblock the collectpads before calling the
- * parent change_state so that streaming can finish */
- gst_collect_pads_stop (adder->collect);
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- default:
- break;
- }
-
- return ret;
-}
-
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- /*oil_init (); */
-
- if (!gst_element_register (plugin, "adder", GST_RANK_NONE, GST_TYPE_ADDER)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "adder",
- "Adds multiple streams",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/adder/gstadder.h b/gst/adder/gstadder.h
deleted file mode 100644
index 3832dfd1..00000000
--- a/gst/adder/gstadder.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2000 Wim Taymans <wtay@chello.be>
- *
- * gstadder.h: Header for GstAdder 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_ADDER_H__
-#define __GST_ADDER_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstcollectpads.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_ADDER (gst_adder_get_type())
-#define GST_ADDER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ADDER,GstAdder))
-#define GST_IS_ADDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ADDER))
-#define GST_ADDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_ADDER,GstAdderClass))
-#define GST_IS_ADDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_ADDER))
-#define GST_ADDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_ADDER,GstAdderClass))
-
-typedef struct _GstAdder GstAdder;
-typedef struct _GstAdderClass GstAdderClass;
-typedef struct _GstAdderInputChannel GstAdderInputChannel;
-
-typedef enum {
- GST_ADDER_FORMAT_UNSET,
- GST_ADDER_FORMAT_INT,
- GST_ADDER_FORMAT_FLOAT
-} GstAdderFormat;
-
-typedef void (*GstAdderFunction) (gpointer out, gpointer in, guint size);
-
-/**
- * GstAdder:
- *
- * The adder object structure.
- */
-struct _GstAdder {
- GstElement element;
-
- GstPad *srcpad;
- GstCollectPads *collect;
- /* pad counter, used for creating unique request pads */
- gint padcount;
-
- /* the next are valid for both int and float */
- GstAdderFormat format;
- gint rate;
- gint channels;
- gint width;
- gint endianness;
-
- /* the next are valid only for format == GST_ADDER_FORMAT_INT */
- gint depth;
- gboolean is_signed;
-
- /* number of bytes per sample, actually width/8 * channels */
- gint bps;
-
- /* function to add samples */
- GstAdderFunction func;
-
- /* counters to keep track of timestamps */
- gint64 timestamp;
- gint64 offset;
-
- /* sink event handling */
- GstPadEventFunction collect_event;
- GstSegment segment;
- gboolean segment_pending;
- guint64 segment_position;
- gdouble segment_rate;
- /* src event handling */
- gboolean flush_stop_pending;
-
- /* target caps */
- GstCaps *filter_caps;
-
- /* Pending inline events */
- GList *pending_events;
-};
-
-struct _GstAdderClass {
- GstElementClass parent_class;
-};
-
-GType gst_adder_get_type (void);
-
-G_END_DECLS
-
-
-#endif /* __GST_ADDER_H__ */
diff --git a/gst/app/Makefile.am b/gst/app/Makefile.am
deleted file mode 100644
index 178ed4e8..00000000
--- a/gst/app/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-plugin_LTLIBRARIES = libgstapp.la
-
-libgstapp_la_SOURCES = gstapp.c
-libgstapp_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
-libgstapp_la_LIBADD = $(GST_BASE_LIBS) $(top_builddir)/gst-libs/gst/app/libgstapp-@GST_MAJORMINOR@.la
-libgstapp_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstapp_la_LIBTOOLFLAGS = --tag=disable-static
-
diff --git a/gst/app/gstapp.c b/gst/app/gstapp.c
deleted file mode 100644
index 098fbdd2..00000000
--- a/gst/app/gstapp.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-#include <gst/app/gstappsrc.h>
-#include <gst/app/gstappsink.h>
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- gst_element_register (plugin, "appsrc", GST_RANK_NONE, GST_TYPE_APP_SRC);
- gst_element_register (plugin, "appsink", GST_RANK_NONE, GST_TYPE_APP_SINK);
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "app",
- "Elements used to communicate with applications",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/audioconvert/.gitignore b/gst/audioconvert/.gitignore
deleted file mode 100644
index 696560c4..00000000
--- a/gst/audioconvert/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-channelmixtest
diff --git a/gst/audioconvert/Makefile.am b/gst/audioconvert/Makefile.am
deleted file mode 100644
index 94978bb6..00000000
--- a/gst/audioconvert/Makefile.am
+++ /dev/null
@@ -1,31 +0,0 @@
-plugin_LTLIBRARIES = libgstaudioconvert.la
-
-libgstaudioconvert_la_SOURCES = \
- gstaudioconvert.c \
- audioconvert.c \
- gstchannelmix.c \
- gstaudioquantize.c \
- plugin.c
-
-libgstaudioconvert_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
-libgstaudioconvert_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstaudioconvert_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
- $(GST_BASE_LIBS) $(GST_LIBS) $(LIBM)
-libgstaudioconvert_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = \
- gstaudioconvert.h \
- audioconvert.h \
- gstchannelmix.h \
- gstaudioquantize.h \
- gstfastrandom.h \
- plugin.h
-
-#TESTS = channelmixtest
-#noinst_PROGRAMS = channelmixtest
-
-#channelmixtest_CFLAGS = $(GST_CFLAGS)
-#channelmixtest_LDADD = libgstaudioconvert.la \
-# $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la
-#channelmixtest_LDFLAGS = $(GST_LIBS)
diff --git a/gst/audioconvert/audioconvert.c b/gst/audioconvert/audioconvert.c
deleted file mode 100644
index 47803249..00000000
--- a/gst/audioconvert/audioconvert.c
+++ /dev/null
@@ -1,600 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005 Wim Taymans <wim at fluendo dot com>
- *
- * audioconvert.c: Convert audio to different audio formats automatically
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <math.h>
-#include <string.h>
-
-#include "gstchannelmix.h"
-#include "gstaudioquantize.h"
-#include "audioconvert.h"
-#include "gst/floatcast/floatcast.h"
-
-/* sign bit in the intermediate format */
-#define SIGNED (1U<<31)
-
-/***
- * unpack code
- */
-#define MAKE_UNPACK_FUNC_NAME(name) \
-audio_convert_unpack_##name
-
-/* unpack from integer to signed integer 32 */
-#define MAKE_UNPACK_FUNC_II(name, stride, sign, READ_FUNC) \
-static void \
-MAKE_UNPACK_FUNC_NAME (name) (guint8 *src, gint32 *dst, \
- gint scale, gint count) \
-{ \
- for (;count; count--) { \
- *dst++ = (((gint32) READ_FUNC (src)) << scale) ^ (sign); \
- src+=stride; \
- } \
-}
-
-/* unpack from float to signed integer 32 */
-#define MAKE_UNPACK_FUNC_FI(name, type, READ_FUNC) \
-static void \
-MAKE_UNPACK_FUNC_NAME (name) (type * src, gint32 * dst, gint s, gint count) \
-{ \
- gdouble temp; \
- \
- for (; count; count--) { \
- /* blow up to 32 bit */ \
- temp = floor ((READ_FUNC (*src++) * 2147483647.0) + 0.5); \
- *dst++ = (gint32) CLAMP (temp, G_MININT32, G_MAXINT32); \
- } \
-}
-
-/* unpack from float to float 64 (double) */
-#define MAKE_UNPACK_FUNC_FF(name, type, FUNC) \
-static void \
-MAKE_UNPACK_FUNC_NAME (name) (type * src, gdouble * dst, gint s, \
- gint count) \
-{ \
- for (; count; count--) \
- *dst++ = (gdouble) FUNC (*src++); \
-}
-
-/* unpack from int to float 64 (double) */
-#define MAKE_UNPACK_FUNC_IF(name, stride, sign, READ_FUNC) \
-static void \
-MAKE_UNPACK_FUNC_NAME (name) (guint8 * src, gdouble * dst, gint scale, \
- gint count) \
-{ \
- gdouble tmp; \
- for (; count; count--) { \
- tmp = (gdouble) ((((gint32) READ_FUNC (src)) << scale) ^ (sign)); \
- *dst++ = tmp * (1.0 / 2147483647.0); \
- src += stride; \
- } \
-}
-
-#define READ8(p) GST_READ_UINT8(p)
-#define READ16_FROM_LE(p) GST_READ_UINT16_LE (p)
-#define READ16_FROM_BE(p) GST_READ_UINT16_BE (p)
-#define READ24_FROM_LE(p) (p[0] | (p[1] << 8) | (p[2] << 16))
-#define READ24_FROM_BE(p) (p[2] | (p[1] << 8) | (p[0] << 16))
-#define READ32_FROM_LE(p) GST_READ_UINT32_LE (p)
-#define READ32_FROM_BE(p) GST_READ_UINT32_BE (p)
-
-MAKE_UNPACK_FUNC_II (u8, 1, SIGNED, READ8);
-MAKE_UNPACK_FUNC_II (s8, 1, 0, READ8);
-MAKE_UNPACK_FUNC_II (u16_le, 2, SIGNED, READ16_FROM_LE);
-MAKE_UNPACK_FUNC_II (s16_le, 2, 0, READ16_FROM_LE);
-MAKE_UNPACK_FUNC_II (u16_be, 2, SIGNED, READ16_FROM_BE);
-MAKE_UNPACK_FUNC_II (s16_be, 2, 0, READ16_FROM_BE);
-MAKE_UNPACK_FUNC_II (u24_le, 3, SIGNED, READ24_FROM_LE);
-MAKE_UNPACK_FUNC_II (s24_le, 3, 0, READ24_FROM_LE);
-MAKE_UNPACK_FUNC_II (u24_be, 3, SIGNED, READ24_FROM_BE);
-MAKE_UNPACK_FUNC_II (s24_be, 3, 0, READ24_FROM_BE);
-MAKE_UNPACK_FUNC_II (u32_le, 4, SIGNED, READ32_FROM_LE);
-MAKE_UNPACK_FUNC_II (s32_le, 4, 0, READ32_FROM_LE);
-MAKE_UNPACK_FUNC_II (u32_be, 4, SIGNED, READ32_FROM_BE);
-MAKE_UNPACK_FUNC_II (s32_be, 4, 0, READ32_FROM_BE);
-MAKE_UNPACK_FUNC_FI (float_le, gfloat, GFLOAT_FROM_LE);
-MAKE_UNPACK_FUNC_FI (float_be, gfloat, GFLOAT_FROM_BE);
-MAKE_UNPACK_FUNC_FI (double_le, gdouble, GDOUBLE_FROM_LE);
-MAKE_UNPACK_FUNC_FI (double_be, gdouble, GDOUBLE_FROM_BE);
-MAKE_UNPACK_FUNC_FF (float_hq_le, gfloat, GFLOAT_FROM_LE);
-MAKE_UNPACK_FUNC_FF (float_hq_be, gfloat, GFLOAT_FROM_BE);
-MAKE_UNPACK_FUNC_FF (double_hq_le, gdouble, GDOUBLE_FROM_LE);
-MAKE_UNPACK_FUNC_FF (double_hq_be, gdouble, GDOUBLE_FROM_BE);
-MAKE_UNPACK_FUNC_IF (u8_float, 1, SIGNED, READ8);
-MAKE_UNPACK_FUNC_IF (s8_float, 1, 0, READ8);
-MAKE_UNPACK_FUNC_IF (u16_le_float, 2, SIGNED, READ16_FROM_LE);
-MAKE_UNPACK_FUNC_IF (s16_le_float, 2, 0, READ16_FROM_LE);
-MAKE_UNPACK_FUNC_IF (u16_be_float, 2, SIGNED, READ16_FROM_BE);
-MAKE_UNPACK_FUNC_IF (s16_be_float, 2, 0, READ16_FROM_BE);
-MAKE_UNPACK_FUNC_IF (u24_le_float, 3, SIGNED, READ24_FROM_LE);
-MAKE_UNPACK_FUNC_IF (s24_le_float, 3, 0, READ24_FROM_LE);
-MAKE_UNPACK_FUNC_IF (u24_be_float, 3, SIGNED, READ24_FROM_BE);
-MAKE_UNPACK_FUNC_IF (s24_be_float, 3, 0, READ24_FROM_BE);
-MAKE_UNPACK_FUNC_IF (u32_le_float, 4, SIGNED, READ32_FROM_LE);
-MAKE_UNPACK_FUNC_IF (s32_le_float, 4, 0, READ32_FROM_LE);
-MAKE_UNPACK_FUNC_IF (u32_be_float, 4, SIGNED, READ32_FROM_BE);
-MAKE_UNPACK_FUNC_IF (s32_be_float, 4, 0, READ32_FROM_BE);
-
-/* One of the double_hq_* functions generated above is ineffecient, but it's
- * never used anyway. The same is true for one of the s32_* functions. */
-
-/***
- * packing code
- */
-#define MAKE_PACK_FUNC_NAME(name) \
-audio_convert_pack_##name
-
-/*
- * These functions convert the signed 32 bit integers to the
- * target format. For this to work the following steps are done:
- *
- * 1) If the output format is unsigned we will XOR the sign bit. This
- * will do the same as if we add 1<<31.
- * 2) Afterwards we shift to the target depth. It's necessary to left-shift
- * on signed values here to get arithmetical shifting.
- * 3) This is then written into our target array by the corresponding write
- * function for the target width.
- */
-
-/* pack from signed integer 32 to integer */
-#define MAKE_PACK_FUNC_II(name, stride, sign, WRITE_FUNC) \
-static void \
-MAKE_PACK_FUNC_NAME (name) (gint32 *src, guint8 * dst, \
- gint scale, gint count) \
-{ \
- gint32 tmp; \
- for (;count; count--) { \
- tmp = (*src++ ^ (sign)) >> scale; \
- WRITE_FUNC (dst, tmp); \
- dst += stride; \
- } \
-}
-
-/* pack from signed integer 32 to float */
-#define MAKE_PACK_FUNC_IF(name, type, FUNC) \
-static void \
-MAKE_PACK_FUNC_NAME (name) (gint32 * src, type * dst, gint scale, \
- gint count) \
-{ \
- for (; count; count--) \
- *dst++ = FUNC ((type) ((*src++) * (1.0 / 2147483647.0))); \
-}
-
-/* pack from float 64 (double) to float */
-#define MAKE_PACK_FUNC_FF(name, type, FUNC) \
-static void \
-MAKE_PACK_FUNC_NAME (name) (gdouble * src, type * dst, gint s, \
- gint count) \
-{ \
- for (; count; count--) \
- *dst++ = FUNC ((type) (*src++)); \
-}
-
-/* pack from float 64 (double) to signed int.
- * the floats are already in the correct range. Only a cast is needed.
- */
-#define MAKE_PACK_FUNC_FI_S(name, stride, WRITE_FUNC) \
-static void \
-MAKE_PACK_FUNC_NAME (name) (gdouble * src, guint8 * dst, gint scale, \
- gint count) \
-{ \
- gint32 tmp; \
- for (; count; count--) { \
- tmp = (gint32) (*src); \
- WRITE_FUNC (dst, tmp); \
- src++; \
- dst += stride; \
- } \
-}
-
-/* pack from float 64 (double) to unsigned int.
- * the floats are already in the correct range. Only a cast is needed
- * and an addition of 2^(target_depth-1) to get in the correct unsigned
- * range. */
-#define MAKE_PACK_FUNC_FI_U(name, stride, WRITE_FUNC) \
-static void \
-MAKE_PACK_FUNC_NAME (name) (gdouble * src, guint8 * dst, gint scale, \
- gint count) \
-{ \
- guint32 tmp; \
- gdouble limit = (1U<<(32-scale-1)); \
- for (; count; count--) { \
- tmp = (guint32) (*src + limit); \
- WRITE_FUNC (dst, tmp); \
- src++; \
- dst += stride; \
- } \
-}
-
-#define WRITE8(p, v) GST_WRITE_UINT8 (p, v)
-#define WRITE16_TO_LE(p,v) GST_WRITE_UINT16_LE (p, (guint16)(v))
-#define WRITE16_TO_BE(p,v) GST_WRITE_UINT16_BE (p, (guint16)(v))
-#define WRITE24_TO_LE(p,v) p[0] = v & 0xff; p[1] = (v >> 8) & 0xff; p[2] = (v >> 16) & 0xff
-#define WRITE24_TO_BE(p,v) p[2] = v & 0xff; p[1] = (v >> 8) & 0xff; p[0] = (v >> 16) & 0xff
-#define WRITE32_TO_LE(p,v) GST_WRITE_UINT32_LE (p, (guint32)(v))
-#define WRITE32_TO_BE(p,v) GST_WRITE_UINT32_BE (p, (guint32)(v))
-
-MAKE_PACK_FUNC_II (u8, 1, SIGNED, WRITE8);
-MAKE_PACK_FUNC_II (s8, 1, 0, WRITE8);
-MAKE_PACK_FUNC_II (u16_le, 2, SIGNED, WRITE16_TO_LE);
-MAKE_PACK_FUNC_II (s16_le, 2, 0, WRITE16_TO_LE);
-MAKE_PACK_FUNC_II (u16_be, 2, SIGNED, WRITE16_TO_BE);
-MAKE_PACK_FUNC_II (s16_be, 2, 0, WRITE16_TO_BE);
-MAKE_PACK_FUNC_II (u24_le, 3, SIGNED, WRITE24_TO_LE);
-MAKE_PACK_FUNC_II (s24_le, 3, 0, WRITE24_TO_LE);
-MAKE_PACK_FUNC_II (u24_be, 3, SIGNED, WRITE24_TO_BE);
-MAKE_PACK_FUNC_II (s24_be, 3, 0, WRITE24_TO_BE);
-MAKE_PACK_FUNC_II (u32_le, 4, SIGNED, WRITE32_TO_LE);
-MAKE_PACK_FUNC_II (s32_le, 4, 0, WRITE32_TO_LE);
-MAKE_PACK_FUNC_II (u32_be, 4, SIGNED, WRITE32_TO_BE);
-MAKE_PACK_FUNC_II (s32_be, 4, 0, WRITE32_TO_BE);
-MAKE_PACK_FUNC_IF (float_le, gfloat, GFLOAT_TO_LE);
-MAKE_PACK_FUNC_IF (float_be, gfloat, GFLOAT_TO_BE);
-MAKE_PACK_FUNC_IF (double_le, gdouble, GDOUBLE_TO_LE);
-MAKE_PACK_FUNC_IF (double_be, gdouble, GDOUBLE_TO_BE);
-MAKE_PACK_FUNC_FF (float_hq_le, gfloat, GFLOAT_TO_LE);
-MAKE_PACK_FUNC_FF (float_hq_be, gfloat, GFLOAT_TO_BE);
-MAKE_PACK_FUNC_FI_U (u8_float, 1, WRITE8);
-MAKE_PACK_FUNC_FI_S (s8_float, 1, WRITE8);
-MAKE_PACK_FUNC_FI_U (u16_le_float, 2, WRITE16_TO_LE);
-MAKE_PACK_FUNC_FI_S (s16_le_float, 2, WRITE16_TO_LE);
-MAKE_PACK_FUNC_FI_U (u16_be_float, 2, WRITE16_TO_BE);
-MAKE_PACK_FUNC_FI_S (s16_be_float, 2, WRITE16_TO_BE);
-MAKE_PACK_FUNC_FI_U (u24_le_float, 3, WRITE24_TO_LE);
-MAKE_PACK_FUNC_FI_S (s24_le_float, 3, WRITE24_TO_LE);
-MAKE_PACK_FUNC_FI_U (u24_be_float, 3, WRITE24_TO_BE);
-MAKE_PACK_FUNC_FI_S (s24_be_float, 3, WRITE24_TO_BE);
-MAKE_PACK_FUNC_FI_U (u32_le_float, 4, WRITE32_TO_LE);
-MAKE_PACK_FUNC_FI_S (s32_le_float, 4, WRITE32_TO_LE);
-MAKE_PACK_FUNC_FI_U (u32_be_float, 4, WRITE32_TO_BE);
-MAKE_PACK_FUNC_FI_S (s32_be_float, 4, WRITE32_TO_BE);
-
-/* For double_hq, packing and unpacking is the same, so we reuse the unpacking
- * functions here. */
-#define audio_convert_pack_double_hq_le MAKE_UNPACK_FUNC_NAME (double_hq_le)
-#define audio_convert_pack_double_hq_be MAKE_UNPACK_FUNC_NAME (double_hq_be)
-
-static AudioConvertUnpack unpack_funcs[] = {
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (u8),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (s8),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (u8),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (s8),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (u16_le),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (s16_le),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (u16_be),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (s16_be),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (u24_le),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (s24_le),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (u24_be),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (s24_be),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (u32_le),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (s32_le),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (u32_be),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (s32_be),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (float_le),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (float_be),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (double_le),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (double_be),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (float_hq_le),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (float_hq_be),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (double_hq_le),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (double_hq_be),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (u8_float),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (s8_float),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (u8_float),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (s8_float),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (u16_le_float),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (s16_le_float),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (u16_be_float),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (s16_be_float),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (u24_le_float),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (s24_le_float),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (u24_be_float),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (s24_be_float),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (u32_le_float),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (s32_le_float),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (u32_be_float),
- (AudioConvertUnpack) MAKE_UNPACK_FUNC_NAME (s32_be_float),
-};
-
-static AudioConvertPack pack_funcs[] = {
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (u8),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (s8),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (u8),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (s8),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (u16_le),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (s16_le),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (u16_be),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (s16_be),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (u24_le),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (s24_le),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (u24_be),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (s24_be),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (u32_le),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (s32_le),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (u32_be),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (s32_be),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (float_le),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (float_be),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (double_le),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (double_be),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (float_hq_le),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (float_hq_be),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (double_hq_le),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (double_hq_be),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (u8_float),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (s8_float),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (u8_float),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (s8_float),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (u16_le_float),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (s16_le_float),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (u16_be_float),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (s16_be_float),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (u24_le_float),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (s24_le_float),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (u24_be_float),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (s24_be_float),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (u32_le_float),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (s32_le_float),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (u32_be_float),
- (AudioConvertPack) MAKE_PACK_FUNC_NAME (s32_be_float),
-};
-
-#define DOUBLE_INTERMEDIATE_FORMAT(ctx) \
- ((!ctx->in.is_int && !ctx->out.is_int) || (ctx->ns != NOISE_SHAPING_NONE))
-
-static gint
-audio_convert_get_func_index (AudioConvertCtx * ctx, AudioConvertFmt * fmt)
-{
- gint index = 0;
-
- if (fmt->is_int) {
- index += (fmt->width / 8 - 1) * 4;
- index += fmt->endianness == G_LITTLE_ENDIAN ? 0 : 2;
- index += fmt->sign ? 1 : 0;
- index += (ctx->ns == NOISE_SHAPING_NONE) ? 0 : 24;
- } else {
- /* this is float/double */
- index = 16;
- index += (fmt->width == 32) ? 0 : 2;
- index += (fmt->endianness == G_LITTLE_ENDIAN) ? 0 : 1;
- index += (DOUBLE_INTERMEDIATE_FORMAT (ctx)) ? 4 : 0;
- }
-
- return index;
-}
-
-static inline gboolean
-check_default (AudioConvertCtx * ctx, AudioConvertFmt * fmt)
-{
- if (!DOUBLE_INTERMEDIATE_FORMAT (ctx)) {
- return (fmt->width == 32 && fmt->depth == 32 &&
- fmt->endianness == G_BYTE_ORDER && fmt->sign == TRUE);
- } else {
- return (fmt->width == 64 && fmt->endianness == G_BYTE_ORDER);
- }
-}
-
-gboolean
-audio_convert_clean_fmt (AudioConvertFmt * fmt)
-{
- g_return_val_if_fail (fmt != NULL, FALSE);
-
- g_free (fmt->pos);
- fmt->pos = NULL;
-
- return TRUE;
-}
-
-
-gboolean
-audio_convert_prepare_context (AudioConvertCtx * ctx, AudioConvertFmt * in,
- AudioConvertFmt * out, GstAudioConvertDithering dither,
- GstAudioConvertNoiseShaping ns)
-{
- gint idx_in, idx_out;
-
- g_return_val_if_fail (ctx != NULL, FALSE);
- g_return_val_if_fail (in != NULL, FALSE);
- g_return_val_if_fail (out != NULL, FALSE);
-
- /* first clean the existing context */
- audio_convert_clean_context (ctx);
-
- g_return_val_if_fail (in->unpositioned_layout == out->unpositioned_layout,
- FALSE);
-
- ctx->in = *in;
- ctx->out = *out;
-
- /* Don't dither or apply noise shaping if out depth is bigger than 20 bits
- * as DA converters only can do a SNR up to 20 bits in reality.
- * Also don't dither or apply noise shaping if target depth is larger than
- * source depth. */
- if (ctx->out.depth <= 20 && (!ctx->in.is_int
- || ctx->in.depth >= ctx->out.depth)) {
- ctx->dither = dither;
- ctx->ns = ns;
- } else {
- ctx->dither = DITHER_NONE;
- ctx->ns = NOISE_SHAPING_NONE;
- }
-
- /* Use simple error feedback when output sample rate is smaller than
- * 32000 as the other methods might move the noise to audible ranges */
- if (ctx->ns > NOISE_SHAPING_ERROR_FEEDBACK && ctx->out.rate < 32000)
- ctx->ns = NOISE_SHAPING_ERROR_FEEDBACK;
-
- gst_channel_mix_setup_matrix (ctx);
-
- idx_in = audio_convert_get_func_index (ctx, in);
- ctx->unpack = unpack_funcs[idx_in];
-
- idx_out = audio_convert_get_func_index (ctx, out);
- ctx->pack = pack_funcs[idx_out];
-
- /* if both formats are float/double or we use noise shaping use double as
- * intermediate format and and switch mixing */
- if (!DOUBLE_INTERMEDIATE_FORMAT (ctx)) {
- GST_INFO ("use int mixing");
- ctx->channel_mix = (AudioConvertMix) gst_channel_mix_mix_int;
- } else {
- GST_INFO ("use float mixing");
- ctx->channel_mix = (AudioConvertMix) gst_channel_mix_mix_float;
- }
- GST_INFO ("unitsizes: %d -> %d", in->unit_size, out->unit_size);
-
- /* check if input is in default format */
- ctx->in_default = check_default (ctx, in);
- /* check if channel mixer is passthrough */
- ctx->mix_passthrough = gst_channel_mix_passthrough (ctx);
- /* check if output is in default format */
- ctx->out_default = check_default (ctx, out);
-
- GST_INFO ("in default %d, mix passthrough %d, out default %d",
- ctx->in_default, ctx->mix_passthrough, ctx->out_default);
-
- ctx->in_scale = (in->is_int) ? (32 - in->depth) : 0;
- ctx->out_scale = (out->is_int) ? (32 - out->depth) : 0;
-
- gst_audio_quantize_setup (ctx);
-
- return TRUE;
-}
-
-gboolean
-audio_convert_clean_context (AudioConvertCtx * ctx)
-{
- g_return_val_if_fail (ctx != NULL, FALSE);
-
- gst_audio_quantize_free (ctx);
- audio_convert_clean_fmt (&ctx->in);
- audio_convert_clean_fmt (&ctx->out);
- gst_channel_mix_unset_matrix (ctx);
-
- g_free (ctx->tmpbuf);
- ctx->tmpbuf = NULL;
- ctx->tmpbufsize = 0;
-
- return TRUE;
-}
-
-gboolean
-audio_convert_get_sizes (AudioConvertCtx * ctx, gint samples, gint * srcsize,
- gint * dstsize)
-{
- g_return_val_if_fail (ctx != NULL, FALSE);
-
- if (srcsize)
- *srcsize = samples * ctx->in.unit_size;
- if (dstsize)
- *dstsize = samples * ctx->out.unit_size;
-
- return TRUE;
-}
-
-gboolean
-audio_convert_convert (AudioConvertCtx * ctx, gpointer src,
- gpointer dst, gint samples, gboolean src_writable)
-{
- guint insize, outsize, size;
- gpointer outbuf, tmpbuf;
- guint intemp = 0, outtemp = 0, biggest;
-
- g_return_val_if_fail (ctx != NULL, FALSE);
- g_return_val_if_fail (src != NULL, FALSE);
- g_return_val_if_fail (dst != NULL, FALSE);
- g_return_val_if_fail (samples >= 0, FALSE);
-
- if (samples == 0)
- return TRUE;
-
- insize = ctx->in.unit_size * samples;
- outsize = ctx->out.unit_size * samples;
-
- /* find biggest temp buffer size */
- size = (DOUBLE_INTERMEDIATE_FORMAT (ctx)) ? sizeof (gdouble)
- : sizeof (gint32);
-
- if (!ctx->in_default)
- intemp = gst_util_uint64_scale (insize, size * 8, ctx->in.width);
- if (!ctx->mix_passthrough || !ctx->out_default)
- outtemp = gst_util_uint64_scale (outsize, size * 8, ctx->out.width);
- biggest = MAX (intemp, outtemp);
-
- /* see if one of the buffers can be used as temp */
- if ((outsize >= biggest) && (ctx->out.unit_size <= size))
- tmpbuf = dst;
- else if ((insize >= biggest) && src_writable && (ctx->in.unit_size >= size))
- tmpbuf = src;
- else {
- if (biggest > ctx->tmpbufsize) {
- ctx->tmpbuf = g_realloc (ctx->tmpbuf, biggest);
- ctx->tmpbufsize = biggest;
- }
- tmpbuf = ctx->tmpbuf;
- }
-
- /* start conversion */
- if (!ctx->in_default) {
- /* check if final conversion */
- if (!(ctx->out_default && ctx->mix_passthrough))
- outbuf = tmpbuf;
- else
- outbuf = dst;
-
- /* unpack to default format */
- ctx->unpack (src, outbuf, ctx->in_scale, samples * ctx->in.channels);
-
- src = outbuf;
- }
-
- if (!ctx->mix_passthrough) {
- /* check if final conversion */
- if (!ctx->out_default)
- outbuf = tmpbuf;
- else
- outbuf = dst;
-
- /* convert channels */
- ctx->channel_mix (ctx, src, outbuf, samples);
-
- src = outbuf;
- }
-
- /* we only need to quantize if output format is int */
- if (ctx->out.is_int) {
- if (ctx->out_default)
- outbuf = dst;
- else
- outbuf = tmpbuf;
- ctx->quantize (ctx, src, outbuf, samples);
- }
-
- if (!ctx->out_default) {
- /* pack default format into dst */
- ctx->pack (src, dst, ctx->out_scale, samples * ctx->out.channels);
- }
-
- return TRUE;
-}
diff --git a/gst/audioconvert/audioconvert.h b/gst/audioconvert/audioconvert.h
deleted file mode 100644
index 98ce829f..00000000
--- a/gst/audioconvert/audioconvert.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/* GStreamer
- * Copyright (C) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * audioconvert.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __AUDIO_CONVERT_H__
-#define __AUDIO_CONVERT_H__
-
-#include <gst/gst.h>
-#include <gst/audio/multichannel.h>
-
-/**
- * GstAudioConvertDithering:
- * @DITHER_NONE: No dithering
- * @DITHER_RPDF: Rectangular dithering
- * @DITHER_TPDF: Triangular dithering (default)
- * @DITHER_TPDF_HF: High frequency triangular dithering
- *
- * Set of available dithering methods when converting audio.
- */
-typedef enum
-{
- DITHER_NONE = 0,
- DITHER_RPDF,
- DITHER_TPDF,
- DITHER_TPDF_HF
-} GstAudioConvertDithering;
-
-/**
- * GstAudioConvertNoiseShaping:
- * @NOISE_SHAPING_NONE: No noise shaping (default)
- * @NOISE_SHAPING_ERROR_FEEDBACK: Error feedback
- * @NOISE_SHAPING_SIMPLE: Simple 2-pole noise shaping
- * @NOISE_SHAPING_MEDIUM: Medium 5-pole noise shaping
- * @NOISE_SHAPING_HIGH: High 8-pole noise shaping
- *
- * Set of available noise shaping methods
- */
-typedef enum
-{
- NOISE_SHAPING_NONE = 0,
- NOISE_SHAPING_ERROR_FEEDBACK,
- NOISE_SHAPING_SIMPLE,
- NOISE_SHAPING_MEDIUM,
- NOISE_SHAPING_HIGH
-} GstAudioConvertNoiseShaping;
-
-typedef struct _AudioConvertCtx AudioConvertCtx;
-typedef struct _AudioConvertFmt AudioConvertFmt;
-
-struct _AudioConvertFmt
-{
- /* general caps */
- gboolean is_int;
- gint endianness;
- gint width;
- gint rate;
- gint channels;
- GstAudioChannelPosition *pos;
- gboolean unpositioned_layout;
-
- /* int audio caps */
- gboolean sign;
- gint depth;
-
- gint unit_size;
-};
-
-typedef void (*AudioConvertUnpack) (gpointer src, gpointer dst, gint scale,
- gint count);
-typedef void (*AudioConvertPack) (gpointer src, gpointer dst, gint scale,
- gint count);
-
-typedef void (*AudioConvertMix) (AudioConvertCtx *, gpointer, gpointer, gint);
-typedef void (*AudioConvertQuantize) (AudioConvertCtx * ctx, gpointer src,
- gpointer dst, gint count);
-
-struct _AudioConvertCtx
-{
- AudioConvertFmt in;
- AudioConvertFmt out;
-
- AudioConvertUnpack unpack;
- AudioConvertPack pack;
-
- /* channel conversion matrix, m[in_channels][out_channels].
- * If identity matrix, passthrough applies. */
- gfloat **matrix;
- /* temp storage for channelmix */
- gpointer tmp;
-
- gboolean in_default;
- gboolean mix_passthrough;
- gboolean out_default;
-
- gpointer tmpbuf;
- gint tmpbufsize;
-
- gint in_scale;
- gint out_scale;
-
- AudioConvertMix channel_mix;
-
- AudioConvertQuantize quantize;
-
- GstAudioConvertDithering dither;
- GstAudioConvertNoiseShaping ns;
- /* last random number generated per channel for hifreq TPDF dither */
- gpointer last_random;
- /* contains the past quantization errors, error[out_channels][count] */
- gdouble *error_buf;
-};
-
-gboolean audio_convert_clean_fmt (AudioConvertFmt * fmt);
-
-gboolean audio_convert_prepare_context (AudioConvertCtx * ctx,
- AudioConvertFmt * in, AudioConvertFmt * out,
- GstAudioConvertDithering dither, GstAudioConvertNoiseShaping ns);
-gboolean audio_convert_get_sizes (AudioConvertCtx * ctx, gint samples,
- gint * srcsize, gint * dstsize);
-
-gboolean audio_convert_clean_context (AudioConvertCtx * ctx);
-
-gboolean audio_convert_convert (AudioConvertCtx * ctx, gpointer src,
- gpointer dst, gint samples, gboolean src_writable);
-
-#endif /* __AUDIO_CONVERT_H__ */
diff --git a/gst/audioconvert/audioconvert.vcproj b/gst/audioconvert/audioconvert.vcproj
deleted file mode 100644
index efa18333..00000000
--- a/gst/audioconvert/audioconvert.vcproj
+++ /dev/null
@@ -1,154 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="audioconvert"
- ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D678A5}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../win32/Debug"
- IntermediateDirectory="../../win32/Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;audioconvert_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstaudioconvert.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Debug;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/audioconvert.pdb"
- SubSystem="2"
- OptimizeReferences="2"
- ImportLibrary="$(OutDir)/gstaudioconvert.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../win32/Release"
- IntermediateDirectory="../../win32/Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;audioconvert_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstaudioconvert.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Release;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/gstaudioconvert.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath=".\gstaudioconvert.c">
- </File>
- <File
- RelativePath=".\bufferframesconvert.c">
- </File>
- <File
- RelativePath=".\plugin.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- <File
- RelativePath=".\plugin.h">
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/gst/audioconvert/channelmixtest.c b/gst/audioconvert/channelmixtest.c
deleted file mode 100644
index 096a6830..00000000
--- a/gst/audioconvert/channelmixtest.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005 Benjamin Otte <otte@gnome.org>
- *
- * channelmixtest.c: simple test of channel mixing
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstchannelmix.h"
-#include "plugin.h"
-
-int
-main (gint argc, gchar ** argv)
-{
- GstElement *bin, *src, *sink;
- GstAudioConvert *c;
- GstCaps *caps;
- guint i, j, k;
- struct
- {
- gchar *sinkcaps;
- gchar *srccaps;
- gfloat matrix[6][6]; /* use a predefined matrix here, makes stuff simpler */
- } tests[] = {
- /* stereo => mono */
- {
- "audio/x-raw-int, channels=2", "audio/x-raw-int, channels=1", { {
- 0.5,}, {
- 0.5,},}},
- /* mono => stereo */
- {
- "audio/x-raw-int, channels=1", "audio/x-raw-int, channels=2", { {
- 1, 1,},}}
- };
-
- gst_init (&argc, &argv);
-
- for (i = 0; i < G_N_ELEMENTS (tests); i++) {
- g_print ("running test %u\n", i);
- bin = gst_element_factory_make ("pipeline", NULL);
- c = g_object_new (GST_TYPE_AUDIO_CONVERT, NULL);
- /* avoid gst being braindead */
- gst_object_set_name (GST_OBJECT (c), "shuddup");
- src = gst_element_factory_make ("fakesrc", NULL);
- sink = gst_element_factory_make ("fakesink", NULL);
- gst_bin_add_many (GST_BIN (bin), src, c, sink, NULL);
- caps = gst_caps_from_string (tests[i].sinkcaps);
- g_assert (caps);
- if (!gst_element_link_filtered (src, GST_ELEMENT (c), caps))
- g_assert_not_reached ();
- gst_caps_unref (caps);
- caps = gst_caps_from_string (tests[i].srccaps);
- g_assert (caps);
- if (!gst_element_link_filtered (GST_ELEMENT (c), sink, caps))
- g_assert_not_reached ();
- gst_caps_unref (caps);
- if (!gst_element_set_state (bin, GST_STATE_PLAYING))
- g_assert_not_reached ();
- g_assert (c->srccaps.channels <= 6);
- g_assert (c->sinkcaps.channels <= 6);
- for (j = 0; j < 6; j++) {
- for (k = 0; k < 6; k++) {
- if (j < c->sinkcaps.channels && k < c->srccaps.channels) {
- if (tests[i].matrix[j][k] != c->matrix[j][k]) {
- g_printerr ("matrix[j][k] should be %g but is %g\n",
- tests[i].matrix[j][k], c->matrix[j][k]);
- g_assert_not_reached ();
- }
- } else {
- g_assert (tests[i].matrix[j][k] == 0);
- }
- }
- }
- gst_object_unref (bin);
- }
-
- return 0;
-}
diff --git a/gst/audioconvert/gstaudioconvert.c b/gst/audioconvert/gstaudioconvert.c
deleted file mode 100644
index 74db1625..00000000
--- a/gst/audioconvert/gstaudioconvert.c
+++ /dev/null
@@ -1,1180 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- * Copyright (C) 2005 Thomas Vander Stichele <thomas at apestaart dot org>
- * Copyright (C) 2005 Wim Taymans <wim at fluendo dot com>
- *
- * gstaudioconvert.c: Convert audio to different audio formats automatically
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-/**
- * SECTION:element-audioconvert
- *
- * Audioconvert converts raw audio buffers between various possible formats.
- * It supports integer to float conversion, width/depth conversion,
- * signedness and endianness conversion and channel transformations.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch -v -m audiotestsrc ! audioconvert ! audio/x-raw-int,channels=2,width=8,depth=8 ! level ! fakesink silent=TRUE
- * ]| This pipeline converts audio to 8-bit. The level element shows that
- * the output levels still match the one for a sine wave.
- * |[
- * gst-launch -v -m audiotestsrc ! audioconvert ! vorbisenc ! fakesink silent=TRUE
- * ]| The vorbis encoder takes float audio data instead of the integer data
- * generated by audiotestsrc.
- * </refsect2>
- *
- * Last reviewed on 2006-03-02 (0.10.4)
- */
-
-/*
- * design decisions:
- * - audioconvert converts buffers in a set of supported caps. If it supports
- * a caps, it supports conversion from these caps to any other caps it
- * supports. (example: if it does A=>B and A=>C, it also does B=>C)
- * - audioconvert does not save state between buffers. Every incoming buffer is
- * converted and the converted buffer is pushed out.
- * conclusion:
- * audioconvert is not supposed to be a one-element-does-anything solution for
- * audio conversions.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include "gstaudioconvert.h"
-#include "gstchannelmix.h"
-#include "gstaudioquantize.h"
-#include "plugin.h"
-
-GST_DEBUG_CATEGORY (audio_convert_debug);
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE);
-
-/*** DEFINITIONS **************************************************************/
-
-static const GstElementDetails audio_convert_details =
-GST_ELEMENT_DETAILS ("Audio converter",
- "Filter/Converter/Audio",
- "Convert audio to different formats",
- "Benjamin Otte <in7y118@public.uni-hamburg.de>");
-
-/* type functions */
-static void gst_audio_convert_dispose (GObject * obj);
-
-/* gstreamer functions */
-static gboolean gst_audio_convert_get_unit_size (GstBaseTransform * base,
- GstCaps * caps, guint * size);
-static GstCaps *gst_audio_convert_transform_caps (GstBaseTransform * base,
- GstPadDirection direction, GstCaps * caps);
-static void gst_audio_convert_fixate_caps (GstBaseTransform * base,
- GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
-static gboolean gst_audio_convert_set_caps (GstBaseTransform * base,
- GstCaps * incaps, GstCaps * outcaps);
-static GstFlowReturn gst_audio_convert_transform (GstBaseTransform * base,
- GstBuffer * inbuf, GstBuffer * outbuf);
-static GstFlowReturn gst_audio_convert_transform_ip (GstBaseTransform * base,
- GstBuffer * buf);
-static void gst_audio_convert_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_audio_convert_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static gboolean structure_has_fixed_channel_positions (GstStructure * s,
- gboolean * unpositioned_layout);
-
-/* AudioConvert signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- ARG_0,
- ARG_DITHERING,
- ARG_NOISE_SHAPING,
-};
-
-#define DEBUG_INIT(bla) \
- GST_DEBUG_CATEGORY_INIT (audio_convert_debug, "audioconvert", 0, "audio conversion element"); \
- GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
-
-GST_BOILERPLATE_FULL (GstAudioConvert, gst_audio_convert, GstBaseTransform,
- GST_TYPE_BASE_TRANSFORM, DEBUG_INIT);
-
-/*** GSTREAMER PROTOTYPES *****************************************************/
-
-#define STATIC_CAPS \
-GST_STATIC_CAPS ( \
- "audio/x-raw-float, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
- "width = (int) 64;" \
- "audio/x-raw-float, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
- "width = (int) 32;" \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
- "width = (int) 32, " \
- "depth = (int) [ 1, 32 ], " \
- "signed = (boolean) { true, false }; " \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
- "width = (int) 24, " \
- "depth = (int) [ 1, 24 ], " "signed = (boolean) { true, false }; " \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
- "width = (int) 16, " \
- "depth = (int) [ 1, 16 ], " \
- "signed = (boolean) { true, false }; " \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
- "width = (int) 8, " \
- "depth = (int) [ 1, 8 ], " \
- "signed = (boolean) { true, false } " \
-)
-
-static GstStaticPadTemplate gst_audio_convert_src_template =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- STATIC_CAPS);
-
-static GstStaticPadTemplate gst_audio_convert_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- STATIC_CAPS);
-
-#define GST_TYPE_AUDIO_CONVERT_DITHERING (gst_audio_convert_dithering_get_type ())
-static GType
-gst_audio_convert_dithering_get_type (void)
-{
- static GType gtype = 0;
-
- if (gtype == 0) {
- static const GEnumValue values[] = {
- {DITHER_NONE, "No dithering",
- "none"},
- {DITHER_RPDF, "Rectangular dithering", "rpdf"},
- {DITHER_TPDF, "Triangular dithering (default)", "tpdf"},
- {DITHER_TPDF_HF, "High frequency triangular dithering", "tpdf-hf"},
- {0, NULL, NULL}
- };
-
- gtype = g_enum_register_static ("GstAudioConvertDithering", values);
- }
- return gtype;
-}
-
-#define GST_TYPE_AUDIO_CONVERT_NOISE_SHAPING (gst_audio_convert_ns_get_type ())
-static GType
-gst_audio_convert_ns_get_type (void)
-{
- static GType gtype = 0;
-
- if (gtype == 0) {
- static const GEnumValue values[] = {
- {NOISE_SHAPING_NONE, "No noise shaping (default)",
- "none"},
- {NOISE_SHAPING_ERROR_FEEDBACK, "Error feedback", "error-feedback"},
- {NOISE_SHAPING_SIMPLE, "Simple 2-pole noise shaping", "simple"},
- {NOISE_SHAPING_MEDIUM, "Medium 5-pole noise shaping", "medium"},
- {NOISE_SHAPING_HIGH, "High 8-pole noise shaping", "high"},
- {0, NULL, NULL}
- };
-
- gtype = g_enum_register_static ("GstAudioConvertNoiseShaping", values);
- }
- return gtype;
-}
-
-
-/*** TYPE FUNCTIONS ***********************************************************/
-
-static void
-gst_audio_convert_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_audio_convert_src_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_audio_convert_sink_template));
- gst_element_class_set_details (element_class, &audio_convert_details);
-}
-
-static void
-gst_audio_convert_class_init (GstAudioConvertClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstBaseTransformClass *basetransform_class = GST_BASE_TRANSFORM_CLASS (klass);
-
- gobject_class->dispose = gst_audio_convert_dispose;
- gobject_class->set_property = gst_audio_convert_set_property;
- gobject_class->get_property = gst_audio_convert_get_property;
-
- g_object_class_install_property (gobject_class, ARG_DITHERING,
- g_param_spec_enum ("dithering", "Dithering",
- "Selects between different dithering methods.",
- GST_TYPE_AUDIO_CONVERT_DITHERING, DITHER_TPDF,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, ARG_NOISE_SHAPING,
- g_param_spec_enum ("noise-shaping", "Noise shaping",
- "Selects between different noise shaping methods.",
- GST_TYPE_AUDIO_CONVERT_NOISE_SHAPING, NOISE_SHAPING_NONE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- basetransform_class->get_unit_size =
- GST_DEBUG_FUNCPTR (gst_audio_convert_get_unit_size);
- basetransform_class->transform_caps =
- GST_DEBUG_FUNCPTR (gst_audio_convert_transform_caps);
- basetransform_class->fixate_caps =
- GST_DEBUG_FUNCPTR (gst_audio_convert_fixate_caps);
- basetransform_class->set_caps =
- GST_DEBUG_FUNCPTR (gst_audio_convert_set_caps);
- basetransform_class->transform_ip =
- GST_DEBUG_FUNCPTR (gst_audio_convert_transform_ip);
- basetransform_class->transform =
- GST_DEBUG_FUNCPTR (gst_audio_convert_transform);
-
- basetransform_class->passthrough_on_same_caps = TRUE;
-}
-
-static void
-gst_audio_convert_init (GstAudioConvert * this, GstAudioConvertClass * g_class)
-{
- this->dither = DITHER_TPDF;
- this->ns = NOISE_SHAPING_NONE;
- memset (&this->ctx, 0, sizeof (AudioConvertCtx));
-
- gst_base_transform_set_gap_aware (GST_BASE_TRANSFORM (this), TRUE);
-}
-
-static void
-gst_audio_convert_dispose (GObject * obj)
-{
- GstAudioConvert *this = GST_AUDIO_CONVERT (obj);
-
- audio_convert_clean_context (&this->ctx);
-
- G_OBJECT_CLASS (parent_class)->dispose (obj);
-}
-
-/*** GSTREAMER FUNCTIONS ******************************************************/
-
-/* convert the given GstCaps to our format */
-static gboolean
-gst_audio_convert_parse_caps (const GstCaps * caps, AudioConvertFmt * fmt)
-{
- GstStructure *structure = gst_caps_get_structure (caps, 0);
-
- GST_DEBUG ("parse caps %p and %" GST_PTR_FORMAT, caps, caps);
-
- g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
- g_return_val_if_fail (fmt != NULL, FALSE);
-
- /* cleanup old */
- audio_convert_clean_fmt (fmt);
-
- fmt->endianness = G_BYTE_ORDER;
- fmt->is_int =
- (strcmp (gst_structure_get_name (structure), "audio/x-raw-int") == 0);
-
- /* parse common fields */
- if (!gst_structure_get_int (structure, "channels", &fmt->channels))
- goto no_values;
- if (!(fmt->pos = gst_audio_get_channel_positions (structure)))
- goto no_values;
-
- fmt->unpositioned_layout = FALSE;
- structure_has_fixed_channel_positions (structure, &fmt->unpositioned_layout);
-
- if (!gst_structure_get_int (structure, "width", &fmt->width))
- goto no_values;
- if (!gst_structure_get_int (structure, "rate", &fmt->rate))
- goto no_values;
- /* width != 8 needs an endianness field */
- if (fmt->width != 8) {
- if (!gst_structure_get_int (structure, "endianness", &fmt->endianness))
- goto no_values;
- }
-
- if (fmt->is_int) {
- /* int specific fields */
- if (!gst_structure_get_boolean (structure, "signed", &fmt->sign))
- goto no_values;
- if (!gst_structure_get_int (structure, "depth", &fmt->depth))
- goto no_values;
-
- /* depth cannot be bigger than the width */
- if (fmt->depth > fmt->width)
- goto not_allowed;
- }
-
- fmt->unit_size = (fmt->width * fmt->channels) / 8;
-
- return TRUE;
-
- /* ERRORS */
-no_values:
- {
- GST_DEBUG ("could not get some values from structure");
- audio_convert_clean_fmt (fmt);
- return FALSE;
- }
-not_allowed:
- {
- GST_DEBUG ("width > depth, not allowed - make us advertise correct fmt");
- audio_convert_clean_fmt (fmt);
- return FALSE;
- }
-}
-
-/* BaseTransform vmethods */
-static gboolean
-gst_audio_convert_get_unit_size (GstBaseTransform * base, GstCaps * caps,
- guint * size)
-{
- AudioConvertFmt fmt = { 0 };
-
- g_assert (size);
-
- if (!gst_audio_convert_parse_caps (caps, &fmt))
- goto parse_error;
-
- GST_INFO_OBJECT (base, "unit_size = %u", fmt.unit_size);
- *size = fmt.unit_size;
-
- audio_convert_clean_fmt (&fmt);
-
- return TRUE;
-
-parse_error:
- {
- GST_INFO_OBJECT (base, "failed to parse caps to get unit_size");
- return FALSE;
- }
-}
-
-/* Set widths (a list); multiples of 8 between min and max */
-static void
-set_structure_widths (GstStructure * s, int min, int max)
-{
- GValue list = { 0 };
- GValue val = { 0 };
- int width;
-
- if (min == max) {
- gst_structure_set (s, "width", G_TYPE_INT, min, NULL);
- return;
- }
-
- g_value_init (&list, GST_TYPE_LIST);
- g_value_init (&val, G_TYPE_INT);
- for (width = min; width <= max; width += 8) {
- g_value_set_int (&val, width);
- gst_value_list_append_value (&list, &val);
- }
- gst_structure_set_value (s, "width", &list);
- g_value_unset (&val);
- g_value_unset (&list);
-}
-
-/* Set widths of 32 bits and 64 bits (as list) */
-static void
-set_structure_widths_32_and_64 (GstStructure * s)
-{
- GValue list = { 0 };
- GValue val = { 0 };
-
- g_value_init (&list, GST_TYPE_LIST);
- g_value_init (&val, G_TYPE_INT);
- g_value_set_int (&val, 32);
- gst_value_list_append_value (&list, &val);
- g_value_set_int (&val, 64);
- gst_value_list_append_value (&list, &val);
- gst_structure_set_value (s, "width", &list);
- g_value_unset (&val);
- g_value_unset (&list);
-}
-
-/* Modify the structure so that things that must always have a single
- * value (for float), or can always be losslessly converted (for int), have
- * appropriate values.
- */
-static GstStructure *
-make_lossless_changes (GstStructure * s, gboolean isfloat)
-{
- GValue list = { 0 };
- GValue val = { 0 };
- int i;
- const gint endian[] = { G_LITTLE_ENDIAN, G_BIG_ENDIAN };
- const gboolean booleans[] = { TRUE, FALSE };
-
- g_value_init (&list, GST_TYPE_LIST);
- g_value_init (&val, G_TYPE_INT);
- for (i = 0; i < 2; i++) {
- g_value_set_int (&val, endian[i]);
- gst_value_list_append_value (&list, &val);
- }
- gst_structure_set_value (s, "endianness", &list);
- g_value_unset (&val);
- g_value_unset (&list);
-
- if (isfloat) {
- /* float doesn't have a depth or signedness field and only supports
- * widths of 32 and 64 bits */
- gst_structure_remove_field (s, "depth");
- gst_structure_remove_field (s, "signed");
- set_structure_widths_32_and_64 (s);
- } else {
- /* int supports signed and unsigned. GValues are a pain */
- g_value_init (&list, GST_TYPE_LIST);
- g_value_init (&val, G_TYPE_BOOLEAN);
- for (i = 0; i < 2; i++) {
- g_value_set_boolean (&val, booleans[i]);
- gst_value_list_append_value (&list, &val);
- }
- gst_structure_set_value (s, "signed", &list);
- g_value_unset (&val);
- g_value_unset (&list);
- }
-
- return s;
-}
-
-static void
-strip_width_64 (GstStructure * s)
-{
- const GValue *v = gst_structure_get_value (s, "width");
- GValue widths = { 0 };
-
- if (GST_VALUE_HOLDS_LIST (v)) {
- int i;
- int len = gst_value_list_get_size (v);
-
- g_value_init (&widths, GST_TYPE_LIST);
-
- for (i = 0; i < len; i++) {
- const GValue *width = gst_value_list_get_value (v, i);
-
- if (g_value_get_int (width) != 64)
- gst_value_list_append_value (&widths, width);
- }
- gst_structure_set_value (s, "width", &widths);
- g_value_unset (&widths);
- }
-}
-
-/* Little utility function to create a related structure for float/int */
-static void
-append_with_other_format (GstCaps * caps, GstStructure * s, gboolean isfloat)
-{
- GstStructure *s2;
-
- if (isfloat) {
- s2 = gst_structure_copy (s);
- gst_structure_set_name (s2, "audio/x-raw-int");
- s = make_lossless_changes (s2, FALSE);
- /* If 64 bit float was allowed; remove width 64: we don't support it for
- * integer*/
- strip_width_64 (s);
- gst_caps_append_structure (caps, s2);
- } else {
- s2 = gst_structure_copy (s);
- gst_structure_set_name (s2, "audio/x-raw-float");
- s = make_lossless_changes (s2, TRUE);
- gst_caps_append_structure (caps, s2);
- }
-}
-
-static gboolean
-structure_has_fixed_channel_positions (GstStructure * s,
- gboolean * unpositioned_layout)
-{
- GstAudioChannelPosition *pos;
- const GValue *val;
- gint channels = 0;
-
- if (!gst_structure_get_int (s, "channels", &channels))
- return FALSE; /* probably a range */
-
- val = gst_structure_get_value (s, "channel-positions");
- if ((val == NULL || !gst_value_is_fixed (val)) && channels <= 8) {
- GST_LOG ("no or unfixed channel-positions in %" GST_PTR_FORMAT, s);
- return FALSE;
- } else if (val == NULL || !gst_value_is_fixed (val)) {
- GST_LOG ("implicit undefined channel-positions");
- *unpositioned_layout = TRUE;
- return TRUE;
- }
-
- pos = gst_audio_get_channel_positions (s);
- if (pos && pos[0] == GST_AUDIO_CHANNEL_POSITION_NONE) {
- GST_LOG ("fixed undefined channel-positions in %" GST_PTR_FORMAT, s);
- *unpositioned_layout = TRUE;
- } else {
- GST_LOG ("fixed defined channel-positions in %" GST_PTR_FORMAT, s);
- *unpositioned_layout = FALSE;
- }
- g_free (pos);
-
- return TRUE;
-}
-
-/* Audioconvert can perform all conversions on audio except for resampling.
- * However, there are some conversions we _prefer_ not to do. For example, it's
- * better to convert format (float<->int, endianness, etc) than the number of
- * channels, as the latter conversion is not lossless.
- *
- * So, we return, in order (assuming input caps have only one structure;
- * which is enforced by basetransform):
- * - input caps with a different format (lossless conversions).
- * - input caps with a different format (slightly lossy conversions).
- * - input caps with a different number of channels (very lossy!)
- */
-static GstCaps *
-gst_audio_convert_transform_caps (GstBaseTransform * base,
- GstPadDirection direction, GstCaps * caps)
-{
- GstCaps *ret;
- GstStructure *s, *structure;
- gboolean isfloat, allow_mixing;
- gint width, depth, channels = 0;
- const gchar *fields_used[] = {
- "width", "depth", "rate", "channels", "endianness", "signed"
- };
- const gchar *structure_name;
- int i;
-
- g_return_val_if_fail (GST_CAPS_IS_SIMPLE (caps), NULL);
-
- structure = gst_caps_get_structure (caps, 0);
- structure_name = gst_structure_get_name (structure);
-
- isfloat = strcmp (structure_name, "audio/x-raw-float") == 0;
-
- /* We operate on a version of the original structure with any additional
- * fields absent */
- s = gst_structure_empty_new (structure_name);
- for (i = 0; i < sizeof (fields_used) / sizeof (*fields_used); i++) {
- if (gst_structure_has_field (structure, fields_used[i]))
- gst_structure_set_value (s, fields_used[i],
- gst_structure_get_value (structure, fields_used[i]));
- }
-
- if (!isfloat) {
- /* Commonly, depth is left out: set it equal to width if we have a fixed
- * width, if so */
- if (!gst_structure_has_field (s, "depth") &&
- gst_structure_get_int (s, "width", &width))
- gst_structure_set (s, "depth", G_TYPE_INT, width, NULL);
- }
-
- ret = gst_caps_new_empty ();
-
- /* All lossless conversions */
- s = make_lossless_changes (s, isfloat);
- gst_caps_append_structure (ret, s);
-
- /* Same, plus a float<->int conversion */
- append_with_other_format (ret, s, isfloat);
- GST_DEBUG_OBJECT (base, " step1: (%d) %" GST_PTR_FORMAT,
- gst_caps_get_size (ret), ret);
-
- /* We don't mind increasing width/depth/channels, but reducing them is
- * Very Bad. Only available if width, depth, channels are already fixed. */
- s = gst_structure_copy (s);
- if (!isfloat) {
- if (gst_structure_get_int (structure, "width", &width))
- set_structure_widths (s, width, 32);
- if (gst_structure_get_int (structure, "depth", &depth)) {
- if (depth == 32)
- gst_structure_set (s, "depth", G_TYPE_INT, 32, NULL);
- else
- gst_structure_set (s, "depth", GST_TYPE_INT_RANGE, depth, 32, NULL);
- }
- }
-
- allow_mixing = TRUE;
- if (gst_structure_get_int (structure, "channels", &channels)) {
- gboolean unpositioned;
-
- /* we don't support mixing for channels without channel positions */
- if (structure_has_fixed_channel_positions (structure, &unpositioned))
- allow_mixing = (unpositioned == FALSE);
- }
-
- if (!allow_mixing) {
- gst_structure_set (s, "channels", G_TYPE_INT, channels, NULL);
- if (gst_structure_has_field (structure, "channel-positions"))
- gst_structure_set_value (s, "channel-positions",
- gst_structure_get_value (structure, "channel-positions"));
- } else {
- if (channels == 0)
- gst_structure_set (s, "channels", GST_TYPE_INT_RANGE, 1, 11, NULL);
- else if (channels == 11)
- gst_structure_set (s, "channels", G_TYPE_INT, 11, NULL);
- else
- gst_structure_set (s, "channels", GST_TYPE_INT_RANGE, channels, 11, NULL);
- gst_structure_remove_field (s, "channel-positions");
- }
- gst_caps_append_structure (ret, s);
-
- /* Same, plus a float<->int conversion */
- append_with_other_format (ret, s, isfloat);
-
- /* We'll reduce depth if we must. We reduce as low as 16 bits (for integer);
- * reducing to less than this is even worse than dropping channels. We only
- * do this if we haven't already done the equivalent above. */
- if (!gst_structure_get_int (structure, "width", &width) || width > 16) {
- if (isfloat) {
- GstStructure *s2 = gst_structure_copy (s);
-
- set_structure_widths_32_and_64 (s2);
- append_with_other_format (ret, s2, TRUE);
- gst_structure_free (s2);
- } else {
- s = gst_structure_copy (s);
- set_structure_widths (s, 16, 32);
- gst_structure_set (s, "depth", GST_TYPE_INT_RANGE, 16, 32, NULL);
- gst_caps_append_structure (ret, s);
- }
- }
-
- /* Channel conversions to fewer channels is only done if needed - generally
- * it's very bad to drop channels entirely.
- */
- s = gst_structure_copy (s);
- if (allow_mixing) {
- gst_structure_set (s, "channels", GST_TYPE_INT_RANGE, 1, 11, NULL);
- gst_structure_remove_field (s, "channel-positions");
- } else {
- /* allow_mixing can only be FALSE if we got a fixed number of channels */
- gst_structure_set (s, "channels", G_TYPE_INT, channels, NULL);
- if (gst_structure_has_field (structure, "channel-positions"))
- gst_structure_set_value (s, "channel-positions",
- gst_structure_get_value (structure, "channel-positions"));
- }
- gst_caps_append_structure (ret, s);
-
- /* Same, plus a float<->int conversion */
- append_with_other_format (ret, s, isfloat);
-
- /* And, finally, for integer only, we allow conversion to any width/depth we
- * support: this should be equivalent to our (non-float) template caps. (the
- * floating point case should be being handled just above) */
- s = gst_structure_copy (s);
- set_structure_widths (s, 8, 32);
- gst_structure_set (s, "depth", GST_TYPE_INT_RANGE, 1, 32, NULL);
-
- if (isfloat) {
- append_with_other_format (ret, s, TRUE);
- gst_structure_free (s);
- } else
- gst_caps_append_structure (ret, s);
-
- GST_DEBUG_OBJECT (base, "Caps transformed to %" GST_PTR_FORMAT, ret);
-
- return ret;
-}
-
-static const GstAudioChannelPosition default_positions[8][8] = {
- /* 1 channel */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_MONO,
- },
- /* 2 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- },
- /* 3 channels (2.1) */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_LFE, /* or FRONT_CENTER for 3.0? */
- },
- /* 4 channels (4.0 or 3.1?) */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- },
- /* 5 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- },
- /* 6 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- },
- /* 7 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
- },
- /* 8 channels */
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
- GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
- }
-};
-
-static const GValue *
-find_suitable_channel_layout (const GValue * val, guint chans)
-{
- /* if output layout is fixed already and looks sane, we're done */
- if (GST_VALUE_HOLDS_ARRAY (val) && gst_value_array_get_size (val) == chans)
- return val;
-
- /* if it's a list, go through it recursively and return the first
- * sane-enough looking value we find */
- if (GST_VALUE_HOLDS_LIST (val)) {
- gint i;
-
- for (i = 0; i < gst_value_list_get_size (val); ++i) {
- const GValue *v, *ret;
-
- v = gst_value_list_get_value (val, i);
- if ((ret = find_suitable_channel_layout (v, chans)))
- return ret;
- }
- }
-
- return NULL;
-}
-
-static void
-gst_audio_convert_fixate_channels (GstBaseTransform * base, GstStructure * ins,
- GstStructure * outs)
-{
- const GValue *in_layout, *out_layout;
- gint in_chans, out_chans;
-
- if (!gst_structure_get_int (ins, "channels", &in_chans))
- return; /* this shouldn't really happen, should it? */
-
- if (!gst_structure_has_field (outs, "channels")) {
- /* we could try to get the implied number of channels from the layout,
- * but that seems overdoing it for a somewhat exotic corner case */
- gst_structure_remove_field (outs, "channel-positions");
- return;
- }
-
- /* ok, let's fixate the channels if they are not fixated yet */
- gst_structure_fixate_field_nearest_int (outs, "channels", in_chans);
-
- if (!gst_structure_get_int (outs, "channels", &out_chans)) {
- /* shouldn't really happen ... */
- gst_structure_remove_field (outs, "channel-positions");
- return;
- }
-
- /* check if the output has a channel layout (or a list of layouts) */
- out_layout = gst_structure_get_value (outs, "channel-positions");
-
- /* get the channel layout of the input if any */
- in_layout = gst_structure_get_value (ins, "channel-positions");
-
- if (out_layout == NULL) {
- if (out_chans <= 2 && (in_chans != out_chans || in_layout == NULL))
- return; /* nothing to do, default layout will be assumed */
- GST_WARNING_OBJECT (base, "downstream caps contain no channel layout");
- }
-
- if (in_chans == out_chans && in_layout != NULL) {
- GValue res = { 0, };
-
- /* same number of channels and no output layout: just use input layout */
- if (out_layout == NULL) {
- gst_structure_set_value (outs, "channel-positions", in_layout);
- return;
- }
-
- /* if output layout is fixed already and looks sane, we're done */
- if (GST_VALUE_HOLDS_ARRAY (out_layout) &&
- gst_value_array_get_size (out_layout) == out_chans) {
- return;
- }
-
- /* if the output layout is not fixed, check if the output layout contains
- * the input layout */
- if (gst_value_intersect (&res, in_layout, out_layout)) {
- gst_structure_set_value (outs, "channel-positions", in_layout);
- g_value_unset (&res);
- return;
- }
-
- /* output layout is not fixed and does not contain the input layout, so
- * just pick the first layout in the list (it should be a list ...) */
- if ((out_layout = find_suitable_channel_layout (out_layout, out_chans))) {
- gst_structure_set_value (outs, "channel-positions", out_layout);
- return;
- }
-
- /* ... else fall back to default layout (NB: out_layout is NULL here) */
- GST_WARNING_OBJECT (base, "unexpected output channel layout");
- }
-
- /* number of input channels != number of output channels:
- * if this value contains a list of channel layouts (or even worse: a list
- * with another list), just pick the first value and repeat until we find a
- * channel position array or something else that's not a list; we assume
- * the input if half-way sane and don't try to fall back on other list items
- * if the first one is something unexpected or non-channel-pos-array-y */
- if (out_layout != NULL && GST_VALUE_HOLDS_LIST (out_layout))
- out_layout = find_suitable_channel_layout (out_layout, out_chans);
-
- if (out_layout != NULL) {
- if (GST_VALUE_HOLDS_ARRAY (out_layout) &&
- gst_value_array_get_size (out_layout) == out_chans) {
- /* looks sane enough, let's use it */
- gst_structure_set_value (outs, "channel-positions", out_layout);
- return;
- }
-
- /* what now?! Just ignore what we're given and use default positions */
- GST_WARNING_OBJECT (base, "invalid or unexpected channel-positions");
- }
-
- /* missing or invalid output layout and we can't use the input layout for
- * one reason or another, so just pick a default layout (we could be smarter
- * and try to add/remove channels from the input layout, or pick a default
- * layout based on LFE-presence in input layout, but let's save that for
- * another day) */
- if (out_chans > 0 && out_chans <= G_N_ELEMENTS (default_positions[0])) {
- GST_DEBUG_OBJECT (base, "using default channel layout as fallback");
- gst_audio_set_channel_positions (outs, default_positions[out_chans - 1]);
- }
-}
-
-/* try to keep as many of the structure members the same by fixating the
- * possible ranges; this way we convert the least amount of things as possible
- */
-static void
-gst_audio_convert_fixate_caps (GstBaseTransform * base,
- GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
-{
- GstStructure *ins, *outs;
- gint rate, endianness, depth, width;
- gboolean signedness;
-
- g_return_if_fail (gst_caps_is_fixed (caps));
-
- GST_DEBUG_OBJECT (base, "trying to fixate othercaps %" GST_PTR_FORMAT
- " based on caps %" GST_PTR_FORMAT, othercaps, caps);
-
- ins = gst_caps_get_structure (caps, 0);
- outs = gst_caps_get_structure (othercaps, 0);
-
- gst_audio_convert_fixate_channels (base, ins, outs);
-
- if (gst_structure_get_int (ins, "rate", &rate)) {
- if (gst_structure_has_field (outs, "rate")) {
- gst_structure_fixate_field_nearest_int (outs, "rate", rate);
- }
- }
- if (gst_structure_get_int (ins, "endianness", &endianness)) {
- if (gst_structure_has_field (outs, "endianness")) {
- gst_structure_fixate_field_nearest_int (outs, "endianness", endianness);
- }
- }
- if (gst_structure_get_int (ins, "width", &width)) {
- if (gst_structure_has_field (outs, "width")) {
- gst_structure_fixate_field_nearest_int (outs, "width", width);
- }
- } else {
- /* this is not allowed */
- }
-
- if (gst_structure_get_int (ins, "depth", &depth)) {
- if (gst_structure_has_field (outs, "depth")) {
- gst_structure_fixate_field_nearest_int (outs, "depth", depth);
- }
- } else {
- /* set depth as width */
- if (gst_structure_has_field (outs, "depth")) {
- gst_structure_fixate_field_nearest_int (outs, "depth", width);
- }
- }
-
- if (gst_structure_get_boolean (ins, "signed", &signedness)) {
- if (gst_structure_has_field (outs, "signed")) {
- gst_structure_fixate_field_boolean (outs, "signed", signedness);
- }
- }
-
- GST_DEBUG_OBJECT (base, "fixated othercaps to %" GST_PTR_FORMAT, othercaps);
-}
-
-static gboolean
-gst_audio_convert_set_caps (GstBaseTransform * base, GstCaps * incaps,
- GstCaps * outcaps)
-{
- AudioConvertFmt in_ac_caps = { 0 };
- AudioConvertFmt out_ac_caps = { 0 };
- GstAudioConvert *this = GST_AUDIO_CONVERT (base);
-
- GST_DEBUG_OBJECT (base, "incaps %" GST_PTR_FORMAT ", outcaps %"
- GST_PTR_FORMAT, incaps, outcaps);
-
- if (!gst_audio_convert_parse_caps (incaps, &in_ac_caps))
- return FALSE;
- if (!gst_audio_convert_parse_caps (outcaps, &out_ac_caps))
- return FALSE;
-
- if (!audio_convert_prepare_context (&this->ctx, &in_ac_caps, &out_ac_caps,
- this->dither, this->ns))
- goto no_converter;
-
- return TRUE;
-
-no_converter:
- {
- return FALSE;
- }
-}
-
-static GstFlowReturn
-gst_audio_convert_transform_ip (GstBaseTransform * base, GstBuffer * buf)
-{
- /* nothing to do here */
- return GST_FLOW_OK;
-}
-
-static void
-gst_audio_convert_create_silence_buffer (GstAudioConvert * this, gpointer dst,
- gint size)
-{
- if (this->ctx.out.is_int && !this->ctx.out.sign) {
- gint i;
-
- switch (this->ctx.out.width) {
- case 8:{
- guint8 zero = 0x80 >> (8 - this->ctx.out.depth);
-
- memset (dst, zero, size);
- break;
- }
- case 16:{
- guint16 *data = (guint16 *) dst;
- guint16 zero = 0x8000 >> (16 - this->ctx.out.depth);
-
- if (this->ctx.out.endianness == G_LITTLE_ENDIAN)
- zero = GUINT16_TO_LE (zero);
- else
- zero = GUINT16_TO_BE (zero);
-
- size /= 2;
-
- for (i = 0; i < size; i++)
- data[i] = zero;
- break;
- }
- case 24:{
- guint32 zero = 0x800000 >> (24 - this->ctx.out.depth);
- guint8 *data = (guint8 *) dst;
-
- if (this->ctx.out.endianness == G_LITTLE_ENDIAN) {
- for (i = 0; i < size; i += 3) {
- data[i] = zero & 0xff;
- data[i + 1] = (zero >> 8) & 0xff;
- data[i + 2] = (zero >> 16) & 0xff;
- }
- } else {
- for (i = 0; i < size; i += 3) {
- data[i + 2] = zero & 0xff;
- data[i + 1] = (zero >> 8) & 0xff;
- data[i] = (zero >> 16) & 0xff;
- }
- }
- break;
- }
- case 32:{
- guint32 *data = (guint32 *) dst;
- guint32 zero = (0x80000000 >> (32 - this->ctx.out.depth));
-
- if (this->ctx.out.endianness == G_LITTLE_ENDIAN)
- zero = GUINT32_TO_LE (zero);
- else
- zero = GUINT32_TO_BE (zero);
-
- size /= 4;
-
- for (i = 0; i < size; i++)
- data[i] = zero;
- break;
- }
- default:
- memset (dst, 0, size);
- g_return_if_reached ();
- break;
- }
- } else {
- memset (dst, 0, size);
- }
-}
-
-static GstFlowReturn
-gst_audio_convert_transform (GstBaseTransform * base, GstBuffer * inbuf,
- GstBuffer * outbuf)
-{
- GstAudioConvert *this = GST_AUDIO_CONVERT (base);
- gint insize, outsize;
- gint samples;
- gpointer src, dst;
-
- GST_CAT_LOG_OBJECT (GST_CAT_PERFORMANCE, base, "converting audio from %"
- GST_PTR_FORMAT " to %" GST_PTR_FORMAT, GST_BUFFER_CAPS (inbuf),
- GST_BUFFER_CAPS (outbuf));
-
- /* get amount of samples to convert. */
- samples = GST_BUFFER_SIZE (inbuf) / this->ctx.in.unit_size;
-
- /* get in/output sizes, to see if the buffers we got are of correct
- * sizes */
- if (!audio_convert_get_sizes (&this->ctx, samples, &insize, &outsize))
- goto error;
-
- if (insize == 0 || outsize == 0)
- return GST_FLOW_OK;
-
- /* check in and outsize */
- if (GST_BUFFER_SIZE (inbuf) < insize)
- goto wrong_size;
- if (GST_BUFFER_SIZE (outbuf) < outsize)
- goto wrong_size;
-
- /* get src and dst data */
- src = GST_BUFFER_DATA (inbuf);
- dst = GST_BUFFER_DATA (outbuf);
-
- /* and convert the samples */
- if (!GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP)) {
- if (!audio_convert_convert (&this->ctx, src, dst,
- samples, gst_buffer_is_writable (inbuf)))
- goto convert_error;
- } else {
- /* Create silence buffer */
- gst_audio_convert_create_silence_buffer (this, dst, outsize);
- }
-
- GST_BUFFER_SIZE (outbuf) = outsize;
-
- return GST_FLOW_OK;
-
- /* ERRORS */
-error:
- {
- GST_ELEMENT_ERROR (this, STREAM, FORMAT,
- (NULL), ("cannot get input/output sizes for %d samples", samples));
- return GST_FLOW_ERROR;
- }
-wrong_size:
- {
- GST_ELEMENT_ERROR (this, STREAM, FORMAT,
- (NULL),
- ("input/output buffers are of wrong size in: %d < %d or out: %d < %d",
- GST_BUFFER_SIZE (inbuf), insize, GST_BUFFER_SIZE (outbuf),
- outsize));
- return GST_FLOW_ERROR;
- }
-convert_error:
- {
- GST_ELEMENT_ERROR (this, STREAM, FORMAT,
- (NULL), ("error while converting"));
- return GST_FLOW_ERROR;
- }
-}
-
-static void
-gst_audio_convert_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstAudioConvert *this = GST_AUDIO_CONVERT (object);
-
- switch (prop_id) {
- case ARG_DITHERING:
- this->dither = g_value_get_enum (value);
- break;
- case ARG_NOISE_SHAPING:
- this->ns = g_value_get_enum (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_audio_convert_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstAudioConvert *this = GST_AUDIO_CONVERT (object);
-
- switch (prop_id) {
- case ARG_DITHERING:
- g_value_set_enum (value, this->dither);
- break;
- case ARG_NOISE_SHAPING:
- g_value_set_enum (value, this->ns);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
diff --git a/gst/audioconvert/gstaudioconvert.h b/gst/audioconvert/gstaudioconvert.h
deleted file mode 100644
index 9370d380..00000000
--- a/gst/audioconvert/gstaudioconvert.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005 Wim Taymans <wim at fluendo dot com>
- *
- * gstaudioconvert.h: Convert audio to different audio formats automatically
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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_AUDIO_CONVERT_H__
-#define __GST_AUDIO_CONVERT_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
-#include <gst/audio/multichannel.h>
-
-#include "audioconvert.h"
-
-#define GST_TYPE_AUDIO_CONVERT (gst_audio_convert_get_type())
-#define GST_AUDIO_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_CONVERT,GstAudioConvert))
-#define GST_AUDIO_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_CONVERT,GstAudioConvertClass))
-#define GST_IS_AUDIO_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_CONVERT))
-#define GST_IS_AUDIO_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_CONVERT))
-
-typedef struct _GstAudioConvert GstAudioConvert;
-typedef struct _GstAudioConvertClass GstAudioConvertClass;
-
-/**
- * GstAudioConvert:
- *
- * The audioconvert object structure.
- */
-struct _GstAudioConvert
-{
- GstBaseTransform element;
-
- AudioConvertCtx ctx;
-
- GstAudioConvertDithering dither;
- GstAudioConvertNoiseShaping ns;
-};
-
-struct _GstAudioConvertClass
-{
- GstBaseTransformClass parent_class;
-};
-
-#endif /* __GST_AUDIO_CONVERT_H__ */
diff --git a/gst/audioconvert/gstaudioquantize.c b/gst/audioconvert/gstaudioquantize.c
deleted file mode 100644
index 2155397c..00000000
--- a/gst/audioconvert/gstaudioquantize.c
+++ /dev/null
@@ -1,503 +0,0 @@
-/* GStreamer
- * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
- *
- * gstaudioquantize.c: 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * FIXME: When doing dithering with int as intermediate format
- * one gets audible harmonics while the noise floor is
- * constant for double as intermediate format!
- */
-
-/* TODO: - Maybe drop 5-pole noise shaping and use coefficients
- * generated by dmaker
- * http://shibatch.sf.net
- */
-
-#include <gst/gst.h>
-#include <string.h>
-#include <math.h>
-#include "audioconvert.h"
-#include "gstaudioquantize.h"
-
-#include "gstfastrandom.h"
-
-#define MAKE_QUANTIZE_FUNC_NAME(name) \
-gst_audio_quantize_quantize_##name
-
-/* Quantize functions for gint32 as intermediate format */
-
-#define MAKE_QUANTIZE_FUNC_I(name, DITHER_INIT_FUNC, ADD_DITHER_FUNC, \
- ROUND_FUNC) \
-static void \
-MAKE_QUANTIZE_FUNC_NAME (name) (AudioConvertCtx *ctx, gint32 *src, \
- gint32 *dst, gint count) \
-{ \
- gint scale = ctx->out_scale; \
- gint channels = ctx->out.channels; \
- gint chan_pos; \
- \
- if (scale > 0) { \
- gint32 tmp; \
- guint32 mask = 0xffffffff & (0xffffffff << scale); \
- guint32 bias = 1U << (scale - 1); \
- DITHER_INIT_FUNC() \
- \
- for (;count;count--) { \
- for (chan_pos = 0; chan_pos < channels; chan_pos++) { \
- tmp = *src++; \
- ADD_DITHER_FUNC() \
- ROUND_FUNC() \
- *dst = tmp & mask; \
- dst++; \
- } \
- } \
- } else { \
- for (;count;count--) { \
- for (chan_pos = 0; chan_pos < channels; chan_pos++) { \
- *dst = *src++; \
- dst++; \
- } \
- } \
- } \
-}
-
-
-/* Quantize functions for gdouble as intermediate format with
- * int as target */
-
-#define MAKE_QUANTIZE_FUNC_F(name, DITHER_INIT_FUNC, NS_INIT_FUNC, \
- ADD_NS_FUNC, ADD_DITHER_FUNC, \
- UPDATE_ERROR_FUNC) \
-static void \
-MAKE_QUANTIZE_FUNC_NAME (name) (AudioConvertCtx *ctx, gdouble *src, \
- gdouble *dst, gint count) \
-{ \
- gint scale = ctx->out_scale; \
- gint channels = ctx->out.channels; \
- gint chan_pos; \
- gdouble factor = (1U<<(32-scale-1)) - 1; \
- \
- if (scale > 0) { \
- gdouble tmp; \
- DITHER_INIT_FUNC() \
- NS_INIT_FUNC() \
- \
- for (;count;count--) { \
- for (chan_pos = 0; chan_pos < channels; chan_pos++) { \
- tmp = *src++; \
- ADD_NS_FUNC() \
- ADD_DITHER_FUNC() \
- tmp = floor(tmp * factor + 0.5); \
- *dst = CLAMP (tmp, -factor - 1, factor); \
- UPDATE_ERROR_FUNC() \
- dst++; \
- } \
- } \
- } else { \
- for (;count;count--) { \
- for (chan_pos = 0; chan_pos < channels; chan_pos++) { \
- *dst = *src++ * 2147483647.0; \
- dst++; \
- } \
- } \
- } \
-}
-
-/* Rounding functions for int as intermediate format, only used when
- * not using dithering. With dithering we include this offset in our
- * dither noise instead. */
-
-#define ROUND() \
- if (tmp > 0 && G_MAXINT32 - tmp <= bias) \
- tmp = G_MAXINT32; \
- else \
- tmp += bias;
-
-
-#define NONE_FUNC()
-
-/* Dithering definitions
- * See http://en.wikipedia.org/wiki/Dithering or
- * http://www.cadenzarecording.com/Dither.html for explainations.
- *
- * We already add the rounding offset to the dither noise here
- * to have only one overflow check instead of two. */
-
-#define INIT_DITHER_RPDF_I() \
- gint32 rand; \
- gint32 dither = (1<<(scale));
-
-#define ADD_DITHER_RPDF_I() \
- rand = gst_fast_random_int32_range (bias - dither, \
- bias + dither); \
- if (rand > 0 && tmp > 0 && G_MAXINT32 - tmp <= rand) \
- tmp = G_MAXINT32; \
- else if (rand < 0 && tmp < 0 && G_MININT32 - tmp >= rand) \
- tmp = G_MININT32; \
- else \
- tmp += rand;
-
-#define INIT_DITHER_RPDF_F() \
- gdouble dither = 1.0/(1U<<(32 - scale - 1));
-
-#define ADD_DITHER_RPDF_F() \
- tmp += gst_fast_random_double_range (- dither, dither);
-
-#define INIT_DITHER_TPDF_I() \
- gint32 rand; \
- gint32 dither = (1<<(scale - 1)); \
- bias = bias >> 1;
-
-#define ADD_DITHER_TPDF_I() \
- rand = gst_fast_random_int32_range (bias - dither, \
- bias + dither - 1) \
- + gst_fast_random_int32_range (bias - dither, \
- bias + dither - 1); \
- if (rand > 0 && tmp > 0 && G_MAXINT32 - tmp <= rand) \
- tmp = G_MAXINT32; \
- else if (rand < 0 && tmp < 0 && G_MININT32 - tmp >= rand) \
- tmp = G_MININT32; \
- else \
- tmp += rand;
-
-#define INIT_DITHER_TPDF_F() \
- gdouble dither = 1.0/(1U<<(32 - scale));
-
-#define ADD_DITHER_TPDF_F() \
- tmp += gst_fast_random_double_range (- dither, dither) \
- + gst_fast_random_double_range (- dither, dither);
-
-#define INIT_DITHER_TPDF_HF_I() \
- gint32 rand; \
- gint32 dither = (1<<(scale-1)); \
- gint32 *last_random = (gint32 *) ctx->last_random, tmp_rand; \
- bias = bias >> 1;
-
-#define ADD_DITHER_TPDF_HF_I() \
- tmp_rand = gst_fast_random_int32_range (bias - dither, \
- bias + dither); \
- rand = tmp_rand - last_random[chan_pos]; \
- last_random[chan_pos] = tmp_rand; \
- if (rand > 0 && tmp > 0 && G_MAXINT32 - tmp <= rand) \
- tmp = G_MAXINT32; \
- else if (rand < 0 && tmp < 0 && G_MININT32 - tmp >= rand) \
- tmp = G_MININT32; \
- else \
- tmp += rand;
-
-/* Like TPDF dither but the dither noise is oriented more to the
- * higher frequencies */
-
-#define INIT_DITHER_TPDF_HF_F() \
- gdouble rand; \
- gdouble dither = 1.0/(1U<<(32 - scale)); \
- gdouble *last_random = (gdouble *) ctx->last_random, tmp_rand;
-
-#define ADD_DITHER_TPDF_HF_F() \
- tmp_rand = gst_fast_random_double_range (- dither, dither); \
- rand = tmp_rand - last_random[chan_pos]; \
- last_random[chan_pos] = tmp_rand; \
- tmp += rand;
-
-/* Noise shaping definitions.
- * See http://en.wikipedia.org/wiki/Noise_shaping for explanations. */
-
-
-/* Simple error feedback: Just accumulate the dithering and quantization
- * error and remove it from each sample. */
-
-#define INIT_NS_ERROR_FEEDBACK() \
- gdouble orig; \
- gdouble *errors = ctx->error_buf;
-
-#define ADD_NS_ERROR_FEEDBACK() \
- orig = tmp; \
- tmp -= errors[chan_pos];
-
-#define UPDATE_ERROR_ERROR_FEEDBACK() \
- errors[chan_pos] += (*dst)/factor - orig;
-
-/* Same as error feedback but also add 1/2 of the previous error value.
- * This moves the noise a bit more into the higher frequencies. */
-
-#define INIT_NS_SIMPLE() \
- gdouble orig; \
- gdouble *errors = ctx->error_buf, cur_error;
-
-#define ADD_NS_SIMPLE() \
- cur_error = errors[chan_pos*2] - 0.5 * errors[chan_pos*2 + 1]; \
- tmp -= cur_error; \
- orig = tmp;
-
-#define UPDATE_ERROR_SIMPLE() \
- errors[chan_pos*2 + 1] = errors[chan_pos*2]; \
- errors[chan_pos*2] = (*dst)/factor - orig;
-
-
-/* Noise shaping coefficients from[1], moves most power of the
- * error noise into inaudible frequency ranges.
- *
- * [1]
- * "Minimally Audible Noise Shaping", Stanley P. Lipshitz,
- * John Vanderkooy, and Robert A. Wannamaker,
- * J. Audio Eng. Soc., Vol. 39, No. 11, November 1991. */
-
-static const gdouble ns_medium_coeffs[] = {
- 2.033, -2.165, 1.959, -1.590, 0.6149
-};
-
-#define INIT_NS_MEDIUM() \
- gdouble orig; \
- gdouble *errors = ctx->error_buf, cur_error; \
- int j;
-
-#define ADD_NS_MEDIUM() \
- cur_error = 0.0; \
- for (j = 0; j < 5; j++) \
- cur_error += errors[chan_pos*5 + j] * ns_medium_coeffs[j]; \
- tmp -= cur_error; \
- orig = tmp;
-
-#define UPDATE_ERROR_MEDIUM() \
- for (j = 4; j > 0; j--) \
- errors[chan_pos*5 + j] = errors[chan_pos*5 + j-1]; \
- errors[chan_pos*5] = (*dst)/factor - orig;
-
-/* Noise shaping coefficients by David Schleef, moves most power of the
- * error noise into inaudible frequency ranges */
-
-static const gdouble ns_high_coeffs[] = {
- 2.08484, -2.92975, 3.27918, -3.31399, 2.61339, -1.72008, 0.876066, -0.340122
-};
-
-#define INIT_NS_HIGH() \
- gdouble orig; \
- gdouble *errors = ctx->error_buf, cur_error; \
- int j;
-
-#define ADD_NS_HIGH() \
- cur_error = 0.0; \
- for (j = 0; j < 8; j++) \
- cur_error += errors[chan_pos + j] * ns_high_coeffs[j]; \
- tmp -= cur_error; \
- orig = tmp;
-
-#define UPDATE_ERROR_HIGH() \
- for (j = 7; j > 0; j--) \
- errors[chan_pos + j] = errors[chan_pos + j-1]; \
- errors[chan_pos] = (*dst)/factor - orig;
-
-
-MAKE_QUANTIZE_FUNC_I (signed_none_none, NONE_FUNC, NONE_FUNC, ROUND);
-MAKE_QUANTIZE_FUNC_I (signed_rpdf_none, INIT_DITHER_RPDF_I, ADD_DITHER_RPDF_I,
- NONE_FUNC);
-MAKE_QUANTIZE_FUNC_I (signed_tpdf_none, INIT_DITHER_TPDF_I, ADD_DITHER_TPDF_I,
- NONE_FUNC);
-MAKE_QUANTIZE_FUNC_I (signed_tpdf_hf_none, INIT_DITHER_TPDF_HF_I,
- ADD_DITHER_TPDF_HF_I, NONE_FUNC);
-
-MAKE_QUANTIZE_FUNC_I (unsigned_none_none, NONE_FUNC, NONE_FUNC, ROUND);
-MAKE_QUANTIZE_FUNC_I (unsigned_rpdf_none, INIT_DITHER_RPDF_I, ADD_DITHER_RPDF_I,
- NONE_FUNC);
-MAKE_QUANTIZE_FUNC_I (unsigned_tpdf_none, INIT_DITHER_TPDF_I, ADD_DITHER_TPDF_I,
- NONE_FUNC);
-MAKE_QUANTIZE_FUNC_I (unsigned_tpdf_hf_none, INIT_DITHER_TPDF_HF_I,
- ADD_DITHER_TPDF_HF_I, NONE_FUNC);
-
-MAKE_QUANTIZE_FUNC_F (float_none_error_feedback, NONE_FUNC,
- INIT_NS_ERROR_FEEDBACK, ADD_NS_ERROR_FEEDBACK, NONE_FUNC,
- UPDATE_ERROR_ERROR_FEEDBACK);
-MAKE_QUANTIZE_FUNC_F (float_none_simple, NONE_FUNC, INIT_NS_SIMPLE,
- ADD_NS_SIMPLE, NONE_FUNC, UPDATE_ERROR_SIMPLE);
-MAKE_QUANTIZE_FUNC_F (float_none_medium, NONE_FUNC, INIT_NS_MEDIUM,
- ADD_NS_MEDIUM, NONE_FUNC, UPDATE_ERROR_MEDIUM);
-MAKE_QUANTIZE_FUNC_F (float_none_high, NONE_FUNC, INIT_NS_HIGH, ADD_NS_HIGH,
- NONE_FUNC, UPDATE_ERROR_HIGH);
-
-MAKE_QUANTIZE_FUNC_F (float_rpdf_error_feedback, INIT_DITHER_RPDF_F,
- INIT_NS_ERROR_FEEDBACK, ADD_NS_ERROR_FEEDBACK, ADD_DITHER_RPDF_F,
- UPDATE_ERROR_ERROR_FEEDBACK);
-MAKE_QUANTIZE_FUNC_F (float_rpdf_simple, INIT_DITHER_RPDF_F, INIT_NS_SIMPLE,
- ADD_NS_SIMPLE, ADD_DITHER_RPDF_F, UPDATE_ERROR_SIMPLE);
-MAKE_QUANTIZE_FUNC_F (float_rpdf_medium, INIT_DITHER_RPDF_F, INIT_NS_MEDIUM,
- ADD_NS_MEDIUM, ADD_DITHER_RPDF_F, UPDATE_ERROR_MEDIUM);
-MAKE_QUANTIZE_FUNC_F (float_rpdf_high, INIT_DITHER_RPDF_F, INIT_NS_HIGH,
- ADD_NS_HIGH, ADD_DITHER_RPDF_F, UPDATE_ERROR_HIGH);
-
-MAKE_QUANTIZE_FUNC_F (float_tpdf_error_feedback, INIT_DITHER_TPDF_F,
- INIT_NS_ERROR_FEEDBACK, ADD_NS_ERROR_FEEDBACK, ADD_DITHER_TPDF_F,
- UPDATE_ERROR_ERROR_FEEDBACK);
-MAKE_QUANTIZE_FUNC_F (float_tpdf_simple, INIT_DITHER_TPDF_F, INIT_NS_SIMPLE,
- ADD_NS_SIMPLE, ADD_DITHER_TPDF_F, UPDATE_ERROR_SIMPLE);
-MAKE_QUANTIZE_FUNC_F (float_tpdf_medium, INIT_DITHER_TPDF_F, INIT_NS_MEDIUM,
- ADD_NS_MEDIUM, ADD_DITHER_TPDF_F, UPDATE_ERROR_MEDIUM);
-MAKE_QUANTIZE_FUNC_F (float_tpdf_high, INIT_DITHER_TPDF_F, INIT_NS_HIGH,
- ADD_NS_HIGH, ADD_DITHER_TPDF_F, UPDATE_ERROR_HIGH);
-
-MAKE_QUANTIZE_FUNC_F (float_tpdf_hf_error_feedback, INIT_DITHER_TPDF_HF_F,
- INIT_NS_ERROR_FEEDBACK, ADD_NS_ERROR_FEEDBACK, ADD_DITHER_TPDF_HF_F,
- UPDATE_ERROR_ERROR_FEEDBACK);
-MAKE_QUANTIZE_FUNC_F (float_tpdf_hf_simple, INIT_DITHER_TPDF_HF_F,
- INIT_NS_SIMPLE, ADD_NS_SIMPLE, ADD_DITHER_TPDF_HF_F, UPDATE_ERROR_SIMPLE);
-MAKE_QUANTIZE_FUNC_F (float_tpdf_hf_medium, INIT_DITHER_TPDF_HF_F,
- INIT_NS_MEDIUM, ADD_NS_MEDIUM, ADD_DITHER_TPDF_HF_F, UPDATE_ERROR_MEDIUM);
-MAKE_QUANTIZE_FUNC_F (float_tpdf_hf_high, INIT_DITHER_TPDF_HF_F, INIT_NS_HIGH,
- ADD_NS_HIGH, ADD_DITHER_TPDF_HF_F, UPDATE_ERROR_HIGH);
-
-static AudioConvertQuantize quantize_funcs[] = {
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (signed_none_none),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (signed_rpdf_none),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (signed_tpdf_none),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (signed_tpdf_hf_none),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (unsigned_none_none),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (unsigned_rpdf_none),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (unsigned_tpdf_none),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (unsigned_tpdf_hf_none),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (float_none_error_feedback),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (float_none_simple),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (float_none_medium),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (float_none_high),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (float_rpdf_error_feedback),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (float_rpdf_simple),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (float_rpdf_medium),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (float_rpdf_high),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (float_tpdf_error_feedback),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (float_tpdf_simple),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (float_tpdf_medium),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (float_tpdf_high),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (float_tpdf_hf_error_feedback),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (float_tpdf_hf_simple),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (float_tpdf_hf_medium),
- (AudioConvertQuantize) MAKE_QUANTIZE_FUNC_NAME (float_tpdf_hf_high)
-};
-
-static void
-gst_audio_quantize_setup_noise_shaping (AudioConvertCtx * ctx)
-{
- switch (ctx->ns) {
- case NOISE_SHAPING_HIGH:{
- ctx->error_buf = g_new0 (gdouble, ctx->out.channels * 8);
- break;
- }
- case NOISE_SHAPING_MEDIUM:{
- ctx->error_buf = g_new0 (gdouble, ctx->out.channels * 5);
- break;
- }
- case NOISE_SHAPING_SIMPLE:{
- ctx->error_buf = g_new0 (gdouble, ctx->out.channels * 2);
- break;
- }
- case NOISE_SHAPING_ERROR_FEEDBACK:
- ctx->error_buf = g_new0 (gdouble, ctx->out.channels);
- break;
- case NOISE_SHAPING_NONE:
- default:
- ctx->error_buf = NULL;
- break;
- }
- return;
-}
-
-static void
-gst_audio_quantize_free_noise_shaping (AudioConvertCtx * ctx)
-{
- switch (ctx->ns) {
- case NOISE_SHAPING_HIGH:
- case NOISE_SHAPING_MEDIUM:
- case NOISE_SHAPING_SIMPLE:
- case NOISE_SHAPING_ERROR_FEEDBACK:
- case NOISE_SHAPING_NONE:
- default:
- break;
- }
-
- g_free (ctx->error_buf);
- ctx->error_buf = NULL;
- return;
-}
-
-static void
-gst_audio_quantize_setup_dither (AudioConvertCtx * ctx)
-{
- switch (ctx->dither) {
- case DITHER_TPDF_HF:
- if (ctx->out.is_int)
- ctx->last_random = g_new0 (gint32, ctx->out.channels);
- else
- ctx->last_random = g_new0 (gdouble, ctx->out.channels);
- break;
- case DITHER_RPDF:
- case DITHER_TPDF:
- ctx->last_random = NULL;
- break;
- case DITHER_NONE:
- default:
- ctx->last_random = NULL;
- break;
- }
- return;
-}
-
-static void
-gst_audio_quantize_free_dither (AudioConvertCtx * ctx)
-{
- g_free (ctx->last_random);
-
- return;
-}
-
-static void
-gst_audio_quantize_setup_quantize_func (AudioConvertCtx * ctx)
-{
- gint index = 0;
-
- if (!ctx->out.is_int) {
- ctx->quantize = NULL;
- return;
- }
-
- if (ctx->ns == NOISE_SHAPING_NONE) {
- index += ctx->dither;
- index += (ctx->out.sign) ? 0 : 4;
- } else {
- index += 8 + (4 * ctx->dither);
- index += ctx->ns - 1;
- }
-
- ctx->quantize = quantize_funcs[index];
-}
-
-gboolean
-gst_audio_quantize_setup (AudioConvertCtx * ctx)
-{
- gst_audio_quantize_setup_dither (ctx);
- gst_audio_quantize_setup_noise_shaping (ctx);
- gst_audio_quantize_setup_quantize_func (ctx);
-
- return TRUE;
-}
-
-void
-gst_audio_quantize_free (AudioConvertCtx * ctx)
-{
- gst_audio_quantize_free_dither (ctx);
- gst_audio_quantize_free_noise_shaping (ctx);
-}
diff --git a/gst/audioconvert/gstaudioquantize.h b/gst/audioconvert/gstaudioquantize.h
deleted file mode 100644
index a61003bd..00000000
--- a/gst/audioconvert/gstaudioquantize.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* GStreamer
- * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <gst/gst.h>
-#include "audioconvert.h"
-
-GST_DEBUG_CATEGORY_EXTERN (audio_convert_debug);
-#define GST_CAT_DEFAULT (audio_convert_debug)
-
-#ifndef __GST_AUDIO_QUANTIZE_H__
-#define __GST_AUDIO_QUANTIZE_H__
-
-gboolean gst_audio_quantize_setup (AudioConvertCtx * ctx);
-void gst_audio_quantize_reset (AudioConvertCtx * ctx);
-void gst_audio_quantize_free (AudioConvertCtx * ctx);
-
-
-#endif /* __GST_AUDIO_QUANTIZE_H__ */
diff --git a/gst/audioconvert/gstchannelmix.c b/gst/audioconvert/gstchannelmix.c
deleted file mode 100644
index 055f28d7..00000000
--- a/gst/audioconvert/gstchannelmix.c
+++ /dev/null
@@ -1,742 +0,0 @@
-/* GStreamer
- * Copyright (C) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
- * Copyright (C) 2008 Sebastian Dröge <slomo@circular-chaos.org>
- *
- * gstchannelmix.c: 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <math.h>
-#include <string.h>
-#include <gst/audio/multichannel.h>
-
-#include "gstchannelmix.h"
-
-/*
- * Channel matrix functions.
- */
-
-void
-gst_channel_mix_unset_matrix (AudioConvertCtx * this)
-{
- gint i;
-
- /* don't access if nothing there */
- if (!this->matrix)
- return;
-
- /* free */
- for (i = 0; i < this->in.channels; i++)
- g_free (this->matrix[i]);
- g_free (this->matrix);
-
- this->matrix = NULL;
- g_free (this->tmp);
- this->tmp = NULL;
-}
-
-/*
- * Detect and fill in identical channels. E.g.
- * forward the left/right front channels in a
- * 5.1 to 2.0 conversion.
- */
-
-static void
-gst_channel_mix_fill_identical (AudioConvertCtx * this)
-{
- gint ci, co;
-
- /* Apart from the compatible channel assignments, we can also have
- * same channel assignments. This is much simpler, we simply copy
- * the value from source to dest! */
- for (co = 0; co < this->out.channels; co++) {
- /* find a channel in input with same position */
- for (ci = 0; ci < this->in.channels; ci++) {
- if (this->in.pos[ci] == this->out.pos[co]) {
- this->matrix[ci][co] = 1.0;
- }
- }
- }
-}
-
-/*
- * Detect and fill in compatible channels. E.g.
- * forward left/right front to mono (or the other
- * way around) when going from 2.0 to 1.0.
- */
-
-static void
-gst_channel_mix_fill_compatible (AudioConvertCtx * this)
-{
- /* Conversions from one-channel to compatible two-channel configs */
- struct
- {
- GstAudioChannelPosition pos1[2];
- GstAudioChannelPosition pos2[1];
- } conv[] = {
- /* front: mono <-> stereo */
- { {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, {
- GST_AUDIO_CHANNEL_POSITION_FRONT_MONO}},
- /* front center: 2 <-> 1 */
- { {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER}, {
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER}},
- /* rear: 2 <-> 1 */
- { {
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, {
- GST_AUDIO_CHANNEL_POSITION_REAR_CENTER}}, { {
- GST_AUDIO_CHANNEL_POSITION_INVALID}}
- };
- gint c;
-
- /* conversions from compatible (but not the same) channel schemes */
- for (c = 0; conv[c].pos1[0] != GST_AUDIO_CHANNEL_POSITION_INVALID; c++) {
- gint pos1_0 = -1, pos1_1 = -1, pos1_2 = -1;
- gint pos2_0 = -1, pos2_1 = -1, pos2_2 = -1;
- gint n;
-
- for (n = 0; n < this->in.channels; n++) {
- if (this->in.pos[n] == conv[c].pos1[0])
- pos1_0 = n;
- else if (this->in.pos[n] == conv[c].pos1[1])
- pos1_1 = n;
- else if (this->in.pos[n] == conv[c].pos2[0])
- pos1_2 = n;
- }
- for (n = 0; n < this->out.channels; n++) {
- if (this->out.pos[n] == conv[c].pos1[0])
- pos2_0 = n;
- else if (this->out.pos[n] == conv[c].pos1[1])
- pos2_1 = n;
- else if (this->out.pos[n] == conv[c].pos2[0])
- pos2_2 = n;
- }
-
- /* The general idea here is to fill in channels from the same position
- * as good as possible. This means mixing left<->center and right<->center.
- */
-
- /* left -> center */
- if (pos1_0 != -1 && pos1_2 == -1 && pos2_0 == -1 && pos2_2 != -1)
- this->matrix[pos1_0][pos2_2] = 1.0;
- else if (pos1_0 != -1 && pos1_2 != -1 && pos2_0 == -1 && pos2_2 != -1)
- this->matrix[pos1_0][pos2_2] = 0.5;
- else if (pos1_0 != -1 && pos1_2 == -1 && pos2_0 != -1 && pos2_2 != -1)
- this->matrix[pos1_0][pos2_2] = 1.0;
-
- /* right -> center */
- if (pos1_1 != -1 && pos1_2 == -1 && pos2_1 == -1 && pos2_2 != -1)
- this->matrix[pos1_1][pos2_2] = 1.0;
- else if (pos1_1 != -1 && pos1_2 != -1 && pos2_1 == -1 && pos2_2 != -1)
- this->matrix[pos1_1][pos2_2] = 0.5;
- else if (pos1_1 != -1 && pos1_2 == -1 && pos2_1 != -1 && pos2_2 != -1)
- this->matrix[pos1_1][pos2_2] = 1.0;
-
- /* center -> left */
- if (pos1_2 != -1 && pos1_0 == -1 && pos2_2 == -1 && pos2_0 != -1)
- this->matrix[pos1_2][pos2_0] = 1.0;
- else if (pos1_2 != -1 && pos1_0 != -1 && pos2_2 == -1 && pos2_0 != -1)
- this->matrix[pos1_2][pos2_0] = 0.5;
- else if (pos1_2 != -1 && pos1_0 == -1 && pos2_2 != -1 && pos2_0 != -1)
- this->matrix[pos1_2][pos2_0] = 1.0;
-
- /* center -> right */
- if (pos1_2 != -1 && pos1_1 == -1 && pos2_2 == -1 && pos2_1 != -1)
- this->matrix[pos1_2][pos2_1] = 1.0;
- else if (pos1_2 != -1 && pos1_1 != -1 && pos2_2 == -1 && pos2_1 != -1)
- this->matrix[pos1_2][pos2_1] = 0.5;
- else if (pos1_2 != -1 && pos1_1 == -1 && pos2_2 != -1 && pos2_1 != -1)
- this->matrix[pos1_2][pos2_1] = 1.0;
- }
-}
-
-/*
- * Detect and fill in channels not handled by the
- * above two, e.g. center to left/right front in
- * 5.1 to 2.0 (or the other way around).
- *
- * Unfortunately, limited to static conversions
- * for now.
- */
-
-static void
-gst_channel_mix_detect_pos (AudioConvertFmt * caps,
- gint * f, gboolean * has_f,
- gint * c, gboolean * has_c, gint * r, gboolean * has_r,
- gint * s, gboolean * has_s, gint * b, gboolean * has_b)
-{
- gint n;
-
- for (n = 0; n < caps->channels; n++) {
- switch (caps->pos[n]) {
- case GST_AUDIO_CHANNEL_POSITION_FRONT_MONO:
- f[1] = n;
- *has_f = TRUE;
- break;
- case GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT:
- f[0] = n;
- *has_f = TRUE;
- break;
- case GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT:
- f[2] = n;
- *has_f = TRUE;
- break;
- case GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER:
- c[1] = n;
- *has_c = TRUE;
- break;
- case GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER:
- c[0] = n;
- *has_c = TRUE;
- break;
- case GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER:
- c[2] = n;
- *has_c = TRUE;
- break;
- case GST_AUDIO_CHANNEL_POSITION_REAR_CENTER:
- r[1] = n;
- *has_r = TRUE;
- break;
- case GST_AUDIO_CHANNEL_POSITION_REAR_LEFT:
- r[0] = n;
- *has_r = TRUE;
- break;
- case GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT:
- r[2] = n;
- *has_r = TRUE;
- break;
- case GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT:
- s[0] = n;
- *has_s = TRUE;
- break;
- case GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT:
- s[2] = n;
- *has_s = TRUE;
- break;
- case GST_AUDIO_CHANNEL_POSITION_LFE:
- *has_b = TRUE;
- b[1] = n;
- break;
- default:
- break;
- }
- }
-}
-
-static void
-gst_channel_mix_fill_one_other (gfloat ** matrix,
- AudioConvertFmt * from_caps, gint * from_idx,
- AudioConvertFmt * to_caps, gint * to_idx, gfloat ratio)
-{
-
- /* src & dst have center => passthrough */
- if (from_idx[1] != -1 && to_idx[1] != -1) {
- matrix[from_idx[1]][to_idx[1]] = ratio;
- }
-
- /* src & dst have left => passthrough */
- if (from_idx[0] != -1 && to_idx[0] != -1) {
- matrix[from_idx[0]][to_idx[0]] = ratio;
- }
-
- /* src & dst have right => passthrough */
- if (from_idx[2] != -1 && to_idx[2] != -1) {
- matrix[from_idx[2]][to_idx[2]] = ratio;
- }
-
- /* src has left & dst has center => put into center */
- if (from_idx[0] != -1 && to_idx[1] != -1 && from_idx[1] != -1) {
- matrix[from_idx[0]][to_idx[1]] = 0.5 * ratio;
- } else if (from_idx[0] != -1 && to_idx[1] != -1 && from_idx[1] == -1) {
- matrix[from_idx[0]][to_idx[1]] = ratio;
- }
-
- /* src has right & dst has center => put into center */
- if (from_idx[2] != -1 && to_idx[1] != -1 && from_idx[1] != -1) {
- matrix[from_idx[2]][to_idx[1]] = 0.5 * ratio;
- } else if (from_idx[2] != -1 && to_idx[1] != -1 && from_idx[1] == -1) {
- matrix[from_idx[2]][to_idx[1]] = ratio;
- }
-
- /* src has center & dst has left => passthrough */
- if (from_idx[1] != -1 && to_idx[0] != -1 && from_idx[0] != -1) {
- matrix[from_idx[1]][to_idx[0]] = 0.5 * ratio;
- } else if (from_idx[1] != -1 && to_idx[0] != -1 && from_idx[0] == -1) {
- matrix[from_idx[1]][to_idx[0]] = ratio;
- }
-
- /* src has center & dst has right => passthrough */
- if (from_idx[1] != -1 && to_idx[2] != -1 && from_idx[2] != -1) {
- matrix[from_idx[1]][to_idx[2]] = 0.5 * ratio;
- } else if (from_idx[1] != -1 && to_idx[2] != -1 && from_idx[2] == -1) {
- matrix[from_idx[1]][to_idx[2]] = ratio;
- }
-}
-
-#define RATIO_CENTER_FRONT (1.0 / sqrt (2.0))
-#define RATIO_CENTER_SIDE (1.0 / 2.0)
-#define RATIO_CENTER_REAR (1.0 / sqrt (8.0))
-
-#define RATIO_FRONT_CENTER (1.0 / sqrt (2.0))
-#define RATIO_FRONT_SIDE (1.0 / sqrt (2.0))
-#define RATIO_FRONT_REAR (1.0 / 2.0)
-
-#define RATIO_SIDE_CENTER (1.0 / 2.0)
-#define RATIO_SIDE_FRONT (1.0 / sqrt (2.0))
-#define RATIO_SIDE_REAR (1.0 / sqrt (2.0))
-
-#define RATIO_CENTER_BASS (1.0 / sqrt (2.0))
-#define RATIO_FRONT_BASS (1.0)
-#define RATIO_SIDE_BASS (1.0 / sqrt (2.0))
-#define RATIO_REAR_BASS (1.0 / sqrt (2.0))
-
-static void
-gst_channel_mix_fill_others (AudioConvertCtx * this)
-{
- gboolean in_has_front = FALSE, out_has_front = FALSE,
- in_has_center = FALSE, out_has_center = FALSE,
- in_has_rear = FALSE, out_has_rear = FALSE,
- in_has_side = FALSE, out_has_side = FALSE,
- in_has_bass = FALSE, out_has_bass = FALSE;
- /* LEFT, RIGHT, MONO */
- gint in_f[3] = { -1, -1, -1 };
- gint out_f[3] = { -1, -1, -1 };
- /* LOC, ROC, CENTER */
- gint in_c[3] = { -1, -1, -1 };
- gint out_c[3] = { -1, -1, -1 };
- /* RLEFT, RRIGHT, RCENTER */
- gint in_r[3] = { -1, -1, -1 };
- gint out_r[3] = { -1, -1, -1 };
- /* SLEFT, INVALID, SRIGHT */
- gint in_s[3] = { -1, -1, -1 };
- gint out_s[3] = { -1, -1, -1 };
- /* INVALID, LFE, INVALID */
- gint in_b[3] = { -1, -1, -1 };
- gint out_b[3] = { -1, -1, -1 };
-
- /* First see where (if at all) the various channels from/to
- * which we want to convert are located in our matrix/array. */
- gst_channel_mix_detect_pos (&this->in,
- in_f, &in_has_front,
- in_c, &in_has_center, in_r, &in_has_rear,
- in_s, &in_has_side, in_b, &in_has_bass);
- gst_channel_mix_detect_pos (&this->out,
- out_f, &out_has_front,
- out_c, &out_has_center, out_r, &out_has_rear,
- out_s, &out_has_side, out_b, &out_has_bass);
-
- /* The general idea here is:
- * - if the source has a channel that the destination doesn't have mix
- * it into the nearest available destination channel
- * - if the destination has a channel that the source doesn't have mix
- * the nearest source channel into the destination channel
- *
- * The ratio for the mixing becomes lower as the distance between the
- * channels gets larger
- */
-
- /* center <-> front/side/rear */
- if (!in_has_center && in_has_front && out_has_center) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_f, &this->out, out_c, RATIO_CENTER_FRONT);
- } else if (!in_has_center && !in_has_front && in_has_side && out_has_center) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_s, &this->out, out_c, RATIO_CENTER_SIDE);
- } else if (!in_has_center && !in_has_front && !in_has_side && in_has_rear
- && out_has_center) {
- gst_channel_mix_fill_one_other (this->matrix, &this->in, in_r, &this->out,
- out_c, RATIO_CENTER_REAR);
- } else if (in_has_center && !out_has_center && out_has_front) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_c, &this->out, out_f, RATIO_CENTER_FRONT);
- } else if (in_has_center && !out_has_center && !out_has_front && out_has_side) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_c, &this->out, out_s, RATIO_CENTER_SIDE);
- } else if (in_has_center && !out_has_center && !out_has_front && !out_has_side
- && out_has_rear) {
- gst_channel_mix_fill_one_other (this->matrix, &this->in, in_c, &this->out,
- out_r, RATIO_CENTER_REAR);
- }
-
- /* front <-> center/side/rear */
- if (!in_has_front && in_has_center && !in_has_side && out_has_front) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_c, &this->out, out_f, RATIO_CENTER_FRONT);
- } else if (!in_has_front && !in_has_center && in_has_side && out_has_front) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_s, &this->out, out_f, RATIO_FRONT_SIDE);
- } else if (!in_has_front && in_has_center && in_has_side && out_has_front) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_c, &this->out, out_f, 0.5 * RATIO_CENTER_FRONT);
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_s, &this->out, out_f, 0.5 * RATIO_FRONT_SIDE);
- } else if (!in_has_front && !in_has_center && !in_has_side && in_has_rear
- && out_has_front) {
- gst_channel_mix_fill_one_other (this->matrix, &this->in, in_r, &this->out,
- out_f, RATIO_FRONT_REAR);
- } else if (in_has_front && out_has_center && !out_has_side && !out_has_front) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_f, &this->out, out_c, RATIO_CENTER_FRONT);
- } else if (in_has_front && !out_has_center && out_has_side && !out_has_front) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_f, &this->out, out_s, RATIO_FRONT_SIDE);
- } else if (in_has_front && out_has_center && out_has_side && !out_has_front) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_f, &this->out, out_c, 0.5 * RATIO_CENTER_FRONT);
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_f, &this->out, out_s, 0.5 * RATIO_FRONT_SIDE);
- } else if (in_has_front && !out_has_center && !out_has_side && !out_has_front
- && out_has_rear) {
- gst_channel_mix_fill_one_other (this->matrix, &this->in, in_f, &this->out,
- out_r, RATIO_FRONT_REAR);
- }
-
- /* side <-> center/front/rear */
- if (!in_has_side && in_has_front && !in_has_rear && out_has_side) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_f, &this->out, out_s, RATIO_FRONT_SIDE);
- } else if (!in_has_side && !in_has_front && in_has_rear && out_has_side) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_r, &this->out, out_s, RATIO_SIDE_REAR);
- } else if (!in_has_side && in_has_front && in_has_rear && out_has_side) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_f, &this->out, out_s, 0.5 * RATIO_FRONT_SIDE);
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_r, &this->out, out_s, 0.5 * RATIO_SIDE_REAR);
- } else if (!in_has_side && !in_has_front && !in_has_rear && in_has_center
- && out_has_side) {
- gst_channel_mix_fill_one_other (this->matrix, &this->in, in_c, &this->out,
- out_s, RATIO_CENTER_SIDE);
- } else if (in_has_side && out_has_front && !out_has_rear && !out_has_side) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_s, &this->out, out_f, RATIO_FRONT_SIDE);
- } else if (in_has_side && !out_has_front && out_has_rear && !out_has_side) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_s, &this->out, out_r, RATIO_SIDE_REAR);
- } else if (in_has_side && out_has_front && out_has_rear && !out_has_side) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_s, &this->out, out_f, 0.5 * RATIO_FRONT_SIDE);
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_s, &this->out, out_r, 0.5 * RATIO_SIDE_REAR);
- } else if (in_has_side && !out_has_front && !out_has_rear && out_has_center
- && !out_has_side) {
- gst_channel_mix_fill_one_other (this->matrix, &this->in, in_s, &this->out,
- out_c, RATIO_CENTER_SIDE);
- }
-
- /* rear <-> center/front/side */
- if (!in_has_rear && in_has_side && out_has_rear) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_s, &this->out, out_r, RATIO_SIDE_REAR);
- } else if (!in_has_rear && !in_has_side && in_has_front && out_has_rear) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_f, &this->out, out_r, RATIO_FRONT_REAR);
- } else if (!in_has_rear && !in_has_side && !in_has_front && in_has_center
- && out_has_rear) {
- gst_channel_mix_fill_one_other (this->matrix, &this->in, in_c, &this->out,
- out_r, RATIO_CENTER_REAR);
- } else if (in_has_rear && !out_has_rear && out_has_side) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_r, &this->out, out_s, RATIO_SIDE_REAR);
- } else if (in_has_rear && !out_has_rear && !out_has_side && out_has_front) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_r, &this->out, out_f, RATIO_FRONT_REAR);
- } else if (in_has_rear && !out_has_rear && !out_has_side && !out_has_front
- && out_has_center) {
- gst_channel_mix_fill_one_other (this->matrix, &this->in, in_r, &this->out,
- out_c, RATIO_CENTER_REAR);
- }
-
- /* bass <-> any */
- if (in_has_bass && !out_has_bass) {
- if (out_has_center) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_b, &this->out, out_c, RATIO_CENTER_BASS);
- }
- if (out_has_front) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_b, &this->out, out_f, RATIO_FRONT_BASS);
- }
- if (out_has_side) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_b, &this->out, out_s, RATIO_SIDE_BASS);
- }
- if (out_has_rear) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_b, &this->out, out_r, RATIO_REAR_BASS);
- }
- } else if (!in_has_bass && out_has_bass) {
- if (in_has_center) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_c, &this->out, out_b, RATIO_CENTER_BASS);
- }
- if (in_has_front) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_f, &this->out, out_b, RATIO_FRONT_BASS);
- }
- if (in_has_side) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_s, &this->out, out_b, RATIO_REAR_BASS);
- }
- if (in_has_rear) {
- gst_channel_mix_fill_one_other (this->matrix,
- &this->in, in_r, &this->out, out_b, RATIO_REAR_BASS);
- }
- }
-}
-
-/*
- * Normalize output values.
- */
-
-static void
-gst_channel_mix_fill_normalize (AudioConvertCtx * this)
-{
- gfloat sum, top = 0;
- gint i, j;
-
- for (j = 0; j < this->out.channels; j++) {
- /* calculate sum */
- sum = 0.0;
- for (i = 0; i < this->in.channels; i++) {
- sum += fabs (this->matrix[i][j]);
- }
- if (sum > top) {
- top = sum;
- }
- }
-
- /* normalize to this */
- if (top == 0.0)
- return;
-
- for (j = 0; j < this->out.channels; j++) {
- for (i = 0; i < this->in.channels; i++) {
- this->matrix[i][j] /= top;
- }
- }
-}
-
-static gboolean
-gst_channel_mix_fill_special (AudioConvertCtx * this)
-{
- AudioConvertFmt *in = &this->in, *out = &this->out;
-
- /* Special, standard conversions here */
-
- /* Mono<->Stereo, just a fast-path */
- if (in->channels == 2 && out->channels == 1 &&
- ((in->pos[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT &&
- in->pos[1] == GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT) ||
- (in->pos[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT &&
- in->pos[1] == GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT)) &&
- out->pos[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_MONO) {
- this->matrix[0][0] = 0.5;
- this->matrix[1][0] = 0.5;
- return TRUE;
- } else if (in->channels == 1 && out->channels == 2 &&
- ((out->pos[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT &&
- out->pos[1] == GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT) ||
- (out->pos[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT &&
- out->pos[1] == GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT)) &&
- in->pos[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_MONO) {
- this->matrix[0][0] = 1.0;
- this->matrix[0][1] = 1.0;
- return TRUE;
- }
-
- /* TODO: 5.1 <-> Stereo and other standard conversions */
-
- return FALSE;
-}
-
-/*
- * Automagically generate conversion matrix.
- */
-
-static void
-gst_channel_mix_fill_matrix (AudioConvertCtx * this)
-{
- if (gst_channel_mix_fill_special (this))
- return;
-
- gst_channel_mix_fill_identical (this);
-
- if (!this->in.unpositioned_layout) {
- gst_channel_mix_fill_compatible (this);
- gst_channel_mix_fill_others (this);
- gst_channel_mix_fill_normalize (this);
- }
-}
-
-/* only call after this->out and this->in are filled in */
-void
-gst_channel_mix_setup_matrix (AudioConvertCtx * this)
-{
- gint i, j;
-
- /* don't lose memory */
- gst_channel_mix_unset_matrix (this);
-
- /* temp storage */
- if (this->in.is_int || this->out.is_int) {
- this->tmp = (gpointer) g_new (gint32, this->out.channels);
- } else {
- this->tmp = (gpointer) g_new (gdouble, this->out.channels);
- }
-
- /* allocate */
- this->matrix = g_new0 (gfloat *, this->in.channels);
- for (i = 0; i < this->in.channels; i++) {
- this->matrix[i] = g_new (gfloat, this->out.channels);
- for (j = 0; j < this->out.channels; j++)
- this->matrix[i][j] = 0.;
- }
-
- /* setup the matrix' internal values */
- gst_channel_mix_fill_matrix (this);
-
-#ifndef GST_DISABLE_GST_DEBUG
- /* debug */
- {
- GString *s;
- s = g_string_new ("Matrix for");
- g_string_append_printf (s, " %d -> %d: ",
- this->in.channels, this->out.channels);
- g_string_append (s, "{");
- for (i = 0; i < this->in.channels; i++) {
- if (i != 0)
- g_string_append (s, ",");
- g_string_append (s, " {");
- for (j = 0; j < this->out.channels; j++) {
- if (j != 0)
- g_string_append (s, ",");
- g_string_append_printf (s, " %f", this->matrix[i][j]);
- }
- g_string_append (s, " }");
- }
- g_string_append (s, " }");
- GST_DEBUG ("%s", s->str);
- g_string_free (s, TRUE);
- }
-#endif
-}
-
-gboolean
-gst_channel_mix_passthrough (AudioConvertCtx * this)
-{
- gint i;
-
- /* only NxN matrices can be identities */
- if (this->in.channels != this->out.channels)
- return FALSE;
-
- /* this assumes a normalized matrix */
- for (i = 0; i < this->in.channels; i++)
- if (this->matrix[i][i] != 1.)
- return FALSE;
-
- return TRUE;
-}
-
-/* IMPORTANT: out_data == in_data is possible, make sure to not overwrite data
- * you might need later on! */
-void
-gst_channel_mix_mix_int (AudioConvertCtx * this,
- gint32 * in_data, gint32 * out_data, gint samples)
-{
- gint in, out, n;
- gint64 res;
- gboolean backwards;
- gint inchannels, outchannels;
- gint32 *tmp = (gint32 *) this->tmp;
-
- g_return_if_fail (this->matrix != NULL);
- g_return_if_fail (this->tmp != NULL);
-
- inchannels = this->in.channels;
- outchannels = this->out.channels;
- backwards = outchannels > inchannels;
-
- /* FIXME: use liboil here? */
- for (n = (backwards ? samples - 1 : 0); n < samples && n >= 0;
- backwards ? n-- : n++) {
- for (out = 0; out < outchannels; out++) {
- /* convert */
- res = 0;
- for (in = 0; in < inchannels; in++) {
- res += in_data[n * inchannels + in] * this->matrix[in][out];
- }
-
- /* clip (shouldn't we use doubles instead as intermediate format?) */
- if (res < G_MININT32)
- res = G_MININT32;
- else if (res > G_MAXINT32)
- res = G_MAXINT32;
- tmp[out] = res;
- }
- memcpy (&out_data[n * outchannels], this->tmp,
- sizeof (gint32) * outchannels);
- }
-}
-
-void
-gst_channel_mix_mix_float (AudioConvertCtx * this,
- gdouble * in_data, gdouble * out_data, gint samples)
-{
- gint in, out, n;
- gdouble res;
- gboolean backwards;
- gint inchannels, outchannels;
- gdouble *tmp = (gdouble *) this->tmp;
-
- g_return_if_fail (this->matrix != NULL);
- g_return_if_fail (this->tmp != NULL);
-
- inchannels = this->in.channels;
- outchannels = this->out.channels;
- backwards = outchannels > inchannels;
-
- /* FIXME: use liboil here? */
- for (n = (backwards ? samples - 1 : 0); n < samples && n >= 0;
- backwards ? n-- : n++) {
- for (out = 0; out < outchannels; out++) {
- /* convert */
- res = 0.0;
- for (in = 0; in < inchannels; in++) {
- res += in_data[n * inchannels + in] * this->matrix[in][out];
- }
-
- /* clip (shouldn't we use doubles instead as intermediate format?) */
- if (res < -1.0)
- res = -1.0;
- else if (res > 1.0)
- res = 1.0;
- tmp[out] = res;
- }
- memcpy (&out_data[n * outchannels], this->tmp,
- sizeof (gdouble) * outchannels);
- }
-}
diff --git a/gst/audioconvert/gstchannelmix.h b/gst/audioconvert/gstchannelmix.h
deleted file mode 100644
index d0462109..00000000
--- a/gst/audioconvert/gstchannelmix.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GStreamer
- * Copyright (C) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
- *
- * gstchannelmix.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_CHANNEL_MIX_H__
-#define __GST_CHANNEL_MIX_H__
-
-#include <gst/gst.h>
-#include "audioconvert.h"
-
-GST_DEBUG_CATEGORY_EXTERN (audio_convert_debug);
-#define GST_CAT_DEFAULT (audio_convert_debug)
-
-/*
- * Delete channel mixer matrix.
- */
-void gst_channel_mix_unset_matrix (AudioConvertCtx * this);
-
-/*
- * Setup channel mixer matrix.
- */
-void gst_channel_mix_setup_matrix (AudioConvertCtx * this);
-
-/*
- * Checks for passthrough (= identity matrix).
- */
-gboolean gst_channel_mix_passthrough (AudioConvertCtx * this);
-
-/*
- * Do actual mixing.
- */
-void gst_channel_mix_mix_int (AudioConvertCtx * this,
- gint32 * in_data,
- gint32 * out_data,
- gint samples);
-
-void gst_channel_mix_mix_float (AudioConvertCtx * this,
- gdouble * in_data,
- gdouble * out_data,
- gint samples);
-
-#endif /* __GST_CHANNEL_MIX_H__ */
diff --git a/gst/audioconvert/gstfastrandom.h b/gst/audioconvert/gstfastrandom.h
deleted file mode 100644
index b1c88b54..00000000
--- a/gst/audioconvert/gstfastrandom.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* GStreamer
- * Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>
- *
- * gstfastrandom.h: Fast, bad PNRG
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-#include <glib.h>
-
-#ifndef __GST_FAST_RANDOM__
-#define __GST_FAST_RANDOM__
-
-/* transform [0..2^32] -> [0..1] */
-#define GST_RAND_DOUBLE_TRANSFORM 2.3283064365386962890625e-10
-
-/* This is the base function, implementing a linear congruential generator
- * and returning a pseudo random number between 0 and 2^32 - 1.
- */
-static inline guint32
-gst_fast_random_uint32 ()
-{
- static guint32 state = 0xdeadbeef;
-
- return (state = state * 1103515245 + 12345);
-}
-
-static inline guint32
-gst_fast_random_uint32_range (gint32 start, gint32 end)
-{
- guint64 tmp = gst_fast_random_uint32 ();
-
- tmp = (tmp * (end - start)) / G_MAXUINT32 + start;
-
- return (guint32) tmp;
-}
-
-static inline gint32
-gst_fast_random_int32 (void)
-{
- return (gint32) gst_fast_random_uint32 ();
-}
-
-static inline gint32
-gst_fast_random_int32_range (gint32 start, gint32 end)
-{
- gint64 tmp = gst_fast_random_uint32 ();
-
- tmp = (tmp * (end - start)) / G_MAXUINT32 + start;
-
- return (gint32) tmp;
-}
-
-static inline gdouble
-gst_fast_random_double (void)
-{
- gdouble ret;
-
- ret = gst_fast_random_uint32 () * GST_RAND_DOUBLE_TRANSFORM;
- ret = (ret + gst_fast_random_uint32 ()) * GST_RAND_DOUBLE_TRANSFORM;
-
- if (ret >= 1.0)
- return gst_fast_random_double ();
-
- return ret;
-}
-
-static inline gdouble
-gst_fast_random_double_range (gdouble start, gdouble end)
-{
- return gst_fast_random_double () * (end - start) + start;
-}
-
-#undef GST_RAND_DOUBLE_TRANSFORM
-
-#endif /* __GST_FAST_RANDOM__ */
-
diff --git a/gst/audioconvert/plugin.c b/gst/audioconvert/plugin.c
deleted file mode 100644
index 643737a8..00000000
--- a/gst/audioconvert/plugin.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* GStreamer audio conversion plugin
- * Copyright (C) 2004 Andy Wingo <wingo at pobox.com>
- *
- * plugin.c: the stubs for the audioconvert plugin
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "plugin.h"
-
-#include <gst/audio/multichannel.h>
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- /* ensure GstAudioChannelPosition type is registered */
- if (!gst_audio_channel_position_get_type ())
- return FALSE;
-
- if (!gst_element_register (plugin, "audioconvert",
- GST_RANK_PRIMARY, gst_audio_convert_get_type ()))
- return FALSE;
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "audioconvert",
- "Convert audio to different formats",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/audioconvert/plugin.h b/gst/audioconvert/plugin.h
deleted file mode 100644
index 5aa3ec45..00000000
--- a/gst/audioconvert/plugin.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* GStreamer buffer-frames conversion plugin
- * Copyright (C) 2004 Andy Wingo <wingo at pobox.com>
- *
- * plugin.h: the stubs for the buffer-frames-convert plugin
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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_PLUGIN_AUDIO_CONVERT_H__
-#define __GST_PLUGIN_AUDIO_CONVERT_H__
-
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-GType gst_audio_convert_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_PLUGIN_AUDIO_CONVERT_H__ */
diff --git a/gst/audiorate/Makefile.am b/gst/audiorate/Makefile.am
deleted file mode 100644
index 10195de7..00000000
--- a/gst/audiorate/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-noinst_HEADERS = gstaudiorate.h
-
-plugin_LTLIBRARIES = libgstaudiorate.la
-
-libgstaudiorate_la_SOURCES = gstaudiorate.c
-libgstaudiorate_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-libgstaudiorate_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstaudiorate_la_LIBADD = $(GST_LIBS)
-libgstaudiorate_la_LIBTOOLFLAGS = --tag=disable-static
-
diff --git a/gst/audiorate/audiorate.vcproj b/gst/audiorate/audiorate.vcproj
deleted file mode 100644
index 22b8737a..00000000
--- a/gst/audiorate/audiorate.vcproj
+++ /dev/null
@@ -1,145 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="audiorate"
- ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D678A6}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../win32/Debug"
- IntermediateDirectory="../../win32/Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;audiorate_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstaudiorate.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Debug;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/audiorate.pdb"
- SubSystem="2"
- OptimizeReferences="2"
- ImportLibrary="$(OutDir)/gstaudiorate.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../win32/Release"
- IntermediateDirectory="../../win32/Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;audiorate_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstaudiorate.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Release;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/gstaudiorate.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath=".\gstaudiorate.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/gst/audiorate/gstaudiorate.c b/gst/audiorate/gstaudiorate.c
deleted file mode 100644
index 0adf8e18..00000000
--- a/gst/audiorate/gstaudiorate.c
+++ /dev/null
@@ -1,816 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-audiorate
- * @see_also: #GstVideoRate
- *
- * This element takes an incoming stream of timestamped raw audio frames and
- * produces a perfect stream by inserting or dropping samples as needed.
- *
- * This operation may be of use to link to elements that require or otherwise
- * implicitly assume a perfect stream as they do not store timestamps,
- * but derive this by some means (e.g. bitrate for some AVI cases).
- *
- * The properties #GstAudioRate:in, #GstAudioRate:out, #GstAudioRate:add
- * and #GstAudioRate:drop can be read to obtain information about number of
- * input samples, output samples, dropped samples (i.e. the number of unused
- * input samples) and inserted samples (i.e. the number of samples added to
- * stream).
- *
- * When the #GstAudioRate:silent property is set to FALSE, a GObject property
- * notification will be emitted whenever one of the #GstAudioRate:add or
- * #GstAudioRate:drop values changes.
- * This can potentially cause performance degradation.
- * Note that property notification will happen from the streaming thread, so
- * applications should be prepared for this.
- *
- * If the #GstAudioRate:tolerance property is non-zero, and an incoming buffer's
- * timestamp deviates less than the property indicates from what would make a
- * 'perfect time', then no samples will be added or dropped.
- * Note that the output is still guaranteed to be a perfect stream, which means
- * that the incoming data is then simply shifted (by less than the indicated
- * tolerance) to a perfect time.
- *
- * <refsect2>
- * <title>Example pipelines</title>
- * |[
- * gst-launch -v alsasrc ! audiorate ! wavenc ! filesink location=alsa.wav
- * ]| Capture audio from an ALSA device, and turn it into a perfect stream
- * for saving in a raw audio file.
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-
-#include "gstaudiorate.h"
-
-#define GST_CAT_DEFAULT audio_rate_debug
-GST_DEBUG_CATEGORY_STATIC (audio_rate_debug);
-
-/* elementfactory information */
-static const GstElementDetails audio_rate_details =
-GST_ELEMENT_DETAILS ("Audio rate adjuster",
- "Filter/Effect/Audio",
- "Drops/duplicates/adjusts timestamps on audio samples to make a perfect stream",
- "Wim Taymans <wim@fluendo.com>");
-
-/* GstAudioRate signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-#define DEFAULT_SILENT TRUE
-#define DEFAULT_TOLERANCE 0
-
-enum
-{
- ARG_0,
- ARG_IN,
- ARG_OUT,
- ARG_ADD,
- ARG_DROP,
- ARG_SILENT,
- ARG_TOLERANCE,
- /* FILL ME */
-};
-
-static GstStaticPadTemplate gst_audio_rate_src_template =
- GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS ";"
- GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS)
- );
-
-static GstStaticPadTemplate gst_audio_rate_sink_template =
- GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS ";"
- GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS)
- );
-
-static void gst_audio_rate_base_init (gpointer g_class);
-static void gst_audio_rate_class_init (GstAudioRateClass * klass);
-static void gst_audio_rate_init (GstAudioRate * audiorate);
-static gboolean gst_audio_rate_sink_event (GstPad * pad, GstEvent * event);
-static gboolean gst_audio_rate_src_event (GstPad * pad, GstEvent * event);
-static GstFlowReturn gst_audio_rate_chain (GstPad * pad, GstBuffer * buf);
-
-static void gst_audio_rate_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_audio_rate_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static GstStateChangeReturn gst_audio_rate_change_state (GstElement * element,
- GstStateChange transition);
-
-static GstElementClass *parent_class = NULL;
-
-/*static guint gst_audio_rate_signals[LAST_SIGNAL] = { 0 }; */
-
-static GType
-gst_audio_rate_get_type (void)
-{
- static GType audio_rate_type = 0;
-
- if (!audio_rate_type) {
- static const GTypeInfo audio_rate_info = {
- sizeof (GstAudioRateClass),
- gst_audio_rate_base_init,
- NULL,
- (GClassInitFunc) gst_audio_rate_class_init,
- NULL,
- NULL,
- sizeof (GstAudioRate),
- 0,
- (GInstanceInitFunc) gst_audio_rate_init,
- };
-
- audio_rate_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstAudioRate", &audio_rate_info, 0);
- }
-
- return audio_rate_type;
-}
-
-static void
-gst_audio_rate_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &audio_rate_details);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_audio_rate_sink_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_audio_rate_src_template));
-}
-
-static void
-gst_audio_rate_class_init (GstAudioRateClass * klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->set_property = gst_audio_rate_set_property;
- object_class->get_property = gst_audio_rate_get_property;
-
- g_object_class_install_property (object_class, ARG_IN,
- g_param_spec_uint64 ("in", "In",
- "Number of input samples", 0, G_MAXUINT64, 0,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class, ARG_OUT,
- g_param_spec_uint64 ("out", "Out", "Number of output samples", 0,
- G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class, ARG_ADD,
- g_param_spec_uint64 ("add", "Add", "Number of added samples", 0,
- G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class, ARG_DROP,
- g_param_spec_uint64 ("drop", "Drop", "Number of dropped samples", 0,
- G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class, ARG_SILENT,
- g_param_spec_boolean ("silent", "silent",
- "Don't emit notify for dropped and duplicated frames", DEFAULT_SILENT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstAudioRate:tolerance
- *
- * The difference between incoming timestamp and next timestamp must exceed
- * the given value for audiorate to add or drop samples.
- *
- * Since: 0.10.26
- **/
- g_object_class_install_property (object_class, ARG_TOLERANCE,
- g_param_spec_uint64 ("tolerance", "tolerance",
- "Only act if timestamp jitter/imperfection exceeds indicated tolerance (ns)",
- 0, G_MAXUINT64, DEFAULT_TOLERANCE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- element_class->change_state = gst_audio_rate_change_state;
-}
-
-static void
-gst_audio_rate_reset (GstAudioRate * audiorate)
-{
- audiorate->next_offset = -1;
- audiorate->next_ts = -1;
- audiorate->discont = TRUE;
- gst_segment_init (&audiorate->sink_segment, GST_FORMAT_UNDEFINED);
- gst_segment_init (&audiorate->src_segment, GST_FORMAT_TIME);
-
- GST_DEBUG_OBJECT (audiorate, "handle reset");
-}
-
-static gboolean
-gst_audio_rate_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstAudioRate *audiorate;
- GstStructure *structure;
- GstPad *otherpad;
- gboolean ret = FALSE;
- gint channels, width, rate;
-
- audiorate = GST_AUDIO_RATE (gst_pad_get_parent (pad));
-
- structure = gst_caps_get_structure (caps, 0);
-
- if (!gst_structure_get_int (structure, "channels", &channels))
- goto wrong_caps;
- if (!gst_structure_get_int (structure, "width", &width))
- goto wrong_caps;
- if (!gst_structure_get_int (structure, "rate", &rate))
- goto wrong_caps;
-
- audiorate->bytes_per_sample = channels * (width / 8);
- if (audiorate->bytes_per_sample == 0)
- goto wrong_format;
-
- audiorate->rate = rate;
-
- /* the format is correct, configure caps on other pad */
- otherpad = (pad == audiorate->srcpad) ? audiorate->sinkpad :
- audiorate->srcpad;
-
- ret = gst_pad_set_caps (otherpad, caps);
-
-done:
- gst_object_unref (audiorate);
- return ret;
-
- /* ERRORS */
-wrong_caps:
- {
- GST_DEBUG_OBJECT (audiorate, "could not get channels/width from caps");
- goto done;
- }
-wrong_format:
- {
- GST_DEBUG_OBJECT (audiorate, "bytes_per_samples gave 0");
- goto done;
- }
-}
-
-static void
-gst_audio_rate_init (GstAudioRate * audiorate)
-{
- audiorate->sinkpad =
- gst_pad_new_from_static_template (&gst_audio_rate_sink_template, "sink");
- gst_pad_set_event_function (audiorate->sinkpad, gst_audio_rate_sink_event);
- gst_pad_set_chain_function (audiorate->sinkpad, gst_audio_rate_chain);
- gst_pad_set_setcaps_function (audiorate->sinkpad, gst_audio_rate_setcaps);
- gst_pad_set_getcaps_function (audiorate->sinkpad, gst_pad_proxy_getcaps);
- gst_element_add_pad (GST_ELEMENT (audiorate), audiorate->sinkpad);
-
- audiorate->srcpad =
- gst_pad_new_from_static_template (&gst_audio_rate_src_template, "src");
- gst_pad_set_event_function (audiorate->srcpad, gst_audio_rate_src_event);
- gst_pad_set_setcaps_function (audiorate->srcpad, gst_audio_rate_setcaps);
- gst_pad_set_getcaps_function (audiorate->srcpad, gst_pad_proxy_getcaps);
- gst_element_add_pad (GST_ELEMENT (audiorate), audiorate->srcpad);
-
- audiorate->in = 0;
- audiorate->out = 0;
- audiorate->drop = 0;
- audiorate->add = 0;
- audiorate->silent = DEFAULT_SILENT;
- audiorate->tolerance = DEFAULT_TOLERANCE;
-}
-
-static void
-gst_audio_rate_fill_to_time (GstAudioRate * audiorate, GstClockTime time)
-{
- GstBuffer *buf;
-
- GST_DEBUG_OBJECT (audiorate, "next_ts: %" GST_TIME_FORMAT
- ", filling to %" GST_TIME_FORMAT, GST_TIME_ARGS (audiorate->next_ts),
- GST_TIME_ARGS (time));
-
- if (!GST_CLOCK_TIME_IS_VALID (time) ||
- !GST_CLOCK_TIME_IS_VALID (audiorate->next_ts))
- return;
-
- /* feed an empty buffer to chain with the given timestamp,
- * it will take care of filling */
- buf = gst_buffer_new ();
- GST_BUFFER_TIMESTAMP (buf) = time;
- gst_audio_rate_chain (audiorate->sinkpad, buf);
-}
-
-static gboolean
-gst_audio_rate_sink_event (GstPad * pad, GstEvent * event)
-{
- gboolean res;
- GstAudioRate *audiorate;
-
- audiorate = GST_AUDIO_RATE (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_STOP:
- GST_DEBUG_OBJECT (audiorate, "handling FLUSH_STOP");
- gst_audio_rate_reset (audiorate);
- res = gst_pad_push_event (audiorate->srcpad, event);
- break;
- case GST_EVENT_NEWSEGMENT:
- {
- GstFormat format;
- gdouble rate, arate;
- gint64 start, stop, time;
- gboolean update;
-
- gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
- &start, &stop, &time);
-
- GST_DEBUG_OBJECT (audiorate, "handle NEWSEGMENT");
- /* FIXME: bad things will likely happen if rate < 0 ... */
- if (!update) {
- /* a new segment starts. We need to figure out what will be the next
- * sample offset. We mark the offsets as invalid so that the _chain
- * function will perform this calculation. */
- gst_audio_rate_fill_to_time (audiorate, audiorate->src_segment.stop);
- audiorate->next_offset = -1;
- audiorate->next_ts = -1;
- } else {
- gst_audio_rate_fill_to_time (audiorate, audiorate->src_segment.start);
- }
-
- /* we accept all formats */
- gst_segment_set_newsegment_full (&audiorate->sink_segment, update, rate,
- arate, format, start, stop, time);
-
- GST_DEBUG_OBJECT (audiorate, "updated segment: %" GST_SEGMENT_FORMAT,
- &audiorate->sink_segment);
-
- if (format == GST_FORMAT_TIME) {
- /* TIME formats can be copied to src and forwarded */
- res = gst_pad_push_event (audiorate->srcpad, event);
- memcpy (&audiorate->src_segment, &audiorate->sink_segment,
- sizeof (GstSegment));
- } else {
- /* other formats will be handled in the _chain function */
- gst_event_unref (event);
- res = TRUE;
- }
- break;
- }
- case GST_EVENT_EOS:
- /* FIXME, fill last segment */
- res = gst_pad_push_event (audiorate->srcpad, event);
- break;
- default:
- res = gst_pad_push_event (audiorate->srcpad, event);
- break;
- }
-
- gst_object_unref (audiorate);
-
- return res;
-}
-
-static gboolean
-gst_audio_rate_src_event (GstPad * pad, GstEvent * event)
-{
- gboolean res;
- GstAudioRate *audiorate;
-
- audiorate = GST_AUDIO_RATE (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- default:
- res = gst_pad_push_event (audiorate->sinkpad, event);
- break;
- }
-
- gst_object_unref (audiorate);
-
- return res;
-}
-
-static gboolean
-gst_audio_rate_convert (GstAudioRate * audiorate,
- GstFormat src_fmt, gint64 src_val, GstFormat dest_fmt, gint64 * dest_val)
-{
- if (src_fmt == dest_fmt) {
- *dest_val = src_val;
- return TRUE;
- }
-
- switch (src_fmt) {
- case GST_FORMAT_DEFAULT:
- switch (dest_fmt) {
- case GST_FORMAT_BYTES:
- *dest_val = src_val * audiorate->bytes_per_sample;
- break;
- case GST_FORMAT_TIME:
- *dest_val =
- gst_util_uint64_scale_int (src_val, GST_SECOND, audiorate->rate);
- break;
- default:
- return FALSE;;
- }
- break;
- case GST_FORMAT_BYTES:
- switch (dest_fmt) {
- case GST_FORMAT_DEFAULT:
- *dest_val = src_val / audiorate->bytes_per_sample;
- break;
- case GST_FORMAT_TIME:
- *dest_val = gst_util_uint64_scale_int (src_val, GST_SECOND,
- audiorate->rate * audiorate->bytes_per_sample);
- break;
- default:
- return FALSE;;
- }
- break;
- case GST_FORMAT_TIME:
- switch (dest_fmt) {
- case GST_FORMAT_BYTES:
- *dest_val = gst_util_uint64_scale_int (src_val,
- audiorate->rate * audiorate->bytes_per_sample, GST_SECOND);
- break;
- case GST_FORMAT_DEFAULT:
- *dest_val =
- gst_util_uint64_scale_int (src_val, audiorate->rate, GST_SECOND);
- break;
- default:
- return FALSE;;
- }
- break;
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-
-static gboolean
-gst_audio_rate_convert_segments (GstAudioRate * audiorate)
-{
- GstFormat src_fmt, dst_fmt;
-
- src_fmt = audiorate->sink_segment.format;
- dst_fmt = audiorate->src_segment.format;
-
-#define CONVERT_VAL(field) gst_audio_rate_convert (audiorate, \
- src_fmt, audiorate->sink_segment.field, \
- dst_fmt, &audiorate->src_segment.field);
-
- audiorate->sink_segment.rate = audiorate->src_segment.rate;
- audiorate->sink_segment.abs_rate = audiorate->src_segment.abs_rate;
- audiorate->sink_segment.flags = audiorate->src_segment.flags;
- audiorate->sink_segment.applied_rate = audiorate->src_segment.applied_rate;
- CONVERT_VAL (start);
- CONVERT_VAL (stop);
- CONVERT_VAL (time);
- CONVERT_VAL (accum);
- CONVERT_VAL (last_stop);
-#undef CONVERT_VAL
-
- return TRUE;
-}
-
-static GstFlowReturn
-gst_audio_rate_chain (GstPad * pad, GstBuffer * buf)
-{
- GstAudioRate *audiorate;
- GstClockTime in_time;
- guint64 in_offset, in_offset_end, in_samples;
- guint in_size;
- GstFlowReturn ret = GST_FLOW_OK;
- GstClockTimeDiff diff;
-
- audiorate = GST_AUDIO_RATE (gst_pad_get_parent (pad));
-
- /* need to be negotiated now */
- if (audiorate->bytes_per_sample == 0)
- goto not_negotiated;
-
- /* we have a new pending segment */
- if (audiorate->next_offset == -1) {
- gint64 pos;
-
- /* update the TIME segment */
- gst_audio_rate_convert_segments (audiorate);
-
- /* first buffer, we are negotiated and we have a segment, calculate the
- * current expected offsets based on the segment.start, which is the first
- * media time of the segment and should match the media time of the first
- * buffer in that segment, which is the offset expressed in DEFAULT units.
- */
- /* convert first timestamp of segment to sample position */
- pos = gst_util_uint64_scale_int (audiorate->src_segment.start,
- audiorate->rate, GST_SECOND);
-
- GST_DEBUG_OBJECT (audiorate, "resync to offset %" G_GINT64_FORMAT, pos);
-
- /* resyncing is a discont */
- audiorate->discont = TRUE;
-
- audiorate->next_offset = pos;
- audiorate->next_ts = gst_util_uint64_scale_int (audiorate->next_offset,
- GST_SECOND, audiorate->rate);
- }
-
- audiorate->in++;
-
- in_time = GST_BUFFER_TIMESTAMP (buf);
- if (in_time == GST_CLOCK_TIME_NONE) {
- GST_DEBUG_OBJECT (audiorate, "no timestamp, using expected next time");
- in_time = audiorate->next_ts;
- }
-
- in_size = GST_BUFFER_SIZE (buf);
- in_samples = in_size / audiorate->bytes_per_sample;
-
- /* calculate the buffer offset */
- in_offset = gst_util_uint64_scale_int_round (in_time, audiorate->rate,
- GST_SECOND);
- in_offset_end = in_offset + in_samples;
-
- GST_LOG_OBJECT (audiorate,
- "in_time:%" GST_TIME_FORMAT ", in_duration:%" GST_TIME_FORMAT
- ", in_size:%u, in_offset:%" G_GUINT64_FORMAT ", in_offset_end:%"
- G_GUINT64_FORMAT ", ->next_offset:%" G_GUINT64_FORMAT,
- GST_TIME_ARGS (in_time),
- GST_TIME_ARGS (GST_FRAMES_TO_CLOCK_TIME (in_samples, audiorate->rate)),
- in_size, in_offset, in_offset_end, audiorate->next_offset);
-
- diff = in_time - audiorate->next_ts;
- if (diff <= (GstClockTimeDiff) audiorate->tolerance &&
- diff >= (GstClockTimeDiff) - audiorate->tolerance) {
- /* buffer time close enough to expected time,
- * so produce a perfect stream by simply 'shifting'
- * it to next ts and offset and sending */
- GST_LOG_OBJECT (audiorate, "within tolerance %" GST_TIME_FORMAT,
- GST_TIME_ARGS (audiorate->tolerance));
- goto send;
- }
-
- /* do we need to insert samples */
- if (in_offset > audiorate->next_offset) {
- GstBuffer *fill;
- gint fillsize;
- guint64 fillsamples;
-
- /* We don't want to allocate a single unreasonably huge buffer - it might
- be hundreds of megabytes. So, limit each output buffer to one second of
- audio */
- fillsamples = in_offset - audiorate->next_offset;
-
- while (fillsamples > 0) {
- guint64 cursamples = MIN (fillsamples, audiorate->rate);
-
- fillsamples -= cursamples;
- fillsize = cursamples * audiorate->bytes_per_sample;
-
- fill = gst_buffer_new_and_alloc (fillsize);
- /* FIXME, 0 might not be the silence byte for the negotiated format. */
- memset (GST_BUFFER_DATA (fill), 0, fillsize);
-
- GST_DEBUG_OBJECT (audiorate, "inserting %" G_GUINT64_FORMAT " samples",
- cursamples);
-
- GST_BUFFER_OFFSET (fill) = audiorate->next_offset;
- audiorate->next_offset += cursamples;
- GST_BUFFER_OFFSET_END (fill) = audiorate->next_offset;
-
- /* Use next timestamp, then calculate following timestamp based on
- * offset to get duration. Neccesary complexity to get 'perfect'
- * streams */
- GST_BUFFER_TIMESTAMP (fill) = audiorate->next_ts;
- audiorate->next_ts = gst_util_uint64_scale_int (audiorate->next_offset,
- GST_SECOND, audiorate->rate);
- GST_BUFFER_DURATION (fill) = audiorate->next_ts -
- GST_BUFFER_TIMESTAMP (fill);
-
- /* we created this buffer to fill a gap */
- GST_BUFFER_FLAG_SET (fill, GST_BUFFER_FLAG_GAP);
- /* set discont if it's pending, this is mostly done for the first buffer
- * and after a flushing seek */
- if (audiorate->discont) {
- GST_BUFFER_FLAG_SET (fill, GST_BUFFER_FLAG_DISCONT);
- audiorate->discont = FALSE;
- }
- gst_buffer_set_caps (fill, GST_PAD_CAPS (audiorate->srcpad));
-
- ret = gst_pad_push (audiorate->srcpad, fill);
- if (ret != GST_FLOW_OK)
- goto beach;
- audiorate->out++;
- audiorate->add += cursamples;
-
- if (!audiorate->silent)
- g_object_notify (G_OBJECT (audiorate), "add");
- }
-
- } else if (in_offset < audiorate->next_offset) {
- /* need to remove samples */
- if (in_offset_end <= audiorate->next_offset) {
- guint64 drop = in_size / audiorate->bytes_per_sample;
-
- audiorate->drop += drop;
-
- GST_DEBUG_OBJECT (audiorate, "dropping %" G_GUINT64_FORMAT " samples",
- drop);
-
- /* we can drop the buffer completely */
- gst_buffer_unref (buf);
-
- if (!audiorate->silent)
- g_object_notify (G_OBJECT (audiorate), "drop");
-
- goto beach;
- } else {
- guint64 truncsamples;
- guint truncsize, leftsize;
- GstBuffer *trunc;
-
- /* truncate buffer */
- truncsamples = audiorate->next_offset - in_offset;
- truncsize = truncsamples * audiorate->bytes_per_sample;
- leftsize = in_size - truncsize;
-
- trunc = gst_buffer_create_sub (buf, truncsize, leftsize);
-
- gst_buffer_unref (buf);
- buf = trunc;
-
- gst_buffer_set_caps (buf, GST_PAD_CAPS (audiorate->srcpad));
-
- audiorate->drop += truncsamples;
- GST_DEBUG_OBJECT (audiorate, "truncating %" G_GUINT64_FORMAT " samples",
- truncsamples);
-
- if (!audiorate->silent)
- g_object_notify (G_OBJECT (audiorate), "drop");
- }
- }
-
-send:
- if (GST_BUFFER_SIZE (buf) == 0)
- goto beach;
-
- /* Now calculate parameters for whichever buffer (either the original
- * or truncated one) we're pushing. */
- GST_BUFFER_OFFSET (buf) = audiorate->next_offset;
- GST_BUFFER_OFFSET_END (buf) = in_offset_end;
-
- GST_BUFFER_TIMESTAMP (buf) = audiorate->next_ts;
- audiorate->next_ts = gst_util_uint64_scale_int (in_offset_end,
- GST_SECOND, audiorate->rate);
- GST_BUFFER_DURATION (buf) = audiorate->next_ts - GST_BUFFER_TIMESTAMP (buf);
-
- if (audiorate->discont) {
- /* we need to output a discont buffer, do so now */
- GST_DEBUG_OBJECT (audiorate, "marking DISCONT on output buffer");
- buf = gst_buffer_make_metadata_writable (buf);
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
- audiorate->discont = FALSE;
- } else if (GST_BUFFER_IS_DISCONT (buf)) {
- /* else we make everything continuous so we can safely remove the DISCONT
- * flag from the buffer if there was one */
- GST_DEBUG_OBJECT (audiorate, "removing DISCONT from buffer");
- buf = gst_buffer_make_metadata_writable (buf);
- GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DISCONT);
- }
-
- /* set last_stop on segment */
- gst_segment_set_last_stop (&audiorate->src_segment, GST_FORMAT_TIME,
- GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf));
-
- ret = gst_pad_push (audiorate->srcpad, buf);
- audiorate->out++;
-
- audiorate->next_offset = in_offset_end;
-beach:
-
- gst_object_unref (audiorate);
-
- return ret;
-
- /* ERRORS */
-not_negotiated:
- {
- GST_ELEMENT_ERROR (audiorate, STREAM, FORMAT,
- (NULL), ("pipeline error, format was not negotiated"));
- return GST_FLOW_NOT_NEGOTIATED;
- }
-}
-
-static void
-gst_audio_rate_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
-{
- GstAudioRate *audiorate = GST_AUDIO_RATE (object);
-
- switch (prop_id) {
- case ARG_SILENT:
- audiorate->silent = g_value_get_boolean (value);
- break;
- case ARG_TOLERANCE:
- audiorate->tolerance = g_value_get_uint64 (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_audio_rate_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- GstAudioRate *audiorate = GST_AUDIO_RATE (object);
-
- switch (prop_id) {
- case ARG_IN:
- g_value_set_uint64 (value, audiorate->in);
- break;
- case ARG_OUT:
- g_value_set_uint64 (value, audiorate->out);
- break;
- case ARG_ADD:
- g_value_set_uint64 (value, audiorate->add);
- break;
- case ARG_DROP:
- g_value_set_uint64 (value, audiorate->drop);
- break;
- case ARG_SILENT:
- g_value_set_boolean (value, audiorate->silent);
- break;
- case ARG_TOLERANCE:
- g_value_set_uint64 (value, audiorate->tolerance);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstStateChangeReturn
-gst_audio_rate_change_state (GstElement * element, GstStateChange transition)
-{
- GstAudioRate *audiorate = GST_AUDIO_RATE (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- audiorate->in = 0;
- audiorate->out = 0;
- audiorate->drop = 0;
- audiorate->bytes_per_sample = 0;
- audiorate->add = 0;
- gst_audio_rate_reset (audiorate);
- break;
- default:
- break;
- }
-
- if (parent_class->change_state)
- return parent_class->change_state (element, transition);
-
- return GST_STATE_CHANGE_SUCCESS;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (audio_rate_debug, "audiorate", 0,
- "AudioRate stream fixer");
-
- return gst_element_register (plugin, "audiorate", GST_RANK_NONE,
- GST_TYPE_AUDIO_RATE);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "audiorate",
- "Adjusts audio frames",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/audiorate/gstaudiorate.h b/gst/audiorate/gstaudiorate.h
deleted file mode 100644
index bcc087bd..00000000
--- a/gst/audiorate/gstaudiorate.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_AUDIO_RATE_H__
-#define __GST_AUDIO_RATE_H__
-
-#include <gst/gst.h>
-#include <gst/audio/audio.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_AUDIO_RATE \
- (gst_audio_rate_get_type())
-#define GST_AUDIO_RATE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_RATE,GstAudioRate))
-#define GST_AUDIO_RATE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_RATE,GstAudioRate))
-#define GST_IS_AUDIO_RATE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_RATE))
-#define GST_IS_AUDIO_RATE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_RATE))
-
-typedef struct _GstAudioRate GstAudioRate;
-typedef struct _GstAudioRateClass GstAudioRateClass;
-
-/**
- * GstAudioRate:
- *
- * Opaque data structure.
- */
-struct _GstAudioRate
-{
- GstElement element;
-
- GstPad *sinkpad, *srcpad;
-
- /* audio format */
- gint bytes_per_sample;
- gint rate;
-
- /* stats */
- guint64 in, out, add, drop;
- gboolean silent;
- guint64 tolerance;
-
- /* audio state */
- guint64 next_offset;
- guint64 next_ts;
-
- gboolean discont;
-
- gboolean new_segment;
- /* we accept all formats on the sink */
- GstSegment sink_segment;
- /* we output TIME format on the src */
- GstSegment src_segment;
-};
-
-struct _GstAudioRateClass
-{
- GstElementClass parent_class;
-};
-
-G_END_DECLS
-
-#endif /* __GST_AUDIO_RATE_H__ */
diff --git a/gst/audioresample/Makefile.am b/gst/audioresample/Makefile.am
deleted file mode 100644
index 30c5e8b4..00000000
--- a/gst/audioresample/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-plugin_LTLIBRARIES = libgstaudioresample.la
-
-if AUDIORESAMPLE_NEEDS_LIBOIL
-COND_LIBOIL_CFLAGS=$(LIBOIL_CFLAGS)
-COND_LIBOIL_LIBS=$(LIBOIL_LIBS)
-else
-COND_LIBOIL_CFLAGS=
-COND_LIBOIL_LIBS=
-endif
-
-libgstaudioresample_la_SOURCES = \
- gstaudioresample.c \
- speex_resampler_int.c \
- speex_resampler_float.c \
- speex_resampler_double.c
-
-libgstaudioresample_la_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(GST_CFLAGS) \
- $(COND_LIBOIL_CFLAGS)
-
-libgstaudioresample_la_LIBADD = \
- $(GST_PLUGINS_BASE_LIBS) \
- $(GST_BASE_LIBS) \
- $(GST_LIBS) \
- $(COND_LIBOIL_LIBS) \
- $(LIBM)
-
-libgstaudioresample_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstaudioresample_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = \
- arch.h \
- fixed_arm4.h \
- fixed_arm5e.h \
- fixed_bfin.h \
- fixed_debug.h \
- fixed_generic.h \
- gstaudioresample.h \
- resample.c \
- resample_sse.h \
- speex_resampler.h \
- speex_resampler_wrapper.h
-
diff --git a/gst/audioresample/README b/gst/audioresample/README
deleted file mode 100644
index faab16fd..00000000
--- a/gst/audioresample/README
+++ /dev/null
@@ -1,347 +0,0 @@
- arch.h
- fixed_arm4.h
- fixed_arm5e.h
- fixed_bfin.h
- fixed_debug.h
- fixed_generic.h
- resample.c
- speex_resampler.h
-
-are taken from http://git.xiph.org/speex.git/ as of 2009-11-10.
-
-The only changes are:
-
-diff -Naur old/arch.h new/arch.h
---- old/arch.h 2009-11-10 12:18:29.000000000 +0100
-+++ new/arch.h 2009-11-10 12:19:09.000000000 +0100
-@@ -78,7 +78,10 @@
- #include "../include/speex/speex_types.h"
- #endif
-
-+#ifndef ABS
- #define ABS(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute integer value. */
-+#endif
-+
- #define ABS16(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 16-bit value. */
- #define MIN16(a,b) ((a) < (b) ? (a) : (b)) /**< Maximum 16-bit value. */
- #define MAX16(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 16-bit value. */
-@@ -134,6 +137,28 @@
-
- #else
-
-+#ifdef DOUBLE_PRECISION
-+typedef double spx_mem_t;
-+typedef double spx_coef_t;
-+typedef double spx_lsp_t;
-+typedef double spx_sig_t;
-+typedef double spx_word16_t;
-+typedef double spx_word32_t;
-+
-+#define Q15ONE 1.0
-+#define LPC_SCALING 1.
-+#define SIG_SCALING 1.
-+#define LSP_SCALING 1.
-+#define GAMMA_SCALING 1.
-+#define GAIN_SCALING 1.
-+#define GAIN_SCALING_1 1.
-+
-+
-+#define VERY_SMALL 1e-20
-+#define VERY_LARGE32 1e20
-+#define VERY_LARGE16 1e20
-+#define Q15_ONE ((spx_word16_t)1.)
-+#else /* !DOUBLE_PRECISION */
- typedef float spx_mem_t;
- typedef float spx_coef_t;
- typedef float spx_lsp_t;
-@@ -154,6 +179,7 @@
- #define VERY_LARGE32 1e15f
- #define VERY_LARGE16 1e15f
- #define Q15_ONE ((spx_word16_t)1.f)
-+#endif /* DOUBLE_PRECISION */
-
- #define QCONST16(x,bits) (x)
- #define QCONST32(x,bits) (x)
-diff -Naur old/resample.c new/resample.c
---- old/resample.c 2009-11-10 12:18:51.000000000 +0100
-+++ new/resample.c 2009-11-10 12:19:09.000000000 +0100
-@@ -63,22 +63,27 @@
-
- #ifdef OUTSIDE_SPEEX
- #include <stdlib.h>
--static void *
-+
-+#include <glib.h>
-+
-+#define EXPORT G_GNUC_INTERNAL
-+
-+static inline void *
- speex_alloc (int size)
- {
-- return calloc (size, 1);
-+ return g_malloc0 (size);
- }
-
--static void *
-+static inline void *
- speex_realloc (void *ptr, int size)
- {
-- return realloc (ptr, size);
-+ return g_realloc (ptr, size);
- }
-
--static void
-+static inline void
- speex_free (void *ptr)
- {
-- free (ptr);
-+ g_free (ptr);
- }
-
- #include "speex_resampler.h"
-@@ -90,7 +95,6 @@
- #include "os_support.h"
- #endif /* OUTSIDE_SPEEX */
-
--#include "stack_alloc.h"
- #include <math.h>
-
- #ifndef M_PI
-@@ -263,10 +267,17 @@
- };
-
- /*8,24,40,56,80,104,128,160,200,256,320*/
-+#ifdef DOUBLE_PRECISION
-+static double
-+compute_func (double x, struct FuncDef *func)
-+{
-+ double y, frac;
-+#else
- static double
- compute_func (float x, struct FuncDef *func)
- {
- float y, frac;
-+#endif
- double interp[4];
- int ind;
- y = x * func->oversample;
-@@ -317,11 +328,19 @@
- }
- #else
- /* The slow way of computing a sinc for the table. Should improve that some day */
-+#ifdef DOUBLE_PRECISION
-+static spx_word16_t
-+sinc (double cutoff, double x, int N, struct FuncDef *window_func)
-+{
-+ /*fprintf (stderr, "%f ", x); */
-+ double xx = x * cutoff;
-+#else
- static spx_word16_t
- sinc (float cutoff, float x, int N, struct FuncDef *window_func)
- {
- /*fprintf (stderr, "%f ", x); */
- float xx = x * cutoff;
-+#endif
- if (fabs (x) < 1e-6)
- return cutoff;
- else if (fabs (x) > .5 * N)
-@@ -372,6 +391,7 @@
- }
- #endif
-
-+#ifndef DOUBLE_PRECISION
- static int
- resampler_basic_direct_single (SpeexResamplerState * st,
- spx_uint32_t channel_index, const spx_word16_t * in, spx_uint32_t * in_len,
-@@ -428,6 +448,7 @@
- st->samp_frac_num[channel_index] = samp_frac_num;
- return out_sample;
- }
-+#endif
-
- #ifdef FIXED_POINT
- #else
-@@ -483,6 +504,7 @@
- }
- #endif
-
-+#ifndef DOUBLE_PRECISION
- static int
- resampler_basic_interpolate_single (SpeexResamplerState * st,
- spx_uint32_t channel_index, const spx_word16_t * in, spx_uint32_t * in_len,
-@@ -562,6 +584,7 @@
- st->samp_frac_num[channel_index] = samp_frac_num;
- return out_sample;
- }
-+#endif
-
- #ifdef FIXED_POINT
- #else
-@@ -592,10 +615,16 @@
- PDIV32 (SHL32 ((samp_frac_num * st->oversample) % st->den_rate, 15),
- st->den_rate);
- #else
-+#ifdef DOUBLE_PRECISION
-+ const spx_word16_t frac =
-+ ((double) ((samp_frac_num * st->oversample) % st->den_rate)) /
-+ st->den_rate;
-+#else
- const spx_word16_t frac =
- ((float) ((samp_frac_num * st->oversample) % st->den_rate)) /
- st->den_rate;
- #endif
-+#endif
- spx_word16_t interp[4];
-
-
-@@ -696,20 +725,27 @@
- spx_int32_t j;
- for (j = 0; j < st->filt_len; j++) {
- st->sinc_table[i * st->filt_len + j] =
-- sinc (st->cutoff,
-- ((j - (spx_int32_t) st->filt_len / 2 + 1) -
-+ sinc (st->cutoff, ((j - (spx_int32_t) st->filt_len / 2 + 1) -
-+#ifdef DOUBLE_PRECISION
-+ ((double) i) / st->den_rate), st->filt_len,
-+#else
- ((float) i) / st->den_rate), st->filt_len,
-+#endif
- quality_map[st->quality].window_func);
- }
- }
- #ifdef FIXED_POINT
- st->resampler_ptr = resampler_basic_direct_single;
- #else
-+#ifdef DOUBLE_PRECISION
-+ st->resampler_ptr = resampler_basic_direct_double;
-+#else
- if (st->quality > 8)
- st->resampler_ptr = resampler_basic_direct_double;
- else
- st->resampler_ptr = resampler_basic_direct_single;
- #endif
-+#endif
- /*fprintf (stderr, "resampler uses direct sinc table and normalised cutoff %f\n", cutoff); */
- } else {
- spx_int32_t i;
-@@ -725,16 +761,24 @@
- }
- for (i = -4; i < (spx_int32_t) (st->oversample * st->filt_len + 4); i++)
- st->sinc_table[i + 4] =
-+#ifdef DOUBLE_PRECISION
-+ sinc (st->cutoff, (i / (double) st->oversample - st->filt_len / 2),
-+#else
- sinc (st->cutoff, (i / (float) st->oversample - st->filt_len / 2),
-+#endif
- st->filt_len, quality_map[st->quality].window_func);
- #ifdef FIXED_POINT
- st->resampler_ptr = resampler_basic_interpolate_single;
- #else
-+#ifdef DOUBLE_PRECISION
-+ st->resampler_ptr = resampler_basic_interpolate_double;
-+#else
- if (st->quality > 8)
- st->resampler_ptr = resampler_basic_interpolate_double;
- else
- st->resampler_ptr = resampler_basic_interpolate_single;
- #endif
-+#endif
- /*fprintf (stderr, "resampler uses interpolated sinc table and normalised cutoff %f\n", cutoff); */
- }
- st->int_advance = st->num_rate / st->den_rate;
-@@ -964,11 +1008,18 @@
- spx_uint32_t channel_index, const spx_int16_t * in, spx_uint32_t * in_len,
- spx_int16_t * out, spx_uint32_t * out_len)
- #else
-+#ifdef DOUBLE_PRECISION
-+EXPORT int
-+speex_resampler_process_float (SpeexResamplerState * st,
-+ spx_uint32_t channel_index, const double *in, spx_uint32_t * in_len,
-+ double *out, spx_uint32_t * out_len)
-+#else
- EXPORT int
- speex_resampler_process_float (SpeexResamplerState * st,
- spx_uint32_t channel_index, const float *in, spx_uint32_t * in_len,
- float *out, spx_uint32_t * out_len)
- #endif
-+#endif
- {
- int j;
- spx_uint32_t ilen = *in_len;
-@@ -1086,9 +1137,16 @@
- return RESAMPLER_ERR_SUCCESS;
- }
-
-+#ifdef DOUBLE_PRECISION
-+EXPORT int
-+speex_resampler_process_interleaved_float (SpeexResamplerState * st,
-+ const double *in, spx_uint32_t * in_len, double *out,
-+ spx_uint32_t * out_len)
-+#else
- EXPORT int
- speex_resampler_process_interleaved_float (SpeexResamplerState * st,
- const float *in, spx_uint32_t * in_len, float *out, spx_uint32_t * out_len)
-+#endif
- {
- spx_uint32_t i;
- int istride_save, ostride_save;
-diff -Naur old/speex_resampler.h new/speex_resampler.h
---- old/speex_resampler.h 2009-11-10 12:18:09.000000000 +0100
-+++ new/speex_resampler.h 2009-11-10 12:19:09.000000000 +0100
-@@ -77,10 +77,10 @@
- #define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem)
- #define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror)
-
--#define spx_int16_t short
--#define spx_int32_t int
--#define spx_uint16_t unsigned short
--#define spx_uint32_t unsigned int
-+#define spx_int16_t gint16
-+#define spx_int32_t gint32
-+#define spx_uint16_t guint16
-+#define spx_uint32_t guint32
-
- #else /* OUTSIDE_SPEEX */
-
-@@ -166,12 +166,21 @@
- * @param out Output buffer
- * @param out_len Size of the output buffer. Returns the number of samples written
- */
-+#ifdef DOUBLE_PRECISION
-+int speex_resampler_process_float(SpeexResamplerState *st,
-+ spx_uint32_t channel_index,
-+ const double *in,
-+ spx_uint32_t *in_len,
-+ double *out,
-+ spx_uint32_t *out_len);
-+#else
- int speex_resampler_process_float(SpeexResamplerState *st,
- spx_uint32_t channel_index,
- const float *in,
- spx_uint32_t *in_len,
- float *out,
- spx_uint32_t *out_len);
-+#endif
-
- /** Resample an int array. The input and output buffers must *not* overlap.
- * @param st Resampler state
-@@ -199,11 +208,19 @@
- * @param out_len Size of the output buffer. Returns the number of samples written.
- * This is all per-channel.
- */
-+#ifdef DOUBLE_PRECISION
-+int speex_resampler_process_interleaved_float(SpeexResamplerState *st,
-+ const double *in,
-+ spx_uint32_t *in_len,
-+ double *out,
-+ spx_uint32_t *out_len);
-+#else
- int speex_resampler_process_interleaved_float(SpeexResamplerState *st,
- const float *in,
- spx_uint32_t *in_len,
- float *out,
- spx_uint32_t *out_len);
-+#endif
-
- /** Resample an interleaved int array. The input and output buffers must *not* overlap.
- * @param st Resampler state
diff --git a/gst/audioresample/arch.h b/gst/audioresample/arch.h
deleted file mode 100644
index c5184582..00000000
--- a/gst/audioresample/arch.h
+++ /dev/null
@@ -1,265 +0,0 @@
-/* Copyright (C) 2003 Jean-Marc Valin */
-/**
- @file arch.h
- @brief Various architecture definitions Speex
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - 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.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- 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 FOUNDATION 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 ARCH_H
-#define ARCH_H
-
-#ifndef SPEEX_VERSION
-#define SPEEX_MAJOR_VERSION 1 /**< Major Speex version. */
-#define SPEEX_MINOR_VERSION 1 /**< Minor Speex version. */
-#define SPEEX_MICRO_VERSION 15 /**< Micro Speex version. */
-#define SPEEX_EXTRA_VERSION "" /**< Extra Speex version. */
-#define SPEEX_VERSION "speex-1.2beta3" /**< Speex version string. */
-#endif
-
-/* A couple test to catch stupid option combinations */
-#ifdef FIXED_POINT
-
-#ifdef FLOATING_POINT
-#error You cannot compile as floating point and fixed point at the same time
-#endif
-#ifdef _USE_SSE
-#error SSE is only for floating-point
-#endif
-#if ((defined (ARM4_ASM)||defined (ARM4_ASM)) && defined(BFIN_ASM)) || (defined (ARM4_ASM)&&defined(ARM5E_ASM))
-#error Make up your mind. What CPU do you have?
-#endif
-#ifdef VORBIS_PSYCHO
-#error Vorbis-psy model currently not implemented in fixed-point
-#endif
-
-#else
-
-#ifndef FLOATING_POINT
-#error You now need to define either FIXED_POINT or FLOATING_POINT
-#endif
-#if defined (ARM4_ASM) || defined(ARM5E_ASM) || defined(BFIN_ASM)
-#error I suppose you can have a [ARM4/ARM5E/Blackfin] that has float instructions?
-#endif
-#ifdef FIXED_POINT_DEBUG
-#error "Don't you think enabling fixed-point is a good thing to do if you want to debug that?"
-#endif
-
-
-#endif
-
-#ifndef OUTSIDE_SPEEX
-#include "../include/speex/speex_types.h"
-#endif
-
-#ifndef ABS
-#define ABS(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute integer value. */
-#endif
-
-#define ABS16(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 16-bit value. */
-#define MIN16(a,b) ((a) < (b) ? (a) : (b)) /**< Maximum 16-bit value. */
-#define MAX16(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 16-bit value. */
-#define ABS32(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 32-bit value. */
-#define MIN32(a,b) ((a) < (b) ? (a) : (b)) /**< Maximum 32-bit value. */
-#define MAX32(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 32-bit value. */
-
-#ifdef FIXED_POINT
-
-typedef spx_int16_t spx_word16_t;
-typedef spx_int32_t spx_word32_t;
-typedef spx_word32_t spx_mem_t;
-typedef spx_word16_t spx_coef_t;
-typedef spx_word16_t spx_lsp_t;
-typedef spx_word32_t spx_sig_t;
-
-#define Q15ONE 32767
-
-#define LPC_SCALING 8192
-#define SIG_SCALING 16384
-#define LSP_SCALING 8192.
-#define GAMMA_SCALING 32768.
-#define GAIN_SCALING 64
-#define GAIN_SCALING_1 0.015625
-
-#define LPC_SHIFT 13
-#define LSP_SHIFT 13
-#define SIG_SHIFT 14
-#define GAIN_SHIFT 6
-
-#define VERY_SMALL 0
-#define VERY_LARGE32 ((spx_word32_t)2147483647)
-#define VERY_LARGE16 ((spx_word16_t)32767)
-#define Q15_ONE ((spx_word16_t)32767)
-
-
-#ifdef FIXED_DEBUG
-#include "fixed_debug.h"
-#else
-
-#include "fixed_generic.h"
-
-#ifdef ARM5E_ASM
-#include "fixed_arm5e.h"
-#elif defined (ARM4_ASM)
-#include "fixed_arm4.h"
-#elif defined (BFIN_ASM)
-#include "fixed_bfin.h"
-#endif
-
-#endif
-
-
-#else
-
-#ifdef DOUBLE_PRECISION
-typedef double spx_mem_t;
-typedef double spx_coef_t;
-typedef double spx_lsp_t;
-typedef double spx_sig_t;
-typedef double spx_word16_t;
-typedef double spx_word32_t;
-
-#define Q15ONE 1.0
-#define LPC_SCALING 1.
-#define SIG_SCALING 1.
-#define LSP_SCALING 1.
-#define GAMMA_SCALING 1.
-#define GAIN_SCALING 1.
-#define GAIN_SCALING_1 1.
-
-
-#define VERY_SMALL 1e-20
-#define VERY_LARGE32 1e20
-#define VERY_LARGE16 1e20
-#define Q15_ONE ((spx_word16_t)1.)
-#else /* !DOUBLE_PRECISION */
-typedef float spx_mem_t;
-typedef float spx_coef_t;
-typedef float spx_lsp_t;
-typedef float spx_sig_t;
-typedef float spx_word16_t;
-typedef float spx_word32_t;
-
-#define Q15ONE 1.0f
-#define LPC_SCALING 1.f
-#define SIG_SCALING 1.f
-#define LSP_SCALING 1.f
-#define GAMMA_SCALING 1.f
-#define GAIN_SCALING 1.f
-#define GAIN_SCALING_1 1.f
-
-
-#define VERY_SMALL 1e-15f
-#define VERY_LARGE32 1e15f
-#define VERY_LARGE16 1e15f
-#define Q15_ONE ((spx_word16_t)1.f)
-#endif /* DOUBLE_PRECISION */
-
-#define QCONST16(x,bits) (x)
-#define QCONST32(x,bits) (x)
-
-#define NEG16(x) (-(x))
-#define NEG32(x) (-(x))
-#define EXTRACT16(x) (x)
-#define EXTEND32(x) (x)
-#define SHR16(a,shift) (a)
-#define SHL16(a,shift) (a)
-#define SHR32(a,shift) (a)
-#define SHL32(a,shift) (a)
-#define PSHR16(a,shift) (a)
-#define PSHR32(a,shift) (a)
-#define VSHR32(a,shift) (a)
-#define SATURATE16(x,a) (x)
-#define SATURATE32(x,a) (x)
-
-#define PSHR(a,shift) (a)
-#define SHR(a,shift) (a)
-#define SHL(a,shift) (a)
-#define SATURATE(x,a) (x)
-
-#define ADD16(a,b) ((a)+(b))
-#define SUB16(a,b) ((a)-(b))
-#define ADD32(a,b) ((a)+(b))
-#define SUB32(a,b) ((a)-(b))
-#define MULT16_16_16(a,b) ((a)*(b))
-#define MULT16_16(a,b) ((spx_word32_t)(a)*(spx_word32_t)(b))
-#define MAC16_16(c,a,b) ((c)+(spx_word32_t)(a)*(spx_word32_t)(b))
-
-#define MULT16_32_Q11(a,b) ((a)*(b))
-#define MULT16_32_Q13(a,b) ((a)*(b))
-#define MULT16_32_Q14(a,b) ((a)*(b))
-#define MULT16_32_Q15(a,b) ((a)*(b))
-#define MULT16_32_P15(a,b) ((a)*(b))
-
-#define MAC16_32_Q11(c,a,b) ((c)+(a)*(b))
-#define MAC16_32_Q15(c,a,b) ((c)+(a)*(b))
-
-#define MAC16_16_Q11(c,a,b) ((c)+(a)*(b))
-#define MAC16_16_Q13(c,a,b) ((c)+(a)*(b))
-#define MAC16_16_P13(c,a,b) ((c)+(a)*(b))
-#define MULT16_16_Q11_32(a,b) ((a)*(b))
-#define MULT16_16_Q13(a,b) ((a)*(b))
-#define MULT16_16_Q14(a,b) ((a)*(b))
-#define MULT16_16_Q15(a,b) ((a)*(b))
-#define MULT16_16_P15(a,b) ((a)*(b))
-#define MULT16_16_P13(a,b) ((a)*(b))
-#define MULT16_16_P14(a,b) ((a)*(b))
-
-#define DIV32_16(a,b) (((spx_word32_t)(a))/(spx_word16_t)(b))
-#define PDIV32_16(a,b) (((spx_word32_t)(a))/(spx_word16_t)(b))
-#define DIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b))
-#define PDIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b))
-
-
-#endif
-
-
-#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
-
-/* 2 on TI C5x DSP */
-#define BYTES_PER_CHAR 2
-#define BITS_PER_CHAR 16
-#define LOG2_BITS_PER_CHAR 4
-
-#else
-
-#define BYTES_PER_CHAR 1
-#define BITS_PER_CHAR 8
-#define LOG2_BITS_PER_CHAR 3
-
-#endif
-
-
-
-#ifdef FIXED_DEBUG
-extern long long spx_mips;
-#endif
-
-
-#endif
diff --git a/gst/audioresample/fixed_arm4.h b/gst/audioresample/fixed_arm4.h
deleted file mode 100644
index b6981cae..00000000
--- a/gst/audioresample/fixed_arm4.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/* Copyright (C) 2004 Jean-Marc Valin */
-/**
- @file fixed_arm4.h
- @brief ARM4 fixed-point operations
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - 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.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- 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 FOUNDATION 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 FIXED_ARM4_H
-#define FIXED_ARM4_H
-
-#undef MULT16_32_Q14
-static inline spx_word32_t MULT16_32_Q14(spx_word16_t x, spx_word32_t y) {
- int res;
- int dummy;
- asm (
- "smull %0,%1,%2,%3 \n\t"
- "mov %0, %0, lsr #14 \n\t"
- "add %0, %0, %1, lsl #18 \n\t"
- : "=&r"(res), "=&r" (dummy)
- : "r"(y),"r"((int)x));
- return(res);
-}
-
-#undef MULT16_32_Q15
-static inline spx_word32_t MULT16_32_Q15(spx_word16_t x, spx_word32_t y) {
- int res;
- int dummy;
- asm (
- "smull %0,%1,%2,%3 \n\t"
- "mov %0, %0, lsr #15 \n\t"
- "add %0, %0, %1, lsl #17 \n\t"
- : "=&r"(res), "=&r" (dummy)
- : "r"(y),"r"((int)x));
- return(res);
-}
-
-#undef DIV32_16
-static inline short DIV32_16(int a, int b)
-{
- int res=0;
- int dead1, dead2, dead3, dead4, dead5;
- __asm__ __volatile__ (
- "\teor %5, %0, %1\n"
- "\tmovs %4, %0\n"
- "\trsbmi %0, %0, #0 \n"
- "\tmovs %4, %1\n"
- "\trsbmi %1, %1, #0 \n"
- "\tmov %4, #1\n"
-
- "\tsubs %3, %0, %1, asl #14 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #14 \n"
-
- "\tsubs %3, %0, %1, asl #13 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #13 \n"
-
- "\tsubs %3, %0, %1, asl #12 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #12 \n"
-
- "\tsubs %3, %0, %1, asl #11 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #11 \n"
-
- "\tsubs %3, %0, %1, asl #10 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #10 \n"
-
- "\tsubs %3, %0, %1, asl #9 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #9 \n"
-
- "\tsubs %3, %0, %1, asl #8 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #8 \n"
-
- "\tsubs %3, %0, %1, asl #7 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #7 \n"
-
- "\tsubs %3, %0, %1, asl #6 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #6 \n"
-
- "\tsubs %3, %0, %1, asl #5 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #5 \n"
-
- "\tsubs %3, %0, %1, asl #4 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #4 \n"
-
- "\tsubs %3, %0, %1, asl #3 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #3 \n"
-
- "\tsubs %3, %0, %1, asl #2 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #2 \n"
-
- "\tsubs %3, %0, %1, asl #1 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4, asl #1 \n"
-
- "\tsubs %3, %0, %1 \n"
- "\tmovpl %0, %3 \n"
- "\torrpl %2, %2, %4 \n"
-
- "\tmovs %5, %5, lsr #31 \n"
- "\trsbne %2, %2, #0 \n"
- : "=r" (dead1), "=r" (dead2), "=r" (res),
- "=r" (dead3), "=r" (dead4), "=r" (dead5)
- : "0" (a), "1" (b), "2" (res)
- : "cc"
- );
- return res;
-}
-
-
-#endif
diff --git a/gst/audioresample/fixed_arm5e.h b/gst/audioresample/fixed_arm5e.h
deleted file mode 100644
index 9b4861c9..00000000
--- a/gst/audioresample/fixed_arm5e.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/* Copyright (C) 2003 Jean-Marc Valin */
-/**
- @file fixed_arm5e.h
- @brief ARM-tuned fixed-point operations
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - 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.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- 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 FOUNDATION 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 FIXED_ARM5E_H
-#define FIXED_ARM5E_H
-
-#undef MULT16_16
-static inline spx_word32_t MULT16_16(spx_word16_t x, spx_word16_t y) {
- int res;
- asm ("smulbb %0,%1,%2;\n"
- : "=&r"(res)
- : "%r"(x),"r"(y));
- return(res);
-}
-
-#undef MAC16_16
-static inline spx_word32_t MAC16_16(spx_word32_t a, spx_word16_t x, spx_word32_t y) {
- int res;
- asm ("smlabb %0,%1,%2,%3;\n"
- : "=&r"(res)
- : "%r"(x),"r"(y),"r"(a));
- return(res);
-}
-
-#undef MULT16_32_Q15
-static inline spx_word32_t MULT16_32_Q15(spx_word16_t x, spx_word32_t y) {
- int res;
- asm ("smulwb %0,%1,%2;\n"
- : "=&r"(res)
- : "%r"(y<<1),"r"(x));
- return(res);
-}
-
-#undef MAC16_32_Q15
-static inline spx_word32_t MAC16_32_Q15(spx_word32_t a, spx_word16_t x, spx_word32_t y) {
- int res;
- asm ("smlawb %0,%1,%2,%3;\n"
- : "=&r"(res)
- : "%r"(y<<1),"r"(x),"r"(a));
- return(res);
-}
-
-#undef MULT16_32_Q11
-static inline spx_word32_t MULT16_32_Q11(spx_word16_t x, spx_word32_t y) {
- int res;
- asm ("smulwb %0,%1,%2;\n"
- : "=&r"(res)
- : "%r"(y<<5),"r"(x));
- return(res);
-}
-
-#undef MAC16_32_Q11
-static inline spx_word32_t MAC16_32_Q11(spx_word32_t a, spx_word16_t x, spx_word32_t y) {
- int res;
- asm ("smlawb %0,%1,%2,%3;\n"
- : "=&r"(res)
- : "%r"(y<<5),"r"(x),"r"(a));
- return(res);
-}
-
-#undef DIV32_16
-static inline short DIV32_16(int a, int b)
-{
- int res=0;
- int dead1, dead2, dead3, dead4, dead5;
- __asm__ __volatile__ (
- "\teor %5, %0, %1\n"
- "\tmovs %4, %0\n"
- "\trsbmi %0, %0, #0 \n"
- "\tmovs %4, %1\n"
- "\trsbmi %1, %1, #0 \n"
- "\tmov %4, #1\n"
-
- "\tsubs %3, %0, %1, asl #14 \n"
- "\torrpl %2, %2, %4, asl #14 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #13 \n"
- "\torrpl %2, %2, %4, asl #13 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #12 \n"
- "\torrpl %2, %2, %4, asl #12 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #11 \n"
- "\torrpl %2, %2, %4, asl #11 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #10 \n"
- "\torrpl %2, %2, %4, asl #10 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #9 \n"
- "\torrpl %2, %2, %4, asl #9 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #8 \n"
- "\torrpl %2, %2, %4, asl #8 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #7 \n"
- "\torrpl %2, %2, %4, asl #7 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #6 \n"
- "\torrpl %2, %2, %4, asl #6 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #5 \n"
- "\torrpl %2, %2, %4, asl #5 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #4 \n"
- "\torrpl %2, %2, %4, asl #4 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #3 \n"
- "\torrpl %2, %2, %4, asl #3 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #2 \n"
- "\torrpl %2, %2, %4, asl #2 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1, asl #1 \n"
- "\torrpl %2, %2, %4, asl #1 \n"
- "\tmovpl %0, %3 \n"
-
- "\tsubs %3, %0, %1 \n"
- "\torrpl %2, %2, %4 \n"
- "\tmovpl %0, %3 \n"
-
- "\tmovs %5, %5, lsr #31 \n"
- "\trsbne %2, %2, #0 \n"
- : "=r" (dead1), "=r" (dead2), "=r" (res),
- "=r" (dead3), "=r" (dead4), "=r" (dead5)
- : "0" (a), "1" (b), "2" (res)
- : "memory", "cc"
- );
- return res;
-}
-
-
-
-
-#endif
diff --git a/gst/audioresample/fixed_bfin.h b/gst/audioresample/fixed_bfin.h
deleted file mode 100644
index 9eb21e33..00000000
--- a/gst/audioresample/fixed_bfin.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/* Copyright (C) 2005 Analog Devices
- Author: Jean-Marc Valin */
-/**
- @file fixed_bfin.h
- @brief Blackfin fixed-point operations
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - 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.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- 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 FOUNDATION 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 FIXED_BFIN_H
-#define FIXED_BFIN_H
-
-#include "bfin.h"
-
-#undef PDIV32_16
-static inline spx_word16_t PDIV32_16(spx_word32_t a, spx_word16_t b)
-{
- spx_word32_t res, bb;
- bb = b;
- a += b>>1;
- __asm__ (
- "P0 = 15;\n\t"
- "R0 = %1;\n\t"
- "R1 = %2;\n\t"
- //"R0 = R0 + R1;\n\t"
- "R0 <<= 1;\n\t"
- "DIVS (R0, R1);\n\t"
- "LOOP divide%= LC0 = P0;\n\t"
- "LOOP_BEGIN divide%=;\n\t"
- "DIVQ (R0, R1);\n\t"
- "LOOP_END divide%=;\n\t"
- "R0 = R0.L;\n\t"
- "%0 = R0;\n\t"
- : "=m" (res)
- : "m" (a), "m" (bb)
- : "P0", "R0", "R1", "ASTAT" BFIN_HWLOOP0_REGS);
- return res;
-}
-
-#undef DIV32_16
-static inline spx_word16_t DIV32_16(spx_word32_t a, spx_word16_t b)
-{
- spx_word32_t res, bb;
- bb = b;
- /* Make the roundinf consistent with the C version
- (do we need to do that?)*/
- if (a<0)
- a += (b-1);
- __asm__ (
- "P0 = 15;\n\t"
- "R0 = %1;\n\t"
- "R1 = %2;\n\t"
- "R0 <<= 1;\n\t"
- "DIVS (R0, R1);\n\t"
- "LOOP divide%= LC0 = P0;\n\t"
- "LOOP_BEGIN divide%=;\n\t"
- "DIVQ (R0, R1);\n\t"
- "LOOP_END divide%=;\n\t"
- "R0 = R0.L;\n\t"
- "%0 = R0;\n\t"
- : "=m" (res)
- : "m" (a), "m" (bb)
- : "P0", "R0", "R1", "ASTAT" BFIN_HWLOOP0_REGS);
- return res;
-}
-
-#undef MAX16
-static inline spx_word16_t MAX16(spx_word16_t a, spx_word16_t b)
-{
- spx_word32_t res;
- __asm__ (
- "%1 = %1.L (X);\n\t"
- "%2 = %2.L (X);\n\t"
- "%0 = MAX(%1,%2);"
- : "=d" (res)
- : "%d" (a), "d" (b)
- : "ASTAT"
- );
- return res;
-}
-
-#undef MULT16_32_Q15
-static inline spx_word32_t MULT16_32_Q15(spx_word16_t a, spx_word32_t b)
-{
- spx_word32_t res;
- __asm__
- (
- "A1 = %2.L*%1.L (M);\n\t"
- "A1 = A1 >>> 15;\n\t"
- "%0 = (A1 += %2.L*%1.H) ;\n\t"
- : "=&W" (res), "=&d" (b)
- : "d" (a), "1" (b)
- : "A1", "ASTAT"
- );
- return res;
-}
-
-#undef MAC16_32_Q15
-static inline spx_word32_t MAC16_32_Q15(spx_word32_t c, spx_word16_t a, spx_word32_t b)
-{
- spx_word32_t res;
- __asm__
- (
- "A1 = %2.L*%1.L (M);\n\t"
- "A1 = A1 >>> 15;\n\t"
- "%0 = (A1 += %2.L*%1.H);\n\t"
- "%0 = %0 + %4;\n\t"
- : "=&W" (res), "=&d" (b)
- : "d" (a), "1" (b), "d" (c)
- : "A1", "ASTAT"
- );
- return res;
-}
-
-#undef MULT16_32_Q14
-static inline spx_word32_t MULT16_32_Q14(spx_word16_t a, spx_word32_t b)
-{
- spx_word32_t res;
- __asm__
- (
- "%2 <<= 1;\n\t"
- "A1 = %1.L*%2.L (M);\n\t"
- "A1 = A1 >>> 15;\n\t"
- "%0 = (A1 += %1.L*%2.H);\n\t"
- : "=W" (res), "=d" (a), "=d" (b)
- : "1" (a), "2" (b)
- : "A1", "ASTAT"
- );
- return res;
-}
-
-#undef MAC16_32_Q14
-static inline spx_word32_t MAC16_32_Q14(spx_word32_t c, spx_word16_t a, spx_word32_t b)
-{
- spx_word32_t res;
- __asm__
- (
- "%1 <<= 1;\n\t"
- "A1 = %2.L*%1.L (M);\n\t"
- "A1 = A1 >>> 15;\n\t"
- "%0 = (A1 += %2.L*%1.H);\n\t"
- "%0 = %0 + %4;\n\t"
- : "=&W" (res), "=&d" (b)
- : "d" (a), "1" (b), "d" (c)
- : "A1", "ASTAT"
- );
- return res;
-}
-
-#endif
diff --git a/gst/audioresample/fixed_debug.h b/gst/audioresample/fixed_debug.h
deleted file mode 100644
index 54f3866e..00000000
--- a/gst/audioresample/fixed_debug.h
+++ /dev/null
@@ -1,487 +0,0 @@
-/* Copyright (C) 2003 Jean-Marc Valin */
-/**
- @file fixed_debug.h
- @brief Fixed-point operations with debugging
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - 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.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- 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 FOUNDATION 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 FIXED_DEBUG_H
-#define FIXED_DEBUG_H
-
-#include <stdio.h>
-
-extern long long spx_mips;
-#define MIPS_INC spx_mips++,
-
-#define QCONST16(x,bits) ((spx_word16_t)(.5+(x)*(((spx_word32_t)1)<<(bits))))
-#define QCONST32(x,bits) ((spx_word32_t)(.5+(x)*(((spx_word32_t)1)<<(bits))))
-
-
-#define VERIFY_SHORT(x) ((x)<=32767&&(x)>=-32768)
-#define VERIFY_INT(x) ((x)<=2147483647LL&&(x)>=-2147483648LL)
-
-static inline short NEG16(int x)
-{
- int res;
- if (!VERIFY_SHORT(x))
- {
- fprintf (stderr, "NEG16: input is not short: %d\n", (int)x);
- }
- res = -x;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "NEG16: output is not short: %d\n", (int)res);
- spx_mips++;
- return res;
-}
-static inline int NEG32(long long x)
-{
- long long res;
- if (!VERIFY_INT(x))
- {
- fprintf (stderr, "NEG16: input is not int: %d\n", (int)x);
- }
- res = -x;
- if (!VERIFY_INT(res))
- fprintf (stderr, "NEG16: output is not int: %d\n", (int)res);
- spx_mips++;
- return res;
-}
-
-#define EXTRACT16(x) _EXTRACT16(x, __FILE__, __LINE__)
-static inline short _EXTRACT16(int x, char *file, int line)
-{
- int res;
- if (!VERIFY_SHORT(x))
- {
- fprintf (stderr, "EXTRACT16: input is not short: %d in %s: line %d\n", x, file, line);
- }
- res = x;
- spx_mips++;
- return res;
-}
-
-#define EXTEND32(x) _EXTEND32(x, __FILE__, __LINE__)
-static inline int _EXTEND32(int x, char *file, int line)
-{
- int res;
- if (!VERIFY_SHORT(x))
- {
- fprintf (stderr, "EXTEND32: input is not short: %d in %s: line %d\n", x, file, line);
- }
- res = x;
- spx_mips++;
- return res;
-}
-
-#define SHR16(a, shift) _SHR16(a, shift, __FILE__, __LINE__)
-static inline short _SHR16(int a, int shift, char *file, int line)
-{
- int res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
- {
- fprintf (stderr, "SHR16: inputs are not short: %d >> %d in %s: line %d\n", a, shift, file, line);
- }
- res = a>>shift;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "SHR16: output is not short: %d in %s: line %d\n", res, file, line);
- spx_mips++;
- return res;
-}
-#define SHL16(a, shift) _SHL16(a, shift, __FILE__, __LINE__)
-static inline short _SHL16(int a, int shift, char *file, int line)
-{
- int res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
- {
- fprintf (stderr, "SHL16: inputs are not short: %d %d in %s: line %d\n", a, shift, file, line);
- }
- res = a<<shift;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "SHL16: output is not short: %d in %s: line %d\n", res, file, line);
- spx_mips++;
- return res;
-}
-
-static inline int SHR32(long long a, int shift)
-{
- long long res;
- if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
- {
- fprintf (stderr, "SHR32: inputs are not int: %d %d\n", (int)a, shift);
- }
- res = a>>shift;
- if (!VERIFY_INT(res))
- {
- fprintf (stderr, "SHR32: output is not int: %d\n", (int)res);
- }
- spx_mips++;
- return res;
-}
-static inline int SHL32(long long a, int shift)
-{
- long long res;
- if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
- {
- fprintf (stderr, "SHL32: inputs are not int: %d %d\n", (int)a, shift);
- }
- res = a<<shift;
- if (!VERIFY_INT(res))
- {
- fprintf (stderr, "SHL32: output is not int: %d\n", (int)res);
- }
- spx_mips++;
- return res;
-}
-
-#define PSHR16(a,shift) (SHR16(ADD16((a),((1<<((shift))>>1))),shift))
-#define PSHR32(a,shift) (SHR32(ADD32((a),((EXTEND32(1)<<((shift))>>1))),shift))
-#define VSHR32(a, shift) (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift)))
-
-#define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
-#define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
-
-//#define SHR(a,shift) ((a) >> (shift))
-//#define SHL(a,shift) ((a) << (shift))
-
-#define ADD16(a, b) _ADD16(a, b, __FILE__, __LINE__)
-static inline short _ADD16(int a, int b, char *file, int line)
-{
- int res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "ADD16: inputs are not short: %d %d in %s: line %d\n", a, b, file, line);
- }
- res = a+b;
- if (!VERIFY_SHORT(res))
- {
- fprintf (stderr, "ADD16: output is not short: %d+%d=%d in %s: line %d\n", a,b,res, file, line);
- }
- spx_mips++;
- return res;
-}
-
-#define SUB16(a, b) _SUB16(a, b, __FILE__, __LINE__)
-static inline short _SUB16(int a, int b, char *file, int line)
-{
- int res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "SUB16: inputs are not short: %d %d in %s: line %d\n", a, b, file, line);
- }
- res = a-b;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "SUB16: output is not short: %d in %s: line %d\n", res, file, line);
- spx_mips++;
- return res;
-}
-
-#define ADD32(a, b) _ADD32(a, b, __FILE__, __LINE__)
-static inline int _ADD32(long long a, long long b, char *file, int line)
-{
- long long res;
- if (!VERIFY_INT(a) || !VERIFY_INT(b))
- {
- fprintf (stderr, "ADD32: inputs are not int: %d %d in %s: line %d\n", (int)a, (int)b, file, line);
- }
- res = a+b;
- if (!VERIFY_INT(res))
- {
- fprintf (stderr, "ADD32: output is not int: %d in %s: line %d\n", (int)res, file, line);
- }
- spx_mips++;
- return res;
-}
-
-static inline int SUB32(long long a, long long b)
-{
- long long res;
- if (!VERIFY_INT(a) || !VERIFY_INT(b))
- {
- fprintf (stderr, "SUB32: inputs are not int: %d %d\n", (int)a, (int)b);
- }
- res = a-b;
- if (!VERIFY_INT(res))
- fprintf (stderr, "SUB32: output is not int: %d\n", (int)res);
- spx_mips++;
- return res;
-}
-
-#define ADD64(a,b) (MIPS_INC(a)+(b))
-
-/* result fits in 16 bits */
-static inline short MULT16_16_16(int a, int b)
-{
- int res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16_16: inputs are not short: %d %d\n", a, b);
- }
- res = a*b;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "MULT16_16_16: output is not short: %d\n", res);
- spx_mips++;
- return res;
-}
-
-#define MULT16_16(a, b) _MULT16_16(a, b, __FILE__, __LINE__)
-static inline int _MULT16_16(int a, int b, char *file, int line)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16: inputs are not short: %d %d in %s: line %d\n", a, b, file, line);
- }
- res = ((long long)a)*b;
- if (!VERIFY_INT(res))
- fprintf (stderr, "MULT16_16: output is not int: %d in %s: line %d\n", (int)res, file, line);
- spx_mips++;
- return res;
-}
-
-#define MAC16_16(c,a,b) (spx_mips--,ADD32((c),MULT16_16((a),(b))))
-#define MAC16_16_Q11(c,a,b) (EXTRACT16(ADD16((c),EXTRACT16(SHR32(MULT16_16((a),(b)),11)))))
-#define MAC16_16_Q13(c,a,b) (EXTRACT16(ADD16((c),EXTRACT16(SHR32(MULT16_16((a),(b)),13)))))
-#define MAC16_16_P13(c,a,b) (EXTRACT16(ADD32((c),SHR32(ADD32(4096,MULT16_16((a),(b))),13))))
-
-
-#define MULT16_32_QX(a, b, Q) _MULT16_32_QX(a, b, Q, __FILE__, __LINE__)
-static inline int _MULT16_32_QX(int a, long long b, int Q, char *file, int line)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_INT(b))
- {
- fprintf (stderr, "MULT16_32_Q%d: inputs are not short+int: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
- }
- if (ABS32(b)>=(EXTEND32(1)<<(15+Q)))
- fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
- res = (((long long)a)*(long long)b) >> Q;
- if (!VERIFY_INT(res))
- fprintf (stderr, "MULT16_32_Q%d: output is not int: %d*%d=%d in %s: line %d\n", Q, (int)a, (int)b,(int)res, file, line);
- spx_mips+=5;
- return res;
-}
-
-static inline int MULT16_32_PX(int a, long long b, int Q)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_INT(b))
- {
- fprintf (stderr, "MULT16_32_P%d: inputs are not short+int: %d %d\n", Q, (int)a, (int)b);
- }
- if (ABS32(b)>=(EXTEND32(1)<<(15+Q)))
- fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b);
- res = ((((long long)a)*(long long)b) + ((EXTEND32(1)<<Q)>>1))>> Q;
- if (!VERIFY_INT(res))
- fprintf (stderr, "MULT16_32_P%d: output is not int: %d*%d=%d\n", Q, (int)a, (int)b,(int)res);
- spx_mips+=5;
- return res;
-}
-
-
-#define MULT16_32_Q11(a,b) MULT16_32_QX(a,b,11)
-#define MAC16_32_Q11(c,a,b) ADD32((c),MULT16_32_Q11((a),(b)))
-#define MULT16_32_Q12(a,b) MULT16_32_QX(a,b,12)
-#define MULT16_32_Q13(a,b) MULT16_32_QX(a,b,13)
-#define MULT16_32_Q14(a,b) MULT16_32_QX(a,b,14)
-#define MULT16_32_Q15(a,b) MULT16_32_QX(a,b,15)
-#define MULT16_32_P15(a,b) MULT16_32_PX(a,b,15)
-#define MAC16_32_Q15(c,a,b) ADD32((c),MULT16_32_Q15((a),(b)))
-
-static inline int SATURATE(int a, int b)
-{
- if (a>b)
- a=b;
- if (a<-b)
- a = -b;
- return a;
-}
-
-static inline int MULT16_16_Q11_32(int a, int b)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16_Q11: inputs are not short: %d %d\n", a, b);
- }
- res = ((long long)a)*b;
- res >>= 11;
- if (!VERIFY_INT(res))
- fprintf (stderr, "MULT16_16_Q11: output is not short: %d*%d=%d\n", (int)a, (int)b, (int)res);
- spx_mips+=3;
- return res;
-}
-static inline short MULT16_16_Q13(int a, int b)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16_Q13: inputs are not short: %d %d\n", a, b);
- }
- res = ((long long)a)*b;
- res >>= 13;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "MULT16_16_Q13: output is not short: %d*%d=%d\n", a, b, (int)res);
- spx_mips+=3;
- return res;
-}
-static inline short MULT16_16_Q14(int a, int b)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16_Q14: inputs are not short: %d %d\n", a, b);
- }
- res = ((long long)a)*b;
- res >>= 14;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "MULT16_16_Q14: output is not short: %d\n", (int)res);
- spx_mips+=3;
- return res;
-}
-static inline short MULT16_16_Q15(int a, int b)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16_Q15: inputs are not short: %d %d\n", a, b);
- }
- res = ((long long)a)*b;
- res >>= 15;
- if (!VERIFY_SHORT(res))
- {
- fprintf (stderr, "MULT16_16_Q15: output is not short: %d\n", (int)res);
- }
- spx_mips+=3;
- return res;
-}
-
-static inline short MULT16_16_P13(int a, int b)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16_P13: inputs are not short: %d %d\n", a, b);
- }
- res = ((long long)a)*b;
- res += 4096;
- if (!VERIFY_INT(res))
- fprintf (stderr, "MULT16_16_P13: overflow: %d*%d=%d\n", a, b, (int)res);
- res >>= 13;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "MULT16_16_P13: output is not short: %d*%d=%d\n", a, b, (int)res);
- spx_mips+=4;
- return res;
-}
-static inline short MULT16_16_P14(int a, int b)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16_P14: inputs are not short: %d %d\n", a, b);
- }
- res = ((long long)a)*b;
- res += 8192;
- if (!VERIFY_INT(res))
- fprintf (stderr, "MULT16_16_P14: overflow: %d*%d=%d\n", a, b, (int)res);
- res >>= 14;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "MULT16_16_P14: output is not short: %d*%d=%d\n", a, b, (int)res);
- spx_mips+=4;
- return res;
-}
-static inline short MULT16_16_P15(int a, int b)
-{
- long long res;
- if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "MULT16_16_P15: inputs are not short: %d %d\n", a, b);
- }
- res = ((long long)a)*b;
- res += 16384;
- if (!VERIFY_INT(res))
- fprintf (stderr, "MULT16_16_P15: overflow: %d*%d=%d\n", a, b, (int)res);
- res >>= 15;
- if (!VERIFY_SHORT(res))
- fprintf (stderr, "MULT16_16_P15: output is not short: %d*%d=%d\n", a, b, (int)res);
- spx_mips+=4;
- return res;
-}
-
-#define DIV32_16(a, b) _DIV32_16(a, b, __FILE__, __LINE__)
-
-static inline int _DIV32_16(long long a, long long b, char *file, int line)
-{
- long long res;
- if (b==0)
- {
- fprintf(stderr, "DIV32_16: divide by zero: %d/%d in %s: line %d\n", (int)a, (int)b, file, line);
- return 0;
- }
- if (!VERIFY_INT(a) || !VERIFY_SHORT(b))
- {
- fprintf (stderr, "DIV32_16: inputs are not int/short: %d %d in %s: line %d\n", (int)a, (int)b, file, line);
- }
- res = a/b;
- if (!VERIFY_SHORT(res))
- {
- fprintf (stderr, "DIV32_16: output is not short: %d / %d = %d in %s: line %d\n", (int)a,(int)b,(int)res, file, line);
- if (res>32767)
- res = 32767;
- if (res<-32768)
- res = -32768;
- }
- spx_mips+=20;
- return res;
-}
-
-#define DIV32(a, b) _DIV32(a, b, __FILE__, __LINE__)
-static inline int _DIV32(long long a, long long b, char *file, int line)
-{
- long long res;
- if (b==0)
- {
- fprintf(stderr, "DIV32: divide by zero: %d/%d in %s: line %d\n", (int)a, (int)b, file, line);
- return 0;
- }
-
- if (!VERIFY_INT(a) || !VERIFY_INT(b))
- {
- fprintf (stderr, "DIV32: inputs are not int/short: %d %d in %s: line %d\n", (int)a, (int)b, file, line);
- }
- res = a/b;
- if (!VERIFY_INT(res))
- fprintf (stderr, "DIV32: output is not int: %d in %s: line %d\n", (int)res, file, line);
- spx_mips+=36;
- return res;
-}
-#define PDIV32(a,b) DIV32(ADD32((a),(b)>>1),b)
-#define PDIV32_16(a,b) DIV32_16(ADD32((a),(b)>>1),b)
-
-#endif
diff --git a/gst/audioresample/fixed_generic.h b/gst/audioresample/fixed_generic.h
deleted file mode 100644
index 3fb096ed..00000000
--- a/gst/audioresample/fixed_generic.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Copyright (C) 2003 Jean-Marc Valin */
-/**
- @file fixed_generic.h
- @brief Generic fixed-point operations
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - 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.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- 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 FOUNDATION 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 FIXED_GENERIC_H
-#define FIXED_GENERIC_H
-
-#define QCONST16(x,bits) ((spx_word16_t)(.5+(x)*(((spx_word32_t)1)<<(bits))))
-#define QCONST32(x,bits) ((spx_word32_t)(.5+(x)*(((spx_word32_t)1)<<(bits))))
-
-#define NEG16(x) (-(x))
-#define NEG32(x) (-(x))
-#define EXTRACT16(x) ((spx_word16_t)(x))
-#define EXTEND32(x) ((spx_word32_t)(x))
-#define SHR16(a,shift) ((a) >> (shift))
-#define SHL16(a,shift) ((a) << (shift))
-#define SHR32(a,shift) ((a) >> (shift))
-#define SHL32(a,shift) ((a) << (shift))
-#define PSHR16(a,shift) (SHR16((a)+((1<<((shift))>>1)),shift))
-#define PSHR32(a,shift) (SHR32((a)+((EXTEND32(1)<<((shift))>>1)),shift))
-#define VSHR32(a, shift) (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift)))
-#define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
-#define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
-
-#define SHR(a,shift) ((a) >> (shift))
-#define SHL(a,shift) ((spx_word32_t)(a) << (shift))
-#define PSHR(a,shift) (SHR((a)+((EXTEND32(1)<<((shift))>>1)),shift))
-#define SATURATE(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
-
-
-#define ADD16(a,b) ((spx_word16_t)((spx_word16_t)(a)+(spx_word16_t)(b)))
-#define SUB16(a,b) ((spx_word16_t)(a)-(spx_word16_t)(b))
-#define ADD32(a,b) ((spx_word32_t)(a)+(spx_word32_t)(b))
-#define SUB32(a,b) ((spx_word32_t)(a)-(spx_word32_t)(b))
-
-
-/* result fits in 16 bits */
-#define MULT16_16_16(a,b) ((((spx_word16_t)(a))*((spx_word16_t)(b))))
-
-/* (spx_word32_t)(spx_word16_t) gives TI compiler a hint that it's 16x16->32 multiply */
-#define MULT16_16(a,b) (((spx_word32_t)(spx_word16_t)(a))*((spx_word32_t)(spx_word16_t)(b)))
-
-#define MAC16_16(c,a,b) (ADD32((c),MULT16_16((a),(b))))
-#define MULT16_32_Q12(a,b) ADD32(MULT16_16((a),SHR((b),12)), SHR(MULT16_16((a),((b)&0x00000fff)),12))
-#define MULT16_32_Q13(a,b) ADD32(MULT16_16((a),SHR((b),13)), SHR(MULT16_16((a),((b)&0x00001fff)),13))
-#define MULT16_32_Q14(a,b) ADD32(MULT16_16((a),SHR((b),14)), SHR(MULT16_16((a),((b)&0x00003fff)),14))
-
-#define MULT16_32_Q11(a,b) ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11))
-#define MAC16_32_Q11(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11)))
-
-#define MULT16_32_P15(a,b) ADD32(MULT16_16((a),SHR((b),15)), PSHR(MULT16_16((a),((b)&0x00007fff)),15))
-#define MULT16_32_Q15(a,b) ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15))
-#define MAC16_32_Q15(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15)))
-
-
-#define MAC16_16_Q11(c,a,b) (ADD32((c),SHR(MULT16_16((a),(b)),11)))
-#define MAC16_16_Q13(c,a,b) (ADD32((c),SHR(MULT16_16((a),(b)),13)))
-#define MAC16_16_P13(c,a,b) (ADD32((c),SHR(ADD32(4096,MULT16_16((a),(b))),13)))
-
-#define MULT16_16_Q11_32(a,b) (SHR(MULT16_16((a),(b)),11))
-#define MULT16_16_Q13(a,b) (SHR(MULT16_16((a),(b)),13))
-#define MULT16_16_Q14(a,b) (SHR(MULT16_16((a),(b)),14))
-#define MULT16_16_Q15(a,b) (SHR(MULT16_16((a),(b)),15))
-
-#define MULT16_16_P13(a,b) (SHR(ADD32(4096,MULT16_16((a),(b))),13))
-#define MULT16_16_P14(a,b) (SHR(ADD32(8192,MULT16_16((a),(b))),14))
-#define MULT16_16_P15(a,b) (SHR(ADD32(16384,MULT16_16((a),(b))),15))
-
-#define MUL_16_32_R15(a,bh,bl) ADD32(MULT16_16((a),(bh)), SHR(MULT16_16((a),(bl)),15))
-
-#define DIV32_16(a,b) ((spx_word16_t)(((spx_word32_t)(a))/((spx_word16_t)(b))))
-#define PDIV32_16(a,b) ((spx_word16_t)(((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word16_t)(b))))
-#define DIV32(a,b) (((spx_word32_t)(a))/((spx_word32_t)(b)))
-#define PDIV32(a,b) (((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word32_t)(b)))
-
-#endif
diff --git a/gst/audioresample/gstaudioresample.c b/gst/audioresample/gstaudioresample.c
deleted file mode 100644
index 6336db57..00000000
--- a/gst/audioresample/gstaudioresample.c
+++ /dev/null
@@ -1,1479 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999 Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) 2003,2004 David A. Schleef <ds@schleef.org>
- * Copyright (C) 2007-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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-audioresample
- *
- * audioresample resamples raw audio buffers to different sample rates using
- * a configurable windowing function to enhance quality.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch -v filesrc location=sine.ogg ! oggdemux ! vorbisdec ! audioconvert ! audioresample ! audio/x-raw-int, rate=8000 ! alsasink
- * ]| Decode an Ogg/Vorbis downsample to 8Khz and play sound through alsa.
- * To create the Ogg/Vorbis file refer to the documentation of vorbisenc.
- * </refsect2>
- */
-
-/* TODO:
- * - Enable SSE/ARM optimizations and select at runtime
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <math.h>
-
-#include "gstaudioresample.h"
-#include <gst/gstutils.h>
-#include <gst/audio/audio.h>
-#include <gst/base/gstbasetransform.h>
-
-#if defined AUDIORESAMPLE_FORMAT_AUTO
-#define OIL_ENABLE_UNSTABLE_API
-#include <liboil/liboilprofile.h>
-#include <liboil/liboil.h>
-#endif
-
-GST_DEBUG_CATEGORY (audio_resample_debug);
-#define GST_CAT_DEFAULT audio_resample_debug
-
-enum
-{
- PROP_0,
- PROP_QUALITY,
- PROP_FILTER_LENGTH
-};
-
-#define SUPPORTED_CAPS \
-GST_STATIC_CAPS ( \
- "audio/x-raw-float, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) { 32, 64 }; " \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 32, " \
- "depth = (int) 32, " \
- "signed = (boolean) true; " \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 24, " \
- "depth = (int) 24, " \
- "signed = (boolean) true; " \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 16, " \
- "depth = (int) 16, " \
- "signed = (boolean) true; " \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 8, " \
- "depth = (int) 8, " \
- "signed = (boolean) true" \
-)
-
-/* If TRUE integer arithmetic resampling is faster and will be used if appropiate */
-#if defined AUDIORESAMPLE_FORMAT_INT
-static gboolean gst_audio_resample_use_int = TRUE;
-#elif defined AUDIORESAMPLE_FORMAT_FLOAT
-static gboolean gst_audio_resample_use_int = FALSE;
-#else
-static gboolean gst_audio_resample_use_int = FALSE;
-#endif
-
-static GstStaticPadTemplate gst_audio_resample_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK, GST_PAD_ALWAYS, SUPPORTED_CAPS);
-
-static GstStaticPadTemplate gst_audio_resample_src_template =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC, GST_PAD_ALWAYS, SUPPORTED_CAPS);
-
-static void gst_audio_resample_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_audio_resample_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-/* vmethods */
-static gboolean gst_audio_resample_get_unit_size (GstBaseTransform * base,
- GstCaps * caps, guint * size);
-static GstCaps *gst_audio_resample_transform_caps (GstBaseTransform * base,
- GstPadDirection direction, GstCaps * caps);
-static void gst_audio_resample_fixate_caps (GstBaseTransform * base,
- GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
-static gboolean gst_audio_resample_transform_size (GstBaseTransform * trans,
- GstPadDirection direction, GstCaps * incaps, guint insize,
- GstCaps * outcaps, guint * outsize);
-static gboolean gst_audio_resample_set_caps (GstBaseTransform * base,
- GstCaps * incaps, GstCaps * outcaps);
-static GstFlowReturn gst_audio_resample_transform (GstBaseTransform * base,
- GstBuffer * inbuf, GstBuffer * outbuf);
-static gboolean gst_audio_resample_event (GstBaseTransform * base,
- GstEvent * event);
-static gboolean gst_audio_resample_start (GstBaseTransform * base);
-static gboolean gst_audio_resample_stop (GstBaseTransform * base);
-static gboolean gst_audio_resample_query (GstPad * pad, GstQuery * query);
-static const GstQueryType *gst_audio_resample_query_type (GstPad * pad);
-
-GST_BOILERPLATE (GstAudioResample, gst_audio_resample, GstBaseTransform,
- GST_TYPE_BASE_TRANSFORM);
-
-static void
-gst_audio_resample_base_init (gpointer g_class)
-{
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&gst_audio_resample_src_template));
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&gst_audio_resample_sink_template));
-
- gst_element_class_set_details_simple (gstelement_class, "Audio resampler",
- "Filter/Converter/Audio", "Resamples audio",
- "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
-}
-
-static void
-gst_audio_resample_class_init (GstAudioResampleClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
-
- gobject_class->set_property = gst_audio_resample_set_property;
- gobject_class->get_property = gst_audio_resample_get_property;
-
- g_object_class_install_property (gobject_class, PROP_QUALITY,
- g_param_spec_int ("quality", "Quality", "Resample quality with 0 being "
- "the lowest and 10 being the best",
- SPEEX_RESAMPLER_QUALITY_MIN, SPEEX_RESAMPLER_QUALITY_MAX,
- SPEEX_RESAMPLER_QUALITY_DEFAULT,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
- /* FIXME 0.11: Remove this property, it's just for compatibility
- * with old audioresample
- */
- /**
- * GstAudioResample:filter-length:
- *
- * Length of the resample filter
- *
- * Deprectated: Use #GstAudioResample:quality property instead
- */
- g_object_class_install_property (gobject_class, PROP_FILTER_LENGTH,
- g_param_spec_int ("filter-length", "Filter length",
- "Length of the resample filter", 0, G_MAXINT, 64, G_PARAM_READWRITE));
-
- GST_BASE_TRANSFORM_CLASS (klass)->start =
- GST_DEBUG_FUNCPTR (gst_audio_resample_start);
- GST_BASE_TRANSFORM_CLASS (klass)->stop =
- GST_DEBUG_FUNCPTR (gst_audio_resample_stop);
- GST_BASE_TRANSFORM_CLASS (klass)->transform_size =
- GST_DEBUG_FUNCPTR (gst_audio_resample_transform_size);
- GST_BASE_TRANSFORM_CLASS (klass)->get_unit_size =
- GST_DEBUG_FUNCPTR (gst_audio_resample_get_unit_size);
- GST_BASE_TRANSFORM_CLASS (klass)->transform_caps =
- GST_DEBUG_FUNCPTR (gst_audio_resample_transform_caps);
- GST_BASE_TRANSFORM_CLASS (klass)->fixate_caps =
- GST_DEBUG_FUNCPTR (gst_audio_resample_fixate_caps);
- GST_BASE_TRANSFORM_CLASS (klass)->set_caps =
- GST_DEBUG_FUNCPTR (gst_audio_resample_set_caps);
- GST_BASE_TRANSFORM_CLASS (klass)->transform =
- GST_DEBUG_FUNCPTR (gst_audio_resample_transform);
- GST_BASE_TRANSFORM_CLASS (klass)->event =
- GST_DEBUG_FUNCPTR (gst_audio_resample_event);
-
- GST_BASE_TRANSFORM_CLASS (klass)->passthrough_on_same_caps = TRUE;
-}
-
-static void
-gst_audio_resample_init (GstAudioResample * resample,
- GstAudioResampleClass * klass)
-{
- GstBaseTransform *trans = GST_BASE_TRANSFORM (resample);
-
- resample->quality = SPEEX_RESAMPLER_QUALITY_DEFAULT;
-
- gst_pad_set_query_function (trans->srcpad, gst_audio_resample_query);
- gst_pad_set_query_type_function (trans->srcpad,
- gst_audio_resample_query_type);
-}
-
-/* vmethods */
-static gboolean
-gst_audio_resample_start (GstBaseTransform * base)
-{
- GstAudioResample *resample = GST_AUDIO_RESAMPLE (base);
-
- resample->need_discont = TRUE;
-
- resample->t0 = GST_CLOCK_TIME_NONE;
- resample->in_offset0 = GST_BUFFER_OFFSET_NONE;
- resample->out_offset0 = GST_BUFFER_OFFSET_NONE;
- resample->next_in_offset = GST_BUFFER_OFFSET_NONE;
- resample->next_out_offset = GST_BUFFER_OFFSET_NONE;
-
- resample->tmp_in = NULL;
- resample->tmp_in_size = 0;
- resample->tmp_out = NULL;
- resample->tmp_out_size = 0;
-
- return TRUE;
-}
-
-static gboolean
-gst_audio_resample_stop (GstBaseTransform * base)
-{
- GstAudioResample *resample = GST_AUDIO_RESAMPLE (base);
-
- if (resample->state) {
- resample->funcs->destroy (resample->state);
- resample->state = NULL;
- }
-
- resample->funcs = NULL;
-
- g_free (resample->tmp_in);
- resample->tmp_in = NULL;
- resample->tmp_in_size = 0;
-
- g_free (resample->tmp_out);
- resample->tmp_out = NULL;
- resample->tmp_out_size = 0;
-
- gst_caps_replace (&resample->sinkcaps, NULL);
- gst_caps_replace (&resample->srccaps, NULL);
-
- return TRUE;
-}
-
-static gboolean
-gst_audio_resample_get_unit_size (GstBaseTransform * base, GstCaps * caps,
- guint * size)
-{
- gint width, channels;
- GstStructure *structure;
- gboolean ret;
-
- g_return_val_if_fail (size != NULL, FALSE);
-
- /* this works for both float and int */
- structure = gst_caps_get_structure (caps, 0);
- ret = gst_structure_get_int (structure, "width", &width);
- ret &= gst_structure_get_int (structure, "channels", &channels);
-
- if (G_UNLIKELY (!ret))
- return FALSE;
-
- *size = (width / 8) * channels;
-
- return TRUE;
-}
-
-static GstCaps *
-gst_audio_resample_transform_caps (GstBaseTransform * base,
- GstPadDirection direction, GstCaps * caps)
-{
- const GValue *val;
- GstStructure *s;
- GstCaps *res;
-
- /* transform single caps into input_caps + input_caps with the rate
- * field set to our supported range. This ensures that upstream knows
- * about downstream's prefered rate(s) and can negotiate accordingly. */
- res = gst_caps_copy (caps);
-
- /* first, however, check if the caps contain a range for the rate field, in
- * which case that side isn't going to care much about the exact sample rate
- * chosen and we should just assume things will get fixated to something sane
- * and we may just as well offer our full range instead of the range in the
- * caps. If the rate is not an int range value, it's likely to express a
- * real preference or limitation and we should maintain that structure as
- * preference by putting it first into the transformed caps, and only add
- * our full rate range as second option */
- s = gst_caps_get_structure (res, 0);
- val = gst_structure_get_value (s, "rate");
- if (val == NULL || GST_VALUE_HOLDS_INT_RANGE (val)) {
- /* overwrite existing range, or add field if it doesn't exist yet */
- gst_structure_set (s, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
- } else {
- /* append caps with full range to existing caps with non-range rate field */
- s = gst_structure_copy (s);
- gst_structure_set (s, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
- gst_caps_append_structure (res, s);
- }
-
- return res;
-}
-
-/* Fixate rate to the allowed rate that has the smallest difference */
-static void
-gst_audio_resample_fixate_caps (GstBaseTransform * base,
- GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
-{
- GstStructure *s;
- gint rate;
-
- s = gst_caps_get_structure (caps, 0);
- if (G_UNLIKELY (!gst_structure_get_int (s, "rate", &rate)))
- return;
-
- s = gst_caps_get_structure (othercaps, 0);
- gst_structure_fixate_field_nearest_int (s, "rate", rate);
-}
-
-static const SpeexResampleFuncs *
-gst_audio_resample_get_funcs (gint width, gboolean fp)
-{
- const SpeexResampleFuncs *funcs = NULL;
-
- if (gst_audio_resample_use_int && (width == 8 || width == 16) && !fp)
- funcs = &int_funcs;
- else if ((!gst_audio_resample_use_int && (width == 8 || width == 16) && !fp)
- || (width == 32 && fp))
- funcs = &float_funcs;
- else if ((width == 64 && fp) || ((width == 32 || width == 24) && !fp))
- funcs = &double_funcs;
- else
- g_assert_not_reached ();
-
- return funcs;
-}
-
-static SpeexResamplerState *
-gst_audio_resample_init_state (GstAudioResample * resample, gint width,
- gint channels, gint inrate, gint outrate, gint quality, gboolean fp)
-{
- SpeexResamplerState *ret = NULL;
- gint err = RESAMPLER_ERR_SUCCESS;
- const SpeexResampleFuncs *funcs = gst_audio_resample_get_funcs (width, fp);
-
- ret = funcs->init (channels, inrate, outrate, quality, &err);
-
- if (G_UNLIKELY (err != RESAMPLER_ERR_SUCCESS)) {
- GST_ERROR_OBJECT (resample, "Failed to create resampler state: %s",
- funcs->strerror (err));
- return NULL;
- }
-
- funcs->skip_zeros (ret);
-
- return ret;
-}
-
-static gboolean
-gst_audio_resample_update_state (GstAudioResample * resample, gint width,
- gint channels, gint inrate, gint outrate, gint quality, gboolean fp)
-{
- gboolean ret = TRUE;
- gboolean updated_latency = FALSE;
-
- updated_latency = (resample->inrate != inrate
- || quality != resample->quality) && resample->state != NULL;
-
- if (resample->state == NULL) {
- ret = TRUE;
- } else if (resample->channels != channels || fp != resample->fp
- || width != resample->width) {
- resample->funcs->destroy (resample->state);
- resample->state =
- gst_audio_resample_init_state (resample, width, channels, inrate,
- outrate, quality, fp);
-
- resample->funcs = gst_audio_resample_get_funcs (width, fp);
- ret = (resample->state != NULL);
- } else if (resample->inrate != inrate || resample->outrate != outrate) {
- gint err = RESAMPLER_ERR_SUCCESS;
-
- err = resample->funcs->set_rate (resample->state, inrate, outrate);
-
- if (G_UNLIKELY (err != RESAMPLER_ERR_SUCCESS))
- GST_ERROR_OBJECT (resample, "Failed to update rate: %s",
- resample->funcs->strerror (err));
-
- ret = (err == RESAMPLER_ERR_SUCCESS);
- } else if (quality != resample->quality) {
- gint err = RESAMPLER_ERR_SUCCESS;
-
- err = resample->funcs->set_quality (resample->state, quality);
-
- if (G_UNLIKELY (err != RESAMPLER_ERR_SUCCESS))
- GST_ERROR_OBJECT (resample, "Failed to update quality: %s",
- resample->funcs->strerror (err));
-
- ret = (err == RESAMPLER_ERR_SUCCESS);
- }
-
- resample->width = width;
- resample->channels = channels;
- resample->fp = fp;
- resample->quality = quality;
- resample->inrate = inrate;
- resample->outrate = outrate;
-
- if (updated_latency)
- gst_element_post_message (GST_ELEMENT (resample),
- gst_message_new_latency (GST_OBJECT (resample)));
-
- return ret;
-}
-
-static void
-gst_audio_resample_reset_state (GstAudioResample * resample)
-{
- if (resample->state)
- resample->funcs->reset_mem (resample->state);
-}
-
-static gboolean
-gst_audio_resample_parse_caps (GstCaps * incaps,
- GstCaps * outcaps, gint * width, gint * channels, gint * inrate,
- gint * outrate, gboolean * fp)
-{
- GstStructure *structure;
- gboolean ret;
- gint mywidth, myinrate, myoutrate, mychannels;
- gboolean myfp;
-
- GST_DEBUG ("incaps %" GST_PTR_FORMAT ", outcaps %"
- GST_PTR_FORMAT, incaps, outcaps);
-
- structure = gst_caps_get_structure (incaps, 0);
-
- if (g_str_equal (gst_structure_get_name (structure), "audio/x-raw-float"))
- myfp = TRUE;
- else
- myfp = FALSE;
-
- ret = gst_structure_get_int (structure, "rate", &myinrate);
- ret &= gst_structure_get_int (structure, "channels", &mychannels);
- ret &= gst_structure_get_int (structure, "width", &mywidth);
- if (G_UNLIKELY (!ret))
- goto no_in_rate_channels;
-
- structure = gst_caps_get_structure (outcaps, 0);
- ret = gst_structure_get_int (structure, "rate", &myoutrate);
- if (G_UNLIKELY (!ret))
- goto no_out_rate;
-
- if (channels)
- *channels = mychannels;
- if (inrate)
- *inrate = myinrate;
- if (outrate)
- *outrate = myoutrate;
- if (width)
- *width = mywidth;
- if (fp)
- *fp = myfp;
-
- return TRUE;
-
- /* ERRORS */
-no_in_rate_channels:
- {
- GST_DEBUG ("could not get input rate and channels");
- return FALSE;
- }
-no_out_rate:
- {
- GST_DEBUG ("could not get output rate");
- return FALSE;
- }
-}
-
-static gint
-_gcd (gint a, gint b)
-{
- while (b != 0) {
- int temp = a;
-
- a = b;
- b = temp % b;
- }
-
- return ABS (a);
-}
-
-static gboolean
-gst_audio_resample_transform_size (GstBaseTransform * base,
- GstPadDirection direction, GstCaps * caps, guint size, GstCaps * othercaps,
- guint * othersize)
-{
- gboolean ret = TRUE;
- guint32 ratio_den, ratio_num;
- gint inrate, outrate, gcd;
- gint bytes_per_samp, channels;
-
- GST_LOG_OBJECT (base, "asked to transform size %d in direction %s",
- size, direction == GST_PAD_SINK ? "SINK" : "SRC");
-
- /* Get sample width -> bytes_per_samp, channels, inrate, outrate */
- ret =
- gst_audio_resample_parse_caps (caps, othercaps, &bytes_per_samp,
- &channels, &inrate, &outrate, NULL);
- if (G_UNLIKELY (!ret)) {
- GST_ERROR_OBJECT (base, "Wrong caps");
- return FALSE;
- }
- /* Number of samples in either buffer is size / (width*channels) ->
- * calculate the factor */
- bytes_per_samp = bytes_per_samp * channels / 8;
- /* Convert source buffer size to samples */
- size /= bytes_per_samp;
-
- /* Simplify the conversion ratio factors */
- gcd = _gcd (inrate, outrate);
- ratio_num = inrate / gcd;
- ratio_den = outrate / gcd;
-
- if (direction == GST_PAD_SINK) {
- /* asked to convert size of an incoming buffer. Round up the output size */
- *othersize = gst_util_uint64_scale_int_ceil (size, ratio_den, ratio_num);
- *othersize *= bytes_per_samp;
- } else {
- /* asked to convert size of an outgoing buffer. Round down the input size */
- *othersize = gst_util_uint64_scale_int (size, ratio_num, ratio_den);
- *othersize *= bytes_per_samp;
- }
-
- GST_LOG_OBJECT (base, "transformed size %d to %d", size * bytes_per_samp,
- *othersize);
-
- return ret;
-}
-
-static gboolean
-gst_audio_resample_set_caps (GstBaseTransform * base, GstCaps * incaps,
- GstCaps * outcaps)
-{
- gboolean ret;
- gint width = 0, inrate = 0, outrate = 0, channels = 0;
- gboolean fp;
- GstAudioResample *resample = GST_AUDIO_RESAMPLE (base);
-
- GST_LOG ("incaps %" GST_PTR_FORMAT ", outcaps %"
- GST_PTR_FORMAT, incaps, outcaps);
-
- ret = gst_audio_resample_parse_caps (incaps, outcaps,
- &width, &channels, &inrate, &outrate, &fp);
-
- if (G_UNLIKELY (!ret))
- return FALSE;
-
- ret =
- gst_audio_resample_update_state (resample, width, channels, inrate,
- outrate, resample->quality, fp);
-
- if (G_UNLIKELY (!ret))
- return FALSE;
-
- /* save caps so we can short-circuit in the size_transform if the caps
- * are the same */
- gst_caps_replace (&resample->sinkcaps, incaps);
- gst_caps_replace (&resample->srccaps, outcaps);
-
- return TRUE;
-}
-
-#define GST_MAXINT24 (8388607)
-#define GST_MININT24 (-8388608)
-
-#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
-#define GST_READ_UINT24 GST_READ_UINT24_LE
-#define GST_WRITE_UINT24 GST_WRITE_UINT24_LE
-#else
-#define GST_READ_UINT24 GST_READ_UINT24_BE
-#define GST_WRITE_UINT24 GST_WRITE_UINT24_BE
-#endif
-
-static void
-gst_audio_resample_convert_buffer (GstAudioResample * resample,
- const guint8 * in, guint8 * out, guint len, gboolean inverse)
-{
- len *= resample->channels;
-
- if (inverse) {
- if (gst_audio_resample_use_int && resample->width == 8 && !resample->fp) {
- gint8 *o = (gint8 *) out;
- gint16 *i = (gint16 *) in;
- gint32 tmp;
-
- while (len) {
- tmp = *i + (G_MAXINT8 >> 1);
- *o = CLAMP (tmp >> 8, G_MININT8, G_MAXINT8);
- o++;
- i++;
- len--;
- }
- } else if (!gst_audio_resample_use_int && resample->width == 8
- && !resample->fp) {
- gint8 *o = (gint8 *) out;
- gfloat *i = (gfloat *) in;
- gfloat tmp;
-
- while (len) {
- tmp = *i;
- *o = (gint8) CLAMP (tmp * G_MAXINT8 + 0.5, G_MININT8, G_MAXINT8);
- o++;
- i++;
- len--;
- }
- } else if (!gst_audio_resample_use_int && resample->width == 16
- && !resample->fp) {
- gint16 *o = (gint16 *) out;
- gfloat *i = (gfloat *) in;
- gfloat tmp;
-
- while (len) {
- tmp = *i;
- *o = (gint16) CLAMP (tmp * G_MAXINT16 + 0.5, G_MININT16, G_MAXINT16);
- o++;
- i++;
- len--;
- }
- } else if (resample->width == 24 && !resample->fp) {
- guint8 *o = (guint8 *) out;
- gdouble *i = (gdouble *) in;
- gdouble tmp;
-
- while (len) {
- tmp = *i;
- GST_WRITE_UINT24 (o, (gint32) CLAMP (tmp * GST_MAXINT24 + 0.5,
- GST_MININT24, GST_MAXINT24));
- o += 3;
- i++;
- len--;
- }
- } else if (resample->width == 32 && !resample->fp) {
- gint32 *o = (gint32 *) out;
- gdouble *i = (gdouble *) in;
- gdouble tmp;
-
- while (len) {
- tmp = *i;
- *o = (gint32) CLAMP (tmp * G_MAXINT32 + 0.5, G_MININT32, G_MAXINT32);
- o++;
- i++;
- len--;
- }
- } else {
- g_assert_not_reached ();
- }
- } else {
- if (gst_audio_resample_use_int && resample->width == 8 && !resample->fp) {
- gint8 *i = (gint8 *) in;
- gint16 *o = (gint16 *) out;
- gint32 tmp;
-
- while (len) {
- tmp = *i;
- *o = tmp << 8;
- o++;
- i++;
- len--;
- }
- } else if (!gst_audio_resample_use_int && resample->width == 8
- && !resample->fp) {
- gint8 *i = (gint8 *) in;
- gfloat *o = (gfloat *) out;
- gfloat tmp;
-
- while (len) {
- tmp = *i;
- *o = tmp / G_MAXINT8;
- o++;
- i++;
- len--;
- }
- } else if (!gst_audio_resample_use_int && resample->width == 16
- && !resample->fp) {
- gint16 *i = (gint16 *) in;
- gfloat *o = (gfloat *) out;
- gfloat tmp;
-
- while (len) {
- tmp = *i;
- *o = tmp / G_MAXINT16;
- o++;
- i++;
- len--;
- }
- } else if (resample->width == 24 && !resample->fp) {
- guint8 *i = (guint8 *) in;
- gdouble *o = (gdouble *) out;
- gdouble tmp;
- guint32 tmp2;
-
- while (len) {
- tmp2 = GST_READ_UINT24 (i);
- if (tmp2 & 0x00800000)
- tmp2 |= 0xff000000;
- tmp = (gint32) tmp2;
- *o = tmp / GST_MAXINT24;
- o++;
- i += 3;
- len--;
- }
- } else if (resample->width == 32 && !resample->fp) {
- gint32 *i = (gint32 *) in;
- gdouble *o = (gdouble *) out;
- gdouble tmp;
-
- while (len) {
- tmp = *i;
- *o = tmp / G_MAXINT32;
- o++;
- i++;
- len--;
- }
- } else {
- g_assert_not_reached ();
- }
- }
-}
-
-static guint8 *
-gst_audio_resample_workspace_realloc (guint8 ** workspace, guint * size,
- guint new_size)
-{
- guint8 *new;
- if (new_size <= *size)
- /* no need to resize */
- return *workspace;
- new = g_realloc (*workspace, new_size);
- if (!new)
- /* failure (re)allocating memeory */
- return NULL;
- /* success */
- *workspace = new;
- *size = new_size;
- return *workspace;
-}
-
-static void
-gst_audio_resample_push_drain (GstAudioResample * resample)
-{
- GstBuffer *outbuf;
- GstFlowReturn res;
- gint outsize;
- guint history_len, out_len, out_processed;
- gint err;
- guint num, den;
-
- if (!resample->state)
- return;
-
- /* Don't drain samples if we were reset. */
- if (!GST_CLOCK_TIME_IS_VALID (resample->t0))
- return;
-
- resample->funcs->get_ratio (resample->state, &num, &den);
-
- history_len = resample->funcs->get_input_latency (resample->state);
- out_len = out_processed =
- gst_util_uint64_scale_int_ceil (history_len, den, num);
- outsize = out_len * resample->channels * (resample->width / 8);
-
- res =
- gst_pad_alloc_buffer_and_set_caps (GST_BASE_TRANSFORM_SRC_PAD (resample),
- GST_BUFFER_OFFSET_NONE, outsize,
- GST_PAD_CAPS (GST_BASE_TRANSFORM_SRC_PAD (resample)), &outbuf);
- if (G_UNLIKELY (res != GST_FLOW_OK)) {
- GST_WARNING_OBJECT (resample, "failed allocating buffer of %d bytes",
- outsize);
- return;
- }
-
- if (resample->funcs->width != resample->width) {
- /* need to convert data format; allocate workspace */
- if (!gst_audio_resample_workspace_realloc (&resample->tmp_out,
- &resample->tmp_out_size, (resample->funcs->width / 8) * out_len *
- resample->channels)) {
- GST_ERROR_OBJECT (resample, "failed to allocate workspace");
- return;
- }
-
- /* process */
- err = resample->funcs->process (resample->state, NULL, &history_len,
- resample->tmp_out, &out_processed);
-
- /* convert output format */
- gst_audio_resample_convert_buffer (resample, resample->tmp_out,
- GST_BUFFER_DATA (outbuf), out_processed, TRUE);
- } else {
- /* don't need to convert data format; process */
- err = resample->funcs->process (resample->state, NULL, &history_len,
- GST_BUFFER_DATA (outbuf), &out_processed);
- }
-
- /* If we wrote more than allocated something is really wrong now
- * and we should better abort immediately */
- g_assert (out_len >= out_processed);
-
- if (G_UNLIKELY (err != RESAMPLER_ERR_SUCCESS)) {
- GST_WARNING_OBJECT (resample, "Failed to process drain: %s",
- resample->funcs->strerror (err));
- gst_buffer_unref (outbuf);
- return;
- }
-
- if (G_UNLIKELY (out_processed == 0)) {
- GST_WARNING_OBJECT (resample, "Failed to get drain, dropping buffer");
- gst_buffer_unref (outbuf);
- return;
- }
-
- if (GST_CLOCK_TIME_IS_VALID (resample->t0)) {
- GST_BUFFER_OFFSET (outbuf) = resample->next_out_offset;
- GST_BUFFER_OFFSET_END (outbuf) = GST_BUFFER_OFFSET (outbuf) + out_processed;
- GST_BUFFER_TIMESTAMP (outbuf) = resample->t0 +
- gst_util_uint64_scale_int_round (GST_BUFFER_OFFSET (outbuf) -
- resample->out_offset0, GST_SECOND, resample->outrate);
- GST_BUFFER_DURATION (outbuf) = resample->t0 +
- gst_util_uint64_scale_int_round (GST_BUFFER_OFFSET_END (outbuf) -
- resample->out_offset0, GST_SECOND, resample->outrate) -
- GST_BUFFER_TIMESTAMP (outbuf);
- resample->next_out_offset += out_processed;
- resample->next_in_offset += 0;
- } else {
- GST_BUFFER_OFFSET (outbuf) = GST_BUFFER_OFFSET_NONE;
- GST_BUFFER_OFFSET_END (outbuf) = GST_BUFFER_OFFSET_NONE;
- GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE;
- GST_BUFFER_DURATION (outbuf) = GST_CLOCK_TIME_NONE;
- }
-
- GST_BUFFER_SIZE (outbuf) =
- out_processed * resample->channels * (resample->width / 8);
-
- GST_LOG_OBJECT (resample,
- "Pushing drain buffer of %u bytes with timestamp %" GST_TIME_FORMAT
- " duration %" GST_TIME_FORMAT " offset %" G_GUINT64_FORMAT " offset_end %"
- G_GUINT64_FORMAT, GST_BUFFER_SIZE (outbuf),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
- GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)), GST_BUFFER_OFFSET (outbuf),
- GST_BUFFER_OFFSET_END (outbuf));
-
- res = gst_pad_push (GST_BASE_TRANSFORM_SRC_PAD (resample), outbuf);
-
- if (G_UNLIKELY (res != GST_FLOW_OK))
- GST_WARNING_OBJECT (resample, "Failed to push drain: %s",
- gst_flow_get_name (res));
-
- return;
-}
-
-static gboolean
-gst_audio_resample_event (GstBaseTransform * base, GstEvent * event)
-{
- GstAudioResample *resample = GST_AUDIO_RESAMPLE (base);
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_STOP:
- gst_audio_resample_reset_state (resample);
- resample->t0 = GST_CLOCK_TIME_NONE;
- resample->in_offset0 = GST_BUFFER_OFFSET_NONE;
- resample->out_offset0 = GST_BUFFER_OFFSET_NONE;
- resample->next_in_offset = GST_BUFFER_OFFSET_NONE;
- resample->next_out_offset = GST_BUFFER_OFFSET_NONE;
- resample->need_discont = TRUE;
- break;
- case GST_EVENT_NEWSEGMENT:
- gst_audio_resample_push_drain (resample);
- gst_audio_resample_reset_state (resample);
- resample->t0 = GST_CLOCK_TIME_NONE;
- resample->in_offset0 = GST_BUFFER_OFFSET_NONE;
- resample->out_offset0 = GST_BUFFER_OFFSET_NONE;
- resample->next_in_offset = GST_BUFFER_OFFSET_NONE;
- resample->next_out_offset = GST_BUFFER_OFFSET_NONE;
- resample->need_discont = TRUE;
- break;
- case GST_EVENT_EOS:
- gst_audio_resample_push_drain (resample);
- gst_audio_resample_reset_state (resample);
- break;
- default:
- break;
- }
-
- return parent_class->event (base, event);
-}
-
-static gboolean
-gst_audio_resample_check_discont (GstAudioResample * resample, GstBuffer * buf)
-{
- guint64 offset;
- guint64 delta;
-
- /* is the incoming buffer a discontinuity? */
- if (G_UNLIKELY (GST_BUFFER_IS_DISCONT (buf)))
- return TRUE;
-
- /* no valid timestamps or offsets to compare --> no discontinuity */
- if (G_UNLIKELY (!(GST_BUFFER_TIMESTAMP_IS_VALID (buf) &&
- GST_CLOCK_TIME_IS_VALID (resample->t0) &&
- resample->in_offset0 != GST_BUFFER_OFFSET_NONE &&
- resample->next_in_offset != GST_BUFFER_OFFSET_NONE)))
- return FALSE;
-
- /* convert the inbound timestamp to an offset. */
- offset =
- resample->in_offset0 +
- gst_util_uint64_scale_int_round (GST_BUFFER_TIMESTAMP (buf) -
- resample->t0, resample->inrate, GST_SECOND);
-
- /* many elements generate imperfect streams due to rounding errors, so we
- * permit a small error (up to one sample) without triggering a filter
- * flush/restart (if triggered incorrectly, this will be audible) */
- delta = ABS ((gint64) (offset - resample->next_in_offset));
- if (delta <= 1)
- return FALSE;
-
- GST_WARNING_OBJECT (resample,
- "encountered timestamp discontinuity of %" G_GUINT64_FORMAT " samples = %"
- GST_TIME_FORMAT, delta,
- GST_TIME_ARGS (gst_util_uint64_scale_int_round (delta, GST_SECOND,
- resample->inrate)));
- return TRUE;
-}
-
-static GstFlowReturn
-gst_audio_resample_process (GstAudioResample * resample, GstBuffer * inbuf,
- GstBuffer * outbuf)
-{
- guint32 in_len, in_processed;
- guint32 out_len, out_processed;
- gint err;
-
- in_len = GST_BUFFER_SIZE (inbuf) / resample->channels;
- out_len = GST_BUFFER_SIZE (outbuf) / resample->channels;
-
- in_len /= (resample->width / 8);
- out_len /= (resample->width / 8);
-
- in_processed = in_len;
- out_processed = out_len;
-
- if (resample->funcs->width != resample->width) {
- /* need to convert data format for processing; ensure we have enough
- * workspace available */
- if (!gst_audio_resample_workspace_realloc (&resample->tmp_in,
- &resample->tmp_in_size, in_len * resample->channels *
- (resample->funcs->width / 8)) ||
- !gst_audio_resample_workspace_realloc (&resample->tmp_out,
- &resample->tmp_out_size, out_len * resample->channels *
- (resample->funcs->width / 8))) {
- GST_ERROR_OBJECT (resample, "failed to allocate workspace");
- return GST_FLOW_ERROR;
- }
-
- /* convert input */
- gst_audio_resample_convert_buffer (resample, GST_BUFFER_DATA (inbuf),
- resample->tmp_in, in_len, FALSE);
-
- /* process */
- err = resample->funcs->process (resample->state,
- resample->tmp_in, &in_processed, resample->tmp_out, &out_processed);
-
- /* convert output */
- gst_audio_resample_convert_buffer (resample, resample->tmp_out,
- GST_BUFFER_DATA (outbuf), out_processed, TRUE);
- } else {
- /* no format conversion required; process */
- err = resample->funcs->process (resample->state,
- GST_BUFFER_DATA (inbuf), &in_processed,
- GST_BUFFER_DATA (outbuf), &out_processed);
- }
-
- /* If we wrote more than allocated something is really wrong now and we
- * should better abort immediately */
- g_assert (out_len >= out_processed);
-
- if (G_UNLIKELY (err != RESAMPLER_ERR_SUCCESS)) {
- GST_ERROR_OBJECT (resample, "Failed to convert data: %s",
- resample->funcs->strerror (err));
- return GST_FLOW_ERROR;
- }
-
- if (G_UNLIKELY (in_len != in_processed)) {
- GST_WARNING_OBJECT (resample, "converted %d of %d input samples",
- in_processed, in_len);
- }
-
- if (GST_CLOCK_TIME_IS_VALID (resample->t0)) {
- GST_BUFFER_OFFSET (outbuf) = resample->next_out_offset;
- GST_BUFFER_OFFSET_END (outbuf) = GST_BUFFER_OFFSET (outbuf) + out_processed;
- GST_BUFFER_TIMESTAMP (outbuf) = resample->t0 +
- gst_util_uint64_scale_int_round (GST_BUFFER_OFFSET (outbuf) -
- resample->out_offset0, GST_SECOND, resample->outrate);
- GST_BUFFER_DURATION (outbuf) = resample->t0 +
- gst_util_uint64_scale_int_round (GST_BUFFER_OFFSET_END (outbuf) -
- resample->out_offset0, GST_SECOND, resample->outrate) -
- GST_BUFFER_TIMESTAMP (outbuf);
- resample->next_out_offset += out_processed;
- resample->next_in_offset += in_len;
- } else {
- GST_BUFFER_OFFSET (outbuf) = GST_BUFFER_OFFSET_NONE;
- GST_BUFFER_OFFSET_END (outbuf) = GST_BUFFER_OFFSET_NONE;
- GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE;
- GST_BUFFER_DURATION (outbuf) = GST_CLOCK_TIME_NONE;
- }
-
- GST_BUFFER_SIZE (outbuf) =
- out_processed * resample->channels * (resample->width / 8);
-
- GST_LOG_OBJECT (resample,
- "Converted to buffer of %" G_GUINT32_FORMAT
- " samples (%u bytes) with timestamp %" GST_TIME_FORMAT ", duration %"
- GST_TIME_FORMAT ", offset %" G_GUINT64_FORMAT ", offset_end %"
- G_GUINT64_FORMAT, out_processed, GST_BUFFER_SIZE (outbuf),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
- GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)),
- GST_BUFFER_OFFSET (outbuf), GST_BUFFER_OFFSET_END (outbuf));
-
- if (out_processed == 0) {
- GST_DEBUG_OBJECT (resample, "buffer dropped");
- return GST_BASE_TRANSFORM_FLOW_DROPPED;
- }
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_audio_resample_transform (GstBaseTransform * base, GstBuffer * inbuf,
- GstBuffer * outbuf)
-{
- GstAudioResample *resample = GST_AUDIO_RESAMPLE (base);
- gulong size;
- GstFlowReturn ret;
-
- if (resample->state == NULL) {
- if (G_UNLIKELY (!(resample->state =
- gst_audio_resample_init_state (resample, resample->width,
- resample->channels, resample->inrate, resample->outrate,
- resample->quality, resample->fp))))
- return GST_FLOW_ERROR;
-
- resample->funcs =
- gst_audio_resample_get_funcs (resample->width, resample->fp);
- }
-
- size = GST_BUFFER_SIZE (inbuf);
-
- GST_LOG_OBJECT (resample, "transforming buffer of %ld bytes, ts %"
- GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT ", offset %"
- G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT,
- size, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (inbuf)),
- GST_TIME_ARGS (GST_BUFFER_DURATION (inbuf)),
- GST_BUFFER_OFFSET (inbuf), GST_BUFFER_OFFSET_END (inbuf));
-
- /* check for timestamp discontinuities; flush/reset if needed, and set
- * flag to resync timestamp and offset counters and send event
- * downstream */
- if (G_UNLIKELY (gst_audio_resample_check_discont (resample, inbuf))) {
- gst_audio_resample_reset_state (resample);
- resample->need_discont = TRUE;
- }
-
- /* handle discontinuity */
- if (G_UNLIKELY (resample->need_discont)) {
- /* resync the timestamp and offset counters if possible */
- if (GST_BUFFER_TIMESTAMP_IS_VALID (inbuf) &&
- GST_BUFFER_OFFSET_IS_VALID (inbuf)) {
- resample->t0 = GST_BUFFER_TIMESTAMP (inbuf);
- resample->in_offset0 = GST_BUFFER_OFFSET (inbuf);
- resample->out_offset0 =
- gst_util_uint64_scale_int_round (resample->in_offset0,
- resample->outrate, resample->inrate);
- resample->next_in_offset = resample->in_offset0;
- resample->next_out_offset = resample->out_offset0;
- } else {
- GST_DEBUG_OBJECT (resample, "found discontinuity but timestamp and/or "
- "offset is invalid, cannot sync output timestamp and offset counter");
- resample->t0 = GST_CLOCK_TIME_NONE;
- resample->in_offset0 = GST_BUFFER_OFFSET_NONE;
- resample->out_offset0 = GST_BUFFER_OFFSET_NONE;
- resample->next_in_offset = GST_BUFFER_OFFSET_NONE;
- resample->next_out_offset = GST_BUFFER_OFFSET_NONE;
- }
- /* set DISCONT flag on output buffer */
- GST_DEBUG_OBJECT (resample, "marking this buffer with the DISCONT flag");
- GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
- resample->need_discont = FALSE;
- }
-
- ret = gst_audio_resample_process (resample, inbuf, outbuf);
- if (G_UNLIKELY (ret != GST_FLOW_OK))
- return ret;
-
- GST_DEBUG_OBJECT (resample, "input = samples [%" G_GUINT64_FORMAT ", %"
- G_GUINT64_FORMAT ") = [%" G_GUINT64_FORMAT ", %" G_GUINT64_FORMAT
- ") ns; output = samples [%" G_GUINT64_FORMAT ", %" G_GUINT64_FORMAT
- ") = [%" G_GUINT64_FORMAT ", %" G_GUINT64_FORMAT ") ns",
- GST_BUFFER_OFFSET (inbuf), GST_BUFFER_OFFSET_END (inbuf),
- GST_BUFFER_TIMESTAMP (inbuf), GST_BUFFER_TIMESTAMP (inbuf) +
- GST_BUFFER_DURATION (inbuf), GST_BUFFER_OFFSET (outbuf),
- GST_BUFFER_OFFSET_END (outbuf), GST_BUFFER_TIMESTAMP (outbuf),
- GST_BUFFER_TIMESTAMP (outbuf) + GST_BUFFER_DURATION (outbuf));
-
- return GST_FLOW_OK;
-}
-
-static gboolean
-gst_audio_resample_query (GstPad * pad, GstQuery * query)
-{
- GstAudioResample *resample = GST_AUDIO_RESAMPLE (gst_pad_get_parent (pad));
- GstBaseTransform *trans = GST_BASE_TRANSFORM (resample);
- gboolean res = TRUE;
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_LATENCY:
- {
- GstClockTime min, max;
- gboolean live;
- guint64 latency;
- GstPad *peer;
- gint rate = resample->inrate;
- gint resampler_latency;
-
- if (resample->state)
- resampler_latency =
- resample->funcs->get_input_latency (resample->state);
- else
- resampler_latency = 0;
-
- if (gst_base_transform_is_passthrough (trans))
- resampler_latency = 0;
-
- if ((peer = gst_pad_get_peer (GST_BASE_TRANSFORM_SINK_PAD (trans)))) {
- if ((res = gst_pad_query (peer, query))) {
- gst_query_parse_latency (query, &live, &min, &max);
-
- GST_DEBUG_OBJECT (resample, "Peer latency: min %"
- GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
- GST_TIME_ARGS (min), GST_TIME_ARGS (max));
-
- /* add our own latency */
- if (rate != 0 && resampler_latency != 0)
- latency = gst_util_uint64_scale_round (resampler_latency,
- GST_SECOND, rate);
- else
- latency = 0;
-
- GST_DEBUG_OBJECT (resample, "Our latency: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (latency));
-
- min += latency;
- if (GST_CLOCK_TIME_IS_VALID (max))
- max += latency;
-
- GST_DEBUG_OBJECT (resample, "Calculated total latency : min %"
- GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
- GST_TIME_ARGS (min), GST_TIME_ARGS (max));
-
- gst_query_set_latency (query, live, min, max);
- }
- gst_object_unref (peer);
- }
- break;
- }
- default:
- res = gst_pad_query_default (pad, query);
- break;
- }
- gst_object_unref (resample);
- return res;
-}
-
-static const GstQueryType *
-gst_audio_resample_query_type (GstPad * pad)
-{
- static const GstQueryType types[] = {
- GST_QUERY_LATENCY,
- 0
- };
-
- return types;
-}
-
-static void
-gst_audio_resample_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstAudioResample *resample;
-
- resample = GST_AUDIO_RESAMPLE (object);
-
- switch (prop_id) {
- case PROP_QUALITY:
- GST_BASE_TRANSFORM_LOCK (resample);
- resample->quality = g_value_get_int (value);
- GST_DEBUG_OBJECT (resample, "new quality %d", resample->quality);
-
- gst_audio_resample_update_state (resample, resample->width,
- resample->channels, resample->inrate, resample->outrate,
- resample->quality, resample->fp);
- GST_BASE_TRANSFORM_UNLOCK (resample);
- break;
- case PROP_FILTER_LENGTH:{
- gint filter_length = g_value_get_int (value);
-
- GST_BASE_TRANSFORM_LOCK (resample);
- if (filter_length <= 8)
- resample->quality = 0;
- else if (filter_length <= 16)
- resample->quality = 1;
- else if (filter_length <= 32)
- resample->quality = 2;
- else if (filter_length <= 48)
- resample->quality = 3;
- else if (filter_length <= 64)
- resample->quality = 4;
- else if (filter_length <= 80)
- resample->quality = 5;
- else if (filter_length <= 96)
- resample->quality = 6;
- else if (filter_length <= 128)
- resample->quality = 7;
- else if (filter_length <= 160)
- resample->quality = 8;
- else if (filter_length <= 192)
- resample->quality = 9;
- else
- resample->quality = 10;
-
- GST_DEBUG_OBJECT (resample, "new quality %d", resample->quality);
-
- gst_audio_resample_update_state (resample, resample->width,
- resample->channels, resample->inrate, resample->outrate,
- resample->quality, resample->fp);
- GST_BASE_TRANSFORM_UNLOCK (resample);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_audio_resample_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstAudioResample *resample;
-
- resample = GST_AUDIO_RESAMPLE (object);
-
- switch (prop_id) {
- case PROP_QUALITY:
- g_value_set_int (value, resample->quality);
- break;
- case PROP_FILTER_LENGTH:
- switch (resample->quality) {
- case 0:
- g_value_set_int (value, 8);
- break;
- case 1:
- g_value_set_int (value, 16);
- break;
- case 2:
- g_value_set_int (value, 32);
- break;
- case 3:
- g_value_set_int (value, 48);
- break;
- case 4:
- g_value_set_int (value, 64);
- break;
- case 5:
- g_value_set_int (value, 80);
- break;
- case 6:
- g_value_set_int (value, 96);
- break;
- case 7:
- g_value_set_int (value, 128);
- break;
- case 8:
- g_value_set_int (value, 160);
- break;
- case 9:
- g_value_set_int (value, 192);
- break;
- case 10:
- g_value_set_int (value, 256);
- break;
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-#if defined AUDIORESAMPLE_FORMAT_AUTO
-#define BENCHMARK_SIZE 512
-
-static gboolean
-_benchmark_int_float (SpeexResamplerState * st)
-{
- gint16 in[BENCHMARK_SIZE] = { 0, }, out[BENCHMARK_SIZE / 2];
- gfloat in_tmp[BENCHMARK_SIZE], out_tmp[BENCHMARK_SIZE / 2];
- gint i;
- guint32 inlen = BENCHMARK_SIZE, outlen = BENCHMARK_SIZE / 2;
-
- for (i = 0; i < BENCHMARK_SIZE; i++) {
- gfloat tmp = in[i];
- in_tmp[i] = tmp / G_MAXINT16;
- }
-
- resample_float_resampler_process_interleaved_float (st,
- (const guint8 *) in_tmp, &inlen, (guint8 *) out_tmp, &outlen);
-
- if (outlen == 0) {
- GST_ERROR ("Failed to use float resampler");
- return FALSE;
- }
-
- for (i = 0; i < outlen; i++) {
- gfloat tmp = out_tmp[i];
- out[i] = CLAMP (tmp * G_MAXINT16 + 0.5, G_MININT16, G_MAXINT16);
- }
-
- return TRUE;
-}
-
-static gboolean
-_benchmark_int_int (SpeexResamplerState * st)
-{
- gint16 in[BENCHMARK_SIZE] = { 0, }, out[BENCHMARK_SIZE / 2];
- guint32 inlen = BENCHMARK_SIZE, outlen = BENCHMARK_SIZE / 2;
-
- resample_int_resampler_process_interleaved_int (st, (const guint8 *) in,
- &inlen, (guint8 *) out, &outlen);
-
- if (outlen == 0) {
- GST_ERROR ("Failed to use int resampler");
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-_benchmark_integer_resampling (void)
-{
- OilProfile a, b;
- gdouble av, bv;
- SpeexResamplerState *sta, *stb;
- int i;
-
- oil_profile_init (&a);
- oil_profile_init (&b);
-
- sta = resample_float_resampler_init (1, 48000, 24000, 4, NULL);
- if (sta == NULL) {
- GST_ERROR ("Failed to create float resampler state");
- return FALSE;
- }
-
- stb = resample_int_resampler_init (1, 48000, 24000, 4, NULL);
- if (stb == NULL) {
- resample_float_resampler_destroy (sta);
- GST_ERROR ("Failed to create int resampler state");
- return FALSE;
- }
-
- /* Benchmark */
- for (i = 0; i < 10; i++) {
- oil_profile_start (&a);
- if (!_benchmark_int_float (sta))
- goto error;
- oil_profile_stop (&a);
- }
-
- /* Benchmark */
- for (i = 0; i < 10; i++) {
- oil_profile_start (&b);
- if (!_benchmark_int_int (stb))
- goto error;
- oil_profile_stop (&b);
- }
-
- /* Handle results */
- oil_profile_get_ave_std (&a, &av, NULL);
- oil_profile_get_ave_std (&b, &bv, NULL);
-
- /* Remember benchmark result in global variable */
- gst_audio_resample_use_int = (av > bv);
- resample_float_resampler_destroy (sta);
- resample_int_resampler_destroy (stb);
-
- if (av > bv)
- GST_INFO ("Using integer resampler if appropiate: %lf < %lf", bv, av);
- else
- GST_INFO ("Using float resampler for everything: %lf <= %lf", av, bv);
-
- return TRUE;
-
-error:
- resample_float_resampler_destroy (sta);
- resample_int_resampler_destroy (stb);
-
- return FALSE;
-}
-#endif
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (audio_resample_debug, "audioresample", 0,
- "audio resampling element");
-#if defined AUDIORESAMPLE_FORMAT_AUTO
- oil_init ();
-
- if (!_benchmark_integer_resampling ())
- return FALSE;
-#endif
-
- if (!gst_element_register (plugin, "audioresample", GST_RANK_PRIMARY,
- GST_TYPE_AUDIO_RESAMPLE)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "audioresample",
- "Resamples audio", plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME,
- GST_PACKAGE_ORIGIN);
diff --git a/gst/audioresample/gstaudioresample.h b/gst/audioresample/gstaudioresample.h
deleted file mode 100644
index 2f41b2ce..00000000
--- a/gst/audioresample/gstaudioresample.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) <2007-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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __AUDIO_RESAMPLE_H__
-#define __AUDIO_RESAMPLE_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
-#include <gst/audio/audio.h>
-
-#include "speex_resampler_wrapper.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_AUDIO_RESAMPLE \
- (gst_audio_resample_get_type())
-#define GST_AUDIO_RESAMPLE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_RESAMPLE,GstAudioResample))
-#define GST_AUDIO_RESAMPLE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_RESAMPLE,GstAudioResampleClass))
-#define GST_IS_AUDIO_RESAMPLE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_RESAMPLE))
-#define GST_IS_AUDIO_RESAMPLE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_RESAMPLE))
-
-typedef struct _GstAudioResample GstAudioResample;
-typedef struct _GstAudioResampleClass GstAudioResampleClass;
-
-/**
- * GstAudioResample:
- *
- * Opaque data structure.
- */
-struct _GstAudioResample {
- GstBaseTransform element;
-
- /* <private> */
-
- GstCaps *srccaps, *sinkcaps;
-
- gboolean need_discont;
-
- GstClockTime t0;
- guint64 in_offset0;
- guint64 out_offset0;
- guint64 next_in_offset;
- guint64 next_out_offset;
-
- gint channels;
- gint inrate;
- gint outrate;
- gint quality;
- gint width;
- gboolean fp;
-
- guint8 *tmp_in;
- guint tmp_in_size;
-
- guint8 *tmp_out;
- guint tmp_out_size;
-
- SpeexResamplerState *state;
- const SpeexResampleFuncs *funcs;
-};
-
-struct _GstAudioResampleClass {
- GstBaseTransformClass parent_class;
-};
-
-GType gst_audio_resample_get_type(void);
-
-G_END_DECLS
-
-#endif /* __AUDIO_RESAMPLE_H__ */
diff --git a/gst/audioresample/resample.c b/gst/audioresample/resample.c
deleted file mode 100644
index 2cfd5442..00000000
--- a/gst/audioresample/resample.c
+++ /dev/null
@@ -1,1348 +0,0 @@
-/* Copyright (C) 2007-2008 Jean-Marc Valin
- Copyright (C) 2008 Thorvald Natvig
-
- File: resample.c
- Arbitrary resampling code
-
- 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.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
-*/
-
-/*
- The design goals of this code are:
- - Very fast algorithm
- - SIMD-friendly algorithm
- - Low memory requirement
- - Good *perceptual* quality (and not best SNR)
-
- Warning: This resampler is relatively new. Although I think I got rid of
- all the major bugs and I don't expect the API to change anymore, there
- may be something I've missed. So use with caution.
-
- This algorithm is based on this original resampling algorithm:
- Smith, Julius O. Digital Audio Resampling Home Page
- Center for Computer Research in Music and Acoustics (CCRMA),
- Stanford University, 2007.
- Web published at http://www-ccrma.stanford.edu/~jos/resample/.
-
- There is one main difference, though. This resampler uses cubic
- interpolation instead of linear interpolation in the above paper. This
- makes the table much smaller and makes it possible to compute that table
- on a per-stream basis. In turn, being able to tweak the table for each
- stream makes it possible to both reduce complexity on simple ratios
- (e.g. 2/3), and get rid of the rounding operations in the inner loop.
- The latter both reduces CPU time and makes the algorithm more SIMD-friendly.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef OUTSIDE_SPEEX
-#include <stdlib.h>
-
-#include <glib.h>
-
-#define EXPORT G_GNUC_INTERNAL
-
-static inline void *
-speex_alloc (int size)
-{
- return g_malloc0 (size);
-}
-
-static inline void *
-speex_realloc (void *ptr, int size)
-{
- return g_realloc (ptr, size);
-}
-
-static inline void
-speex_free (void *ptr)
-{
- g_free (ptr);
-}
-
-#include "speex_resampler.h"
-#include "arch.h"
-#else /* OUTSIDE_SPEEX */
-
-#include "../include/speex/speex_resampler.h"
-#include "arch.h"
-#include "os_support.h"
-#endif /* OUTSIDE_SPEEX */
-
-#include <math.h>
-
-#ifndef M_PI
-#define M_PI 3.14159263
-#endif
-
-#ifdef FIXED_POINT
-#define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x)))
-#else
-#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floor(.5+(x))))
-#endif
-
-#define IMAX(a,b) ((a) > (b) ? (a) : (b))
-#define IMIN(a,b) ((a) < (b) ? (a) : (b))
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifdef _USE_SSE
-#include "resample_sse.h"
-#endif
-
-/* Numer of elements to allocate on the stack */
-#ifdef VAR_ARRAYS
-#define FIXED_STACK_ALLOC 8192
-#else
-#define FIXED_STACK_ALLOC 1024
-#endif
-
-typedef int (*resampler_basic_func) (SpeexResamplerState *, spx_uint32_t,
- const spx_word16_t *, spx_uint32_t *, spx_word16_t *, spx_uint32_t *);
-
-struct SpeexResamplerState_
-{
- spx_uint32_t in_rate;
- spx_uint32_t out_rate;
- spx_uint32_t num_rate;
- spx_uint32_t den_rate;
-
- int quality;
- spx_uint32_t nb_channels;
- spx_uint32_t filt_len;
- spx_uint32_t mem_alloc_size;
- spx_uint32_t buffer_size;
- int int_advance;
- int frac_advance;
- float cutoff;
- spx_uint32_t oversample;
- int initialised;
- int started;
-
- /* These are per-channel */
- spx_int32_t *last_sample;
- spx_uint32_t *samp_frac_num;
- spx_uint32_t *magic_samples;
-
- spx_word16_t *mem;
- spx_word16_t *sinc_table;
- spx_uint32_t sinc_table_length;
- resampler_basic_func resampler_ptr;
-
- int in_stride;
- int out_stride;
-};
-
-static double kaiser12_table[68] = {
- 0.99859849, 1.00000000, 0.99859849, 0.99440475, 0.98745105, 0.97779076,
- 0.96549770, 0.95066529, 0.93340547, 0.91384741, 0.89213598, 0.86843014,
- 0.84290116, 0.81573067, 0.78710866, 0.75723148, 0.72629970, 0.69451601,
- 0.66208321, 0.62920216, 0.59606986, 0.56287762, 0.52980938, 0.49704014,
- 0.46473455, 0.43304576, 0.40211431, 0.37206735, 0.34301800, 0.31506490,
- 0.28829195, 0.26276832, 0.23854851, 0.21567274, 0.19416736, 0.17404546,
- 0.15530766, 0.13794294, 0.12192957, 0.10723616, 0.09382272, 0.08164178,
- 0.07063950, 0.06075685, 0.05193064, 0.04409466, 0.03718069, 0.03111947,
- 0.02584161, 0.02127838, 0.01736250, 0.01402878, 0.01121463, 0.00886058,
- 0.00691064, 0.00531256, 0.00401805, 0.00298291, 0.00216702, 0.00153438,
- 0.00105297, 0.00069463, 0.00043489, 0.00025272, 0.00013031, 0.0000527734,
- 0.00001000, 0.00000000
-};
-
-/*
-static double kaiser12_table[36] = {
- 0.99440475, 1.00000000, 0.99440475, 0.97779076, 0.95066529, 0.91384741,
- 0.86843014, 0.81573067, 0.75723148, 0.69451601, 0.62920216, 0.56287762,
- 0.49704014, 0.43304576, 0.37206735, 0.31506490, 0.26276832, 0.21567274,
- 0.17404546, 0.13794294, 0.10723616, 0.08164178, 0.06075685, 0.04409466,
- 0.03111947, 0.02127838, 0.01402878, 0.00886058, 0.00531256, 0.00298291,
- 0.00153438, 0.00069463, 0.00025272, 0.0000527734, 0.00000500, 0.00000000};
-*/
-static double kaiser10_table[36] = {
- 0.99537781, 1.00000000, 0.99537781, 0.98162644, 0.95908712, 0.92831446,
- 0.89005583, 0.84522401, 0.79486424, 0.74011713, 0.68217934, 0.62226347,
- 0.56155915, 0.50119680, 0.44221549, 0.38553619, 0.33194107, 0.28205962,
- 0.23636152, 0.19515633, 0.15859932, 0.12670280, 0.09935205, 0.07632451,
- 0.05731132, 0.04193980, 0.02979584, 0.02044510, 0.01345224, 0.00839739,
- 0.00488951, 0.00257636, 0.00115101, 0.00035515, 0.00000000, 0.00000000
-};
-
-static double kaiser8_table[36] = {
- 0.99635258, 1.00000000, 0.99635258, 0.98548012, 0.96759014, 0.94302200,
- 0.91223751, 0.87580811, 0.83439927, 0.78875245, 0.73966538, 0.68797126,
- 0.63451750, 0.58014482, 0.52566725, 0.47185369, 0.41941150, 0.36897272,
- 0.32108304, 0.27619388, 0.23465776, 0.19672670, 0.16255380, 0.13219758,
- 0.10562887, 0.08273982, 0.06335451, 0.04724088, 0.03412321, 0.02369490,
- 0.01563093, 0.00959968, 0.00527363, 0.00233883, 0.00050000, 0.00000000
-};
-
-static double kaiser6_table[36] = {
- 0.99733006, 1.00000000, 0.99733006, 0.98935595, 0.97618418, 0.95799003,
- 0.93501423, 0.90755855, 0.87598009, 0.84068475, 0.80211977, 0.76076565,
- 0.71712752, 0.67172623, 0.62508937, 0.57774224, 0.53019925, 0.48295561,
- 0.43647969, 0.39120616, 0.34752997, 0.30580127, 0.26632152, 0.22934058,
- 0.19505503, 0.16360756, 0.13508755, 0.10953262, 0.08693120, 0.06722600,
- 0.05031820, 0.03607231, 0.02432151, 0.01487334, 0.00752000, 0.00000000
-};
-
-struct FuncDef
-{
- double *table;
- int oversample;
-};
-
-static struct FuncDef _KAISER12 = { kaiser12_table, 64 };
-
-#define KAISER12 (&_KAISER12)
-/*static struct FuncDef _KAISER12 = {kaiser12_table, 32};
-#define KAISER12 (&_KAISER12)*/
-static struct FuncDef _KAISER10 = { kaiser10_table, 32 };
-
-#define KAISER10 (&_KAISER10)
-static struct FuncDef _KAISER8 = { kaiser8_table, 32 };
-
-#define KAISER8 (&_KAISER8)
-static struct FuncDef _KAISER6 = { kaiser6_table, 32 };
-
-#define KAISER6 (&_KAISER6)
-
-struct QualityMapping
-{
- int base_length;
- int oversample;
- float downsample_bandwidth;
- float upsample_bandwidth;
- struct FuncDef *window_func;
-};
-
-
-/* This table maps conversion quality to internal parameters. There are two
- reasons that explain why the up-sampling bandwidth is larger than the
- down-sampling bandwidth:
- 1) When up-sampling, we can assume that the spectrum is already attenuated
- close to the Nyquist rate (from an A/D or a previous resampling filter)
- 2) Any aliasing that occurs very close to the Nyquist rate will be masked
- by the sinusoids/noise just below the Nyquist rate (guaranteed only for
- up-sampling).
-*/
-static const struct QualityMapping quality_map[11] = {
- {8, 4, 0.830f, 0.860f, KAISER6}, /* Q0 */
- {16, 4, 0.850f, 0.880f, KAISER6}, /* Q1 */
- {32, 4, 0.882f, 0.910f, KAISER6}, /* Q2 *//* 82.3% cutoff ( ~60 dB stop) 6 */
- {48, 8, 0.895f, 0.917f, KAISER8}, /* Q3 *//* 84.9% cutoff ( ~80 dB stop) 8 */
- {64, 8, 0.921f, 0.940f, KAISER8}, /* Q4 *//* 88.7% cutoff ( ~80 dB stop) 8 */
- {80, 16, 0.922f, 0.940f, KAISER10}, /* Q5 *//* 89.1% cutoff (~100 dB stop) 10 */
- {96, 16, 0.940f, 0.945f, KAISER10}, /* Q6 *//* 91.5% cutoff (~100 dB stop) 10 */
- {128, 16, 0.950f, 0.950f, KAISER10}, /* Q7 *//* 93.1% cutoff (~100 dB stop) 10 */
- {160, 16, 0.960f, 0.960f, KAISER10}, /* Q8 *//* 94.5% cutoff (~100 dB stop) 10 */
- {192, 32, 0.968f, 0.968f, KAISER12}, /* Q9 *//* 95.5% cutoff (~100 dB stop) 10 */
- {256, 32, 0.975f, 0.975f, KAISER12}, /* Q10 *//* 96.6% cutoff (~100 dB stop) 10 */
-};
-
-/*8,24,40,56,80,104,128,160,200,256,320*/
-#ifdef DOUBLE_PRECISION
-static double
-compute_func (double x, struct FuncDef *func)
-{
- double y, frac;
-#else
-static double
-compute_func (float x, struct FuncDef *func)
-{
- float y, frac;
-#endif
- double interp[4];
- int ind;
- y = x * func->oversample;
- ind = (int) floor (y);
- frac = (y - ind);
- /* CSE with handle the repeated powers */
- interp[3] = -0.1666666667 * frac + 0.1666666667 * (frac * frac * frac);
- interp[2] = frac + 0.5 * (frac * frac) - 0.5 * (frac * frac * frac);
- /*interp[2] = 1.f - 0.5f*frac - frac*frac + 0.5f*frac*frac*frac; */
- interp[0] =
- -0.3333333333 * frac + 0.5 * (frac * frac) -
- 0.1666666667 * (frac * frac * frac);
- /* Just to make sure we don't have rounding problems */
- interp[1] = 1.f - interp[3] - interp[2] - interp[0];
-
- /*sum = frac*accum[1] + (1-frac)*accum[2]; */
- return interp[0] * func->table[ind] + interp[1] * func->table[ind + 1] +
- interp[2] * func->table[ind + 2] + interp[3] * func->table[ind + 3];
-}
-
-#if 0
-#include <stdio.h>
-int
-main (int argc, char **argv)
-{
- int i;
- for (i = 0; i < 256; i++) {
- printf ("%f\n", compute_func (i / 256., KAISER12));
- }
- return 0;
-}
-#endif
-
-#ifdef FIXED_POINT
-/* The slow way of computing a sinc for the table. Should improve that some day */
-static spx_word16_t
-sinc (float cutoff, float x, int N, struct FuncDef *window_func)
-{
- /*fprintf (stderr, "%f ", x); */
- float xx = x * cutoff;
- if (fabs (x) < 1e-6f)
- return WORD2INT (32768. * cutoff);
- else if (fabs (x) > .5f * N)
- return 0;
- /*FIXME: Can it really be any slower than this? */
- return WORD2INT (32768. * cutoff * sin (M_PI * xx) / (M_PI * xx) *
- compute_func (fabs (2. * x / N), window_func));
-}
-#else
-/* The slow way of computing a sinc for the table. Should improve that some day */
-#ifdef DOUBLE_PRECISION
-static spx_word16_t
-sinc (double cutoff, double x, int N, struct FuncDef *window_func)
-{
- /*fprintf (stderr, "%f ", x); */
- double xx = x * cutoff;
-#else
-static spx_word16_t
-sinc (float cutoff, float x, int N, struct FuncDef *window_func)
-{
- /*fprintf (stderr, "%f ", x); */
- float xx = x * cutoff;
-#endif
- if (fabs (x) < 1e-6)
- return cutoff;
- else if (fabs (x) > .5 * N)
- return 0;
- /*FIXME: Can it really be any slower than this? */
- return cutoff * sin (M_PI * xx) / (M_PI * xx) * compute_func (fabs (2. * x /
- N), window_func);
-}
-#endif
-
-#ifdef FIXED_POINT
-static void
-cubic_coef (spx_word16_t x, spx_word16_t interp[4])
-{
- /* Compute interpolation coefficients. I'm not sure whether this corresponds to cubic interpolation
- but I know it's MMSE-optimal on a sinc */
- spx_word16_t x2, x3;
- x2 = MULT16_16_P15 (x, x);
- x3 = MULT16_16_P15 (x, x2);
- interp[0] =
- PSHR32 (MULT16_16 (QCONST16 (-0.16667f, 15),
- x) + MULT16_16 (QCONST16 (0.16667f, 15), x3), 15);
- interp[1] =
- EXTRACT16 (EXTEND32 (x) + SHR32 (SUB32 (EXTEND32 (x2), EXTEND32 (x3)),
- 1));
- interp[3] =
- PSHR32 (MULT16_16 (QCONST16 (-0.33333f, 15),
- x) + MULT16_16 (QCONST16 (.5f, 15),
- x2) - MULT16_16 (QCONST16 (0.16667f, 15), x3), 15);
- /* Just to make sure we don't have rounding problems */
- interp[2] = Q15_ONE - interp[0] - interp[1] - interp[3];
- if (interp[2] < 32767)
- interp[2] += 1;
-}
-#else
-static void
-cubic_coef (spx_word16_t frac, spx_word16_t interp[4])
-{
- /* Compute interpolation coefficients. I'm not sure whether this corresponds to cubic interpolation
- but I know it's MMSE-optimal on a sinc */
- interp[0] = -0.16667f * frac + 0.16667f * frac * frac * frac;
- interp[1] = frac + 0.5f * frac * frac - 0.5f * frac * frac * frac;
- /*interp[2] = 1.f - 0.5f*frac - frac*frac + 0.5f*frac*frac*frac; */
- interp[3] =
- -0.33333f * frac + 0.5f * frac * frac - 0.16667f * frac * frac * frac;
- /* Just to make sure we don't have rounding problems */
- interp[2] = 1. - interp[0] - interp[1] - interp[3];
-}
-#endif
-
-#ifndef DOUBLE_PRECISION
-static int
-resampler_basic_direct_single (SpeexResamplerState * st,
- spx_uint32_t channel_index, const spx_word16_t * in, spx_uint32_t * in_len,
- spx_word16_t * out, spx_uint32_t * out_len)
-{
- const int N = st->filt_len;
- int out_sample = 0;
- int last_sample = st->last_sample[channel_index];
- spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
- const spx_word16_t *sinc_table = st->sinc_table;
- const int out_stride = st->out_stride;
- const int int_advance = st->int_advance;
- const int frac_advance = st->frac_advance;
- const spx_uint32_t den_rate = st->den_rate;
- spx_word32_t sum;
- int j;
-
- while (!(last_sample >= (spx_int32_t) * in_len
- || out_sample >= (spx_int32_t) * out_len)) {
- const spx_word16_t *sinc = &sinc_table[samp_frac_num * N];
- const spx_word16_t *iptr = &in[last_sample];
-
-#ifndef OVERRIDE_INNER_PRODUCT_SINGLE
- sum = 0;
- for (j = 0; j < N; j++)
- sum += MULT16_16 (sinc[j], iptr[j]);
-
-/* This code is slower on most DSPs which have only 2 accumulators.
- Plus this this forces truncation to 32 bits and you lose the HW guard bits.
- I think we can trust the compiler and let it vectorize and/or unroll itself.
- spx_word32_t accum[4] = {0,0,0,0};
- for(j=0;j<N;j+=4) {
- accum[0] += MULT16_16(sinc[j], iptr[j]);
- accum[1] += MULT16_16(sinc[j+1], iptr[j+1]);
- accum[2] += MULT16_16(sinc[j+2], iptr[j+2]);
- accum[3] += MULT16_16(sinc[j+3], iptr[j+3]);
- }
- sum = accum[0] + accum[1] + accum[2] + accum[3];
-*/
-#else
- sum = inner_product_single (sinc, iptr, N);
-#endif
-
- out[out_stride * out_sample++] = SATURATE32 (PSHR32 (sum, 15), 32767);
- last_sample += int_advance;
- samp_frac_num += frac_advance;
- if (samp_frac_num >= den_rate) {
- samp_frac_num -= den_rate;
- last_sample++;
- }
- }
-
- st->last_sample[channel_index] = last_sample;
- st->samp_frac_num[channel_index] = samp_frac_num;
- return out_sample;
-}
-#endif
-
-#ifdef FIXED_POINT
-#else
-/* This is the same as the previous function, except with a double-precision accumulator */
-static int
-resampler_basic_direct_double (SpeexResamplerState * st,
- spx_uint32_t channel_index, const spx_word16_t * in, spx_uint32_t * in_len,
- spx_word16_t * out, spx_uint32_t * out_len)
-{
- const int N = st->filt_len;
- int out_sample = 0;
- int last_sample = st->last_sample[channel_index];
- spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
- const spx_word16_t *sinc_table = st->sinc_table;
- const int out_stride = st->out_stride;
- const int int_advance = st->int_advance;
- const int frac_advance = st->frac_advance;
- const spx_uint32_t den_rate = st->den_rate;
- double sum;
- int j;
-
- while (!(last_sample >= (spx_int32_t) * in_len
- || out_sample >= (spx_int32_t) * out_len)) {
- const spx_word16_t *sinc = &sinc_table[samp_frac_num * N];
- const spx_word16_t *iptr = &in[last_sample];
-
-#ifndef OVERRIDE_INNER_PRODUCT_DOUBLE
- double accum[4] = { 0, 0, 0, 0 };
-
- for (j = 0; j < N; j += 4) {
- accum[0] += sinc[j] * iptr[j];
- accum[1] += sinc[j + 1] * iptr[j + 1];
- accum[2] += sinc[j + 2] * iptr[j + 2];
- accum[3] += sinc[j + 3] * iptr[j + 3];
- }
- sum = accum[0] + accum[1] + accum[2] + accum[3];
-#else
- sum = inner_product_double (sinc, iptr, N);
-#endif
-
- out[out_stride * out_sample++] = PSHR32 (sum, 15);
- last_sample += int_advance;
- samp_frac_num += frac_advance;
- if (samp_frac_num >= den_rate) {
- samp_frac_num -= den_rate;
- last_sample++;
- }
- }
-
- st->last_sample[channel_index] = last_sample;
- st->samp_frac_num[channel_index] = samp_frac_num;
- return out_sample;
-}
-#endif
-
-#ifndef DOUBLE_PRECISION
-static int
-resampler_basic_interpolate_single (SpeexResamplerState * st,
- spx_uint32_t channel_index, const spx_word16_t * in, spx_uint32_t * in_len,
- spx_word16_t * out, spx_uint32_t * out_len)
-{
- const int N = st->filt_len;
- int out_sample = 0;
- int last_sample = st->last_sample[channel_index];
- spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
- const int out_stride = st->out_stride;
- const int int_advance = st->int_advance;
- const int frac_advance = st->frac_advance;
- const spx_uint32_t den_rate = st->den_rate;
- int j;
- spx_word32_t sum;
-
- while (!(last_sample >= (spx_int32_t) * in_len
- || out_sample >= (spx_int32_t) * out_len)) {
- const spx_word16_t *iptr = &in[last_sample];
-
- const int offset = samp_frac_num * st->oversample / st->den_rate;
-#ifdef FIXED_POINT
- const spx_word16_t frac =
- PDIV32 (SHL32 ((samp_frac_num * st->oversample) % st->den_rate, 15),
- st->den_rate);
-#else
- const spx_word16_t frac =
- ((float) ((samp_frac_num * st->oversample) % st->den_rate)) /
- st->den_rate;
-#endif
- spx_word16_t interp[4];
-
-
-#ifndef OVERRIDE_INTERPOLATE_PRODUCT_SINGLE
- spx_word32_t accum[4] = { 0, 0, 0, 0 };
-
- for (j = 0; j < N; j++) {
- const spx_word16_t curr_in = iptr[j];
- accum[0] +=
- MULT16_16 (curr_in,
- st->sinc_table[4 + (j + 1) * st->oversample - offset - 2]);
- accum[1] +=
- MULT16_16 (curr_in,
- st->sinc_table[4 + (j + 1) * st->oversample - offset - 1]);
- accum[2] +=
- MULT16_16 (curr_in,
- st->sinc_table[4 + (j + 1) * st->oversample - offset]);
- accum[3] +=
- MULT16_16 (curr_in,
- st->sinc_table[4 + (j + 1) * st->oversample - offset + 1]);
- }
-
- cubic_coef (frac, interp);
- sum =
- MULT16_32_Q15 (interp[0], SHR32 (accum[0],
- 1)) + MULT16_32_Q15 (interp[1], SHR32 (accum[1],
- 1)) + MULT16_32_Q15 (interp[2], SHR32 (accum[2],
- 1)) + MULT16_32_Q15 (interp[3], SHR32 (accum[3], 1));
-#else
- cubic_coef (frac, interp);
- sum =
- interpolate_product_single (iptr,
- st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample,
- interp);
-#endif
-
- out[out_stride * out_sample++] = SATURATE32 (PSHR32 (sum, 14), 32767);
- last_sample += int_advance;
- samp_frac_num += frac_advance;
- if (samp_frac_num >= den_rate) {
- samp_frac_num -= den_rate;
- last_sample++;
- }
- }
-
- st->last_sample[channel_index] = last_sample;
- st->samp_frac_num[channel_index] = samp_frac_num;
- return out_sample;
-}
-#endif
-
-#ifdef FIXED_POINT
-#else
-/* This is the same as the previous function, except with a double-precision accumulator */
-static int
-resampler_basic_interpolate_double (SpeexResamplerState * st,
- spx_uint32_t channel_index, const spx_word16_t * in, spx_uint32_t * in_len,
- spx_word16_t * out, spx_uint32_t * out_len)
-{
- const int N = st->filt_len;
- int out_sample = 0;
- int last_sample = st->last_sample[channel_index];
- spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
- const int out_stride = st->out_stride;
- const int int_advance = st->int_advance;
- const int frac_advance = st->frac_advance;
- const spx_uint32_t den_rate = st->den_rate;
- int j;
- spx_word32_t sum;
-
- while (!(last_sample >= (spx_int32_t) * in_len
- || out_sample >= (spx_int32_t) * out_len)) {
- const spx_word16_t *iptr = &in[last_sample];
-
- const int offset = samp_frac_num * st->oversample / st->den_rate;
-#ifdef FIXED_POINT
- const spx_word16_t frac =
- PDIV32 (SHL32 ((samp_frac_num * st->oversample) % st->den_rate, 15),
- st->den_rate);
-#else
-#ifdef DOUBLE_PRECISION
- const spx_word16_t frac =
- ((double) ((samp_frac_num * st->oversample) % st->den_rate)) /
- st->den_rate;
-#else
- const spx_word16_t frac =
- ((float) ((samp_frac_num * st->oversample) % st->den_rate)) /
- st->den_rate;
-#endif
-#endif
- spx_word16_t interp[4];
-
-
-#ifndef OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE
- double accum[4] = { 0, 0, 0, 0 };
-
- for (j = 0; j < N; j++) {
- const double curr_in = iptr[j];
- accum[0] +=
- MULT16_16 (curr_in,
- st->sinc_table[4 + (j + 1) * st->oversample - offset - 2]);
- accum[1] +=
- MULT16_16 (curr_in,
- st->sinc_table[4 + (j + 1) * st->oversample - offset - 1]);
- accum[2] +=
- MULT16_16 (curr_in,
- st->sinc_table[4 + (j + 1) * st->oversample - offset]);
- accum[3] +=
- MULT16_16 (curr_in,
- st->sinc_table[4 + (j + 1) * st->oversample - offset + 1]);
- }
-
- cubic_coef (frac, interp);
- sum =
- MULT16_32_Q15 (interp[0], accum[0]) + MULT16_32_Q15 (interp[1],
- accum[1]) + MULT16_32_Q15 (interp[2],
- accum[2]) + MULT16_32_Q15 (interp[3], accum[3]);
-#else
- cubic_coef (frac, interp);
- sum =
- interpolate_product_double (iptr,
- st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample,
- interp);
-#endif
-
- out[out_stride * out_sample++] = PSHR32 (sum, 15);
- last_sample += int_advance;
- samp_frac_num += frac_advance;
- if (samp_frac_num >= den_rate) {
- samp_frac_num -= den_rate;
- last_sample++;
- }
- }
-
- st->last_sample[channel_index] = last_sample;
- st->samp_frac_num[channel_index] = samp_frac_num;
- return out_sample;
-}
-#endif
-
-static void
-update_filter (SpeexResamplerState * st)
-{
- spx_uint32_t old_length;
-
- old_length = st->filt_len;
- st->oversample = quality_map[st->quality].oversample;
- st->filt_len = quality_map[st->quality].base_length;
-
- if (st->num_rate > st->den_rate) {
- /* down-sampling */
- st->cutoff =
- quality_map[st->quality].downsample_bandwidth * st->den_rate /
- st->num_rate;
- /* FIXME: divide the numerator and denominator by a certain amount if they're too large */
- st->filt_len = st->filt_len * st->num_rate / st->den_rate;
- /* Round down to make sure we have a multiple of 4 */
- st->filt_len &= (~0x3);
- if (2 * st->den_rate < st->num_rate)
- st->oversample >>= 1;
- if (4 * st->den_rate < st->num_rate)
- st->oversample >>= 1;
- if (8 * st->den_rate < st->num_rate)
- st->oversample >>= 1;
- if (16 * st->den_rate < st->num_rate)
- st->oversample >>= 1;
- if (st->oversample < 1)
- st->oversample = 1;
- } else {
- /* up-sampling */
- st->cutoff = quality_map[st->quality].upsample_bandwidth;
- }
-
- /* Choose the resampling type that requires the least amount of memory */
- if (st->den_rate <= st->oversample) {
- spx_uint32_t i;
- if (!st->sinc_table)
- st->sinc_table =
- (spx_word16_t *) speex_alloc (st->filt_len * st->den_rate *
- sizeof (spx_word16_t));
- else if (st->sinc_table_length < st->filt_len * st->den_rate) {
- st->sinc_table =
- (spx_word16_t *) speex_realloc (st->sinc_table,
- st->filt_len * st->den_rate * sizeof (spx_word16_t));
- st->sinc_table_length = st->filt_len * st->den_rate;
- }
- for (i = 0; i < st->den_rate; i++) {
- spx_int32_t j;
- for (j = 0; j < st->filt_len; j++) {
- st->sinc_table[i * st->filt_len + j] =
- sinc (st->cutoff, ((j - (spx_int32_t) st->filt_len / 2 + 1) -
-#ifdef DOUBLE_PRECISION
- ((double) i) / st->den_rate), st->filt_len,
-#else
- ((float) i) / st->den_rate), st->filt_len,
-#endif
- quality_map[st->quality].window_func);
- }
- }
-#ifdef FIXED_POINT
- st->resampler_ptr = resampler_basic_direct_single;
-#else
-#ifdef DOUBLE_PRECISION
- st->resampler_ptr = resampler_basic_direct_double;
-#else
- if (st->quality > 8)
- st->resampler_ptr = resampler_basic_direct_double;
- else
- st->resampler_ptr = resampler_basic_direct_single;
-#endif
-#endif
- /*fprintf (stderr, "resampler uses direct sinc table and normalised cutoff %f\n", cutoff); */
- } else {
- spx_int32_t i;
- if (!st->sinc_table)
- st->sinc_table =
- (spx_word16_t *) speex_alloc ((st->filt_len * st->oversample +
- 8) * sizeof (spx_word16_t));
- else if (st->sinc_table_length < st->filt_len * st->oversample + 8) {
- st->sinc_table =
- (spx_word16_t *) speex_realloc (st->sinc_table,
- (st->filt_len * st->oversample + 8) * sizeof (spx_word16_t));
- st->sinc_table_length = st->filt_len * st->oversample + 8;
- }
- for (i = -4; i < (spx_int32_t) (st->oversample * st->filt_len + 4); i++)
- st->sinc_table[i + 4] =
-#ifdef DOUBLE_PRECISION
- sinc (st->cutoff, (i / (double) st->oversample - st->filt_len / 2),
-#else
- sinc (st->cutoff, (i / (float) st->oversample - st->filt_len / 2),
-#endif
- st->filt_len, quality_map[st->quality].window_func);
-#ifdef FIXED_POINT
- st->resampler_ptr = resampler_basic_interpolate_single;
-#else
-#ifdef DOUBLE_PRECISION
- st->resampler_ptr = resampler_basic_interpolate_double;
-#else
- if (st->quality > 8)
- st->resampler_ptr = resampler_basic_interpolate_double;
- else
- st->resampler_ptr = resampler_basic_interpolate_single;
-#endif
-#endif
- /*fprintf (stderr, "resampler uses interpolated sinc table and normalised cutoff %f\n", cutoff); */
- }
- st->int_advance = st->num_rate / st->den_rate;
- st->frac_advance = st->num_rate % st->den_rate;
-
-
- /* Here's the place where we update the filter memory to take into account
- the change in filter length. It's probably the messiest part of the code
- due to handling of lots of corner cases. */
- if (!st->mem) {
- spx_uint32_t i;
- st->mem_alloc_size = st->filt_len - 1 + st->buffer_size;
- st->mem =
- (spx_word16_t *) speex_alloc (st->nb_channels * st->mem_alloc_size *
- sizeof (spx_word16_t));
- for (i = 0; i < st->nb_channels * st->mem_alloc_size; i++)
- st->mem[i] = 0;
- /*speex_warning("init filter"); */
- } else if (!st->started) {
- spx_uint32_t i;
- st->mem_alloc_size = st->filt_len - 1 + st->buffer_size;
- st->mem =
- (spx_word16_t *) speex_realloc (st->mem,
- st->nb_channels * st->mem_alloc_size * sizeof (spx_word16_t));
- for (i = 0; i < st->nb_channels * st->mem_alloc_size; i++)
- st->mem[i] = 0;
- /*speex_warning("reinit filter"); */
- } else if (st->filt_len > old_length) {
- spx_int32_t i;
- /* Increase the filter length */
- /*speex_warning("increase filter size"); */
- int old_alloc_size = st->mem_alloc_size;
- if ((st->filt_len - 1 + st->buffer_size) > st->mem_alloc_size) {
- st->mem_alloc_size = st->filt_len - 1 + st->buffer_size;
- st->mem =
- (spx_word16_t *) speex_realloc (st->mem,
- st->nb_channels * st->mem_alloc_size * sizeof (spx_word16_t));
- }
- for (i = st->nb_channels - 1; i >= 0; i--) {
- spx_int32_t j;
- spx_uint32_t olen = old_length;
- /*if (st->magic_samples[i]) */
- {
- /* Try and remove the magic samples as if nothing had happened */
-
- /* FIXME: This is wrong but for now we need it to avoid going over the array bounds */
- olen = old_length + 2 * st->magic_samples[i];
- for (j = old_length - 2 + st->magic_samples[i]; j >= 0; j--)
- st->mem[i * st->mem_alloc_size + j + st->magic_samples[i]] =
- st->mem[i * old_alloc_size + j];
- for (j = 0; j < st->magic_samples[i]; j++)
- st->mem[i * st->mem_alloc_size + j] = 0;
- st->magic_samples[i] = 0;
- }
- if (st->filt_len > olen) {
- /* If the new filter length is still bigger than the "augmented" length */
- /* Copy data going backward */
- for (j = 0; j < olen - 1; j++)
- st->mem[i * st->mem_alloc_size + (st->filt_len - 2 - j)] =
- st->mem[i * st->mem_alloc_size + (olen - 2 - j)];
- /* Then put zeros for lack of anything better */
- for (; j < st->filt_len - 1; j++)
- st->mem[i * st->mem_alloc_size + (st->filt_len - 2 - j)] = 0;
- /* Adjust last_sample */
- st->last_sample[i] += (st->filt_len - olen) / 2;
- } else {
- /* Put back some of the magic! */
- st->magic_samples[i] = (olen - st->filt_len) / 2;
- for (j = 0; j < st->filt_len - 1 + st->magic_samples[i]; j++)
- st->mem[i * st->mem_alloc_size + j] =
- st->mem[i * st->mem_alloc_size + j + st->magic_samples[i]];
- }
- }
- } else if (st->filt_len < old_length) {
- spx_uint32_t i;
- /* Reduce filter length, this a bit tricky. We need to store some of the memory as "magic"
- samples so they can be used directly as input the next time(s) */
- for (i = 0; i < st->nb_channels; i++) {
- spx_uint32_t j;
- spx_uint32_t old_magic = st->magic_samples[i];
- st->magic_samples[i] = (old_length - st->filt_len) / 2;
- /* We must copy some of the memory that's no longer used */
- /* Copy data going backward */
- for (j = 0; j < st->filt_len - 1 + st->magic_samples[i] + old_magic; j++)
- st->mem[i * st->mem_alloc_size + j] =
- st->mem[i * st->mem_alloc_size + j + st->magic_samples[i]];
- st->magic_samples[i] += old_magic;
- }
- }
-
-}
-
-EXPORT SpeexResamplerState *
-speex_resampler_init (spx_uint32_t nb_channels, spx_uint32_t in_rate,
- spx_uint32_t out_rate, int quality, int *err)
-{
- return speex_resampler_init_frac (nb_channels, in_rate, out_rate, in_rate,
- out_rate, quality, err);
-}
-
-EXPORT SpeexResamplerState *
-speex_resampler_init_frac (spx_uint32_t nb_channels, spx_uint32_t ratio_num,
- spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate,
- int quality, int *err)
-{
- spx_uint32_t i;
- SpeexResamplerState *st;
- if (quality > 10 || quality < 0) {
- if (err)
- *err = RESAMPLER_ERR_INVALID_ARG;
- return NULL;
- }
- st = (SpeexResamplerState *) speex_alloc (sizeof (SpeexResamplerState));
- st->initialised = 0;
- st->started = 0;
- st->in_rate = 0;
- st->out_rate = 0;
- st->num_rate = 0;
- st->den_rate = 0;
- st->quality = -1;
- st->sinc_table_length = 0;
- st->mem_alloc_size = 0;
- st->filt_len = 0;
- st->mem = 0;
- st->resampler_ptr = 0;
-
- st->cutoff = 1.f;
- st->nb_channels = nb_channels;
- st->in_stride = 1;
- st->out_stride = 1;
-
-#ifdef FIXED_POINT
- st->buffer_size = 160;
-#else
- st->buffer_size = 160;
-#endif
-
- /* Per channel data */
- st->last_sample = (spx_int32_t *) speex_alloc (nb_channels * sizeof (int));
- st->magic_samples = (spx_uint32_t *) speex_alloc (nb_channels * sizeof (int));
- st->samp_frac_num = (spx_uint32_t *) speex_alloc (nb_channels * sizeof (int));
- for (i = 0; i < nb_channels; i++) {
- st->last_sample[i] = 0;
- st->magic_samples[i] = 0;
- st->samp_frac_num[i] = 0;
- }
-
- speex_resampler_set_quality (st, quality);
- speex_resampler_set_rate_frac (st, ratio_num, ratio_den, in_rate, out_rate);
-
-
- update_filter (st);
-
- st->initialised = 1;
- if (err)
- *err = RESAMPLER_ERR_SUCCESS;
-
- return st;
-}
-
-EXPORT void
-speex_resampler_destroy (SpeexResamplerState * st)
-{
- speex_free (st->mem);
- speex_free (st->sinc_table);
- speex_free (st->last_sample);
- speex_free (st->magic_samples);
- speex_free (st->samp_frac_num);
- speex_free (st);
-}
-
-static int
-speex_resampler_process_native (SpeexResamplerState * st,
- spx_uint32_t channel_index, spx_uint32_t * in_len, spx_word16_t * out,
- spx_uint32_t * out_len)
-{
- int j = 0;
- const int N = st->filt_len;
- int out_sample = 0;
- spx_word16_t *mem = st->mem + channel_index * st->mem_alloc_size;
- spx_uint32_t ilen;
-
- st->started = 1;
-
- /* Call the right resampler through the function ptr */
- out_sample = st->resampler_ptr (st, channel_index, mem, in_len, out, out_len);
-
- if (st->last_sample[channel_index] < (spx_int32_t) * in_len)
- *in_len = st->last_sample[channel_index];
- *out_len = out_sample;
- st->last_sample[channel_index] -= *in_len;
-
- ilen = *in_len;
-
- for (j = 0; j < N - 1; ++j)
- mem[j] = mem[j + ilen];
-
- return RESAMPLER_ERR_SUCCESS;
-}
-
-static int
-speex_resampler_magic (SpeexResamplerState * st, spx_uint32_t channel_index,
- spx_word16_t ** out, spx_uint32_t out_len)
-{
- spx_uint32_t tmp_in_len = st->magic_samples[channel_index];
- spx_word16_t *mem = st->mem + channel_index * st->mem_alloc_size;
- const int N = st->filt_len;
-
- speex_resampler_process_native (st, channel_index, &tmp_in_len, *out,
- &out_len);
-
- st->magic_samples[channel_index] -= tmp_in_len;
-
- /* If we couldn't process all "magic" input samples, save the rest for next time */
- if (st->magic_samples[channel_index]) {
- spx_uint32_t i;
- for (i = 0; i < st->magic_samples[channel_index]; i++)
- mem[N - 1 + i] = mem[N - 1 + i + tmp_in_len];
- }
- *out += out_len * st->out_stride;
- return out_len;
-}
-
-#ifdef FIXED_POINT
-EXPORT int
-speex_resampler_process_int (SpeexResamplerState * st,
- spx_uint32_t channel_index, const spx_int16_t * in, spx_uint32_t * in_len,
- spx_int16_t * out, spx_uint32_t * out_len)
-#else
-#ifdef DOUBLE_PRECISION
-EXPORT int
-speex_resampler_process_float (SpeexResamplerState * st,
- spx_uint32_t channel_index, const double *in, spx_uint32_t * in_len,
- double *out, spx_uint32_t * out_len)
-#else
-EXPORT int
-speex_resampler_process_float (SpeexResamplerState * st,
- spx_uint32_t channel_index, const float *in, spx_uint32_t * in_len,
- float *out, spx_uint32_t * out_len)
-#endif
-#endif
-{
- int j;
- spx_uint32_t ilen = *in_len;
- spx_uint32_t olen = *out_len;
- spx_word16_t *x = st->mem + channel_index * st->mem_alloc_size;
- const int filt_offs = st->filt_len - 1;
- const spx_uint32_t xlen = st->mem_alloc_size - filt_offs;
- const int istride = st->in_stride;
-
- if (st->magic_samples[channel_index])
- olen -= speex_resampler_magic (st, channel_index, &out, olen);
- if (!st->magic_samples[channel_index]) {
- while (ilen && olen) {
- spx_uint32_t ichunk = (ilen > xlen) ? xlen : ilen;
- spx_uint32_t ochunk = olen;
-
- if (in) {
- for (j = 0; j < ichunk; ++j)
- x[j + filt_offs] = in[j * istride];
- } else {
- for (j = 0; j < ichunk; ++j)
- x[j + filt_offs] = 0;
- }
- speex_resampler_process_native (st, channel_index, &ichunk, out, &ochunk);
- ilen -= ichunk;
- olen -= ochunk;
- out += ochunk * st->out_stride;
- if (in)
- in += ichunk * istride;
- }
- }
- *in_len -= ilen;
- *out_len -= olen;
- return RESAMPLER_ERR_SUCCESS;
-}
-
-#ifdef FIXED_POINT
-EXPORT int
-speex_resampler_process_float (SpeexResamplerState * st,
- spx_uint32_t channel_index, const float *in, spx_uint32_t * in_len,
- float *out, spx_uint32_t * out_len)
-#else
-EXPORT int
-speex_resampler_process_int (SpeexResamplerState * st,
- spx_uint32_t channel_index, const spx_int16_t * in, spx_uint32_t * in_len,
- spx_int16_t * out, spx_uint32_t * out_len)
-#endif
-{
- int j;
- const int istride_save = st->in_stride;
- const int ostride_save = st->out_stride;
- spx_uint32_t ilen = *in_len;
- spx_uint32_t olen = *out_len;
- spx_word16_t *x = st->mem + channel_index * st->mem_alloc_size;
- const spx_uint32_t xlen = st->mem_alloc_size - (st->filt_len - 1);
-#ifdef VAR_ARRAYS
- const unsigned int ylen =
- (olen < FIXED_STACK_ALLOC) ? olen : FIXED_STACK_ALLOC;
- VARDECL (spx_word16_t * ystack);
- ALLOC (ystack, ylen, spx_word16_t);
-#else
- const unsigned int ylen = FIXED_STACK_ALLOC;
- spx_word16_t ystack[FIXED_STACK_ALLOC];
-#endif
-
- st->out_stride = 1;
-
- while (ilen && olen) {
- spx_word16_t *y = ystack;
- spx_uint32_t ichunk = (ilen > xlen) ? xlen : ilen;
- spx_uint32_t ochunk = (olen > ylen) ? ylen : olen;
- spx_uint32_t omagic = 0;
-
- if (st->magic_samples[channel_index]) {
- omagic = speex_resampler_magic (st, channel_index, &y, ochunk);
- ochunk -= omagic;
- olen -= omagic;
- }
- if (!st->magic_samples[channel_index]) {
- if (in) {
- for (j = 0; j < ichunk; ++j)
-#ifdef FIXED_POINT
- x[j + st->filt_len - 1] = WORD2INT (in[j * istride_save]);
-#else
- x[j + st->filt_len - 1] = in[j * istride_save];
-#endif
- } else {
- for (j = 0; j < ichunk; ++j)
- x[j + st->filt_len - 1] = 0;
- }
-
- speex_resampler_process_native (st, channel_index, &ichunk, y, &ochunk);
- } else {
- ichunk = 0;
- ochunk = 0;
- }
-
- for (j = 0; j < ochunk + omagic; ++j)
-#ifdef FIXED_POINT
- out[j * ostride_save] = ystack[j];
-#else
- out[j * ostride_save] = WORD2INT (ystack[j]);
-#endif
-
- ilen -= ichunk;
- olen -= ochunk;
- out += (ochunk + omagic) * ostride_save;
- if (in)
- in += ichunk * istride_save;
- }
- st->out_stride = ostride_save;
- *in_len -= ilen;
- *out_len -= olen;
-
- return RESAMPLER_ERR_SUCCESS;
-}
-
-#ifdef DOUBLE_PRECISION
-EXPORT int
-speex_resampler_process_interleaved_float (SpeexResamplerState * st,
- const double *in, spx_uint32_t * in_len, double *out,
- spx_uint32_t * out_len)
-#else
-EXPORT int
-speex_resampler_process_interleaved_float (SpeexResamplerState * st,
- const float *in, spx_uint32_t * in_len, float *out, spx_uint32_t * out_len)
-#endif
-{
- spx_uint32_t i;
- int istride_save, ostride_save;
- spx_uint32_t bak_len = *out_len;
- istride_save = st->in_stride;
- ostride_save = st->out_stride;
- st->in_stride = st->out_stride = st->nb_channels;
- for (i = 0; i < st->nb_channels; i++) {
- *out_len = bak_len;
- if (in != NULL)
- speex_resampler_process_float (st, i, in + i, in_len, out + i, out_len);
- else
- speex_resampler_process_float (st, i, NULL, in_len, out + i, out_len);
- }
- st->in_stride = istride_save;
- st->out_stride = ostride_save;
- return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT int
-speex_resampler_process_interleaved_int (SpeexResamplerState * st,
- const spx_int16_t * in, spx_uint32_t * in_len, spx_int16_t * out,
- spx_uint32_t * out_len)
-{
- spx_uint32_t i;
- int istride_save, ostride_save;
- spx_uint32_t bak_len = *out_len;
- istride_save = st->in_stride;
- ostride_save = st->out_stride;
- st->in_stride = st->out_stride = st->nb_channels;
- for (i = 0; i < st->nb_channels; i++) {
- *out_len = bak_len;
- if (in != NULL)
- speex_resampler_process_int (st, i, in + i, in_len, out + i, out_len);
- else
- speex_resampler_process_int (st, i, NULL, in_len, out + i, out_len);
- }
- st->in_stride = istride_save;
- st->out_stride = ostride_save;
- return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT int
-speex_resampler_set_rate (SpeexResamplerState * st, spx_uint32_t in_rate,
- spx_uint32_t out_rate)
-{
- return speex_resampler_set_rate_frac (st, in_rate, out_rate, in_rate,
- out_rate);
-}
-
-EXPORT void
-speex_resampler_get_rate (SpeexResamplerState * st, spx_uint32_t * in_rate,
- spx_uint32_t * out_rate)
-{
- *in_rate = st->in_rate;
- *out_rate = st->out_rate;
-}
-
-EXPORT int
-speex_resampler_set_rate_frac (SpeexResamplerState * st, spx_uint32_t ratio_num,
- spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate)
-{
- spx_uint32_t fact;
- spx_uint32_t old_den;
- spx_uint32_t i;
- if (st->in_rate == in_rate && st->out_rate == out_rate
- && st->num_rate == ratio_num && st->den_rate == ratio_den)
- return RESAMPLER_ERR_SUCCESS;
-
- old_den = st->den_rate;
- st->in_rate = in_rate;
- st->out_rate = out_rate;
- st->num_rate = ratio_num;
- st->den_rate = ratio_den;
- /* FIXME: This is terribly inefficient, but who cares (at least for now)? */
- for (fact = 2; fact <= IMIN (st->num_rate, st->den_rate); fact++) {
- while ((st->num_rate % fact == 0) && (st->den_rate % fact == 0)) {
- st->num_rate /= fact;
- st->den_rate /= fact;
- }
- }
-
- if (old_den > 0) {
- for (i = 0; i < st->nb_channels; i++) {
- st->samp_frac_num[i] = st->samp_frac_num[i] * st->den_rate / old_den;
- /* Safety net */
- if (st->samp_frac_num[i] >= st->den_rate)
- st->samp_frac_num[i] = st->den_rate - 1;
- }
- }
-
- if (st->initialised)
- update_filter (st);
- return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT void
-speex_resampler_get_ratio (SpeexResamplerState * st, spx_uint32_t * ratio_num,
- spx_uint32_t * ratio_den)
-{
- *ratio_num = st->num_rate;
- *ratio_den = st->den_rate;
-}
-
-EXPORT int
-speex_resampler_set_quality (SpeexResamplerState * st, int quality)
-{
- if (quality > 10 || quality < 0)
- return RESAMPLER_ERR_INVALID_ARG;
- if (st->quality == quality)
- return RESAMPLER_ERR_SUCCESS;
- st->quality = quality;
- if (st->initialised)
- update_filter (st);
- return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT void
-speex_resampler_get_quality (SpeexResamplerState * st, int *quality)
-{
- *quality = st->quality;
-}
-
-EXPORT void
-speex_resampler_set_input_stride (SpeexResamplerState * st, spx_uint32_t stride)
-{
- st->in_stride = stride;
-}
-
-EXPORT void
-speex_resampler_get_input_stride (SpeexResamplerState * st,
- spx_uint32_t * stride)
-{
- *stride = st->in_stride;
-}
-
-EXPORT void
-speex_resampler_set_output_stride (SpeexResamplerState * st,
- spx_uint32_t stride)
-{
- st->out_stride = stride;
-}
-
-EXPORT void
-speex_resampler_get_output_stride (SpeexResamplerState * st,
- spx_uint32_t * stride)
-{
- *stride = st->out_stride;
-}
-
-EXPORT int
-speex_resampler_get_input_latency (SpeexResamplerState * st)
-{
- return st->filt_len / 2;
-}
-
-EXPORT int
-speex_resampler_get_output_latency (SpeexResamplerState * st)
-{
- return ((st->filt_len / 2) * st->den_rate +
- (st->num_rate >> 1)) / st->num_rate;
-}
-
-EXPORT int
-speex_resampler_skip_zeros (SpeexResamplerState * st)
-{
- spx_uint32_t i;
- for (i = 0; i < st->nb_channels; i++)
- st->last_sample[i] = st->filt_len / 2;
- return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT int
-speex_resampler_reset_mem (SpeexResamplerState * st)
-{
- spx_uint32_t i;
- for (i = 0; i < st->nb_channels * (st->filt_len - 1); i++)
- st->mem[i] = 0;
- return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT const char *
-speex_resampler_strerror (int err)
-{
- switch (err) {
- case RESAMPLER_ERR_SUCCESS:
- return "Success.";
- case RESAMPLER_ERR_ALLOC_FAILED:
- return "Memory allocation failed.";
- case RESAMPLER_ERR_BAD_STATE:
- return "Bad resampler state.";
- case RESAMPLER_ERR_INVALID_ARG:
- return "Invalid argument.";
- case RESAMPLER_ERR_PTR_OVERLAP:
- return "Input and output buffers overlap.";
- default:
- return "Unknown error. Bad error code or strange version mismatch.";
- }
-}
diff --git a/gst/audioresample/resample_sse.h b/gst/audioresample/resample_sse.h
deleted file mode 100644
index 64be8a16..00000000
--- a/gst/audioresample/resample_sse.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* Copyright (C) 2007-2008 Jean-Marc Valin
- * Copyright (C) 2008 Thorvald Natvig
- */
-/**
- @file resample_sse.h
- @brief Resampler functions (SSE version)
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - 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.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- 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 FOUNDATION 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.
-*/
-
-#include <xmmintrin.h>
-
-#define OVERRIDE_INNER_PRODUCT_SINGLE
-static inline float inner_product_single(const float *a, const float *b, unsigned int len)
-{
- int i;
- float ret;
- __m128 sum = _mm_setzero_ps();
- for (i=0;i<len;i+=8)
- {
- sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+i), _mm_loadu_ps(b+i)));
- sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+i+4), _mm_loadu_ps(b+i+4)));
- }
- sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
- sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
- _mm_store_ss(&ret, sum);
- return ret;
-}
-
-#define OVERRIDE_INTERPOLATE_PRODUCT_SINGLE
-static inline float interpolate_product_single(const float *a, const float *b, unsigned int len, const spx_uint32_t oversample, float *frac) {
- int i;
- float ret;
- __m128 sum = _mm_setzero_ps();
- __m128 f = _mm_loadu_ps(frac);
- for(i=0;i<len;i+=2)
- {
- sum = _mm_add_ps(sum, _mm_mul_ps(_mm_load1_ps(a+i), _mm_loadu_ps(b+i*oversample)));
- sum = _mm_add_ps(sum, _mm_mul_ps(_mm_load1_ps(a+i+1), _mm_loadu_ps(b+(i+1)*oversample)));
- }
- sum = _mm_mul_ps(f, sum);
- sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
- sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
- _mm_store_ss(&ret, sum);
- return ret;
-}
-
-#ifdef _USE_SSE2
-#include <emmintrin.h>
-#define OVERRIDE_INNER_PRODUCT_DOUBLE
-
-static inline double inner_product_double(const float *a, const float *b, unsigned int len)
-{
- int i;
- double ret;
- __m128d sum = _mm_setzero_pd();
- __m128 t;
- for (i=0;i<len;i+=8)
- {
- t = _mm_mul_ps(_mm_loadu_ps(a+i), _mm_loadu_ps(b+i));
- sum = _mm_add_pd(sum, _mm_cvtps_pd(t));
- sum = _mm_add_pd(sum, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
-
- t = _mm_mul_ps(_mm_loadu_ps(a+i+4), _mm_loadu_ps(b+i+4));
- sum = _mm_add_pd(sum, _mm_cvtps_pd(t));
- sum = _mm_add_pd(sum, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
- }
- sum = _mm_add_sd(sum, _mm_unpackhi_pd(sum, sum));
- _mm_store_sd(&ret, sum);
- return ret;
-}
-
-#define OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE
-static inline double interpolate_product_double(const float *a, const float *b, unsigned int len, const spx_uint32_t oversample, float *frac) {
- int i;
- double ret;
- __m128d sum;
- __m128d sum1 = _mm_setzero_pd();
- __m128d sum2 = _mm_setzero_pd();
- __m128 f = _mm_loadu_ps(frac);
- __m128d f1 = _mm_cvtps_pd(f);
- __m128d f2 = _mm_cvtps_pd(_mm_movehl_ps(f,f));
- __m128 t;
- for(i=0;i<len;i+=2)
- {
- t = _mm_mul_ps(_mm_load1_ps(a+i), _mm_loadu_ps(b+i*oversample));
- sum1 = _mm_add_pd(sum1, _mm_cvtps_pd(t));
- sum2 = _mm_add_pd(sum2, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
-
- t = _mm_mul_ps(_mm_load1_ps(a+i+1), _mm_loadu_ps(b+(i+1)*oversample));
- sum1 = _mm_add_pd(sum1, _mm_cvtps_pd(t));
- sum2 = _mm_add_pd(sum2, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
- }
- sum1 = _mm_mul_pd(f1, sum1);
- sum2 = _mm_mul_pd(f2, sum2);
- sum = _mm_add_pd(sum1, sum2);
- sum = _mm_add_sd(sum, _mm_unpackhi_pd(sum, sum));
- _mm_store_sd(&ret, sum);
- return ret;
-}
-
-#endif
diff --git a/gst/audioresample/speex_resampler.h b/gst/audioresample/speex_resampler.h
deleted file mode 100644
index 9dc02806..00000000
--- a/gst/audioresample/speex_resampler.h
+++ /dev/null
@@ -1,361 +0,0 @@
-/* Copyright (C) 2007 Jean-Marc Valin
-
- File: speex_resampler.h
- Resampling code
-
- The design goals of this code are:
- - Very fast algorithm
- - Low memory requirement
- - Good *perceptual* quality (and not best SNR)
-
- 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.
-
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 SPEEX_RESAMPLER_H
-#define SPEEX_RESAMPLER_H
-
-#ifdef OUTSIDE_SPEEX
-
-/********* WARNING: MENTAL SANITY ENDS HERE *************/
-
-/* If the resampler is defined outside of Speex, we change the symbol names so that
- there won't be any clash if linking with Speex later on. */
-
-/* #define RANDOM_PREFIX your software name here */
-#ifndef RANDOM_PREFIX
-#error "Please define RANDOM_PREFIX (above) to something specific to your project to prevent symbol name clashes"
-#endif
-
-#define CAT_PREFIX2(a,b) a ## b
-#define CAT_PREFIX(a,b) CAT_PREFIX2(a, b)
-
-#define speex_resampler_init CAT_PREFIX(RANDOM_PREFIX,_resampler_init)
-#define speex_resampler_init_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_init_frac)
-#define speex_resampler_destroy CAT_PREFIX(RANDOM_PREFIX,_resampler_destroy)
-#define speex_resampler_process_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_float)
-#define speex_resampler_process_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_int)
-#define speex_resampler_process_interleaved_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_float)
-#define speex_resampler_process_interleaved_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_int)
-#define speex_resampler_set_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate)
-#define speex_resampler_get_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_get_rate)
-#define speex_resampler_set_rate_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate_frac)
-#define speex_resampler_get_ratio CAT_PREFIX(RANDOM_PREFIX,_resampler_get_ratio)
-#define speex_resampler_set_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_set_quality)
-#define speex_resampler_get_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_get_quality)
-#define speex_resampler_set_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_input_stride)
-#define speex_resampler_get_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_stride)
-#define speex_resampler_set_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_output_stride)
-#define speex_resampler_get_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_stride)
-#define speex_resampler_get_input_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_latency)
-#define speex_resampler_get_output_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_latency)
-#define speex_resampler_skip_zeros CAT_PREFIX(RANDOM_PREFIX,_resampler_skip_zeros)
-#define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem)
-#define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror)
-
-#define spx_int16_t gint16
-#define spx_int32_t gint32
-#define spx_uint16_t guint16
-#define spx_uint32_t guint32
-
-#else /* OUTSIDE_SPEEX */
-
-#ifdef _BUILD_SPEEX
-# include "speex_types.h"
-#else
-# include <speex/speex_types.h>
-#endif
-
-#endif /* OUTSIDE_SPEEX */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SPEEX_RESAMPLER_QUALITY_MAX 10
-#define SPEEX_RESAMPLER_QUALITY_MIN 0
-#define SPEEX_RESAMPLER_QUALITY_DEFAULT 4
-#define SPEEX_RESAMPLER_QUALITY_VOIP 3
-#define SPEEX_RESAMPLER_QUALITY_DESKTOP 5
-
-enum {
- RESAMPLER_ERR_SUCCESS = 0,
- RESAMPLER_ERR_ALLOC_FAILED = 1,
- RESAMPLER_ERR_BAD_STATE = 2,
- RESAMPLER_ERR_INVALID_ARG = 3,
- RESAMPLER_ERR_PTR_OVERLAP = 4,
-
- RESAMPLER_ERR_MAX_ERROR
-};
-
-struct SpeexResamplerState_;
-typedef struct SpeexResamplerState_ SpeexResamplerState;
-
-/** Create a new resampler with integer input and output rates.
- * @param nb_channels Number of channels to be processed
- * @param in_rate Input sampling rate (integer number of Hz).
- * @param out_rate Output sampling rate (integer number of Hz).
- * @param quality Resampling quality between 0 and 10, where 0 has poor quality
- * and 10 has very high quality.
- * @return Newly created resampler state
- * @retval NULL Error: not enough memory
- */
-SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels,
- spx_uint32_t in_rate,
- spx_uint32_t out_rate,
- int quality,
- int *err);
-
-/** Create a new resampler with fractional input/output rates. The sampling
- * rate ratio is an arbitrary rational number with both the numerator and
- * denominator being 32-bit integers.
- * @param nb_channels Number of channels to be processed
- * @param ratio_num Numerator of the sampling rate ratio
- * @param ratio_den Denominator of the sampling rate ratio
- * @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
- * @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
- * @param quality Resampling quality between 0 and 10, where 0 has poor quality
- * and 10 has very high quality.
- * @return Newly created resampler state
- * @retval NULL Error: not enough memory
- */
-SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels,
- spx_uint32_t ratio_num,
- spx_uint32_t ratio_den,
- spx_uint32_t in_rate,
- spx_uint32_t out_rate,
- int quality,
- int *err);
-
-/** Destroy a resampler state.
- * @param st Resampler state
- */
-void speex_resampler_destroy(SpeexResamplerState *st);
-
-/** Resample a float array. The input and output buffers must *not* overlap.
- * @param st Resampler state
- * @param channel_index Index of the channel to process for the multi-channel
- * base (0 otherwise)
- * @param in Input buffer
- * @param in_len Number of input samples in the input buffer. Returns the
- * number of samples processed
- * @param out Output buffer
- * @param out_len Size of the output buffer. Returns the number of samples written
- */
-#ifdef DOUBLE_PRECISION
-int speex_resampler_process_float(SpeexResamplerState *st,
- spx_uint32_t channel_index,
- const double *in,
- spx_uint32_t *in_len,
- double *out,
- spx_uint32_t *out_len);
-#else
-int speex_resampler_process_float(SpeexResamplerState *st,
- spx_uint32_t channel_index,
- const float *in,
- spx_uint32_t *in_len,
- float *out,
- spx_uint32_t *out_len);
-#endif
-
-/** Resample an int array. The input and output buffers must *not* overlap.
- * @param st Resampler state
- * @param channel_index Index of the channel to process for the multi-channel
- * base (0 otherwise)
- * @param in Input buffer
- * @param in_len Number of input samples in the input buffer. Returns the number
- * of samples processed
- * @param out Output buffer
- * @param out_len Size of the output buffer. Returns the number of samples written
- */
-int speex_resampler_process_int(SpeexResamplerState *st,
- spx_uint32_t channel_index,
- const spx_int16_t *in,
- spx_uint32_t *in_len,
- spx_int16_t *out,
- spx_uint32_t *out_len);
-
-/** Resample an interleaved float array. The input and output buffers must *not* overlap.
- * @param st Resampler state
- * @param in Input buffer
- * @param in_len Number of input samples in the input buffer. Returns the number
- * of samples processed. This is all per-channel.
- * @param out Output buffer
- * @param out_len Size of the output buffer. Returns the number of samples written.
- * This is all per-channel.
- */
-#ifdef DOUBLE_PRECISION
-int speex_resampler_process_interleaved_float(SpeexResamplerState *st,
- const double *in,
- spx_uint32_t *in_len,
- double *out,
- spx_uint32_t *out_len);
-#else
-int speex_resampler_process_interleaved_float(SpeexResamplerState *st,
- const float *in,
- spx_uint32_t *in_len,
- float *out,
- spx_uint32_t *out_len);
-#endif
-
-/** Resample an interleaved int array. The input and output buffers must *not* overlap.
- * @param st Resampler state
- * @param in Input buffer
- * @param in_len Number of input samples in the input buffer. Returns the number
- * of samples processed. This is all per-channel.
- * @param out Output buffer
- * @param out_len Size of the output buffer. Returns the number of samples written.
- * This is all per-channel.
- */
-int speex_resampler_process_interleaved_int(SpeexResamplerState *st,
- const spx_int16_t *in,
- spx_uint32_t *in_len,
- spx_int16_t *out,
- spx_uint32_t *out_len);
-
-/** Set (change) the input/output sampling rates (integer value).
- * @param st Resampler state
- * @param in_rate Input sampling rate (integer number of Hz).
- * @param out_rate Output sampling rate (integer number of Hz).
- */
-int speex_resampler_set_rate(SpeexResamplerState *st,
- spx_uint32_t in_rate,
- spx_uint32_t out_rate);
-
-/** Get the current input/output sampling rates (integer value).
- * @param st Resampler state
- * @param in_rate Input sampling rate (integer number of Hz) copied.
- * @param out_rate Output sampling rate (integer number of Hz) copied.
- */
-void speex_resampler_get_rate(SpeexResamplerState *st,
- spx_uint32_t *in_rate,
- spx_uint32_t *out_rate);
-
-/** Set (change) the input/output sampling rates and resampling ratio
- * (fractional values in Hz supported).
- * @param st Resampler state
- * @param ratio_num Numerator of the sampling rate ratio
- * @param ratio_den Denominator of the sampling rate ratio
- * @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
- * @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
- */
-int speex_resampler_set_rate_frac(SpeexResamplerState *st,
- spx_uint32_t ratio_num,
- spx_uint32_t ratio_den,
- spx_uint32_t in_rate,
- spx_uint32_t out_rate);
-
-/** Get the current resampling ratio. This will be reduced to the least
- * common denominator.
- * @param st Resampler state
- * @param ratio_num Numerator of the sampling rate ratio copied
- * @param ratio_den Denominator of the sampling rate ratio copied
- */
-void speex_resampler_get_ratio(SpeexResamplerState *st,
- spx_uint32_t *ratio_num,
- spx_uint32_t *ratio_den);
-
-/** Set (change) the conversion quality.
- * @param st Resampler state
- * @param quality Resampling quality between 0 and 10, where 0 has poor
- * quality and 10 has very high quality.
- */
-int speex_resampler_set_quality(SpeexResamplerState *st,
- int quality);
-
-/** Get the conversion quality.
- * @param st Resampler state
- * @param quality Resampling quality between 0 and 10, where 0 has poor
- * quality and 10 has very high quality.
- */
-void speex_resampler_get_quality(SpeexResamplerState *st,
- int *quality);
-
-/** Set (change) the input stride.
- * @param st Resampler state
- * @param stride Input stride
- */
-void speex_resampler_set_input_stride(SpeexResamplerState *st,
- spx_uint32_t stride);
-
-/** Get the input stride.
- * @param st Resampler state
- * @param stride Input stride copied
- */
-void speex_resampler_get_input_stride(SpeexResamplerState *st,
- spx_uint32_t *stride);
-
-/** Set (change) the output stride.
- * @param st Resampler state
- * @param stride Output stride
- */
-void speex_resampler_set_output_stride(SpeexResamplerState *st,
- spx_uint32_t stride);
-
-/** Get the output stride.
- * @param st Resampler state copied
- * @param stride Output stride
- */
-void speex_resampler_get_output_stride(SpeexResamplerState *st,
- spx_uint32_t *stride);
-
-/** Get the latency introduced by the resampler measured in input samples.
- * @param st Resampler state
- */
-int speex_resampler_get_input_latency(SpeexResamplerState *st);
-
-/** Get the latency introduced by the resampler measured in output samples.
- * @param st Resampler state
- */
-int speex_resampler_get_output_latency(SpeexResamplerState *st);
-
-/** Make sure that the first samples to go out of the resamplers don't have
- * leading zeros. This is only useful before starting to use a newly created
- * resampler. It is recommended to use that when resampling an audio file, as
- * it will generate a file with the same length. For real-time processing,
- * it is probably easier not to use this call (so that the output duration
- * is the same for the first frame).
- * @param st Resampler state
- */
-int speex_resampler_skip_zeros(SpeexResamplerState *st);
-
-/** Reset a resampler so a new (unrelated) stream can be processed.
- * @param st Resampler state
- */
-int speex_resampler_reset_mem(SpeexResamplerState *st);
-
-/** Returns the English meaning for an error code
- * @param err Error code
- * @return English string
- */
-const char *speex_resampler_strerror(int err);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/gst/audioresample/speex_resampler_double.c b/gst/audioresample/speex_resampler_double.c
deleted file mode 100644
index e5a25714..00000000
--- a/gst/audioresample/speex_resampler_double.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* GStreamer
- * Copyright (C) 2007-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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#define FLOATING_POINT
-#define DOUBLE_PRECISION
-#define OUTSIDE_SPEEX
-#define RANDOM_PREFIX resample_double
-
-#include "resample.c"
diff --git a/gst/audioresample/speex_resampler_float.c b/gst/audioresample/speex_resampler_float.c
deleted file mode 100644
index f13f60c5..00000000
--- a/gst/audioresample/speex_resampler_float.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* GStreamer
- * Copyright (C) 2007-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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#define FLOATING_POINT
-#define OUTSIDE_SPEEX
-#define RANDOM_PREFIX resample_float
-
-#include "resample.c"
diff --git a/gst/audioresample/speex_resampler_int.c b/gst/audioresample/speex_resampler_int.c
deleted file mode 100644
index 6b858604..00000000
--- a/gst/audioresample/speex_resampler_int.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* GStreamer
- * Copyright (C) 2007-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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#define FIXED_POINT 1
-#define OUTSIDE_SPEEX 1
-#define RANDOM_PREFIX resample_int
-
-#include "resample.c"
diff --git a/gst/audioresample/speex_resampler_wrapper.h b/gst/audioresample/speex_resampler_wrapper.h
deleted file mode 100644
index 36d444f8..00000000
--- a/gst/audioresample/speex_resampler_wrapper.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/* GStreamer
- * Copyright (C) 2007-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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __SPEEX_RESAMPLER_WRAPPER_H__
-#define __SPEEX_RESAMPLER_WRAPPER_H__
-
-#define SPEEX_RESAMPLER_QUALITY_MAX 10
-#define SPEEX_RESAMPLER_QUALITY_MIN 0
-#define SPEEX_RESAMPLER_QUALITY_DEFAULT 4
-#define SPEEX_RESAMPLER_QUALITY_VOIP 3
-#define SPEEX_RESAMPLER_QUALITY_DESKTOP 5
-
-enum
-{
- RESAMPLER_ERR_SUCCESS = 0,
- RESAMPLER_ERR_ALLOC_FAILED = 1,
- RESAMPLER_ERR_BAD_STATE = 2,
- RESAMPLER_ERR_INVALID_ARG = 3,
- RESAMPLER_ERR_PTR_OVERLAP = 4,
-
- RESAMPLER_ERR_MAX_ERROR
-};
-
-typedef struct SpeexResamplerState_ SpeexResamplerState;
-
-typedef struct {
- SpeexResamplerState *(*init) (guint32 nb_channels,
- guint32 in_rate, guint32 out_rate, gint quality, gint * err);
- void (*destroy) (SpeexResamplerState * st);
- int (*process) (SpeexResamplerState *
- st, const guint8 * in, guint32 * in_len, guint8 * out, guint32 * out_len);
- int (*set_rate) (SpeexResamplerState * st,
- guint32 in_rate, guint32 out_rate);
- void (*get_rate) (SpeexResamplerState * st,
- guint32 * in_rate, guint32 * out_rate);
- void (*get_ratio) (SpeexResamplerState * st,
- guint32 * ratio_num, guint32 * ratio_den);
- int (*get_input_latency) (SpeexResamplerState * st);
- int (*set_quality) (SpeexResamplerState * st, gint quality);
- int (*reset_mem) (SpeexResamplerState * st);
- int (*skip_zeros) (SpeexResamplerState * st);
- const char * (*strerror) (gint err);
- unsigned int width;
-} SpeexResampleFuncs;
-
-SpeexResamplerState *resample_float_resampler_init (guint32 nb_channels,
- guint32 in_rate, guint32 out_rate, gint quality, gint * err);
-void resample_float_resampler_destroy (SpeexResamplerState * st);
-int resample_float_resampler_process_interleaved_float (SpeexResamplerState *
- st, const guint8 * in, guint32 * in_len, guint8 * out, guint32 * out_len);
-int resample_float_resampler_set_rate (SpeexResamplerState * st,
- guint32 in_rate, guint32 out_rate);
-void resample_float_resampler_get_rate (SpeexResamplerState * st,
- guint32 * in_rate, guint32 * out_rate);
-void resample_float_resampler_get_ratio (SpeexResamplerState * st,
- guint32 * ratio_num, guint32 * ratio_den);
-int resample_float_resampler_get_input_latency (SpeexResamplerState * st);
-int resample_float_resampler_set_quality (SpeexResamplerState * st, gint quality);
-int resample_float_resampler_reset_mem (SpeexResamplerState * st);
-int resample_float_resampler_skip_zeros (SpeexResamplerState * st);
-const char * resample_float_resampler_strerror (gint err);
-
-static const SpeexResampleFuncs float_funcs =
-{
- resample_float_resampler_init,
- resample_float_resampler_destroy,
- resample_float_resampler_process_interleaved_float,
- resample_float_resampler_set_rate,
- resample_float_resampler_get_rate,
- resample_float_resampler_get_ratio,
- resample_float_resampler_get_input_latency,
- resample_float_resampler_set_quality,
- resample_float_resampler_reset_mem,
- resample_float_resampler_skip_zeros,
- resample_float_resampler_strerror,
- 32
-};
-
-SpeexResamplerState *resample_double_resampler_init (guint32 nb_channels,
- guint32 in_rate, guint32 out_rate, gint quality, gint * err);
-void resample_double_resampler_destroy (SpeexResamplerState * st);
-int resample_double_resampler_process_interleaved_float (SpeexResamplerState *
- st, const guint8 * in, guint32 * in_len, guint8 * out, guint32 * out_len);
-int resample_double_resampler_set_rate (SpeexResamplerState * st,
- guint32 in_rate, guint32 out_rate);
-void resample_double_resampler_get_rate (SpeexResamplerState * st,
- guint32 * in_rate, guint32 * out_rate);
-void resample_double_resampler_get_ratio (SpeexResamplerState * st,
- guint32 * ratio_num, guint32 * ratio_den);
-int resample_double_resampler_get_input_latency (SpeexResamplerState * st);
-int resample_double_resampler_set_quality (SpeexResamplerState * st, gint quality);
-int resample_double_resampler_reset_mem (SpeexResamplerState * st);
-int resample_double_resampler_skip_zeros (SpeexResamplerState * st);
-const char * resample_double_resampler_strerror (gint err);
-
-static const SpeexResampleFuncs double_funcs =
-{
- resample_double_resampler_init,
- resample_double_resampler_destroy,
- resample_double_resampler_process_interleaved_float,
- resample_double_resampler_set_rate,
- resample_double_resampler_get_rate,
- resample_double_resampler_get_ratio,
- resample_double_resampler_get_input_latency,
- resample_double_resampler_set_quality,
- resample_double_resampler_reset_mem,
- resample_double_resampler_skip_zeros,
- resample_double_resampler_strerror,
- 64
-};
-
-SpeexResamplerState *resample_int_resampler_init (guint32 nb_channels,
- guint32 in_rate, guint32 out_rate, gint quality, gint * err);
-void resample_int_resampler_destroy (SpeexResamplerState * st);
-int resample_int_resampler_process_interleaved_int (SpeexResamplerState *
- st, const guint8 * in, guint32 * in_len, guint8 * out, guint32 * out_len);
-int resample_int_resampler_set_rate (SpeexResamplerState * st,
- guint32 in_rate, guint32 out_rate);
-void resample_int_resampler_get_rate (SpeexResamplerState * st,
- guint32 * in_rate, guint32 * out_rate);
-void resample_int_resampler_get_ratio (SpeexResamplerState * st,
- guint32 * ratio_num, guint32 * ratio_den);
-int resample_int_resampler_get_input_latency (SpeexResamplerState * st);
-int resample_int_resampler_set_quality (SpeexResamplerState * st, gint quality);
-int resample_int_resampler_reset_mem (SpeexResamplerState * st);
-int resample_int_resampler_skip_zeros (SpeexResamplerState * st);
-const char * resample_int_resampler_strerror (gint err);
-
-static const SpeexResampleFuncs int_funcs =
-{
- resample_int_resampler_init,
- resample_int_resampler_destroy,
- resample_int_resampler_process_interleaved_int,
- resample_int_resampler_set_rate,
- resample_int_resampler_get_rate,
- resample_int_resampler_get_ratio,
- resample_int_resampler_get_input_latency,
- resample_int_resampler_set_quality,
- resample_int_resampler_reset_mem,
- resample_int_resampler_skip_zeros,
- resample_int_resampler_strerror,
- 16
-};
-
-#endif /* __SPEEX_RESAMPLER_WRAPPER_H__ */
diff --git a/gst/audiotestsrc/Makefile.am b/gst/audiotestsrc/Makefile.am
deleted file mode 100644
index af7564de..00000000
--- a/gst/audiotestsrc/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-plugin_LTLIBRARIES = libgstaudiotestsrc.la
-
-libgstaudiotestsrc_la_SOURCES = gstaudiotestsrc.c
-libgstaudiotestsrc_la_CFLAGS = $(GST_CFLAGS) $(GST_CONTROLLER_CFLAGS)
-libgstaudiotestsrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstaudiotestsrc_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(GST_CONTROLLER_LIBS) $(LIBM)
-libgstaudiotestsrc_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = gstaudiotestsrc.h
diff --git a/gst/audiotestsrc/gstaudiotestsrc.c b/gst/audiotestsrc/gstaudiotestsrc.c
deleted file mode 100644
index 2abd41a2..00000000
--- a/gst/audiotestsrc/gstaudiotestsrc.c
+++ /dev/null
@@ -1,1192 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005 Stefan Kost <ensonic@users.sf.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-/**
- * SECTION:element-audiotestsrc
- *
- * AudioTestSrc can be used to generate basic audio signals. It support several
- * different waveforms and allows to set the base frequency and volume.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch audiotestsrc ! audioconvert ! alsasink
- * ]| This pipeline produces a sine with default frequency, 440 Hz, and the
- * default volume, 0.8 (relative to a maximum 1.0).
- * |[
- * gst-launch audiotestsrc wave=2 freq=200 ! audioconvert ! tee name=t ! queue ! alsasink t. ! queue ! libvisual_lv_scope ! ffmpegcolorspace ! xvimagesink
- * ]| In this example a saw wave is generated. The wave is shown using a
- * scope visualizer from libvisual, allowing you to visually verify that
- * the saw wave is correct.
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gst/controller/gstcontroller.h>
-
-#include "gstaudiotestsrc.h"
-
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#ifndef M_PI_2
-#define M_PI_2 1.57079632679489661923
-#endif
-
-#define M_PI_M2 ( M_PI + M_PI )
-
-GST_DEBUG_CATEGORY_STATIC (audio_test_src_debug);
-#define GST_CAT_DEFAULT audio_test_src_debug
-
-static const GstElementDetails gst_audio_test_src_details =
-GST_ELEMENT_DETAILS ("Audio test source",
- "Source/Audio",
- "Creates audio test signals of given frequency and volume",
- "Stefan Kost <ensonic@users.sf.net>");
-
-#define DEFAULT_SAMPLES_PER_BUFFER 1024
-#define DEFAULT_WAVE GST_AUDIO_TEST_SRC_WAVE_SINE
-#define DEFAULT_FREQ 440.0
-#define DEFAULT_VOLUME 0.8
-#define DEFAULT_IS_LIVE FALSE
-#define DEFAULT_TIMESTAMP_OFFSET G_GINT64_CONSTANT (0)
-#define DEFAULT_CAN_ACTIVATE_PUSH TRUE
-#define DEFAULT_CAN_ACTIVATE_PULL FALSE
-
-enum
-{
- PROP_0,
- PROP_SAMPLES_PER_BUFFER,
- PROP_WAVE,
- PROP_FREQ,
- PROP_VOLUME,
- PROP_IS_LIVE,
- PROP_TIMESTAMP_OFFSET,
- PROP_CAN_ACTIVATE_PUSH,
- PROP_CAN_ACTIVATE_PULL,
- PROP_LAST
-};
-
-
-static GstStaticPadTemplate gst_audio_test_src_src_template =
- GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) true, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) [ 1, MAX ], "
- "channels = (int) [ 1, 2 ]; "
- "audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) true, "
- "width = (int) 32, "
- "depth = (int) 32,"
- "rate = (int) [ 1, MAX ], "
- "channels = (int) [ 1, 2 ]; "
- "audio/x-raw-float, "
- "endianness = (int) BYTE_ORDER, "
- "width = (int) { 32, 64 }, "
- "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]")
- );
-
-
-GST_BOILERPLATE (GstAudioTestSrc, gst_audio_test_src, GstBaseSrc,
- GST_TYPE_BASE_SRC);
-
-#define GST_TYPE_AUDIO_TEST_SRC_WAVE (gst_audiostestsrc_wave_get_type())
-static GType
-gst_audiostestsrc_wave_get_type (void)
-{
- static GType audiostestsrc_wave_type = 0;
- static const GEnumValue audiostestsrc_waves[] = {
- {GST_AUDIO_TEST_SRC_WAVE_SINE, "Sine", "sine"},
- {GST_AUDIO_TEST_SRC_WAVE_SQUARE, "Square", "square"},
- {GST_AUDIO_TEST_SRC_WAVE_SAW, "Saw", "saw"},
- {GST_AUDIO_TEST_SRC_WAVE_TRIANGLE, "Triangle", "triangle"},
- {GST_AUDIO_TEST_SRC_WAVE_SILENCE, "Silence", "silence"},
- {GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE, "White uniform noise", "white-noise"},
- {GST_AUDIO_TEST_SRC_WAVE_PINK_NOISE, "Pink noise", "pink-noise"},
- {GST_AUDIO_TEST_SRC_WAVE_SINE_TAB, "Sine table", "sine-table"},
- {GST_AUDIO_TEST_SRC_WAVE_TICKS, "Periodic Ticks", "ticks"},
- {GST_AUDIO_TEST_SRC_WAVE_GAUSSIAN_WHITE_NOISE, "White Gaussian noise",
- "gaussian-noise"},
- {0, NULL, NULL},
- };
-
- if (G_UNLIKELY (audiostestsrc_wave_type == 0)) {
- audiostestsrc_wave_type = g_enum_register_static ("GstAudioTestSrcWave",
- audiostestsrc_waves);
- }
- return audiostestsrc_wave_type;
-}
-
-static void gst_audio_test_src_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_audio_test_src_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static gboolean gst_audio_test_src_setcaps (GstBaseSrc * basesrc,
- GstCaps * caps);
-static void gst_audio_test_src_src_fixate (GstPad * pad, GstCaps * caps);
-
-static gboolean gst_audio_test_src_is_seekable (GstBaseSrc * basesrc);
-static gboolean gst_audio_test_src_check_get_range (GstBaseSrc * basesrc);
-static gboolean gst_audio_test_src_do_seek (GstBaseSrc * basesrc,
- GstSegment * segment);
-static gboolean gst_audio_test_src_query (GstBaseSrc * basesrc,
- GstQuery * query);
-
-static void gst_audio_test_src_change_wave (GstAudioTestSrc * src);
-
-static void gst_audio_test_src_get_times (GstBaseSrc * basesrc,
- GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
-static gboolean gst_audio_test_src_start (GstBaseSrc * basesrc);
-static gboolean gst_audio_test_src_stop (GstBaseSrc * basesrc);
-static GstFlowReturn gst_audio_test_src_create (GstBaseSrc * basesrc,
- guint64 offset, guint length, GstBuffer ** buffer);
-
-
-static void
-gst_audio_test_src_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_audio_test_src_src_template));
- gst_element_class_set_details (element_class, &gst_audio_test_src_details);
-}
-
-static void
-gst_audio_test_src_class_init (GstAudioTestSrcClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseSrcClass *gstbasesrc_class;
-
- gobject_class = (GObjectClass *) klass;
- gstbasesrc_class = (GstBaseSrcClass *) klass;
-
- gobject_class->set_property = gst_audio_test_src_set_property;
- gobject_class->get_property = gst_audio_test_src_get_property;
-
- g_object_class_install_property (gobject_class, PROP_SAMPLES_PER_BUFFER,
- g_param_spec_int ("samplesperbuffer", "Samples per buffer",
- "Number of samples in each outgoing buffer",
- 1, G_MAXINT, DEFAULT_SAMPLES_PER_BUFFER,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_WAVE,
- g_param_spec_enum ("wave", "Waveform", "Oscillator waveform",
- GST_TYPE_AUDIO_TEST_SRC_WAVE, GST_AUDIO_TEST_SRC_WAVE_SINE,
- G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_FREQ,
- g_param_spec_double ("freq", "Frequency", "Frequency of test signal",
- 0.0, 20000.0, DEFAULT_FREQ,
- G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_VOLUME,
- g_param_spec_double ("volume", "Volume", "Volume of test signal", 0.0,
- 1.0, DEFAULT_VOLUME,
- G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_IS_LIVE,
- g_param_spec_boolean ("is-live", "Is Live",
- "Whether to act as a live source", DEFAULT_IS_LIVE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass),
- PROP_TIMESTAMP_OFFSET, g_param_spec_int64 ("timestamp-offset",
- "Timestamp offset",
- "An offset added to timestamps set on buffers (in ns)", G_MININT64,
- G_MAXINT64, DEFAULT_TIMESTAMP_OFFSET,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_CAN_ACTIVATE_PUSH,
- g_param_spec_boolean ("can-activate-push", "Can activate push",
- "Can activate in push mode", DEFAULT_CAN_ACTIVATE_PUSH,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_CAN_ACTIVATE_PULL,
- g_param_spec_boolean ("can-activate-pull", "Can activate pull",
- "Can activate in pull mode", DEFAULT_CAN_ACTIVATE_PULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstbasesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_audio_test_src_setcaps);
- gstbasesrc_class->is_seekable =
- GST_DEBUG_FUNCPTR (gst_audio_test_src_is_seekable);
- gstbasesrc_class->check_get_range =
- GST_DEBUG_FUNCPTR (gst_audio_test_src_check_get_range);
- gstbasesrc_class->do_seek = GST_DEBUG_FUNCPTR (gst_audio_test_src_do_seek);
- gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_audio_test_src_query);
- gstbasesrc_class->get_times =
- GST_DEBUG_FUNCPTR (gst_audio_test_src_get_times);
- gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_audio_test_src_start);
- gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_audio_test_src_stop);
- gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_audio_test_src_create);
-}
-
-static void
-gst_audio_test_src_init (GstAudioTestSrc * src, GstAudioTestSrcClass * g_class)
-{
- GstPad *pad = GST_BASE_SRC_PAD (src);
-
- gst_pad_set_fixatecaps_function (pad, gst_audio_test_src_src_fixate);
-
- src->samplerate = 44100;
- src->format = GST_AUDIO_TEST_SRC_FORMAT_NONE;
-
- src->volume = DEFAULT_VOLUME;
- src->freq = DEFAULT_FREQ;
-
- /* we operate in time */
- gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
- gst_base_src_set_live (GST_BASE_SRC (src), DEFAULT_IS_LIVE);
-
- src->samples_per_buffer = DEFAULT_SAMPLES_PER_BUFFER;
- src->generate_samples_per_buffer = src->samples_per_buffer;
- src->timestamp_offset = DEFAULT_TIMESTAMP_OFFSET;
- src->can_activate_pull = DEFAULT_CAN_ACTIVATE_PULL;
-
- src->wave = DEFAULT_WAVE;
- gst_base_src_set_blocksize (GST_BASE_SRC (src), -1);
-}
-
-static void
-gst_audio_test_src_src_fixate (GstPad * pad, GstCaps * caps)
-{
- GstAudioTestSrc *src = GST_AUDIO_TEST_SRC (GST_PAD_PARENT (pad));
- const gchar *name;
- GstStructure *structure;
-
- structure = gst_caps_get_structure (caps, 0);
-
- GST_DEBUG_OBJECT (src, "fixating samplerate to %d", src->samplerate);
-
- gst_structure_fixate_field_nearest_int (structure, "rate", src->samplerate);
-
- name = gst_structure_get_name (structure);
- if (strcmp (name, "audio/x-raw-int") == 0)
- gst_structure_fixate_field_nearest_int (structure, "width", 32);
- else if (strcmp (name, "audio/x-raw-float") == 0)
- gst_structure_fixate_field_nearest_int (structure, "width", 64);
-
- /* fixate to mono unless downstream requires stereo, for backwards compat */
- gst_structure_fixate_field_nearest_int (structure, "channels", 1);
-}
-
-static gboolean
-gst_audio_test_src_setcaps (GstBaseSrc * basesrc, GstCaps * caps)
-{
- GstAudioTestSrc *src = GST_AUDIO_TEST_SRC (basesrc);
- const GstStructure *structure;
- const gchar *name;
- gint width;
- gboolean ret;
-
- structure = gst_caps_get_structure (caps, 0);
- ret = gst_structure_get_int (structure, "rate", &src->samplerate);
-
- GST_DEBUG_OBJECT (src, "negotiated to samplerate %d", src->samplerate);
-
- name = gst_structure_get_name (structure);
- if (strcmp (name, "audio/x-raw-int") == 0) {
- ret &= gst_structure_get_int (structure, "width", &width);
- src->format = (width == 32) ? GST_AUDIO_TEST_SRC_FORMAT_S32 :
- GST_AUDIO_TEST_SRC_FORMAT_S16;
- } else {
- ret &= gst_structure_get_int (structure, "width", &width);
- src->format = (width == 32) ? GST_AUDIO_TEST_SRC_FORMAT_F32 :
- GST_AUDIO_TEST_SRC_FORMAT_F64;
- }
-
- /* allocate a new buffer suitable for this pad */
- switch (src->format) {
- case GST_AUDIO_TEST_SRC_FORMAT_S16:
- src->sample_size = sizeof (gint16);
- break;
- case GST_AUDIO_TEST_SRC_FORMAT_S32:
- src->sample_size = sizeof (gint32);
- break;
- case GST_AUDIO_TEST_SRC_FORMAT_F32:
- src->sample_size = sizeof (gfloat);
- break;
- case GST_AUDIO_TEST_SRC_FORMAT_F64:
- src->sample_size = sizeof (gdouble);
- break;
- default:
- /* can't really happen */
- ret = FALSE;
- break;
- }
-
- ret &= gst_structure_get_int (structure, "channels", &src->channels);
- GST_DEBUG_OBJECT (src, "negotiated to %d channels", src->channels);
-
- gst_audio_test_src_change_wave (src);
-
- return ret;
-}
-
-static gboolean
-gst_audio_test_src_query (GstBaseSrc * basesrc, GstQuery * query)
-{
- GstAudioTestSrc *src = GST_AUDIO_TEST_SRC (basesrc);
- gboolean res = FALSE;
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_CONVERT:
- {
- GstFormat src_fmt, dest_fmt;
- gint64 src_val, dest_val;
-
- gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
- if (src_fmt == dest_fmt) {
- dest_val = src_val;
- goto done;
- }
-
- switch (src_fmt) {
- case GST_FORMAT_DEFAULT:
- switch (dest_fmt) {
- case GST_FORMAT_TIME:
- /* samples to time */
- dest_val =
- gst_util_uint64_scale_int (src_val, GST_SECOND,
- src->samplerate);
- break;
- default:
- goto error;
- }
- break;
- case GST_FORMAT_TIME:
- switch (dest_fmt) {
- case GST_FORMAT_DEFAULT:
- /* time to samples */
- dest_val =
- gst_util_uint64_scale_int (src_val, src->samplerate,
- GST_SECOND);
- break;
- default:
- goto error;
- }
- break;
- default:
- goto error;
- }
- done:
- gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
- res = TRUE;
- break;
- }
- default:
- res = GST_BASE_SRC_CLASS (parent_class)->query (basesrc, query);
- break;
- }
-
- return res;
- /* ERROR */
-error:
- {
- GST_DEBUG_OBJECT (src, "query failed");
- return FALSE;
- }
-}
-
-#define DEFINE_SINE(type,scale) \
-static void \
-gst_audio_test_src_create_sine_##type (GstAudioTestSrc * src, g##type * samples) \
-{ \
- gint i, c; \
- gdouble step, amp; \
- \
- step = M_PI_M2 * src->freq / src->samplerate; \
- amp = src->volume * scale; \
- \
- i = 0; \
- while (i < (src->generate_samples_per_buffer * src->channels)) { \
- src->accumulator += step; \
- if (src->accumulator >= M_PI_M2) \
- src->accumulator -= M_PI_M2; \
- \
- for (c = 0; c < src->channels; ++c) { \
- samples[i++] = (g##type) (sin (src->accumulator) * amp); \
- } \
- } \
-}
-
-DEFINE_SINE (int16, 32767.0);
-DEFINE_SINE (int32, 2147483647.0);
-DEFINE_SINE (float, 1.0);
-DEFINE_SINE (double, 1.0);
-
-static const ProcessFunc sine_funcs[] = {
- (ProcessFunc) gst_audio_test_src_create_sine_int16,
- (ProcessFunc) gst_audio_test_src_create_sine_int32,
- (ProcessFunc) gst_audio_test_src_create_sine_float,
- (ProcessFunc) gst_audio_test_src_create_sine_double
-};
-
-#define DEFINE_SQUARE(type,scale) \
-static void \
-gst_audio_test_src_create_square_##type (GstAudioTestSrc * src, g##type * samples) \
-{ \
- gint i, c; \
- gdouble step, amp; \
- \
- step = M_PI_M2 * src->freq / src->samplerate; \
- amp = src->volume * scale; \
- \
- i = 0; \
- while (i < (src->generate_samples_per_buffer * src->channels)) { \
- src->accumulator += step; \
- if (src->accumulator >= M_PI_M2) \
- src->accumulator -= M_PI_M2; \
- \
- for (c = 0; c < src->channels; ++c) { \
- samples[i++] = (g##type) ((src->accumulator < M_PI) ? amp : -amp); \
- } \
- } \
-}
-
-DEFINE_SQUARE (int16, 32767.0);
-DEFINE_SQUARE (int32, 2147483647.0);
-DEFINE_SQUARE (float, 1.0);
-DEFINE_SQUARE (double, 1.0);
-
-static const ProcessFunc square_funcs[] = {
- (ProcessFunc) gst_audio_test_src_create_square_int16,
- (ProcessFunc) gst_audio_test_src_create_square_int32,
- (ProcessFunc) gst_audio_test_src_create_square_float,
- (ProcessFunc) gst_audio_test_src_create_square_double
-};
-
-#define DEFINE_SAW(type,scale) \
-static void \
-gst_audio_test_src_create_saw_##type (GstAudioTestSrc * src, g##type * samples) \
-{ \
- gint i, c; \
- gdouble step, amp; \
- \
- step = M_PI_M2 * src->freq / src->samplerate; \
- amp = (src->volume * scale) / M_PI; \
- \
- i = 0; \
- while (i < (src->generate_samples_per_buffer * src->channels)) { \
- src->accumulator += step; \
- if (src->accumulator >= M_PI_M2) \
- src->accumulator -= M_PI_M2; \
- \
- if (src->accumulator < M_PI) { \
- for (c = 0; c < src->channels; ++c) \
- samples[i++] = (g##type) (src->accumulator * amp); \
- } else { \
- for (c = 0; c < src->channels; ++c) \
- samples[i++] = (g##type) ((M_PI_M2 - src->accumulator) * -amp); \
- } \
- } \
-}
-
-DEFINE_SAW (int16, 32767.0);
-DEFINE_SAW (int32, 2147483647.0);
-DEFINE_SAW (float, 1.0);
-DEFINE_SAW (double, 1.0);
-
-static const ProcessFunc saw_funcs[] = {
- (ProcessFunc) gst_audio_test_src_create_saw_int16,
- (ProcessFunc) gst_audio_test_src_create_saw_int32,
- (ProcessFunc) gst_audio_test_src_create_saw_float,
- (ProcessFunc) gst_audio_test_src_create_saw_double
-};
-
-#define DEFINE_TRIANGLE(type,scale) \
-static void \
-gst_audio_test_src_create_triangle_##type (GstAudioTestSrc * src, g##type * samples) \
-{ \
- gint i, c; \
- gdouble step, amp; \
- \
- step = M_PI_M2 * src->freq / src->samplerate; \
- amp = (src->volume * scale) / M_PI_2; \
- \
- i = 0; \
- while (i < (src->generate_samples_per_buffer * src->channels)) { \
- src->accumulator += step; \
- if (src->accumulator >= M_PI_M2) \
- src->accumulator -= M_PI_M2; \
- \
- if (src->accumulator < (M_PI * 0.5)) { \
- for (c = 0; c < src->channels; ++c) \
- samples[i++] = (g##type) (src->accumulator * amp); \
- } else if (src->accumulator < (M_PI * 1.5)) { \
- for (c = 0; c < src->channels; ++c) \
- samples[i++] = (g##type) ((src->accumulator - M_PI) * -amp); \
- } else { \
- for (c = 0; c < src->channels; ++c) \
- samples[i++] = (g##type) ((M_PI_M2 - src->accumulator) * -amp); \
- } \
- } \
-}
-
-DEFINE_TRIANGLE (int16, 32767.0);
-DEFINE_TRIANGLE (int32, 2147483647.0);
-DEFINE_TRIANGLE (float, 1.0);
-DEFINE_TRIANGLE (double, 1.0);
-
-static const ProcessFunc triangle_funcs[] = {
- (ProcessFunc) gst_audio_test_src_create_triangle_int16,
- (ProcessFunc) gst_audio_test_src_create_triangle_int32,
- (ProcessFunc) gst_audio_test_src_create_triangle_float,
- (ProcessFunc) gst_audio_test_src_create_triangle_double
-};
-
-#define DEFINE_SILENCE(type) \
-static void \
-gst_audio_test_src_create_silence_##type (GstAudioTestSrc * src, g##type * samples) \
-{ \
- memset (samples, 0, src->generate_samples_per_buffer * sizeof (g##type) * src->channels); \
-}
-
-DEFINE_SILENCE (int16);
-DEFINE_SILENCE (int32);
-DEFINE_SILENCE (float);
-DEFINE_SILENCE (double);
-
-static const ProcessFunc silence_funcs[] = {
- (ProcessFunc) gst_audio_test_src_create_silence_int16,
- (ProcessFunc) gst_audio_test_src_create_silence_int32,
- (ProcessFunc) gst_audio_test_src_create_silence_float,
- (ProcessFunc) gst_audio_test_src_create_silence_double
-};
-
-#define DEFINE_WHITE_NOISE(type,scale) \
-static void \
-gst_audio_test_src_create_white_noise_##type (GstAudioTestSrc * src, g##type * samples) \
-{ \
- gint i, c; \
- gdouble amp = (src->volume * scale); \
- \
- i = 0; \
- while (i < (src->generate_samples_per_buffer * src->channels)) { \
- for (c = 0; c < src->channels; ++c) \
- samples[i++] = (g##type) (amp * g_random_double_range (-1.0, 1.0)); \
- } \
-}
-
-DEFINE_WHITE_NOISE (int16, 32767.0);
-DEFINE_WHITE_NOISE (int32, 2147483647.0);
-DEFINE_WHITE_NOISE (float, 1.0);
-DEFINE_WHITE_NOISE (double, 1.0);
-
-static const ProcessFunc white_noise_funcs[] = {
- (ProcessFunc) gst_audio_test_src_create_white_noise_int16,
- (ProcessFunc) gst_audio_test_src_create_white_noise_int32,
- (ProcessFunc) gst_audio_test_src_create_white_noise_float,
- (ProcessFunc) gst_audio_test_src_create_white_noise_double
-};
-
-/* pink noise calculation is based on
- * http://www.firstpr.com.au/dsp/pink-noise/phil_burk_19990905_patest_pink.c
- * which has been released under public domain
- * Many thanks Phil!
- */
-static void
-gst_audio_test_src_init_pink_noise (GstAudioTestSrc * src)
-{
- gint i;
- gint num_rows = 12; /* arbitrary: 1 .. PINK_MAX_RANDOM_ROWS */
- glong pmax;
-
- src->pink.index = 0;
- src->pink.index_mask = (1 << num_rows) - 1;
- /* calculate maximum possible signed random value.
- * Extra 1 for white noise always added. */
- pmax = (num_rows + 1) * (1 << (PINK_RANDOM_BITS - 1));
- src->pink.scalar = 1.0f / pmax;
- /* Initialize rows. */
- for (i = 0; i < num_rows; i++)
- src->pink.rows[i] = 0;
- src->pink.running_sum = 0;
-}
-
-/* Generate Pink noise values between -1.0 and +1.0 */
-static gdouble
-gst_audio_test_src_generate_pink_noise_value (GstPinkNoise * pink)
-{
- glong new_random;
- glong sum;
-
- /* Increment and mask index. */
- pink->index = (pink->index + 1) & pink->index_mask;
-
- /* If index is zero, don't update any random values. */
- if (pink->index != 0) {
- /* Determine how many trailing zeros in PinkIndex. */
- /* This algorithm will hang if n==0 so test first. */
- gint num_zeros = 0;
- gint n = pink->index;
-
- while ((n & 1) == 0) {
- n = n >> 1;
- num_zeros++;
- }
-
- /* Replace the indexed ROWS random value.
- * Subtract and add back to RunningSum instead of adding all the random
- * values together. Only one changes each time.
- */
- pink->running_sum -= pink->rows[num_zeros];
- new_random = 32768.0 - (65536.0 * (gulong) rand () / (RAND_MAX + 1.0));
- pink->running_sum += new_random;
- pink->rows[num_zeros] = new_random;
- }
-
- /* Add extra white noise value. */
- new_random = 32768.0 - (65536.0 * (gulong) rand () / (RAND_MAX + 1.0));
- sum = pink->running_sum + new_random;
-
- /* Scale to range of -1.0 to 0.9999. */
- return (pink->scalar * sum);
-}
-
-#define DEFINE_PINK(type, scale) \
-static void \
-gst_audio_test_src_create_pink_noise_##type (GstAudioTestSrc * src, g##type * samples) \
-{ \
- gint i, c; \
- gdouble amp; \
- \
- amp = src->volume * scale; \
- \
- i = 0; \
- while (i < (src->generate_samples_per_buffer * src->channels)) { \
- for (c = 0; c < src->channels; ++c) { \
- samples[i++] = \
- (g##type) (gst_audio_test_src_generate_pink_noise_value (&src->pink) * \
- amp); \
- } \
- } \
-}
-
-DEFINE_PINK (int16, 32767.0);
-DEFINE_PINK (int32, 2147483647.0);
-DEFINE_PINK (float, 1.0);
-DEFINE_PINK (double, 1.0);
-
-static const ProcessFunc pink_noise_funcs[] = {
- (ProcessFunc) gst_audio_test_src_create_pink_noise_int16,
- (ProcessFunc) gst_audio_test_src_create_pink_noise_int32,
- (ProcessFunc) gst_audio_test_src_create_pink_noise_float,
- (ProcessFunc) gst_audio_test_src_create_pink_noise_double
-};
-
-static void
-gst_audio_test_src_init_sine_table (GstAudioTestSrc * src)
-{
- gint i;
- gdouble ang = 0.0;
- gdouble step = M_PI_M2 / 1024.0;
- gdouble amp = src->volume;
-
- for (i = 0; i < 1024; i++) {
- src->wave_table[i] = sin (ang) * amp;
- ang += step;
- }
-}
-
-#define DEFINE_SINE_TABLE(type,scale) \
-static void \
-gst_audio_test_src_create_sine_table_##type (GstAudioTestSrc * src, g##type * samples) \
-{ \
- gint i, c; \
- gdouble step, scl; \
- \
- step = M_PI_M2 * src->freq / src->samplerate; \
- scl = 1024.0 / M_PI_M2; \
- \
- i = 0; \
- while (i < (src->generate_samples_per_buffer * src->channels)) { \
- src->accumulator += step; \
- if (src->accumulator >= M_PI_M2) \
- src->accumulator -= M_PI_M2; \
- \
- for (c = 0; c < src->channels; ++c) \
- samples[i++] = (g##type) scale * src->wave_table[(gint) (src->accumulator * scl)]; \
- } \
-}
-
-DEFINE_SINE_TABLE (int16, 32767.0);
-DEFINE_SINE_TABLE (int32, 2147483647.0);
-DEFINE_SINE_TABLE (float, 1.0);
-DEFINE_SINE_TABLE (double, 1.0);
-
-static const ProcessFunc sine_table_funcs[] = {
- (ProcessFunc) gst_audio_test_src_create_sine_table_int16,
- (ProcessFunc) gst_audio_test_src_create_sine_table_int32,
- (ProcessFunc) gst_audio_test_src_create_sine_table_float,
- (ProcessFunc) gst_audio_test_src_create_sine_table_double
-};
-
-#define DEFINE_TICKS(type,scale) \
-static void \
-gst_audio_test_src_create_tick_##type (GstAudioTestSrc * src, g##type * samples) \
-{ \
- gint i, c; \
- gdouble step, scl; \
- \
- step = M_PI_M2 * src->freq / src->samplerate; \
- scl = 1024.0 / M_PI_M2; \
- \
- for (i = 0; i < src->generate_samples_per_buffer; i++) { \
- src->accumulator += step; \
- if (src->accumulator >= M_PI_M2) \
- src->accumulator -= M_PI_M2; \
- \
- if ((src->next_sample + i)%src->samplerate < 1600) { \
- for (c = 0; c < src->channels; ++c) \
- samples[(i * src->channels) + c] = (g##type) scale * src->wave_table[(gint) (src->accumulator * scl)]; \
- } else { \
- for (c = 0; c < src->channels; ++c) \
- samples[(i * src->channels) + c] = 0; \
- } \
- } \
-}
-
-DEFINE_TICKS (int16, 32767.0);
-DEFINE_TICKS (int32, 2147483647.0);
-DEFINE_TICKS (float, 1.0);
-DEFINE_TICKS (double, 1.0);
-
-static const ProcessFunc tick_funcs[] = {
- (ProcessFunc) gst_audio_test_src_create_tick_int16,
- (ProcessFunc) gst_audio_test_src_create_tick_int32,
- (ProcessFunc) gst_audio_test_src_create_tick_float,
- (ProcessFunc) gst_audio_test_src_create_tick_double
-};
-
-/* Gaussian white noise using Box-Muller algorithm. unit variance
- * normally-distributed random numbers are generated in pairs as the real
- * and imaginary parts of a compex random variable with
- * uniformly-distributed argument and \chi^{2}-distributed modulus.
- */
-
-#define DEFINE_GAUSSIAN_WHITE_NOISE(type,scale) \
-static void \
-gst_audio_test_src_create_gaussian_white_noise_##type (GstAudioTestSrc * src, g##type * samples) \
-{ \
- gint i, c; \
- gdouble amp = (src->volume * scale); \
- \
- for (i = 0; i < src->generate_samples_per_buffer * src->channels; ) { \
- for (c = 0; c < src->channels; ++c) { \
- gdouble mag = sqrt (-2 * log (1.0 - g_random_double ())); \
- gdouble phs = g_random_double_range (0.0, M_PI_M2); \
- \
- samples[i++] = (g##type) (amp * mag * cos (phs)); \
- if (++c >= src->channels) \
- break; \
- samples[i++] = (g##type) (amp * mag * sin (phs)); \
- } \
- } \
-}
-
-DEFINE_GAUSSIAN_WHITE_NOISE (int16, 32767.0);
-DEFINE_GAUSSIAN_WHITE_NOISE (int32, 2147483647.0);
-DEFINE_GAUSSIAN_WHITE_NOISE (float, 1.0);
-DEFINE_GAUSSIAN_WHITE_NOISE (double, 1.0);
-
-static const ProcessFunc gaussian_white_noise_funcs[] = {
- (ProcessFunc) gst_audio_test_src_create_gaussian_white_noise_int16,
- (ProcessFunc) gst_audio_test_src_create_gaussian_white_noise_int32,
- (ProcessFunc) gst_audio_test_src_create_gaussian_white_noise_float,
- (ProcessFunc) gst_audio_test_src_create_gaussian_white_noise_double
-};
-
-/*
- * gst_audio_test_src_change_wave:
- * Assign function pointer of wave genrator.
- */
-static void
-gst_audio_test_src_change_wave (GstAudioTestSrc * src)
-{
- if (src->format == -1) {
- src->process = NULL;
- return;
- }
-
- switch (src->wave) {
- case GST_AUDIO_TEST_SRC_WAVE_SINE:
- src->process = sine_funcs[src->format];
- break;
- case GST_AUDIO_TEST_SRC_WAVE_SQUARE:
- src->process = square_funcs[src->format];
- break;
- case GST_AUDIO_TEST_SRC_WAVE_SAW:
- src->process = saw_funcs[src->format];
- break;
- case GST_AUDIO_TEST_SRC_WAVE_TRIANGLE:
- src->process = triangle_funcs[src->format];
- break;
- case GST_AUDIO_TEST_SRC_WAVE_SILENCE:
- src->process = silence_funcs[src->format];
- break;
- case GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE:
- src->process = white_noise_funcs[src->format];
- break;
- case GST_AUDIO_TEST_SRC_WAVE_PINK_NOISE:
- gst_audio_test_src_init_pink_noise (src);
- src->process = pink_noise_funcs[src->format];
- break;
- case GST_AUDIO_TEST_SRC_WAVE_SINE_TAB:
- gst_audio_test_src_init_sine_table (src);
- src->process = sine_table_funcs[src->format];
- break;
- case GST_AUDIO_TEST_SRC_WAVE_TICKS:
- gst_audio_test_src_init_sine_table (src);
- src->process = tick_funcs[src->format];
- break;
- case GST_AUDIO_TEST_SRC_WAVE_GAUSSIAN_WHITE_NOISE:
- src->process = gaussian_white_noise_funcs[src->format];
- break;
- default:
- GST_ERROR ("invalid wave-form");
- break;
- }
-}
-
-/*
- * gst_audio_test_src_change_volume:
- * Recalc wave tables for precalculated waves.
- */
-static void
-gst_audio_test_src_change_volume (GstAudioTestSrc * src)
-{
- switch (src->wave) {
- case GST_AUDIO_TEST_SRC_WAVE_SINE_TAB:
- gst_audio_test_src_init_sine_table (src);
- break;
- default:
- break;
- }
-}
-
-static void
-gst_audio_test_src_get_times (GstBaseSrc * basesrc, GstBuffer * buffer,
- GstClockTime * start, GstClockTime * end)
-{
- /* for live sources, sync on the timestamp of the buffer */
- if (gst_base_src_is_live (basesrc)) {
- GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buffer);
-
- if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
- /* get duration to calculate end time */
- GstClockTime duration = GST_BUFFER_DURATION (buffer);
-
- if (GST_CLOCK_TIME_IS_VALID (duration)) {
- *end = timestamp + duration;
- }
- *start = timestamp;
- }
- } else {
- *start = -1;
- *end = -1;
- }
-}
-
-static gboolean
-gst_audio_test_src_start (GstBaseSrc * basesrc)
-{
- GstAudioTestSrc *src = GST_AUDIO_TEST_SRC (basesrc);
-
- src->next_sample = 0;
- src->next_byte = 0;
- src->next_time = 0;
- src->check_seek_stop = FALSE;
- src->eos_reached = FALSE;
- src->tags_pushed = FALSE;
- src->accumulator = 0;
-
- return TRUE;
-}
-
-static gboolean
-gst_audio_test_src_stop (GstBaseSrc * basesrc)
-{
- return TRUE;
-}
-
-/* seek to time, will be called when we operate in push mode. In pull mode we
- * get the requested byte offset. */
-static gboolean
-gst_audio_test_src_do_seek (GstBaseSrc * basesrc, GstSegment * segment)
-{
- GstAudioTestSrc *src = GST_AUDIO_TEST_SRC (basesrc);
- GstClockTime time;
-
- segment->time = segment->start;
- time = segment->last_stop;
-
- /* now move to the time indicated */
- src->next_sample =
- gst_util_uint64_scale_int (time, src->samplerate, GST_SECOND);
- src->next_byte = src->next_sample * src->sample_size * src->channels;
- src->next_time =
- gst_util_uint64_scale_int (src->next_sample, GST_SECOND, src->samplerate);
-
- g_assert (src->next_time <= time);
-
- if (GST_CLOCK_TIME_IS_VALID (segment->stop)) {
- time = segment->stop;
- src->sample_stop = gst_util_uint64_scale_int (time, src->samplerate,
- GST_SECOND);
- src->check_seek_stop = TRUE;
- } else {
- src->check_seek_stop = FALSE;
- }
- src->eos_reached = FALSE;
-
- return TRUE;
-}
-
-static gboolean
-gst_audio_test_src_is_seekable (GstBaseSrc * basesrc)
-{
- /* we're seekable... */
- return TRUE;
-}
-
-static gboolean
-gst_audio_test_src_check_get_range (GstBaseSrc * basesrc)
-{
- GstAudioTestSrc *src;
-
- src = GST_AUDIO_TEST_SRC (basesrc);
-
- /* if we can operate in pull mode */
- return src->can_activate_pull;
-}
-
-static GstFlowReturn
-gst_audio_test_src_create (GstBaseSrc * basesrc, guint64 offset,
- guint length, GstBuffer ** buffer)
-{
- GstFlowReturn res;
- GstAudioTestSrc *src;
- GstBuffer *buf;
- GstClockTime next_time;
- gint64 next_sample, next_byte;
- guint bytes, samples;
- GstElementClass *eclass;
-
- src = GST_AUDIO_TEST_SRC (basesrc);
-
- /* example for tagging generated data */
- if (!src->tags_pushed) {
- GstTagList *taglist;
-
- taglist = gst_tag_list_new ();
-
- gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND,
- GST_TAG_DESCRIPTION, "audiotest wave", NULL);
-
- eclass = GST_ELEMENT_CLASS (parent_class);
- if (eclass->send_event)
- eclass->send_event (GST_ELEMENT_CAST (basesrc),
- gst_event_new_tag (taglist));
- src->tags_pushed = TRUE;
- }
-
- if (src->eos_reached)
- return GST_FLOW_UNEXPECTED;
-
- /* if no length was given, use our default length in samples otherwise convert
- * the length in bytes to samples. */
- if (length == -1)
- samples = src->samples_per_buffer;
- else
- samples = length / (src->sample_size * src->channels);
-
- /* if no offset was given, use our next logical byte */
- if (offset == -1)
- offset = src->next_byte;
-
- /* now see if we are at the byteoffset we think we are */
- if (offset != src->next_byte) {
- GST_DEBUG_OBJECT (src, "seek to new offset %" G_GUINT64_FORMAT, offset);
- /* we have a discont in the expected sample offset, do a 'seek' */
- src->next_sample = offset / (src->sample_size * src->channels);
- src->next_time =
- gst_util_uint64_scale_int (src->next_sample, GST_SECOND,
- src->samplerate);
- src->next_byte = offset;
- }
-
- /* check for eos */
- if (src->check_seek_stop &&
- (src->sample_stop > src->next_sample) &&
- (src->sample_stop < src->next_sample + samples)
- ) {
- /* calculate only partial buffer */
- src->generate_samples_per_buffer = src->sample_stop - src->next_sample;
- next_sample = src->sample_stop;
- src->eos_reached = TRUE;
- } else {
- /* calculate full buffer */
- src->generate_samples_per_buffer = samples;
- next_sample = src->next_sample + samples;
- }
-
- bytes = src->generate_samples_per_buffer * src->sample_size * src->channels;
-
- if ((res = gst_pad_alloc_buffer (basesrc->srcpad, src->next_sample,
- bytes, GST_PAD_CAPS (basesrc->srcpad), &buf)) != GST_FLOW_OK) {
- return res;
- }
-
- next_byte = src->next_byte + bytes;
- next_time = gst_util_uint64_scale_int (next_sample, GST_SECOND,
- src->samplerate);
-
- GST_LOG_OBJECT (src, "samplerate %d", src->samplerate);
- GST_LOG_OBJECT (src, "next_sample %" G_GINT64_FORMAT ", ts %" GST_TIME_FORMAT,
- next_sample, GST_TIME_ARGS (next_time));
-
- GST_BUFFER_TIMESTAMP (buf) = src->timestamp_offset + src->next_time;
- GST_BUFFER_OFFSET (buf) = src->next_sample;
- GST_BUFFER_OFFSET_END (buf) = next_sample;
- GST_BUFFER_DURATION (buf) = next_time - src->next_time;
-
- gst_object_sync_values (G_OBJECT (src), src->next_time);
-
- src->next_time = next_time;
- src->next_sample = next_sample;
- src->next_byte = next_byte;
-
- GST_LOG_OBJECT (src, "generating %u samples at ts %" GST_TIME_FORMAT,
- src->generate_samples_per_buffer,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
-
- src->process (src, GST_BUFFER_DATA (buf));
-
- if (G_UNLIKELY ((src->wave == GST_AUDIO_TEST_SRC_WAVE_SILENCE)
- || (src->volume == 0.0))) {
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_GAP);
- }
-
- *buffer = buf;
-
- return GST_FLOW_OK;
-}
-
-static void
-gst_audio_test_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstAudioTestSrc *src = GST_AUDIO_TEST_SRC (object);
-
- switch (prop_id) {
- case PROP_SAMPLES_PER_BUFFER:
- src->samples_per_buffer = g_value_get_int (value);
- break;
- case PROP_WAVE:
- src->wave = g_value_get_enum (value);
- gst_audio_test_src_change_wave (src);
- break;
- case PROP_FREQ:
- src->freq = g_value_get_double (value);
- break;
- case PROP_VOLUME:
- src->volume = g_value_get_double (value);
- gst_audio_test_src_change_volume (src);
- break;
- case PROP_IS_LIVE:
- gst_base_src_set_live (GST_BASE_SRC (src), g_value_get_boolean (value));
- break;
- case PROP_TIMESTAMP_OFFSET:
- src->timestamp_offset = g_value_get_int64 (value);
- break;
- case PROP_CAN_ACTIVATE_PUSH:
- GST_BASE_SRC (src)->can_activate_push = g_value_get_boolean (value);
- break;
- case PROP_CAN_ACTIVATE_PULL:
- src->can_activate_pull = g_value_get_boolean (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_audio_test_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstAudioTestSrc *src = GST_AUDIO_TEST_SRC (object);
-
- switch (prop_id) {
- case PROP_SAMPLES_PER_BUFFER:
- g_value_set_int (value, src->samples_per_buffer);
- break;
- case PROP_WAVE:
- g_value_set_enum (value, src->wave);
- break;
- case PROP_FREQ:
- g_value_set_double (value, src->freq);
- break;
- case PROP_VOLUME:
- g_value_set_double (value, src->volume);
- break;
- case PROP_IS_LIVE:
- g_value_set_boolean (value, gst_base_src_is_live (GST_BASE_SRC (src)));
- break;
- case PROP_TIMESTAMP_OFFSET:
- g_value_set_int64 (value, src->timestamp_offset);
- break;
- case PROP_CAN_ACTIVATE_PUSH:
- g_value_set_boolean (value, GST_BASE_SRC (src)->can_activate_push);
- break;
- case PROP_CAN_ACTIVATE_PULL:
- g_value_set_boolean (value, src->can_activate_pull);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- /* initialize gst controller library */
- gst_controller_init (NULL, NULL);
-
- GST_DEBUG_CATEGORY_INIT (audio_test_src_debug, "audiotestsrc", 0,
- "Audio Test Source");
-
- return gst_element_register (plugin, "audiotestsrc",
- GST_RANK_NONE, GST_TYPE_AUDIO_TEST_SRC);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "audiotestsrc",
- "Creates audio test signals of given frequency and volume",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
diff --git a/gst/audiotestsrc/gstaudiotestsrc.h b/gst/audiotestsrc/gstaudiotestsrc.h
deleted file mode 100644
index 69f73eda..00000000
--- a/gst/audiotestsrc/gstaudiotestsrc.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005 Stefan Kost <ensonic@users.sf.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_AUDIO_TEST_SRC_H__
-#define __GST_AUDIO_TEST_SRC_H__
-
-
-#include <gst/gst.h>
-#include <gst/base/gstbasesrc.h>
-
-G_BEGIN_DECLS
-
-
-#define GST_TYPE_AUDIO_TEST_SRC \
- (gst_audio_test_src_get_type())
-#define GST_AUDIO_TEST_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_TEST_SRC,GstAudioTestSrc))
-#define GST_AUDIO_TEST_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_TEST_SRC,GstAudioTestSrcClass))
-#define GST_IS_AUDIO_TEST_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_TEST_SRC))
-#define GST_IS_AUDIO_TEST_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_TEST_SRC))
-
-/**
- * GstAudioTestSrcWave:
- * @GST_AUDIO_TEST_SRC_WAVE_SINE: a sine wave
- * @GST_AUDIO_TEST_SRC_WAVE_SQUARE: a square wave
- * @GST_AUDIO_TEST_SRC_WAVE_SAW: a saw wave
- * @GST_AUDIO_TEST_SRC_WAVE_TRIANGLE: a tringle wave
- * @GST_AUDIO_TEST_SRC_WAVE_SILENCE: silence
- * @GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE: white uniform noise
- * @GST_AUDIO_TEST_SRC_WAVE_PINK_NOISE: pink noise
- * @GST_AUDIO_TEST_SRC_WAVE_SINE_TAB: sine wave using a table
- * @GST_AUDIO_TEST_SRC_WAVE_TICKS: periodic ticks
- * @GST_AUDIO_TEST_SRC_WAVE_GAUSSIAN_WHITE_NOISE: white (zero mean) Gaussian noise; volume sets the standard deviation of the noise in units of the range of values of the sample type, e.g. volume=0.1 produces noise with a standard deviation of 0.1*32767=3277 with 16-bit integer samples, or 0.1*1.0=0.1 with floating-point samples.
- *
- * Different types of supported sound waves.
- */
-typedef enum {
- GST_AUDIO_TEST_SRC_WAVE_SINE,
- GST_AUDIO_TEST_SRC_WAVE_SQUARE,
- GST_AUDIO_TEST_SRC_WAVE_SAW,
- GST_AUDIO_TEST_SRC_WAVE_TRIANGLE,
- GST_AUDIO_TEST_SRC_WAVE_SILENCE,
- GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE,
- GST_AUDIO_TEST_SRC_WAVE_PINK_NOISE,
- GST_AUDIO_TEST_SRC_WAVE_SINE_TAB,
- GST_AUDIO_TEST_SRC_WAVE_TICKS,
- GST_AUDIO_TEST_SRC_WAVE_GAUSSIAN_WHITE_NOISE
-} GstAudioTestSrcWave;
-
-#define PINK_MAX_RANDOM_ROWS (30)
-#define PINK_RANDOM_BITS (16)
-#define PINK_RANDOM_SHIFT ((sizeof(long)*8)-PINK_RANDOM_BITS)
-
-typedef struct {
- glong rows[PINK_MAX_RANDOM_ROWS];
- glong running_sum; /* Used to optimize summing of generators. */
- gint index; /* Incremented each sample. */
- gint index_mask; /* Index wrapped by ANDing with this mask. */
- gdouble scalar; /* Used to scale within range of -1.0 to +1.0 */
-} GstPinkNoise;
-
-typedef enum {
- GST_AUDIO_TEST_SRC_FORMAT_NONE = -1,
- GST_AUDIO_TEST_SRC_FORMAT_S16 = 0,
- GST_AUDIO_TEST_SRC_FORMAT_S32,
- GST_AUDIO_TEST_SRC_FORMAT_F32,
- GST_AUDIO_TEST_SRC_FORMAT_F64
-} GstAudioTestSrcFormat;
-
-typedef struct _GstAudioTestSrc GstAudioTestSrc;
-typedef struct _GstAudioTestSrcClass GstAudioTestSrcClass;
-
-typedef void (*ProcessFunc) (GstAudioTestSrc*, guint8 *);
-
-/**
- * GstAudioTestSrc:
- *
- * audiotestsrc object structure.
- */
-struct _GstAudioTestSrc {
- GstBaseSrc parent;
-
- ProcessFunc process;
-
- /* parameters */
- GstAudioTestSrcWave wave;
- gdouble volume;
- gdouble freq;
-
- /* audio parameters */
- gint channels;
- gint samplerate;
- gint samples_per_buffer;
- gint sample_size;
- GstAudioTestSrcFormat format;
-
- /*< private >*/
- gboolean tags_pushed; /* send tags just once ? */
- GstClockTimeDiff timestamp_offset; /* base offset */
- GstClockTime next_time; /* next timestamp */
- gint64 next_sample; /* next sample to send */
- gint64 next_byte; /* next byte to send */
- gint64 sample_stop;
- gboolean check_seek_stop;
- gboolean eos_reached;
- gint generate_samples_per_buffer; /* used to generate a partial buffer */
- gboolean can_activate_pull;
-
- /* waveform specific context data */
- gdouble accumulator; /* phase angle */
- GstPinkNoise pink;
- gdouble wave_table[1024];
-};
-
-struct _GstAudioTestSrcClass {
- GstBaseSrcClass parent_class;
-};
-
-GType gst_audio_test_src_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_AUDIO_TEST_SRC_H__ */
diff --git a/gst/ffmpegcolorspace/Makefile.am b/gst/ffmpegcolorspace/Makefile.am
deleted file mode 100644
index 2893fc41..00000000
--- a/gst/ffmpegcolorspace/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-plugin_LTLIBRARIES = libgstffmpegcolorspace.la
-
-libgstffmpegcolorspace_la_SOURCES = \
- gstffmpeg.c \
- gstffmpegcolorspace.c \
- gstffmpegcodecmap.c \
- dsputil.c \
- mem.c \
- utils.c \
- imgconvert.c
-
-libgstffmpegcolorspace_la_CFLAGS = $(GST_CFLAGS)
-libgstffmpegcolorspace_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstffmpegcolorspace_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS)
-libgstffmpegcolorspace_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = \
- gstffmpegcolorspace.h \
- gstffmpegcodecmap.h \
- imgconvert_template.h \
- dsputil.h \
- avcodec.h
diff --git a/gst/ffmpegcolorspace/avcodec.h b/gst/ffmpegcolorspace/avcodec.h
deleted file mode 100644
index 651d4fa9..00000000
--- a/gst/ffmpegcolorspace/avcodec.h
+++ /dev/null
@@ -1,282 +0,0 @@
-#ifndef AVCODEC_H
-#define AVCODEC_H
-
-/**
- * @file avcodec.h
- * external api header.
- */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "_stdint.h"
-
-#include <sys/types.h> /* size_t */
-
-#define FFMPEG_VERSION_INT 0x000409
-#define FFMPEG_VERSION "0.4.9-pre1"
-#define LIBAVCODEC_BUILD 4728
-
-#define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
-#define LIBAVCODEC_VERSION FFMPEG_VERSION
-
-#define AV_STRINGIFY(s) AV_TOSTRING(s)
-#define AV_TOSTRING(s) #s
-#define LIBAVCODEC_IDENT "FFmpeg" LIBAVCODEC_VERSION "b" AV_STRINGIFY(LIBAVCODEC_BUILD)
-
-enum CodecType {
- CODEC_TYPE_UNKNOWN = -1,
- CODEC_TYPE_VIDEO,
- CODEC_TYPE_AUDIO,
- CODEC_TYPE_DATA,
-};
-
-/*
- * Pixel format. Notes:
- *
- * PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA
- * color is put together as:
- * (A << 24) | (R << 16) | (G << 8) | B
- * This is stored as BGRA on little endian CPU architectures and ARGB on
- * big endian CPUs.
- *
- * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized
- * image data is stored in AVFrame.data[0]. The palette is transported in
- * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is
- * formatted the same as in PIX_FMT_RGBA32 described above (i.e., it is
- * also endian-specific). Note also that the individual RGB palette
- * components stored in AVFrame.data[1] should be in the range 0..255.
- * This is important as many custom PAL8 video codecs that were designed
- * to run on the IBM VGA graphics adapter use 6-bit palette components.
- */
-enum PixelFormat {
- PIX_FMT_YUV420P, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples) (I420)
- PIX_FMT_NV12, ///< Packed YUV 4:2:0 (separate Y plane, interleaved Cb & Cr planes)
- PIX_FMT_NV21, ///< Packed YUV 4:2:0 (separate Y plane, interleaved Cb & Cr planes)
- PIX_FMT_YVU420P, ///< Planar YUV 4:2:0 (1 Cb & Cr sample per 2x2 Y samples) (YV12)
- PIX_FMT_YUV422, ///< Packed pixel, Y0 Cb Y1 Cr
- PIX_FMT_RGB24, ///< Packed pixel, 3 bytes per pixel, RGBRGB...
- PIX_FMT_BGR24, ///< Packed pixel, 3 bytes per pixel, BGRBGR...
- PIX_FMT_YUV422P, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
- PIX_FMT_YUV444P, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
- PIX_FMT_RGBA32, ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness
- PIX_FMT_BGRA32, ///< Packed pixel, 4 bytes per pixel, ARGBARGB...
- PIX_FMT_ARGB32, ///< Packed pixel, 4 bytes per pixel, ABGRABGR..., stored in cpu endianness
- PIX_FMT_ABGR32, ///< Packed pixel, 4 bytes per pixel, RGBARGBA...
- PIX_FMT_RGB32, ///< Packed pixel, 4 bytes per pixel, BGRxBGRx..., stored in cpu endianness
- PIX_FMT_xRGB32, ///< Packed pixel, 4 bytes per pixel, xBGRxBGR..., stored in cpu endianness
- PIX_FMT_BGR32, ///< Packed pixel, 4 bytes per pixel, xRGBxRGB...
- PIX_FMT_BGRx32, ///< Packed pixel, 4 bytes per pixel, RGBxRGBx...
- PIX_FMT_YUV410P, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
- PIX_FMT_YVU410P, ///< Planar YVU 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
- PIX_FMT_YUV411P, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
- PIX_FMT_RGB565, ///< always stored in cpu endianness
- PIX_FMT_RGB555, ///< always stored in cpu endianness, most significant bit to 1
- PIX_FMT_GRAY8,
- PIX_FMT_GRAY16_L,
- PIX_FMT_GRAY16_B,
- PIX_FMT_MONOWHITE, ///< 0 is white
- PIX_FMT_MONOBLACK, ///< 0 is black
- PIX_FMT_PAL8, ///< 8 bit with RGBA palette
- PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0 full scale (jpeg)
- PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2 full scale (jpeg)
- PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4 full scale (jpeg)
- PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h)
- PIX_FMT_XVMC_MPEG2_IDCT,
- PIX_FMT_UYVY422, ///< Packed pixel, Cb Y0 Cr Y1
- PIX_FMT_YVYU422, ///< Packed pixel, Y0 Cr Y1 Cb
- PIX_FMT_UYVY411, ///< Packed pixel, Cb Y0 Y1 Cr Y2 Y3
- PIX_FMT_V308, ///< Packed pixel, Y0 Cb Cr
-
- PIX_FMT_AYUV4444, ///< Packed pixel, A0 Y0 Cb Cr
- PIX_FMT_NB
-};
-
-/* currently unused, may be used if 24/32 bits samples ever supported */
-enum SampleFormat {
- SAMPLE_FMT_S16 = 0, ///< signed 16 bits
-};
-
-/* thomas: extracted from imgconvert.c since it's also used in
- * gstffmpegcodecmap.c */
-
-/* start of extract */
-
-#define FF_COLOR_RGB 0 /* RGB color space */
-#define FF_COLOR_GRAY 1 /* gray color space */
-#define FF_COLOR_YUV 2 /* YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
-#define FF_COLOR_YUV_JPEG 3 /* YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
-
-#define FF_PIXEL_PLANAR 0 /* each channel has one component in AVPicture */
-#define FF_PIXEL_PACKED 1 /* only one components containing all the channels */
-#define FF_PIXEL_PALETTE 2 /* one components containing indexes for a palette */
-
-typedef struct PixFmtInfo
-{
- enum PixelFormat format;
- const char *name;
- uint8_t nb_channels; /* number of channels (including alpha) */
- uint8_t color_type; /* color type (see FF_COLOR_xxx constants) */
- uint8_t pixel_type; /* pixel storage type (see FF_PIXEL_xxx constants) */
- uint8_t is_alpha:1; /* true if alpha can be specified */
- uint8_t x_chroma_shift; /* X chroma subsampling factor is 2 ^ shift */
- uint8_t y_chroma_shift; /* Y chroma subsampling factor is 2 ^ shift */
- uint8_t depth; /* bit depth of the color components */
-} PixFmtInfo;
-
-PixFmtInfo * get_pix_fmt_info (enum PixelFormat format);
-/* end of extract */
-
-/**
- * main external api structure.
- */
-typedef struct AVCodecContext {
- /* video only */
- /**
- * frames per sec multiplied by frame_rate_base.
- * for variable fps this is the precission, so if the timestamps
- * can be specified in msec precssion then this is 1000*frame_rate_base
- * - encoding: MUST be set by user
- * - decoding: set by lavc. 0 or the frame_rate if available
- */
- int frame_rate;
-
- /**
- * frame_rate_base.
- * for variable fps this is 1
- * - encoding: set by user.
- * - decoding: set by lavc.
- */
-
- int frame_rate_base;
- /**
- * picture width / height.
- * - encoding: MUST be set by user.
- * - decoding: set by lavc.
- * Note, for compatibility its possible to set this instead of
- * coded_width/height before decoding
- */
- int width, height;
-
- /**
- * pixel format, see PIX_FMT_xxx.
- * - encoding: FIXME: used by ffmpeg to decide whether an pix_fmt
- * conversion is in order. This only works for
- * codecs with one supported pix_fmt, we should
- * do something for a generic case as well.
- * - decoding: set by lavc.
- */
- enum PixelFormat pix_fmt;
-
- /* audio only */
- int sample_rate; ///< samples per sec
- int channels;
- int sample_fmt; ///< sample format, currenly unused
-
- /**
- * Palette control structure
- * - encoding: ??? (no palette-enabled encoder yet)
- * - decoding: set by user.
- */
- struct AVPaletteControl *palctrl;
-} AVCodecContext;
-
-/**
- * four components are given, that's all.
- * the last component is alpha
- */
-typedef struct AVPicture {
- uint8_t *data[4];
- int linesize[4]; ///< number of bytes per line
- int interlaced;
-} AVPicture;
-
-/**
- * AVPaletteControl
- * This structure defines a method for communicating palette changes
- * between and demuxer and a decoder.
- */
-#define AVPALETTE_SIZE 1024
-#define AVPALETTE_COUNT 256
-typedef struct AVPaletteControl {
-
- /* demuxer sets this to 1 to indicate the palette has changed;
- * decoder resets to 0 */
- int palette_changed;
-
- /* 4-byte ARGB palette entries, stored in native byte order; note that
- * the individual palette components should be on a 8-bit scale; if
- * the palette data comes from a IBM VGA native format, the component
- * data is probably 6 bits in size and needs to be scaled */
- unsigned int palette[AVPALETTE_COUNT];
-
-} AVPaletteControl;
-
-int avpicture_get_size(int pix_fmt, int width, int height);
-
-void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift);
-const char *avcodec_get_pix_fmt_name(int pix_fmt);
-void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
-enum PixelFormat avcodec_get_pix_fmt(const char* name);
-
-#define FF_LOSS_RESOLUTION 0x0001 /* loss due to resolution change */
-#define FF_LOSS_DEPTH 0x0002 /* loss due to color depth change */
-#define FF_LOSS_COLORSPACE 0x0004 /* loss due to color space conversion */
-#define FF_LOSS_ALPHA 0x0008 /* loss of alpha bits */
-#define FF_LOSS_COLORQUANT 0x0010 /* loss due to color quantization */
-#define FF_LOSS_CHROMA 0x0020 /* loss of chroma (e.g. rgb to gray conversion) */
-
-int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt,
- int has_alpha);
-int avcodec_find_best_pix_fmt(int pix_fmt_mask, int src_pix_fmt,
- int has_alpha, int *loss_ptr);
-
-#define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */
-#define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
-int img_get_alpha_info(const AVPicture *src,
- int pix_fmt, int width, int height);
-
-/* convert among pixel formats */
-int img_convert(AVPicture *dst, int dst_pix_fmt,
- const AVPicture *src, int pix_fmt,
- int width, int height);
-
-void avcodec_init(void);
-
-void avcodec_get_context_defaults(AVCodecContext *s);
-AVCodecContext *avcodec_alloc_context(void);
-
-/* memory */
-void *av_malloc(unsigned int size);
-void *av_mallocz(unsigned int size);
-void *av_realloc(void *ptr, unsigned int size);
-void av_free(void *ptr);
-char *av_strdup(const char *s);
-void av_freep(void *ptr);
-void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
-/* for static data only */
-/* call av_free_static to release all staticaly allocated tables */
-void av_free_static(void);
-void *av_mallocz_static(unsigned int size);
-
-/* endian macros */
-#if !defined(BE_16) || !defined(BE_32) || !defined(LE_16) || !defined(LE_32)
-#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
-#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
- (((uint8_t*)(x))[1] << 16) | \
- (((uint8_t*)(x))[2] << 8) | \
- ((uint8_t*)(x))[3])
-#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
-#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \
- (((uint8_t*)(x))[2] << 16) | \
- (((uint8_t*)(x))[1] << 8) | \
- ((uint8_t*)(x))[0])
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* AVCODEC_H */
diff --git a/gst/ffmpegcolorspace/dsputil.c b/gst/ffmpegcolorspace/dsputil.c
deleted file mode 100644
index f5689c05..00000000
--- a/gst/ffmpegcolorspace/dsputil.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * DSP utils
- * Copyright (c) 2000, 2001 Fabrice Bellard.
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
- *
- * This library is free software; you can redistribute it 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * gmc & q-pel & 32/64 bit based MC by Michael Niedermayer <michaelni@gmx.at>
- */
-
-/**
- * @file dsputil.c
- * DSP utils
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-
-uint8_t cropTbl[256 + 2 * MAX_NEG_CROP] = { 0, };
-
-/* init static data */
-void
-dsputil_static_init (void)
-{
- int i;
-
- for (i = 0; i < 256; i++)
- cropTbl[i + MAX_NEG_CROP] = i;
- for (i = 0; i < MAX_NEG_CROP; i++) {
- cropTbl[i] = 0;
- cropTbl[i + MAX_NEG_CROP + 256] = 255;
- }
-}
diff --git a/gst/ffmpegcolorspace/dsputil.h b/gst/ffmpegcolorspace/dsputil.h
deleted file mode 100644
index 69475a3d..00000000
--- a/gst/ffmpegcolorspace/dsputil.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * DSP utils
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard.
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
- *
- * This library is free software; you can redistribute it 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/**
- * @file dsputil.h
- * DSP utils.
- * note, many functions in here may use MMX which trashes the FPU state, it is
- * absolutely necessary to call emms_c() between dsp & float/double code
- */
-
-#ifndef DSPUTIL_H
-#define DSPUTIL_H
-
-/* pixel operations */
-#define MAX_NEG_CROP 1024
-
-/* temporary */
-extern uint8_t cropTbl[256 + 2 * MAX_NEG_CROP];
-
-void dsputil_static_init(void);
-
-#endif
diff --git a/gst/ffmpegcolorspace/ffmpegcolorspace.vcproj b/gst/ffmpegcolorspace/ffmpegcolorspace.vcproj
deleted file mode 100644
index fc5e7c6a..00000000
--- a/gst/ffmpegcolorspace/ffmpegcolorspace.vcproj
+++ /dev/null
@@ -1,181 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="ffmpegcolorspace"
- ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D678B1}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../win32/Debug"
- IntermediateDirectory="../../win32/Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;ffmpegcolorspace_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstffmpegcolorspace.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Debug;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/ffmpegcolorspace.pdb"
- SubSystem="2"
- OptimizeReferences="2"
- ImportLibrary="$(OutDir)/gstffmpegcolorspace.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../win32/Release"
- IntermediateDirectory="../../win32/Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;ffmpegcolorspace_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstffmpegcolorspace.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Release;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/gstffmpegcolorspace.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath=".\gstffmpegcolorspace.c">
- </File>
- <File
- RelativePath=".\gstffmpeg.c">
- </File>
- <File
- RelativePath=".\gstffmpegcodecmap.c">
- </File>
- <File
- RelativePath=".\dsputil.c">
- </File>
- <File
- RelativePath=".\mem.c">
- </File>
- <File
- RelativePath=".\utils.c">
- </File>
- <File
- RelativePath=".\imgconvert.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- <File
- RelativePath=".\gstffmpegcodecmap.h">
- </File>
- <File
- RelativePath=".\imgconvert_template.h">
- </File>
- <File
- RelativePath=".\common.h">
- </File>
- <File
- RelativePath=".\dsputil.h">
- </File>
- <File
- RelativePath=".\mmx.h">
- </File>
- <File
- RelativePath=".\avcodec.h">
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/gst/ffmpegcolorspace/gstffmpeg.c b/gst/ffmpegcolorspace/gstffmpeg.c
deleted file mode 100644
index a8d9e037..00000000
--- a/gst/ffmpegcolorspace/gstffmpeg.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/* First, include the header file for the plugin, to bring in the
- * object definition and other useful things.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-#include "avcodec.h"
-
-extern gboolean gst_ffmpegcolorspace_register (GstPlugin * plugin);
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- avcodec_init ();
- gst_ffmpegcolorspace_register (plugin);
-
- /* Now we can return the pointer to the newly created Plugin object. */
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "ffmpegcolorspace",
- "colorspace conversion copied from FFMpeg " FFMPEG_VERSION,
- plugin_init, VERSION, "LGPL", "FFMpeg", "http://ffmpeg.sourceforge.net/")
diff --git a/gst/ffmpegcolorspace/gstffmpegcodecmap.c b/gst/ffmpegcolorspace/gstffmpegcodecmap.c
deleted file mode 100644
index 258090cf..00000000
--- a/gst/ffmpegcolorspace/gstffmpegcodecmap.c
+++ /dev/null
@@ -1,974 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * This file:
- * Copyright (c) 2002-2004 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include <gst/gst.h>
-
-#include "avcodec.h"
-#include "gstffmpegcodecmap.h"
-
-GST_DEBUG_CATEGORY_EXTERN (ffmpegcolorspace_debug);
-#define GST_CAT_DEFAULT ffmpegcolorspace_debug
-
-static GstCaps *
-gst_ff_vid_caps_new (AVCodecContext * context,
- const char *mimetype, const char *fieldname, ...)
- G_GNUC_NULL_TERMINATED;
- static GstCaps *gst_ff_aud_caps_new (AVCodecContext * context,
- const char *mimetype, const char *fieldname, ...) G_GNUC_NULL_TERMINATED;
-
-/*
- * Read a palette from a caps.
- */
-
- static void
- gst_ffmpeg_get_palette (const GstCaps * caps, AVCodecContext * context)
-{
- GstStructure *str = gst_caps_get_structure (caps, 0);
- const GValue *palette_v;
-
- /* do we have a palette? */
- if ((palette_v = gst_structure_get_value (str, "palette_data")) && context) {
- const GstBuffer *palette;
-
- palette = gst_value_get_buffer (palette_v);
- if (palette && GST_BUFFER_SIZE (palette) >= 256 * 4) {
- if (context->palctrl)
- av_free (context->palctrl);
- context->palctrl = av_malloc (sizeof (AVPaletteControl));
- context->palctrl->palette_changed = 1;
- memcpy (context->palctrl->palette, GST_BUFFER_DATA (palette),
- AVPALETTE_SIZE);
- }
- }
-}
-
-static void
-gst_ffmpeg_set_palette (GstCaps * caps, AVCodecContext * context)
-{
- if (context->palctrl) {
- GstBuffer *palette = gst_buffer_new_and_alloc (256 * 4);
-
- memcpy (GST_BUFFER_DATA (palette), context->palctrl->palette,
- AVPALETTE_SIZE);
- gst_caps_set_simple (caps, "palette_data", GST_TYPE_BUFFER, palette, NULL);
- gst_buffer_unref (palette);
- }
-}
-
-/* this function creates caps with fixed or unfixed width/height
- * properties depending on whether we've got a context.
- *
- * See below for why we use this.
- *
- * We should actually do this stuff at the end, like in riff-media.c,
- * but I'm too lazy today. Maybe later.
- */
-
-static GstCaps *
-gst_ff_vid_caps_new (AVCodecContext * context, const char *mimetype,
- const char *fieldname, ...)
-{
- GstStructure *structure = NULL;
- GstCaps *caps = NULL;
- va_list var_args;
-
- if (context != NULL) {
- caps = gst_caps_new_simple (mimetype,
- "width", G_TYPE_INT, context->width,
- "height", G_TYPE_INT, context->height,
- "framerate", GST_TYPE_FRACTION,
- (gint) context->frame_rate, (gint) context->frame_rate_base, NULL);
- } else {
- caps = gst_caps_new_simple (mimetype,
- "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
- "height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
- "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
- }
-
- structure = gst_caps_get_structure (caps, 0);
-
- if (structure) {
- va_start (var_args, fieldname);
- gst_structure_set_valist (structure, fieldname, var_args);
- va_end (var_args);
- }
-
- return caps;
-}
-
-/* same for audio - now with channels/sample rate
- */
-
-static GstCaps *
-gst_ff_aud_caps_new (AVCodecContext * context, const char *mimetype,
- const char *fieldname, ...)
-{
- GstCaps *caps = NULL;
- GstStructure *structure = NULL;
- va_list var_args;
-
- if (context != NULL) {
- caps = gst_caps_new_simple (mimetype,
- "rate", G_TYPE_INT, context->sample_rate,
- "channels", G_TYPE_INT, context->channels, NULL);
- } else {
- caps = gst_caps_new_simple (mimetype, NULL);
- }
-
- structure = gst_caps_get_structure (caps, 0);
-
- if (structure) {
- va_start (var_args, fieldname);
- gst_structure_set_valist (structure, fieldname, var_args);
- va_end (var_args);
- }
-
- return caps;
-}
-
-/* Convert a FFMPEG Pixel Format and optional AVCodecContext
- * to a GstCaps. If the context is ommitted, no fixed values
- * for video/audio size will be included in the GstCaps
- *
- * See below for usefulness
- */
-
-static GstCaps *
-gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context)
-{
- GstCaps *caps = NULL;
-
- int bpp = 0, depth = 0, endianness = 0;
- gulong g_mask = 0, r_mask = 0, b_mask = 0, a_mask = 0;
- guint32 fmt = 0;
-
- switch (pix_fmt) {
- case PIX_FMT_YUV420P:
- fmt = GST_MAKE_FOURCC ('I', '4', '2', '0');
- break;
- case PIX_FMT_NV12:
- fmt = GST_MAKE_FOURCC ('N', 'V', '1', '2');
- break;
- case PIX_FMT_NV21:
- fmt = GST_MAKE_FOURCC ('N', 'V', '2', '1');
- break;
- case PIX_FMT_YVU420P:
- fmt = GST_MAKE_FOURCC ('Y', 'V', '1', '2');
- break;
- case PIX_FMT_YUV422:
- fmt = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2');
- break;
- case PIX_FMT_UYVY422:
- fmt = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y');
- break;
- case PIX_FMT_YVYU422:
- fmt = GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U');
- break;
- case PIX_FMT_UYVY411:
- fmt = GST_MAKE_FOURCC ('I', 'Y', 'U', '1');
- break;
- case PIX_FMT_RGB24:
- bpp = depth = 24;
- endianness = G_BIG_ENDIAN;
- r_mask = 0xff0000;
- g_mask = 0x00ff00;
- b_mask = 0x0000ff;
- break;
- case PIX_FMT_BGR24:
- bpp = depth = 24;
- endianness = G_BIG_ENDIAN;
- r_mask = 0x0000ff;
- g_mask = 0x00ff00;
- b_mask = 0xff0000;
- break;
- case PIX_FMT_YUV422P:
- fmt = GST_MAKE_FOURCC ('Y', '4', '2', 'B');
- break;
- case PIX_FMT_YUV444P:
- fmt = GST_MAKE_FOURCC ('Y', '4', '4', '4');
- break;
- case PIX_FMT_RGB32:
- bpp = 32;
- depth = 24;
- endianness = G_BIG_ENDIAN;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- r_mask = 0x00ff0000;
- g_mask = 0x0000ff00;
- b_mask = 0x000000ff;
-#else
- r_mask = 0x0000ff00;
- g_mask = 0x00ff0000;
- b_mask = 0xff000000;
-#endif
- break;
- case PIX_FMT_BGR32:
- bpp = 32;
- depth = 24;
- endianness = G_BIG_ENDIAN;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- r_mask = 0x0000ff00;
- g_mask = 0x00ff0000;
- b_mask = 0xff000000;
-#else
- r_mask = 0x00ff0000;
- g_mask = 0x0000ff00;
- b_mask = 0x000000ff;
-#endif
- break;
- case PIX_FMT_xRGB32:
- bpp = 32;
- depth = 24;
- endianness = G_BIG_ENDIAN;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- r_mask = 0xff000000;
- g_mask = 0x00ff0000;
- b_mask = 0x0000ff00;
-#else
- r_mask = 0x000000ff;
- g_mask = 0x0000ff00;
- b_mask = 0x00ff0000;
-#endif
- break;
- case PIX_FMT_BGRx32:
- bpp = 32;
- depth = 24;
- endianness = G_BIG_ENDIAN;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- r_mask = 0x000000ff;
- g_mask = 0x0000ff00;
- b_mask = 0x00ff0000;
-#else
- r_mask = 0xff000000;
- g_mask = 0x00ff0000;
- b_mask = 0x0000ff00;
-#endif
- break;
- case PIX_FMT_RGBA32:
- bpp = 32;
- depth = 32;
- endianness = G_BIG_ENDIAN;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- r_mask = 0x00ff0000;
- g_mask = 0x0000ff00;
- b_mask = 0x000000ff;
- a_mask = 0xff000000;
-#else
- r_mask = 0x0000ff00;
- g_mask = 0x00ff0000;
- b_mask = 0xff000000;
- a_mask = 0x000000ff;
-#endif
- break;
- case PIX_FMT_BGRA32:
- bpp = 32;
- depth = 32;
- endianness = G_BIG_ENDIAN;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- r_mask = 0x0000ff00;
- g_mask = 0x00ff0000;
- b_mask = 0xff000000;
- a_mask = 0x000000ff;
-#else
- r_mask = 0x00ff0000;
- g_mask = 0x0000ff00;
- b_mask = 0x000000ff;
- a_mask = 0xff000000;
-#endif
- break;
- case PIX_FMT_ARGB32:
- bpp = 32;
- depth = 32;
- endianness = G_BIG_ENDIAN;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- r_mask = 0xff000000;
- g_mask = 0x00ff0000;
- b_mask = 0x0000ff00;
- a_mask = 0x000000ff;
-#else
- r_mask = 0x000000ff;
- g_mask = 0x0000ff00;
- b_mask = 0x00ff0000;
- a_mask = 0xff000000;
-#endif
- break;
- case PIX_FMT_ABGR32:
- bpp = 32;
- depth = 32;
- endianness = G_BIG_ENDIAN;
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- r_mask = 0x000000ff;
- g_mask = 0x0000ff00;
- b_mask = 0x00ff0000;
- a_mask = 0xff000000;
-#else
- r_mask = 0xff000000;
- g_mask = 0x00ff0000;
- b_mask = 0x0000ff00;
- a_mask = 0x000000ff;
-#endif
- break;
- case PIX_FMT_YUV410P:
- fmt = GST_MAKE_FOURCC ('Y', 'U', 'V', '9');
- break;
- case PIX_FMT_YVU410P:
- fmt = GST_MAKE_FOURCC ('Y', 'V', 'U', '9');
- break;
- case PIX_FMT_YUV411P:
- fmt = GST_MAKE_FOURCC ('Y', '4', '1', 'B');
- break;
- case PIX_FMT_RGB565:
- bpp = depth = 16;
- endianness = G_BYTE_ORDER;
- r_mask = 0xf800;
- g_mask = 0x07e0;
- b_mask = 0x001f;
- break;
- case PIX_FMT_RGB555:
- bpp = 16;
- depth = 15;
- endianness = G_BYTE_ORDER;
- r_mask = 0x7c00;
- g_mask = 0x03e0;
- b_mask = 0x001f;
- break;
- case PIX_FMT_PAL8:
- bpp = depth = 8;
- endianness = G_BYTE_ORDER;
- break;
- case PIX_FMT_V308:
- fmt = GST_MAKE_FOURCC ('v', '3', '0', '8');
- break;
- case PIX_FMT_AYUV4444:
- fmt = GST_MAKE_FOURCC ('A', 'Y', 'U', 'V');
- break;
- case PIX_FMT_GRAY8:{
- GstCaps *tmp;
-
- bpp = depth = 8;
- caps = gst_ff_vid_caps_new (context, "video/x-raw-gray",
- "bpp", G_TYPE_INT, bpp, "depth", G_TYPE_INT, depth, NULL);
- tmp = gst_ff_vid_caps_new (context, "video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('Y', '8', '0', '0'),
- NULL);
- gst_caps_append (caps, tmp);
- }
- break;
- case PIX_FMT_GRAY16_L:
- bpp = depth = 16;
- caps = gst_ff_vid_caps_new (context, "video/x-raw-gray",
- "bpp", G_TYPE_INT, bpp, "depth", G_TYPE_INT, depth,
- "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL);
- break;
- case PIX_FMT_GRAY16_B:
- bpp = depth = 16;
- caps = gst_ff_vid_caps_new (context, "video/x-raw-gray",
- "bpp", G_TYPE_INT, bpp, "depth", G_TYPE_INT, depth,
- "endianness", G_TYPE_INT, G_BIG_ENDIAN, NULL);
- break;
- default:
- /* give up ... */
- break;
- }
-
- if (caps == NULL) {
- if (bpp != 0) {
- if (a_mask != 0) {
- caps = gst_ff_vid_caps_new (context, "video/x-raw-rgb",
- "bpp", G_TYPE_INT, bpp,
- "depth", G_TYPE_INT, depth,
- "red_mask", G_TYPE_INT, r_mask,
- "green_mask", G_TYPE_INT, g_mask,
- "blue_mask", G_TYPE_INT, b_mask,
- "alpha_mask", G_TYPE_INT, a_mask,
- "endianness", G_TYPE_INT, endianness, NULL);
- } else if (r_mask != 0) {
- caps = gst_ff_vid_caps_new (context, "video/x-raw-rgb",
- "bpp", G_TYPE_INT, bpp,
- "depth", G_TYPE_INT, depth,
- "red_mask", G_TYPE_INT, r_mask,
- "green_mask", G_TYPE_INT, g_mask,
- "blue_mask", G_TYPE_INT, b_mask,
- "endianness", G_TYPE_INT, endianness, NULL);
- } else {
- caps = gst_ff_vid_caps_new (context, "video/x-raw-rgb",
- "bpp", G_TYPE_INT, bpp,
- "depth", G_TYPE_INT, depth,
- "endianness", G_TYPE_INT, endianness, NULL);
- if (context && context->pix_fmt == PIX_FMT_PAL8) {
- gst_ffmpeg_set_palette (caps, context);
- }
- }
- } else if (fmt) {
- caps = gst_ff_vid_caps_new (context, "video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, fmt, NULL);
- }
- }
-
- if (caps != NULL) {
- GST_DEBUG ("caps for pix_fmt=%d: %" GST_PTR_FORMAT, pix_fmt, caps);
- } else {
- GST_LOG ("No caps found for pix_fmt=%d", pix_fmt);
- }
-
- return caps;
-}
-
-/* Convert a FFMPEG Sample Format and optional AVCodecContext
- * to a GstCaps. If the context is ommitted, no fixed values
- * for video/audio size will be included in the GstCaps
- *
- * See below for usefulness
- */
-
-static GstCaps *
-gst_ffmpeg_smpfmt_to_caps (enum SampleFormat sample_fmt,
- AVCodecContext * context)
-{
- GstCaps *caps = NULL;
-
- int bpp = 0;
- gboolean signedness = FALSE;
-
- switch (sample_fmt) {
- case SAMPLE_FMT_S16:
- signedness = TRUE;
- bpp = 16;
- break;
-
- default:
- /* .. */
- break;
- }
-
- if (bpp) {
- caps = gst_ff_aud_caps_new (context, "audio/x-raw-int",
- "signed", G_TYPE_BOOLEAN, signedness,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "width", G_TYPE_INT, bpp, "depth", G_TYPE_INT, bpp, NULL);
- }
-
- if (caps != NULL) {
- GST_DEBUG ("caps for sample_fmt=%d: %" GST_PTR_FORMAT, sample_fmt, caps);
- } else {
- GST_LOG ("No caps found for sample_fmt=%d", sample_fmt);
- }
-
- return caps;
-}
-
-/* Convert a FFMPEG codec Type and optional AVCodecContext
- * to a GstCaps. If the context is ommitted, no fixed values
- * for video/audio size will be included in the GstCaps
- *
- * CodecType is primarily meant for uncompressed data GstCaps!
- */
-
-GstCaps *
-gst_ffmpegcsp_codectype_to_caps (enum CodecType codec_type,
- AVCodecContext * context)
-{
- GstCaps *caps;
-
- switch (codec_type) {
- case CODEC_TYPE_VIDEO:
- if (context) {
- caps = gst_ffmpeg_pixfmt_to_caps (context->pix_fmt,
- context->width == -1 ? NULL : context);
- } else {
- GstCaps *temp;
- enum PixelFormat i;
-
- caps = gst_caps_new_empty ();
- for (i = 0; i < PIX_FMT_NB; i++) {
- temp = gst_ffmpeg_pixfmt_to_caps (i, NULL);
- if (temp != NULL) {
- gst_caps_append (caps, temp);
- }
- }
- }
- break;
-
- case CODEC_TYPE_AUDIO:
- if (context) {
- caps = gst_ffmpeg_smpfmt_to_caps (context->sample_fmt, context);
- } else {
- GstCaps *temp;
- enum SampleFormat i;
-
- caps = gst_caps_new_empty ();
- for (i = 0; i <= SAMPLE_FMT_S16; i++) {
- temp = gst_ffmpeg_smpfmt_to_caps (i, NULL);
- if (temp != NULL) {
- gst_caps_append (caps, temp);
- }
- }
- }
- break;
-
- default:
- /* .. */
- caps = NULL;
- break;
- }
-
- return caps;
-}
-
-/* Convert a GstCaps (audio/raw) to a FFMPEG SampleFmt
- * and other audio properties in a AVCodecContext.
- *
- * For usefulness, see below
- */
-
-static void
-gst_ffmpeg_caps_to_smpfmt (const GstCaps * caps,
- AVCodecContext * context, gboolean raw)
-{
- GstStructure *structure;
- gint depth = 0, width = 0, endianness = 0;
- gboolean signedness = FALSE;
-
- g_return_if_fail (gst_caps_get_size (caps) == 1);
- structure = gst_caps_get_structure (caps, 0);
-
- gst_structure_get_int (structure, "channels", &context->channels);
- gst_structure_get_int (structure, "rate", &context->sample_rate);
-
- if (!raw)
- return;
-
- if (gst_structure_get_int (structure, "width", &width) &&
- gst_structure_get_int (structure, "depth", &depth) &&
- gst_structure_get_boolean (structure, "signed", &signedness) &&
- gst_structure_get_int (structure, "endianness", &endianness)) {
- if (width == 16 && depth == 16 &&
- endianness == G_BYTE_ORDER && signedness == TRUE) {
- context->sample_fmt = SAMPLE_FMT_S16;
- }
- }
-}
-
-
-/* Convert a GstCaps (video/raw) to a FFMPEG PixFmt
- * and other video properties in a AVCodecContext.
- *
- * For usefulness, see below
- */
-
-static void
-gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps,
- AVCodecContext * context, gboolean raw)
-{
- GstStructure *structure;
- const GValue *fps;
- gboolean ret;
-
- g_return_if_fail (gst_caps_get_size (caps) == 1);
- structure = gst_caps_get_structure (caps, 0);
-
- ret = gst_structure_get_int (structure, "width", &context->width);
- ret &= gst_structure_get_int (structure, "height", &context->height);
- g_return_if_fail (ret == TRUE);
-
- fps = gst_structure_get_value (structure, "framerate");
- g_return_if_fail (GST_VALUE_HOLDS_FRACTION (fps));
-
- /* framerate does not really matter */
- context->frame_rate = gst_value_get_fraction_numerator (fps);
- context->frame_rate_base = gst_value_get_fraction_denominator (fps);
-
- if (!raw)
- return;
-
- if (gst_structure_has_name (structure, "video/x-raw-yuv")) {
- guint32 fourcc;
-
- if (gst_structure_get_fourcc (structure, "format", &fourcc)) {
- switch (fourcc) {
- case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
- context->pix_fmt = PIX_FMT_YUV422;
- break;
- case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
- context->pix_fmt = PIX_FMT_UYVY422;
- break;
- case GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'):
- context->pix_fmt = PIX_FMT_YVYU422;
- break;
- case GST_MAKE_FOURCC ('I', 'Y', 'U', '1'):
- context->pix_fmt = PIX_FMT_UYVY411;
- break;
- case GST_MAKE_FOURCC ('I', '4', '2', '0'):
- context->pix_fmt = PIX_FMT_YUV420P;
- break;
- case GST_MAKE_FOURCC ('N', 'V', '1', '2'):
- context->pix_fmt = PIX_FMT_NV12;
- break;
- case GST_MAKE_FOURCC ('N', 'V', '2', '1'):
- context->pix_fmt = PIX_FMT_NV21;
- break;
- case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
- context->pix_fmt = PIX_FMT_YVU420P;
- break;
- case GST_MAKE_FOURCC ('Y', '4', '1', 'B'):
- context->pix_fmt = PIX_FMT_YUV411P;
- break;
- case GST_MAKE_FOURCC ('Y', '4', '2', 'B'):
- context->pix_fmt = PIX_FMT_YUV422P;
- break;
- case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'):
- context->pix_fmt = PIX_FMT_YUV410P;
- break;
- case GST_MAKE_FOURCC ('Y', 'V', 'U', '9'):
- context->pix_fmt = PIX_FMT_YVU410P;
- break;
- case GST_MAKE_FOURCC ('v', '3', '0', '8'):
- context->pix_fmt = PIX_FMT_V308;
- break;
- case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'):
- context->pix_fmt = PIX_FMT_AYUV4444;
- break;
- case GST_MAKE_FOURCC ('Y', '4', '4', '4'):
- context->pix_fmt = PIX_FMT_YUV444P;
- break;
- case GST_MAKE_FOURCC ('Y', '8', '0', '0'):
- context->pix_fmt = PIX_FMT_GRAY8;
- break;
- }
- }
- } else if (gst_structure_has_name (structure, "video/x-raw-rgb")) {
- gint bpp = 0, rmask = 0, endianness = 0, amask = 0, depth = 0;
-
- if (gst_structure_get_int (structure, "bpp", &bpp) &&
- gst_structure_get_int (structure, "endianness", &endianness)) {
- if (gst_structure_get_int (structure, "red_mask", &rmask)) {
- switch (bpp) {
- case 32:
- if (gst_structure_get_int (structure, "alpha_mask", &amask)) {
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- if (rmask == 0x0000ff00)
- context->pix_fmt = PIX_FMT_BGRA32;
- else if (rmask == 0x00ff0000)
- context->pix_fmt = PIX_FMT_RGBA32;
- else if (rmask == 0xff000000)
- context->pix_fmt = PIX_FMT_ARGB32;
- else // if (r_mask = 0x000000ff)
- context->pix_fmt = PIX_FMT_ABGR32;
-#else
- if (rmask == 0x00ff0000)
- context->pix_fmt = PIX_FMT_BGRA32;
- else if (rmask == 0x0000ff00)
- context->pix_fmt = PIX_FMT_RGBA32;
- else if (rmask == 0x000000ff)
- context->pix_fmt = PIX_FMT_ARGB32;
- else // if (rmask == 0xff000000)
- context->pix_fmt = PIX_FMT_ABGR32;
-#endif
- } else {
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- if (rmask == 0x00ff0000)
- context->pix_fmt = PIX_FMT_RGB32;
- else if (rmask == 0x0000ff00)
- context->pix_fmt = PIX_FMT_BGR32;
- else if (rmask == 0xff000000)
- context->pix_fmt = PIX_FMT_xRGB32;
- else // if (rmask == 0x000000ff)
- context->pix_fmt = PIX_FMT_BGRx32;
-#else
- if (rmask == 0x0000ff00)
- context->pix_fmt = PIX_FMT_RGB32;
- else if (rmask == 0x00ff0000)
- context->pix_fmt = PIX_FMT_BGR32;
- else if (rmask == 0x000000ff)
- context->pix_fmt = PIX_FMT_xRGB32;
- else // if (rmask == 0xff000000)
- context->pix_fmt = PIX_FMT_BGRx32;
-#endif
- }
- break;
- case 24:
- if (rmask == 0x0000FF)
- context->pix_fmt = PIX_FMT_BGR24;
- else
- context->pix_fmt = PIX_FMT_RGB24;
- break;
- case 16:
- if (endianness == G_BYTE_ORDER) {
- context->pix_fmt = PIX_FMT_RGB565;
- if (gst_structure_get_int (structure, "depth", &depth)) {
- if (depth == 15)
- context->pix_fmt = PIX_FMT_RGB555;
- }
- }
- break;
- case 15:
- if (endianness == G_BYTE_ORDER)
- context->pix_fmt = PIX_FMT_RGB555;
- break;
- default:
- /* nothing */
- break;
- }
- } else {
- if (bpp == 8) {
- context->pix_fmt = PIX_FMT_PAL8;
- gst_ffmpeg_get_palette (caps, context);
- }
- }
- }
- } else if (gst_structure_has_name (structure, "video/x-raw-gray")) {
- gint bpp = 0;
-
- if (gst_structure_get_int (structure, "bpp", &bpp)) {
- switch (bpp) {
- case 8:
- context->pix_fmt = PIX_FMT_GRAY8;
- break;
- case 16:{
- gint endianness = 0;
-
- if (gst_structure_get_int (structure, "endianness", &endianness)) {
- if (endianness == G_LITTLE_ENDIAN)
- context->pix_fmt = PIX_FMT_GRAY16_L;
- else if (endianness == G_BIG_ENDIAN)
- context->pix_fmt = PIX_FMT_GRAY16_B;
- }
- }
- break;
- }
- }
- }
-}
-
-/* Convert a GstCaps and a FFMPEG codec Type to a
- * AVCodecContext. If the context is ommitted, no fixed values
- * for video/audio size will be included in the context
- *
- * CodecType is primarily meant for uncompressed data GstCaps!
- */
-
-void
-gst_ffmpegcsp_caps_with_codectype (enum CodecType type,
- const GstCaps * caps, AVCodecContext * context)
-{
- if (context == NULL)
- return;
-
- switch (type) {
- case CODEC_TYPE_VIDEO:
- gst_ffmpeg_caps_to_pixfmt (caps, context, TRUE);
- break;
-
- case CODEC_TYPE_AUDIO:
- gst_ffmpeg_caps_to_smpfmt (caps, context, TRUE);
- break;
-
- default:
- /* unknown */
- break;
- }
-}
-
-#define GEN_MASK(x) ((1<<(x))-1)
-#define ROUND_UP_X(v,x) (((v) + GEN_MASK(x)) & ~GEN_MASK(x))
-#define DIV_ROUND_UP_X(v,x) (((v) + GEN_MASK(x)) >> (x))
-
-/*
- * Fill in pointers to memory in a AVPicture, where
- * everything is aligned by 4 (as required by X).
- * This is mostly a copy from imgconvert.c with some
- * small changes.
- */
-int
-gst_ffmpegcsp_avpicture_fill (AVPicture * picture,
- uint8_t * ptr, enum PixelFormat pix_fmt, int width, int height,
- int interlaced)
-{
- int size, w2, h2, size2;
- int stride, stride2;
- PixFmtInfo *pinfo;
-
- pinfo = get_pix_fmt_info (pix_fmt);
-
- picture->interlaced = interlaced;
-
- switch (pix_fmt) {
- case PIX_FMT_YUV420P:
- case PIX_FMT_YUV422P:
- case PIX_FMT_YUV444P:
- case PIX_FMT_YUV410P:
- case PIX_FMT_YUV411P:
- case PIX_FMT_YUVJ420P:
- case PIX_FMT_YUVJ422P:
- case PIX_FMT_YUVJ444P:
- stride = GST_ROUND_UP_4 (width);
- h2 = ROUND_UP_X (height, pinfo->y_chroma_shift);
- size = stride * h2;
- w2 = DIV_ROUND_UP_X (width, pinfo->x_chroma_shift);
- stride2 = GST_ROUND_UP_4 (w2);
- h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift);
- size2 = stride2 * h2;
- picture->data[0] = ptr;
- picture->data[1] = picture->data[0] + size;
- picture->data[2] = picture->data[1] + size2;
- picture->linesize[0] = stride;
- picture->linesize[1] = stride2;
- picture->linesize[2] = stride2;
- return size + 2 * size2;
- /* PIX_FMT_YVU420P = YV12: same as PIX_FMT_YUV420P, but
- * with U and V plane swapped. Strides as in videotestsrc */
- case PIX_FMT_YVU410P:
- case PIX_FMT_YVU420P:
- stride = GST_ROUND_UP_4 (width);
- h2 = ROUND_UP_X (height, pinfo->y_chroma_shift);
- size = stride * h2;
- w2 = DIV_ROUND_UP_X (width, pinfo->x_chroma_shift);
- stride2 = GST_ROUND_UP_4 (w2);
- h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift);
- size2 = stride2 * h2;
- picture->data[0] = ptr;
- picture->data[2] = picture->data[0] + size;
- picture->data[1] = picture->data[2] + size2;
- picture->linesize[0] = stride;
- picture->linesize[1] = stride2;
- picture->linesize[2] = stride2;
- return size + 2 * size2;
- case PIX_FMT_NV12:
- case PIX_FMT_NV21:
- stride = GST_ROUND_UP_4 (width);
- h2 = ROUND_UP_X (height, pinfo->y_chroma_shift);
- size = stride * h2;
- w2 = 2 * DIV_ROUND_UP_X (width, pinfo->x_chroma_shift);
- stride2 = GST_ROUND_UP_4 (w2);
- h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift);
- size2 = stride2 * h2;
- picture->data[0] = ptr;
- picture->data[1] = picture->data[0] + size;
- picture->data[2] = NULL;
- picture->linesize[0] = stride;
- picture->linesize[1] = stride2;
- picture->linesize[2] = 0;
- return size + size2;
- case PIX_FMT_RGB24:
- case PIX_FMT_BGR24:
- stride = GST_ROUND_UP_4 (width * 3);
- size = stride * height;
- picture->data[0] = ptr;
- picture->data[1] = NULL;
- picture->data[2] = NULL;
- picture->linesize[0] = stride;
- return size;
- case PIX_FMT_AYUV4444:
- case PIX_FMT_RGB32:
- case PIX_FMT_RGBA32:
- case PIX_FMT_ARGB32:
- case PIX_FMT_BGR32:
- case PIX_FMT_BGRA32:
- case PIX_FMT_ABGR32:
- case PIX_FMT_xRGB32:
- case PIX_FMT_BGRx32:
- stride = width * 4;
- size = stride * height;
- picture->data[0] = ptr;
- picture->data[1] = NULL;
- picture->data[2] = NULL;
- picture->linesize[0] = stride;
- return size;
- case PIX_FMT_RGB555:
- case PIX_FMT_RGB565:
- case PIX_FMT_YUV422:
- case PIX_FMT_UYVY422:
- case PIX_FMT_YVYU422:
- stride = GST_ROUND_UP_4 (width * 2);
- size = stride * height;
- picture->data[0] = ptr;
- picture->data[1] = NULL;
- picture->data[2] = NULL;
- picture->linesize[0] = stride;
- return size;
- case PIX_FMT_V308:
- stride = GST_ROUND_UP_4 (width * 3);
- size = stride * height;
- picture->data[0] = ptr;
- picture->data[1] = NULL;
- picture->data[2] = NULL;
- picture->linesize[0] = stride;
- return size;
- case PIX_FMT_UYVY411:
- /* FIXME, probably not the right stride */
- stride = GST_ROUND_UP_4 (width);
- size = stride * height;
- picture->data[0] = ptr;
- picture->data[1] = NULL;
- picture->data[2] = NULL;
- picture->linesize[0] = width + width / 2;
- return size + size / 2;
- case PIX_FMT_GRAY8:
- stride = GST_ROUND_UP_4 (width);
- size = stride * height;
- picture->data[0] = ptr;
- picture->data[1] = NULL;
- picture->data[2] = NULL;
- picture->linesize[0] = stride;
- return size;
- case PIX_FMT_GRAY16_L:
- case PIX_FMT_GRAY16_B:
- stride = GST_ROUND_UP_4 (width * 2);
- size = stride * height;
- picture->data[0] = ptr;
- picture->data[1] = NULL;
- picture->data[2] = NULL;
- picture->linesize[0] = stride;
- return size;
- case PIX_FMT_MONOWHITE:
- case PIX_FMT_MONOBLACK:
- stride = GST_ROUND_UP_4 ((width + 7) >> 3);
- size = stride * height;
- picture->data[0] = ptr;
- picture->data[1] = NULL;
- picture->data[2] = NULL;
- picture->linesize[0] = stride;
- return size;
- case PIX_FMT_PAL8:
- /* already forced to be with stride, so same result as other function */
- stride = GST_ROUND_UP_4 (width);
- size = stride * height;
- picture->data[0] = ptr;
- picture->data[1] = ptr + size; /* palette is stored here as 256 32 bit words */
- picture->data[2] = NULL;
- picture->linesize[0] = stride;
- picture->linesize[1] = 4;
- return size + 256 * 4;
- default:
- picture->data[0] = NULL;
- picture->data[1] = NULL;
- picture->data[2] = NULL;
- picture->data[3] = NULL;
- return -1;
- }
-
- return 0;
-}
diff --git a/gst/ffmpegcolorspace/gstffmpegcodecmap.h b/gst/ffmpegcolorspace/gstffmpegcodecmap.h
deleted file mode 100644
index 515f530b..00000000
--- a/gst/ffmpegcolorspace/gstffmpegcodecmap.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_FFMPEG_CODECMAP_H__
-#define __GST_FFMPEG_CODECMAP_H__
-
-#include <avcodec.h>
-#include <gst/gst.h>
-
-/*
- * _codectype_to_caps () gets the GstCaps that belongs to
- * a certain CodecType for a pad with uncompressed data.
- */
-
-GstCaps *
-gst_ffmpegcsp_codectype_to_caps (enum CodecType codec_type,
- AVCodecContext *context);
-
-/*
- * caps_with_codectype () transforms a GstCaps that belongs to
- * a pad for uncompressed data to a filled-in context.
- */
-
-void
-gst_ffmpegcsp_caps_with_codectype (enum CodecType type,
- const GstCaps *caps,
- AVCodecContext *context);
-
-/*
- * Fill in pointers in an AVPicture, aligned by 4 (required by X).
- */
-
-int
-gst_ffmpegcsp_avpicture_fill (AVPicture * picture,
- uint8_t * ptr,
- enum PixelFormat pix_fmt,
- int width,
- int height,
- int interlaced);
-
-#endif /* __GST_FFMPEG_CODECMAP_H__ */
-
diff --git a/gst/ffmpegcolorspace/gstffmpegcolorspace.c b/gst/ffmpegcolorspace/gstffmpegcolorspace.c
deleted file mode 100644
index 714b01fe..00000000
--- a/gst/ffmpegcolorspace/gstffmpegcolorspace.c
+++ /dev/null
@@ -1,571 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * This file:
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-ffmpegcolorspace
- *
- * Convert video frames between a great variety of colorspace formats.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch -v videotestsrc ! video/x-raw-yuv,format=\(fourcc\)YUY2 ! ffmpegcolorspace ! ximagesink
- * ]|
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "gstffmpegcolorspace.h"
-#include "gstffmpegcodecmap.h"
-
-GST_DEBUG_CATEGORY (ffmpegcolorspace_debug);
-#define GST_CAT_DEFAULT ffmpegcolorspace_debug
-GST_DEBUG_CATEGORY (ffmpegcolorspace_performance);
-
-/* elementfactory information */
-static const GstElementDetails ffmpegcsp_details =
-GST_ELEMENT_DETAILS ("FFMPEG Colorspace converter",
- "Filter/Converter/Video",
- "Converts video from one colorspace to another",
- "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
-
-
-/* Stereo signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- ARG_0,
-};
-
-static GType gst_ffmpegcsp_get_type (void);
-
-static void gst_ffmpegcsp_base_init (GstFFMpegCspClass * klass);
-static void gst_ffmpegcsp_class_init (GstFFMpegCspClass * klass);
-static void gst_ffmpegcsp_init (GstFFMpegCsp * space);
-
-static gboolean gst_ffmpegcsp_set_caps (GstBaseTransform * btrans,
- GstCaps * incaps, GstCaps * outcaps);
-static gboolean gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans,
- GstCaps * caps, guint * size);
-static GstFlowReturn gst_ffmpegcsp_transform (GstBaseTransform * btrans,
- GstBuffer * inbuf, GstBuffer * outbuf);
-#if 0
-static GstFlowReturn gst_ffmpegcsp_transform_ip (GstBaseTransform * btrans,
- GstBuffer * inbuf);
-#endif
-
-static GstPadTemplate *sinktempl, *srctempl;
-static GstElementClass *parent_class = NULL;
-
-/*static guint gst_ffmpegcsp_signals[LAST_SIGNAL] = { 0 }; */
-
-/* copies the given caps */
-static GstCaps *
-gst_ffmpegcsp_caps_remove_format_info (GstCaps * caps)
-{
- int i;
- GstStructure *structure;
- GstCaps *rgbcaps;
- GstCaps *graycaps;
-
- caps = gst_caps_copy (caps);
-
- for (i = 0; i < gst_caps_get_size (caps); i++) {
- structure = gst_caps_get_structure (caps, i);
-
- gst_structure_set_name (structure, "video/x-raw-yuv");
- gst_structure_remove_field (structure, "format");
- gst_structure_remove_field (structure, "endianness");
- gst_structure_remove_field (structure, "depth");
- gst_structure_remove_field (structure, "bpp");
- gst_structure_remove_field (structure, "red_mask");
- gst_structure_remove_field (structure, "green_mask");
- gst_structure_remove_field (structure, "blue_mask");
- gst_structure_remove_field (structure, "alpha_mask");
- gst_structure_remove_field (structure, "palette_data");
- }
-
- gst_caps_do_simplify (caps);
- rgbcaps = gst_caps_copy (caps);
-
- for (i = 0; i < gst_caps_get_size (rgbcaps); i++) {
- structure = gst_caps_get_structure (rgbcaps, i);
-
- gst_structure_set_name (structure, "video/x-raw-rgb");
- }
- graycaps = gst_caps_copy (caps);
-
- for (i = 0; i < gst_caps_get_size (graycaps); i++) {
- structure = gst_caps_get_structure (graycaps, i);
-
- gst_structure_set_name (structure, "video/x-raw-gray");
- }
-
- gst_caps_append (caps, graycaps);
- gst_caps_append (caps, rgbcaps);
-
- return caps;
-}
-
-
-static gboolean
-gst_ffmpegcsp_structure_is_alpha (GstStructure * s)
-{
- const gchar *name;
-
- name = gst_structure_get_name (s);
-
- if (g_str_equal (name, "video/x-raw-rgb")) {
- return gst_structure_has_field (s, "alpha_mask");
- } else if (g_str_equal (name, "video/x-raw-yuv")) {
- guint32 fourcc;
-
- if (!gst_structure_get_fourcc (s, "format", &fourcc))
- return FALSE;
-
- return (fourcc == GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'));
- }
-
- return FALSE;
-}
-
-/* The caps can be transformed into any other caps with format info removed.
- * However, we should prefer passthrough, so if passthrough is possible,
- * put it first in the list. */
-static GstCaps *
-gst_ffmpegcsp_transform_caps (GstBaseTransform * btrans,
- GstPadDirection direction, GstCaps * caps)
-{
- GstCaps *template;
- GstCaps *tmp, *tmp2;
- GstCaps *result;
- guint i, n;
- gboolean is_alpha;
- GstStructure *s;
- GstCaps *alpha, *non_alpha;
-
- s = gst_caps_get_structure (caps, 0);
- is_alpha = gst_ffmpegcsp_structure_is_alpha (s);
-
- template = gst_ffmpegcsp_codectype_to_caps (CODEC_TYPE_VIDEO, NULL);
- result = gst_caps_intersect (caps, template);
-
- /* Get all possible caps that we can transform to */
- tmp = gst_ffmpegcsp_caps_remove_format_info (caps);
- tmp2 = gst_caps_intersect (tmp, template);
- gst_caps_unref (template);
- gst_caps_unref (tmp);
- tmp = tmp2;
-
- /* Now move alpha formats to the beginning if caps is an alpha format
- * or at the end if caps is no alpha format */
- n = gst_caps_get_size (tmp);
-
- alpha = gst_caps_new_empty ();
- non_alpha = gst_caps_new_empty ();
-
- for (i = 0; i < n; i++) {
- s = gst_caps_get_structure (tmp, i);
-
- if (gst_ffmpegcsp_structure_is_alpha (s))
- gst_caps_append_structure (alpha, gst_structure_copy (s));
- else
- gst_caps_append_structure (non_alpha, gst_structure_copy (s));
- }
-
- s = gst_caps_get_structure (caps, 0);
- gst_caps_unref (tmp);
-
- if (gst_ffmpegcsp_structure_is_alpha (s)) {
- gst_caps_append (alpha, non_alpha);
- tmp = alpha;
- } else {
- gst_caps_append (non_alpha, alpha);
- tmp = non_alpha;
- }
-
- gst_caps_append (result, tmp);
-
- GST_DEBUG_OBJECT (btrans, "transformed %" GST_PTR_FORMAT " into %"
- GST_PTR_FORMAT, caps, result);
-
- return result;
-}
-
-static gboolean
-gst_ffmpegcsp_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
- GstCaps * outcaps)
-{
- GstFFMpegCsp *space;
- GstStructure *structure;
- gint in_height, in_width;
- gint out_height, out_width;
- const GValue *in_framerate = NULL;
- const GValue *out_framerate = NULL;
- const GValue *in_par = NULL;
- const GValue *out_par = NULL;
- AVCodecContext *ctx;
- gboolean res;
-
- space = GST_FFMPEGCSP (btrans);
-
- /* parse in and output values */
- structure = gst_caps_get_structure (incaps, 0);
-
- /* we have to have width and height */
- res = gst_structure_get_int (structure, "width", &in_width);
- res &= gst_structure_get_int (structure, "height", &in_height);
- if (!res)
- goto no_width_height;
-
- /* and framerate */
- in_framerate = gst_structure_get_value (structure, "framerate");
- if (in_framerate == NULL || !GST_VALUE_HOLDS_FRACTION (in_framerate))
- goto no_framerate;
-
- /* this is optional */
- in_par = gst_structure_get_value (structure, "pixel-aspect-ratio");
-
- structure = gst_caps_get_structure (outcaps, 0);
-
- /* we have to have width and height */
- res = gst_structure_get_int (structure, "width", &out_width);
- res &= gst_structure_get_int (structure, "height", &out_height);
- if (!res)
- goto no_width_height;
-
- /* and framerate */
- out_framerate = gst_structure_get_value (structure, "framerate");
- if (out_framerate == NULL || !GST_VALUE_HOLDS_FRACTION (out_framerate))
- goto no_framerate;
-
- /* this is optional */
- out_par = gst_structure_get_value (structure, "pixel-aspect-ratio");
-
- /* these must match */
- if (in_width != out_width || in_height != out_height ||
- gst_value_compare (in_framerate, out_framerate) != GST_VALUE_EQUAL)
- goto format_mismatch;
-
- /* if present, these must match too */
- if (in_par && out_par
- && gst_value_compare (in_par, out_par) != GST_VALUE_EQUAL)
- goto format_mismatch;
-
- ctx = avcodec_alloc_context ();
-
- space->width = ctx->width = in_width;
- space->height = ctx->height = in_height;
-
- space->interlaced = FALSE;
- gst_structure_get_boolean (structure, "interlaced", &space->interlaced);
-
- /* get from format */
- ctx->pix_fmt = PIX_FMT_NB;
- gst_ffmpegcsp_caps_with_codectype (CODEC_TYPE_VIDEO, incaps, ctx);
- if (ctx->pix_fmt == PIX_FMT_NB)
- goto invalid_in_caps;
- space->from_pixfmt = ctx->pix_fmt;
-
- /* palette, only for from data */
- if (space->palette)
- av_free (space->palette);
- space->palette = ctx->palctrl;
- ctx->palctrl = NULL;
-
- /* get to format */
- ctx->pix_fmt = PIX_FMT_NB;
- gst_ffmpegcsp_caps_with_codectype (CODEC_TYPE_VIDEO, outcaps, ctx);
- if (ctx->pix_fmt == PIX_FMT_NB)
- goto invalid_out_caps;
- space->to_pixfmt = ctx->pix_fmt;
-
- GST_DEBUG ("reconfigured %d %d", space->from_pixfmt, space->to_pixfmt);
-
- av_free (ctx);
-
- return TRUE;
-
- /* ERRORS */
-no_width_height:
- {
- GST_DEBUG_OBJECT (space, "did not specify width or height");
- space->from_pixfmt = PIX_FMT_NB;
- space->to_pixfmt = PIX_FMT_NB;
- return FALSE;
- }
-no_framerate:
- {
- GST_DEBUG_OBJECT (space, "did not specify framerate");
- space->from_pixfmt = PIX_FMT_NB;
- space->to_pixfmt = PIX_FMT_NB;
- return FALSE;
- }
-format_mismatch:
- {
- GST_DEBUG_OBJECT (space, "input and output formats do not match");
- space->from_pixfmt = PIX_FMT_NB;
- space->to_pixfmt = PIX_FMT_NB;
- return FALSE;
- }
-invalid_in_caps:
- {
- GST_DEBUG_OBJECT (space, "could not configure context for input format");
- av_free (ctx);
- space->from_pixfmt = PIX_FMT_NB;
- space->to_pixfmt = PIX_FMT_NB;
- return FALSE;
- }
-invalid_out_caps:
- {
- GST_DEBUG_OBJECT (space, "could not configure context for output format");
- av_free (ctx);
- space->from_pixfmt = PIX_FMT_NB;
- space->to_pixfmt = PIX_FMT_NB;
- return FALSE;
- }
-}
-
-static GType
-gst_ffmpegcsp_get_type (void)
-{
- static GType ffmpegcsp_type = 0;
-
- if (!ffmpegcsp_type) {
- static const GTypeInfo ffmpegcsp_info = {
- sizeof (GstFFMpegCspClass),
- (GBaseInitFunc) gst_ffmpegcsp_base_init,
- NULL,
- (GClassInitFunc) gst_ffmpegcsp_class_init,
- NULL,
- NULL,
- sizeof (GstFFMpegCsp),
- 0,
- (GInstanceInitFunc) gst_ffmpegcsp_init,
- };
-
- ffmpegcsp_type = g_type_register_static (GST_TYPE_BASE_TRANSFORM,
- "GstFFMpegCsp", &ffmpegcsp_info, 0);
- }
-
- return ffmpegcsp_type;
-}
-
-static void
-gst_ffmpegcsp_base_init (GstFFMpegCspClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class, srctempl);
- gst_element_class_add_pad_template (element_class, sinktempl);
- gst_element_class_set_details (element_class, &ffmpegcsp_details);
-}
-
-static void
-gst_ffmpegcsp_finalize (GObject * obj)
-{
- GstFFMpegCsp *space = GST_FFMPEGCSP (obj);
-
- if (space->palette)
- av_free (space->palette);
-
- G_OBJECT_CLASS (parent_class)->finalize (obj);
-}
-
-static void
-gst_ffmpegcsp_class_init (GstFFMpegCspClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseTransformClass *gstbasetransform_class;
-
- gobject_class = (GObjectClass *) klass;
- gstbasetransform_class = (GstBaseTransformClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->finalize = gst_ffmpegcsp_finalize;
-
- gstbasetransform_class->transform_caps =
- GST_DEBUG_FUNCPTR (gst_ffmpegcsp_transform_caps);
- gstbasetransform_class->set_caps = GST_DEBUG_FUNCPTR (gst_ffmpegcsp_set_caps);
- gstbasetransform_class->get_unit_size =
- GST_DEBUG_FUNCPTR (gst_ffmpegcsp_get_unit_size);
- gstbasetransform_class->transform =
- GST_DEBUG_FUNCPTR (gst_ffmpegcsp_transform);
-#if 0
- gstbasetransform_class->transform_ip =
- GST_DEBUG_FUNCPTR (gst_ffmpegcsp_transform_ip);
-#endif
-
- gstbasetransform_class->passthrough_on_same_caps = TRUE;
-}
-
-static void
-gst_ffmpegcsp_init (GstFFMpegCsp * space)
-{
- gst_base_transform_set_qos_enabled (GST_BASE_TRANSFORM (space), TRUE);
- space->from_pixfmt = space->to_pixfmt = PIX_FMT_NB;
- space->palette = NULL;
-}
-
-static gboolean
-gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
- guint * size)
-{
- GstStructure *structure = NULL;
- AVCodecContext *ctx = NULL;
- gboolean ret = TRUE;
- gint width, height;
-
- g_assert (size);
-
- structure = gst_caps_get_structure (caps, 0);
- gst_structure_get_int (structure, "width", &width);
- gst_structure_get_int (structure, "height", &height);
-
- ctx = avcodec_alloc_context ();
-
- g_assert (ctx != NULL);
-
- ctx->pix_fmt = PIX_FMT_NB;
-
- gst_ffmpegcsp_caps_with_codectype (CODEC_TYPE_VIDEO, caps, ctx);
-
- if (G_UNLIKELY (ctx->pix_fmt == PIX_FMT_NB)) {
- ret = FALSE;
- goto beach;
- }
-
- *size = avpicture_get_size (ctx->pix_fmt, width, height);
-
- /* ffmpeg frames have the palette after the frame data, whereas
- * GStreamer currently puts it into the caps as 'palette_data' field,
- * so for paletted data the frame size avpicture_get_size() returns is
- * 1024 bytes larger than what GStreamer expects. */
- if (gst_structure_has_field (structure, "palette_data") &&
- ctx->pix_fmt == PIX_FMT_PAL8) {
- *size -= 4 * 256; /* = AVPALETTE_SIZE */
- }
-
-beach:
-
- if (ctx->palctrl)
- av_free (ctx->palctrl);
- av_free (ctx);
-
- return ret;
-}
-
-#if 0
-/* FIXME: Could use transform_ip to implement endianness swap type operations */
-static GstFlowReturn
-gst_ffmpegcsp_transform_ip (GstBaseTransform * btrans, GstBuffer * inbuf)
-{
- /* do nothing */
- return GST_FLOW_OK;
-}
-#endif
-
-static GstFlowReturn
-gst_ffmpegcsp_transform (GstBaseTransform * btrans, GstBuffer * inbuf,
- GstBuffer * outbuf)
-{
- GstFFMpegCsp *space;
- gint result;
-
- space = GST_FFMPEGCSP (btrans);
-
- GST_DEBUG ("from %d -> to %d", space->from_pixfmt, space->to_pixfmt);
-
- if (G_UNLIKELY (space->from_pixfmt == PIX_FMT_NB ||
- space->to_pixfmt == PIX_FMT_NB))
- goto unknown_format;
-
- /* fill from with source data */
- gst_ffmpegcsp_avpicture_fill (&space->from_frame,
- GST_BUFFER_DATA (inbuf), space->from_pixfmt, space->width, space->height,
- space->interlaced);
-
- /* fill optional palette */
- if (space->palette)
- space->from_frame.data[1] = (uint8_t *) space->palette->palette;
-
- /* fill target frame */
- gst_ffmpegcsp_avpicture_fill (&space->to_frame,
- GST_BUFFER_DATA (outbuf), space->to_pixfmt, space->width, space->height,
- space->interlaced);
-
- /* and convert */
- result = img_convert (&space->to_frame, space->to_pixfmt,
- &space->from_frame, space->from_pixfmt, space->width, space->height);
- if (result == -1)
- goto not_supported;
-
- /* baseclass copies timestamps */
- GST_DEBUG ("from %d -> to %d done", space->from_pixfmt, space->to_pixfmt);
-
- return GST_FLOW_OK;
-
- /* ERRORS */
-unknown_format:
- {
- GST_ELEMENT_ERROR (space, CORE, NOT_IMPLEMENTED, (NULL),
- ("attempting to convert colorspaces between unknown formats"));
- return GST_FLOW_NOT_NEGOTIATED;
- }
-not_supported:
- {
- GST_ELEMENT_ERROR (space, CORE, NOT_IMPLEMENTED, (NULL),
- ("cannot convert between formats"));
- return GST_FLOW_NOT_SUPPORTED;
- }
-}
-
-gboolean
-gst_ffmpegcolorspace_register (GstPlugin * plugin)
-{
- GstCaps *caps;
-
- GST_DEBUG_CATEGORY_INIT (ffmpegcolorspace_debug, "ffmpegcolorspace", 0,
- "FFMPEG-based colorspace converter");
- GST_DEBUG_CATEGORY_GET (ffmpegcolorspace_performance, "GST_PERFORMANCE");
-
- /* template caps */
- caps = gst_ffmpegcsp_codectype_to_caps (CODEC_TYPE_VIDEO, NULL);
-
- /* build templates */
- srctempl = gst_pad_template_new ("src",
- GST_PAD_SRC, GST_PAD_ALWAYS, gst_caps_copy (caps));
-
- /* the sink template will do palette handling as well... */
- sinktempl = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
-
- return gst_element_register (plugin, "ffmpegcolorspace",
- GST_RANK_NONE, GST_TYPE_FFMPEGCSP);
-}
diff --git a/gst/ffmpegcolorspace/gstffmpegcolorspace.h b/gst/ffmpegcolorspace/gstffmpegcolorspace.h
deleted file mode 100644
index 07950e32..00000000
--- a/gst/ffmpegcolorspace/gstffmpegcolorspace.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * This file:
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_FFMPEGCOLORSPACE_H__
-#define __GST_FFMPEGCOLORSPACE_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
-#include "avcodec.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_FFMPEGCSP (gst_ffmpegcsp_get_type())
-#define GST_FFMPEGCSP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGCSP,GstFFMpegCsp))
-#define GST_FFMPEGCSP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGCSP,GstFFMpegCspClass))
-#define GST_IS_FFMPEGCSP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGCSP))
-#define GST_IS_FFMPEGCSP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGCSP))
-
-typedef struct _GstFFMpegCsp GstFFMpegCsp;
-typedef struct _GstFFMpegCspClass GstFFMpegCspClass;
-
-/**
- * GstFFMpegCsp:
- *
- * Opaque object data structure.
- */
-struct _GstFFMpegCsp {
- GstBaseTransform element;
-
- gint width, height;
- gboolean interlaced;
- gfloat fps;
- enum PixelFormat from_pixfmt, to_pixfmt;
- AVPicture from_frame, to_frame;
- AVPaletteControl *palette;
-};
-
-struct _GstFFMpegCspClass
-{
- GstBaseTransformClass parent_class;
-};
-
-G_END_DECLS
-
-#endif /* __GST_FFMPEGCOLORSPACE_H__ */
diff --git a/gst/ffmpegcolorspace/imgconvert.c b/gst/ffmpegcolorspace/imgconvert.c
deleted file mode 100644
index dba12db7..00000000
--- a/gst/ffmpegcolorspace/imgconvert.c
+++ /dev/null
@@ -1,3517 +0,0 @@
-/*
- * Misc image convertion routines
- * Copyright (c) 2001, 2002, 2003 Fabrice Bellard.
- *
- * This library is free software; you can redistribute it 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/**
- * @file imgconvert.c
- * Misc image convertion routines.
- */
-
-/* TODO:
- * - write 'ffimg' program to test all the image related stuff
- * - move all api to slice based system
- * - integrate deinterlacing, postprocessing and scaling in the conversion process
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "gstffmpegcodecmap.h"
-
-#include <string.h>
-#include <stdlib.h>
-
-GST_DEBUG_CATEGORY_EXTERN (ffmpegcolorspace_performance);
-
-#define xglue(x, y) x ## y
-#define glue(x, y) xglue(x, y)
-
-/* this table gives more information about formats */
-/* FIXME, this table is also in ffmpegcodecmap */
-static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
- /* YUV formats */
- /* [PIX_FMT_YUV420P] = */ {
- /* .format = */ PIX_FMT_YUV420P,
- /* .name = */ "yuv420p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 1,
- /* .y_chroma_shift = */ 1,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_YVU420P] = */ {
- /* .format = */ PIX_FMT_YVU420P,
- /* .name = */ "yvu420p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 1,
- /* .y_chroma_shift = */ 1,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_NV12] = */ {
- /* .format = */ PIX_FMT_NV12,
- /* .name = */ "nv12",
- /* .nb_channels = */ 2,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 1,
- /* .y_chroma_shift = */ 1,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_NV21] = */ {
- /* .format = */ PIX_FMT_NV21,
- /* .name = */ "nv21",
- /* .nb_channels = */ 2,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 1,
- /* .y_chroma_shift = */ 1,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_YUV422P] = */ {
- /* .format = */ PIX_FMT_YUV422P,
- /* .name = */ "yuv422p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 1,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_YUV444P] = */ {
- /* .format = */ PIX_FMT_YUV444P,
- /* .name = */ "yuv444p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_YUV422] = */ {
- /* .format = */ PIX_FMT_YUV422,
- /* .name = */ "yuv422",
- /* .nb_channels = */ 1,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 1,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_UYVY422] = */ {
- /* .format = */ PIX_FMT_UYVY422,
- /* .name = */ "uyvy422",
- /* .nb_channels = */ 1,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 1,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_YVYU422] = */ {
- /* .format = */ PIX_FMT_YVYU422,
- /* .name = */ "yvyu422",
- /* .nb_channels = */ 1,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 1,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_V308] = */ {
- /* .format = */ PIX_FMT_V308,
- /* .name = */ "v308",
- /* .nb_channels = */ 1,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_YUV410P] = */ {
- /* .format = */ PIX_FMT_YUV410P,
- /* .name = */ "yuv410p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 2,
- /* .y_chroma_shift = */ 2,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_YVU410P] = */ {
- /* .format = */ PIX_FMT_YVU410P,
- /* .name = */ "yvu410p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 2,
- /* .y_chroma_shift = */ 2,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_YUV411P] = */ {
- /* .format = */ PIX_FMT_YUV411P,
- /* .name = */ "yuv411p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 2,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
-
- /* JPEG YUV */
- /* [PIX_FMT_YUVJ420P] = */ {
- /* .format = */ PIX_FMT_YUVJ420P,
- /* .name = */ "yuvj420p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV_JPEG,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 1,
- /* .y_chroma_shift = */ 1,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_YUVJ422P] = */ {
- /* .format = */ PIX_FMT_YUVJ422P,
- /* .name = */ "yuvj422p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV_JPEG,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 1,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_YUVJ444P] = */ {
- /* .format = */ PIX_FMT_YUVJ444P,
- /* .name = */ "yuvj444p",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_YUV_JPEG,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
-
- /* RGB formats */
- /* [PIX_FMT_RGB24] = */ {
- /* .format = */ PIX_FMT_RGB24,
- /* .name = */ "rgb24",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_BGR24] = */ {
- /* .format = */ PIX_FMT_BGR24,
- /* .name = */ "bgr24",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_RGB32] = */ {
- /* .format = */ PIX_FMT_RGB32,
- /* .name = */ "rgb32",
- /* .nb_channels = */ 4,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_BGR32] = */ {
- /* .format = */ PIX_FMT_BGR32,
- /* .name = */ "bgr32",
- /* .nb_channels = */ 4,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_RGB32] = */ {
- /* .format = */ PIX_FMT_xRGB32,
- /* .name = */ "xrgb32",
- /* .nb_channels = */ 4,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_BGR32] = */ {
- /* .format = */ PIX_FMT_BGRx32,
- /* .name = */ "bgrx32",
- /* .nb_channels = */ 4,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_RGBA32] = */ {
- /* .format = */ PIX_FMT_RGBA32,
- /* .name = */ "rgba32",
- /* .nb_channels = */ 4,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 1,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_BGRA32] = */ {
- /* .format = */ PIX_FMT_BGRA32,
- /* .name = */ "bgra32",
- /* .nb_channels = */ 4,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 1,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_ARGB32] = */ {
- /* .format = */ PIX_FMT_ARGB32,
- /* .name = */ "argb32",
- /* .nb_channels = */ 4,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 1,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_ABGR32] = */ {
- /* .format = */ PIX_FMT_ABGR32,
- /* .name = */ "abgr32",
- /* .nb_channels = */ 4,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 1,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_RGB565] = */ {
- /* .format = */ PIX_FMT_RGB565,
- /* .name = */ "rgb565",
- /* .nb_channels = */ 3,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 5,
- },
- /* [PIX_FMT_RGB555] = */ {
- /* .format = */ PIX_FMT_RGB555,
- /* .name = */ "rgb555",
- /* .nb_channels = */ 4,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 1,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 5,
- },
-
- /* gray / mono formats */
- /* [PIX_FMT_GRAY8] = */ {
- /* .format = */ PIX_FMT_GRAY8,
- /* .name = */ "gray",
- /* .nb_channels = */ 1,
- /* .color_type = */ FF_COLOR_GRAY,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_GRAY16_L] = */ {
- /* .format = */ PIX_FMT_GRAY16_L,
- /* .name = */ "gray",
- /* .nb_channels = */ 1,
- /* .color_type = */ FF_COLOR_GRAY,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 16,
- },
- /* [PIX_FMT_GRAY16_B] = */ {
- /* .format = */ PIX_FMT_GRAY16_B,
- /* .name = */ "gray",
- /* .nb_channels = */ 1,
- /* .color_type = */ FF_COLOR_GRAY,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 16,
- },
- /* [PIX_FMT_MONOWHITE] = */ {
- /* .format = */ PIX_FMT_MONOWHITE,
- /* .name = */ "monow",
- /* .nb_channels = */ 1,
- /* .color_type = */ FF_COLOR_GRAY,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 1,
- },
- /* [PIX_FMT_MONOBLACK] = */ {
- /* .format = */ PIX_FMT_MONOBLACK,
- /* .name = */ "monob",
- /* .nb_channels = */ 1,
- /* .color_type = */ FF_COLOR_GRAY,
- /* .pixel_type = */ FF_PIXEL_PLANAR,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 1,
- },
-
- /* paletted formats */
- /* [PIX_FMT_PAL8] = */ {
- /* .format = */ PIX_FMT_PAL8,
- /* .name = */ "pal8",
- /* .nb_channels = */ 4,
- /* .color_type = */ FF_COLOR_RGB,
- /* .pixel_type = */ FF_PIXEL_PALETTE,
- /* .is_alpha = */ 1,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_XVMC_MPEG2_MC] = */ {
- /* .format = */ PIX_FMT_XVMC_MPEG2_MC,
- /* .name = */ "xvmcmc",
- },
- /* [PIX_FMT_XVMC_MPEG2_IDCT] = */ {
- /* .format = */ PIX_FMT_XVMC_MPEG2_IDCT,
- /* .name = */ "xvmcidct",
- },
- /* [PIX_FMT_UYVY411] = */ {
- /* .format = */ PIX_FMT_UYVY411,
- /* .name = */ "uyvy411",
- /* .nb_channels = */ 1,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 0,
- /* .x_chroma_shift = */ 2,
- /* .y_chroma_shift = */ 0,
- /* .depth = */ 8,
- },
- /* [PIX_FMT_AYUV4444] = */ {
- /* .format = */ PIX_FMT_AYUV4444,
- /* .name = */ "ayuv4444",
- /* .nb_channels = */ 1,
- /* .color_type = */ FF_COLOR_YUV,
- /* .pixel_type = */ FF_PIXEL_PACKED,
- /* .is_alpha = */ 1,
- /* .x_chroma_shift = */ 0,
- /* .y_chroma_shift = */ 0,
- /*.depth = */ 8
- }
-
-};
-
-/* returns NULL if not found */
-/* undid static since this is also used in gstffmpegcodecmap.c */
-PixFmtInfo *
-get_pix_fmt_info (enum PixelFormat format)
-{
- int i;
-
- for (i = 0; i < sizeof (pix_fmt_info) / sizeof (pix_fmt_info[0]); i++) {
- if (pix_fmt_info[i].format == format) {
- return pix_fmt_info + i;
- }
- }
-
- /* since this doesn't get checked *anywhere*, we might as well warn
- here if we return NULL so you have *some* idea what's going on */
- g_warning
- ("Could not find info for pixel format %d out of %d known pixel formats. One segfault coming up",
- format, PIX_FMT_NB);
- return NULL;
-}
-
-void
-avcodec_get_chroma_sub_sample (int pix_fmt, int *h_shift, int *v_shift)
-{
- *h_shift = get_pix_fmt_info (pix_fmt)->x_chroma_shift;
- *v_shift = get_pix_fmt_info (pix_fmt)->y_chroma_shift;
-}
-
-const char *
-avcodec_get_pix_fmt_name (int pix_fmt)
-{
- if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB)
- return "???";
- else
- return get_pix_fmt_info (pix_fmt)->name;
-}
-
-enum PixelFormat
-avcodec_get_pix_fmt (const char *name)
-{
- int i;
-
- for (i = 0; i < PIX_FMT_NB; i++)
- if (!strcmp (pix_fmt_info[i].name, name))
- break;
- return pix_fmt_info[i].format;
-}
-
-#if 0
-static int
-avpicture_layout (const AVPicture * src, int pix_fmt, int width, int height,
- unsigned char *dest, int dest_size)
-{
- PixFmtInfo *pf = get_pix_fmt_info (pix_fmt);
- int i, j, w, h, data_planes;
- const unsigned char *s;
- int size = avpicture_get_size (pix_fmt, width, height);
-
- if (size > dest_size)
- return -1;
-
- if (pf->pixel_type == FF_PIXEL_PACKED || pf->pixel_type == FF_PIXEL_PALETTE) {
- if (pix_fmt == PIX_FMT_YUV422 ||
- pix_fmt == PIX_FMT_UYVY422 ||
- pix_fmt == PIX_FMT_RGB565 || pix_fmt == PIX_FMT_RGB555)
- w = width * 2;
- else if (pix_fmt == PIX_FMT_UYVY411)
- w = width + width / 2;
- else if (pix_fmt == PIX_FMT_PAL8)
- w = width;
- else
- w = width * (pf->depth * pf->nb_channels / 8);
-
- data_planes = 1;
- h = height;
- } else {
- data_planes = pf->nb_channels;
- w = (width * pf->depth + 7) / 8;
- h = height;
- }
-
- for (i = 0; i < data_planes; i++) {
- if (i == 1) {
- w = width >> pf->x_chroma_shift;
- h = height >> pf->y_chroma_shift;
- }
- s = src->data[i];
- for (j = 0; j < h; j++) {
- memcpy (dest, s, w);
- dest += w;
- s += src->linesize[i];
- }
- }
-
- if (pf->pixel_type == FF_PIXEL_PALETTE)
- memcpy ((unsigned char *) (((size_t) dest + 3) & ~3), src->data[1],
- 256 * 4);
-
- return size;
-}
-#endif
-
-int
-avpicture_get_size (int pix_fmt, int width, int height)
-{
- AVPicture dummy_pict;
-
- return gst_ffmpegcsp_avpicture_fill (&dummy_pict, NULL, pix_fmt, width,
- height, FALSE);
-}
-
-/**
- * compute the loss when converting from a pixel format to another
- */
-int
-avcodec_get_pix_fmt_loss (int dst_pix_fmt, int src_pix_fmt, int has_alpha)
-{
- const PixFmtInfo *pf, *ps;
- int loss;
-
- ps = get_pix_fmt_info (src_pix_fmt);
- pf = get_pix_fmt_info (dst_pix_fmt);
-
- /* compute loss */
- loss = 0;
- if (pf->depth < ps->depth ||
- (dst_pix_fmt == PIX_FMT_RGB555 && src_pix_fmt == PIX_FMT_RGB565))
- loss |= FF_LOSS_DEPTH;
- if (pf->x_chroma_shift > ps->x_chroma_shift ||
- pf->y_chroma_shift > ps->y_chroma_shift)
- loss |= FF_LOSS_RESOLUTION;
- switch (pf->color_type) {
- case FF_COLOR_RGB:
- if (ps->color_type != FF_COLOR_RGB && ps->color_type != FF_COLOR_GRAY)
- loss |= FF_LOSS_COLORSPACE;
- break;
- case FF_COLOR_GRAY:
- if (ps->color_type != FF_COLOR_GRAY)
- loss |= FF_LOSS_COLORSPACE;
- break;
- case FF_COLOR_YUV:
- if (ps->color_type != FF_COLOR_YUV)
- loss |= FF_LOSS_COLORSPACE;
- break;
- case FF_COLOR_YUV_JPEG:
- if (ps->color_type != FF_COLOR_YUV_JPEG &&
- ps->color_type != FF_COLOR_YUV && ps->color_type != FF_COLOR_GRAY)
- loss |= FF_LOSS_COLORSPACE;
- break;
- default:
- /* fail safe test */
- if (ps->color_type != pf->color_type)
- loss |= FF_LOSS_COLORSPACE;
- break;
- }
- if (pf->color_type == FF_COLOR_GRAY && ps->color_type != FF_COLOR_GRAY)
- loss |= FF_LOSS_CHROMA;
- if (!pf->is_alpha && (ps->is_alpha && has_alpha))
- loss |= FF_LOSS_ALPHA;
- if (pf->pixel_type == FF_PIXEL_PALETTE &&
- (ps->pixel_type != FF_PIXEL_PALETTE && ps->color_type != FF_COLOR_GRAY))
- loss |= FF_LOSS_COLORQUANT;
- return loss;
-}
-
-static int
-avg_bits_per_pixel (int pix_fmt)
-{
- int bits;
- const PixFmtInfo *pf;
-
- pf = get_pix_fmt_info (pix_fmt);
- switch (pf->pixel_type) {
- case FF_PIXEL_PACKED:
- switch (pix_fmt) {
- case PIX_FMT_YUV422:
- case PIX_FMT_UYVY422:
- case PIX_FMT_YVYU422:
- case PIX_FMT_RGB565:
- case PIX_FMT_RGB555:
- bits = 16;
- break;
- case PIX_FMT_UYVY411:
- bits = 12;
- break;
- default:
- bits = pf->depth * pf->nb_channels;
- break;
- }
- break;
- case FF_PIXEL_PLANAR:
- if (pf->x_chroma_shift == 0 && pf->y_chroma_shift == 0) {
- bits = pf->depth * pf->nb_channels;
- } else {
- bits = pf->depth + ((2 * pf->depth) >>
- (pf->x_chroma_shift + pf->y_chroma_shift));
- }
- break;
- case FF_PIXEL_PALETTE:
- bits = 8;
- break;
- default:
- bits = -1;
- break;
- }
- return bits;
-}
-
-static int
-avcodec_find_best_pix_fmt1 (int pix_fmt_mask,
- int src_pix_fmt, int has_alpha, int loss_mask)
-{
- int dist, i, loss, min_dist, dst_pix_fmt;
-
- /* find exact color match with smallest size */
- dst_pix_fmt = -1;
- min_dist = 0x7fffffff;
- for (i = 0; i < PIX_FMT_NB; i++) {
- if (pix_fmt_mask & (1 << i)) {
- loss = avcodec_get_pix_fmt_loss (i, src_pix_fmt, has_alpha) & loss_mask;
- if (loss == 0) {
- dist = avg_bits_per_pixel (i);
- if (dist < min_dist) {
- min_dist = dist;
- dst_pix_fmt = i;
- }
- }
- }
- }
- return dst_pix_fmt;
-}
-
-/**
- * find best pixel format to convert to. Return -1 if none found
- */
-int
-avcodec_find_best_pix_fmt (int pix_fmt_mask, int src_pix_fmt,
- int has_alpha, int *loss_ptr)
-{
- int dst_pix_fmt, loss_mask, i;
- static const int loss_mask_order[] = {
- ~0, /* no loss first */
- ~FF_LOSS_ALPHA,
- ~FF_LOSS_RESOLUTION,
- ~(FF_LOSS_COLORSPACE | FF_LOSS_RESOLUTION),
- ~FF_LOSS_COLORQUANT,
- ~FF_LOSS_DEPTH,
- 0,
- };
-
- /* try with successive loss */
- i = 0;
- for (;;) {
- loss_mask = loss_mask_order[i++];
- dst_pix_fmt = avcodec_find_best_pix_fmt1 (pix_fmt_mask, src_pix_fmt,
- has_alpha, loss_mask);
- if (dst_pix_fmt >= 0)
- goto found;
- if (loss_mask == 0)
- break;
- }
- return -1;
-found:
- if (loss_ptr)
- *loss_ptr = avcodec_get_pix_fmt_loss (dst_pix_fmt, src_pix_fmt, has_alpha);
- return dst_pix_fmt;
-}
-
-static void
-img_copy_plane (uint8_t * dst, int dst_wrap,
- const uint8_t * src, int src_wrap, int width, int height)
-{
- for (; height > 0; height--) {
- memcpy (dst, src, width);
- dst += dst_wrap;
- src += src_wrap;
- }
-}
-
-/**
- * Copy image 'src' to 'dst'.
- */
-static void
-img_copy (AVPicture * dst, const AVPicture * src,
- int pix_fmt, int width, int height)
-{
- int bwidth, bits, i;
- const PixFmtInfo *pf;
-
- pf = get_pix_fmt_info (pix_fmt);
- switch (pf->pixel_type) {
- case FF_PIXEL_PACKED:
- switch (pix_fmt) {
- case PIX_FMT_YUV422:
- case PIX_FMT_UYVY422:
- case PIX_FMT_YVYU422:
- case PIX_FMT_RGB565:
- case PIX_FMT_RGB555:
- bits = 16;
- break;
- case PIX_FMT_UYVY411:
- bits = 12;
- break;
- default:
- bits = pf->depth * pf->nb_channels;
- break;
- }
- bwidth = (width * bits + 7) >> 3;
- img_copy_plane (dst->data[0], dst->linesize[0],
- src->data[0], src->linesize[0], bwidth, height);
- break;
- case FF_PIXEL_PLANAR:
- for (i = 0; i < pf->nb_channels; i++) {
- int w, h;
-
- w = width;
- h = height;
- if (i == 1 || i == 2) {
- w >>= pf->x_chroma_shift;
- h >>= pf->y_chroma_shift;
- }
- bwidth = (w * pf->depth + 7) >> 3;
- img_copy_plane (dst->data[i], dst->linesize[i],
- src->data[i], src->linesize[i], bwidth, h);
- }
- break;
- case FF_PIXEL_PALETTE:
- img_copy_plane (dst->data[0], dst->linesize[0],
- src->data[0], src->linesize[0], width, height);
- /* copy the palette */
- img_copy_plane (dst->data[1], dst->linesize[1],
- src->data[1], src->linesize[1], 4, 256);
- break;
- }
-}
-
-/* XXX: totally non optimized */
-
-static void
-yuv422_to_yuv420p (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const uint8_t *p, *p1;
- uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
- int w;
-
- p1 = src->data[0];
- lum1 = dst->data[0];
- cb1 = dst->data[1];
- cr1 = dst->data[2];
-
- for (; height >= 1; height -= 2) {
- p = p1;
- lum = lum1;
- cb = cb1;
- cr = cr1;
- for (w = width; w >= 2; w -= 2) {
- lum[0] = p[0];
- cb[0] = p[1];
- lum[1] = p[2];
- cr[0] = p[3];
- p += 4;
- lum += 2;
- cb++;
- cr++;
- }
- if (w) {
- lum[0] = p[0];
- cb[0] = p[1];
- cr[0] = p[3];
- }
- p1 += src->linesize[0];
- lum1 += dst->linesize[0];
- if (height > 1) {
- p = p1;
- lum = lum1;
- for (w = width; w >= 2; w -= 2) {
- lum[0] = p[0];
- lum[1] = p[2];
- p += 4;
- lum += 2;
- }
- if (w) {
- lum[0] = p[0];
- }
- p1 += src->linesize[0];
- lum1 += dst->linesize[0];
- }
- cb1 += dst->linesize[1];
- cr1 += dst->linesize[2];
- }
-}
-
-static void
-uyvy422_to_gray (AVPicture * dst, const AVPicture * src, int width, int height)
-{
- const uint8_t *p, *p1;
- uint8_t *lum, *lum1;
- int w;
-
- p1 = src->data[0];
- lum1 = dst->data[0];
- for (; height > 0; height--) {
- p = p1;
- lum = lum1;
-
- for (w = width; w >= 2; w -= 2) {
- lum[0] = p[1];
- lum[1] = p[3];
- p += 4;
- lum += 2;
- }
- p1 += src->linesize[0];
- lum1 += dst->linesize[0];
- }
-}
-
-
-static void
-uyvy422_to_yuv420p (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const uint8_t *p, *p1;
- uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
- int w;
-
- p1 = src->data[0];
-
- lum1 = dst->data[0];
- cb1 = dst->data[1];
- cr1 = dst->data[2];
-
- for (; height >= 1; height -= 2) {
- p = p1;
- lum = lum1;
- cb = cb1;
- cr = cr1;
- for (w = width; w >= 2; w -= 2) {
- lum[0] = p[1];
- cb[0] = p[0];
- lum[1] = p[3];
- cr[0] = p[2];
- p += 4;
- lum += 2;
- cb++;
- cr++;
- }
- if (w) {
- lum[0] = p[1];
- cb[0] = p[0];
- cr[0] = p[2];
- }
- p1 += src->linesize[0];
- lum1 += dst->linesize[0];
- if (height > 1) {
- p = p1;
- lum = lum1;
- for (w = width; w >= 2; w -= 2) {
- lum[0] = p[1];
- lum[1] = p[3];
- p += 4;
- lum += 2;
- }
- if (w) {
- lum[0] = p[1];
- }
- p1 += src->linesize[0];
- lum1 += dst->linesize[0];
- }
- cb1 += dst->linesize[1];
- cr1 += dst->linesize[2];
- }
-}
-
-
-static void
-uyvy422_to_yuv422p (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const uint8_t *p, *p1;
- uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
- int w;
-
- p1 = src->data[0];
- lum1 = dst->data[0];
- cb1 = dst->data[1];
- cr1 = dst->data[2];
- for (; height > 0; height--) {
- p = p1;
- lum = lum1;
- cb = cb1;
- cr = cr1;
- for (w = width; w >= 2; w -= 2) {
- lum[0] = p[1];
- cb[0] = p[0];
- lum[1] = p[3];
- cr[0] = p[2];
- p += 4;
- lum += 2;
- cb++;
- cr++;
- }
- p1 += src->linesize[0];
- lum1 += dst->linesize[0];
- cb1 += dst->linesize[1];
- cr1 += dst->linesize[2];
- }
-}
-
-static void
-yvyu422_to_gray (AVPicture * dst, const AVPicture * src, int width, int height)
-{
- const uint8_t *p, *p1;
- uint8_t *lum, *lum1;
- int w;
-
- p1 = src->data[0];
- lum1 = dst->data[0];
- for (; height > 0; height--) {
- p = p1;
- lum = lum1;
-
- for (w = width; w >= 2; w -= 2) {
- lum[0] = p[0];
- lum[1] = p[2];
- p += 4;
- lum += 2;
- }
- p1 += src->linesize[0];
- lum1 += dst->linesize[0];
- }
-}
-
-
-static void
-yvyu422_to_yuv420p (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const uint8_t *p, *p1;
- uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
- int w;
-
- p1 = src->data[0];
-
- lum1 = dst->data[0];
- cb1 = dst->data[1];
- cr1 = dst->data[2];
-
- for (; height >= 1; height -= 2) {
- p = p1;
- lum = lum1;
- cb = cb1;
- cr = cr1;
- for (w = width; w >= 2; w -= 2) {
- lum[0] = p[0];
- cb[0] = p[3];
- lum[1] = p[2];
- cr[0] = p[1];
- p += 4;
- lum += 2;
- cb++;
- cr++;
- }
- if (w) {
- lum[0] = p[0];
- cb[0] = p[3];
- cr[0] = p[1];
- }
- p1 += src->linesize[0];
- lum1 += dst->linesize[0];
- if (height > 1) {
- p = p1;
- lum = lum1;
- for (w = width; w >= 2; w -= 2) {
- lum[0] = p[0];
- lum[1] = p[2];
- p += 4;
- lum += 2;
- }
- if (w) {
- lum[0] = p[0];
- }
- p1 += src->linesize[0];
- lum1 += dst->linesize[0];
- }
- cb1 += dst->linesize[1];
- cr1 += dst->linesize[2];
- }
-}
-
-static void
-yvyu422_to_yuv422p (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const uint8_t *p, *p1;
- uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
- int w;
-
- p1 = src->data[0];
- lum1 = dst->data[0];
- cb1 = dst->data[1];
- cr1 = dst->data[2];
- for (; height > 0; height--) {
- p = p1;
- lum = lum1;
- cb = cb1;
- cr = cr1;
- for (w = width; w >= 2; w -= 2) {
- lum[0] = p[0];
- cb[0] = p[3];
- lum[1] = p[2];
- cr[0] = p[1];
- p += 4;
- lum += 2;
- cb++;
- cr++;
- }
- p1 += src->linesize[0];
- lum1 += dst->linesize[0];
- cb1 += dst->linesize[1];
- cr1 += dst->linesize[2];
- }
-}
-
-static void
-yuv422_to_yuv422p (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const uint8_t *p, *p1;
- uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
- int w;
-
- p1 = src->data[0];
- lum1 = dst->data[0];
- cb1 = dst->data[1];
- cr1 = dst->data[2];
- for (; height > 0; height--) {
- p = p1;
- lum = lum1;
- cb = cb1;
- cr = cr1;
- for (w = width; w >= 2; w -= 2) {
- lum[0] = p[0];
- cb[0] = p[1];
- lum[1] = p[2];
- cr[0] = p[3];
- p += 4;
- lum += 2;
- cb++;
- cr++;
- }
- p1 += src->linesize[0];
- lum1 += dst->linesize[0];
- cb1 += dst->linesize[1];
- cr1 += dst->linesize[2];
- }
-}
-
-static void
-yuv422p_to_yuv422 (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- uint8_t *p, *p1;
- const uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
- int w;
-
- p1 = dst->data[0];
- lum1 = src->data[0];
- cb1 = src->data[1];
- cr1 = src->data[2];
- for (; height > 0; height--) {
- p = p1;
- lum = lum1;
- cb = cb1;
- cr = cr1;
- for (w = width; w >= 2; w -= 2) {
- p[0] = lum[0];
- p[1] = cb[0];
- p[2] = lum[1];
- p[3] = cr[0];
- p += 4;
- lum += 2;
- cb++;
- cr++;
- }
- if (w) {
- p[0] = lum[0];
- p[1] = cb[0];
- }
- p1 += dst->linesize[0];
- lum1 += src->linesize[0];
- cb1 += src->linesize[1];
- cr1 += src->linesize[2];
- }
-}
-
-static void
-yuv422p_to_uyvy422 (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- uint8_t *p, *p1;
- const uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
- int w;
-
- p1 = dst->data[0];
- lum1 = src->data[0];
- cb1 = src->data[1];
- cr1 = src->data[2];
- for (; height > 0; height--) {
- p = p1;
- lum = lum1;
- cb = cb1;
- cr = cr1;
- for (w = width; w >= 2; w -= 2) {
- p[1] = lum[0];
- p[0] = cb[0];
- p[3] = lum[1];
- p[2] = cr[0];
- p += 4;
- lum += 2;
- cb++;
- cr++;
- }
- p1 += dst->linesize[0];
- lum1 += src->linesize[0];
- cb1 += src->linesize[1];
- cr1 += src->linesize[2];
- }
-}
-
-static void
-yuv422p_to_yvyu422 (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- uint8_t *p, *p1;
- const uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
- int w;
-
- p1 = dst->data[0];
- lum1 = src->data[0];
- cb1 = src->data[1];
- cr1 = src->data[2];
- for (; height > 0; height--) {
- p = p1;
- lum = lum1;
- cb = cb1;
- cr = cr1;
- for (w = width; w >= 2; w -= 2) {
- p[0] = lum[0];
- p[3] = cb[0];
- p[2] = lum[1];
- p[1] = cr[0];
- p += 4;
- lum += 2;
- cb++;
- cr++;
- }
- p1 += dst->linesize[0];
- lum1 += src->linesize[0];
- cb1 += src->linesize[1];
- cr1 += src->linesize[2];
- }
-}
-
-static void
-uyvy411_to_yuv411p (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const uint8_t *p, *p1;
- uint8_t *lum, *cr, *cb, *lum1, *cr1, *cb1;
- int w;
-
- p1 = src->data[0];
- lum1 = dst->data[0];
- cb1 = dst->data[1];
- cr1 = dst->data[2];
- for (; height > 0; height--) {
- p = p1;
- lum = lum1;
- cb = cb1;
- cr = cr1;
- for (w = width; w >= 4; w -= 4) {
- cb[0] = p[0];
- lum[0] = p[1];
- lum[1] = p[2];
- cr[0] = p[3];
- lum[2] = p[4];
- lum[3] = p[5];
- p += 6;
- lum += 4;
- cb++;
- cr++;
- }
- p1 += src->linesize[0];
- lum1 += dst->linesize[0];
- cb1 += dst->linesize[1];
- cr1 += dst->linesize[2];
- }
-}
-
-static void
-yuv420p_to_yuv422 (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- int w, h;
- uint8_t *line1, *line2, *linesrc = dst->data[0];
- uint8_t *lum1, *lum2, *lumsrc = src->data[0];
- uint8_t *cb1, *cb2 = src->data[1];
- uint8_t *cr1, *cr2 = src->data[2];
-
- for (h = height / 2; h--;) {
- line1 = linesrc;
- line2 = linesrc + dst->linesize[0];
-
- lum1 = lumsrc;
- lum2 = lumsrc + src->linesize[0];
-
- cb1 = cb2;
- cr1 = cr2;
-
- for (w = width / 2; w--;) {
- *line1++ = *lum1++;
- *line2++ = *lum2++;
- *line1++ = *line2++ = *cb1++;
- *line1++ = *lum1++;
- *line2++ = *lum2++;
- *line1++ = *line2++ = *cr1++;
- }
- /* odd width */
- if (width % 2 != 0) {
- *line1++ = *lum1++;
- *line2++ = *lum2++;
- *line1++ = *line2++ = *cb1++;
- }
-
- linesrc += dst->linesize[0] * 2;
- lumsrc += src->linesize[0] * 2;
- cb2 += src->linesize[1];
- cr2 += src->linesize[2];
- }
- /* odd height */
- if (height % 2 != 0) {
- line1 = linesrc;
- lum1 = lumsrc;
- cb1 = cb2;
- cr1 = cr2;
-
- for (w = width / 2; w--;) {
- *line1++ = *lum1++;
- *line1++ = *cb1++;
- *line1++ = *lum1++;
- *line1++ = *cr1++;
- }
- /* odd width */
- if (width % 2 != 0) {
- *line1++ = *lum1++;
- *line1++ = *cb1++;
- }
- }
-}
-
-static void
-nv12_to_nv21 (AVPicture * dst, const AVPicture * src, int width, int height)
-{
- const uint8_t *s_c_ptr;
- uint8_t *d_c_ptr;
- int w, c_wrap;
-
- memcpy (dst->data[0], src->data[0], src->linesize[0] * height);
-
- s_c_ptr = src->data[1];
- d_c_ptr = dst->data[1];
- c_wrap = src->linesize[1] - ((width + 1) & ~0x01);
-
- for (; height >= 2; height -= 2) {
- for (w = width; w >= 2; w -= 2) {
- d_c_ptr[0] = s_c_ptr[1];
- d_c_ptr[1] = s_c_ptr[0];
- s_c_ptr += 2;
- d_c_ptr += 2;
- }
-
- /* handle odd width */
- if (w) {
- d_c_ptr[0] = s_c_ptr[1];
- d_c_ptr[1] = s_c_ptr[0];
- s_c_ptr += 2;
- d_c_ptr += 2;
- }
- s_c_ptr += c_wrap;
- d_c_ptr += c_wrap;
- }
-
- /* handle odd height */
- if (height) {
- for (w = width; w >= 2; w -= 2) {
- d_c_ptr[0] = s_c_ptr[1];
- d_c_ptr[1] = s_c_ptr[0];
- s_c_ptr += 2;
- d_c_ptr += 2;
- }
-
- /* handle odd width */
- if (w) {
- d_c_ptr[0] = s_c_ptr[1];
- d_c_ptr[1] = s_c_ptr[0];
- s_c_ptr += 2;
- d_c_ptr += 2;
- }
- }
-}
-
-static void
-nv12_to_yuv444p (AVPicture * dst, const AVPicture * src, int width, int height)
-{
- int w, h;
- uint8_t *dst_lum1, *dst_lum2, *dst_line = dst->data[0];
- uint8_t *dst_cb1, *dst_cb2, *dst_cb_line = dst->data[1];
- uint8_t *dst_cr1, *dst_cr2, *dst_cr_line = dst->data[2];
- uint8_t *lum1, *lum2, *src_lum_line = src->data[0];
- uint8_t *src_c1, *src_c_line = src->data[1];
- uint8_t cb, cr;
-
- for (h = height / 2; h--;) {
- dst_lum1 = dst_line;
- dst_lum2 = dst_line + dst->linesize[0];
-
- dst_cb1 = dst_cb_line;
- dst_cb2 = dst_cb_line + dst->linesize[1];
- dst_cr1 = dst_cr_line;
- dst_cr2 = dst_cr_line + dst->linesize[2];
-
- lum1 = src_lum_line;
- lum2 = src_lum_line + src->linesize[0];
-
- src_c1 = src_c_line;
-
- for (w = width / 2; w--;) {
- cb = *src_c1++;
- cr = *src_c1++;
- *dst_lum1++ = *lum1++;
- *dst_lum2++ = *lum2++;
- *dst_cb1++ = *dst_cb2++ = cb;
- *dst_cr1++ = *dst_cr2++ = cr;
- *dst_lum1++ = *lum1++;
- *dst_lum2++ = *lum2++;
- *dst_cb1++ = *dst_cb2++ = cb;
- *dst_cr1++ = *dst_cr2++ = cr;
- }
- /* odd width */
- if (width % 2 != 0) {
- cb = *src_c1++;
- cr = *src_c1++;
- *dst_lum1++ = *lum1++;
- *dst_lum2++ = *lum2++;
- *dst_cb1++ = *dst_cb2++ = *src_c1++;
- *dst_cr1++ = *dst_cr2++ = *src_c1++;
- }
-
- dst_line += dst->linesize[0] * 2;
- dst_cb_line += dst->linesize[1] * 2;
- dst_cr_line += dst->linesize[2] * 2;
- src_lum_line += src->linesize[0] * 2;
- src_c_line += src->linesize[1];
- }
-
- /* odd height */
- if (height % 2 != 0) {
- dst_lum1 = dst_line;
- lum1 = src_lum_line;
- src_c1 = src_c_line;
- dst_cb1 = dst_cb_line;
- dst_cr1 = dst_cr_line;
-
- for (w = width / 2; w--;) {
- cb = *src_c1++;
- cr = *src_c1++;
- *dst_lum1++ = *lum1++;
- *dst_cb1++ = cb;
- *dst_cr1++ = cr;
- *dst_lum1++ = *lum1++;
- *dst_cb1++ = cb;
- *dst_cr1++ = cr;
- }
- /* odd width */
- if (width % 2 != 0) {
- cb = *src_c1++;
- cr = *src_c1++;
- *dst_lum1++ = *lum1++;
- *dst_cb1++ = cb;
- *dst_cr1++ = cr;
- }
- }
-}
-
-#define nv21_to_nv12 nv12_to_nv21
-
-static void
-nv21_to_yuv444p (AVPicture * dst, const AVPicture * src, int width, int height)
-{
- int w, h;
- uint8_t *dst_lum1, *dst_lum2, *dst_line = dst->data[0];
- uint8_t *dst_cb1, *dst_cb2, *dst_cb_line = dst->data[1];
- uint8_t *dst_cr1, *dst_cr2, *dst_cr_line = dst->data[2];
- uint8_t *lum1, *lum2, *src_lum_line = src->data[0];
- uint8_t *src_c1, *src_c_line = src->data[1];
- uint8_t cb, cr;
-
- for (h = height / 2; h--;) {
- dst_lum1 = dst_line;
- dst_lum2 = dst_line + dst->linesize[0];
-
- dst_cb1 = dst_cb_line;
- dst_cb2 = dst_cb_line + dst->linesize[1];
- dst_cr1 = dst_cr_line;
- dst_cr2 = dst_cr_line + dst->linesize[2];
-
- lum1 = src_lum_line;
- lum2 = src_lum_line + src->linesize[0];
-
- src_c1 = src_c_line;
-
- for (w = width / 2; w--;) {
- cr = *src_c1++;
- cb = *src_c1++;
- *dst_lum1++ = *lum1++;
- *dst_lum2++ = *lum2++;
- *dst_cb1++ = *dst_cb2++ = cb;
- *dst_cr1++ = *dst_cr2++ = cr;
- *dst_lum1++ = *lum1++;
- *dst_lum2++ = *lum2++;
- *dst_cb1++ = *dst_cb2++ = cb;
- *dst_cr1++ = *dst_cr2++ = cr;
- }
- /* odd width */
- if (width % 2 != 0) {
- cr = *src_c1++;
- cb = *src_c1++;
- *dst_lum1++ = *lum1++;
- *dst_lum2++ = *lum2++;
- *dst_cb1++ = *dst_cb2++ = *src_c1++;
- *dst_cr1++ = *dst_cr2++ = *src_c1++;
- }
-
- dst_line += dst->linesize[0] * 2;
- dst_cb_line += dst->linesize[1] * 2;
- dst_cr_line += dst->linesize[2] * 2;
- src_lum_line += src->linesize[0] * 2;
- src_c_line += src->linesize[1];
- }
-
- /* odd height */
- if (height % 2 != 0) {
- dst_lum1 = dst_line;
- lum1 = src_lum_line;
- src_c1 = src_c_line;
-
- dst_cb1 = dst_cb_line;
- dst_cr1 = dst_cr_line;
-
- for (w = width / 2; w--;) {
- cr = *src_c1++;
- cb = *src_c1++;
- *dst_lum1++ = *lum1++;
- *dst_cb1++ = cb;
- *dst_cr1++ = cr;
- *dst_lum1++ = *lum1++;
- *dst_cb1++ = cb;
- *dst_cr1++ = cr;
- }
- /* odd width */
- if (width % 2 != 0) {
- cr = *src_c1++;
- cb = *src_c1++;
- *dst_lum1++ = *lum1++;
- *dst_cb1++ = cb;
- *dst_cr1++ = cr;
- }
- }
-}
-
-#define SCALEBITS 10
-#define ONE_HALF (1 << (SCALEBITS - 1))
-#define FIX(x) ((int) ((x) * (1<<SCALEBITS) + 0.5))
-
-#define YUV_TO_RGB1_CCIR(cb1, cr1)\
-{\
- cb = (cb1) - 128;\
- cr = (cr1) - 128;\
- r_add = FIX(1.40200*255.0/224.0) * cr + ONE_HALF;\
- g_add = - FIX(0.34414*255.0/224.0) * cb - FIX(0.71414*255.0/224.0) * cr + \
- ONE_HALF;\
- b_add = FIX(1.77200*255.0/224.0) * cb + ONE_HALF;\
-}
-
-#define YUV_TO_RGB2_CCIR(r, g, b, y1)\
-{\
- y = ((y1) - 16) * FIX(255.0/219.0);\
- r = cm[(y + r_add) >> SCALEBITS];\
- g = cm[(y + g_add) >> SCALEBITS];\
- b = cm[(y + b_add) >> SCALEBITS];\
-}
-
-#define YUV_TO_RGB1(cb1, cr1)\
-{\
- cb = (cb1) - 128;\
- cr = (cr1) - 128;\
- r_add = FIX(1.40200) * cr + ONE_HALF;\
- g_add = - FIX(0.34414) * cb - FIX(0.71414) * cr + ONE_HALF;\
- b_add = FIX(1.77200) * cb + ONE_HALF;\
-}
-
-#define YUV_TO_RGB2(r, g, b, y1)\
-{\
- y = (y1) << SCALEBITS;\
- r = cm[(y + r_add) >> SCALEBITS];\
- g = cm[(y + g_add) >> SCALEBITS];\
- b = cm[(y + b_add) >> SCALEBITS];\
-}
-
-#define Y_CCIR_TO_JPEG(y)\
- cm[((y) * FIX(255.0/219.0) + (ONE_HALF - 16 * FIX(255.0/219.0))) >> SCALEBITS]
-
-#define Y_JPEG_TO_CCIR(y)\
- (((y) * FIX(219.0/255.0) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS)
-
-#define C_CCIR_TO_JPEG(y)\
- cm[(((y) - 128) * FIX(127.0/112.0) + (ONE_HALF + (128 << SCALEBITS))) >> SCALEBITS]
-
-/* NOTE: the clamp is really necessary! */
-static inline int
-C_JPEG_TO_CCIR (int y)
-{
- y = (((y - 128) * FIX (112.0 / 127.0) + (ONE_HALF +
- (128 << SCALEBITS))) >> SCALEBITS);
- if (y < 16)
- y = 16;
- return y;
-}
-
-
-#define RGB_TO_Y(r, g, b) \
-((FIX(0.29900) * (r) + FIX(0.58700) * (g) + \
- FIX(0.11400) * (b) + ONE_HALF) >> SCALEBITS)
-
-#define RGB_TO_U(r1, g1, b1, shift)\
-(((- FIX(0.16874) * r1 - FIX(0.33126) * g1 + \
- FIX(0.50000) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128)
-
-#define RGB_TO_V(r1, g1, b1, shift)\
-(((FIX(0.50000) * r1 - FIX(0.41869) * g1 - \
- FIX(0.08131) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128)
-
-#define RGB_TO_Y_CCIR(r, g, b) \
-((FIX(0.29900*219.0/255.0) * (r) + FIX(0.58700*219.0/255.0) * (g) + \
- FIX(0.11400*219.0/255.0) * (b) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS)
-
-#define RGB_TO_U_CCIR(r1, g1, b1, shift)\
-(((- FIX(0.16874*224.0/255.0) * r1 - FIX(0.33126*224.0/255.0) * g1 + \
- FIX(0.50000*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128)
-
-#define RGB_TO_V_CCIR(r1, g1, b1, shift)\
-(((FIX(0.50000*224.0/255.0) * r1 - FIX(0.41869*224.0/255.0) * g1 - \
- FIX(0.08131*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128)
-
-static uint8_t y_ccir_to_jpeg[256];
-static uint8_t y_jpeg_to_ccir[256];
-static uint8_t c_ccir_to_jpeg[256];
-static uint8_t c_jpeg_to_ccir[256];
-
-/* init various conversion tables */
-static void
-img_convert_init (void)
-{
- int i;
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
-
- for (i = 0; i < 256; i++) {
- y_ccir_to_jpeg[i] = Y_CCIR_TO_JPEG (i);
- y_jpeg_to_ccir[i] = Y_JPEG_TO_CCIR (i);
- c_ccir_to_jpeg[i] = C_CCIR_TO_JPEG (i);
- c_jpeg_to_ccir[i] = C_JPEG_TO_CCIR (i);
- }
-}
-
-/* apply to each pixel the given table */
-static void
-img_apply_table (uint8_t * dst, int dst_wrap,
- const uint8_t * src, int src_wrap,
- int width, int height, const uint8_t * table1)
-{
- int n;
- const uint8_t *s;
- uint8_t *d;
- const uint8_t *table;
-
- table = table1;
- for (; height > 0; height--) {
- s = src;
- d = dst;
- n = width;
- while (n >= 4) {
- d[0] = table[s[0]];
- d[1] = table[s[1]];
- d[2] = table[s[2]];
- d[3] = table[s[3]];
- d += 4;
- s += 4;
- n -= 4;
- }
- while (n > 0) {
- d[0] = table[s[0]];
- d++;
- s++;
- n--;
- }
- dst += dst_wrap;
- src += src_wrap;
- }
-}
-
-/* XXX: use generic filter ? */
-/* XXX: in most cases, the sampling position is incorrect */
-
-/* 4x1 -> 1x1 */
-static void
-shrink41 (uint8_t * dst, int dst_wrap,
- const uint8_t * src, int src_wrap, int width, int height)
-{
- int w;
- const uint8_t *s;
- uint8_t *d;
-
- for (; height > 0; height--) {
- s = src;
- d = dst;
- for (w = width; w > 0; w--) {
- d[0] = (s[0] + s[1] + s[2] + s[3] + 2) >> 2;
- s += 4;
- d++;
- }
- src += src_wrap;
- dst += dst_wrap;
- }
-}
-
-/* 2x1 -> 1x1 */
-static void
-shrink21 (uint8_t * dst, int dst_wrap,
- const uint8_t * src, int src_wrap, int width, int height)
-{
- int w;
- const uint8_t *s;
- uint8_t *d;
-
- for (; height > 0; height--) {
- s = src;
- d = dst;
- for (w = width; w > 0; w--) {
- d[0] = (s[0] + s[1]) >> 1;
- s += 2;
- d++;
- }
- src += src_wrap;
- dst += dst_wrap;
- }
-}
-
-/* 1x2 -> 1x1 */
-static void
-shrink12 (uint8_t * dst, int dst_wrap,
- const uint8_t * src, int src_wrap, int width, int height)
-{
- int w;
- uint8_t *d;
- const uint8_t *s1, *s2;
-
- for (; height > 0; height--) {
- s1 = src;
- s2 = s1 + src_wrap;
- d = dst;
- for (w = width; w >= 4; w -= 4) {
- d[0] = (s1[0] + s2[0]) >> 1;
- d[1] = (s1[1] + s2[1]) >> 1;
- d[2] = (s1[2] + s2[2]) >> 1;
- d[3] = (s1[3] + s2[3]) >> 1;
- s1 += 4;
- s2 += 4;
- d += 4;
- }
- for (; w > 0; w--) {
- d[0] = (s1[0] + s2[0]) >> 1;
- s1++;
- s2++;
- d++;
- }
- src += 2 * src_wrap;
- dst += dst_wrap;
- }
-}
-
-/* 2x2 -> 1x1 */
-static void
-shrink22 (uint8_t * dst, int dst_wrap,
- const uint8_t * src, int src_wrap, int width, int height)
-{
- int w;
- const uint8_t *s1, *s2;
- uint8_t *d;
-
- for (; height > 0; height--) {
- s1 = src;
- s2 = s1 + src_wrap;
- d = dst;
- for (w = width; w >= 4; w -= 4) {
- d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
- d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 2;
- d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 2;
- d[3] = (s1[6] + s1[7] + s2[6] + s2[7] + 2) >> 2;
- s1 += 8;
- s2 += 8;
- d += 4;
- }
- for (; w > 0; w--) {
- d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
- s1 += 2;
- s2 += 2;
- d++;
- }
- src += 2 * src_wrap;
- dst += dst_wrap;
- }
-}
-
-/* 4x4 -> 1x1 */
-static void
-shrink44 (uint8_t * dst, int dst_wrap,
- const uint8_t * src, int src_wrap, int width, int height)
-{
- int w;
- const uint8_t *s1, *s2, *s3, *s4;
- uint8_t *d;
-
- for (; height > 0; height--) {
- s1 = src;
- s2 = s1 + src_wrap;
- s3 = s2 + src_wrap;
- s4 = s3 + src_wrap;
- d = dst;
- for (w = width; w > 0; w--) {
- d[0] = (s1[0] + s1[1] + s1[2] + s1[3] +
- s2[0] + s2[1] + s2[2] + s2[3] +
- s3[0] + s3[1] + s3[2] + s3[3] +
- s4[0] + s4[1] + s4[2] + s4[3] + 8) >> 4;
- s1 += 4;
- s2 += 4;
- s3 += 4;
- s4 += 4;
- d++;
- }
- src += 4 * src_wrap;
- dst += dst_wrap;
- }
-}
-
-static void
-grow21_line (uint8_t * dst, const uint8_t * src, int width)
-{
- int w;
- const uint8_t *s1;
- uint8_t *d;
-
- s1 = src;
- d = dst;
- for (w = width; w >= 4; w -= 4) {
- d[1] = d[0] = s1[0];
- d[3] = d[2] = s1[1];
- s1 += 2;
- d += 4;
- }
- for (; w >= 2; w -= 2) {
- d[1] = d[0] = s1[0];
- s1++;
- d += 2;
- }
- /* only needed if width is not a multiple of two */
- /* XXX: veryfy that */
- if (w) {
- d[0] = s1[0];
- }
-}
-
-static void
-grow41_line (uint8_t * dst, const uint8_t * src, int width)
-{
- int w, v;
- const uint8_t *s1;
- uint8_t *d;
-
- s1 = src;
- d = dst;
- for (w = width; w >= 4; w -= 4) {
- v = s1[0];
- d[0] = v;
- d[1] = v;
- d[2] = v;
- d[3] = v;
- s1++;
- d += 4;
- }
- for (; w >= 0; w--) {
- d[0] = s1[0];
- d++;
- }
-}
-
-/* 1x1 -> 2x1 */
-static void
-grow21 (uint8_t * dst, int dst_wrap,
- const uint8_t * src, int src_wrap, int width, int height)
-{
- for (; height > 0; height--) {
- grow21_line (dst, src, width);
- src += src_wrap;
- dst += dst_wrap;
- }
-}
-
-/* 1x1 -> 2x2 */
-static void
-grow22 (uint8_t * dst, int dst_wrap,
- const uint8_t * src, int src_wrap, int width, int height)
-{
- for (; height > 0; height--) {
- grow21_line (dst, src, width);
- if (height % 2)
- src += src_wrap;
- dst += dst_wrap;
- }
-}
-
-/* 1x1 -> 4x1 */
-static void
-grow41 (uint8_t * dst, int dst_wrap,
- const uint8_t * src, int src_wrap, int width, int height)
-{
- for (; height > 0; height--) {
- grow41_line (dst, src, width);
- src += src_wrap;
- dst += dst_wrap;
- }
-}
-
-/* 1x1 -> 4x4 */
-static void
-grow44 (uint8_t * dst, int dst_wrap,
- const uint8_t * src, int src_wrap, int width, int height)
-{
- for (; height > 0; height--) {
- grow41_line (dst, src, width);
- if ((height & 3) == 1)
- src += src_wrap;
- dst += dst_wrap;
- }
-}
-
-/* 1x2 -> 2x1 */
-static void
-conv411 (uint8_t * dst, int dst_wrap,
- const uint8_t * src, int src_wrap, int width, int height)
-{
- int w, c;
- const uint8_t *s1, *s2;
- uint8_t *d;
-
- width >>= 1;
-
- for (; height > 0; height--) {
- s1 = src;
- s2 = src + src_wrap;
- d = dst;
- for (w = width; w > 0; w--) {
- c = (s1[0] + s2[0]) >> 1;
- d[0] = c;
- d[1] = c;
- s1++;
- s2++;
- d += 2;
- }
- src += src_wrap * 2;
- dst += dst_wrap;
- }
-}
-
-/* XXX: add jpeg quantize code */
-
-#define TRANSP_INDEX (6*6*6)
-
-/* this is maybe slow, but allows for extensions */
-static inline unsigned char
-gif_clut_index (uint8_t r, uint8_t g, uint8_t b)
-{
- return ((((r) / 47) % 6) * 6 * 6 + (((g) / 47) % 6) * 6 + (((b) / 47) % 6));
-}
-
-static void
-build_rgb_palette (uint8_t * palette, int has_alpha)
-{
- uint32_t *pal;
- static const uint8_t pal_value[6] = { 0x00, 0x33, 0x66, 0x99, 0xcc, 0xff };
- int i, r, g, b;
-
- pal = (uint32_t *) palette;
- i = 0;
- for (r = 0; r < 6; r++) {
- for (g = 0; g < 6; g++) {
- for (b = 0; b < 6; b++) {
- pal[i++] = (0xffU << 24) | (pal_value[r] << 16) |
- (pal_value[g] << 8) | pal_value[b];
- }
- }
- }
- if (has_alpha)
- pal[i++] = 0;
- while (i < 256)
- pal[i++] = 0xff000000;
-}
-
-/* copy bit n to bits 0 ... n - 1 */
-static inline unsigned int
-bitcopy_n (unsigned int a, int n)
-{
- int mask;
-
- mask = (1 << n) - 1;
- return (a & (0xff & ~mask)) | ((-((a >> n) & 1)) & mask);
-}
-
-/* rgb555 handling */
-
-#define RGB_NAME rgb555
-
-#define RGB_IN(r, g, b, s)\
-{\
- unsigned int v = ((const uint16_t *)(s))[0];\
- r = bitcopy_n(v >> (10 - 3), 3);\
- g = bitcopy_n(v >> (5 - 3), 3);\
- b = bitcopy_n(v << 3, 3);\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
- unsigned int v = ((const uint16_t *)(s))[0];\
- r = bitcopy_n(v >> (10 - 3), 3);\
- g = bitcopy_n(v >> (5 - 3), 3);\
- b = bitcopy_n(v << 3, 3);\
- a = (-(v >> 15)) & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
- ((uint16_t *)(d))[0] = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3) | \
- ((a << 8) & 0x8000);\
-}
-
-#define BPP 2
-
-#include "imgconvert_template.h"
-
-/* rgb565 handling */
-
-#define RGB_NAME rgb565
-
-#define RGB_IN(r, g, b, s)\
-{\
- unsigned int v = ((const uint16_t *)(s))[0];\
- r = bitcopy_n(v >> (11 - 3), 3);\
- g = bitcopy_n(v >> (5 - 2), 2);\
- b = bitcopy_n(v << 3, 3);\
-}
-
-#define RGB_OUT(d, r, g, b)\
-{\
- ((uint16_t *)(d))[0] = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);\
-}
-
-#define BPP 2
-
-#include "imgconvert_template.h"
-
-/* bgr24 handling */
-
-#define RGB_NAME bgr24
-
-#define RGB_IN(r, g, b, s)\
-{\
- b = (s)[0];\
- g = (s)[1];\
- r = (s)[2];\
-}
-
-#define RGB_OUT(d, r, g, b)\
-{\
- (d)[0] = b;\
- (d)[1] = g;\
- (d)[2] = r;\
-}
-
-#define BPP 3
-
-#include "imgconvert_template.h"
-
-#undef RGB_IN
-#undef RGB_OUT
-#undef BPP
-
-/* rgb24 handling */
-
-#define RGB_NAME rgb24
-#define FMT_RGB24
-
-#define RGB_IN(r, g, b, s)\
-{\
- r = (s)[0];\
- g = (s)[1];\
- b = (s)[2];\
-}
-
-#define RGB_OUT(d, r, g, b)\
-{\
- (d)[0] = r;\
- (d)[1] = g;\
- (d)[2] = b;\
-}
-
-#define BPP 3
-
-#include "imgconvert_template.h"
-
-/* rgb32 handling */
-
-#define RGB_NAME rgb32
-#define FMT_RGBA32
-
-#define RGB_IN(r, g, b, s)\
-{\
- unsigned int v = ((const uint32_t *)(s))[0];\
- r = (v >> 16) & 0xff;\
- g = (v >> 8) & 0xff;\
- b = v & 0xff;\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
- unsigned int v = ((const uint32_t *)(s))[0];\
- a = 0xff;\
- r = (v >> 16) & 0xff;\
- g = (v >> 8) & 0xff;\
- b = v & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
- ((uint32_t *)(d))[0] = (a << 24) | (r << 16) | (g << 8) | b;\
-}
-
-#define BPP 4
-
-#include "imgconvert_template.h"
-
-/* bgr32 handling */
-
-#define RGB_NAME bgr32
-
-#define RGB_IN(r, g, b, s)\
-{\
- unsigned int v = ((const uint32_t *)(s))[0];\
- r = (v >> 8) & 0xff;\
- g = (v >> 16) & 0xff;\
- b = (v >> 24) & 0xff;\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
- unsigned int v = ((const uint32_t *)(s))[0];\
- a = 0xff;\
- r = (v >> 8) & 0xff;\
- g = (v >> 16) & 0xff;\
- b = (v >> 24) & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
- ((uint32_t *)(d))[0] = a | (r << 8) | (g << 16) | (b << 24);\
-}
-
-#define BPP 4
-
-#include "imgconvert_template.h"
-
-/* xrgb32 handling */
-
-#define RGB_NAME xrgb32
-#define FMT_RGBA32
-
-#define RGB_IN(r, g, b, s)\
-{\
- unsigned int v = ((const uint32_t *)(s))[0];\
- r = (v >> 24) & 0xff;\
- g = (v >> 16) & 0xff;\
- b = (v >> 8) & 0xff;\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
- unsigned int v = ((const uint32_t *)(s))[0];\
- a = 0xff;\
- r = (v >> 24) & 0xff;\
- g = (v >> 16) & 0xff;\
- b = (v >> 8) & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
- ((uint32_t *)(d))[0] = (r << 24) | (g << 16) | (b << 8) | a;\
-}
-
-#define BPP 4
-
-#include "imgconvert_template.h"
-
-/* bgrx32 handling */
-
-#define RGB_NAME bgrx32
-
-#define RGB_IN(r, g, b, s)\
-{\
- unsigned int v = ((const uint32_t *)(s))[0];\
- r = (v) & 0xff;\
- g = (v >> 8) & 0xff;\
- b = (v >> 16) & 0xff;\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
- unsigned int v = ((const uint32_t *)(s))[0];\
- a = 0xff;\
- r = (v) & 0xff;\
- g = (v >> 8) & 0xff;\
- b = (v >> 16) & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
- ((uint32_t *)(d))[0] = r | (g << 8) | (b << 16) | (a << 24);\
-}
-
-#define BPP 4
-
-#include "imgconvert_template.h"
-
-/* rgba32 handling */
-
-#define RGB_NAME rgba32
-#define FMT_RGBA32
-
-#define RGB_IN(r, g, b, s)\
-{\
- unsigned int v = ((const uint32_t *)(s))[0];\
- r = (v >> 16) & 0xff;\
- g = (v >> 8) & 0xff;\
- b = v & 0xff;\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
- unsigned int v = ((const uint32_t *)(s))[0];\
- a = (v >> 24) & 0xff;\
- r = (v >> 16) & 0xff;\
- g = (v >> 8) & 0xff;\
- b = v & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
- ((uint32_t *)(d))[0] = (a << 24) | (r << 16) | (g << 8) | b;\
-}
-
-#define BPP 4
-
-#include "imgconvert_template.h"
-
-/* bgra32 handling */
-
-#define RGB_NAME bgra32
-#define FMT_BGRA32
-
-#define RGB_IN(r, g, b, s)\
-{\
- unsigned int v = ((const uint32_t *)(s))[0];\
- r = (v >> 8) & 0xff;\
- g = (v >> 16) & 0xff;\
- b = (v >> 24) & 0xff;\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
- unsigned int v = ((const uint32_t *)(s))[0];\
- a = v & 0xff;\
- r = (v >> 8) & 0xff;\
- g = (v >> 16) & 0xff;\
- b = (v >> 24) & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
- ((uint32_t *)(d))[0] = a | (r << 8) | (g << 16) | (b << 24 );\
-}
-
-#define BPP 4
-
-#include "imgconvert_template.h"
-
-/* argb32 handling */
-
-#define RGB_NAME argb32
-#define FMT_ARGB32
-
-#define RGB_IN(r, g, b, s)\
-{\
- unsigned int v = ((const uint32_t *)(s))[0];\
- r = (v >> 24) & 0xff;\
- g = (v >> 16) & 0xff;\
- b = (v >> 8) & 0xff;\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
- unsigned int v = ((const uint32_t *)(s))[0];\
- r = (v >> 24) & 0xff;\
- g = (v >> 16) & 0xff;\
- b = (v >> 8) & 0xff;\
- a = v & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
- ((uint32_t *)(d))[0] = (r << 24) | (g << 16) | (b << 8) | a;\
-}
-
-#define BPP 4
-
-#include "imgconvert_template.h"
-
-/* abgr32 handling */
-
-#define RGB_NAME abgr32
-#define FMT_ABGR32
-
-#define RGB_IN(r, g, b, s)\
-{\
- unsigned int v = ((const uint32_t *)(s))[0];\
- r = v & 0xff;\
- g = (v >> 8) & 0xff;\
- b = (v >> 16) & 0xff;\
-}
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
- unsigned int v = ((const uint32_t *)(s))[0];\
- r = v & 0xff;\
- g = (v >> 8) & 0xff;\
- b = (v >> 16) & 0xff;\
- a = (v >> 24) & 0xff;\
-}
-
-#define RGBA_OUT(d, r, g, b, a)\
-{\
- ((uint32_t *)(d))[0] = r | (g << 8) | (b << 16) | (a << 24 );\
-}
-
-#define BPP 4
-
-#include "imgconvert_template.h"
-
-static void
-gray_to_gray16_l (AVPicture * dst, const AVPicture * src, int width, int height)
-{
- const unsigned char *p;
- unsigned char *q;
- int dst_wrap, src_wrap;
- int x, y;
-
- p = src->data[0];
- src_wrap = src->linesize[0] - width;
-
- q = dst->data[0];
- dst_wrap = dst->linesize[0] - 2 * width;
-
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- GST_WRITE_UINT16_LE (q, (*p << 8));
- q += 2;
- p++;
- }
- p += src_wrap;
- q += dst_wrap;
- }
-}
-
-static void
-gray_to_gray16_b (AVPicture * dst, const AVPicture * src, int width, int height)
-{
- const unsigned char *p;
- unsigned char *q;
- int dst_wrap, src_wrap;
- int x, y;
-
- p = src->data[0];
- src_wrap = src->linesize[0] - width;
-
- q = dst->data[0];
- dst_wrap = dst->linesize[0] - 2 * width;
-
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- GST_WRITE_UINT16_BE (q, (*p << 8));
- q += 2;
- p++;
- }
- p += src_wrap;
- q += dst_wrap;
- }
-}
-
-static void
-gray16_l_to_gray (AVPicture * dst, const AVPicture * src, int width, int height)
-{
- const unsigned char *p;
- unsigned char *q;
- int dst_wrap, src_wrap;
- int x, y;
-
- p = src->data[0];
- src_wrap = src->linesize[0] - 2 * width;
-
- q = dst->data[0];
- dst_wrap = dst->linesize[0] - width;
-
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- q[0] = GST_READ_UINT16_LE (p) >> 8;
- q++;
- p += 2;
- }
- p += src_wrap;
- q += dst_wrap;
- }
-}
-
-static void
-gray16_b_to_gray (AVPicture * dst, const AVPicture * src, int width, int height)
-{
- const unsigned char *p;
- unsigned char *q;
- int dst_wrap, src_wrap;
- int x, y;
-
- p = src->data[0];
- src_wrap = src->linesize[0] - 2 * width;
-
- q = dst->data[0];
- dst_wrap = dst->linesize[0] - width;
-
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- q[0] = GST_READ_UINT16_BE (p) >> 8;
- q++;
- p += 2;
- }
- p += src_wrap;
- q += dst_wrap;
- }
-}
-
-static void
-gray16_b_to_gray16_l (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const unsigned char *p;
- unsigned char *q;
- int dst_wrap, src_wrap;
- int x, y;
-
- p = src->data[0];
- src_wrap = src->linesize[0] - 2 * width;
-
- q = dst->data[0];
- dst_wrap = dst->linesize[0] - 2 * width;
-
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- q[0] = p[1];
- q[1] = p[0];
- q += 2;
- p += 2;
- }
- p += src_wrap;
- q += dst_wrap;
- }
-}
-
-static void
-mono_to_gray (AVPicture * dst, const AVPicture * src,
- int width, int height, int xor_mask)
-{
- const unsigned char *p;
- unsigned char *q;
- int v, dst_wrap, src_wrap;
- int y, w;
-
- p = src->data[0];
- src_wrap = src->linesize[0] - ((width + 7) >> 3);
-
- q = dst->data[0];
- dst_wrap = dst->linesize[0] - width;
- for (y = 0; y < height; y++) {
- w = width;
- while (w >= 8) {
- v = *p++ ^ xor_mask;
- q[0] = -(v >> 7);
- q[1] = -((v >> 6) & 1);
- q[2] = -((v >> 5) & 1);
- q[3] = -((v >> 4) & 1);
- q[4] = -((v >> 3) & 1);
- q[5] = -((v >> 2) & 1);
- q[6] = -((v >> 1) & 1);
- q[7] = -((v >> 0) & 1);
- w -= 8;
- q += 8;
- }
- if (w > 0) {
- v = *p++ ^ xor_mask;
- do {
- q[0] = -((v >> 7) & 1);
- q++;
- v <<= 1;
- } while (--w);
- }
- p += src_wrap;
- q += dst_wrap;
- }
-}
-
-static void
-monowhite_to_gray (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- mono_to_gray (dst, src, width, height, 0xff);
-}
-
-static void
-monoblack_to_gray (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- mono_to_gray (dst, src, width, height, 0x00);
-}
-
-static void
-gray_to_mono (AVPicture * dst, const AVPicture * src,
- int width, int height, int xor_mask)
-{
- int n;
- const uint8_t *s;
- uint8_t *d;
- int j, b, v, n1, src_wrap, dst_wrap, y;
-
- s = src->data[0];
- src_wrap = src->linesize[0] - width;
-
- d = dst->data[0];
- dst_wrap = dst->linesize[0] - ((width + 7) >> 3);
-
- for (y = 0; y < height; y++) {
- n = width;
- while (n >= 8) {
- v = 0;
- for (j = 0; j < 8; j++) {
- b = s[0];
- s++;
- v = (v << 1) | (b >> 7);
- }
- d[0] = v ^ xor_mask;
- d++;
- n -= 8;
- }
- if (n > 0) {
- n1 = n;
- v = 0;
- while (n > 0) {
- b = s[0];
- s++;
- v = (v << 1) | (b >> 7);
- n--;
- }
- d[0] = (v << (8 - (n1 & 7))) ^ xor_mask;
- d++;
- }
- s += src_wrap;
- d += dst_wrap;
- }
-}
-
-static void
-gray_to_monowhite (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- gray_to_mono (dst, src, width, height, 0xff);
-}
-
-static void
-gray_to_monoblack (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- gray_to_mono (dst, src, width, height, 0x00);
-}
-
-typedef struct ConvertEntry
-{
- enum PixelFormat src;
- enum PixelFormat dest;
- void (*convert) (AVPicture * dst,
- const AVPicture * src, int width, int height);
-} ConvertEntry;
-
-/* Add each new convertion function in this table. In order to be able
- to convert from any format to any format, the following constraints
- must be satisfied:
-
- - all FF_COLOR_RGB formats must convert to and from PIX_FMT_RGB24
-
- - all FF_COLOR_GRAY formats must convert to and from PIX_FMT_GRAY8
-
- - all FF_COLOR_RGB formats with alpha must convert to and from PIX_FMT_RGBA32
-
- - PIX_FMT_YUV444P and PIX_FMT_YUVJ444P must convert to and from
- PIX_FMT_RGB24.
-
- - PIX_FMT_422 must convert to and from PIX_FMT_422P.
-
- The other conversion functions are just optimisations for common cases.
-*/
-static ConvertEntry convert_table[] = {
- {PIX_FMT_YUV420P, PIX_FMT_YUV422, yuv420p_to_yuv422},
- {PIX_FMT_YUV420P, PIX_FMT_RGB555, yuv420p_to_rgb555},
- {PIX_FMT_YUV420P, PIX_FMT_RGB565, yuv420p_to_rgb565},
- {PIX_FMT_YUV420P, PIX_FMT_BGR24, yuv420p_to_bgr24},
- {PIX_FMT_YUV420P, PIX_FMT_RGB24, yuv420p_to_rgb24},
- {PIX_FMT_YUV420P, PIX_FMT_RGB32, yuv420p_to_rgb32},
- {PIX_FMT_YUV420P, PIX_FMT_BGR32, yuv420p_to_bgr32},
- {PIX_FMT_YUV420P, PIX_FMT_xRGB32, yuv420p_to_xrgb32},
- {PIX_FMT_YUV420P, PIX_FMT_BGRx32, yuv420p_to_bgrx32},
- {PIX_FMT_YUV420P, PIX_FMT_RGBA32, yuv420p_to_rgba32},
- {PIX_FMT_YUV420P, PIX_FMT_BGRA32, yuv420p_to_bgra32},
- {PIX_FMT_YUV420P, PIX_FMT_ARGB32, yuv420p_to_argb32},
- {PIX_FMT_YUV420P, PIX_FMT_ABGR32, yuv420p_to_abgr32},
-
- {PIX_FMT_NV12, PIX_FMT_RGB555, nv12_to_rgb555},
- {PIX_FMT_NV12, PIX_FMT_RGB565, nv12_to_rgb565},
- {PIX_FMT_NV12, PIX_FMT_BGR24, nv12_to_bgr24},
- {PIX_FMT_NV12, PIX_FMT_RGB24, nv12_to_rgb24},
- {PIX_FMT_NV12, PIX_FMT_RGB32, nv12_to_rgb32},
- {PIX_FMT_NV12, PIX_FMT_BGR32, nv12_to_bgr32},
- {PIX_FMT_NV12, PIX_FMT_xRGB32, nv12_to_xrgb32},
- {PIX_FMT_NV12, PIX_FMT_BGRx32, nv12_to_bgrx32},
- {PIX_FMT_NV12, PIX_FMT_RGBA32, nv12_to_rgba32},
- {PIX_FMT_NV12, PIX_FMT_BGRA32, nv12_to_bgra32},
- {PIX_FMT_NV12, PIX_FMT_ARGB32, nv12_to_argb32},
- {PIX_FMT_NV12, PIX_FMT_ABGR32, nv12_to_abgr32},
- {PIX_FMT_NV12, PIX_FMT_NV21, nv12_to_nv21},
- {PIX_FMT_NV12, PIX_FMT_YUV444P, nv12_to_yuv444p},
-
- {PIX_FMT_NV21, PIX_FMT_RGB555, nv21_to_rgb555},
- {PIX_FMT_NV21, PIX_FMT_RGB565, nv21_to_rgb565},
- {PIX_FMT_NV21, PIX_FMT_BGR24, nv21_to_bgr24},
- {PIX_FMT_NV21, PIX_FMT_RGB24, nv21_to_rgb24},
- {PIX_FMT_NV21, PIX_FMT_RGB32, nv21_to_rgb32},
- {PIX_FMT_NV21, PIX_FMT_BGR32, nv21_to_bgr32},
- {PIX_FMT_NV21, PIX_FMT_xRGB32, nv21_to_xrgb32},
- {PIX_FMT_NV21, PIX_FMT_BGRx32, nv21_to_bgrx32},
- {PIX_FMT_NV21, PIX_FMT_RGBA32, nv21_to_rgba32},
- {PIX_FMT_NV21, PIX_FMT_BGRA32, nv21_to_bgra32},
- {PIX_FMT_NV21, PIX_FMT_ARGB32, nv21_to_argb32},
- {PIX_FMT_NV21, PIX_FMT_ABGR32, nv21_to_abgr32},
- {PIX_FMT_NV21, PIX_FMT_YUV444P, nv21_to_yuv444p},
- {PIX_FMT_NV21, PIX_FMT_NV12, nv21_to_nv12},
-
- {PIX_FMT_YUV422P, PIX_FMT_YUV422, yuv422p_to_yuv422},
- {PIX_FMT_YUV422P, PIX_FMT_UYVY422, yuv422p_to_uyvy422},
- {PIX_FMT_YUV422P, PIX_FMT_YVYU422, yuv422p_to_yvyu422},
-
- {PIX_FMT_YUV444P, PIX_FMT_RGB24, yuv444p_to_rgb24},
-
- {PIX_FMT_YUVJ420P, PIX_FMT_RGB555, yuvj420p_to_rgb555},
- {PIX_FMT_YUVJ420P, PIX_FMT_RGB565, yuvj420p_to_rgb565},
- {PIX_FMT_YUVJ420P, PIX_FMT_BGR24, yuvj420p_to_bgr24},
- {PIX_FMT_YUVJ420P, PIX_FMT_RGB24, yuvj420p_to_rgb24},
- {PIX_FMT_YUVJ420P, PIX_FMT_RGB32, yuvj420p_to_rgb32},
- {PIX_FMT_YUVJ420P, PIX_FMT_BGR32, yuvj420p_to_bgr32},
- {PIX_FMT_YUVJ420P, PIX_FMT_RGB32, yuvj420p_to_xrgb32},
- {PIX_FMT_YUVJ420P, PIX_FMT_BGR32, yuvj420p_to_bgrx32},
- {PIX_FMT_YUVJ420P, PIX_FMT_RGBA32, yuvj420p_to_rgba32},
- {PIX_FMT_YUVJ420P, PIX_FMT_BGRA32, yuvj420p_to_bgra32},
- {PIX_FMT_YUVJ420P, PIX_FMT_ARGB32, yuvj420p_to_argb32},
- {PIX_FMT_YUVJ420P, PIX_FMT_ABGR32, yuvj420p_to_abgr32},
-
- {PIX_FMT_YUVJ444P, PIX_FMT_RGB24, yuvj444p_to_rgb24},
-
- {PIX_FMT_YUV422, PIX_FMT_YUV420P, yuv422_to_yuv420p},
- {PIX_FMT_YUV422, PIX_FMT_YUV422P, yuv422_to_yuv422p},
-
- {PIX_FMT_UYVY422, PIX_FMT_YUV420P, uyvy422_to_yuv420p},
- {PIX_FMT_UYVY422, PIX_FMT_YUV422P, uyvy422_to_yuv422p},
- {PIX_FMT_UYVY422, PIX_FMT_GRAY8, uyvy422_to_gray},
- {PIX_FMT_UYVY422, PIX_FMT_RGB555, uyvy422_to_rgb555},
- {PIX_FMT_UYVY422, PIX_FMT_RGB565, uyvy422_to_rgb565},
- {PIX_FMT_UYVY422, PIX_FMT_BGR24, uyvy422_to_bgr24},
- {PIX_FMT_UYVY422, PIX_FMT_RGB24, uyvy422_to_rgb24},
- {PIX_FMT_UYVY422, PIX_FMT_RGB32, uyvy422_to_rgb32},
- {PIX_FMT_UYVY422, PIX_FMT_BGR32, uyvy422_to_bgr32},
- {PIX_FMT_UYVY422, PIX_FMT_xRGB32, uyvy422_to_xrgb32},
- {PIX_FMT_UYVY422, PIX_FMT_BGRx32, uyvy422_to_bgrx32},
- {PIX_FMT_UYVY422, PIX_FMT_RGBA32, uyvy422_to_rgba32},
- {PIX_FMT_UYVY422, PIX_FMT_BGRA32, uyvy422_to_bgra32},
- {PIX_FMT_UYVY422, PIX_FMT_ARGB32, uyvy422_to_argb32},
- {PIX_FMT_UYVY422, PIX_FMT_ABGR32, uyvy422_to_abgr32},
-
- {PIX_FMT_YVYU422, PIX_FMT_YUV420P, yvyu422_to_yuv420p},
- {PIX_FMT_YVYU422, PIX_FMT_YUV422P, yvyu422_to_yuv422p},
- {PIX_FMT_YVYU422, PIX_FMT_GRAY8, yvyu422_to_gray},
-
- {PIX_FMT_RGB24, PIX_FMT_YUV420P, rgb24_to_yuv420p},
- {PIX_FMT_RGB24, PIX_FMT_NV12, rgb24_to_nv12},
- {PIX_FMT_RGB24, PIX_FMT_NV21, rgb24_to_nv21},
- {PIX_FMT_RGB24, PIX_FMT_RGB565, rgb24_to_rgb565},
- {PIX_FMT_RGB24, PIX_FMT_RGB555, rgb24_to_rgb555},
- {PIX_FMT_RGB24, PIX_FMT_RGB32, rgb24_to_rgb32},
- {PIX_FMT_RGB24, PIX_FMT_BGR32, rgb24_to_bgr32},
- {PIX_FMT_RGB24, PIX_FMT_xRGB32, rgb24_to_xrgb32},
- {PIX_FMT_RGB24, PIX_FMT_BGRx32, rgb24_to_bgrx32},
- {PIX_FMT_RGB24, PIX_FMT_RGBA32, rgb24_to_rgba32},
- {PIX_FMT_RGB24, PIX_FMT_BGR24, rgb24_to_bgr24},
- {PIX_FMT_RGB24, PIX_FMT_BGRA32, rgb24_to_bgra32},
- {PIX_FMT_RGB24, PIX_FMT_ARGB32, rgb24_to_argb32},
- {PIX_FMT_RGB24, PIX_FMT_ABGR32, rgb24_to_abgr32},
- {PIX_FMT_RGB24, PIX_FMT_GRAY8, rgb24_to_gray},
- {PIX_FMT_RGB24, PIX_FMT_GRAY16_L, rgb24_to_gray16_l},
- {PIX_FMT_RGB24, PIX_FMT_GRAY16_B, rgb24_to_gray16_b},
- {PIX_FMT_RGB24, PIX_FMT_PAL8, rgb24_to_pal8},
- {PIX_FMT_RGB24, PIX_FMT_YUV444P, rgb24_to_yuv444p},
- {PIX_FMT_RGB24, PIX_FMT_YUVJ420P, rgb24_to_yuvj420p},
- {PIX_FMT_RGB24, PIX_FMT_YUVJ444P, rgb24_to_yuvj444p},
- {PIX_FMT_RGB24, PIX_FMT_AYUV4444, rgb24_to_ayuv4444},
- {PIX_FMT_RGB24, PIX_FMT_V308, rgb24_to_v308},
-
- {PIX_FMT_RGB32, PIX_FMT_RGB24, rgb32_to_rgb24},
- {PIX_FMT_RGB32, PIX_FMT_RGB555, rgba32_to_rgb555},
- {PIX_FMT_RGB32, PIX_FMT_PAL8, rgb32_to_pal8},
- {PIX_FMT_RGB32, PIX_FMT_YUV420P, rgb32_to_yuv420p},
- {PIX_FMT_RGB32, PIX_FMT_NV12, rgb32_to_nv12},
- {PIX_FMT_RGB32, PIX_FMT_NV21, rgb32_to_nv21},
- {PIX_FMT_RGB32, PIX_FMT_GRAY8, rgb32_to_gray},
- {PIX_FMT_RGB32, PIX_FMT_GRAY16_L, rgb32_to_gray16_l},
- {PIX_FMT_RGB32, PIX_FMT_GRAY16_B, rgb32_to_gray16_b},
-
- {PIX_FMT_xRGB32, PIX_FMT_RGB24, xrgb32_to_rgb24},
- {PIX_FMT_xRGB32, PIX_FMT_PAL8, xrgb32_to_pal8},
- {PIX_FMT_xRGB32, PIX_FMT_YUV420P, xrgb32_to_yuv420p},
- {PIX_FMT_xRGB32, PIX_FMT_NV12, xrgb32_to_nv12},
- {PIX_FMT_xRGB32, PIX_FMT_NV21, xrgb32_to_nv21},
- {PIX_FMT_xRGB32, PIX_FMT_GRAY8, xrgb32_to_gray},
- {PIX_FMT_xRGB32, PIX_FMT_GRAY16_L, xrgb32_to_gray16_l},
- {PIX_FMT_xRGB32, PIX_FMT_GRAY16_B, xrgb32_to_gray16_b},
-
- {PIX_FMT_RGBA32, PIX_FMT_BGRA32, rgba32_to_bgra32},
- {PIX_FMT_RGBA32, PIX_FMT_ABGR32, rgba32_to_abgr32},
- {PIX_FMT_RGBA32, PIX_FMT_ARGB32, rgba32_to_argb32},
- {PIX_FMT_RGBA32, PIX_FMT_BGR32, rgba32_to_bgr32},
- {PIX_FMT_RGBA32, PIX_FMT_BGRx32, rgba32_to_bgrx32},
- {PIX_FMT_RGBA32, PIX_FMT_ABGR32, rgba32_to_abgr32},
- {PIX_FMT_RGBA32, PIX_FMT_RGB24, rgba32_to_rgb24},
- {PIX_FMT_RGBA32, PIX_FMT_RGB555, rgba32_to_rgb555},
- {PIX_FMT_RGBA32, PIX_FMT_PAL8, rgba32_to_pal8},
- {PIX_FMT_RGBA32, PIX_FMT_YUV420P, rgba32_to_yuv420p},
- {PIX_FMT_RGBA32, PIX_FMT_NV12, rgba32_to_nv12},
- {PIX_FMT_RGBA32, PIX_FMT_NV21, rgba32_to_nv21},
- {PIX_FMT_RGBA32, PIX_FMT_GRAY8, rgba32_to_gray},
- {PIX_FMT_RGBA32, PIX_FMT_GRAY16_L, rgba32_to_gray16_l},
- {PIX_FMT_RGBA32, PIX_FMT_GRAY16_B, rgba32_to_gray16_b},
- {PIX_FMT_RGBA32, PIX_FMT_AYUV4444, rgba32_to_ayuv4444},
-
- {PIX_FMT_BGR24, PIX_FMT_RGB24, bgr24_to_rgb24},
- {PIX_FMT_BGR24, PIX_FMT_YUV420P, bgr24_to_yuv420p},
- {PIX_FMT_BGR24, PIX_FMT_NV12, bgr24_to_nv12},
- {PIX_FMT_BGR24, PIX_FMT_NV21, bgr24_to_nv21},
- {PIX_FMT_BGR24, PIX_FMT_GRAY8, bgr24_to_gray},
- {PIX_FMT_BGR24, PIX_FMT_GRAY16_L, bgr24_to_gray16_l},
- {PIX_FMT_BGR24, PIX_FMT_GRAY16_B, bgr24_to_gray16_b},
-
- {PIX_FMT_BGR32, PIX_FMT_RGB24, bgr32_to_rgb24},
- {PIX_FMT_BGR32, PIX_FMT_RGBA32, bgr32_to_rgba32},
- {PIX_FMT_BGR32, PIX_FMT_YUV420P, bgr32_to_yuv420p},
- {PIX_FMT_BGR32, PIX_FMT_NV12, bgr32_to_nv12},
- {PIX_FMT_BGR32, PIX_FMT_NV21, bgr32_to_nv21},
- {PIX_FMT_BGR32, PIX_FMT_GRAY8, bgr32_to_gray},
- {PIX_FMT_BGR32, PIX_FMT_GRAY16_L, bgr32_to_gray16_l},
- {PIX_FMT_BGR32, PIX_FMT_GRAY16_B, bgr32_to_gray16_b},
-
- {PIX_FMT_BGRx32, PIX_FMT_RGB24, bgrx32_to_rgb24},
- {PIX_FMT_BGRx32, PIX_FMT_RGBA32, bgrx32_to_rgba32},
- {PIX_FMT_BGRx32, PIX_FMT_YUV420P, bgrx32_to_yuv420p},
- {PIX_FMT_BGRx32, PIX_FMT_NV12, bgrx32_to_nv12},
- {PIX_FMT_BGRx32, PIX_FMT_NV21, bgrx32_to_nv21},
- {PIX_FMT_BGRx32, PIX_FMT_GRAY8, bgrx32_to_gray},
- {PIX_FMT_BGRx32, PIX_FMT_GRAY16_L, bgrx32_to_gray16_l},
- {PIX_FMT_BGRx32, PIX_FMT_GRAY16_B, bgrx32_to_gray16_b},
-
- {PIX_FMT_BGRA32, PIX_FMT_RGB24, bgra32_to_rgb24},
- {PIX_FMT_BGRA32, PIX_FMT_RGBA32, bgra32_to_rgba32},
- {PIX_FMT_BGRA32, PIX_FMT_YUV420P, bgra32_to_yuv420p},
- {PIX_FMT_BGRA32, PIX_FMT_NV12, bgra32_to_nv12},
- {PIX_FMT_BGRA32, PIX_FMT_NV21, bgra32_to_nv21},
- {PIX_FMT_BGRA32, PIX_FMT_GRAY8, bgra32_to_gray},
- {PIX_FMT_BGRA32, PIX_FMT_GRAY16_L, bgra32_to_gray16_l},
- {PIX_FMT_BGRA32, PIX_FMT_GRAY16_B, bgra32_to_gray16_b},
- {PIX_FMT_BGRA32, PIX_FMT_AYUV4444, bgra32_to_ayuv4444},
-
- {PIX_FMT_ABGR32, PIX_FMT_RGB24, abgr32_to_rgb24},
- {PIX_FMT_ABGR32, PIX_FMT_RGBA32, abgr32_to_rgba32},
- {PIX_FMT_ABGR32, PIX_FMT_YUV420P, abgr32_to_yuv420p},
- {PIX_FMT_ABGR32, PIX_FMT_NV12, abgr32_to_nv12},
- {PIX_FMT_ABGR32, PIX_FMT_NV21, abgr32_to_nv21},
- {PIX_FMT_ABGR32, PIX_FMT_GRAY8, abgr32_to_gray},
- {PIX_FMT_ABGR32, PIX_FMT_GRAY16_L, abgr32_to_gray16_l},
- {PIX_FMT_ABGR32, PIX_FMT_GRAY16_B, abgr32_to_gray16_b},
- {PIX_FMT_ABGR32, PIX_FMT_AYUV4444, abgr32_to_ayuv4444},
-
- {PIX_FMT_ARGB32, PIX_FMT_RGB24, argb32_to_rgb24},
- {PIX_FMT_ARGB32, PIX_FMT_RGBA32, argb32_to_rgba32},
- {PIX_FMT_ARGB32, PIX_FMT_YUV420P, argb32_to_yuv420p},
- {PIX_FMT_ARGB32, PIX_FMT_NV12, argb32_to_nv12},
- {PIX_FMT_ARGB32, PIX_FMT_NV21, argb32_to_nv21},
- {PIX_FMT_ARGB32, PIX_FMT_GRAY8, argb32_to_gray},
- {PIX_FMT_ARGB32, PIX_FMT_GRAY16_L, argb32_to_gray16_l},
- {PIX_FMT_ARGB32, PIX_FMT_GRAY16_B, argb32_to_gray16_b},
- {PIX_FMT_ARGB32, PIX_FMT_AYUV4444, argb32_to_ayuv4444},
-
- {PIX_FMT_RGB555, PIX_FMT_RGB24, rgb555_to_rgb24},
- {PIX_FMT_RGB555, PIX_FMT_RGB32, rgb555_to_rgba32},
- {PIX_FMT_RGB555, PIX_FMT_RGBA32, rgb555_to_rgba32},
- {PIX_FMT_RGB555, PIX_FMT_YUV420P, rgb555_to_yuv420p},
- {PIX_FMT_RGB555, PIX_FMT_NV12, rgb555_to_nv12},
- {PIX_FMT_RGB555, PIX_FMT_NV21, rgb555_to_nv21},
- {PIX_FMT_RGB555, PIX_FMT_GRAY8, rgb555_to_gray},
- {PIX_FMT_RGB555, PIX_FMT_GRAY16_L, rgb555_to_gray16_l},
- {PIX_FMT_RGB555, PIX_FMT_GRAY16_B, rgb555_to_gray16_b},
-
- {PIX_FMT_RGB565, PIX_FMT_RGB24, rgb565_to_rgb24},
- {PIX_FMT_RGB565, PIX_FMT_YUV420P, rgb565_to_yuv420p},
- {PIX_FMT_RGB565, PIX_FMT_NV12, rgb565_to_nv12},
- {PIX_FMT_RGB565, PIX_FMT_NV21, rgb565_to_nv21},
- {PIX_FMT_RGB565, PIX_FMT_GRAY8, rgb565_to_gray},
- {PIX_FMT_RGB565, PIX_FMT_GRAY16_L, rgb565_to_gray16_l},
- {PIX_FMT_RGB565, PIX_FMT_GRAY16_B, rgb565_to_gray16_b},
-
- {PIX_FMT_GRAY8, PIX_FMT_RGB555, gray_to_rgb555},
- {PIX_FMT_GRAY8, PIX_FMT_RGB565, gray_to_rgb565},
- {PIX_FMT_GRAY8, PIX_FMT_RGB24, gray_to_rgb24},
- {PIX_FMT_GRAY8, PIX_FMT_BGR24, gray_to_bgr24},
- {PIX_FMT_GRAY8, PIX_FMT_RGB32, gray_to_rgb32},
- {PIX_FMT_GRAY8, PIX_FMT_BGR32, gray_to_bgr32},
- {PIX_FMT_GRAY8, PIX_FMT_xRGB32, gray_to_xrgb32},
- {PIX_FMT_GRAY8, PIX_FMT_BGRx32, gray_to_bgrx32},
- {PIX_FMT_GRAY8, PIX_FMT_RGBA32, gray_to_rgba32},
- {PIX_FMT_GRAY8, PIX_FMT_BGRA32, gray_to_bgra32},
- {PIX_FMT_GRAY8, PIX_FMT_ARGB32, gray_to_argb32},
- {PIX_FMT_GRAY8, PIX_FMT_ABGR32, gray_to_abgr32},
- {PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, gray_to_monowhite},
- {PIX_FMT_GRAY8, PIX_FMT_MONOBLACK, gray_to_monoblack},
- {PIX_FMT_GRAY8, PIX_FMT_GRAY16_L, gray_to_gray16_l},
- {PIX_FMT_GRAY8, PIX_FMT_GRAY16_B, gray_to_gray16_b},
-
- {PIX_FMT_MONOWHITE, PIX_FMT_GRAY8, monowhite_to_gray},
-
- {PIX_FMT_MONOBLACK, PIX_FMT_GRAY8, monoblack_to_gray},
-
- {PIX_FMT_GRAY16_L, PIX_FMT_GRAY8, gray16_l_to_gray},
- {PIX_FMT_GRAY16_L, PIX_FMT_RGB555, gray16_l_to_rgb555},
- {PIX_FMT_GRAY16_L, PIX_FMT_RGB565, gray16_l_to_rgb565},
- {PIX_FMT_GRAY16_L, PIX_FMT_BGR24, gray16_l_to_bgr24},
- {PIX_FMT_GRAY16_L, PIX_FMT_RGB24, gray16_l_to_rgb24},
- {PIX_FMT_GRAY16_L, PIX_FMT_BGR32, gray16_l_to_bgr32},
- {PIX_FMT_GRAY16_L, PIX_FMT_RGB32, gray16_l_to_rgb32},
- {PIX_FMT_GRAY16_L, PIX_FMT_xRGB32, gray16_l_to_xrgb32},
- {PIX_FMT_GRAY16_L, PIX_FMT_BGRx32, gray16_l_to_bgrx32},
- {PIX_FMT_GRAY16_L, PIX_FMT_ABGR32, gray16_l_to_abgr32},
- {PIX_FMT_GRAY16_L, PIX_FMT_ARGB32, gray16_l_to_argb32},
- {PIX_FMT_GRAY16_L, PIX_FMT_BGRA32, gray16_l_to_bgra32},
- {PIX_FMT_GRAY16_L, PIX_FMT_RGBA32, gray16_l_to_rgba32},
- {PIX_FMT_GRAY16_L, PIX_FMT_GRAY16_B, gray16_b_to_gray16_l},
-
- {PIX_FMT_GRAY16_B, PIX_FMT_GRAY8, gray16_b_to_gray},
- {PIX_FMT_GRAY16_B, PIX_FMT_RGB555, gray16_b_to_rgb555},
- {PIX_FMT_GRAY16_B, PIX_FMT_RGB565, gray16_b_to_rgb565},
- {PIX_FMT_GRAY16_B, PIX_FMT_BGR24, gray16_b_to_bgr24},
- {PIX_FMT_GRAY16_B, PIX_FMT_RGB24, gray16_b_to_rgb24},
- {PIX_FMT_GRAY16_B, PIX_FMT_BGR32, gray16_b_to_bgr32},
- {PIX_FMT_GRAY16_B, PIX_FMT_RGB32, gray16_b_to_rgb32},
- {PIX_FMT_GRAY16_B, PIX_FMT_xRGB32, gray16_b_to_xrgb32},
- {PIX_FMT_GRAY16_B, PIX_FMT_BGRx32, gray16_b_to_bgrx32},
- {PIX_FMT_GRAY16_B, PIX_FMT_ABGR32, gray16_b_to_abgr32},
- {PIX_FMT_GRAY16_B, PIX_FMT_ARGB32, gray16_b_to_argb32},
- {PIX_FMT_GRAY16_B, PIX_FMT_BGRA32, gray16_b_to_bgra32},
- {PIX_FMT_GRAY16_B, PIX_FMT_RGBA32, gray16_b_to_rgba32},
- {PIX_FMT_GRAY16_B, PIX_FMT_GRAY16_L, gray16_b_to_gray16_l},
-
- {PIX_FMT_PAL8, PIX_FMT_RGB555, pal8_to_rgb555},
- {PIX_FMT_PAL8, PIX_FMT_RGB565, pal8_to_rgb565},
- {PIX_FMT_PAL8, PIX_FMT_BGR24, pal8_to_bgr24},
- {PIX_FMT_PAL8, PIX_FMT_RGB24, pal8_to_rgb24},
- {PIX_FMT_PAL8, PIX_FMT_RGB32, pal8_to_rgb32},
- {PIX_FMT_PAL8, PIX_FMT_BGR32, pal8_to_bgr32},
- {PIX_FMT_PAL8, PIX_FMT_xRGB32, pal8_to_xrgb32},
- {PIX_FMT_PAL8, PIX_FMT_BGRx32, pal8_to_bgrx32},
- {PIX_FMT_PAL8, PIX_FMT_RGBA32, pal8_to_rgba32},
- {PIX_FMT_PAL8, PIX_FMT_BGRA32, pal8_to_bgra32},
- {PIX_FMT_PAL8, PIX_FMT_ARGB32, pal8_to_argb32},
- {PIX_FMT_PAL8, PIX_FMT_ABGR32, pal8_to_abgr32},
-
- {PIX_FMT_UYVY411, PIX_FMT_YUV411P, uyvy411_to_yuv411p},
-
- {PIX_FMT_V308, PIX_FMT_RGB24, v308_to_rgb24},
-
- {PIX_FMT_AYUV4444, PIX_FMT_RGBA32, ayuv4444_to_rgba32},
- {PIX_FMT_AYUV4444, PIX_FMT_ARGB32, ayuv4444_to_argb32},
- {PIX_FMT_AYUV4444, PIX_FMT_BGRA32, ayuv4444_to_bgra32},
- {PIX_FMT_AYUV4444, PIX_FMT_ABGR32, ayuv4444_to_abgr32},
- {PIX_FMT_AYUV4444, PIX_FMT_RGB24, ayuv4444_to_rgb24},
-};
-
-static ConvertEntry *
-get_convert_table_entry (int src_pix_fmt, int dst_pix_fmt)
-{
- int i;
-
- for (i = 0; i < sizeof (convert_table) / sizeof (convert_table[0]); i++) {
- if (convert_table[i].src == src_pix_fmt &&
- convert_table[i].dest == dst_pix_fmt) {
- return convert_table + i;
- }
- }
-
- return NULL;
-}
-
-static int
-avpicture_alloc (AVPicture * picture, int pix_fmt, int width, int height,
- int interlaced)
-{
- unsigned int size;
- void *ptr;
-
- size = avpicture_get_size (pix_fmt, width, height);
- ptr = av_malloc (size);
- if (!ptr)
- goto fail;
- gst_ffmpegcsp_avpicture_fill (picture, ptr, pix_fmt, width, height,
- interlaced);
- return 0;
-fail:
- memset (picture, 0, sizeof (AVPicture));
- return -1;
-}
-
-static void
-avpicture_free (AVPicture * picture)
-{
- av_free (picture->data[0]);
-}
-
-/* return true if yuv planar */
-static inline int
-is_yuv_planar (PixFmtInfo * ps)
-{
- return (ps->color_type == FF_COLOR_YUV ||
- ps->color_type == FF_COLOR_YUV_JPEG) && ps->pixel_type == FF_PIXEL_PLANAR;
-}
-
-/* XXX: always use linesize. Return -1 if not supported */
-int
-img_convert (AVPicture * dst, int dst_pix_fmt,
- const AVPicture * src, int src_pix_fmt, int src_width, int src_height)
-{
- static int inited;
- int i, ret, dst_width, dst_height, int_pix_fmt;
- PixFmtInfo *src_pix, *dst_pix;
- ConvertEntry *ce;
- AVPicture tmp1, *tmp = &tmp1;
-
- if (G_UNLIKELY (src_width <= 0 || src_height <= 0))
- return 0;
-
- if (G_UNLIKELY (!inited)) {
- inited = 1;
- img_convert_init ();
- }
-
- dst_width = src_width;
- dst_height = src_height;
-
- dst_pix = get_pix_fmt_info (dst_pix_fmt);
- src_pix = get_pix_fmt_info (src_pix_fmt);
- if (G_UNLIKELY (src_pix_fmt == dst_pix_fmt)) {
- /* no conversion needed: just copy */
- img_copy (dst, src, dst_pix_fmt, dst_width, dst_height);
- return 0;
- }
-
- ce = get_convert_table_entry (src_pix_fmt, dst_pix_fmt);
- if (ce && ce->convert) {
- /* specific conversion routine */
- ce->convert (dst, src, dst_width, dst_height);
- return 0;
- }
-
- /* gray to YUV */
- if (is_yuv_planar (dst_pix) && src_pix_fmt == PIX_FMT_GRAY8) {
- int w, h, y;
- uint8_t *d;
-
- if (dst_pix->color_type == FF_COLOR_YUV_JPEG) {
- img_copy_plane (dst->data[0], dst->linesize[0],
- src->data[0], src->linesize[0], dst_width, dst_height);
- } else {
- img_apply_table (dst->data[0], dst->linesize[0],
- src->data[0], src->linesize[0],
- dst_width, dst_height, y_jpeg_to_ccir);
- }
- /* fill U and V with 128 */
- w = dst_width;
- h = dst_height;
- w >>= dst_pix->x_chroma_shift;
- h >>= dst_pix->y_chroma_shift;
- for (i = 1; i <= 2; i++) {
- d = dst->data[i];
- for (y = 0; y < h; y++) {
- memset (d, 128, w);
- d += dst->linesize[i];
- }
- }
- return 0;
- }
-
- /* YUV to gray */
- if (is_yuv_planar (src_pix) && dst_pix_fmt == PIX_FMT_GRAY8) {
- if (src_pix->color_type == FF_COLOR_YUV_JPEG) {
- img_copy_plane (dst->data[0], dst->linesize[0],
- src->data[0], src->linesize[0], dst_width, dst_height);
- } else {
- img_apply_table (dst->data[0], dst->linesize[0],
- src->data[0], src->linesize[0],
- dst_width, dst_height, y_ccir_to_jpeg);
- }
- return 0;
- }
-
- /* YUV to YUV planar */
- if (is_yuv_planar (dst_pix) && is_yuv_planar (src_pix)) {
- int x_shift, y_shift, xy_shift;
- void (*resize_func) (uint8_t * dst, int dst_wrap,
- const uint8_t * src, int src_wrap, int width, int height);
-
- x_shift = (dst_pix->x_chroma_shift - src_pix->x_chroma_shift);
- y_shift = (dst_pix->y_chroma_shift - src_pix->y_chroma_shift);
- xy_shift = ((x_shift & 0xf) << 4) | (y_shift & 0xf);
-
- /* there must be filters for conversion at least from and to
- YUV444 format */
- switch (xy_shift) {
- case 0x00:
- resize_func = img_copy_plane;
- break;
- case 0x10:
- resize_func = shrink21;
- break;
- case 0x20:
- resize_func = shrink41;
- break;
- case 0x01:
- resize_func = shrink12;
- break;
- case 0x11:
- resize_func = shrink22;
- break;
- case 0x22:
- resize_func = shrink44;
- break;
- case 0xf0:
- resize_func = grow21;
- break;
- case 0xe0:
- resize_func = grow41;
- break;
- case 0xff:
- resize_func = grow22;
- break;
- case 0xee:
- resize_func = grow44;
- break;
- case 0xf1:
- resize_func = conv411;
- break;
- default:
- /* currently not handled */
- goto no_chroma_filter;
- }
-
- img_copy_plane (dst->data[0], dst->linesize[0],
- src->data[0], src->linesize[0], dst_width, dst_height);
-
-#define GEN_MASK(x) ((1<<(x))-1)
-#define DIV_ROUND_UP_X(v,x) (((v) + GEN_MASK(x)) >> (x))
-
- for (i = 1; i <= 2; i++) {
- gint w, h;
-
- w = DIV_ROUND_UP_X (dst_width, dst_pix->x_chroma_shift);
- h = DIV_ROUND_UP_X (dst_height, dst_pix->y_chroma_shift);
-
- resize_func (dst->data[i], dst->linesize[i],
- src->data[i], src->linesize[i], w, h);
- }
- /* if yuv color space conversion is needed, we do it here on
- the destination image */
- if (dst_pix->color_type != src_pix->color_type) {
- const uint8_t *y_table, *c_table;
-
- if (dst_pix->color_type == FF_COLOR_YUV) {
- y_table = y_jpeg_to_ccir;
- c_table = c_jpeg_to_ccir;
- } else {
- y_table = y_ccir_to_jpeg;
- c_table = c_ccir_to_jpeg;
- }
- img_apply_table (dst->data[0], dst->linesize[0],
- dst->data[0], dst->linesize[0], dst_width, dst_height, y_table);
-
- for (i = 1; i <= 2; i++)
- img_apply_table (dst->data[i], dst->linesize[i],
- dst->data[i], dst->linesize[i],
- dst_width >> dst_pix->x_chroma_shift,
- dst_height >> dst_pix->y_chroma_shift, c_table);
- }
- return 0;
- }
-no_chroma_filter:
- GST_CAT_INFO (ffmpegcolorspace_performance,
- "no direct path to convert colorspace from %s -> %s", src_pix->name,
- dst_pix->name);
-
- /* try to use an intermediate format */
- if (src_pix_fmt == PIX_FMT_YUV422 || dst_pix_fmt == PIX_FMT_YUV422) {
- /* specific case: convert to YUV422P first */
- int_pix_fmt = PIX_FMT_YUV422P;
- } else if (src_pix_fmt == PIX_FMT_UYVY422 || dst_pix_fmt == PIX_FMT_UYVY422 ||
- src_pix_fmt == PIX_FMT_YVYU422 || dst_pix_fmt == PIX_FMT_YVYU422) {
- /* specific case: convert to YUV422P first */
- int_pix_fmt = PIX_FMT_YUV422P;
- } else if (src_pix_fmt == PIX_FMT_UYVY411 || dst_pix_fmt == PIX_FMT_UYVY411) {
- /* specific case: convert to YUV411P first */
- int_pix_fmt = PIX_FMT_YUV411P;
- } else if ((src_pix->color_type == FF_COLOR_GRAY &&
- src_pix_fmt != PIX_FMT_GRAY8) ||
- (dst_pix->color_type == FF_COLOR_GRAY && dst_pix_fmt != PIX_FMT_GRAY8)) {
- /* gray8 is the normalized format */
- int_pix_fmt = PIX_FMT_GRAY8;
- } else if ((is_yuv_planar (src_pix) &&
- src_pix_fmt != PIX_FMT_YUV444P && src_pix_fmt != PIX_FMT_YUVJ444P)) {
- /* yuv444 is the normalized format */
- if (src_pix->color_type == FF_COLOR_YUV_JPEG)
- int_pix_fmt = PIX_FMT_YUVJ444P;
- else
- int_pix_fmt = PIX_FMT_YUV444P;
- } else if ((is_yuv_planar (dst_pix) &&
- dst_pix_fmt != PIX_FMT_YUV444P && dst_pix_fmt != PIX_FMT_YUVJ444P)) {
- /* yuv444 is the normalized format */
- if (dst_pix->color_type == FF_COLOR_YUV_JPEG)
- int_pix_fmt = PIX_FMT_YUVJ444P;
- else
- int_pix_fmt = PIX_FMT_YUV444P;
- } else {
- /* the two formats are rgb or gray8 or yuv[j]444p */
- if (src_pix->is_alpha && dst_pix->is_alpha)
- int_pix_fmt = PIX_FMT_RGBA32;
- else
- int_pix_fmt = PIX_FMT_RGB24;
- }
- if (avpicture_alloc (tmp, int_pix_fmt, dst_width, dst_height,
- dst->interlaced) < 0)
- return -1;
- ret = -1;
- if (img_convert (tmp, int_pix_fmt,
- src, src_pix_fmt, src_width, src_height) < 0)
- goto fail1;
-
- if (img_convert (dst, dst_pix_fmt,
- tmp, int_pix_fmt, dst_width, dst_height) < 0)
- goto fail1;
- ret = 0;
-fail1:
- avpicture_free (tmp);
- return ret;
-}
-
-/* NOTE: we scan all the pixels to have an exact information */
-static int
-get_alpha_info_pal8 (const AVPicture * src, int width, int height)
-{
- const unsigned char *p;
- int src_wrap, ret, x, y;
- unsigned int a;
- uint32_t *palette = (uint32_t *) src->data[1];
-
- p = src->data[0];
- src_wrap = src->linesize[0] - width;
- ret = 0;
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- a = palette[p[0]] >> 24;
- if (a == 0x00) {
- ret |= FF_ALPHA_TRANSP;
- } else if (a != 0xff) {
- ret |= FF_ALPHA_SEMI_TRANSP;
- }
- p++;
- }
- p += src_wrap;
- }
- return ret;
-}
-
-/**
- * Tell if an image really has transparent alpha values.
- * @return ored mask of FF_ALPHA_xxx constants
- */
-int
-img_get_alpha_info (const AVPicture * src, int pix_fmt, int width, int height)
-{
- const PixFmtInfo *pf;
- int ret;
-
- pf = get_pix_fmt_info (pix_fmt);
- /* no alpha can be represented in format */
- if (!pf->is_alpha)
- return 0;
- switch (pix_fmt) {
- case PIX_FMT_RGB32:
- ret = get_alpha_info_rgb32 (src, width, height);
- break;
- case PIX_FMT_BGR32:
- ret = get_alpha_info_bgr32 (src, width, height);
- break;
- case PIX_FMT_xRGB32:
- ret = get_alpha_info_xrgb32 (src, width, height);
- break;
- case PIX_FMT_BGRx32:
- ret = get_alpha_info_bgrx32 (src, width, height);
- break;
- case PIX_FMT_RGBA32:
- ret = get_alpha_info_rgba32 (src, width, height);
- break;
- case PIX_FMT_BGRA32:
- ret = get_alpha_info_bgra32 (src, width, height);
- break;
- case PIX_FMT_ARGB32:
- ret = get_alpha_info_argb32 (src, width, height);
- break;
- case PIX_FMT_ABGR32:
- ret = get_alpha_info_abgr32 (src, width, height);
- break;
- case PIX_FMT_RGB555:
- ret = get_alpha_info_rgb555 (src, width, height);
- break;
- case PIX_FMT_PAL8:
- ret = get_alpha_info_pal8 (src, width, height);
- break;
- default:
- /* we do not know, so everything is indicated */
- ret = FF_ALPHA_TRANSP | FF_ALPHA_SEMI_TRANSP;
- break;
- }
- return ret;
-}
-
-#ifdef HAVE_MMX
-#define DEINT_INPLACE_LINE_LUM \
- movd_m2r(lum_m4[0],mm0);\
- movd_m2r(lum_m3[0],mm1);\
- movd_m2r(lum_m2[0],mm2);\
- movd_m2r(lum_m1[0],mm3);\
- movd_m2r(lum[0],mm4);\
- punpcklbw_r2r(mm7,mm0);\
- movd_r2m(mm2,lum_m4[0]);\
- punpcklbw_r2r(mm7,mm1);\
- punpcklbw_r2r(mm7,mm2);\
- punpcklbw_r2r(mm7,mm3);\
- punpcklbw_r2r(mm7,mm4);\
- paddw_r2r(mm3,mm1);\
- psllw_i2r(1,mm2);\
- paddw_r2r(mm4,mm0);\
- psllw_i2r(2,mm1);\
- paddw_r2r(mm6,mm2);\
- paddw_r2r(mm2,mm1);\
- psubusw_r2r(mm0,mm1);\
- psrlw_i2r(3,mm1);\
- packuswb_r2r(mm7,mm1);\
- movd_r2m(mm1,lum_m2[0]);
-
-#define DEINT_LINE_LUM \
- movd_m2r(lum_m4[0],mm0);\
- movd_m2r(lum_m3[0],mm1);\
- movd_m2r(lum_m2[0],mm2);\
- movd_m2r(lum_m1[0],mm3);\
- movd_m2r(lum[0],mm4);\
- punpcklbw_r2r(mm7,mm0);\
- punpcklbw_r2r(mm7,mm1);\
- punpcklbw_r2r(mm7,mm2);\
- punpcklbw_r2r(mm7,mm3);\
- punpcklbw_r2r(mm7,mm4);\
- paddw_r2r(mm3,mm1);\
- psllw_i2r(1,mm2);\
- paddw_r2r(mm4,mm0);\
- psllw_i2r(2,mm1);\
- paddw_r2r(mm6,mm2);\
- paddw_r2r(mm2,mm1);\
- psubusw_r2r(mm0,mm1);\
- psrlw_i2r(3,mm1);\
- packuswb_r2r(mm7,mm1);\
- movd_r2m(mm1,dst[0]);
-#endif
-
-/* filter parameters: [-1 4 2 4 -1] // 8 */
-#if 0
-static void
-deinterlace_line (uint8_t * dst,
- const uint8_t * lum_m4, const uint8_t * lum_m3,
- const uint8_t * lum_m2, const uint8_t * lum_m1,
- const uint8_t * lum, int size)
-{
-#ifndef HAVE_MMX
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
- int sum;
-
- for (; size > 0; size--) {
- sum = -lum_m4[0];
- sum += lum_m3[0] << 2;
- sum += lum_m2[0] << 1;
- sum += lum_m1[0] << 2;
- sum += -lum[0];
- dst[0] = cm[(sum + 4) >> 3];
- lum_m4++;
- lum_m3++;
- lum_m2++;
- lum_m1++;
- lum++;
- dst++;
- }
-#else
-
- {
- mmx_t rounder;
-
- rounder.uw[0] = 4;
- rounder.uw[1] = 4;
- rounder.uw[2] = 4;
- rounder.uw[3] = 4;
- pxor_r2r (mm7, mm7);
- movq_m2r (rounder, mm6);
- }
- for (; size > 3; size -= 4) {
- DEINT_LINE_LUM lum_m4 += 4;
-
- lum_m3 += 4;
- lum_m2 += 4;
- lum_m1 += 4;
- lum += 4;
- dst += 4;
- }
-#endif
-}
-
-static void
-deinterlace_line_inplace (uint8_t * lum_m4, uint8_t * lum_m3, uint8_t * lum_m2,
- uint8_t * lum_m1, uint8_t * lum, int size)
-{
-#ifndef HAVE_MMX
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
- int sum;
-
- for (; size > 0; size--) {
- sum = -lum_m4[0];
- sum += lum_m3[0] << 2;
- sum += lum_m2[0] << 1;
- lum_m4[0] = lum_m2[0];
- sum += lum_m1[0] << 2;
- sum += -lum[0];
- lum_m2[0] = cm[(sum + 4) >> 3];
- lum_m4++;
- lum_m3++;
- lum_m2++;
- lum_m1++;
- lum++;
- }
-#else
-
- {
- mmx_t rounder;
-
- rounder.uw[0] = 4;
- rounder.uw[1] = 4;
- rounder.uw[2] = 4;
- rounder.uw[3] = 4;
- pxor_r2r (mm7, mm7);
- movq_m2r (rounder, mm6);
- }
- for (; size > 3; size -= 4) {
- DEINT_INPLACE_LINE_LUM lum_m4 += 4;
-
- lum_m3 += 4;
- lum_m2 += 4;
- lum_m1 += 4;
- lum += 4;
- }
-#endif
-}
-#endif
-
-/* deinterlacing : 2 temporal taps, 3 spatial taps linear filter. The
- top field is copied as is, but the bottom field is deinterlaced
- against the top field. */
-#if 0
-static void
-deinterlace_bottom_field (uint8_t * dst, int dst_wrap,
- const uint8_t * src1, int src_wrap, int width, int height)
-{
- const uint8_t *src_m2, *src_m1, *src_0, *src_p1, *src_p2;
- int y;
-
- src_m2 = src1;
- src_m1 = src1;
- src_0 = &src_m1[src_wrap];
- src_p1 = &src_0[src_wrap];
- src_p2 = &src_p1[src_wrap];
- for (y = 0; y < (height - 2); y += 2) {
- memcpy (dst, src_m1, width);
- dst += dst_wrap;
- deinterlace_line (dst, src_m2, src_m1, src_0, src_p1, src_p2, width);
- src_m2 = src_0;
- src_m1 = src_p1;
- src_0 = src_p2;
- src_p1 += 2 * src_wrap;
- src_p2 += 2 * src_wrap;
- dst += dst_wrap;
- }
- memcpy (dst, src_m1, width);
- dst += dst_wrap;
- /* do last line */
- deinterlace_line (dst, src_m2, src_m1, src_0, src_0, src_0, width);
-}
-
-static void
-deinterlace_bottom_field_inplace (uint8_t * src1, int src_wrap,
- int width, int height)
-{
- uint8_t *src_m1, *src_0, *src_p1, *src_p2;
- int y;
- uint8_t *buf;
-
- buf = (uint8_t *) av_malloc (width);
-
- src_m1 = src1;
- memcpy (buf, src_m1, width);
- src_0 = &src_m1[src_wrap];
- src_p1 = &src_0[src_wrap];
- src_p2 = &src_p1[src_wrap];
- for (y = 0; y < (height - 2); y += 2) {
- deinterlace_line_inplace (buf, src_m1, src_0, src_p1, src_p2, width);
- src_m1 = src_p1;
- src_0 = src_p2;
- src_p1 += 2 * src_wrap;
- src_p2 += 2 * src_wrap;
- }
- /* do last line */
- deinterlace_line_inplace (buf, src_m1, src_0, src_0, src_0, width);
- av_free (buf);
-}
-#endif
-
-/* deinterlace - if not supported return -1 */
-#if 0
-static int
-avpicture_deinterlace (AVPicture * dst, const AVPicture * src,
- int pix_fmt, int width, int height)
-{
- int i;
-
- if (pix_fmt != PIX_FMT_YUV420P &&
- pix_fmt != PIX_FMT_YUV422P &&
- pix_fmt != PIX_FMT_YUV444P && pix_fmt != PIX_FMT_YUV411P)
- return -1;
- if ((width & 3) != 0 || (height & 3) != 0)
- return -1;
-
- for (i = 0; i < 3; i++) {
- if (i == 1) {
- switch (pix_fmt) {
- case PIX_FMT_YUV420P:
- width >>= 1;
- height >>= 1;
- break;
- case PIX_FMT_YUV422P:
- width >>= 1;
- break;
- case PIX_FMT_YUV411P:
- width >>= 2;
- break;
- default:
- break;
- }
- }
- if (src == dst) {
- deinterlace_bottom_field_inplace (dst->data[i], dst->linesize[i],
- width, height);
- } else {
- deinterlace_bottom_field (dst->data[i], dst->linesize[i],
- src->data[i], src->linesize[i], width, height);
- }
- }
-#ifdef HAVE_MMX
- emms ();
-#endif
- return 0;
-}
-#endif
-
-#undef FIX
diff --git a/gst/ffmpegcolorspace/imgconvert_template.h b/gst/ffmpegcolorspace/imgconvert_template.h
deleted file mode 100644
index 255e7e82..00000000
--- a/gst/ffmpegcolorspace/imgconvert_template.h
+++ /dev/null
@@ -1,1741 +0,0 @@
-/*
- * Templates for image convertion routines
- * Copyright (c) 2001, 2002, 2003 Fabrice Bellard.
- *
- * This library is free software; you can redistribute it 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef RGB_OUT
-#define RGB_OUT(d, r, g, b) RGBA_OUT(d, r, g, b, 0xffU)
-#endif
-
-static void glue (uyvy422_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src,
- int width, int height)
-{
- uint8_t *s, *d, *d1, *s1;
- int w, y, cb, cr, r_add, g_add, b_add;
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
- unsigned int r, g, b;
-
- d = dst->data[0];
- s = src->data[0];
- for(;height > 0; height --) {
- d1 = d;
- s1 = s;
- for(w = width; w >= 2; w -= 2) {
- YUV_TO_RGB1_CCIR(s1[0], s1[2]);
-
- YUV_TO_RGB2_CCIR(r, g, b, s1[1]);
- RGB_OUT(d1, r, g, b);
- d1 += BPP;
-
- YUV_TO_RGB2_CCIR(r, g, b, s1[3]);
- RGB_OUT(d1, r, g, b);
- d1 += BPP;
-
- s1 += 4;
- }
- d += dst->linesize[0];
- s += src->linesize[0];
- }
-}
-
-static void glue (yuv420p_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src,
- int width, int height)
-{
- const uint8_t *y1_ptr, *y2_ptr, *cb_ptr, *cr_ptr;
- uint8_t *d, *d1, *d2;
- int w, y, cb, cr, r_add, g_add, b_add, width2;
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
- unsigned int r, g, b;
-
- d = dst->data[0];
- y1_ptr = src->data[0];
- cb_ptr = src->data[1];
- cr_ptr = src->data[2];
- width2 = (width + 1) >> 1;
- for (; height >= 2; height -= 2) {
- d1 = d;
- d2 = d + dst->linesize[0];
- y2_ptr = y1_ptr + src->linesize[0];
- for (w = width; w >= 2; w -= 2) {
- YUV_TO_RGB1_CCIR (cb_ptr[0], cr_ptr[0]);
- /* output 4 pixels */
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
-
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[1]);
- RGB_OUT (d1 + BPP, r, g, b);
-
- YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[0]);
- RGB_OUT (d2, r, g, b);
-
- YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[1]);
- RGB_OUT (d2 + BPP, r, g, b);
-
- d1 += 2 * BPP;
- d2 += 2 * BPP;
-
- y1_ptr += 2;
- y2_ptr += 2;
- cb_ptr++;
- cr_ptr++;
- }
- /* handle odd width */
- if (w) {
- YUV_TO_RGB1_CCIR (cb_ptr[0], cr_ptr[0]);
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
-
- YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[0]);
- RGB_OUT (d2, r, g, b);
- d1 += BPP;
- d2 += BPP;
- y1_ptr++;
- y2_ptr++;
- cb_ptr++;
- cr_ptr++;
- }
- d += 2 * dst->linesize[0];
- y1_ptr += 2 * src->linesize[0] - width;
- cb_ptr += src->linesize[1] - width2;
- cr_ptr += src->linesize[2] - width2;
- }
- /* handle odd height */
- if (height) {
- d1 = d;
- for (w = width; w >= 2; w -= 2) {
- YUV_TO_RGB1_CCIR (cb_ptr[0], cr_ptr[0]);
- /* output 2 pixels */
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
-
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[1]);
- RGB_OUT (d1 + BPP, r, g, b);
-
- d1 += 2 * BPP;
-
- y1_ptr += 2;
- cb_ptr++;
- cr_ptr++;
- }
- /* handle width */
- if (w) {
- YUV_TO_RGB1_CCIR (cb_ptr[0], cr_ptr[0]);
- /* output 2 pixel */
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
- d1 += BPP;
-
- y1_ptr++;
- cb_ptr++;
- cr_ptr++;
- }
- }
-}
-
-static void glue (nv12_to_, RGB_NAME) (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const uint8_t *y1_ptr, *y2_ptr, *c_ptr;
- uint8_t *d, *d1, *d2;
- int w, y, cb, cr, r_add, g_add, b_add;
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
- unsigned int r, g, b;
- int c_wrap = src->linesize[1] - ((width + 1) & ~0x01);
-
- d = dst->data[0];
- y1_ptr = src->data[0];
- c_ptr = src->data[1];
- for (; height >= 2; height -= 2) {
- d1 = d;
- d2 = d + dst->linesize[0];
- y2_ptr = y1_ptr + src->linesize[0];
- for (w = width; w >= 2; w -= 2) {
- YUV_TO_RGB1_CCIR (c_ptr[0], c_ptr[1]);
- /* output 4 pixels */
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
-
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[1]);
- RGB_OUT (d1 + BPP, r, g, b);
-
- YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[0]);
- RGB_OUT (d2, r, g, b);
-
- YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[1]);
- RGB_OUT (d2 + BPP, r, g, b);
-
- d1 += 2 * BPP;
- d2 += 2 * BPP;
-
- y1_ptr += 2;
- y2_ptr += 2;
- c_ptr += 2;
- }
- /* handle odd width */
- if (w) {
- YUV_TO_RGB1_CCIR (c_ptr[0], c_ptr[1]);
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
-
- YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[0]);
- RGB_OUT (d2, r, g, b);
- d1 += BPP;
- d2 += BPP;
- y1_ptr++;
- y2_ptr++;
- c_ptr += 2;
- }
- d += 2 * dst->linesize[0];
- y1_ptr += 2 * src->linesize[0] - width;
- c_ptr += c_wrap;
- }
- /* handle odd height */
- if (height) {
- d1 = d;
- for (w = width; w >= 2; w -= 2) {
- YUV_TO_RGB1_CCIR (c_ptr[0], c_ptr[1]);
- /* output 2 pixels */
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
-
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[1]);
- RGB_OUT (d1 + BPP, r, g, b);
-
- d1 += 2 * BPP;
-
- y1_ptr += 2;
- c_ptr += 2;
- }
- /* handle odd width */
- if (w) {
- YUV_TO_RGB1_CCIR (c_ptr[0], c_ptr[1]);
- /* output 1 pixel */
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
- d1 += BPP;
-
- y1_ptr++;
- c_ptr += 2;
- }
- }
-}
-
-static void glue (nv21_to_, RGB_NAME) (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const uint8_t *y1_ptr, *y2_ptr, *c_ptr;
- uint8_t *d, *d1, *d2;
- int w, y, cb, cr, r_add, g_add, b_add;
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
- unsigned int r, g, b;
- int c_wrap = src->linesize[1] - ((width + 1) & ~0x01);
-
- d = dst->data[0];
- y1_ptr = src->data[0];
- c_ptr = src->data[1];
- for (; height >= 2; height -= 2) {
- d1 = d;
- d2 = d + dst->linesize[0];
- y2_ptr = y1_ptr + src->linesize[0];
- for (w = width; w >= 2; w -= 2) {
- YUV_TO_RGB1_CCIR (c_ptr[1], c_ptr[0]);
- /* output 4 pixels */
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
-
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[1]);
- RGB_OUT (d1 + BPP, r, g, b);
-
- YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[0]);
- RGB_OUT (d2, r, g, b);
-
- YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[1]);
- RGB_OUT (d2 + BPP, r, g, b);
-
- d1 += 2 * BPP;
- d2 += 2 * BPP;
-
- y1_ptr += 2;
- y2_ptr += 2;
- c_ptr += 2;
- }
- /* handle odd width */
- if (w) {
- YUV_TO_RGB1_CCIR (c_ptr[1], c_ptr[0]);
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
-
- YUV_TO_RGB2_CCIR (r, g, b, y2_ptr[0]);
- RGB_OUT (d2, r, g, b);
- d1 += BPP;
- d2 += BPP;
- y1_ptr++;
- y2_ptr++;
- c_ptr += 2;
- }
- d += 2 * dst->linesize[0];
- y1_ptr += 2 * src->linesize[0] - width;
- c_ptr += c_wrap;
- }
- /* handle odd height */
- if (height) {
- d1 = d;
- for (w = width; w >= 2; w -= 2) {
- YUV_TO_RGB1_CCIR (c_ptr[1], c_ptr[0]);
- /* output 2 pixels */
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
-
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[1]);
- RGB_OUT (d1 + BPP, r, g, b);
-
- d1 += 2 * BPP;
-
- y1_ptr += 2;
- c_ptr += 2;
- }
- /* handle odd width */
- if (w) {
- YUV_TO_RGB1_CCIR (c_ptr[1], c_ptr[0]);
- /* output 1 pixel */
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
- d1 += BPP;
-
- y1_ptr++;
- c_ptr += 2;
- }
- }
-}
-
-static void glue (yuvj420p_to_, RGB_NAME) (AVPicture * dst,
- const AVPicture * src, int width, int height)
-{
- const uint8_t *y1_ptr, *y2_ptr, *cb_ptr, *cr_ptr;
- uint8_t *d, *d1, *d2;
- int w, y, cb, cr, r_add, g_add, b_add, width2;
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
- unsigned int r, g, b;
-
- d = dst->data[0];
- y1_ptr = src->data[0];
- cb_ptr = src->data[1];
- cr_ptr = src->data[2];
- width2 = (width + 1) >> 1;
- for (; height >= 2; height -= 2) {
- d1 = d;
- d2 = d + dst->linesize[0];
- y2_ptr = y1_ptr + src->linesize[0];
- for (w = width; w >= 2; w -= 2) {
- YUV_TO_RGB1 (cb_ptr[0], cr_ptr[0]);
- /* output 4 pixels */
- YUV_TO_RGB2 (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
-
- YUV_TO_RGB2 (r, g, b, y1_ptr[1]);
- RGB_OUT (d1 + BPP, r, g, b);
-
- YUV_TO_RGB2 (r, g, b, y2_ptr[0]);
- RGB_OUT (d2, r, g, b);
-
- YUV_TO_RGB2 (r, g, b, y2_ptr[1]);
- RGB_OUT (d2 + BPP, r, g, b);
-
- d1 += 2 * BPP;
- d2 += 2 * BPP;
-
- y1_ptr += 2;
- y2_ptr += 2;
- cb_ptr++;
- cr_ptr++;
- }
- /* handle odd width */
- if (w) {
- YUV_TO_RGB1 (cb_ptr[0], cr_ptr[0]);
- YUV_TO_RGB2 (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
-
- YUV_TO_RGB2 (r, g, b, y2_ptr[0]);
- RGB_OUT (d2, r, g, b);
- d1 += BPP;
- d2 += BPP;
- y1_ptr++;
- y2_ptr++;
- cb_ptr++;
- cr_ptr++;
- }
- d += 2 * dst->linesize[0];
- y1_ptr += 2 * src->linesize[0] - width;
- cb_ptr += src->linesize[1] - width2;
- cr_ptr += src->linesize[2] - width2;
- }
- /* handle odd height */
- if (height) {
- d1 = d;
- for (w = width; w >= 2; w -= 2) {
- YUV_TO_RGB1 (cb_ptr[0], cr_ptr[0]);
- /* output 2 pixels */
- YUV_TO_RGB2 (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
-
- YUV_TO_RGB2 (r, g, b, y1_ptr[1]);
- RGB_OUT (d1 + BPP, r, g, b);
-
- d1 += 2 * BPP;
-
- y1_ptr += 2;
- cb_ptr++;
- cr_ptr++;
- }
- /* handle width */
- if (w) {
- YUV_TO_RGB1 (cb_ptr[0], cr_ptr[0]);
- /* output 2 pixels */
- YUV_TO_RGB2 (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
- d1 += BPP;
-
- y1_ptr++;
- cb_ptr++;
- cr_ptr++;
- }
- }
-}
-
-static void glue (RGB_NAME, _to_yuv420p) (AVPicture * dst,
- const AVPicture * src, int width, int height)
-{
- int wrap, wrap3, width2;
- int r, g, b, r1, g1, b1, w;
- uint8_t *lum, *cb, *cr;
- const uint8_t *p;
-
- lum = dst->data[0];
- cb = dst->data[1];
- cr = dst->data[2];
-
- width2 = (width + 1) >> 1;
- wrap = dst->linesize[0];
- wrap3 = src->linesize[0];
- p = src->data[0];
- for (; height >= 2; height -= 2) {
- for (w = width; w >= 2; w -= 2) {
- RGB_IN (r, g, b, p);
- r1 = r;
- g1 = g;
- b1 = b;
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
- RGB_IN (r, g, b, p + BPP);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[1] = RGB_TO_Y_CCIR (r, g, b);
- p += wrap3;
- lum += wrap;
-
- RGB_IN (r, g, b, p);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
- RGB_IN (r, g, b, p + BPP);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[1] = RGB_TO_Y_CCIR (r, g, b);
-
- cb[0] = RGB_TO_U_CCIR (r1, g1, b1, 2);
- cr[0] = RGB_TO_V_CCIR (r1, g1, b1, 2);
-
-
- cb++;
- cr++;
- p += -wrap3 + 2 * BPP;
- lum += -wrap + 2;
- }
- if (w) {
- RGB_IN (r, g, b, p);
- r1 = r;
- g1 = g;
- b1 = b;
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
- p += wrap3;
- lum += wrap;
- RGB_IN (r, g, b, p);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
- cb[0] = RGB_TO_U_CCIR (r1, g1, b1, 1);
- cr[0] = RGB_TO_V_CCIR (r1, g1, b1, 1);
- cb++;
- cr++;
- p += -wrap3 + BPP;
- lum += -wrap + 1;
- }
- p += wrap3 + (wrap3 - width * BPP);
- lum += wrap + (wrap - width);
- cb += dst->linesize[1] - width2;
- cr += dst->linesize[2] - width2;
- }
- /* handle odd height */
- if (height) {
- for (w = width; w >= 2; w -= 2) {
- RGB_IN (r, g, b, p);
- r1 = r;
- g1 = g;
- b1 = b;
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
- RGB_IN (r, g, b, p + BPP);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[1] = RGB_TO_Y_CCIR (r, g, b);
- cb[0] = RGB_TO_U_CCIR (r1, g1, b1, 1);
- cr[0] = RGB_TO_V_CCIR (r1, g1, b1, 1);
- cb++;
- cr++;
- p += 2 * BPP;
- lum += 2;
- }
- if (w) {
- RGB_IN (r, g, b, p);
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
- cb[0] = RGB_TO_U_CCIR (r, g, b, 0);
- cr[0] = RGB_TO_V_CCIR (r, g, b, 0);
- }
- }
-}
-
-static void glue (RGB_NAME, _to_nv12) (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- int wrap, wrap3;
- int r, g, b, r1, g1, b1, w;
- uint8_t *lum, *c;
- const uint8_t *p;
-
- lum = dst->data[0];
- c = dst->data[1];
-
- wrap = dst->linesize[0];
- wrap3 = src->linesize[0];
- p = src->data[0];
- for (; height >= 2; height -= 2) {
- for (w = width; w >= 2; w -= 2) {
- RGB_IN (r, g, b, p);
- r1 = r;
- g1 = g;
- b1 = b;
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
- RGB_IN (r, g, b, p + BPP);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[1] = RGB_TO_Y_CCIR (r, g, b);
- p += wrap3;
- lum += wrap;
-
- RGB_IN (r, g, b, p);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
- RGB_IN (r, g, b, p + BPP);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[1] = RGB_TO_Y_CCIR (r, g, b);
-
- c[0] = RGB_TO_U_CCIR (r1, g1, b1, 2);
- c[1] = RGB_TO_V_CCIR (r1, g1, b1, 2);
-
-
- c += 2;
- p += -wrap3 + 2 * BPP;
- lum += -wrap + 2;
- }
- /* handle odd width */
- if (w) {
- RGB_IN (r, g, b, p);
- r1 = r;
- g1 = g;
- b1 = b;
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
- p += wrap3;
- lum += wrap;
- RGB_IN (r, g, b, p);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
- c[0] = RGB_TO_U_CCIR (r1, g1, b1, 1);
- c[1] = RGB_TO_V_CCIR (r1, g1, b1, 1);
- p += -wrap3 + BPP;
- lum += -wrap + 1;
- }
- p += wrap3 + (wrap3 - width * BPP);
- lum += wrap + (wrap - width);
- c += dst->linesize[1] - (width & ~1);
- }
- /* handle odd height */
- if (height) {
- for (w = width; w >= 2; w -= 2) {
- RGB_IN (r, g, b, p);
- r1 = r;
- g1 = g;
- b1 = b;
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
- RGB_IN (r, g, b, p + BPP);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[1] = RGB_TO_Y_CCIR (r, g, b);
- c[0] = RGB_TO_U_CCIR (r1, g1, b1, 1);
- c[1] = RGB_TO_V_CCIR (r1, g1, b1, 1);
- c += 2;
- p += 2 * BPP;
- lum += 2;
- }
- /* handle odd width */
- if (w) {
- RGB_IN (r, g, b, p);
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
- c[0] = RGB_TO_U_CCIR (r, g, b, 0);
- c[1] = RGB_TO_V_CCIR (r, g, b, 0);
- }
- }
-}
-
-static void glue (RGB_NAME, _to_nv21) (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- int wrap, wrap3;
- int r, g, b, r1, g1, b1, w;
- uint8_t *lum, *c;
- const uint8_t *p;
-
- lum = dst->data[0];
- c = dst->data[1];
-
- wrap = dst->linesize[0];
- wrap3 = src->linesize[0];
- p = src->data[0];
- for (; height >= 2; height -= 2) {
- for (w = width; w >= 2; w -= 2) {
- RGB_IN (r, g, b, p);
- r1 = r;
- g1 = g;
- b1 = b;
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
- RGB_IN (r, g, b, p + BPP);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[1] = RGB_TO_Y_CCIR (r, g, b);
- p += wrap3;
- lum += wrap;
-
- RGB_IN (r, g, b, p);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
- RGB_IN (r, g, b, p + BPP);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[1] = RGB_TO_Y_CCIR (r, g, b);
-
- c[1] = RGB_TO_U_CCIR (r1, g1, b1, 2);
- c[0] = RGB_TO_V_CCIR (r1, g1, b1, 2);
-
-
- c += 2;
- p += -wrap3 + 2 * BPP;
- lum += -wrap + 2;
- }
- /* handle odd width */
- if (w) {
- RGB_IN (r, g, b, p);
- r1 = r;
- g1 = g;
- b1 = b;
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
- p += wrap3;
- lum += wrap;
- RGB_IN (r, g, b, p);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
- c[1] = RGB_TO_U_CCIR (r1, g1, b1, 1);
- c[0] = RGB_TO_V_CCIR (r1, g1, b1, 1);
- p += -wrap3 + BPP;
- lum += -wrap + 1;
- }
- p += wrap3 + (wrap3 - width * BPP);
- lum += wrap + (wrap - width);
- c += dst->linesize[1] - (width & ~1);
- }
- /* handle odd height */
- if (height) {
- for (w = width; w >= 2; w -= 2) {
- RGB_IN (r, g, b, p);
- r1 = r;
- g1 = g;
- b1 = b;
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
-
- RGB_IN (r, g, b, p + BPP);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[1] = RGB_TO_Y_CCIR (r, g, b);
- c[1] = RGB_TO_U_CCIR (r1, g1, b1, 1);
- c[0] = RGB_TO_V_CCIR (r1, g1, b1, 1);
- c += 2;
- p += 2 * BPP;
- lum += 2;
- }
- /* handle odd width */
- if (w) {
- RGB_IN (r, g, b, p);
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
- c[1] = RGB_TO_U_CCIR (r, g, b, 0);
- c[0] = RGB_TO_V_CCIR (r, g, b, 0);
- }
- }
-}
-
-static void glue (RGB_NAME, _to_gray) (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const unsigned char *p;
- unsigned char *q;
- int r, g, b, dst_wrap, src_wrap;
- int x, y;
-
- p = src->data[0];
- src_wrap = src->linesize[0] - BPP * width;
-
- q = dst->data[0];
- dst_wrap = dst->linesize[0] - width;
-
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- RGB_IN (r, g, b, p);
- q[0] = RGB_TO_Y (r, g, b);
- q++;
- p += BPP;
- }
- p += src_wrap;
- q += dst_wrap;
- }
-}
-
-static void glue (gray_to_, RGB_NAME) (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const unsigned char *p;
- unsigned char *q;
- int r, dst_wrap, src_wrap;
- int x, y;
-
- p = src->data[0];
- src_wrap = src->linesize[0] - width;
-
- q = dst->data[0];
- dst_wrap = dst->linesize[0] - BPP * width;
-
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- r = p[0];
- RGB_OUT (q, r, r, r);
- q += BPP;
- p++;
- }
- p += src_wrap;
- q += dst_wrap;
- }
-}
-
-static void glue (RGB_NAME, _to_gray16_l) (AVPicture * dst,
- const AVPicture * src, int width, int height)
-{
- const unsigned char *p;
- unsigned char *q;
- int r, g, b, dst_wrap, src_wrap;
- int x, y;
-
- p = src->data[0];
- src_wrap = src->linesize[0] - BPP * width;
-
- q = dst->data[0];
- dst_wrap = dst->linesize[0] - 2 * width;
-
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- RGB_IN (r, g, b, p);
- GST_WRITE_UINT16_LE (q, RGB_TO_Y (r, g, b) << 8);
- q += 2;
- p += BPP;
- }
- p += src_wrap;
- q += dst_wrap;
- }
-}
-
-static void glue (gray16_l_to_, RGB_NAME) (AVPicture * dst,
- const AVPicture * src, int width, int height)
-{
- const unsigned char *p;
- unsigned char *q;
- int r, dst_wrap, src_wrap;
- int x, y;
-
- p = src->data[0];
- src_wrap = src->linesize[0] - 2 * width;
-
- q = dst->data[0];
- dst_wrap = dst->linesize[0] - BPP * width;
-
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- r = GST_READ_UINT16_LE (p) >> 8;
- RGB_OUT (q, r, r, r);
- q += BPP;
- p += 2;
- }
- p += src_wrap;
- q += dst_wrap;
- }
-}
-
-static void glue (RGB_NAME, _to_gray16_b) (AVPicture * dst,
- const AVPicture * src, int width, int height)
-{
- const unsigned char *p;
- unsigned char *q;
- int r, g, b, dst_wrap, src_wrap;
- int x, y;
-
- p = src->data[0];
- src_wrap = src->linesize[0] - BPP * width;
-
- q = dst->data[0];
- dst_wrap = dst->linesize[0] - 2 * width;
-
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- RGB_IN (r, g, b, p);
- GST_WRITE_UINT16_BE (q, RGB_TO_Y (r, g, b) << 8);
- q += 2;
- p += BPP;
- }
- p += src_wrap;
- q += dst_wrap;
- }
-}
-
-static void glue (gray16_b_to_, RGB_NAME) (AVPicture * dst,
- const AVPicture * src, int width, int height)
-{
- const unsigned char *p;
- unsigned char *q;
- int r, dst_wrap, src_wrap;
- int x, y;
-
- p = src->data[0];
- src_wrap = src->linesize[0] - 2 * width;
-
- q = dst->data[0];
- dst_wrap = dst->linesize[0] - BPP * width;
-
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- r = GST_READ_UINT16_BE (p) >> 8;
- RGB_OUT (q, r, r, r);
- q += BPP;
- p += 2;
- }
- p += src_wrap;
- q += dst_wrap;
- }
-}
-
-static void glue (pal8_to_, RGB_NAME) (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const unsigned char *p;
- unsigned char *q;
- int r, g, b, dst_wrap, src_wrap;
- int x, y;
- uint32_t v;
- const uint32_t *palette;
-
- p = src->data[0];
- src_wrap = src->linesize[0] - width;
- palette = (uint32_t *) src->data[1];
-
- q = dst->data[0];
- dst_wrap = dst->linesize[0] - BPP * width;
-
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- v = palette[p[0]];
- r = (v >> 16) & 0xff;
- g = (v >> 8) & 0xff;
- b = (v) & 0xff;
-#ifdef RGBA_OUT
- {
- int a;
- a = (v >> 24) & 0xff;
- RGBA_OUT (q, r, g, b, a);
- }
-#else
- RGB_OUT (q, r, g, b);
-#endif
- q += BPP;
- p++;
- }
- p += src_wrap;
- q += dst_wrap;
- }
-}
-
-#if !defined(FMT_RGBA32) && defined(RGBA_OUT)
-/* alpha support */
-
-static void glue (rgba32_to_, RGB_NAME) (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const uint8_t *s;
- uint8_t *d;
- int src_wrap, dst_wrap, j, y;
- unsigned int v, r, g, b, a;
-
- s = src->data[0];
- src_wrap = src->linesize[0] - width * 4;
-
- d = dst->data[0];
- dst_wrap = dst->linesize[0] - width * BPP;
-
- for (y = 0; y < height; y++) {
- for (j = 0; j < width; j++) {
- v = ((const uint32_t *) (s))[0];
- a = (v >> 24) & 0xff;
- r = (v >> 16) & 0xff;
- g = (v >> 8) & 0xff;
- b = v & 0xff;
- RGBA_OUT (d, r, g, b, a);
- s += 4;
- d += BPP;
- }
- s += src_wrap;
- d += dst_wrap;
- }
-}
-
-static void glue (RGB_NAME, _to_rgba32) (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const uint8_t *s;
- uint8_t *d;
- int src_wrap, dst_wrap, j, y;
- unsigned int r, g, b, a;
-
- s = src->data[0];
- src_wrap = src->linesize[0] - width * BPP;
-
- d = dst->data[0];
- dst_wrap = dst->linesize[0] - width * 4;
-
- for (y = 0; y < height; y++) {
- for (j = 0; j < width; j++) {
- RGBA_IN (r, g, b, a, s);
- ((uint32_t *) (d))[0] = (a << 24) | (r << 16) | (g << 8) | b;
- d += 4;
- s += BPP;
- }
- s += src_wrap;
- d += dst_wrap;
- }
-}
-#endif /* !defined(FMT_RGBA32) && defined(RGBA_OUT) */
-
-#if defined(FMT_RGBA32)
-
-#if !defined(rgba32_fcts_done)
-#define rgba32_fcts_done
-
-static void
-ayuv4444_to_rgba32 (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- uint8_t *s, *d, *d1, *s1;
- int w, y, cb, cr, r_add, g_add, b_add;
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
- unsigned int r, g, b, a;
-
- d = dst->data[0];
- s = src->data[0];
- for (; height > 0; height--) {
- d1 = d;
- s1 = s;
- for (w = width; w > 0; w--) {
- a = s1[0];
- YUV_TO_RGB1_CCIR (s1[2], s1[3]);
-
- YUV_TO_RGB2_CCIR (r, g, b, s1[1]);
- RGBA_OUT (d1, r, g, b, a);
- d1 += BPP;
- s1 += 4;
- }
- d += dst->linesize[0];
- s += src->linesize[0];
- }
-}
-
-static void
-rgba32_to_ayuv4444 (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- int src_wrap, dst_wrap, x, y;
- int r, g, b, a;
- uint8_t *d;
- const uint8_t *p;
-
- src_wrap = src->linesize[0] - width * BPP;
- dst_wrap = dst->linesize[0] - width * 4;
- d = dst->data[0];
- p = src->data[0];
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- RGBA_IN (r, g, b, a, p);
- d[0] = a;
- d[1] = RGB_TO_Y_CCIR (r, g, b);
- d[2] = RGB_TO_U_CCIR (r, g, b, 0);
- d[3] = RGB_TO_V_CCIR (r, g, b, 0);
- p += BPP;
- d += 4;
- }
- p += src_wrap;
- d += dst_wrap;
- }
-}
-
-#endif /* !defined(rgba32_fcts_done) */
-
-#endif /* defined(FMT_RGBA32) */
-
-#if defined(FMT_BGRA32)
-#if !defined(bgra32_fcts_done)
-#define bgra32_fcts_done
-
-static void
-bgra32_to_ayuv4444 (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- int src_wrap, dst_wrap, x, y;
- int r, g, b, a;
- uint8_t *d;
- const uint8_t *p;
-
- src_wrap = src->linesize[0] - width * BPP;
- dst_wrap = dst->linesize[0] - width * 4;
- d = dst->data[0];
- p = src->data[0];
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- RGBA_IN (r, g, b, a, p);
- d[0] = a;
- d[1] = RGB_TO_Y_CCIR (r, g, b);
- d[2] = RGB_TO_U_CCIR (r, g, b, 0);
- d[3] = RGB_TO_V_CCIR (r, g, b, 0);
- p += BPP;
- d += 4;
- }
- p += src_wrap;
- d += dst_wrap;
- }
-}
-
-static void
-ayuv4444_to_bgra32 (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- uint8_t *s, *d, *d1, *s1;
- int w, y, cb, cr, r_add, g_add, b_add;
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
- unsigned int r, g, b, a;
-
- d = dst->data[0];
- s = src->data[0];
- for (; height > 0; height--) {
- d1 = d;
- s1 = s;
- for (w = width; w > 0; w--) {
- a = s1[0];
- YUV_TO_RGB1_CCIR (s1[2], s1[3]);
-
- YUV_TO_RGB2_CCIR (r, g, b, s1[1]);
- RGBA_OUT (d1, r, g, b, a);
- d1 += BPP;
- s1 += 4;
- }
- d += dst->linesize[0];
- s += src->linesize[0];
- }
-}
-
-#endif /* !defined(bgra32_fcts_done) */
-
-#endif /* defined(FMT_BGRA32) */
-
-#if defined(FMT_ARGB32)
-
-#if !defined(argb32_fcts_done)
-#define argb32_fcts_done
-
-static void
-ayuv4444_to_argb32 (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- uint8_t *s, *d, *d1, *s1;
- int w, y, cb, cr, r_add, g_add, b_add;
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
- unsigned int r, g, b, a;
-
- d = dst->data[0];
- s = src->data[0];
- for (; height > 0; height--) {
- d1 = d;
- s1 = s;
- for (w = width; w > 0; w--) {
- a = s1[0];
- YUV_TO_RGB1_CCIR (s1[2], s1[3]);
-
- YUV_TO_RGB2_CCIR (r, g, b, s1[1]);
- RGBA_OUT (d1, r, g, b, a);
- d1 += BPP;
- s1 += 4;
- }
- d += dst->linesize[0];
- s += src->linesize[0];
- }
-}
-
-static void
-argb32_to_ayuv4444 (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- int src_wrap, dst_wrap, x, y;
- int r, g, b, a;
- uint8_t *d;
- const uint8_t *p;
-
- src_wrap = src->linesize[0] - width * BPP;
- dst_wrap = dst->linesize[0] - width * 4;
- d = dst->data[0];
- p = src->data[0];
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- RGBA_IN (r, g, b, a, p);
- d[0] = a;
- d[1] = RGB_TO_Y_CCIR (r, g, b);
- d[2] = RGB_TO_U_CCIR (r, g, b, 0);
- d[3] = RGB_TO_V_CCIR (r, g, b, 0);
- p += BPP;
- d += 4;
- }
- p += src_wrap;
- d += dst_wrap;
- }
-}
-
-#endif /* !defined(argb32_fcts_done) */
-
-#endif /* defined(FMT_ARGB32) */
-
-#if defined(FMT_ABGR32)
-#if !defined(abgr32_fcts_done)
-#define abgr32_fcts_done
-
-static void
-abgr32_to_ayuv4444 (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- int src_wrap, dst_wrap, x, y;
- int r, g, b, a;
- uint8_t *d;
- const uint8_t *p;
-
- src_wrap = src->linesize[0] - width * BPP;
- dst_wrap = dst->linesize[0] - width * 4;
- d = dst->data[0];
- p = src->data[0];
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- RGBA_IN (r, g, b, a, p);
- d[0] = a;
- d[1] = RGB_TO_Y_CCIR (r, g, b);
- d[2] = RGB_TO_U_CCIR (r, g, b, 0);
- d[3] = RGB_TO_V_CCIR (r, g, b, 0);
- p += BPP;
- d += 4;
- }
- p += src_wrap;
- d += dst_wrap;
- }
-}
-
-static void
-ayuv4444_to_abgr32 (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- uint8_t *s, *d, *d1, *s1;
- int w, y, cb, cr, r_add, g_add, b_add;
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
- unsigned int r, g, b, a;
-
- d = dst->data[0];
- s = src->data[0];
- for (; height > 0; height--) {
- d1 = d;
- s1 = s;
- for (w = width; w > 0; w--) {
- a = s1[0];
- YUV_TO_RGB1_CCIR (s1[2], s1[3]);
-
- YUV_TO_RGB2_CCIR (r, g, b, s1[1]);
- RGBA_OUT (d1, r, g, b, a);
- d1 += BPP;
- s1 += 4;
- }
- d += dst->linesize[0];
- s += src->linesize[0];
- }
-}
-
-#endif /* !defined(abgr32_fcts_done) */
-
-#endif /* defined(FMT_ABGR32) */
-
-#ifndef FMT_RGB24
-
-static void glue (rgb24_to_, RGB_NAME) (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const uint8_t *s;
- uint8_t *d;
- int src_wrap, dst_wrap, j, y;
- unsigned int r, g, b;
-
- s = src->data[0];
- src_wrap = src->linesize[0] - width * 3;
-
- d = dst->data[0];
- dst_wrap = dst->linesize[0] - width * BPP;
-
- for (y = 0; y < height; y++) {
- for (j = 0; j < width; j++) {
- r = s[0];
- g = s[1];
- b = s[2];
- RGB_OUT (d, r, g, b);
- s += 3;
- d += BPP;
- }
- s += src_wrap;
- d += dst_wrap;
- }
-}
-
-static void glue (RGB_NAME, _to_rgb24) (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const uint8_t *s;
- uint8_t *d;
- int src_wrap, dst_wrap, j, y;
- unsigned int r, g, b;
-
- s = src->data[0];
- src_wrap = src->linesize[0] - width * BPP;
-
- d = dst->data[0];
- dst_wrap = dst->linesize[0] - width * 3;
-
- for (y = 0; y < height; y++) {
- for (j = 0; j < width; j++) {
- RGB_IN (r, g, b, s)
- d[0] = r;
- d[1] = g;
- d[2] = b;
- d += 3;
- s += BPP;
- }
- s += src_wrap;
- d += dst_wrap;
- }
-}
-
-#endif /* !FMT_RGB24 */
-
-#ifdef FMT_RGB24
-
-static void
-yuv444p_to_rgb24 (AVPicture * dst, const AVPicture * src, int width, int height)
-{
- const uint8_t *y1_ptr, *cb_ptr, *cr_ptr;
- uint8_t *d, *d1;
- int w, y, cb, cr, r_add, g_add, b_add;
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
- unsigned int r, g, b;
-
- d = dst->data[0];
- y1_ptr = src->data[0];
- cb_ptr = src->data[1];
- cr_ptr = src->data[2];
- for (; height > 0; height--) {
- d1 = d;
- for (w = width; w > 0; w--) {
- YUV_TO_RGB1_CCIR (cb_ptr[0], cr_ptr[0]);
-
- YUV_TO_RGB2_CCIR (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
- d1 += BPP;
-
- y1_ptr++;
- cb_ptr++;
- cr_ptr++;
- }
- d += dst->linesize[0];
- y1_ptr += src->linesize[0] - width;
- cb_ptr += src->linesize[1] - width;
- cr_ptr += src->linesize[2] - width;
- }
-}
-
-static void
-yuvj444p_to_rgb24 (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const uint8_t *y1_ptr, *cb_ptr, *cr_ptr;
- uint8_t *d, *d1;
- int w, y, cb, cr, r_add, g_add, b_add;
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
- unsigned int r, g, b;
-
- d = dst->data[0];
- y1_ptr = src->data[0];
- cb_ptr = src->data[1];
- cr_ptr = src->data[2];
- for (; height > 0; height--) {
- d1 = d;
- for (w = width; w > 0; w--) {
- YUV_TO_RGB1 (cb_ptr[0], cr_ptr[0]);
-
- YUV_TO_RGB2 (r, g, b, y1_ptr[0]);
- RGB_OUT (d1, r, g, b);
- d1 += BPP;
-
- y1_ptr++;
- cb_ptr++;
- cr_ptr++;
- }
- d += dst->linesize[0];
- y1_ptr += src->linesize[0] - width;
- cb_ptr += src->linesize[1] - width;
- cr_ptr += src->linesize[2] - width;
- }
-}
-
-static void
-rgb24_to_yuv444p (AVPicture * dst, const AVPicture * src, int width, int height)
-{
- int src_wrap, x, y;
- int r, g, b;
- uint8_t *lum, *cb, *cr;
- const uint8_t *p;
-
- lum = dst->data[0];
- cb = dst->data[1];
- cr = dst->data[2];
-
- src_wrap = src->linesize[0] - width * BPP;
- p = src->data[0];
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- RGB_IN (r, g, b, p);
- lum[0] = RGB_TO_Y_CCIR (r, g, b);
- cb[0] = RGB_TO_U_CCIR (r, g, b, 0);
- cr[0] = RGB_TO_V_CCIR (r, g, b, 0);
- p += BPP;
- cb++;
- cr++;
- lum++;
- }
- p += src_wrap;
- lum += dst->linesize[0] - width;
- cb += dst->linesize[1] - width;
- cr += dst->linesize[2] - width;
- }
-}
-
-static void
-rgb24_to_yuvj420p (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- int wrap, wrap3, width2;
- int r, g, b, r1, g1, b1, w;
- uint8_t *lum, *cb, *cr;
- const uint8_t *p;
-
- lum = dst->data[0];
- cb = dst->data[1];
- cr = dst->data[2];
-
- width2 = (width + 1) >> 1;
- wrap = dst->linesize[0];
- wrap3 = src->linesize[0];
- p = src->data[0];
- for (; height >= 2; height -= 2) {
- for (w = width; w >= 2; w -= 2) {
- RGB_IN (r, g, b, p);
- r1 = r;
- g1 = g;
- b1 = b;
- lum[0] = RGB_TO_Y (r, g, b);
-
- RGB_IN (r, g, b, p + BPP);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[1] = RGB_TO_Y (r, g, b);
- p += wrap3;
- lum += wrap;
-
- RGB_IN (r, g, b, p);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[0] = RGB_TO_Y (r, g, b);
-
- RGB_IN (r, g, b, p + BPP);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[1] = RGB_TO_Y (r, g, b);
-
- cb[0] = RGB_TO_U (r1, g1, b1, 2);
- cr[0] = RGB_TO_V (r1, g1, b1, 2);
-
- cb++;
- cr++;
- p += -wrap3 + 2 * BPP;
- lum += -wrap + 2;
- }
- if (w) {
- RGB_IN (r, g, b, p);
- r1 = r;
- g1 = g;
- b1 = b;
- lum[0] = RGB_TO_Y (r, g, b);
- p += wrap3;
- lum += wrap;
- RGB_IN (r, g, b, p);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[0] = RGB_TO_Y (r, g, b);
- cb[0] = RGB_TO_U (r1, g1, b1, 1);
- cr[0] = RGB_TO_V (r1, g1, b1, 1);
- cb++;
- cr++;
- p += -wrap3 + BPP;
- lum += -wrap + 1;
- }
- p += wrap3 + (wrap3 - width * BPP);
- lum += wrap + (wrap - width);
- cb += dst->linesize[1] - width2;
- cr += dst->linesize[2] - width2;
- }
- /* handle odd height */
- if (height) {
- for (w = width; w >= 2; w -= 2) {
- RGB_IN (r, g, b, p);
- r1 = r;
- g1 = g;
- b1 = b;
- lum[0] = RGB_TO_Y (r, g, b);
-
- RGB_IN (r, g, b, p + BPP);
- r1 += r;
- g1 += g;
- b1 += b;
- lum[1] = RGB_TO_Y (r, g, b);
- cb[0] = RGB_TO_U (r1, g1, b1, 1);
- cr[0] = RGB_TO_V (r1, g1, b1, 1);
- cb++;
- cr++;
- p += 2 * BPP;
- lum += 2;
- }
- if (w) {
- RGB_IN (r, g, b, p);
- lum[0] = RGB_TO_Y (r, g, b);
- cb[0] = RGB_TO_U (r, g, b, 0);
- cr[0] = RGB_TO_V (r, g, b, 0);
- }
- }
-}
-
-static void
-rgb24_to_yuvj444p (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- int src_wrap, x, y;
- int r, g, b;
- uint8_t *lum, *cb, *cr;
- const uint8_t *p;
-
- lum = dst->data[0];
- cb = dst->data[1];
- cr = dst->data[2];
-
- src_wrap = src->linesize[0] - width * BPP;
- p = src->data[0];
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- RGB_IN (r, g, b, p);
- lum[0] = RGB_TO_Y (r, g, b);
- cb[0] = RGB_TO_U (r, g, b, 0);
- cr[0] = RGB_TO_V (r, g, b, 0);
- p += BPP;
- cb++;
- cr++;
- lum++;
- }
- p += src_wrap;
- lum += dst->linesize[0] - width;
- cb += dst->linesize[1] - width;
- cr += dst->linesize[2] - width;
- }
-}
-
-static void
-ayuv4444_to_rgb24 (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- uint8_t *s, *d, *d1, *s1;
- int w, y, cb, cr, r_add, g_add, b_add;
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
- unsigned int r, g, b;
-
- d = dst->data[0];
- s = src->data[0];
- for (; height > 0; height--) {
- d1 = d;
- s1 = s;
- for (w = width; w > 0; w--) {
- YUV_TO_RGB1_CCIR (s1[2], s1[3]);
-
- YUV_TO_RGB2_CCIR (r, g, b, s1[1]);
- RGB_OUT (d1, r, g, b);
- d1 += BPP;
- s1 += 4;
- }
- d += dst->linesize[0];
- s += src->linesize[0];
- }
-}
-
-static void
-rgb24_to_ayuv4444 (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- int src_wrap, dst_wrap, x, y;
- int r, g, b;
- uint8_t *d;
- const uint8_t *p;
-
- src_wrap = src->linesize[0] - width * BPP;
- dst_wrap = dst->linesize[0] - width * 4;
- d = dst->data[0];
- p = src->data[0];
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- RGB_IN (r, g, b, p);
- d[0] = 0xff;
- d[1] = RGB_TO_Y_CCIR (r, g, b);
- d[2] = RGB_TO_U_CCIR (r, g, b, 0);
- d[3] = RGB_TO_V_CCIR (r, g, b, 0);
- p += BPP;
- d += 4;
- }
- p += src_wrap;
- d += dst_wrap;
- }
-}
-
-static void
-v308_to_rgb24 (AVPicture * dst, const AVPicture * src, int width, int height)
-{
- uint8_t *s, *d, *d1, *s1;
- int w, y, cb, cr, r_add, g_add, b_add;
- uint8_t *cm = cropTbl + MAX_NEG_CROP;
- unsigned int r, g, b;
-
- d = dst->data[0];
- s = src->data[0];
- for (; height > 0; height--) {
- d1 = d;
- s1 = s;
- for (w = width; w > 0; w--) {
- YUV_TO_RGB1_CCIR (s1[1], s1[2]);
-
- YUV_TO_RGB2_CCIR (r, g, b, s1[0]);
- RGB_OUT (d1, r, g, b);
- d1 += BPP;
- s1 += 3;
- }
- d += dst->linesize[0];
- s += src->linesize[0];
- }
-}
-
-static void
-rgb24_to_v308 (AVPicture * dst, const AVPicture * src, int width, int height)
-{
- int src_wrap, dst_wrap, x, y;
- int r, g, b;
- uint8_t *d;
- const uint8_t *p;
-
- src_wrap = src->linesize[0] - width * BPP;
- dst_wrap = dst->linesize[0] - width * 3;
- d = dst->data[0];
- p = src->data[0];
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- RGB_IN (r, g, b, p);
- d[0] = RGB_TO_Y_CCIR (r, g, b);
- d[1] = RGB_TO_U_CCIR (r, g, b, 0);
- d[2] = RGB_TO_V_CCIR (r, g, b, 0);
- p += BPP;
- d += 3;
- }
- p += src_wrap;
- d += dst_wrap;
- }
-}
-#endif /* FMT_RGB24 */
-
-#if defined(FMT_RGB24) || defined(FMT_RGBA32)
-
-static void glue (RGB_NAME, _to_pal8) (AVPicture * dst, const AVPicture * src,
- int width, int height)
-{
- const unsigned char *p;
- unsigned char *q;
- int dst_wrap, src_wrap;
- int x, y, has_alpha;
- unsigned int r, g, b;
-
- p = src->data[0];
- src_wrap = src->linesize[0] - BPP * width;
-
- q = dst->data[0];
- dst_wrap = dst->linesize[0] - width;
- has_alpha = 0;
-
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
-#ifdef RGBA_IN
- {
- unsigned int a;
- RGBA_IN (r, g, b, a, p);
- /* crude approximation for alpha ! */
- if (a < 0x80) {
- has_alpha = 1;
- q[0] = TRANSP_INDEX;
- } else {
- q[0] = gif_clut_index (r, g, b);
- }
- }
-#else
- RGB_IN (r, g, b, p);
- q[0] = gif_clut_index (r, g, b);
-#endif
- q++;
- p += BPP;
- }
- p += src_wrap;
- q += dst_wrap;
- }
-
- build_rgb_palette (dst->data[1], has_alpha);
-}
-
-#endif /* defined(FMT_RGB24) || defined(FMT_RGBA32) */
-
-#ifdef RGBA_IN
-
-static int glue (get_alpha_info_, RGB_NAME) (const AVPicture * src,
- int width, int height)
-{
- const unsigned char *p;
- int src_wrap, ret, x, y;
- unsigned int r, g, b, a;
-
- p = src->data[0];
- src_wrap = src->linesize[0] - BPP * width;
- ret = 0;
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- RGBA_IN (r, g, b, a, p);
- if (a == 0x00) {
- ret |= FF_ALPHA_TRANSP;
- } else if (a != 0xff) {
- ret |= FF_ALPHA_SEMI_TRANSP;
- }
- p += BPP;
- }
- p += src_wrap;
- }
- return ret;
-}
-
-#endif /* RGBA_IN */
-
-#undef RGB_IN
-#undef RGBA_IN
-#undef RGB_OUT
-#undef RGBA_OUT
-#undef BPP
-#undef RGB_NAME
-#undef FMT_RGB24
-#undef FMT_RGBA32
diff --git a/gst/ffmpegcolorspace/mem.c b/gst/ffmpegcolorspace/mem.c
deleted file mode 100644
index 5c3a8a38..00000000
--- a/gst/ffmpegcolorspace/mem.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * default memory allocator for libavcodec
- * Copyright (c) 2002 Fabrice Bellard.
- *
- * This library is free software; you can redistribute it 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/**
- * @file mem.c
- * default memory allocator for libavcodec.
- */
-
-#include "avcodec.h"
-
-/* here we can use OS dependant allocation functions */
-#undef malloc
-#undef free
-#undef realloc
-
-#include <stdlib.h>
-
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-
-/* you can redefine av_malloc and av_free in your project to use your
- memory allocator. You do not need to suppress this file because the
- linker will do it automatically */
-
-/**
- * Memory allocation of size byte with alignment suitable for all
- * memory accesses (including vectors if available on the
- * CPU). av_malloc(0) must return a non NULL pointer.
- */
-void *
-av_malloc (unsigned int size)
-{
- void *ptr;
-
-#ifdef MEMALIGN_HACK
- int diff;
-
- ptr = malloc (size + 16 + 1);
- diff = ((-(int) ptr - 1) & 15) + 1;
- ptr += diff;
- ((char *) ptr)[-1] = diff;
-#elif defined (HAVE_MEMALIGN)
- ptr = memalign (16, size);
- /* Why 64?
- Indeed, we should align it:
- on 4 for 386
- on 16 for 486
- on 32 for 586, PPro - k6-III
- on 64 for K7 (maybe for P3 too).
- Because L1 and L2 caches are aligned on those values.
- But I don't want to code such logic here!
- */
- /* Why 16?
- because some cpus need alignment, for example SSE2 on P4, & most RISC cpus
- it will just trigger an exception and the unaligned load will be done in the
- exception handler or it will just segfault (SSE2 on P4)
- Why not larger? because i didnt see a difference in benchmarks ...
- */
- /* benchmarks with p3
- memalign(64)+1 3071,3051,3032
- memalign(64)+2 3051,3032,3041
- memalign(64)+4 2911,2896,2915
- memalign(64)+8 2545,2554,2550
- memalign(64)+16 2543,2572,2563
- memalign(64)+32 2546,2545,2571
- memalign(64)+64 2570,2533,2558
-
- btw, malloc seems to do 8 byte alignment by default here
- */
-#else
- ptr = malloc (size);
-#endif
- return ptr;
-}
-
-/**
- * av_realloc semantics (same as glibc): if ptr is NULL and size > 0,
- * identical to malloc(size). If size is zero, it is identical to
- * free(ptr) and NULL is returned.
- */
-void *
-av_realloc (void *ptr, unsigned int size)
-{
-#ifdef MEMALIGN_HACK
- //FIXME this isnt aligned correctly though it probably isnt needed
- int diff;
-
- if (!ptr)
- return av_malloc (size);
- diff = ((char *) ptr)[-1];
- return realloc (ptr - diff, size + diff) + diff;
-#else
- return realloc (ptr, size);
-#endif
-}
-
-/* NOTE: ptr = NULL is explicetly allowed */
-void
-av_free (void *ptr)
-{
- /* XXX: this test should not be needed on most libcs */
- if (ptr)
-#ifdef MEMALIGN_HACK
- free (ptr - ((char *) ptr)[-1]);
-#else
- free (ptr);
-#endif
-}
diff --git a/gst/ffmpegcolorspace/utils.c b/gst/ffmpegcolorspace/utils.c
deleted file mode 100644
index 49d86e78..00000000
--- a/gst/ffmpegcolorspace/utils.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * utils for libavcodec
- * Copyright (c) 2001 Fabrice Bellard.
- * Copyright (c) 2003 Michel Bardiaux for the av_log API
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
- *
- * This library is free software; you can redistribute it 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/**
- * @file utils.c
- * utils.
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <limits.h>
-
-void *
-av_mallocz (unsigned int size)
-{
- void *ptr;
-
- ptr = av_malloc (size);
- if (!ptr)
- return NULL;
- memset (ptr, 0, size);
- return ptr;
-}
-
-char *
-av_strdup (const char *s)
-{
- char *ptr;
- int len;
-
- len = strlen (s) + 1;
- ptr = av_malloc (len);
- if (!ptr)
- return NULL;
- memcpy (ptr, s, len);
- return ptr;
-}
-
-/**
- * realloc which does nothing if the block is large enough
- */
-void *
-av_fast_realloc (void *ptr, unsigned int *size, unsigned int min_size)
-{
- if (min_size < *size)
- return ptr;
-
- *size = 17 * min_size / 16 + 32;
-
- return av_realloc (ptr, *size);
-}
-
-
-static unsigned int last_static = 0;
-static unsigned int allocated_static = 0;
-static void **array_static = NULL;
-
-/**
- * allocation of static arrays - do not use for normal allocation.
- */
-void *
-av_mallocz_static (unsigned int size)
-{
- void *ptr = av_mallocz (size);
-
- if (ptr) {
- array_static =
- av_fast_realloc (array_static, &allocated_static,
- sizeof (void *) * (last_static + 1));
- array_static[last_static++] = ptr;
- }
-
- return ptr;
-}
-
-/**
- * free all static arrays and reset pointers to 0.
- */
-void
-av_free_static (void)
-{
- while (last_static) {
- av_freep (&array_static[--last_static]);
- }
- av_freep (&array_static);
-}
-
-/**
- * Frees memory and sets the pointer to NULL.
- * @param arg pointer to the pointer which should be freed
- */
-void
-av_freep (void *arg)
-{
- void **ptr = (void **) arg;
-
- av_free (*ptr);
- *ptr = NULL;
-}
-
-void
-avcodec_get_context_defaults (AVCodecContext * s)
-{
- memset (s, 0, sizeof (AVCodecContext));
-
- s->frame_rate_base = 1;
- s->frame_rate = 25;
-}
-
-/**
- * allocates a AVCodecContext and set it to defaults.
- * this can be deallocated by simply calling free()
- */
-AVCodecContext *
-avcodec_alloc_context (void)
-{
- AVCodecContext *avctx = av_malloc (sizeof (AVCodecContext));
-
- if (avctx == NULL)
- return NULL;
-
- avcodec_get_context_defaults (avctx);
-
- return avctx;
-}
-
-/* must be called before any other functions */
-void
-avcodec_init (void)
-{
- static int inited = 0;
-
- if (inited != 0)
- return;
- inited = 1;
-
- dsputil_static_init ();
-}
diff --git a/gst/gdp/Makefile.am b/gst/gdp/Makefile.am
deleted file mode 100644
index b42a955f..00000000
--- a/gst/gdp/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-plugin_LTLIBRARIES = libgstgdp.la
-
-libgstgdp_la_SOURCES = \
- gstgdp.c \
- gstgdppay.c \
- gstgdpdepay.c
-
-libgstgdp_la_CFLAGS = $(GST_BASE_CFLAGS) $(GST_CFLAGS)
-libgstgdp_la_LIBADD = $(GST_BASE_LIBS) $(GST_GDP_LIBS)
-libgstgdp_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstgdp_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = \
- gstgdppay.h \
- gstgdpdepay.h
diff --git a/gst/gdp/README b/gst/gdp/README
deleted file mode 100644
index 6b84afc4..00000000
--- a/gst/gdp/README
+++ /dev/null
@@ -1,22 +0,0 @@
-Sample pipelines:
-- replacing tcpserversink protocol=gdp with gdppay ! tcpserversink:
- - raw audio:
- - server:
- gst-launch -v audiotestsrc ! gdppay version=0.2 ! tcpserversink
- - client:
- gst-launch -v tcpclientsrc protocol=gdp ! alsasink sync=FALSE
-
- - vorbis packets:
- - server:
- gst-launch -v audiotestsrc ! audioconvert ! vorbisenc ! gdppay version=0.2 ! tcpserversink
- - client:
- gst-launch -v tcpclientsrc protocol=gdp ! vorbisdec ! audioconvert ! alsasink sync=FALSE
-
- - ogg packets:
- - server:
- gst-launch -v audiotestsrc ! audioconvert ! vorbisenc ! oggmux ! gdppay version=0.2 ! tcpserversink
- - client:
- gst-launch -v tcpclientsrc protocol=gdp ! oggdemux ! vorbisdec ! audioconvert ! alsasink sync=FALSE
-
- In all the client pipelines, tcpclientsrc protocol=gdp can be replaced with
- tcpclientsrc ! gdpdepay
diff --git a/gst/gdp/gstgdp.c b/gst/gdp/gstgdp.c
deleted file mode 100644
index 31d32598..00000000
--- a/gst/gdp/gstgdp.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* GStreamer
- * Copyright (C) 2006 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gst/dataprotocol/dataprotocol.h>
-
-#include "gstgdppay.h"
-#include "gstgdpdepay.h"
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- gst_dp_init ();
-
- if (!gst_gdp_depay_plugin_init (plugin))
- return FALSE;
-
- if (!gst_gdp_pay_plugin_init (plugin))
- return FALSE;
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR,
- "gdp",
- "Payload/depayload GDP packets", plugin_init,
- VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
diff --git a/gst/gdp/gstgdpdepay.c b/gst/gdp/gstgdpdepay.c
deleted file mode 100644
index a72cc303..00000000
--- a/gst/gdp/gstgdpdepay.c
+++ /dev/null
@@ -1,482 +0,0 @@
-/* GStreamer
- * Copyright (C) 2006 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-gdpdepay
- * @see_also: gdppay
- *
- * This element depayloads GStreamer Data Protocol buffers back to deserialized
- * buffers and events.
- *
- * <refsect2>
- * |[
- * gst-launch -v -m filesrc location=test.gdp ! gdpdepay ! xvimagesink
- * ]| This pipeline plays back a serialized video stream as created in the
- * example for gdppay.
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include <gst/dataprotocol/dataprotocol.h>
-
-#include "gstgdpdepay.h"
-
-/* elementfactory information */
-static const GstElementDetails gdp_depay_details =
-GST_ELEMENT_DETAILS ("GDP Depayloader",
- "GDP/Depayloader",
- "Depayloads GStreamer Data Protocol buffers",
- "Thomas Vander Stichele <thomas at apestaart dot org>");
-
-enum
-{
- PROP_0,
-};
-
-static GstStaticPadTemplate gdp_depay_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-gdp"));
-
-static GstStaticPadTemplate gdp_depay_src_template =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-GST_DEBUG_CATEGORY_STATIC (gst_gdp_depay_debug);
-#define GST_CAT_DEFAULT gst_gdp_depay_debug
-
-#define _do_init(x) \
- GST_DEBUG_CATEGORY_INIT (gst_gdp_depay_debug, "gdpdepay", 0, \
- "GDP depayloader");
-
-GST_BOILERPLATE_FULL (GstGDPDepay, gst_gdp_depay, GstElement,
- GST_TYPE_ELEMENT, _do_init);
-
-static gboolean gst_gdp_depay_sink_event (GstPad * pad, GstEvent * event);
-static gboolean gst_gdp_depay_src_event (GstPad * pad, GstEvent * event);
-
-static GstFlowReturn gst_gdp_depay_chain (GstPad * pad, GstBuffer * buffer);
-
-static GstStateChangeReturn gst_gdp_depay_change_state (GstElement *
- element, GstStateChange transition);
-
-static void gst_gdp_depay_finalize (GObject * object);
-
-static void
-gst_gdp_depay_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &gdp_depay_details);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gdp_depay_sink_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gdp_depay_src_template));
-}
-
-static void
-gst_gdp_depay_class_init (GstGDPDepayClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_gdp_depay_change_state);
- gobject_class->finalize = gst_gdp_depay_finalize;
-}
-
-static void
-gst_gdp_depay_init (GstGDPDepay * gdpdepay, GstGDPDepayClass * g_class)
-{
- gdpdepay->sinkpad =
- gst_pad_new_from_static_template (&gdp_depay_sink_template, "sink");
- gst_pad_set_chain_function (gdpdepay->sinkpad,
- GST_DEBUG_FUNCPTR (gst_gdp_depay_chain));
- gst_pad_set_event_function (gdpdepay->sinkpad,
- GST_DEBUG_FUNCPTR (gst_gdp_depay_sink_event));
- gst_element_add_pad (GST_ELEMENT (gdpdepay), gdpdepay->sinkpad);
-
- gdpdepay->srcpad =
- gst_pad_new_from_static_template (&gdp_depay_src_template, "src");
- gst_pad_set_event_function (gdpdepay->srcpad,
- GST_DEBUG_FUNCPTR (gst_gdp_depay_src_event));
- /* our caps will always be decided by the incoming GDP caps buffers */
- gst_pad_use_fixed_caps (gdpdepay->srcpad);
- gst_element_add_pad (GST_ELEMENT (gdpdepay), gdpdepay->srcpad);
-
- gdpdepay->adapter = gst_adapter_new ();
-}
-
-static void
-gst_gdp_depay_finalize (GObject * gobject)
-{
- GstGDPDepay *this;
-
- this = GST_GDP_DEPAY (gobject);
- if (this->caps)
- gst_caps_unref (this->caps);
- g_free (this->header);
- gst_adapter_clear (this->adapter);
- g_object_unref (this->adapter);
-
- GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (gobject));
-}
-
-static gboolean
-gst_gdp_depay_sink_event (GstPad * pad, GstEvent * event)
-{
- GstGDPDepay *this;
- gboolean res = TRUE;
-
- this = GST_GDP_DEPAY (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_START:
- /* forward flush start */
- res = gst_pad_push_event (this->srcpad, event);
- break;
- case GST_EVENT_FLUSH_STOP:
- /* clear adapter on flush */
- gst_adapter_clear (this->adapter);
- /* forward flush stop */
- res = gst_pad_push_event (this->srcpad, event);
- break;
- case GST_EVENT_EOS:
- /* after EOS, we don't expect to output anything anymore */
- res = gst_pad_push_event (this->srcpad, event);
- break;
- case GST_EVENT_NEWSEGMENT:
- case GST_EVENT_TAG:
- case GST_EVENT_BUFFERSIZE:
- default:
- /* we unref most events as we take them from the datastream */
- gst_event_unref (event);
- break;
- }
- gst_object_unref (this);
-
- return res;
-}
-
-static gboolean
-gst_gdp_depay_src_event (GstPad * pad, GstEvent * event)
-{
- GstGDPDepay *this;
- gboolean res = TRUE;
-
- this = GST_GDP_DEPAY (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:
- /* we refuse seek for now. */
- gst_event_unref (event);
- res = FALSE;
- break;
- case GST_EVENT_QOS:
- case GST_EVENT_NAVIGATION:
- default:
- /* everything else is passed */
- res = gst_pad_push_event (this->sinkpad, event);
- break;
- }
- gst_object_unref (this);
-
- return res;
-}
-
-static GstFlowReturn
-gst_gdp_depay_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstGDPDepay *this;
- GstFlowReturn ret = GST_FLOW_OK;
- GstCaps *caps;
- GstBuffer *buf;
- GstEvent *event;
- guint available;
-
- this = GST_GDP_DEPAY (gst_pad_get_parent (pad));
-
- /* On DISCONT, get rid of accumulated data. We assume a buffer after the
- * DISCONT contains (part of) a new valid header, if not we error because we
- * lost sync */
- if (GST_BUFFER_IS_DISCONT (buffer)) {
- gst_adapter_clear (this->adapter);
- this->state = GST_GDP_DEPAY_STATE_HEADER;
- }
- gst_adapter_push (this->adapter, buffer);
-
- while (TRUE) {
- switch (this->state) {
- case GST_GDP_DEPAY_STATE_HEADER:
- {
- guint8 *header;
-
- /* collect a complete header, validate and store the header. Figure out
- * the payload length and switch to the PAYLOAD state */
- available = gst_adapter_available (this->adapter);
- if (available < GST_DP_HEADER_LENGTH)
- goto done;
-
- GST_LOG_OBJECT (this, "reading GDP header from adapter");
- header = gst_adapter_take (this->adapter, GST_DP_HEADER_LENGTH);
- if (!gst_dp_validate_header (GST_DP_HEADER_LENGTH, header)) {
- g_free (header);
- goto header_validate_error;
- }
-
- /* store types and payload length. Also store the header, which we need
- * to make the payload. */
- this->payload_length = gst_dp_header_payload_length (header);
- this->payload_type = gst_dp_header_payload_type (header);
- /* free previous header and store new one. */
- g_free (this->header);
- this->header = header;
-
- GST_LOG_OBJECT (this,
- "read GDP header, payload size %d, payload type %d, switching to state PAYLOAD",
- this->payload_length, this->payload_type);
- this->state = GST_GDP_DEPAY_STATE_PAYLOAD;
- break;
- }
- case GST_GDP_DEPAY_STATE_PAYLOAD:
- {
- /* in this state we wait for all the payload data to be available in the
- * adapter. Then we switch to the state where we actually process the
- * payload. */
- available = gst_adapter_available (this->adapter);
- if (available < this->payload_length)
- goto done;
-
- /* change state based on type */
- if (this->payload_type == GST_DP_PAYLOAD_BUFFER) {
- GST_LOG_OBJECT (this, "switching to state BUFFER");
- this->state = GST_GDP_DEPAY_STATE_BUFFER;
- } else if (this->payload_type == GST_DP_PAYLOAD_CAPS) {
- GST_LOG_OBJECT (this, "switching to state CAPS");
- this->state = GST_GDP_DEPAY_STATE_CAPS;
- } else if (this->payload_type >= GST_DP_PAYLOAD_EVENT_NONE) {
- GST_LOG_OBJECT (this, "switching to state EVENT");
- this->state = GST_GDP_DEPAY_STATE_EVENT;
- } else {
- goto wrong_type;
- }
-
- if (this->payload_length
- && (!gst_dp_validate_payload (GST_DP_HEADER_LENGTH, this->header,
- gst_adapter_peek (this->adapter, this->payload_length)))) {
- goto payload_validate_error;
- }
-
- break;
- }
- case GST_GDP_DEPAY_STATE_BUFFER:
- {
-
- /* if we receive a buffer without caps first, we error out */
- if (!this->caps)
- goto no_caps;
-
- GST_LOG_OBJECT (this, "reading GDP buffer from adapter");
- buf = gst_dp_buffer_from_header (GST_DP_HEADER_LENGTH, this->header);
- if (!buf)
- goto buffer_failed;
-
- /* now take the payload if there is any */
- if (this->payload_length > 0) {
- guint8 *payload;
-
- payload = gst_adapter_take (this->adapter, this->payload_length);
- memcpy (GST_BUFFER_DATA (buf), payload, this->payload_length);
- g_free (payload);
- }
-
- /* set caps and push */
- gst_buffer_set_caps (buf, this->caps);
- GST_LOG_OBJECT (this, "deserialized buffer %p, pushing, timestamp %"
- GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT
- ", offset %" G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT
- ", size %d, flags 0x%x",
- buf,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
- GST_TIME_ARGS (GST_BUFFER_DURATION (buf)),
- GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
- GST_BUFFER_SIZE (buf), GST_BUFFER_FLAGS (buf));
- ret = gst_pad_push (this->srcpad, buf);
- if (ret != GST_FLOW_OK)
- goto push_error;
-
- GST_LOG_OBJECT (this, "switching to state HEADER");
- this->state = GST_GDP_DEPAY_STATE_HEADER;
- break;
- }
- case GST_GDP_DEPAY_STATE_CAPS:
- {
- guint8 *payload;
-
- /* take the payload of the caps */
- GST_LOG_OBJECT (this, "reading GDP caps from adapter");
- payload = gst_adapter_take (this->adapter, this->payload_length);
- caps = gst_dp_caps_from_packet (GST_DP_HEADER_LENGTH, this->header,
- payload);
- g_free (payload);
- if (!caps)
- goto caps_failed;
-
- GST_DEBUG_OBJECT (this, "deserialized caps %" GST_PTR_FORMAT, caps);
- gst_caps_replace (&(this->caps), caps);
- gst_pad_set_caps (this->srcpad, caps);
- /* drop the creation ref we still have */
- gst_caps_unref (caps);
-
- GST_LOG_OBJECT (this, "switching to state HEADER");
- this->state = GST_GDP_DEPAY_STATE_HEADER;
- break;
- }
- case GST_GDP_DEPAY_STATE_EVENT:
- {
- guint8 *payload;
-
- GST_LOG_OBJECT (this, "reading GDP event from adapter");
-
- /* adapter doesn't like 0 length payload */
- if (this->payload_length > 0)
- payload = gst_adapter_take (this->adapter, this->payload_length);
- else
- payload = NULL;
- event = gst_dp_event_from_packet (GST_DP_HEADER_LENGTH, this->header,
- payload);
- g_free (payload);
- if (!event)
- goto event_failed;
-
- GST_DEBUG_OBJECT (this, "deserialized event %p of type %s, pushing",
- event, gst_event_type_get_name (event->type));
- gst_pad_push_event (this->srcpad, event);
-
- GST_LOG_OBJECT (this, "switching to state HEADER");
- this->state = GST_GDP_DEPAY_STATE_HEADER;
- break;
- }
- }
- }
-
-done:
- gst_object_unref (this);
- return ret;
-
- /* ERRORS */
-header_validate_error:
- {
- GST_ELEMENT_ERROR (this, STREAM, DECODE, (NULL),
- ("GDP packet header does not validate"));
- ret = GST_FLOW_ERROR;
- goto done;
- }
-payload_validate_error:
- {
- GST_ELEMENT_ERROR (this, STREAM, DECODE, (NULL),
- ("GDP packet payload does not validate"));
- ret = GST_FLOW_ERROR;
- goto done;
- }
-wrong_type:
- {
- GST_ELEMENT_ERROR (this, STREAM, DECODE, (NULL),
- ("GDP packet header is of wrong type"));
- ret = GST_FLOW_ERROR;
- goto done;
- }
-no_caps:
- {
- GST_ELEMENT_ERROR (this, STREAM, DECODE, (NULL),
- ("Received a buffer without first receiving caps"));
- ret = GST_FLOW_NOT_NEGOTIATED;
- goto done;
- }
-buffer_failed:
- {
- GST_ELEMENT_ERROR (this, STREAM, DECODE, (NULL),
- ("could not create buffer from GDP packet"));
- ret = GST_FLOW_ERROR;
- goto done;
- }
-push_error:
- {
- GST_WARNING_OBJECT (this, "pushing depayloaded buffer returned %d", ret);
- goto done;
- }
-caps_failed:
- {
- GST_ELEMENT_ERROR (this, STREAM, DECODE, (NULL),
- ("could not create caps from GDP packet"));
- ret = GST_FLOW_ERROR;
- goto done;
- }
-event_failed:
- {
- GST_ELEMENT_ERROR (this, STREAM, DECODE, (NULL),
- ("could not create event from GDP packet"));
- ret = GST_FLOW_ERROR;
- goto done;
- }
-}
-
-static GstStateChangeReturn
-gst_gdp_depay_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret;
- GstGDPDepay *this = GST_GDP_DEPAY (element);
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- if (this->caps) {
- gst_caps_unref (this->caps);
- this->caps = NULL;
- }
- gst_adapter_clear (this->adapter);
- break;
- default:
- break;
- }
- return ret;
-}
-
-gboolean
-gst_gdp_depay_plugin_init (GstPlugin * plugin)
-{
- if (!gst_element_register (plugin, "gdpdepay", GST_RANK_NONE,
- GST_TYPE_GDP_DEPAY))
- return FALSE;
-
- return TRUE;
-}
diff --git a/gst/gdp/gstgdpdepay.h b/gst/gdp/gstgdpdepay.h
deleted file mode 100644
index f1f41acd..00000000
--- a/gst/gdp/gstgdpdepay.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* GStreamer
- * Copyright (C) 2006 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_GDP_DEPAY_H__
-#define __GST_GDP_DEPAY_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstadapter.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GDP_DEPAY \
- (gst_gdp_depay_get_type())
-#define GST_GDP_DEPAY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GDP_DEPAY,GstGDPDepay))
-#define GST_GDP_DEPAY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GDP_DEPAY,GstGDPDepayClass))
-#define GST_IS_GDP_DEPAY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GDP_DEPAY))
-#define GST_IS_GDP_DEPAY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GDP_DEPAY))
-
-typedef enum {
- GST_GDP_DEPAY_STATE_HEADER = 0,
- GST_GDP_DEPAY_STATE_PAYLOAD,
- GST_GDP_DEPAY_STATE_BUFFER,
- GST_GDP_DEPAY_STATE_CAPS,
- GST_GDP_DEPAY_STATE_EVENT,
-} GstGDPDepayState;
-
-
-typedef struct _GstGDPDepay GstGDPDepay;
-typedef struct _GstGDPDepayClass GstGDPDepayClass;
-
-/**
- * GstGDPDepay:
- *
- * Private gdpdepay element structure.
- */
-struct _GstGDPDepay
-{
- GstElement element;
- GstPad *sinkpad;
- GstPad *srcpad;
-
- GstAdapter *adapter;
- GstGDPDepayState state;
- GstCaps *caps;
-
- guint8 *header;
- guint32 payload_length;
- GstDPPayloadType payload_type;
-};
-
-struct _GstGDPDepayClass
-{
- GstElementClass parent_class;
-};
-
-gboolean gst_gdp_depay_plugin_init (GstPlugin * plugin);
-
-G_END_DECLS
-
-#endif /* __GST_GDP_DEPAY_H__ */
diff --git a/gst/gdp/gstgdppay.c b/gst/gdp/gstgdppay.c
deleted file mode 100644
index 584e2ea5..00000000
--- a/gst/gdp/gstgdppay.c
+++ /dev/null
@@ -1,899 +0,0 @@
-/* GStreamer
- * Copyright (C) 2006 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-gdppay
- * @see_also: gdpdepay
- *
- * This element payloads GStreamer buffers and events using the
- * GStreamer Data Protocol.
- *
- * <refsect2>
- * |[
- * gst-launch -v -m videotestsrc num-buffers=50 ! gdppay ! filesink location=test.gdp
- * ]| This pipeline creates a serialized video stream that can be played back
- * with the example shown in gdpdepay.
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/dataprotocol/dataprotocol.h>
-
-#include "gstgdppay.h"
-
-/* elementfactory information */
-static const GstElementDetails gdp_pay_details =
-GST_ELEMENT_DETAILS ("GDP Payloader",
- "GDP/Payloader",
- "Payloads GStreamer Data Protocol buffers",
- "Thomas Vander Stichele <thomas at apestaart dot org>");
-
-static GstStaticPadTemplate gdp_pay_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-static GstStaticPadTemplate gdp_pay_src_template =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-gdp"));
-
-GST_DEBUG_CATEGORY_STATIC (gst_gdp_pay_debug);
-#define GST_CAT_DEFAULT gst_gdp_pay_debug
-
-#define DEFAULT_CRC_HEADER TRUE
-#define DEFAULT_CRC_PAYLOAD FALSE
-#define DEFAULT_VERSION GST_DP_VERSION_1_0
-
-enum
-{
- PROP_0,
- PROP_CRC_HEADER,
- PROP_CRC_PAYLOAD,
- PROP_VERSION,
-};
-
-#define _do_init(x) \
- GST_DEBUG_CATEGORY_INIT (gst_gdp_pay_debug, "gdppay", 0, \
- "GDP payloader");
-
-GST_BOILERPLATE_FULL (GstGDPPay, gst_gdp_pay, GstElement,
- GST_TYPE_ELEMENT, _do_init);
-
-static void gst_gdp_pay_reset (GstGDPPay * this);
-
-static GstFlowReturn gst_gdp_pay_chain (GstPad * pad, GstBuffer * buffer);
-
-static gboolean gst_gdp_pay_src_event (GstPad * pad, GstEvent * event);
-
-static gboolean gst_gdp_pay_sink_event (GstPad * pad, GstEvent * event);
-
-static GstStateChangeReturn gst_gdp_pay_change_state (GstElement *
- element, GstStateChange transition);
-
-static void gst_gdp_pay_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_gdp_pay_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static void gst_gdp_pay_finalize (GObject * gobject);
-
-static void
-gst_gdp_pay_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &gdp_pay_details);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gdp_pay_sink_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gdp_pay_src_template));
-}
-
-static void
-gst_gdp_pay_class_init (GstGDPPayClass * klass)
-{
- GObjectClass *gobject_class;
-
- GstElementClass *gstelement_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- gobject_class->set_property = gst_gdp_pay_set_property;
- gobject_class->get_property = gst_gdp_pay_get_property;
- gobject_class->finalize = gst_gdp_pay_finalize;
-
- g_object_class_install_property (gobject_class, PROP_CRC_HEADER,
- g_param_spec_boolean ("crc-header", "CRC Header",
- "Calculate and store a CRC checksum on the header",
- DEFAULT_CRC_HEADER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_CRC_PAYLOAD,
- g_param_spec_boolean ("crc-payload", "CRC Payload",
- "Calculate and store a CRC checksum on the payload",
- DEFAULT_CRC_PAYLOAD, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_VERSION,
- g_param_spec_enum ("version", "Version",
- "Version of the GStreamer Data Protocol",
- GST_TYPE_DP_VERSION, DEFAULT_VERSION,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_gdp_pay_change_state);
-}
-
-static void
-gst_gdp_pay_init (GstGDPPay * gdppay, GstGDPPayClass * g_class)
-{
- gdppay->sinkpad =
- gst_pad_new_from_static_template (&gdp_pay_sink_template, "sink");
- gst_pad_set_chain_function (gdppay->sinkpad,
- GST_DEBUG_FUNCPTR (gst_gdp_pay_chain));
- gst_pad_set_event_function (gdppay->sinkpad,
- GST_DEBUG_FUNCPTR (gst_gdp_pay_sink_event));
- gst_element_add_pad (GST_ELEMENT (gdppay), gdppay->sinkpad);
-
- gdppay->srcpad =
- gst_pad_new_from_static_template (&gdp_pay_src_template, "src");
- gst_pad_set_event_function (gdppay->srcpad,
- GST_DEBUG_FUNCPTR (gst_gdp_pay_src_event));
- gst_element_add_pad (GST_ELEMENT (gdppay), gdppay->srcpad);
-
- gdppay->crc_header = DEFAULT_CRC_HEADER;
- gdppay->crc_payload = DEFAULT_CRC_PAYLOAD;
- gdppay->header_flag = gdppay->crc_header | gdppay->crc_payload;
- gdppay->version = DEFAULT_VERSION;
- gdppay->offset = 0;
-
- gdppay->packetizer = gst_dp_packetizer_new (gdppay->version);
-}
-
-static void
-gst_gdp_pay_finalize (GObject * gobject)
-{
- GstGDPPay *this = GST_GDP_PAY (gobject);
-
- gst_gdp_pay_reset (this);
- gst_dp_packetizer_free (this->packetizer);
-
- GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (gobject));
-}
-
-static void
-gst_gdp_pay_reset (GstGDPPay * this)
-{
- GST_DEBUG_OBJECT (this, "Resetting GDP object");
- /* clear the queued buffers */
- while (this->queue) {
- GstBuffer *buffer;
-
- buffer = GST_BUFFER_CAST (this->queue->data);
-
- /* delete buffer from queue now */
- this->queue = g_list_delete_link (this->queue, this->queue);
-
- gst_buffer_unref (buffer);
- }
- if (this->caps) {
- gst_caps_unref (this->caps);
- this->caps = NULL;
- }
- if (this->caps_buf) {
- gst_buffer_unref (this->caps_buf);
- this->caps_buf = NULL;
- }
- if (this->tag_buf) {
- gst_buffer_unref (this->tag_buf);
- this->tag_buf = NULL;
- }
- if (this->new_segment_buf) {
- gst_buffer_unref (this->new_segment_buf);
- this->new_segment_buf = NULL;
- }
- this->sent_streamheader = FALSE;
- this->offset = 0;
-}
-
-/* set OFFSET and OFFSET_END with running count */
-static void
-gst_gdp_stamp_buffer (GstGDPPay * this, GstBuffer * buffer)
-{
- GST_BUFFER_OFFSET (buffer) = this->offset;
- GST_BUFFER_OFFSET_END (buffer) = this->offset + GST_BUFFER_SIZE (buffer);
- this->offset = GST_BUFFER_OFFSET_END (buffer);
-}
-
-static GstBuffer *
-gst_gdp_buffer_from_caps (GstGDPPay * this, GstCaps * caps)
-{
- GstBuffer *headerbuf;
-
- GstBuffer *payloadbuf;
-
- guint8 *header, *payload;
-
- guint len;
-
- if (!this->packetizer->packet_from_caps (caps, this->header_flag, &len,
- &header, &payload))
- goto packet_failed;
-
- GST_LOG_OBJECT (this, "creating GDP header and payload buffer from caps");
- headerbuf = gst_buffer_new ();
- gst_buffer_set_data (headerbuf, header, len);
- GST_BUFFER_MALLOCDATA (headerbuf) = header;
-
- payloadbuf = gst_buffer_new ();
- gst_buffer_set_data (payloadbuf, payload,
- gst_dp_header_payload_length (header));
- GST_BUFFER_MALLOCDATA (payloadbuf) = payload;
-
- return gst_buffer_join (headerbuf, payloadbuf);
-
- /* ERRORS */
-packet_failed:
- {
- GST_WARNING_OBJECT (this, "could not create GDP header from caps");
- return NULL;
- }
-}
-
-static GstBuffer *
-gst_gdp_pay_buffer_from_buffer (GstGDPPay * this, GstBuffer * buffer)
-{
- GstBuffer *headerbuf;
-
- guint8 *header;
-
- guint len;
-
- if (!this->packetizer->header_from_buffer (buffer, this->header_flag, &len,
- &header))
- goto no_buffer;
-
- GST_LOG_OBJECT (this, "creating GDP header and payload buffer from buffer");
- headerbuf = gst_buffer_new ();
- gst_buffer_set_data (headerbuf, header, len);
- GST_BUFFER_MALLOCDATA (headerbuf) = header;
-
- /* we do not want to lose the ref on the incoming buffer */
- gst_buffer_ref (buffer);
-
- return gst_buffer_join (headerbuf, buffer);
-
- /* ERRORS */
-no_buffer:
- {
- GST_WARNING_OBJECT (this, "could not create GDP header from buffer");
- return NULL;
- }
-}
-
-static GstBuffer *
-gst_gdp_buffer_from_event (GstGDPPay * this, GstEvent * event)
-{
- GstBuffer *headerbuf;
-
- GstBuffer *payloadbuf;
-
- guint8 *header, *payload;
-
- guint len;
-
- gboolean ret;
-
- ret =
- this->packetizer->packet_from_event (event, this->header_flag, &len,
- &header, &payload);
- if (!ret)
- goto no_event;
-
- GST_LOG_OBJECT (this, "creating GDP header and payload buffer from event");
- headerbuf = gst_buffer_new ();
- gst_buffer_set_data (headerbuf, header, len);
- GST_BUFFER_MALLOCDATA (headerbuf) = header;
-
- payloadbuf = gst_buffer_new ();
- gst_buffer_set_data (payloadbuf, payload,
- gst_dp_header_payload_length (header));
- GST_BUFFER_MALLOCDATA (payloadbuf) = payload;
-
- return gst_buffer_join (headerbuf, payloadbuf);
-
- /* ERRORS */
-no_event:
- {
- GST_WARNING_OBJECT (this, "could not create GDP header from event %s (%d)",
- gst_event_type_get_name (event->type), event->type);
- return NULL;
- }
-}
-
-
-/* set our caps with streamheader, based on the latest newsegment and caps,
- * and (possibly) GDP-serialized buffers of the streamheaders on the src pad */
-static GstFlowReturn
-gst_gdp_pay_reset_streamheader (GstGDPPay * this)
-{
- GstCaps *caps;
-
- /* We use copies of these to avoid circular refcounts */
- GstBuffer *new_segment_buf, *caps_buf, *tag_buf;
-
- GstStructure *structure;
-
- GstFlowReturn r = GST_FLOW_OK;
-
- gboolean version_one_zero = TRUE;
-
- GValue array = { 0 };
- GValue value = { 0 };
-
- GST_DEBUG_OBJECT (this, "start");
- /* In version 0.2, we didn't need or send new segment or tags */
- if (this->version == GST_DP_VERSION_0_2)
- version_one_zero = FALSE;
-
- if (version_one_zero) {
- if (!this->new_segment_buf || !this->caps_buf) {
- GST_DEBUG_OBJECT (this, "1.0, missing new_segment or caps, returning");
- return GST_FLOW_OK;
- }
- } else {
- if (!this->caps_buf) {
- GST_DEBUG_OBJECT (this, "0.2, missing caps, returning");
- return GST_FLOW_OK;
- }
- }
-
- /* put copies of the buffers in a fixed list
- * Stamp the buffers with offset and offset_end as well.
- * We do this here so the offsets match the order the buffers go out in */
- g_value_init (&array, GST_TYPE_ARRAY);
-
- if (version_one_zero) {
- gst_gdp_stamp_buffer (this, this->new_segment_buf);
- GST_DEBUG_OBJECT (this, "1.0, appending copy of new segment buffer %p",
- this->new_segment_buf);
- new_segment_buf = gst_buffer_copy (this->new_segment_buf);
- gst_buffer_set_caps (new_segment_buf, NULL);
- g_value_init (&value, GST_TYPE_BUFFER);
- gst_value_set_buffer (&value, new_segment_buf);
- gst_value_array_append_value (&array, &value);
- g_value_unset (&value);
- gst_buffer_unref (new_segment_buf);
-
- if (this->tag_buf) {
- gst_gdp_stamp_buffer (this, this->tag_buf);
- GST_DEBUG_OBJECT (this, "1.0, appending current tags buffer %p",
- this->tag_buf);
- tag_buf = this->tag_buf;
- this->tag_buf = NULL;
-
- gst_buffer_set_caps (tag_buf, NULL);
- g_value_init (&value, GST_TYPE_BUFFER);
- gst_value_set_buffer (&value, tag_buf);
- gst_value_array_append_value (&array, &value);
- g_value_unset (&value);
- gst_buffer_unref (tag_buf);
- }
- }
-
- gst_gdp_stamp_buffer (this, this->caps_buf);
- GST_DEBUG_OBJECT (this, "appending copy of caps buffer %p", this->caps_buf);
- caps_buf = gst_buffer_copy (this->caps_buf);
- gst_buffer_set_caps (caps_buf, NULL);
- g_value_init (&value, GST_TYPE_BUFFER);
- gst_value_set_buffer (&value, caps_buf);
- gst_value_array_append_value (&array, &value);
- g_value_unset (&value);
- gst_buffer_unref (caps_buf);
-
- /* we also need to add GDP serializations of the streamheaders of the
- * incoming caps */
- structure = gst_caps_get_structure (this->caps, 0);
- if (gst_structure_has_field (structure, "streamheader")) {
- const GValue *sh;
-
- GArray *buffers;
-
- GstBuffer *buffer;
-
- int i;
-
- sh = gst_structure_get_value (structure, "streamheader");
- buffers = g_value_peek_pointer (sh);
- GST_DEBUG_OBJECT (this,
- "Need to serialize %d incoming streamheader buffers on ours",
- buffers->len);
- for (i = 0; i < buffers->len; ++i) {
- GValue *bufval;
-
- GstBuffer *outbuffer;
-
- bufval = &g_array_index (buffers, GValue, i);
- buffer = g_value_peek_pointer (bufval);
- /* this buffer is deserialized by gdpdepay as a regular buffer,
- it needs IN_CAPS, because it's a streamheader - otherwise it
- is mixed with regular data buffers */
- GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_IN_CAPS);
- GST_BUFFER_OFFSET (buffer) = GST_BUFFER_OFFSET_NONE;
- GST_BUFFER_OFFSET_END (buffer) = GST_BUFFER_OFFSET_NONE;
- GST_BUFFER_TIMESTAMP (buffer) = GST_CLOCK_TIME_NONE;
-
- outbuffer = gst_gdp_pay_buffer_from_buffer (this, buffer);
- if (!outbuffer) {
- g_value_unset (&array);
- goto no_buffer;
- }
-
- /* Setting IN_CAPS as other GDP event buffers */
- GST_DEBUG_OBJECT (this,
- "Setting IN_CAPS flag on outgoing buffer %" GST_PTR_FORMAT,
- outbuffer);
- GST_BUFFER_FLAG_SET (outbuffer, GST_BUFFER_FLAG_IN_CAPS);
- GST_BUFFER_OFFSET (outbuffer) = GST_BUFFER_OFFSET_NONE;
- GST_BUFFER_OFFSET_END (outbuffer) = GST_BUFFER_OFFSET_NONE;
- GST_BUFFER_TIMESTAMP (outbuffer) = GST_CLOCK_TIME_NONE;
-
- g_value_init (&value, GST_TYPE_BUFFER);
- gst_value_set_buffer (&value, outbuffer);
- gst_value_array_append_value (&array, &value);
- g_value_unset (&value);
-
- gst_buffer_unref (outbuffer);
- }
- } else {
- GST_DEBUG_OBJECT (this, "no streamheader to serialize");
- }
-
- GST_DEBUG_OBJECT (this, "%d serialized buffers on streamheaders",
- gst_value_array_get_size (&array));
- caps = gst_caps_from_string ("application/x-gdp");
- structure = gst_caps_get_structure (caps, 0);
-
- gst_structure_set_value (structure, "streamheader", &array);
- g_value_unset (&array);
-
- GST_DEBUG_OBJECT (this, "Setting caps on src pad %" GST_PTR_FORMAT, caps);
- gst_pad_set_caps (this->srcpad, caps);
- gst_buffer_set_caps (this->caps_buf, caps);
- gst_buffer_set_caps (this->new_segment_buf, caps);
-
- /* if these are our first ever buffers, send out new_segment first */
- if (!this->sent_streamheader) {
- GstEvent *event =
- gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_BYTES, 0, -1, 0);
- GST_DEBUG_OBJECT (this, "Sending out new_segment event %p", event);
- if (!gst_pad_push_event (this->srcpad, event)) {
- GST_WARNING_OBJECT (this, "pushing new segment failed");
- r = GST_FLOW_ERROR;
- goto done;
- }
- }
-
- /* push out these streamheader buffers, then flush our internal queue */
- GST_DEBUG_OBJECT (this, "Pushing GDP new_segment buffer %p with offset %"
- G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT, this->new_segment_buf,
- GST_BUFFER_OFFSET (this->new_segment_buf),
- GST_BUFFER_OFFSET_END (this->new_segment_buf));
- /* we stored these bufs with refcount 1, so make sure we keep a ref */
- r = gst_pad_push (this->srcpad, gst_buffer_ref (this->new_segment_buf));
- if (r != GST_FLOW_OK) {
- GST_WARNING_OBJECT (this, "pushing GDP newsegment buffer returned %d", r);
- goto done;
- }
- if (this->tag_buf) {
- gst_buffer_set_caps (this->tag_buf, caps);
- GST_DEBUG_OBJECT (this, "Pushing GDP tag buffer %p", this->tag_buf);
- /* we stored these bufs with refcount 1, so make sure we keep a ref */
- r = gst_pad_push (this->srcpad, gst_buffer_ref (this->tag_buf));
- if (r != GST_FLOW_OK) {
- GST_WARNING_OBJECT (this, "pushing GDP tag buffer returned %d", r);
- goto done;
- }
- }
- GST_DEBUG_OBJECT (this, "Pushing GDP caps buffer %p", this->caps_buf);
- r = gst_pad_push (this->srcpad, gst_buffer_ref (this->caps_buf));
- if (r != GST_FLOW_OK) {
- GST_WARNING_OBJECT (this, "pushing GDP caps buffer returned %d", r);
- goto done;
- }
- this->sent_streamheader = TRUE;
- GST_DEBUG_OBJECT (this, "need to push %d queued buffers",
- g_list_length (this->queue));
- while (this->queue) {
- GstBuffer *buffer;
-
- buffer = GST_BUFFER_CAST (this->queue->data);
- GST_DEBUG_OBJECT (this, "Pushing queued GDP buffer %p", buffer);
-
- /* delete buffer from queue now */
- this->queue = g_list_delete_link (this->queue, this->queue);
-
- /* set caps and push */
- gst_buffer_set_caps (buffer, caps);
- r = gst_pad_push (this->srcpad, buffer);
- if (r != GST_FLOW_OK) {
- GST_WARNING_OBJECT (this, "pushing queued GDP buffer returned %d", r);
- goto done;
- }
- }
-
-done:
- gst_caps_unref (caps);
- GST_DEBUG_OBJECT (this, "stop");
- return r;
-
- /* ERRORS */
-no_buffer:
- {
- GST_ELEMENT_ERROR (this, STREAM, FORMAT, (NULL),
- ("failed to create GDP buffer from streamheader"));
- return GST_FLOW_ERROR;
- }
-}
-
-/* queue a buffer internally if we haven't sent streamheader buffers yet;
- * otherwise, just push on, this takes ownership of the buffer. */
-static GstFlowReturn
-gst_gdp_queue_buffer (GstGDPPay * this, GstBuffer * buffer)
-{
- if (this->sent_streamheader) {
- GST_LOG_OBJECT (this, "Pushing GDP buffer %p, caps %" GST_PTR_FORMAT,
- buffer, this->caps);
- gst_buffer_set_caps (buffer, GST_PAD_CAPS (this->srcpad));
- return gst_pad_push (this->srcpad, buffer);
- }
-
- /* store it on an internal queue. buffer remains reffed. */
- this->queue = g_list_append (this->queue, buffer);
- GST_DEBUG_OBJECT (this, "streamheader not sent yet, "
- "queued buffer %p, now %d buffers queued",
- buffer, g_list_length (this->queue));
-
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_gdp_pay_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstGDPPay *this;
-
- GstCaps *caps;
-
- GstBuffer *outbuffer;
-
- GstFlowReturn ret;
-
- this = GST_GDP_PAY (gst_pad_get_parent (pad));
-
- /* we should have received a new_segment before, otherwise it's a bug.
- * fake one in that case */
- if (!this->new_segment_buf) {
- GstEvent *event;
-
- GST_WARNING_OBJECT (this,
- "did not receive new-segment before first buffer");
- event = gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_BYTES, 0, -1, 0);
- outbuffer = gst_gdp_buffer_from_event (this, event);
- gst_event_unref (event);
-
- /* GDP 0.2 doesn't know about new-segment, so this is not fatal */
- if (!outbuffer) {
- GST_ELEMENT_WARNING (this, STREAM, ENCODE, (NULL),
- ("Could not create GDP buffer from new segment event"));
- } else {
- GST_BUFFER_TIMESTAMP (outbuffer) = GST_BUFFER_TIMESTAMP (buffer);
- GST_BUFFER_DURATION (outbuffer) = 0;
- GST_BUFFER_FLAG_SET (outbuffer, GST_BUFFER_FLAG_IN_CAPS);
- GST_DEBUG_OBJECT (this, "Storing buffer %p as new_segment_buf",
- outbuffer);
- this->new_segment_buf = outbuffer;
- }
- }
-
- /* make sure we've received caps before */
- caps = gst_buffer_get_caps (buffer);
- if (!this->caps && !caps)
- goto no_caps;
-
- /* if the caps have changed, process caps first */
- if (caps && !gst_caps_is_equal (this->caps, caps)) {
- GST_LOG_OBJECT (this, "caps changed to %p, %" GST_PTR_FORMAT, caps, caps);
- gst_caps_replace (&(this->caps), caps);
- outbuffer = gst_gdp_buffer_from_caps (this, caps);
- if (!outbuffer)
- goto no_caps_buffer;
-
- GST_BUFFER_TIMESTAMP (outbuffer) = GST_BUFFER_TIMESTAMP (buffer);
- GST_BUFFER_DURATION (outbuffer) = 0;
- GST_BUFFER_FLAG_SET (outbuffer, GST_BUFFER_FLAG_IN_CAPS);
-
- if (this->caps_buf)
- gst_buffer_unref (this->caps_buf);
- this->caps_buf = outbuffer;
- gst_gdp_pay_reset_streamheader (this);
- }
-
- if (caps)
- gst_caps_unref (caps);
-
- /* create a GDP header packet,
- * then create a GST buffer of the header packet and the buffer contents */
- outbuffer = gst_gdp_pay_buffer_from_buffer (this, buffer);
- if (!outbuffer)
- goto no_buffer;
-
- /* If the incoming buffer is IN_CAPS, that means we have it on the caps
- * as streamheader, and we have serialized a GDP version of it and put it
- * on our caps */
- if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_IN_CAPS)) {
- GST_DEBUG_OBJECT (this, "Setting IN_CAPS flag on outgoing buffer %p",
- outbuffer);
- GST_BUFFER_FLAG_SET (outbuffer, GST_BUFFER_FLAG_IN_CAPS);
- }
-
- gst_gdp_stamp_buffer (this, outbuffer);
- GST_BUFFER_TIMESTAMP (outbuffer) = GST_BUFFER_TIMESTAMP (buffer);
- GST_BUFFER_DURATION (outbuffer) = GST_BUFFER_DURATION (buffer);
-
- ret = gst_gdp_queue_buffer (this, outbuffer);
-
-done:
- gst_buffer_unref (buffer);
- gst_object_unref (this);
- return ret;
-
- /* ERRORS */
-no_caps:
- {
- /* when returning a fatal error as a GstFlowReturn we must post an error
- * message */
- GST_ELEMENT_ERROR (this, STREAM, FORMAT, (NULL),
- ("first received buffer does not have caps set"));
- if (caps)
- gst_caps_unref (caps);
- ret = GST_FLOW_NOT_NEGOTIATED;
- goto done;
- }
-no_caps_buffer:
- {
- GST_ELEMENT_ERROR (this, STREAM, ENCODE, (NULL),
- ("Could not create GDP buffer from caps %" GST_PTR_FORMAT, caps));
- gst_caps_unref (caps);
- ret = GST_FLOW_ERROR;
- goto done;
- }
-no_buffer:
- {
- GST_ELEMENT_ERROR (this, STREAM, ENCODE, (NULL),
- ("Could not create GDP buffer from buffer"));
- ret = GST_FLOW_ERROR;
- goto done;
- }
-}
-
-static gboolean
-gst_gdp_pay_sink_event (GstPad * pad, GstEvent * event)
-{
- GstBuffer *outbuffer;
-
- GstGDPPay *this = GST_GDP_PAY (gst_pad_get_parent (pad));
-
- GstFlowReturn flowret;
-
- gboolean ret = TRUE;
-
- GST_DEBUG_OBJECT (this, "received event %p of type %s (%d)",
- event, gst_event_type_get_name (event->type), event->type);
-
- /* now turn the event into a buffer */
- outbuffer = gst_gdp_buffer_from_event (this, event);
- if (!outbuffer)
- goto no_outbuffer;
-
- GST_BUFFER_TIMESTAMP (outbuffer) = GST_EVENT_TIMESTAMP (event);
- GST_BUFFER_DURATION (outbuffer) = 0;
-
- /* if we got a new segment or tag event, we should put it on our streamheader,
- * and not send it on */
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:
- GST_DEBUG_OBJECT (this, "Storing in caps buffer %p as new_segment_buf",
- outbuffer);
-
- if (this->new_segment_buf)
- gst_buffer_unref (this->new_segment_buf);
- this->new_segment_buf = outbuffer;
-
- GST_BUFFER_FLAG_SET (outbuffer, GST_BUFFER_FLAG_IN_CAPS);
- gst_gdp_pay_reset_streamheader (this);
- break;
- case GST_EVENT_TAG:
- GST_DEBUG_OBJECT (this, "Storing in caps buffer %p as tag_buf",
- outbuffer);
-
- if (this->tag_buf)
- gst_buffer_unref (this->tag_buf);
- this->tag_buf = outbuffer;
-
- GST_BUFFER_FLAG_SET (outbuffer, GST_BUFFER_FLAG_IN_CAPS);
- gst_gdp_pay_reset_streamheader (this);
- break;
- default:
- GST_DEBUG_OBJECT (this, "queuing GDP buffer %p of event %p", outbuffer,
- event);
- flowret = gst_gdp_queue_buffer (this, outbuffer);
- if (flowret != GST_FLOW_OK)
- goto push_error;
- break;
- }
-
- /* if we have EOS, we should send on EOS ourselves */
- if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
- GST_DEBUG_OBJECT (this, "Sending on EOS event %p", event);
- /* ref, we unref later again */
- ret = gst_pad_push_event (this->srcpad, gst_event_ref (event));
- }
-
-done:
- gst_event_unref (event);
- gst_object_unref (this);
-
- return ret;
-
- /* ERRORS */
-no_outbuffer:
- {
- GST_ELEMENT_WARNING (this, STREAM, ENCODE, (NULL),
- ("Could not create GDP buffer from received event (type %s)",
- gst_event_type_get_name (event->type)));
- ret = FALSE;
- goto done;
- }
-push_error:
- {
- GST_WARNING_OBJECT (this, "queueing GDP event buffer returned %d", flowret);
- ret = FALSE;
- goto done;
- }
-}
-
-static gboolean
-gst_gdp_pay_src_event (GstPad * pad, GstEvent * event)
-{
- GstGDPPay *this;
-
- gboolean res = TRUE;
-
- this = GST_GDP_PAY (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:
- /* we refuse seek for now. */
- gst_event_unref (event);
- res = FALSE;
- break;
- case GST_EVENT_QOS:
- case GST_EVENT_NAVIGATION:
- default:
- /* everything else is passed */
- res = gst_pad_push_event (this->sinkpad, event);
- break;
- }
- gst_object_unref (this);
-
- return res;
-}
-
-static void
-gst_gdp_pay_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstGDPPay *this;
-
- g_return_if_fail (GST_IS_GDP_PAY (object));
- this = GST_GDP_PAY (object);
-
- switch (prop_id) {
- case PROP_CRC_HEADER:
- this->crc_header =
- g_value_get_boolean (value) ? GST_DP_HEADER_FLAG_CRC_HEADER : 0;
- this->header_flag = this->crc_header | this->crc_payload;
- break;
- case PROP_CRC_PAYLOAD:
- this->crc_payload =
- g_value_get_boolean (value) ? GST_DP_HEADER_FLAG_CRC_PAYLOAD : 0;
- this->header_flag = this->crc_header | this->crc_payload;
- break;
- case PROP_VERSION:
- this->version = g_value_get_enum (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_gdp_pay_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstGDPPay *this;
-
- g_return_if_fail (GST_IS_GDP_PAY (object));
- this = GST_GDP_PAY (object);
-
- switch (prop_id) {
- case PROP_CRC_HEADER:
- g_value_set_boolean (value, this->crc_header);
- break;
- case PROP_CRC_PAYLOAD:
- g_value_set_boolean (value, this->crc_payload);
- break;
- case PROP_VERSION:
- g_value_set_enum (value, this->version);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstStateChangeReturn
-gst_gdp_pay_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret;
-
- GstGDPPay *this = GST_GDP_PAY (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- gst_gdp_pay_reset (this);
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-gboolean
-gst_gdp_pay_plugin_init (GstPlugin * plugin)
-{
- if (!gst_element_register (plugin, "gdppay", GST_RANK_NONE, GST_TYPE_GDP_PAY))
- return FALSE;
-
- return TRUE;
-}
diff --git a/gst/gdp/gstgdppay.h b/gst/gdp/gstgdppay.h
deleted file mode 100644
index 0cc360eb..00000000
--- a/gst/gdp/gstgdppay.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* GStreamer
- * Copyright (C) 2006 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_GDP_PAY_H__
-#define __GST_GDP_PAY_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_GDP_PAY \
- (gst_gdp_pay_get_type())
-#define GST_GDP_PAY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GDP_PAY,GstGDPPay))
-#define GST_GDP_PAY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GDP_PAY,GstGDPPayClass))
-#define GST_IS_GDP_PAY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GDP_PAY))
-#define GST_IS_GDP_PAY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GDP_PAY))
-
-typedef struct _GstGDPPay GstGDPPay;
-typedef struct _GstGDPPayClass GstGDPPayClass;
-
-/**
- * GstGDPPay:
- *
- * Private gdppay element structure.
- */
-struct _GstGDPPay
-{
- GstElement element;
-
- GstPad *sinkpad;
- GstPad *srcpad;
-
- GstCaps *caps; /* incoming caps */
-
- GstBuffer *caps_buf;
- GstBuffer *new_segment_buf;
- GstBuffer *tag_buf;
-
- gboolean sent_streamheader; /* TRUE after the first streamheaders are sent */
- GList *queue; /* list of queued buffers before streamheaders are sent */
- guint64 offset;
-
- gboolean crc_header;
- gboolean crc_payload;
- GstDPHeaderFlag header_flag;
- GstDPVersion version;
- GstDPPacketizer *packetizer;
-};
-
-struct _GstGDPPayClass
-{
- GstElementClass parent_class;
-};
-
-gboolean gst_gdp_pay_plugin_init (GstPlugin * plugin);
-
-G_END_DECLS
-
-#endif /* __GST_GDP_PAY_H__ */
diff --git a/gst/playback/.gitignore b/gst/playback/.gitignore
deleted file mode 100644
index a81827a2..00000000
--- a/gst/playback/.gitignore
+++ /dev/null
@@ -1,10 +0,0 @@
-decodetest
-test
-test2
-test3
-test4
-test5
-gstplay-marshal.c
-gstplay-marshal.h
-test6
-test7
diff --git a/gst/playback/Makefile.am b/gst/playback/Makefile.am
deleted file mode 100644
index db5d3f43..00000000
--- a/gst/playback/Makefile.am
+++ /dev/null
@@ -1,100 +0,0 @@
-# variables used for enum/marshal generation
-glib_enum_define = GST_PLAY
-glib_gen_prefix = gst_play
-glib_gen_basename = gstplay
-
-built_sources = gstplay-marshal.c
-built_headers = gstplay-marshal.h
-
-plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
-
-plugin_LTLIBRARIES = libgstplaybin.la libgstdecodebin.la libgstdecodebin2.la
-
-libgstplaybin_la_SOURCES = \
- gstplayback.c \
- gstplaybin.c \
- gstplaybin2.c \
- gstplaysink.c \
- gstplaybasebin.c \
- gstplay-enum.c \
- gstfactorylists.c \
- gstinputselector.c \
- gstscreenshot.c \
- gststreaminfo.c \
- gststreamselector.c \
- gstsubtitleoverlay.c
-
-nodist_libgstplaybin_la_SOURCES = $(built_sources)
-libgstplaybin_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-libgstplaybin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstplaybin_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_MAJORMINOR@.la \
- $(GST_LIBS)
-libgstplaybin_la_LIBTOOLFLAGS = --tag=disable-static
-
-libgstdecodebin_la_SOURCES = gstdecodebin.c
-nodist_libgstdecodebin_la_SOURCES = $(built_sources)
-libgstdecodebin_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-libgstdecodebin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstdecodebin_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la \
- $(GST_LIBS)
-libgstdecodebin_la_LIBTOOLFLAGS = --tag=disable-static
-
-libgstdecodebin2_la_SOURCES = gstdecodebin2.c gsturidecodebin.c gstfactorylists.c gstplay-enum.c
-nodist_libgstdecodebin2_la_SOURCES = $(built_sources)
-libgstdecodebin2_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-libgstdecodebin2_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstdecodebin2_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la \
- $(GST_LIBS)
-libgstdecodebin2_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = \
- gstplaybasebin.h \
- gstplaysink.h \
- gststreaminfo.h \
- gstfactorylists.h \
- gstinputselector.h \
- gstplay-enum.h \
- gstscreenshot.h \
- gststreamselector.h \
- gstrawcaps.h \
- gstsubtitleoverlay.h
-
-noinst_PROGRAMS = test decodetest test2 test3 test4 test5 test6 test7
-
-test_LDADD = $(GST_LIBS)
-test_CFLAGS = $(GST_CFLAGS)
-
-test2_LDADD = $(GST_LIBS)
-test2_CFLAGS = $(GST_CFLAGS)
-
-test3_LDADD = $(GST_LIBS)
-test3_CFLAGS = $(GST_CFLAGS)
-
-test4_LDADD = $(GST_LIBS)
-test4_CFLAGS = $(GST_CFLAGS)
-
-test5_LDADD = $(GST_LIBS)
-test5_CFLAGS = $(GST_CFLAGS)
-
-test6_LDADD = $(GST_LIBS)
-test6_CFLAGS = $(GST_CFLAGS)
-
-test7_LDADD = $(GST_LIBS)
-test7_CFLAGS = $(GST_CFLAGS)
-
-decodetest_LDADD = $(GST_LIBS)
-decodetest_CFLAGS = $(GST_CFLAGS)
-
-BUILT_SOURCES = $(built_headers) $(built_sources)
-
-EXTRA_DIST = gstplay-marshal.list
-
-CLEANFILES = $(BUILT_SOURCES)
-
-include $(top_srcdir)/common/gst-glib-gen.mak
-
diff --git a/gst/playback/README b/gst/playback/README
deleted file mode 100644
index 286e49f8..00000000
--- a/gst/playback/README
+++ /dev/null
@@ -1,91 +0,0 @@
-decodebin:
-
- A bin with a sinkpad that decodes the data into raw formats. It works by sending
- the input data through a typefind element and then recursively autoplugs elements
- from the registry until a raw format is obtained. It will then create a new ghostpad
- on itself to signal the app of the new pad.
-
- Decodebin will also remove pads when they are removed from the stream.
-
- TODO
- - reuse of decoderbin, cleanup in READY state
- - threading after demuxing?
- - new_media events should be handled.
- - caching of elements.
- - abstract more elements, pads (typefind, ...);
-
- The autoplugging happens as follows:
-
- 1) typefind is added internally to the bin.
- 2) the have_type signal is connected to typefind.
- 3) in the have_type callback the close_pad_link function is called
- 4) close_pad_link checks the type on the pad, if it is raw, a ghostpad
- is created and autoplugging for that pad stops.
- 5) if the type of the pad is not raw, a list of possible elements that
- can connect to this type is generated in find_compatibles.
- 6) try_to_link_1 with the element list is called. The function will loop
- over the element list and will try to connect one of the elements to
- the pad. If the link works, a call is made to close_link.
- 7) close_link loops over all the source pads of the element and
- recursively calls 4) for any ALWAYS pad. For elements with
- a SOMETIMES pad, a structure is set up and is passed to the callback
- of the new_pad signal.
- 8) in the new_pad callback, 4) is called to try to autoplug the
- new pad.
-
-
-playbasebin:
-
- A bin with an uri property. It will find the right source element from the registry
- and connect a decoderbin to it. When going to the PAUSED state, it will iterate the
- decoderbin and listen for new pad signals from it. It will connect a queue to each
- new pad and will iterate the decoderbin until one of the queues is filled. It is
- assumed that by that time all the streams will be found so that when leaving the
- PAUSED state, one can query the number of streams in the media file with the given
- uri.
-
- Playbasebin internally groups related streams together in a GstPlayBaseGroup. This
- is particulary important for chained oggs. Initially, a new group is created in
- the 'building' state. All new streams will be added to the building group until
- no-more-pads is signaled or one of the preroll queues overflows. When this happens,
- the group is commited to a list of groups ready for playback. PlaybaseBin will then
- attach a padprobe to each stream to figure out when it finished. It will remove
- the current group and install the next playable group, then.
-
- Before going to the PLAYING state, it is possible to connect a custom element to
- each of the streams. To do that, you have to add the element to the bin and then
- connect the pad(s) from the stream(s). You do not have to add the elements in
- a thread, the bin will take care of then when it's needed. You are allowed to use
- threads inside the elements, of course.
- The bin tries to be smart and doesn't add a queue when there is only one possible
- stream.
-
-
- TODO
- - reuse, cleanup in ready state
- - when the first pad is closed, it's possible that another dynamic element is
- added somewhere so that we need a queue for the first pad as well.
-
-
-playbin:
-
- Extends playbasebin, sets up default audiosink and videosink for first audio/video
- stream detected. implements seeking and querying on the configured sinks.
-
- It also waits for new notifications from playbasebin about any new groups that are
- becomming active. It then disconnects the sinks and reconnects them to the new
- pads in the group.
-
- TODO
- - reuse, refcounting, cleanup in READY state
- - be smarter about replugging the sinks instead of removing them and readding them.
- - Do not crap out when the audio device is in use.
-
-
-general
-
- TODO
- - playlist support. maybe use a playlist bin that streams the contents of the
- playlist on a pad, interleaved with new_media events. Also add a tuner
- interface while we're at it.
-
diff --git a/gst/playback/decodetest.c b/gst/playback/decodetest.c
deleted file mode 100644
index dd81c6b5..00000000
--- a/gst/playback/decodetest.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#include <gst/gst.h>
-#include <string.h>
-
-static void
-warning_cb (GstBus * bus, GstMessage * msg, gpointer foo)
-{
- GError *err = NULL;
- gchar *dbg = NULL;
-
- gst_message_parse_warning (msg, &err, &dbg);
-
- g_printerr ("WARNING: %s (%s)\n", err->message, (dbg) ? dbg : "no details");
-
- g_error_free (err);
- g_free (dbg);
-}
-
-static void
-error_cb (GstBus * bus, GstMessage * msg, GMainLoop * main_loop)
-{
- GError *err = NULL;
- gchar *dbg = NULL;
-
- gst_message_parse_error (msg, &err, &dbg);
-
- g_printerr ("ERROR: %s (%s)\n", err->message, (dbg) ? dbg : "no details");
-
- g_main_loop_quit (main_loop);
-
- g_error_free (err);
- g_free (dbg);
-}
-
-static void
-eos_cb (GstBus * bus, GstMessage * msg, GMainLoop * main_loop)
-{
- g_print ("EOS\n");
- g_main_loop_quit (main_loop);
-}
-
-static void
-state_cb (GstBus * bus, GstMessage * msg, GstElement * pipeline)
-{
- if (msg->src == GST_OBJECT (pipeline)) {
- GstState old_state, new_state, pending_state;
-
- gst_message_parse_state_changed (msg, &old_state, &new_state,
- &pending_state);
- if (new_state == GST_STATE_PLAYING) {
- g_print ("Decoding ...\n");
- }
- }
-}
-
-static void
-new_decoded_pad_cb (GstElement * decodebin, GstPad * pad, gboolean last,
- GstElement * pipeline)
-{
- GstPadLinkReturn ret;
- GstElement *fakesink;
- GstPad *fakesink_pad;
-
- fakesink = gst_element_factory_make ("fakesink", NULL);
- fakesink_pad = gst_element_get_static_pad (fakesink, "sink");
-
- gst_bin_add (GST_BIN (pipeline), fakesink);
-
- /* this doesn't really seem right, but it makes things work for me */
- gst_element_set_state (fakesink, GST_STATE_PLAYING);
-
- ret = gst_pad_link (pad, fakesink_pad);
- if (!GST_PAD_LINK_SUCCESSFUL (ret)) {
- g_printerr ("Failed to link %s:%s to %s:%s (ret = %d)\n",
- GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (fakesink_pad), ret);
- } else {
- g_printerr ("Linked %s:%s to %s:%s\n", GST_DEBUG_PAD_NAME (pad),
- GST_DEBUG_PAD_NAME (fakesink_pad));
- }
-
- gst_object_unref (fakesink_pad);
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
- GstElement *decoder;
- GstElement *source;
- GstElement *pipeline;
- GstStateChangeReturn res;
- GMainLoop *loop;
- GstBus *bus;
-
- gst_init (&argc, &argv);
-
- if (argc != 2) {
- g_printerr ("Decode file from start to end.\n");
- g_printerr ("Usage: %s URI\n\n", argv[0]);
- return 1;
- }
-
- loop = g_main_loop_new (NULL, TRUE);
-
- pipeline = gst_pipeline_new ("pipeline");
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_signal_watch (bus);
-
- g_signal_connect (bus, "message::eos", G_CALLBACK (eos_cb), loop);
- g_signal_connect (bus, "message::error", G_CALLBACK (error_cb), loop);
- g_signal_connect (bus, "message::warning", G_CALLBACK (warning_cb), NULL);
- g_signal_connect (bus, "message::state-changed", G_CALLBACK (state_cb),
- pipeline);
-
- source = gst_element_factory_make ("gnomevfssrc", "source");
- g_assert (source);
-
- if (argv[1] && strstr (argv[1], "://") != NULL) {
- g_object_set (G_OBJECT (source), "location", argv[1], NULL);
- } else if (argv[1]) {
- gchar *uri = g_strdup_printf ("file://%s", argv[1]);
-
- g_object_set (G_OBJECT (source), "location", uri, NULL);
- g_free (uri);
- }
-
- decoder = gst_element_factory_make ("decodebin", "decoder");
- g_assert (decoder);
-
- gst_bin_add (GST_BIN (pipeline), source);
- gst_bin_add (GST_BIN (pipeline), decoder);
-
- gst_element_link_pads (source, "src", decoder, "sink");
-
- g_signal_connect (decoder, "new-decoded-pad",
- G_CALLBACK (new_decoded_pad_cb), pipeline);
-
- res = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (res == GST_STATE_CHANGE_FAILURE) {
- g_print ("could not play\n");
- return -1;
- }
-
- g_main_loop_run (loop);
-
- /* tidy up */
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
- gst_object_unref (bus);
-
- return 0;
-}
diff --git a/gst/playback/gstdecodebin.c b/gst/playback/gstdecodebin.c
deleted file mode 100644
index 13c136fa..00000000
--- a/gst/playback/gstdecodebin.c
+++ /dev/null
@@ -1,2048 +0,0 @@
-/* GStreamer
- * Copyright (C) <2004> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-decodebin
- *
- * #GstBin that auto-magically constructs a decoding pipeline using available
- * decoders and demuxers via auto-plugging.
- *
- * When using decodebin in your application, connect a signal handler to
- * #GstDecodeBin::new-decoded-pad and connect your sinks from within the
- * callback function.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst-i18n-plugin.h>
-
-#include <string.h>
-#include <gst/gst.h>
-#include <gst/pbutils/pbutils.h>
-
-#include "gstplay-marshal.h"
-
-/* generic templates */
-static GstStaticPadTemplate decoder_bin_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-static GstStaticPadTemplate decoder_bin_src_template =
-GST_STATIC_PAD_TEMPLATE ("src%d",
- GST_PAD_SRC,
- GST_PAD_SOMETIMES,
- GST_STATIC_CAPS_ANY);
-
-GST_DEBUG_CATEGORY_STATIC (gst_decode_bin_debug);
-#define GST_CAT_DEFAULT gst_decode_bin_debug
-
-#define GST_TYPE_DECODE_BIN (gst_decode_bin_get_type())
-#define GST_DECODE_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DECODE_BIN,GstDecodeBin))
-#define GST_DECODE_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DECODE_BIN,GstDecodeBinClass))
-#define GST_IS_DECODE_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DECODE_BIN))
-#define GST_IS_DECODE_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DECODE_BIN))
-
-typedef struct _GstDecodeBin GstDecodeBin;
-typedef struct _GstDecodeBinClass GstDecodeBinClass;
-
-/**
- * GstDecodeBin:
- *
- * Auto-plugging decoder element structure
- */
-struct _GstDecodeBin
-{
- GstBin bin; /* we extend GstBin */
-
- GstElement *typefind; /* this holds the typefind object */
- GstElement *fakesink;
-
- GList *dynamics; /* list of dynamic connections */
-
- GList *queues; /* list of demuxer-decoder queues */
-
- GList *probes; /* list of PadProbeData */
-
- GList *factories; /* factories we can use for selecting elements */
- gint numpads;
- gint numwaiting;
-
- gboolean have_type;
- guint have_type_id; /* signal id for the typefind element */
-
- gboolean shutting_down; /* stop pluggin if we're shutting down */
-
- GType queue_type; /* store the GType of queues, to aid in recognising them */
-
- GMutex *cb_mutex; /* Mutex for multi-threaded callbacks, such as removing the fakesink */
-};
-
-struct _GstDecodeBinClass
-{
- GstBinClass parent_class;
-
- /* signal we fire when a new pad has been decoded into raw audio/video */
- void (*new_decoded_pad) (GstElement * element, GstPad * pad, gboolean last);
- /* signal we fire when a pad has been removed */
- void (*removed_decoded_pad) (GstElement * element, GstPad * pad);
- /* signal fired when we found a pad that we cannot decode */
- void (*unknown_type) (GstElement * element, GstPad * pad, GstCaps * caps);
-};
-
-/* signals */
-enum
-{
- SIGNAL_NEW_DECODED_PAD,
- SIGNAL_REMOVED_DECODED_PAD,
- SIGNAL_UNKNOWN_TYPE,
- SIGNAL_REDIRECT,
- LAST_SIGNAL
-};
-
-/* Properties */
-enum
-{
- PROP_0,
- PROP_SINK_CAPS,
-};
-
-
-typedef struct
-{
- GstPad *pad;
- gulong sigid;
- gboolean done;
-} PadProbeData;
-
-/* this structure is created for all dynamic pads that could get created
- * at runtime */
-typedef struct
-{
- GstDecodeBin *decode_bin; /* pointer to ourself */
-
- GstElement *element; /* the element sending the signal */
- gint np_sig_id; /* signal id of new_pad */
- gint nmp_sig_id; /* signal id of no_more_pads */
-
- GstPad *pad; /* the pad sending the signal */
- gint caps_sig_id; /* signal id of caps */
-}
-GstDynamic;
-
-static void gst_decode_bin_class_init (GstDecodeBinClass * klass);
-static void gst_decode_bin_init (GstDecodeBin * decode_bin);
-static void gst_decode_bin_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_decode_bin_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_decode_bin_dispose (GObject * object);
-static void gst_decode_bin_finalize (GObject * object);
-
-static GstStateChangeReturn gst_decode_bin_change_state (GstElement * element,
- GstStateChange transition);
-
-static gboolean add_fakesink (GstDecodeBin * decode_bin);
-static void remove_fakesink (GstDecodeBin * decode_bin);
-
-static void dynamic_free (GstDynamic * dyn);
-static void free_dynamics (GstDecodeBin * decode_bin);
-static void type_found (GstElement * typefind, guint probability,
- GstCaps * caps, GstDecodeBin * decode_bin);
-static GstElement *try_to_link_1 (GstDecodeBin * decode_bin,
- GstElement * origelement, GstPad * pad, GList * factories);
-static void close_link (GstElement * element, GstDecodeBin * decode_bin);
-static void close_pad_link (GstElement * element, GstPad * pad,
- GstCaps * caps, GstDecodeBin * decode_bin, gboolean more);
-static void unlinked (GstPad * pad, GstPad * peerpad,
- GstDecodeBin * decode_bin);
-static void new_pad (GstElement * element, GstPad * pad, GstDynamic * dynamic);
-static void no_more_pads (GstElement * element, GstDynamic * dynamic);
-static void new_caps (GstPad * pad, GParamSpec * unused, GstDynamic * dynamic);
-
-static void queue_filled_cb (GstElement * queue, GstDecodeBin * decode_bin);
-static void queue_underrun_cb (GstElement * queue, GstDecodeBin * decode_bin);
-
-static gboolean is_demuxer_element (GstElement * srcelement);
-
-static GstElementClass *parent_class;
-static guint gst_decode_bin_signals[LAST_SIGNAL] = { 0 };
-
-static const GstElementDetails gst_decode_bin_details =
-GST_ELEMENT_DETAILS ("Decoder Bin",
- "Generic/Bin/Decoder",
- "Autoplug and decode to raw media",
- "Wim Taymans <wim.taymans@gmail.com>");
-
-
-static GType
-gst_decode_bin_get_type (void)
-{
- static GType gst_decode_bin_type = 0;
-
- if (!gst_decode_bin_type) {
- static const GTypeInfo gst_decode_bin_info = {
- sizeof (GstDecodeBinClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_decode_bin_class_init,
- NULL,
- NULL,
- sizeof (GstDecodeBin),
- 0,
- (GInstanceInitFunc) gst_decode_bin_init,
- NULL
- };
-
- gst_decode_bin_type =
- g_type_register_static (GST_TYPE_BIN, "GstDecodeBin",
- &gst_decode_bin_info, 0);
- }
-
- return gst_decode_bin_type;
-}
-
-static void
-gst_decode_bin_class_init (GstDecodeBinClass * klass)
-{
- GObjectClass *gobject_klass;
- GstElementClass *gstelement_klass;
-
- gobject_klass = (GObjectClass *) klass;
- gstelement_klass = (GstElementClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_klass->set_property = gst_decode_bin_set_property;
- gobject_klass->get_property = gst_decode_bin_get_property;
- gobject_klass->dispose = gst_decode_bin_dispose;
- gobject_klass->finalize = gst_decode_bin_finalize;
-
- /**
- * GstDecodeBin::new-decoded-pad:
- * @bin: The decodebin
- * @pad: The newly created pad
- * @islast: #TRUE if this is the last pad to be added. Deprecated.
- *
- * This signal gets emitted as soon as a new pad of the same type as one of
- * the valid 'raw' types is added.
- */
- gst_decode_bin_signals[SIGNAL_NEW_DECODED_PAD] =
- g_signal_new ("new-decoded-pad", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstDecodeBinClass, new_decoded_pad), NULL, NULL,
- gst_play_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, GST_TYPE_PAD,
- G_TYPE_BOOLEAN);
- /**
- * GstDecodeBin::removed-decoded-pad:
- * @bin: The decodebin
- * @pad: The pad that was removed
- *
- * This signal is emitted when a 'final' caps pad has been removed.
- */
- gst_decode_bin_signals[SIGNAL_REMOVED_DECODED_PAD] =
- g_signal_new ("removed-decoded-pad", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstDecodeBinClass, removed_decoded_pad), NULL, NULL,
- gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_PAD);
- /**
- * GstDecodeBin::unknown-type:
- * @bin: The decodebin
- * @pad: The new pad containing caps that cannot be resolved to a 'final'
- * stream type.
- * @caps: The #GstCaps of the pad that cannot be resolved.
- *
- * This signal is emitted when a pad for which there is no further possible
- * decoding is added to the decodebin.
- */
- gst_decode_bin_signals[SIGNAL_UNKNOWN_TYPE] =
- g_signal_new ("unknown-type", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDecodeBinClass, unknown_type),
- NULL, NULL, gst_marshal_VOID__OBJECT_BOXED, G_TYPE_NONE, 2,
- GST_TYPE_PAD, GST_TYPE_CAPS);
-
- g_object_class_install_property (gobject_klass, PROP_SINK_CAPS,
- g_param_spec_boxed ("sink-caps", "Sink Caps",
- "The caps of the input data. (NULL = use typefind element)",
- GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gst_element_class_add_pad_template (gstelement_klass,
- gst_static_pad_template_get (&decoder_bin_sink_template));
- gst_element_class_add_pad_template (gstelement_klass,
- gst_static_pad_template_get (&decoder_bin_src_template));
-
- gst_element_class_set_details (gstelement_klass, &gst_decode_bin_details);
-
- gstelement_klass->change_state =
- GST_DEBUG_FUNCPTR (gst_decode_bin_change_state);
-}
-
-/* check if the bin is dynamic.
- *
- * If there are no outstanding dynamic connections, the bin is
- * considered to be non-dynamic.
- */
-static gboolean
-gst_decode_bin_is_dynamic (GstDecodeBin * decode_bin)
-{
- return decode_bin->dynamics != NULL;
-}
-
-/* the filter function for selecting the elements we can use in
- * autoplugging */
-static gboolean
-gst_decode_bin_factory_filter (GstPluginFeature * feature,
- GstDecodeBin * decode_bin)
-{
- guint rank;
- const gchar *klass;
-
- /* we only care about element factories */
- if (!GST_IS_ELEMENT_FACTORY (feature))
- return FALSE;
-
- klass = gst_element_factory_get_klass (GST_ELEMENT_FACTORY (feature));
- /* only demuxers, decoders and parsers can play */
- if (strstr (klass, "Demux") == NULL &&
- strstr (klass, "Decoder") == NULL && strstr (klass, "Parse") == NULL &&
- strstr (klass, "Depayloader") == NULL) {
- return FALSE;
- }
-
- /* only select elements with autoplugging rank */
- rank = gst_plugin_feature_get_rank (feature);
- if (rank < GST_RANK_MARGINAL)
- return FALSE;
-
- return TRUE;
-}
-
-/* function used to sort element features */
-static gint
-compare_ranks (GstPluginFeature * f1, GstPluginFeature * f2)
-{
- gint diff;
- const gchar *rname1, *rname2;
-
- diff = gst_plugin_feature_get_rank (f2) - gst_plugin_feature_get_rank (f1);
- if (diff != 0)
- return diff;
-
- rname1 = gst_plugin_feature_get_name (f1);
- rname2 = gst_plugin_feature_get_name (f2);
-
- diff = strcmp (rname2, rname1);
-
- return diff;
-}
-
-static void
-print_feature (GstPluginFeature * feature)
-{
- const gchar *rname;
-
- rname = gst_plugin_feature_get_name (feature);
-
- GST_DEBUG ("%s", rname);
-}
-
-static void
-gst_decode_bin_init (GstDecodeBin * decode_bin)
-{
- GList *factories;
-
- decode_bin->cb_mutex = g_mutex_new ();
-
- /* first filter out the interesting element factories */
- factories = gst_default_registry_feature_filter (
- (GstPluginFeatureFilter) gst_decode_bin_factory_filter,
- FALSE, decode_bin);
-
- /* sort them according to their ranks */
- decode_bin->factories = g_list_sort (factories, (GCompareFunc) compare_ranks);
- /* do some debugging */
- g_list_foreach (decode_bin->factories, (GFunc) print_feature, NULL);
-
- /* we create the typefind element only once */
- decode_bin->typefind = gst_element_factory_make ("typefind", "typefind");
- if (!decode_bin->typefind) {
- g_warning ("can't find typefind element, decodebin will not work");
- } else {
- GstPad *pad, *gpad;
-
- /* add the typefind element */
- if (!gst_bin_add (GST_BIN (decode_bin), decode_bin->typefind)) {
- g_warning ("Could not add typefind element, decodebin will not work");
- gst_object_unref (decode_bin->typefind);
- decode_bin->typefind = NULL;
- }
-
- /* get the sinkpad */
- pad = gst_element_get_static_pad (decode_bin->typefind, "sink");
-
- /* ghost the sink pad to ourself */
- gpad = gst_ghost_pad_new ("sink", pad);
- gst_pad_set_active (gpad, TRUE);
- gst_element_add_pad (GST_ELEMENT (decode_bin), gpad);
-
- gst_object_unref (pad);
-
- /* connect a signal to find out when the typefind element found
- * a type */
- decode_bin->have_type_id =
- g_signal_connect (G_OBJECT (decode_bin->typefind), "have_type",
- G_CALLBACK (type_found), decode_bin);
- }
- add_fakesink (decode_bin);
-
- decode_bin->dynamics = NULL;
- decode_bin->queues = NULL;
- decode_bin->probes = NULL;
-}
-
-static void
-gst_decode_bin_dispose (GObject * object)
-{
- GstDecodeBin *decode_bin;
-
- decode_bin = GST_DECODE_BIN (object);
-
- if (decode_bin->factories)
- gst_plugin_feature_list_free (decode_bin->factories);
- decode_bin->factories = NULL;
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-
- /* our parent dispose might trigger new signals when pads are unlinked
- * etc. clean up the mess here. */
- /* FIXME do proper cleanup when going to NULL */
- free_dynamics (decode_bin);
-}
-
-static void
-gst_decode_bin_set_sink_caps (GstDecodeBin * dbin, GstCaps * caps)
-{
- GST_DEBUG_OBJECT (dbin, "Setting new caps: %" GST_PTR_FORMAT, caps);
-
- g_object_set (dbin->typefind, "force-caps", caps, NULL);
-}
-
-static GstCaps *
-gst_decode_bin_get_sink_caps (GstDecodeBin * dbin)
-{
- GstCaps *caps;
-
- GST_DEBUG_OBJECT (dbin, "Getting currently set caps");
-
- g_object_get (dbin->typefind, "force-caps", &caps, NULL);
-
- return caps;
-}
-
-static void
-gst_decode_bin_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstDecodeBin *dbin;
-
- dbin = GST_DECODE_BIN (object);
-
- switch (prop_id) {
- case PROP_SINK_CAPS:
- gst_decode_bin_set_sink_caps (dbin, g_value_get_boxed (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_decode_bin_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstDecodeBin *dbin;
-
- dbin = GST_DECODE_BIN (object);
- switch (prop_id) {
- case PROP_SINK_CAPS:
- g_value_take_boxed (value, gst_decode_bin_get_sink_caps (dbin));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_decode_bin_finalize (GObject * object)
-{
- GstDecodeBin *decode_bin = GST_DECODE_BIN (object);
-
- g_mutex_free (decode_bin->cb_mutex);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-struct DynFind
-{
- GstElement *elem;
- GstPad *pad;
-};
-
-static gint
-find_dynamic (GstDynamic * dyn, struct DynFind *info)
-{
- if (dyn->element == info->elem && dyn->pad == info->pad)
- return 0;
- return 1;
-}
-
-/* Add either an element (for dynamic pads/pad-added watching) or a
- * pad (for delayed caps/notify::caps watching) to the dynamic list,
- * taking care to ignore repeat entries so we don't end up handling a
- * pad twice, for example */
-static void
-dynamic_add (GstElement * element, GstPad * pad, GstDecodeBin * decode_bin)
-{
- GstDynamic *dyn;
- struct DynFind find_info;
- GList *found;
-
- g_return_if_fail (element != NULL);
-
- /* do a search that this entry doesn't already exist */
- find_info.elem = element;
- find_info.pad = pad;
- found = g_list_find_custom (decode_bin->dynamics, &find_info,
- (GCompareFunc) find_dynamic);
- if (found != NULL)
- goto exit;
-
- /* take refs */
- dyn = g_new0 (GstDynamic, 1);
- dyn->element = gst_object_ref (element);
- dyn->decode_bin = gst_object_ref (decode_bin);
- if (pad) {
- dyn->pad = gst_object_ref (pad);
- GST_DEBUG_OBJECT (decode_bin, "dynamic create for pad %" GST_PTR_FORMAT,
- pad);
- dyn->caps_sig_id = g_signal_connect (G_OBJECT (pad), "notify::caps",
- G_CALLBACK (new_caps), dyn);
- } else {
- GST_DEBUG_OBJECT (decode_bin, "dynamic create for element %"
- GST_PTR_FORMAT, element);
- dyn->np_sig_id = g_signal_connect (G_OBJECT (element), "pad-added",
- G_CALLBACK (new_pad), dyn);
- dyn->nmp_sig_id = g_signal_connect (G_OBJECT (element), "no-more-pads",
- G_CALLBACK (no_more_pads), dyn);
- }
-
- /* and add this element to the dynamic elements */
- decode_bin->dynamics = g_list_prepend (decode_bin->dynamics, dyn);
-
- return;
-exit:
- if (element) {
- GST_DEBUG_OBJECT (decode_bin, "Dynamic element already added: %"
- GST_PTR_FORMAT, element);
- } else {
- GST_DEBUG_OBJECT (decode_bin, "Dynamic pad already added: %"
- GST_PTR_FORMAT, pad);
- }
-}
-
-static void
-dynamic_free (GstDynamic * dyn)
-{
- GST_DEBUG_OBJECT (dyn->decode_bin, "dynamic free");
-
- /* disconnect signals */
- if (dyn->np_sig_id)
- g_signal_handler_disconnect (G_OBJECT (dyn->element), dyn->np_sig_id);
- if (dyn->nmp_sig_id)
- g_signal_handler_disconnect (G_OBJECT (dyn->element), dyn->nmp_sig_id);
- if (dyn->caps_sig_id)
- g_signal_handler_disconnect (G_OBJECT (dyn->pad), dyn->caps_sig_id);
-
- if (dyn->pad)
- gst_object_unref (dyn->pad);
- dyn->pad = NULL;
- if (dyn->element)
- gst_object_unref (dyn->element);
- dyn->element = NULL;
-
- gst_object_unref (dyn->decode_bin);
- dyn->decode_bin = NULL;
-
- g_free (dyn);
-}
-
-static void
-free_dynamics (GstDecodeBin * decode_bin)
-{
- GList *dyns;
-
- for (dyns = decode_bin->dynamics; dyns; dyns = g_list_next (dyns)) {
- GstDynamic *dynamic = (GstDynamic *) dyns->data;
-
- dynamic_free (dynamic);
- }
- g_list_free (decode_bin->dynamics);
- decode_bin->dynamics = NULL;
-}
-
-/* this function runs through the element factories and returns a list
- * of all elements that are able to sink the given caps
- */
-static GList *
-find_compatibles (GstDecodeBin * decode_bin, const GstCaps * caps)
-{
- GList *factories;
- GList *to_try = NULL;
-
- /* loop over all the factories */
- for (factories = decode_bin->factories; factories;
- factories = g_list_next (factories)) {
- GstElementFactory *factory = GST_ELEMENT_FACTORY (factories->data);
- const GList *templates;
- GList *walk;
-
- /* get the templates from the element factory */
- templates = gst_element_factory_get_static_pad_templates (factory);
- for (walk = (GList *) templates; walk; walk = g_list_next (walk)) {
- GstStaticPadTemplate *templ = walk->data;
-
- /* we only care about the sink templates */
- if (templ->direction == GST_PAD_SINK) {
- GstCaps *intersect;
- GstCaps *tmpl_caps;
-
- /* try to intersect the caps with the caps of the template */
- tmpl_caps = gst_static_caps_get (&templ->static_caps);
-
- intersect = gst_caps_intersect (caps, tmpl_caps);
- gst_caps_unref (tmpl_caps);
-
- /* check if the intersection is empty */
- if (!gst_caps_is_empty (intersect)) {
- /* non empty intersection, we can use this element */
- to_try = g_list_prepend (to_try, factory);
- gst_caps_unref (intersect);
- break;
- }
- gst_caps_unref (intersect);
- }
- }
- }
- to_try = g_list_reverse (to_try);
-
- return to_try;
-}
-
-static gboolean
-mimetype_is_raw (const gchar * mimetype)
-{
- return g_str_has_prefix (mimetype, "video/x-raw") ||
- g_str_has_prefix (mimetype, "audio/x-raw") ||
- g_str_has_prefix (mimetype, "text/plain") ||
- g_str_has_prefix (mimetype, "text/x-pango-markup");
-}
-
-static void
-free_pad_probes (GstDecodeBin * decode_bin)
-{
- GList *tmp;
-
- /* Remove pad probes */
- for (tmp = decode_bin->probes; tmp; tmp = g_list_next (tmp)) {
- PadProbeData *data = (PadProbeData *) tmp->data;
-
- gst_pad_remove_data_probe (data->pad, data->sigid);
- g_free (data);
- }
- g_list_free (decode_bin->probes);
- decode_bin->probes = NULL;
-}
-
-/* used when we need to remove a probe because the decoder we plugged failed
- * to activate */
-static void
-free_pad_probe_for_element (GstDecodeBin * decode_bin, GstElement * element)
-{
- GList *l;
-
- for (l = decode_bin->probes; l != NULL; l = g_list_next (l)) {
- PadProbeData *data = (PadProbeData *) l->data;
-
- if (GST_ELEMENT_CAST (GST_PAD_PARENT (data->pad)) == element) {
- gst_pad_remove_data_probe (data->pad, data->sigid);
- decode_bin->probes = g_list_delete_link (decode_bin->probes, l);
- g_free (data);
- return;
- }
- }
-}
-
-static gboolean
-add_fakesink (GstDecodeBin * decode_bin)
-{
- if (decode_bin->fakesink != NULL)
- return TRUE;
-
- g_mutex_lock (decode_bin->cb_mutex);
-
- decode_bin->fakesink = gst_element_factory_make ("fakesink", "fakesink");
- if (!decode_bin->fakesink)
- goto no_fakesink;
-
- /* hacky, remove sink flag, we don't want our decodebin to become a sink
- * just because we add a fakesink element to make us ASYNC */
- GST_OBJECT_FLAG_UNSET (decode_bin->fakesink, GST_ELEMENT_IS_SINK);
-
- /* takes ownership */
- if (!gst_bin_add (GST_BIN (decode_bin), decode_bin->fakesink)) {
- g_warning ("Could not add fakesink element, decodebin will not work");
- gst_object_unref (decode_bin->fakesink);
- decode_bin->fakesink = NULL;
- }
- g_mutex_unlock (decode_bin->cb_mutex);
- return TRUE;
-
- /* ERRORS */
-no_fakesink:
- {
- g_warning ("can't find fakesink element, decodebin will not work");
- g_mutex_unlock (decode_bin->cb_mutex);
- return FALSE;
- }
-}
-
-static void
-remove_fakesink (GstDecodeBin * decode_bin)
-{
- gboolean removed_fakesink = FALSE;
-
- if (decode_bin->fakesink == NULL)
- return;
-
- g_mutex_lock (decode_bin->cb_mutex);
- if (decode_bin->fakesink) {
- GST_DEBUG_OBJECT (decode_bin, "Removing fakesink and marking state dirty");
-
- /* Lock the state to prevent it from changing state to non-NULL
- * before it's removed */
- gst_element_set_locked_state (decode_bin->fakesink, TRUE);
- /* setting the state to NULL is never async */
- gst_element_set_state (decode_bin->fakesink, GST_STATE_NULL);
- gst_bin_remove (GST_BIN (decode_bin), decode_bin->fakesink);
- decode_bin->fakesink = NULL;
-
- removed_fakesink = TRUE;
- }
- g_mutex_unlock (decode_bin->cb_mutex);
-
- if (removed_fakesink) {
- free_pad_probes (decode_bin);
- }
-}
-
-/* this should be implemented with _pad_block() */
-static gboolean
-pad_probe (GstPad * pad, GstMiniObject * data, GstDecodeBin * decode_bin)
-{
- GList *tmp;
- gboolean alldone = TRUE;
-
- for (tmp = decode_bin->probes; tmp; tmp = g_list_next (tmp)) {
- PadProbeData *pdata = (PadProbeData *) tmp->data;
-
- if (pdata->pad == pad) {
- if (GST_IS_BUFFER (data)) {
- if (!pdata->done)
- decode_bin->numwaiting--;
- pdata->done = TRUE;
- } else if (GST_IS_EVENT (data) &&
- ((GST_EVENT_TYPE (data) == GST_EVENT_EOS) ||
- (GST_EVENT_TYPE (data) == GST_EVENT_TAG) ||
- (GST_EVENT_TYPE (data) == GST_EVENT_FLUSH_START))) {
- /* FIXME, what about NEWSEGMENT? really, use _pad_block()... */
- if (!pdata->done)
- decode_bin->numwaiting--;
- pdata->done = TRUE;
- }
- }
-
- if (!(pdata->done)) {
- GST_LOG_OBJECT (decode_bin, "Pad probe on pad %" GST_PTR_FORMAT
- " but pad %" GST_PTR_FORMAT " still needs data.", pad, pdata->pad);
- alldone = FALSE;
- }
- }
- if (alldone)
- remove_fakesink (decode_bin);
- return TRUE;
-}
-
-/* FIXME: this should be somehow merged with the queue code in
- * try_to_link_1() to reduce code duplication */
-static GstPad *
-add_raw_queue (GstDecodeBin * decode_bin, GstPad * pad)
-{
- GstElement *queue = NULL;
- GstPad *queuesinkpad = NULL, *queuesrcpad = NULL;
-
- queue = gst_element_factory_make ("queue", NULL);
- decode_bin->queue_type = G_OBJECT_TYPE (queue);
-
- g_object_set (G_OBJECT (queue), "max-size-buffers", 0, NULL);
- g_object_set (G_OBJECT (queue), "max-size-time", G_GINT64_CONSTANT (0), NULL);
- g_object_set (G_OBJECT (queue), "max-size-bytes", 8192, NULL);
- gst_bin_add (GST_BIN (decode_bin), queue);
- gst_element_set_state (queue, GST_STATE_READY);
- queuesinkpad = gst_element_get_static_pad (queue, "sink");
- queuesrcpad = gst_element_get_static_pad (queue, "src");
-
- if (gst_pad_link (pad, queuesinkpad) != GST_PAD_LINK_OK) {
- GST_WARNING_OBJECT (decode_bin,
- "Linking queue failed, trying without queue");
- gst_element_set_state (queue, GST_STATE_NULL);
- gst_object_unref (queuesrcpad);
- gst_object_unref (queuesinkpad);
- gst_bin_remove (GST_BIN (decode_bin), queue);
- return gst_object_ref (pad);
- }
-
- decode_bin->queues = g_list_append (decode_bin->queues, queue);
- g_signal_connect (G_OBJECT (queue),
- "overrun", G_CALLBACK (queue_filled_cb), decode_bin);
- g_signal_connect (G_OBJECT (queue),
- "underrun", G_CALLBACK (queue_underrun_cb), decode_bin);
-
- gst_element_set_state (queue, GST_STATE_PAUSED);
- gst_object_unref (queuesinkpad);
-
- return queuesrcpad;
-}
-
-/* given a pad and a caps from an element, find the list of elements
- * that could connect to the pad
- *
- * If the pad has a raw format, this function will create a ghostpad
- * for the pad onto the decodebin.
- *
- * If no compatible elements could be found, this function will signal
- * the unknown_type signal.
- */
-static void
-close_pad_link (GstElement * element, GstPad * pad, GstCaps * caps,
- GstDecodeBin * decode_bin, gboolean more)
-{
- GstStructure *structure;
- const gchar *mimetype;
- gchar *padname;
- gint diff;
-
- padname = gst_pad_get_name (pad);
- diff = strncmp (padname, "current_", 8);
- g_free (padname);
-
- /* hack.. ignore current pads */
- if (!diff)
- return;
-
- /* the caps is empty, this means the pad has no type, we can only
- * decide to fire the unknown_type signal. */
- if (caps == NULL || gst_caps_is_empty (caps))
- goto unknown_type;
-
- /* the caps is any, this means the pad can be anything and
- * we don't know yet */
- if (gst_caps_is_any (caps))
- goto dont_know_yet;
-
- GST_LOG_OBJECT (element, "trying to close %" GST_PTR_FORMAT, caps);
-
- /* FIXME, iterate over more structures? I guess it is possible that
- * this pad has some encoded and some raw pads. This code will fail
- * then if the first structure is not the raw type... */
- structure = gst_caps_get_structure (caps, 0);
- mimetype = gst_structure_get_name (structure);
-
- /* first see if this is raw. If the type is raw, we can
- * create a ghostpad for this pad. It's possible that the caps are not
- * fixed. */
- if (mimetype_is_raw (mimetype)) {
- gchar *padname;
- GstPad *ghost;
- PadProbeData *data;
-
- /* If we're at a demuxer element but have raw data already
- * we have to add a queue here. For non-raw data this is done
- * in try_to_link_1() */
- if (is_demuxer_element (element)) {
- GST_DEBUG_OBJECT (decode_bin,
- "Element %s is a demuxer, inserting a queue",
- GST_OBJECT_NAME (element));
-
- pad = add_raw_queue (decode_bin, pad);
- }
-
- /* make a unique name for this new pad */
- padname = g_strdup_printf ("src%d", decode_bin->numpads);
- decode_bin->numpads++;
-
- /* make it a ghostpad */
- ghost = gst_ghost_pad_new (padname, pad);
- gst_pad_set_active (ghost, TRUE);
- gst_element_add_pad (GST_ELEMENT (decode_bin), ghost);
-
- data = g_new0 (PadProbeData, 1);
- data->pad = pad;
- data->done = FALSE;
-
- /* FIXME, use _pad_block() */
- data->sigid = gst_pad_add_data_probe (pad, G_CALLBACK (pad_probe),
- decode_bin);
- decode_bin->numwaiting++;
-
- decode_bin->probes = g_list_append (decode_bin->probes, data);
-
- GST_LOG_OBJECT (element, "closed pad %s", padname);
-
- /* our own signal with an extra flag that this is the only pad */
- GST_DEBUG_OBJECT (decode_bin, "emitting new-decoded-pad");
- g_signal_emit (G_OBJECT (decode_bin),
- gst_decode_bin_signals[SIGNAL_NEW_DECODED_PAD], 0, ghost, !more);
- GST_DEBUG_OBJECT (decode_bin, "emitted new-decoded-pad");
-
- g_free (padname);
-
- /* If we're at a demuxer element pad was set to a queue's
- * srcpad and must be unref'd here */
- if (is_demuxer_element (element))
- gst_object_unref (pad);
- } else {
- GList *to_try;
-
- /* if the caps has many types, we need to delay */
- if (!gst_caps_is_fixed (caps))
- goto many_types;
-
- /* continue plugging, first find all compatible elements */
- to_try = find_compatibles (decode_bin, caps);
- if (to_try == NULL)
- /* no compatible elements, we cannot go on */
- goto unknown_type;
-
- if (try_to_link_1 (decode_bin, element, pad, to_try) == NULL) {
- g_list_free (to_try);
- GST_LOG_OBJECT (pad, "none of the allegedly available elements usable");
- goto unknown_type;
- }
-
- /* can free the list again now */
- g_list_free (to_try);
- }
- return;
-
- /* ERRORS */
-unknown_type:
- {
- GST_LOG_OBJECT (pad, "unknown type found, fire signal");
- g_signal_emit (G_OBJECT (decode_bin),
- gst_decode_bin_signals[SIGNAL_UNKNOWN_TYPE], 0, pad, caps);
-
- gst_element_post_message (GST_ELEMENT_CAST (decode_bin),
- gst_missing_decoder_message_new (GST_ELEMENT_CAST (decode_bin), caps));
-
- if (element == decode_bin->typefind) {
- gchar *desc;
-
- desc = gst_pb_utils_get_decoder_description (caps);
- GST_ELEMENT_ERROR (decode_bin, STREAM, CODEC_NOT_FOUND,
- (_("A %s plugin is required to play this stream, but not installed."),
- desc),
- ("No decoder to handle media type '%s'",
- gst_structure_get_name (gst_caps_get_structure (caps, 0))));
- g_free (desc);
- }
-
- return;
- }
-dont_know_yet:
- {
- GST_LOG_OBJECT (pad, "type is not known yet");
- goto setup_caps_delay;
- }
-many_types:
- {
- GST_LOG_OBJECT (pad, "many possible types");
- goto setup_caps_delay;
- }
-setup_caps_delay:
- {
- GST_LOG_OBJECT (pad, "setting up a delayed link");
- dynamic_add (element, pad, decode_bin);
- return;
- }
-}
-
-/* Decide whether an element is a demuxer based on the
- * klass and number/type of src pad templates it has */
-static gboolean
-is_demuxer_element (GstElement * srcelement)
-{
- GstElementFactory *srcfactory;
- GstElementClass *elemclass;
- GList *walk;
- const gchar *klass;
- gint potential_src_pads = 0;
-
- srcfactory = gst_element_get_factory (srcelement);
- klass = gst_element_factory_get_klass (srcfactory);
-
- /* Can't be a demuxer unless it has Demux in the klass name */
- if (klass == NULL || !strstr (klass, "Demux"))
- return FALSE;
-
- /* Walk the src pad templates and count how many the element
- * might produce */
- elemclass = GST_ELEMENT_GET_CLASS (srcelement);
-
- walk = gst_element_class_get_pad_template_list (elemclass);
- while (walk != NULL) {
- GstPadTemplate *templ;
-
- templ = (GstPadTemplate *) walk->data;
- if (GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SRC) {
- switch (GST_PAD_TEMPLATE_PRESENCE (templ)) {
- case GST_PAD_ALWAYS:
- case GST_PAD_SOMETIMES:
- if (strstr (GST_PAD_TEMPLATE_NAME_TEMPLATE (templ), "%"))
- potential_src_pads += 2; /* Might make multiple pads */
- else
- potential_src_pads += 1;
- break;
- case GST_PAD_REQUEST:
- potential_src_pads += 2;
- break;
- }
- }
- walk = g_list_next (walk);
- }
-
- if (potential_src_pads < 2)
- return FALSE;
-
- return TRUE;
-}
-
-/*
- * given a list of element factories, try to link one of the factories
- * to the given pad.
- *
- * The function returns the element that was successfully linked to the
- * pad.
- */
-static GstElement *
-try_to_link_1 (GstDecodeBin * decode_bin, GstElement * srcelement, GstPad * pad,
- GList * factories)
-{
- GList *walk;
- GstElement *result = NULL;
- gboolean isdemux = FALSE;
- GstPad *queuesinkpad = NULL, *queuesrcpad = NULL;
- GstElement *queue = NULL;
- GstPad *usedsrcpad = pad;
-
- /* Check if the parent of the src pad is a demuxer */
- isdemux = is_demuxer_element (srcelement);
-
- if (isdemux && factories != NULL) {
- GstPadLinkReturn dqlink;
-
- /* Insert a queue between demuxer and decoder */
- GST_DEBUG_OBJECT (decode_bin,
- "Element %s is a demuxer, inserting a queue",
- GST_OBJECT_NAME (srcelement));
- queue = gst_element_factory_make ("queue", NULL);
- decode_bin->queue_type = G_OBJECT_TYPE (queue);
-
- g_object_set (G_OBJECT (queue), "max-size-buffers", 0, NULL);
- g_object_set (G_OBJECT (queue), "max-size-time", G_GINT64_CONSTANT (0),
- NULL);
- g_object_set (G_OBJECT (queue), "max-size-bytes", 8192, NULL);
- gst_bin_add (GST_BIN (decode_bin), queue);
- gst_element_set_state (queue, GST_STATE_READY);
- queuesinkpad = gst_element_get_static_pad (queue, "sink");
- usedsrcpad = queuesrcpad = gst_element_get_static_pad (queue, "src");
-
- dqlink = gst_pad_link (pad, queuesinkpad);
- g_return_val_if_fail (dqlink == GST_PAD_LINK_OK, NULL);
- }
-
- /* loop over the factories */
- for (walk = factories; walk; walk = g_list_next (walk)) {
- GstElementFactory *factory = GST_ELEMENT_FACTORY (walk->data);
- GstElement *element;
- GstPadLinkReturn ret;
- GstPad *sinkpad;
-
- GST_DEBUG_OBJECT (decode_bin, "trying to link %s",
- gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory)));
-
- /* make an element from the factory first */
- if ((element = gst_element_factory_create (factory, NULL)) == NULL) {
- /* hmm, strange. Like with all things in life, let's move on.. */
- GST_WARNING_OBJECT (decode_bin, "could not create an element from %s",
- gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory)));
- continue;
- }
-
- /* try to link the given pad to a sinkpad */
- /* FIXME, find the sinkpad by looping over the pads instead of
- * looking it up by name */
- if ((sinkpad = gst_element_get_static_pad (element, "sink")) == NULL) {
- /* if no pad is found we can't do anything */
- GST_WARNING_OBJECT (decode_bin, "could not find sinkpad in element");
- continue;
- }
-
- /* now add the element to the bin first */
- GST_DEBUG_OBJECT (decode_bin, "adding %s", GST_OBJECT_NAME (element));
- gst_bin_add (GST_BIN (decode_bin), element);
-
- /* set to READY first so it is ready, duh. */
- if (gst_element_set_state (element,
- GST_STATE_READY) == GST_STATE_CHANGE_FAILURE) {
- GST_WARNING_OBJECT (decode_bin, "Couldn't set %s to READY",
- GST_ELEMENT_NAME (element));
- /* get rid of the sinkpad */
- gst_object_unref (sinkpad);
- /* this element did not work, remove it again and continue trying
- * other elements, the element will be disposed. */
- /* FIXME: shouldn't we do this before adding it to the bin so that no
- * error messages get through to the app? (tpm) */
- gst_bin_remove (GST_BIN (decode_bin), element);
- continue;
- }
-
- if ((ret = gst_pad_link (usedsrcpad, sinkpad)) != GST_PAD_LINK_OK) {
- GST_DEBUG_OBJECT (decode_bin, "link failed on pad %s:%s, reason %d",
- GST_DEBUG_PAD_NAME (pad), ret);
- /* get rid of the sinkpad */
- gst_object_unref (sinkpad);
- /* this element did not work, remove it again and continue trying
- * other elements, the element will be disposed. */
- gst_element_set_state (element, GST_STATE_NULL);
- gst_bin_remove (GST_BIN (decode_bin), element);
- } else {
- GST_DEBUG_OBJECT (decode_bin, "linked on pad %s:%s",
- GST_DEBUG_PAD_NAME (usedsrcpad));
-
- /* configure the queue some more */
- if (queue != NULL) {
- decode_bin->queues = g_list_append (decode_bin->queues, queue);
- g_signal_connect (G_OBJECT (queue),
- "overrun", G_CALLBACK (queue_filled_cb), decode_bin);
- g_signal_connect (G_OBJECT (queue),
- "underrun", G_CALLBACK (queue_underrun_cb), decode_bin);
- }
-
- /* The link worked, now figure out what it was that we connected */
-
- /* make sure we catch unlink signals */
- g_signal_connect (G_OBJECT (pad), "unlinked",
- G_CALLBACK (unlinked), decode_bin);
-
- /* now that we added the element we can try to continue autoplugging
- * on it until we have a raw type */
- close_link (element, decode_bin);
-
- /* change the state of the element to that of the parent */
- if ((gst_element_set_state (element,
- GST_STATE_PAUSED)) == GST_STATE_CHANGE_FAILURE) {
- GST_WARNING_OBJECT (decode_bin, "Couldn't set %s to PAUSED",
- GST_ELEMENT_NAME (element));
- /* close_link -> close_pad_link -> might have set up a pad probe */
- free_pad_probe_for_element (decode_bin, element);
- gst_element_set_state (element, GST_STATE_NULL);
- gst_bin_remove (GST_BIN (decode_bin), element);
- continue;
- }
-
- result = element;
-
- /* get rid of the sinkpad now */
- gst_object_unref (sinkpad);
-
- /* Set the queue to paused and set the pointer to NULL so we don't
- * remove it below */
- if (queue != NULL) {
- gst_element_set_state (queue, GST_STATE_PAUSED);
- queue = NULL;
- gst_object_unref (queuesrcpad);
- gst_object_unref (queuesinkpad);
- }
-
- /* and exit */
- goto done;
- }
- }
-done:
- if (queue != NULL) {
- /* We didn't successfully connect to the queue */
- gst_pad_unlink (pad, queuesinkpad);
- gst_element_set_state (queue, GST_STATE_NULL);
- gst_object_unref (queuesrcpad);
- gst_object_unref (queuesinkpad);
- gst_bin_remove (GST_BIN (decode_bin), queue);
- }
- return result;
-}
-
-static GstPad *
-get_our_ghost_pad (GstDecodeBin * decode_bin, GstPad * pad)
-{
- GstIterator *pad_it = NULL;
- GstPad *db_pad = NULL;
- gboolean done = FALSE;
-
- if (pad == NULL || !GST_PAD_IS_SRC (pad)) {
- GST_DEBUG_OBJECT (decode_bin, "pad NULL or not SRC pad");
- return NULL;
- }
-
- /* our ghostpads are the sourcepads */
- pad_it = gst_element_iterate_src_pads (GST_ELEMENT (decode_bin));
- while (!done) {
- db_pad = NULL;
- switch (gst_iterator_next (pad_it, (gpointer) & db_pad)) {
- case GST_ITERATOR_OK:
- GST_DEBUG_OBJECT (decode_bin, "looking at pad %s:%s",
- GST_DEBUG_PAD_NAME (db_pad));
- if (GST_IS_GHOST_PAD (db_pad)) {
- GstPad *target_pad = NULL;
-
- target_pad = gst_ghost_pad_get_target (GST_GHOST_PAD (db_pad));
- done = (target_pad == pad);
- if (target_pad)
- gst_object_unref (target_pad);
-
- if (done) {
- /* Found our ghost pad */
- GST_DEBUG_OBJECT (decode_bin, "found ghostpad %s:%s for pad %s:%s",
- GST_DEBUG_PAD_NAME (db_pad), GST_DEBUG_PAD_NAME (pad));
- break;
- }
- }
- /* Not the right one */
- gst_object_unref (db_pad);
- break;
- case GST_ITERATOR_RESYNC:
- gst_iterator_resync (pad_it);
- break;
- case GST_ITERATOR_ERROR:
- done = TRUE;
- break;
- case GST_ITERATOR_DONE:
- done = TRUE;
- break;
- }
- }
- gst_iterator_free (pad_it);
-
- return db_pad;
-}
-
-/* remove all downstream elements starting from the given pad.
- * Also make sure to remove the ghostpad we created for the raw
- * decoded stream.
- */
-static void
-remove_element_chain (GstDecodeBin * decode_bin, GstPad * pad)
-{
- GstIterator *iter;
- gboolean done = FALSE;
- gpointer item;
- GstElement *elem = GST_ELEMENT (GST_OBJECT_PARENT (pad));
-
- while (GST_OBJECT_PARENT (elem) &&
- GST_OBJECT_PARENT (elem) != GST_OBJECT (decode_bin))
- elem = GST_ELEMENT (GST_OBJECT_PARENT (elem));
-
- if (G_OBJECT_TYPE (elem) == decode_bin->queue_type) {
- GST_DEBUG_OBJECT (decode_bin,
- "Encountered demuxer output queue while removing element chain");
- decode_bin->queues = g_list_remove (decode_bin->queues, elem);
- }
-
- GST_DEBUG_OBJECT (decode_bin, "%s:%s", GST_DEBUG_PAD_NAME (pad));
- iter = gst_pad_iterate_internal_links (pad);
- if (!iter)
- goto no_iter;
-
- /* remove all elements linked to this pad up to the ghostpad
- * that we created for this stream */
- while (!done) {
- switch (gst_iterator_next (iter, &item)) {
- case GST_ITERATOR_OK:{
- GstPad *pad;
- GstPad *ghostpad;
- GstPad *peer;
-
- pad = GST_PAD (item);
- GST_DEBUG_OBJECT (decode_bin, "inspecting internal pad %s:%s",
- GST_DEBUG_PAD_NAME (pad));
-
- ghostpad = get_our_ghost_pad (decode_bin, pad);
- if (ghostpad) {
- GST_DEBUG_OBJECT (decode_bin, "found our ghost pad %s:%s for %s:%s",
- GST_DEBUG_PAD_NAME (ghostpad), GST_DEBUG_PAD_NAME (pad));
-
- g_signal_emit (G_OBJECT (decode_bin),
- gst_decode_bin_signals[SIGNAL_REMOVED_DECODED_PAD], 0, ghostpad);
-
- gst_element_remove_pad (GST_ELEMENT (decode_bin), ghostpad);
- gst_object_unref (ghostpad);
- continue;
- } else {
- GST_DEBUG_OBJECT (decode_bin, "not one of our ghostpads");
- }
-
- peer = gst_pad_get_peer (pad);
- if (peer) {
- GstObject *parent = gst_pad_get_parent (peer);
-
- GST_DEBUG_OBJECT (decode_bin,
- "internal pad %s:%s linked to pad %s:%s",
- GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (peer));
-
- if (parent) {
- GstObject *grandparent = gst_object_get_parent (parent);
-
- if (grandparent != NULL) {
- if (GST_ELEMENT (grandparent) != GST_ELEMENT (decode_bin)) {
- GST_DEBUG_OBJECT (decode_bin, "dead end pad %s:%s parent %s",
- GST_DEBUG_PAD_NAME (peer), GST_OBJECT_NAME (grandparent));
- } else {
- GST_DEBUG_OBJECT (decode_bin,
- "recursing element %s on pad %s:%s",
- GST_ELEMENT_NAME (elem), GST_DEBUG_PAD_NAME (pad));
- remove_element_chain (decode_bin, peer);
- }
- gst_object_unref (grandparent);
- }
- gst_object_unref (parent);
- }
- gst_object_unref (peer);
- }
- gst_object_unref (item);
- }
- break;
- case GST_ITERATOR_RESYNC:
- gst_iterator_resync (iter);
- break;
- case GST_ITERATOR_ERROR:
- GST_ERROR_OBJECT (pad, "Could not iterate over internally linked pads");
- done = TRUE;
- break;
- case GST_ITERATOR_DONE:
- done = TRUE;
- break;
- }
- }
- GST_DEBUG_OBJECT (decode_bin, "removing %s", GST_ELEMENT_NAME (elem));
-
- gst_iterator_free (iter);
-
-no_iter:
- gst_element_set_state (elem, GST_STATE_NULL);
- gst_bin_remove (GST_BIN (decode_bin), elem);
-}
-
-/* there are @bytes bytes in @queue, enlarge it
- *
- * Returns: new max number of bytes in @queue
- */
-static guint
-queue_enlarge (GstElement * queue, guint bytes, GstDecodeBin * decode_bin)
-{
- /* Increase the queue size by 1Mbyte if it is over 1Mb, else double its current limit
- */
- if (bytes > 1024 * 1024)
- bytes += 1024 * 1024;
- else
- bytes *= 2;
-
- GST_DEBUG_OBJECT (decode_bin,
- "increasing queue %s max-size-bytes to %d", GST_ELEMENT_NAME (queue),
- bytes);
- g_object_set (G_OBJECT (queue), "max-size-bytes", bytes, NULL);
-
- return bytes;
-}
-
-/* this callback is called when our queues fills up or are empty
- * We then check the status of all other queues to make sure we
- * never have an empty and full queue at the same time since that
- * would block dataflow. In the case of a filled queue, we make
- * it larger.
- */
-static void
-queue_underrun_cb (GstElement * queue, GstDecodeBin * decode_bin)
-{
- /* FIXME: we don't really do anything here for now. Ideally we should
- * see if some of the queues are filled and increase their values
- * in that case.
- * Note: be very carefull with thread safety here as this underrun
- * signal is done from the streaming thread of queue srcpad which
- * is different from the pad_added (where we add the queue to the
- * list) and the overrun signals that are signalled from the
- * demuxer thread.
- */
- GST_DEBUG_OBJECT (decode_bin, "got underrun");
-}
-
-/* Make sure we don't have a full queue and empty queue situation */
-static void
-queue_filled_cb (GstElement * queue, GstDecodeBin * decode_bin)
-{
- GList *tmp;
- gboolean increase = FALSE;
- guint bytes;
-
- /* get current byte level from the queue that is filled */
- g_object_get (G_OBJECT (queue), "current-level-bytes", &bytes, NULL);
- GST_DEBUG_OBJECT (decode_bin, "One of the queues is full at %d bytes", bytes);
-
- /* we do not buffer more than 20Mb */
- if (bytes > (20 * 1024 * 1024))
- goto too_large;
-
- /* check all other queue to see if one is empty, in that case
- * we need to enlarge @queue */
- for (tmp = decode_bin->queues; tmp; tmp = g_list_next (tmp)) {
- GstElement *aqueue = GST_ELEMENT (tmp->data);
- guint levelbytes = 0;
-
- if (aqueue != queue) {
- g_object_get (G_OBJECT (aqueue), "current-level-bytes", &levelbytes,
- NULL);
- if (levelbytes == 0) {
- /* yup, found an empty queue, we can stop the search and
- * need to enlarge the queue */
- increase = TRUE;
- break;
- }
- }
- }
-
- if (increase) {
- /* enlarge @queue */
- queue_enlarge (queue, bytes, decode_bin);
- } else {
- GST_DEBUG_OBJECT (decode_bin,
- "Queue is full but other queues are not empty, not doing anything");
- }
- return;
-
- /* errors */
-too_large:
- {
- GST_WARNING_OBJECT (decode_bin,
- "Queue is bigger than 20Mbytes, something else is going wrong");
- return;
- }
-}
-
-/* This function will be called when a dynamic pad is created on an element.
- * We try to continue autoplugging on this new pad. */
-static void
-new_pad (GstElement * element, GstPad * pad, GstDynamic * dynamic)
-{
- GstDecodeBin *decode_bin = dynamic->decode_bin;
- GstCaps *caps;
- gboolean more;
-
- GST_OBJECT_LOCK (decode_bin);
- if (decode_bin->shutting_down)
- goto shutting_down1;
- GST_OBJECT_UNLOCK (decode_bin);
-
- GST_STATE_LOCK (decode_bin);
- if (decode_bin->shutting_down)
- goto shutting_down2;
-
- /* see if any more pending dynamic connections exist */
- more = gst_decode_bin_is_dynamic (decode_bin);
-
- caps = gst_pad_get_caps (pad);
- close_pad_link (element, pad, caps, decode_bin, more);
- if (caps)
- gst_caps_unref (caps);
- GST_STATE_UNLOCK (decode_bin);
-
- return;
-
-shutting_down1:
- {
- GST_DEBUG_OBJECT (decode_bin, "we are shutting down");
- GST_OBJECT_UNLOCK (decode_bin);
- return;
- }
-shutting_down2:
- {
- GST_DEBUG_OBJECT (decode_bin, "we are shutting down");
- GST_STATE_UNLOCK (decode_bin);
- return;
- }
-}
-
-static void
-dynamic_remove (GstDynamic * dynamic)
-{
- GstDecodeBin *decode_bin = dynamic->decode_bin;
-
- /* remove the dynamic from the list of dynamics */
- decode_bin->dynamics = g_list_remove (decode_bin->dynamics, dynamic);
- dynamic_free (dynamic);
-
- /* if we have no more dynamic elements, we have no chance of creating
- * more pads, so we fire the no_more_pads signal */
- if (decode_bin->dynamics == NULL) {
- if (decode_bin->numwaiting == 0) {
- GST_DEBUG_OBJECT (decode_bin,
- "no more dynamic elements, removing fakesink");
- remove_fakesink (decode_bin);
- }
- GST_DEBUG_OBJECT (decode_bin,
- "no more dynamic elements, signaling no_more_pads");
- gst_element_no_more_pads (GST_ELEMENT (decode_bin));
- } else {
- GST_DEBUG_OBJECT (decode_bin, "we have more dynamic elements");
- }
-}
-
-/* this signal is fired when an element signals the no_more_pads signal.
- * This means that the element will not generate more dynamic pads and
- * we can remove the element from the list of dynamic elements. When we
- * have no more dynamic elements in the pipeline, we can fire a no_more_pads
- * signal ourselves. */
-static void
-no_more_pads (GstElement * element, GstDynamic * dynamic)
-{
- GST_DEBUG_OBJECT (dynamic->decode_bin, "no more pads on element %s",
- GST_ELEMENT_NAME (element));
-
- dynamic_remove (dynamic);
-}
-
-static void
-new_caps (GstPad * pad, GParamSpec * unused, GstDynamic * dynamic)
-{
- GST_DEBUG_OBJECT (dynamic->decode_bin, "delayed link triggered");
-
- new_pad (dynamic->element, pad, dynamic);
-
- /* assume it worked and remove the dynamic */
- dynamic_remove (dynamic);
-
- return;
-}
-
-static gboolean
-is_our_kid (GstElement * e, GstDecodeBin * decode_bin)
-{
- gboolean ret;
- GstElement *parent;
-
- parent = (GstElement *) gst_object_get_parent ((GstObject *) e);
- ret = (parent == (GstElement *) decode_bin);
-
- if (parent)
- gst_object_unref ((GstObject *) parent);
-
- return ret;
-}
-
-static gboolean
-elem_is_dynamic (GstElement * element, GstDecodeBin * decode_bin)
-{
- GList *pads;
-
- /* loop over all the padtemplates */
- for (pads = GST_ELEMENT_GET_CLASS (element)->padtemplates; pads;
- pads = g_list_next (pads)) {
- GstPadTemplate *templ = GST_PAD_TEMPLATE (pads->data);
- const gchar *templ_name;
-
- /* we are only interested in source pads */
- if (GST_PAD_TEMPLATE_DIRECTION (templ) != GST_PAD_SRC)
- continue;
-
- templ_name = GST_PAD_TEMPLATE_NAME_TEMPLATE (templ);
- GST_DEBUG_OBJECT (decode_bin, "got a source pad template %s", templ_name);
-
- /* figure out what kind of pad this is */
- switch (GST_PAD_TEMPLATE_PRESENCE (templ)) {
- case GST_PAD_SOMETIMES:
- {
- /* try to get the pad to see if it is already created or
- * not */
- GstPad *pad = gst_element_get_static_pad (element, templ_name);
-
- if (pad) {
- GST_DEBUG_OBJECT (decode_bin, "got the pad for sometimes template %s",
- templ_name);
- gst_object_unref (pad);
- } else {
- GST_DEBUG_OBJECT (decode_bin,
- "did not get the sometimes pad of template %s", templ_name);
- /* we have an element that will create dynamic pads */
- return TRUE;
- }
- break;
- }
- default:
- /* Don't care about ALWAYS or REQUEST pads */
- break;
- }
- }
- return FALSE;
-}
-
-/* This function will be called when a pad is disconnected for some reason */
-static void
-unlinked (GstPad * pad, GstPad * peerpad, GstDecodeBin * decode_bin)
-{
- GstElement *element, *peer;
-
- /* inactivate pad */
- gst_pad_set_active (pad, GST_ACTIVATE_NONE);
-
- peer = gst_pad_get_parent_element (peerpad);
-
- if (!is_our_kid (peer, decode_bin))
- goto exit;
-
- GST_DEBUG_OBJECT (decode_bin, "pad %s:%s removal while alive - chained?",
- GST_DEBUG_PAD_NAME (pad));
-
- /* remove all elements linked to the peerpad */
- remove_element_chain (decode_bin, peerpad);
-
- /* Re-add as a dynamic element if needed, via close_link */
- element = gst_pad_get_parent_element (pad);
- if (element) {
- if (elem_is_dynamic (element, decode_bin))
- dynamic_add (element, NULL, decode_bin);
-
- gst_object_unref (element);
- }
-
-exit:
- gst_object_unref (peer);
-}
-
-/* this function inspects the given element and tries to connect something
- * on the srcpads. If there are dynamic pads, it sets up a signal handler to
- * continue autoplugging when they become available */
-static void
-close_link (GstElement * element, GstDecodeBin * decode_bin)
-{
- GList *pads;
- gboolean dynamic = FALSE;
- GList *to_connect = NULL;
- gboolean more;
-
- GST_DEBUG_OBJECT (decode_bin, "closing links with element %s",
- GST_ELEMENT_NAME (element));
-
- /* loop over all the padtemplates */
- for (pads = GST_ELEMENT_GET_CLASS (element)->padtemplates; pads;
- pads = g_list_next (pads)) {
- GstPadTemplate *templ = GST_PAD_TEMPLATE (pads->data);
- const gchar *templ_name;
-
- /* we are only interested in source pads */
- if (GST_PAD_TEMPLATE_DIRECTION (templ) != GST_PAD_SRC)
- continue;
-
- templ_name = GST_PAD_TEMPLATE_NAME_TEMPLATE (templ);
- GST_DEBUG_OBJECT (decode_bin, "got a source pad template %s", templ_name);
-
- /* figure out what kind of pad this is */
- switch (GST_PAD_TEMPLATE_PRESENCE (templ)) {
- case GST_PAD_ALWAYS:
- {
- /* get the pad that we need to autoplug */
- GstPad *pad = gst_element_get_static_pad (element, templ_name);
-
- if (pad) {
- GST_DEBUG_OBJECT (decode_bin, "got the pad for always template %s",
- templ_name);
- /* here is the pad, we need to autoplug it */
- to_connect = g_list_prepend (to_connect, pad);
- } else {
- /* strange, pad is marked as always but it's not
- * there. Fix the element */
- GST_WARNING_OBJECT (decode_bin,
- "could not get the pad for always template %s", templ_name);
- }
- break;
- }
- case GST_PAD_SOMETIMES:
- {
- /* try to get the pad to see if it is already created or
- * not */
- GstPad *pad = gst_element_get_static_pad (element, templ_name);
-
- if (pad) {
- GST_DEBUG_OBJECT (decode_bin, "got the pad for sometimes template %s",
- templ_name);
- /* the pad is created, we need to autoplug it */
- to_connect = g_list_prepend (to_connect, pad);
- } else {
- GST_DEBUG_OBJECT (decode_bin,
- "did not get the sometimes pad of template %s", templ_name);
- /* we have an element that will create dynamic pads */
- dynamic = TRUE;
- }
- break;
- }
- case GST_PAD_REQUEST:
- /* ignore request pads */
- GST_DEBUG_OBJECT (decode_bin, "ignoring request padtemplate %s",
- templ_name);
- break;
- }
- }
- if (dynamic) {
- GST_DEBUG_OBJECT (decode_bin, "got a dynamic element here");
- /* ok, this element has dynamic pads, set up the signal handlers to be
- * notified of them */
-
- dynamic_add (element, NULL, decode_bin);
- }
-
- /* Check if this is an element with more than 1 pad. If this element
- * has more than 1 pad, we need to be carefull not to signal the
- * no_more_pads signal after connecting the first pad. */
- more = g_list_length (to_connect) > 1;
-
- /* now loop over all the pads we need to connect */
- for (pads = to_connect; pads; pads = g_list_next (pads)) {
- GstPad *pad = GST_PAD_CAST (pads->data);
- GstCaps *caps;
-
- /* we have more pads if we have more than 1 pad to connect or
- * dynamics. If we have only 1 pad and no dynamics, more will be
- * set to FALSE and the no-more-pads signal will be fired. Note
- * that this can change after the close_pad_link call. */
- more |= gst_decode_bin_is_dynamic (decode_bin);
-
- GST_DEBUG_OBJECT (decode_bin, "closing pad link for %s",
- GST_OBJECT_NAME (pad));
-
- /* continue autoplugging on the pads */
- caps = gst_pad_get_caps (pad);
- close_pad_link (element, pad, caps, decode_bin, more);
- if (caps)
- gst_caps_unref (caps);
-
- gst_object_unref (pad);
- }
- g_list_free (to_connect);
-}
-
-/* this is the signal handler for the typefind element have_type signal.
- * It tries to continue autoplugging on the typefind src pad */
-static void
-type_found (GstElement * typefind, guint probability, GstCaps * caps,
- GstDecodeBin * decode_bin)
-{
- gboolean dynamic;
- GstPad *pad;
-
- GST_DEBUG_OBJECT (decode_bin, "typefind found caps %" GST_PTR_FORMAT, caps);
-
- GST_OBJECT_LOCK (decode_bin);
- if (decode_bin->shutting_down)
- goto shutting_down;
- GST_OBJECT_UNLOCK (decode_bin);
-
- GST_STATE_LOCK (decode_bin);
- if (decode_bin->shutting_down)
- goto exit;
-
- /* don't need the typefind anymore if we already found a type, we're not going
- * to be able to do anything with it anyway except for generating errors */
- if (decode_bin->have_type)
- goto exit;
-
- decode_bin->have_type = TRUE;
-
- /* special-case text/plain: we only want to accept it as a raw type if it
- * comes from a subtitle parser element or a demuxer, but not if it is the
- * type of the entire stream, in which case we just want to error out */
- if (typefind == decode_bin->typefind &&
- gst_structure_has_name (gst_caps_get_structure (caps, 0), "text/plain")) {
- gst_element_no_more_pads (GST_ELEMENT (decode_bin));
- /* we can't handle this type of stream */
- GST_ELEMENT_ERROR (decode_bin, STREAM, WRONG_TYPE,
- (_("This appears to be a text file")),
- ("decodebin cannot decode plain text files"));
- goto exit;
- }
-
- /* autoplug the new pad with the caps that the signal gave us. */
- pad = gst_element_get_static_pad (typefind, "src");
- close_pad_link (typefind, pad, caps, decode_bin, FALSE);
- gst_object_unref (pad);
-
- dynamic = gst_decode_bin_is_dynamic (decode_bin);
- if (dynamic == FALSE) {
- GST_DEBUG_OBJECT (decode_bin, "we have no dynamic elements anymore");
- /* if we have no dynamic elements, we know that no new pads
- * will be created and we can signal out no_more_pads signal */
- gst_element_no_more_pads (GST_ELEMENT (decode_bin));
- } else {
- /* more dynamic elements exist that could create new pads */
- GST_DEBUG_OBJECT (decode_bin, "we have more dynamic elements");
- }
-
-exit:
- GST_STATE_UNLOCK (decode_bin);
- return;
-
-shutting_down:
- {
- GST_DEBUG_OBJECT (decode_bin, "we are shutting down");
- GST_OBJECT_UNLOCK (decode_bin);
- return;
- }
-}
-
-static void
-disconnect_unlinked_signals (GstDecodeBin * decode_bin, GstElement * element)
-{
- GstIterator *pad_it = NULL;
- gboolean done = FALSE;
-
- pad_it = gst_element_iterate_src_pads (element);
- while (!done) {
- GstPad *pad = NULL;
-
- switch (gst_iterator_next (pad_it, (gpointer) & pad)) {
- case GST_ITERATOR_OK:
- g_signal_handlers_disconnect_by_func (pad, (gpointer) unlinked,
- decode_bin);
- gst_object_unref (pad);
- break;
- case GST_ITERATOR_RESYNC:
- gst_iterator_resync (pad_it);
- break;
- default:
- done = TRUE;
- break;
- }
- }
- gst_iterator_free (pad_it);
-}
-
-
-static void
-cleanup_decodebin (GstDecodeBin * decode_bin)
-{
- GstIterator *elem_it = NULL, *gpad_it = NULL;
- GstPad *typefind_pad = NULL;
- gboolean done = FALSE;
-
- g_return_if_fail (GST_IS_DECODE_BIN (decode_bin));
-
- GST_DEBUG_OBJECT (decode_bin, "cleaning up decodebin");
-
- typefind_pad = gst_element_get_static_pad (decode_bin->typefind, "src");
- if (GST_IS_PAD (typefind_pad)) {
- g_signal_handlers_block_by_func (typefind_pad, (gpointer) unlinked,
- decode_bin);
- }
-
- elem_it = gst_bin_iterate_elements (GST_BIN (decode_bin));
- while (!done) {
- GstElement *element = NULL;
-
- switch (gst_iterator_next (elem_it, (gpointer) & element)) {
- case GST_ITERATOR_OK:
- if (element != decode_bin->typefind && element != decode_bin->fakesink) {
- GST_DEBUG_OBJECT (element, "removing autoplugged element");
- disconnect_unlinked_signals (decode_bin, element);
- gst_element_set_state (element, GST_STATE_NULL);
- gst_bin_remove (GST_BIN (decode_bin), element);
- }
- gst_object_unref (element);
- break;
- case GST_ITERATOR_RESYNC:
- gst_iterator_resync (elem_it);
- break;
- case GST_ITERATOR_ERROR:
- done = TRUE;
- break;
- case GST_ITERATOR_DONE:
- done = TRUE;
- break;
- }
- }
- gst_iterator_free (elem_it);
-
- done = FALSE;
- gpad_it = gst_element_iterate_pads (GST_ELEMENT (decode_bin));
- while (!done) {
- GstPad *pad = NULL;
-
- switch (gst_iterator_next (gpad_it, (gpointer) & pad)) {
- case GST_ITERATOR_OK:
- GST_DEBUG_OBJECT (pad, "inspecting pad %s:%s",
- GST_DEBUG_PAD_NAME (pad));
- if (GST_IS_GHOST_PAD (pad) && GST_PAD_IS_SRC (pad)) {
- GST_DEBUG_OBJECT (pad, "removing ghost pad");
- gst_element_remove_pad (GST_ELEMENT (decode_bin), pad);
- }
- gst_object_unref (pad);
- break;
- case GST_ITERATOR_RESYNC:
- gst_iterator_resync (gpad_it);
- break;
- case GST_ITERATOR_ERROR:
- done = TRUE;
- break;
- case GST_ITERATOR_DONE:
- done = TRUE;
- break;
- }
- }
- gst_iterator_free (gpad_it);
-
- if (GST_IS_PAD (typefind_pad)) {
- g_signal_handlers_unblock_by_func (typefind_pad, (gpointer) unlinked,
- decode_bin);
- g_signal_handlers_disconnect_by_func (typefind_pad, (gpointer) unlinked,
- decode_bin);
- gst_object_unref (typefind_pad);
- }
-}
-
-static GstStateChangeReturn
-gst_decode_bin_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret;
- GstDecodeBin *decode_bin;
-
- decode_bin = GST_DECODE_BIN (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- decode_bin->numpads = 0;
- decode_bin->numwaiting = 0;
- decode_bin->dynamics = NULL;
- if (decode_bin->typefind == NULL)
- goto missing_typefind;
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- GST_OBJECT_LOCK (decode_bin);
- decode_bin->shutting_down = FALSE;
- decode_bin->have_type = FALSE;
- GST_OBJECT_UNLOCK (decode_bin);
-
- if (!add_fakesink (decode_bin))
- goto missing_fakesink;
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- GST_OBJECT_LOCK (decode_bin);
- decode_bin->shutting_down = TRUE;
- GST_OBJECT_UNLOCK (decode_bin);
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- if (ret == GST_STATE_CHANGE_FAILURE)
- return ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- case GST_STATE_CHANGE_READY_TO_NULL:
- free_dynamics (decode_bin);
- free_pad_probes (decode_bin);
- cleanup_decodebin (decode_bin);
- break;
- default:
- break;
- }
-
- return ret;
-/* ERRORS */
-missing_typefind:
- {
- gst_element_post_message (element,
- gst_missing_element_message_new (element, "typefind"));
- GST_ELEMENT_ERROR (element, CORE, MISSING_PLUGIN, (NULL), ("no typefind!"));
- return GST_STATE_CHANGE_FAILURE;
- }
-missing_fakesink:
- {
- gst_element_post_message (element,
- gst_missing_element_message_new (element, "fakesink"));
- GST_ELEMENT_ERROR (element, CORE, MISSING_PLUGIN, (NULL), ("no fakesink!"));
- return GST_STATE_CHANGE_FAILURE;
- }
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (gst_decode_bin_debug, "decodebin", 0, "decoder bin");
-
-#ifdef ENABLE_NLS
- GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
- LOCALEDIR);
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif /* ENABLE_NLS */
-
- return gst_element_register (plugin, "decodebin", GST_RANK_NONE,
- GST_TYPE_DECODE_BIN);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "decodebin",
- "decoder bin", plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME,
- GST_PACKAGE_ORIGIN)
diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c
deleted file mode 100644
index d05c698d..00000000
--- a/gst/playback/gstdecodebin2.c
+++ /dev/null
@@ -1,3444 +0,0 @@
-/* GStreamer
- * Copyright (C) <2006> Edward Hervey <edward@fluendo.com>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-decodebin2
- *
- * #GstBin that auto-magically constructs a decoding pipeline using available
- * decoders and demuxers via auto-plugging.
- *
- * At this stage, decodebin2 is considered UNSTABLE. The API provided in the
- * signals is expected to change in the near future.
- *
- * To try out decodebin2, you can set the USE_DECODEBIN2 environment
- * variable (USE_DECODEBIN2=1 for example). This will cause playbin to use
- * decodebin2 instead of the older #GstDecodeBin for its internal auto-plugging.
- */
-
-/* Implementation notes:
- *
- * The following section describes how decodebin2 works internally.
- *
- * The first part of decodebin2 is it's typefind element, which tries
- * to get the type of the input stream. If the type is found autoplugging starts.
- *
- * decodebin2 internally organizes the elements it autoplugged into GstDecodeChains
- * and GstDecodeGroups. A decode chain is a single chain of decoding, this
- * means that if decodebin2 every autoplugs an element with two+ srcpads
- * (e.g. a demuxer) this will end the chain and everything following this
- * demuxer will be put into decode groups below the chain. Otherwise,
- * if an element has a single srcpad that outputs raw data the decode chain
- * is ended too and a GstDecodePad is stored and blocked.
- *
- * A decode group combines a number of chains that are created by a
- * demuxer element. All those chains are connected through a multiqueue to
- * the demuxer. A new group for the same demuxer is only created if the
- * demuxer has signaled no-more pads, in which case all following pads
- * create a new chain in the new group.
- *
- * This continues until the top-level decode chain is complete. A decode
- * chain is complete if it either ends with a blocked endpad, if autoplugging
- * stopped because no suitable plugins could be found or if the active group
- * is complete. A decode group OTOH is complete if all child chains are complete.
- *
- * If this happens at some point, all endpads of all active groups are exposed.
- * For this decodebin2 adds the endpads, signals no-more-pads and then unblocks
- * them. Now playback starts.
- *
- * If one of the chains that end on a endpad receives EOS decodebin2 checks upwards
- * via the parent pointers if all chains and groups are drained. In that case
- * everything goes into EOS.
- * If there is a chain where the active group is drained but there exist next groups
- * the active group is hidden (endpads are removed) and the next group is exposed.
- *
- * Note 1: If we're talking about blocked endpads this really means that the
- * *target* pads of the endpads are blocked. Pads that are exposed to the outside
- * should never ever be blocked!
- *
- * Note 2: If a group is complete and the parent's chain demuxer adds new pads
- * but never signaled no-more-pads this additional pads will be ignored!
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst-i18n-plugin.h>
-
-#include <string.h>
-#include <gst/gst.h>
-#include <gst/pbutils/pbutils.h>
-
-#include "gstplay-marshal.h"
-#include "gstplay-enum.h"
-#include "gstfactorylists.h"
-#include "gstrawcaps.h"
-
-/* generic templates */
-static GstStaticPadTemplate decoder_bin_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-static GstStaticPadTemplate decoder_bin_src_template =
-GST_STATIC_PAD_TEMPLATE ("src%d",
- GST_PAD_SRC,
- GST_PAD_SOMETIMES,
- GST_STATIC_CAPS_ANY);
-
-GST_DEBUG_CATEGORY_STATIC (gst_decode_bin_debug);
-#define GST_CAT_DEFAULT gst_decode_bin_debug
-
-typedef struct _GstPendingPad GstPendingPad;
-typedef struct _GstDecodeChain GstDecodeChain;
-typedef struct _GstDecodeGroup GstDecodeGroup;
-typedef struct _GstDecodePad GstDecodePad;
-typedef GstGhostPadClass GstDecodePadClass;
-typedef struct _GstDecodeBin GstDecodeBin;
-typedef struct _GstDecodeBin GstDecodeBin2;
-typedef struct _GstDecodeBinClass GstDecodeBinClass;
-
-#define GST_TYPE_DECODE_BIN (gst_decode_bin_get_type())
-#define GST_DECODE_BIN_CAST(obj) ((GstDecodeBin*)(obj))
-#define GST_DECODE_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DECODE_BIN,GstDecodeBin))
-#define GST_DECODE_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DECODE_BIN,GstDecodeBinClass))
-#define GST_IS_DECODE_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DECODE_BIN))
-#define GST_IS_DECODE_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DECODE_BIN))
-
-/**
- * GstDecodeBin2:
- *
- * The opaque #DecodeBin2 data structure
- */
-struct _GstDecodeBin
-{
- GstBin bin; /* we extend GstBin */
-
- /* properties */
- GstCaps *caps; /* caps on which to stop decoding */
- gchar *encoding; /* encoding of subtitles */
- gboolean use_buffering; /* configure buffering on multiqueues */
- gint low_percent;
- gint high_percent;
- guint max_size_bytes;
- guint max_size_buffers;
- guint64 max_size_time;
- gboolean post_stream_topology;
-
- GstElement *typefind; /* this holds the typefind object */
-
- GMutex *expose_lock; /* Protects exposal and removal of groups */
- GstDecodeChain *decode_chain; /* Top level decode chain */
- gint nbpads; /* unique identifier for source pads */
-
- GMutex *factories_lock;
- guint32 factories_cookie; /* Cookie from last time when factories was updated */
- GValueArray *factories; /* factories we can use for selecting elements */
-
- GMutex *subtitle_lock; /* Protects changes to subtitles and encoding */
- GList *subtitles; /* List of elements with subtitle-encoding,
- * protected by above mutex! */
-
- gboolean have_type; /* if we received the have_type signal */
- guint have_type_id; /* signal id for have-type from typefind */
-
- gboolean async_pending; /* async-start has been emited */
-
- GMutex *dyn_lock; /* lock protecting pad blocking */
- gboolean shutdown; /* if we are shutting down */
- GList *blocked_pads; /* pads that have set to block */
-};
-
-struct _GstDecodeBinClass
-{
- GstBinClass parent_class;
-
- /* signal we fire when a new pad has been decoded into raw audio/video */
- void (*new_decoded_pad) (GstElement * element, GstPad * pad, gboolean last);
- /* signal we fire when a pad has been removed */
- void (*removed_decoded_pad) (GstElement * element, GstPad * pad);
- /* signal fired when we found a pad that we cannot decode */
- void (*unknown_type) (GstElement * element, GstPad * pad, GstCaps * caps);
-
- /* signal fired to know if we continue trying to decode the given caps */
- gboolean (*autoplug_continue) (GstElement * element, GstPad * pad,
- GstCaps * caps);
- /* signal fired to get a list of factories to try to autoplug */
- GValueArray *(*autoplug_factories) (GstElement * element, GstPad * pad,
- GstCaps * caps);
- /* signal fired to sort the factories */
- GValueArray *(*autoplug_sort) (GstElement * element, GstPad * pad,
- GstCaps * caps, GValueArray * factories);
- /* signal fired to select from the proposed list of factories */
- GstAutoplugSelectResult (*autoplug_select) (GstElement * element,
- GstPad * pad, GstCaps * caps, GstElementFactory * factory);
-
- /* fired when the last group is drained */
- void (*drained) (GstElement * element);
-};
-
-/* signals */
-enum
-{
- SIGNAL_NEW_DECODED_PAD,
- SIGNAL_REMOVED_DECODED_PAD,
- SIGNAL_UNKNOWN_TYPE,
- SIGNAL_AUTOPLUG_CONTINUE,
- SIGNAL_AUTOPLUG_FACTORIES,
- SIGNAL_AUTOPLUG_SELECT,
- SIGNAL_AUTOPLUG_SORT,
- SIGNAL_DRAINED,
- LAST_SIGNAL
-};
-
-/* automatic sizes, while prerolling we buffer up to 2MB, we ignore time
- * and buffers in this case. */
-#define AUTO_PREROLL_SIZE_BYTES 2 * 1024 * 1024
-#define AUTO_PREROLL_SIZE_BUFFERS 0
-#define AUTO_PREROLL_SIZE_TIME 0
-
-/* whan playing, keep a max of 2MB of data but try to keep the number of buffers
- * as low as possible (try to aim for 5 buffers) */
-#define AUTO_PLAY_SIZE_BYTES 2 * 1024 * 1024
-#define AUTO_PLAY_SIZE_BUFFERS 5
-#define AUTO_PLAY_SIZE_TIME 0
-
-#define DEFAULT_SUBTITLE_ENCODING NULL
-#define DEFAULT_USE_BUFFERING FALSE
-#define DEFAULT_LOW_PERCENT 10
-#define DEFAULT_HIGH_PERCENT 99
-/* by default we use the automatic values above */
-#define DEFAULT_MAX_SIZE_BYTES 0
-#define DEFAULT_MAX_SIZE_BUFFERS 0
-#define DEFAULT_MAX_SIZE_TIME 0
-#define DEFAULT_POST_STREAM_TOPOLOGY FALSE
-
-/* Properties */
-enum
-{
- PROP_0,
- PROP_CAPS,
- PROP_SUBTITLE_ENCODING,
- PROP_SINK_CAPS,
- PROP_USE_BUFFERING,
- PROP_LOW_PERCENT,
- PROP_HIGH_PERCENT,
- PROP_MAX_SIZE_BYTES,
- PROP_MAX_SIZE_BUFFERS,
- PROP_MAX_SIZE_TIME,
- PROP_POST_STREAM_TOPOLOGY,
- PROP_LAST
-};
-
-static GstBinClass *parent_class;
-static guint gst_decode_bin_signals[LAST_SIGNAL] = { 0 };
-
-static const GstElementDetails gst_decode_bin_details =
-GST_ELEMENT_DETAILS ("Decoder Bin",
- "Generic/Bin/Decoder",
- "Autoplug and decode to raw media",
- "Edward Hervey <edward.hervey@collabora.co.uk>, "
- "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
-
-static GstStaticCaps default_raw_caps = GST_STATIC_CAPS (DEFAULT_RAW_CAPS);
-
-static void do_async_start (GstDecodeBin * dbin);
-static void do_async_done (GstDecodeBin * dbin);
-
-static void type_found (GstElement * typefind, guint probability,
- GstCaps * caps, GstDecodeBin * decode_bin);
-
-static void decodebin_set_queue_size (GstDecodeBin * dbin,
- GstElement * multiqueue, gboolean preroll);
-
-static gboolean gst_decode_bin_autoplug_continue (GstElement * element,
- GstPad * pad, GstCaps * caps);
-static GValueArray *gst_decode_bin_autoplug_factories (GstElement *
- element, GstPad * pad, GstCaps * caps);
-static GValueArray *gst_decode_bin_autoplug_sort (GstElement * element,
- GstPad * pad, GstCaps * caps, GValueArray * factories);
-static GstAutoplugSelectResult gst_decode_bin_autoplug_select (GstElement *
- element, GstPad * pad, GstCaps * caps, GstElementFactory * factory);
-
-static void gst_decode_bin_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_decode_bin_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_decode_bin_set_caps (GstDecodeBin * dbin, GstCaps * caps);
-static GstCaps *gst_decode_bin_get_caps (GstDecodeBin * dbin);
-static void caps_notify_cb (GstPad * pad, GParamSpec * unused,
- GstDecodeChain * chain);
-
-static GstPad *find_sink_pad (GstElement * element);
-static GstStateChangeReturn gst_decode_bin_change_state (GstElement * element,
- GstStateChange transition);
-
-#define EXPOSE_LOCK(dbin) G_STMT_START { \
- GST_LOG_OBJECT (dbin, \
- "expose locking from thread %p", \
- g_thread_self ()); \
- g_mutex_lock (GST_DECODE_BIN_CAST(dbin)->expose_lock); \
- GST_LOG_OBJECT (dbin, \
- "expose locked from thread %p", \
- g_thread_self ()); \
-} G_STMT_END
-
-#define EXPOSE_UNLOCK(dbin) G_STMT_START { \
- GST_LOG_OBJECT (dbin, \
- "expose unlocking from thread %p", \
- g_thread_self ()); \
- g_mutex_unlock (GST_DECODE_BIN_CAST(dbin)->expose_lock); \
-} G_STMT_END
-
-#define DYN_LOCK(dbin) G_STMT_START { \
- GST_LOG_OBJECT (dbin, \
- "dynlocking from thread %p", \
- g_thread_self ()); \
- g_mutex_lock (GST_DECODE_BIN_CAST(dbin)->dyn_lock); \
- GST_LOG_OBJECT (dbin, \
- "dynlocked from thread %p", \
- g_thread_self ()); \
-} G_STMT_END
-
-#define DYN_UNLOCK(dbin) G_STMT_START { \
- GST_LOG_OBJECT (dbin, \
- "dynunlocking from thread %p", \
- g_thread_self ()); \
- g_mutex_unlock (GST_DECODE_BIN_CAST(dbin)->dyn_lock); \
-} G_STMT_END
-
-#define SUBTITLE_LOCK(dbin) G_STMT_START { \
- GST_LOG_OBJECT (dbin, \
- "subtitle locking from thread %p", \
- g_thread_self ()); \
- g_mutex_lock (GST_DECODE_BIN_CAST(dbin)->subtitle_lock); \
- GST_LOG_OBJECT (dbin, \
- "subtitle lock from thread %p", \
- g_thread_self ()); \
-} G_STMT_END
-
-#define SUBTITLE_UNLOCK(dbin) G_STMT_START { \
- GST_LOG_OBJECT (dbin, \
- "subtitle unlocking from thread %p", \
- g_thread_self ()); \
- g_mutex_unlock (GST_DECODE_BIN_CAST(dbin)->subtitle_lock); \
-} G_STMT_END
-
-struct _GstPendingPad
-{
- GstPad *pad;
- GstDecodeChain *chain;
- gulong event_probe_id;
-};
-
-/* GstDecodeGroup
- *
- * Streams belonging to the same group/chain of a media file
- *
- * When changing something here lock the parent chain!
- */
-struct _GstDecodeGroup
-{
- GstDecodeBin *dbin;
- GstDecodeChain *parent;
-
- GstElement *multiqueue; /* Used for linking all child chains */
- gulong overrunsig; /* the overrun signal for multiqueue */
-
- gboolean overrun; /* TRUE if the multiqueue signaled overrun. This
- * means that we should really expose the group */
-
- gboolean no_more_pads; /* TRUE if the demuxer signaled no-more-pads */
- gboolean drained; /* TRUE if the all children are drained */
-
- GList *children; /* List of GstDecodeChains in this group */
-
- GList *reqpads; /* List of RequestPads for multiqueue, there is
- * exactly one RequestPad per child chain */
-};
-
-struct _GstDecodeChain
-{
- GstDecodeGroup *parent;
- GstDecodeBin *dbin;
-
- GMutex *lock; /* Protects this chain and its groups */
-
- GstPad *pad; /* srcpad that caused creation of this chain */
-
- gboolean demuxer; /* TRUE if elements->data is a demuxer */
- GList *elements; /* All elements in this group, first
- is the latest and most downstream element */
-
- /* Note: there are only groups if the last element of this chain
- * is a demuxer, otherwise the chain will end with an endpad.
- * The other way around this means, that endpad only exists if this
- * chain doesn't end with a demuxer! */
-
- GstDecodeGroup *active_group; /* Currently active group */
- GList *next_groups; /* head is newest group, tail is next group.
- a new group will be created only if the head
- group had no-more-pads. If it's only exposed
- all new pads will be ignored! */
- GList *pending_pads; /* Pads that have no fixed caps yet */
-
- GstDecodePad *endpad; /* Pad of this chain that could be exposed */
- gboolean deadend; /* This chain is incomplete and can't be completed,
- e.g. no suitable decoder could be found
- e.g. stream got EOS without buffers
- */
- GstCaps *endcaps; /* Caps that were used when linking to the endpad
- or that resulted in the deadend
- */
-
- /* FIXME: This should be done directly via a thread! */
- GList *old_groups; /* Groups that should be freed later */
-};
-
-static void gst_decode_chain_free (GstDecodeChain * chain);
-static GstDecodeChain *gst_decode_chain_new (GstDecodeBin * dbin,
- GstDecodeGroup * group, GstPad * pad);
-static void gst_decode_group_hide (GstDecodeGroup * group);
-static void gst_decode_group_free (GstDecodeGroup * group);
-static GstDecodeGroup *gst_decode_group_new (GstDecodeBin * dbin,
- GstDecodeChain * chain);
-static gboolean gst_decode_chain_is_complete (GstDecodeChain * chain);
-static void gst_decode_chain_handle_eos (GstDecodeChain * chain);
-static gboolean gst_decode_chain_expose (GstDecodeChain * chain,
- GList ** endpads, gboolean * missing_plugin);
-static gboolean gst_decode_chain_is_drained (GstDecodeChain * chain);
-static gboolean gst_decode_group_is_complete (GstDecodeGroup * group);
-static GstPad *gst_decode_group_control_demuxer_pad (GstDecodeGroup * group,
- GstPad * pad);
-static gboolean gst_decode_group_is_drained (GstDecodeGroup * group);
-
-static gboolean gst_decode_bin_expose (GstDecodeBin * dbin);
-
-#define CHAIN_MUTEX_LOCK(chain) G_STMT_START { \
- GST_LOG_OBJECT (chain->dbin, \
- "locking chain %p from thread %p", \
- chain, g_thread_self ()); \
- g_mutex_lock (chain->lock); \
- GST_LOG_OBJECT (chain->dbin, \
- "locked chain %p from thread %p", \
- chain, g_thread_self ()); \
-} G_STMT_END
-
-#define CHAIN_MUTEX_UNLOCK(chain) G_STMT_START { \
- GST_LOG_OBJECT (chain->dbin, \
- "unlocking chain %p from thread %p", \
- chain, g_thread_self ()); \
- g_mutex_unlock (chain->lock); \
-} G_STMT_END
-
-/* GstDecodePad
- *
- * GstPad private used for source pads of chains
- */
-struct _GstDecodePad
-{
- GstGhostPad parent;
- GstDecodeBin *dbin;
- GstDecodeChain *chain;
-
- gboolean blocked; /* the *target* pad is blocked */
- gboolean exposed; /* the pad is exposed */
- gboolean drained; /* an EOS has been seen on the pad */
-};
-
-G_DEFINE_TYPE (GstDecodePad, gst_decode_pad, GST_TYPE_GHOST_PAD);
-#define GST_TYPE_DECODE_PAD (gst_decode_pad_get_type ())
-#define GST_DECODE_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DECODE_PAD,GstDecodePad))
-
-static GstDecodePad *gst_decode_pad_new (GstDecodeBin * dbin, GstPad * pad,
- GstDecodeChain * chain);
-static void gst_decode_pad_activate (GstDecodePad * dpad,
- GstDecodeChain * chain);
-static void gst_decode_pad_unblock (GstDecodePad * dpad);
-static void gst_decode_pad_set_blocked (GstDecodePad * dpad, gboolean blocked);
-
-static void gst_pending_pad_free (GstPendingPad * ppad);
-static gboolean pad_event_cb (GstPad * pad, GstEvent * event, gpointer data);
-
-/********************************
- * Standard GObject boilerplate *
- ********************************/
-
-static void gst_decode_bin_class_init (GstDecodeBinClass * klass);
-static void gst_decode_bin_init (GstDecodeBin * decode_bin);
-static void gst_decode_bin_dispose (GObject * object);
-static void gst_decode_bin_finalize (GObject * object);
-
-static GType
-gst_decode_bin_get_type (void)
-{
- static GType gst_decode_bin_type = 0;
-
- if (!gst_decode_bin_type) {
- static const GTypeInfo gst_decode_bin_info = {
- sizeof (GstDecodeBinClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_decode_bin_class_init,
- NULL,
- NULL,
- sizeof (GstDecodeBin),
- 0,
- (GInstanceInitFunc) gst_decode_bin_init,
- NULL
- };
-
- gst_decode_bin_type =
- g_type_register_static (GST_TYPE_BIN, "GstDecodeBin2",
- &gst_decode_bin_info, 0);
- }
-
- return gst_decode_bin_type;
-}
-
-static gboolean
-_gst_boolean_accumulator (GSignalInvocationHint * ihint,
- GValue * return_accu, const GValue * handler_return, gpointer dummy)
-{
- gboolean myboolean;
-
- myboolean = g_value_get_boolean (handler_return);
- if (!(ihint->run_type & G_SIGNAL_RUN_CLEANUP))
- g_value_set_boolean (return_accu, myboolean);
-
- /* stop emission if FALSE */
- return myboolean;
-}
-
-/* we collect the first result */
-static gboolean
-_gst_array_accumulator (GSignalInvocationHint * ihint,
- GValue * return_accu, const GValue * handler_return, gpointer dummy)
-{
- gpointer array;
-
- array = g_value_get_boxed (handler_return);
- if (!(ihint->run_type & G_SIGNAL_RUN_CLEANUP))
- g_value_set_boxed (return_accu, array);
-
- return FALSE;
-}
-
-static gboolean
-_gst_select_accumulator (GSignalInvocationHint * ihint,
- GValue * return_accu, const GValue * handler_return, gpointer dummy)
-{
- GstAutoplugSelectResult res;
-
- res = g_value_get_enum (handler_return);
- if (!(ihint->run_type & G_SIGNAL_RUN_CLEANUP))
- g_value_set_enum (return_accu, res);
-
- return FALSE;
-}
-
-static void
-gst_decode_bin_class_init (GstDecodeBinClass * klass)
-{
- GObjectClass *gobject_klass;
- GstElementClass *gstelement_klass;
-
- gobject_klass = (GObjectClass *) klass;
- gstelement_klass = (GstElementClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_klass->dispose = gst_decode_bin_dispose;
- gobject_klass->finalize = gst_decode_bin_finalize;
- gobject_klass->set_property = gst_decode_bin_set_property;
- gobject_klass->get_property = gst_decode_bin_get_property;
-
- /**
- * GstDecodeBin2::new-decoded-pad:
- * @bin: The decodebin
- * @pad: The newly created pad
- * @islast: #TRUE if this is the last pad to be added. Deprecated.
- *
- * This signal gets emitted as soon as a new pad of the same type as one of
- * the valid 'raw' types is added.
- */
- gst_decode_bin_signals[SIGNAL_NEW_DECODED_PAD] =
- g_signal_new ("new-decoded-pad", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstDecodeBinClass, new_decoded_pad), NULL, NULL,
- gst_play_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, GST_TYPE_PAD,
- G_TYPE_BOOLEAN);
-
- /**
- * GstDecodeBin2::removed-decoded-pad:
- * @bin: The decodebin
- * @pad: The pad that was removed
- *
- * This signal is emitted when a 'final' caps pad has been removed.
- */
- gst_decode_bin_signals[SIGNAL_REMOVED_DECODED_PAD] =
- g_signal_new ("removed-decoded-pad", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstDecodeBinClass, removed_decoded_pad), NULL, NULL,
- gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_PAD);
-
- /**
- * GstDecodeBin2::unknown-type:
- * @bin: The decodebin
- * @pad: The new pad containing caps that cannot be resolved to a 'final'
- * stream type.
- * @caps: The #GstCaps of the pad that cannot be resolved.
- *
- * This signal is emitted when a pad for which there is no further possible
- * decoding is added to the decodebin.
- */
- gst_decode_bin_signals[SIGNAL_UNKNOWN_TYPE] =
- g_signal_new ("unknown-type", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDecodeBinClass, unknown_type),
- NULL, NULL, gst_marshal_VOID__OBJECT_BOXED, G_TYPE_NONE, 2,
- GST_TYPE_PAD, GST_TYPE_CAPS);
-
- /**
- * GstDecodeBin2::autoplug-continue:
- * @bin: The decodebin
- * @pad: The #GstPad.
- * @caps: The #GstCaps found.
- *
- * This signal is emitted whenever decodebin2 finds a new stream. It is
- * emitted before looking for any elements that can handle that stream.
- *
- * Returns: #TRUE if you wish decodebin2 to look for elements that can
- * handle the given @caps. If #FALSE, those caps will be considered as
- * final and the pad will be exposed as such (see 'new-decoded-pad'
- * signal).
- */
- gst_decode_bin_signals[SIGNAL_AUTOPLUG_CONTINUE] =
- g_signal_new ("autoplug-continue", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDecodeBinClass, autoplug_continue),
- _gst_boolean_accumulator, NULL, gst_play_marshal_BOOLEAN__OBJECT_BOXED,
- G_TYPE_BOOLEAN, 2, GST_TYPE_PAD, GST_TYPE_CAPS);
-
- /**
- * GstDecodeBin2::autoplug-factories:
- * @bin: The decodebin
- * @pad: The #GstPad.
- * @caps: The #GstCaps found.
- *
- * This function is emited when an array of possible factories for @caps on
- * @pad is needed. Decodebin2 will by default return an array with all
- * compatible factories, sorted by rank.
- *
- * If this function returns NULL, @pad will be exposed as a final caps.
- *
- * If this function returns an empty array, the pad will be considered as
- * having an unhandled type media type.
- *
- * Returns: a #GValueArray* with a list of factories to try. The factories are
- * by default tried in the returned order or based on the index returned by
- * "autoplug-select".
- */
- gst_decode_bin_signals[SIGNAL_AUTOPLUG_FACTORIES] =
- g_signal_new ("autoplug-factories", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDecodeBinClass,
- autoplug_factories), _gst_array_accumulator, NULL,
- gst_play_marshal_BOXED__OBJECT_BOXED, G_TYPE_VALUE_ARRAY, 2,
- GST_TYPE_PAD, GST_TYPE_CAPS);
-
- /**
- * GstDecodeBin2::autoplug-sort:
- * @bin: The decodebin
- * @pad: The #GstPad.
- * @caps: The #GstCaps.
- * @factories: A #GValueArray of possible #GstElementFactory to use.
- *
- * Once decodebin2 has found the possible #GstElementFactory objects to try
- * for @caps on @pad, this signal is emited. The purpose of the signal is for
- * the application to perform additional sorting or filtering on the element
- * factory array.
- *
- * The callee should copy and modify @factories.
- *
- * Returns: A new sorted array of #GstElementFactory objects.
- */
- gst_decode_bin_signals[SIGNAL_AUTOPLUG_SORT] =
- g_signal_new ("autoplug-sort", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDecodeBinClass, autoplug_sort),
- NULL, NULL, gst_play_marshal_BOXED__OBJECT_BOXED_BOXED,
- G_TYPE_VALUE_ARRAY, 3, GST_TYPE_PAD, GST_TYPE_CAPS, G_TYPE_VALUE_ARRAY);
-
- /**
- * GstDecodeBin2::autoplug-select:
- * @bin: The decodebin
- * @pad: The #GstPad.
- * @caps: The #GstCaps.
- * @factory: A #GstElementFactory to use
- *
- * This signal is emitted once decodebin2 has found all the possible
- * #GstElementFactory that can be used to handle the given @caps. For each of
- * those factories, this signal is emited.
- *
- * The signal handler should return a #GST_TYPE_AUTOPLUG_SELECT_RESULT enum
- * value indicating what decodebin2 should do next.
- *
- * A value of #GST_AUTOPLUG_SELECT_TRY will try to autoplug an element from
- * @factory.
- *
- * A value of #GST_AUTOPLUG_SELECT_EXPOSE will expose @pad without plugging
- * any element to it.
- *
- * A value of #GST_AUTOPLUG_SELECT_SKIP will skip @factory and move to the
- * next factory.
- *
- * Returns: a #GST_TYPE_AUTOPLUG_SELECT_RESULT that indicates the required
- * operation. the default handler will always return
- * #GST_AUTOPLUG_SELECT_TRY.
- */
- gst_decode_bin_signals[SIGNAL_AUTOPLUG_SELECT] =
- g_signal_new ("autoplug-select", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDecodeBinClass, autoplug_select),
- _gst_select_accumulator, NULL,
- gst_play_marshal_ENUM__OBJECT_BOXED_OBJECT,
- GST_TYPE_AUTOPLUG_SELECT_RESULT, 3, GST_TYPE_PAD, GST_TYPE_CAPS,
- GST_TYPE_ELEMENT_FACTORY);
-
- /**
- * GstDecodeBin2::drained
- * @bin: The decodebin
- *
- * This signal is emitted once decodebin2 has finished decoding all the data.
- *
- * Since: 0.10.16
- */
- gst_decode_bin_signals[SIGNAL_DRAINED] =
- g_signal_new ("drained", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDecodeBinClass, drained),
- NULL, NULL, gst_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
-
- g_object_class_install_property (gobject_klass, PROP_CAPS,
- g_param_spec_boxed ("caps", "Caps", "The caps on which to stop decoding.",
- GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_klass, PROP_SUBTITLE_ENCODING,
- g_param_spec_string ("subtitle-encoding", "subtitle encoding",
- "Encoding to assume if input subtitles are not in UTF-8 encoding. "
- "If not set, the GST_SUBTITLE_ENCODING environment variable will "
- "be checked for an encoding to use. If that is not set either, "
- "ISO-8859-15 will be assumed.", NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_klass, PROP_SINK_CAPS,
- g_param_spec_boxed ("sink-caps", "Sink Caps",
- "The caps of the input data. (NULL = use typefind element)",
- GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstDecodeBin2::use-buffering
- *
- * Activate buffering in decodebin2. This will instruct the multiqueues behind
- * decoders to emit BUFFERING messages.
-
- * Since: 0.10.26
- */
- g_object_class_install_property (gobject_klass, PROP_USE_BUFFERING,
- g_param_spec_boolean ("use-buffering", "Use Buffering",
- "Emit GST_MESSAGE_BUFFERING based on low-/high-percent thresholds",
- DEFAULT_USE_BUFFERING, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstDecodebin2:low-percent
- *
- * Low threshold percent for buffering to start.
- *
- * Since: 0.10.26
- */
- g_object_class_install_property (gobject_klass, PROP_LOW_PERCENT,
- g_param_spec_int ("low-percent", "Low percent",
- "Low threshold for buffering to start", 0, 100,
- DEFAULT_LOW_PERCENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstDecodebin2:high-percent
- *
- * High threshold percent for buffering to finish.
- *
- * Since: 0.10.26
- */
- g_object_class_install_property (gobject_klass, PROP_HIGH_PERCENT,
- g_param_spec_int ("high-percent", "High percent",
- "High threshold for buffering to finish", 0, 100,
- DEFAULT_HIGH_PERCENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstDecodebin2:max-size-bytes
- *
- * Max amount amount of bytes in the queue (0=automatic).
- *
- * Since: 0.10.26
- */
- g_object_class_install_property (gobject_klass, PROP_MAX_SIZE_BYTES,
- g_param_spec_uint ("max-size-bytes", "Max. size (bytes)",
- "Max. amount of bytes in the queue (0=automatic)",
- 0, G_MAXUINT, DEFAULT_MAX_SIZE_BYTES,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstDecodebin2:max-size-buffers
- *
- * Max amount amount of buffers in the queue (0=automatic).
- *
- * Since: 0.10.26
- */
- g_object_class_install_property (gobject_klass, PROP_MAX_SIZE_BUFFERS,
- g_param_spec_uint ("max-size-buffers", "Max. size (buffers)",
- "Max. number of buffers in the queue (0=automatic)",
- 0, G_MAXUINT, DEFAULT_MAX_SIZE_BUFFERS,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstDecodebin2:max-size-time
- *
- * Max amount amount of time in the queue (in ns, 0=automatic).
- *
- * Since: 0.10.26
- */
- g_object_class_install_property (gobject_klass, PROP_MAX_SIZE_TIME,
- g_param_spec_uint64 ("max-size-time", "Max. size (ns)",
- "Max. amount of data in the queue (in ns, 0=automatic)",
- 0, G_MAXUINT64,
- DEFAULT_MAX_SIZE_TIME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstDecodeBin2::post-stream-topology
- *
- * Post stream-topology messages on the bus every time the topology changes.
- *
- * Since: 0.10.26
- */
- g_object_class_install_property (gobject_klass, PROP_POST_STREAM_TOPOLOGY,
- g_param_spec_boolean ("post-stream-topology", "Post Stream Topology",
- "Post stream-topology messages",
- DEFAULT_POST_STREAM_TOPOLOGY,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-
-
- klass->autoplug_continue =
- GST_DEBUG_FUNCPTR (gst_decode_bin_autoplug_continue);
- klass->autoplug_factories =
- GST_DEBUG_FUNCPTR (gst_decode_bin_autoplug_factories);
- klass->autoplug_sort = GST_DEBUG_FUNCPTR (gst_decode_bin_autoplug_sort);
- klass->autoplug_select = GST_DEBUG_FUNCPTR (gst_decode_bin_autoplug_select);
-
- gst_element_class_add_pad_template (gstelement_klass,
- gst_static_pad_template_get (&decoder_bin_sink_template));
- gst_element_class_add_pad_template (gstelement_klass,
- gst_static_pad_template_get (&decoder_bin_src_template));
-
- gst_element_class_set_details (gstelement_klass, &gst_decode_bin_details);
-
- gstelement_klass->change_state =
- GST_DEBUG_FUNCPTR (gst_decode_bin_change_state);
-}
-
-/* Must be called with factories lock! */
-static void
-gst_decode_bin_update_factories_list (GstDecodeBin * dbin)
-{
- if (!dbin->factories
- || dbin->factories_cookie !=
- gst_default_registry_get_feature_list_cookie ()) {
- if (dbin->factories)
- g_value_array_free (dbin->factories);
- dbin->factories = gst_factory_list_get_elements (GST_FACTORY_LIST_DECODER);
- dbin->factories_cookie = gst_default_registry_get_feature_list_cookie ();
- }
-}
-
-static void
-gst_decode_bin_init (GstDecodeBin * decode_bin)
-{
- /* first filter out the interesting element factories */
- decode_bin->factories_lock = g_mutex_new ();
- gst_decode_bin_update_factories_list (decode_bin);
-
- /* we create the typefind element only once */
- decode_bin->typefind = gst_element_factory_make ("typefind", "typefind");
- if (!decode_bin->typefind) {
- g_warning ("can't find typefind element, decodebin will not work");
- } else {
- GstPad *pad;
- GstPad *gpad;
-
- /* add the typefind element */
- if (!gst_bin_add (GST_BIN (decode_bin), decode_bin->typefind)) {
- g_warning ("Could not add typefind element, decodebin will not work");
- gst_object_unref (decode_bin->typefind);
- decode_bin->typefind = NULL;
- }
-
- /* get the sinkpad */
- pad = gst_element_get_static_pad (decode_bin->typefind, "sink");
-
- /* ghost the sink pad to ourself */
- gpad = gst_ghost_pad_new ("sink", pad);
- gst_pad_set_active (gpad, TRUE);
- gst_element_add_pad (GST_ELEMENT (decode_bin), gpad);
-
- gst_object_unref (pad);
-
- /* connect a signal to find out when the typefind element found
- * a type */
- decode_bin->have_type_id =
- g_signal_connect (G_OBJECT (decode_bin->typefind), "have-type",
- G_CALLBACK (type_found), decode_bin);
- }
-
- decode_bin->expose_lock = g_mutex_new ();
- decode_bin->decode_chain = NULL;
-
- decode_bin->dyn_lock = g_mutex_new ();
- decode_bin->shutdown = FALSE;
- decode_bin->blocked_pads = NULL;
-
- decode_bin->subtitle_lock = g_mutex_new ();
-
- decode_bin->encoding = g_strdup (DEFAULT_SUBTITLE_ENCODING);
- decode_bin->caps = gst_static_caps_get (&default_raw_caps);
- decode_bin->use_buffering = DEFAULT_USE_BUFFERING;
- decode_bin->low_percent = DEFAULT_LOW_PERCENT;
- decode_bin->high_percent = DEFAULT_HIGH_PERCENT;
-
- decode_bin->max_size_bytes = DEFAULT_MAX_SIZE_BYTES;
- decode_bin->max_size_buffers = DEFAULT_MAX_SIZE_BUFFERS;
- decode_bin->max_size_time = DEFAULT_MAX_SIZE_TIME;
-}
-
-static void
-gst_decode_bin_dispose (GObject * object)
-{
- GstDecodeBin *decode_bin;
-
- decode_bin = GST_DECODE_BIN (object);
-
- if (decode_bin->factories)
- g_value_array_free (decode_bin->factories);
- decode_bin->factories = NULL;
-
- if (decode_bin->decode_chain)
- gst_decode_chain_free (decode_bin->decode_chain);
- decode_bin->decode_chain = NULL;
-
- if (decode_bin->caps)
- gst_caps_unref (decode_bin->caps);
- decode_bin->caps = NULL;
-
- g_free (decode_bin->encoding);
- decode_bin->encoding = NULL;
-
- g_list_free (decode_bin->subtitles);
- decode_bin->subtitles = NULL;
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_decode_bin_finalize (GObject * object)
-{
- GstDecodeBin *decode_bin;
-
- decode_bin = GST_DECODE_BIN (object);
-
- if (decode_bin->expose_lock) {
- g_mutex_free (decode_bin->expose_lock);
- decode_bin->expose_lock = NULL;
- }
-
- if (decode_bin->dyn_lock) {
- g_mutex_free (decode_bin->dyn_lock);
- decode_bin->dyn_lock = NULL;
- }
-
- if (decode_bin->subtitle_lock) {
- g_mutex_free (decode_bin->subtitle_lock);
- decode_bin->subtitle_lock = NULL;
- }
-
- if (decode_bin->factories_lock) {
- g_mutex_free (decode_bin->factories_lock);
- decode_bin->factories_lock = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/* _set_caps
- * Changes the caps on which decodebin will stop decoding.
- * Will unref the previously set one. The refcount of the given caps will be
- * increased.
- * @caps can be NULL.
- *
- * MT-safe
- */
-static void
-gst_decode_bin_set_caps (GstDecodeBin * dbin, GstCaps * caps)
-{
- GST_DEBUG_OBJECT (dbin, "Setting new caps: %" GST_PTR_FORMAT, caps);
-
- GST_OBJECT_LOCK (dbin);
- gst_caps_replace (&dbin->caps, caps);
- GST_OBJECT_UNLOCK (dbin);
-}
-
-/* _get_caps
- * Returns the currently configured caps on which decodebin will stop decoding.
- * The returned caps (if not NULL), will have its refcount incremented.
- *
- * MT-safe
- */
-static GstCaps *
-gst_decode_bin_get_caps (GstDecodeBin * dbin)
-{
- GstCaps *caps;
-
- GST_DEBUG_OBJECT (dbin, "Getting currently set caps");
-
- GST_OBJECT_LOCK (dbin);
- caps = dbin->caps;
- if (caps)
- gst_caps_ref (caps);
- GST_OBJECT_UNLOCK (dbin);
-
- return caps;
-}
-
-static void
-gst_decode_bin_set_sink_caps (GstDecodeBin * dbin, GstCaps * caps)
-{
- GST_DEBUG_OBJECT (dbin, "Setting new caps: %" GST_PTR_FORMAT, caps);
-
- g_object_set (dbin->typefind, "force-caps", caps, NULL);
-}
-
-static GstCaps *
-gst_decode_bin_get_sink_caps (GstDecodeBin * dbin)
-{
- GstCaps *caps;
-
- GST_DEBUG_OBJECT (dbin, "Getting currently set caps");
-
- g_object_get (dbin->typefind, "force-caps", &caps, NULL);
-
- return caps;
-}
-
-static void
-gst_decode_bin_set_subs_encoding (GstDecodeBin * dbin, const gchar * encoding)
-{
- GList *walk;
-
- GST_DEBUG_OBJECT (dbin, "Setting new encoding: %s", GST_STR_NULL (encoding));
-
- SUBTITLE_LOCK (dbin);
- g_free (dbin->encoding);
- dbin->encoding = g_strdup (encoding);
-
- /* set the subtitle encoding on all added elements */
- for (walk = dbin->subtitles; walk; walk = g_list_next (walk)) {
- g_object_set (G_OBJECT (walk->data), "subtitle-encoding", dbin->encoding,
- NULL);
- }
- SUBTITLE_UNLOCK (dbin);
-}
-
-static gchar *
-gst_decode_bin_get_subs_encoding (GstDecodeBin * dbin)
-{
- gchar *encoding;
-
- GST_DEBUG_OBJECT (dbin, "Getting currently set encoding");
-
- SUBTITLE_LOCK (dbin);
- encoding = g_strdup (dbin->encoding);
- SUBTITLE_UNLOCK (dbin);
-
- return encoding;
-}
-
-static void
-gst_decode_bin_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstDecodeBin *dbin;
-
- dbin = GST_DECODE_BIN (object);
-
- switch (prop_id) {
- case PROP_CAPS:
- gst_decode_bin_set_caps (dbin, g_value_get_boxed (value));
- break;
- case PROP_SUBTITLE_ENCODING:
- gst_decode_bin_set_subs_encoding (dbin, g_value_get_string (value));
- break;
- case PROP_SINK_CAPS:
- gst_decode_bin_set_sink_caps (dbin, g_value_get_boxed (value));
- break;
- case PROP_USE_BUFFERING:
- dbin->use_buffering = g_value_get_boolean (value);
- break;
- case PROP_LOW_PERCENT:
- dbin->low_percent = g_value_get_int (value);
- break;
- case PROP_HIGH_PERCENT:
- dbin->high_percent = g_value_get_int (value);
- break;
- case PROP_MAX_SIZE_BYTES:
- dbin->max_size_bytes = g_value_get_uint (value);
- break;
- case PROP_MAX_SIZE_BUFFERS:
- dbin->max_size_buffers = g_value_get_uint (value);
- break;
- case PROP_MAX_SIZE_TIME:
- dbin->max_size_time = g_value_get_uint64 (value);
- break;
- case PROP_POST_STREAM_TOPOLOGY:
- dbin->post_stream_topology = g_value_get_boolean (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_decode_bin_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstDecodeBin *dbin;
-
- dbin = GST_DECODE_BIN (object);
- switch (prop_id) {
- case PROP_CAPS:
- g_value_take_boxed (value, gst_decode_bin_get_caps (dbin));
- break;
- case PROP_SUBTITLE_ENCODING:
- g_value_take_string (value, gst_decode_bin_get_subs_encoding (dbin));
- break;
- case PROP_SINK_CAPS:
- g_value_take_boxed (value, gst_decode_bin_get_sink_caps (dbin));
- break;
- case PROP_USE_BUFFERING:
- g_value_set_boolean (value, dbin->use_buffering);
- break;
- case PROP_LOW_PERCENT:
- g_value_set_int (value, dbin->low_percent);
- break;
- case PROP_HIGH_PERCENT:
- g_value_set_int (value, dbin->high_percent);
- break;
- case PROP_MAX_SIZE_BYTES:
- g_value_set_uint (value, dbin->max_size_bytes);
- break;
- case PROP_MAX_SIZE_BUFFERS:
- g_value_set_uint (value, dbin->max_size_buffers);
- break;
- case PROP_MAX_SIZE_TIME:
- g_value_set_uint64 (value, dbin->max_size_time);
- break;
- case PROP_POST_STREAM_TOPOLOGY:
- g_value_set_boolean (value, dbin->post_stream_topology);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-/*****
- * Default autoplug signal handlers
- *****/
-static gboolean
-gst_decode_bin_autoplug_continue (GstElement * element, GstPad * pad,
- GstCaps * caps)
-{
- GST_DEBUG_OBJECT (element, "autoplug-continue returns TRUE");
-
- /* by default we always continue */
- return TRUE;
-}
-
-static GValueArray *
-gst_decode_bin_autoplug_factories (GstElement * element, GstPad * pad,
- GstCaps * caps)
-{
- GValueArray *result;
- GstDecodeBin *dbin = GST_DECODE_BIN_CAST (element);
-
- GST_DEBUG_OBJECT (element, "finding factories");
-
- /* return all compatible factories for caps */
- g_mutex_lock (dbin->factories_lock);
- gst_decode_bin_update_factories_list (dbin);
- result = gst_factory_list_filter (dbin->factories, caps);
- g_mutex_unlock (dbin->factories_lock);
-
- GST_DEBUG_OBJECT (element, "autoplug-factories returns %p", result);
-
- return result;
-}
-
-static GValueArray *
-gst_decode_bin_autoplug_sort (GstElement * element, GstPad * pad,
- GstCaps * caps, GValueArray * factories)
-{
- GValueArray *result;
-
- result = g_value_array_copy (factories);
-
- GST_DEBUG_OBJECT (element, "autoplug-sort returns %p", result);
-
- /* return input */
- return result;
-}
-
-static GstAutoplugSelectResult
-gst_decode_bin_autoplug_select (GstElement * element, GstPad * pad,
- GstCaps * caps, GstElementFactory * factory)
-{
- GST_DEBUG_OBJECT (element, "default autoplug-select returns TRY");
-
- /* Try factory. */
- return GST_AUTOPLUG_SELECT_TRY;
-}
-
-/********
- * Discovery methods
- *****/
-
-static gboolean are_raw_caps (GstDecodeBin * dbin, GstCaps * caps);
-static gboolean is_demuxer_element (GstElement * srcelement);
-
-static gboolean connect_pad (GstDecodeBin * dbin, GstElement * src,
- GstDecodePad * dpad, GstPad * pad, GstCaps * caps, GValueArray * factories,
- GstDecodeChain * chain);
-static gboolean connect_element (GstDecodeBin * dbin, GstElement * element,
- GstDecodeChain * chain);
-static void expose_pad (GstDecodeBin * dbin, GstElement * src,
- GstDecodePad * dpad, GstPad * pad, GstCaps * caps, GstDecodeChain * chain);
-
-static void pad_added_cb (GstElement * element, GstPad * pad,
- GstDecodeChain * chain);
-static void pad_removed_cb (GstElement * element, GstPad * pad,
- GstDecodeChain * chain);
-static void no_more_pads_cb (GstElement * element, GstDecodeChain * chain);
-
-static GstDecodeGroup *gst_decode_chain_get_current_group (GstDecodeChain *
- chain);
-
-/* called when a new pad is discovered. It will perform some basic actions
- * before trying to link something to it.
- *
- * - Check the caps, don't do anything when there are no caps or when they have
- * no good type.
- * - signal AUTOPLUG_CONTINUE to check if we need to continue autoplugging this
- * pad.
- * - if the caps are non-fixed, setup a handler to continue autoplugging when
- * the caps become fixed (connect to notify::caps).
- * - get list of factories to autoplug.
- * - continue autoplugging to one of the factories.
- */
-static void
-analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
- GstCaps * caps, GstDecodeChain * chain)
-{
- gboolean apcontinue = TRUE;
- GValueArray *factories = NULL, *result = NULL;
- GstDecodePad *dpad;
-
- GST_DEBUG_OBJECT (dbin, "Pad %s:%s caps:%" GST_PTR_FORMAT,
- GST_DEBUG_PAD_NAME (pad), caps);
-
- if (chain->elements && src != chain->elements->data) {
- GST_ERROR_OBJECT (dbin, "New pad from not the last element in this chain");
- return;
- }
-
- if (chain->endpad) {
- GST_ERROR_OBJECT (dbin, "New pad in a chain that is already complete");
- return;
- }
-
- if (chain->demuxer) {
- GstDecodeGroup *group;
- GstDecodeChain *oldchain = chain;
-
- CHAIN_MUTEX_LOCK (oldchain);
- group = gst_decode_chain_get_current_group (chain);
- if (group) {
- chain = gst_decode_chain_new (dbin, group, pad);
- group->children = g_list_prepend (group->children, chain);
- }
- CHAIN_MUTEX_UNLOCK (oldchain);
- if (!group) {
- GST_WARNING_OBJECT (dbin, "No current group");
- return;
- }
- }
-
- if ((caps == NULL) || gst_caps_is_empty (caps))
- goto unknown_type;
-
- if (gst_caps_is_any (caps))
- goto any_caps;
-
- dpad = gst_decode_pad_new (dbin, pad, chain);
-
- /* 1. Emit 'autoplug-continue' the result will tell us if this pads needs
- * further autoplugging. */
- g_signal_emit (G_OBJECT (dbin),
- gst_decode_bin_signals[SIGNAL_AUTOPLUG_CONTINUE], 0, dpad, caps,
- &apcontinue);
-
- /* 1.a if autoplug-continue is FALSE or caps is a raw format, goto pad_is_final */
- if ((!apcontinue) || are_raw_caps (dbin, caps))
- goto expose_pad;
-
- /* 1.b when the caps are not fixed yet, we can't be sure what element to
- * connect. We delay autoplugging until the caps are fixed */
- if (!gst_caps_is_fixed (caps))
- goto non_fixed;
-
- /* 1.c else get the factories and if there's no compatible factory goto
- * unknown_type */
- g_signal_emit (G_OBJECT (dbin),
- gst_decode_bin_signals[SIGNAL_AUTOPLUG_FACTORIES], 0, dpad, caps,
- &factories);
-
- /* NULL means that we can expose the pad */
- if (factories == NULL)
- goto expose_pad;
-
- /* if the array is empty, we have an unknown type */
- if (factories->n_values == 0) {
- /* no compatible factories */
- g_value_array_free (factories);
- gst_object_unref (dpad);
- goto unknown_type;
- }
-
- /* 1.d sort some more. */
- g_signal_emit (G_OBJECT (dbin),
- gst_decode_bin_signals[SIGNAL_AUTOPLUG_SORT], 0, dpad, caps, factories,
- &result);
- g_value_array_free (factories);
- factories = result;
-
- /* 1.e else continue autoplugging something from the list. */
- GST_LOG_OBJECT (pad, "Let's continue discovery on this pad");
- connect_pad (dbin, src, dpad, pad, caps, factories, chain);
-
- gst_object_unref (dpad);
- g_value_array_free (factories);
-
- return;
-
-expose_pad:
- {
- GST_LOG_OBJECT (dbin, "Pad is final. autoplug-continue:%d", apcontinue);
- expose_pad (dbin, src, dpad, pad, caps, chain);
- gst_object_unref (dpad);
- return;
- }
-unknown_type:
- {
- GST_LOG_OBJECT (pad, "Unknown type, posting message and firing signal");
-
- chain->deadend = TRUE;
- chain->endcaps = gst_caps_ref (caps);
-
- gst_element_post_message (GST_ELEMENT_CAST (dbin),
- gst_missing_decoder_message_new (GST_ELEMENT_CAST (dbin), caps));
-
- g_signal_emit (G_OBJECT (dbin),
- gst_decode_bin_signals[SIGNAL_UNKNOWN_TYPE], 0, pad, caps);
-
- /* Try to expose anything */
- EXPOSE_LOCK (dbin);
- if (gst_decode_chain_is_complete (dbin->decode_chain)) {
- gst_decode_bin_expose (dbin);
- }
- EXPOSE_UNLOCK (dbin);
- do_async_done (dbin);
-
- if (src == dbin->typefind) {
- gchar *desc;
-
- if (caps && !gst_caps_is_empty (caps)) {
- desc = gst_pb_utils_get_decoder_description (caps);
- GST_ELEMENT_ERROR (dbin, STREAM, CODEC_NOT_FOUND,
- (_("A %s plugin is required to play this stream, "
- "but not installed."), desc),
- ("No decoder to handle media type '%s'",
- gst_structure_get_name (gst_caps_get_structure (caps, 0))));
- g_free (desc);
- } else {
- GST_ELEMENT_ERROR (dbin, STREAM, TYPE_NOT_FOUND,
- (_("Could not determine type of stream")),
- ("Stream caps %" GST_PTR_FORMAT, caps));
- }
- }
- return;
- }
-non_fixed:
- {
- GST_DEBUG_OBJECT (pad, "pad has non-fixed caps delay autoplugging");
- gst_object_unref (dpad);
- goto setup_caps_delay;
- }
-any_caps:
- {
- GST_WARNING_OBJECT (pad,
- "pad has ANY caps, not able to autoplug to anything");
- goto setup_caps_delay;
- }
-setup_caps_delay:
- {
- GstPendingPad *ppad;
-
- /* connect to caps notification */
- CHAIN_MUTEX_LOCK (chain);
- GST_LOG_OBJECT (dbin, "Chain %p has now %d dynamic pads", chain,
- g_list_length (chain->pending_pads));
- ppad = g_slice_new0 (GstPendingPad);
- ppad->pad = gst_object_ref (pad);
- ppad->chain = chain;
- ppad->event_probe_id =
- gst_pad_add_event_probe (pad, (GCallback) pad_event_cb, ppad);
- chain->pending_pads = g_list_prepend (chain->pending_pads, ppad);
- CHAIN_MUTEX_UNLOCK (chain);
- g_signal_connect (G_OBJECT (pad), "notify::caps",
- G_CALLBACK (caps_notify_cb), chain);
- return;
- }
-}
-
-
-/* connect_pad:
- *
- * Try to connect the given pad to an element created from one of the factories,
- * and recursively.
- *
- * Note that dpad is ghosting pad, and so pad is linked; be sure to unset dpad's
- * target before trying to link pad.
- *
- * Returns TRUE if an element was properly created and linked
- */
-static gboolean
-connect_pad (GstDecodeBin * dbin, GstElement * src, GstDecodePad * dpad,
- GstPad * pad, GstCaps * caps, GValueArray * factories,
- GstDecodeChain * chain)
-{
- gboolean res = FALSE;
- GstPad *mqpad = NULL;
- gboolean is_demuxer = chain->parent && !chain->elements; /* First pad after the demuxer */
-
- g_return_val_if_fail (factories != NULL, FALSE);
- g_return_val_if_fail (factories->n_values > 0, FALSE);
-
- GST_DEBUG_OBJECT (dbin, "pad %s:%s , chain:%p",
- GST_DEBUG_PAD_NAME (pad), chain);
-
- /* 1. is element demuxer or parser */
- if (is_demuxer) {
- GST_LOG_OBJECT (src,
- "is a demuxer, connecting the pad through multiqueue '%s'",
- GST_OBJECT_NAME (chain->parent->multiqueue));
-
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (dpad), NULL);
- if (!(mqpad = gst_decode_group_control_demuxer_pad (chain->parent, pad)))
- goto beach;
- src = chain->parent->multiqueue;
- pad = mqpad;
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (dpad), pad);
- }
-
- /* 2. Try to create an element and link to it */
- while (factories->n_values > 0) {
- GstAutoplugSelectResult ret;
- GstElementFactory *factory;
- GstElement *element;
- GstPad *sinkpad;
- gboolean subtitle;
-
- /* Set dpad target to pad again, it might've been unset
- * below but we came back here because something failed
- */
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (dpad), pad);
-
- /* take first factory */
- factory = g_value_get_object (g_value_array_get_nth (factories, 0));
- /* Remove selected factory from the list. */
- g_value_array_remove (factories, 0);
-
- /* emit autoplug-select to see what we should do with it. */
- g_signal_emit (G_OBJECT (dbin),
- gst_decode_bin_signals[SIGNAL_AUTOPLUG_SELECT],
- 0, dpad, caps, factory, &ret);
-
- switch (ret) {
- case GST_AUTOPLUG_SELECT_TRY:
- GST_DEBUG_OBJECT (dbin, "autoplug select requested try");
- break;
- case GST_AUTOPLUG_SELECT_EXPOSE:
- GST_DEBUG_OBJECT (dbin, "autoplug select requested expose");
- /* expose the pad, we don't have the source element */
- expose_pad (dbin, src, dpad, pad, caps, chain);
- res = TRUE;
- goto beach;
- case GST_AUTOPLUG_SELECT_SKIP:
- GST_DEBUG_OBJECT (dbin, "autoplug select requested skip");
- continue;
- default:
- GST_WARNING_OBJECT (dbin, "autoplug select returned unhandled %d", ret);
- break;
- }
-
- /* 2.0. Unlink pad */
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (dpad), NULL);
-
- /* 2.1. Try to create an element */
- if ((element = gst_element_factory_create (factory, NULL)) == NULL) {
- GST_WARNING_OBJECT (dbin, "Could not create an element from %s",
- gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory)));
- continue;
- }
-
- /* ... activate it ... We do this before adding it to the bin so that we
- * don't accidentally make it post error messages that will stop
- * everything. */
- if ((gst_element_set_state (element,
- GST_STATE_READY)) == GST_STATE_CHANGE_FAILURE) {
- GST_WARNING_OBJECT (dbin, "Couldn't set %s to READY",
- GST_ELEMENT_NAME (element));
- gst_object_unref (element);
- continue;
- }
-
- /* 2.3. Find its sink pad, this should work after activating it. */
- if (!(sinkpad = find_sink_pad (element))) {
- GST_WARNING_OBJECT (dbin, "Element %s doesn't have a sink pad",
- GST_ELEMENT_NAME (element));
- gst_element_set_state (element, GST_STATE_NULL);
- gst_object_unref (element);
- continue;
- }
-
- /* 2.4 add it ... */
- if (!(gst_bin_add (GST_BIN_CAST (dbin), element))) {
- GST_WARNING_OBJECT (dbin, "Couldn't add %s to the bin",
- GST_ELEMENT_NAME (element));
- gst_object_unref (sinkpad);
- gst_element_set_state (element, GST_STATE_NULL);
- gst_object_unref (element);
- continue;
- }
-
- /* 2.5 ...and try to link */
- if ((gst_pad_link (pad, sinkpad)) != GST_PAD_LINK_OK) {
- GST_WARNING_OBJECT (dbin, "Link failed on pad %s:%s",
- GST_DEBUG_PAD_NAME (sinkpad));
- gst_element_set_state (element, GST_STATE_NULL);
- gst_object_unref (sinkpad);
- gst_bin_remove (GST_BIN (dbin), element);
- continue;
- }
- gst_object_unref (sinkpad);
- GST_LOG_OBJECT (dbin, "linked on pad %s:%s", GST_DEBUG_PAD_NAME (pad));
-
- CHAIN_MUTEX_LOCK (chain);
- chain->elements =
- g_list_prepend (chain->elements, gst_object_ref (element));
- chain->demuxer = is_demuxer_element (element);
- CHAIN_MUTEX_UNLOCK (chain);
-
- /* link this element further */
- connect_element (dbin, element, chain);
-
- /* try to configure the subtitle encoding property when we can */
- if (g_object_class_find_property (G_OBJECT_GET_CLASS (element),
- "subtitle-encoding")) {
- SUBTITLE_LOCK (dbin);
- GST_DEBUG_OBJECT (dbin,
- "setting subtitle-encoding=%s to element", dbin->encoding);
- g_object_set (G_OBJECT (element), "subtitle-encoding", dbin->encoding,
- NULL);
- SUBTITLE_UNLOCK (dbin);
- subtitle = TRUE;
- } else
- subtitle = FALSE;
-
- /* Bring the element to the state of the parent */
- if ((gst_element_set_state (element,
- GST_STATE_PAUSED)) == GST_STATE_CHANGE_FAILURE) {
- GstElement *tmp = NULL;
-
- GST_WARNING_OBJECT (dbin, "Couldn't set %s to PAUSED",
- GST_ELEMENT_NAME (element));
-
- /* Remove all elements in this chain that were just added. No
- * other thread could've added elements in the meantime */
- CHAIN_MUTEX_LOCK (chain);
- do {
- tmp = chain->elements->data;
- gst_element_set_state (tmp, GST_STATE_NULL);
- gst_bin_remove (GST_BIN (dbin), tmp);
- chain->elements = g_list_delete_link (chain->elements, chain->elements);
- } while (tmp != element);
- CHAIN_MUTEX_UNLOCK (chain);
-
- continue;
- }
- if (subtitle) {
- SUBTITLE_LOCK (dbin);
- /* we added the element now, add it to the list of subtitle-encoding
- * elements when we can set the property */
- dbin->subtitles = g_list_prepend (dbin->subtitles, element);
- SUBTITLE_UNLOCK (dbin);
- }
-
- res = TRUE;
- break;
- }
-
-beach:
- if (mqpad)
- gst_object_unref (mqpad);
-
- return res;
-}
-
-static gboolean
-connect_element (GstDecodeBin * dbin, GstElement * element,
- GstDecodeChain * chain)
-{
- GList *pads;
- gboolean res = TRUE;
- gboolean dynamic = FALSE;
- GList *to_connect = NULL;
-
- GST_DEBUG_OBJECT (dbin, "Attempting to connect element %s [chain:%p] further",
- GST_ELEMENT_NAME (element), chain);
-
- /* 1. Loop over pad templates, grabbing existing pads along the way */
- for (pads = GST_ELEMENT_GET_CLASS (element)->padtemplates; pads;
- pads = g_list_next (pads)) {
- GstPadTemplate *templ = GST_PAD_TEMPLATE (pads->data);
- const gchar *templ_name;
-
- /* we are only interested in source pads */
- if (GST_PAD_TEMPLATE_DIRECTION (templ) != GST_PAD_SRC)
- continue;
-
- templ_name = GST_PAD_TEMPLATE_NAME_TEMPLATE (templ);
- GST_DEBUG_OBJECT (dbin, "got a source pad template %s", templ_name);
-
- /* figure out what kind of pad this is */
- switch (GST_PAD_TEMPLATE_PRESENCE (templ)) {
- case GST_PAD_ALWAYS:
- {
- /* get the pad that we need to autoplug */
- GstPad *pad = gst_element_get_static_pad (element, templ_name);
-
- if (pad) {
- GST_DEBUG_OBJECT (dbin, "got the pad for always template %s",
- templ_name);
- /* here is the pad, we need to autoplug it */
- to_connect = g_list_prepend (to_connect, pad);
- } else {
- /* strange, pad is marked as always but it's not
- * there. Fix the element */
- GST_WARNING_OBJECT (dbin,
- "could not get the pad for always template %s", templ_name);
- }
- break;
- }
- case GST_PAD_SOMETIMES:
- {
- /* try to get the pad to see if it is already created or
- * not */
- GstPad *pad = gst_element_get_static_pad (element, templ_name);
-
- if (pad) {
- GST_DEBUG_OBJECT (dbin, "got the pad for sometimes template %s",
- templ_name);
- /* the pad is created, we need to autoplug it */
- to_connect = g_list_prepend (to_connect, pad);
- } else {
- GST_DEBUG_OBJECT (dbin,
- "did not get the sometimes pad of template %s", templ_name);
- /* we have an element that will create dynamic pads */
- dynamic = TRUE;
- }
- break;
- }
- case GST_PAD_REQUEST:
- /* ignore request pads */
- GST_DEBUG_OBJECT (dbin, "ignoring request padtemplate %s", templ_name);
- break;
- }
- }
-
- /* 2. if there are more potential pads, connect to relevant signals */
- if (dynamic) {
- GST_LOG_OBJECT (dbin, "Adding signals to element %s in chain %p",
- GST_ELEMENT_NAME (element), chain);
- g_signal_connect (G_OBJECT (element), "pad-added",
- G_CALLBACK (pad_added_cb), chain);
- g_signal_connect (G_OBJECT (element), "pad-removed",
- G_CALLBACK (pad_removed_cb), chain);
- g_signal_connect (G_OBJECT (element), "no-more-pads",
- G_CALLBACK (no_more_pads_cb), chain);
- }
-
- /* 3. for every available pad, connect it */
- for (pads = to_connect; pads; pads = g_list_next (pads)) {
- GstPad *pad = GST_PAD_CAST (pads->data);
- GstCaps *caps;
-
- caps = gst_pad_get_caps_reffed (pad);
- analyze_new_pad (dbin, element, pad, caps, chain);
- if (caps)
- gst_caps_unref (caps);
-
- gst_object_unref (pad);
- }
- g_list_free (to_connect);
-
- return res;
-}
-
-/* expose_pad:
- *
- * Expose the given pad on the chain as a decoded pad.
- */
-static void
-expose_pad (GstDecodeBin * dbin, GstElement * src, GstDecodePad * dpad,
- GstPad * pad, GstCaps * caps, GstDecodeChain * chain)
-{
- GstPad *mqpad = NULL;
-
- GST_DEBUG_OBJECT (dbin, "pad %s:%s, chain:%p",
- GST_DEBUG_PAD_NAME (pad), chain);
-
- /* If this is the first pad for this chain, there are no other elements
- * and the source element is not the multiqueue we must link through the
- * multiqueue.
- *
- * This is the case if a demuxer directly exposed a raw pad.
- */
- if (chain->parent && !chain->elements && src != chain->parent->multiqueue) {
- GST_LOG_OBJECT (src, "connecting the pad through multiqueue");
-
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (dpad), NULL);
- if (!(mqpad = gst_decode_group_control_demuxer_pad (chain->parent, pad)))
- goto beach;
- pad = mqpad;
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (dpad), pad);
- }
-
- gst_decode_pad_activate (dpad, chain);
- chain->endpad = gst_object_ref (dpad);
- chain->endcaps = gst_caps_ref (caps);
-
- EXPOSE_LOCK (dbin);
- if (gst_decode_chain_is_complete (dbin->decode_chain)) {
- gst_decode_bin_expose (dbin);
- }
- EXPOSE_UNLOCK (dbin);
-
- if (mqpad)
- gst_object_unref (mqpad);
-
-beach:
- return;
-}
-
-static void
-type_found (GstElement * typefind, guint probability,
- GstCaps * caps, GstDecodeBin * decode_bin)
-{
- GstPad *pad;
-
- GST_DEBUG_OBJECT (decode_bin, "typefind found caps %" GST_PTR_FORMAT, caps);
-
- /* If the typefinder (but not something else) finds text/plain - i.e. that's
- * the top-level type of the file - then error out.
- */
- if (gst_structure_has_name (gst_caps_get_structure (caps, 0), "text/plain")) {
- GST_ELEMENT_ERROR (decode_bin, STREAM, WRONG_TYPE,
- (_("This appears to be a text file")),
- ("decodebin2 cannot decode plain text files"));
- goto exit;
- }
-
- /* FIXME: we can only deal with one type, we don't yet support dynamically changing
- * caps from the typefind element */
- if (decode_bin->have_type || decode_bin->decode_chain)
- goto exit;
-
- decode_bin->have_type = TRUE;
-
- pad = gst_element_get_static_pad (typefind, "src");
-
- decode_bin->decode_chain = gst_decode_chain_new (decode_bin, NULL, pad);
- analyze_new_pad (decode_bin, typefind, pad, caps, decode_bin->decode_chain);
-
- gst_object_unref (pad);
-
-exit:
- return;
-}
-
-static gboolean
-pad_event_cb (GstPad * pad, GstEvent * event, gpointer data)
-{
- GstPendingPad *ppad = (GstPendingPad *) data;
- GstDecodeChain *chain = ppad->chain;
- GstDecodeBin *dbin = chain->dbin;
-
- g_assert (ppad);
- g_assert (chain);
- g_assert (dbin);
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_EOS:
- GST_DEBUG_OBJECT (dbin, "Received EOS on a non final pad, this stream "
- "ended too early");
- chain->deadend = TRUE;
- /* we don't set the endcaps because NULL endcaps means early EOS */
- EXPOSE_LOCK (dbin);
- if (gst_decode_chain_is_complete (dbin->decode_chain))
- gst_decode_bin_expose (dbin);
- EXPOSE_UNLOCK (dbin);
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-static void
-pad_added_cb (GstElement * element, GstPad * pad, GstDecodeChain * chain)
-{
- GstCaps *caps;
- GstDecodeBin *dbin;
-
- dbin = chain->dbin;
-
- GST_DEBUG_OBJECT (pad, "pad added, chain:%p", chain);
-
- caps = gst_pad_get_caps_reffed (pad);
- analyze_new_pad (dbin, element, pad, caps, chain);
- if (caps)
- gst_caps_unref (caps);
-
- EXPOSE_LOCK (dbin);
- if (gst_decode_chain_is_complete (dbin->decode_chain)) {
- GST_LOG_OBJECT (dbin,
- "That was the last dynamic object, now attempting to expose the group");
- if (!gst_decode_bin_expose (dbin))
- GST_WARNING_OBJECT (dbin, "Couldn't expose group");
- }
- EXPOSE_UNLOCK (dbin);
-}
-
-static void
-pad_removed_cb (GstElement * element, GstPad * pad, GstDecodeChain * chain)
-{
- GList *l;
-
- GST_LOG_OBJECT (pad, "pad removed, chain:%p", chain);
-
- /* In fact, we don't have to do anything here, the active group will be
- * removed when the group's multiqueue is drained */
- CHAIN_MUTEX_LOCK (chain);
- for (l = chain->pending_pads; l; l = l->next) {
- GstPendingPad *ppad = l->data;
- GstPad *opad = ppad->pad;
-
- if (pad == opad) {
- g_signal_handlers_disconnect_by_func (pad, caps_notify_cb, chain);
- gst_pending_pad_free (ppad);
- chain->pending_pads = g_list_delete_link (chain->pending_pads, l);
- break;
- }
- }
- CHAIN_MUTEX_UNLOCK (chain);
-}
-
-static void
-no_more_pads_cb (GstElement * element, GstDecodeChain * chain)
-{
- GstDecodeGroup *group = NULL;
-
- GST_LOG_OBJECT (element, "got no more pads");
-
- CHAIN_MUTEX_LOCK (chain);
- if (!chain->elements || (GstElement *) chain->elements->data != element) {
- GST_LOG_OBJECT (chain->dbin, "no-more-pads from old chain element '%s'",
- GST_OBJECT_NAME (element));
- CHAIN_MUTEX_UNLOCK (chain);
- return;
- } else if (!chain->demuxer) {
- GST_LOG_OBJECT (chain->dbin, "no-more-pads from a non-demuxer element '%s'",
- GST_OBJECT_NAME (element));
- CHAIN_MUTEX_UNLOCK (chain);
- return;
- }
-
- /* when we received no_more_pads, we can complete the pads of the chain */
- if (!chain->next_groups && chain->active_group) {
- group = chain->active_group;
- } else if (chain->next_groups) {
- group = chain->next_groups->data;
- }
- if (!group) {
- GST_ERROR_OBJECT (chain->dbin, "can't find group for element");
- CHAIN_MUTEX_UNLOCK (chain);
- return;
- }
-
- GST_DEBUG_OBJECT (element, "Setting group %p to complete", group);
-
- group->no_more_pads = TRUE;
- /* this group has prerolled enough to not need more pads,
- * we can probably set its buffering state to playing now */
- GST_DEBUG_OBJECT (group->dbin, "Setting group %p multiqueue to "
- "'playing' buffering mode", group);
- decodebin_set_queue_size (group->dbin, group->multiqueue, FALSE);
- CHAIN_MUTEX_UNLOCK (chain);
-
- EXPOSE_LOCK (chain->dbin);
- if (gst_decode_chain_is_complete (chain->dbin->decode_chain)) {
- gst_decode_bin_expose (chain->dbin);
- }
- EXPOSE_UNLOCK (chain->dbin);
-}
-
-static void
-caps_notify_cb (GstPad * pad, GParamSpec * unused, GstDecodeChain * chain)
-{
- GstElement *element;
- GList *l;
-
- GST_LOG_OBJECT (pad, "Notified caps for pad %s:%s", GST_DEBUG_PAD_NAME (pad));
-
- /* Disconnect this; if we still need it, we'll reconnect to this in
- * analyze_new_pad */
- g_signal_handlers_disconnect_by_func (pad, caps_notify_cb, chain);
-
- element = GST_ELEMENT_CAST (gst_pad_get_parent (pad));
-
- CHAIN_MUTEX_LOCK (chain);
- for (l = chain->pending_pads; l; l = l->next) {
- GstPendingPad *ppad = l->data;
- if (ppad->pad == pad) {
- gst_pending_pad_free (ppad);
- chain->pending_pads = g_list_delete_link (chain->pending_pads, l);
- break;
- }
- }
- CHAIN_MUTEX_UNLOCK (chain);
-
- pad_added_cb (element, pad, chain);
-
- gst_object_unref (element);
-}
-
-/* Decide whether an element is a demuxer based on the
- * klass and number/type of src pad templates it has */
-static gboolean
-is_demuxer_element (GstElement * srcelement)
-{
- GstElementFactory *srcfactory;
- GstElementClass *elemclass;
- GList *walk;
- const gchar *klass;
- gint potential_src_pads = 0;
-
- srcfactory = gst_element_get_factory (srcelement);
- klass = gst_element_factory_get_klass (srcfactory);
-
- /* Can't be a demuxer unless it has Demux in the klass name */
- if (!strstr (klass, "Demux"))
- return FALSE;
-
- /* Walk the src pad templates and count how many the element
- * might produce */
- elemclass = GST_ELEMENT_GET_CLASS (srcelement);
-
- walk = gst_element_class_get_pad_template_list (elemclass);
- while (walk != NULL) {
- GstPadTemplate *templ;
-
- templ = (GstPadTemplate *) walk->data;
- if (GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SRC) {
- switch (GST_PAD_TEMPLATE_PRESENCE (templ)) {
- case GST_PAD_ALWAYS:
- case GST_PAD_SOMETIMES:
- if (strstr (GST_PAD_TEMPLATE_NAME_TEMPLATE (templ), "%"))
- potential_src_pads += 2; /* Might make multiple pads */
- else
- potential_src_pads += 1;
- break;
- case GST_PAD_REQUEST:
- potential_src_pads += 2;
- break;
- }
- }
- walk = g_list_next (walk);
- }
-
- if (potential_src_pads < 2)
- return FALSE;
-
- return TRUE;
-}
-
-/* Returns TRUE if the caps are raw, or if they are compatible with the caps
- * specified in the 'caps' property
- *
- * The decodebin_lock should be taken !
- */
-static gboolean
-are_raw_caps (GstDecodeBin * dbin, GstCaps * caps)
-{
- gboolean res;
-
- GST_LOG_OBJECT (dbin, "Checking with caps %" GST_PTR_FORMAT, caps);
-
- /* lock for getting the caps */
- GST_OBJECT_LOCK (dbin);
- res = gst_caps_can_intersect (dbin->caps, caps);
- GST_OBJECT_UNLOCK (dbin);
-
- GST_LOG_OBJECT (dbin, "Caps are %sfinal caps", res ? "" : "not ");
-
- return res;
-}
-
-/****
- * GstDecodeChain functions
- ****/
-
-/* gst_decode_chain_get_current_group:
- *
- * Returns the current group of this chain, to which
- * new chains should be attached or NULL if the last
- * group didn't have no-more-pads.
- *
- * Not MT-safe: Call with parent chain lock!
- */
-static GstDecodeGroup *
-gst_decode_chain_get_current_group (GstDecodeChain * chain)
-{
- GstDecodeGroup *group;
-
- if (!chain->next_groups && chain->active_group
- && chain->active_group->overrun && !chain->active_group->no_more_pads) {
- GST_WARNING_OBJECT (chain->dbin,
- "Currently active group %p is exposed"
- " and wants to add a new pad without having signaled no-more-pads",
- chain->active_group);
- return NULL;
- }
-
- if (chain->next_groups && (group = chain->next_groups->data) && group->overrun
- && !group->no_more_pads) {
- GST_WARNING_OBJECT (chain->dbin,
- "Currently newest pending group %p "
- "had overflow but didn't signal no-more-pads", group);
- return NULL;
- }
-
- /* Now we know that we can really return something useful */
- if (!chain->active_group) {
- chain->active_group = group = gst_decode_group_new (chain->dbin, chain);
- } else if (!chain->active_group->overrun
- && !chain->active_group->no_more_pads) {
- group = chain->active_group;
- } else if (chain->next_groups && (group = chain->next_groups->data)
- && !group->overrun && !group->no_more_pads) {
- /* group = chain->next_groups->data */
- } else {
- group = gst_decode_group_new (chain->dbin, chain);
- chain->next_groups = g_list_prepend (chain->next_groups, group);
- }
-
- return group;
-}
-
-static void gst_decode_group_free_internal (GstDecodeGroup * group,
- gboolean hide);
-
-static void
-gst_decode_chain_free_internal (GstDecodeChain * chain, gboolean hide)
-{
- GList *l;
-
- CHAIN_MUTEX_LOCK (chain);
-
- GST_DEBUG_OBJECT (chain->dbin, "%s chain %p", (hide ? "Hiding" : "Freeing"),
- chain);
-
- if (chain->active_group) {
- gst_decode_group_free_internal (chain->active_group, hide);
- if (!hide)
- chain->active_group = NULL;
- }
-
- for (l = chain->next_groups; l; l = l->next) {
- gst_decode_group_free_internal ((GstDecodeGroup *) l->data, hide);
- if (!hide)
- l->data = NULL;
- }
- if (!hide) {
- g_list_free (chain->next_groups);
- chain->next_groups = NULL;
- }
-
- if (!hide) {
- for (l = chain->old_groups; l; l = l->next) {
- GstDecodeGroup *group = l->data;
-
- gst_decode_group_free (group);
- }
- g_list_free (chain->old_groups);
- chain->old_groups = NULL;
- }
-
- for (l = chain->pending_pads; l; l = l->next) {
- GstPendingPad *ppad = l->data;
- GstPad *pad = ppad->pad;
-
- g_signal_handlers_disconnect_by_func (pad, caps_notify_cb, chain);
- gst_pending_pad_free (ppad);
- l->data = NULL;
- }
- g_list_free (chain->pending_pads);
- chain->pending_pads = NULL;
-
- for (l = chain->elements; l; l = l->next) {
- GstElement *element = GST_ELEMENT (l->data);
-
- g_signal_handlers_disconnect_by_func (element, pad_added_cb, chain);
- g_signal_handlers_disconnect_by_func (element, pad_removed_cb, chain);
- g_signal_handlers_disconnect_by_func (element, no_more_pads_cb, chain);
-
- if (GST_OBJECT_PARENT (element) == GST_OBJECT_CAST (chain->dbin))
- gst_bin_remove (GST_BIN_CAST (chain->dbin), element);
- if (!hide) {
- gst_element_set_state (element, GST_STATE_NULL);
- }
-
- SUBTITLE_LOCK (chain->dbin);
- /* remove possible subtitle element */
- chain->dbin->subtitles = g_list_remove (chain->dbin->subtitles, element);
- SUBTITLE_UNLOCK (chain->dbin);
-
- if (!hide) {
- gst_object_unref (element);
- l->data = NULL;
- }
- }
- if (!hide) {
- g_list_free (chain->elements);
- chain->elements = NULL;
- }
-
- if (chain->endpad) {
- if (chain->endpad->exposed)
- gst_element_remove_pad (GST_ELEMENT_CAST (chain->dbin),
- GST_PAD_CAST (chain->endpad));
-
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (chain->endpad), NULL);
- chain->endpad->exposed = FALSE;
- if (!hide) {
- gst_object_unref (chain->endpad);
- chain->endpad = NULL;
- }
- }
-
- if (chain->pad) {
- gst_object_unref (chain->pad);
- chain->pad = NULL;
- }
-
- if (chain->endcaps) {
- gst_caps_unref (chain->endcaps);
- chain->endcaps = NULL;
- }
-
- GST_DEBUG_OBJECT (chain->dbin, "%s chain %p", (hide ? "Hidden" : "Freed"),
- chain);
- CHAIN_MUTEX_UNLOCK (chain);
- if (!hide) {
- g_mutex_free (chain->lock);
- g_slice_free (GstDecodeChain, chain);
- }
-}
-
-/* gst_decode_chain_free:
- *
- * Completely frees and removes the chain and all
- * child groups from decodebin2.
- *
- * MT-safe, don't hold the chain lock or any child chain's lock
- * when calling this!
- */
-static void
-gst_decode_chain_free (GstDecodeChain * chain)
-{
- gst_decode_chain_free_internal (chain, FALSE);
-}
-
-/* gst_decode_chain_new:
- *
- * Creates a new decode chain and initializes it.
- *
- * It's up to the caller to add it to the list of child chains of
- * a group!
- */
-static GstDecodeChain *
-gst_decode_chain_new (GstDecodeBin * dbin, GstDecodeGroup * parent,
- GstPad * pad)
-{
- GstDecodeChain *chain = g_slice_new0 (GstDecodeChain);
-
- GST_DEBUG_OBJECT (dbin, "Creating new chain %p with parent group %p", chain,
- parent);
-
- chain->dbin = dbin;
- chain->parent = parent;
- chain->lock = g_mutex_new ();
- chain->pad = gst_object_ref (pad);
-
- return chain;
-}
-
-/****
- * GstDecodeGroup functions
- ****/
-
-/* The overrun callback is used to expose groups that have not yet had their
- * no_more_pads called while the (large) multiqueue overflowed. When this
- * happens we must assume that the no_more_pads will not arrive anymore and we
- * must expose the pads that we have.
- */
-static void
-multi_queue_overrun_cb (GstElement * queue, GstDecodeGroup * group)
-{
- GstDecodeBin *dbin;
-
- dbin = group->dbin;
-
- GST_LOG_OBJECT (dbin, "multiqueue '%s' (%p) is full", GST_OBJECT_NAME (queue),
- queue);
-
- group->overrun = TRUE;
-
- /* FIXME: We should make sure that everything gets exposed now
- * even if child chains are not complete because the will never
- * be complete! Ignore any non-complete chains when exposing
- * and never expose them later
- */
-
- EXPOSE_LOCK (dbin);
- if (gst_decode_chain_is_complete (dbin->decode_chain)) {
- if (!gst_decode_bin_expose (dbin))
- GST_WARNING_OBJECT (dbin, "Couldn't expose group");
- }
- EXPOSE_UNLOCK (group->dbin);
-}
-
-static void
-gst_decode_group_free_internal (GstDecodeGroup * group, gboolean hide)
-{
- GList *l;
-
- GST_DEBUG_OBJECT (group->dbin, "%s group %p", (hide ? "Hiding" : "Freeing"),
- group);
- for (l = group->children; l; l = l->next) {
- GstDecodeChain *chain = (GstDecodeChain *) l->data;
-
- gst_decode_chain_free_internal (chain, hide);
- if (!hide)
- l->data = NULL;
- }
- if (!hide) {
- g_list_free (group->children);
- group->children = NULL;
- }
-
- if (!hide) {
- for (l = group->reqpads; l; l = l->next) {
- GstPad *pad = l->data;
-
- gst_element_release_request_pad (group->multiqueue, pad);
- gst_object_unref (pad);
- l->data = NULL;
- }
- g_list_free (group->reqpads);
- group->reqpads = NULL;
- }
-
- if (group->multiqueue) {
- if (group->overrunsig) {
- g_signal_handler_disconnect (group->multiqueue, group->overrunsig);
- group->overrunsig = 0;
- }
-
- if (GST_OBJECT_PARENT (group->multiqueue) == GST_OBJECT_CAST (group->dbin))
- gst_bin_remove (GST_BIN_CAST (group->dbin), group->multiqueue);
- if (!hide) {
- gst_element_set_state (group->multiqueue, GST_STATE_NULL);
- gst_object_unref (group->multiqueue);
- group->multiqueue = NULL;
- }
- }
-
- GST_DEBUG_OBJECT (group->dbin, "%s group %p", (hide ? "Hided" : "Freed"),
- group);
- if (!hide)
- g_slice_free (GstDecodeGroup, group);
-}
-
-/* gst_decode_group_free:
- *
- * Completely frees and removes the decode group and all
- * it's children.
- *
- * Never call this from any streaming thread!
- *
- * Not MT-safe, call with parent's chain lock!
- */
-static void
-gst_decode_group_free (GstDecodeGroup * group)
-{
- gst_decode_group_free_internal (group, FALSE);
-}
-
-/* gst_decode_group_hide:
- *
- * Hide the decode group only, this means that
- * all child endpads are removed from decodebin2
- * and all signals are unconnected.
- *
- * No element is set to NULL state and completely
- * unrefed here.
- *
- * Can be called from streaming threads.
- *
- * Not MT-safe, call with parent's chain lock!
- */
-static void
-gst_decode_group_hide (GstDecodeGroup * group)
-{
- gst_decode_group_free_internal (group, TRUE);
-}
-
-/* configure queue sizes, this depends on the buffering method and if we are
- * playing or prerolling. */
-static void
-decodebin_set_queue_size (GstDecodeBin * dbin, GstElement * multiqueue,
- gboolean preroll)
-{
- guint max_bytes, max_buffers;
- guint64 max_time;
-
- if (preroll || dbin->use_buffering) {
- /* takes queue limits, initially we only queue up up to the max bytes limit,
- * with a default of 2MB. we use the same values for buffering mode. */
- if ((max_bytes = dbin->max_size_bytes) == 0)
- max_bytes = AUTO_PREROLL_SIZE_BYTES;
- if ((max_buffers = dbin->max_size_buffers) == 0)
- max_buffers = AUTO_PREROLL_SIZE_BUFFERS;
- if ((max_time = dbin->max_size_time) == 0)
- max_time = AUTO_PREROLL_SIZE_TIME;
- } else {
- /* update runtime limits. At runtime, we try to keep the amount of buffers
- * in the queues as low as possible (but at least 5 buffers). */
- if ((max_bytes = dbin->max_size_bytes) == 0)
- max_bytes = AUTO_PLAY_SIZE_BYTES;
- if ((max_buffers = dbin->max_size_buffers) == 0)
- max_buffers = AUTO_PLAY_SIZE_BUFFERS;
- if ((max_time = dbin->max_size_time) == 0)
- max_time = AUTO_PLAY_SIZE_TIME;
- }
-
- g_object_set (multiqueue,
- "max-size-bytes", max_bytes, "max-size-time", max_time,
- "max-size-buffers", max_buffers, NULL);
-}
-
-/* gst_decode_group_new:
- * @dbin: Parent decodebin
- * @parent: Parent chain or %NULL
- *
- * Creates a new GstDecodeGroup. It is up to the caller to add it to the list
- * of groups.
- */
-static GstDecodeGroup *
-gst_decode_group_new (GstDecodeBin * dbin, GstDecodeChain * parent)
-{
- GstDecodeGroup *group = g_slice_new0 (GstDecodeGroup);
- GstElement *mq;
-
- GST_DEBUG_OBJECT (dbin, "Creating new group %p with parent chain %p", group,
- parent);
-
- group->dbin = dbin;
- group->parent = parent;
-
- mq = group->multiqueue = gst_element_factory_make ("multiqueue", NULL);
- if (G_UNLIKELY (!group->multiqueue))
- goto missing_multiqueue;
-
- g_object_set (mq, "use-buffering", dbin->use_buffering, NULL);
- if (dbin->use_buffering) {
- g_object_set (mq, "low-percent", dbin->low_percent, NULL);
- g_object_set (mq, "high-percent", dbin->high_percent, NULL);
- }
-
- /* configure queue sizes for preroll */
- decodebin_set_queue_size (dbin, mq, TRUE);
-
- group->overrunsig = g_signal_connect (G_OBJECT (mq), "overrun",
- G_CALLBACK (multi_queue_overrun_cb), group);
-
- gst_bin_add (GST_BIN (dbin), gst_object_ref (mq));
- gst_element_set_state (mq, GST_STATE_PAUSED);
-
- return group;
-
- /* ERRORS */
-missing_multiqueue:
- {
- gst_element_post_message (GST_ELEMENT_CAST (dbin),
- gst_missing_element_message_new (GST_ELEMENT_CAST (dbin),
- "multiqueue"));
- GST_ELEMENT_ERROR (dbin, CORE, MISSING_PLUGIN, (NULL), ("no multiqueue!"));
- g_slice_free (GstDecodeGroup, group);
- return NULL;
- }
-}
-
-/* gst_decode_group_control_demuxer_pad
- *
- * Adds a new demuxer srcpad to the given group.
- *
- * Returns the srcpad of the multiqueue corresponding the given pad.
- * Returns NULL if there was an error.
- */
-static GstPad *
-gst_decode_group_control_demuxer_pad (GstDecodeGroup * group, GstPad * pad)
-{
- GstDecodeBin *dbin;
- GstPad *srcpad, *sinkpad;
- GstIterator *it = NULL;
-
- dbin = group->dbin;
-
- GST_LOG_OBJECT (dbin, "group:%p pad %s:%s", group, GST_DEBUG_PAD_NAME (pad));
-
- srcpad = NULL;
-
- if (G_UNLIKELY (!group->multiqueue))
- return NULL;
-
- if (!(sinkpad = gst_element_get_request_pad (group->multiqueue, "sink%d"))) {
- GST_ERROR_OBJECT (dbin, "Couldn't get sinkpad from multiqueue");
- return NULL;
- }
-
- if ((gst_pad_link (pad, sinkpad) != GST_PAD_LINK_OK)) {
- GST_ERROR_OBJECT (dbin, "Couldn't link demuxer and multiqueue");
- goto error;
- }
-
- it = gst_pad_iterate_internal_links (sinkpad);
-
- if (!it || (gst_iterator_next (it, (gpointer) & srcpad)) != GST_ITERATOR_OK
- || srcpad == NULL) {
- GST_ERROR_OBJECT (dbin,
- "Couldn't get srcpad from multiqueue for sinkpad %" GST_PTR_FORMAT,
- sinkpad);
- goto error;
- }
-
- CHAIN_MUTEX_LOCK (group->parent);
- group->reqpads = g_list_prepend (group->reqpads, gst_object_ref (sinkpad));
- CHAIN_MUTEX_UNLOCK (group->parent);
-
-beach:
- if (it)
- gst_iterator_free (it);
- gst_object_unref (sinkpad);
- return srcpad;
-
-error:
- gst_element_release_request_pad (group->multiqueue, sinkpad);
- goto beach;
-}
-
-/* gst_decode_group_is_complete:
- *
- * Checks if the group is complete, this means that
- * a) overrun of the multiqueue or no-more-pads happened
- * b) all child chains are complete
- *
- * Not MT-safe, always call with decodebin expose lock
- */
-static gboolean
-gst_decode_group_is_complete (GstDecodeGroup * group)
-{
- GList *l;
- gboolean complete = TRUE;
-
- if (!group->overrun && !group->no_more_pads) {
- complete = FALSE;
- goto out;
- }
-
- for (l = group->children; l; l = l->next) {
- GstDecodeChain *chain = l->data;
-
- if (!gst_decode_chain_is_complete (chain)) {
- complete = FALSE;
- goto out;
- }
- }
-
-out:
- GST_DEBUG_OBJECT (group->dbin, "Group %p is complete: %d", group, complete);
- return complete;
-}
-
-/* gst_decode_chain_is_complete:
- *
- * Returns TRUE if the chain is complete, this means either
- * a) This chain is a dead end, i.e. we have no suitable plugins
- * b) This chain ends in an endpad and this is blocked or exposed
- *
- * Not MT-safe, always call with decodebin expose lock
- */
-static gboolean
-gst_decode_chain_is_complete (GstDecodeChain * chain)
-{
- gboolean complete = FALSE;
-
- CHAIN_MUTEX_LOCK (chain);
- if (chain->deadend) {
- complete = TRUE;
- goto out;
- }
-
- if (chain->endpad && (chain->endpad->blocked || chain->endpad->exposed)) {
- complete = TRUE;
- goto out;
- }
-
- if (chain->demuxer) {
- if (chain->active_group
- && gst_decode_group_is_complete (chain->active_group)) {
- complete = TRUE;
- goto out;
- }
- }
-
-out:
- CHAIN_MUTEX_UNLOCK (chain);
- GST_DEBUG_OBJECT (chain->dbin, "Chain %p is complete: %d", chain, complete);
- return complete;
-}
-
-/* check if the group is drained, meaning all pads have seen an EOS
- * event. */
-static void
-gst_decode_pad_handle_eos (GstDecodePad * pad)
-{
- GstDecodeChain *chain = pad->chain;
-
- GST_LOG_OBJECT (pad->dbin, "chain : %p, pad %p", chain, pad);
- pad->drained = TRUE;
- gst_decode_chain_handle_eos (chain);
-}
-
-/* gst_decode_chain_handle_eos:
- *
- * Checks if there are next groups in any parent chain
- * to which we can switch or if everything is drained.
- *
- * If there are groups to switch to, hide the current active
- * one and expose the new one.
- *
- * MT-safe, don't call with chain lock!
- */
-static void
-gst_decode_chain_handle_eos (GstDecodeChain * eos_chain)
-{
- GstDecodeBin *dbin = eos_chain->dbin;
- GstDecodeGroup *group = eos_chain->parent;
- GstDecodeChain *chain = eos_chain;
- gboolean drained;
-
- g_return_if_fail (eos_chain->endpad);
-
- CHAIN_MUTEX_LOCK (chain);
- while ((group = chain->parent)) {
- CHAIN_MUTEX_UNLOCK (chain);
- chain = group->parent;
- CHAIN_MUTEX_LOCK (chain);
-
- if (gst_decode_group_is_drained (group)) {
- continue;
- }
- break;
- }
-
- drained = chain->active_group ?
- gst_decode_group_is_drained (chain->active_group) : TRUE;
-
- /* Now either group == NULL and chain == dbin->decode_chain
- * or chain is the lowest chain that has a non-drained group */
- if (chain->active_group && drained && chain->next_groups) {
- GST_DEBUG_OBJECT (dbin, "Hiding current group %p", chain->active_group);
- gst_decode_group_hide (chain->active_group);
- chain->old_groups = g_list_prepend (chain->old_groups, chain->active_group);
- GST_DEBUG_OBJECT (dbin, "Switching to next group %p",
- chain->next_groups->data);
- chain->active_group = chain->next_groups->data;
- chain->next_groups =
- g_list_delete_link (chain->next_groups, chain->next_groups);
- CHAIN_MUTEX_UNLOCK (chain);
- EXPOSE_LOCK (dbin);
- if (gst_decode_chain_is_complete (dbin->decode_chain))
- gst_decode_bin_expose (dbin);
- EXPOSE_UNLOCK (dbin);
- } else if (!chain->active_group || drained) {
- g_assert (chain == dbin->decode_chain);
- CHAIN_MUTEX_UNLOCK (chain);
-
- GST_LOG_OBJECT (dbin, "all groups drained, fire signal");
- g_signal_emit (G_OBJECT (dbin), gst_decode_bin_signals[SIGNAL_DRAINED], 0,
- NULL);
- } else {
- CHAIN_MUTEX_UNLOCK (chain);
- GST_DEBUG_OBJECT (dbin,
- "Current active group in chain %p is not drained yet", chain);
- }
-}
-
-/* gst_decode_group_is_drained:
- *
- * Check is this group is drained and cache this result.
- * The group is drained if all child chains are drained.
- *
- * Not MT-safe, call with group->parent's lock */
-static gboolean
-gst_decode_group_is_drained (GstDecodeGroup * group)
-{
- GList *l;
- gboolean drained = TRUE;
-
- if (group->drained) {
- drained = TRUE;
- goto out;
- }
-
- for (l = group->children; l; l = l->next) {
- GstDecodeChain *chain = l->data;
-
- CHAIN_MUTEX_LOCK (chain);
- if (!gst_decode_chain_is_drained (chain))
- drained = FALSE;
- CHAIN_MUTEX_UNLOCK (chain);
- if (!drained)
- goto out;
- }
- group->drained = drained;
-
-out:
- GST_DEBUG_OBJECT (group->dbin, "Group %p is drained: %d", group, drained);
- return drained;
-}
-
-/* gst_decode_chain_is_drained:
- *
- * Check is the chain is drained, which means that
- * either
- *
- * a) it's endpad is drained
- * b) there are no pending pads, the active group is drained
- * and there are no next groups
- *
- * Not MT-safe, call with chain lock
- */
-static gboolean
-gst_decode_chain_is_drained (GstDecodeChain * chain)
-{
- gboolean drained = FALSE;
-
- if (chain->endpad) {
- drained = chain->endpad->drained;
- goto out;
- }
-
- if (chain->pending_pads) {
- drained = FALSE;
- goto out;
- }
-
- if (chain->active_group && gst_decode_group_is_drained (chain->active_group)
- && !chain->next_groups) {
- drained = TRUE;
- goto out;
- }
-
-out:
- GST_DEBUG_OBJECT (chain->dbin, "Chain %p is drained: %d", chain, drained);
- return drained;
-}
-
-/* sort_end_pads:
- * GCompareFunc to use with lists of GstPad.
- * Sorts pads by mime type.
- * First video (raw, then non-raw), then audio (raw, then non-raw),
- * then others.
- *
- * Return: negative if a<b, 0 if a==b, positive if a>b
- */
-static gint
-sort_end_pads (GstDecodePad * da, GstDecodePad * db)
-{
- gint va, vb;
- GstCaps *capsa, *capsb;
- GstStructure *sa, *sb;
- const gchar *namea, *nameb;
-
- capsa = gst_pad_get_caps_reffed (GST_PAD_CAST (da));
- capsb = gst_pad_get_caps_reffed (GST_PAD_CAST (db));
-
- sa = gst_caps_get_structure ((const GstCaps *) capsa, 0);
- sb = gst_caps_get_structure ((const GstCaps *) capsb, 0);
-
- namea = gst_structure_get_name (sa);
- nameb = gst_structure_get_name (sb);
-
- if (g_strrstr (namea, "video/x-raw-"))
- va = 0;
- else if (g_strrstr (namea, "video/"))
- va = 1;
- else if (g_strrstr (namea, "audio/x-raw"))
- va = 2;
- else if (g_strrstr (namea, "audio/"))
- va = 3;
- else
- va = 4;
-
- if (g_strrstr (nameb, "video/x-raw-"))
- vb = 0;
- else if (g_strrstr (nameb, "video/"))
- vb = 1;
- else if (g_strrstr (nameb, "audio/x-raw"))
- vb = 2;
- else if (g_strrstr (nameb, "audio/"))
- vb = 3;
- else
- vb = 4;
-
- gst_caps_unref (capsa);
- gst_caps_unref (capsb);
-
- return va - vb;
-}
-
-static GstCaps *
-_gst_element_get_linked_caps (GstElement * src, GstElement * sink)
-{
- GstIterator *it;
- GstElement *parent;
- GstPad *pad, *peer;
- gboolean done = FALSE;
- GstCaps *caps = NULL;
-
- it = gst_element_iterate_src_pads (src);
- while (!done) {
- switch (gst_iterator_next (it, (gpointer) & pad)) {
- case GST_ITERATOR_OK:
- peer = gst_pad_get_peer (pad);
- if (peer) {
- parent = gst_pad_get_parent_element (peer);
- if (parent == sink) {
- caps = gst_pad_get_negotiated_caps (pad);
- done = TRUE;
- }
-
- if (parent)
- gst_object_unref (parent);
- gst_object_unref (peer);
- }
- gst_object_unref (pad);
- break;
- case GST_ITERATOR_RESYNC:
- gst_iterator_resync (it);
- break;
- case GST_ITERATOR_ERROR:
- case GST_ITERATOR_DONE:
- done = TRUE;
- break;
- }
- }
-
- gst_iterator_free (it);
-
- return caps;
-}
-
-static GQuark topology_structure_name = 0;
-static GQuark topology_caps = 0;
-static GQuark topology_next = 0;
-static GQuark topology_pad = 0;
-
-/* FIXME: Invent gst_structure_take_structure() to prevent all the
- * structure copying for nothing
- */
-static GstStructure *
-gst_decode_chain_get_topology (GstDecodeChain * chain)
-{
- GstStructure *s, *u;
- GList *l;
- GstCaps *caps;
-
- u = gst_structure_id_empty_new (topology_structure_name);
-
- /* Now at the last element */
- if (chain->elements && (chain->endpad || chain->deadend)) {
- s = gst_structure_id_empty_new (topology_structure_name);
- gst_structure_id_set (u, topology_caps, GST_TYPE_CAPS, chain->endcaps,
- NULL);
-
- if (chain->endpad)
- gst_structure_id_set (u, topology_pad, GST_TYPE_PAD, chain->endpad, NULL);
- gst_structure_id_set (s, topology_next, GST_TYPE_STRUCTURE, u, NULL);
- gst_structure_free (u);
- u = s;
- } else if (chain->active_group) {
- GValue list = { 0, };
- GValue item = { 0, };
-
- g_value_init (&list, GST_TYPE_LIST);
- g_value_init (&item, GST_TYPE_STRUCTURE);
- for (l = chain->active_group->children; l; l = l->next) {
- s = gst_decode_chain_get_topology (l->data);
- gst_value_set_structure (&item, s);
- gst_value_list_append_value (&list, &item);
- g_value_reset (&item);
- gst_structure_free (s);
- }
- gst_structure_id_set_value (u, topology_next, &list);
- g_value_unset (&list);
- g_value_unset (&item);
- }
-
- /* Get caps between all elements in this chain */
- l = (chain->elements && chain->elements->next) ? chain->elements : NULL;
- for (; l && l->next; l = l->next) {
- GstCaps *caps = _gst_element_get_linked_caps (l->next->data, l->data);
-
- s = gst_structure_id_empty_new (topology_structure_name);
- gst_structure_id_set (u, topology_caps, GST_TYPE_CAPS, caps, NULL);
- gst_caps_unref (caps);
-
- gst_structure_id_set (s, topology_next, GST_TYPE_STRUCTURE, u, NULL);
- gst_structure_free (u);
- u = s;
- }
-
- /* Caps that resulted in this chain */
- caps = gst_pad_get_negotiated_caps (chain->pad);
- if (!caps) {
- caps = gst_pad_get_caps_reffed (chain->pad);
- if (G_UNLIKELY (!gst_caps_is_fixed (caps))) {
- GST_ERROR_OBJECT (chain->pad,
- "Couldn't get fixed caps, got %" GST_PTR_FORMAT, caps);
- gst_caps_unref (caps);
- caps = NULL;
- }
- }
- gst_structure_set (u, "caps", GST_TYPE_CAPS, caps, NULL);
- gst_caps_unref (caps);
-
- return u;
-}
-
-static void
-gst_decode_bin_post_topology_message (GstDecodeBin * dbin)
-{
- GstStructure *s;
- GstMessage *msg;
-
- s = gst_decode_chain_get_topology (dbin->decode_chain);
-
- msg = gst_message_new_element (GST_OBJECT (dbin), s);
- gst_element_post_message (GST_ELEMENT (dbin), msg);
-}
-
-/* Must only be called if the toplevel chain is complete and blocked! */
-/* Not MT-safe, call with decodebin expose lock! */
-static gboolean
-gst_decode_bin_expose (GstDecodeBin * dbin)
-{
- GList *tmp, *endpads = NULL;
- gboolean missing_plugin = FALSE;
- gboolean already_exposed = TRUE;
-
- GST_DEBUG_OBJECT (dbin, "Exposing currently active chains/groups");
-
- /* Don't expose if we're currently shutting down */
- DYN_LOCK (dbin);
- if (G_UNLIKELY (dbin->shutdown == TRUE)) {
- GST_WARNING_OBJECT (dbin, "Currently, shutting down, aborting exposing");
- DYN_UNLOCK (dbin);
- return FALSE;
- }
- DYN_UNLOCK (dbin);
-
- /* Get the pads that we're going to expose and mark things as exposed */
- if (!gst_decode_chain_expose (dbin->decode_chain, &endpads, &missing_plugin)) {
- g_list_foreach (endpads, (GFunc) gst_object_unref, NULL);
- g_list_free (endpads);
- GST_ERROR_OBJECT (dbin, "Broken chain/group tree");
- g_return_val_if_reached (FALSE);
- return FALSE;
- }
- if (endpads == NULL) {
- if (missing_plugin) {
- GST_WARNING_OBJECT (dbin, "No suitable plugins found");
- GST_ELEMENT_ERROR (dbin, CORE, MISSING_PLUGIN, (NULL),
- ("no suitable plugins found"));
- } else {
- /* in this case, the stream ended without buffers,
- * just post a warning */
- GST_WARNING_OBJECT (dbin, "All streams finished without buffers");
- GST_ELEMENT_ERROR (dbin, STREAM, FAILED, (NULL),
- ("all streams without buffers"));
- }
- return FALSE;
- }
-
- /* Check if this was called when everything was exposed already */
- for (tmp = endpads; tmp && already_exposed; tmp = tmp->next) {
- GstDecodePad *dpad = tmp->data;
-
- already_exposed &= dpad->exposed;
- if (!already_exposed)
- break;
- }
- if (already_exposed) {
- GST_DEBUG_OBJECT (dbin, "Everything was exposed already!");
- g_list_foreach (endpads, (GFunc) gst_object_unref, NULL);
- g_list_free (endpads);
- return TRUE;
- }
-
- /* Set all already exposed pads to blocked */
- for (tmp = endpads; tmp; tmp = tmp->next) {
- GstDecodePad *dpad = tmp->data;
-
- if (dpad->exposed) {
- GST_DEBUG_OBJECT (dpad, "blocking exposed pad");
- gst_decode_pad_set_blocked (dpad, TRUE);
- }
- }
-
- /* re-order pads : video, then audio, then others */
- endpads = g_list_sort (endpads, (GCompareFunc) sort_end_pads);
-
- /* Expose pads */
- for (tmp = endpads; tmp; tmp = tmp->next) {
- GstDecodePad *dpad = (GstDecodePad *) tmp->data;
- gchar *padname;
-
- /* 1. rewrite name */
- padname = g_strdup_printf ("src%d", dbin->nbpads);
- dbin->nbpads++;
- GST_DEBUG_OBJECT (dbin, "About to expose dpad %s as %s",
- GST_OBJECT_NAME (dpad), padname);
- gst_object_set_name (GST_OBJECT (dpad), padname);
- g_free (padname);
-
- /* 2. activate and add */
- if (!dpad->exposed
- && !gst_element_add_pad (GST_ELEMENT (dbin), GST_PAD_CAST (dpad))) {
- /* not really fatal, we can try to add the other pads */
- g_warning ("error adding pad to decodebin2");
- continue;
- }
- dpad->exposed = TRUE;
-
- /* 3. emit signal */
- GST_DEBUG_OBJECT (dbin, "emitting new-decoded-pad");
- g_signal_emit (G_OBJECT (dbin),
- gst_decode_bin_signals[SIGNAL_NEW_DECODED_PAD], 0, dpad,
- (tmp->next == NULL));
- GST_DEBUG_OBJECT (dbin, "emitted new-decoded-pad");
- }
-
- /* 4. Signal no-more-pads. This allows the application to hook stuff to the
- * exposed pads */
- GST_LOG_OBJECT (dbin, "signalling no-more-pads");
- gst_element_no_more_pads (GST_ELEMENT (dbin));
-
- /* 5. Send a custom element message with the stream topology */
- if (dbin->post_stream_topology)
- gst_decode_bin_post_topology_message (dbin);
-
- /* 6. Unblock internal pads. The application should have connected stuff now
- * so that streaming can continue. */
- for (tmp = endpads; tmp; tmp = tmp->next) {
- GstDecodePad *dpad = (GstDecodePad *) tmp->data;
-
- GST_DEBUG_OBJECT (dpad, "unblocking");
- gst_decode_pad_unblock (dpad);
- GST_DEBUG_OBJECT (dpad, "unblocked");
- gst_object_unref (dpad);
- }
- g_list_free (endpads);
-
- do_async_done (dbin);
- GST_DEBUG_OBJECT (dbin, "Exposed everything");
- return TRUE;
-}
-
-/* gst_decode_chain_expose:
- *
- * Check if the chain can be exposed and add all endpads
- * to the endpads list.
- *
- * Also update the active group's multiqueue to the
- * runtime limits.
- *
- * Not MT-safe, call with decodebin expose lock! *
- */
-static gboolean
-gst_decode_chain_expose (GstDecodeChain * chain, GList ** endpads,
- gboolean * missing_plugin)
-{
- GstDecodeGroup *group;
- GList *l;
- GstDecodeBin *dbin;
-
- if (chain->deadend) {
- if (chain->endcaps)
- *missing_plugin = TRUE;
- return TRUE;
- }
-
- if (chain->endpad) {
- if (!chain->endpad->blocked && !chain->endpad->exposed)
- return FALSE;
- *endpads = g_list_prepend (*endpads, gst_object_ref (chain->endpad));
- return TRUE;
- }
-
- group = chain->active_group;
- if (!group)
- return FALSE;
- if (!group->no_more_pads && !group->overrun)
- return FALSE;
-
- dbin = group->dbin;
-
- /* configure queues for playback */
- decodebin_set_queue_size (dbin, group->multiqueue, FALSE);
-
- /* we can now disconnect any overrun signal, which is used to expose the
- * group. */
- if (group->overrunsig) {
- GST_LOG_OBJECT (dbin, "Disconnecting overrun");
- g_signal_handler_disconnect (group->multiqueue, group->overrunsig);
- group->overrunsig = 0;
- }
-
- for (l = group->children; l; l = l->next) {
- GstDecodeChain *childchain = l->data;
-
- if (!gst_decode_chain_expose (childchain, endpads, missing_plugin))
- return FALSE;
- }
-
- return TRUE;
-}
-
-/*************************
- * GstDecodePad functions
- *************************/
-
-static void
-gst_decode_pad_class_init (GstDecodePadClass * klass)
-{
-}
-
-static void
-gst_decode_pad_init (GstDecodePad * pad)
-{
- pad->chain = NULL;
- pad->blocked = FALSE;
- pad->exposed = FALSE;
- pad->drained = FALSE;
- gst_object_ref (pad);
- gst_object_sink (pad);
-}
-
-static void
-source_pad_blocked_cb (GstPad * pad, gboolean blocked, GstDecodePad * dpad)
-{
- GstDecodeChain *chain;
- GstDecodeBin *dbin;
-
- chain = dpad->chain;
- dbin = chain->dbin;
-
- GST_LOG_OBJECT (dpad, "blocked:%d, dpad->chain:%p", blocked, chain);
-
- dpad->blocked = blocked;
-
- if (dpad->blocked) {
- EXPOSE_LOCK (dbin);
- if (gst_decode_chain_is_complete (dbin->decode_chain)) {
- if (!gst_decode_bin_expose (dbin))
- GST_WARNING_OBJECT (dbin, "Couldn't expose group");
- }
- EXPOSE_UNLOCK (dbin);
- }
-}
-
-static gboolean
-source_pad_event_probe (GstPad * pad, GstEvent * event, GstDecodePad * dpad)
-{
- GST_LOG_OBJECT (pad, "%s dpad:%p", GST_EVENT_TYPE_NAME (event), dpad);
-
- if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
- GST_DEBUG_OBJECT (pad, "we received EOS");
-
- /* Check if all pads are drained. If there is a next group to expose, we
- * will remove the ghostpad of the current group first, which unlinks the
- * peer and so drops the EOS. */
- gst_decode_pad_handle_eos (dpad);
- }
- /* never drop events */
- return TRUE;
-}
-
-static void
-gst_decode_pad_set_blocked (GstDecodePad * dpad, gboolean blocked)
-{
- GstDecodeBin *dbin = dpad->dbin;
- GstPad *opad;
-
- DYN_LOCK (dbin);
-
- GST_DEBUG_OBJECT (dpad, "blocking pad: %d", blocked);
-
- opad = gst_ghost_pad_get_target (GST_GHOST_PAD_CAST (dpad));
- if (!opad)
- goto out;
-
- /* do not block if shutting down.
- * we do not consider/expect it blocked further below, but use other trick */
- if (!blocked || !dbin->shutdown)
- gst_pad_set_blocked_async_full (opad, blocked,
- (GstPadBlockCallback) source_pad_blocked_cb, gst_object_ref (dpad),
- (GDestroyNotify) gst_object_unref);
-
- if (blocked) {
- if (dbin->shutdown) {
- /* deactivate to force flushing state to prevent NOT_LINKED errors */
- gst_pad_set_active (GST_PAD_CAST (dpad), FALSE);
- /* note that deactivating the target pad would have no effect here,
- * since elements are typically connected first (and pads exposed),
- * and only then brought to PAUSED state (so pads activated) */
- } else {
- gst_object_ref (dpad);
- dbin->blocked_pads = g_list_prepend (dbin->blocked_pads, dpad);
- }
- } else {
- GList *l;
-
- if ((l = g_list_find (dbin->blocked_pads, dpad))) {
- gst_object_unref (dpad);
- dbin->blocked_pads = g_list_delete_link (dbin->blocked_pads, l);
- }
- }
- gst_object_unref (opad);
-out:
- DYN_UNLOCK (dbin);
-}
-
-static void
-gst_decode_pad_add_drained_check (GstDecodePad * dpad)
-{
- gst_pad_add_event_probe (GST_PAD_CAST (dpad),
- G_CALLBACK (source_pad_event_probe), dpad);
-}
-
-static void
-gst_decode_pad_activate (GstDecodePad * dpad, GstDecodeChain * chain)
-{
- g_return_if_fail (chain != NULL);
-
- dpad->chain = chain;
- gst_pad_set_active (GST_PAD_CAST (dpad), TRUE);
- gst_decode_pad_set_blocked (dpad, TRUE);
- gst_decode_pad_add_drained_check (dpad);
-}
-
-static void
-gst_decode_pad_unblock (GstDecodePad * dpad)
-{
- gst_decode_pad_set_blocked (dpad, FALSE);
-}
-
-/*gst_decode_pad_new:
- *
- * Creates a new GstDecodePad for the given pad.
- */
-static GstDecodePad *
-gst_decode_pad_new (GstDecodeBin * dbin, GstPad * pad, GstDecodeChain * chain)
-{
- GstDecodePad *dpad;
-
- GST_DEBUG_OBJECT (dbin, "making new decodepad");
- dpad =
- g_object_new (GST_TYPE_DECODE_PAD, "direction", GST_PAD_DIRECTION (pad),
- NULL);
- gst_ghost_pad_construct (GST_GHOST_PAD_CAST (dpad));
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (dpad), pad);
- dpad->chain = chain;
- dpad->dbin = dbin;
-
- return dpad;
-}
-
-static void
-gst_pending_pad_free (GstPendingPad * ppad)
-{
- g_assert (ppad);
- g_assert (ppad->pad);
-
- if (ppad->event_probe_id != 0)
- gst_pad_remove_event_probe (ppad->pad, ppad->event_probe_id);
- gst_object_unref (ppad->pad);
- g_slice_free (GstPendingPad, ppad);
-}
-
-/*****
- * Element add/remove
- *****/
-
-static void
-do_async_start (GstDecodeBin * dbin)
-{
- GstMessage *message;
-
- dbin->async_pending = TRUE;
-
- message = gst_message_new_async_start (GST_OBJECT_CAST (dbin), FALSE);
- parent_class->handle_message (GST_BIN_CAST (dbin), message);
-}
-
-static void
-do_async_done (GstDecodeBin * dbin)
-{
- GstMessage *message;
-
- if (dbin->async_pending) {
- message = gst_message_new_async_done (GST_OBJECT_CAST (dbin));
- parent_class->handle_message (GST_BIN_CAST (dbin), message);
-
- dbin->async_pending = FALSE;
- }
-}
-
-/*****
- * convenience functions
- *****/
-
-/* find_sink_pad
- *
- * Returns the first sink pad of the given element, or NULL if it doesn't have
- * any.
- */
-
-static GstPad *
-find_sink_pad (GstElement * element)
-{
- GstIterator *it;
- GstPad *pad = NULL;
- gpointer point;
-
- it = gst_element_iterate_sink_pads (element);
-
- if ((gst_iterator_next (it, &point)) == GST_ITERATOR_OK)
- pad = (GstPad *) point;
-
- gst_iterator_free (it);
-
- return pad;
-}
-
-/* call with dyn_lock held */
-static void
-unblock_pads (GstDecodeBin * dbin)
-{
- GList *tmp;
-
- GST_LOG_OBJECT (dbin, "unblocking pads");
-
- for (tmp = dbin->blocked_pads; tmp; tmp = tmp->next) {
- GstDecodePad *dpad = (GstDecodePad *) tmp->data;
- GstPad *opad;
-
- opad = gst_ghost_pad_get_target (GST_GHOST_PAD_CAST (dpad));
- if (!opad)
- continue;
-
- GST_DEBUG_OBJECT (dpad, "unblocking");
- gst_pad_set_blocked_async_full (opad, FALSE,
- (GstPadBlockCallback) source_pad_blocked_cb, gst_object_ref (dpad),
- (GDestroyNotify) gst_object_unref);
- /* make flushing, prevent NOT_LINKED */
- GST_PAD_SET_FLUSHING (GST_PAD_CAST (dpad));
- gst_object_unref (dpad);
- gst_object_unref (opad);
- GST_DEBUG_OBJECT (dpad, "unblocked");
- }
-
- /* clear, no more blocked pads */
- g_list_free (dbin->blocked_pads);
- dbin->blocked_pads = NULL;
-}
-
-static GstStateChangeReturn
-gst_decode_bin_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
- GstDecodeBin *dbin = GST_DECODE_BIN (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- if (dbin->typefind == NULL)
- goto missing_typefind;
- g_mutex_lock (dbin->factories_lock);
- gst_decode_bin_update_factories_list (dbin);
- g_mutex_unlock (dbin->factories_lock);
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- DYN_LOCK (dbin);
- GST_LOG_OBJECT (dbin, "clearing shutdown flag");
- dbin->shutdown = FALSE;
- DYN_UNLOCK (dbin);
- dbin->have_type = FALSE;
- ret = GST_STATE_CHANGE_ASYNC;
- do_async_start (dbin);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- DYN_LOCK (dbin);
- GST_LOG_OBJECT (dbin, "setting shutdown flag");
- dbin->shutdown = TRUE;
- unblock_pads (dbin);
- DYN_UNLOCK (dbin);
- default:
- break;
- }
-
- {
- GstStateChangeReturn bret;
-
- bret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- if (G_UNLIKELY (bret == GST_STATE_CHANGE_FAILURE))
- goto activate_failed;
- else if (G_UNLIKELY (bret == GST_STATE_CHANGE_NO_PREROLL)) {
- do_async_done (dbin);
- ret = bret;
- }
- }
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- do_async_done (dbin);
- if (dbin->decode_chain) {
- gst_decode_chain_free (dbin->decode_chain);
- dbin->decode_chain = NULL;
- }
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- default:
- break;
- }
-
- return ret;
-
-/* ERRORS */
-missing_typefind:
- {
- gst_element_post_message (element,
- gst_missing_element_message_new (element, "typefind"));
- GST_ELEMENT_ERROR (dbin, CORE, MISSING_PLUGIN, (NULL), ("no typefind!"));
- return GST_STATE_CHANGE_FAILURE;
- }
-activate_failed:
- {
- GST_DEBUG_OBJECT (element,
- "element failed to change states -- activation problem?");
- return GST_STATE_CHANGE_FAILURE;
- }
-}
-
-gboolean
-gst_decode_bin_plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (gst_decode_bin_debug, "decodebin2", 0,
- "decoder bin");
-
-#ifdef ENABLE_NLS
- GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
- LOCALEDIR);
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif /* ENABLE_NLS */
-
- /* Register some quarks here for the stream topology message */
- topology_structure_name = g_quark_from_static_string ("stream-topology");
- topology_caps = g_quark_from_static_string ("caps");
- topology_next = g_quark_from_static_string ("next");
- topology_pad = g_quark_from_static_string ("pad");
-
- return gst_element_register (plugin, "decodebin2", GST_RANK_NONE,
- GST_TYPE_DECODE_BIN);
-}
diff --git a/gst/playback/gstfactorylists.c b/gst/playback/gstfactorylists.c
deleted file mode 100644
index eb5fb4c0..00000000
--- a/gst/playback/gstfactorylists.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#include <string.h>
-
-#include "gstfactorylists.h"
-
-typedef struct
-{
- GstFactoryListType type;
-} FilterData;
-
-/* function used to sort element features. We first sort on the rank, then
- * on the element name (to get a consistent, predictable list) */
-static gint
-compare_ranks (GValue * v1, GValue * v2)
-{
- gint diff;
- GstPluginFeature *f1, *f2;
-
- f1 = g_value_get_object (v1);
- f2 = g_value_get_object (v2);
-
- diff = f2->rank - f1->rank;
- if (diff != 0)
- return diff;
-
- diff = strcmp (f2->name, f1->name);
-
- return diff;
-}
-
-/* the filter function for selecting the elements we can use in
- * autoplugging */
-static gboolean
-decoders_filter (GstElementFactory * factory)
-{
- guint rank;
- const gchar *klass;
-
- klass = gst_element_factory_get_klass (factory);
- /* only demuxers, decoders, depayloaders and parsers can play */
- if (strstr (klass, "Demux") == NULL &&
- strstr (klass, "Decoder") == NULL &&
- strstr (klass, "Depayloader") == NULL &&
- strstr (klass, "Parse") == NULL) {
- return FALSE;
- }
-
- /* only select elements with autoplugging rank */
- rank = gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (factory));
- if (rank < GST_RANK_MARGINAL)
- return FALSE;
-
- return TRUE;
-}
-
-/* the filter function for selecting the elements we can use in
- * autoplugging */
-static gboolean
-sinks_filter (GstElementFactory * factory)
-{
- guint rank;
- const gchar *klass;
-
- klass = gst_element_factory_get_klass (factory);
- /* only sinks can play */
- if (strstr (klass, "Sink") == NULL) {
- return FALSE;
- }
-
- /* must be audio or video sink */
- if (strstr (klass, "Audio") == NULL && strstr (klass, "Video") == NULL) {
- return FALSE;
- }
-
- /* only select elements with autoplugging rank */
- rank = gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (factory));
- if (rank < GST_RANK_MARGINAL)
- return FALSE;
-
- return TRUE;
-}
-
-/**
- * gst_factory_list_is_type:
- * @factory: a #GstElementFactory
- * @type: a #GstFactoryListType
- *
- * Check if @factory if of the given types.
- *
- * Returns: %TRUE if @factory is of @type.
- */
-gboolean
-gst_factory_list_is_type (GstElementFactory * factory, GstFactoryListType type)
-{
- gboolean res = FALSE;
-
- if (!res && (type & GST_FACTORY_LIST_SINK))
- res = sinks_filter (factory);
- if (!res && (type & GST_FACTORY_LIST_DECODER))
- res = decoders_filter (factory);
-
- return res;
-}
-
-static gboolean
-element_filter (GstPluginFeature * feature, FilterData * data)
-{
- gboolean res;
-
- /* we only care about element factories */
- if (!GST_IS_ELEMENT_FACTORY (feature))
- return FALSE;
-
- res =
- gst_factory_list_is_type (GST_ELEMENT_FACTORY_CAST (feature), data->type);
-
- return res;
-}
-
-/**
- * gst_factory_list_get_elements:
- * @type: a #GstFactoryListType
- *
- * Get a sorted list of factories of @type.
- *
- * Returns: a #GValueArray of #GstElementFactory elements. Use
- * g_value_array_free() after usage.
- */
-GValueArray *
-gst_factory_list_get_elements (GstFactoryListType type)
-{
- GValueArray *result;
- GList *walk, *list;
- FilterData data;
-
- result = g_value_array_new (0);
-
- /* prepare type */
- data.type = type;
-
- /* get the feature list using the filter */
- list = gst_default_registry_feature_filter ((GstPluginFeatureFilter)
- element_filter, FALSE, &data);
-
- /* convert to an array */
- for (walk = list; walk; walk = g_list_next (walk)) {
- GstElementFactory *factory = GST_ELEMENT_FACTORY_CAST (walk->data);
- GValue val = { 0, };
-
- g_value_init (&val, G_TYPE_OBJECT);
- g_value_set_object (&val, factory);
- g_value_array_append (result, &val);
- g_value_unset (&val);
- }
- gst_plugin_feature_list_free (list);
-
- /* sort on rank and name */
- g_value_array_sort (result, (GCompareFunc) compare_ranks);
-
- return result;
-}
-
-/**
- * gst_factory_list_debug:
- * @array: an array of element factories
- *
- * Debug the element factory names in @array.
- */
-void
-gst_factory_list_debug (GValueArray * array)
-{
-#ifndef GST_DISABLE_GST_DEBUG
- gint i;
-
- for (i = 0; i < array->n_values; i++) {
- GValue *value;
- GstPluginFeature *feature;
-
- value = g_value_array_get_nth (array, i);
- feature = g_value_get_object (value);
-
- GST_DEBUG ("%s", gst_plugin_feature_get_name (feature));
- }
-#endif
-}
-
-/**
- * gst_factory_list_filter:
- * @array: a #GValueArray to filter
- * @caps: a #GstCaps
- *
- * Filter out all the elementfactories in @array that can handle @caps as
- * input.
- *
- * Returns: a #GValueArray of #GstElementFactory elements. Use
- * g_value_array_free() after usage.
- */
-GValueArray *
-gst_factory_list_filter (GValueArray * array, const GstCaps * caps)
-{
- GValueArray *result;
- gint i;
-
- result = g_value_array_new (0);
-
- GST_DEBUG ("finding factories");
-
- /* loop over all the factories */
- for (i = 0; i < array->n_values; i++) {
- GValue *value;
- GstElementFactory *factory;
- const GList *templates;
- GList *walk;
-
- value = g_value_array_get_nth (array, i);
- factory = g_value_get_object (value);
-
- /* get the templates from the element factory */
- templates = gst_element_factory_get_static_pad_templates (factory);
- for (walk = (GList *) templates; walk; walk = g_list_next (walk)) {
- GstStaticPadTemplate *templ = walk->data;
-
- /* we only care about the sink templates */
- if (templ->direction == GST_PAD_SINK) {
- GstCaps *tmpl_caps;
-
- /* try to intersect the caps with the caps of the template */
- tmpl_caps = gst_static_caps_get (&templ->static_caps);
-
- /* FIXME, intersect is not the right method, we ideally want to check
- * for a subset here */
-
- /* check if the intersection is empty */
- if (gst_caps_can_intersect (caps, tmpl_caps)) {
- /* non empty intersection, we can use this element */
- GValue resval = { 0, };
- g_value_init (&resval, G_TYPE_OBJECT);
- g_value_set_object (&resval, factory);
- g_value_array_append (result, &resval);
- g_value_unset (&resval);
- gst_caps_unref (tmpl_caps);
- break;
- }
- gst_caps_unref (tmpl_caps);
- }
- }
- }
- return result;
-}
diff --git a/gst/playback/gstfactorylists.h b/gst/playback/gstfactorylists.h
deleted file mode 100644
index 5d4c64cc..00000000
--- a/gst/playback/gstfactorylists.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_FACTORY_LISTS_H__
-#define __GST_FACTORY_LISTS_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-typedef enum {
- GST_FACTORY_LIST_DECODER = (1 << 0),
- GST_FACTORY_LIST_ENCODER = (1 << 1),
- GST_FACTORY_LIST_SINK = (1 << 2),
- GST_FACTORY_LIST_SRC = (1 << 3)
-} GstFactoryListType;
-
-gboolean gst_factory_list_is_type (GstElementFactory *factory, GstFactoryListType type);
-GValueArray * gst_factory_list_get_elements (GstFactoryListType type);
-
-void gst_factory_list_debug (GValueArray *array);
-
-GValueArray * gst_factory_list_filter (GValueArray *array, const GstCaps *caps);
-
-#ifndef GST_DISABLE_GST_DEBUG
-#define GST_FACTORY_LIST_DEBUG(array) gst_factory_list_debug(array)
-#else
-#define GST_FACTORY_LIST_DEBUG(array)
-#endif
-
-G_END_DECLS
-
-#endif /* __GST_FACTORY_LISTS_H__ */
diff --git a/gst/playback/gstinputselector.c b/gst/playback/gstinputselector.c
deleted file mode 100644
index 72aa9ffc..00000000
--- a/gst/playback/gstinputselector.c
+++ /dev/null
@@ -1,1455 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
- * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
- * Copyright (C) 2005 Jan Schmidt <thaytan@mad.scientist.com>
- * Copyright (C) 2007 Wim Taymans <wim.taymans@gmail.com>
- * Copyright (C) 2007 Andy Wingo <wingo@pobox.com>
- * Copyright (C) 2008 Nokia Corporation. (contact <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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-input-selector
- * @see_also: #GstOutputSelector
- *
- * Direct one out of N input streams to the output pad.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include "gstinputselector.h"
-#include "gstplay-marshal.h"
-
-GST_DEBUG_CATEGORY_STATIC (input_selector_debug);
-#define GST_CAT_DEFAULT input_selector_debug
-
-static const GstElementDetails gst_input_selector_details =
-GST_ELEMENT_DETAILS ("Input selector",
- "Generic",
- "N-to-1 input stream selectoring",
- "Julien Moutte <julien@moutte.net>\n"
- "Jan Schmidt <thaytan@mad.scientist.com>\n"
- "Wim Taymans <wim.taymans@gmail.com>");
-
-static GstStaticPadTemplate gst_input_selector_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("sink%d",
- GST_PAD_SINK,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS_ANY);
-
-static GstStaticPadTemplate gst_input_selector_src_factory =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-enum
-{
- PROP_0,
- PROP_N_PADS,
- PROP_ACTIVE_PAD,
- PROP_SELECT_ALL,
- PROP_LAST
-};
-
-#define DEFAULT_PAD_ALWAYS_OK TRUE
-
-enum
-{
- PROP_PAD_0,
- PROP_PAD_RUNNING_TIME,
- PROP_PAD_TAGS,
- PROP_PAD_ACTIVE,
- PROP_PAD_ALWAYS_OK,
- PROP_PAD_LAST
-};
-
-enum
-{
- /* methods */
- SIGNAL_BLOCK,
- SIGNAL_SWITCH,
- LAST_SIGNAL
-};
-static guint gst_input_selector_signals[LAST_SIGNAL] = { 0 };
-
-static inline gboolean gst_input_selector_is_active_sinkpad (GstInputSelector *
- sel, GstPad * pad);
-static GstPad *gst_input_selector_activate_sinkpad (GstInputSelector * sel,
- GstPad * pad);
-static GstPad *gst_input_selector_get_linked_pad (GstPad * pad,
- gboolean strict);
-static gboolean gst_input_selector_check_eos (GstElement * selector);
-
-#define GST_TYPE_SELECTOR_PAD \
- (gst_selector_pad_get_type())
-#define GST_SELECTOR_PAD(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_SELECTOR_PAD, GstSelectorPad))
-#define GST_SELECTOR_PAD_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_SELECTOR_PAD, GstSelectorPadClass))
-#define GST_IS_SELECTOR_PAD(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_SELECTOR_PAD))
-#define GST_IS_SELECTOR_PAD_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_SELECTOR_PAD))
-#define GST_SELECTOR_PAD_CAST(obj) \
- ((GstSelectorPad *)(obj))
-
-typedef struct _GstSelectorPad GstSelectorPad;
-typedef struct _GstSelectorPadClass GstSelectorPadClass;
-
-struct _GstSelectorPad
-{
- GstPad parent;
-
- gboolean active; /* when buffer have passed the pad */
- gboolean eos; /* when EOS has been received */
- gboolean discont; /* after switching we create a discont */
- gboolean always_ok;
- GstSegment segment; /* the current segment on the pad */
- GstTagList *tags; /* last tags received on the pad */
-
- gboolean segment_pending;
-};
-
-struct _GstSelectorPadClass
-{
- GstPadClass parent;
-};
-
-static void gst_selector_pad_class_init (GstSelectorPadClass * klass);
-static void gst_selector_pad_init (GstSelectorPad * pad);
-static void gst_selector_pad_finalize (GObject * object);
-static void gst_selector_pad_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-static void gst_selector_pad_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-
-static GstPadClass *selector_pad_parent_class = NULL;
-
-static gint64 gst_selector_pad_get_running_time (GstSelectorPad * pad);
-static void gst_selector_pad_reset (GstSelectorPad * pad);
-static gboolean gst_selector_pad_event (GstPad * pad, GstEvent * event);
-static GstCaps *gst_selector_pad_getcaps (GstPad * pad);
-static gboolean gst_selector_pad_acceptcaps (GstPad * pad, GstCaps * caps);
-static GstIterator *gst_selector_pad_iterate_linked_pads (GstPad * pad);
-static GstFlowReturn gst_selector_pad_chain (GstPad * pad, GstBuffer * buf);
-static GstFlowReturn gst_selector_pad_bufferalloc (GstPad * pad,
- guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
-
-GType
-gst_selector_pad_get_type (void)
-{
- static GType selector_pad_type = 0;
-
- if (!selector_pad_type) {
- static const GTypeInfo selector_pad_info = {
- sizeof (GstSelectorPadClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_selector_pad_class_init,
- NULL,
- NULL,
- sizeof (GstSelectorPad),
- 0,
- (GInstanceInitFunc) gst_selector_pad_init,
- };
-
- selector_pad_type =
- g_type_register_static (GST_TYPE_PAD, "GstPlaybin2SelectorPad",
- &selector_pad_info, 0);
- }
- return selector_pad_type;
-}
-
-static void
-gst_selector_pad_class_init (GstSelectorPadClass * klass)
-{
- GObjectClass *gobject_class;
-
- gobject_class = (GObjectClass *) klass;
-
- selector_pad_parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->finalize = gst_selector_pad_finalize;
-
- gobject_class->get_property = gst_selector_pad_get_property;
- gobject_class->set_property = gst_selector_pad_set_property;
-
- g_object_class_install_property (gobject_class, PROP_PAD_RUNNING_TIME,
- g_param_spec_int64 ("running-time", "Running time",
- "Running time of stream on pad", 0, G_MAXINT64, 0, G_PARAM_READABLE));
- g_object_class_install_property (gobject_class, PROP_PAD_TAGS,
- g_param_spec_boxed ("tags", "Tags",
- "The currently active tags on the pad", GST_TYPE_TAG_LIST,
- G_PARAM_READABLE));
- g_object_class_install_property (gobject_class, PROP_PAD_ACTIVE,
- g_param_spec_boolean ("active", "Active",
- "If the pad is currently active", FALSE, G_PARAM_READABLE));
- g_object_class_install_property (gobject_class, PROP_PAD_ALWAYS_OK,
- g_param_spec_boolean ("always-ok", "Always OK",
- "Make an inactive pad return OK instead of NOT_LINKED",
- DEFAULT_PAD_ALWAYS_OK, G_PARAM_READWRITE));
-}
-
-static void
-gst_selector_pad_init (GstSelectorPad * pad)
-{
- pad->always_ok = DEFAULT_PAD_ALWAYS_OK;
- gst_selector_pad_reset (pad);
-}
-
-static void
-gst_selector_pad_finalize (GObject * object)
-{
- GstSelectorPad *pad;
-
- pad = GST_SELECTOR_PAD_CAST (object);
-
- if (pad->tags)
- gst_tag_list_free (pad->tags);
-
- G_OBJECT_CLASS (selector_pad_parent_class)->finalize (object);
-}
-
-static void
-gst_selector_pad_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstSelectorPad *spad = GST_SELECTOR_PAD_CAST (object);
-
- switch (prop_id) {
- case PROP_PAD_ALWAYS_OK:
- GST_OBJECT_LOCK (object);
- spad->always_ok = g_value_get_boolean (value);
- GST_OBJECT_UNLOCK (object);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_selector_pad_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstSelectorPad *spad = GST_SELECTOR_PAD_CAST (object);
-
- switch (prop_id) {
- case PROP_PAD_RUNNING_TIME:
- g_value_set_int64 (value, gst_selector_pad_get_running_time (spad));
- break;
- case PROP_PAD_TAGS:
- GST_OBJECT_LOCK (object);
- g_value_set_boxed (value, spad->tags);
- GST_OBJECT_UNLOCK (object);
- break;
- case PROP_PAD_ACTIVE:
- {
- GstInputSelector *sel;
-
- sel = GST_INPUT_SELECTOR (gst_pad_get_parent (spad));
- g_value_set_boolean (value, gst_input_selector_is_active_sinkpad (sel,
- GST_PAD_CAST (spad)));
- gst_object_unref (sel);
- break;
- }
- case PROP_PAD_ALWAYS_OK:
- GST_OBJECT_LOCK (object);
- g_value_set_boolean (value, spad->always_ok);
- GST_OBJECT_UNLOCK (object);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static gint64
-gst_selector_pad_get_running_time (GstSelectorPad * pad)
-{
- gint64 ret = 0;
-
- GST_OBJECT_LOCK (pad);
- if (pad->active) {
- gint64 last_stop = pad->segment.last_stop;
-
- if (last_stop >= 0)
- ret = gst_segment_to_running_time (&pad->segment, GST_FORMAT_TIME,
- last_stop);
- }
- GST_OBJECT_UNLOCK (pad);
-
- GST_DEBUG_OBJECT (pad, "running time: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (ret));
-
- return ret;
-}
-
-static void
-gst_selector_pad_reset (GstSelectorPad * pad)
-{
- GST_OBJECT_LOCK (pad);
- pad->active = FALSE;
- pad->eos = FALSE;
- pad->segment_pending = FALSE;
- pad->discont = FALSE;
- gst_segment_init (&pad->segment, GST_FORMAT_UNDEFINED);
- GST_OBJECT_UNLOCK (pad);
-}
-
-/* strictly get the linked pad from the sinkpad. If the pad is active we return
- * the srcpad else we return NULL */
-static GstIterator *
-gst_selector_pad_iterate_linked_pads (GstPad * pad)
-{
- GstInputSelector *sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
- GstPad *otherpad;
- GstIterator *it;
-
- otherpad = gst_input_selector_get_linked_pad (pad, TRUE);
- it = gst_iterator_new_single (GST_TYPE_PAD, otherpad,
- (GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref);
-
- if (otherpad)
- gst_object_unref (otherpad);
- gst_object_unref (sel);
-
- return it;
-}
-
-static gboolean
-gst_selector_pad_event (GstPad * pad, GstEvent * event)
-{
- gboolean res = TRUE;
- gboolean forward = TRUE;
- GstInputSelector *sel;
- GstSelectorPad *selpad;
- GstPad *prev_active_sinkpad;
- GstPad *active_sinkpad;
-
- sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
- selpad = GST_SELECTOR_PAD_CAST (pad);
-
- GST_INPUT_SELECTOR_LOCK (sel);
- prev_active_sinkpad = sel->active_sinkpad;
- active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad);
-
- /* only forward if we are dealing with the active sinkpad or if select_all
- * is enabled */
- if (pad != active_sinkpad && !sel->select_all)
- forward = FALSE;
- GST_INPUT_SELECTOR_UNLOCK (sel);
-
- if (prev_active_sinkpad != active_sinkpad && pad == active_sinkpad)
- g_object_notify (G_OBJECT (sel), "active-pad");
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_START:
- /* FIXME, flush out the waiter */
- break;
- case GST_EVENT_FLUSH_STOP:
- GST_INPUT_SELECTOR_LOCK (sel);
- gst_selector_pad_reset (selpad);
- sel->pending_close = FALSE;
- GST_INPUT_SELECTOR_UNLOCK (sel);
- break;
- case GST_EVENT_NEWSEGMENT:
- {
- gboolean update;
- GstFormat format;
- gdouble rate, arate;
- gint64 start, stop, time;
-
- gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
- &start, &stop, &time);
-
- GST_DEBUG_OBJECT (pad,
- "configured NEWSEGMENT update %d, rate %lf, applied rate %lf, "
- "format %d, "
- "%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
- G_GINT64_FORMAT, update, rate, arate, format, start, stop, time);
-
- GST_INPUT_SELECTOR_LOCK (sel);
- GST_OBJECT_LOCK (selpad);
- gst_segment_set_newsegment_full (&selpad->segment, update,
- rate, arate, format, start, stop, time);
- GST_OBJECT_UNLOCK (selpad);
-
- /* If we aren't forwarding the event (because the pad is not the
- * active_sinkpad, and select_all is not set, then set the flag on the
- * that says a segment needs sending if/when that pad is activated.
- * For all other cases, we send the event immediately, which makes
- * sparse streams and other segment updates work correctly downstream.
- */
- if (!forward)
- selpad->segment_pending = TRUE;
-
- GST_INPUT_SELECTOR_UNLOCK (sel);
- break;
- }
- case GST_EVENT_TAG:
- {
- GstTagList *tags, *oldtags, *newtags;
-
- gst_event_parse_tag (event, &tags);
-
- GST_OBJECT_LOCK (selpad);
- oldtags = selpad->tags;
-
- newtags = gst_tag_list_merge (oldtags, tags, GST_TAG_MERGE_REPLACE);
- selpad->tags = newtags;
- if (oldtags)
- gst_tag_list_free (oldtags);
- GST_DEBUG_OBJECT (pad, "received tags %" GST_PTR_FORMAT, newtags);
- GST_OBJECT_UNLOCK (selpad);
-
- g_object_notify (G_OBJECT (selpad), "tags");
- break;
- }
- case GST_EVENT_EOS:
- selpad->eos = TRUE;
- GST_DEBUG_OBJECT (pad, "received EOS");
- /* don't forward eos in select_all mode until all sink pads have eos */
- if (sel->select_all && !gst_input_selector_check_eos (GST_ELEMENT (sel))) {
- forward = FALSE;
- }
- break;
- default:
- break;
- }
- if (forward) {
- GST_DEBUG_OBJECT (pad, "forwarding event");
- res = gst_pad_push_event (sel->srcpad, event);
- } else
- gst_event_unref (event);
-
- gst_object_unref (sel);
-
- return res;
-}
-
-static GstCaps *
-gst_selector_pad_getcaps (GstPad * pad)
-{
- GstInputSelector *sel;
- GstCaps *caps;
-
- sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
-
- GST_DEBUG_OBJECT (sel, "Getting caps of srcpad peer");
- caps = gst_pad_peer_get_caps_reffed (sel->srcpad);
- if (caps == NULL)
- caps = gst_caps_new_any ();
-
- gst_object_unref (sel);
-
- return caps;
-}
-
-static gboolean
-gst_selector_pad_acceptcaps (GstPad * pad, GstCaps * caps)
-{
- GstInputSelector *sel;
- gboolean res;
-
- sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
-
- GST_DEBUG_OBJECT (sel, "Checking acceptcaps of srcpad peer");
- res = gst_pad_peer_accept_caps (sel->srcpad, caps);
- gst_object_unref (sel);
-
- return res;
-}
-
-static GstFlowReturn
-gst_selector_pad_bufferalloc (GstPad * pad, guint64 offset,
- guint size, GstCaps * caps, GstBuffer ** buf)
-{
- GstInputSelector *sel;
- GstFlowReturn result;
- GstPad *active_sinkpad;
- GstPad *prev_active_sinkpad;
- GstSelectorPad *selpad;
-
- sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
- selpad = GST_SELECTOR_PAD_CAST (pad);
-
- GST_DEBUG_OBJECT (pad, "received alloc");
-
- GST_INPUT_SELECTOR_LOCK (sel);
- prev_active_sinkpad = sel->active_sinkpad;
- active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad);
-
- if (pad != active_sinkpad)
- goto not_active;
-
- GST_INPUT_SELECTOR_UNLOCK (sel);
-
- if (prev_active_sinkpad != active_sinkpad && pad == active_sinkpad)
- g_object_notify (G_OBJECT (sel), "active-pad");
-
- result = gst_pad_alloc_buffer (sel->srcpad, offset, size, caps, buf);
-
-done:
- gst_object_unref (sel);
-
- return result;
-
- /* ERRORS */
-not_active:
- {
- GST_INPUT_SELECTOR_UNLOCK (sel);
-
- /* unselected pad, perform fallback alloc or return unlinked when
- * asked */
- GST_OBJECT_LOCK (selpad);
- if (selpad->always_ok) {
- GST_DEBUG_OBJECT (pad, "Not selected, performing fallback allocation");
- *buf = NULL;
- result = GST_FLOW_OK;
- } else {
- GST_DEBUG_OBJECT (pad, "Not selected, return NOT_LINKED");
- result = GST_FLOW_NOT_LINKED;
- }
- GST_OBJECT_UNLOCK (selpad);
-
- goto done;
- }
-}
-
-/* must be called with the SELECTOR_LOCK, will block while the pad is blocked
- * or return TRUE when flushing */
-static gboolean
-gst_input_selector_wait (GstInputSelector * self, GstPad * pad)
-{
- while (self->blocked && !self->flushing) {
- /* we can be unlocked here when we are shutting down (flushing) or when we
- * get unblocked */
- GST_INPUT_SELECTOR_WAIT (self);
- }
- return self->flushing;
-}
-
-static GstFlowReturn
-gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
-{
- GstInputSelector *sel;
- GstFlowReturn res;
- GstPad *active_sinkpad;
- GstPad *prev_active_sinkpad;
- GstSelectorPad *selpad;
- GstClockTime start_time;
- GstSegment *seg;
- GstEvent *close_event = NULL, *start_event = NULL;
- GstCaps *caps;
-
- sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
- selpad = GST_SELECTOR_PAD_CAST (pad);
- seg = &selpad->segment;
-
- GST_INPUT_SELECTOR_LOCK (sel);
- /* wait or check for flushing */
- if (gst_input_selector_wait (sel, pad))
- goto flushing;
-
- GST_DEBUG_OBJECT (pad, "getting active pad");
-
- prev_active_sinkpad = sel->active_sinkpad;
- active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad);
-
- /* update the segment on the srcpad */
- start_time = GST_BUFFER_TIMESTAMP (buf);
- if (GST_CLOCK_TIME_IS_VALID (start_time)) {
- GST_DEBUG_OBJECT (pad, "received start time %" GST_TIME_FORMAT,
- GST_TIME_ARGS (start_time));
- if (GST_BUFFER_DURATION_IS_VALID (buf))
- GST_DEBUG_OBJECT (pad, "received end time %" GST_TIME_FORMAT,
- GST_TIME_ARGS (start_time + GST_BUFFER_DURATION (buf)));
-
- GST_OBJECT_LOCK (pad);
- gst_segment_set_last_stop (seg, seg->format, start_time);
- GST_OBJECT_UNLOCK (pad);
- }
-
- /* Ignore buffers from pads except the selected one */
- if (pad != active_sinkpad)
- goto ignore;
-
- if (G_UNLIKELY (sel->pending_close)) {
- GstSegment *cseg = &sel->segment;
-
- GST_DEBUG_OBJECT (sel,
- "pushing close NEWSEGMENT update %d, rate %lf, applied rate %lf, "
- "format %d, "
- "%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
- G_GINT64_FORMAT, TRUE, cseg->rate, cseg->applied_rate, cseg->format,
- cseg->start, cseg->stop, cseg->time);
-
- /* create update segment */
- close_event = gst_event_new_new_segment_full (TRUE, cseg->rate,
- cseg->applied_rate, cseg->format, cseg->start, cseg->stop, cseg->time);
-
- sel->pending_close = FALSE;
- }
- /* if we have a pending segment, push it out now */
- if (G_UNLIKELY (selpad->segment_pending)) {
- GST_DEBUG_OBJECT (pad,
- "pushing pending NEWSEGMENT update %d, rate %lf, applied rate %lf, "
- "format %d, "
- "%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
- G_GINT64_FORMAT, FALSE, seg->rate, seg->applied_rate, seg->format,
- seg->start, seg->stop, seg->time);
-
- start_event = gst_event_new_new_segment_full (FALSE, seg->rate,
- seg->applied_rate, seg->format, seg->start, seg->stop, seg->time);
-
- selpad->segment_pending = FALSE;
- }
- GST_INPUT_SELECTOR_UNLOCK (sel);
-
- if (prev_active_sinkpad != active_sinkpad && pad == active_sinkpad)
- g_object_notify (G_OBJECT (sel), "active-pad");
-
- if (close_event)
- gst_pad_push_event (sel->srcpad, close_event);
-
- if (start_event)
- gst_pad_push_event (sel->srcpad, start_event);
-
- if (selpad->discont) {
- buf = gst_buffer_make_metadata_writable (buf);
-
- GST_DEBUG_OBJECT (pad, "Marking discont buffer %p", buf);
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
- selpad->discont = FALSE;
- }
-
- /* forward */
- GST_DEBUG_OBJECT (pad, "Forwarding buffer %p from pad %s:%s", buf,
- GST_DEBUG_PAD_NAME (pad));
-
- if ((caps = GST_BUFFER_CAPS (buf))) {
- if (GST_PAD_CAPS (sel->srcpad) != caps)
- gst_pad_set_caps (sel->srcpad, caps);
- }
-
- res = gst_pad_push (sel->srcpad, buf);
-
-done:
- gst_object_unref (sel);
- return res;
-
- /* dropped buffers */
-ignore:
- {
- GST_DEBUG_OBJECT (pad, "Pad not active, discard buffer %p", buf);
- /* when we drop a buffer, we're creating a discont on this pad */
- selpad->discont = TRUE;
- GST_INPUT_SELECTOR_UNLOCK (sel);
- gst_buffer_unref (buf);
-
- /* figure out what to return upstream */
- GST_OBJECT_LOCK (selpad);
- if (selpad->always_ok)
- res = GST_FLOW_OK;
- else
- res = GST_FLOW_NOT_LINKED;
- GST_OBJECT_UNLOCK (selpad);
-
- goto done;
- }
-flushing:
- {
- GST_DEBUG_OBJECT (pad, "We are flushing, discard buffer %p", buf);
- GST_INPUT_SELECTOR_UNLOCK (sel);
- gst_buffer_unref (buf);
- res = GST_FLOW_WRONG_STATE;
- goto done;
- }
-}
-
-static void gst_input_selector_init (GstInputSelector * sel);
-static void gst_input_selector_base_init (GstInputSelectorClass * klass);
-static void gst_input_selector_class_init (GstInputSelectorClass * klass);
-
-static void gst_input_selector_dispose (GObject * object);
-
-static void gst_input_selector_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_input_selector_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static GstPad *gst_input_selector_request_new_pad (GstElement * element,
- GstPadTemplate * templ, const gchar * unused);
-static void gst_input_selector_release_pad (GstElement * element, GstPad * pad);
-
-static GstStateChangeReturn gst_input_selector_change_state (GstElement *
- element, GstStateChange transition);
-
-static GstCaps *gst_input_selector_getcaps (GstPad * pad);
-static gboolean gst_input_selector_event (GstPad * pad, GstEvent * event);
-static gboolean gst_input_selector_query (GstPad * pad, GstQuery * query);
-static gint64 gst_input_selector_block (GstInputSelector * self);
-static void gst_input_selector_switch (GstInputSelector * self,
- GstPad * pad, gint64 stop_time, gint64 start_time);
-
-static GstElementClass *parent_class = NULL;
-
-GType
-gst_input_selector_get_type (void)
-{
- static GType input_selector_type = 0;
-
- if (!input_selector_type) {
- static const GTypeInfo input_selector_info = {
- sizeof (GstInputSelectorClass),
- (GBaseInitFunc) gst_input_selector_base_init,
- NULL,
- (GClassInitFunc) gst_input_selector_class_init,
- NULL,
- NULL,
- sizeof (GstInputSelector),
- 0,
- (GInstanceInitFunc) gst_input_selector_init,
- };
- input_selector_type =
- g_type_register_static (GST_TYPE_ELEMENT,
- "GstPlaybin2InputSelector", &input_selector_info, 0);
- GST_DEBUG_CATEGORY_INIT (input_selector_debug,
- "playbin2-input-selector", 0, "Playbin2 input stream selector element");
- }
-
- return input_selector_type;
-}
-
-static void
-gst_input_selector_base_init (GstInputSelectorClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_set_details (element_class, &gst_input_selector_details);
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_input_selector_sink_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_input_selector_src_factory));
-}
-
-static void
-gst_input_selector_class_init (GstInputSelectorClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->dispose = gst_input_selector_dispose;
-
- gobject_class->set_property = gst_input_selector_set_property;
- gobject_class->get_property = gst_input_selector_get_property;
-
- g_object_class_install_property (gobject_class, PROP_N_PADS,
- g_param_spec_uint ("n-pads", "Number of Pads",
- "The number of sink pads", 0, G_MAXUINT, 0, G_PARAM_READABLE));
-
- g_object_class_install_property (gobject_class, PROP_ACTIVE_PAD,
- g_param_spec_object ("active-pad", "Active pad",
- "The currently active sink pad", GST_TYPE_PAD, G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_SELECT_ALL,
- g_param_spec_boolean ("select-all", "Select all mode",
- "Forwards data from all input pads", FALSE, G_PARAM_READWRITE));
-
- /**
- * GstInputSelector::block:
- * @inputselector: the #GstInputSelector
- *
- * Block all sink pads in preparation for a switch. Returns the stop time of
- * the current switch segment, as a running time, or 0 if there is no current
- * active pad or the current active pad never received data.
- */
- gst_input_selector_signals[SIGNAL_BLOCK] =
- g_signal_new ("block", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GstInputSelectorClass, block), NULL, NULL,
- gst_play_marshal_INT64__VOID, G_TYPE_INT64, 0);
- /**
- * GstInputSelector::switch:
- * @inputselector: the #GstInputSelector
- * @pad: the pad to switch to
- * @stop_time: running time at which to close the previous segment, or -1
- * to use the running time of the previously active sink pad
- * @start_time: running time at which to start the new segment, or -1 to
- * use the running time of the newly active sink pad
- *
- * Switch to a new feed. The segment opened by the previously active pad, if
- * any, will be closed, and a new segment opened before data flows again.
- *
- * This signal must be emitted when the element has been blocked via the <link
- * linkend="GstInputSelector-block">block</link> signal.
- *
- * If you have a stream with only one switch element, such as an audio-only
- * stream, a stream switch should be performed by first emitting the block
- * signal, and then emitting the switch signal with -1 for the stop and start
- * time values.
- *
- * The intention of the @stop_time and @start_time arguments is to allow
- * multiple switch elements to switch and maintain stream synchronization.
- * When switching a stream with multiple feeds, you will need as many switch
- * elements as you have feeds. For example, a feed with audio and video will
- * have one switch element between the audio feeds and one for video.
- *
- * A switch over multiple switch elements should be performed as follows:
- * First, emit the <link linkend="GstInputSelector-block">block</link>
- * signal, collecting the returned values. The maximum running time returned
- * by block should then be used as the time at which to close the previous
- * segment.
- *
- * Then, query the running times of the new audio and video pads that you will
- * switch to. Naturally, these pads are on separate switch elements. Take the
- * minimum running time for those streams and use it for the time at which to
- * open the new segment.
- *
- * If @pad is the same as the current active pad, the element will cancel any
- * previous block without adjusting segments.
- *
- * <note><simpara>
- * the signal changed from accepting the pad name to the pad object.
- * </simpara></note>
- *
- * Since: 0.10.7
- */
- gst_input_selector_signals[SIGNAL_SWITCH] =
- g_signal_new ("switch", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstInputSelectorClass, switch_),
- NULL, NULL, gst_play_marshal_VOID__OBJECT_INT64_INT64,
- G_TYPE_NONE, 3, GST_TYPE_PAD, G_TYPE_INT64, G_TYPE_INT64);
-
- gstelement_class->request_new_pad = gst_input_selector_request_new_pad;
- gstelement_class->release_pad = gst_input_selector_release_pad;
- gstelement_class->change_state = gst_input_selector_change_state;
-
- klass->block = GST_DEBUG_FUNCPTR (gst_input_selector_block);
- /* note the underscore because switch is a keyword otherwise */
- klass->switch_ = GST_DEBUG_FUNCPTR (gst_input_selector_switch);
-}
-
-static void
-gst_input_selector_init (GstInputSelector * sel)
-{
- sel->srcpad = gst_pad_new ("src", GST_PAD_SRC);
- gst_pad_set_iterate_internal_links_function (sel->srcpad,
- GST_DEBUG_FUNCPTR (gst_selector_pad_iterate_linked_pads));
- gst_pad_set_getcaps_function (sel->srcpad,
- GST_DEBUG_FUNCPTR (gst_input_selector_getcaps));
- gst_pad_set_query_function (sel->srcpad,
- GST_DEBUG_FUNCPTR (gst_input_selector_query));
- gst_pad_set_event_function (sel->srcpad,
- GST_DEBUG_FUNCPTR (gst_input_selector_event));
- gst_element_add_pad (GST_ELEMENT (sel), sel->srcpad);
- /* sinkpad management */
- sel->active_sinkpad = NULL;
- sel->padcount = 0;
- gst_segment_init (&sel->segment, GST_FORMAT_UNDEFINED);
-
- sel->lock = g_mutex_new ();
- sel->cond = g_cond_new ();
- sel->blocked = FALSE;
-
- sel->select_all = FALSE;
-}
-
-static void
-gst_input_selector_dispose (GObject * object)
-{
- GstInputSelector *sel = GST_INPUT_SELECTOR (object);
-
- if (sel->active_sinkpad) {
- gst_object_unref (sel->active_sinkpad);
- sel->active_sinkpad = NULL;
- }
- if (sel->lock) {
- g_mutex_free (sel->lock);
- sel->lock = NULL;
- }
- if (sel->cond) {
- g_cond_free (sel->cond);
- sel->cond = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-/* Solve the following equation for B.timestamp, and set that as the segment
- * stop:
- * B.running_time = (B.timestamp - NS.start) / NS.abs_rate + NS.accum
- */
-static gint64
-gst_segment_get_timestamp (GstSegment * segment, gint64 running_time)
-{
- if (running_time <= segment->accum)
- return segment->start;
- else
- return (running_time - segment->accum) * segment->abs_rate + segment->start;
-}
-
-static void
-gst_segment_set_stop (GstSegment * segment, gint64 running_time)
-{
- segment->stop = gst_segment_get_timestamp (segment, running_time);
- segment->last_stop = -1;
-}
-
-static void
-gst_segment_set_start (GstSegment * segment, gint64 running_time)
-{
- gint64 new_start, duration;
-
- new_start = gst_segment_get_timestamp (segment, running_time);
-
- /* this is the duration we skipped */
- duration = new_start - segment->start;
- /* add the duration to the accumulated segment time */
- segment->accum += duration;
- /* move position in the segment */
- segment->time += duration;
- segment->start += duration;
-}
-
-/* this function must be called with the SELECTOR_LOCK. It returns TRUE when the
- * active pad changed. */
-static gboolean
-gst_input_selector_set_active_pad (GstInputSelector * self,
- GstPad * pad, gint64 stop_time, gint64 start_time)
-{
- GstSelectorPad *old, *new;
- GstPad **active_pad_p;
-
- if (pad == self->active_sinkpad)
- return FALSE;
-
- old = GST_SELECTOR_PAD_CAST (self->active_sinkpad);
- new = GST_SELECTOR_PAD_CAST (pad);
-
- GST_DEBUG_OBJECT (self, "setting active pad to %s:%s",
- GST_DEBUG_PAD_NAME (new));
-
- if (stop_time == -1 && old) {
- /* no stop time given, get the latest running_time on the active pad to
- * close and open the new segment */
- stop_time = start_time = gst_selector_pad_get_running_time (old);
- GST_DEBUG_OBJECT (self, "using start/stop of %" G_GINT64_FORMAT,
- start_time);
- }
-
- if (old && old->active && !self->pending_close && stop_time >= 0) {
- /* schedule a last_stop update if one isn't already scheduled, and a
- segment has been pushed before. */
- memcpy (&self->segment, &old->segment, sizeof (self->segment));
-
- GST_DEBUG_OBJECT (self, "setting stop_time to %" G_GINT64_FORMAT,
- stop_time);
- gst_segment_set_stop (&self->segment, stop_time);
- self->pending_close = TRUE;
- }
-
- if (new && new->active && start_time >= 0) {
- GST_DEBUG_OBJECT (self, "setting start_time to %" G_GINT64_FORMAT,
- start_time);
- /* schedule a new segment push */
- gst_segment_set_start (&new->segment, start_time);
- new->segment_pending = TRUE;
- }
-
- active_pad_p = &self->active_sinkpad;
- gst_object_replace ((GstObject **) active_pad_p, GST_OBJECT_CAST (pad));
- GST_DEBUG_OBJECT (self, "New active pad is %" GST_PTR_FORMAT,
- self->active_sinkpad);
-
- return TRUE;
-}
-
-static void
-gst_input_selector_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstInputSelector *sel = GST_INPUT_SELECTOR (object);
-
- switch (prop_id) {
- case PROP_ACTIVE_PAD:
- {
- GstPad *pad;
-
- pad = g_value_get_object (value);
-
- GST_INPUT_SELECTOR_LOCK (sel);
- gst_input_selector_set_active_pad (sel, pad,
- GST_CLOCK_TIME_NONE, GST_CLOCK_TIME_NONE);
- GST_INPUT_SELECTOR_UNLOCK (sel);
- break;
- }
- case PROP_SELECT_ALL:
- GST_INPUT_SELECTOR_LOCK (object);
- sel->select_all = g_value_get_boolean (value);
- GST_INPUT_SELECTOR_UNLOCK (object);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_input_selector_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstInputSelector *sel = GST_INPUT_SELECTOR (object);
-
- switch (prop_id) {
- case PROP_N_PADS:
- GST_INPUT_SELECTOR_LOCK (object);
- g_value_set_uint (value, sel->n_pads);
- GST_INPUT_SELECTOR_UNLOCK (object);
- break;
- case PROP_ACTIVE_PAD:
- GST_INPUT_SELECTOR_LOCK (object);
- g_value_set_object (value, sel->active_sinkpad);
- GST_INPUT_SELECTOR_UNLOCK (object);
- break;
- case PROP_SELECT_ALL:
- GST_INPUT_SELECTOR_LOCK (object);
- g_value_set_boolean (value, sel->select_all);
- GST_INPUT_SELECTOR_UNLOCK (object);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstPad *
-gst_input_selector_get_linked_pad (GstPad * pad, gboolean strict)
-{
- GstInputSelector *sel;
- GstPad *otherpad = NULL;
-
- sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
-
- GST_INPUT_SELECTOR_LOCK (sel);
- if (pad == sel->srcpad)
- otherpad = sel->active_sinkpad;
- else if (pad == sel->active_sinkpad || !strict)
- otherpad = sel->srcpad;
- if (otherpad)
- gst_object_ref (otherpad);
- GST_INPUT_SELECTOR_UNLOCK (sel);
-
- gst_object_unref (sel);
-
- return otherpad;
-}
-
-static gboolean
-gst_input_selector_event (GstPad * pad, GstEvent * event)
-{
- gboolean res = FALSE;
- GstPad *otherpad;
-
- otherpad = gst_input_selector_get_linked_pad (pad, TRUE);
-
- if (otherpad) {
- res = gst_pad_push_event (otherpad, event);
-
- gst_object_unref (otherpad);
- } else
- gst_event_unref (event);
- return res;
-}
-
-/* query on the srcpad. We override this function because by default it will
- * only forward the query to one random sinkpad */
-static gboolean
-gst_input_selector_query (GstPad * pad, GstQuery * query)
-{
- gboolean res = TRUE;
- GstInputSelector *sel;
- GstPad *otherpad;
-
- sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
-
- otherpad = gst_input_selector_get_linked_pad (pad, TRUE);
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_LATENCY:
- {
- GList *walk;
- GstClockTime resmin, resmax;
- gboolean reslive;
-
- resmin = 0;
- resmax = -1;
- reslive = FALSE;
-
- /* assume FALSE, we become TRUE if one query succeeds */
- res = FALSE;
-
- /* perform the query on all sinkpads and combine the results. We take the
- * max of min and the min of max for the result latency. */
- GST_INPUT_SELECTOR_LOCK (sel);
- for (walk = GST_ELEMENT_CAST (sel)->sinkpads; walk;
- walk = g_list_next (walk)) {
- GstPad *sinkpad = GST_PAD_CAST (walk->data);
-
- if (gst_pad_peer_query (sinkpad, query)) {
- GstClockTime min, max;
- gboolean live;
-
- /* one query succeeded, we succeed too */
- res = TRUE;
-
- gst_query_parse_latency (query, &live, &min, &max);
-
- GST_DEBUG_OBJECT (sinkpad,
- "peer latency min %" GST_TIME_FORMAT ", max %" GST_TIME_FORMAT
- ", live %d", GST_TIME_ARGS (min), GST_TIME_ARGS (max), live);
-
- if (live) {
- if (min > resmin)
- resmin = min;
- if (resmax == -1)
- resmax = max;
- else if (max < resmax)
- resmax = max;
- if (reslive == FALSE)
- reslive = live;
- }
- }
- }
- GST_INPUT_SELECTOR_UNLOCK (sel);
- if (res) {
- gst_query_set_latency (query, reslive, resmin, resmax);
-
- GST_DEBUG_OBJECT (sel,
- "total latency min %" GST_TIME_FORMAT ", max %" GST_TIME_FORMAT
- ", live %d", GST_TIME_ARGS (resmin), GST_TIME_ARGS (resmax),
- reslive);
- }
-
- break;
- }
- default:
- if (otherpad)
- res = gst_pad_peer_query (otherpad, query);
- break;
- }
- if (otherpad)
- gst_object_unref (otherpad);
- gst_object_unref (sel);
-
- return res;
-}
-
-static GstCaps *
-gst_input_selector_getcaps (GstPad * pad)
-{
- GstPad *otherpad;
- GstObject *parent;
- GstCaps *caps;
-
- parent = gst_object_get_parent (GST_OBJECT (pad));
-
- otherpad = gst_input_selector_get_linked_pad (pad, FALSE);
-
- if (!otherpad) {
- if (GST_INPUT_SELECTOR (parent)->select_all) {
- GST_DEBUG_OBJECT (parent,
- "Pad %s:%s not linked, returning merge of caps",
- GST_DEBUG_PAD_NAME (pad));
- caps = gst_pad_proxy_getcaps (pad);
- } else {
- GST_DEBUG_OBJECT (parent,
- "Pad %s:%s not linked, returning ANY", GST_DEBUG_PAD_NAME (pad));
- caps = gst_caps_new_any ();
- }
- } else {
- GST_DEBUG_OBJECT (parent,
- "Pad %s:%s is linked (to %s:%s), returning peer caps",
- GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (otherpad));
- /* if the peer has caps, use those. If the pad is not linked, this function
- * returns NULL and we return ANY */
- if (!(caps = gst_pad_peer_get_caps_reffed (otherpad)))
- caps = gst_caps_new_any ();
- gst_object_unref (otherpad);
- }
-
- gst_object_unref (parent);
- return caps;
-}
-
-/* check if the pad is the active sinkpad */
-static gboolean
-gst_input_selector_is_active_sinkpad (GstInputSelector * sel, GstPad * pad)
-{
- gboolean res;
-
- GST_INPUT_SELECTOR_LOCK (sel);
- res = (pad == sel->active_sinkpad);
- GST_INPUT_SELECTOR_UNLOCK (sel);
-
- return res;
-}
-
-/* Get or create the active sinkpad, must be called with SELECTOR_LOCK */
-static GstPad *
-gst_input_selector_activate_sinkpad (GstInputSelector * sel, GstPad * pad)
-{
- GstPad *active_sinkpad;
- GstSelectorPad *selpad;
-
- selpad = GST_SELECTOR_PAD_CAST (pad);
-
- selpad->active = TRUE;
- active_sinkpad = sel->active_sinkpad;
- if (active_sinkpad == NULL || sel->select_all) {
- /* first pad we get activity on becomes the activated pad by default, if we
- * select all, we also remember the last used pad. */
- if (sel->active_sinkpad)
- gst_object_unref (sel->active_sinkpad);
- active_sinkpad = sel->active_sinkpad = gst_object_ref (pad);
- GST_DEBUG_OBJECT (sel, "Activating pad %s:%s", GST_DEBUG_PAD_NAME (pad));
- }
-
- return active_sinkpad;
-}
-
-static GstPad *
-gst_input_selector_request_new_pad (GstElement * element,
- GstPadTemplate * templ, const gchar * unused)
-{
- GstInputSelector *sel;
- gchar *name = NULL;
- GstPad *sinkpad = NULL;
-
- g_return_val_if_fail (templ->direction == GST_PAD_SINK, NULL);
-
- sel = GST_INPUT_SELECTOR (element);
-
- GST_INPUT_SELECTOR_LOCK (sel);
-
- GST_LOG_OBJECT (sel, "Creating new pad %d", sel->padcount);
- name = g_strdup_printf ("sink%d", sel->padcount++);
- sinkpad = g_object_new (GST_TYPE_SELECTOR_PAD,
- "name", name, "direction", templ->direction, "template", templ, NULL);
- g_free (name);
-
- sel->n_pads++;
-
- gst_pad_set_event_function (sinkpad,
- GST_DEBUG_FUNCPTR (gst_selector_pad_event));
- gst_pad_set_getcaps_function (sinkpad,
- GST_DEBUG_FUNCPTR (gst_selector_pad_getcaps));
- gst_pad_set_acceptcaps_function (sinkpad,
- GST_DEBUG_FUNCPTR (gst_selector_pad_acceptcaps));
- gst_pad_set_chain_function (sinkpad,
- GST_DEBUG_FUNCPTR (gst_selector_pad_chain));
- gst_pad_set_iterate_internal_links_function (sinkpad,
- GST_DEBUG_FUNCPTR (gst_selector_pad_iterate_linked_pads));
- gst_pad_set_bufferalloc_function (sinkpad,
- GST_DEBUG_FUNCPTR (gst_selector_pad_bufferalloc));
-
- gst_pad_set_active (sinkpad, TRUE);
- gst_element_add_pad (GST_ELEMENT (sel), sinkpad);
- GST_INPUT_SELECTOR_UNLOCK (sel);
-
- return sinkpad;
-}
-
-static void
-gst_input_selector_release_pad (GstElement * element, GstPad * pad)
-{
- GstInputSelector *sel;
-
- sel = GST_INPUT_SELECTOR (element);
- GST_LOG_OBJECT (sel, "Releasing pad %s:%s", GST_DEBUG_PAD_NAME (pad));
-
- GST_INPUT_SELECTOR_LOCK (sel);
- /* if the pad was the active pad, makes us select a new one */
- if (sel->active_sinkpad == pad) {
- GST_DEBUG_OBJECT (sel, "Deactivating pad %s:%s", GST_DEBUG_PAD_NAME (pad));
- gst_object_unref (sel->active_sinkpad);
- sel->active_sinkpad = NULL;
- }
- sel->n_pads--;
-
- gst_pad_set_active (pad, FALSE);
- gst_element_remove_pad (GST_ELEMENT (sel), pad);
- GST_INPUT_SELECTOR_UNLOCK (sel);
-}
-
-static void
-gst_input_selector_reset (GstInputSelector * sel)
-{
- GList *walk;
-
- GST_INPUT_SELECTOR_LOCK (sel);
- /* clear active pad */
- if (sel->active_sinkpad) {
- gst_object_unref (sel->active_sinkpad);
- sel->active_sinkpad = NULL;
- }
- /* reset segment */
- gst_segment_init (&sel->segment, GST_FORMAT_UNDEFINED);
- sel->pending_close = FALSE;
- /* reset each of our sinkpads state */
- for (walk = GST_ELEMENT_CAST (sel)->sinkpads; walk; walk = g_list_next (walk)) {
- GstSelectorPad *selpad = GST_SELECTOR_PAD_CAST (walk->data);
-
- gst_selector_pad_reset (selpad);
-
- if (selpad->tags) {
- gst_tag_list_free (selpad->tags);
- selpad->tags = NULL;
- }
- }
- GST_INPUT_SELECTOR_UNLOCK (sel);
-}
-
-static GstStateChangeReturn
-gst_input_selector_change_state (GstElement * element,
- GstStateChange transition)
-{
- GstInputSelector *self = GST_INPUT_SELECTOR (element);
- GstStateChangeReturn result;
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- GST_INPUT_SELECTOR_LOCK (self);
- self->blocked = FALSE;
- self->flushing = FALSE;
- GST_INPUT_SELECTOR_UNLOCK (self);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- /* first unlock before we call the parent state change function, which
- * tries to acquire the stream lock when going to ready. */
- GST_INPUT_SELECTOR_LOCK (self);
- self->blocked = FALSE;
- self->flushing = TRUE;
- GST_INPUT_SELECTOR_BROADCAST (self);
- GST_INPUT_SELECTOR_UNLOCK (self);
- break;
- default:
- break;
- }
-
- result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- gst_input_selector_reset (self);
- break;
- default:
- break;
- }
-
- return result;
-}
-
-static gint64
-gst_input_selector_block (GstInputSelector * self)
-{
- gint64 ret = 0;
- GstSelectorPad *spad;
-
- GST_INPUT_SELECTOR_LOCK (self);
-
- if (self->blocked)
- GST_WARNING_OBJECT (self, "switch already blocked");
-
- self->blocked = TRUE;
- spad = GST_SELECTOR_PAD_CAST (self->active_sinkpad);
-
- if (spad)
- ret = gst_selector_pad_get_running_time (spad);
- else
- GST_DEBUG_OBJECT (self, "no active pad while blocking");
-
- GST_INPUT_SELECTOR_UNLOCK (self);
-
- return ret;
-}
-
-/* stop_time and start_time are running times */
-static void
-gst_input_selector_switch (GstInputSelector * self, GstPad * pad,
- gint64 stop_time, gint64 start_time)
-{
- gboolean changed;
-
- g_return_if_fail (self->blocked == TRUE);
-
- GST_INPUT_SELECTOR_LOCK (self);
- changed =
- gst_input_selector_set_active_pad (self, pad, stop_time, start_time);
-
- self->blocked = FALSE;
- GST_INPUT_SELECTOR_BROADCAST (self);
- GST_INPUT_SELECTOR_UNLOCK (self);
-
- if (changed)
- g_object_notify (G_OBJECT (self), "active-pad");
-}
-
-static gboolean
-gst_input_selector_check_eos (GstElement * selector)
-{
- GstIterator *it = gst_element_iterate_sink_pads (selector);
- GstIteratorResult ires;
- gpointer item;
- gboolean done = FALSE, is_eos = FALSE;
- GstSelectorPad *pad;
-
- while (!done) {
- ires = gst_iterator_next (it, &item);
- switch (ires) {
- case GST_ITERATOR_DONE:
- GST_INFO_OBJECT (selector, "all sink pads have eos");
- done = TRUE;
- is_eos = TRUE;
- break;
- case GST_ITERATOR_OK:
- pad = GST_SELECTOR_PAD_CAST (item);
- if (!pad->eos) {
- done = TRUE;
- }
- gst_object_unref (pad);
- break;
- case GST_ITERATOR_RESYNC:
- gst_iterator_resync (it);
- break;
- default:
- done = TRUE;
- break;
- }
- }
- gst_iterator_free (it);
-
- return is_eos;
-}
diff --git a/gst/playback/gstinputselector.h b/gst/playback/gstinputselector.h
deleted file mode 100644
index 83e0e541..00000000
--- a/gst/playback/gstinputselector.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
- * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
- * Copyright (C) 2008 Nokia Corporation. (contact <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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_INPUT_SELECTOR_H__
-#define __GST_INPUT_SELECTOR_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_INPUT_SELECTOR \
- (gst_input_selector_get_type())
-#define GST_INPUT_SELECTOR(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_INPUT_SELECTOR, GstInputSelector))
-#define GST_INPUT_SELECTOR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_INPUT_SELECTOR, GstInputSelectorClass))
-#define GST_IS_INPUT_SELECTOR(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_INPUT_SELECTOR))
-#define GST_IS_INPUT_SELECTOR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_INPUT_SELECTOR))
-
-typedef struct _GstInputSelector GstInputSelector;
-typedef struct _GstInputSelectorClass GstInputSelectorClass;
-
-#define GST_INPUT_SELECTOR_GET_LOCK(sel) (((GstInputSelector*)(sel))->lock)
-#define GST_INPUT_SELECTOR_GET_COND(sel) (((GstInputSelector*)(sel))->cond)
-#define GST_INPUT_SELECTOR_LOCK(sel) (g_mutex_lock (GST_INPUT_SELECTOR_GET_LOCK(sel)))
-#define GST_INPUT_SELECTOR_UNLOCK(sel) (g_mutex_unlock (GST_INPUT_SELECTOR_GET_LOCK(sel)))
-#define GST_INPUT_SELECTOR_WAIT(sel) (g_cond_wait (GST_INPUT_SELECTOR_GET_COND(sel), \
- GST_INPUT_SELECTOR_GET_LOCK(sel)))
-#define GST_INPUT_SELECTOR_BROADCAST(sel) (g_cond_broadcast (GST_INPUT_SELECTOR_GET_COND(sel)))
-
-struct _GstInputSelector {
- GstElement element;
-
- GstPad *srcpad;
-
- GstPad *active_sinkpad;
- guint n_pads;
- guint padcount;
-
- GstSegment segment; /* the output segment */
- gboolean pending_close; /* if we should push a close first */
-
- GMutex *lock;
- GCond *cond;
- gboolean blocked;
- gboolean flushing;
-
- /* select all mode, send data from all input pads forward */
- gboolean select_all;
-};
-
-struct _GstInputSelectorClass {
- GstElementClass parent_class;
-
- gint64 (*block) (GstInputSelector *self);
- void (*switch_) (GstInputSelector *self, GstPad *pad,
- gint64 stop_time, gint64 start_time);
-};
-
-GType gst_input_selector_get_type (void);
-GType gst_selector_pad_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_INPUT_SELECTOR_H__ */
diff --git a/gst/playback/gstplay-enum.c b/gst/playback/gstplay-enum.c
deleted file mode 100644
index 60c448c8..00000000
--- a/gst/playback/gstplay-enum.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "gstplay-enum.h"
-
-#define C_ENUM(v) ((gint) v)
-#define C_FLAGS(v) ((guint) v)
-
-static void
-register_gst_autoplug_select_result (GType * id)
-{
- static const GEnumValue values[] = {
- {C_ENUM (GST_AUTOPLUG_SELECT_TRY), "GST_AUTOPLUG_SELECT_TRY", "try"},
- {C_ENUM (GST_AUTOPLUG_SELECT_EXPOSE), "GST_AUTOPLUG_SELECT_EXPOSE",
- "expose"},
- {C_ENUM (GST_AUTOPLUG_SELECT_SKIP), "GST_AUTOPLUG_SELECT_SKIP", "skip"},
- {0, NULL, NULL}
- };
- *id = g_enum_register_static ("GstAutoplugSelectResult", values);
-}
-
-GType
-gst_autoplug_select_result_get_type (void)
-{
- static GType id;
- static GOnce once = G_ONCE_INIT;
-
- g_once (&once, (GThreadFunc) register_gst_autoplug_select_result, &id);
- return id;
-}
-
-static void
-register_gst_play_flags (GType * id)
-{
- static const GFlagsValue values[] = {
- {C_FLAGS (GST_PLAY_FLAG_VIDEO), "Render the video stream", "video"},
- {C_FLAGS (GST_PLAY_FLAG_AUDIO), "Render the audio stream", "audio"},
- {C_FLAGS (GST_PLAY_FLAG_TEXT), "Render subtitles", "text"},
- {C_FLAGS (GST_PLAY_FLAG_VIS),
- "Render visualisation when no video is present", "vis"},
- {C_FLAGS (GST_PLAY_FLAG_SOFT_VOLUME), "Use software volume", "soft-volume"},
- {C_FLAGS (GST_PLAY_FLAG_NATIVE_AUDIO), "Only use native audio formats",
- "native-audio"},
- {C_FLAGS (GST_PLAY_FLAG_NATIVE_VIDEO), "Only use native video formats",
- "native-video"},
- {C_FLAGS (GST_PLAY_FLAG_DOWNLOAD), "Attempt progressive download buffering",
- "download"},
- {C_FLAGS (GST_PLAY_FLAG_BUFFERING), "Buffer demuxed/parsed data",
- "buffering"},
- {0, NULL, NULL}
- };
- *id = g_flags_register_static ("GstPlayFlags", values);
-}
-
-GType
-gst_play_flags_get_type (void)
-{
- static GType id;
- static GOnce once = G_ONCE_INIT;
-
- g_once (&once, (GThreadFunc) register_gst_play_flags, &id);
- return id;
-}
diff --git a/gst/playback/gstplay-enum.h b/gst/playback/gstplay-enum.h
deleted file mode 100644
index 96f271b8..00000000
--- a/gst/playback/gstplay-enum.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_PLAY_ENUM_H__
-#define __GST_PLAY_ENUM_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-/**
- * GstAutoplugSelectResult:
- * @GST_AUTOPLUG_SELECT_TRY: try to autoplug the current factory
- * @GST_AUTOPLUG_SELECT_EXPOSE: expose the pad as a raw stream
- * @GST_AUTOPLUG_SELECT_SKIP: skip the current factory
- *
- * return values for the autoplug-select signal.
- */
-typedef enum {
- GST_AUTOPLUG_SELECT_TRY,
- GST_AUTOPLUG_SELECT_EXPOSE,
- GST_AUTOPLUG_SELECT_SKIP
-} GstAutoplugSelectResult;
-
-#define GST_TYPE_AUTOPLUG_SELECT_RESULT (gst_autoplug_select_result_get_type())
-GType gst_autoplug_select_result_get_type (void);
-
-/**
- * GstPlayFlags:
- * @GST_PLAY_FLAG_VIDEO: Enable rendering of the video stream
- * @GST_PLAY_FLAG_AUDIO: Enable rendering of the audio stream
- * @GST_PLAY_FLAG_TEXT: Enable rendering of subtitles
- * @GST_PLAY_FLAG_VIS: Enable rendering of visualisations when there is
- * no video stream.
- * @GST_PLAY_FLAG_SOFT_VOLUME: Use software volume
- * @GST_PLAY_FLAG_NATIVE_AUDIO: only allow native audio formats, this omits
- * configuration of audioconvert and audioresample.
- * @GST_PLAY_FLAG_NATIVE_VIDEO: only allow native video formats, this omits
- * configuration of ffmpegcolorspace and videoscale.
- * @GST_PLAY_FLAG_DOWNLOAD: enable progressice download buffering for selected
- * formats.
- * @GST_PLAY_FLAG_BUFFERING: enable buffering of the demuxed or parsed data.
- *
- * Extra flags to configure the behaviour of the sinks.
- */
-typedef enum {
- GST_PLAY_FLAG_VIDEO = (1 << 0),
- GST_PLAY_FLAG_AUDIO = (1 << 1),
- GST_PLAY_FLAG_TEXT = (1 << 2),
- GST_PLAY_FLAG_VIS = (1 << 3),
- GST_PLAY_FLAG_SOFT_VOLUME = (1 << 4),
- GST_PLAY_FLAG_NATIVE_AUDIO = (1 << 5),
- GST_PLAY_FLAG_NATIVE_VIDEO = (1 << 6),
- GST_PLAY_FLAG_DOWNLOAD = (1 << 7),
- GST_PLAY_FLAG_BUFFERING = (1 << 8)
-} GstPlayFlags;
-
-#define GST_TYPE_PLAY_FLAGS (gst_play_flags_get_type())
-GType gst_play_flags_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_PLAY_ENUM_H__ */
diff --git a/gst/playback/gstplay-marshal.list b/gst/playback/gstplay-marshal.list
deleted file mode 100644
index c07fdce7..00000000
--- a/gst/playback/gstplay-marshal.list
+++ /dev/null
@@ -1,12 +0,0 @@
-BOOLEAN:OBJECT,BOXED
-BOOLEAN:OBJECT,OBJECT,OBJECT
-BOXED:OBJECT,BOXED
-VOID:OBJECT,BOOLEAN
-ENUM:OBJECT,OBJECT,BOXED
-ENUM:OBJECT,BOXED,OBJECT
-BOXED:OBJECT,BOXED,BOXED
-BOXED:INT
-OBJECT:BOXED
-OBJECT:INT
-INT64:VOID
-VOID:OBJECT,INT64,INT64
diff --git a/gst/playback/gstplayback.c b/gst/playback/gstplayback.c
deleted file mode 100644
index a4db4241..00000000
--- a/gst/playback/gstplayback.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <gst/gst.h>
-
-#include <gst/gst-i18n-plugin.h>
-#include <gst/pbutils/pbutils.h>
-
-#include "gststreamselector.h"
-#include "gststreaminfo.h"
-#include "gstplaysink.h"
-#include "gstsubtitleoverlay.h"
-
-gboolean gst_play_bin_plugin_init (GstPlugin * plugin);
-gboolean gst_play_bin2_plugin_init (GstPlugin * plugin);
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- gboolean res;
-
- gst_pb_utils_init ();
-
-#ifdef ENABLE_NLS
- GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
- LOCALEDIR);
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif /* ENABLE_NLS */
-
- /* ref class from a thread-safe context to work around missing bit of
- * thread-safety in GObject */
- g_type_class_ref (GST_TYPE_STREAM_INFO);
- g_type_class_ref (GST_TYPE_STREAM_SELECTOR);
-
- res = gst_play_bin_plugin_init (plugin);
- res &= gst_play_bin2_plugin_init (plugin);
- res &= gst_play_sink_plugin_init (plugin);
- res &= gst_subtitle_overlay_plugin_init (plugin);
-
- return res;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "playback",
- "various playback elements", plugin_init, VERSION, GST_LICENSE,
- GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/playback/gstplaybasebin.c b/gst/playback/gstplaybasebin.c
deleted file mode 100644
index d7dbf2b7..00000000
--- a/gst/playback/gstplaybasebin.c
+++ /dev/null
@@ -1,2816 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst-i18n-plugin.h>
-#include <string.h>
-#include "gstplaybasebin.h"
-#include "gststreamselector.h"
-#include "gstplay-marshal.h"
-
-#include <gst/pbutils/pbutils.h>
-
-GST_DEBUG_CATEGORY_STATIC (gst_play_base_bin_debug);
-#define GST_CAT_DEFAULT gst_play_base_bin_debug
-
-#define DEFAULT_QUEUE_SIZE (3 * GST_SECOND)
-#define DEFAULT_QUEUE_MIN_THRESHOLD ((DEFAULT_QUEUE_SIZE * 30) / 100)
-#define DEFAULT_QUEUE_THRESHOLD ((DEFAULT_QUEUE_SIZE * 95) / 100)
-#define DEFAULT_CONNECTION_SPEED 0
-
-#define GROUP_LOCK(pbb) g_mutex_lock (pbb->group_lock)
-#define GROUP_UNLOCK(pbb) g_mutex_unlock (pbb->group_lock)
-#define GROUP_WAIT(pbb) g_cond_wait (pbb->group_cond, pbb->group_lock)
-#define GROUP_SIGNAL(pbb) g_cond_signal (pbb->group_cond)
-
-/* props */
-enum
-{
- ARG_0,
- ARG_URI,
- ARG_SUBURI,
- ARG_QUEUE_SIZE,
- ARG_QUEUE_THRESHOLD,
- ARG_QUEUE_MIN_THRESHOLD,
- ARG_NSTREAMS,
- ARG_STREAMINFO,
- ARG_STREAMINFO_VALUES,
- ARG_SOURCE,
- ARG_VIDEO,
- ARG_AUDIO,
- ARG_TEXT,
- ARG_SUBTITLE_ENCODING,
- ARG_CONNECTION_SPEED
-};
-
-static void gst_play_base_bin_class_init (GstPlayBaseBinClass * klass);
-static void gst_play_base_bin_init (GstPlayBaseBin * play_base_bin);
-static void gst_play_base_bin_dispose (GObject * object);
-static void gst_play_base_bin_finalize (GObject * object);
-
-static void gst_play_base_bin_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * spec);
-static void gst_play_base_bin_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * spec);
-static void gst_play_base_bin_handle_message_func (GstBin * bin,
- GstMessage * msg);
-
-static GstStateChangeReturn gst_play_base_bin_change_state (GstElement *
- element, GstStateChange transition);
-
-static const GList *gst_play_base_bin_get_streaminfo (GstPlayBaseBin * bin);
-static GValueArray *gst_play_base_bin_get_streaminfo_value_array (GstPlayBaseBin
- * play_base_bin);
-static void preroll_remove_overrun (GstElement * element,
- GstPlayBaseBin * play_base_bin);
-static void queue_remove_probe (GstElement * queue, GstPlayBaseBin
- * play_base_bin);
-
-static GstElement *make_decoder (GstPlayBaseBin * play_base_bin);
-static gboolean has_all_raw_caps (GstPad * pad, gboolean * all_raw);
-
-static gboolean prepare_output (GstPlayBaseBin * play_base_bin);
-static void set_active_source (GstPlayBaseBin * play_base_bin,
- GstStreamType type, gint source_num);
-static gboolean probe_triggered (GstPad * pad, GstEvent * event,
- gpointer user_data);
-static void setup_substreams (GstPlayBaseBin * play_base_bin);
-
-static GstPipelineClass *parent_class;
-
-/*
- * GObject playbasebin wrappers.
- */
-
-GType
-gst_play_base_bin_get_type (void)
-{
- static GType gst_play_base_bin_type = 0;
-
- if (!gst_play_base_bin_type) {
- static const GTypeInfo gst_play_base_bin_info = {
- sizeof (GstPlayBaseBinClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_play_base_bin_class_init,
- NULL,
- NULL,
- sizeof (GstPlayBaseBin),
- 0,
- (GInstanceInitFunc) gst_play_base_bin_init,
- NULL
- };
-
- gst_play_base_bin_type = g_type_register_static (GST_TYPE_PIPELINE,
- "GstPlayBaseBin", &gst_play_base_bin_info, 0);
- }
-
- return gst_play_base_bin_type;
-}
-
-static void
-gst_play_base_bin_class_init (GstPlayBaseBinClass * klass)
-{
- GObjectClass *gobject_klass;
- GstElementClass *gstelement_klass;
- GstBinClass *gstbin_klass;
-
- gobject_klass = (GObjectClass *) klass;
- gstelement_klass = (GstElementClass *) klass;
- gstbin_klass = (GstBinClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_klass->set_property = gst_play_base_bin_set_property;
- gobject_klass->get_property = gst_play_base_bin_get_property;
-
- g_object_class_install_property (gobject_klass, ARG_URI,
- g_param_spec_string ("uri", "URI", "URI of the media to play",
- NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_SUBURI,
- g_param_spec_string ("suburi", ".sub-URI", "Optional URI of a subtitle",
- NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_klass, ARG_QUEUE_SIZE,
- g_param_spec_uint64 ("queue-size", "Queue size",
- "Size of internal queues in nanoseconds", 0, G_MAXINT64,
- DEFAULT_QUEUE_SIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_QUEUE_THRESHOLD,
- g_param_spec_uint64 ("queue-threshold", "Queue threshold",
- "Buffering threshold of internal queues in nanoseconds", 0,
- G_MAXINT64, DEFAULT_QUEUE_THRESHOLD,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_QUEUE_MIN_THRESHOLD,
- g_param_spec_uint64 ("queue-min-threshold", "Queue min threshold",
- "Buffering low threshold of internal queues in nanoseconds", 0,
- G_MAXINT64, DEFAULT_QUEUE_MIN_THRESHOLD,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_klass, ARG_NSTREAMS,
- g_param_spec_int ("nstreams", "NStreams", "number of streams",
- 0, G_MAXINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_STREAMINFO,
- g_param_spec_pointer ("stream-info", "Stream info", "List of streaminfo",
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_STREAMINFO_VALUES,
- g_param_spec_value_array ("stream-info-value-array",
- "StreamInfo GValueArray", "value array of streaminfo",
- g_param_spec_object ("streaminfo", "StreamInfo", "Streaminfo object",
- GST_TYPE_STREAM_INFO, G_PARAM_READABLE),
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_SOURCE,
- g_param_spec_object ("source", "Source", "Source element",
- GST_TYPE_ELEMENT, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_klass, ARG_VIDEO,
- g_param_spec_int ("current-video", "Current video",
- "Currently playing video stream (-1 = none)",
- -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_AUDIO,
- g_param_spec_int ("current-audio", "Current audio",
- "Currently playing audio stream (-1 = none)",
- -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_TEXT,
- g_param_spec_int ("current-text", "Current text",
- "Currently playing text stream (-1 = none)",
- -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_SUBTITLE_ENCODING,
- g_param_spec_string ("subtitle-encoding", "subtitle encoding",
- "Encoding to assume if input subtitles are not in UTF-8 encoding. "
- "If not set, the GST_SUBTITLE_ENCODING environment variable will "
- "be checked for an encoding to use. If that is not set either, "
- "ISO-8859-15 will be assumed.", NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstPlayBaseBin:connection-speed
- *
- * Network connection speed in kbps (0 = unknown)
- * <note><simpara>
- * Since version 0.10.10 in #GstPlayBin, at 0.10.15 moved to #GstPlayBaseBin
- * </simpara></note>
- *
- * Since: 0.10.10
- */
- g_object_class_install_property (gobject_klass, ARG_CONNECTION_SPEED,
- g_param_spec_uint ("connection-speed", "Connection Speed",
- "Network connection speed in kbps (0 = unknown)",
- 0, G_MAXUINT, DEFAULT_CONNECTION_SPEED,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- GST_DEBUG_CATEGORY_INIT (gst_play_base_bin_debug, "playbasebin", 0,
- "playbasebin");
-
- gobject_klass->dispose = gst_play_base_bin_dispose;
- gobject_klass->finalize = gst_play_base_bin_finalize;
-
- gstbin_klass->handle_message =
- GST_DEBUG_FUNCPTR (gst_play_base_bin_handle_message_func);
-
- gstelement_klass->change_state =
- GST_DEBUG_FUNCPTR (gst_play_base_bin_change_state);
-}
-
-static void
-gst_play_base_bin_init (GstPlayBaseBin * play_base_bin)
-{
- play_base_bin->uri = NULL;
- play_base_bin->suburi = NULL;
- play_base_bin->need_rebuild = TRUE;
- play_base_bin->is_stream = FALSE;
- play_base_bin->source = NULL;
- play_base_bin->decoders = NULL;
- play_base_bin->subtitle = NULL;
- play_base_bin->subencoding = NULL;
- play_base_bin->subtitle_elements = NULL;
- play_base_bin->sub_lock = g_mutex_new ();
-
- play_base_bin->group_lock = g_mutex_new ();
- play_base_bin->group_cond = g_cond_new ();
-
- play_base_bin->building_group = NULL;
- play_base_bin->queued_groups = NULL;
-
- play_base_bin->queue_size = DEFAULT_QUEUE_SIZE;
- play_base_bin->queue_threshold = DEFAULT_QUEUE_THRESHOLD;
- play_base_bin->queue_min_threshold = DEFAULT_QUEUE_MIN_THRESHOLD;
- play_base_bin->connection_speed = DEFAULT_CONNECTION_SPEED;
-}
-
-static void
-gst_play_base_bin_dispose (GObject * object)
-{
- GstPlayBaseBin *play_base_bin;
-
- play_base_bin = GST_PLAY_BASE_BIN (object);
- g_free (play_base_bin->uri);
- play_base_bin->uri = NULL;
- g_free (play_base_bin->suburi);
- play_base_bin->suburi = NULL;
- g_free (play_base_bin->subencoding);
- play_base_bin->subencoding = NULL;
- if (play_base_bin->subtitle_elements) {
- g_slist_free (play_base_bin->subtitle_elements);
- play_base_bin->subtitle_elements = NULL;
- }
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_play_base_bin_finalize (GObject * object)
-{
- GstPlayBaseBin *play_base_bin = GST_PLAY_BASE_BIN (object);
-
- g_mutex_free (play_base_bin->group_lock);
- g_cond_free (play_base_bin->group_cond);
-
- g_mutex_free (play_base_bin->sub_lock);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/*
- * playbasebingroup stuff.
- */
-
-static GstPlayBaseGroup *
-group_create (GstPlayBaseBin * play_base_bin)
-{
- GstPlayBaseGroup *group;
-
- group = g_new0 (GstPlayBaseGroup, 1);
- group->bin = play_base_bin;
- group->streaminfo_value_array = g_value_array_new (0);
-
- GST_DEBUG_OBJECT (play_base_bin, "created new group %p", group);
-
- return group;
-}
-
-/*
- * Gets the currently playing group.
- *
- * Callers must have group-lock held when calling this.
- */
-
-static GstPlayBaseGroup *
-get_active_group (GstPlayBaseBin * play_base_bin)
-{
- GstPlayBaseGroup *group = NULL;
-
- if (play_base_bin->queued_groups)
- group = play_base_bin->queued_groups->data;
-
- return group;
-}
-
-/*
- * get the group used for discovering the different streams.
- * This function creates a group is there is none.
- *
- * Callers must have group-lock held when calling this.
- */
-static GstPlayBaseGroup *
-get_building_group (GstPlayBaseBin * play_base_bin)
-{
- GstPlayBaseGroup *group;
-
- group = play_base_bin->building_group;
- if (group == NULL) {
- group = group_create (play_base_bin);
- play_base_bin->building_group = group;
- }
-
- return group;
-}
-
-/*
- * Callers must have lock held when calling this!
- */
-
-static void
-group_destroy (GstPlayBaseGroup * group)
-{
- GstPlayBaseBin *play_base_bin = group->bin;
- gint n;
-
- GST_LOG ("removing group %p", group);
-
- /* remove the preroll queues */
- for (n = 0; n < NUM_TYPES; n++) {
- GstElement *element = group->type[n].preroll;
- GstElement *fakesrc;
- GstElement *sel;
- const GList *item;
-
- if (!element)
- continue;
-
- sel = group->type[n].selector;
-
- /* remove any fakesrc elements for this preroll element */
- for (item = sel->pads; item != NULL; item = item->next) {
- GstPad *pad = GST_PAD (item->data);
- guint sig_id;
-
- if (GST_PAD_DIRECTION (pad) != GST_PAD_SINK)
- continue;
-
- sig_id =
- GPOINTER_TO_INT (g_object_get_data (G_OBJECT (pad), "unlinked_id"));
-
- if (sig_id != 0) {
- GST_LOG ("removing unlink signal %s:%s", GST_DEBUG_PAD_NAME (pad));
- g_signal_handler_disconnect (G_OBJECT (pad), sig_id);
- g_object_set_data (G_OBJECT (pad), "unlinked_id", GINT_TO_POINTER (0));
- }
-
- fakesrc = (GstElement *) g_object_get_data (G_OBJECT (pad), "fakesrc");
- if (fakesrc != NULL) {
- GST_LOG ("removing fakesrc from %s:%s",
- GST_PAD_NAME (pad), GST_ELEMENT_NAME (GST_PAD_PARENT (pad)));
- gst_element_set_state (fakesrc, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (play_base_bin), fakesrc);
- }
- }
-
- /* if the group is currently being played, we have to remove the element
- * from the thread */
- gst_element_set_state (element, GST_STATE_NULL);
- gst_element_set_state (group->type[n].selector, GST_STATE_NULL);
-
- GST_LOG ("removing preroll element %s", GST_ELEMENT_NAME (element));
-
- gst_bin_remove (group->type[n].bin, element);
- gst_bin_remove (group->type[n].bin, group->type[n].selector);
-
- group->type[n].preroll = NULL;
- group->type[n].selector = NULL;
- group->type[n].bin = NULL;
- }
-
- /* free the streaminfo too */
- g_list_foreach (group->streaminfo, (GFunc) g_object_unref, NULL);
- g_list_free (group->streaminfo);
- g_value_array_free (group->streaminfo_value_array);
- g_free (group);
-}
-
-/*
- * is called when the current building group is completely finished
- * and ready for playback
- *
- * This function grabs lock, so take care when calling.
- */
-static void
-group_commit (GstPlayBaseBin * play_base_bin, gboolean fatal, gboolean subtitle)
-{
- GstPlayBaseGroup *group;
- gboolean had_active_group;
- gboolean res;
-
- GROUP_LOCK (play_base_bin);
- group = play_base_bin->building_group;
- had_active_group = (get_active_group (play_base_bin) != NULL);
-
- GST_DEBUG_OBJECT (play_base_bin, "commit group %p, had active %d",
- group, had_active_group);
-
- /* if an element signalled a no-more-pads after we stopped due
- * to preroll, the group is NULL. This is not an error */
- if (group == NULL) {
- if (!fatal) {
- GROUP_UNLOCK (play_base_bin);
- return;
- } else {
- GST_DEBUG_OBJECT (play_base_bin, "Group loading failed, bailing out");
- }
- } else {
- if (!subtitle) {
- gint n;
-
- GST_DEBUG_OBJECT (play_base_bin, "group %p done", group);
-
- play_base_bin->queued_groups =
- g_list_append (play_base_bin->queued_groups, group);
-
- play_base_bin->building_group = NULL;
-
- /* remove signals. We don't want anymore signals from the preroll
- * elements at this stage. */
- for (n = 0; n < NUM_TYPES; n++) {
- GstElement *element = group->type[n].preroll;
-
- if (!element)
- continue;
-
- preroll_remove_overrun (element, play_base_bin);
- /* if overrun is removed, probe alse has to be removed */
- queue_remove_probe (element, play_base_bin);
- }
- } else {
- /* this is a special subtitle bin, we don't commit the group but
- * mark the subtitles as detected before we signal. */
- GST_DEBUG_OBJECT (play_base_bin, "marking subtitle bin as complete");
- play_base_bin->subtitle_done = TRUE;
- }
- }
-
- GST_DEBUG_OBJECT (play_base_bin, "signal group done");
- GROUP_SIGNAL (play_base_bin);
- GST_DEBUG_OBJECT (play_base_bin, "signaled group done");
-
- if (!subtitle && !had_active_group) {
- if (!prepare_output (play_base_bin)) {
- GROUP_UNLOCK (play_base_bin);
- return;
- }
-
- setup_substreams (play_base_bin);
- GST_DEBUG_OBJECT (play_base_bin, "Emitting signal");
- res =
- GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin)->setup_output_pads
- (play_base_bin, group);
- GST_DEBUG_OBJECT (play_base_bin, "done");
-
- GROUP_UNLOCK (play_base_bin);
-
- g_object_notify (G_OBJECT (play_base_bin), "stream-info");
- } else {
- GROUP_UNLOCK (play_base_bin);
- }
-}
-
-/*
- * check if there are streams in the group that are not muted
- *
- * Callers must have group-lock held when calling this.
- */
-static gboolean
-group_is_muted (GstPlayBaseGroup * group)
-{
- gint n;
-
- for (n = 0; n < NUM_TYPES; n++) {
- if (group->type[n].preroll && !group->type[n].done)
- return FALSE;
- }
-
- return TRUE;
-}
-
-/*
- * Buffer/cache checking.
- */
-
-static inline void
-fill_buffer (GstPlayBaseBin * play_base_bin, gint percent)
-{
- GST_DEBUG_OBJECT (play_base_bin, "buffering %d", percent);
- gst_element_post_message (GST_ELEMENT_CAST (play_base_bin),
- gst_message_new_buffering (GST_OBJECT_CAST (play_base_bin), percent));
-}
-
-static gboolean
-check_queue_event (GstPad * pad, GstEvent * event, gpointer user_data)
-{
- GstElement *queue = GST_ELEMENT_CAST (user_data);
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_EOS:
- GST_DEBUG ("EOS event, mark EOS");
- g_object_set_data (G_OBJECT (queue), "eos", "1");
- break;
- case GST_EVENT_FLUSH_STOP:
- GST_DEBUG ("FLUSH_STOP event, remove EOS");
- g_object_set_data (G_OBJECT (queue), "eos", NULL);
- break;
- default:
- GST_DEBUG ("uninteresting event %s", GST_EVENT_TYPE_NAME (event));
- break;
- }
- return TRUE;
-}
-
-static gboolean
-check_queue (GstPad * pad, GstBuffer * data, gpointer user_data)
-{
- GstElement *queue = GST_ELEMENT_CAST (user_data);
- GstPlayBaseBin *play_base_bin = g_object_get_data (G_OBJECT (queue), "pbb");
- guint64 level = 0;
-
- GST_DEBUG_OBJECT (queue, "check queue triggered");
-
- g_object_get (G_OBJECT (queue), "current-level-time", &level, NULL);
- GST_DEBUG_OBJECT (play_base_bin, "Queue size: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (level));
-
- if (play_base_bin->queue_threshold > 0) {
- level = level * 99 / play_base_bin->queue_threshold;
- if (level > 99)
- level = 99;
- } else
- level = 99;
-
- fill_buffer (play_base_bin, level);
-
- /* continue! */
- return TRUE;
-}
-
-/* If a queue overruns and we are buffer in streaming mode (we have a min-time)
- * we can potentially create a deadlock when:
- *
- * 1) the max-bytes is hit and
- * 2) the min-time is not hit.
- *
- * We recover from this situation in this callback by
- * setting the max-bytes to unlimited if we see that there is
- * a current-time-level (which means some sort of timestamping is
- * done).
- */
-static void
-queue_deadlock_check (GstElement * queue, GstPlayBaseBin * play_base_bin)
-{
- guint64 time, min_time;
- guint bytes;
-
- GST_DEBUG_OBJECT (play_base_bin, "overrun signal received from queue %s",
- GST_ELEMENT_NAME (queue));
-
- /* figure out where we are */
- g_object_get (G_OBJECT (queue), "current-level-time", &time,
- "current-level-bytes", &bytes, "min-threshold-time", &min_time, NULL);
-
- GST_DEBUG_OBJECT (play_base_bin, "streaming mode, queue %s current %"
- GST_TIME_FORMAT ", min %" GST_TIME_FORMAT
- ", bytes %d", GST_ELEMENT_NAME (queue),
- GST_TIME_ARGS (time), GST_TIME_ARGS (min_time), bytes);
-
- /* if the bytes in the queue represent time, we disable bytes
- * overrun checking to not cause deadlocks.
- */
- if (bytes && time != 0 && time < min_time) {
- GST_DEBUG_OBJECT (play_base_bin,
- "possible deadlock found, removing byte limit");
-
- /* queue knows about time but is filled with bytes that do
- * not represent min-threshold time, disable bytes checking so
- * the queue can grow some more. */
- g_object_set (G_OBJECT (queue), "max-size-bytes", 0, NULL);
-
- /* bytes limit is removed, we cannot deadlock anymore */
- g_signal_handlers_disconnect_by_func (queue,
- (gpointer) queue_deadlock_check, play_base_bin);
- } else {
- GST_DEBUG_OBJECT (play_base_bin, "no deadlock");
- }
-}
-
-static void
-queue_remove_probe (GstElement * queue, GstPlayBaseBin * play_base_bin)
-{
- gpointer data;
- GstPad *sinkpad;
-
- data = g_object_get_data (G_OBJECT (queue), "probe");
- sinkpad = gst_element_get_static_pad (queue, "sink");
-
- if (data) {
- GST_DEBUG_OBJECT (play_base_bin,
- "Removing buffer probe from pad %s:%s (%p)",
- GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
-
- g_object_set_data (G_OBJECT (queue), "probe", NULL);
- gst_pad_remove_buffer_probe (sinkpad, GPOINTER_TO_INT (data));
- } else {
- GST_DEBUG_OBJECT (play_base_bin,
- "No buffer probe to remove from %s:%s (%p)",
- GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
- }
- gst_object_unref (sinkpad);
-}
-
-/* Used for time-based buffering in streaming mode and is called when a queue
- * emits the running signal. This means that the high watermark threshold is
- * reached and the buffering is completed. */
-static void
-queue_threshold_reached (GstElement * queue, GstPlayBaseBin * play_base_bin)
-{
- GstPlayBaseGroup *group;
- gpointer data;
- gint n;
-
- GST_DEBUG_OBJECT (play_base_bin, "running signal received from queue %s",
- GST_ELEMENT_NAME (queue));
-
- /* we disconnect the signal so that we don't get called for every buffer. */
- g_signal_handlers_disconnect_by_func (queue,
- (gpointer) queue_threshold_reached, play_base_bin);
-
- data = g_object_get_data (G_OBJECT (queue), "eos");
- if (data) {
- GST_DEBUG_OBJECT (play_base_bin, "disable min threshold time, we are EOS");
- g_object_set (queue, "min-threshold-time", (guint64) 0, NULL);
- } else {
- /* now place the limits at the low threshold. When we hit this limit, the
- * underrun signal will be called. The underrun signal is always connected. */
- GST_DEBUG_OBJECT (play_base_bin,
- "setting min threshold time to %" G_GUINT64_FORMAT,
- play_base_bin->queue_min_threshold);
- g_object_set (queue, "min-threshold-time",
- play_base_bin->queue_min_threshold, NULL);
- }
-
- GROUP_LOCK (play_base_bin);
- group = get_active_group (play_base_bin);
- if (!group) {
- GROUP_UNLOCK (play_base_bin);
- return;
- }
-
- /* we remove the probe now because we don't need it anymore to give progress
- * about the buffering. */
- for (n = 0; n < NUM_TYPES; n++) {
- GstElement *element = group->type[n].preroll;
-
- if (!element)
- continue;
-
- queue_remove_probe (element, play_base_bin);
- }
-
- GROUP_UNLOCK (play_base_bin);
-
- /* we post a 100% buffering message to notify the app that buffering is
- * completed and playback can start/continue */
- if (play_base_bin->is_stream)
- fill_buffer (play_base_bin, 100);
-}
-
-/* this signal will be fired when one of the queues with raw
- * data is filled. This means that the group building stage is over
- * and playback of the new queued group should start. This is a rather unusual
- * situation because normally the group is commited when the "no_more_pads"
- * signal is fired.
- */
-static void
-queue_overrun (GstElement * queue, GstPlayBaseBin * play_base_bin)
-{
- GST_DEBUG_OBJECT (play_base_bin, "queue %s overrun",
- GST_ELEMENT_NAME (queue));
-
- preroll_remove_overrun (queue, play_base_bin);
-
- group_commit (play_base_bin, FALSE,
- GST_OBJECT_PARENT (GST_OBJECT_CAST (queue)) ==
- GST_OBJECT_CAST (play_base_bin->subtitle));
-
- /* notify end of buffering */
- queue_threshold_reached (queue, play_base_bin);
-}
-
-/* this signal is only added when in streaming mode to catch underruns
- */
-static void
-queue_out_of_data (GstElement * queue, GstPlayBaseBin * play_base_bin)
-{
- GST_DEBUG_OBJECT (play_base_bin, "underrun signal received from queue %s",
- GST_ELEMENT_NAME (queue));
-
- /* On underrun, we want to temoprarily pause playback, set a "min-size"
- * threshold and wait for the running signal and then play again.
- *
- * This signal could never be called because the queue max-size limits are set
- * too low. We take care of this possible deadlock in the the overrun signal
- * handler. */
- g_signal_connect (G_OBJECT (queue), "pushing",
- G_CALLBACK (queue_threshold_reached), play_base_bin);
- GST_DEBUG_OBJECT (play_base_bin,
- "setting min threshold time to %" G_GUINT64_FORMAT,
- (guint64) play_base_bin->queue_threshold);
- g_object_set (queue, "min-threshold-time",
- (guint64) play_base_bin->queue_threshold, NULL);
-
- /* re-connect probe, this will fire feedback about the percentage that we
- * buffered and is posted in the BUFFERING message. */
- if (!g_object_get_data (G_OBJECT (queue), "probe")) {
- GstPad *sinkpad;
- guint id;
-
- sinkpad = gst_element_get_static_pad (queue, "sink");
- id = gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), queue);
- g_object_set_data (G_OBJECT (queue), "probe", GINT_TO_POINTER (id));
- GST_DEBUG_OBJECT (play_base_bin,
- "Re-attaching buffering probe to pad %s:%s %p",
- GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
- gst_object_unref (sinkpad);
-
- fill_buffer (play_base_bin, 0);
- }
-}
-
-/*
- * generate a preroll element which is simply a queue. While there
- * are still dynamic elements in the pipeline, we wait for one
- * of the queues to fill. The assumption is that all the dynamic
- * streams will be detected by that time.
- *
- * Callers must have the group-lock held when calling this.
- */
-static void
-gen_preroll_element (GstPlayBaseBin * play_base_bin,
- GstPlayBaseGroup * group, GstStreamType type, GstPad * pad,
- GstStreamInfo * info)
-{
- GstElement *selector, *preroll;
- gchar *name, *padname;
- const gchar *prename;
- guint overrun_sig;
- GstPad *preroll_pad;
- GstBin *target;
- GstState state;
-
- if (type == GST_STREAM_TYPE_VIDEO)
- prename = "video";
- else if (type == GST_STREAM_TYPE_TEXT)
- prename = "text";
- else if (type == GST_STREAM_TYPE_AUDIO)
- prename = "audio";
- else if (type == GST_STREAM_TYPE_SUBPICTURE)
- prename = "subpicture";
- else
- g_return_if_reached ();
-
- /* create stream selector */
- selector = g_object_new (GST_TYPE_STREAM_SELECTOR, NULL);
- padname = gst_pad_get_name (pad);
- name = g_strdup_printf ("selector_%s_%s", prename, padname);
- gst_object_set_name (GST_OBJECT_CAST (selector), name);
- g_free (name);
-
- /* create preroll queue */
- name = g_strdup_printf ("preroll_%s_%s", prename, padname);
- preroll = gst_element_factory_make ("queue", name);
- g_free (name);
- g_free (padname);
-
- /* for buffering of raw data we ideally want to buffer a
- * very small amount of buffers since the memory used by
- * this raw data can be enormously huge.
- *
- * We use an upper limit of typically a few seconds here but
- * cap in case no timestamps are set on the raw data (bad!).
- *
- * FIXME: we abuse this buffer to do network buffering since
- * we can then easily do time-based buffering. The better
- * solution would be to add a specific network queue right
- * after the source that measures the datarate and scales this
- * queue of encoded data instead.
- */
- if (play_base_bin->raw_decoding_mode) {
- if (type == GST_STREAM_TYPE_VIDEO) {
- g_object_set (G_OBJECT (preroll),
- "max-size-buffers", 2, "max-size-bytes", 0,
- "max-size-time", (guint64) 0, NULL);
- } else {
- g_object_set (G_OBJECT (preroll),
- "max-size-buffers", 0, "max-size-bytes",
- 2 * 1024 * 1024, "max-size-time", play_base_bin->queue_size, NULL);
- }
- } else {
- g_object_set (G_OBJECT (preroll),
- "max-size-buffers", 0, "max-size-bytes",
- ((type == GST_STREAM_TYPE_VIDEO) ? 25 : 2) * 1024 * 1024,
- "max-size-time", play_base_bin->queue_size, NULL);
- }
-
- /* the overrun signal is always attached and serves two purposes:
- *
- * 1) when we are building a group and the overrun is called, we commit the
- * group. The reason being that if we fill the entire queue without a
- * normal group commit (with _no_more_pads()) we can assume the
- * audio/video is completely wacked or the element just does not know when
- * it is ready with all the pads (mpeg).
- * 2) When we are doing network buffering, we keep track of low/high
- * watermarks in the queue. It is possible that we set the high watermark
- * higher than the max-size limits to trigger an overrun. In this case we
- * will never get a running signal but we can use the overrun signal to
- * detect this deadlock and correct it.
- */
- overrun_sig = g_signal_connect (G_OBJECT (preroll), "overrun",
- G_CALLBACK (queue_overrun), play_base_bin);
-
- /* keep a ref to the signal id so that we can disconnect the signal callback
- * when we are done with the preroll */
- g_object_set_data (G_OBJECT (preroll), "overrun_signal_id",
- GINT_TO_POINTER (overrun_sig));
-
- if (play_base_bin->is_stream &&
- ((type == GST_STREAM_TYPE_VIDEO &&
- group->type[GST_STREAM_TYPE_AUDIO - 1].npads == 0) ||
- (type == GST_STREAM_TYPE_AUDIO &&
- group->type[GST_STREAM_TYPE_VIDEO - 1].npads == 0))) {
- GstPad *sinkpad;
- guint id;
-
- /* catch deadlocks when we are network buffering in time but the max-limit
- * in bytes is hit. */
- g_signal_connect (G_OBJECT (preroll), "overrun",
- G_CALLBACK (queue_deadlock_check), play_base_bin);
-
- /* attach pointer to playbasebin */
- g_object_set_data (G_OBJECT (preroll), "pbb", play_base_bin);
-
- /* give updates on queue size */
- sinkpad = gst_element_get_static_pad (preroll, "sink");
- id = gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), preroll);
- GST_DEBUG_OBJECT (play_base_bin, "Attaching probe to pad %s:%s (%p)",
- GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
- g_object_set_data (G_OBJECT (preroll), "probe", GINT_TO_POINTER (id));
-
- /* catch eos and flush events so that we can ignore underruns */
- id = gst_pad_add_event_probe (sinkpad, G_CALLBACK (check_queue_event),
- preroll);
- g_object_set_data (G_OBJECT (preroll), "eos_probe", GINT_TO_POINTER (id));
-
- gst_object_unref (sinkpad);
-
- /* When we connect this queue, it will start running and immediatly
- * fire an underrun. */
- g_signal_connect (G_OBJECT (preroll), "underrun",
- G_CALLBACK (queue_out_of_data), play_base_bin);
- /* configure threshold and callbacks */
- queue_out_of_data (preroll, play_base_bin);
- }
-
- /* listen for EOS so we can switch groups when one ended. */
- preroll_pad = gst_element_get_static_pad (preroll, "src");
- gst_pad_add_event_probe (preroll_pad, G_CALLBACK (probe_triggered), info);
- gst_object_unref (preroll_pad);
-
- /* add to group list */
- group->type[type - 1].selector = selector;
- group->type[type - 1].preroll = preroll;
-
- /* figure out where the preroll element should go */
- if (type == GST_STREAM_TYPE_TEXT && play_base_bin->subtitle)
- target = GST_BIN_CAST (play_base_bin->subtitle);
- else
- target = GST_BIN_CAST (play_base_bin);
-
- group->type[type - 1].bin = target;
- gst_bin_add (target, selector);
- gst_bin_add (target, preroll);
-
- gst_element_link (selector, preroll);
-
- /* figure out target state and set */
- state = (GST_STATE (play_base_bin) == GST_STATE_PLAYING ?
- GST_STATE_PLAYING : GST_STATE_PAUSED);
-
- gst_element_set_state (selector, state);
- gst_element_set_state (preroll, state);
-}
-
-static void
-preroll_remove_overrun (GstElement * element, GstPlayBaseBin * play_base_bin)
-{
- guint overrun_sig;
- GObject *obj = G_OBJECT (element);
-
- overrun_sig = GPOINTER_TO_INT (g_object_get_data (obj, "overrun_signal_id"));
- if (overrun_sig) {
- GST_LOG_OBJECT (play_base_bin, "removing preroll signal %s",
- GST_ELEMENT_NAME (element));
- g_signal_handler_disconnect (obj, overrun_sig);
- /* We have disconnected this signal, remove the signal_id from the object
- * data */
- g_object_set_data (obj, "overrun_signal_id", NULL);
- }
-}
-
-static void
-remove_groups (GstPlayBaseBin * play_base_bin)
-{
- GROUP_LOCK (play_base_bin);
-
- /* first destroy the group we were building if any */
- if (play_base_bin->building_group) {
- group_destroy (play_base_bin->building_group);
- play_base_bin->building_group = NULL;
- }
-
- /* remove the queued groups */
- g_list_foreach (play_base_bin->queued_groups, (GFunc) group_destroy, NULL);
- g_list_free (play_base_bin->queued_groups);
- play_base_bin->queued_groups = NULL;
-
- /* clear subs */
- if (play_base_bin->subtitle) {
- gst_element_set_state (play_base_bin->subtitle, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (play_base_bin), play_base_bin->subtitle);
- play_base_bin->subtitle = NULL;
- }
-
- GROUP_UNLOCK (play_base_bin);
-}
-
-/*
- * Add/remove a single stream to current building group.
- *
- * Must be called with group-lock held.
- */
-static void
-add_stream (GstPlayBaseGroup * group, GstStreamInfo * info)
-{
- GValue v = { 0, };
- GST_DEBUG ("add stream to group %p", group);
-
- /* keep ref to the group */
- g_object_set_data (G_OBJECT (info), "group", group);
-
- g_value_init (&v, G_TYPE_OBJECT);
- g_value_set_object (&v, info);
- g_value_array_append (group->streaminfo_value_array, &v);
- g_value_unset (&v);
- group->streaminfo = g_list_append (group->streaminfo, info);
- if (info->type > 0 && info->type <= NUM_TYPES) {
- group->type[info->type - 1].npads++;
- }
-}
-
-static gboolean
-string_arr_has_str (const gchar * values[], const gchar * value)
-{
- if (values && value) {
- while (*values != NULL) {
- if (strcmp (value, *values) == 0)
- return TRUE;
- ++values;
- }
- }
- return FALSE;
-}
-
-/* mime types we are not handling on purpose right now, don't post a
- * missing-plugin message for these */
-static const gchar *blacklisted_mimes[] = {
- "video/x-dvd-subpicture", NULL
-};
-
-#define IS_BLACKLISTED_MIME(type) (string_arr_has_str(blacklisted_mimes,type))
-
-static void
-gst_play_base_bin_handle_message_func (GstBin * bin, GstMessage * msg)
-{
- if (gst_is_missing_plugin_message (msg)) {
- gchar *detail;
- guint i;
-
- detail = gst_missing_plugin_message_get_installer_detail (msg);
- for (i = 0; detail != NULL && blacklisted_mimes[i] != NULL; ++i) {
- if (strstr (detail, "|decoder-") && strstr (detail, blacklisted_mimes[i])) {
- GST_LOG_OBJECT (bin, "suppressing message %" GST_PTR_FORMAT, msg);
- gst_message_unref (msg);
- g_free (detail);
- return;
- }
- }
- g_free (detail);
- }
- GST_BIN_CLASS (parent_class)->handle_message (bin, msg);
-}
-
-/*
- * signal fired when an unknown stream is found. We create a new
- * UNKNOWN streaminfo object.
- */
-static void
-unknown_type (GstElement * element, GstPad * pad, GstCaps * caps,
- GstPlayBaseBin * play_base_bin)
-{
- const gchar *type_name;
- GstStreamInfo *info;
- GstPlayBaseGroup *group;
-
- type_name = gst_structure_get_name (gst_caps_get_structure (caps, 0));
- if (type_name && !IS_BLACKLISTED_MIME (type_name)) {
- gchar *capsstr;
-
- capsstr = gst_caps_to_string (caps);
- GST_DEBUG_OBJECT (play_base_bin, "don't know how to handle %s", capsstr);
- /* FIXME, g_message() ? */
- g_message ("don't know how to handle %s", capsstr);
- g_free (capsstr);
- } else {
- /* don't spew stuff to the terminal or send message if it's blacklisted */
- GST_DEBUG_OBJECT (play_base_bin, "media type %s not handled on purpose, "
- "not posting a missing-plugin message on the bus", type_name);
- }
-
- GROUP_LOCK (play_base_bin);
-
- group = get_building_group (play_base_bin);
-
- /* add the stream to the list */
- info = gst_stream_info_new (GST_OBJECT_CAST (pad), GST_STREAM_TYPE_UNKNOWN,
- NULL, caps);
- info->origin = GST_OBJECT_CAST (pad);
- add_stream (group, info);
-
- GROUP_UNLOCK (play_base_bin);
-}
-
-/* add a streaminfo that indicates that the stream is handled by the
- * given element. This usually means that a stream without actual data is
- * produced but one that is sunken by an element. Examples of this are:
- * cdaudio, a hardware decoder/sink, dvd meta bins etc...
- */
-static void
-add_element_stream (GstElement * element, GstPlayBaseBin * play_base_bin)
-{
- GstStreamInfo *info;
- GstPlayBaseGroup *group;
-
- GROUP_LOCK (play_base_bin);
-
- group = get_building_group (play_base_bin);
-
- /* add the stream to the list */
- info =
- gst_stream_info_new (GST_OBJECT_CAST (element), GST_STREAM_TYPE_ELEMENT,
- NULL, NULL);
- info->origin = GST_OBJECT_CAST (element);
- add_stream (group, info);
-
- GROUP_UNLOCK (play_base_bin);
-}
-
-/* when the decoder element signals that no more pads will be generated, we
- * can commit the current group.
- */
-static void
-no_more_pads_full (GstElement * element, gboolean subs,
- GstPlayBaseBin * play_base_bin)
-{
- /* setup phase */
- GST_DEBUG_OBJECT (element, "no more pads, %d pending",
- play_base_bin->pending);
-
- /* nothing pending, we can exit */
- if (play_base_bin->pending == 0)
- return;
-
- /* the object has no pending no_more_pads */
- if (!g_object_get_data (G_OBJECT (element), "pending"))
- return;
-
- g_object_set_data (G_OBJECT (element), "pending", NULL);
-
- play_base_bin->pending--;
-
- GST_DEBUG_OBJECT (element, "remove pending, now %d pending",
- play_base_bin->pending);
-
- if (play_base_bin->pending == 0) {
- /* we can commit this group for playback now */
- group_commit (play_base_bin, play_base_bin->is_stream, subs);
- }
-}
-
-static void
-no_more_pads (GstElement * element, GstPlayBaseBin * play_base_bin)
-{
- no_more_pads_full (element, FALSE, play_base_bin);
-}
-
-static void
-sub_no_more_pads (GstElement * element, GstPlayBaseBin * play_base_bin)
-{
- no_more_pads_full (element, TRUE, play_base_bin);
-}
-
-static void
-source_no_more_pads (GstElement * element, GstPlayBaseBin * bin)
-{
- GST_DEBUG_OBJECT (bin, "No more pads in source element %s.",
- GST_ELEMENT_NAME (element));
-
- g_signal_handler_disconnect (G_OBJECT (element), bin->src_np_sig_id);
- bin->src_np_sig_id = 0;
- g_signal_handler_disconnect (G_OBJECT (element), bin->src_nmp_sig_id);
- bin->src_nmp_sig_id = 0;
-
- no_more_pads_full (element, FALSE, bin);
-}
-
-static gboolean
-probe_triggered (GstPad * pad, GstEvent * event, gpointer user_data)
-{
- GstPlayBaseGroup *group;
- GstPlayBaseBin *play_base_bin;
- GstStreamInfo *info;
- gboolean res;
- GstEventType type;
-
- type = GST_EVENT_TYPE (event);
-
- GST_LOG ("probe triggered, (%d) %s", type, gst_event_type_get_name (type));
-
- /* we only care about EOS */
- if (type != GST_EVENT_EOS)
- return TRUE;
-
- info = GST_STREAM_INFO (user_data);
- group = (GstPlayBaseGroup *) g_object_get_data (G_OBJECT (info), "group");
- play_base_bin = group->bin;
-
- if (type == GST_EVENT_EOS) {
- gint num_groups = 0;
- gboolean have_left;
-
- GST_DEBUG_OBJECT (play_base_bin, "probe got EOS in group %p", group);
-
- GROUP_LOCK (play_base_bin);
-
- /* mute this stream */
- g_object_set (G_OBJECT (info), "mute", TRUE, NULL);
- if (info->type > 0 && info->type <= NUM_TYPES)
- group->type[info->type - 1].done = TRUE;
-
- /* see if we have some more groups left to play */
- num_groups = g_list_length (play_base_bin->queued_groups);
- if (play_base_bin->building_group)
- num_groups++;
- have_left = (num_groups > 1);
-
- /* see if the complete group is muted */
- if (!group_is_muted (group)) {
- /* group is not completely muted, we remove the EOS event
- * and continue, eventually the other streams will be EOSed and
- * we can switch out this group. */
- GST_DEBUG ("group %p not completely muted", group);
-
- GROUP_UNLOCK (play_base_bin);
-
- /* remove the EOS if we have something left */
- return !have_left;
- }
-
- if (have_left) {
- /* ok, get rid of the current group then */
- //group_destroy (group);
- /* removing the current group brings the next group
- * active */
- play_base_bin->queued_groups =
- g_list_remove (play_base_bin->queued_groups, group);
- /* and wait for the next one to be ready */
- while (!play_base_bin->queued_groups) {
- GROUP_WAIT (play_base_bin);
- }
- group = play_base_bin->queued_groups->data;
-
- /* now activate the next one */
- setup_substreams (play_base_bin);
- GST_DEBUG ("switching to next group %p - emitting signal", group);
- /* and signal the new group */
- res =
- GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin)->setup_output_pads
- (play_base_bin, group);
-
- GROUP_UNLOCK (play_base_bin);
-
- g_object_notify (G_OBJECT (play_base_bin), "stream-info");
-
- /* get rid of the EOS event */
- return FALSE;
- } else {
- GROUP_UNLOCK (play_base_bin);
- GST_LOG ("Last group done, EOS");
- }
- }
-
- return TRUE;
-}
-
-/* This function will be called when the sinkpad of the preroll element
- * is unlinked, we have to connect something to the sinkpad or else the
- * state change will fail..
- */
-static void
-preroll_unlinked (GstPad * pad, GstPad * peerpad,
- GstPlayBaseBin * play_base_bin)
-{
- GstElement *fakesrc;
- guint sig_id;
- GstPad *srcpad;
-
- /* make a fakesrc that will just emit one EOS */
- fakesrc = gst_element_factory_make ("fakesrc", NULL);
- g_object_set (G_OBJECT (fakesrc), "num-buffers", 0, NULL);
-
- GST_DEBUG ("patching unlinked pad %s:%s", GST_DEBUG_PAD_NAME (pad));
-
- srcpad = gst_element_get_static_pad (fakesrc, "src");
- gst_bin_add (GST_BIN_CAST (play_base_bin), fakesrc);
- gst_pad_link (srcpad, pad);
- gst_object_unref (srcpad);
-
- /* keep track of these patch elements */
- g_object_set_data (G_OBJECT (pad), "fakesrc", fakesrc);
-
- /* now unlink the unlinked signal so that it is not called again when
- * we destroy the queue */
- sig_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (pad), "unlinked_id"));
- if (sig_id != 0) {
- g_signal_handler_disconnect (G_OBJECT (pad), sig_id);
- g_object_set_data (G_OBJECT (pad), "unlinked_id", GINT_TO_POINTER (0));
- }
-}
-
-/* Mute stream on first data - for header-is-in-stream-stuff
- * (vorbis, ogmtext). */
-static gboolean
-mute_stream (GstPad * pad, GstBuffer * buf, gpointer data)
-{
- GstStreamInfo *info = GST_STREAM_INFO (data);
- guint id;
-
- GST_DEBUG ("mute stream triggered");
-
- g_object_set (G_OBJECT (info), "mute", TRUE, NULL);
- id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (info), "mute_probe"));
- g_object_set_data (G_OBJECT (info), "mute_probe", NULL);
- if (id > 0)
- gst_pad_remove_buffer_probe (GST_PAD_CAST (info->object), id);
-
- /* no data */
- return FALSE;
-}
-
-/* Eat data. */
-static gboolean
-silence_stream (GstPad * pad, GstMiniObject * data, gpointer user_data)
-{
- GST_DEBUG ("silence stream triggered");
-
- /* no data */
- return FALSE;
-}
-
-/* Called by the signal handlers when a decodebin (main or subtitle) has
- * found a new raw pad. We create a preroll element if needed and the
- * appropriate streaminfo. Commits the group if there will be no more pads
- * from decodebin */
-static void
-new_decoded_pad_full (GstElement * element, GstPad * pad, gboolean last,
- GstPlayBaseBin * play_base_bin, gboolean is_subs)
-{
- GstStructure *structure;
- const gchar *mimetype;
- GstCaps *caps;
- GstStreamInfo *info;
- GstStreamType type = GST_STREAM_TYPE_UNKNOWN;
- GstPad *sinkpad;
- GstPlayBaseGroup *group;
- guint sig;
- GstObject *parent;
- gboolean first_pad;
-
- GST_DEBUG ("play base: new decoded pad. Last: %d", last);
-
- /* first see if this pad has interesting caps */
- caps = gst_pad_get_caps (pad);
- if (caps == NULL || gst_caps_is_empty (caps) || gst_caps_is_any (caps))
- goto no_type;
-
- /* get the mime type */
- structure = gst_caps_get_structure (caps, 0);
- mimetype = gst_structure_get_name (structure);
-
- GROUP_LOCK (play_base_bin);
-
- group = get_building_group (play_base_bin);
-
- group->nstreams++;
-
- parent = gst_object_get_parent (GST_OBJECT_CAST (element));
- if (g_str_has_prefix (mimetype, "audio/") &&
- parent != GST_OBJECT_CAST (play_base_bin->subtitle)) {
- type = GST_STREAM_TYPE_AUDIO;
- } else if (g_str_has_prefix (mimetype, "video/x-dvd-subpicture") &&
- parent != GST_OBJECT_CAST (play_base_bin->subtitle)) {
- type = GST_STREAM_TYPE_SUBPICTURE;
- } else if (g_str_has_prefix (mimetype, "video/") &&
- parent != GST_OBJECT_CAST (play_base_bin->subtitle)) {
- type = GST_STREAM_TYPE_VIDEO;
- } else if (g_str_has_prefix (mimetype, "text/")) {
- type = GST_STREAM_TYPE_TEXT;
- }
- gst_object_unref (parent);
-
- info = gst_stream_info_new (GST_OBJECT_CAST (pad), type, NULL, caps);
- gst_caps_unref (caps);
-
- if (type == GST_STREAM_TYPE_UNKNOWN) {
- /* Unknown streams get added to the group, but the data
- * just gets ignored */
- add_stream (group, info);
-
- GROUP_UNLOCK (play_base_bin);
-
- /* signal the no more pads after adding the stream */
- if (last)
- no_more_pads_full (element, is_subs, play_base_bin);
-
- return;
- }
-
- /* first pad of each type gets a selector + preroll queue */
- first_pad = (group->type[type - 1].npads == 0);
-
- if (first_pad) {
- GST_DEBUG ("play base: pad needs new preroll");
- gen_preroll_element (play_base_bin, group, type, pad, info);
- }
-
- /* add to stream selector */
- sinkpad =
- gst_element_get_request_pad (group->type[type - 1].selector, "sink%d");
-
- /* make sure we catch unlink signals */
- sig = g_signal_connect (G_OBJECT (sinkpad), "unlinked",
- G_CALLBACK (preroll_unlinked), play_base_bin);
- /* keep a ref to the signal id so that we can disconnect the signal callback */
- g_object_set_data (G_OBJECT (sinkpad), "unlinked_id", GINT_TO_POINTER (sig));
- /* Store a pointer to the stream selector pad for this stream */
- g_object_set_data (G_OBJECT (pad), "pb_sel_pad", sinkpad);
-
- gst_pad_link (pad, sinkpad);
- gst_object_unref (sinkpad);
-
- /* select 1st for now - we'll select a preferred one after preroll */
- if (!first_pad) {
- guint id;
-
- GST_DEBUG ("Adding silence_stream data probe on type %d (npads %d)", type,
- group->type[type - 1].npads);
-
- id = gst_pad_add_data_probe (GST_PAD_CAST (pad),
- G_CALLBACK (silence_stream), info);
- g_object_set_data (G_OBJECT (pad), "eat_probe", GINT_TO_POINTER (id));
- }
-
- /* add the stream to the list */
- add_stream (group, info);
-
- GROUP_UNLOCK (play_base_bin);
-
- /* signal the no more pads after adding the stream */
- if (last)
- no_more_pads_full (element, is_subs, play_base_bin);
-
- return;
-
- /* ERRORS */
-no_type:
- {
- g_warning ("no type on pad %s:%s", GST_DEBUG_PAD_NAME (pad));
- if (caps)
- gst_caps_unref (caps);
- return;
- }
-}
-
-static void
-new_decoded_pad (GstElement * element, GstPad * pad, gboolean last,
- GstPlayBaseBin * play_base_bin)
-{
- new_decoded_pad_full (element, pad, last, play_base_bin, FALSE);
-}
-
-static void
-subs_new_decoded_pad (GstElement * element, GstPad * pad, gboolean last,
- GstPlayBaseBin * play_base_bin)
-{
- new_decoded_pad_full (element, pad, last, play_base_bin, TRUE);
-}
-
-static void
-set_encoding_element (GstElement * element, gchar * encoding)
-{
- GST_DEBUG_OBJECT (element, "setting encoding to %s", GST_STR_NULL (encoding));
- g_object_set (G_OBJECT (element), "subtitle-encoding", encoding, NULL);
-}
-
-
-static void
-decodebin_element_added_cb (GstBin * decodebin, GstElement * element,
- gpointer data)
-{
- GstPlayBaseBin *play_base_bin = GST_PLAY_BASE_BIN (data);
- gchar *encoding;
-
- if (!g_object_class_find_property (G_OBJECT_GET_CLASS (element),
- "subtitle-encoding")) {
- return;
- }
-
- g_mutex_lock (play_base_bin->sub_lock);
- play_base_bin->subtitle_elements =
- g_slist_append (play_base_bin->subtitle_elements, element);
- encoding = g_strdup (play_base_bin->subencoding);
- g_mutex_unlock (play_base_bin->sub_lock);
-
- set_encoding_element (element, encoding);
- g_free (encoding);
-}
-
-static void
-decodebin_element_removed_cb (GstBin * decodebin, GstElement * element,
- gpointer data)
-{
- GstPlayBaseBin *play_base_bin = GST_PLAY_BASE_BIN (data);
-
- g_mutex_lock (play_base_bin->sub_lock);
- play_base_bin->subtitle_elements =
- g_slist_remove (play_base_bin->subtitle_elements, element);
- g_mutex_unlock (play_base_bin->sub_lock);
-}
-
-
-/*
- * Generate source ! subparse bins.
- */
-
-static GstElement *
-setup_subtitle (GstPlayBaseBin * play_base_bin, gchar * sub_uri)
-{
- GstElement *source, *subdecodebin, *subbin;
-
- if (!gst_uri_is_valid (sub_uri))
- goto invalid_uri;
-
- source = gst_element_make_from_uri (GST_URI_SRC, sub_uri, NULL);
- if (!source)
- goto unknown_uri;
-
- if (g_getenv ("USE_DECODEBIN2"))
- subdecodebin = gst_element_factory_make ("decodebin2", "subtitle-decoder");
- else
- subdecodebin = gst_element_factory_make ("decodebin", "subtitle-decoder");
- g_signal_connect (subdecodebin, "element-added",
- G_CALLBACK (decodebin_element_added_cb), play_base_bin);
- g_signal_connect (subdecodebin, "element-removed",
- G_CALLBACK (decodebin_element_removed_cb), play_base_bin);
- subbin = gst_bin_new ("subtitle-bin");
- gst_bin_add_many (GST_BIN_CAST (subbin), source, subdecodebin, NULL);
-
- gst_element_link (source, subdecodebin);
-
- /* return the subtitle GstElement object */
- return subbin;
-
- /* WARNINGS */
-invalid_uri:
- {
- GST_ELEMENT_WARNING (play_base_bin, RESOURCE, NOT_FOUND,
- (_("Invalid subtitle URI \"%s\", subtitles disabled."), sub_uri),
- (NULL));
- return NULL;
- }
-unknown_uri:
- {
- gchar *prot = gst_uri_get_protocol (sub_uri);
-
- if (prot) {
- gchar *desc;
-
- gst_element_post_message (GST_ELEMENT (play_base_bin),
- gst_missing_uri_source_message_new (GST_ELEMENT (play_base_bin),
- prot));
-
- desc = gst_pb_utils_get_source_description (prot);
- GST_ELEMENT_ERROR (play_base_bin, CORE, MISSING_PLUGIN,
- (_("A %s plugin is required to play this stream, but not installed."),
- desc), ("No URI handler to handle sub_uri: %s", sub_uri));
- g_free (desc);
- g_free (prot);
- } else
- goto invalid_uri;
-
- return NULL;
- }
-}
-
-/* helper function to lookup stuff in lists */
-static gboolean
-array_has_value (const gchar * values[], const gchar * value)
-{
- gint i;
-
- for (i = 0; values[i]; i++) {
- if (g_str_has_prefix (value, values[i]))
- return TRUE;
- }
- return FALSE;
-}
-
-/* list of URIs that we consider to be streams and that need buffering.
- * We have no mechanism yet to figure this out with a query. */
-static const gchar *stream_uris[] = { "http://", "mms://", "mmsh://",
- "mmsu://", "mmst://", "myth://", NULL
-};
-
-/* blacklisted URIs, we know they will always fail. */
-static const gchar *blacklisted_uris[] = { NULL };
-
-/* mime types that we don't consider to be media types */
-static const gchar *no_media_mimes[] = {
- "application/x-executable", "application/x-bzip", "application/x-gzip",
- "application/zip", "application/x-compress", NULL
-};
-
-/* mime types we consider raw media */
-static const gchar *raw_mimes[] = {
- "audio/x-raw", "video/x-raw", "video/x-dvd-subpicture", NULL
-};
-
-#define IS_STREAM_URI(uri) (array_has_value (stream_uris, uri))
-#define IS_BLACKLISTED_URI(uri) (array_has_value (blacklisted_uris, uri))
-#define IS_NO_MEDIA_MIME(mime) (array_has_value (no_media_mimes, mime))
-#define IS_RAW_MIME(mime) (array_has_value (raw_mimes, mime))
-
-/*
- * Generate and configure a source element.
- */
-static GstElement *
-gen_source_element (GstPlayBaseBin * play_base_bin, GstElement ** subbin)
-{
- GstElement *source;
-
- if (!play_base_bin->uri)
- goto no_uri;
-
- if (!gst_uri_is_valid (play_base_bin->uri))
- goto invalid_uri;
-
- if (IS_BLACKLISTED_URI (play_base_bin->uri))
- goto uri_blacklisted;
-
- if (play_base_bin->suburi) {
- GST_LOG_OBJECT (play_base_bin, "Creating decoder for subtitles URI %s",
- play_base_bin->suburi);
- /* subtitle specified */
- *subbin = setup_subtitle (play_base_bin, play_base_bin->suburi);
- } else {
- /* no subtitle specified */
- *subbin = NULL;
- }
-
- source = gst_element_make_from_uri (GST_URI_SRC, play_base_bin->uri,
- "source");
- if (!source)
- goto no_source;
-
- play_base_bin->is_stream = IS_STREAM_URI (play_base_bin->uri);
-
- /* make HTTP sources send extra headers so we get icecast
- * metadata in case the stream is an icecast stream */
- if (!strncmp (play_base_bin->uri, "http://", 7) &&
- g_object_class_find_property (G_OBJECT_GET_CLASS (source),
- "iradio-mode")) {
- g_object_set (source, "iradio-mode", TRUE, NULL);
- }
-
- if (g_object_class_find_property (G_OBJECT_GET_CLASS (source),
- "connection-speed")) {
- GST_DEBUG_OBJECT (play_base_bin,
- "setting connection-speed=%d to source element",
- play_base_bin->connection_speed / 1000);
- g_object_set (source, "connection-speed",
- play_base_bin->connection_speed / 1000, NULL);
- }
-
- return source;
-
- /* ERRORS */
-no_uri:
- {
- GST_ELEMENT_ERROR (play_base_bin, RESOURCE, NOT_FOUND,
- (_("No URI specified to play from.")), (NULL));
- return NULL;
- }
-invalid_uri:
- {
- GST_ELEMENT_ERROR (play_base_bin, RESOURCE, NOT_FOUND,
- (_("Invalid URI \"%s\"."), play_base_bin->uri), (NULL));
- return NULL;
- }
-uri_blacklisted:
- {
- GST_ELEMENT_ERROR (play_base_bin, RESOURCE, FAILED,
- (_("RTSP streams cannot be played yet.")), (NULL));
- return NULL;
- }
-no_source:
- {
- gchar *prot = gst_uri_get_protocol (play_base_bin->uri);
-
- /* whoops, could not create the source element, dig a little deeper to
- * figure out what might be wrong. */
- if (prot) {
- gchar *desc;
-
- gst_element_post_message (GST_ELEMENT (play_base_bin),
- gst_missing_uri_source_message_new (GST_ELEMENT (play_base_bin),
- prot));
-
- desc = gst_pb_utils_get_source_description (prot);
- GST_ELEMENT_ERROR (play_base_bin, CORE, MISSING_PLUGIN,
- (_("A %s plugin is required to play this stream, but not installed."),
- desc), ("No URI handler for %s", prot));
- g_free (desc);
- g_free (prot);
- } else
- goto invalid_uri;
-
- return NULL;
- }
-}
-
-/* is called when a dynamic source element created a new pad. */
-static void
-source_new_pad (GstElement * element, GstPad * pad, GstPlayBaseBin * bin)
-{
- GstElement *decoder;
- gboolean is_raw;
-
- GST_DEBUG_OBJECT (bin, "Found new pad %s.%s in source element %s",
- GST_DEBUG_PAD_NAME (pad), GST_ELEMENT_NAME (element));
-
- /* if this is a pad with all raw caps, we can expose it */
- if (has_all_raw_caps (pad, &is_raw) && is_raw) {
- bin->raw_decoding_mode = TRUE;
- /* it's all raw, create output pads. */
- new_decoded_pad_full (element, pad, FALSE, bin, FALSE);
- return;
- }
-
- /* not raw, create decoder */
- decoder = make_decoder (bin);
- if (!decoder)
- goto no_decodebin;
-
- /* and link to decoder */
- if (!gst_element_link (bin->source, decoder))
- goto could_not_link;
-
- gst_element_set_state (decoder, GST_STATE_PAUSED);
-
- return;
-
- /* ERRORS */
-no_decodebin:
- {
- /* error was posted */
- return;
- }
-could_not_link:
- {
- GST_ELEMENT_ERROR (bin, CORE, NEGOTIATION,
- (NULL), ("Can't link source to decoder element"));
- return;
- }
-}
-
-/*
- * Setup the substreams (is called right after group_commit () when
- * loading a new group, or after switching groups).
- *
- * Should be called with group-lock held.
- */
-static void
-setup_substreams (GstPlayBaseBin * play_base_bin)
-{
- GstPlayBaseGroup *group;
- gint n;
- const GList *item;
-
- GST_DEBUG_OBJECT (play_base_bin, "setting up substreams");
-
- /* Remove the eat probes */
- group = get_active_group (play_base_bin);
- for (item = group->streaminfo; item; item = item->next) {
- GstStreamInfo *info = item->data;
- gpointer data;
-
- data = g_object_get_data (G_OBJECT (info->object), "eat_probe");
- if (data) {
- gst_pad_remove_data_probe (GST_PAD_CAST (info->object),
- GPOINTER_TO_INT (data));
- g_object_set_data (G_OBJECT (info->object), "eat_probe", NULL);
- }
-
- /* now remove unknown pads */
- if (info->type == GST_STREAM_TYPE_UNKNOWN) {
- guint id;
-
- id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (info), "mute_probe"));
- if (id == 0) {
- id = gst_pad_add_buffer_probe (GST_PAD_CAST (info->object),
- G_CALLBACK (mute_stream), info);
- g_object_set_data (G_OBJECT (info), "mute_probe", GINT_TO_POINTER (id));
- }
- }
- }
-
- /* now check if the requested current streams exist. If
- * current >= num_streams, decrease current so at least
- * we have output. Always keep it enabled. */
- for (n = 0; n < NUM_TYPES; n++) {
- if (play_base_bin->current[n] >= group->type[n].npads) {
- GST_DEBUG_OBJECT (play_base_bin, "reset type %d to current 0", n);
- play_base_bin->current[n] = 0;
- }
- }
-
- /* now activate the right sources. Don't forget that during preroll,
- * we set the first source to forwarding and ignored the rest. */
- for (n = 0; n < NUM_TYPES; n++) {
- GST_DEBUG_OBJECT (play_base_bin, "setting type %d to current %d", n,
- play_base_bin->current[n]);
- set_active_source (play_base_bin, n + 1, play_base_bin->current[n]);
- }
-}
-
-/**
- * has_all_raw_caps:
- * @pad: a #GstPad
- * @all_raw: pointer to hold the result
- *
- * check if the caps of the pad are all raw. The caps are all raw if
- * all of its structures contain audio/x-raw or video/x-raw.
- *
- * Returns: %FALSE @pad has no caps. Else TRUE and @all_raw set t the result.
- */
-static gboolean
-has_all_raw_caps (GstPad * pad, gboolean * all_raw)
-{
- GstCaps *caps;
- gint capssize;
- guint i, num_raw = 0;
- gboolean res = FALSE;
-
- caps = gst_pad_get_caps (pad);
- if (caps == NULL)
- return FALSE;
-
- capssize = gst_caps_get_size (caps);
- /* no caps, skip and move to the next pad */
- if (capssize == 0 || gst_caps_is_empty (caps) || gst_caps_is_any (caps))
- goto done;
-
- /* count the number of raw formats in the caps */
- for (i = 0; i < capssize; ++i) {
- GstStructure *s;
- const gchar *mime_type;
-
- s = gst_caps_get_structure (caps, i);
- mime_type = gst_structure_get_name (s);
-
- if (IS_RAW_MIME (mime_type))
- ++num_raw;
- }
-
- *all_raw = (num_raw == capssize);
- res = TRUE;
-
-done:
- gst_caps_unref (caps);
- return res;
-}
-
-/**
- * analyse_source:
- * @play_base_bin: a #GstPlayBaseBin
- * @is_raw: are all pads raw data
- * @have_out: does the source have output
- * @is_dynamic: is this a dynamic source
- *
- * Check the source of @play_base_bin and collect information about it.
- *
- * @is_raw will be set to TRUE if the source only produces raw pads. When this
- * function returns, all of the raw pad of the source will be added
- * to @play_base_bin.
- *
- * @have_out: will be set to TRUE if the source has output pads.
- *
- * @is_dynamic: TRUE if the element will create (more) pads dynamically later
- * on.
- *
- * Returns: FALSE if a fatal error occured while scanning.
- */
-static gboolean
-analyse_source (GstPlayBaseBin * play_base_bin, gboolean * is_raw,
- gboolean * have_out, gboolean * is_dynamic)
-{
- GstIterator *pads_iter;
- gboolean done = FALSE;
- gboolean res = TRUE;
-
- *have_out = FALSE;
- *is_raw = FALSE;
- *is_dynamic = FALSE;
-
- pads_iter = gst_element_iterate_src_pads (play_base_bin->source);
- while (!done) {
- GstPad *pad = NULL;
-
- switch (gst_iterator_next (pads_iter, (gpointer) & pad)) {
- case GST_ITERATOR_ERROR:
- res = FALSE;
- /* FALLTROUGH */
- case GST_ITERATOR_DONE:
- done = TRUE;
- break;
- case GST_ITERATOR_RESYNC:
- /* reset results and resync */
- *have_out = FALSE;
- *is_raw = FALSE;
- *is_dynamic = FALSE;
- gst_iterator_resync (pads_iter);
- break;
- case GST_ITERATOR_OK:
- /* we now officially have an ouput pad */
- *have_out = TRUE;
-
- /* if FALSE, this pad has no caps and we continue with the next pad. */
- if (!has_all_raw_caps (pad, is_raw)) {
- gst_object_unref (pad);
- break;
- }
-
- /* caps on source pad are all raw, we can add the pad */
- if (*is_raw) {
- new_decoded_pad_full (play_base_bin->source, pad, FALSE,
- play_base_bin, FALSE);
- }
-
- gst_object_unref (pad);
- break;
- }
- }
- gst_iterator_free (pads_iter);
-
- if (!*have_out) {
- GstElementClass *elemclass;
- GList *walk;
-
- /* element has no output pads, check for padtemplates that list SOMETIMES
- * pads. */
- elemclass = GST_ELEMENT_GET_CLASS (play_base_bin->source);
-
- walk = gst_element_class_get_pad_template_list (elemclass);
- while (walk != NULL) {
- GstPadTemplate *templ;
-
- templ = (GstPadTemplate *) walk->data;
- if (GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SRC) {
- if (GST_PAD_TEMPLATE_PRESENCE (templ) == GST_PAD_SOMETIMES) {
- *is_dynamic = TRUE;
- break; /* only break out if we found a sometimes src pad
- continue walking through if say a request src pad is found
- elements such as mpegtsparse and dvbbasebin have request
- and sometimes src pads */
- }
- }
- walk = g_list_next (walk);
- }
- }
-
- return res;
-}
-
-static void
-remove_decoders (GstPlayBaseBin * bin)
-{
- GSList *walk;
-
- for (walk = bin->decoders; walk; walk = g_slist_next (walk)) {
- GstElement *decoder = GST_ELEMENT_CAST (walk->data);
-
- GST_DEBUG_OBJECT (bin, "removing old decoder element");
- /* Disconnect all the signal handlers we attached to the decodebin before
- * we dispose of it */
- g_signal_handlers_disconnect_by_func (decoder,
- (gpointer) (decodebin_element_added_cb), bin);
- g_signal_handlers_disconnect_by_func (decoder,
- (gpointer) (decodebin_element_removed_cb), bin);
- g_signal_handlers_disconnect_by_func (decoder,
- (gpointer) (new_decoded_pad), bin);
- g_signal_handlers_disconnect_by_func (decoder,
- (gpointer) (no_more_pads), bin);
- g_signal_handlers_disconnect_by_func (decoder,
- (gpointer) (unknown_type), bin);
-
- gst_element_set_state (decoder, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (bin), decoder);
- }
- g_slist_free (bin->decoders);
- bin->decoders = NULL;
-}
-
-static GstElement *
-make_decoder (GstPlayBaseBin * play_base_bin)
-{
- GstElement *decoder;
-
- /* now create the decoder element */
- if (g_getenv ("USE_DECODEBIN2"))
- decoder = gst_element_factory_make ("decodebin2", NULL);
- else
- decoder = gst_element_factory_make ("decodebin", NULL);
- if (!decoder)
- goto no_decodebin;
-
- g_signal_connect (decoder, "element-added",
- G_CALLBACK (decodebin_element_added_cb), play_base_bin);
- g_signal_connect (decoder, "element-removed",
- G_CALLBACK (decodebin_element_removed_cb), play_base_bin);
-
- gst_bin_add (GST_BIN_CAST (play_base_bin), decoder);
-
- /* set up callbacks to create the links between decoded data
- * and video/audio/subtitle rendering/output. */
- g_signal_connect (G_OBJECT (decoder),
- "new-decoded-pad", G_CALLBACK (new_decoded_pad), play_base_bin);
- g_signal_connect (G_OBJECT (decoder), "no-more-pads",
- G_CALLBACK (no_more_pads), play_base_bin);
- g_signal_connect (G_OBJECT (decoder),
- "unknown-type", G_CALLBACK (unknown_type), play_base_bin);
- g_object_set_data (G_OBJECT (decoder), "pending", "1");
- play_base_bin->pending++;
-
- GST_DEBUG_OBJECT (play_base_bin, "created decodebin, %d pending",
- play_base_bin->pending);
-
- play_base_bin->decoders = g_slist_prepend (play_base_bin->decoders, decoder);
-
- return decoder;
-
- /* ERRORS */
-no_decodebin:
- {
- GST_ELEMENT_ERROR (play_base_bin, CORE, MISSING_PLUGIN,
- (_("Could not create \"decodebin\" element.")), (NULL));
- return NULL;
- }
-}
-
-static void
-remove_source (GstPlayBaseBin * bin)
-{
- GstElement *source = bin->source;
-
- if (source) {
- GST_DEBUG_OBJECT (bin, "removing old src element");
- gst_element_set_state (source, GST_STATE_NULL);
-
- if (bin->src_np_sig_id) {
- g_signal_handler_disconnect (G_OBJECT (source), bin->src_np_sig_id);
- bin->src_np_sig_id = 0;
- }
- if (bin->src_nmp_sig_id) {
- g_signal_handler_disconnect (G_OBJECT (source), bin->src_nmp_sig_id);
- bin->src_nmp_sig_id = 0;
- }
- gst_bin_remove (GST_BIN_CAST (bin), source);
- bin->source = NULL;
- }
-}
-
-static GstBusSyncReply
-subbin_startup_sync_msg (GstBus * bus, GstMessage * msg, gpointer user_data)
-{
- if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) {
- GstPlayBaseBin *play_base_bin;
-
- play_base_bin = GST_PLAY_BASE_BIN (user_data);
- if (!play_base_bin->subtitle_done) {
- GST_WARNING_OBJECT (play_base_bin, "error starting up subtitle bin: %"
- GST_PTR_FORMAT, msg);
- play_base_bin->subtitle_done = TRUE;
- GST_DEBUG_OBJECT (play_base_bin, "signal group done");
- GROUP_SIGNAL (play_base_bin);
- GST_DEBUG_OBJECT (play_base_bin, "signaled group done");
- }
- }
- return GST_BUS_PASS;
-}
-
-/* construct and run the source and decoder elements until we found
- * all the streams or until a preroll queue has been filled.
-*/
-static gboolean
-setup_source (GstPlayBaseBin * play_base_bin)
-{
- GstElement *subbin = NULL;
- gboolean is_raw, have_out, is_dynamic;
-
- if (!play_base_bin->need_rebuild)
- return TRUE;
- play_base_bin->raw_decoding_mode = FALSE;
-
- GST_DEBUG_OBJECT (play_base_bin, "setup source");
-
- /* delete old src */
- remove_source (play_base_bin);
-
- /* create and configure an element that can handle the uri */
- if (!(play_base_bin->source = gen_source_element (play_base_bin, &subbin)))
- goto no_source;
-
- /* state will be merged later - if file is not found, error will be
- * handled by the application right after. */
- gst_bin_add (GST_BIN_CAST (play_base_bin), play_base_bin->source);
- g_object_notify (G_OBJECT (play_base_bin), "source");
-
- /* remove the old decoders now, if any */
- remove_decoders (play_base_bin);
-
- /* remove our previous preroll queues */
- remove_groups (play_base_bin);
-
- /* clear pending dynamic elements */
- play_base_bin->pending = 0;
-
- /* do subs */
- if (subbin) {
- GstElement *db;
- GstBus *bus;
-
- play_base_bin->subtitle = subbin;
- db = gst_bin_get_by_name (GST_BIN_CAST (subbin), "subtitle-decoder");
-
- /* do type detection, without adding (so no preroll) */
- g_signal_connect (G_OBJECT (db), "new-decoded-pad",
- G_CALLBACK (subs_new_decoded_pad), play_base_bin);
- g_signal_connect (G_OBJECT (db), "no-more-pads",
- G_CALLBACK (sub_no_more_pads), play_base_bin);
- g_signal_connect (G_OBJECT (db), "unknown-type",
- G_CALLBACK (unknown_type), play_base_bin);
- g_object_set_data (G_OBJECT (db), "pending", "1");
- play_base_bin->pending++;
-
- GST_DEBUG_OBJECT (play_base_bin, "we have subtitles, %d pending",
- play_base_bin->pending);
-
- if (!play_base_bin->is_stream) {
- GstStateChangeReturn sret;
-
- /* either when the queues are filled or when the decoder element
- * has no more dynamic streams, the cond is unlocked. We can remove
- * the signal handlers then
- */
- GST_DEBUG_OBJECT (play_base_bin, "starting subtitle bin");
-
- /* for subtitles in a separate bin we will not commit the
- * current building group since we need to add the other
- * audio/video streams to the group. We check if we managed
- * to commit the subtitle group using an extra flag. */
- play_base_bin->subtitle_done = FALSE;
-
- /* since subbin is still a stand-alone bin, we need to add a custom bus
- * to intercept error messages, so we can stop waiting and continue */
- bus = gst_bus_new ();
- gst_element_set_bus (subbin, bus);
- gst_bus_set_sync_handler (bus, subbin_startup_sync_msg, play_base_bin);
-
- sret = gst_element_set_state (subbin, GST_STATE_PAUSED);
- if (sret != GST_STATE_CHANGE_FAILURE) {
- GROUP_LOCK (play_base_bin);
- GST_DEBUG ("waiting for subtitle to complete...");
- while (!play_base_bin->subtitle_done)
- GROUP_WAIT (play_base_bin);
- GST_DEBUG ("group done !");
- GROUP_UNLOCK (play_base_bin);
-
- if (!play_base_bin->building_group ||
- play_base_bin->building_group->type[GST_STREAM_TYPE_TEXT -
- 1].npads == 0) {
-
- GST_DEBUG ("No subtitle found - ignoring");
- gst_element_set_state (subbin, GST_STATE_NULL);
- gst_object_unref (play_base_bin->subtitle);
- play_base_bin->subtitle = NULL;
- } else {
- GST_DEBUG_OBJECT (play_base_bin, "Subtitle set-up successful");
- }
- } else {
- GST_WARNING_OBJECT (play_base_bin, "Failed to start subtitle bin");
- gst_element_set_state (subbin, GST_STATE_NULL);
- gst_object_unref (play_base_bin->subtitle);
- play_base_bin->subtitle = NULL;
- }
-
- gst_bus_set_sync_handler (bus, NULL, NULL);
- gst_element_set_bus (subbin, NULL);
- gst_object_unref (bus);
- }
- gst_object_unref (db);
- }
- /* see if the source element emits raw audio/video all by itself,
- * if so, we can create streams for the pads and be done with it.
- * Also check that is has source pads, if not, we assume it will
- * do everything itself. */
- if (!analyse_source (play_base_bin, &is_raw, &have_out, &is_dynamic))
- goto invalid_source;
-
- if (is_raw) {
- GST_DEBUG_OBJECT (play_base_bin, "Source provides all raw data");
- /* source provides raw data, we added the pads and we can now signal a
- * no_more pads because we are done. */
- group_commit (play_base_bin, play_base_bin->is_stream, FALSE);
- return TRUE;
- }
- if (!have_out && !is_dynamic) {
- GST_DEBUG_OBJECT (play_base_bin, "Source has no output pads");
- /* create a stream to indicate that this uri is handled by a self
- * contained element. We are now done. */
- add_element_stream (play_base_bin->source, play_base_bin);
- group_commit (play_base_bin, play_base_bin->is_stream, FALSE);
- return TRUE;
- }
- if (is_dynamic) {
- /* connect a handler for the new-pad signal */
- play_base_bin->src_np_sig_id =
- g_signal_connect (G_OBJECT (play_base_bin->source), "pad-added",
- G_CALLBACK (source_new_pad), play_base_bin);
- play_base_bin->src_nmp_sig_id =
- g_signal_connect (G_OBJECT (play_base_bin->source), "no-more-pads",
- G_CALLBACK (source_no_more_pads), play_base_bin);
- g_object_set_data (G_OBJECT (play_base_bin->source), "pending", "1");
- play_base_bin->pending++;
- GST_DEBUG_OBJECT (play_base_bin,
- "Source has dynamic output pads, %d pending", play_base_bin->pending);
- } else {
- GstElement *decoder;
-
- /* no dynamic source, we can link now */
- decoder = make_decoder (play_base_bin);
- if (!decoder)
- goto no_decodebin;
-
- if (!gst_element_link (play_base_bin->source, decoder))
- goto could_not_link;
- }
-
- if (play_base_bin->subtitle)
- gst_bin_add (GST_BIN_CAST (play_base_bin), play_base_bin->subtitle);
-
- play_base_bin->need_rebuild = FALSE;
-
- return TRUE;
-
- /* ERRORS */
-no_source:
- {
- /* error message was already posted */
- return FALSE;
- }
-invalid_source:
- {
- GST_ELEMENT_ERROR (play_base_bin, CORE, FAILED,
- (_("Source element is invalid.")), (NULL));
- return FALSE;
- }
-no_decodebin:
- {
- /* message was posted */
- return FALSE;
- }
-could_not_link:
- {
- GST_ELEMENT_ERROR (play_base_bin, CORE, NEGOTIATION,
- (NULL), ("Can't link source to decoder element"));
- return FALSE;
- }
-}
-
-static void
-finish_source (GstPlayBaseBin * play_base_bin)
-{
- /* FIXME: no need to grab the group lock here? (tpm) */
- if (get_active_group (play_base_bin) != NULL) {
- if (play_base_bin->subtitle) {
- /* make subs iterate from now on */
- gst_bin_add (GST_BIN_CAST (play_base_bin), play_base_bin->subtitle);
- }
- }
-}
-
-/*
- * Caller must have group-lock held.
- *
- * We iterate over all detected streams in the streaminfo and try to find
- * impossible cases, like subtitles without video.
- */
-static gboolean
-prepare_output (GstPlayBaseBin * play_base_bin)
-{
- const GList *item;
- gboolean stream_found = FALSE, no_media = FALSE;
- gboolean got_video = FALSE, got_subtitle = FALSE;
- GstPlayBaseGroup *group;
-
- group = get_active_group (play_base_bin);
-
- /* check if we found any supported stream... if not, then
- * we detected stream type (or the above would've failed),
- * but linking/decoding failed - plugin probably missing. */
- for (item = group ? group->streaminfo : NULL; item != NULL; item = item->next) {
- GstStreamInfo *info = GST_STREAM_INFO (item->data);
-
- if (info->type == GST_STREAM_TYPE_VIDEO) {
- stream_found = TRUE;
- got_video = TRUE;
- break;
- } else if (info->type == GST_STREAM_TYPE_ELEMENT) {
- stream_found = TRUE;
- } else if (info->type == GST_STREAM_TYPE_AUDIO) {
- stream_found = TRUE;
- } else if (info->type == GST_STREAM_TYPE_TEXT ||
- info->type == GST_STREAM_TYPE_SUBPICTURE) {
- got_subtitle = TRUE;
- } else if (!item->prev && !item->next) {
- /* We're no audio/video and the only stream... We could
- * be something not-media that's detected because then our
- * typefind doesn't mess up with mp3 (bz2, gz, elf, ...) */
- if (info->caps && !gst_caps_is_empty (info->caps)) {
- const gchar *mime =
- gst_structure_get_name (gst_caps_get_structure (info->caps, 0));
-
- no_media = IS_NO_MEDIA_MIME (mime);
- }
- }
- }
-
- if (!stream_found) {
- if (got_subtitle) {
- GST_ELEMENT_ERROR (play_base_bin, STREAM, WRONG_TYPE,
- (_("Only a subtitle stream was detected. "
- "Either you are loading a subtitle file or some other type of "
- "text file, or the media file was not recognized.")), (NULL));
- } else if (!no_media) {
- GST_ELEMENT_ERROR (play_base_bin, STREAM, CODEC_NOT_FOUND,
- (_("You do not have a decoder installed to handle this file. "
- "You might need to install the necessary plugins.")), (NULL));
- } else {
- GST_ELEMENT_ERROR (play_base_bin, STREAM, WRONG_TYPE,
- (_("This is not a media file")), (NULL));
- }
- return FALSE;
- } else if (got_subtitle && !got_video) {
- GST_ELEMENT_ERROR (play_base_bin, STREAM, WRONG_TYPE,
- (_("A subtitle stream was detected, but no video stream.")), (NULL));
- return FALSE;
- }
-
- return TRUE;
-}
-
-/*
- * Multi-stream management. -1 = none.
- *
- * Caller has group-lock held.
- */
-static gint
-get_active_source (GstPlayBaseBin * play_base_bin, GstStreamType type)
-{
- GstPlayBaseGroup *group;
- GList *s;
- gint num = 0;
-
- group = get_active_group (play_base_bin);
- if (!group)
- return -1;
-
- for (s = group->streaminfo; s; s = s->next) {
- GstStreamInfo *info = s->data;
-
- if (info->type == type) {
- if (!info->mute && !g_object_get_data (G_OBJECT (info), "mute_probe")) {
- return num;
- } else {
- num++;
- }
- }
- }
-
- return -1;
-}
-
-/* Kill pad reactivation on state change. */
-
-#if 0
-static void muted_group_change_state (GstElement * element,
- gint old_state, gint new_state, gpointer data);
-#endif
-
-static void
-mute_group_type (GstPlayBaseGroup * group, GstStreamType type, gboolean mute)
-{
- gboolean active = !mute;
- GstPad *pad;
-
- pad = gst_element_get_static_pad (group->type[type - 1].preroll, "src");
- gst_pad_set_active (pad, active);
- gst_object_unref (pad);
- pad = gst_element_get_static_pad (group->type[type - 1].preroll, "sink");
- gst_pad_set_active (pad, active);
- gst_object_unref (pad);
- pad = gst_element_get_static_pad (group->type[type - 1].selector, "src");
- gst_pad_set_active (pad, active);
- gst_object_unref (pad);
-
-#if 0
- if (mute) {
- g_signal_connect (group->type[type - 1].preroll, "state-changed",
- G_CALLBACK (muted_group_change_state), group);
- } else {
- g_signal_handlers_disconnect_by_func (group->type[type - 1].preroll,
- G_CALLBACK (muted_group_change_state), group);
- }
-#endif
-}
-
-#if 0
-static void
-muted_group_change_state (GstElement * element,
- gint old_state, gint new_state, gpointer data)
-{
- GstPlayBaseGroup *group = data;
-
- GROUP_LOCK (group->bin);
-
- if (new_state == GST_STATE_PLAYING) {
- gint n;
-
- for (n = 0; n < NUM_TYPES; n++) {
- if (group->type[n].selector == element) {
- mute_group_type (group, n + 1, TRUE);
- }
- }
- }
-
- GROUP_UNLOCK (group->bin);
-}
-#endif
-
-static void
-set_subtitles_visible (GstPlayBaseBin * play_base_bin, gboolean visible)
-{
- GstPlayBaseBinClass *klass = GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin);
-
- /* we use a vfunc for this since we don't have a reference to the
- * textoverlay element, but playbin does */
- if (klass != NULL && klass->set_subtitles_visible != NULL)
- klass->set_subtitles_visible (play_base_bin, visible);
-}
-
-static void
-set_audio_mute (GstPlayBaseBin * play_base_bin, gboolean mute)
-{
- GstPlayBaseBinClass *klass = GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin);
-
- /* we use a vfunc for this since we don't have a reference to the
- * textoverlay element, but playbin does */
- if (klass != NULL && klass->set_audio_mute != NULL)
- klass->set_audio_mute (play_base_bin, mute);
-}
-
-/*
- * Caller has group-lock held.
- */
-
-static void
-set_active_source (GstPlayBaseBin * play_base_bin,
- GstStreamType type, gint source_num)
-{
- GstPlayBaseGroup *group;
- GList *s;
- gint num = 0;
- gboolean have_active = FALSE;
- GstElement *sel;
-
- GST_LOG ("Changing active source of type %d to %d", type, source_num);
- play_base_bin->current[type - 1] = source_num;
-
- group = get_active_group (play_base_bin);
- if (!group || !group->type[type - 1].preroll) {
- GST_LOG ("No active group, or group for type %d has no preroll", type);
- return;
- }
-
- /* HACK: instead of unlinking the subtitle input (= lots of hassle,
- * especially if subtitles come from an external source), just tell
- * textoverlay not to render them */
- if (type == GST_STREAM_TYPE_TEXT) {
- gboolean visible = (source_num != -1);
-
- set_subtitles_visible (play_base_bin, visible);
- if (!visible)
- return;
- } else if (type == GST_STREAM_TYPE_AUDIO) {
- gboolean mute = (source_num == -1);
-
- set_audio_mute (play_base_bin, mute);
-
- if (mute)
- return;
- }
-
- sel = group->type[type - 1].selector;
-
- for (s = group->streaminfo; s; s = s->next) {
- GstStreamInfo *info = s->data;
-
- if (info->type == type) {
- if (num == source_num) {
- GstPad *sel_pad;
-
- GST_LOG ("Unmuting (if already muted) source %d of type %d", source_num,
- type);
- g_object_set (info, "mute", FALSE, NULL);
-
- /* Tell the stream selector which pad to accept */
- sel_pad = GST_PAD_CAST (g_object_get_data (G_OBJECT (info->object),
- "pb_sel_pad"));
-
- if (sel && sel_pad != NULL) {
- g_object_set (G_OBJECT (sel), "active-pad", sel_pad, NULL);
- }
-
- have_active = TRUE;
- } else {
- guint id;
-
- GST_LOG_OBJECT (info->object, "Muting source %d of type %d", num, type);
-
- id = gst_pad_add_buffer_probe (GST_PAD_CAST (info->object),
- G_CALLBACK (mute_stream), info);
- g_object_set_data (G_OBJECT (info), "mute_probe", GINT_TO_POINTER (id));
- }
- num++;
- }
- }
-
- if (!have_active) {
- GST_LOG ("Muting group type: %d", type);
- g_object_set (sel, "active-pad", NULL, NULL);
- } else {
- GST_LOG ("Unmuting group type: %d", type);
- }
- mute_group_type (group, type, !have_active);
-}
-
-static void
-gst_play_base_bin_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstPlayBaseBin *play_base_bin;
-
- g_return_if_fail (GST_IS_PLAY_BASE_BIN (object));
-
- play_base_bin = GST_PLAY_BASE_BIN (object);
-
- switch (prop_id) {
- case ARG_URI:
- {
- const gchar *uri = g_value_get_string (value);
-
- if (uri == NULL) {
- g_warning ("cannot set NULL uri");
- return;
- }
- /* if we have no previous uri, or the new uri is different from the
- * old one, replug */
- if (play_base_bin->uri == NULL || strcmp (play_base_bin->uri, uri) != 0) {
- g_free (play_base_bin->uri);
- play_base_bin->uri = g_strdup (uri);
-
- GST_DEBUG ("setting new uri to %s", uri);
-
- play_base_bin->need_rebuild = TRUE;
- }
- break;
- }
- case ARG_SUBURI:{
- const gchar *suburi = g_value_get_string (value);
-
- if ((!suburi && !play_base_bin->suburi) ||
- (suburi && play_base_bin->suburi &&
- !strcmp (play_base_bin->suburi, suburi)))
- return;
- g_free (play_base_bin->suburi);
- play_base_bin->suburi = g_strdup (suburi);
- GST_DEBUG ("setting new .sub uri to %s", suburi);
- play_base_bin->need_rebuild = TRUE;
- break;
- }
- case ARG_QUEUE_SIZE:
- play_base_bin->queue_size = g_value_get_uint64 (value);
- break;
- case ARG_QUEUE_THRESHOLD:
- play_base_bin->queue_threshold = g_value_get_uint64 (value);
- break;
- case ARG_QUEUE_MIN_THRESHOLD:
- play_base_bin->queue_min_threshold = g_value_get_uint64 (value);
- break;
- case ARG_CONNECTION_SPEED:
- play_base_bin->connection_speed = g_value_get_uint (value) * 1000;
- break;
- case ARG_VIDEO:
- GROUP_LOCK (play_base_bin);
- set_active_source (play_base_bin,
- GST_STREAM_TYPE_VIDEO, g_value_get_int (value));
- GROUP_UNLOCK (play_base_bin);
- break;
- case ARG_AUDIO:
- GROUP_LOCK (play_base_bin);
- set_active_source (play_base_bin,
- GST_STREAM_TYPE_AUDIO, g_value_get_int (value));
- GROUP_UNLOCK (play_base_bin);
- break;
- case ARG_TEXT:
- GROUP_LOCK (play_base_bin);
- set_active_source (play_base_bin,
- GST_STREAM_TYPE_TEXT, g_value_get_int (value));
- GROUP_UNLOCK (play_base_bin);
- break;
- case ARG_SUBTITLE_ENCODING:
- {
- const gchar *encoding;
- GSList *list;
-
- encoding = g_value_get_string (value);
- if (encoding && play_base_bin->subencoding &&
- !strcmp (play_base_bin->subencoding, encoding)) {
- return;
- }
- if (encoding == NULL && play_base_bin->subencoding == NULL)
- return;
-
- g_mutex_lock (play_base_bin->sub_lock);
- g_free (play_base_bin->subencoding);
- play_base_bin->subencoding = g_strdup (encoding);
- list = g_slist_copy (play_base_bin->subtitle_elements);
- g_slist_foreach (list, (GFunc) gst_object_ref, NULL);
- g_mutex_unlock (play_base_bin->sub_lock);
-
- /* we can't hold a lock when calling g_object_set() on a child, since
- * the notify event will trigger GstObject to send a deep-notify event
- * which will try to take the lock ... */
- g_slist_foreach (list, (GFunc) set_encoding_element, (gpointer) encoding);
- g_slist_foreach (list, (GFunc) gst_object_unref, NULL);
- g_slist_free (list);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_play_base_bin_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstPlayBaseBin *play_base_bin;
-
- g_return_if_fail (GST_IS_PLAY_BASE_BIN (object));
-
- play_base_bin = GST_PLAY_BASE_BIN (object);
-
- switch (prop_id) {
- case ARG_URI:
- g_value_set_string (value, play_base_bin->uri);
- break;
- case ARG_SUBURI:
- g_value_set_string (value, play_base_bin->suburi);
- break;
- case ARG_NSTREAMS:
- {
- GstPlayBaseGroup *group;
-
- GROUP_LOCK (play_base_bin);
- group = get_active_group (play_base_bin);
- if (group) {
- g_value_set_int (value, group->nstreams);
- } else {
- g_value_set_int (value, 0);
- }
- GROUP_UNLOCK (play_base_bin);
- break;
- }
- case ARG_QUEUE_SIZE:
- g_value_set_uint64 (value, play_base_bin->queue_size);
- break;
- case ARG_QUEUE_THRESHOLD:
- g_value_set_uint64 (value, play_base_bin->queue_threshold);
- break;
- case ARG_QUEUE_MIN_THRESHOLD:
- g_value_set_uint64 (value, play_base_bin->queue_min_threshold);
- break;
- case ARG_CONNECTION_SPEED:
- g_value_set_uint (value, play_base_bin->connection_speed / 1000);
- break;
- case ARG_STREAMINFO:
- /* FIXME: hold some kind of lock here, use iterator */
- g_value_set_pointer (value,
- (gpointer) gst_play_base_bin_get_streaminfo (play_base_bin));
- break;
- case ARG_STREAMINFO_VALUES:{
- GValueArray *copy;
-
- copy = gst_play_base_bin_get_streaminfo_value_array (play_base_bin);
- g_value_take_boxed (value, copy);
- break;
- }
- case ARG_SOURCE:
- g_value_set_object (value, play_base_bin->source);
- break;
- case ARG_VIDEO:
- GROUP_LOCK (play_base_bin);
- g_value_set_int (value, get_active_source (play_base_bin,
- GST_STREAM_TYPE_VIDEO));
- GROUP_UNLOCK (play_base_bin);
- break;
- case ARG_AUDIO:
- GROUP_LOCK (play_base_bin);
- g_value_set_int (value, get_active_source (play_base_bin,
- GST_STREAM_TYPE_AUDIO));
- GROUP_UNLOCK (play_base_bin);
- break;
- case ARG_TEXT:
- GROUP_LOCK (play_base_bin);
- g_value_set_int (value, get_active_source (play_base_bin,
- GST_STREAM_TYPE_TEXT));
- GROUP_UNLOCK (play_base_bin);
- break;
- case ARG_SUBTITLE_ENCODING:
- GST_OBJECT_LOCK (play_base_bin);
- g_value_set_string (value, play_base_bin->subencoding);
- GST_OBJECT_UNLOCK (play_base_bin);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstStateChangeReturn
-gst_play_base_bin_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret;
- GstPlayBaseBin *play_base_bin;
-
- play_base_bin = GST_PLAY_BASE_BIN (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- if (!setup_source (play_base_bin))
- goto source_failed;
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- if (ret == GST_STATE_CHANGE_FAILURE)
- goto cleanup_groups;
-
- finish_source (play_base_bin);
- break;
- /* clean-up in both cases, READY=>NULL clean-up is if there was an error */
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- case GST_STATE_CHANGE_READY_TO_NULL:
- play_base_bin->need_rebuild = TRUE;
- remove_decoders (play_base_bin);
- remove_groups (play_base_bin);
- remove_source (play_base_bin);
- break;
- default:
- break;
- }
- return ret;
-
- /* ERRORS */
-source_failed:
- {
- play_base_bin->need_rebuild = TRUE;
-
- return GST_STATE_CHANGE_FAILURE;
- }
-cleanup_groups:
- {
- /* clean up leftover groups */
- remove_groups (play_base_bin);
- play_base_bin->need_rebuild = TRUE;
-
- return GST_STATE_CHANGE_FAILURE;
- }
-}
-
-static const GList *
-gst_play_base_bin_get_streaminfo (GstPlayBaseBin * play_base_bin)
-{
- GstPlayBaseGroup *group = get_active_group (play_base_bin);
- GList *info = NULL;
-
- if (group) {
- info = group->streaminfo;
- }
- return info;
-}
-
-static GValueArray *
-gst_play_base_bin_get_streaminfo_value_array (GstPlayBaseBin * play_base_bin)
-{
- GstPlayBaseGroup *group;
- GValueArray *array = NULL;
-
- GROUP_LOCK (play_base_bin);
- group = get_active_group (play_base_bin);
- if (group) {
- array = g_value_array_copy (group->streaminfo_value_array);
- } else {
- array = g_value_array_new (0);
- }
- GROUP_UNLOCK (play_base_bin);
-
- return array;
-}
diff --git a/gst/playback/gstplaybasebin.h b/gst/playback/gstplaybasebin.h
deleted file mode 100644
index c8c86499..00000000
--- a/gst/playback/gstplaybasebin.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * <2007> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_PLAYBASEBIN_H__
-#define __GST_PLAYBASEBIN_H__
-
-#include <gst/gst.h>
-#include "gststreaminfo.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_PLAY_BASE_BIN (gst_play_base_bin_get_type())
-#define GST_PLAY_BASE_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAY_BASE_BIN,GstPlayBaseBin))
-#define GST_PLAY_BASE_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAY_BASE_BIN,GstPlayBaseBinClass))
-#define GST_IS_PLAY_BASE_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAY_BASE_BIN))
-#define GST_IS_PLAY_BASE_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAY_BASE_BIN))
-#define GST_PLAY_BASE_BIN_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLAY_BASE_BIN, \
- GstPlayBaseBinClass))
-
-typedef struct _GstPlayBaseBin GstPlayBaseBin;
-typedef struct _GstPlayBaseBinClass GstPlayBaseBinClass;
-
-/* a GstPlayBaseGroup is a group of pads and streaminfo that together
- * make up a playable stream. A new group is created from the current
- * set of pads that are alive when the preroll elements are filled or
- * when the no-more-pads signal is fired.
- *
- * We have to queue the groups as they can be created while the preroll
- * queues are still playing the old group. We monitor the EOS signals
- * on the preroll queues and when all the streams in the current group
- * have EOSed, we switch to the next queued group.
- */
-typedef struct
-{
- GstPlayBaseBin *bin; /* ref to the owner */
-
- gint nstreams;
- GList *streaminfo;
- GValueArray *streaminfo_value_array;
-
- /* contained decoded elementary streams */
- struct {
- gint npads;
- GstBin *bin;
- GstElement *preroll;
- GstElement *selector;
- gboolean done;
-#define NUM_TYPES 4
- } type[NUM_TYPES]; /* AUDIO, VIDEO, TEXT, SUBPIC */
-} GstPlayBaseGroup;
-
-struct _GstPlayBaseBin {
- GstPipeline pipeline;
-
- /* properties */
- guint64 queue_size;
- guint64 queue_threshold;
- guint64 queue_min_threshold;
- /* connection speed in bits/sec (0 = unknown) */
- guint connection_speed;
-
-
- /* currently loaded media */
- gint current[NUM_TYPES];
- gchar *uri, *suburi;
- gboolean is_stream;
- GstElement *source;
- GSList *decoders;
- GstElement *subtitle; /* additional filesrc ! subparse bin */
- gboolean subtitle_done;
- gboolean need_rebuild;
- gboolean raw_decoding_mode; /* Use smaller queues when source outputs raw data */
-
- GSList *subtitle_elements; /* subtitle elements that have 'subtitle-encoding' property */
- gchar *subencoding; /* encoding to propagate to the above subtitle elements */
- GMutex *sub_lock; /* protecting subtitle_elements and subencoding members */
-
- /* group management - using own lock */
- GMutex *group_lock; /* lock and mutex to signal availability of new group */
- GCond *group_cond;
- GstPlayBaseGroup *building_group; /* the group that we are constructing */
- GList *queued_groups; /* the constructed groups, head is the active one */
-
- /* for dynamic sources */
- guint src_np_sig_id; /* new-pad signal id */
- guint src_nmp_sig_id; /* no-more-pads signal id */
- gint pending;
-};
-
-struct _GstPlayBaseBinClass {
- GstPipelineClass parent_class;
-
- /* virtual fuctions */
- gboolean (*setup_output_pads) (GstPlayBaseBin *play_base_bin,
- GstPlayBaseGroup *group);
-
- void (*set_subtitles_visible) (GstPlayBaseBin *play_base_bin,
- gboolean visible);
- void (*set_audio_mute) (GstPlayBaseBin *play_base_bin,
- gboolean mute);
-};
-
-GType gst_play_base_bin_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_PLAYBASEBIN_H__ */
-
diff --git a/gst/playback/gstplaybin.c b/gst/playback/gstplaybin.c
deleted file mode 100644
index 8d8ae297..00000000
--- a/gst/playback/gstplaybin.c
+++ /dev/null
@@ -1,1982 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-playbin
- *
- * Playbin provides a stand-alone everything-in-one abstraction for an
- * audio and/or video player.
- *
- * It can handle both audio and video files and features
- * <itemizedlist>
- * <listitem>
- * automatic file type recognition and based on that automatic
- * selection and usage of the right audio/video/subtitle demuxers/decoders
- * </listitem>
- * <listitem>
- * visualisations for audio files
- * </listitem>
- * <listitem>
- * subtitle support for video files
- * </listitem>
- * <listitem>
- * stream selection between different audio/subtitles streams
- * </listitem>
- * <listitem>
- * meta info (tag) extraction
- * </listitem>
- * <listitem>
- * easy access to the last video frame
- * </listitem>
- * <listitem>
- * buffering when playing streams over a network
- * </listitem>
- * <listitem>
- * volume control
- * </listitem>
- * </itemizedlist>
- *
- * <refsect2>
- * <title>Usage</title>
- * <para>
- * A playbin element can be created just like any other element using
- * gst_element_factory_make(). The file/URI to play should be set via the #GstPlayBin:uri
- * property. This must be an absolute URI, relative file paths are not allowed.
- * Example URIs are file:///home/joe/movie.avi or http://www.joedoe.com/foo.ogg
- *
- * Playbin is a #GstPipeline. It will notify the application of everything
- * that's happening (errors, end of stream, tags found, state changes, etc.)
- * by posting messages on its #GstBus. The application needs to watch the
- * bus.
- *
- * Playback can be initiated by setting the element to PLAYING state using
- * gst_element_set_state(). Note that the state change will take place in
- * the background in a separate thread, when the function returns playback
- * is probably not happening yet and any errors might not have occured yet.
- * Applications using playbin should ideally be written to deal with things
- * completely asynchroneous.
- *
- * When playback has finished (an EOS message has been received on the bus)
- * or an error has occured (an ERROR message has been received on the bus) or
- * the user wants to play a different track, playbin should be set back to
- * READY or NULL state, then the #GstPlayBin:uri property should be set to the
- * new location and then playbin be set to PLAYING state again.
- *
- * Seeking can be done using gst_element_seek_simple() or gst_element_seek()
- * on the playbin element. Again, the seek will not be executed
- * instantaneously, but will be done in a background thread. When the seek
- * call returns the seek will most likely still be in process. An application
- * may wait for the seek to finish (or fail) using gst_element_get_state() with
- * -1 as the timeout, but this will block the user interface and is not
- * recommended at all.
- *
- * Applications may query the current position and duration of the stream
- * via gst_element_query_position() and gst_element_query_duration() and
- * setting the format passed to GST_FORMAT_TIME. If the query was successful,
- * the duration or position will have been returned in units of nanoseconds.
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>Advanced Usage: specifying the audio and video sink</title>
- * <para>
- * By default, if no audio sink or video sink has been specified via the
- * #GstPlayBin:audio-sink or #GstPlayBin:video-sink property, playbin will use
- * the autoaudiosink and autovideosink elements to find the first-best
- * available output method.
- * This should work in most cases, but is not always desirable. Often either
- * the user or application might want to specify more explicitly what to use
- * for audio and video output.
- *
- * If the application wants more control over how audio or video should be
- * output, it may create the audio/video sink elements itself (for example
- * using gst_element_factory_make()) and provide them to playbin using the
- * #GstPlayBin:audio-sink or #GstPlayBin:video-sink property.
- *
- * GNOME-based applications, for example, will usually want to create
- * gconfaudiosink and gconfvideosink elements and make playbin use those,
- * so that output happens to whatever the user has configured in the GNOME
- * Multimedia System Selector confinguration dialog.
- *
- * The sink elements do not necessarily need to be ready-made sinks. It is
- * possible to create container elements that look like a sink to playbin,
- * but in reality contain a number of custom elements linked together. This
- * can be achieved by creating a #GstBin and putting elements in there and
- * linking them, and then creating a sink #GstGhostPad for the bin and pointing
- * it to the sink pad of the first element within the bin. This can be used
- * for a number of purposes, for example to force output to a particular
- * format or to modify or observe the data before it is output.
- *
- * It is also possible to 'suppress' audio and/or video output by using
- * 'fakesink' elements (or capture it from there using the fakesink element's
- * "handoff" signal, which, nota bene, is fired from the streaming thread!).
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>Retrieving Tags and Other Meta Data</title>
- * <para>
- * Most of the common meta data (artist, title, etc.) can be retrieved by
- * watching for TAG messages on the pipeline's bus (see above).
- *
- * Other more specific meta information like width/height/framerate of video
- * streams or samplerate/number of channels of audio streams can be obtained
- * using the #GstPlayBaseBin:stream-info property, which will return a GList of
- * stream info objects, one for each stream. These are opaque objects that can
- * only be accessed via the standard GObject property interface, ie. g_object_get().
- * Each stream info object has the following properties:
- * <itemizedlist>
- * <listitem>"object" (GstObject) (the decoder source pad usually)</listitem>
- * <listitem>"type" (enum) (if this is an audio/video/subtitle stream)</listitem>
- * <listitem>"decoder" (string) (name of decoder used to decode this stream)</listitem>
- * <listitem>"mute" (boolean) (to mute or unmute this stream)</listitem>
- * <listitem>"caps" (GstCaps) (caps of the decoded stream)</listitem>
- * <listitem>"language-code" (string) (ISO-639 language code for this stream, mostly used for audio/subtitle streams)</listitem>
- * <listitem>"codec" (string) (format this stream was encoded in)</listitem>
- * </itemizedlist>
- * Stream information from the #GstPlayBaseBin:stream-info property is best queried once
- * playbin has changed into PAUSED or PLAYING state (which can be detected
- * via a state-changed message on the #GstBus where old_state=READY and
- * new_state=PAUSED), since before that the list might not be complete yet or
- * not contain all available information (like language-codes).
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>Buffering</title>
- * Playbin handles buffering automatically for the most part, but applications
- * need to handle parts of the buffering process as well. Whenever playbin is
- * buffering, it will post BUFFERING messages on the bus with a percentage
- * value that shows the progress of the buffering process. Applications need
- * to set playbin to PLAYING or PAUSED state in response to these messages.
- * They may also want to convey the buffering progress to the user in some
- * way. Here is how to extract the percentage information from the message
- * (requires GStreamer >= 0.10.11):
- * |[
- * switch (GST_MESSAGE_TYPE (msg)) {
- * case GST_MESSAGE_BUFFERING: {
- * gint percent = 0;
- * gst_message_parse_buffering (msg, &amp;percent);
- * g_print ("Buffering (%%u percent done)", percent);
- * break;
- * }
- * ...
- * }
- * ]|
- * Note that applications should keep/set the pipeline in the PAUSED state when
- * a BUFFERING message is received with a buffer percent value < 100 and set
- * the pipeline back to PLAYING state when a BUFFERING message with a value
- * of 100 percent is received (if PLAYING is the desired state, that is).
- * </refsect2>
- * <refsect2>
- * <title>Embedding the video window in your application</title>
- * By default, playbin (or rather the video sinks used) will create their own
- * window. Applications will usually want to force output to a window of their
- * own, however. This can be done using the #GstXOverlay interface, which most
- * video sinks implement. See the documentation there for more details.
- * </refsect2>
- * <refsect2>
- * <title>Specifying which CD/DVD device to use</title>
- * The device to use for CDs/DVDs needs to be set on the source element
- * playbin creates before it is opened. The only way to do this at the moment
- * is to connect to playbin's "notify::source" signal, which will be emitted
- * by playbin when it has created the source element for a particular URI.
- * In the signal callback you can check if the source element has a "device"
- * property and set it appropriately. In future ways might be added to specify
- * the device as part of the URI, but at the time of writing this is not
- * possible yet.
- * </refsect2>
- * <refsect2>
- * <title>Examples</title>
- * |[
- * gst-launch -v playbin uri=file:///path/to/somefile.avi
- * ]| This will play back the given AVI video file, given that the video and
- * audio decoders required to decode the content are installed. Since no
- * special audio sink or video sink is supplied (not possible via gst-launch),
- * playbin will try to find a suitable audio and video sink automatically
- * using the autoaudiosink and autovideosink elements.
- * |[
- * gst-launch -v playbin uri=cdda://4
- * ]| This will play back track 4 on an audio CD in your disc drive (assuming
- * the drive is detected automatically by the plugin).
- * |[
- * gst-launch -v playbin uri=dvd://1
- * ]| This will play back title 1 of a DVD in your disc drive (assuming
- * the drive is detected automatically by the plugin).
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <gst/gst.h>
-
-#include <gst/gst-i18n-plugin.h>
-#include <gst/pbutils/pbutils.h>
-
-#include "gstplaybasebin.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_play_bin_debug);
-#define GST_CAT_DEFAULT gst_play_bin_debug
-
-#define GST_TYPE_PLAY_BIN (gst_play_bin_get_type())
-#define GST_PLAY_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAY_BIN,GstPlayBin))
-#define GST_PLAY_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAY_BIN,GstPlayBinClass))
-#define GST_IS_PLAY_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAY_BIN))
-#define GST_IS_PLAY_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAY_BIN))
-
-#define VOLUME_MAX_DOUBLE 10.0
-
-typedef struct _GstPlayBin GstPlayBin;
-typedef struct _GstPlayBinClass GstPlayBinClass;
-
-/**
- * GstPlayBin:
- *
- * High-level player element
- */
-struct _GstPlayBin
-{
- GstPlayBaseBin parent;
-
- /* the configurable elements */
- GstElement *fakesink;
- GstElement *audio_sink;
- GstElement *video_sink;
- GstElement *visualisation;
- GstElement *pending_visualisation;
- GstElement *volume_element;
- GstElement *textoverlay_element;
- GstElement *spu_element;
- gfloat volume;
-
- /* these are the currently active sinks */
- GList *sinks;
-
- /* the last captured frame for snapshots */
- GstBuffer *frame;
-
- /* our cache for the sinks */
- GHashTable *cache;
-
- /* font description */
- gchar *font_desc;
-
- /* indication if the pipeline is live */
- gboolean is_live;
-};
-
-struct _GstPlayBinClass
-{
- GstPlayBaseBinClass parent_class;
-};
-
-/* props */
-enum
-{
- ARG_0,
- ARG_AUDIO_SINK,
- ARG_VIDEO_SINK,
- ARG_VIS_PLUGIN,
- ARG_VOLUME,
- ARG_FRAME,
- ARG_FONT_DESC
-};
-
-/* signals */
-enum
-{
- LAST_SIGNAL
-};
-
-static void gst_play_bin_class_init (GstPlayBinClass * klass);
-static void gst_play_bin_init (GstPlayBin * play_bin);
-static void gst_play_bin_dispose (GObject * object);
-
-static gboolean setup_sinks (GstPlayBaseBin * play_base_bin,
- GstPlayBaseGroup * group);
-static void remove_sinks (GstPlayBin * play_bin);
-static void playbin_set_subtitles_visible (GstPlayBaseBin * play_base_bin,
- gboolean visible);
-static void playbin_set_audio_mute (GstPlayBaseBin * play_base_bin,
- gboolean mute);
-
-static void gst_play_bin_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * spec);
-static void gst_play_bin_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * spec);
-
-static gboolean gst_play_bin_send_event (GstElement * element,
- GstEvent * event);
-static GstStateChangeReturn gst_play_bin_change_state (GstElement * element,
- GstStateChange transition);
-
-static void gst_play_bin_handle_message (GstBin * bin, GstMessage * message);
-
-static GstElementClass *parent_class;
-
-//static guint gst_play_bin_signals[LAST_SIGNAL] = { 0 };
-
-static const GstElementDetails gst_play_bin_details =
-GST_ELEMENT_DETAILS ("Player Bin",
- "Generic/Bin/Player",
- "Autoplug and play media from an uri",
- "Wim Taymans <wim.taymans@gmail.com>");
-
-static GType
-gst_play_bin_get_type (void)
-{
- static GType gst_play_bin_type = 0;
-
- if (!gst_play_bin_type) {
- static const GTypeInfo gst_play_bin_info = {
- sizeof (GstPlayBinClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_play_bin_class_init,
- NULL,
- NULL,
- sizeof (GstPlayBin),
- 0,
- (GInstanceInitFunc) gst_play_bin_init,
- NULL
- };
-
- gst_play_bin_type = g_type_register_static (GST_TYPE_PLAY_BASE_BIN,
- "GstPlayBin", &gst_play_bin_info, 0);
- }
-
- return gst_play_bin_type;
-}
-
-static void
-gst_play_bin_class_init (GstPlayBinClass * klass)
-{
- GObjectClass *gobject_klass;
- GstElementClass *gstelement_klass;
- GstBinClass *gstbin_klass;
- GstPlayBaseBinClass *playbasebin_klass;
-
- gobject_klass = (GObjectClass *) klass;
- gstelement_klass = (GstElementClass *) klass;
- gstbin_klass = (GstBinClass *) klass;
- playbasebin_klass = (GstPlayBaseBinClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_klass->set_property = gst_play_bin_set_property;
- gobject_klass->get_property = gst_play_bin_get_property;
-
- g_object_class_install_property (gobject_klass, ARG_VIDEO_SINK,
- g_param_spec_object ("video-sink", "Video Sink",
- "the video output element to use (NULL = default sink)",
- GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_AUDIO_SINK,
- g_param_spec_object ("audio-sink", "Audio Sink",
- "the audio output element to use (NULL = default sink)",
- GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_VIS_PLUGIN,
- g_param_spec_object ("vis-plugin", "Vis plugin",
- "the visualization element to use (NULL = none)",
- GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstPlayBin:volume:
- *
- * Get or set the current audio stream volume. 1.0 means 100%,
- * 0.0 means mute. This uses a linear volume scale.
- *
- */
- g_object_class_install_property (gobject_klass, ARG_VOLUME,
- g_param_spec_double ("volume", "volume", "volume",
- 0.0, VOLUME_MAX_DOUBLE, 1.0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_FRAME,
- gst_param_spec_mini_object ("frame", "Frame",
- "The last frame (NULL = no video available)", GST_TYPE_BUFFER,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_FONT_DESC,
- g_param_spec_string ("subtitle-font-desc", "Subtitle font description",
- "Pango font description of font " "to be used for subtitle rendering",
- NULL, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
-
- gobject_klass->dispose = gst_play_bin_dispose;
-
- gst_element_class_set_details (gstelement_klass, &gst_play_bin_details);
-
- gstelement_klass->change_state =
- GST_DEBUG_FUNCPTR (gst_play_bin_change_state);
- gstelement_klass->send_event = GST_DEBUG_FUNCPTR (gst_play_bin_send_event);
-
- gstbin_klass->handle_message =
- GST_DEBUG_FUNCPTR (gst_play_bin_handle_message);
-
- playbasebin_klass->setup_output_pads = setup_sinks;
- playbasebin_klass->set_subtitles_visible = playbin_set_subtitles_visible;
- playbasebin_klass->set_audio_mute = playbin_set_audio_mute;
-}
-
-static void
-gst_play_bin_init (GstPlayBin * play_bin)
-{
- play_bin->video_sink = NULL;
- play_bin->audio_sink = NULL;
- play_bin->visualisation = NULL;
- play_bin->pending_visualisation = NULL;
- play_bin->volume_element = NULL;
- play_bin->textoverlay_element = NULL;
- play_bin->spu_element = NULL;
- play_bin->volume = 1.0;
- play_bin->sinks = NULL;
- play_bin->frame = NULL;
- play_bin->font_desc = NULL;
- play_bin->cache = g_hash_table_new_full (g_str_hash, g_str_equal,
- NULL, (GDestroyNotify) gst_object_unref);
-}
-
-static void
-gst_play_bin_dispose (GObject * object)
-{
- GstPlayBin *play_bin;
-
- play_bin = GST_PLAY_BIN (object);
-
- if (play_bin->cache != NULL) {
- remove_sinks (play_bin);
- g_hash_table_destroy (play_bin->cache);
- play_bin->cache = NULL;
- }
-
- if (play_bin->audio_sink != NULL) {
- gst_element_set_state (play_bin->audio_sink, GST_STATE_NULL);
- gst_object_unref (play_bin->audio_sink);
- play_bin->audio_sink = NULL;
- }
- if (play_bin->video_sink != NULL) {
- gst_element_set_state (play_bin->video_sink, GST_STATE_NULL);
- gst_object_unref (play_bin->video_sink);
- play_bin->video_sink = NULL;
- }
- if (play_bin->visualisation != NULL) {
- gst_element_set_state (play_bin->visualisation, GST_STATE_NULL);
- gst_object_unref (play_bin->visualisation);
- play_bin->visualisation = NULL;
- }
- if (play_bin->pending_visualisation != NULL) {
- gst_element_set_state (play_bin->pending_visualisation, GST_STATE_NULL);
- gst_object_unref (play_bin->pending_visualisation);
- play_bin->pending_visualisation = NULL;
- }
- if (play_bin->textoverlay_element != NULL) {
- gst_object_unref (play_bin->textoverlay_element);
- play_bin->textoverlay_element = NULL;
- }
- if (play_bin->spu_element != NULL) {
- gst_object_unref (play_bin->spu_element);
- play_bin->spu_element = NULL;
- }
- g_free (play_bin->font_desc);
- play_bin->font_desc = NULL;
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_play_bin_vis_unblocked (GstPad * tee_pad, gboolean blocked,
- gpointer user_data)
-{
- GstPlayBin *play_bin = GST_PLAY_BIN (user_data);
-
- if (play_bin->pending_visualisation)
- gst_pad_set_blocked_async (tee_pad, FALSE, gst_play_bin_vis_unblocked,
- play_bin);
-}
-
-static void
-gst_play_bin_vis_blocked (GstPad * tee_pad, gboolean blocked,
- gpointer user_data)
-{
- GstPlayBin *play_bin = GST_PLAY_BIN (user_data);
- GstBin *vis_bin = NULL;
- GstPad *vis_sink_pad = NULL, *vis_src_pad = NULL, *vqueue_pad = NULL;
- GstState bin_state;
- GstElement *pending_visualisation;
-
- GST_OBJECT_LOCK (play_bin);
- pending_visualisation = play_bin->pending_visualisation;
- play_bin->pending_visualisation = NULL;
- GST_OBJECT_UNLOCK (play_bin);
-
- /* We want to disable visualisation */
- if (!GST_IS_ELEMENT (pending_visualisation)) {
- /* Set visualisation element to READY */
- gst_element_set_state (play_bin->visualisation, GST_STATE_READY);
- goto beach;
- }
-
- vis_bin =
- GST_BIN_CAST (gst_object_get_parent (GST_OBJECT_CAST
- (play_bin->visualisation)));
-
- if (!GST_IS_BIN (vis_bin) || !GST_IS_PAD (tee_pad)) {
- goto beach;
- }
-
- vis_src_pad = gst_element_get_static_pad (play_bin->visualisation, "src");
- vis_sink_pad = gst_pad_get_peer (tee_pad);
-
- /* Can be fakesink */
- if (GST_IS_PAD (vis_src_pad)) {
- vqueue_pad = gst_pad_get_peer (vis_src_pad);
- }
-
- if (!GST_IS_PAD (vis_sink_pad)) {
- goto beach;
- }
-
- /* Check the bin's state */
- GST_OBJECT_LOCK (vis_bin);
- bin_state = GST_STATE (vis_bin);
- GST_OBJECT_UNLOCK (vis_bin);
-
- /* Unlink */
- gst_pad_unlink (tee_pad, vis_sink_pad);
- gst_object_unref (vis_sink_pad);
- vis_sink_pad = NULL;
-
- if (GST_IS_PAD (vqueue_pad)) {
- gst_pad_unlink (vis_src_pad, vqueue_pad);
- gst_object_unref (vis_src_pad);
- vis_src_pad = NULL;
- }
-
- /* Remove from vis_bin */
- gst_bin_remove (vis_bin, play_bin->visualisation);
- /* Set state to NULL */
- gst_element_set_state (play_bin->visualisation, GST_STATE_NULL);
- /* And loose our ref */
- gst_object_unref (play_bin->visualisation);
-
- if (pending_visualisation) {
- /* Ref this new visualisation element before adding to the bin */
- gst_object_ref (pending_visualisation);
- /* Add the new one */
- gst_bin_add (vis_bin, pending_visualisation);
- /* Synchronizing state */
- gst_element_set_state (pending_visualisation, bin_state);
-
- vis_sink_pad = gst_element_get_static_pad (pending_visualisation, "sink");
- vis_src_pad = gst_element_get_static_pad (pending_visualisation, "src");
-
- if (!GST_IS_PAD (vis_sink_pad) || !GST_IS_PAD (vis_src_pad)) {
- goto beach;
- }
-
- /* Link */
- gst_pad_link (tee_pad, vis_sink_pad);
- gst_pad_link (vis_src_pad, vqueue_pad);
- }
-
- /* We are done */
- gst_object_unref (play_bin->visualisation);
- play_bin->visualisation = pending_visualisation;
-
-beach:
- if (vis_sink_pad) {
- gst_object_unref (vis_sink_pad);
- }
- if (vis_src_pad) {
- gst_object_unref (vis_src_pad);
- }
- if (vqueue_pad) {
- gst_object_unref (vqueue_pad);
- }
- if (vis_bin) {
- gst_object_unref (vis_bin);
- }
-
- /* Unblock the pad */
- gst_pad_set_blocked_async (tee_pad, FALSE, gst_play_bin_vis_unblocked,
- play_bin);
-}
-
-static void
-gst_play_bin_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstPlayBin *play_bin;
-
- play_bin = GST_PLAY_BIN (object);
-
- switch (prop_id) {
- case ARG_VIDEO_SINK:
- if (play_bin->video_sink != NULL) {
- gst_object_unref (play_bin->video_sink);
- }
- play_bin->video_sink = g_value_get_object (value);
- if (play_bin->video_sink != NULL) {
- gst_object_ref (play_bin->video_sink);
- gst_object_sink (GST_OBJECT_CAST (play_bin->video_sink));
- }
- /* when changing the videosink, we just remove the
- * video pipeline from the cache so that it will be
- * regenerated with the new sink element */
- g_hash_table_remove (play_bin->cache, "vbin");
- break;
- case ARG_AUDIO_SINK:
- if (play_bin->audio_sink != NULL) {
- gst_object_unref (play_bin->audio_sink);
- }
- play_bin->audio_sink = g_value_get_object (value);
- if (play_bin->audio_sink != NULL) {
- gst_object_ref (play_bin->audio_sink);
- gst_object_sink (GST_OBJECT_CAST (play_bin->audio_sink));
- }
- g_hash_table_remove (play_bin->cache, "abin");
- break;
- case ARG_VIS_PLUGIN:
- {
- GstElement *pending_visualisation =
- GST_ELEMENT_CAST (g_value_get_object (value));
-
- /* Take ownership */
- if (pending_visualisation) {
- gst_object_ref (pending_visualisation);
- gst_object_sink (pending_visualisation);
- }
-
- /* Do we already have a visualisation change pending ? */
- GST_OBJECT_LOCK (play_bin);
- if (play_bin->pending_visualisation) {
- gst_object_unref (play_bin->pending_visualisation);
- play_bin->pending_visualisation = pending_visualisation;
- GST_OBJECT_UNLOCK (play_bin);
- } else {
- GST_OBJECT_UNLOCK (play_bin);
- /* Was there a visualisation already set ? */
- if (play_bin->visualisation != NULL) {
- GstBin *vis_bin = NULL;
-
- vis_bin =
- GST_BIN_CAST (gst_object_get_parent (GST_OBJECT_CAST
- (play_bin->visualisation)));
-
- /* Check if the visualisation is already in a bin */
- if (GST_IS_BIN (vis_bin)) {
- GstPad *vis_sink_pad = NULL, *tee_pad = NULL;
-
- /* Now get tee pad and block it async */
- vis_sink_pad = gst_element_get_static_pad (play_bin->visualisation,
- "sink");
- if (!GST_IS_PAD (vis_sink_pad)) {
- goto beach;
- }
- tee_pad = gst_pad_get_peer (vis_sink_pad);
- if (!GST_IS_PAD (tee_pad)) {
- goto beach;
- }
-
- play_bin->pending_visualisation = pending_visualisation;
- /* Block with callback */
- gst_pad_set_blocked_async (tee_pad, TRUE, gst_play_bin_vis_blocked,
- play_bin);
- beach:
- if (vis_sink_pad) {
- gst_object_unref (vis_sink_pad);
- }
- if (tee_pad) {
- gst_object_unref (tee_pad);
- }
- gst_object_unref (vis_bin);
- } else {
- play_bin->visualisation = pending_visualisation;
- }
- } else {
- play_bin->visualisation = pending_visualisation;
- }
- }
- break;
- }
- case ARG_VOLUME:
- play_bin->volume = g_value_get_double (value);
- if (play_bin->volume_element) {
- g_object_set (G_OBJECT (play_bin->volume_element), "volume",
- play_bin->volume, NULL);
- }
- break;
- case ARG_FONT_DESC:
- g_free (play_bin->font_desc);
- play_bin->font_desc = g_strdup (g_value_get_string (value));
- if (play_bin->textoverlay_element) {
- g_object_set (G_OBJECT (play_bin->textoverlay_element),
- "font-desc", g_value_get_string (value), NULL);
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_play_bin_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstPlayBin *play_bin;
-
- play_bin = GST_PLAY_BIN (object);
-
- switch (prop_id) {
- case ARG_VIDEO_SINK:
- g_value_set_object (value, play_bin->video_sink);
- break;
- case ARG_AUDIO_SINK:
- g_value_set_object (value, play_bin->audio_sink);
- break;
- case ARG_VIS_PLUGIN:
- g_value_set_object (value, play_bin->visualisation);
- break;
- case ARG_VOLUME:
- g_value_set_double (value, play_bin->volume);
- break;
- case ARG_FRAME:{
- GstBuffer *cur_frame = NULL;
-
- gst_buffer_replace (&cur_frame, play_bin->frame);
- gst_value_take_buffer (value, cur_frame);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/* signal fired when the identity has received a new buffer. This is used for
- * making screenshots.
- */
-static void
-handoff (GstElement * identity, GstBuffer * frame, gpointer data)
-{
- GstPlayBin *play_bin = GST_PLAY_BIN (data);
-
- /* applications need to know the buffer caps,
- * make sure they are always set on the frame */
- if (GST_BUFFER_CAPS (frame) == NULL) {
- GstPad *pad;
-
- if ((pad = gst_element_get_static_pad (identity, "sink"))) {
- gst_buffer_set_caps (frame, GST_PAD_CAPS (pad));
- gst_object_unref (pad);
- }
- }
-
- gst_buffer_replace (&play_bin->frame, frame);
-}
-
-static void
-post_missing_element_message (GstPlayBin * playbin, const gchar * name)
-{
- GstMessage *msg;
-
- msg = gst_missing_element_message_new (GST_ELEMENT_CAST (playbin), name);
- gst_element_post_message (GST_ELEMENT_CAST (playbin), msg);
-}
-
-/* make the element (bin) that contains the elements needed to perform
- * video display. We connect a handoff signal to identity so that we
- * can grab snapshots. Identity's sinkpad is ghosted to vbin.
- *
- * +-------------------------------------------------------------+
- * | vbin |
- * | +--------+ +----------+ +----------+ +---------+ |
- * | |identity| |colorspace| |videoscale| |videosink| |
- * | +-sink src-sink src-sink src-sink | |
- * | | +---+----+ +----------+ +----------+ +---------+ |
- * sink-+ | |
- * +----------|--------------------------------------------------+
- * handoff
- */
-static GstElement *
-gen_video_element (GstPlayBin * play_bin)
-{
- GstElement *element;
- GstElement *conv;
-
- GstElement *scale;
- GstElement *sink;
- GstElement *identity;
- GstPad *pad;
-
- /* first see if we have it in the cache */
- element = g_hash_table_lookup (play_bin->cache, "vbin");
- if (element != NULL) {
- return element;
- }
-
- if (play_bin->video_sink) {
- sink = play_bin->video_sink;
- } else {
- sink = gst_element_factory_make ("autovideosink", "videosink");
- if (sink == NULL) {
- sink = gst_element_factory_make ("xvimagesink", "videosink");
- }
- if (sink == NULL)
- goto no_sinks;
- }
- gst_object_ref (sink);
- g_hash_table_insert (play_bin->cache, "video_sink", sink);
-
- /* create a bin to hold objects, as we create them we add them to this bin so
- * that when something goes wrong we only need to unref the bin */
- element = gst_bin_new ("vbin");
- gst_bin_add (GST_BIN_CAST (element), sink);
-
- conv = gst_element_factory_make ("ffmpegcolorspace", "vconv");
- if (conv == NULL)
- goto no_colorspace;
- gst_bin_add (GST_BIN_CAST (element), conv);
-
- scale = gst_element_factory_make ("videoscale", "vscale");
- if (scale == NULL)
- goto no_videoscale;
- gst_bin_add (GST_BIN_CAST (element), scale);
-
- identity = gst_element_factory_make ("identity", "id");
- g_object_set (identity, "silent", TRUE, NULL);
- g_signal_connect (identity, "handoff", G_CALLBACK (handoff), play_bin);
- gst_bin_add (GST_BIN_CAST (element), identity);
-
- gst_element_link_pads (identity, "src", conv, "sink");
- gst_element_link_pads (conv, "src", scale, "sink");
- /* be more careful with the pad from the custom sink element, it might not
- * be named 'sink' */
- if (!gst_element_link_pads (scale, "src", sink, NULL))
- goto link_failed;
-
- pad = gst_element_get_static_pad (identity, "sink");
- gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- gst_element_set_state (element, GST_STATE_READY);
-
- /* since we're gonna add it to a bin but don't want to lose it,
- * we keep a reference. */
- gst_object_ref (element);
- g_hash_table_insert (play_bin->cache, "vbin", element);
-
- return element;
-
- /* ERRORS */
-no_sinks:
- {
- post_missing_element_message (play_bin, "autovideosink");
- GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
- (_("Both autovideosink and xvimagesink elements are missing.")),
- (NULL));
- return NULL;
- }
-no_colorspace:
- {
- post_missing_element_message (play_bin, "ffmpegcolorspace");
- GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "ffmpegcolorspace"), (NULL));
- gst_object_unref (element);
- return NULL;
- }
-
-no_videoscale:
- {
- post_missing_element_message (play_bin, "videoscale");
- GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "videoscale"), ("possibly a liboil version mismatch?"));
- gst_object_unref (element);
- return NULL;
- }
-link_failed:
- {
- GST_ELEMENT_ERROR (play_bin, CORE, PAD,
- (NULL), ("Failed to configure the video sink."));
- gst_object_unref (element);
- return NULL;
- }
-}
-
-/* make an element for playback of video with subtitles embedded.
- *
- * +--------------------------------------------------+
- * | tbin +-------------+ |
- * | +-----+ | textoverlay | +------+ |
- * | | csp | +--video_sink | | vbin | |
- * video_sink-sink src+ +-text_sink src---sink | |
- * | +-----+ | +-------------+ +------+ |
- * text_sink-------------+ |
- * +--------------------------------------------------+
- *
- * If there is no subtitle renderer this function will simply return the
- * videosink without the text_sink pad.
- */
-static GstElement *
-add_text_element (GstPlayBin * play_bin, GstElement * vbin)
-{
- GstElement *element, *csp, *overlay;
- GstPad *pad;
-
- /* Text overlay */
- overlay = gst_element_factory_make ("textoverlay", "overlay");
-
- /* If no overlay return the video bin without subtitle support. */
- if (!overlay)
- goto no_overlay;
-
- /* Create our bin */
- element = gst_bin_new ("textbin");
-
- /* Set some parameters */
- g_object_set (G_OBJECT (overlay),
- "halign", "center", "valign", "bottom", NULL);
- if (play_bin->font_desc) {
- g_object_set (G_OBJECT (overlay), "font-desc", play_bin->font_desc, NULL);
- }
-
- /* Take a ref */
- play_bin->textoverlay_element = GST_ELEMENT_CAST (gst_object_ref (overlay));
-
- /* we know this will succeed, as the video bin already created one before */
- csp = gst_element_factory_make ("ffmpegcolorspace", "subtitlecsp");
-
- /* Add our elements */
- gst_bin_add_many (GST_BIN_CAST (element), csp, overlay, vbin, NULL);
-
- /* Link */
- gst_element_link_pads (csp, "src", overlay, "video_sink");
- gst_element_link_pads (overlay, "src", vbin, "sink");
-
- /* Add ghost pads on the subtitle bin */
- pad = gst_element_get_static_pad (overlay, "text_sink");
- gst_element_add_pad (element, gst_ghost_pad_new ("text_sink", pad));
- gst_object_unref (pad);
-
- pad = gst_element_get_static_pad (csp, "sink");
- gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- /* If the vbin provides a subpicture sink pad, ghost it too */
- pad = gst_element_get_static_pad (vbin, "subpicture_sink");
- if (pad) {
- gst_element_add_pad (element, gst_ghost_pad_new ("subpicture_sink", pad));
- gst_object_unref (pad);
- }
-
- /* Set state to READY */
- gst_element_set_state (element, GST_STATE_READY);
-
- return element;
-
- /* ERRORS */
-no_overlay:
- {
- post_missing_element_message (play_bin, "textoverlay");
- GST_WARNING_OBJECT (play_bin,
- "No overlay (pango) element, subtitles disabled");
- return vbin;
- }
-}
-
-/* make an element for rendering DVD subpictures onto output video
- *
- * +---------------------------------------------+
- * | tbin +--------+ |
- * | +-----+ | | +------+ |
- * | | csp | src-videosink | | vbin | |
- * video_sink-sink src+ | src-sink | |
- * | +-----+ +subpicture | +------+ |
- * subpicture_pad--------+ +--------+ |
- * +---------- ----------------------------------+
- *
- */
-static GstElement *
-add_spu_element (GstPlayBin * play_bin, GstElement * vbin)
-{
- GstElement *element, *csp, *overlay;
- GstPad *pad;
-
- /* DVD spu overlay */
- GST_DEBUG_OBJECT (play_bin, "Attempting to insert DVD SPU element");
-
- overlay = gst_element_factory_make ("dvdspu", "overlay");
-
- /* If no overlay return the video bin without subpicture support. */
- if (!overlay)
- goto no_overlay;
-
- /* Create our bin */
- element = gst_bin_new ("spubin");
-
- /* Take a ref */
- play_bin->spu_element = GST_ELEMENT_CAST (gst_object_ref (overlay));
-
- /* we know this will succeed, as the video bin already created one before */
- csp = gst_element_factory_make ("ffmpegcolorspace", "spucsp");
-
- /* Add our elements */
- gst_bin_add_many (GST_BIN_CAST (element), csp, overlay, vbin, NULL);
-
- /* Link */
- gst_element_link_pads (csp, "src", overlay, "video");
- gst_element_link_pads (overlay, "src", vbin, "sink");
-
- /* Add ghost pad on the subpicture bin so it looks like vbin */
- pad = gst_element_get_static_pad (csp, "sink");
- gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- pad = gst_element_get_static_pad (overlay, "subpicture");
- gst_element_add_pad (element, gst_ghost_pad_new ("subpicture_sink", pad));
- gst_object_unref (pad);
-
- /* Set state to READY */
- gst_element_set_state (element, GST_STATE_READY);
-
- return element;
-
- /* ERRORS */
-no_overlay:
- {
- post_missing_element_message (play_bin, "dvdspu");
- GST_WARNING_OBJECT (play_bin,
- "No DVD overlay (dvdspu) element. "
- "menu highlight/subtitles unavailable");
- return vbin;
- }
-}
-
-/* make the element (bin) that contains the elements needed to perform
- * audio playback.
- *
- * +-------------------------------------------------------------+
- * | abin |
- * | +---------+ +----------+ +---------+ +---------+ |
- * | |audioconv| |audioscale| | volume | |audiosink| |
- * | +-sink src-sink src-sink src-sink | |
- * | | +---------+ +----------+ +---------+ +---------+ |
- * sink-+ |
- * +-------------------------------------------------------------+
- */
-static GstElement *
-gen_audio_element (GstPlayBin * play_bin)
-{
- gboolean res;
- GstElement *element;
- GstElement *conv;
- GstElement *scale;
- GstElement *sink;
- GstElement *volume;
- GstPad *pad;
-
- element = g_hash_table_lookup (play_bin->cache, "abin");
- if (element != NULL)
- return element;
-
- if (play_bin->audio_sink) {
- sink = play_bin->audio_sink;
- } else {
- sink = gst_element_factory_make ("autoaudiosink", "audiosink");
- if (sink == NULL) {
- sink = gst_element_factory_make ("alsasink", "audiosink");
- }
- if (sink == NULL)
- goto no_sinks;
-
- play_bin->audio_sink = GST_ELEMENT_CAST (gst_object_ref (sink));
- }
-
- gst_object_ref (sink);
- g_hash_table_insert (play_bin->cache, "audio_sink", sink);
-
- element = gst_bin_new ("abin");
- gst_bin_add (GST_BIN_CAST (element), sink);
-
- conv = gst_element_factory_make ("audioconvert", "aconv");
- if (conv == NULL)
- goto no_audioconvert;
- gst_bin_add (GST_BIN_CAST (element), conv);
-
- scale = gst_element_factory_make ("audioresample", "aresample");
- if (scale == NULL)
- goto no_audioresample;
- gst_bin_add (GST_BIN_CAST (element), scale);
-
- volume = gst_element_factory_make ("volume", "volume");
- if (volume == NULL)
- goto no_volume;
- g_object_set (G_OBJECT (volume), "volume", play_bin->volume, NULL);
- play_bin->volume_element = GST_ELEMENT_CAST (gst_object_ref (volume));
- gst_bin_add (GST_BIN_CAST (element), volume);
-
- res = gst_element_link_pads (conv, "src", scale, "sink");
- res &= gst_element_link_pads (scale, "src", volume, "sink");
- res &= gst_element_link_pads (volume, "src", sink, NULL);
- if (!res)
- goto link_failed;
-
- pad = gst_element_get_static_pad (conv, "sink");
- gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- gst_element_set_state (element, GST_STATE_READY);
-
- /* since we're gonna add it to a bin but don't want to lose it,
- * we keep a reference. */
- gst_object_ref (element);
- g_hash_table_insert (play_bin->cache, "abin", element);
-
- return element;
-
- /* ERRORS */
-no_sinks:
- {
- post_missing_element_message (play_bin, "autoaudiosink");
- GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
- (_("Both autoaudiosink and alsasink elements are missing.")), (NULL));
- return NULL;
- }
-no_audioconvert:
- {
- post_missing_element_message (play_bin, "audioconvert");
- GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "audioconvert"), ("possibly a liboil version mismatch?"));
- gst_object_unref (element);
- return NULL;
- }
-no_audioresample:
- {
- post_missing_element_message (play_bin, "audioresample");
- GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "audioresample"), ("possibly a liboil version mismatch?"));
- gst_object_unref (element);
- return NULL;
- }
-no_volume:
- {
- post_missing_element_message (play_bin, "volume");
- GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "volume"), ("possibly a liboil version mismatch?"));
- gst_object_unref (element);
- return NULL;
- }
-link_failed:
- {
- GST_ELEMENT_ERROR (play_bin, CORE, PAD,
- (NULL), ("Failed to configure the audio sink."));
- gst_object_unref (element);
- return NULL;
- }
-}
-
-/* make the element (bin) that contains the elements needed to perform
- * visualisation ouput. The idea is to split the audio using tee, then
- * sending the output to the regular audio bin and the other output to
- * the vis plugin that transforms it into a video that is rendered with the
- * normal video bin. The video and audio bins are run in threads to make sure
- * they don't block eachother.
- *
- * +-----------------------------------------------------------------------+
- * | visbin |
- * | +------+ +--------+ +----------------+ |
- * | | tee | | aqueue | | abin ... | |
- * | +-sink src-sink src-sink | |
- * | | | | +--------+ +----------------+ |
- * | | | | |
- * | | | | +------+ +------------+ +------+ +-----------+ |
- * | | | | |vqueue| | audioconv | | vis | | vbin ... | |
- * | | | src-sink src-sink + samp src-sink src-sink | |
- * | | | | +------+ +------------+ +------+ +-----------+ |
- * | | | | |
- * | | +------+ |
- * sink-+ |
- * +-----------------------------------------------------------------------+
- */
-static GstElement *
-gen_vis_element (GstPlayBin * play_bin)
-{
- gboolean res;
- GstElement *element;
- GstElement *tee;
- GstElement *asink;
- GstElement *vsink;
- GstElement *conv;
- GstElement *resamp;
- GstElement *conv2;
- GstElement *vis;
- GstElement *vqueue, *aqueue;
- GstPad *pad, *rpad;
-
- /* errors are already posted when these fail. */
- asink = gen_audio_element (play_bin);
- if (!asink)
- return NULL;
- vsink = gen_video_element (play_bin);
- if (!vsink) {
- gst_object_unref (asink);
- return NULL;
- }
-
- element = gst_bin_new ("visbin");
- tee = gst_element_factory_make ("tee", "tee");
-
- vqueue = gst_element_factory_make ("queue", "vqueue");
- aqueue = gst_element_factory_make ("queue", "aqueue");
-
- gst_bin_add (GST_BIN_CAST (element), asink);
- gst_bin_add (GST_BIN_CAST (element), vqueue);
- gst_bin_add (GST_BIN_CAST (element), aqueue);
- gst_bin_add (GST_BIN_CAST (element), vsink);
- gst_bin_add (GST_BIN_CAST (element), tee);
-
- conv = gst_element_factory_make ("audioconvert", "aconv");
- if (conv == NULL)
- goto no_audioconvert;
- gst_bin_add (GST_BIN_CAST (element), conv);
-
- resamp = gst_element_factory_make ("audioresample", "aresamp");
- if (resamp == NULL)
- goto no_audioresample;
- gst_bin_add (GST_BIN_CAST (element), resamp);
-
- conv2 = gst_element_factory_make ("audioconvert", "aconv2");
- if (conv2 == NULL)
- goto no_audioconvert;
- gst_bin_add (GST_BIN_CAST (element), conv2);
-
- if (play_bin->visualisation) {
- gst_object_ref (play_bin->visualisation);
- vis = play_bin->visualisation;
- } else {
- vis = gst_element_factory_make ("goom", "vis");
- if (!vis)
- goto no_goom;
- }
- gst_bin_add (GST_BIN_CAST (element), vis);
-
- res = gst_element_link_pads (vqueue, "src", conv, "sink");
- res &= gst_element_link_pads (conv, "src", resamp, "sink");
- res &= gst_element_link_pads (resamp, "src", conv2, "sink");
- res &= gst_element_link_pads (conv2, "src", vis, "sink");
- res &= gst_element_link_pads (vis, "src", vsink, "sink");
- if (!res)
- goto link_failed;
-
- pad = gst_element_get_static_pad (aqueue, "sink");
- rpad = gst_element_get_request_pad (tee, "src%d");
- gst_pad_link (rpad, pad);
- gst_object_unref (rpad);
- gst_object_unref (pad);
- gst_element_link_pads (aqueue, "src", asink, "sink");
-
- pad = gst_element_get_static_pad (vqueue, "sink");
- rpad = gst_element_get_request_pad (tee, "src%d");
- gst_pad_link (rpad, pad);
- gst_object_unref (rpad);
- gst_object_unref (pad);
-
- pad = gst_element_get_static_pad (tee, "sink");
- gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- return element;
-
- /* ERRORS */
-no_audioconvert:
- {
- post_missing_element_message (play_bin, "audioconvert");
- GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "audioconvert"), ("possibly a liboil version mismatch?"));
- gst_object_unref (element);
- return NULL;
- }
-no_audioresample:
- {
- post_missing_element_message (play_bin, "audioresample");
- GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "audioresample"), (NULL));
- gst_object_unref (element);
- return NULL;
- }
-no_goom:
- {
- post_missing_element_message (play_bin, "goom");
- GST_ELEMENT_ERROR (play_bin, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "goom"), (NULL));
- gst_object_unref (element);
- return NULL;
- }
-link_failed:
- {
- GST_ELEMENT_ERROR (play_bin, CORE, PAD,
- (NULL), ("Failed to configure the visualisation element."));
- gst_object_unref (element);
- return NULL;
- }
-}
-
-/* get rid of all installed sinks */
-static void
-remove_sinks (GstPlayBin * play_bin)
-{
- GList *sinks;
- GstObject *parent;
- GstElement *element;
- GstPad *pad, *peer;
-
- if (play_bin->cache == NULL)
- return;
-
- GST_DEBUG ("removesinks");
- element = g_hash_table_lookup (play_bin->cache, "abin");
- if (element != NULL) {
- parent = gst_element_get_parent (element);
- if (parent != NULL) {
- /* we remove the element from the parent so that
- * there is no unwanted state change when the parent
- * is disposed */
- play_bin->sinks = g_list_remove (play_bin->sinks, element);
- gst_element_set_state (element, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (parent), element);
- gst_object_unref (parent);
- }
- pad = gst_element_get_static_pad (element, "sink");
- if (pad != NULL) {
- peer = gst_pad_get_peer (pad);
- if (peer != NULL) {
- gst_pad_unlink (peer, pad);
- gst_object_unref (peer);
- }
- gst_object_unref (pad);
- }
- }
- element = g_hash_table_lookup (play_bin->cache, "vbin");
- if (element != NULL) {
- parent = gst_element_get_parent (element);
- if (parent != NULL) {
- play_bin->sinks = g_list_remove (play_bin->sinks, element);
- gst_element_set_state (element, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (parent), element);
- gst_object_unref (parent);
- }
- pad = gst_element_get_static_pad (element, "sink");
- if (pad != NULL) {
- peer = gst_pad_get_peer (pad);
- if (peer != NULL) {
- gst_pad_unlink (peer, pad);
- gst_object_unref (peer);
- }
- gst_object_unref (pad);
- }
- }
-
- for (sinks = play_bin->sinks; sinks; sinks = g_list_next (sinks)) {
- GstElement *element = GST_ELEMENT_CAST (sinks->data);
- GstPad *pad;
- GstPad *peer;
-
- pad = gst_element_get_static_pad (element, "sink");
-
- GST_LOG ("removing sink %p", element);
-
- peer = gst_pad_get_peer (pad);
- if (peer) {
- gst_pad_unlink (peer, pad);
- gst_object_unref (peer);
- }
- gst_object_unref (pad);
-
- gst_element_set_state (element, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (play_bin), element);
- }
- g_list_free (play_bin->sinks);
- play_bin->sinks = NULL;
-
- if (play_bin->visualisation) {
- GstElement *vis_bin;
-
- vis_bin =
- GST_ELEMENT_CAST (gst_element_get_parent (play_bin->visualisation));
-
- gst_element_set_state (play_bin->visualisation, GST_STATE_NULL);
-
- if (vis_bin) {
- gst_bin_remove (GST_BIN_CAST (vis_bin), play_bin->visualisation);
- gst_object_unref (vis_bin);
- }
- }
-
- if (play_bin->frame) {
- gst_buffer_unref (play_bin->frame);
- play_bin->frame = NULL;
- }
-
- if (play_bin->textoverlay_element) {
- gst_object_unref (play_bin->textoverlay_element);
- play_bin->textoverlay_element = NULL;
- }
-
- if (play_bin->volume_element) {
- gst_object_unref (play_bin->volume_element);
- play_bin->volume_element = NULL;
- }
-}
-
-/* loop over the streams and set up the pipeline to play this
- * media file. First we count the number of audio and video streams.
- * If there is no video stream but there exists an audio stream,
- * we install a visualisation pipeline.
- *
- * Also make sure to only connect the first audio and video pad. FIXME
- * this should eventually be handled with a tuner interface so that
- * one can switch the streams.
- *
- * This function takes ownership of @sink.*
- */
-static gboolean
-add_sink (GstPlayBin * play_bin, GstElement * sink, GstPad * srcpad,
- GstPad * subtitle_pad)
-{
- GstPad *sinkpad;
- GstPadLinkReturn linkres;
- GstElement *parent;
- GstStateChangeReturn stateret;
- GstState state;
-
- g_return_val_if_fail (sink != NULL, FALSE);
-
- state = GST_STATE_PAUSED;
-
- /* this is only for debugging */
- parent = gst_pad_get_parent_element (srcpad);
- if (parent) {
- GST_DEBUG ("Adding sink %" GST_PTR_FORMAT
- " with state %d (parent: %d, peer: %d)", sink,
- GST_STATE (sink), GST_STATE (play_bin), GST_STATE (parent));
- gst_object_unref (parent);
- }
- gst_bin_add (GST_BIN_CAST (play_bin), sink);
-
- /* bring it to the required state so we can link to the peer without
- * breaking the flow */
- stateret = gst_element_set_state (sink, state);
- if (stateret == GST_STATE_CHANGE_FAILURE)
- goto state_failed;
-
- /* we found a sink for this stream, now try to install it */
- sinkpad = gst_element_get_static_pad (sink, "sink");
- linkres = gst_pad_link (srcpad, sinkpad);
- gst_object_unref (sinkpad);
-
- /* try to link the pad of the sink to the stream */
- if (GST_PAD_LINK_FAILED (linkres))
- goto link_failed;
-
- if (GST_IS_PAD (subtitle_pad)) {
- sinkpad = gst_element_get_static_pad (sink, "text_sink");
- linkres = gst_pad_link (subtitle_pad, sinkpad);
- gst_object_unref (sinkpad);
- }
-
- /* try to link the subtitle pad of the sink to the stream, this is not
- * fatal. */
- if (GST_PAD_LINK_FAILED (linkres))
- goto subtitle_failed;
-
-done:
- /* we got the sink succesfully linked, now keep the sink
- * in our internal list */
- play_bin->sinks = g_list_prepend (play_bin->sinks, sink);
-
- return TRUE;
-
- /* ERRORS */
-state_failed:
- {
- gst_element_set_state (sink, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (play_bin), sink);
- GST_DEBUG_OBJECT (play_bin, "state change failure when adding sink");
- return FALSE;
- }
-link_failed:
- {
- gchar *capsstr;
- GstCaps *caps;
-
- /* could not link this stream */
- caps = gst_pad_get_caps (srcpad);
- capsstr = gst_caps_to_string (caps);
- g_warning ("could not link %s: %d", capsstr, linkres);
- GST_DEBUG_OBJECT (play_bin,
- "link failed when adding sink, caps %s, reason %d", capsstr, linkres);
- g_free (capsstr);
- gst_caps_unref (caps);
-
- gst_element_set_state (sink, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (play_bin), sink);
- return FALSE;
- }
-subtitle_failed:
- {
- GstCaps *caps;
-
- /* could not link this stream */
- caps = gst_pad_get_caps (subtitle_pad);
- GST_WARNING_OBJECT (play_bin, "subtitle link failed when adding sink, "
- "caps = %" GST_PTR_FORMAT ", reason %d", caps, linkres);
- gst_caps_unref (caps);
-
- /* not fatal */
- goto done;
- }
-}
-
-static void
-dummy_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
-{
-}
-
-static gboolean
-setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group)
-{
- GstPlayBin *play_bin = GST_PLAY_BIN (play_base_bin);
- gboolean have_video = FALSE;
- gboolean need_vis = FALSE;
- gboolean need_text = FALSE;
- gboolean need_spu = FALSE;
- GstPad *textsrcpad = NULL, *pad = NULL, *origtextsrcpad = NULL;
- GstElement *sink;
- gboolean res = TRUE;
-
- /* get rid of existing sinks */
- if (play_bin->sinks) {
- remove_sinks (play_bin);
- }
- GST_DEBUG_OBJECT (play_base_bin, "setupsinks");
-
- /* find out what to do */
- have_video = (group->type[GST_STREAM_TYPE_VIDEO - 1].npads > 0);
- need_spu = (group->type[GST_STREAM_TYPE_SUBPICTURE - 1].npads != 0);
-
- if (have_video && group->type[GST_STREAM_TYPE_TEXT - 1].npads > 0) {
- need_text = TRUE;
- } else if (!have_video &&
- group->type[GST_STREAM_TYPE_AUDIO - 1].npads > 0 &&
- play_bin->visualisation != NULL) {
- need_vis = TRUE;
- }
-
- /* now actually connect everything */
-
- /* link audio */
- if (group->type[GST_STREAM_TYPE_AUDIO - 1].npads > 0) {
- if (need_vis) {
- sink = gen_vis_element (play_bin);
- } else {
- sink = gen_audio_element (play_bin);
- }
- if (!sink)
- return FALSE;
-
- pad =
- gst_element_get_static_pad (group->type[GST_STREAM_TYPE_AUDIO -
- 1].preroll, "src");
- res = add_sink (play_bin, sink, pad, NULL);
- gst_object_unref (pad);
- }
-
- /* link video */
- if (have_video) {
- /* Create the video rendering bin, error is posted when this fails. */
- sink = gen_video_element (play_bin);
- if (!sink)
- return FALSE;
- if (need_spu) {
- sink = add_spu_element (play_bin, sink);
- }
-
- if (need_text) {
- GstObject *parent = NULL, *grandparent = NULL;
- GstPad *ghost = NULL;
-
- /* Add the subtitle overlay element into the video sink */
- sink = add_text_element (play_bin, sink);
-
- /* Link the incoming subtitle stream into the output bin */
- textsrcpad =
- gst_element_get_static_pad (group->type[GST_STREAM_TYPE_TEXT -
- 1].preroll, "src");
-
- /* This pad is from subtitle-bin, we need to create a ghost pad to have
- common grandparents */
- parent = gst_object_get_parent (GST_OBJECT_CAST (textsrcpad));
- if (!parent) {
- GST_WARNING_OBJECT (textsrcpad, "subtitle pad has no parent !");
- gst_object_unref (textsrcpad);
- textsrcpad = NULL;
- goto beach;
- }
-
- grandparent = gst_object_get_parent (parent);
- if (!grandparent) {
- GST_WARNING_OBJECT (textsrcpad, "subtitle pad has no grandparent !");
- gst_object_unref (parent);
- gst_object_unref (textsrcpad);
- textsrcpad = NULL;
- goto beach;
- }
-
- /* We ghost the pad on subtitle_bin only, if the text pad is from the
- media demuxer we keep it as it is */
- if (!GST_IS_PLAY_BIN (grandparent)) {
- GST_DEBUG_OBJECT (textsrcpad, "this subtitle pad is from a subtitle "
- "file, ghosting to a suitable hierarchy");
- /* Block the pad first, because as soon as we add a ghostpad, the queue
- * will try and start pushing */
- gst_pad_set_blocked_async (textsrcpad, TRUE, dummy_blocked_cb, NULL);
- origtextsrcpad = gst_object_ref (textsrcpad);
-
- ghost = gst_ghost_pad_new ("text_src", textsrcpad);
- if (!GST_IS_PAD (ghost)) {
- GST_WARNING_OBJECT (textsrcpad, "failed creating ghost pad for "
- "subtitle-bin");
- gst_object_unref (parent);
- gst_object_unref (grandparent);
- gst_object_unref (textsrcpad);
- textsrcpad = NULL;
- goto beach;
- }
-
- gst_pad_set_active (ghost, TRUE);
- if (gst_element_add_pad (GST_ELEMENT_CAST (grandparent), ghost)) {
- gst_object_unref (textsrcpad);
- textsrcpad = gst_object_ref (ghost);
- } else {
- GST_WARNING_OBJECT (ghost, "failed adding ghost pad on subtitle-bin");
- gst_pad_set_active (ghost, FALSE);
- gst_object_unref (ghost);
- gst_object_unref (textsrcpad);
- textsrcpad = NULL;
- }
- } else {
- GST_DEBUG_OBJECT (textsrcpad, "this subtitle pad is from the demuxer "
- "no changes to hierarchy needed");
- }
-
- gst_object_unref (parent);
- gst_object_unref (grandparent);
- }
- beach:
- if (!sink)
- return FALSE;
- pad =
- gst_element_get_static_pad (group->type[GST_STREAM_TYPE_VIDEO -
- 1].preroll, "src");
- res = add_sink (play_bin, sink, pad, textsrcpad);
- gst_object_unref (pad);
- if (textsrcpad)
- gst_object_unref (textsrcpad);
- if (origtextsrcpad) {
- gst_pad_set_blocked_async (origtextsrcpad, FALSE, dummy_blocked_cb, NULL);
- gst_object_unref (origtextsrcpad);
- }
-
- /* If we have a DVD subpicture stream, link it to the SPU now */
- if (need_spu) {
- GstPad *subpic_pad;
- GstPad *spu_sink_pad;
-
- subpic_pad =
- gst_element_get_static_pad (group->type[GST_STREAM_TYPE_SUBPICTURE
- - 1].preroll, "src");
- spu_sink_pad = gst_element_get_static_pad (sink, "subpicture_sink");
- if (subpic_pad && spu_sink_pad) {
- GST_LOG_OBJECT (play_bin, "Linking DVD subpicture stream onto SPU");
- gst_pad_set_blocked_async (subpic_pad, TRUE, dummy_blocked_cb, NULL);
- if (gst_pad_link (subpic_pad, spu_sink_pad) != GST_PAD_LINK_OK) {
- GST_WARNING_OBJECT (play_bin,
- "Failed to link DVD subpicture stream onto SPU");
- }
- gst_pad_set_blocked_async (subpic_pad, FALSE, dummy_blocked_cb, NULL);
- }
- if (subpic_pad)
- gst_object_unref (subpic_pad);
- if (spu_sink_pad)
- gst_object_unref (spu_sink_pad);
- }
- }
-
- /* remove the sinks now, pipeline get_state will now wait for the
- * sinks to preroll */
- if (play_bin->fakesink) {
- gst_element_set_state (play_bin->fakesink, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (play_bin), play_bin->fakesink);
- play_bin->fakesink = NULL;
- }
-
- return res;
-}
-
-static void
-playbin_set_subtitles_visible (GstPlayBaseBin * play_base_bin, gboolean visible)
-{
- GstPlayBin *playbin = GST_PLAY_BIN (play_base_bin);
-
- /* we're ignoring the case of someone setting the 'current-text' property
- * before textoverlay is set up (which is probably okay, since playbasebin
- * will just select the first subtitle stream as active stream regardless) */
- if (playbin->textoverlay_element != NULL) {
- GST_LOG_OBJECT (playbin, "setting subtitle visibility to %d", visible);
- g_object_set (playbin->textoverlay_element, "silent", !visible, NULL);
- }
-}
-
-static void
-playbin_set_audio_mute (GstPlayBaseBin * play_base_bin, gboolean mute)
-{
- GstPlayBin *playbin = GST_PLAY_BIN (play_base_bin);
-
- if (playbin->volume_element) {
- g_object_set (G_OBJECT (playbin->volume_element), "mute", mute, NULL);
- }
-}
-
-/* Send an event to our sinks until one of them works; don't then send to the
- * remaining sinks (unlike GstBin)
- */
-static gboolean
-gst_play_bin_send_event_to_sink (GstPlayBin * play_bin, GstEvent * event)
-{
- GList *sinks = play_bin->sinks;
- gboolean res = TRUE;
-
- while (sinks) {
- GstElement *sink = GST_ELEMENT_CAST (sinks->data);
-
- gst_event_ref (event);
- if ((res = gst_element_send_event (sink, event))) {
- GST_DEBUG_OBJECT (play_bin,
- "Sent event succesfully to sink %" GST_PTR_FORMAT, sink);
- break;
- }
- GST_DEBUG_OBJECT (play_bin,
- "Event failed when sent to sink %" GST_PTR_FORMAT, sink);
-
- sinks = g_list_next (sinks);
- }
-
- gst_event_unref (event);
-
- return res;
-}
-
-/* We only want to send the event to a single sink (overriding GstBin's
- * behaviour), but we want to keep GstPipeline's behaviour - wrapping seek
- * events appropriately. So, this is a messy duplication of code. */
-static gboolean
-gst_play_bin_send_event (GstElement * element, GstEvent * event)
-{
- gboolean res = FALSE;
- GstEventType event_type = GST_EVENT_TYPE (event);
-
- switch (event_type) {
- case GST_EVENT_SEEK:
- GST_DEBUG_OBJECT (element, "Sending seek event to a sink");
- res = gst_play_bin_send_event_to_sink (GST_PLAY_BIN (element), event);
- break;
- default:
- res = parent_class->send_event (element, event);
- break;
- }
-
- return res;
-}
-
-static void
-value_list_append_structure_list (GValue * list_val, GstStructure ** first,
- GList * structure_list)
-{
- GList *l;
-
- for (l = structure_list; l != NULL; l = l->next) {
- GValue val = { 0, };
-
- if (*first == NULL)
- *first = gst_structure_copy ((GstStructure *) l->data);
-
- g_value_init (&val, GST_TYPE_STRUCTURE);
- g_value_take_boxed (&val, gst_structure_copy ((GstStructure *) l->data));
- gst_value_list_append_value (list_val, &val);
- g_value_unset (&val);
- }
-}
-
-/* if it's a redirect message with multiple redirect locations we might
- * want to pick a different 'best' location depending on the required
- * bitrates and the connection speed */
-static GstMessage *
-gst_play_bin_handle_redirect_message (GstPlayBin * playbin, GstMessage * msg)
-{
- const GValue *locations_list, *location_val;
- GstMessage *new_msg;
- GstStructure *new_structure = NULL;
- GList *l_good = NULL, *l_neutral = NULL, *l_bad = NULL;
- GValue new_list = { 0, };
- guint size, i;
- GstPlayBaseBin *playbasebin = GST_PLAY_BASE_BIN (playbin);
- guint connection_speed = playbasebin->connection_speed;
-
- GST_DEBUG_OBJECT (playbin, "redirect message: %" GST_PTR_FORMAT, msg);
- GST_DEBUG_OBJECT (playbin, "connection speed: %u", connection_speed);
-
- if (connection_speed == 0 || msg->structure == NULL)
- return msg;
-
- locations_list = gst_structure_get_value (msg->structure, "locations");
- if (locations_list == NULL)
- return msg;
-
- size = gst_value_list_get_size (locations_list);
- if (size < 2)
- return msg;
-
- /* maintain existing order as much as possible, just sort references
- * with too high a bitrate to the end (the assumption being that if
- * bitrates are given they are given for all interesting streams and
- * that the you-need-at-least-version-xyz redirect has the same bitrate
- * as the lowest referenced redirect alternative) */
- for (i = 0; i < size; ++i) {
- const GstStructure *s;
- gint bitrate = 0;
-
- location_val = gst_value_list_get_value (locations_list, i);
- s = (const GstStructure *) g_value_get_boxed (location_val);
- if (!gst_structure_get_int (s, "minimum-bitrate", &bitrate) || bitrate <= 0) {
- GST_DEBUG_OBJECT (playbin, "no bitrate: %" GST_PTR_FORMAT, s);
- l_neutral = g_list_append (l_neutral, (gpointer) s);
- } else if (bitrate > connection_speed) {
- GST_DEBUG_OBJECT (playbin, "bitrate too high: %" GST_PTR_FORMAT, s);
- l_bad = g_list_append (l_bad, (gpointer) s);
- } else if (bitrate <= connection_speed) {
- GST_DEBUG_OBJECT (playbin, "bitrate OK: %" GST_PTR_FORMAT, s);
- l_good = g_list_append (l_good, (gpointer) s);
- }
- }
-
- g_value_init (&new_list, GST_TYPE_LIST);
- value_list_append_structure_list (&new_list, &new_structure, l_good);
- value_list_append_structure_list (&new_list, &new_structure, l_neutral);
- value_list_append_structure_list (&new_list, &new_structure, l_bad);
- gst_structure_set_value (new_structure, "locations", &new_list);
- g_value_unset (&new_list);
-
- g_list_free (l_good);
- g_list_free (l_neutral);
- g_list_free (l_bad);
-
- new_msg = gst_message_new_element (msg->src, new_structure);
- gst_message_unref (msg);
-
- GST_DEBUG_OBJECT (playbin, "new redirect message: %" GST_PTR_FORMAT, new_msg);
- return new_msg;
-}
-
-static void
-gst_play_bin_handle_message (GstBin * bin, GstMessage * msg)
-{
- if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ELEMENT && msg->structure != NULL
- && gst_structure_has_name (msg->structure, "redirect")) {
- msg = gst_play_bin_handle_redirect_message (GST_PLAY_BIN (bin), msg);
- }
-
- GST_BIN_CLASS (parent_class)->handle_message (bin, msg);
-}
-
-static GstStateChangeReturn
-gst_play_bin_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret;
- GstPlayBin *play_bin;
-
- play_bin = GST_PLAY_BIN (element);
-
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- /* this really is the easiest way to make the state change return
- * ASYNC until we added the sinks */
- if (!play_bin->fakesink) {
- play_bin->fakesink = gst_element_factory_make ("fakesink", "test");
- gst_bin_add (GST_BIN_CAST (play_bin), play_bin->fakesink);
- }
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- if (ret == GST_STATE_CHANGE_FAILURE)
- return ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- /* remember us being a live pipeline */
- play_bin->is_live = (ret == GST_STATE_CHANGE_NO_PREROLL);
- GST_DEBUG_OBJECT (play_bin, "is live: %d", play_bin->is_live);
- break;
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- /* FIXME Release audio device when we implement that */
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- case GST_STATE_CHANGE_READY_TO_NULL:
- /* remove sinks we added */
- remove_sinks (play_bin);
- /* and there might be a fakesink we need to clean up now */
- if (play_bin->fakesink) {
- gst_element_set_state (play_bin->fakesink, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (play_bin), play_bin->fakesink);
- play_bin->fakesink = NULL;
- }
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-gboolean
-gst_play_bin_plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (gst_play_bin_debug, "playbin", 0, "play bin");
-
- return gst_element_register (plugin, "playbin", GST_RANK_NONE,
- GST_TYPE_PLAY_BIN);
-}
diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c
deleted file mode 100644
index f76a30ec..00000000
--- a/gst/playback/gstplaybin2.c
+++ /dev/null
@@ -1,3630 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-playbin2
- *
- * Playbin2 provides a stand-alone everything-in-one abstraction for an
- * audio and/or video player.
- *
- * At this stage, playbin2 is considered UNSTABLE. The API provided in the
- * signals and properties may yet change in the near future. When playbin2
- * is stable, it will probably replace #playbin
- *
- * It can handle both audio and video files and features
- * <itemizedlist>
- * <listitem>
- * automatic file type recognition and based on that automatic
- * selection and usage of the right audio/video/subtitle demuxers/decoders
- * </listitem>
- * <listitem>
- * visualisations for audio files
- * </listitem>
- * <listitem>
- * subtitle support for video files. Subtitles can be store in external
- * files.
- * </listitem>
- * <listitem>
- * stream selection between different video/audio/subtitles streams
- * </listitem>
- * <listitem>
- * meta info (tag) extraction
- * </listitem>
- * <listitem>
- * easy access to the last video frame
- * </listitem>
- * <listitem>
- * buffering when playing streams over a network
- * </listitem>
- * <listitem>
- * volume control with mute option
- * </listitem>
- * </itemizedlist>
- *
- * <refsect2>
- * <title>Usage</title>
- * <para>
- * A playbin element can be created just like any other element using
- * gst_element_factory_make(). The file/URI to play should be set via the #GstPlayBin2:uri
- * property. This must be an absolute URI, relative file paths are not allowed.
- * Example URIs are file:///home/joe/movie.avi or http://www.joedoe.com/foo.ogg
- *
- * Playbin is a #GstPipeline. It will notify the application of everything
- * that's happening (errors, end of stream, tags found, state changes, etc.)
- * by posting messages on its #GstBus. The application needs to watch the
- * bus.
- *
- * Playback can be initiated by setting the element to PLAYING state using
- * gst_element_set_state(). Note that the state change will take place in
- * the background in a separate thread, when the function returns playback
- * is probably not happening yet and any errors might not have occured yet.
- * Applications using playbin should ideally be written to deal with things
- * completely asynchroneous.
- *
- * When playback has finished (an EOS message has been received on the bus)
- * or an error has occured (an ERROR message has been received on the bus) or
- * the user wants to play a different track, playbin should be set back to
- * READY or NULL state, then the #GstPlayBin2:uri property should be set to the
- * new location and then playbin be set to PLAYING state again.
- *
- * Seeking can be done using gst_element_seek_simple() or gst_element_seek()
- * on the playbin element. Again, the seek will not be executed
- * instantaneously, but will be done in a background thread. When the seek
- * call returns the seek will most likely still be in process. An application
- * may wait for the seek to finish (or fail) using gst_element_get_state() with
- * -1 as the timeout, but this will block the user interface and is not
- * recommended at all.
- *
- * Applications may query the current position and duration of the stream
- * via gst_element_query_position() and gst_element_query_duration() and
- * setting the format passed to GST_FORMAT_TIME. If the query was successful,
- * the duration or position will have been returned in units of nanoseconds.
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>Advanced Usage: specifying the audio and video sink</title>
- * <para>
- * By default, if no audio sink or video sink has been specified via the
- * #GstPlayBin2:audio-sink or #GstPlayBin2:video-sink property, playbin will use the autoaudiosink
- * and autovideosink elements to find the first-best available output method.
- * This should work in most cases, but is not always desirable. Often either
- * the user or application might want to specify more explicitly what to use
- * for audio and video output.
- *
- * If the application wants more control over how audio or video should be
- * output, it may create the audio/video sink elements itself (for example
- * using gst_element_factory_make()) and provide them to playbin using the
- * #GstPlayBin2:audio-sink or #GstPlayBin2:video-sink property.
- *
- * GNOME-based applications, for example, will usually want to create
- * gconfaudiosink and gconfvideosink elements and make playbin use those,
- * so that output happens to whatever the user has configured in the GNOME
- * Multimedia System Selector configuration dialog.
- *
- * The sink elements do not necessarily need to be ready-made sinks. It is
- * possible to create container elements that look like a sink to playbin,
- * but in reality contain a number of custom elements linked together. This
- * can be achieved by creating a #GstBin and putting elements in there and
- * linking them, and then creating a sink #GstGhostPad for the bin and pointing
- * it to the sink pad of the first element within the bin. This can be used
- * for a number of purposes, for example to force output to a particular
- * format or to modify or observe the data before it is output.
- *
- * It is also possible to 'suppress' audio and/or video output by using
- * 'fakesink' elements (or capture it from there using the fakesink element's
- * "handoff" signal, which, nota bene, is fired from the streaming thread!).
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>Retrieving Tags and Other Meta Data</title>
- * <para>
- * Most of the common meta data (artist, title, etc.) can be retrieved by
- * watching for TAG messages on the pipeline's bus (see above).
- *
- * Other more specific meta information like width/height/framerate of video
- * streams or samplerate/number of channels of audio streams can be obtained
- * from the negotiated caps on the sink pads of the sinks.
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>Buffering</title>
- * Playbin handles buffering automatically for the most part, but applications
- * need to handle parts of the buffering process as well. Whenever playbin is
- * buffering, it will post BUFFERING messages on the bus with a percentage
- * value that shows the progress of the buffering process. Applications need
- * to set playbin to PLAYING or PAUSED state in response to these messages.
- * They may also want to convey the buffering progress to the user in some
- * way. Here is how to extract the percentage information from the message
- * (requires GStreamer >= 0.10.11):
- * |[
- * switch (GST_MESSAGE_TYPE (msg)) {
- * case GST_MESSAGE_BUFFERING: {
- * gint percent = 0;
- * gst_message_parse_buffering (msg, &amp;percent);
- * g_print ("Buffering (%%u percent done)", percent);
- * break;
- * }
- * ...
- * }
- * ]|
- * Note that applications should keep/set the pipeline in the PAUSED state when
- * a BUFFERING message is received with a buffer percent value < 100 and set
- * the pipeline back to PLAYING state when a BUFFERING message with a value
- * of 100 percent is received (if PLAYING is the desired state, that is).
- * </refsect2>
- * <refsect2>
- * <title>Embedding the video window in your application</title>
- * By default, playbin (or rather the video sinks used) will create their own
- * window. Applications will usually want to force output to a window of their
- * own, however. This can be done using the #GstXOverlay interface, which most
- * video sinks implement. See the documentation there for more details.
- * </refsect2>
- * <refsect2>
- * <title>Specifying which CD/DVD device to use</title>
- * The device to use for CDs/DVDs needs to be set on the source element
- * playbin creates before it is opened. The only way to do this at the moment
- * is to connect to playbin's "notify::source" signal, which will be emitted
- * by playbin when it has created the source element for a particular URI.
- * In the signal callback you can check if the source element has a "device"
- * property and set it appropriately. In future ways might be added to specify
- * the device as part of the URI, but at the time of writing this is not
- * possible yet.
- * </refsect2>
- * <refsect2>
- * <title>Handling redirects</title>
- * <para>
- * Some elements may post 'redirect' messages on the bus to tell the
- * application to open another location. These are element messages containing
- * a structure named 'redirect' along with a 'new-location' field of string
- * type. The new location may be a relative or an absolute URI. Examples
- * for such redirects can be found in many quicktime movie trailers.
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>Examples</title>
- * |[
- * gst-launch -v playbin uri=file:///path/to/somefile.avi
- * ]| This will play back the given AVI video file, given that the video and
- * audio decoders required to decode the content are installed. Since no
- * special audio sink or video sink is supplied (not possible via gst-launch),
- * playbin will try to find a suitable audio and video sink automatically
- * using the autoaudiosink and autovideosink elements.
- * |[
- * gst-launch -v playbin uri=cdda://4
- * ]| This will play back track 4 on an audio CD in your disc drive (assuming
- * the drive is detected automatically by the plugin).
- * |[
- * gst-launch -v playbin uri=dvd://1
- * ]| This will play back title 1 of a DVD in your disc drive (assuming
- * the drive is detected automatically by the plugin).
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <gst/gst.h>
-
-#include <gst/gst-i18n-plugin.h>
-#include <gst/pbutils/pbutils.h>
-#include <gst/interfaces/streamvolume.h>
-
-#include "gstplay-enum.h"
-#include "gstplay-marshal.h"
-#include "gstplaysink.h"
-#include "gstfactorylists.h"
-#include "gstinputselector.h"
-#include "gstscreenshot.h"
-#include "gstsubtitleoverlay.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_play_bin_debug);
-#define GST_CAT_DEFAULT gst_play_bin_debug
-
-#define GST_TYPE_PLAY_BIN (gst_play_bin_get_type())
-#define GST_PLAY_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLAY_BIN,GstPlayBin))
-#define GST_PLAY_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLAY_BIN,GstPlayBinClass))
-#define GST_IS_PLAY_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAY_BIN))
-#define GST_IS_PLAY_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAY_BIN))
-
-#define VOLUME_MAX_DOUBLE 10.0
-
-typedef struct _GstPlayBin GstPlayBin;
-typedef struct _GstPlayBinClass GstPlayBinClass;
-typedef struct _GstSourceGroup GstSourceGroup;
-typedef struct _GstSourceSelect GstSourceSelect;
-
-typedef GstCaps *(*SourceSelectGetMediaCapsFunc) (void);
-
-/* has the info for a selector and provides the link to the sink */
-struct _GstSourceSelect
-{
- const gchar *media_list[8]; /* the media types for the selector */
- SourceSelectGetMediaCapsFunc get_media_caps; /* more complex caps for the selector */
- GstPlaySinkType type; /* the sink pad type of the selector */
-
- GstElement *selector; /* the selector */
- GPtrArray *channels;
- GstPad *srcpad; /* the source pad of the selector */
- GstPad *sinkpad; /* the sinkpad of the sink when the selector
- * is linked
- */
-
- gulong src_event_probe_id;
- gulong sink_event_probe_id;
- GstClockTime group_start_accum;
-};
-
-#define GST_SOURCE_GROUP_GET_LOCK(group) (((GstSourceGroup*)(group))->lock)
-#define GST_SOURCE_GROUP_LOCK(group) (g_mutex_lock (GST_SOURCE_GROUP_GET_LOCK(group)))
-#define GST_SOURCE_GROUP_UNLOCK(group) (g_mutex_unlock (GST_SOURCE_GROUP_GET_LOCK(group)))
-
-/* a structure to hold the objects for decoding a uri and the subtitle uri
- */
-struct _GstSourceGroup
-{
- GstPlayBin *playbin;
-
- GMutex *lock;
-
- gboolean valid; /* the group has valid info to start playback */
- gboolean active; /* the group is active */
-
- /* properties */
- gchar *uri;
- gchar *suburi;
- GValueArray *streaminfo;
- GstElement *source;
-
- GPtrArray *video_channels; /* links to selector pads */
- GPtrArray *audio_channels; /* links to selector pads */
- GPtrArray *text_channels; /* links to selector pads */
-
- GstElement *audio_sink; /* autoplugged audio and video sinks */
- GstElement *video_sink;
-
- /* uridecodebins for uri and subtitle uri */
- GstElement *uridecodebin;
- GstElement *suburidecodebin;
- gint pending;
- gboolean sub_pending;
-
- gulong pad_added_id;
- gulong pad_removed_id;
- gulong no_more_pads_id;
- gulong notify_source_id;
- gulong drained_id;
- gulong autoplug_factories_id;
- gulong autoplug_select_id;
- gulong autoplug_continue_id;
-
- gulong sub_pad_added_id;
- gulong sub_pad_removed_id;
- gulong sub_no_more_pads_id;
- gulong sub_autoplug_continue_id;
-
- GMutex *stream_changed_pending_lock;
- GList *stream_changed_pending;
-
- /* selectors for different streams */
- GstSourceSelect selector[GST_PLAY_SINK_TYPE_LAST];
-};
-
-#define GST_PLAY_BIN_GET_LOCK(bin) (((GstPlayBin*)(bin))->lock)
-#define GST_PLAY_BIN_LOCK(bin) (g_mutex_lock (GST_PLAY_BIN_GET_LOCK(bin)))
-#define GST_PLAY_BIN_UNLOCK(bin) (g_mutex_unlock (GST_PLAY_BIN_GET_LOCK(bin)))
-
-/* lock to protect dynamic callbacks, like no-more-pads */
-#define GST_PLAY_BIN_DYN_LOCK(bin) g_mutex_lock ((bin)->dyn_lock)
-#define GST_PLAY_BIN_DYN_UNLOCK(bin) g_mutex_unlock ((bin)->dyn_lock)
-
-/* lock for shutdown */
-#define GST_PLAY_BIN_SHUTDOWN_LOCK(bin,label) \
-G_STMT_START { \
- if (G_UNLIKELY (g_atomic_int_get (&bin->shutdown))) \
- goto label; \
- GST_PLAY_BIN_DYN_LOCK (bin); \
- if (G_UNLIKELY (g_atomic_int_get (&bin->shutdown))) { \
- GST_PLAY_BIN_DYN_UNLOCK (bin); \
- goto label; \
- } \
-} G_STMT_END
-
-/* unlock for shutdown */
-#define GST_PLAY_BIN_SHUTDOWN_UNLOCK(bin) \
- GST_PLAY_BIN_DYN_UNLOCK (bin); \
-
-/**
- * GstPlayBin2:
- *
- * playbin element structure
- */
-struct _GstPlayBin
-{
- GstPipeline parent;
-
- GMutex *lock; /* to protect group switching */
-
- /* the groups, we use a double buffer to switch between current and next */
- GstSourceGroup groups[2]; /* array with group info */
- GstSourceGroup *curr_group; /* pointer to the currently playing group */
- GstSourceGroup *next_group; /* pointer to the next group */
-
- /* properties */
- guint connection_speed; /* connection speed in bits/sec (0 = unknown) */
- gint current_video; /* the currently selected stream */
- gint current_audio; /* the currently selected stream */
- gint current_text; /* the currently selected stream */
-
- guint64 buffer_duration; /* When buffering, the max buffer duration (ns) */
- guint buffer_size; /* When buffering, the max buffer size (bytes) */
-
- /* our play sink */
- GstPlaySink *playsink;
-
- /* the last activated source */
- GstElement *source;
-
- /* lock protecting dynamic adding/removing */
- GMutex *dyn_lock;
- /* if we are shutting down or not */
- gint shutdown;
-
- GMutex *elements_lock;
- guint32 elements_cookie;
- GValueArray *elements; /* factories we can use for selecting elements */
-
- gboolean have_selector; /* set to FALSE when we fail to create an
- * input-selector, so that we only post a
- * warning once */
-
- GstElement *audio_sink; /* configured audio sink, or NULL */
- GstElement *video_sink; /* configured video sink, or NULL */
- GstElement *text_sink; /* configured text sink, or NULL */
-
- struct
- {
- gboolean valid;
- GstFormat format;
- gint64 duration;
- } duration[5]; /* cached durations */
-
- GstSegment segments[3]; /* Video/Audio/Text segments */
-};
-
-struct _GstPlayBinClass
-{
- GstPipelineClass parent_class;
-
- /* notify app that the current uri finished decoding and it is possible to
- * queue a new one for gapless playback */
- void (*about_to_finish) (GstPlayBin * playbin);
-
- /* notify app that number of audio/video/text streams changed */
- void (*video_changed) (GstPlayBin * playbin);
- void (*audio_changed) (GstPlayBin * playbin);
- void (*text_changed) (GstPlayBin * playbin);
-
- /* notify app that the tags of audio/video/text streams changed */
- void (*video_tags_changed) (GstPlayBin * playbin, gint stream);
- void (*audio_tags_changed) (GstPlayBin * playbin, gint stream);
- void (*text_tags_changed) (GstPlayBin * playbin, gint stream);
-
- /* get audio/video/text tags for a stream */
- GstTagList *(*get_video_tags) (GstPlayBin * playbin, gint stream);
- GstTagList *(*get_audio_tags) (GstPlayBin * playbin, gint stream);
- GstTagList *(*get_text_tags) (GstPlayBin * playbin, gint stream);
-
- /* get the last video frame and convert it to the given caps */
- GstBuffer *(*convert_frame) (GstPlayBin * playbin, GstCaps * caps);
-
- /* get audio/video/text pad for a stream */
- GstPad *(*get_video_pad) (GstPlayBin * playbin, gint stream);
- GstPad *(*get_audio_pad) (GstPlayBin * playbin, gint stream);
- GstPad *(*get_text_pad) (GstPlayBin * playbin, gint stream);
-};
-
-/* props */
-#define DEFAULT_URI NULL
-#define DEFAULT_SUBURI NULL
-#define DEFAULT_SOURCE NULL
-#define DEFAULT_FLAGS GST_PLAY_FLAG_AUDIO | GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_TEXT | \
- GST_PLAY_FLAG_SOFT_VOLUME
-#define DEFAULT_N_VIDEO 0
-#define DEFAULT_CURRENT_VIDEO -1
-#define DEFAULT_N_AUDIO 0
-#define DEFAULT_CURRENT_AUDIO -1
-#define DEFAULT_N_TEXT 0
-#define DEFAULT_CURRENT_TEXT -1
-#define DEFAULT_SUBTITLE_ENCODING NULL
-#define DEFAULT_AUDIO_SINK NULL
-#define DEFAULT_VIDEO_SINK NULL
-#define DEFAULT_VIS_PLUGIN NULL
-#define DEFAULT_TEXT_SINK NULL
-#define DEFAULT_VOLUME 1.0
-#define DEFAULT_MUTE FALSE
-#define DEFAULT_FRAME NULL
-#define DEFAULT_FONT_DESC NULL
-#define DEFAULT_CONNECTION_SPEED 0
-#define DEFAULT_BUFFER_DURATION -1
-#define DEFAULT_BUFFER_SIZE -1
-
-enum
-{
- PROP_0,
- PROP_URI,
- PROP_SUBURI,
- PROP_SOURCE,
- PROP_FLAGS,
- PROP_N_VIDEO,
- PROP_CURRENT_VIDEO,
- PROP_N_AUDIO,
- PROP_CURRENT_AUDIO,
- PROP_N_TEXT,
- PROP_CURRENT_TEXT,
- PROP_SUBTITLE_ENCODING,
- PROP_AUDIO_SINK,
- PROP_VIDEO_SINK,
- PROP_VIS_PLUGIN,
- PROP_TEXT_SINK,
- PROP_VOLUME,
- PROP_MUTE,
- PROP_FRAME,
- PROP_FONT_DESC,
- PROP_CONNECTION_SPEED,
- PROP_BUFFER_SIZE,
- PROP_BUFFER_DURATION,
- PROP_LAST
-};
-
-/* signals */
-enum
-{
- SIGNAL_ABOUT_TO_FINISH,
- SIGNAL_CONVERT_FRAME,
- SIGNAL_VIDEO_CHANGED,
- SIGNAL_AUDIO_CHANGED,
- SIGNAL_TEXT_CHANGED,
- SIGNAL_VIDEO_TAGS_CHANGED,
- SIGNAL_AUDIO_TAGS_CHANGED,
- SIGNAL_TEXT_TAGS_CHANGED,
- SIGNAL_GET_VIDEO_TAGS,
- SIGNAL_GET_AUDIO_TAGS,
- SIGNAL_GET_TEXT_TAGS,
- SIGNAL_GET_VIDEO_PAD,
- SIGNAL_GET_AUDIO_PAD,
- SIGNAL_GET_TEXT_PAD,
- LAST_SIGNAL
-};
-
-static void gst_play_bin_class_init (GstPlayBinClass * klass);
-static void gst_play_bin_init (GstPlayBin * playbin);
-static void gst_play_bin_finalize (GObject * object);
-
-static void gst_play_bin_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * spec);
-static void gst_play_bin_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * spec);
-
-static GstStateChangeReturn gst_play_bin_change_state (GstElement * element,
- GstStateChange transition);
-
-static void gst_play_bin_handle_message (GstBin * bin, GstMessage * message);
-static gboolean gst_play_bin_query (GstElement * element, GstQuery * query);
-
-static GstTagList *gst_play_bin_get_video_tags (GstPlayBin * playbin,
- gint stream);
-static GstTagList *gst_play_bin_get_audio_tags (GstPlayBin * playbin,
- gint stream);
-static GstTagList *gst_play_bin_get_text_tags (GstPlayBin * playbin,
- gint stream);
-
-static GstBuffer *gst_play_bin_convert_frame (GstPlayBin * playbin,
- GstCaps * caps);
-
-static GstPad *gst_play_bin_get_video_pad (GstPlayBin * playbin, gint stream);
-static GstPad *gst_play_bin_get_audio_pad (GstPlayBin * playbin, gint stream);
-static GstPad *gst_play_bin_get_text_pad (GstPlayBin * playbin, gint stream);
-
-static gboolean setup_next_source (GstPlayBin * playbin, GstState target);
-
-static void no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group);
-static void pad_removed_cb (GstElement * decodebin, GstPad * pad,
- GstSourceGroup * group);
-
-static void gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
- gboolean block);
-static void gst_play_bin_suburidecodebin_seek_to_start (GstElement *
- suburidecodebin);
-
-static GstElementClass *parent_class;
-
-static guint gst_play_bin_signals[LAST_SIGNAL] = { 0 };
-
-static const GstElementDetails gst_play_bin_details =
-GST_ELEMENT_DETAILS ("Player Bin 2",
- "Generic/Bin/Player",
- "Autoplug and play media from an uri",
- "Wim Taymans <wim.taymans@gmail.com>");
-
-#define REMOVE_SIGNAL(obj,id) \
-if (id) { \
- g_signal_handler_disconnect (obj, id); \
- id = 0; \
-}
-
-static void
-gst_play_marshal_BUFFER__BOXED (GClosure * closure,
- GValue * return_value G_GNUC_UNUSED,
- guint n_param_values,
- const GValue * param_values,
- gpointer invocation_hint G_GNUC_UNUSED, gpointer marshal_data)
-{
- typedef GstBuffer *(*GMarshalFunc_OBJECT__BOXED) (gpointer data1,
- gpointer arg_1, gpointer data2);
- register GMarshalFunc_OBJECT__BOXED callback;
- register GCClosure *cc = (GCClosure *) closure;
- register gpointer data1, data2;
- GstBuffer *v_return;
-
- g_return_if_fail (return_value != NULL);
- g_return_if_fail (n_param_values == 2);
-
- if (G_CCLOSURE_SWAP_DATA (closure)) {
- data1 = closure->data;
- data2 = g_value_peek_pointer (param_values + 0);
- } else {
- data1 = g_value_peek_pointer (param_values + 0);
- data2 = closure->data;
- }
- callback =
- (GMarshalFunc_OBJECT__BOXED) (marshal_data ? marshal_data : cc->callback);
-
- v_return = callback (data1, g_value_get_boxed (param_values + 1), data2);
-
- gst_value_take_buffer (return_value, v_return);
-}
-
-static GType
-gst_play_bin_get_type (void)
-{
- static GType gst_play_bin_type = 0;
-
- if (!gst_play_bin_type) {
- static const GTypeInfo gst_play_bin_info = {
- sizeof (GstPlayBinClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_play_bin_class_init,
- NULL,
- NULL,
- sizeof (GstPlayBin),
- 0,
- (GInstanceInitFunc) gst_play_bin_init,
- NULL
- };
- static const GInterfaceInfo svol_info = {
- NULL, NULL, NULL
- };
-
- gst_play_bin_type = g_type_register_static (GST_TYPE_PIPELINE,
- "GstPlayBin2", &gst_play_bin_info, 0);
-
- g_type_add_interface_static (gst_play_bin_type, GST_TYPE_STREAM_VOLUME,
- &svol_info);
- }
-
- return gst_play_bin_type;
-}
-
-static void
-gst_play_bin_class_init (GstPlayBinClass * klass)
-{
- GObjectClass *gobject_klass;
- GstElementClass *gstelement_klass;
- GstBinClass *gstbin_klass;
-
- gobject_klass = (GObjectClass *) klass;
- gstelement_klass = (GstElementClass *) klass;
- gstbin_klass = (GstBinClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_klass->set_property = gst_play_bin_set_property;
- gobject_klass->get_property = gst_play_bin_get_property;
-
- gobject_klass->finalize = gst_play_bin_finalize;
-
- /**
- * GstPlayBin2:uri
- *
- * Set the next URI that playbin will play. This property can be set from the
- * about-to-finish signal to queue the next media file.
- */
- g_object_class_install_property (gobject_klass, PROP_URI,
- g_param_spec_string ("uri", "URI", "URI of the media to play",
- NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstPlayBin2:suburi
- *
- * Set the next subtitle URI that playbin will play. This property can be
- * set from the about-to-finish signal to queue the next subtitle media file.
- */
- g_object_class_install_property (gobject_klass, PROP_SUBURI,
- g_param_spec_string ("suburi", ".sub-URI", "Optional URI of a subtitle",
- NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_klass, PROP_SOURCE,
- g_param_spec_object ("source", "Source", "Source element",
- GST_TYPE_ELEMENT, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstPlayBin2:flags
- *
- * Control the behaviour of playbin.
- */
- g_object_class_install_property (gobject_klass, PROP_FLAGS,
- g_param_spec_flags ("flags", "Flags", "Flags to control behaviour",
- GST_TYPE_PLAY_FLAGS, DEFAULT_FLAGS,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstPlayBin2:n-video
- *
- * Get the total number of available video streams.
- */
- g_object_class_install_property (gobject_klass, PROP_N_VIDEO,
- g_param_spec_int ("n-video", "Number Video",
- "Total number of video streams", 0, G_MAXINT, 0,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- /**
- * GstPlayBin2:current-video
- *
- * Get or set the currently playing video stream. By default the first video
- * stream with data is played.
- */
- g_object_class_install_property (gobject_klass, PROP_CURRENT_VIDEO,
- g_param_spec_int ("current-video", "Current Video",
- "Currently playing video stream (-1 = auto)",
- -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstPlayBin2:n-audio
- *
- * Get the total number of available audio streams.
- */
- g_object_class_install_property (gobject_klass, PROP_N_AUDIO,
- g_param_spec_int ("n-audio", "Number Audio",
- "Total number of audio streams", 0, G_MAXINT, 0,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- /**
- * GstPlayBin2:current-audio
- *
- * Get or set the currently playing audio stream. By default the first audio
- * stream with data is played.
- */
- g_object_class_install_property (gobject_klass, PROP_CURRENT_AUDIO,
- g_param_spec_int ("current-audio", "Current audio",
- "Currently playing audio stream (-1 = auto)",
- -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstPlayBin2:n-text
- *
- * Get the total number of available subtitle streams.
- */
- g_object_class_install_property (gobject_klass, PROP_N_TEXT,
- g_param_spec_int ("n-text", "Number Text",
- "Total number of text streams", 0, G_MAXINT, 0,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- /**
- * GstPlayBin2:current-text:
- *
- * Get or set the currently playing subtitle stream. By default the first
- * subtitle stream with data is played.
- */
- g_object_class_install_property (gobject_klass, PROP_CURRENT_TEXT,
- g_param_spec_int ("current-text", "Current Text",
- "Currently playing text stream (-1 = auto)",
- -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_klass, PROP_SUBTITLE_ENCODING,
- g_param_spec_string ("subtitle-encoding", "subtitle encoding",
- "Encoding to assume if input subtitles are not in UTF-8 encoding. "
- "If not set, the GST_SUBTITLE_ENCODING environment variable will "
- "be checked for an encoding to use. If that is not set either, "
- "ISO-8859-15 will be assumed.", NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_klass, PROP_VIDEO_SINK,
- g_param_spec_object ("video-sink", "Video Sink",
- "the video output element to use (NULL = default sink)",
- GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, PROP_AUDIO_SINK,
- g_param_spec_object ("audio-sink", "Audio Sink",
- "the audio output element to use (NULL = default sink)",
- GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, PROP_VIS_PLUGIN,
- g_param_spec_object ("vis-plugin", "Vis plugin",
- "the visualization element to use (NULL = default)",
- GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, PROP_TEXT_SINK,
- g_param_spec_object ("text-sink", "Text plugin",
- "the text output element to use (NULL = default textoverlay)",
- GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstPlayBin2:volume:
- *
- * Get or set the current audio stream volume. 1.0 means 100%,
- * 0.0 means mute. This uses a linear volume scale.
- *
- */
- g_object_class_install_property (gobject_klass, PROP_VOLUME,
- g_param_spec_double ("volume", "Volume", "The audio volume, 1.0=100%",
- 0.0, VOLUME_MAX_DOUBLE, 1.0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, PROP_MUTE,
- g_param_spec_boolean ("mute", "Mute",
- "Mute the audio channel without changing the volume", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstPlayBin2:frame:
- * @playbin: a #GstPlayBin2
- *
- * Get the currently rendered or prerolled frame in the sink.
- * The #GstCaps on the buffer will describe the format of the buffer.
- */
- g_object_class_install_property (gobject_klass, PROP_FRAME,
- gst_param_spec_mini_object ("frame", "Frame",
- "The last frame (NULL = no video available)",
- GST_TYPE_BUFFER, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, PROP_FONT_DESC,
- g_param_spec_string ("subtitle-font-desc",
- "Subtitle font description",
- "Pango font description of font "
- "to be used for subtitle rendering", NULL,
- G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_klass, PROP_CONNECTION_SPEED,
- g_param_spec_uint ("connection-speed", "Connection Speed",
- "Network connection speed in kbps (0 = unknown)",
- 0, G_MAXUINT / 1000, DEFAULT_CONNECTION_SPEED,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_klass, PROP_BUFFER_SIZE,
- g_param_spec_int ("buffer-size", "Buffer size (bytes)",
- "Buffer size when buffering network streams",
- -1, G_MAXINT, DEFAULT_BUFFER_SIZE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, PROP_BUFFER_DURATION,
- g_param_spec_int64 ("buffer-duration", "Buffer duration (ns)",
- "Buffer duration when buffering network streams",
- -1, G_MAXINT64, DEFAULT_BUFFER_DURATION,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstPlayBin2::about-to-finish
- * @playbin: a #GstPlayBin2
- *
- * This signal is emitted when the current uri is about to finish. You can
- * set the uri and suburi to make sure that playback continues.
- */
- gst_play_bin_signals[SIGNAL_ABOUT_TO_FINISH] =
- g_signal_new ("about-to-finish", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstPlayBinClass, about_to_finish), NULL, NULL,
- gst_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
-
- /**
- * GstPlayBin2::video-changed
- * @playbin: a #GstPlayBin2
- *
- * This signal is emitted whenever the number or order of the video
- * streams has changed. The application will most likely want to select
- * a new video stream.
- */
- gst_play_bin_signals[SIGNAL_VIDEO_CHANGED] =
- g_signal_new ("video-changed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstPlayBinClass, video_changed), NULL, NULL,
- gst_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
- /**
- * GstPlayBin2::audio-changed
- * @playbin: a #GstPlayBin2
- *
- * This signal is emitted whenever the number or order of the audio
- * streams has changed. The application will most likely want to select
- * a new audio stream.
- */
- gst_play_bin_signals[SIGNAL_AUDIO_CHANGED] =
- g_signal_new ("audio-changed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstPlayBinClass, audio_changed), NULL, NULL,
- gst_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
- /**
- * GstPlayBin2::text-changed
- * @playbin: a #GstPlayBin2
- *
- * This signal is emitted whenever the number or order of the text
- * streams has changed. The application will most likely want to select
- * a new text stream.
- */
- gst_play_bin_signals[SIGNAL_TEXT_CHANGED] =
- g_signal_new ("text-changed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstPlayBinClass, text_changed), NULL, NULL,
- gst_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
-
- /**
- * GstPlayBin2::video-tags-changed
- * @playbin: a #GstPlayBin2
- * @stream: stream index with changed tags
- *
- * This signal is emitted whenever the tags of a video stream have changed.
- * The application will most likely want to get the new tags.
- *
- * Since: 0.10.24
- */
- gst_play_bin_signals[SIGNAL_VIDEO_TAGS_CHANGED] =
- g_signal_new ("video-tags-changed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstPlayBinClass, video_tags_changed), NULL, NULL,
- gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
-
- /**
- * GstPlayBin2::audio-tags-changed
- * @playbin: a #GstPlayBin2
- * @stream: stream index with changed tags
- *
- * This signal is emitted whenever the tags of an audio stream have changed.
- * The application will most likely want to get the new tags.
- *
- * Since: 0.10.24
- */
- gst_play_bin_signals[SIGNAL_AUDIO_TAGS_CHANGED] =
- g_signal_new ("audio-tags-changed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstPlayBinClass, audio_tags_changed), NULL, NULL,
- gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
-
- /**
- * GstPlayBin2::text-tags-changed
- * @playbin: a #GstPlayBin2
- * @stream: stream index with changed tags
- *
- * This signal is emitted whenever the tags of a text stream have changed.
- * The application will most likely want to get the new tags.
- *
- * Since: 0.10.24
- */
- gst_play_bin_signals[SIGNAL_TEXT_TAGS_CHANGED] =
- g_signal_new ("text-tags-changed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstPlayBinClass, text_tags_changed), NULL, NULL,
- gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
-
- /**
- * GstPlayBin2::get-video-tags
- * @playbin: a #GstPlayBin2
- * @stream: a video stream number
- *
- * Action signal to retrieve the tags of a specific video stream number.
- * This information can be used to select a stream.
- *
- * Returns: a GstTagList with tags or NULL when the stream number does not
- * exist.
- */
- gst_play_bin_signals[SIGNAL_GET_VIDEO_TAGS] =
- g_signal_new ("get-video-tags", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GstPlayBinClass, get_video_tags), NULL, NULL,
- gst_play_marshal_BOXED__INT, GST_TYPE_TAG_LIST, 1, G_TYPE_INT);
- /**
- * GstPlayBin2::get-audio-tags
- * @playbin: a #GstPlayBin2
- * @stream: an audio stream number
- *
- * Action signal to retrieve the tags of a specific audio stream number.
- * This information can be used to select a stream.
- *
- * Returns: a GstTagList with tags or NULL when the stream number does not
- * exist.
- */
- gst_play_bin_signals[SIGNAL_GET_AUDIO_TAGS] =
- g_signal_new ("get-audio-tags", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GstPlayBinClass, get_audio_tags), NULL, NULL,
- gst_play_marshal_BOXED__INT, GST_TYPE_TAG_LIST, 1, G_TYPE_INT);
- /**
- * GstPlayBin2::get-text-tags
- * @playbin: a #GstPlayBin2
- * @stream: a text stream number
- *
- * Action signal to retrieve the tags of a specific text stream number.
- * This information can be used to select a stream.
- *
- * Returns: a GstTagList with tags or NULL when the stream number does not
- * exist.
- */
- gst_play_bin_signals[SIGNAL_GET_TEXT_TAGS] =
- g_signal_new ("get-text-tags", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GstPlayBinClass, get_text_tags), NULL, NULL,
- gst_play_marshal_BOXED__INT, GST_TYPE_TAG_LIST, 1, G_TYPE_INT);
- /**
- * GstPlayBin2::convert-frame
- * @playbin: a #GstPlayBin2
- * @caps: the target format of the frame
- *
- * Action signal to retrieve the currently playing video frame in the format
- * specified by @caps.
- * If @caps is %NULL, no conversion will be performed and this function is
- * equivalent to the #GstPlayBin::frame property.
- *
- * Returns: a #GstBuffer of the current video frame converted to #caps.
- * The caps on the buffer will describe the final layout of the buffer data.
- * %NULL is returned when no current buffer can be retrieved or when the
- * conversion failed.
- */
- gst_play_bin_signals[SIGNAL_CONVERT_FRAME] =
- g_signal_new ("convert-frame", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GstPlayBinClass, convert_frame), NULL, NULL,
- gst_play_marshal_BUFFER__BOXED, GST_TYPE_BUFFER, 1, GST_TYPE_CAPS);
-
- /**
- * GstPlayBin2::get-video-pad
- * @playbin: a #GstPlayBin2
- * @stream: a video stream number
- *
- * Action signal to retrieve the stream-selector sinkpad for a specific
- * video stream.
- * This pad can be used for notifications of caps changes, stream-specific
- * queries, etc.
- *
- * Returns: a #GstPad, or NULL when the stream number does not exist.
- */
- gst_play_bin_signals[SIGNAL_GET_VIDEO_PAD] =
- g_signal_new ("get-video-pad", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GstPlayBinClass, get_video_pad), NULL, NULL,
- gst_play_marshal_OBJECT__INT, GST_TYPE_PAD, 1, G_TYPE_INT);
- /**
- * GstPlayBin2::get-audio-pad
- * @playbin: a #GstPlayBin2
- * @stream: an audio stream number
- *
- * Action signal to retrieve the stream-selector sinkpad for a specific
- * audio stream.
- * This pad can be used for notifications of caps changes, stream-specific
- * queries, etc.
- *
- * Returns: a #GstPad, or NULL when the stream number does not exist.
- */
- gst_play_bin_signals[SIGNAL_GET_AUDIO_PAD] =
- g_signal_new ("get-audio-pad", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GstPlayBinClass, get_audio_pad), NULL, NULL,
- gst_play_marshal_OBJECT__INT, GST_TYPE_PAD, 1, G_TYPE_INT);
- /**
- * GstPlayBin2::get-text-pad
- * @playbin: a #GstPlayBin2
- * @stream: a text stream number
- *
- * Action signal to retrieve the stream-selector sinkpad for a specific
- * text stream.
- * This pad can be used for notifications of caps changes, stream-specific
- * queries, etc.
- *
- * Returns: a #GstPad, or NULL when the stream number does not exist.
- */
- gst_play_bin_signals[SIGNAL_GET_TEXT_PAD] =
- g_signal_new ("get-text-pad", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GstPlayBinClass, get_text_pad), NULL, NULL,
- gst_play_marshal_OBJECT__INT, GST_TYPE_PAD, 1, G_TYPE_INT);
-
- klass->get_video_tags = gst_play_bin_get_video_tags;
- klass->get_audio_tags = gst_play_bin_get_audio_tags;
- klass->get_text_tags = gst_play_bin_get_text_tags;
-
- klass->convert_frame = gst_play_bin_convert_frame;
-
- klass->get_video_pad = gst_play_bin_get_video_pad;
- klass->get_audio_pad = gst_play_bin_get_audio_pad;
- klass->get_text_pad = gst_play_bin_get_text_pad;
-
- gst_element_class_set_details (gstelement_klass, &gst_play_bin_details);
-
- gstelement_klass->change_state =
- GST_DEBUG_FUNCPTR (gst_play_bin_change_state);
- gstelement_klass->query = GST_DEBUG_FUNCPTR (gst_play_bin_query);
-
- gstbin_klass->handle_message =
- GST_DEBUG_FUNCPTR (gst_play_bin_handle_message);
-}
-
-static void
-init_group (GstPlayBin * playbin, GstSourceGroup * group)
-{
- /* store the array for the different channels */
- group->video_channels = g_ptr_array_new ();
- group->audio_channels = g_ptr_array_new ();
- group->text_channels = g_ptr_array_new ();
- group->lock = g_mutex_new ();
- /* init selectors. The selector is found by finding the first prefix that
- * matches the media. */
- group->playbin = playbin;
- /* If you add any items to these lists, check that media_list[] is defined
- * above to be large enough to hold MAX(items)+1, so as to accomodate a
- * NULL terminator (set when the memory is zeroed on allocation) */
- group->selector[0].media_list[0] = "audio/x-raw-";
- group->selector[0].type = GST_PLAY_SINK_TYPE_AUDIO_RAW;
- group->selector[0].channels = group->audio_channels;
- group->selector[1].media_list[0] = "audio/";
- group->selector[1].type = GST_PLAY_SINK_TYPE_AUDIO;
- group->selector[1].channels = group->audio_channels;
- group->selector[2].media_list[0] = "text/";
- group->selector[2].media_list[1] = "application/x-subtitle";
- group->selector[2].media_list[2] = "application/x-ssa";
- group->selector[2].media_list[3] = "application/x-ass";
- group->selector[2].media_list[4] = "video/x-dvd-subpicture";
- group->selector[2].media_list[5] = "subpicture/";
- group->selector[2].media_list[6] = "subtitle/";
- group->selector[2].get_media_caps = gst_subtitle_overlay_create_factory_caps;
- group->selector[2].type = GST_PLAY_SINK_TYPE_TEXT;
- group->selector[2].channels = group->text_channels;
- group->selector[3].media_list[0] = "video/x-raw-";
- group->selector[3].type = GST_PLAY_SINK_TYPE_VIDEO_RAW;
- group->selector[3].channels = group->video_channels;
- group->selector[4].media_list[0] = "video/";
- group->selector[4].type = GST_PLAY_SINK_TYPE_VIDEO;
- group->selector[4].channels = group->video_channels;
-}
-
-static void
-free_group (GstPlayBin * playbin, GstSourceGroup * group)
-{
- g_free (group->uri);
- g_free (group->suburi);
- g_ptr_array_free (group->video_channels, TRUE);
- g_ptr_array_free (group->audio_channels, TRUE);
- g_ptr_array_free (group->text_channels, TRUE);
-
- g_mutex_free (group->lock);
- if (group->audio_sink)
- gst_object_unref (group->audio_sink);
- group->audio_sink = NULL;
- if (group->video_sink)
- gst_object_unref (group->video_sink);
- group->video_sink = NULL;
-
- g_list_free (group->stream_changed_pending);
- group->stream_changed_pending = NULL;
-
- if (group->stream_changed_pending_lock)
- g_mutex_free (group->stream_changed_pending_lock);
- group->stream_changed_pending_lock = NULL;
-}
-
-static void
-notify_volume_cb (GObject * selector, GParamSpec * pspec, GstPlayBin * playbin)
-{
- g_object_notify (G_OBJECT (playbin), "volume");
-}
-
-static void
-notify_mute_cb (GObject * selector, GParamSpec * pspec, GstPlayBin * playbin)
-{
- g_object_notify (G_OBJECT (playbin), "mute");
-}
-
-/* Must be called with elements lock! */
-static void
-gst_play_bin_update_elements_list (GstPlayBin * playbin)
-{
- if (!playbin->elements ||
- playbin->elements_cookie !=
- gst_default_registry_get_feature_list_cookie ()) {
- if (playbin->elements)
- g_value_array_free (playbin->elements);
- playbin->elements =
- gst_factory_list_get_elements (GST_FACTORY_LIST_DECODER |
- GST_FACTORY_LIST_SINK);
- playbin->elements_cookie = gst_default_registry_get_feature_list_cookie ();
- }
-}
-
-static void
-gst_play_bin_init (GstPlayBin * playbin)
-{
- playbin->lock = g_mutex_new ();
- playbin->dyn_lock = g_mutex_new ();
-
- /* assume we can create a selector */
- playbin->have_selector = TRUE;
-
- /* init groups */
- playbin->curr_group = &playbin->groups[0];
- playbin->next_group = &playbin->groups[1];
- init_group (playbin, &playbin->groups[0]);
- init_group (playbin, &playbin->groups[1]);
-
- /* first filter out the interesting element factories */
- playbin->elements_lock = g_mutex_new ();
- gst_play_bin_update_elements_list (playbin);
- GST_FACTORY_LIST_DEBUG (playbin->elements);
-
- /* add sink */
- playbin->playsink = g_object_new (GST_TYPE_PLAY_SINK, NULL);
- gst_bin_add (GST_BIN_CAST (playbin), GST_ELEMENT_CAST (playbin->playsink));
- gst_play_sink_set_flags (playbin->playsink, DEFAULT_FLAGS);
- /* Connect to notify::volume and notify::mute signals for proxying */
- g_signal_connect (playbin->playsink, "notify::volume",
- G_CALLBACK (notify_volume_cb), playbin);
- g_signal_connect (playbin->playsink, "notify::mute",
- G_CALLBACK (notify_mute_cb), playbin);
-
- playbin->current_video = DEFAULT_CURRENT_VIDEO;
- playbin->current_audio = DEFAULT_CURRENT_AUDIO;
- playbin->current_text = DEFAULT_CURRENT_TEXT;
-
- playbin->buffer_duration = DEFAULT_BUFFER_DURATION;
- playbin->buffer_size = DEFAULT_BUFFER_SIZE;
-}
-
-static void
-gst_play_bin_finalize (GObject * object)
-{
- GstPlayBin *playbin;
-
- playbin = GST_PLAY_BIN (object);
-
- free_group (playbin, &playbin->groups[0]);
- free_group (playbin, &playbin->groups[1]);
-
- if (playbin->source)
- gst_object_unref (playbin->source);
- if (playbin->video_sink)
- gst_object_unref (playbin->video_sink);
- if (playbin->audio_sink)
- gst_object_unref (playbin->audio_sink);
- if (playbin->text_sink)
- gst_object_unref (playbin->text_sink);
-
- g_value_array_free (playbin->elements);
- g_mutex_free (playbin->lock);
- g_mutex_free (playbin->dyn_lock);
- g_mutex_free (playbin->elements_lock);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_play_bin_set_uri (GstPlayBin * playbin, const gchar * uri)
-{
- GstSourceGroup *group;
-
- if (uri == NULL) {
- g_warning ("cannot set NULL uri");
- return;
- }
-
- GST_PLAY_BIN_LOCK (playbin);
- group = playbin->next_group;
-
- GST_SOURCE_GROUP_LOCK (group);
- /* store the uri in the next group we will play */
- g_free (group->uri);
- group->uri = g_strdup (uri);
- group->valid = TRUE;
- GST_SOURCE_GROUP_UNLOCK (group);
-
- GST_DEBUG ("set new uri to %s", uri);
- GST_PLAY_BIN_UNLOCK (playbin);
-}
-
-static void
-gst_play_bin_set_suburi (GstPlayBin * playbin, const gchar * suburi)
-{
- GstSourceGroup *group;
-
- GST_PLAY_BIN_LOCK (playbin);
- group = playbin->next_group;
-
- GST_SOURCE_GROUP_LOCK (group);
- g_free (group->suburi);
- group->suburi = g_strdup (suburi);
- GST_SOURCE_GROUP_UNLOCK (group);
-
- GST_DEBUG ("setting new .sub uri to %s", suburi);
-
- GST_PLAY_BIN_UNLOCK (playbin);
-}
-
-static void
-gst_play_bin_set_flags (GstPlayBin * playbin, GstPlayFlags flags)
-{
- gst_play_sink_set_flags (playbin->playsink, flags);
- gst_play_sink_reconfigure (playbin->playsink);
-}
-
-static GstPlayFlags
-gst_play_bin_get_flags (GstPlayBin * playbin)
-{
- GstPlayFlags flags;
-
- flags = gst_play_sink_get_flags (playbin->playsink);
-
- return flags;
-}
-
-/* get the currently playing group or if nothing is playing, the next
- * group. Must be called with the PLAY_BIN_LOCK. */
-static GstSourceGroup *
-get_group (GstPlayBin * playbin)
-{
- GstSourceGroup *result;
-
- if (!(result = playbin->curr_group))
- result = playbin->next_group;
-
- return result;
-}
-
-static GstPad *
-gst_play_bin_get_video_pad (GstPlayBin * playbin, gint stream)
-{
- GstPad *sinkpad = NULL;
- GstSourceGroup *group;
-
- GST_PLAY_BIN_LOCK (playbin);
- group = get_group (playbin);
- if (stream < group->video_channels->len) {
- sinkpad = g_ptr_array_index (group->video_channels, stream);
- gst_object_ref (sinkpad);
- }
- GST_PLAY_BIN_UNLOCK (playbin);
-
- return sinkpad;
-}
-
-static GstPad *
-gst_play_bin_get_audio_pad (GstPlayBin * playbin, gint stream)
-{
- GstPad *sinkpad = NULL;
- GstSourceGroup *group;
-
- GST_PLAY_BIN_LOCK (playbin);
- group = get_group (playbin);
- if (stream < group->audio_channels->len) {
- sinkpad = g_ptr_array_index (group->audio_channels, stream);
- gst_object_ref (sinkpad);
- }
- GST_PLAY_BIN_UNLOCK (playbin);
-
- return sinkpad;
-}
-
-static GstPad *
-gst_play_bin_get_text_pad (GstPlayBin * playbin, gint stream)
-{
- GstPad *sinkpad = NULL;
- GstSourceGroup *group;
-
- GST_PLAY_BIN_LOCK (playbin);
- group = get_group (playbin);
- if (stream < group->text_channels->len) {
- sinkpad = g_ptr_array_index (group->text_channels, stream);
- gst_object_ref (sinkpad);
- }
- GST_PLAY_BIN_UNLOCK (playbin);
-
- return sinkpad;
-}
-
-
-static GstTagList *
-get_tags (GstPlayBin * playbin, GPtrArray * channels, gint stream)
-{
- GstTagList *result;
- GstPad *sinkpad;
-
- if (!channels || stream >= channels->len)
- return NULL;
-
- sinkpad = g_ptr_array_index (channels, stream);
- g_object_get (sinkpad, "tags", &result, NULL);
-
- return result;
-}
-
-static GstTagList *
-gst_play_bin_get_video_tags (GstPlayBin * playbin, gint stream)
-{
- GstTagList *result;
- GstSourceGroup *group;
-
- GST_PLAY_BIN_LOCK (playbin);
- group = get_group (playbin);
- result = get_tags (playbin, group->video_channels, stream);
- GST_PLAY_BIN_UNLOCK (playbin);
-
- return result;
-}
-
-static GstTagList *
-gst_play_bin_get_audio_tags (GstPlayBin * playbin, gint stream)
-{
- GstTagList *result;
- GstSourceGroup *group;
-
- GST_PLAY_BIN_LOCK (playbin);
- group = get_group (playbin);
- result = get_tags (playbin, group->audio_channels, stream);
- GST_PLAY_BIN_UNLOCK (playbin);
-
- return result;
-}
-
-static GstTagList *
-gst_play_bin_get_text_tags (GstPlayBin * playbin, gint stream)
-{
- GstTagList *result;
- GstSourceGroup *group;
-
- GST_PLAY_BIN_LOCK (playbin);
- group = get_group (playbin);
- result = get_tags (playbin, group->text_channels, stream);
- GST_PLAY_BIN_UNLOCK (playbin);
-
- return result;
-}
-
-static GstBuffer *
-gst_play_bin_convert_frame (GstPlayBin * playbin, GstCaps * caps)
-{
- GstBuffer *result;
-
- result = gst_play_sink_get_last_frame (playbin->playsink);
- if (result != NULL && caps != NULL) {
- GstBuffer *temp;
-
- temp = gst_play_frame_conv_convert (result, caps);
- gst_buffer_unref (result);
- result = temp;
- }
- return result;
-}
-
-/* Returns current stream number, or -1 if none has been selected yet */
-static int
-get_current_stream_number (GstPlayBin * playbin, GPtrArray * channels)
-{
- /* Internal API cleanup would make this easier... */
- int i;
- GstPad *pad, *current;
- GstObject *selector = NULL;
- int ret = -1;
-
- for (i = 0; i < channels->len; i++) {
- pad = g_ptr_array_index (channels, i);
- if ((selector = gst_pad_get_parent (pad))) {
- g_object_get (selector, "active-pad", &current, NULL);
- gst_object_unref (selector);
-
- if (pad == current) {
- gst_object_unref (current);
- ret = i;
- break;
- }
-
- if (current)
- gst_object_unref (current);
- }
- }
-
- return ret;
-}
-
-static gboolean
-gst_play_bin_set_current_video_stream (GstPlayBin * playbin, gint stream)
-{
- GstSourceGroup *group;
- GPtrArray *channels;
- GstPad *sinkpad;
-
- GST_PLAY_BIN_LOCK (playbin);
- group = get_group (playbin);
- if (!(channels = group->video_channels))
- goto no_channels;
-
- if (stream == -1 || channels->len <= stream) {
- sinkpad = NULL;
- } else {
- /* take channel from selected stream */
- sinkpad = g_ptr_array_index (channels, stream);
- }
-
- if (sinkpad)
- gst_object_ref (sinkpad);
- GST_PLAY_BIN_UNLOCK (playbin);
-
- if (sinkpad) {
- GstObject *selector;
-
- if ((selector = gst_pad_get_parent (sinkpad))) {
- /* activate the selected pad */
- g_object_set (selector, "active-pad", sinkpad, NULL);
- gst_object_unref (selector);
- }
- gst_object_unref (sinkpad);
- }
- return TRUE;
-
-no_channels:
- {
- GST_PLAY_BIN_UNLOCK (playbin);
- return FALSE;
- }
-}
-
-static gboolean
-gst_play_bin_set_current_audio_stream (GstPlayBin * playbin, gint stream)
-{
- GstSourceGroup *group;
- GPtrArray *channels;
- GstPad *sinkpad;
-
- GST_PLAY_BIN_LOCK (playbin);
- group = get_group (playbin);
- if (!(channels = group->audio_channels))
- goto no_channels;
-
- if (stream == -1 || channels->len <= stream) {
- sinkpad = NULL;
- } else {
- /* take channel from selected stream */
- sinkpad = g_ptr_array_index (channels, stream);
- }
-
- if (sinkpad)
- gst_object_ref (sinkpad);
- GST_PLAY_BIN_UNLOCK (playbin);
-
- if (sinkpad) {
- GstObject *selector;
-
- if ((selector = gst_pad_get_parent (sinkpad))) {
- /* activate the selected pad */
- g_object_set (selector, "active-pad", sinkpad, NULL);
- gst_object_unref (selector);
- }
- gst_object_unref (sinkpad);
- }
- return TRUE;
-
-no_channels:
- {
- GST_PLAY_BIN_UNLOCK (playbin);
- return FALSE;
- }
-}
-
-static void
-_suburidecodebin_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
-{
- GST_DEBUG_OBJECT (pad, "Pad blocked: %d", blocked);
-}
-
-static void
-gst_play_bin_suburidecodebin_seek_to_start (GstElement * suburidecodebin)
-{
- GstIterator *it = gst_element_iterate_src_pads (suburidecodebin);
- GstPad *sinkpad;
-
- if (it && gst_iterator_next (it, (gpointer) & sinkpad) == GST_ITERATOR_OK
- && sinkpad) {
- GstEvent *event;
-
- event =
- gst_event_new_seek (1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE,
- GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE, -1);
- if (!gst_pad_send_event (sinkpad, event)) {
- event =
- gst_event_new_seek (1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_NONE,
- GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE, -1);
- if (!gst_pad_send_event (sinkpad, event))
- GST_DEBUG_OBJECT (suburidecodebin, "Seeking to the beginning failed!");
- }
-
- gst_object_unref (sinkpad);
- }
-
- if (it)
- gst_iterator_free (it);
-}
-
-static void
-gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
- gboolean block)
-{
- GstIterator *it = gst_element_iterate_src_pads (suburidecodebin);
- gboolean done = FALSE;
-
- GST_DEBUG_OBJECT (suburidecodebin, "Blocking suburidecodebin: %d", block);
-
- if (!it)
- return;
- while (!done) {
- GstPad *sinkpad;
-
- switch (gst_iterator_next (it, (gpointer) & sinkpad)) {
- case GST_ITERATOR_OK:
- gst_pad_set_blocked_async (sinkpad, block, _suburidecodebin_blocked_cb,
- NULL);
- gst_object_unref (sinkpad);
- break;
- case GST_ITERATOR_DONE:
- done = TRUE;
- break;
- case GST_ITERATOR_RESYNC:
- gst_iterator_resync (it);
- break;
- case GST_ITERATOR_ERROR:
- done = TRUE;
- break;
- }
- }
- gst_iterator_free (it);
-}
-
-static gboolean
-gst_play_bin_set_current_text_stream (GstPlayBin * playbin, gint stream)
-{
- GstSourceGroup *group;
- GPtrArray *channels;
- GstPad *sinkpad;
-
- GST_PLAY_BIN_LOCK (playbin);
- group = get_group (playbin);
- if (!(channels = group->text_channels))
- goto no_channels;
-
- if (stream == -1 || channels->len <= stream) {
- sinkpad = NULL;
- } else {
- /* take channel from selected stream */
- sinkpad = g_ptr_array_index (channels, stream);
- }
-
- if (sinkpad)
- gst_object_ref (sinkpad);
- GST_PLAY_BIN_UNLOCK (playbin);
-
- if (sinkpad) {
- GstObject *selector;
-
- if ((selector = gst_pad_get_parent (sinkpad))) {
- GstPad *old_sinkpad;
-
- g_object_get (selector, "active-pad", &old_sinkpad, NULL);
-
- if (old_sinkpad != sinkpad) {
- gboolean need_unblock, need_block, need_seek;
- GstPad *src, *peer = NULL, *oldpeer = NULL;
- GstElement *parent_element = NULL, *old_parent_element = NULL;
-
- /* Now check if we need to seek the suburidecodebin to the beginning
- * or if we need to block all suburidecodebin sinkpads or if we need
- * to unblock all suburidecodebin sinkpads
- */
- if (sinkpad)
- peer = gst_pad_get_peer (sinkpad);
- if (old_sinkpad)
- oldpeer = gst_pad_get_peer (old_sinkpad);
-
- if (peer)
- parent_element = gst_pad_get_parent_element (peer);
- if (oldpeer)
- old_parent_element = gst_pad_get_parent_element (oldpeer);
-
- need_block = (old_parent_element == group->suburidecodebin
- && parent_element != old_parent_element);
- need_unblock = (parent_element == group->suburidecodebin
- && parent_element != old_parent_element);
- need_seek = (parent_element == group->suburidecodebin);
-
- if (peer)
- gst_object_unref (peer);
- if (oldpeer)
- gst_object_unref (oldpeer);
- if (parent_element)
- gst_object_unref (parent_element);
- if (old_parent_element)
- gst_object_unref (old_parent_element);
-
- /* Block all suburidecodebin sinkpads */
- if (need_block)
- gst_play_bin_suburidecodebin_block (group->suburidecodebin, TRUE);
-
- /* activate the selected pad */
- g_object_set (selector, "active-pad", sinkpad, NULL);
-
- src = gst_element_get_static_pad (GST_ELEMENT_CAST (selector), "src");
- peer = gst_pad_get_peer (src);
- if (peer) {
- GstStructure *s;
- GstEvent *event;
- /* Flush the subtitle renderer to remove any
- * currently displayed subtitles. This event will
- * never travel outside subtitleoverlay!
- */
- s = gst_structure_empty_new ("subtitleoverlay-flush-subtitle");
- event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM_OOB, s);
- gst_pad_send_event (peer, event);
- gst_object_unref (peer);
- }
- gst_object_unref (src);
-
- /* Unblock pads if necessary */
- if (need_unblock)
- gst_play_bin_suburidecodebin_block (group->suburidecodebin, FALSE);
-
- /* seek to the beginning */
- if (need_seek)
- gst_play_bin_suburidecodebin_seek_to_start (group->suburidecodebin);
- }
- gst_object_unref (selector);
-
- if (old_sinkpad)
- gst_object_unref (old_sinkpad);
- }
- gst_object_unref (sinkpad);
- }
- return TRUE;
-
-no_channels:
- {
- GST_PLAY_BIN_UNLOCK (playbin);
- return FALSE;
- }
-}
-
-static void
-gst_play_bin_set_sink (GstPlayBin * playbin, GstElement ** elem,
- const gchar * dbg, GstElement * sink)
-{
- GST_INFO_OBJECT (playbin, "Setting %s sink to %" GST_PTR_FORMAT, dbg, sink);
-
- GST_PLAY_BIN_LOCK (playbin);
- if (*elem != sink) {
- GstElement *old;
-
- old = *elem;
- if (sink)
- gst_object_ref_sink (sink);
-
- *elem = sink;
- if (old)
- gst_object_unref (old);
- }
- GST_LOG_OBJECT (playbin, "%s sink now %" GST_PTR_FORMAT, dbg, *elem);
- GST_PLAY_BIN_UNLOCK (playbin);
-}
-
-static void
-gst_play_bin_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstPlayBin *playbin;
-
- playbin = GST_PLAY_BIN (object);
-
- switch (prop_id) {
- case PROP_URI:
- gst_play_bin_set_uri (playbin, g_value_get_string (value));
- break;
- case PROP_SUBURI:
- gst_play_bin_set_suburi (playbin, g_value_get_string (value));
- break;
- case PROP_FLAGS:
- gst_play_bin_set_flags (playbin, g_value_get_flags (value));
- break;
- case PROP_CURRENT_VIDEO:
- gst_play_bin_set_current_video_stream (playbin, g_value_get_int (value));
- break;
- case PROP_CURRENT_AUDIO:
- gst_play_bin_set_current_audio_stream (playbin, g_value_get_int (value));
- break;
- case PROP_CURRENT_TEXT:
- gst_play_bin_set_current_text_stream (playbin, g_value_get_int (value));
- break;
- case PROP_SUBTITLE_ENCODING:
- gst_play_sink_set_subtitle_encoding (playbin->playsink,
- g_value_get_string (value));
- break;
- case PROP_VIDEO_SINK:
- gst_play_bin_set_sink (playbin, &playbin->video_sink, "video",
- g_value_get_object (value));
- break;
- case PROP_AUDIO_SINK:
- gst_play_bin_set_sink (playbin, &playbin->audio_sink, "audio",
- g_value_get_object (value));
- break;
- case PROP_VIS_PLUGIN:
- gst_play_sink_set_vis_plugin (playbin->playsink,
- g_value_get_object (value));
- break;
- case PROP_TEXT_SINK:
- gst_play_bin_set_sink (playbin, &playbin->text_sink, "text",
- g_value_get_object (value));
- break;
- case PROP_VOLUME:
- gst_play_sink_set_volume (playbin->playsink, g_value_get_double (value));
- break;
- case PROP_MUTE:
- gst_play_sink_set_mute (playbin->playsink, g_value_get_boolean (value));
- break;
- case PROP_FONT_DESC:
- gst_play_sink_set_font_desc (playbin->playsink,
- g_value_get_string (value));
- break;
- case PROP_CONNECTION_SPEED:
- GST_PLAY_BIN_LOCK (playbin);
- playbin->connection_speed = g_value_get_uint (value) * 1000;
- GST_PLAY_BIN_UNLOCK (playbin);
- break;
- case PROP_BUFFER_SIZE:
- playbin->buffer_size = g_value_get_int (value);
- break;
- case PROP_BUFFER_DURATION:
- playbin->buffer_duration = g_value_get_int64 (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstElement *
-gst_play_bin_get_current_sink (GstPlayBin * playbin, GstElement ** elem,
- const gchar * dbg, GstPlaySinkType type)
-{
- GstElement *sink;
-
- sink = gst_play_sink_get_sink (playbin->playsink, type);
-
- GST_LOG_OBJECT (playbin, "play_sink_get_sink() returned %s sink %"
- GST_PTR_FORMAT ", the originally set %s sink is %" GST_PTR_FORMAT,
- dbg, sink, dbg, *elem);
-
- if (sink == NULL) {
- GST_PLAY_BIN_LOCK (playbin);
- if ((sink = *elem))
- gst_object_ref (sink);
- GST_PLAY_BIN_UNLOCK (playbin);
- }
-
- return sink;
-}
-
-static void
-gst_play_bin_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstPlayBin *playbin;
-
- playbin = GST_PLAY_BIN (object);
-
- switch (prop_id) {
- case PROP_URI:
- {
- GstSourceGroup *group;
-
- GST_PLAY_BIN_LOCK (playbin);
- group = get_group (playbin);
- g_value_set_string (value, group->uri);
- GST_PLAY_BIN_UNLOCK (playbin);
- break;
- }
- case PROP_SUBURI:
- {
- GstSourceGroup *group;
-
- GST_PLAY_BIN_LOCK (playbin);
- group = get_group (playbin);
- g_value_set_string (value, group->suburi);
- GST_PLAY_BIN_UNLOCK (playbin);
- break;
- }
- case PROP_SOURCE:
- {
- GST_OBJECT_LOCK (playbin);
- g_value_set_object (value, playbin->source);
- GST_OBJECT_UNLOCK (playbin);
- break;
- }
- case PROP_FLAGS:
- g_value_set_flags (value, gst_play_bin_get_flags (playbin));
- break;
- case PROP_N_VIDEO:
- {
- GstSourceGroup *group;
- gint n_video;
-
- GST_PLAY_BIN_LOCK (playbin);
- group = get_group (playbin);
- n_video = (group->video_channels ? group->video_channels->len : 0);
- g_value_set_int (value, n_video);
- GST_PLAY_BIN_UNLOCK (playbin);
- break;
- }
- case PROP_CURRENT_VIDEO:
- GST_PLAY_BIN_LOCK (playbin);
- g_value_set_int (value, playbin->current_video);
- GST_PLAY_BIN_UNLOCK (playbin);
- break;
- case PROP_N_AUDIO:
- {
- GstSourceGroup *group;
- gint n_audio;
-
- GST_PLAY_BIN_LOCK (playbin);
- group = get_group (playbin);
- n_audio = (group->audio_channels ? group->audio_channels->len : 0);
- g_value_set_int (value, n_audio);
- GST_PLAY_BIN_UNLOCK (playbin);
- break;
- }
- case PROP_CURRENT_AUDIO:
- GST_PLAY_BIN_LOCK (playbin);
- g_value_set_int (value, playbin->current_audio);
- GST_PLAY_BIN_UNLOCK (playbin);
- break;
- case PROP_N_TEXT:
- {
- GstSourceGroup *group;
- gint n_text;
-
- GST_PLAY_BIN_LOCK (playbin);
- group = get_group (playbin);
- n_text = (group->text_channels ? group->text_channels->len : 0);
- g_value_set_int (value, n_text);
- GST_PLAY_BIN_UNLOCK (playbin);
- break;
- }
- case PROP_CURRENT_TEXT:
- GST_PLAY_BIN_LOCK (playbin);
- g_value_set_int (value, playbin->current_text);
- GST_PLAY_BIN_UNLOCK (playbin);
- break;
- case PROP_SUBTITLE_ENCODING:
- GST_PLAY_BIN_LOCK (playbin);
- g_value_take_string (value,
- gst_play_sink_get_subtitle_encoding (playbin->playsink));
- GST_PLAY_BIN_UNLOCK (playbin);
- break;
- case PROP_VIDEO_SINK:
- g_value_take_object (value,
- gst_play_bin_get_current_sink (playbin, &playbin->video_sink,
- "video", GST_PLAY_SINK_TYPE_VIDEO));
- break;
- case PROP_AUDIO_SINK:
- g_value_take_object (value,
- gst_play_bin_get_current_sink (playbin, &playbin->audio_sink,
- "audio", GST_PLAY_SINK_TYPE_AUDIO));
- break;
- case PROP_VIS_PLUGIN:
- g_value_take_object (value,
- gst_play_sink_get_vis_plugin (playbin->playsink));
- break;
- case PROP_TEXT_SINK:
- g_value_take_object (value,
- gst_play_bin_get_current_sink (playbin, &playbin->text_sink,
- "text", GST_PLAY_SINK_TYPE_TEXT));
- break;
- case PROP_VOLUME:
- g_value_set_double (value, gst_play_sink_get_volume (playbin->playsink));
- break;
- case PROP_MUTE:
- g_value_set_boolean (value, gst_play_sink_get_mute (playbin->playsink));
- break;
- case PROP_FRAME:
- gst_value_take_buffer (value, gst_play_bin_convert_frame (playbin, NULL));
- break;
- case PROP_FONT_DESC:
- g_value_take_string (value,
- gst_play_sink_get_font_desc (playbin->playsink));
- break;
- case PROP_CONNECTION_SPEED:
- GST_PLAY_BIN_LOCK (playbin);
- g_value_set_uint (value, playbin->connection_speed / 1000);
- GST_PLAY_BIN_UNLOCK (playbin);
- break;
- case PROP_BUFFER_SIZE:
- GST_OBJECT_LOCK (playbin);
- g_value_set_int (value, playbin->buffer_size);
- GST_OBJECT_UNLOCK (playbin);
- break;
- case PROP_BUFFER_DURATION:
- GST_OBJECT_LOCK (playbin);
- g_value_set_int64 (value, playbin->buffer_duration);
- GST_OBJECT_UNLOCK (playbin);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_play_bin_update_cached_duration_from_query (GstPlayBin * playbin,
- gboolean valid, GstQuery * query)
-{
- GstFormat fmt;
- gint64 duration;
- gint i;
-
- GST_DEBUG_OBJECT (playbin, "Updating cached duration from query");
- gst_query_parse_duration (query, &fmt, &duration);
-
- for (i = 0; i < G_N_ELEMENTS (playbin->duration); i++) {
- if (playbin->duration[i].format == 0 || fmt == playbin->duration[i].format) {
- playbin->duration[i].valid = valid;
- playbin->duration[i].format = fmt;
- playbin->duration[i].duration = valid ? duration : -1;
- break;
- }
- }
-}
-
-static void
-gst_play_bin_update_cached_duration (GstPlayBin * playbin)
-{
- const GstFormat formats[] =
- { GST_FORMAT_TIME, GST_FORMAT_BYTES, GST_FORMAT_DEFAULT };
- gboolean ret;
- GstQuery *query;
- gint i;
-
- GST_DEBUG_OBJECT (playbin, "Updating cached durations before group switch");
- for (i = 0; i < G_N_ELEMENTS (formats); i++) {
- query = gst_query_new_duration (formats[i]);
- ret =
- GST_ELEMENT_CLASS (parent_class)->query (GST_ELEMENT_CAST (playbin),
- query);
- gst_play_bin_update_cached_duration_from_query (playbin, ret, query);
- gst_query_unref (query);
- }
-}
-
-static gboolean
-gst_play_bin_query (GstElement * element, GstQuery * query)
-{
- GstPlayBin *playbin = GST_PLAY_BIN (element);
- gboolean ret;
-
- /* During a group switch we shouldn't allow duration queries
- * because it's not clear if the old or new group's duration
- * is returned and if the sinks are already playing new data
- * or old data. See bug #585969
- *
- * While we're at it, also don't do any other queries during
- * a group switch or any other event that causes topology changes
- * by taking the playbin lock in any case.
- */
- GST_PLAY_BIN_LOCK (playbin);
-
- if (GST_QUERY_TYPE (query) == GST_QUERY_DURATION) {
- GstSourceGroup *group = playbin->curr_group;
- gboolean pending;
-
- GST_SOURCE_GROUP_LOCK (group);
- if (group->stream_changed_pending_lock) {
- g_mutex_lock (group->stream_changed_pending_lock);
- pending = group->pending || group->stream_changed_pending;
- g_mutex_unlock (group->stream_changed_pending_lock);
- } else {
- pending = group->pending;
- }
- if (pending) {
- GstFormat fmt;
- gint i;
-
- ret = FALSE;
- gst_query_parse_duration (query, &fmt, NULL);
- for (i = 0; i < G_N_ELEMENTS (playbin->duration); i++) {
- if (fmt == playbin->duration[i].format) {
- ret = playbin->duration[i].valid;
- gst_query_set_duration (query, fmt,
- (ret ? playbin->duration[i].duration : -1));
- break;
- }
- }
- GST_DEBUG_OBJECT (playbin,
- "Taking cached duration because of pending group switch: %d", ret);
- GST_SOURCE_GROUP_UNLOCK (group);
- GST_PLAY_BIN_UNLOCK (playbin);
- return ret;
- }
- GST_SOURCE_GROUP_UNLOCK (group);
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->query (element, query);
-
- if (GST_QUERY_TYPE (query) == GST_QUERY_DURATION)
- gst_play_bin_update_cached_duration_from_query (playbin, ret, query);
- GST_PLAY_BIN_UNLOCK (playbin);
-
- return ret;
-}
-
-/* mime types we are not handling on purpose right now, don't post a
- * missing-plugin message for these */
-static const gchar *blacklisted_mimes[] = {
- NULL
-};
-
-static void
-gst_play_bin_handle_message (GstBin * bin, GstMessage * msg)
-{
- GstPlayBin *playbin = GST_PLAY_BIN (bin);
- GstSourceGroup *group;
-
- if (gst_is_missing_plugin_message (msg)) {
- gchar *detail;
- guint i;
-
- detail = gst_missing_plugin_message_get_installer_detail (msg);
- for (i = 0; detail != NULL && blacklisted_mimes[i] != NULL; ++i) {
- if (strstr (detail, "|decoder-") && strstr (detail, blacklisted_mimes[i])) {
- GST_LOG_OBJECT (bin, "suppressing message %" GST_PTR_FORMAT, msg);
- gst_message_unref (msg);
- g_free (detail);
- return;
- }
- }
- g_free (detail);
- } else if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ELEMENT) {
- const GstStructure *s = gst_message_get_structure (msg);
-
- /* Drop all stream-changed messages except the last one */
- if (strcmp ("playbin2-stream-changed", gst_structure_get_name (s)) == 0) {
- guint32 seqnum = gst_message_get_seqnum (msg);
- GList *l, *l_prev;
-
- group = playbin->curr_group;
- g_mutex_lock (group->stream_changed_pending_lock);
- for (l = group->stream_changed_pending; l;) {
- guint32 l_seqnum = GPOINTER_TO_UINT (l->data);
-
- if (l_seqnum == seqnum) {
- l_prev = l;
- l = l->next;
- group->stream_changed_pending =
- g_list_delete_link (group->stream_changed_pending, l_prev);
- if (group->stream_changed_pending) {
- gst_message_unref (msg);
- msg = NULL;
- break;
- }
- } else {
- l = l->next;
- }
- }
- g_mutex_unlock (group->stream_changed_pending_lock);
- }
- } else if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ASYNC_START ||
- GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ASYNC_DONE) {
- GstObject *src = GST_OBJECT_CAST (msg->src);
-
- /* Ignore async state changes from the uridecodebin children,
- * see bug #602000. */
- group = playbin->curr_group;
- if (src && (group = playbin->curr_group) &&
- ((group->uridecodebin && src == GST_OBJECT_CAST (group->uridecodebin))
- || (group->suburidecodebin
- && src == GST_OBJECT_CAST (group->suburidecodebin)))) {
- GST_DEBUG_OBJECT (playbin,
- "Ignoring async state change of uridecodebin: %s",
- GST_OBJECT_NAME (src));
- gst_message_unref (msg);
- msg = NULL;
- }
- } else if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) {
- /* If we get an error of the subtitle uridecodebin transform
- * them into warnings and disable the subtitles */
- group = playbin->curr_group;
- if (group && group->suburidecodebin) {
- if (G_UNLIKELY (gst_object_has_ancestor (msg->src, GST_OBJECT_CAST
- (group->suburidecodebin)))) {
- GError *err;
- gchar *debug = NULL;
- GstMessage *new_msg;
- GstIterator *it;
- gboolean done = FALSE;
-
- gst_message_parse_error (msg, &err, &debug);
- new_msg = gst_message_new_warning (msg->src, err, debug);
-
- gst_message_unref (msg);
- g_error_free (err);
- g_free (debug);
- msg = new_msg;
-
- REMOVE_SIGNAL (group->suburidecodebin, group->sub_pad_added_id);
- REMOVE_SIGNAL (group->suburidecodebin, group->sub_pad_removed_id);
- REMOVE_SIGNAL (group->suburidecodebin, group->sub_no_more_pads_id);
- REMOVE_SIGNAL (group->suburidecodebin, group->sub_autoplug_continue_id);
-
- it = gst_element_iterate_src_pads (group->suburidecodebin);
- while (it && !done) {
- GstPad *p = NULL;
- GstIteratorResult res;
-
- res = gst_iterator_next (it, (gpointer) & p);
-
- switch (res) {
- case GST_ITERATOR_DONE:
- done = TRUE;
- break;
- case GST_ITERATOR_OK:
- pad_removed_cb (NULL, p, group);
- gst_object_unref (p);
- break;
-
- case GST_ITERATOR_RESYNC:
- gst_iterator_resync (it);
- break;
- case GST_ITERATOR_ERROR:
- done = TRUE;
- break;
- }
- }
- if (it)
- gst_iterator_free (it);
-
- gst_object_ref (group->suburidecodebin);
- gst_bin_remove (bin, group->suburidecodebin);
- gst_element_set_locked_state (group->suburidecodebin, FALSE);
-
- if (group->sub_pending) {
- group->sub_pending = FALSE;
- no_more_pads_cb (NULL, group);
- }
- }
- }
- }
-
- if (msg)
- GST_BIN_CLASS (parent_class)->handle_message (bin, msg);
-}
-
-static void
-selector_active_pad_changed (GObject * selector, GParamSpec * pspec,
- GstPlayBin * playbin)
-{
- gchar *property;
- GstSourceGroup *group;
- GstSourceSelect *select = NULL;
- int i;
-
- GST_PLAY_BIN_LOCK (playbin);
- group = get_group (playbin);
-
- for (i = 0; i < GST_PLAY_SINK_TYPE_LAST; i++) {
- if (selector == G_OBJECT (group->selector[i].selector)) {
- select = &group->selector[i];
- }
- }
-
- /* We got a pad-change after our group got switched out; no need to notify */
- if (!select) {
- GST_PLAY_BIN_UNLOCK (playbin);
- return;
- }
-
- switch (select->type) {
- case GST_PLAY_SINK_TYPE_VIDEO:
- case GST_PLAY_SINK_TYPE_VIDEO_RAW:
- property = "current-video";
- playbin->current_video = get_current_stream_number (playbin,
- group->video_channels);
- break;
- case GST_PLAY_SINK_TYPE_AUDIO:
- case GST_PLAY_SINK_TYPE_AUDIO_RAW:
- property = "current-audio";
- playbin->current_audio = get_current_stream_number (playbin,
- group->audio_channels);
- break;
- case GST_PLAY_SINK_TYPE_TEXT:
- property = "current-text";
- playbin->current_text = get_current_stream_number (playbin,
- group->text_channels);
- break;
- default:
- property = NULL;
- }
- GST_PLAY_BIN_UNLOCK (playbin);
-
- if (property)
- g_object_notify (G_OBJECT (playbin), property);
-}
-
-static void
-selector_blocked (GstPad * pad, gboolean blocked, gpointer user_data)
-{
- /* no nothing */
- GST_DEBUG_OBJECT (pad, "blocked callback, blocked: %d", blocked);
-}
-
-/* helper function to lookup stuff in lists */
-static gboolean
-array_has_value (const gchar * values[], const gchar * value)
-{
- gint i;
-
- for (i = 0; values[i]; i++) {
- if (g_str_has_prefix (value, values[i]))
- return TRUE;
- }
- return FALSE;
-}
-
-typedef struct
-{
- GstPlayBin *playbin;
- gint stream_id;
- GstPlaySinkType type;
-} NotifyTagsData;
-
-static void
-notify_tags_cb (GObject * object, GParamSpec * pspec, gpointer user_data)
-{
- NotifyTagsData *ntdata = (NotifyTagsData *) user_data;
- gint signal;
-
- GST_DEBUG_OBJECT (ntdata->playbin, "Tags on pad %" GST_PTR_FORMAT
- " with stream id %d and type %d have changed",
- object, ntdata->stream_id, ntdata->type);
-
- switch (ntdata->type) {
- case GST_PLAY_SINK_TYPE_VIDEO:
- case GST_PLAY_SINK_TYPE_VIDEO_RAW:
- signal = SIGNAL_VIDEO_TAGS_CHANGED;
- break;
- case GST_PLAY_SINK_TYPE_AUDIO:
- case GST_PLAY_SINK_TYPE_AUDIO_RAW:
- signal = SIGNAL_AUDIO_TAGS_CHANGED;
- break;
- case GST_PLAY_SINK_TYPE_TEXT:
- signal = SIGNAL_TEXT_TAGS_CHANGED;
- break;
- default:
- signal = -1;
- break;
- }
-
- if (signal >= 0)
- g_signal_emit (G_OBJECT (ntdata->playbin), gst_play_bin_signals[signal], 0,
- ntdata->stream_id);
-}
-
-typedef struct
-{
- GstPlayBin *playbin;
- GstSourceGroup *group;
- GstPlaySinkType type;
-} PlaySinkEventProbeData;
-
-static gboolean
-_playsink_src_event_probe_cb (GstPad * pad, GstEvent * event,
- PlaySinkEventProbeData * data)
-{
- if (GST_EVENT_TYPE (event) == GST_EVENT_QOS) {
- GstEvent *new_event;
- GstStructure *s;
- gdouble proportion;
- GstClockTimeDiff diff;
- GstClockTime group_start_accum =
- data->group->selector[data->type].group_start_accum;
- GstClockTime timestamp;
-
- s = (GstStructure *) gst_event_get_structure (event);
- if (gst_structure_has_field (s, "playbin2-adjusted-event"))
- return TRUE;
-
- /* If we have no group start accumulator yet, this is
- * a QOS event for the previous group or this stream
- * has a non-time segment.
- */
- if (!GST_CLOCK_TIME_IS_VALID (group_start_accum))
- return FALSE;
-
- /* If the group start accumulator is 0, this is the first
- * group and we don't need to do everything below
- */
- if (group_start_accum == 0)
- return TRUE;
-
- gst_event_parse_qos (event, &proportion, &diff, &timestamp);
-
- /* If the running time timestamp is smaller than the accumulator,
- * the event is for a buffer from the previous group
- */
- if (timestamp >= group_start_accum)
- timestamp -= group_start_accum;
- else
- return FALSE;
-
- /* That case is invalid for QoS events, also it means that
- * we have switched the group but receive QoS events of
- * the previous group.
- */
- if (diff < 0 && -diff > timestamp)
- return FALSE;
-
- new_event = gst_event_new_qos (proportion, diff, timestamp);
- s = (GstStructure *) gst_event_get_structure (new_event);
- gst_structure_set (s, "playbin2-adjusted-event", G_TYPE_BOOLEAN, TRUE,
- NULL);
- gst_pad_send_event (pad, new_event);
-
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-_playsink_sink_event_probe_cb (GstPad * pad, GstEvent * event,
- PlaySinkEventProbeData * data)
-{
- guint index;
-
- if (data->type == GST_PLAY_SINK_TYPE_VIDEO
- || data->type == GST_PLAY_SINK_TYPE_VIDEO_RAW)
- index = 0;
- else if (data->type == GST_PLAY_SINK_TYPE_AUDIO
- || data->type == GST_PLAY_SINK_TYPE_AUDIO_RAW)
- index = 1;
- else if (data->type == GST_PLAY_SINK_TYPE_TEXT)
- index = 2;
- else
- g_assert_not_reached ();
-
- if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
- GstPlayBin *playbin = data->playbin;
- GstSegment *segment;
- gboolean update;
- GstFormat format;
- gdouble rate, applied_rate;
- gint64 start, stop, pos;
-
- segment = &playbin->segments[index];
-
- gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
- &format, &start, &stop, &pos);
- if (segment->format != format)
- gst_segment_init (segment, format);
- gst_segment_set_newsegment_full (segment, update, rate, applied_rate,
- format, start, stop, pos);
-
- if (format != GST_FORMAT_TIME)
- data->group->selector[data->type].group_start_accum = GST_CLOCK_TIME_NONE;
- else if (!GST_CLOCK_TIME_IS_VALID (data->group->selector[data->type].
- group_start_accum))
- data->group->selector[data->type].group_start_accum = segment->accum;
- } else if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP) {
- gst_segment_init (&data->playbin->segments[index], GST_FORMAT_UNDEFINED);
- }
-
- return TRUE;
-}
-
-/* this function is called when a new pad is added to decodebin. We check the
- * type of the pad and add it to the selector element of the group.
- */
-static void
-pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
-{
- GstPlayBin *playbin;
- GstCaps *caps;
- const GstStructure *s;
- const gchar *name;
- GstPad *sinkpad;
- GstPadLinkReturn res;
- GstSourceSelect *select = NULL;
- gint i;
- gboolean changed = FALSE;
-
- playbin = group->playbin;
-
- caps = gst_pad_get_caps_reffed (pad);
- s = gst_caps_get_structure (caps, 0);
- name = gst_structure_get_name (s);
-
- GST_DEBUG_OBJECT (playbin,
- "pad %s:%s with caps %" GST_PTR_FORMAT " added in group %p",
- GST_DEBUG_PAD_NAME (pad), caps, group);
-
- /* major type of the pad, this determines the selector to use */
- for (i = 0; i < GST_PLAY_SINK_TYPE_LAST; i++) {
- if (array_has_value (group->selector[i].media_list, name)) {
- select = &group->selector[i];
- break;
- } else if (group->selector[i].get_media_caps) {
- GstCaps *media_caps = group->selector[i].get_media_caps ();
-
- if (media_caps && gst_caps_can_intersect (media_caps, caps)) {
- select = &group->selector[i];
- gst_caps_unref (media_caps);
- break;
- }
- gst_caps_unref (media_caps);
- }
- }
- /* no selector found for the media type, don't bother linking it to a
- * selector. This will leave the pad unlinked and thus ignored. */
- if (select == NULL)
- goto unknown_type;
-
- GST_SOURCE_GROUP_LOCK (group);
- if (select->selector == NULL && playbin->have_selector) {
- /* no selector, create one */
- GST_DEBUG_OBJECT (playbin, "creating new selector");
- select->selector = g_object_new (GST_TYPE_INPUT_SELECTOR, NULL);
- /* the above can't fail, but we keep the error handling around for when
- * the selector plugin has moved to -base or -good and we stop using an
- * internal copy of input-selector */
- if (select->selector == NULL) {
- /* post the missing selector message only once */
- playbin->have_selector = FALSE;
- gst_element_post_message (GST_ELEMENT_CAST (playbin),
- gst_missing_element_message_new (GST_ELEMENT_CAST (playbin),
- "input-selector"));
- GST_ELEMENT_WARNING (playbin, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "input-selector"), (NULL));
- } else {
- g_signal_connect (select->selector, "notify::active-pad",
- G_CALLBACK (selector_active_pad_changed), playbin);
-
- GST_DEBUG_OBJECT (playbin, "adding new selector %p", select->selector);
- gst_bin_add (GST_BIN_CAST (playbin), select->selector);
- gst_element_set_state (select->selector, GST_STATE_PAUSED);
- }
- }
-
- if (select->srcpad == NULL) {
- PlaySinkEventProbeData *data = g_new (PlaySinkEventProbeData, 1);
-
- if (select->selector) {
- /* save source pad of the selector */
- select->srcpad = gst_element_get_static_pad (select->selector, "src");
- } else {
- /* no selector, use the pad as the source pad then */
- select->srcpad = gst_object_ref (pad);
- }
-
- /* Install an event probe */
- data->playbin = playbin;
- data->group = group;
- data->type = select->type;
- select->src_event_probe_id =
- gst_pad_add_event_probe_full (select->srcpad,
- G_CALLBACK (_playsink_src_event_probe_cb), data,
- (GDestroyNotify) g_free);
-
- select->group_start_accum = -1;
-
- /* block the selector srcpad. It's possible that multiple decodebins start
- * pushing data into the selectors before we have a chance to collect all
- * streams and connect the sinks, resulting in not-linked errors. After we
- * configured the sinks we will unblock them all. */
- GST_DEBUG_OBJECT (playbin, "blocking %" GST_PTR_FORMAT, select->srcpad);
- gst_pad_set_blocked_async (select->srcpad, TRUE, selector_blocked, NULL);
- }
-
- /* get sinkpad for the new stream */
- if (select->selector) {
- if ((sinkpad = gst_element_get_request_pad (select->selector, "sink%d"))) {
- gulong notify_tags_handler = 0;
- NotifyTagsData *ntdata;
-
- GST_DEBUG_OBJECT (playbin, "got pad %s:%s from selector",
- GST_DEBUG_PAD_NAME (sinkpad));
-
- /* store the selector for the pad */
- g_object_set_data (G_OBJECT (sinkpad), "playbin2.select", select);
-
- /* connect to the notify::tags signal for our
- * own *-tags-changed signals
- */
- ntdata = g_new0 (NotifyTagsData, 1);
- ntdata->playbin = playbin;
- ntdata->stream_id = select->channels->len;
- ntdata->type = select->type;
-
- notify_tags_handler =
- g_signal_connect_data (G_OBJECT (sinkpad), "notify::tags",
- G_CALLBACK (notify_tags_cb), ntdata, (GClosureNotify) g_free,
- (GConnectFlags) 0);
- g_object_set_data (G_OBJECT (sinkpad), "playbin2.notify_tags_handler",
- (gpointer) notify_tags_handler);
-
- /* store the pad in the array */
- GST_DEBUG_OBJECT (playbin, "pad %p added to array", sinkpad);
- g_ptr_array_add (select->channels, sinkpad);
-
- res = gst_pad_link (pad, sinkpad);
- if (GST_PAD_LINK_FAILED (res))
- goto link_failed;
-
- /* store selector pad so we can release it */
- g_object_set_data (G_OBJECT (pad), "playbin2.sinkpad", sinkpad);
-
- changed = TRUE;
- GST_DEBUG_OBJECT (playbin, "linked pad %s:%s to selector %p",
- GST_DEBUG_PAD_NAME (pad), select->selector);
- }
- } else {
- /* no selector, don't configure anything, we'll link the new pad directly to
- * the sink. */
- changed = FALSE;
- sinkpad = NULL;
- }
- GST_SOURCE_GROUP_UNLOCK (group);
-
- if (changed) {
- int signal;
- gboolean always_ok = (decodebin == group->suburidecodebin);
-
- switch (select->type) {
- case GST_PLAY_SINK_TYPE_VIDEO:
- case GST_PLAY_SINK_TYPE_VIDEO_RAW:
- /* we want to return NOT_LINKED for unselected pads but only for pads
- * from the normal uridecodebin. This makes sure that subtitle streams
- * are not raced past audio/video from decodebin2's multiqueue.
- * For pads from suburidecodebin OK should always be returned, otherwise
- * it will most likely stop. */
- g_object_set (sinkpad, "always-ok", always_ok, NULL);
- signal = SIGNAL_VIDEO_CHANGED;
- break;
- case GST_PLAY_SINK_TYPE_AUDIO:
- case GST_PLAY_SINK_TYPE_AUDIO_RAW:
- g_object_set (sinkpad, "always-ok", always_ok, NULL);
- signal = SIGNAL_AUDIO_CHANGED;
- break;
- case GST_PLAY_SINK_TYPE_TEXT:
- g_object_set (sinkpad, "always-ok", always_ok, NULL);
- signal = SIGNAL_TEXT_CHANGED;
- break;
- default:
- signal = -1;
- }
-
- if (signal >= 0)
- g_signal_emit (G_OBJECT (playbin), gst_play_bin_signals[signal], 0, NULL);
- }
-
-done:
- gst_caps_unref (caps);
- return;
-
- /* ERRORS */
-unknown_type:
- {
- GST_ERROR_OBJECT (playbin, "unknown type %s for pad %s:%s",
- name, GST_DEBUG_PAD_NAME (pad));
- goto done;
- }
-link_failed:
- {
- GST_ERROR_OBJECT (playbin,
- "failed to link pad %s:%s to selector, reason %d",
- GST_DEBUG_PAD_NAME (pad), res);
- GST_SOURCE_GROUP_UNLOCK (group);
- goto done;
- }
-}
-
-/* called when a pad is removed from the uridecodebin. We unlink the pad from
- * the selector. This will make the selector select a new pad. */
-static void
-pad_removed_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
-{
- GstPlayBin *playbin;
- GstPad *peer;
- GstElement *selector;
- GstSourceSelect *select;
-
- playbin = group->playbin;
-
- GST_DEBUG_OBJECT (playbin,
- "pad %s:%s removed from group %p", GST_DEBUG_PAD_NAME (pad), group);
-
- GST_SOURCE_GROUP_LOCK (group);
- /* get the selector sinkpad */
- if (!(peer = g_object_get_data (G_OBJECT (pad), "playbin2.sinkpad")))
- goto not_linked;
-
- if ((select = g_object_get_data (G_OBJECT (peer), "playbin2.select"))) {
- gulong notify_tags_handler;
-
- notify_tags_handler =
- (gulong) g_object_get_data (G_OBJECT (peer),
- "playbin2.notify_tags_handler");
- if (notify_tags_handler != 0)
- g_signal_handler_disconnect (G_OBJECT (peer), notify_tags_handler);
- g_object_set_data (G_OBJECT (peer), "playbin2.notify_tags_handler", NULL);
-
- /* remove the pad from the array */
- g_ptr_array_remove (select->channels, peer);
- GST_DEBUG_OBJECT (playbin, "pad %p removed from array", peer);
- }
-
- /* unlink the pad now (can fail, the pad is unlinked before it's removed) */
- gst_pad_unlink (pad, peer);
-
- /* get selector, this can be NULL when the element is removing the pads
- * because it's being disposed. */
- selector = GST_ELEMENT_CAST (gst_pad_get_parent (peer));
- if (!selector) {
- gst_object_unref (peer);
- goto no_selector;
- }
-
- /* release the pad to the selector, this will make the selector choose a new
- * pad. */
- gst_element_release_request_pad (selector, peer);
- gst_object_unref (peer);
-
- gst_object_unref (selector);
- GST_SOURCE_GROUP_UNLOCK (group);
-
- return;
-
- /* ERRORS */
-not_linked:
- {
- GST_DEBUG_OBJECT (playbin, "pad not linked");
- GST_SOURCE_GROUP_UNLOCK (group);
- return;
- }
-no_selector:
- {
- GST_DEBUG_OBJECT (playbin, "selector not found");
- GST_SOURCE_GROUP_UNLOCK (group);
- return;
- }
-}
-
-/* we get called when all pads are available and we must connect the sinks to
- * them.
- * The main purpose of the code is to see if we have video/audio and subtitles
- * and pick the right pipelines to display them.
- *
- * The selectors installed on the group tell us about the presence of
- * audio/video and subtitle streams. This allows us to see if we need
- * visualisation, video or/and audio.
- */
-static void
-no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
-{
- GstPlayBin *playbin;
- GstPadLinkReturn res;
- gint i;
- gboolean configure;
-
- playbin = group->playbin;
-
- GST_DEBUG_OBJECT (playbin, "no more pads in group %p", group);
-
- GST_PLAY_BIN_SHUTDOWN_LOCK (playbin, shutdown);
-
- GST_SOURCE_GROUP_LOCK (group);
- for (i = 0; i < GST_PLAY_SINK_TYPE_LAST; i++) {
- GstSourceSelect *select = &group->selector[i];
-
- /* check if the specific media type was detected and thus has a selector
- * created for it. If there is the media type, get a sinkpad from the sink
- * and link it. We only do this if we have not yet requested the sinkpad
- * before. */
- if (select->srcpad && select->sinkpad == NULL) {
- PlaySinkEventProbeData *data = g_new (PlaySinkEventProbeData, 1);
-
- GST_DEBUG_OBJECT (playbin, "requesting new sink pad %d", select->type);
- select->sinkpad =
- gst_play_sink_request_pad (playbin->playsink, select->type);
-
- /* Install an event probe */
- data->playbin = playbin;
- data->group = group;
- data->type = select->type;
- select->sink_event_probe_id =
- gst_pad_add_event_probe_full (select->sinkpad,
- G_CALLBACK (_playsink_sink_event_probe_cb), data,
- (GDestroyNotify) g_free);
-
- res = gst_pad_link (select->srcpad, select->sinkpad);
- GST_DEBUG_OBJECT (playbin, "linked type %s, result: %d",
- select->media_list[0], res);
- if (res != GST_PAD_LINK_OK) {
- GST_ELEMENT_ERROR (playbin, CORE, PAD,
- ("Internal playbin error."),
- ("Failed to link selector to sink. Error %d", res));
- }
- }
- }
- GST_DEBUG_OBJECT (playbin, "pending %d > %d", group->pending,
- group->pending - 1);
-
- if (group->pending > 0)
- group->pending--;
-
- if (group->suburidecodebin == decodebin)
- group->sub_pending = FALSE;
-
- if (group->pending == 0) {
- /* we are the last group to complete, we will configure the output and then
- * signal the other waiters. */
- GST_LOG_OBJECT (playbin, "last group complete");
- configure = TRUE;
- } else {
- GST_LOG_OBJECT (playbin, "have more pending groups");
- configure = FALSE;
- }
- GST_SOURCE_GROUP_UNLOCK (group);
-
- if (configure) {
- /* if we have custom sinks, configure them now */
- GST_SOURCE_GROUP_LOCK (group);
- if (group->audio_sink) {
- GST_INFO_OBJECT (playbin, "setting custom audio sink %" GST_PTR_FORMAT,
- group->audio_sink);
- gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_AUDIO,
- group->audio_sink);
- } else {
- GST_INFO_OBJECT (playbin, "setting default audio sink %" GST_PTR_FORMAT,
- playbin->audio_sink);
- gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_AUDIO,
- playbin->audio_sink);
- }
- if (group->video_sink) {
- GST_INFO_OBJECT (playbin, "setting custom video sink %" GST_PTR_FORMAT,
- group->video_sink);
- gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_VIDEO,
- group->video_sink);
- } else {
- GST_INFO_OBJECT (playbin, "setting default video sink %" GST_PTR_FORMAT,
- playbin->video_sink);
- gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_VIDEO,
- playbin->video_sink);
- }
- gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_TEXT,
- playbin->text_sink);
- GST_SOURCE_GROUP_UNLOCK (group);
-
- GST_LOG_OBJECT (playbin, "reconfigure sink");
- /* we configure the modes if we were the last decodebin to complete. */
- gst_play_sink_reconfigure (playbin->playsink);
-
- /* signal the other decodebins that they can continue now. */
- GST_SOURCE_GROUP_LOCK (group);
- /* unblock all selectors */
- for (i = 0; i < GST_PLAY_SINK_TYPE_LAST; i++) {
- GstSourceSelect *select = &group->selector[i];
-
- /* Wait for stream-changed messages on all selectors except
- * the text selector because of the sparse nature of text streams.
- */
- if (select->sinkpad && select->type != GST_PLAY_SINK_TYPE_TEXT) {
- GstStructure *s;
- GstMessage *msg;
- GstEvent *event;
- guint32 seqnum;
-
- s = gst_structure_new ("playbin2-stream-changed", "uri", G_TYPE_STRING,
- group->uri, NULL);
- if (group->suburi)
- gst_structure_set (s, "suburi", G_TYPE_STRING, group->suburi, NULL);
- msg = gst_message_new_element (GST_OBJECT_CAST (playbin), s);
- seqnum = gst_message_get_seqnum (msg);
- event = gst_event_new_sink_message (msg);
- g_mutex_lock (group->stream_changed_pending_lock);
- group->stream_changed_pending =
- g_list_prepend (group->stream_changed_pending,
- GUINT_TO_POINTER (seqnum));
- g_mutex_unlock (group->stream_changed_pending_lock);
- gst_pad_send_event (select->sinkpad, event);
- gst_message_unref (msg);
- }
-
- if (select->srcpad) {
- GST_DEBUG_OBJECT (playbin, "unblocking %" GST_PTR_FORMAT,
- select->srcpad);
- gst_pad_set_blocked_async (select->srcpad, FALSE, selector_blocked,
- NULL);
- }
- }
- GST_SOURCE_GROUP_UNLOCK (group);
- }
-
- GST_PLAY_BIN_SHUTDOWN_UNLOCK (playbin);
-
- return;
-
-shutdown:
- {
- GST_DEBUG ("ignoring, we are shutting down");
- /* Request a flushing pad from playsink that we then link to the selector.
- * Then we unblock the selectors so that they stop with a WRONG_STATE
- * instead of a NOT_LINKED error.
- */
- GST_SOURCE_GROUP_LOCK (group);
- for (i = 0; i < GST_PLAY_SINK_TYPE_LAST; i++) {
- GstSourceSelect *select = &group->selector[i];
-
- if (select->srcpad) {
- if (select->sinkpad == NULL) {
- GST_DEBUG_OBJECT (playbin, "requesting new flushing sink pad");
- select->sinkpad =
- gst_play_sink_request_pad (playbin->playsink,
- GST_PLAY_SINK_TYPE_FLUSHING);
- res = gst_pad_link (select->srcpad, select->sinkpad);
- GST_DEBUG_OBJECT (playbin, "linked flushing, result: %d", res);
- }
- GST_DEBUG_OBJECT (playbin, "unblocking %" GST_PTR_FORMAT,
- select->srcpad);
- gst_pad_set_blocked_async (select->srcpad, FALSE, selector_blocked,
- NULL);
- }
- }
- GST_SOURCE_GROUP_UNLOCK (group);
- return;
- }
-}
-
-static void
-drained_cb (GstElement * decodebin, GstSourceGroup * group)
-{
- GstPlayBin *playbin;
-
- playbin = group->playbin;
-
- GST_DEBUG_OBJECT (playbin, "about to finish in group %p", group);
-
- /* after this call, we should have a next group to activate or we EOS */
- g_signal_emit (G_OBJECT (playbin),
- gst_play_bin_signals[SIGNAL_ABOUT_TO_FINISH], 0, NULL);
-
- /* now activate the next group. If the app did not set a uri, this will
- * fail and we can do EOS */
- setup_next_source (playbin, GST_STATE_PAUSED);
-}
-
-/* Called when we must provide a list of factories to plug to @pad with @caps.
- * We first check if we have a sink that can handle the format and if we do, we
- * return NULL, to expose the pad. If we have no sink (or the sink does not
- * work), we return the list of elements that can connect. */
-static GValueArray *
-autoplug_factories_cb (GstElement * decodebin, GstPad * pad,
- GstCaps * caps, GstSourceGroup * group)
-{
- GstPlayBin *playbin;
- GValueArray *result;
-
- playbin = group->playbin;
-
- GST_DEBUG_OBJECT (playbin, "factories group %p for %s:%s, %" GST_PTR_FORMAT,
- group, GST_DEBUG_PAD_NAME (pad), caps);
-
- /* filter out the elements based on the caps. */
- g_mutex_lock (playbin->elements_lock);
- gst_play_bin_update_elements_list (playbin);
- result = gst_factory_list_filter (playbin->elements, caps);
- g_mutex_unlock (playbin->elements_lock);
-
- GST_DEBUG_OBJECT (playbin, "found factories %p", result);
- GST_FACTORY_LIST_DEBUG (result);
-
- return result;
-}
-
-/* autoplug-continue decides, if a pad has raw caps that can be exposed
- * directly or if further decoding is necessary. We use this to expose
- * supported subtitles directly */
-static gboolean
-autoplug_continue_cb (GstElement * element, GstPad * pad, GstCaps * caps,
- GstSourceGroup * group)
-{
- GstCaps *subcaps;
- gboolean ret = FALSE;
-
- subcaps = gst_subtitle_overlay_create_factory_caps ();
- ret = !gst_caps_can_intersect (subcaps, caps);
- gst_caps_unref (subcaps);
-
- GST_DEBUG_OBJECT (group->playbin,
- "continue autoplugging group %p for %s:%s, %" GST_PTR_FORMAT ": %d",
- group, GST_DEBUG_PAD_NAME (pad), caps, ret);
-
- return ret;
-}
-
-/* We are asked to select an element. See if the next element to check
- * is a sink. If this is the case, we see if the sink works by setting it to
- * READY. If the sink works, we return SELECT_EXPOSE to make decodebin
- * expose the raw pad so that we can setup the mixers. */
-static GstAutoplugSelectResult
-autoplug_select_cb (GstElement * decodebin, GstPad * pad,
- GstCaps * caps, GstElementFactory * factory, GstSourceGroup * group)
-{
- GstPlayBin *playbin;
- GstElement *element;
- const gchar *klass;
- GstPlaySinkType type;
- GstElement **sinkp;
-
- playbin = group->playbin;
-
- GST_DEBUG_OBJECT (playbin, "select group %p for %s:%s, %" GST_PTR_FORMAT,
- group, GST_DEBUG_PAD_NAME (pad), caps);
-
- GST_DEBUG_OBJECT (playbin, "checking factory %s",
- GST_PLUGIN_FEATURE_NAME (factory));
-
- /* if it's not a sink, we just make decodebin try it */
- if (!gst_factory_list_is_type (factory, GST_FACTORY_LIST_SINK))
- return GST_AUTOPLUG_SELECT_TRY;
-
- /* it's a sink, see if an instance of it actually works */
- GST_DEBUG_OBJECT (playbin, "we found a sink");
-
- klass = gst_element_factory_get_klass (factory);
-
- /* figure out the klass */
- if (strstr (klass, "Audio")) {
- GST_DEBUG_OBJECT (playbin, "we found an audio sink");
- type = GST_PLAY_SINK_TYPE_AUDIO;
- sinkp = &group->audio_sink;
- } else if (strstr (klass, "Video")) {
- GST_DEBUG_OBJECT (playbin, "we found a video sink");
- type = GST_PLAY_SINK_TYPE_VIDEO;
- sinkp = &group->video_sink;
- } else {
- /* unknown klass, skip this element */
- GST_WARNING_OBJECT (playbin, "unknown sink klass %s found", klass);
- return GST_AUTOPLUG_SELECT_SKIP;
- }
-
- /* if we are asked to do visualisations and it's an audio sink, skip the
- * element. We can only do visualisations with raw sinks */
- if (gst_play_sink_get_flags (playbin->playsink) & GST_PLAY_FLAG_VIS) {
- if (type == GST_PLAY_SINK_TYPE_AUDIO) {
- GST_DEBUG_OBJECT (playbin, "skip audio sink because of vis");
- return GST_AUTOPLUG_SELECT_SKIP;
- }
- }
-
- /* now see if we already have a sink element */
- GST_SOURCE_GROUP_LOCK (group);
- if (*sinkp) {
- GST_DEBUG_OBJECT (playbin, "we already have a pending sink, expose pad");
- /* for now, just assume that we can link the pad to this same sink. FIXME,
- * check that we can link this new pad to this sink as well. */
- GST_SOURCE_GROUP_UNLOCK (group);
- return GST_AUTOPLUG_SELECT_EXPOSE;
- }
- GST_DEBUG_OBJECT (playbin, "we have no pending sink, try to create one");
- GST_SOURCE_GROUP_UNLOCK (group);
-
- if ((element = gst_element_factory_create (factory, NULL)) == NULL) {
- GST_WARNING_OBJECT (playbin, "Could not create an element from %s",
- gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory)));
- return GST_AUTOPLUG_SELECT_SKIP;
- }
-
- /* ... activate it ... We do this before adding it to the bin so that we
- * don't accidentally make it post error messages that will stop
- * everything. */
- if ((gst_element_set_state (element,
- GST_STATE_READY)) == GST_STATE_CHANGE_FAILURE) {
- GST_WARNING_OBJECT (playbin, "Couldn't set %s to READY",
- GST_ELEMENT_NAME (element));
- gst_object_unref (element);
- return GST_AUTOPLUG_SELECT_SKIP;
- }
-
- /* remember the sink in the group now, the element is floating, we take
- * ownership now */
- GST_SOURCE_GROUP_LOCK (group);
- if (*sinkp == NULL) {
- /* store the sink in the group, we will configure it later when we
- * reconfigure the sink */
- GST_DEBUG_OBJECT (playbin, "remember sink");
- gst_object_ref_sink (element);
- *sinkp = element;
- } else {
- /* some other thread configured a sink while we were testing the sink, set
- * the sink back to NULL and assume we can use the other sink */
- GST_DEBUG_OBJECT (playbin, "another sink was found, expose pad");
- gst_element_set_state (element, GST_STATE_NULL);
- gst_object_unref (element);
- }
- GST_SOURCE_GROUP_UNLOCK (group);
-
- /* tell decodebin to expose the pad because we are going to use this
- * sink */
- GST_DEBUG_OBJECT (playbin, "we found a working sink, expose pad");
-
- return GST_AUTOPLUG_SELECT_EXPOSE;
-}
-
-static void
-notify_source_cb (GstElement * uridecodebin, GParamSpec * pspec,
- GstSourceGroup * group)
-{
- GstPlayBin *playbin;
- GstElement *source;
-
- playbin = group->playbin;
-
- g_object_get (group->uridecodebin, "source", &source, NULL);
-
- GST_OBJECT_LOCK (playbin);
- if (playbin->source)
- gst_object_unref (playbin->source);
- playbin->source = source;
- GST_OBJECT_UNLOCK (playbin);
-
- g_object_notify (G_OBJECT (playbin), "source");
-}
-
-/* must be called with the group lock */
-static gboolean
-group_set_locked_state_unlocked (GstPlayBin * playbin, GstSourceGroup * group,
- gboolean locked)
-{
- GST_DEBUG_OBJECT (playbin, "locked_state %d on group %p", locked, group);
-
- if (group->uridecodebin)
- gst_element_set_locked_state (group->uridecodebin, locked);
- if (group->suburidecodebin)
- gst_element_set_locked_state (group->suburidecodebin, locked);
-
- return TRUE;
-}
-
-/* must be called with PLAY_BIN_LOCK */
-static gboolean
-activate_group (GstPlayBin * playbin, GstSourceGroup * group, GstState target)
-{
- GstElement *uridecodebin;
- GstElement *suburidecodebin = NULL;
- GstPlayFlags flags;
-
- g_return_val_if_fail (group->valid, FALSE);
- g_return_val_if_fail (!group->active, FALSE);
-
- GST_DEBUG_OBJECT (playbin, "activating group %p", group);
-
- GST_SOURCE_GROUP_LOCK (group);
-
- g_list_free (group->stream_changed_pending);
- group->stream_changed_pending = NULL;
- if (!group->stream_changed_pending_lock)
- group->stream_changed_pending_lock = g_mutex_new ();
-
- if (group->uridecodebin) {
- GST_DEBUG_OBJECT (playbin, "reusing existing uridecodebin");
- uridecodebin = group->uridecodebin;
- gst_element_set_state (uridecodebin, GST_STATE_READY);
- gst_bin_add (GST_BIN_CAST (playbin), gst_object_ref (uridecodebin));
- } else {
- GST_DEBUG_OBJECT (playbin, "making new uridecodebin");
- uridecodebin = gst_element_factory_make ("uridecodebin", NULL);
- if (!uridecodebin)
- goto no_decodebin;
- gst_bin_add (GST_BIN_CAST (playbin), uridecodebin);
- group->uridecodebin = gst_object_ref (uridecodebin);
- }
-
- /* configure connection speed */
- g_object_set (uridecodebin, "connection-speed",
- playbin->connection_speed / 1000, NULL);
-
- flags = gst_play_sink_get_flags (playbin->playsink);
-
- /* configure download buffering */
- if (flags & GST_PLAY_FLAG_DOWNLOAD)
- g_object_set (uridecodebin, "download", TRUE, NULL);
- else
- g_object_set (uridecodebin, "download", FALSE, NULL);
-
- /* configure uri */
- g_object_set (uridecodebin, "uri", group->uri, NULL);
- /* configure buffering of demuxed/parsed data */
- if (flags & GST_PLAY_FLAG_BUFFERING)
- g_object_set (uridecodebin, "use-buffering", TRUE, NULL);
- else
- g_object_set (uridecodebin, "use-buffering", FALSE, NULL);
- /* configure buffering parameters */
- g_object_set (uridecodebin, "buffer-duration", playbin->buffer_duration,
- NULL);
- g_object_set (uridecodebin, "buffer-size", playbin->buffer_size, NULL);
-
- /* connect pads and other things */
- group->pad_added_id = g_signal_connect (uridecodebin, "pad-added",
- G_CALLBACK (pad_added_cb), group);
- group->pad_removed_id = g_signal_connect (uridecodebin, "pad-removed",
- G_CALLBACK (pad_removed_cb), group);
- group->no_more_pads_id = g_signal_connect (uridecodebin, "no-more-pads",
- G_CALLBACK (no_more_pads_cb), group);
- group->notify_source_id = g_signal_connect (uridecodebin, "notify::source",
- G_CALLBACK (notify_source_cb), group);
-
- /* we have 1 pending no-more-pads */
- group->pending = 1;
-
- /* is called when the uridecodebin is out of data and we can switch to the
- * next uri */
- group->drained_id =
- g_signal_connect (uridecodebin, "drained", G_CALLBACK (drained_cb),
- group);
-
- /* will be called when a new media type is found. We return a list of decoders
- * including sinks for decodebin to try */
- group->autoplug_factories_id =
- g_signal_connect (uridecodebin, "autoplug-factories",
- G_CALLBACK (autoplug_factories_cb), group);
- group->autoplug_select_id =
- g_signal_connect (uridecodebin, "autoplug-select",
- G_CALLBACK (autoplug_select_cb), group);
- group->autoplug_continue_id =
- g_signal_connect (uridecodebin, "autoplug-continue",
- G_CALLBACK (autoplug_continue_cb), group);
-
- if (group->suburi) {
- /* subtitles */
- if (group->suburidecodebin) {
- GST_DEBUG_OBJECT (playbin, "reusing existing suburidecodebin");
- suburidecodebin = group->suburidecodebin;
- gst_element_set_state (suburidecodebin, GST_STATE_READY);
- gst_bin_add (GST_BIN_CAST (playbin), gst_object_ref (suburidecodebin));
- } else {
- GST_DEBUG_OBJECT (playbin, "making new suburidecodebin");
- suburidecodebin = gst_element_factory_make ("uridecodebin", NULL);
- if (!suburidecodebin)
- goto no_decodebin;
-
- gst_bin_add (GST_BIN_CAST (playbin), suburidecodebin);
- group->suburidecodebin = gst_object_ref (suburidecodebin);
- }
-
- /* configure connection speed */
- g_object_set (suburidecodebin, "connection-speed",
- playbin->connection_speed, NULL);
- /* configure uri */
- g_object_set (suburidecodebin, "uri", group->suburi, NULL);
-
- /* connect pads and other things */
- group->sub_pad_added_id = g_signal_connect (suburidecodebin, "pad-added",
- G_CALLBACK (pad_added_cb), group);
- group->sub_pad_removed_id = g_signal_connect (suburidecodebin,
- "pad-removed", G_CALLBACK (pad_removed_cb), group);
- group->sub_no_more_pads_id = g_signal_connect (suburidecodebin,
- "no-more-pads", G_CALLBACK (no_more_pads_cb), group);
-
- group->sub_autoplug_continue_id =
- g_signal_connect (suburidecodebin, "autoplug-continue",
- G_CALLBACK (autoplug_continue_cb), group);
-
- /* we have 2 pending no-more-pads */
- group->pending = 2;
- group->sub_pending = TRUE;
- } else {
- group->sub_pending = FALSE;
- }
-
- /* release the group lock before setting the state of the decodebins, they
- * might fire signals in this thread that we need to handle with the
- * group_lock taken. */
- GST_SOURCE_GROUP_UNLOCK (group);
-
- if (suburidecodebin) {
- if (gst_element_set_state (suburidecodebin,
- target) == GST_STATE_CHANGE_FAILURE) {
- GST_DEBUG_OBJECT (playbin,
- "failed state change of subtitle uridecodebin");
- GST_SOURCE_GROUP_LOCK (group);
-
- REMOVE_SIGNAL (group->suburidecodebin, group->sub_pad_added_id);
- REMOVE_SIGNAL (group->suburidecodebin, group->sub_pad_removed_id);
- REMOVE_SIGNAL (group->suburidecodebin, group->sub_no_more_pads_id);
- REMOVE_SIGNAL (group->suburidecodebin, group->sub_autoplug_continue_id);
- /* Might already be removed because of an error message */
- if (GST_OBJECT_PARENT (suburidecodebin) == GST_OBJECT_CAST (playbin))
- gst_bin_remove (GST_BIN_CAST (playbin), suburidecodebin);
- if (group->sub_pending) {
- group->pending--;
- group->sub_pending = FALSE;
- }
- gst_element_set_state (suburidecodebin, GST_STATE_READY);
- GST_SOURCE_GROUP_UNLOCK (group);
- }
- }
- if (gst_element_set_state (uridecodebin, target) == GST_STATE_CHANGE_FAILURE)
- goto uridecodebin_failure;
-
- GST_SOURCE_GROUP_LOCK (group);
- /* alow state changes of the playbin2 affect the group elements now */
- group_set_locked_state_unlocked (playbin, group, FALSE);
- group->active = TRUE;
- GST_SOURCE_GROUP_UNLOCK (group);
-
- return TRUE;
-
- /* ERRORS */
-no_decodebin:
- {
- GstMessage *msg;
-
- GST_SOURCE_GROUP_UNLOCK (group);
- msg =
- gst_missing_element_message_new (GST_ELEMENT_CAST (playbin),
- "uridecodebin");
- gst_element_post_message (GST_ELEMENT_CAST (playbin), msg);
-
- GST_ELEMENT_ERROR (playbin, CORE, MISSING_PLUGIN,
- (_("Could not create \"uridecodebin\" element.")), (NULL));
- return FALSE;
- }
-uridecodebin_failure:
- {
- GST_DEBUG_OBJECT (playbin, "failed state change of uridecodebin");
- return FALSE;
- }
-}
-
-/* unlink a group of uridecodebins from the sink.
- * must be called with PLAY_BIN_LOCK */
-static gboolean
-deactivate_group (GstPlayBin * playbin, GstSourceGroup * group)
-{
- gint i;
-
- g_return_val_if_fail (group->valid, FALSE);
- g_return_val_if_fail (group->active, FALSE);
-
- GST_DEBUG_OBJECT (playbin, "unlinking group %p", group);
-
- GST_SOURCE_GROUP_LOCK (group);
- group->active = FALSE;
- for (i = 0; i < GST_PLAY_SINK_TYPE_LAST; i++) {
- GstSourceSelect *select = &group->selector[i];
-
- GST_DEBUG_OBJECT (playbin, "unlinking selector %s", select->media_list[0]);
-
- if (select->srcpad) {
- if (select->sinkpad) {
- GST_LOG_OBJECT (playbin, "unlinking from sink");
- gst_pad_unlink (select->srcpad, select->sinkpad);
-
- if (select->sink_event_probe_id)
- gst_pad_remove_event_probe (select->sinkpad,
- select->sink_event_probe_id);
- select->sink_event_probe_id = 0;
-
- /* release back */
- GST_LOG_OBJECT (playbin, "release sink pad");
- gst_play_sink_release_pad (playbin->playsink, select->sinkpad);
- select->sinkpad = NULL;
- }
-
- if (select->src_event_probe_id)
- gst_pad_remove_event_probe (select->srcpad, select->src_event_probe_id);
- select->src_event_probe_id = 0;
-
- gst_object_unref (select->srcpad);
- select->srcpad = NULL;
- }
-
- if (select->selector) {
- gint n;
-
- /* release and unref requests pad from the selector */
- for (n = 0; n < select->channels->len; n++) {
- GstPad *sinkpad = g_ptr_array_index (select->channels, n);
-
- gst_element_release_request_pad (select->selector, sinkpad);
- gst_object_unref (sinkpad);
- }
- g_ptr_array_set_size (select->channels, 0);
-
- gst_element_set_state (select->selector, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (playbin), select->selector);
- select->selector = NULL;
- }
- }
- /* delete any custom sinks we might have */
- if (group->audio_sink)
- gst_object_unref (group->audio_sink);
- group->audio_sink = NULL;
- if (group->video_sink)
- gst_object_unref (group->video_sink);
- group->video_sink = NULL;
-
- if (group->uridecodebin) {
- REMOVE_SIGNAL (group->uridecodebin, group->pad_added_id);
- REMOVE_SIGNAL (group->uridecodebin, group->pad_removed_id);
- REMOVE_SIGNAL (group->uridecodebin, group->no_more_pads_id);
- REMOVE_SIGNAL (group->uridecodebin, group->notify_source_id);
- REMOVE_SIGNAL (group->uridecodebin, group->drained_id);
- REMOVE_SIGNAL (group->uridecodebin, group->autoplug_factories_id);
- REMOVE_SIGNAL (group->uridecodebin, group->autoplug_select_id);
- REMOVE_SIGNAL (group->uridecodebin, group->autoplug_continue_id);
- gst_bin_remove (GST_BIN_CAST (playbin), group->uridecodebin);
- }
-
- if (group->suburidecodebin) {
- REMOVE_SIGNAL (group->suburidecodebin, group->sub_pad_added_id);
- REMOVE_SIGNAL (group->suburidecodebin, group->sub_pad_removed_id);
- REMOVE_SIGNAL (group->suburidecodebin, group->sub_no_more_pads_id);
- REMOVE_SIGNAL (group->suburidecodebin, group->sub_autoplug_continue_id);
-
- /* Might already be removed because of errors */
- if (GST_OBJECT_PARENT (group->suburidecodebin) == GST_OBJECT_CAST (playbin))
- gst_bin_remove (GST_BIN_CAST (playbin), group->suburidecodebin);
- }
-
- GST_SOURCE_GROUP_UNLOCK (group);
-
- return TRUE;
-}
-
-/* setup the next group to play, this assumes the next_group is valid and
- * configured. It swaps out the current_group and activates the valid
- * next_group. */
-static gboolean
-setup_next_source (GstPlayBin * playbin, GstState target)
-{
- GstSourceGroup *new_group, *old_group;
-
- GST_DEBUG_OBJECT (playbin, "setup sources");
-
- /* see if there is a next group */
- GST_PLAY_BIN_LOCK (playbin);
- new_group = playbin->next_group;
- if (!new_group || !new_group->valid)
- goto no_next_group;
-
- /* first unlink the current source, if any */
- old_group = playbin->curr_group;
- if (old_group && old_group->valid) {
- gst_play_bin_update_cached_duration (playbin);
- /* unlink our pads with the sink */
- deactivate_group (playbin, old_group);
- old_group->valid = FALSE;
- }
-
- /* swap old and new */
- playbin->curr_group = new_group;
- playbin->next_group = old_group;
-
- /* activate the new group */
- if (!activate_group (playbin, new_group, target))
- goto activate_failed;
-
- GST_PLAY_BIN_UNLOCK (playbin);
-
- return TRUE;
-
- /* ERRORS */
-no_next_group:
- {
- GST_DEBUG_OBJECT (playbin, "no next group");
- if (target == GST_STATE_READY && new_group && new_group->uri == NULL)
- GST_ELEMENT_ERROR (playbin, RESOURCE, NOT_FOUND, ("No URI set"), (NULL));
- GST_PLAY_BIN_UNLOCK (playbin);
- return FALSE;
- }
-activate_failed:
- {
- GST_DEBUG_OBJECT (playbin, "activate failed");
- GST_PLAY_BIN_UNLOCK (playbin);
- return FALSE;
- }
-}
-
-/* The group that is currently playing is copied again to the
- * next_group so that it will start playing the next time.
- */
-static gboolean
-save_current_group (GstPlayBin * playbin)
-{
- GstSourceGroup *curr_group;
-
- GST_DEBUG_OBJECT (playbin, "save current group");
-
- /* see if there is a current group */
- GST_PLAY_BIN_LOCK (playbin);
- curr_group = playbin->curr_group;
- if (curr_group && curr_group->valid) {
- /* unlink our pads with the sink */
- deactivate_group (playbin, curr_group);
- }
- /* swap old and new */
- playbin->curr_group = playbin->next_group;
- playbin->next_group = curr_group;
- GST_PLAY_BIN_UNLOCK (playbin);
-
- return TRUE;
-}
-
-/* clear the locked state from all groups. This function is called before a
- * state change to NULL is performed on them. */
-static gboolean
-groups_set_locked_state (GstPlayBin * playbin, gboolean locked)
-{
- GST_DEBUG_OBJECT (playbin, "setting locked state to %d on all groups",
- locked);
-
- GST_PLAY_BIN_LOCK (playbin);
- GST_SOURCE_GROUP_LOCK (playbin->curr_group);
- group_set_locked_state_unlocked (playbin, playbin->curr_group, locked);
- GST_SOURCE_GROUP_UNLOCK (playbin->curr_group);
- GST_SOURCE_GROUP_LOCK (playbin->next_group);
- group_set_locked_state_unlocked (playbin, playbin->next_group, locked);
- GST_SOURCE_GROUP_UNLOCK (playbin->next_group);
- GST_PLAY_BIN_UNLOCK (playbin);
-
- return TRUE;
-}
-
-static GstStateChangeReturn
-gst_play_bin_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret;
- GstPlayBin *playbin;
-
- playbin = GST_PLAY_BIN (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- g_mutex_lock (playbin->elements_lock);
- gst_play_bin_update_elements_list (playbin);
- g_mutex_unlock (playbin->elements_lock);
- memset (&playbin->duration, 0, sizeof (playbin->duration));
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:{
- guint i;
-
- GST_LOG_OBJECT (playbin, "clearing shutdown flag");
- memset (&playbin->duration, 0, sizeof (playbin->duration));
- g_atomic_int_set (&playbin->shutdown, 0);
-
- for (i = 0; i < 3; i++)
- gst_segment_init (&playbin->segments[i], GST_FORMAT_UNDEFINED);
-
- if (!setup_next_source (playbin, GST_STATE_READY))
- goto source_failed;
- break;
- }
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- /* FIXME unlock our waiting groups */
- GST_LOG_OBJECT (playbin, "setting shutdown flag");
- g_atomic_int_set (&playbin->shutdown, 1);
- memset (&playbin->duration, 0, sizeof (playbin->duration));
-
- /* wait for all callbacks to end by taking the lock.
- * No dynamic (critical) new callbacks will
- * be able to happen as we set the shutdown flag. */
- GST_PLAY_BIN_DYN_LOCK (playbin);
- GST_LOG_OBJECT (playbin, "dynamic lock taken, we can continue shutdown");
- GST_PLAY_BIN_DYN_UNLOCK (playbin);
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:{
- guint i;
-
- memset (&playbin->duration, 0, sizeof (playbin->duration));
-
- /* unlock so that all groups go to NULL */
- groups_set_locked_state (playbin, FALSE);
-
- for (i = 0; i < 2; i++) {
- if (playbin->groups[i].uridecodebin) {
- gst_element_set_state (playbin->groups[i].uridecodebin,
- GST_STATE_NULL);
- gst_object_unref (playbin->groups[i].uridecodebin);
- playbin->groups[i].uridecodebin = NULL;
- }
- if (playbin->groups[i].suburidecodebin) {
- gst_element_set_state (playbin->groups[i].suburidecodebin,
- GST_STATE_NULL);
- gst_object_unref (playbin->groups[i].suburidecodebin);
- playbin->groups[i].suburidecodebin = NULL;
- }
- }
- break;
- }
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- if (ret == GST_STATE_CHANGE_FAILURE) {
- if (transition == GST_STATE_CHANGE_READY_TO_PAUSED) {
- GstSourceGroup *curr_group;
-
- curr_group = playbin->curr_group;
- if (curr_group && curr_group->valid) {
- /* unlink our pads with the sink */
- deactivate_group (playbin, curr_group);
- }
-
- /* Swap current and next group back */
- playbin->curr_group = playbin->next_group;
- playbin->next_group = curr_group;
- }
- return ret;
- }
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- /* FIXME Release audio device when we implement that */
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- save_current_group (playbin);
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- /* make sure the groups don't perform a state change anymore until we
- * enable them again */
- groups_set_locked_state (playbin, TRUE);
- break;
- default:
- break;
- }
-
- return ret;
-
- /* ERRORS */
-source_failed:
- {
- return GST_STATE_CHANGE_FAILURE;
- }
-}
-
-gboolean
-gst_play_bin2_plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (gst_play_bin_debug, "playbin2", 0, "play bin");
-
- g_type_class_ref (gst_input_selector_get_type ());
- g_type_class_ref (gst_selector_pad_get_type ());
-
- return gst_element_register (plugin, "playbin2", GST_RANK_NONE,
- GST_TYPE_PLAY_BIN);
-}
diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c
deleted file mode 100644
index 68f56b84..00000000
--- a/gst/playback/gstplaysink.c
+++ /dev/null
@@ -1,2756 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <gst/gst.h>
-
-#include <gst/gst-i18n-plugin.h>
-#include <gst/pbutils/pbutils.h>
-
-#include "gstplaysink.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_play_sink_debug);
-#define GST_CAT_DEFAULT gst_play_sink_debug
-
-#define VOLUME_MAX_DOUBLE 10.0
-
-#define DEFAULT_FLAGS GST_PLAY_FLAG_AUDIO | GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_TEXT | \
- GST_PLAY_FLAG_SOFT_VOLUME
-
-#define GST_PLAY_CHAIN(c) ((GstPlayChain *)(c))
-
-/* holds the common data fields for the audio and video pipelines. We keep them
- * in a structure to more easily have all the info available. */
-typedef struct
-{
- GstPlaySink *playsink;
- GstElement *bin;
- gboolean added;
- gboolean activated;
- gboolean raw;
-} GstPlayChain;
-
-typedef struct
-{
- GstPlayChain chain;
- GstPad *sinkpad;
- GstElement *queue;
- GstElement *conv;
- GstElement *resample;
- GstElement *volume; /* element with the volume property */
- gboolean sink_volume; /* if the volume was provided by the sink */
- GstElement *mute; /* element with the mute property */
- GstElement *sink;
-} GstPlayAudioChain;
-
-typedef struct
-{
- GstPlayChain chain;
- GstPad *sinkpad;
- GstElement *queue;
- GstElement *conv;
- GstElement *scale;
- GstElement *sink;
- gboolean async;
-} GstPlayVideoChain;
-
-typedef struct
-{
- GstPlayChain chain;
- GstPad *sinkpad;
- GstElement *queue;
- GstElement *conv;
- GstElement *resample;
- GstPad *blockpad; /* srcpad of resample, used for switching the vis */
- GstPad *vissinkpad; /* visualisation sinkpad, */
- GstElement *vis;
- GstPad *vissrcpad; /* visualisation srcpad, */
- GstPad *srcpad; /* outgoing srcpad, used to connect to the next
- * chain */
-} GstPlayVisChain;
-
-typedef struct
-{
- GstPlayChain chain;
- GstPad *sinkpad;
- GstElement *queue;
- GstElement *identity;
- GstElement *overlay;
- GstPad *videosinkpad;
- GstPad *textsinkpad;
- GstPad *srcpad; /* outgoing srcpad, used to connect to the next
- * chain */
- GstElement *sink; /* custom sink to receive subtitle buffers */
-} GstPlayTextChain;
-
-#define GST_PLAY_SINK_GET_LOCK(playsink) (&((GstPlaySink *)playsink)->lock)
-#define GST_PLAY_SINK_LOCK(playsink) g_static_rec_mutex_lock (GST_PLAY_SINK_GET_LOCK (playsink))
-#define GST_PLAY_SINK_UNLOCK(playsink) g_static_rec_mutex_unlock (GST_PLAY_SINK_GET_LOCK (playsink))
-
-struct _GstPlaySink
-{
- GstBin bin;
-
- GStaticRecMutex lock;
-
- gboolean async_pending;
- gboolean need_async_start;
-
- GstPlayFlags flags;
-
- /* chains */
- GstPlayAudioChain *audiochain;
- GstPlayVideoChain *videochain;
- GstPlayVisChain *vischain;
- GstPlayTextChain *textchain;
-
- /* audio */
- GstPad *audio_pad;
- gboolean audio_pad_raw;
- /* audio tee */
- GstElement *audio_tee;
- GstPad *audio_tee_sink;
- GstPad *audio_tee_asrc;
- GstPad *audio_tee_vissrc;
- /* video */
- GstPad *video_pad;
- gboolean video_pad_raw;
- /* text */
- GstPad *text_pad;
-
- /* properties */
- GstElement *audio_sink;
- GstElement *video_sink;
- GstElement *visualisation;
- GstElement *text_sink;
- gdouble volume;
- gboolean mute;
- gchar *font_desc; /* font description */
- gchar *subtitle_encoding; /* subtitle encoding */
- guint connection_speed; /* connection speed in bits/sec (0 = unknown) */
- gint count;
- gboolean volume_changed; /* volume/mute changed while no audiochain */
- gboolean mute_changed; /* ... has been created yet */
-};
-
-struct _GstPlaySinkClass
-{
- GstBinClass parent_class;
-
- gboolean (*reconfigure) (GstPlaySink * playsink);
-};
-
-static GstStaticPadTemplate audiorawtemplate =
-GST_STATIC_PAD_TEMPLATE ("audio_raw_sink",
- GST_PAD_SINK,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS_ANY);
-static GstStaticPadTemplate audiotemplate =
-GST_STATIC_PAD_TEMPLATE ("audio_sink",
- GST_PAD_SINK,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS_ANY);
-static GstStaticPadTemplate videorawtemplate =
-GST_STATIC_PAD_TEMPLATE ("video_raw_sink",
- GST_PAD_SINK,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS_ANY);
-static GstStaticPadTemplate videotemplate =
-GST_STATIC_PAD_TEMPLATE ("video_sink",
- GST_PAD_SINK,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS_ANY);
-static GstStaticPadTemplate texttemplate = GST_STATIC_PAD_TEMPLATE ("text_sink",
- GST_PAD_SINK,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS_ANY);
-
-/* props */
-enum
-{
- PROP_0,
- PROP_FLAGS,
- PROP_MUTE,
- PROP_VOLUME,
- PROP_FONT_DESC,
- PROP_SUBTITLE_ENCODING,
- PROP_VIS_PLUGIN,
- PROP_LAST
-};
-
-/* signals */
-enum
-{
- LAST_SIGNAL
-};
-
-static void gst_play_sink_class_init (GstPlaySinkClass * klass);
-static void gst_play_sink_init (GstPlaySink * playsink);
-static void gst_play_sink_dispose (GObject * object);
-static void gst_play_sink_finalize (GObject * object);
-static void gst_play_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * spec);
-static void gst_play_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * spec);
-
-static GstPad *gst_play_sink_request_new_pad (GstElement * element,
- GstPadTemplate * templ, const gchar * name);
-static void gst_play_sink_release_request_pad (GstElement * element,
- GstPad * pad);
-static gboolean gst_play_sink_send_event (GstElement * element,
- GstEvent * event);
-static GstStateChangeReturn gst_play_sink_change_state (GstElement * element,
- GstStateChange transition);
-
-static void gst_play_sink_handle_message (GstBin * bin, GstMessage * message);
-
-/* static guint gst_play_sink_signals[LAST_SIGNAL] = { 0 }; */
-
-G_DEFINE_TYPE (GstPlaySink, gst_play_sink, GST_TYPE_BIN);
-
-static void
-gst_play_sink_class_init (GstPlaySinkClass * klass)
-{
- GObjectClass *gobject_klass;
- GstElementClass *gstelement_klass;
- GstBinClass *gstbin_klass;
-
- gobject_klass = (GObjectClass *) klass;
- gstelement_klass = (GstElementClass *) klass;
- gstbin_klass = (GstBinClass *) klass;
-
- gobject_klass->dispose = gst_play_sink_dispose;
- gobject_klass->finalize = gst_play_sink_finalize;
- gobject_klass->set_property = gst_play_sink_set_property;
- gobject_klass->get_property = gst_play_sink_get_property;
-
-
- /**
- * GstPlaySink:flags
- *
- * Control the behaviour of playsink.
- */
- g_object_class_install_property (gobject_klass, PROP_FLAGS,
- g_param_spec_flags ("flags", "Flags", "Flags to control behaviour",
- GST_TYPE_PLAY_FLAGS, DEFAULT_FLAGS,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstPlaySink:volume:
- *
- * Get or set the current audio stream volume. 1.0 means 100%,
- * 0.0 means mute. This uses a linear volume scale.
- *
- */
- g_object_class_install_property (gobject_klass, PROP_VOLUME,
- g_param_spec_double ("volume", "Volume", "The audio volume, 1.0=100%",
- 0.0, VOLUME_MAX_DOUBLE, 1.0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, PROP_MUTE,
- g_param_spec_boolean ("mute", "Mute",
- "Mute the audio channel without changing the volume", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, PROP_FONT_DESC,
- g_param_spec_string ("subtitle-font-desc",
- "Subtitle font description",
- "Pango font description of font "
- "to be used for subtitle rendering", NULL,
- G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, PROP_SUBTITLE_ENCODING,
- g_param_spec_string ("subtitle-encoding", "subtitle encoding",
- "Encoding to assume if input subtitles are not in UTF-8 encoding. "
- "If not set, the GST_SUBTITLE_ENCODING environment variable will "
- "be checked for an encoding to use. If that is not set either, "
- "ISO-8859-15 will be assumed.", NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, PROP_VIS_PLUGIN,
- g_param_spec_object ("vis-plugin", "Vis plugin",
- "the visualization element to use (NULL = default)",
- GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_signal_new ("reconfigure", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstPlaySinkClass,
- reconfigure), NULL, NULL, gst_marshal_BOOLEAN__VOID, G_TYPE_BOOLEAN,
- 0, G_TYPE_NONE);
-
- gst_element_class_add_pad_template (gstelement_klass,
- gst_static_pad_template_get (&audiorawtemplate));
- gst_element_class_add_pad_template (gstelement_klass,
- gst_static_pad_template_get (&audiotemplate));
- gst_element_class_add_pad_template (gstelement_klass,
- gst_static_pad_template_get (&videorawtemplate));
- gst_element_class_add_pad_template (gstelement_klass,
- gst_static_pad_template_get (&videotemplate));
- gst_element_class_add_pad_template (gstelement_klass,
- gst_static_pad_template_get (&texttemplate));
- gst_element_class_set_details_simple (gstelement_klass, "Player Sink",
- "Generic/Bin/Sink",
- "Convenience sink for multiple streams",
- "Wim Taymans <wim.taymans@gmail.com>");
-
- gstelement_klass->change_state =
- GST_DEBUG_FUNCPTR (gst_play_sink_change_state);
- gstelement_klass->send_event = GST_DEBUG_FUNCPTR (gst_play_sink_send_event);
- gstelement_klass->request_new_pad =
- GST_DEBUG_FUNCPTR (gst_play_sink_request_new_pad);
- gstelement_klass->release_pad =
- GST_DEBUG_FUNCPTR (gst_play_sink_release_request_pad);
-
- gstbin_klass->handle_message =
- GST_DEBUG_FUNCPTR (gst_play_sink_handle_message);
-
- klass->reconfigure = GST_DEBUG_FUNCPTR (gst_play_sink_reconfigure);
-}
-
-static void
-gst_play_sink_init (GstPlaySink * playsink)
-{
- /* init groups */
- playsink->video_sink = NULL;
- playsink->audio_sink = NULL;
- playsink->visualisation = NULL;
- playsink->text_sink = NULL;
- playsink->volume = 1.0;
- playsink->font_desc = NULL;
- playsink->subtitle_encoding = NULL;
- playsink->flags = DEFAULT_FLAGS;
-
- g_static_rec_mutex_init (&playsink->lock);
- GST_OBJECT_FLAG_SET (playsink, GST_ELEMENT_IS_SINK);
-}
-
-static void
-free_chain (GstPlayChain * chain)
-{
- if (chain) {
- if (chain->bin)
- gst_object_unref (chain->bin);
- g_free (chain);
- }
-}
-
-static void
-gst_play_sink_dispose (GObject * object)
-{
- GstPlaySink *playsink;
-
- playsink = GST_PLAY_SINK (object);
-
- if (playsink->audio_sink != NULL) {
- gst_element_set_state (playsink->audio_sink, GST_STATE_NULL);
- gst_object_unref (playsink->audio_sink);
- playsink->audio_sink = NULL;
- }
- if (playsink->video_sink != NULL) {
- gst_element_set_state (playsink->video_sink, GST_STATE_NULL);
- gst_object_unref (playsink->video_sink);
- playsink->video_sink = NULL;
- }
- if (playsink->visualisation != NULL) {
- gst_element_set_state (playsink->visualisation, GST_STATE_NULL);
- gst_object_unref (playsink->visualisation);
- playsink->visualisation = NULL;
- }
- if (playsink->text_sink != NULL) {
- gst_element_set_state (playsink->text_sink, GST_STATE_NULL);
- gst_object_unref (playsink->text_sink);
- playsink->text_sink = NULL;
- }
-
- free_chain ((GstPlayChain *) playsink->videochain);
- playsink->videochain = NULL;
- free_chain ((GstPlayChain *) playsink->audiochain);
- playsink->audiochain = NULL;
- free_chain ((GstPlayChain *) playsink->vischain);
- playsink->vischain = NULL;
- free_chain ((GstPlayChain *) playsink->textchain);
- playsink->textchain = NULL;
-
- if (playsink->audio_tee_sink) {
- gst_object_unref (playsink->audio_tee_sink);
- playsink->audio_tee_sink = NULL;
- }
-
- if (playsink->audio_tee_vissrc) {
- gst_element_release_request_pad (playsink->audio_tee,
- playsink->audio_tee_vissrc);
- gst_object_unref (playsink->audio_tee_vissrc);
- playsink->audio_tee_vissrc = NULL;
- }
-
- if (playsink->audio_tee_asrc) {
- gst_element_release_request_pad (playsink->audio_tee,
- playsink->audio_tee_asrc);
- gst_object_unref (playsink->audio_tee_asrc);
- playsink->audio_tee_asrc = NULL;
- }
-
- g_free (playsink->font_desc);
- playsink->font_desc = NULL;
-
- g_free (playsink->subtitle_encoding);
- playsink->subtitle_encoding = NULL;
-
- G_OBJECT_CLASS (gst_play_sink_parent_class)->dispose (object);
-}
-
-static void
-gst_play_sink_finalize (GObject * object)
-{
- GstPlaySink *playsink;
-
- playsink = GST_PLAY_SINK (object);
-
- g_static_rec_mutex_free (&playsink->lock);
-
- G_OBJECT_CLASS (gst_play_sink_parent_class)->finalize (object);
-}
-
-void
-gst_play_sink_set_sink (GstPlaySink * playsink, GstPlaySinkType type,
- GstElement * sink)
-{
- GstElement **elem = NULL, *old = NULL;
-
- GST_LOG ("Setting sink %" GST_PTR_FORMAT " as sink type %d", sink, type);
-
- GST_PLAY_SINK_LOCK (playsink);
- switch (type) {
- case GST_PLAY_SINK_TYPE_AUDIO:
- case GST_PLAY_SINK_TYPE_AUDIO_RAW:
- elem = &playsink->audio_sink;
- break;
- case GST_PLAY_SINK_TYPE_VIDEO:
- case GST_PLAY_SINK_TYPE_VIDEO_RAW:
- elem = &playsink->video_sink;
- break;
- case GST_PLAY_SINK_TYPE_TEXT:
- elem = &playsink->text_sink;
- break;
- default:
- break;
- }
- if (elem) {
- old = *elem;
- if (sink)
- gst_object_ref (sink);
- *elem = sink;
- }
- GST_PLAY_SINK_UNLOCK (playsink);
-
- if (old) {
- if (old != sink)
- gst_element_set_state (old, GST_STATE_NULL);
- gst_object_unref (old);
- }
-}
-
-GstElement *
-gst_play_sink_get_sink (GstPlaySink * playsink, GstPlaySinkType type)
-{
- GstElement *result = NULL;
- GstElement *elem = NULL, *chainp = NULL;
-
- GST_PLAY_SINK_LOCK (playsink);
- switch (type) {
- case GST_PLAY_SINK_TYPE_AUDIO:
- {
- GstPlayAudioChain *chain;
- if ((chain = (GstPlayAudioChain *) playsink->audiochain))
- chainp = chain->sink;
- elem = playsink->audio_sink;
- break;
- }
- case GST_PLAY_SINK_TYPE_VIDEO:
- {
- GstPlayVideoChain *chain;
- if ((chain = (GstPlayVideoChain *) playsink->videochain))
- chainp = chain->sink;
- elem = playsink->video_sink;
- break;
- }
- case GST_PLAY_SINK_TYPE_TEXT:
- {
- GstPlayTextChain *chain;
- if ((chain = (GstPlayTextChain *) playsink->textchain))
- chainp = chain->sink;
- elem = playsink->text_sink;
- break;
- }
- default:
- break;
- }
- if (chainp) {
- /* we have an active chain with a sink, get the sink */
- result = gst_object_ref (chainp);
- }
- /* nothing found, return last configured sink */
- if (result == NULL && elem)
- result = gst_object_ref (elem);
- GST_PLAY_SINK_UNLOCK (playsink);
-
- return result;
-}
-
-static void
-gst_play_sink_vis_unblocked (GstPad * tee_pad, gboolean blocked,
- gpointer user_data)
-{
- GstPlaySink *playsink;
-
- playsink = GST_PLAY_SINK (user_data);
- /* nothing to do here, we need a dummy callback here to make the async call
- * non-blocking. */
- GST_DEBUG_OBJECT (playsink, "vis pad unblocked");
-}
-
-static void
-gst_play_sink_vis_blocked (GstPad * tee_pad, gboolean blocked,
- gpointer user_data)
-{
- GstPlaySink *playsink;
- GstPlayVisChain *chain;
-
- playsink = GST_PLAY_SINK (user_data);
-
- GST_PLAY_SINK_LOCK (playsink);
- GST_DEBUG_OBJECT (playsink, "vis pad blocked");
- /* now try to change the plugin in the running vis chain */
- if (!(chain = (GstPlayVisChain *) playsink->vischain))
- goto done;
-
- /* unlink the old plugin and unghost the pad */
- gst_pad_unlink (chain->blockpad, chain->vissinkpad);
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (chain->srcpad), NULL);
-
- /* set the old plugin to NULL and remove */
- gst_element_set_state (chain->vis, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (chain->chain.bin), chain->vis);
-
- /* add new plugin and set state to playing */
- chain->vis = playsink->visualisation;
- gst_bin_add (GST_BIN_CAST (chain->chain.bin), chain->vis);
- gst_element_set_state (chain->vis, GST_STATE_PLAYING);
-
- /* get pads */
- chain->vissinkpad = gst_element_get_static_pad (chain->vis, "sink");
- chain->vissrcpad = gst_element_get_static_pad (chain->vis, "src");
-
- /* link pads */
- gst_pad_link (chain->blockpad, chain->vissinkpad);
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (chain->srcpad),
- chain->vissrcpad);
-
-done:
- /* Unblock the pad */
- gst_pad_set_blocked_async (tee_pad, FALSE, gst_play_sink_vis_unblocked,
- playsink);
- GST_PLAY_SINK_UNLOCK (playsink);
-}
-
-void
-gst_play_sink_set_vis_plugin (GstPlaySink * playsink, GstElement * vis)
-{
- GstPlayVisChain *chain;
-
- /* setting NULL means creating the default vis plugin */
- if (vis == NULL)
- vis = gst_element_factory_make ("goom", "vis");
-
- /* simply return if we don't have a vis plugin here */
- if (vis == NULL)
- return;
-
- GST_PLAY_SINK_LOCK (playsink);
- /* first store the new vis */
- if (playsink->visualisation)
- gst_object_unref (playsink->visualisation);
- /* take ownership */
- gst_object_ref_sink (vis);
- playsink->visualisation = vis;
-
- /* now try to change the plugin in the running vis chain, if we have no chain,
- * we don't bother, any future vis chain will be created with the new vis
- * plugin. */
- if (!(chain = (GstPlayVisChain *) playsink->vischain))
- goto done;
-
- /* block the pad, the next time the callback is called we can change the
- * visualisation. It's possible that this never happens or that the pad was
- * already blocked. If the callback never happens, we don't have new data so
- * we don't need the new vis plugin. If the pad was already blocked, the
- * function returns FALSE but the previous pad block will do the right thing
- * anyway. */
- GST_DEBUG_OBJECT (playsink, "blocking vis pad");
- gst_pad_set_blocked_async (chain->blockpad, TRUE, gst_play_sink_vis_blocked,
- playsink);
-done:
- GST_PLAY_SINK_UNLOCK (playsink);
-
- return;
-}
-
-GstElement *
-gst_play_sink_get_vis_plugin (GstPlaySink * playsink)
-{
- GstElement *result = NULL;
- GstPlayVisChain *chain;
-
- GST_PLAY_SINK_LOCK (playsink);
- if ((chain = (GstPlayVisChain *) playsink->vischain)) {
- /* we have an active chain, get the sink */
- if (chain->vis)
- result = gst_object_ref (chain->vis);
- }
- /* nothing found, return last configured sink */
- if (result == NULL && playsink->visualisation)
- result = gst_object_ref (playsink->visualisation);
- GST_PLAY_SINK_UNLOCK (playsink);
-
- return result;
-}
-
-void
-gst_play_sink_set_volume (GstPlaySink * playsink, gdouble volume)
-{
- GstPlayAudioChain *chain;
-
- GST_PLAY_SINK_LOCK (playsink);
- playsink->volume = volume;
- chain = (GstPlayAudioChain *) playsink->audiochain;
- if (chain && chain->volume) {
- GST_LOG_OBJECT (playsink, "elements: volume=%" GST_PTR_FORMAT ", mute=%"
- GST_PTR_FORMAT "; new volume=%.03f, mute=%d", chain->volume,
- chain->mute, volume, playsink->mute);
- /* if there is a mute element or we are not muted, set the volume */
- if (chain->mute || !playsink->mute)
- g_object_set (chain->volume, "volume", volume, NULL);
- } else {
- GST_LOG_OBJECT (playsink, "no volume element");
- playsink->volume_changed = TRUE;
- }
- GST_PLAY_SINK_UNLOCK (playsink);
-}
-
-gdouble
-gst_play_sink_get_volume (GstPlaySink * playsink)
-{
- gdouble result;
- GstPlayAudioChain *chain;
-
- GST_PLAY_SINK_LOCK (playsink);
- chain = (GstPlayAudioChain *) playsink->audiochain;
- result = playsink->volume;
- if (chain && chain->volume) {
- if (chain->mute || !playsink->mute) {
- g_object_get (chain->volume, "volume", &result, NULL);
- playsink->volume = result;
- }
- }
- GST_PLAY_SINK_UNLOCK (playsink);
-
- return result;
-}
-
-void
-gst_play_sink_set_mute (GstPlaySink * playsink, gboolean mute)
-{
- GstPlayAudioChain *chain;
-
- GST_PLAY_SINK_LOCK (playsink);
- playsink->mute = mute;
- chain = (GstPlayAudioChain *) playsink->audiochain;
- if (chain) {
- if (chain->mute) {
- g_object_set (chain->mute, "mute", mute, NULL);
- } else if (chain->volume) {
- if (mute)
- g_object_set (chain->volume, "volume", (gdouble) 0.0, NULL);
- else
- g_object_set (chain->volume, "volume", (gdouble) playsink->volume,
- NULL);
- }
- } else {
- playsink->mute_changed = TRUE;
- }
- GST_PLAY_SINK_UNLOCK (playsink);
-}
-
-gboolean
-gst_play_sink_get_mute (GstPlaySink * playsink)
-{
- gboolean result;
- GstPlayAudioChain *chain;
-
- GST_PLAY_SINK_LOCK (playsink);
- chain = (GstPlayAudioChain *) playsink->audiochain;
- if (chain && chain->mute) {
- g_object_get (chain->mute, "mute", &result, NULL);
- playsink->mute = result;
- } else {
- result = playsink->mute;
- }
- GST_PLAY_SINK_UNLOCK (playsink);
-
- return result;
-}
-
-static void
-post_missing_element_message (GstPlaySink * playsink, const gchar * name)
-{
- GstMessage *msg;
-
- msg = gst_missing_element_message_new (GST_ELEMENT_CAST (playsink), name);
- gst_element_post_message (GST_ELEMENT_CAST (playsink), msg);
-}
-
-static gboolean
-add_chain (GstPlayChain * chain, gboolean add)
-{
- if (chain->added == add)
- return TRUE;
-
- if (add)
- gst_bin_add (GST_BIN_CAST (chain->playsink), chain->bin);
- else {
- gst_bin_remove (GST_BIN_CAST (chain->playsink), chain->bin);
- /* we don't want to lose our sink status */
- GST_OBJECT_FLAG_SET (chain->playsink, GST_ELEMENT_IS_SINK);
- }
-
- chain->added = add;
-
- return TRUE;
-}
-
-static gboolean
-activate_chain (GstPlayChain * chain, gboolean activate)
-{
- GstState state;
-
- if (chain->activated == activate)
- return TRUE;
-
- GST_OBJECT_LOCK (chain->playsink);
- state = GST_STATE_TARGET (chain->playsink);
- GST_OBJECT_UNLOCK (chain->playsink);
-
- if (activate)
- gst_element_set_state (chain->bin, state);
- else
- gst_element_set_state (chain->bin, GST_STATE_NULL);
-
- chain->activated = activate;
-
- return TRUE;
-}
-
-static gboolean
-element_is_sink (GstElement * element)
-{
- gboolean is_sink;
-
- GST_OBJECT_LOCK (element);
- is_sink = GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_IS_SINK);
- GST_OBJECT_UNLOCK (element);
-
- GST_DEBUG_OBJECT (element, "is a sink: %s", (is_sink) ? "yes" : "no");
- return is_sink;
-}
-
-static gboolean
-element_has_property (GstElement * element, const gchar * pname, GType type)
-{
- GParamSpec *pspec;
-
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (element), pname);
-
- if (pspec == NULL) {
- GST_DEBUG_OBJECT (element, "no %s property", pname);
- return FALSE;
- }
-
- if (type == G_TYPE_INVALID || type == pspec->value_type ||
- g_type_is_a (pspec->value_type, type)) {
- GST_DEBUG_OBJECT (element, "has %s property of type %s", pname,
- (type == G_TYPE_INVALID) ? "any type" : g_type_name (type));
- return TRUE;
- }
-
- GST_WARNING_OBJECT (element, "has %s property, but property is of type %s "
- "and we expected it to be of type %s", pname,
- g_type_name (pspec->value_type), g_type_name (type));
-
- return FALSE;
-}
-
-typedef struct
-{
- const gchar *prop_name;
- GType prop_type;
- gboolean need_sink;
-} FindPropertyHelper;
-
-static gint
-find_property (GstElement * element, FindPropertyHelper * helper)
-{
- if (helper->need_sink && !element_is_sink (element)) {
- gst_object_unref (element);
- return 1;
- }
-
- if (!element_has_property (element, helper->prop_name, helper->prop_type)) {
- gst_object_unref (element);
- return 1;
- }
-
- GST_INFO_OBJECT (element, "found %s with %s property", helper->prop_name,
- (helper->need_sink) ? "sink" : "element");
- return 0; /* keep it */
-}
-
-/* FIXME: why not move these functions into core? */
-/* find a sink in the hierarchy with a property named @name. This function does
- * not increase the refcount of the returned object and thus remains valid as
- * long as the bin is valid. */
-static GstElement *
-gst_play_sink_find_property_sinks (GstPlaySink * playsink, GstElement * obj,
- const gchar * name, GType expected_type)
-{
- GstElement *result = NULL;
- GstIterator *it;
-
- if (element_has_property (obj, name, expected_type)) {
- result = obj;
- } else if (GST_IS_BIN (obj)) {
- FindPropertyHelper helper = { name, expected_type, TRUE };
-
- it = gst_bin_iterate_recurse (GST_BIN_CAST (obj));
- result = gst_iterator_find_custom (it,
- (GCompareFunc) find_property, &helper);
- gst_iterator_free (it);
- /* we don't need the extra ref */
- if (result)
- gst_object_unref (result);
- }
- return result;
-}
-
-/* find an object in the hierarchy with a property named @name */
-static GstElement *
-gst_play_sink_find_property (GstPlaySink * playsink, GstElement * obj,
- const gchar * name, GType expected_type)
-{
- GstElement *result = NULL;
- GstIterator *it;
-
- if (GST_IS_BIN (obj)) {
- FindPropertyHelper helper = { name, expected_type, FALSE };
-
- it = gst_bin_iterate_recurse (GST_BIN_CAST (obj));
- result = gst_iterator_find_custom (it,
- (GCompareFunc) find_property, &helper);
- gst_iterator_free (it);
- } else {
- if (element_has_property (obj, name, expected_type)) {
- result = obj;
- gst_object_ref (obj);
- }
- }
- return result;
-}
-
-static void
-do_async_start (GstPlaySink * playsink)
-{
- GstMessage *message;
-
- if (!playsink->need_async_start) {
- GST_INFO_OBJECT (playsink, "no async_start needed");
- return;
- }
-
- playsink->async_pending = TRUE;
-
- GST_INFO_OBJECT (playsink, "Sending async_start message");
- message = gst_message_new_async_start (GST_OBJECT_CAST (playsink), FALSE);
- GST_BIN_CLASS (gst_play_sink_parent_class)->handle_message (GST_BIN_CAST
- (playsink), message);
-}
-
-static void
-do_async_done (GstPlaySink * playsink)
-{
- GstMessage *message;
-
- if (playsink->async_pending) {
- GST_INFO_OBJECT (playsink, "Sending async_done message");
- message = gst_message_new_async_done (GST_OBJECT_CAST (playsink));
- GST_BIN_CLASS (gst_play_sink_parent_class)->handle_message (GST_BIN_CAST
- (playsink), message);
-
- playsink->async_pending = FALSE;
- }
-
- playsink->need_async_start = FALSE;
-}
-
-/* try to change the state of an element. This function returns the element when
- * the state change could be performed. When this function returns NULL an error
- * occured and the element is unreffed if @unref is TRUE. */
-static GstElement *
-try_element (GstPlaySink * playsink, GstElement * element, gboolean unref)
-{
- GstStateChangeReturn ret;
-
- if (element) {
- ret = gst_element_set_state (element, GST_STATE_READY);
- if (ret == GST_STATE_CHANGE_FAILURE) {
- GST_DEBUG_OBJECT (playsink, "failed state change..");
- gst_element_set_state (element, GST_STATE_NULL);
- if (unref)
- gst_object_unref (element);
- element = NULL;
- }
- }
- return element;
-}
-
-/* make the element (bin) that contains the elements needed to perform
- * video display.
- *
- * +------------------------------------------------------------+
- * | vbin |
- * | +-------+ +----------+ +----------+ +---------+ |
- * | | queue | |colorspace| |videoscale| |videosink| |
- * | +-sink src-sink src-sink src-sink | |
- * | | +-------+ +----------+ +----------+ +---------+ |
- * sink-+ |
- * +------------------------------------------------------------+
- *
- */
-static GstPlayVideoChain *
-gen_video_chain (GstPlaySink * playsink, gboolean raw, gboolean async,
- gboolean queue)
-{
- GstPlayVideoChain *chain;
- GstBin *bin;
- GstPad *pad;
- GstElement *head = NULL, *prev = NULL, *elem = NULL;
-
- chain = g_new0 (GstPlayVideoChain, 1);
- chain->chain.playsink = playsink;
- chain->chain.raw = raw;
-
- GST_DEBUG_OBJECT (playsink, "making video chain %p", chain);
-
- if (playsink->video_sink) {
- GST_DEBUG_OBJECT (playsink, "trying configured videosink");
- chain->sink = try_element (playsink, playsink->video_sink, FALSE);
- } else {
- /* only try fallback if no specific sink was chosen */
- if (chain->sink == NULL) {
- GST_DEBUG_OBJECT (playsink, "trying autovideosink");
- elem = gst_element_factory_make ("autovideosink", "videosink");
- chain->sink = try_element (playsink, elem, TRUE);
- }
- if (chain->sink == NULL) {
- /* if default sink from config.h is different then try it too */
- if (strcmp (DEFAULT_VIDEOSINK, "autovideosink")) {
- GST_DEBUG_OBJECT (playsink, "trying " DEFAULT_VIDEOSINK);
- elem = gst_element_factory_make (DEFAULT_VIDEOSINK, "videosink");
- chain->sink = try_element (playsink, elem, TRUE);
- }
- }
- }
- if (chain->sink == NULL)
- goto no_sinks;
- head = chain->sink;
-
- /* if we can disable async behaviour of the sink, we can avoid adding a
- * queue for the audio chain. */
- elem =
- gst_play_sink_find_property_sinks (playsink, chain->sink, "async",
- G_TYPE_BOOLEAN);
- if (elem) {
- GST_DEBUG_OBJECT (playsink, "setting async property to %d on element %s",
- async, GST_ELEMENT_NAME (elem));
- g_object_set (elem, "async", async, NULL);
- chain->async = async;
- } else {
- GST_DEBUG_OBJECT (playsink, "no async property on the sink");
- chain->async = TRUE;
- }
-
- /* create a bin to hold objects, as we create them we add them to this bin so
- * that when something goes wrong we only need to unref the bin */
- chain->chain.bin = gst_bin_new ("vbin");
- bin = GST_BIN_CAST (chain->chain.bin);
- gst_object_ref_sink (bin);
- gst_bin_add (bin, chain->sink);
-
- if (queue) {
- /* decouple decoder from sink, this improves playback quite a lot since the
- * decoder can continue while the sink blocks for synchronisation. We don't
- * need a lot of buffers as this consumes a lot of memory and we don't want
- * too little because else we would be context switching too quickly. */
- chain->queue = gst_element_factory_make ("queue", "vqueue");
- if (chain->queue == NULL) {
- post_missing_element_message (playsink, "queue");
- GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "queue"), ("video rendering might be suboptimal"));
- head = chain->sink;
- prev = NULL;
- } else {
- g_object_set (G_OBJECT (chain->queue), "max-size-buffers", 3,
- "max-size-bytes", 0, "max-size-time", (gint64) 0, NULL);
- gst_bin_add (bin, chain->queue);
- head = prev = chain->queue;
- }
- } else {
- head = chain->sink;
- prev = NULL;
- }
-
- if (raw && !(playsink->flags & GST_PLAY_FLAG_NATIVE_VIDEO)) {
- GST_DEBUG_OBJECT (playsink, "creating ffmpegcolorspace");
- chain->conv = gst_element_factory_make ("ffmpegcolorspace", "vconv");
- if (chain->conv == NULL) {
- post_missing_element_message (playsink, "ffmpegcolorspace");
- GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "ffmpegcolorspace"), ("video rendering might fail"));
- } else {
- gst_bin_add (bin, chain->conv);
- if (prev) {
- if (!gst_element_link_pads (prev, "src", chain->conv, "sink"))
- goto link_failed;
- } else {
- head = chain->conv;
- }
- prev = chain->conv;
- }
-
- GST_DEBUG_OBJECT (playsink, "creating videoscale");
- chain->scale = gst_element_factory_make ("videoscale", "vscale");
- if (chain->scale == NULL) {
- post_missing_element_message (playsink, "videoscale");
- GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "videoscale"), ("possibly a liboil version mismatch?"));
- } else {
- gst_bin_add (bin, chain->scale);
- if (prev) {
- if (!gst_element_link_pads (prev, "src", chain->scale, "sink"))
- goto link_failed;
- } else {
- head = chain->scale;
- }
- prev = chain->scale;
- }
- }
-
- if (prev) {
- GST_DEBUG_OBJECT (playsink, "linking to sink");
- if (!gst_element_link_pads (prev, "src", chain->sink, NULL))
- goto link_failed;
- }
-
- pad = gst_element_get_static_pad (head, "sink");
- chain->sinkpad = gst_ghost_pad_new ("sink", pad);
- gst_object_unref (pad);
-
- gst_element_add_pad (chain->chain.bin, chain->sinkpad);
-
- return chain;
-
- /* ERRORS */
-no_sinks:
- {
- if (!elem) {
- post_missing_element_message (playsink, "autovideosink");
- if (strcmp (DEFAULT_VIDEOSINK, "autovideosink")) {
- post_missing_element_message (playsink, DEFAULT_VIDEOSINK);
- GST_ELEMENT_ERROR (playsink, CORE, MISSING_PLUGIN,
- (_("Both autovideosink and %s elements are missing."),
- DEFAULT_VIDEOSINK), (NULL));
- } else {
- GST_ELEMENT_ERROR (playsink, CORE, MISSING_PLUGIN,
- (_("The autovideosink element is missing.")), (NULL));
- }
- } else {
- if (strcmp (DEFAULT_VIDEOSINK, "autovideosink")) {
- GST_ELEMENT_ERROR (playsink, CORE, STATE_CHANGE,
- (_("Both autovideosink and %s elements are not working."),
- DEFAULT_VIDEOSINK), (NULL));
- } else {
- GST_ELEMENT_ERROR (playsink, CORE, MISSING_PLUGIN,
- (_("The autovideosink element is not working.")), (NULL));
- }
- }
- free_chain ((GstPlayChain *) chain);
- return NULL;
- }
-link_failed:
- {
- GST_ELEMENT_ERROR (playsink, CORE, PAD,
- (NULL), ("Failed to configure the video sink."));
- free_chain ((GstPlayChain *) chain);
- return NULL;
- }
-}
-
-static gboolean
-setup_video_chain (GstPlaySink * playsink, gboolean raw, gboolean async,
- gboolean queue)
-{
- GstElement *elem;
- GstPlayVideoChain *chain;
- GstStateChangeReturn ret;
-
- chain = playsink->videochain;
-
- /* if the chain was active we don't do anything */
- if (GST_PLAY_CHAIN (chain)->activated == TRUE)
- return TRUE;
-
- if (chain->chain.raw != raw)
- return FALSE;
-
- /* try to set the sink element to READY again */
- ret = gst_element_set_state (chain->sink, GST_STATE_READY);
- if (ret == GST_STATE_CHANGE_FAILURE)
- return FALSE;
-
- /* if we can disable async behaviour of the sink, we can avoid adding a
- * queue for the audio chain. */
- elem =
- gst_play_sink_find_property_sinks (playsink, chain->sink, "async",
- G_TYPE_BOOLEAN);
- if (elem) {
- GST_DEBUG_OBJECT (playsink, "setting async property to %d on element %s",
- async, GST_ELEMENT_NAME (elem));
- g_object_set (elem, "async", async, NULL);
- chain->async = async;
- } else {
- GST_DEBUG_OBJECT (playsink, "no async property on the sink");
- chain->async = TRUE;
- }
- return TRUE;
-}
-
-/* make an element for playback of video with subtitles embedded.
- *
- * +--------------------------------------------+
- * | tbin |
- * | +--------+ +-----------------+ |
- * | | queue | | subtitleoverlay | |
- * video--src sink---video_sink | |
- * | +--------+ | src--src
- * text------------------text_sink | |
- * | +-----------------+ |
- * +--------------------------------------------+
- *
- */
-static GstPlayTextChain *
-gen_text_chain (GstPlaySink * playsink)
-{
- GstPlayTextChain *chain;
- GstBin *bin;
- GstElement *elem;
- GstPad *videosinkpad, *textsinkpad, *srcpad;
-
- chain = g_new0 (GstPlayTextChain, 1);
- chain->chain.playsink = playsink;
-
- GST_DEBUG_OBJECT (playsink, "making text chain %p", chain);
-
- chain->chain.bin = gst_bin_new ("tbin");
- bin = GST_BIN_CAST (chain->chain.bin);
- gst_object_ref_sink (bin);
-
- videosinkpad = textsinkpad = srcpad = NULL;
-
- /* first try to hook the text pad to the custom sink */
- if (playsink->text_sink) {
- GST_DEBUG_OBJECT (playsink, "trying configured textsink");
- chain->sink = try_element (playsink, playsink->text_sink, FALSE);
- if (chain->sink) {
- elem =
- gst_play_sink_find_property_sinks (playsink, chain->sink, "async",
- G_TYPE_BOOLEAN);
- if (elem) {
- /* make sure the sparse subtitles don't participate in the preroll */
- g_object_set (elem, "async", FALSE, NULL);
- /* we have a custom sink, this will be our textsinkpad */
- textsinkpad = gst_element_get_static_pad (chain->sink, "sink");
- if (textsinkpad) {
- /* we're all fine now and we can add the sink to the chain */
- GST_DEBUG_OBJECT (playsink, "adding custom text sink");
- gst_bin_add (bin, chain->sink);
- } else {
- GST_WARNING_OBJECT (playsink,
- "can't find a sink pad on custom text sink");
- gst_object_unref (chain->sink);
- chain->sink = NULL;
- }
- /* try to set sync to true but it's no biggie when we can't */
- if ((elem =
- gst_play_sink_find_property_sinks (playsink, chain->sink,
- "sync", G_TYPE_BOOLEAN)))
- g_object_set (elem, "sync", TRUE, NULL);
- } else {
- GST_WARNING_OBJECT (playsink,
- "can't find async property in custom text sink");
- }
- }
- if (textsinkpad == NULL) {
- GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN,
- (_("Custom text sink element is not usable.")),
- ("fallback to default textoverlay"));
- }
- }
-
- if (textsinkpad == NULL) {
- if (!(playsink->flags & GST_PLAY_FLAG_NATIVE_VIDEO)) {
- /* make a little queue */
- chain->queue = gst_element_factory_make ("queue", "vqueue");
- if (chain->queue == NULL) {
- post_missing_element_message (playsink, "queue");
- GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "queue"), ("video rendering might be suboptimal"));
- } else {
- g_object_set (G_OBJECT (chain->queue), "max-size-buffers", 3,
- "max-size-bytes", 0, "max-size-time", (gint64) 0, NULL);
- gst_bin_add (bin, chain->queue);
- videosinkpad = gst_element_get_static_pad (chain->queue, "sink");
- }
-
- chain->overlay =
- gst_element_factory_make ("subtitleoverlay", "suboverlay");
- if (chain->overlay == NULL) {
- post_missing_element_message (playsink, "subtitleoverlay");
- GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "subtitleoverlay"), ("subtitle rendering disabled"));
- } else {
- gst_bin_add (bin, chain->overlay);
-
- g_object_set (G_OBJECT (chain->overlay), "silent", FALSE, NULL);
- if (playsink->font_desc) {
- g_object_set (G_OBJECT (chain->overlay), "font-desc",
- playsink->font_desc, NULL);
- }
- if (playsink->subtitle_encoding) {
- g_object_set (G_OBJECT (chain->overlay), "subtitle-encoding",
- playsink->subtitle_encoding, NULL);
- }
-
- gst_element_link_pads (chain->queue, "src", chain->overlay,
- "video_sink");
-
- textsinkpad =
- gst_element_get_static_pad (chain->overlay, "subtitle_sink");
- srcpad = gst_element_get_static_pad (chain->overlay, "src");
- }
- }
- }
-
- if (videosinkpad == NULL) {
- /* if we still don't have a videosink, we don't have an overlay. the only
- * thing we can do is insert an identity and ghost the src
- * and sink pads. */
- chain->identity = gst_element_factory_make ("identity", "tidentity");
- if (chain->identity == NULL) {
- post_missing_element_message (playsink, "identity");
- GST_ELEMENT_ERROR (playsink, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "identity"), (NULL));
- } else {
- g_object_set (chain->identity, "signal-handoffs", FALSE, NULL);
- g_object_set (chain->identity, "silent", TRUE, NULL);
- gst_bin_add (bin, chain->identity);
- srcpad = gst_element_get_static_pad (chain->identity, "src");
- videosinkpad = gst_element_get_static_pad (chain->identity, "sink");
- }
- }
-
- /* expose the ghostpads */
- if (videosinkpad) {
- chain->videosinkpad = gst_ghost_pad_new ("sink", videosinkpad);
- gst_object_unref (videosinkpad);
- gst_element_add_pad (chain->chain.bin, chain->videosinkpad);
- }
- if (textsinkpad) {
- chain->textsinkpad = gst_ghost_pad_new ("text_sink", textsinkpad);
- gst_object_unref (textsinkpad);
- gst_element_add_pad (chain->chain.bin, chain->textsinkpad);
- }
- if (srcpad) {
- chain->srcpad = gst_ghost_pad_new ("src", srcpad);
- gst_object_unref (srcpad);
- gst_element_add_pad (chain->chain.bin, chain->srcpad);
- }
-
- return chain;
-}
-
-static void
-notify_volume_cb (GObject * object, GParamSpec * pspec, GstPlaySink * playsink)
-{
- gdouble vol;
-
- g_object_get (object, "volume", &vol, NULL);
- playsink->volume = vol;
-
- g_object_notify (G_OBJECT (playsink), "volume");
-}
-
-static void
-notify_mute_cb (GObject * object, GParamSpec * pspec, GstPlaySink * playsink)
-{
- gboolean mute;
-
- g_object_get (object, "mute", &mute, NULL);
- playsink->mute = mute;
-
- g_object_notify (G_OBJECT (playsink), "mute");
-}
-
-/* make the chain that contains the elements needed to perform
- * audio playback.
- *
- * We add a tee as the first element so that we can link the visualisation chain
- * to it when requested.
- *
- * +-------------------------------------------------------------+
- * | abin |
- * | +---------+ +----------+ +---------+ +---------+ |
- * | |audioconv| |audioscale| | volume | |audiosink| |
- * | +-srck src-sink src-sink src-sink | |
- * | | +---------+ +----------+ +---------+ +---------+ |
- * sink-+ |
- * +-------------------------------------------------------------+
- */
-static GstPlayAudioChain *
-gen_audio_chain (GstPlaySink * playsink, gboolean raw, gboolean queue)
-{
- GstPlayAudioChain *chain;
- GstBin *bin;
- gboolean have_volume;
- GstPad *pad;
- GstElement *head, *prev, *elem = NULL;
-
- chain = g_new0 (GstPlayAudioChain, 1);
- chain->chain.playsink = playsink;
- chain->chain.raw = raw;
-
- GST_DEBUG_OBJECT (playsink, "making audio chain %p", chain);
-
- if (playsink->audio_sink) {
- GST_DEBUG_OBJECT (playsink, "trying configured audiosink %" GST_PTR_FORMAT,
- playsink->audio_sink);
- chain->sink = try_element (playsink, playsink->audio_sink, FALSE);
- } else {
- /* only try fallback if no specific sink was chosen */
- if (chain->sink == NULL) {
- GST_DEBUG_OBJECT (playsink, "trying autoaudiosink");
- elem = gst_element_factory_make ("autoaudiosink", "audiosink");
- chain->sink = try_element (playsink, elem, TRUE);
- }
- if (chain->sink == NULL) {
- /* if default sink from config.h is different then try it too */
- if (strcmp (DEFAULT_AUDIOSINK, "autoaudiosink")) {
- GST_DEBUG_OBJECT (playsink, "trying " DEFAULT_AUDIOSINK);
- elem = gst_element_factory_make (DEFAULT_AUDIOSINK, "audiosink");
- chain->sink = try_element (playsink, elem, TRUE);
- }
- }
- }
- if (chain->sink == NULL)
- goto no_sinks;
-
- chain->chain.bin = gst_bin_new ("abin");
- bin = GST_BIN_CAST (chain->chain.bin);
- gst_object_ref_sink (bin);
- gst_bin_add (bin, chain->sink);
-
- if (queue) {
- /* we have to add a queue when we need to decouple for the video sink in
- * visualisations */
- GST_DEBUG_OBJECT (playsink, "adding audio queue");
- chain->queue = gst_element_factory_make ("queue", "aqueue");
- if (chain->queue == NULL) {
- post_missing_element_message (playsink, "queue");
- GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "queue"), ("audio playback and visualizations might not work"));
- head = chain->sink;
- prev = NULL;
- } else {
- gst_bin_add (bin, chain->queue);
- prev = head = chain->queue;
- }
- } else {
- head = chain->sink;
- prev = NULL;
- }
-
- /* check if the sink, or something within the sink, has the volume property.
- * If it does we don't need to add a volume element. */
- elem =
- gst_play_sink_find_property_sinks (playsink, chain->sink, "volume",
- G_TYPE_DOUBLE);
- if (elem) {
- chain->volume = elem;
-
- g_signal_connect (chain->volume, "notify::volume",
- G_CALLBACK (notify_volume_cb), playsink);
-
- GST_DEBUG_OBJECT (playsink, "the sink has a volume property");
- have_volume = TRUE;
- chain->sink_volume = TRUE;
- /* if the sink also has a mute property we can use this as well. We'll only
- * use the mute property if there is a volume property. We can simulate the
- * mute with the volume otherwise. */
- chain->mute =
- gst_play_sink_find_property_sinks (playsink, chain->sink, "mute",
- G_TYPE_BOOLEAN);
- if (chain->mute) {
- GST_DEBUG_OBJECT (playsink, "the sink has a mute property");
- g_signal_connect (chain->mute, "notify::mute",
- G_CALLBACK (notify_mute_cb), playsink);
- }
- /* use the sink to control the volume and mute */
- if (playsink->volume_changed) {
- g_object_set (G_OBJECT (chain->volume), "volume", playsink->volume, NULL);
- playsink->volume_changed = FALSE;
- }
- if (playsink->mute_changed) {
- if (chain->mute) {
- g_object_set (chain->mute, "mute", playsink->mute, NULL);
- } else {
- if (playsink->mute)
- g_object_set (chain->volume, "volume", (gdouble) 0.0, NULL);
- }
- playsink->mute_changed = FALSE;
- }
- } else {
- /* no volume, we need to add a volume element when we can */
- GST_DEBUG_OBJECT (playsink, "the sink has no volume property");
- have_volume = FALSE;
- chain->sink_volume = FALSE;
- }
-
- if (raw && !(playsink->flags & GST_PLAY_FLAG_NATIVE_AUDIO)) {
- GST_DEBUG_OBJECT (playsink, "creating audioconvert");
- chain->conv = gst_element_factory_make ("audioconvert", "aconv");
- if (chain->conv == NULL) {
- post_missing_element_message (playsink, "audioconvert");
- GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "audioconvert"), ("possibly a liboil version mismatch?"));
- } else {
- gst_bin_add (bin, chain->conv);
- if (prev) {
- if (!gst_element_link_pads (prev, "src", chain->conv, "sink"))
- goto link_failed;
- } else {
- head = chain->conv;
- }
- prev = chain->conv;
- }
-
- GST_DEBUG_OBJECT (playsink, "creating audioresample");
- chain->resample = gst_element_factory_make ("audioresample", "aresample");
- if (chain->resample == NULL) {
- post_missing_element_message (playsink, "audioresample");
- GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "audioresample"), ("possibly a liboil version mismatch?"));
- } else {
- gst_bin_add (bin, chain->resample);
- if (prev) {
- if (!gst_element_link_pads (prev, "src", chain->resample, "sink"))
- goto link_failed;
- } else {
- head = chain->resample;
- }
- prev = chain->resample;
- }
-
- if (!have_volume && playsink->flags & GST_PLAY_FLAG_SOFT_VOLUME) {
- GST_DEBUG_OBJECT (playsink, "creating volume");
- chain->volume = gst_element_factory_make ("volume", "volume");
- if (chain->volume == NULL) {
- post_missing_element_message (playsink, "volume");
- GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "volume"), ("possibly a liboil version mismatch?"));
- } else {
- have_volume = TRUE;
-
- g_signal_connect (chain->volume, "notify::volume",
- G_CALLBACK (notify_volume_cb), playsink);
-
- /* volume also has the mute property */
- chain->mute = chain->volume;
- g_signal_connect (chain->mute, "notify::mute",
- G_CALLBACK (notify_mute_cb), playsink);
-
- /* configure with the latest volume and mute */
- g_object_set (G_OBJECT (chain->volume), "volume", playsink->volume,
- NULL);
- g_object_set (G_OBJECT (chain->mute), "mute", playsink->mute, NULL);
- gst_bin_add (bin, chain->volume);
-
- if (prev) {
- if (!gst_element_link_pads (prev, "src", chain->volume, "sink"))
- goto link_failed;
- } else {
- head = chain->volume;
- }
- prev = chain->volume;
- }
- }
- }
-
- if (prev) {
- /* we only have to link to the previous element if we have something in
- * front of the sink */
- GST_DEBUG_OBJECT (playsink, "linking to sink");
- if (!gst_element_link_pads (prev, "src", chain->sink, NULL))
- goto link_failed;
- }
-
- /* post a warning if we have no way to configure the volume */
- if (!have_volume) {
- GST_ELEMENT_WARNING (playsink, STREAM, NOT_IMPLEMENTED,
- (_("No volume control found")), ("Volume/mute is not available"));
- }
-
- /* and ghost the sinkpad of the headmost element */
- GST_DEBUG_OBJECT (playsink, "ghosting sink pad");
- pad = gst_element_get_static_pad (head, "sink");
- chain->sinkpad = gst_ghost_pad_new ("sink", pad);
- gst_object_unref (pad);
- gst_element_add_pad (chain->chain.bin, chain->sinkpad);
-
- return chain;
-
- /* ERRORS */
-no_sinks:
- {
- if (!elem) {
- post_missing_element_message (playsink, "autoaudiosink");
- if (strcmp (DEFAULT_AUDIOSINK, "autoaudiosink")) {
- post_missing_element_message (playsink, DEFAULT_AUDIOSINK);
- GST_ELEMENT_ERROR (playsink, CORE, MISSING_PLUGIN,
- (_("Both autoaudiosink and %s elements are missing."),
- DEFAULT_AUDIOSINK), (NULL));
- } else {
- GST_ELEMENT_ERROR (playsink, CORE, MISSING_PLUGIN,
- (_("The autoaudiosink element is missing.")), (NULL));
- }
- } else {
- if (strcmp (DEFAULT_AUDIOSINK, "autoaudiosink")) {
- GST_ELEMENT_ERROR (playsink, CORE, STATE_CHANGE,
- (_("Both autoaudiosink and %s elements are not working."),
- DEFAULT_AUDIOSINK), (NULL));
- } else {
- GST_ELEMENT_ERROR (playsink, CORE, MISSING_PLUGIN,
- (_("The autoaudiosink element is not working.")), (NULL));
- }
- }
- free_chain ((GstPlayChain *) chain);
- return NULL;
- }
-link_failed:
- {
- GST_ELEMENT_ERROR (playsink, CORE, PAD,
- (NULL), ("Failed to configure the audio sink."));
- free_chain ((GstPlayChain *) chain);
- return NULL;
- }
-}
-
-static gboolean
-setup_audio_chain (GstPlaySink * playsink, gboolean raw, gboolean queue)
-{
- GstElement *elem;
- GstPlayAudioChain *chain;
- GstStateChangeReturn ret;
-
- chain = playsink->audiochain;
-
- /* if the chain was active we don't do anything */
- if (GST_PLAY_CHAIN (chain)->activated == TRUE)
- return TRUE;
-
- if (chain->chain.raw != raw)
- return FALSE;
-
- /* try to set the sink element to READY again */
- ret = gst_element_set_state (chain->sink, GST_STATE_READY);
- if (ret == GST_STATE_CHANGE_FAILURE)
- return FALSE;
-
- /* check if the sink, or something within the sink, has the volume property.
- * If it does we don't need to add a volume element. */
- elem =
- gst_play_sink_find_property_sinks (playsink, chain->sink, "volume",
- G_TYPE_DOUBLE);
- if (elem) {
- chain->volume = elem;
-
- if (playsink->volume_changed) {
- GST_DEBUG_OBJECT (playsink, "the sink has a volume property, setting %f",
- playsink->volume);
- /* use the sink to control the volume */
- g_object_set (G_OBJECT (chain->volume), "volume", playsink->volume, NULL);
- playsink->volume_changed = FALSE;
- }
-
- g_signal_connect (chain->volume, "notify::volume",
- G_CALLBACK (notify_volume_cb), playsink);
- /* if the sink also has a mute property we can use this as well. We'll only
- * use the mute property if there is a volume property. We can simulate the
- * mute with the volume otherwise. */
- chain->mute =
- gst_play_sink_find_property_sinks (playsink, chain->sink, "mute",
- G_TYPE_BOOLEAN);
- if (chain->mute) {
- GST_DEBUG_OBJECT (playsink, "the sink has a mute property");
- g_signal_connect (chain->mute, "notify::mute",
- G_CALLBACK (notify_mute_cb), playsink);
- }
- } else {
- /* no volume, we need to add a volume element when we can */
- GST_DEBUG_OBJECT (playsink, "the sink has no volume property");
- if (!raw) {
- GST_LOG_OBJECT (playsink, "non-raw format, can't do soft volume control");
-
- if (chain->volume)
- g_signal_handlers_disconnect_by_func (chain->volume, notify_volume_cb,
- playsink);
- if (chain->mute)
- g_signal_handlers_disconnect_by_func (chain->mute, notify_mute_cb,
- playsink);
-
- chain->volume = NULL;
- chain->mute = NULL;
- } else {
- /* both last and current chain are raw audio, there should be a volume
- * element already, unless the sink changed from one with a volume
- * property to one that hasn't got a volume property, in which case we
- * re-generate the chain */
- if (chain->volume == NULL) {
- GST_DEBUG_OBJECT (playsink, "no existing volume element to re-use");
- return FALSE;
- }
-
- GST_DEBUG_OBJECT (playsink, "reusing existing volume element");
- }
- }
- return TRUE;
-}
-
-/*
- * +-------------------------------------------------------------------+
- * | visbin |
- * | +----------+ +------------+ +----------+ +-------+ |
- * | | visqueue | | audioconv | | audiores | | vis | |
- * | +-sink src-sink + samp src-sink src-sink src-+ |
- * | | +----------+ +------------+ +----------+ +-------+ | |
- * sink-+ +-src
- * +-------------------------------------------------------------------+
- *
- */
-static GstPlayVisChain *
-gen_vis_chain (GstPlaySink * playsink)
-{
- GstPlayVisChain *chain;
- GstBin *bin;
- gboolean res;
- GstPad *pad;
- GstElement *elem;
-
- chain = g_new0 (GstPlayVisChain, 1);
- chain->chain.playsink = playsink;
-
- GST_DEBUG_OBJECT (playsink, "making vis chain %p", chain);
-
- chain->chain.bin = gst_bin_new ("visbin");
- bin = GST_BIN_CAST (chain->chain.bin);
- gst_object_ref_sink (bin);
-
- /* we're queuing raw audio here, we can remove this queue when we can disable
- * async behaviour in the video sink. */
- chain->queue = gst_element_factory_make ("queue", "visqueue");
- if (chain->queue == NULL)
- goto no_queue;
- gst_bin_add (bin, chain->queue);
-
- chain->conv = gst_element_factory_make ("audioconvert", "aconv");
- if (chain->conv == NULL)
- goto no_audioconvert;
- gst_bin_add (bin, chain->conv);
-
- chain->resample = gst_element_factory_make ("audioresample", "aresample");
- if (chain->resample == NULL)
- goto no_audioresample;
- gst_bin_add (bin, chain->resample);
-
- /* this pad will be used for blocking the dataflow and switching the vis
- * plugin */
- chain->blockpad = gst_element_get_static_pad (chain->resample, "src");
-
- if (playsink->visualisation) {
- GST_DEBUG_OBJECT (playsink, "trying configure vis");
- chain->vis = try_element (playsink, playsink->visualisation, FALSE);
- }
- if (chain->vis == NULL) {
- GST_DEBUG_OBJECT (playsink, "trying goom");
- elem = gst_element_factory_make ("goom", "vis");
- chain->vis = try_element (playsink, elem, TRUE);
- }
- if (chain->vis == NULL)
- goto no_goom;
-
- gst_bin_add (bin, chain->vis);
-
- res = gst_element_link_pads (chain->queue, "src", chain->conv, "sink");
- res &= gst_element_link_pads (chain->conv, "src", chain->resample, "sink");
- res &= gst_element_link_pads (chain->resample, "src", chain->vis, "sink");
- if (!res)
- goto link_failed;
-
- chain->vissinkpad = gst_element_get_static_pad (chain->vis, "sink");
- chain->vissrcpad = gst_element_get_static_pad (chain->vis, "src");
-
- pad = gst_element_get_static_pad (chain->queue, "sink");
- chain->sinkpad = gst_ghost_pad_new ("sink", pad);
- gst_object_unref (pad);
- gst_element_add_pad (chain->chain.bin, chain->sinkpad);
-
- chain->srcpad = gst_ghost_pad_new ("src", chain->vissrcpad);
- gst_element_add_pad (chain->chain.bin, chain->srcpad);
-
- return chain;
-
- /* ERRORS */
-no_queue:
- {
- post_missing_element_message (playsink, "queue");
- GST_ELEMENT_ERROR (playsink, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "queue"), (NULL));
- free_chain ((GstPlayChain *) chain);
- return NULL;
- }
-no_audioconvert:
- {
- post_missing_element_message (playsink, "audioconvert");
- GST_ELEMENT_ERROR (playsink, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "audioconvert"), ("possibly a liboil version mismatch?"));
- free_chain ((GstPlayChain *) chain);
- return NULL;
- }
-no_audioresample:
- {
- post_missing_element_message (playsink, "audioresample");
- GST_ELEMENT_ERROR (playsink, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "audioresample"), (NULL));
- free_chain ((GstPlayChain *) chain);
- return NULL;
- }
-no_goom:
- {
- post_missing_element_message (playsink, "goom");
- GST_ELEMENT_ERROR (playsink, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "goom"), (NULL));
- free_chain ((GstPlayChain *) chain);
- return NULL;
- }
-link_failed:
- {
- GST_ELEMENT_ERROR (playsink, CORE, PAD,
- (NULL), ("Failed to configure the visualisation element."));
- free_chain ((GstPlayChain *) chain);
- return NULL;
- }
-}
-
-/* this function is called when all the request pads are requested and when we
- * have to construct the final pipeline. Based on the flags we construct the
- * final output pipelines.
- */
-gboolean
-gst_play_sink_reconfigure (GstPlaySink * playsink)
-{
- GstPlayFlags flags;
- gboolean need_audio, need_video, need_vis, need_text;
-
- GST_DEBUG_OBJECT (playsink, "reconfiguring");
-
- /* assume we need nothing */
- need_audio = need_video = need_vis = need_text = FALSE;
-
- GST_PLAY_SINK_LOCK (playsink);
- GST_OBJECT_LOCK (playsink);
- /* get flags, there are protected with the object lock */
- flags = playsink->flags;
- GST_OBJECT_UNLOCK (playsink);
-
- /* figure out which components we need */
- if (flags & GST_PLAY_FLAG_TEXT && playsink->text_pad) {
- /* we have a text_pad and we need text rendering, in this case we need a
- * video_pad to combine the video with the text */
- if (!playsink->video_pad)
- goto subs_but_no_video;
-
- /* we have subtitles and we are requested to show it, we also need to show
- * video in this case. */
- need_video = TRUE;
- need_text = TRUE;
- } else if (((flags & GST_PLAY_FLAG_VIDEO)
- || (flags & GST_PLAY_FLAG_NATIVE_VIDEO)) && playsink->video_pad) {
- /* we have video and we are requested to show it */
- need_video = TRUE;
- }
- if (playsink->audio_pad) {
- if ((flags & GST_PLAY_FLAG_AUDIO) || (flags & GST_PLAY_FLAG_NATIVE_AUDIO)) {
- need_audio = TRUE;
- }
- if (playsink->audio_pad_raw) {
- /* only can do vis with raw uncompressed audio */
- if (flags & GST_PLAY_FLAG_VIS && !need_video) {
- /* also add video when we add visualisation */
- need_video = TRUE;
- need_vis = TRUE;
- }
- }
- }
- GST_DEBUG_OBJECT (playsink, "audio:%d, video:%d, vis:%d, text:%d", need_audio,
- need_video, need_vis, need_text);
-
- /* set up video pipeline */
- if (need_video) {
- gboolean raw, async, queue;
-
- /* we need a raw sink when we do vis or when we have a raw pad */
- raw = need_vis ? TRUE : playsink->video_pad_raw;
- /* we try to set the sink async=FALSE when we need vis, this way we can
- * avoid a queue in the audio chain. */
- async = !need_vis;
-
- /* If subtitles are requested there already is a queue in the video chain */
- queue = (need_text == FALSE);
-
- GST_DEBUG_OBJECT (playsink, "adding video, raw %d",
- playsink->video_pad_raw);
-
- if (playsink->videochain) {
- /* try to reactivate the chain */
- if (!setup_video_chain (playsink, raw, async, queue)) {
- add_chain (GST_PLAY_CHAIN (playsink->videochain), FALSE);
- activate_chain (GST_PLAY_CHAIN (playsink->videochain), FALSE);
- free_chain ((GstPlayChain *) playsink->videochain);
- playsink->videochain = NULL;
- }
- }
-
- if (!playsink->videochain) {
- playsink->videochain = gen_video_chain (playsink, raw, async, queue);
- }
- if (playsink->videochain) {
- GST_DEBUG_OBJECT (playsink, "adding video chain");
- add_chain (GST_PLAY_CHAIN (playsink->videochain), TRUE);
- activate_chain (GST_PLAY_CHAIN (playsink->videochain), TRUE);
- /* if we are not part of vis or subtitles, set the ghostpad target */
- if (!need_vis && !need_text && !playsink->textchain) {
- GST_DEBUG_OBJECT (playsink, "ghosting video sinkpad");
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (playsink->video_pad),
- playsink->videochain->sinkpad);
- }
- }
- } else {
- GST_DEBUG_OBJECT (playsink, "no video needed");
- if (playsink->videochain) {
- GST_DEBUG_OBJECT (playsink, "removing video chain");
- if (playsink->vischain) {
- GstPad *srcpad;
-
- GST_DEBUG_OBJECT (playsink, "unlinking vis chain");
-
- /* also had visualisation, release the tee srcpad before we then
- * unlink the video from it */
- if (playsink->audio_tee_vissrc) {
- gst_element_release_request_pad (playsink->audio_tee,
- playsink->audio_tee_vissrc);
- gst_object_unref (playsink->audio_tee_vissrc);
- playsink->audio_tee_vissrc = NULL;
- }
- srcpad =
- gst_element_get_static_pad (playsink->vischain->chain.bin, "src");
- gst_pad_unlink (srcpad, playsink->videochain->sinkpad);
- }
- add_chain (GST_PLAY_CHAIN (playsink->videochain), FALSE);
- activate_chain (GST_PLAY_CHAIN (playsink->videochain), FALSE);
- }
- if (playsink->video_pad)
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (playsink->video_pad), NULL);
- }
-
- if (need_text) {
- GST_DEBUG_OBJECT (playsink, "adding text");
- if (!playsink->textchain) {
- GST_DEBUG_OBJECT (playsink, "creating text chain");
- playsink->textchain = gen_text_chain (playsink);
- }
- if (playsink->textchain) {
- GST_DEBUG_OBJECT (playsink, "adding text chain");
- g_object_set (G_OBJECT (playsink->textchain->overlay), "silent", FALSE,
- NULL);
- add_chain (GST_PLAY_CHAIN (playsink->textchain), TRUE);
-
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (playsink->text_pad),
- playsink->textchain->textsinkpad);
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (playsink->video_pad),
- playsink->textchain->videosinkpad);
- gst_pad_link (playsink->textchain->srcpad, playsink->videochain->sinkpad);
-
- activate_chain (GST_PLAY_CHAIN (playsink->textchain), TRUE);
- }
- } else {
- GST_DEBUG_OBJECT (playsink, "no text needed");
- /* we have no subtitles/text or we are requested to not show them */
- if (playsink->textchain) {
- if (playsink->text_pad == NULL) {
- /* no text pad, remove the chain entirely */
- GST_DEBUG_OBJECT (playsink, "removing text chain");
- add_chain (GST_PLAY_CHAIN (playsink->textchain), FALSE);
- activate_chain (GST_PLAY_CHAIN (playsink->textchain), FALSE);
- } else {
- /* we have a chain and a textpad, turn the subtitles off */
- GST_DEBUG_OBJECT (playsink, "turning off the text");
- g_object_set (G_OBJECT (playsink->textchain->overlay), "silent", TRUE,
- NULL);
- }
- }
- if (!need_video && playsink->video_pad)
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (playsink->video_pad), NULL);
- if (playsink->text_pad && !playsink->textchain)
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (playsink->text_pad), NULL);
- }
-
- if (need_audio) {
- gboolean raw, queue;
-
- GST_DEBUG_OBJECT (playsink, "adding audio");
-
- /* get a raw sink if we are asked for a raw pad */
- raw = playsink->audio_pad_raw;
- if (need_vis && playsink->videochain) {
- /* If we are dealing with visualisations, we need to add a queue to
- * decouple the audio from the video part. We only have to do this when
- * the video part is async=true */
- queue = ((GstPlayVideoChain *) playsink->videochain)->async;
- GST_DEBUG_OBJECT (playsink, "need audio queue for vis: %d", queue);
- } else {
- /* no vis, we can avoid a queue */
- GST_DEBUG_OBJECT (playsink, "don't need audio queue");
- queue = FALSE;
- }
-
- if (playsink->audiochain) {
- /* try to reactivate the chain */
- if (!setup_audio_chain (playsink, raw, queue)) {
- GST_DEBUG_OBJECT (playsink, "removing current audio chain");
- if (playsink->audio_tee_asrc) {
- gst_element_release_request_pad (playsink->audio_tee,
- playsink->audio_tee_asrc);
- gst_object_unref (playsink->audio_tee_asrc);
- playsink->audio_tee_asrc = NULL;
- }
- add_chain (GST_PLAY_CHAIN (playsink->audiochain), FALSE);
- activate_chain (GST_PLAY_CHAIN (playsink->audiochain), FALSE);
- playsink->audiochain->volume = NULL;
- playsink->audiochain->mute = NULL;
- free_chain ((GstPlayChain *) playsink->audiochain);
- playsink->audiochain = NULL;
- playsink->volume_changed = playsink->mute_changed = FALSE;
- }
- }
-
- if (!playsink->audiochain) {
- GST_DEBUG_OBJECT (playsink, "creating new audio chain");
- playsink->audiochain = gen_audio_chain (playsink, raw, queue);
- }
-
- if (playsink->audiochain) {
- GST_DEBUG_OBJECT (playsink, "adding audio chain");
- if (playsink->audio_tee_asrc == NULL) {
- playsink->audio_tee_asrc =
- gst_element_get_request_pad (playsink->audio_tee, "src%d");
- }
- add_chain (GST_PLAY_CHAIN (playsink->audiochain), TRUE);
- activate_chain (GST_PLAY_CHAIN (playsink->audiochain), TRUE);
- gst_pad_link (playsink->audio_tee_asrc, playsink->audiochain->sinkpad);
- }
- } else {
- GST_DEBUG_OBJECT (playsink, "no audio needed");
- /* we have no audio or we are requested to not play audio */
- if (playsink->audiochain) {
- GST_DEBUG_OBJECT (playsink, "removing audio chain");
- /* release the audio pad */
- if (playsink->audio_tee_asrc) {
- gst_element_release_request_pad (playsink->audio_tee,
- playsink->audio_tee_asrc);
- gst_object_unref (playsink->audio_tee_asrc);
- playsink->audio_tee_asrc = NULL;
- }
- if (playsink->audiochain->sink_volume) {
- playsink->audiochain->volume = NULL;
- playsink->audiochain->mute = NULL;
- }
- add_chain (GST_PLAY_CHAIN (playsink->audiochain), FALSE);
- activate_chain (GST_PLAY_CHAIN (playsink->audiochain), FALSE);
- }
- }
-
- if (need_vis) {
- GstPad *srcpad;
-
- if (!playsink->vischain)
- playsink->vischain = gen_vis_chain (playsink);
-
- GST_DEBUG_OBJECT (playsink, "adding visualisation");
-
- if (playsink->vischain) {
- GST_DEBUG_OBJECT (playsink, "setting up vis chain");
- srcpad =
- gst_element_get_static_pad (playsink->vischain->chain.bin, "src");
- add_chain (GST_PLAY_CHAIN (playsink->vischain), TRUE);
- activate_chain (GST_PLAY_CHAIN (playsink->vischain), TRUE);
- if (playsink->audio_tee_vissrc == NULL) {
- playsink->audio_tee_vissrc =
- gst_element_get_request_pad (playsink->audio_tee, "src%d");
- }
- gst_pad_link (playsink->audio_tee_vissrc, playsink->vischain->sinkpad);
- gst_pad_link (srcpad, playsink->videochain->sinkpad);
- gst_object_unref (srcpad);
- }
- } else {
- GST_DEBUG_OBJECT (playsink, "no vis needed");
- if (playsink->vischain) {
- if (playsink->audio_tee_vissrc) {
- gst_element_release_request_pad (playsink->audio_tee,
- playsink->audio_tee_vissrc);
- gst_object_unref (playsink->audio_tee_vissrc);
- playsink->audio_tee_vissrc = NULL;
- }
- GST_DEBUG_OBJECT (playsink, "removing vis chain");
- add_chain (GST_PLAY_CHAIN (playsink->vischain), FALSE);
- activate_chain (GST_PLAY_CHAIN (playsink->vischain), FALSE);
- }
- }
- do_async_done (playsink);
- GST_PLAY_SINK_UNLOCK (playsink);
-
- return TRUE;
-
- /* ERRORS */
-subs_but_no_video:
- {
- GST_ELEMENT_ERROR (playsink, STREAM, FORMAT,
- (_("Can't play a text file without video.")),
- ("Have text pad but no video pad"));
- GST_PLAY_SINK_UNLOCK (playsink);
- return FALSE;
- }
-}
-
-/**
- * gst_play_sink_set_flags:
- * @playsink: a #GstPlaySink
- * @flags: #GstPlayFlags
- *
- * Configure @flags on @playsink. The flags control the behaviour of @playsink
- * when constructing the sink pipelins.
- *
- * Returns: TRUE if the flags could be configured.
- */
-gboolean
-gst_play_sink_set_flags (GstPlaySink * playsink, GstPlayFlags flags)
-{
- g_return_val_if_fail (GST_IS_PLAY_SINK (playsink), FALSE);
-
- GST_OBJECT_LOCK (playsink);
- playsink->flags = flags;
- GST_OBJECT_UNLOCK (playsink);
-
- return TRUE;
-}
-
-/**
- * gst_play_sink_get_flags:
- * @playsink: a #GstPlaySink
- *
- * Get the flags of @playsink. That flags control the behaviour of the sink when
- * it constructs the sink pipelines.
- *
- * Returns: the currently configured #GstPlayFlags.
- */
-GstPlayFlags
-gst_play_sink_get_flags (GstPlaySink * playsink)
-{
- GstPlayFlags res;
-
- g_return_val_if_fail (GST_IS_PLAY_SINK (playsink), 0);
-
- GST_OBJECT_LOCK (playsink);
- res = playsink->flags;
- GST_OBJECT_UNLOCK (playsink);
-
- return res;
-}
-
-void
-gst_play_sink_set_font_desc (GstPlaySink * playsink, const gchar * desc)
-{
- GstPlayTextChain *chain;
-
- GST_PLAY_SINK_LOCK (playsink);
- chain = (GstPlayTextChain *) playsink->textchain;
- g_free (playsink->font_desc);
- playsink->font_desc = g_strdup (desc);
- if (chain && chain->overlay) {
- g_object_set (chain->overlay, "font-desc", desc, NULL);
- }
- GST_PLAY_SINK_UNLOCK (playsink);
-}
-
-gchar *
-gst_play_sink_get_font_desc (GstPlaySink * playsink)
-{
- gchar *result = NULL;
- GstPlayTextChain *chain;
-
- GST_PLAY_SINK_LOCK (playsink);
- chain = (GstPlayTextChain *) playsink->textchain;
- if (chain && chain->overlay) {
- g_object_get (chain->overlay, "font-desc", &result, NULL);
- playsink->font_desc = g_strdup (result);
- } else {
- result = g_strdup (playsink->font_desc);
- }
- GST_PLAY_SINK_UNLOCK (playsink);
-
- return result;
-}
-
-void
-gst_play_sink_set_subtitle_encoding (GstPlaySink * playsink,
- const gchar * encoding)
-{
- GstPlayTextChain *chain;
-
- GST_PLAY_SINK_LOCK (playsink);
- chain = (GstPlayTextChain *) playsink->textchain;
- g_free (playsink->subtitle_encoding);
- playsink->subtitle_encoding = g_strdup (encoding);
- if (chain && chain->overlay) {
- g_object_set (chain->overlay, "subtitle-encoding", encoding, NULL);
- }
- GST_PLAY_SINK_UNLOCK (playsink);
-}
-
-gchar *
-gst_play_sink_get_subtitle_encoding (GstPlaySink * playsink)
-{
- gchar *result = NULL;
- GstPlayTextChain *chain;
-
- GST_PLAY_SINK_LOCK (playsink);
- chain = (GstPlayTextChain *) playsink->textchain;
- if (chain && chain->overlay) {
- g_object_get (chain->overlay, "subtitle-encoding", &result, NULL);
- playsink->subtitle_encoding = g_strdup (result);
- } else {
- result = g_strdup (playsink->subtitle_encoding);
- }
- GST_PLAY_SINK_UNLOCK (playsink);
-
- return result;
-}
-
-/**
- * gst_play_sink_get_last_frame:
- * @playsink: a #GstPlaySink
- *
- * Get the last displayed frame from @playsink. This frame is in the native
- * format of the sink element, the caps on the result buffer contain the format
- * of the frame data.
- *
- * Returns: a #GstBuffer with the frame data or %NULL when no video frame is
- * available.
- */
-GstBuffer *
-gst_play_sink_get_last_frame (GstPlaySink * playsink)
-{
- GstBuffer *result = NULL;
- GstPlayVideoChain *chain;
-
- GST_PLAY_SINK_LOCK (playsink);
- GST_DEBUG_OBJECT (playsink, "taking last frame");
- /* get the video chain if we can */
- if ((chain = (GstPlayVideoChain *) playsink->videochain)) {
- GST_DEBUG_OBJECT (playsink, "found video chain");
- /* see if the chain is active */
- if (chain->chain.activated && chain->sink) {
- GstElement *elem;
-
- GST_DEBUG_OBJECT (playsink, "video chain active and has a sink");
-
- /* find and get the last-buffer property now */
- if ((elem =
- gst_play_sink_find_property (playsink, chain->sink,
- "last-buffer", GST_TYPE_BUFFER))) {
- GST_DEBUG_OBJECT (playsink, "getting last-buffer property");
- g_object_get (elem, "last-buffer", &result, NULL);
- gst_object_unref (elem);
- }
- }
- }
- GST_PLAY_SINK_UNLOCK (playsink);
-
- return result;
-}
-
-/**
- * gst_play_sink_request_pad
- * @playsink: a #GstPlaySink
- * @type: a #GstPlaySinkType
- *
- * Create or return a pad of @type.
- *
- * Returns: a #GstPad of @type or %NULL when the pad could not be created.
- */
-GstPad *
-gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
-{
- GstPad *res = NULL;
- gboolean created = FALSE;
- gboolean raw = FALSE;
- gboolean activate = TRUE;
- const gchar *pad_name = NULL;
-
- GST_DEBUG_OBJECT (playsink, "request pad type %d", type);
-
- GST_PLAY_SINK_LOCK (playsink);
- switch (type) {
- case GST_PLAY_SINK_TYPE_AUDIO_RAW:
- pad_name = "audio_raw_sink";
- raw = TRUE;
- case GST_PLAY_SINK_TYPE_AUDIO:
- if (pad_name == NULL)
- pad_name = "audio_sink";
- if (!playsink->audio_tee) {
- GST_LOG_OBJECT (playsink, "creating tee");
- /* create tee when needed. This element will feed the audio sink chain
- * and the vis chain. */
- playsink->audio_tee = gst_element_factory_make ("tee", "audiotee");
- if (playsink->audio_tee == NULL) {
- post_missing_element_message (playsink, "tee");
- GST_ELEMENT_ERROR (playsink, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- "tee"), (NULL));
- res = NULL;
- break;
- } else {
- playsink->audio_tee_sink =
- gst_element_get_static_pad (playsink->audio_tee, "sink");
- gst_bin_add (GST_BIN_CAST (playsink), playsink->audio_tee);
- gst_element_set_state (playsink->audio_tee, GST_STATE_PAUSED);
- }
- } else {
- gst_element_set_state (playsink->audio_tee, GST_STATE_PAUSED);
- }
- if (!playsink->audio_pad) {
- GST_LOG_OBJECT (playsink, "ghosting tee sinkpad");
- playsink->audio_pad =
- gst_ghost_pad_new (pad_name, playsink->audio_tee_sink);
- created = TRUE;
- }
- playsink->audio_pad_raw = raw;
- res = playsink->audio_pad;
- break;
- case GST_PLAY_SINK_TYPE_VIDEO_RAW:
- pad_name = "video_raw_sink";
- raw = TRUE;
- case GST_PLAY_SINK_TYPE_VIDEO:
- if (pad_name == NULL)
- pad_name = "video_sink";
- if (!playsink->video_pad) {
- GST_LOG_OBJECT (playsink, "ghosting videosink");
- playsink->video_pad =
- gst_ghost_pad_new_no_target (pad_name, GST_PAD_SINK);
- created = TRUE;
- }
- playsink->video_pad_raw = raw;
- res = playsink->video_pad;
- break;
- case GST_PLAY_SINK_TYPE_TEXT:
- GST_LOG_OBJECT (playsink, "ghosting text");
- if (!playsink->text_pad) {
- playsink->text_pad =
- gst_ghost_pad_new_no_target ("text_sink", GST_PAD_SINK);
- created = TRUE;
- }
- res = playsink->text_pad;
- break;
- case GST_PLAY_SINK_TYPE_FLUSHING:
- {
- gchar *padname;
-
- /* we need a unique padname for the flushing pad. */
- padname = g_strdup_printf ("flushing_%d", playsink->count);
- res = gst_ghost_pad_new_no_target (padname, GST_PAD_SINK);
- g_free (padname);
- playsink->count++;
- activate = FALSE;
- created = TRUE;
- break;
- }
- default:
- res = NULL;
- break;
- }
- GST_PLAY_SINK_UNLOCK (playsink);
-
- if (created && res) {
- /* we have to add the pad when it's active or we get an error when the
- * element is 'running' */
- gst_pad_set_active (res, TRUE);
- gst_element_add_pad (GST_ELEMENT_CAST (playsink), res);
- if (!activate)
- gst_pad_set_active (res, activate);
- }
-
- return res;
-}
-
-static GstPad *
-gst_play_sink_request_new_pad (GstElement * element, GstPadTemplate * templ,
- const gchar * name)
-{
- GstPlaySink *psink;
- GstPad *pad;
- GstElementClass *klass;
- GstPlaySinkType type;
- const gchar *tplname;
-
- g_return_val_if_fail (templ != NULL, NULL);
-
- GST_DEBUG_OBJECT (element, "name:%s", name);
-
- psink = GST_PLAY_SINK (element);
- klass = GST_ELEMENT_GET_CLASS (element);
- tplname = GST_PAD_TEMPLATE_NAME_TEMPLATE (templ);
-
- /* Figure out the GstPlaySinkType based on the template */
- if (!strcmp (tplname, "audio_sink"))
- type = GST_PLAY_SINK_TYPE_AUDIO;
- else if (!strcmp (tplname, "aduio_raw_sink"))
- type = GST_PLAY_SINK_TYPE_AUDIO_RAW;
- else if (!strcmp (tplname, "video_sink"))
- type = GST_PLAY_SINK_TYPE_VIDEO;
- else if (!strcmp (tplname, "video_raw_sink"))
- type = GST_PLAY_SINK_TYPE_VIDEO_RAW;
- else if (!strcmp (tplname, "text_sink"))
- type = GST_PLAY_SINK_TYPE_TEXT;
- else
- goto unknown_template;
-
- pad = gst_play_sink_request_pad (psink, type);
- return pad;
-
-unknown_template:
- GST_WARNING_OBJECT (element, "Unknown pad template");
- return NULL;
-}
-
-void
-gst_play_sink_release_pad (GstPlaySink * playsink, GstPad * pad)
-{
- GstPad **res = NULL;
- gboolean untarget = TRUE;
-
- GST_DEBUG_OBJECT (playsink, "release pad %" GST_PTR_FORMAT, pad);
-
- GST_PLAY_SINK_LOCK (playsink);
- if (pad == playsink->video_pad) {
- res = &playsink->video_pad;
- } else if (pad == playsink->audio_pad) {
- res = &playsink->audio_pad;
- } else if (pad == playsink->text_pad) {
- res = &playsink->text_pad;
- } else {
- /* try to release the given pad anyway, these could be the FLUSHING pads. */
- res = &pad;
- untarget = FALSE;
- }
- GST_PLAY_SINK_UNLOCK (playsink);
-
- if (*res) {
- GST_DEBUG_OBJECT (playsink, "deactivate pad %" GST_PTR_FORMAT, *res);
- gst_pad_set_active (*res, FALSE);
- if (untarget) {
- GST_DEBUG_OBJECT (playsink, "untargeting pad %" GST_PTR_FORMAT, *res);
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (*res), NULL);
- }
- GST_DEBUG_OBJECT (playsink, "remove pad %" GST_PTR_FORMAT, *res);
- gst_element_remove_pad (GST_ELEMENT_CAST (playsink), *res);
- *res = NULL;
- }
-}
-
-static void
-gst_play_sink_release_request_pad (GstElement * element, GstPad * pad)
-{
- GstPlaySink *psink = GST_PLAY_SINK (element);
-
- gst_play_sink_release_pad (psink, pad);
-}
-
-static void
-gst_play_sink_handle_message (GstBin * bin, GstMessage * message)
-{
- GstPlaySink *playsink;
-
- playsink = GST_PLAY_SINK_CAST (bin);
-
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_STEP_DONE:
- {
- GstFormat format;
- guint64 amount;
- gdouble rate;
- gboolean flush, intermediate, eos;
- guint64 duration;
-
- GST_INFO_OBJECT (playsink, "Handling step-done message");
- gst_message_parse_step_done (message, &format, &amount, &rate, &flush,
- &intermediate, &duration, &eos);
-
- if (format == GST_FORMAT_BUFFERS) {
- /* for the buffer format, we align the other streams */
- if (playsink->audiochain) {
- GstEvent *event;
-
- event =
- gst_event_new_step (GST_FORMAT_TIME, duration, rate, flush,
- intermediate);
-
- if (!gst_element_send_event (playsink->audiochain->chain.bin, event)) {
- GST_DEBUG_OBJECT (playsink, "Event failed when sent to audio sink");
- }
- }
- }
- GST_BIN_CLASS (gst_play_sink_parent_class)->handle_message (bin, message);
- break;
- }
- default:
- GST_BIN_CLASS (gst_play_sink_parent_class)->handle_message (bin, message);
- break;
- }
-}
-
-/* Send an event to our sinks until one of them works; don't then send to the
- * remaining sinks (unlike GstBin)
- * Special case: If a text sink is set we need to send the event
- * to them in case it's source is different from the a/v stream's source.
- */
-static gboolean
-gst_play_sink_send_event_to_sink (GstPlaySink * playsink, GstEvent * event)
-{
- gboolean res = TRUE;
-
- if (playsink->textchain && playsink->textchain->sink) {
- gst_event_ref (event);
- if ((res = gst_element_send_event (playsink->textchain->chain.bin, event))) {
- GST_DEBUG_OBJECT (playsink, "Sent event succesfully to text sink");
- } else {
- GST_DEBUG_OBJECT (playsink, "Event failed when sent to text sink");
- }
- }
-
- if (playsink->videochain) {
- gst_event_ref (event);
- if ((res = gst_element_send_event (playsink->videochain->chain.bin, event))) {
- GST_DEBUG_OBJECT (playsink, "Sent event succesfully to video sink");
- goto done;
- }
- GST_DEBUG_OBJECT (playsink, "Event failed when sent to video sink");
- }
- if (playsink->audiochain) {
- gst_event_ref (event);
- if ((res = gst_element_send_event (playsink->audiochain->chain.bin, event))) {
- GST_DEBUG_OBJECT (playsink, "Sent event succesfully to audio sink");
- goto done;
- }
- GST_DEBUG_OBJECT (playsink, "Event failed when sent to audio sink");
- }
-
-done:
- gst_event_unref (event);
- return res;
-}
-
-/* We only want to send the event to a single sink (overriding GstBin's
- * behaviour), but we want to keep GstPipeline's behaviour - wrapping seek
- * events appropriately. So, this is a messy duplication of code. */
-static gboolean
-gst_play_sink_send_event (GstElement * element, GstEvent * event)
-{
- gboolean res = FALSE;
- GstEventType event_type = GST_EVENT_TYPE (event);
- GstPlaySink *playsink;
-
- playsink = GST_PLAY_SINK_CAST (element);
-
- switch (event_type) {
- case GST_EVENT_SEEK:
- GST_DEBUG_OBJECT (element, "Sending event to a sink");
- res = gst_play_sink_send_event_to_sink (playsink, event);
- break;
- case GST_EVENT_STEP:
- {
- GstFormat format;
- guint64 amount;
- gdouble rate;
- gboolean flush, intermediate;
-
- gst_event_parse_step (event, &format, &amount, &rate, &flush,
- &intermediate);
-
- if (format == GST_FORMAT_BUFFERS) {
- /* for buffers, we will try to step video frames, for other formats we
- * send the step to all sinks */
- res = gst_play_sink_send_event_to_sink (playsink, event);
- } else {
- res =
- GST_ELEMENT_CLASS (gst_play_sink_parent_class)->send_event (element,
- event);
- }
- break;
- }
- default:
- res =
- GST_ELEMENT_CLASS (gst_play_sink_parent_class)->send_event (element,
- event);
- break;
- }
- return res;
-}
-
-static GstStateChangeReturn
-gst_play_sink_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret;
- GstStateChangeReturn bret;
-
- GstPlaySink *playsink;
-
- playsink = GST_PLAY_SINK (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- playsink->need_async_start = TRUE;
- /* we want to go async to PAUSED until we managed to configure and add the
- * sinks */
- do_async_start (playsink);
- ret = GST_STATE_CHANGE_ASYNC;
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- case GST_STATE_CHANGE_READY_TO_NULL:
- if (playsink->audiochain && playsink->audiochain->sink_volume) {
- /* remove our links to the mute and volume elements when they were
- * provided by a sink */
- playsink->audiochain->volume = NULL;
- playsink->audiochain->mute = NULL;
- }
- ret = GST_STATE_CHANGE_SUCCESS;
- break;
- default:
- /* all other state changes return SUCCESS by default, this value can be
- * overridden by the result of the children */
- ret = GST_STATE_CHANGE_SUCCESS;
- break;
- }
-
- /* do the state change of the children */
- bret =
- GST_ELEMENT_CLASS (gst_play_sink_parent_class)->change_state (element,
- transition);
- /* now look at the result of our children and adjust the return value */
- switch (bret) {
- case GST_STATE_CHANGE_FAILURE:
- /* failure, we stop */
- goto activate_failed;
- case GST_STATE_CHANGE_NO_PREROLL:
- /* some child returned NO_PREROLL. This is strange but we never know. We
- * commit our async state change (if any) and return the NO_PREROLL */
- do_async_done (playsink);
- ret = bret;
- break;
- case GST_STATE_CHANGE_ASYNC:
- /* some child was async, return this */
- ret = bret;
- break;
- default:
- /* return our previously configured return value */
- break;
- }
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- /* FIXME Release audio device when we implement that */
- playsink->need_async_start = TRUE;
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- case GST_STATE_CHANGE_READY_TO_NULL:
- /* remove sinks we added */
- if (playsink->videochain) {
- activate_chain (GST_PLAY_CHAIN (playsink->videochain), FALSE);
- add_chain (GST_PLAY_CHAIN (playsink->videochain), FALSE);
- }
- if (playsink->audiochain) {
- activate_chain (GST_PLAY_CHAIN (playsink->audiochain), FALSE);
- add_chain (GST_PLAY_CHAIN (playsink->audiochain), FALSE);
- }
- if (playsink->vischain) {
- activate_chain (GST_PLAY_CHAIN (playsink->vischain), FALSE);
- add_chain (GST_PLAY_CHAIN (playsink->vischain), FALSE);
- }
- if (playsink->textchain) {
- activate_chain (GST_PLAY_CHAIN (playsink->textchain), FALSE);
- add_chain (GST_PLAY_CHAIN (playsink->textchain), FALSE);
- }
- do_async_done (playsink);
- break;
- default:
- break;
- }
- return ret;
-
- /* ERRORS */
-activate_failed:
- {
- GST_DEBUG_OBJECT (element,
- "element failed to change states -- activation problem?");
- return GST_STATE_CHANGE_FAILURE;
- }
-}
-
-static void
-gst_play_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * spec)
-{
- GstPlaySink *playsink = GST_PLAY_SINK (object);
-
- switch (prop_id) {
- case PROP_FLAGS:
- gst_play_sink_set_flags (playsink, g_value_get_flags (value));
- break;
- case PROP_VOLUME:
- gst_play_sink_set_volume (playsink, g_value_get_double (value));
- break;
- case PROP_MUTE:
- gst_play_sink_set_mute (playsink, g_value_get_boolean (value));
- break;
- case PROP_FONT_DESC:
- gst_play_sink_set_font_desc (playsink, g_value_get_string (value));
- break;
- case PROP_SUBTITLE_ENCODING:
- gst_play_sink_set_subtitle_encoding (playsink,
- g_value_get_string (value));
- break;
- case PROP_VIS_PLUGIN:
- gst_play_sink_set_vis_plugin (playsink, g_value_get_object (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
- break;
- }
-}
-
-static void
-gst_play_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * spec)
-{
- GstPlaySink *playsink = GST_PLAY_SINK (object);
-
- switch (prop_id) {
- case PROP_FLAGS:
- g_value_set_flags (value, gst_play_sink_get_flags (playsink));
- break;
- case PROP_VOLUME:
- g_value_set_double (value, gst_play_sink_get_volume (playsink));
- break;
- case PROP_MUTE:
- g_value_set_boolean (value, gst_play_sink_get_mute (playsink));
- break;
- case PROP_FONT_DESC:
- g_value_take_string (value, gst_play_sink_get_font_desc (playsink));
- break;
- case PROP_SUBTITLE_ENCODING:
- g_value_take_string (value,
- gst_play_sink_get_subtitle_encoding (playsink));
- break;
- case PROP_VIS_PLUGIN:
- g_value_take_object (value, gst_play_sink_get_vis_plugin (playsink));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
- break;
- }
-}
-
-
-gboolean
-gst_play_sink_plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (gst_play_sink_debug, "playsink", 0, "play bin");
-
- return gst_element_register (plugin, "playsink", GST_RANK_NONE,
- GST_TYPE_PLAY_SINK);
-}
diff --git a/gst/playback/gstplaysink.h b/gst/playback/gstplaysink.h
deleted file mode 100644
index b47ba6ef..00000000
--- a/gst/playback/gstplaysink.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_PLAY_SINK_H__
-#define __GST_PLAY_SINK_H__
-
-#include <gst/gst.h>
-
-#include "gstplay-enum.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_PLAY_SINK \
- (gst_play_sink_get_type())
-#define GST_PLAY_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAY_SINK, GstPlaySink))
-#define GST_PLAY_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLAY_SINK, GstPlaySinkClass))
-#define GST_IS_PLAY_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLAY_SINK))
-#define GST_IS_PLAY_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLAY_SINK))
-#define GST_PLAY_SINK_CAST(obj) \
- ((GstPlaySink*)(obj))
-
-/**
- * GstPlaySinkType:
- * @GST_PLAY_SINK_TYPE_AUDIO: A non-raw audio pad
- * @GST_PLAY_SINK_TYPE_AUDIO_RAW: a raw audio pad
- * @GST_PLAY_SINK_TYPE_VIDEO: a non-raw video pad
- * @GST_PLAY_SINK_TYPE_VIDEO_RAW: a raw video pad
- * @GST_PLAY_SINK_TYPE_TEXT: a raw text pad
- * @GST_PLAY_SINK_TYPE_LAST: the last type
- * @GST_PLAY_SINK_TYPE_FLUSHING: a flushing pad, used when shutting down
- *
- * Types of pads that can be requested from the sinks.
- */
-typedef enum {
- GST_PLAY_SINK_TYPE_AUDIO = 0,
- GST_PLAY_SINK_TYPE_AUDIO_RAW = 1,
- GST_PLAY_SINK_TYPE_VIDEO = 2,
- GST_PLAY_SINK_TYPE_VIDEO_RAW = 3,
- GST_PLAY_SINK_TYPE_TEXT = 4,
- GST_PLAY_SINK_TYPE_LAST = 5,
-
- /* this is a dummy pad */
- GST_PLAY_SINK_TYPE_FLUSHING = 6
-} GstPlaySinkType;
-
-typedef struct _GstPlaySink GstPlaySink;
-typedef struct _GstPlaySinkClass GstPlaySinkClass;
-
-GType gst_play_sink_get_type (void);
-
-GstPad * gst_play_sink_request_pad (GstPlaySink *playsink, GstPlaySinkType type);
-void gst_play_sink_release_pad (GstPlaySink *playsink, GstPad *pad);
-
-void gst_play_sink_set_sink (GstPlaySink * playsink, GstPlaySinkType type, GstElement * sink);
-GstElement * gst_play_sink_get_sink (GstPlaySink * playsink, GstPlaySinkType type);
-
-void gst_play_sink_set_vis_plugin (GstPlaySink * playsink, GstElement * vis);
-GstElement * gst_play_sink_get_vis_plugin (GstPlaySink * playsink);
-
-void gst_play_sink_set_volume (GstPlaySink *playsink, gdouble volume);
-gdouble gst_play_sink_get_volume (GstPlaySink *playsink);
-
-void gst_play_sink_set_mute (GstPlaySink *playsink, gboolean mute);
-gboolean gst_play_sink_get_mute (GstPlaySink *playsink);
-
-gboolean gst_play_sink_set_flags (GstPlaySink * playsink, GstPlayFlags flags);
-GstPlayFlags gst_play_sink_get_flags (GstPlaySink * playsink);
-
-void gst_play_sink_set_font_desc (GstPlaySink *playsink, const gchar * desc);
-gchar * gst_play_sink_get_font_desc (GstPlaySink *playsink);
-void gst_play_sink_set_subtitle_encoding (GstPlaySink *playsink, const gchar * encoding);
-gchar * gst_play_sink_get_subtitle_encoding (GstPlaySink *playsink);
-
-GstBuffer * gst_play_sink_get_last_frame (GstPlaySink * playsink);
-
-gboolean gst_play_sink_reconfigure (GstPlaySink * playsink);
-
-gboolean gst_play_sink_plugin_init (GstPlugin * plugin);
-
-G_END_DECLS
-
-#endif /* __GST_PLAY_SINK_H__ */
diff --git a/gst/playback/gstrawcaps.h b/gst/playback/gstrawcaps.h
deleted file mode 100644
index 0297e331..00000000
--- a/gst/playback/gstrawcaps.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* GStreamer
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_RAW_CAPS_H__
-#define __GST_RAW_CAPS_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define DEFAULT_RAW_CAPS \
- "video/x-raw-yuv; " \
- "video/x-raw-rgb; " \
- "video/x-raw-gray; " \
- "audio/x-raw-int; " \
- "audio/x-raw-float; " \
- "text/plain; " \
- "text/x-pango-markup; " \
- "video/x-dvd-subpicture; " \
- "subpicture/x-pgs"
-
-G_END_DECLS
-
-#endif /* __GST_RAW_CAPS__ */
-
diff --git a/gst/playback/gstscreenshot.c b/gst/playback/gstscreenshot.c
deleted file mode 100644
index 6d09c376..00000000
--- a/gst/playback/gstscreenshot.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/* Small helper element for format conversion
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <string.h>
-
-#include "gstscreenshot.h"
-
-static void
-feed_fakesrc (GstElement * src, GstBuffer * buf, GstPad * pad, gpointer data)
-{
- GstBuffer *in_buf = GST_BUFFER (data);
-
- gst_buffer_set_caps (buf, GST_BUFFER_CAPS (in_buf));
-
- memcpy (GST_BUFFER_DATA (buf), GST_BUFFER_DATA (in_buf),
- GST_BUFFER_SIZE (in_buf));
-
- GST_BUFFER_SIZE (buf) = GST_BUFFER_SIZE (in_buf);
-
- GST_DEBUG ("feeding buffer %p, size %u, caps %" GST_PTR_FORMAT,
- buf, GST_BUFFER_SIZE (buf), GST_BUFFER_CAPS (buf));
-}
-
-static void
-save_result (GstElement * sink, GstBuffer * buf, GstPad * pad, gpointer data)
-{
- GstBuffer **p_buf = (GstBuffer **) data;
-
- *p_buf = gst_buffer_ref (buf);
-
- GST_DEBUG ("received converted buffer %p with caps %" GST_PTR_FORMAT,
- *p_buf, GST_BUFFER_CAPS (*p_buf));
-}
-
-static gboolean
-create_element (const gchar * factory_name, GstElement ** element,
- GError ** err)
-{
- *element = gst_element_factory_make (factory_name, NULL);
- if (*element)
- return TRUE;
-
- if (err && *err == NULL) {
- *err = g_error_new (GST_CORE_ERROR, GST_CORE_ERROR_MISSING_PLUGIN,
- "cannot create element '%s' - please check your GStreamer installation",
- factory_name);
- }
-
- return FALSE;
-}
-
-/* takes ownership of the input buffer */
-GstBuffer *
-gst_play_frame_conv_convert (GstBuffer * buf, GstCaps * to_caps)
-{
- GstElement *src, *csp, *filter1, *vscale, *filter2, *sink, *pipeline;
- GstMessage *msg;
- GstBuffer *result = NULL;
- GError *error = NULL;
- GstBus *bus;
- GstCaps *to_caps_no_par;
-
- g_return_val_if_fail (GST_BUFFER_CAPS (buf) != NULL, NULL);
-
- /* videoscale is here to correct for the pixel-aspect-ratio for us */
- GST_DEBUG ("creating elements");
- if (!create_element ("fakesrc", &src, &error) ||
- !create_element ("ffmpegcolorspace", &csp, &error) ||
- !create_element ("videoscale", &vscale, &error) ||
- !create_element ("capsfilter", &filter1, &error) ||
- !create_element ("capsfilter", &filter2, &error) ||
- !create_element ("fakesink", &sink, &error))
- goto no_elements;
-
- pipeline = gst_pipeline_new ("screenshot-pipeline");
- if (pipeline == NULL)
- goto no_pipeline;
-
- GST_DEBUG ("adding elements");
- gst_bin_add_many (GST_BIN (pipeline), src, csp, filter1, vscale, filter2,
- sink, NULL);
-
- g_signal_connect (src, "handoff", G_CALLBACK (feed_fakesrc), buf);
-
- /* set to 'fixed' sizetype */
- g_object_set (src, "sizemax", GST_BUFFER_SIZE (buf), "sizetype", 2,
- "num-buffers", 1, "signal-handoffs", TRUE, NULL);
-
- /* adding this superfluous capsfilter makes linking cheaper */
- to_caps_no_par = gst_caps_copy (to_caps);
- gst_structure_remove_field (gst_caps_get_structure (to_caps_no_par, 0),
- "pixel-aspect-ratio");
- g_object_set (filter1, "caps", to_caps_no_par, NULL);
- gst_caps_unref (to_caps_no_par);
-
- g_object_set (filter2, "caps", to_caps, NULL);
-
- g_signal_connect (sink, "handoff", G_CALLBACK (save_result), &result);
-
- g_object_set (sink, "preroll-queue-len", 1, "signal-handoffs", TRUE, NULL);
-
- /* FIXME: linking is still way too expensive, profile this properly */
- GST_DEBUG ("linking src->csp");
- if (!gst_element_link_pads (src, "src", csp, "sink"))
- return NULL;
-
- GST_DEBUG ("linking csp->filter1");
- if (!gst_element_link_pads (csp, "src", filter1, "sink"))
- return NULL;
-
- GST_DEBUG ("linking filter1->vscale");
- if (!gst_element_link_pads (filter1, "src", vscale, "sink"))
- return NULL;
-
- GST_DEBUG ("linking vscale->capsfilter");
- if (!gst_element_link_pads (vscale, "src", filter2, "sink"))
- return NULL;
-
- GST_DEBUG ("linking capsfilter->sink");
- if (!gst_element_link_pads (filter2, "src", sink, "sink"))
- return NULL;
-
- GST_DEBUG ("running conversion pipeline");
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- bus = gst_element_get_bus (pipeline);
- msg =
- gst_bus_poll (bus, GST_MESSAGE_ERROR | GST_MESSAGE_EOS, 25 * GST_SECOND);
-
- if (msg) {
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_EOS:{
- if (result) {
- GST_DEBUG ("conversion successful: result = %p", result);
- } else {
- GST_WARNING ("EOS but no result frame?!");
- }
- break;
- }
- case GST_MESSAGE_ERROR:{
- gchar *dbg = NULL;
-
- gst_message_parse_error (msg, &error, &dbg);
- if (error) {
- g_warning ("Could not take screenshot: %s", error->message);
- GST_DEBUG ("%s [debug: %s]", error->message, GST_STR_NULL (dbg));
- g_error_free (error);
- } else {
- g_warning ("Could not take screenshot (and NULL error!)");
- }
- g_free (dbg);
- result = NULL;
- break;
- }
- default:{
- g_return_val_if_reached (NULL);
- }
- }
- gst_message_unref (msg);
- } else {
- g_warning ("Could not take screenshot: %s", "timeout during conversion");
- result = NULL;
- }
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- return result;
-
- /* ERRORS */
-no_elements:
- {
- g_warning ("Could not take screenshot: %s", error->message);
- g_error_free (error);
- return NULL;
- }
-no_pipeline:
- {
- g_warning ("Could not take screenshot: %s", "no pipeline (unknown error)");
- return NULL;
- }
-}
diff --git a/gst/playback/gstscreenshot.h b/gst/playback/gstscreenshot.h
deleted file mode 100644
index c17215b6..00000000
--- a/gst/playback/gstscreenshot.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Small helper element for format conversion
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_PLAY_FRAME_CONV_H__
-#define __GST_PLAY_FRAME_CONV_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-GstBuffer * gst_play_frame_conv_convert (GstBuffer *buf, GstCaps *to);
-
-G_END_DECLS
-
-#endif /* __GST_PLAY_FRAME_CONV_H__ */
diff --git a/gst/playback/gststreaminfo.c b/gst/playback/gststreaminfo.c
deleted file mode 100644
index 86ec58a3..00000000
--- a/gst/playback/gststreaminfo.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <gst/gst.h>
-#include "gststreaminfo.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_streaminfo_debug);
-#define GST_CAT_DEFAULT gst_streaminfo_debug
-
-/* props */
-enum
-{
- ARG_0,
- ARG_PAD,
- ARG_TYPE,
- ARG_DECODER,
- ARG_MUTE,
- ARG_CAPS,
- ARG_LANG_CODE,
- ARG_CODEC
-};
-
-/* signals */
-enum
-{
- SIGNAL_MUTED,
- LAST_SIGNAL
-};
-
-static guint gst_stream_info_signals[LAST_SIGNAL] = { 0 };
-
-#define GST_TYPE_STREAM_TYPE (gst_stream_type_get_type())
-static GType
-gst_stream_type_get_type (void)
-{
- static GType stream_type_type = 0;
- static const GEnumValue stream_type[] = {
- {GST_STREAM_TYPE_UNKNOWN, "Unknown stream", "unknown"},
- {GST_STREAM_TYPE_AUDIO, "Audio stream", "audio"},
- {GST_STREAM_TYPE_VIDEO, "Video stream", "video"},
- {GST_STREAM_TYPE_TEXT, "Text stream", "text"},
- {GST_STREAM_TYPE_SUBPICTURE, "Subpicture stream", "subpicture"},
- {GST_STREAM_TYPE_ELEMENT,
- "Stream handled by element", "element"},
- {0, NULL, NULL},
- };
-
- if (!stream_type_type) {
- stream_type_type = g_enum_register_static ("GstStreamType", stream_type);
- }
- return stream_type_type;
-}
-
-static void gst_stream_info_class_init (GstStreamInfoClass * klass);
-static void gst_stream_info_init (GstStreamInfo * stream_info);
-static void gst_stream_info_dispose (GObject * object);
-
-static void stream_info_change_state (GstElement * element,
- gint old_state, gint new_state, gpointer data);
-
-static void gst_stream_info_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * spec);
-static void gst_stream_info_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * spec);
-
-static GObjectClass *parent_class;
-
-//static guint gst_stream_info_signals[LAST_SIGNAL] = { 0 };
-
-GType
-gst_stream_info_get_type (void)
-{
- static GType gst_stream_info_type = 0;
-
- if (!gst_stream_info_type) {
- static const GTypeInfo gst_stream_info_info = {
- sizeof (GstStreamInfoClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_stream_info_class_init,
- NULL,
- NULL,
- sizeof (GstStreamInfo),
- 0,
- (GInstanceInitFunc) gst_stream_info_init,
- NULL
- };
- gst_stream_info_type = g_type_register_static (G_TYPE_OBJECT,
- "GstStreamInfo", &gst_stream_info_info, 0);
- }
-
- return gst_stream_info_type;
-}
-
-static void
-gst_stream_info_class_init (GstStreamInfoClass * klass)
-{
- GObjectClass *gobject_klass;
-
- gobject_klass = (GObjectClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_klass->set_property = gst_stream_info_set_property;
- gobject_klass->get_property = gst_stream_info_get_property;
-
- g_object_class_install_property (gobject_klass, ARG_PAD,
- g_param_spec_object ("object", "object",
- "Source Pad or object of the stream", GST_TYPE_OBJECT,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_TYPE,
- g_param_spec_enum ("type", "Type", "Type of the stream",
- GST_TYPE_STREAM_TYPE, GST_STREAM_TYPE_UNKNOWN,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_DECODER,
- g_param_spec_string ("decoder", "Decoder",
- "The decoder used to decode the stream", NULL,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_MUTE,
- g_param_spec_boolean ("mute", "Mute", "Mute or unmute this stream", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_CAPS,
- g_param_spec_boxed ("caps", "Capabilities",
- "Capabilities (or type) of this stream", GST_TYPE_CAPS,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_LANG_CODE,
- g_param_spec_string ("language-code", "Language code",
- "Language code for this stream, conforming to ISO-639-1", NULL,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_klass, ARG_CODEC,
- g_param_spec_string ("codec", "Codec", "Codec used to encode the stream",
- NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- gst_stream_info_signals[SIGNAL_MUTED] =
- g_signal_new ("muted", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstStreamInfoClass, muted), NULL, NULL,
- gst_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
-
- gobject_klass->dispose = gst_stream_info_dispose;
-
- GST_DEBUG_CATEGORY_INIT (gst_streaminfo_debug, "streaminfo", 0,
- "Playbin Stream Info");
-}
-
-
-static void
-gst_stream_info_init (GstStreamInfo * stream_info)
-{
- stream_info->object = NULL;
- stream_info->origin = NULL;
- stream_info->type = GST_STREAM_TYPE_UNKNOWN;
- stream_info->decoder = NULL;
- stream_info->mute = FALSE;
- stream_info->caps = NULL;
-}
-
-static gboolean
-cb_probe (GstPad * pad, GstEvent * e, gpointer user_data)
-{
- GstStreamInfo *info = user_data;
-
- if (GST_EVENT_TYPE (e) == GST_EVENT_TAG) {
- gchar *codec, *lang;
- GstTagList *list;
-
- gst_event_parse_tag (e, &list);
-
- if (info->type != GST_STREAM_TYPE_AUDIO &&
- gst_tag_list_get_string (list, GST_TAG_VIDEO_CODEC, &codec)) {
- g_free (info->codec);
- info->codec = codec;
- GST_LOG_OBJECT (pad, "codec = %s (video)", codec);
- g_object_notify (G_OBJECT (info), "codec");
- } else if (info->type != GST_STREAM_TYPE_VIDEO &&
- gst_tag_list_get_string (list, GST_TAG_AUDIO_CODEC, &codec)) {
- g_free (info->codec);
- info->codec = codec;
- GST_LOG_OBJECT (pad, "codec = %s (audio)", codec);
- g_object_notify (G_OBJECT (info), "codec");
- } else if (gst_tag_list_get_string (list, GST_TAG_CODEC, &codec)) {
- g_free (info->codec);
- info->codec = codec;
- GST_LOG_OBJECT (pad, "codec = %s (generic)", codec);
- g_object_notify (G_OBJECT (info), "codec");
- }
- if (gst_tag_list_get_string (list, GST_TAG_LANGUAGE_CODE, &lang)) {
- g_free (info->langcode);
- info->langcode = lang;
- GST_LOG_OBJECT (pad, "language-code = %s", lang);
- g_object_notify (G_OBJECT (info), "language-code");
- }
- }
-
- return TRUE;
-}
-
-GstStreamInfo *
-gst_stream_info_new (GstObject * object,
- GstStreamType type, const gchar * decoder, const GstCaps * caps)
-{
- GstStreamInfo *info;
-
- info = g_object_new (GST_TYPE_STREAM_INFO, NULL);
-
- gst_object_ref (object);
- if (GST_IS_PAD (object)) {
- gst_pad_add_event_probe (GST_PAD_CAST (object),
- G_CALLBACK (cb_probe), info);
- }
- info->object = object;
- info->type = type;
- info->decoder = g_strdup (decoder);
- info->origin = object;
- if (caps) {
- info->caps = gst_caps_copy (caps);
- }
-
- return info;
-}
-
-static void
-gst_stream_info_dispose (GObject * object)
-{
- GstStreamInfo *stream_info;
-
- stream_info = GST_STREAM_INFO (object);
-
- if (stream_info->object) {
- GstElement *parent;
-
- parent = gst_pad_get_parent_element ((GstPad *)
- GST_PAD_CAST (stream_info->object));
- if (parent != NULL) {
- g_signal_handlers_disconnect_by_func (parent,
- (gpointer) stream_info_change_state, stream_info);
- gst_object_unref (parent);
- }
-
- gst_object_unref (stream_info->object);
- stream_info->object = NULL;
- }
- stream_info->origin = NULL;
- stream_info->type = GST_STREAM_TYPE_UNKNOWN;
- g_free (stream_info->decoder);
- stream_info->decoder = NULL;
- g_free (stream_info->langcode);
- stream_info->langcode = NULL;
- g_free (stream_info->codec);
- stream_info->codec = NULL;
- if (stream_info->caps) {
- gst_caps_unref (stream_info->caps);
- stream_info->caps = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose) {
- G_OBJECT_CLASS (parent_class)->dispose (object);
- }
-}
-
-static void
-stream_info_change_state (GstElement * element,
- gint old_state, gint new_state, gpointer data)
-{
- GstStreamInfo *stream_info = data;
-
- if (new_state == GST_STATE_PLAYING) {
- /* state change will annoy us */
- g_return_if_fail (stream_info->mute == TRUE);
- GST_DEBUG_OBJECT (stream_info, "Re-muting pads after state-change");
- //gst_pad_set_active_recursive (GST_PAD (stream_info->object), FALSE);
- g_warning ("FIXME");
- }
-}
-
-gboolean
-gst_stream_info_set_mute (GstStreamInfo * stream_info, gboolean mute)
-{
- g_return_val_if_fail (GST_IS_STREAM_INFO (stream_info), FALSE);
-
- if (stream_info->type == GST_STREAM_TYPE_ELEMENT) {
- g_warning ("cannot mute element stream");
- return FALSE;
- }
-
- if (mute != stream_info->mute) {
- /* nothing really happens here. it looks like gstplaybasebin installs a
- * buffer probe hat drops buffers when muting. but the this removes it self
- * after first call.
- */
-
- stream_info->mute = mute;
-#if 0
- gst_pad_set_active ((GstPad *) GST_PAD_CAST (stream_info->object), !mute);
-#endif
-#if 0
- {
- GstElement *element;
-
- element = gst_pad_get_parent_element ((GstPad *)
- GST_PAD_CAST (stream_info->object));
- if (element) {
- if (mute) {
- g_signal_connect (element, "state-changed",
- G_CALLBACK (stream_info_change_state), stream_info);
- } else {
- g_signal_handlers_disconnect_by_func (element,
- G_CALLBACK (stream_info_change_state), stream_info);
- }
- gst_object_unref (element);
- }
- }
-#endif
- }
- return TRUE;
-}
-
-gboolean
-gst_stream_info_is_mute (GstStreamInfo * stream_info)
-{
- g_return_val_if_fail (GST_IS_STREAM_INFO (stream_info), TRUE);
-
- return stream_info->mute;
-}
-
-static void
-gst_stream_info_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstStreamInfo *stream_info;
-
- g_return_if_fail (GST_IS_STREAM_INFO (object));
-
- stream_info = GST_STREAM_INFO (object);
-
- switch (prop_id) {
- case ARG_MUTE:
- gst_stream_info_set_mute (stream_info, g_value_get_boolean (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_stream_info_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstStreamInfo *stream_info;
-
- g_return_if_fail (GST_IS_STREAM_INFO (object));
-
- stream_info = GST_STREAM_INFO (object);
-
- switch (prop_id) {
- case ARG_PAD:
- g_value_set_object (value, stream_info->object);
- break;
- case ARG_TYPE:
- g_value_set_enum (value, stream_info->type);
- break;
- case ARG_DECODER:
- g_value_set_string (value, stream_info->decoder);
- break;
- case ARG_MUTE:
- g_value_set_boolean (value, stream_info->mute);
- break;
- case ARG_CAPS:
- g_value_set_boxed (value, stream_info->caps);
- break;
- case ARG_LANG_CODE:
- g_value_set_string (value, stream_info->langcode);
- break;
- case ARG_CODEC:
- g_value_set_string (value, stream_info->codec);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
diff --git a/gst/playback/gststreaminfo.h b/gst/playback/gststreaminfo.h
deleted file mode 100644
index b4157ea8..00000000
--- a/gst/playback/gststreaminfo.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * <2007> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_STREAMINFO_H__
-#define __GST_STREAMINFO_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_STREAM_INFO (gst_stream_info_get_type())
-#define GST_STREAM_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_STREAM_INFO,GstStreamInfo))
-#define GST_STREAM_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_STREAM_INFO,GstStreamInfoClass))
-#define GST_IS_STREAM_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_STREAM_INFO))
-#define GST_IS_STREAM_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_STREAM_INFO))
-
-typedef struct _GstStreamInfo GstStreamInfo;
-typedef struct _GstStreamInfoClass GstStreamInfoClass;
-
-typedef enum {
- GST_STREAM_TYPE_UNKNOWN = 0,
- GST_STREAM_TYPE_AUDIO = 1, /* an audio stream */
- GST_STREAM_TYPE_VIDEO = 2, /* a video stream */
- GST_STREAM_TYPE_TEXT = 3, /* a subtitle/text stream */
- GST_STREAM_TYPE_SUBPICTURE = 4, /* a subtitle in picture-form */
- GST_STREAM_TYPE_ELEMENT = 5 /* stream handled by an element */
-} GstStreamType;
-
-struct _GstStreamInfo {
- GObject parent;
-
- GstObject *object; /* pad/element providing/handling this stream */
- GstStreamType type; /* the type of the provided stream */
- gchar *decoder; /* string describing the decoder */
- gboolean mute; /* is the stream muted or not */
- GstObject *origin; /* the real object providing this stream, this can
- be different from the object as the object can be
- a queue pad, inserted for preroll. */
- GstCaps *caps; /* the caps of the stream */
-
- /* this is tream information cached here because the streaminfo may be
- * created before the app can know about it. */
- gchar *langcode,
- *codec;
-};
-
-struct _GstStreamInfoClass {
- GObjectClass parent_class;
-
- /* signals */
- void (*muted) (GstStreamInfo *info, gboolean mute);
-};
-
-GType gst_stream_info_get_type (void);
-
-GstStreamInfo* gst_stream_info_new (GstObject *object,
- GstStreamType type,
- const gchar *decoder,
- const GstCaps *caps);
-
-gboolean gst_stream_info_set_mute (GstStreamInfo *stream_info,
- gboolean mute);
-gboolean gst_stream_info_is_mute (GstStreamInfo *stream_info);
-
-
-G_END_DECLS
-
-#endif /* __GST_STREAMINFO_H__ */
diff --git a/gst/playback/gststreamselector.c b/gst/playback/gststreamselector.c
deleted file mode 100644
index b77da1e5..00000000
--- a/gst/playback/gststreamselector.c
+++ /dev/null
@@ -1,752 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
- * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
- * Copyright (C) 2005 Jan Schmidt <thaytan@mad.scientist.com>
- * Copyright (C) 2007 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include "gststreamselector.h"
-
-GST_DEBUG_CATEGORY_STATIC (stream_selector_debug);
-#define GST_CAT_DEFAULT stream_selector_debug
-
-static const GstElementDetails gst_stream_selector_details =
-GST_ELEMENT_DETAILS ("StreamSelector",
- "Generic",
- "N-to-1 input stream_selectoring",
- "Julien Moutte <julien@moutte.net>\n"
- "Jan Schmidt <thaytan@mad.scientist.com>\n"
- "Wim Taymans <wim.taymans@gmail.com>");
-
-static GstStaticPadTemplate gst_stream_selector_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("sink%d",
- GST_PAD_SINK,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS_ANY);
-
-static GstStaticPadTemplate gst_stream_selector_src_factory =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-enum
-{
- PROP_0,
- PROP_N_PADS,
- PROP_ACTIVE_PAD,
- PROP_LAST
-};
-
-static gboolean gst_stream_selector_is_active_sinkpad (GstStreamSelector * sel,
- GstPad * pad);
-static GstPad *gst_stream_selector_activate_sinkpad (GstStreamSelector * sel,
- GstPad * pad);
-static GstPad *gst_stream_selector_get_linked_pad (GstPad * pad,
- gboolean strict);
-
-#define GST_TYPE_SELECTOR_PAD \
- (gst_selector_pad_get_type())
-#define GST_SELECTOR_PAD(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_SELECTOR_PAD, GstSelectorPad))
-#define GST_SELECTOR_PAD_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_SELECTOR_PAD, GstSelectorPadClass))
-#define GST_IS_SELECTOR_PAD(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_SELECTOR_PAD))
-#define GST_IS_SELECTOR_PAD_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_SELECTOR_PAD))
-#define GST_SELECTOR_PAD_CAST(obj) \
- ((GstSelectorPad *)(obj))
-
-typedef struct _GstSelectorPad GstSelectorPad;
-typedef struct _GstSelectorPadClass GstSelectorPadClass;
-
-struct _GstSelectorPad
-{
- GstPad parent;
-
- gboolean active;
- gboolean eos;
- gboolean segment_pending;
- GstSegment segment;
- GstTagList *tags;
-};
-
-struct _GstSelectorPadClass
-{
- GstPadClass parent;
-};
-
-static void gst_selector_pad_class_init (GstSelectorPadClass * klass);
-static void gst_selector_pad_init (GstSelectorPad * pad);
-static void gst_selector_pad_finalize (GObject * object);
-
-static void gst_selector_pad_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static GstPadClass *selector_pad_parent_class = NULL;
-
-static void gst_selector_pad_reset (GstSelectorPad * pad);
-static gboolean gst_selector_pad_event (GstPad * pad, GstEvent * event);
-static GstCaps *gst_selector_pad_getcaps (GstPad * pad);
-static GstFlowReturn gst_selector_pad_chain (GstPad * pad, GstBuffer * buf);
-static GstFlowReturn gst_selector_pad_bufferalloc (GstPad * pad,
- guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
-
-enum
-{
- PROP_PAD_0,
- PROP_PAD_TAGS,
- PROP_PAD_ACTIVE,
- PROP_PAD_LAST
-};
-
-static GType
-gst_selector_pad_get_type (void)
-{
- static GType selector_pad_type = 0;
-
- if (!selector_pad_type) {
- static const GTypeInfo selector_pad_info = {
- sizeof (GstSelectorPadClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_selector_pad_class_init,
- NULL,
- NULL,
- sizeof (GstSelectorPad),
- 0,
- (GInstanceInitFunc) gst_selector_pad_init,
- };
-
- selector_pad_type =
- g_type_register_static (GST_TYPE_PAD, "GstPlaybinSelectorPad",
- &selector_pad_info, 0);
- }
- return selector_pad_type;
-}
-
-static void
-gst_selector_pad_class_init (GstSelectorPadClass * klass)
-{
- GObjectClass *gobject_class;
-
- gobject_class = (GObjectClass *) klass;
-
- selector_pad_parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->finalize = gst_selector_pad_finalize;
- gobject_class->get_property = gst_selector_pad_get_property;
-
- g_object_class_install_property (gobject_class, PROP_PAD_TAGS,
- g_param_spec_boxed ("tags", "Tags",
- "The currently active tags on the pad", GST_TYPE_TAG_LIST,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_PAD_ACTIVE,
- g_param_spec_boolean ("active", "Active",
- "If the pad is currently active", FALSE,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-}
-
-static void
-gst_selector_pad_init (GstSelectorPad * pad)
-{
- gst_selector_pad_reset (pad);
-}
-
-static void
-gst_selector_pad_finalize (GObject * object)
-{
- GstSelectorPad *pad;
-
- pad = GST_SELECTOR_PAD_CAST (object);
-
- if (pad->tags)
- gst_tag_list_free (pad->tags);
-
- G_OBJECT_CLASS (selector_pad_parent_class)->finalize (object);
-}
-
-static void
-gst_selector_pad_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- GstSelectorPad *pad;
-
- pad = GST_SELECTOR_PAD (object);
-
- switch (prop_id) {
- case PROP_PAD_TAGS:
- GST_OBJECT_LOCK (object);
- g_value_set_boxed (value, pad->tags);
- GST_OBJECT_UNLOCK (object);
- break;
- case PROP_PAD_ACTIVE:
- {
- GstStreamSelector *sel;
-
- sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
- g_value_set_boolean (value, gst_stream_selector_is_active_sinkpad (sel,
- GST_PAD_CAST (pad)));
- gst_object_unref (sel);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_selector_pad_reset (GstSelectorPad * pad)
-{
- pad->active = FALSE;
- pad->eos = FALSE;
- gst_segment_init (&pad->segment, GST_FORMAT_UNDEFINED);
-}
-
-static gboolean
-gst_selector_pad_event (GstPad * pad, GstEvent * event)
-{
- gboolean res = TRUE;
- gboolean forward = TRUE;
- GstStreamSelector *sel;
- GstSelectorPad *selpad;
- GstPad *active_sinkpad;
-
- sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
- selpad = GST_SELECTOR_PAD_CAST (pad);
-
- /* only forward if we are dealing with the active sinkpad */
- active_sinkpad = gst_stream_selector_activate_sinkpad (sel, pad);
- forward = (active_sinkpad == pad);
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_STOP:
- gst_selector_pad_reset (selpad);
- break;
- case GST_EVENT_NEWSEGMENT:
- {
- gboolean update;
- GstFormat format;
- gdouble rate, arate;
- gint64 start, stop, time;
-
- gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
- &start, &stop, &time);
-
- GST_DEBUG_OBJECT (selpad,
- "configured NEWSEGMENT update %d, rate %lf, applied rate %lf, "
- "format %d, "
- "%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
- G_GINT64_FORMAT, update, rate, arate, format, start, stop, time);
-
- gst_segment_set_newsegment_full (&selpad->segment, update,
- rate, arate, format, start, stop, time);
- /* if we are not going to forward the segment, mark the segment as
- * pending */
- if (!forward)
- selpad->segment_pending = TRUE;
- break;
- }
- case GST_EVENT_TAG:
- {
- GstTagList *tags;
-
- GST_OBJECT_LOCK (selpad);
- if (selpad->tags)
- gst_tag_list_free (selpad->tags);
- gst_event_parse_tag (event, &tags);
- if (tags)
- tags = gst_tag_list_copy (tags);
- selpad->tags = tags;
- GST_DEBUG_OBJECT (sel, "received tags %" GST_PTR_FORMAT, selpad->tags);
- GST_OBJECT_UNLOCK (selpad);
- break;
- }
- case GST_EVENT_EOS:
- selpad->eos = TRUE;
- break;
- default:
- break;
- }
- if (forward)
- res = gst_pad_push_event (sel->srcpad, event);
- else
- gst_event_unref (event);
-
- gst_object_unref (sel);
-
- return res;
-}
-
-static GstCaps *
-gst_selector_pad_getcaps (GstPad * pad)
-{
- GstStreamSelector *sel;
- GstCaps *caps;
-
- sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
-
- GST_DEBUG_OBJECT (sel, "Getting caps of srcpad peer");
- caps = gst_pad_peer_get_caps (sel->srcpad);
- if (caps == NULL)
- caps = gst_caps_new_any ();
-
- gst_object_unref (sel);
-
- return caps;
-}
-
-static GstFlowReturn
-gst_selector_pad_bufferalloc (GstPad * pad, guint64 offset,
- guint size, GstCaps * caps, GstBuffer ** buf)
-{
- GstStreamSelector *sel;
- GstFlowReturn result;
- GstPad *active_sinkpad;
-
- sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
-
- active_sinkpad = gst_stream_selector_activate_sinkpad (sel, pad);
-
- /* Fallback allocation for buffers from pads except the selected one */
- if (pad != active_sinkpad) {
- GST_DEBUG_OBJECT (sel,
- "Pad %s:%s is not selected. Performing fallback allocation",
- GST_DEBUG_PAD_NAME (pad));
-
- *buf = NULL;
- result = GST_FLOW_OK;
- } else {
- result = gst_pad_alloc_buffer (sel->srcpad, offset, size, caps, buf);
-
- /* FIXME: HACK. If buffer alloc returns not-linked, perform a fallback
- * allocation. This should NOT be necessary, because playbin should
- * properly block the source pad from running until it's finished hooking
- * everything up, but playbin needs refactoring first. */
- if (result == GST_FLOW_NOT_LINKED) {
- GST_DEBUG_OBJECT (sel,
- "No peer pad yet - performing fallback allocation for pad %s:%s",
- GST_DEBUG_PAD_NAME (pad));
-
- *buf = NULL;
- result = GST_FLOW_OK;
- }
- }
-
- gst_object_unref (sel);
-
- return result;
-}
-
-static GstFlowReturn
-gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
-{
- GstStreamSelector *sel;
- GstFlowReturn res;
- GstPad *active_sinkpad;
- GstSelectorPad *selpad;
- GstClockTime timestamp;
- GstSegment *seg;
-
- sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
- selpad = GST_SELECTOR_PAD_CAST (pad);
- seg = &selpad->segment;
-
- active_sinkpad = gst_stream_selector_activate_sinkpad (sel, pad);
-
- timestamp = GST_BUFFER_TIMESTAMP (buf);
- if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
- GST_DEBUG_OBJECT (sel, "received timestamp %" GST_TIME_FORMAT,
- GST_TIME_ARGS (timestamp));
- gst_segment_set_last_stop (seg, seg->format, timestamp);
- }
-
- /* Ignore buffers from pads except the selected one */
- if (pad != active_sinkpad)
- goto ignore;
-
- /* if we have a pending segment, push it out now */
- if (selpad->segment_pending) {
- gst_pad_push_event (sel->srcpad, gst_event_new_new_segment_full (FALSE,
- seg->rate, seg->applied_rate, seg->format, seg->start, seg->stop,
- seg->time));
-
- selpad->segment_pending = FALSE;
- }
-
- /* forward */
- GST_DEBUG_OBJECT (sel, "Forwarding buffer %p from pad %s:%s", buf,
- GST_DEBUG_PAD_NAME (pad));
- res = gst_pad_push (sel->srcpad, buf);
-done:
- gst_object_unref (sel);
- return res;
- /* dropped buffers */
-ignore:
- {
- GST_DEBUG_OBJECT (sel, "Ignoring buffer %p from pad %s:%s",
- buf, GST_DEBUG_PAD_NAME (pad));
- gst_buffer_unref (buf);
- res = GST_FLOW_NOT_LINKED;
- goto done;
- }
-}
-
-static void gst_stream_selector_dispose (GObject * object);
-
-static void gst_stream_selector_init (GstStreamSelector * sel);
-static void gst_stream_selector_base_init (GstStreamSelectorClass * klass);
-static void gst_stream_selector_class_init (GstStreamSelectorClass * klass);
-
-static void gst_stream_selector_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_stream_selector_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static GstPad *gst_stream_selector_request_new_pad (GstElement * element,
- GstPadTemplate * templ, const gchar * unused);
-static void gst_stream_selector_release_pad (GstElement * element,
- GstPad * pad);
-static GstIterator *gst_stream_selector_pad_iterate_linked_pads (GstPad * pad);
-static GstCaps *gst_stream_selector_getcaps (GstPad * pad);
-
-static GstElementClass *parent_class = NULL;
-
-GType
-gst_stream_selector_get_type (void)
-{
- static GType stream_selector_type = 0;
-
- if (!stream_selector_type) {
- static const GTypeInfo stream_selector_info = {
- sizeof (GstStreamSelectorClass),
- (GBaseInitFunc) gst_stream_selector_base_init,
- NULL,
- (GClassInitFunc) gst_stream_selector_class_init,
- NULL,
- NULL,
- sizeof (GstStreamSelector),
- 0,
- (GInstanceInitFunc) gst_stream_selector_init,
- };
- stream_selector_type =
- g_type_register_static (GST_TYPE_ELEMENT,
- "GstStreamSelector", &stream_selector_info, 0);
- GST_DEBUG_CATEGORY_INIT (stream_selector_debug,
- "streamselector", 0, "A stream-selector element");
- }
-
- return stream_selector_type;
-}
-
-static void
-gst_stream_selector_base_init (GstStreamSelectorClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_set_details (element_class, &gst_stream_selector_details);
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_stream_selector_sink_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_stream_selector_src_factory));
-}
-
-static void
-gst_stream_selector_class_init (GstStreamSelectorClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->dispose = gst_stream_selector_dispose;
-
- gobject_class->set_property = gst_stream_selector_set_property;
- gobject_class->get_property = gst_stream_selector_get_property;
-
- g_object_class_install_property (gobject_class, PROP_N_PADS,
- g_param_spec_uint ("n-pads", "Number of Pads",
- "The number of sink pads", 0, G_MAXUINT, 0,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_ACTIVE_PAD,
- g_param_spec_object ("active-pad", "Active Pad",
- "The currently active sink pad", GST_TYPE_PAD,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstelement_class->request_new_pad = gst_stream_selector_request_new_pad;
- gstelement_class->release_pad = gst_stream_selector_release_pad;
-}
-
-static void
-gst_stream_selector_init (GstStreamSelector * sel)
-{
- sel->srcpad = gst_pad_new ("src", GST_PAD_SRC);
- gst_pad_set_iterate_internal_links_function (sel->srcpad,
- GST_DEBUG_FUNCPTR (gst_stream_selector_pad_iterate_linked_pads));
- gst_pad_set_getcaps_function (sel->srcpad,
- GST_DEBUG_FUNCPTR (gst_stream_selector_getcaps));
- gst_element_add_pad (GST_ELEMENT (sel), sel->srcpad);
- /* sinkpad management */
- sel->padcount = 0;
- sel->active_sinkpad = NULL;
- gst_segment_init (&sel->segment, GST_FORMAT_UNDEFINED);
-}
-
-static void
-gst_stream_selector_dispose (GObject * object)
-{
- GstStreamSelector *sel = GST_STREAM_SELECTOR (object);
-
- if (sel->active_sinkpad) {
- gst_object_unref (sel->active_sinkpad);
- sel->active_sinkpad = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_stream_selector_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstStreamSelector *sel = GST_STREAM_SELECTOR (object);
-
- switch (prop_id) {
- case PROP_ACTIVE_PAD:
- {
- GstPad *pad = NULL;
- GstPad **active_pad_p;
-
- pad = g_value_get_object (value);
-
- GST_OBJECT_LOCK (object);
- if (pad != sel->active_sinkpad) {
- GstSelectorPad *selpad;
-
- selpad = GST_SELECTOR_PAD_CAST (pad);
- /* we can only activate pads that have data received */
- if (selpad && !selpad->active) {
- GST_DEBUG_OBJECT (sel, "No data received on pad %" GST_PTR_FORMAT,
- pad);
- } else {
- active_pad_p = &sel->active_sinkpad;
- gst_object_replace ((GstObject **) active_pad_p,
- GST_OBJECT_CAST (pad));
- GST_DEBUG_OBJECT (sel, "New active pad is %" GST_PTR_FORMAT,
- sel->active_sinkpad);
- }
- }
- GST_OBJECT_UNLOCK (object);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_stream_selector_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstStreamSelector *sel = GST_STREAM_SELECTOR (object);
-
- switch (prop_id) {
- case PROP_N_PADS:
- GST_OBJECT_LOCK (object);
- g_value_set_uint (value, sel->n_pads);
- GST_OBJECT_UNLOCK (object);
- break;
- case PROP_ACTIVE_PAD:{
- GST_OBJECT_LOCK (object);
- g_value_set_object (value, sel->active_sinkpad);
- GST_OBJECT_UNLOCK (object);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstPad *
-gst_stream_selector_get_linked_pad (GstPad * pad, gboolean strict)
-{
- GstStreamSelector *sel;
- GstPad *otherpad = NULL;
-
- sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
-
- GST_OBJECT_LOCK (sel);
- if (pad == sel->srcpad)
- otherpad = sel->active_sinkpad;
- else if (pad == sel->active_sinkpad || !strict)
- otherpad = sel->srcpad;
- if (otherpad)
- gst_object_ref (otherpad);
- GST_OBJECT_UNLOCK (sel);
- gst_object_unref (sel);
- return otherpad;
-}
-
-static GstCaps *
-gst_stream_selector_getcaps (GstPad * pad)
-{
- GstPad *otherpad;
- GstObject *parent;
- GstCaps *caps;
-
- otherpad = gst_stream_selector_get_linked_pad (pad, FALSE);
- parent = gst_object_get_parent (GST_OBJECT (pad));
- if (!otherpad) {
- GST_DEBUG_OBJECT (parent,
- "Pad %s:%s not linked, returning ANY", GST_DEBUG_PAD_NAME (pad));
- caps = gst_caps_new_any ();
- } else {
- GST_DEBUG_OBJECT (parent,
- "Pad %s:%s is linked (to %s:%s), returning peer caps",
- GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (otherpad));
- /* if the peer has caps, use those. If the pad is not linked, this function
- * returns NULL and we return ANY */
- if (!(caps = gst_pad_peer_get_caps (otherpad)))
- caps = gst_caps_new_any ();
- gst_object_unref (otherpad);
- }
-
- gst_object_unref (parent);
- return caps;
-}
-
-/* check if the pad is the active sinkpad */
-static gboolean
-gst_stream_selector_is_active_sinkpad (GstStreamSelector * sel, GstPad * pad)
-{
- gboolean res;
-
- GST_OBJECT_LOCK (sel);
- res = (pad == sel->active_sinkpad);
- GST_OBJECT_UNLOCK (sel);
-
- return res;
-}
-
-/* Get or create the active sinkpad */
-static GstPad *
-gst_stream_selector_activate_sinkpad (GstStreamSelector * sel, GstPad * pad)
-{
- GstPad *active_sinkpad;
- GstSelectorPad *selpad;
-
- selpad = GST_SELECTOR_PAD_CAST (pad);
-
- GST_OBJECT_LOCK (sel);
- selpad->active = TRUE;
- active_sinkpad = sel->active_sinkpad;
- if (active_sinkpad == NULL) {
- /* first pad we get an alloc on becomes the activated pad by default */
- active_sinkpad = sel->active_sinkpad = gst_object_ref (pad);
- GST_DEBUG_OBJECT (sel, "Activating pad %s:%s", GST_DEBUG_PAD_NAME (pad));
- }
- GST_OBJECT_UNLOCK (sel);
-
- return active_sinkpad;
-}
-
-static GstIterator *
-gst_stream_selector_pad_iterate_linked_pads (GstPad * pad)
-{
- GstStreamSelector *sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
- GstPad *otherpad;
- GstIterator *ret;
-
- otherpad = gst_stream_selector_get_linked_pad (pad, TRUE);
- ret =
- gst_iterator_new_single (GST_TYPE_PAD, otherpad,
- (GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref);
-
- if (otherpad)
- gst_object_unref (otherpad);
- gst_object_unref (sel);
-
- return ret;
-}
-
-static GstPad *
-gst_stream_selector_request_new_pad (GstElement * element,
- GstPadTemplate * templ, const gchar * unused)
-{
- GstStreamSelector *sel;
- gchar *name = NULL;
- GstPad *sinkpad = NULL;
-
- sel = GST_STREAM_SELECTOR (element);
- g_return_val_if_fail (templ->direction == GST_PAD_SINK, NULL);
- GST_LOG_OBJECT (sel, "Creating new pad %d", sel->padcount);
- GST_OBJECT_LOCK (sel);
- name = g_strdup_printf ("sink%d", sel->padcount++);
- sinkpad = g_object_new (GST_TYPE_SELECTOR_PAD,
- "name", name, "direction", templ->direction, "template", templ, NULL);
- g_free (name);
- sel->n_pads++;
- GST_OBJECT_UNLOCK (sel);
-
- gst_pad_set_event_function (sinkpad,
- GST_DEBUG_FUNCPTR (gst_selector_pad_event));
- gst_pad_set_getcaps_function (sinkpad,
- GST_DEBUG_FUNCPTR (gst_selector_pad_getcaps));
- gst_pad_set_chain_function (sinkpad,
- GST_DEBUG_FUNCPTR (gst_selector_pad_chain));
- gst_pad_set_iterate_internal_links_function (sinkpad,
- GST_DEBUG_FUNCPTR (gst_stream_selector_pad_iterate_linked_pads));
- gst_pad_set_bufferalloc_function (sinkpad,
- GST_DEBUG_FUNCPTR (gst_selector_pad_bufferalloc));
-
- gst_pad_set_active (sinkpad, TRUE);
- gst_element_add_pad (GST_ELEMENT (sel), sinkpad);
- return sinkpad;
-}
-
-static void
-gst_stream_selector_release_pad (GstElement * element, GstPad * pad)
-{
- GstStreamSelector *sel;
-
- sel = GST_STREAM_SELECTOR (element);
- GST_LOG_OBJECT (sel, "Releasing pad %s:%s", GST_DEBUG_PAD_NAME (pad));
-
- GST_OBJECT_LOCK (sel);
- /* if the pad was the active pad, makes us select a new one */
- if (sel->active_sinkpad == pad) {
- GST_DEBUG_OBJECT (sel, "Deactivating pad %s:%s", GST_DEBUG_PAD_NAME (pad));
- sel->active_sinkpad = NULL;
- }
- sel->n_pads--;
- GST_OBJECT_UNLOCK (sel);
-
- gst_pad_set_active (pad, FALSE);
- gst_element_remove_pad (GST_ELEMENT (sel), pad);
-}
diff --git a/gst/playback/gststreamselector.h b/gst/playback/gststreamselector.h
deleted file mode 100644
index 5200a0b0..00000000
--- a/gst/playback/gststreamselector.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
- * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_STREAM_SELECTOR_H__
-#define __GST_STREAM_SELECTOR_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_STREAM_SELECTOR \
- (gst_stream_selector_get_type())
-#define GST_STREAM_SELECTOR(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_STREAM_SELECTOR, GstStreamSelector))
-#define GST_STREAM_SELECTOR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_STREAM_SELECTOR, GstStreamSelectorClass))
-#define GST_IS_STREAM_SELECTOR(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_STREAM_SELECTOR))
-#define GST_IS_STREAM_SELECTOR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_STREAM_SELECTOR))
-
-typedef struct _GstStreamSelector GstStreamSelector;
-typedef struct _GstStreamSelectorClass GstStreamSelectorClass;
-
-struct _GstStreamSelector {
- GstElement element;
-
- GstPad *srcpad;
-
- GstPad *active_sinkpad;
- guint n_pads;
- guint padcount;
-
- GstSegment segment;
-};
-
-struct _GstStreamSelectorClass {
- GstElementClass parent_class;
-};
-
-GType gst_stream_selector_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_STREAM_SELECTOR_H__ */
diff --git a/gst/playback/gstsubtitleoverlay.c b/gst/playback/gstsubtitleoverlay.c
deleted file mode 100644
index 98fe15d8..00000000
--- a/gst/playback/gstsubtitleoverlay.c
+++ /dev/null
@@ -1,2140 +0,0 @@
-/*
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-subtitleoverlay
- *
- * #GstBin that auto-magically overlays a video stream with subtitles by
- * autoplugging the required elements.
- *
- * It supports raw, timestamped text, different textual subtitle formats and
- * DVD subpicture subtitles.
- *
- * <refsect2>
- * <title>Examples</title>
- * |[
- * gst-launch -v filesrc location=test.mkv ! matroskademux name=demux ! "video/x-h264" ! queue2 ! decodebin2 ! subtitleoverlay name=overlay ! ffmpegcolorspace ! autovideosink demux. ! "video/x-dvd-subpicture" ! queue2 ! overlay.
- * ]| This will play back the given Matroska file with h264 video and subpicture subtitles.
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstsubtitleoverlay.h"
-
-#include <gst/gstfilter.h>
-#include <gst/pbutils/missing-plugins.h>
-#include <gst/video/video.h>
-#include <string.h>
-
-GST_DEBUG_CATEGORY_STATIC (subtitle_overlay_debug);
-#define GST_CAT_DEFAULT subtitle_overlay_debug
-
-#define IS_SUBTITLE_CHAIN_IGNORE_ERROR(flow) \
- G_UNLIKELY (flow == GST_FLOW_ERROR || flow == GST_FLOW_NOT_NEGOTIATED)
-
-#define IS_VIDEO_CHAIN_IGNORE_ERROR(flow) \
- G_UNLIKELY (flow == GST_FLOW_ERROR)
-
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-static GstStaticPadTemplate video_sinktemplate =
-GST_STATIC_PAD_TEMPLATE ("video_sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-static GstStaticPadTemplate subtitle_sinktemplate =
-GST_STATIC_PAD_TEMPLATE ("subtitle_sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-enum
-{
- PROP_0,
- PROP_SILENT,
- PROP_FONT_DESC,
- PROP_SUBTITLE_ENCODING
-};
-
-GST_BOILERPLATE (GstSubtitleOverlay, gst_subtitle_overlay, GstBin,
- GST_TYPE_BIN);
-
-static void _pad_blocked_cb (GstPad * pad, gboolean blocked,
- gpointer user_data);
-
-static GQuark _subtitle_overlay_event_marker_id = 0;
-
-static void
-do_async_start (GstSubtitleOverlay * self)
-{
- if (!self->do_async) {
- GstMessage *msg =
- gst_message_new_async_start (GST_OBJECT_CAST (self), FALSE);
-
- GST_DEBUG_OBJECT (self, "Posting async-start");
- parent_class->handle_message (GST_BIN_CAST (self), msg);
- self->do_async = TRUE;
- }
-}
-
-static void
-do_async_done (GstSubtitleOverlay * self)
-{
- if (self->do_async) {
- GstMessage *msg = gst_message_new_async_done (GST_OBJECT_CAST (self));
-
- GST_DEBUG_OBJECT (self, "Posting async-done");
- parent_class->handle_message (GST_BIN_CAST (self), msg);
- self->do_async = FALSE;
- }
-}
-
-static void
-gst_subtitle_overlay_finalize (GObject * object)
-{
- GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (object);
-
- if (self->lock) {
- g_mutex_free (self->lock);
- self->lock = NULL;
- }
-
- if (self->factories_lock) {
- g_mutex_free (self->factories_lock);
- self->factories_lock = NULL;
- }
-
- if (self->factories)
- gst_plugin_feature_list_free (self->factories);
- self->factories = NULL;
- gst_caps_replace (&self->factory_caps, NULL);
-
- if (self->font_desc) {
- g_free (self->font_desc);
- self->font_desc = NULL;
- }
-
- if (self->encoding) {
- g_free (self->encoding);
- self->encoding = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static gboolean
-_is_renderer (GstElementFactory * factory)
-{
- const gchar *klass, *name;
-
- klass = gst_element_factory_get_klass (factory);
- name = gst_plugin_feature_get_name (GST_PLUGIN_FEATURE_CAST (factory));
-
- if (strstr (klass, "Overlay/Subtitle") != NULL ||
- strstr (klass, "Overlay/SubPicture") != NULL)
- return TRUE;
- if (strcmp (name, "textoverlay") == 0)
- return TRUE;
- return FALSE;
-}
-
-static gboolean
-_is_parser (GstElementFactory * factory)
-{
- const gchar *klass;
-
- klass = gst_element_factory_get_klass (factory);
-
- if (strstr (klass, "Parser/Subtitle") != NULL)
- return TRUE;
- return FALSE;
-}
-
-static const gchar *_sub_pad_names[] = { "subpicture", "subpicture_sink",
- "text", "text_sink",
- "subtitle_sink", "subtitle"
-};
-
-static GstCaps *
-_get_sub_caps (GstElementFactory * factory)
-{
- const GList *templates;
- GList *walk;
- gboolean is_parser = _is_parser (factory);
-
- templates = gst_element_factory_get_static_pad_templates (factory);
- for (walk = (GList *) templates; walk; walk = g_list_next (walk)) {
- GstStaticPadTemplate *templ = walk->data;
-
- if (templ->direction == GST_PAD_SINK && templ->presence == GST_PAD_ALWAYS) {
- gboolean found = FALSE;
-
- if (is_parser) {
- found = TRUE;
- } else {
- guint i;
-
- for (i = 0; i < G_N_ELEMENTS (_sub_pad_names); i++) {
- if (strcmp (templ->name_template, _sub_pad_names[i]) == 0) {
- found = TRUE;
- break;
- }
- }
- }
- if (found)
- return gst_static_caps_get (&templ->static_caps);
- }
- }
- return NULL;
-}
-
-static gboolean
-_factory_filter (GstPluginFeature * feature, GstCaps ** subcaps)
-{
- GstElementFactory *factory;
- guint rank;
- const gchar *name;
- const GList *templates;
- GList *walk;
- gboolean is_renderer;
- GstCaps *templ_caps = NULL;
- gboolean have_video_sink = FALSE;
-
- /* we only care about element factories */
- if (!GST_IS_ELEMENT_FACTORY (feature))
- return FALSE;
-
- factory = GST_ELEMENT_FACTORY_CAST (feature);
-
- /* only select elements with autoplugging rank or textoverlay */
- name = gst_plugin_feature_get_name (feature);
- rank = gst_plugin_feature_get_rank (feature);
- if (strcmp ("textoverlay", name) != 0 && rank < GST_RANK_MARGINAL)
- return FALSE;
-
- /* Check if it's a renderer or a parser */
- if (_is_renderer (factory)) {
- is_renderer = TRUE;
- } else if (_is_parser (factory)) {
- is_renderer = FALSE;
- } else {
- return FALSE;
- }
-
- /* Check if there's a video sink in case of a renderer */
- if (is_renderer) {
- templates = gst_element_factory_get_static_pad_templates (factory);
- for (walk = (GList *) templates; walk; walk = g_list_next (walk)) {
- GstStaticPadTemplate *templ = walk->data;
-
- /* we only care about the always-sink templates */
- if (templ->direction == GST_PAD_SINK && templ->presence == GST_PAD_ALWAYS) {
- if (strcmp (templ->name_template, "video") == 0 ||
- strcmp (templ->name_template, "video_sink") == 0) {
- have_video_sink = TRUE;
- }
- }
- }
- }
- templ_caps = _get_sub_caps (factory);
-
- if (is_renderer && have_video_sink && templ_caps) {
- GstCaps *tmp;
-
- GST_DEBUG ("Found renderer element %s (%s) with caps %" GST_PTR_FORMAT,
- gst_element_factory_get_longname (factory),
- gst_plugin_feature_get_name (feature), templ_caps);
- tmp = gst_caps_union (*subcaps, templ_caps);
- gst_caps_unref (templ_caps);
- gst_caps_replace (subcaps, tmp);
- gst_caps_unref (tmp);
- return TRUE;
- } else if (!is_renderer && !have_video_sink && templ_caps) {
- GstCaps *tmp;
-
- GST_DEBUG ("Found parser element %s (%s) with caps %" GST_PTR_FORMAT,
- gst_element_factory_get_longname (factory),
- gst_plugin_feature_get_name (feature), templ_caps);
- tmp = gst_caps_union (*subcaps, templ_caps);
- gst_caps_unref (templ_caps);
- gst_caps_replace (subcaps, tmp);
- gst_caps_unref (tmp);
- return TRUE;
- } else {
- if (templ_caps)
- gst_caps_unref (templ_caps);
- return FALSE;
- }
-}
-
-/* Call with factories_lock! */
-static gboolean
-gst_subtitle_overlay_update_factory_list (GstSubtitleOverlay * self)
-{
- if (!self->factories
- || self->factories_cookie !=
- gst_default_registry_get_feature_list_cookie ()) {
- GstCaps *subcaps;
- GList *factories;
-
- subcaps = gst_caps_new_empty ();
-
- factories = gst_default_registry_feature_filter (
- (GstPluginFeatureFilter) _factory_filter, FALSE, &subcaps);
- GST_DEBUG_OBJECT (self, "Created factory caps: %" GST_PTR_FORMAT, subcaps);
- gst_caps_replace (&self->factory_caps, subcaps);
- gst_caps_unref (subcaps);
- if (self->factories)
- gst_plugin_feature_list_free (self->factories);
- self->factories = factories;
- self->factories_cookie = gst_default_registry_get_feature_list_cookie ();
- }
-
- return (self->factories != NULL);
-}
-
-G_LOCK_DEFINE_STATIC (_factory_caps);
-static GstCaps *_factory_caps = NULL;
-static guint32 _factory_caps_cookie = 0;
-
-GstCaps *
-gst_subtitle_overlay_create_factory_caps (void)
-{
- GList *factories;
- GstCaps *subcaps = NULL;
-
- G_LOCK (_factory_caps);
- if (!_factory_caps
- || _factory_caps_cookie !=
- gst_default_registry_get_feature_list_cookie ()) {
- if (_factory_caps)
- gst_caps_unref (_factory_caps);
- _factory_caps = gst_caps_new_empty ();
-
- factories = gst_default_registry_feature_filter (
- (GstPluginFeatureFilter) _factory_filter, FALSE, &_factory_caps);
- GST_DEBUG ("Created factory caps: %" GST_PTR_FORMAT, _factory_caps);
- gst_plugin_feature_list_free (factories);
- _factory_caps_cookie = gst_default_registry_get_feature_list_cookie ();
- }
- subcaps = gst_caps_ref (_factory_caps);
- G_UNLOCK (_factory_caps);
-
- return subcaps;
-}
-
-static gboolean
-_filter_factories_for_caps (GstElementFactory * factory, const GstCaps * caps)
-{
- GstCaps *fcaps = _get_sub_caps (factory);
- gboolean ret = (fcaps) ? gst_caps_can_intersect (fcaps, caps) : FALSE;
-
- if (fcaps)
- gst_caps_unref (fcaps);
-
- if (ret)
- gst_object_ref (factory);
- return ret;
-}
-
-static gint
-_sort_by_ranks (GstPluginFeature * f1, GstPluginFeature * f2)
-{
- gint diff;
- const gchar *rname1, *rname2;
-
- diff = gst_plugin_feature_get_rank (f2) - gst_plugin_feature_get_rank (f1);
- if (diff != 0)
- return diff;
-
- /* If the ranks are the same sort by name to get deterministic results */
- rname1 = gst_plugin_feature_get_name (f1);
- rname2 = gst_plugin_feature_get_name (f2);
-
- diff = strcmp (rname1, rname2);
-
- return diff;
-}
-
-static GstPad *
-_get_sub_pad (GstElement * element)
-{
- GstPad *pad;
- guint i;
-
- for (i = 0; i < G_N_ELEMENTS (_sub_pad_names); i++) {
- pad = gst_element_get_static_pad (element, _sub_pad_names[i]);
- if (pad)
- return pad;
- }
- return NULL;
-}
-
-static GstPad *
-_get_video_pad (GstElement * element)
-{
- static const gchar *pad_names[] = { "video", "video_sink" };
- GstPad *pad;
- guint i;
-
- for (i = 0; i < G_N_ELEMENTS (pad_names); i++) {
- pad = gst_element_get_static_pad (element, pad_names[i]);
- if (pad)
- return pad;
- }
- return NULL;
-}
-
-static gboolean
-_create_element (GstSubtitleOverlay * self, GstElement ** element,
- const gchar * factory_name, GstElementFactory * factory,
- const gchar * element_name, gboolean mandatory)
-{
- GstElement *elt;
-
- g_assert (!factory || !factory_name);
-
- if (factory_name) {
- elt = gst_element_factory_make (factory_name, element_name);
- } else {
- factory_name =
- gst_plugin_feature_get_name (GST_PLUGIN_FEATURE_CAST (factory));
- elt = gst_element_factory_create (factory, element_name);
- }
-
- if (G_UNLIKELY (!elt)) {
- if (!factory) {
- GstMessage *msg;
-
- msg =
- gst_missing_element_message_new (GST_ELEMENT_CAST (self),
- factory_name);
- gst_element_post_message (GST_ELEMENT_CAST (self), msg);
-
- if (mandatory)
- GST_ELEMENT_ERROR (self, CORE, MISSING_PLUGIN, (NULL),
- ("no '%s' plugin found", factory_name));
- else
- GST_ELEMENT_WARNING (self, CORE, MISSING_PLUGIN, (NULL),
- ("no '%s' plugin found", factory_name));
- } else {
- if (mandatory) {
- GST_ELEMENT_ERROR (self, CORE, FAILED, (NULL),
- ("can't instantiate '%s'", factory_name));
- } else {
- GST_ELEMENT_WARNING (self, CORE, FAILED, (NULL),
- ("can't instantiate '%s'", factory_name));
- }
- }
-
- return FALSE;
- }
-
- if (G_UNLIKELY (gst_element_set_state (elt,
- GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS)) {
- gst_object_unref (elt);
- if (mandatory) {
- GST_ELEMENT_ERROR (self, CORE, STATE_CHANGE, (NULL),
- ("failed to set '%s' to READY", factory_name));
- } else {
- GST_WARNING_OBJECT (self, "Failed to set '%s' to READY", factory_name);
- }
- return FALSE;
- }
-
- if (G_UNLIKELY (!gst_bin_add (GST_BIN_CAST (self), gst_object_ref (elt)))) {
- gst_element_set_state (elt, GST_STATE_NULL);
- gst_object_unref (elt);
- if (mandatory) {
- GST_ELEMENT_ERROR (self, CORE, FAILED, (NULL),
- ("failed to add '%s' to subtitleoverlay", factory_name));
- } else {
- GST_WARNING_OBJECT (self, "Failed to add '%s' to subtitleoverlay",
- factory_name);
- }
- return FALSE;
- }
-
- gst_element_sync_state_with_parent (elt);
- *element = elt;
- return TRUE;
-}
-
-static void
-_remove_element (GstSubtitleOverlay * self, GstElement ** element)
-{
- if (*element) {
- gst_bin_remove (GST_BIN_CAST (self), *element);
- gst_element_set_state (*element, GST_STATE_NULL);
- gst_object_unref (*element);
- *element = NULL;
- }
-}
-
-static void
-_generate_update_newsegment_event (GstSegment * segment, GstEvent ** event1,
- GstEvent ** event2)
-{
- GstEvent *event;
-
- *event1 = NULL;
- *event2 = NULL;
-
- event = gst_event_new_new_segment_full (FALSE, segment->rate,
- segment->applied_rate, segment->format, 0, segment->accum, 0);
- gst_structure_id_set (event->structure, _subtitle_overlay_event_marker_id,
- G_TYPE_BOOLEAN, TRUE, NULL);
- *event1 = event;
-
- event = gst_event_new_new_segment_full (FALSE, segment->rate,
- segment->applied_rate, segment->format,
- segment->start, segment->stop, segment->time);
- gst_structure_id_set (event->structure, _subtitle_overlay_event_marker_id,
- G_TYPE_BOOLEAN, TRUE, NULL);
- *event2 = event;
-}
-
-static gboolean
-_setup_passthrough (GstSubtitleOverlay * self)
-{
- GstPad *src, *sink;
- GstElement *identity;
-
- GST_DEBUG_OBJECT (self, "Doing video passthrough");
-
- if (self->passthrough_identity) {
- GST_DEBUG_OBJECT (self, "Already in passthrough mode");
- goto out;
- }
-
- /* Unlink & destroy everything */
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->srcpad), NULL);
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->video_sinkpad), NULL);
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->subtitle_sinkpad), NULL);
- self->silent_property = NULL;
- _remove_element (self, &self->post_colorspace);
- _remove_element (self, &self->overlay);
- _remove_element (self, &self->parser);
- _remove_element (self, &self->renderer);
- _remove_element (self, &self->pre_colorspace);
- _remove_element (self, &self->passthrough_identity);
-
- if (G_UNLIKELY (!_create_element (self, &self->passthrough_identity,
- "identity", NULL, "passthrough-identity", TRUE))) {
- return FALSE;
- }
-
- identity = self->passthrough_identity;
- g_object_set (G_OBJECT (identity), "silent", TRUE, "signal-handoffs", FALSE,
- NULL);
-
- /* Set src ghostpad target */
- src = gst_element_get_static_pad (self->passthrough_identity, "src");
- if (G_UNLIKELY (!src)) {
- GST_ELEMENT_ERROR (self, CORE, PAD, (NULL),
- ("Failed to get srcpad from identity"));
- return FALSE;
- }
-
- if (G_UNLIKELY (!gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->srcpad),
- src))) {
- GST_ELEMENT_ERROR (self, CORE, PAD, (NULL),
- ("Failed to set srcpad target"));
- gst_object_unref (src);
- return FALSE;
- }
- gst_object_unref (src);
-
- sink = gst_element_get_static_pad (self->passthrough_identity, "sink");
- if (G_UNLIKELY (!sink)) {
- GST_ELEMENT_ERROR (self, CORE, PAD, (NULL),
- ("Failed to get sinkpad from identity"));
- return FALSE;
- }
-
- /* Send segment to the identity. This is dropped because identity
- * is not linked downstream yet */
- if (self->video_segment.format != GST_FORMAT_UNDEFINED) {
- GstEvent *event1, *event2;
-
- _generate_update_newsegment_event (&self->video_segment, &event1, &event2);
- GST_DEBUG_OBJECT (self,
- "Pushing video accumulate newsegment event: %" GST_PTR_FORMAT,
- event1->structure);
- GST_DEBUG_OBJECT (self,
- "Pushing video update newsegment event: %" GST_PTR_FORMAT,
- event2->structure);
- gst_pad_send_event (sink, event1);
- gst_pad_send_event (sink, event2);
- }
-
- /* Link sink ghostpads to identity */
- if (G_UNLIKELY (!gst_ghost_pad_set_target (GST_GHOST_PAD_CAST
- (self->video_sinkpad), sink))) {
- GST_ELEMENT_ERROR (self, CORE, PAD, (NULL),
- ("Failed to set video sinkpad target"));
- gst_object_unref (sink);
- return FALSE;
- }
- gst_object_unref (sink);
-
- GST_DEBUG_OBJECT (self, "Video passthrough setup successfully");
-
-out:
- /* Unblock pads */
- gst_pad_set_blocked_async_full (self->video_block_pad, FALSE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
-
- if (self->subtitle_sink_blocked)
- gst_pad_set_blocked_async_full (self->subtitle_block_pad, FALSE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
-
- return TRUE;
-}
-
-/* Must be called with subtitleoverlay lock! */
-static void
-gst_subtitle_overlay_set_fps (GstSubtitleOverlay * self)
-{
- GObjectClass *gobject_class;
- GParamSpec *pspec;
-
- if (!self->parser || self->fps_d == 0)
- return;
-
- gobject_class = G_OBJECT_GET_CLASS (self->parser);
- pspec = g_object_class_find_property (gobject_class, "video-fps");
- if (!pspec || pspec->value_type != GST_TYPE_FRACTION)
- return;
-
- GST_DEBUG_OBJECT (self, "Updating video-fps property in parser");
- g_object_set (self->parser, "video-fps", self->fps_n, self->fps_d, NULL);
-}
-
-static const gchar *
-_get_silent_property (GstElement * element, gboolean * invert)
-{
- static const struct
- {
- const gchar *name;
- gboolean invert;
- } properties[] = { {
- "silent", FALSE}, {
- "enable", TRUE}};
- GObjectClass *gobject_class;
- GParamSpec *pspec;
- guint i;
-
- gobject_class = G_OBJECT_GET_CLASS (element);
-
- for (i = 0; i < G_N_ELEMENTS (properties); i++) {
- pspec = g_object_class_find_property (gobject_class, properties[i].name);
- if (pspec && pspec->value_type == G_TYPE_BOOLEAN) {
- *invert = properties[i].invert;
- return properties[i].name;
- }
- }
- return NULL;
-}
-
-static gboolean
-_has_subtitle_encoding_property (GstElement * element)
-{
- GParamSpec *pspec;
-
- pspec =
- g_object_class_find_property (G_OBJECT_GET_CLASS (element),
- "subtitle-encoding");
- return (pspec && pspec->value_type == G_TYPE_STRING);
-}
-
-static gboolean
-_has_font_desc_property (GstElement * element)
-{
- GParamSpec *pspec;
-
- pspec =
- g_object_class_find_property (G_OBJECT_GET_CLASS (element), "font-desc");
- return (pspec && pspec->value_type == G_TYPE_STRING);
-}
-
-static void
-_pad_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
-{
- GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY_CAST (user_data);
- GstCaps *subcaps;
- GList *l, *factories = NULL;
-
- GST_DEBUG_OBJECT (pad, "Pad blocked: %d", blocked);
-
- GST_SUBTITLE_OVERLAY_LOCK (self);
- if (pad == self->video_block_pad)
- self->video_sink_blocked = blocked;
- else if (pad == self->subtitle_block_pad)
- self->subtitle_sink_blocked = blocked;
-
- if (!blocked) {
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
- return;
- }
-
- /* Now either both or the video sink are blocked */
-
- /* Get current subtitle caps */
- subcaps = self->subcaps;
- if (!subcaps) {
- GstPad *peer;
-
- peer = gst_pad_get_peer (self->subtitle_sinkpad);
- if (peer) {
- subcaps = gst_pad_get_negotiated_caps (peer);
- if (!subcaps) {
- subcaps = gst_pad_get_caps_reffed (peer);
- if (!gst_caps_is_fixed (subcaps)) {
- gst_caps_unref (subcaps);
- subcaps = NULL;
- }
- }
- gst_object_unref (peer);
- }
- gst_caps_replace (&self->subcaps, subcaps);
- if (subcaps)
- gst_caps_unref (subcaps);
- }
- GST_DEBUG_OBJECT (self, "Current subtitle caps: %" GST_PTR_FORMAT, subcaps);
-
- /* If there are no subcaps but the subtitle sink is blocked upstream
- * must behave wrong as there are no fixed caps set for the first
- * buffer or in-order event */
- if (G_UNLIKELY (!subcaps && self->subtitle_sink_blocked)) {
- GST_ELEMENT_WARNING (self, CORE, NEGOTIATION, (NULL),
- ("Subtitle sink is blocked but we have no subtitle caps"));
- subcaps = NULL;
- }
-
- if (self->subtitle_error || (self->silent && !self->silent_property)) {
- _setup_passthrough (self);
- do_async_done (self);
- goto out;
- }
-
- /* Now do something with the caps */
- if (subcaps && !self->subtitle_flush) {
- GstPad *target =
- gst_ghost_pad_get_target (GST_GHOST_PAD_CAST (self->subtitle_sinkpad));
-
- if (target && gst_pad_accept_caps (target, subcaps)) {
- GST_DEBUG_OBJECT (pad, "Target accepts caps");
-
- gst_object_unref (target);
-
- /* Unblock pads */
- gst_pad_set_blocked_async_full (self->video_block_pad, FALSE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
-
- if (self->subtitle_sink_blocked)
- gst_pad_set_blocked_async_full (self->subtitle_block_pad, FALSE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
- goto out;
- } else if (target) {
- gst_object_unref (target);
- }
- }
-
- if (self->subtitle_sink_blocked && !self->video_sink_blocked) {
- GST_DEBUG_OBJECT (self, "Subtitle sink blocked but video not blocked");
- gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
- goto out;
- }
-
- self->subtitle_flush = FALSE;
-
- /* Find our factories */
- g_mutex_lock (self->factories_lock);
- gst_subtitle_overlay_update_factory_list (self);
- if (subcaps) {
- factories = gst_filter_run (self->factories,
- (GstFilterFunc) _filter_factories_for_caps, FALSE, subcaps);
- if (!factories) {
- GstMessage *msg;
-
- msg = gst_missing_decoder_message_new (GST_ELEMENT_CAST (self), subcaps);
- gst_element_post_message (GST_ELEMENT_CAST (self), msg);
- GST_ELEMENT_WARNING (self, CORE, MISSING_PLUGIN, (NULL),
- ("no suitable subtitle plugin found"));
- subcaps = NULL;
- self->subtitle_error = TRUE;
- }
- }
- g_mutex_unlock (self->factories_lock);
-
- if (!subcaps) {
- _setup_passthrough (self);
- do_async_done (self);
- goto out;
- }
-
- /* Now the interesting parts are done: subtitle overlaying! */
-
- /* Sort the factories by rank */
- factories = g_list_sort (factories, (GCompareFunc) _sort_by_ranks);
-
- for (l = factories; l; l = l->next) {
- GstElementFactory *factory = l->data;
- gboolean is_renderer = _is_renderer (factory);
- GstElement *element;
- GstPad *sink, *src;
-
- /* Unlink & destroy everything */
-
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->srcpad), NULL);
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->video_sinkpad), NULL);
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->subtitle_sinkpad),
- NULL);
- self->silent_property = NULL;
- _remove_element (self, &self->post_colorspace);
- _remove_element (self, &self->overlay);
- _remove_element (self, &self->parser);
- _remove_element (self, &self->renderer);
- _remove_element (self, &self->pre_colorspace);
- _remove_element (self, &self->passthrough_identity);
-
- GST_DEBUG_OBJECT (self, "Trying factory '%s'",
- GST_STR_NULL (gst_plugin_feature_get_name (GST_PLUGIN_FEATURE_CAST
- (factory))));
-
- if (G_UNLIKELY ((is_renderer
- && !_create_element (self, &self->renderer, NULL, factory,
- "renderer", FALSE)) || (!is_renderer
- && !_create_element (self, &self->parser, NULL, factory,
- "parser", FALSE))))
- continue;
-
- element = is_renderer ? self->renderer : self->parser;
-
- /* If this is a parser, create textoverlay and link video and the parser to it
- * Else link the renderer to the output colorspace */
- if (!is_renderer) {
- GstElement *overlay;
- GstPad *video_peer;
-
- /* Try to get the latest video framerate */
- video_peer = gst_pad_get_peer (self->video_sinkpad);
- if (video_peer) {
- GstCaps *video_caps;
- gint fps_n, fps_d;
-
- video_caps = gst_pad_get_negotiated_caps (video_peer);
- if (!video_caps) {
- video_caps = gst_pad_get_caps_reffed (video_peer);
- if (!gst_caps_is_fixed (video_caps)) {
- gst_caps_unref (video_caps);
- video_caps = NULL;
- }
- }
-
- if (video_caps
- && gst_video_parse_caps_framerate (video_caps, &fps_n, &fps_d)) {
- if (self->fps_n != fps_n || self->fps_d != fps_d) {
- GST_DEBUG_OBJECT (self, "New video fps: %d/%d", fps_n, fps_d);
- self->fps_n = fps_n;
- self->fps_d = fps_d;
- }
- }
-
- if (video_caps)
- gst_caps_unref (video_caps);
- gst_object_unref (video_peer);
- }
-
- if (_has_subtitle_encoding_property (self->parser))
- g_object_set (self->parser, "subtitle-encoding", self->encoding, NULL);
-
- /* Try to set video fps on the parser */
- gst_subtitle_overlay_set_fps (self);
-
- /* First link everything internally */
- if (G_UNLIKELY (!_create_element (self, &self->overlay, "textoverlay",
- NULL, "overlay", FALSE))) {
- continue;
- }
- overlay = self->overlay;
- self->silent_property = "silent";
- self->silent_property_invert = FALSE;
-
- /* Set some properties */
- g_object_set (G_OBJECT (overlay),
- "halign", "center", "valign", "bottom", "wait-text", FALSE, NULL);
- if (self->font_desc)
- g_object_set (G_OBJECT (overlay), "font-desc", self->font_desc, NULL);
-
- src = gst_element_get_static_pad (element, "src");
- if (G_UNLIKELY (!src)) {
- continue;
- }
-
- sink = gst_element_get_static_pad (overlay, "text_sink");
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Can't get text sink from textoverlay");
- gst_object_unref (src);
- continue;
- }
-
- if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
- GST_WARNING_OBJECT (self, "Can't link parser to textoverlay");
- gst_object_unref (sink);
- gst_object_unref (src);
- continue;
- }
- gst_object_unref (sink);
- gst_object_unref (src);
-
- if (G_UNLIKELY (!_create_element (self, &self->post_colorspace,
- "ffmpegcolorspace", NULL, "post-colorspace", FALSE))) {
- continue;
- }
-
- src = gst_element_get_static_pad (overlay, "src");
- if (G_UNLIKELY (!src)) {
- GST_WARNING_OBJECT (self, "Can't get src pad from overlay");
- continue;
- }
-
- sink = gst_element_get_static_pad (self->post_colorspace, "sink");
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace");
- gst_object_unref (src);
- continue;
- }
-
- if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
- GST_WARNING_OBJECT (self, "Can't link overlay with ffmpegcolorspace");
- gst_object_unref (src);
- gst_object_unref (sink);
- continue;
- }
- gst_object_unref (src);
- gst_object_unref (sink);
-
- if (G_UNLIKELY (!_create_element (self, &self->pre_colorspace,
- "ffmpegcolorspace", NULL, "pre-colorspace", FALSE))) {
- continue;
- }
-
- sink = gst_element_get_static_pad (overlay, "video_sink");
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Can't get video sink from textoverlay");
- continue;
- }
-
- src = gst_element_get_static_pad (self->pre_colorspace, "src");
- if (G_UNLIKELY (!src)) {
- GST_WARNING_OBJECT (self, "Can't get srcpad from ffmpegcolorspace");
- gst_object_unref (sink);
- continue;
- }
-
- if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
- GST_WARNING_OBJECT (self, "Can't link ffmpegcolorspace to textoverlay");
- gst_object_unref (src);
- gst_object_unref (sink);
- continue;
- }
- gst_object_unref (src);
- gst_object_unref (sink);
-
- /* Set src ghostpad target */
- src = gst_element_get_static_pad (self->post_colorspace, "src");
- if (G_UNLIKELY (!src)) {
- GST_WARNING_OBJECT (self, "Can't get src pad from ffmpegcolorspace");
- continue;
- }
-
- if (G_UNLIKELY (!gst_ghost_pad_set_target (GST_GHOST_PAD_CAST
- (self->srcpad), src))) {
- GST_WARNING_OBJECT (self, "Can't set srcpad target");
- gst_object_unref (src);
- continue;
- }
- gst_object_unref (src);
-
- /* Send segments to the parser/overlay if necessary. These are not sent
- * outside this element because of the proxy pad event function */
- if (self->video_segment.format != GST_FORMAT_UNDEFINED) {
- GstEvent *event1, *event2;
-
- sink = gst_element_get_static_pad (self->pre_colorspace, "sink");
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace");
- continue;
- }
-
- _generate_update_newsegment_event (&self->video_segment, &event1,
- &event2);
- GST_DEBUG_OBJECT (self,
- "Pushing video accumulate newsegment event: %" GST_PTR_FORMAT,
- event1->structure);
- GST_DEBUG_OBJECT (self,
- "Pushing video update newsegment event: %" GST_PTR_FORMAT,
- event2->structure);
- gst_pad_send_event (sink, event1);
- gst_pad_send_event (sink, event2);
-
- gst_object_unref (sink);
- }
-
- if (self->subtitle_segment.format != GST_FORMAT_UNDEFINED) {
- GstEvent *event1, *event2;
-
- sink = gst_element_get_static_pad (element, "sink");
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Failed to get subpad");
- continue;
- }
-
- _generate_update_newsegment_event (&self->subtitle_segment, &event1,
- &event2);
- GST_DEBUG_OBJECT (self,
- "Pushing subtitle accumulate newsegment event: %" GST_PTR_FORMAT,
- event1->structure);
- GST_DEBUG_OBJECT (self,
- "Pushing subtitle update newsegment event: %" GST_PTR_FORMAT,
- event2->structure);
- gst_pad_send_event (sink, event1);
- gst_pad_send_event (sink, event2);
-
- gst_object_unref (sink);
- }
-
- /* Set the sink ghostpad targets */
- sink = gst_element_get_static_pad (self->pre_colorspace, "sink");
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace");
- continue;
- }
-
- if (G_UNLIKELY (!gst_ghost_pad_set_target (GST_GHOST_PAD_CAST
- (self->video_sinkpad), sink))) {
- GST_WARNING_OBJECT (self, "Can't set video sinkpad target");
- gst_object_unref (sink);
- continue;
- }
- gst_object_unref (sink);
-
- /* Link subtitle identity to subtitle pad of our element */
- sink = gst_element_get_static_pad (element, "sink");
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Failed to get subpad");
- continue;
- }
-
- if (G_UNLIKELY (!gst_ghost_pad_set_target (GST_GHOST_PAD_CAST
- (self->subtitle_sinkpad), sink))) {
- GST_WARNING_OBJECT (self, "Failed to set subtitle sink target");
- gst_object_unref (sink);
- continue;
- }
- gst_object_unref (sink);
- } else {
- const gchar *name =
- gst_plugin_feature_get_name (GST_PLUGIN_FEATURE_CAST (factory));
-
- if (strcmp (name, "textoverlay") == 0) {
- /* Set some textoverlay specific properties */
- g_object_set (G_OBJECT (element),
- "halign", "center", "valign", "bottom", "wait-text", FALSE, NULL);
- if (self->font_desc)
- g_object_set (G_OBJECT (element), "font-desc", self->font_desc, NULL);
- self->silent_property = "silent";
- self->silent_property_invert = FALSE;
- } else {
- self->silent_property =
- _get_silent_property (element, &self->silent_property_invert);
- if (_has_subtitle_encoding_property (self->renderer))
- g_object_set (self->renderer, "subtitle-encoding", self->encoding,
- NULL);
- if (_has_font_desc_property (self->renderer))
- g_object_set (self->renderer, "font-desc", self->font_desc, NULL);
- }
-
- /* First link everything internally */
- if (G_UNLIKELY (!_create_element (self, &self->post_colorspace,
- "ffmpegcolorspace", NULL, "post-colorspace", FALSE))) {
- continue;
- }
-
- src = gst_element_get_static_pad (element, "src");
- if (G_UNLIKELY (!src)) {
- GST_WARNING_OBJECT (self, "Can't get src pad from renderer");
- continue;
- }
-
- sink = gst_element_get_static_pad (self->post_colorspace, "sink");
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace");
- gst_object_unref (src);
- continue;
- }
-
- if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
- GST_WARNING_OBJECT (self, "Can't link renderer with ffmpegcolorspace");
- gst_object_unref (src);
- gst_object_unref (sink);
- continue;
- }
- gst_object_unref (src);
- gst_object_unref (sink);
-
- if (G_UNLIKELY (!_create_element (self, &self->pre_colorspace,
- "ffmpegcolorspace", NULL, "pre-colorspace", FALSE))) {
- continue;
- }
-
- sink = _get_video_pad (element);
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Can't get video sink from renderer");
- continue;
- }
-
- src = gst_element_get_static_pad (self->pre_colorspace, "src");
- if (G_UNLIKELY (!src)) {
- GST_WARNING_OBJECT (self, "Can't get srcpad from ffmpegcolorspace");
- gst_object_unref (sink);
- continue;
- }
-
- if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
- GST_WARNING_OBJECT (self, "Can't link ffmpegcolorspace to renderer");
- gst_object_unref (src);
- gst_object_unref (sink);
- continue;
- }
- gst_object_unref (src);
- gst_object_unref (sink);
-
- /* Set src ghostpad target */
- src = gst_element_get_static_pad (self->post_colorspace, "src");
- if (G_UNLIKELY (!src)) {
- GST_WARNING_OBJECT (self, "Can't get src pad from ffmpegcolorspace");
- continue;
- }
-
- if (G_UNLIKELY (!gst_ghost_pad_set_target (GST_GHOST_PAD_CAST
- (self->srcpad), src))) {
- GST_WARNING_OBJECT (self, "Can't set srcpad target");
- gst_object_unref (src);
- continue;
- }
- gst_object_unref (src);
-
- /* Send segments to the renderer if necessary. These are not sent
- * outside this element because of the proxy pad event handler */
- if (self->video_segment.format != GST_FORMAT_UNDEFINED) {
- GstEvent *event1, *event2;
-
- sink = gst_element_get_static_pad (self->pre_colorspace, "sink");
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace");
- continue;
- }
-
- _generate_update_newsegment_event (&self->video_segment, &event1,
- &event2);
- GST_DEBUG_OBJECT (self,
- "Pushing video accumulate newsegment event: %" GST_PTR_FORMAT,
- event1->structure);
- GST_DEBUG_OBJECT (self,
- "Pushing video update newsegment event: %" GST_PTR_FORMAT,
- event2->structure);
- gst_pad_send_event (sink, event1);
- gst_pad_send_event (sink, event2);
- gst_object_unref (sink);
- }
-
- if (self->subtitle_segment.format != GST_FORMAT_UNDEFINED) {
- GstEvent *event1, *event2;
-
- sink = _get_sub_pad (element);
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Failed to get subpad");
- continue;
- }
-
- _generate_update_newsegment_event (&self->subtitle_segment, &event1,
- &event2);
- GST_DEBUG_OBJECT (self,
- "Pushing subtitle accumulate newsegment event: %" GST_PTR_FORMAT,
- event1->structure);
- GST_DEBUG_OBJECT (self,
- "Pushing subtitle update newsegment event: %" GST_PTR_FORMAT,
- event2->structure);
- gst_pad_send_event (sink, event1);
- gst_pad_send_event (sink, event2);
- gst_object_unref (sink);
- }
-
- /* Set the sink ghostpad targets */
- sink = gst_element_get_static_pad (self->pre_colorspace, "sink");
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Can't get sink pad from ffmpegcolorspace");
- continue;
- }
-
- if (G_UNLIKELY (!gst_ghost_pad_set_target (GST_GHOST_PAD_CAST
- (self->video_sinkpad), sink))) {
- GST_WARNING_OBJECT (self, "Can't set video sinkpad target");
- gst_object_unref (sink);
- continue;
- }
- gst_object_unref (sink);
-
- sink = _get_sub_pad (element);
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Failed to get subpad");
- continue;
- }
-
- if (G_UNLIKELY (!gst_ghost_pad_set_target (GST_GHOST_PAD_CAST
- (self->subtitle_sinkpad), sink))) {
- GST_WARNING_OBJECT (self, "Failed to set subtitle sink target");
- gst_object_unref (sink);
- continue;
- }
- gst_object_unref (sink);
- }
-
- break;
- }
-
- if (G_UNLIKELY (l == NULL)) {
- GST_ELEMENT_WARNING (self, CORE, FAILED, (NULL),
- ("Failed to find any usable factories"));
- self->subtitle_error = TRUE;
- _setup_passthrough (self);
- do_async_done (self);
- } else {
- GST_DEBUG_OBJECT (self, "Everything worked, unblocking pads");
- gst_pad_set_blocked_async_full (self->video_block_pad, FALSE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
- gst_pad_set_blocked_async_full (self->subtitle_block_pad, FALSE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
- do_async_done (self);
- }
-
-out:
- if (factories)
- gst_plugin_feature_list_free (factories);
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
-}
-
-static GstStateChangeReturn
-gst_subtitle_overlay_change_state (GstElement * element,
- GstStateChange transition)
-{
- GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (element);
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- GST_DEBUG_OBJECT (self, "State change NULL->READY");
- g_mutex_lock (self->factories_lock);
- if (G_UNLIKELY (!gst_subtitle_overlay_update_factory_list (self))) {
- g_mutex_unlock (self->factories_lock);
- return GST_STATE_CHANGE_FAILURE;
- }
- g_mutex_unlock (self->factories_lock);
-
- GST_SUBTITLE_OVERLAY_LOCK (self);
- /* Set the internal pads to blocking */
- gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
- gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- GST_DEBUG_OBJECT (self, "State change READY->PAUSED");
- gst_segment_init (&self->video_segment, GST_FORMAT_UNDEFINED);
- gst_segment_init (&self->subtitle_segment, GST_FORMAT_UNDEFINED);
-
- self->fps_n = self->fps_d = 0;
-
- self->subtitle_flush = FALSE;
- self->subtitle_error = FALSE;
-
- self->downstream_chain_error = FALSE;
-
- do_async_start (self);
- ret = GST_STATE_CHANGE_ASYNC;
-
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- GST_DEBUG_OBJECT (self, "State change PAUSED->PLAYING");
- default:
- break;
- }
-
- {
- GstStateChangeReturn bret;
-
- bret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- GST_DEBUG_OBJECT (self, "Base class state changed returned: %d", bret);
- if (G_UNLIKELY (bret == GST_STATE_CHANGE_FAILURE))
- return ret;
- else if (bret == GST_STATE_CHANGE_ASYNC)
- ret = bret;
- else if (G_UNLIKELY (bret == GST_STATE_CHANGE_NO_PREROLL)) {
- do_async_done (self);
- ret = bret;
- }
- }
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- GST_DEBUG_OBJECT (self, "State change PLAYING->PAUSED");
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- GST_DEBUG_OBJECT (self, "State change PAUSED->READY");
- do_async_done (self);
-
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:{
- GstPad *pad;
-
- GST_DEBUG_OBJECT (self, "State change READY->NULL");
-
- GST_SUBTITLE_OVERLAY_LOCK (self);
- gst_caps_replace (&self->subcaps, NULL);
-
- /* Unlink ghost pads */
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->srcpad), NULL);
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->video_sinkpad), NULL);
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->subtitle_sinkpad),
- NULL);
-
- /* Unblock pads */
- if (self->video_block_pad) {
- pad = self->video_block_pad;
- gst_pad_set_blocked_async_full (pad, FALSE, _pad_blocked_cb,
- gst_object_ref (self), (GDestroyNotify) gst_object_unref);
- }
-
- if (self->subtitle_block_pad) {
- pad = self->subtitle_block_pad;
- gst_pad_set_blocked_async_full (pad, FALSE, _pad_blocked_cb,
- gst_object_ref (self), (GDestroyNotify) gst_object_unref);
- }
-
- /* Remove elements */
- self->silent_property = NULL;
- _remove_element (self, &self->post_colorspace);
- _remove_element (self, &self->overlay);
- _remove_element (self, &self->parser);
- _remove_element (self, &self->renderer);
- _remove_element (self, &self->pre_colorspace);
- _remove_element (self, &self->passthrough_identity);
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
-
- break;
- }
- default:
- break;
- }
-
- return ret;
-}
-
-static void
-gst_subtitle_overlay_handle_message (GstBin * bin, GstMessage * message)
-{
- GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY_CAST (bin);
-
- if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR) {
- GstObject *src = GST_MESSAGE_SRC (message);
-
- /* Convert error messages from the subtitle pipeline to
- * warnings and switch to passthrough mode */
- if (src && (
- (self->overlay
- && gst_object_has_ancestor (src,
- GST_OBJECT_CAST (self->overlay))) || (self->parser
- && gst_object_has_ancestor (src,
- GST_OBJECT_CAST (self->parser))) || (self->renderer
- && gst_object_has_ancestor (src,
- GST_OBJECT_CAST (self->renderer))))) {
- GError *err = NULL;
- gchar *debug = NULL;
- GstMessage *wmsg;
-
- gst_message_parse_error (message, &err, &debug);
- GST_DEBUG_OBJECT (self,
- "Got error message from subtitle element %s: %s (%s)",
- GST_MESSAGE_SRC_NAME (message), GST_STR_NULL (err->message),
- GST_STR_NULL (debug));
-
- wmsg = gst_message_new_warning (src, err, debug);
- gst_message_unref (message);
- g_error_free (err);
- g_free (debug);
- message = wmsg;
-
- GST_SUBTITLE_OVERLAY_LOCK (self);
- self->subtitle_error = TRUE;
-
- gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
-
- gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
- }
- }
-
- GST_BIN_CLASS (parent_class)->handle_message (bin, message);
-}
-
-static void
-gst_subtitle_overlay_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY_CAST (object);
-
- switch (prop_id) {
- case PROP_SILENT:
- g_value_set_boolean (value, self->silent);
- break;
- case PROP_FONT_DESC:
- GST_SUBTITLE_OVERLAY_LOCK (self);
- g_value_set_string (value, self->font_desc);
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
- break;
- case PROP_SUBTITLE_ENCODING:
- GST_SUBTITLE_OVERLAY_LOCK (self);
- g_value_set_string (value, self->encoding);
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_subtitle_overlay_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY_CAST (object);
-
- switch (prop_id) {
- case PROP_SILENT:
- GST_SUBTITLE_OVERLAY_LOCK (self);
- self->silent = g_value_get_boolean (value);
- if (self->silent_property) {
- gboolean silent = self->silent;
-
- if (self->silent_property_invert)
- silent = !silent;
-
- if (self->overlay)
- g_object_set (self->overlay, self->silent_property, silent, NULL);
- else if (self->renderer)
- g_object_set (self->renderer, self->silent_property, silent, NULL);
- } else {
- gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
-
- gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
- }
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
- break;
- case PROP_FONT_DESC:
- GST_SUBTITLE_OVERLAY_LOCK (self);
- g_free (self->font_desc);
- self->font_desc = g_value_dup_string (value);
- if (self->overlay)
- g_object_set (self->overlay, "font-desc", self->font_desc, NULL);
- else if (self->renderer && _has_font_desc_property (self->renderer))
- g_object_set (self->renderer, "font-desc", self->font_desc, NULL);
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
- break;
- case PROP_SUBTITLE_ENCODING:
- GST_SUBTITLE_OVERLAY_LOCK (self);
- g_free (self->encoding);
- self->encoding = g_value_dup_string (value);
- if (self->renderer && _has_subtitle_encoding_property (self->renderer))
- g_object_set (self->renderer, "subtitle-encoding", self->encoding,
- NULL);
- if (self->parser && _has_subtitle_encoding_property (self->parser))
- g_object_set (self->parser, "subtitle-encoding", self->encoding, NULL);
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_subtitle_overlay_base_init (gpointer g_class)
-{
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&srctemplate));
-
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&video_sinktemplate));
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&subtitle_sinktemplate));
-
- gst_element_class_set_details_simple (gstelement_class, "Subtitle Overlay",
- "Video/Overlay/Subtitle",
- "Overlays a video stream with subtitles",
- "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
-}
-
-static void
-gst_subtitle_overlay_class_init (GstSubtitleOverlayClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
- GstElementClass *element_class = (GstElementClass *) klass;
- GstBinClass *bin_class = (GstBinClass *) klass;
-
- gobject_class->finalize = gst_subtitle_overlay_finalize;
- gobject_class->set_property = gst_subtitle_overlay_set_property;
- gobject_class->get_property = gst_subtitle_overlay_get_property;
-
- g_object_class_install_property (gobject_class, PROP_SILENT,
- g_param_spec_boolean ("silent",
- "Silent",
- "Whether to show subtitles", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_FONT_DESC,
- g_param_spec_string ("font-desc",
- "Subtitle font description",
- "Pango font description of font "
- "to be used for subtitle rendering", NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SUBTITLE_ENCODING,
- g_param_spec_string ("subtitle-encoding", "subtitle encoding",
- "Encoding to assume if input subtitles are not in UTF-8 encoding. "
- "If not set, the GST_SUBTITLE_ENCODING environment variable will "
- "be checked for an encoding to use. If that is not set either, "
- "ISO-8859-15 will be assumed.", NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- element_class->change_state =
- GST_DEBUG_FUNCPTR (gst_subtitle_overlay_change_state);
-
- bin_class->handle_message =
- GST_DEBUG_FUNCPTR (gst_subtitle_overlay_handle_message);
-}
-
-static GstFlowReturn
-gst_subtitle_overlay_src_proxy_chain (GstPad * proxypad, GstBuffer * buffer)
-{
- GstPad *ghostpad;
- GstSubtitleOverlay *self;
- GstFlowReturn ret;
-
- ghostpad = GST_PAD_CAST (gst_pad_get_parent (proxypad));
- if (G_UNLIKELY (!ghostpad)) {
- gst_buffer_unref (buffer);
- return GST_FLOW_ERROR;
- }
- self = GST_SUBTITLE_OVERLAY_CAST (gst_pad_get_parent (ghostpad));
- if (G_UNLIKELY (!self || self->srcpad != ghostpad)) {
- gst_buffer_unref (buffer);
- gst_object_unref (ghostpad);
- return GST_FLOW_ERROR;
- }
-
- ret = self->src_proxy_chain (proxypad, buffer);
-
- if (IS_VIDEO_CHAIN_IGNORE_ERROR (ret)) {
- GST_ERROR_OBJECT (self, "Downstream chain error: %s",
- gst_flow_get_name (ret));
- self->downstream_chain_error = TRUE;
- }
-
- gst_object_unref (self);
- gst_object_unref (ghostpad);
-
- return ret;
-}
-
-static gboolean
-gst_subtitle_overlay_src_proxy_event (GstPad * proxypad, GstEvent * event)
-{
- GstPad *ghostpad = NULL;
- GstSubtitleOverlay *self = NULL;
- gboolean ret = FALSE;
- const GstStructure *s;
-
- ghostpad = GST_PAD_CAST (gst_pad_get_parent (proxypad));
- if (G_UNLIKELY (!ghostpad))
- goto out;
- self = GST_SUBTITLE_OVERLAY_CAST (gst_pad_get_parent (ghostpad));
- if (G_UNLIKELY (!self || self->srcpad != ghostpad))
- goto out;
-
- s = gst_event_get_structure (event);
- if (s && gst_structure_id_has_field (s, _subtitle_overlay_event_marker_id)) {
- GST_DEBUG_OBJECT (ghostpad, "Dropping event with marker: %" GST_PTR_FORMAT,
- event->structure);
- gst_event_unref (event);
- event = NULL;
- ret = TRUE;
- } else {
- ret = self->src_proxy_event (proxypad, event);
- event = NULL;
- }
-
-out:
- if (event)
- gst_event_unref (event);
- if (self)
- gst_object_unref (self);
- if (ghostpad)
- gst_object_unref (ghostpad);
- return ret;
-}
-
-static gboolean
-gst_subtitle_overlay_video_sink_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad));
- gboolean ret = TRUE;
- gint fps_n, fps_d;
-
- GST_DEBUG_OBJECT (pad, "Setting caps: %" GST_PTR_FORMAT, caps);
-
- if (!gst_video_parse_caps_framerate (caps, &fps_n, &fps_d)) {
- GST_ERROR_OBJECT (pad, "Failed to parse framerate from caps");
- ret = FALSE;
- goto out;
- }
-
- GST_SUBTITLE_OVERLAY_LOCK (self);
- if (self->fps_n != fps_n || self->fps_d != fps_d) {
- GST_DEBUG_OBJECT (self, "New video fps: %d/%d", fps_n, fps_d);
- self->fps_n = fps_n;
- self->fps_d = fps_d;
- gst_subtitle_overlay_set_fps (self);
- }
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
-
- ret = self->video_sink_setcaps (pad, caps);
-
-out:
- gst_object_unref (self);
- return ret;
-}
-
-static gboolean
-gst_subtitle_overlay_video_sink_event (GstPad * pad, GstEvent * event)
-{
- GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad));
- gboolean ret;
-
- if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP) {
- GST_DEBUG_OBJECT (pad,
- "Resetting video segment because of flush-stop event");
- gst_segment_init (&self->video_segment, GST_FORMAT_UNDEFINED);
- self->fps_n = self->fps_d = 0;
- }
-
- ret = self->video_sink_event (pad, gst_event_ref (event));
-
- if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
- gboolean update;
- gdouble rate, applied_rate;
- GstFormat format;
- gint64 start, stop, position;
-
- GST_DEBUG_OBJECT (pad, "Newsegment event: %" GST_PTR_FORMAT,
- event->structure);
- gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
- &format, &start, &stop, &position);
-
- if (format != GST_FORMAT_TIME) {
- GST_ERROR_OBJECT (pad, "Newsegment event in non-time format: %s",
- gst_format_get_name (format));
- gst_object_unref (event);
- gst_object_unref (self);
- return FALSE;
- }
-
- GST_DEBUG_OBJECT (pad, "Old video segment: %" GST_SEGMENT_FORMAT,
- &self->video_segment);
- gst_segment_set_newsegment_full (&self->video_segment, update, rate,
- applied_rate, format, start, stop, position);
- GST_DEBUG_OBJECT (pad, "New video segment: %" GST_SEGMENT_FORMAT,
- &self->video_segment);
- }
-
- gst_event_unref (event);
- gst_object_unref (self);
- return ret;
-}
-
-static GstFlowReturn
-gst_subtitle_overlay_video_sink_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (GST_PAD_PARENT (pad));
- GstFlowReturn ret = self->video_sink_chain (pad, buffer);
-
- if (G_UNLIKELY (self->downstream_chain_error) || self->passthrough_identity) {
- return ret;
- } else if (IS_VIDEO_CHAIN_IGNORE_ERROR (ret)) {
- GST_DEBUG_OBJECT (self, "Subtitle renderer produced chain error: %s",
- gst_flow_get_name (ret));
- GST_SUBTITLE_OVERLAY_LOCK (self);
- self->subtitle_error = TRUE;
- gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
-
- gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
-
- return GST_FLOW_OK;
- }
-
- return ret;
-}
-
-static GstFlowReturn
-gst_subtitle_overlay_subtitle_sink_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (GST_PAD_PARENT (pad));
-
- if (self->subtitle_error) {
- gst_buffer_unref (buffer);
- return GST_FLOW_OK;
- } else {
- GstFlowReturn ret = self->subtitle_sink_chain (pad, buffer);
-
- if (IS_SUBTITLE_CHAIN_IGNORE_ERROR (ret)) {
- GST_DEBUG_OBJECT (self, "Subtitle chain error: %s",
- gst_flow_get_name (ret));
- GST_SUBTITLE_OVERLAY_LOCK (self);
- self->subtitle_error = TRUE;
- gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
-
- gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
-
- return GST_FLOW_OK;
- }
-
- return ret;
- }
-}
-
-static GstCaps *
-gst_subtitle_overlay_subtitle_sink_getcaps (GstPad * pad)
-{
- GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad));
- GstCaps *ret;
-
- g_mutex_lock (self->factories_lock);
- if (G_UNLIKELY (!gst_subtitle_overlay_update_factory_list (self)))
- ret = GST_CAPS_NONE;
- else
- ret = gst_caps_ref (self->factory_caps);
- g_mutex_unlock (self->factories_lock);
-
- GST_DEBUG_OBJECT (pad, "Returning subtitle caps %" GST_PTR_FORMAT, ret);
-
- gst_object_unref (self);
-
- return ret;
-}
-
-static gboolean
-gst_subtitle_overlay_subtitle_sink_acceptcaps (GstPad * pad, GstCaps * caps)
-{
- GstCaps *othercaps = gst_subtitle_overlay_subtitle_sink_getcaps (pad);
- gboolean ret = gst_caps_can_intersect (caps, othercaps);
-
- gst_caps_unref (othercaps);
-
- return ret;
-}
-
-static gboolean
-gst_subtitle_overlay_subtitle_sink_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad));
- gboolean ret = TRUE;
- GstPad *target = NULL;;
-
- GST_DEBUG_OBJECT (pad, "Setting caps: %" GST_PTR_FORMAT, caps);
-
- target =
- gst_ghost_pad_get_target (GST_GHOST_PAD_CAST (self->subtitle_sinkpad));
-
- GST_SUBTITLE_OVERLAY_LOCK (self);
- gst_caps_replace (&self->subcaps, caps);
-
- if (target && gst_pad_accept_caps (target, caps)) {
- GST_DEBUG_OBJECT (pad, "Target accepts caps");
- ret = self->subtitle_sink_setcaps (pad, caps);
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
- goto out;
- }
-
- GST_DEBUG_OBJECT (pad, "Target did not accept caps");
-
- self->subtitle_error = FALSE;
-
- gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
-
- gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
-
-out:
- if (target)
- gst_object_unref (target);
- gst_object_unref (self);
- return ret;
-}
-
-static GstPadLinkReturn
-gst_subtitle_overlay_subtitle_sink_link (GstPad * pad, GstPad * peer)
-{
- GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad));
- GstPadLinkReturn ret;
- GstCaps *caps;
-
- GST_DEBUG_OBJECT (pad, "Linking pad to peer %" GST_PTR_FORMAT, peer);
-
- caps = gst_pad_get_negotiated_caps (peer);
- if (!caps) {
- caps = gst_pad_get_caps_reffed (peer);
- if (!gst_caps_is_fixed (caps)) {
- gst_caps_unref (caps);
- caps = NULL;
- }
- }
-
- if (caps) {
- GST_SUBTITLE_OVERLAY_LOCK (self);
- GST_DEBUG_OBJECT (pad, "Have fixed peer caps: %" GST_PTR_FORMAT, caps);
- gst_caps_replace (&self->subcaps, caps);
-
- self->subtitle_error = FALSE;
-
- gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
-
- gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
- gst_caps_unref (caps);
- }
-
- ret = self->subtitle_sink_link (pad, peer);
-
- gst_object_unref (self);
- return ret;
-}
-
-static void
-gst_subtitle_overlay_subtitle_sink_unlink (GstPad * pad)
-{
- GstSubtitleOverlay *self =
- GST_SUBTITLE_OVERLAY (gst_object_ref (GST_PAD_PARENT (pad)));
-
- /* FIXME: Can't use gst_pad_get_parent() here because this is called with
- * the object lock from state changes
- */
-
- GST_DEBUG_OBJECT (pad, "Pad unlinking");
- gst_caps_replace (&self->subcaps, NULL);
-
- self->subtitle_sink_unlink (pad);
-
- GST_SUBTITLE_OVERLAY_LOCK (self);
- self->subtitle_error = FALSE;
-
- if (self->subtitle_block_pad)
- gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
-
- if (self->video_block_pad)
- gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
-
- gst_object_unref (self);
-}
-
-static gboolean
-gst_subtitle_overlay_subtitle_sink_event (GstPad * pad, GstEvent * event)
-{
- GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad));
- gboolean ret;
- GstFormat format;
-
- if (GST_EVENT_TYPE (event) == GST_EVENT_CUSTOM_DOWNSTREAM_OOB &&
- event->structure
- && strcmp (gst_structure_get_name (event->structure),
- "subtitleoverlay-flush-subtitle") == 0) {
- GST_DEBUG_OBJECT (pad, "Custom subtitle flush event");
- GST_SUBTITLE_OVERLAY_LOCK (self);
- self->subtitle_flush = TRUE;
- self->subtitle_error = FALSE;
- if (self->subtitle_block_pad)
- gst_pad_set_blocked_async_full (self->subtitle_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
- if (self->video_block_pad)
- gst_pad_set_blocked_async_full (self->video_block_pad, TRUE,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
- GST_SUBTITLE_OVERLAY_UNLOCK (self);
-
- gst_event_unref (event);
- event = NULL;
- ret = TRUE;
- goto out;
- } else if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
- gst_event_parse_new_segment_full (event, NULL, NULL, NULL,
- &format, NULL, NULL, NULL);
- if (self->subtitle_segment.format != GST_FORMAT_UNDEFINED &&
- self->subtitle_segment.format != format) {
- GST_DEBUG_OBJECT (pad, "Subtitle segment format changed: %s -> %s",
- gst_format_get_name (self->subtitle_segment.format),
- gst_format_get_name (format));
- gst_segment_init (&self->subtitle_segment, GST_FORMAT_UNDEFINED);
- }
- }
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_STOP:
- GST_DEBUG_OBJECT (pad,
- "Resetting subtitle segment because of flush-stop");
- gst_segment_init (&self->subtitle_segment, GST_FORMAT_UNDEFINED);
- /* fall through */
- case GST_EVENT_FLUSH_START:
- case GST_EVENT_NEWSEGMENT:
- case GST_EVENT_EOS:
- /* Add our event marker to make sure no events from here go ever outside
- * the element, they're only interesting for our internal elements */
- event =
- GST_EVENT_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST
- (event)));
- if (!event->structure) {
- event->structure =
- gst_structure_id_empty_new (_subtitle_overlay_event_marker_id);
- gst_structure_set_parent_refcount (event->structure,
- &event->mini_object.refcount);
- }
- gst_structure_id_set (event->structure, _subtitle_overlay_event_marker_id,
- G_TYPE_BOOLEAN, TRUE, NULL);
- break;
- default:
- break;
- }
-
- ret = self->subtitle_sink_event (pad, gst_event_ref (event));
-
- if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
- gboolean update;
- gdouble rate, applied_rate;
- gint64 start, stop, position;
-
- GST_DEBUG_OBJECT (pad, "Newsegment event: %" GST_PTR_FORMAT,
- event->structure);
- gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
- &format, &start, &stop, &position);
-
- GST_DEBUG_OBJECT (pad, "Old subtitle segment: %" GST_SEGMENT_FORMAT,
- &self->subtitle_segment);
- if (self->subtitle_segment.format != format) {
- GST_DEBUG_OBJECT (pad, "Subtitle segment format changed: %s -> %s",
- gst_format_get_name (self->subtitle_segment.format),
- gst_format_get_name (format));
- gst_segment_init (&self->subtitle_segment, format);
- }
-
- gst_segment_set_newsegment_full (&self->subtitle_segment, update, rate,
- applied_rate, format, start, stop, position);
- GST_DEBUG_OBJECT (pad, "New subtitle segment: %" GST_SEGMENT_FORMAT,
- &self->subtitle_segment);
- }
- gst_event_unref (event);
-
-out:
- gst_object_unref (self);
- return ret;
-}
-
-static void
-gst_subtitle_overlay_init (GstSubtitleOverlay * self,
- GstSubtitleOverlayClass * klass)
-{
- GstPadTemplate *templ;
- GstIterator *it;
- GstPad *proxypad = NULL;
-
- self->lock = g_mutex_new ();
- self->factories_lock = g_mutex_new ();
-
- templ = gst_static_pad_template_get (&srctemplate);
- self->srcpad = gst_ghost_pad_new_no_target_from_template ("src", templ);
- it = gst_pad_iterate_internal_links (self->srcpad);
- if (G_UNLIKELY (!it
- || gst_iterator_next (it, (gpointer) & proxypad) != GST_ITERATOR_OK
- || proxypad == NULL)) {
- GST_ERROR_OBJECT (self, "Failed to get proxypad of srcpad");
- } else {
- self->src_proxy_event = GST_PAD_EVENTFUNC (proxypad);
- gst_pad_set_event_function (proxypad,
- GST_DEBUG_FUNCPTR (gst_subtitle_overlay_src_proxy_event));
- self->src_proxy_chain = GST_PAD_CHAINFUNC (proxypad);
- gst_pad_set_chain_function (proxypad,
- GST_DEBUG_FUNCPTR (gst_subtitle_overlay_src_proxy_chain));
- gst_object_unref (proxypad);
- }
- if (it)
- gst_iterator_free (it);
-
- gst_element_add_pad (GST_ELEMENT_CAST (self), self->srcpad);
-
- templ = gst_static_pad_template_get (&video_sinktemplate);
- self->video_sinkpad =
- gst_ghost_pad_new_no_target_from_template ("video_sink", templ);
- self->video_sink_event = GST_PAD_EVENTFUNC (self->video_sinkpad);
- gst_pad_set_event_function (self->video_sinkpad,
- GST_DEBUG_FUNCPTR (gst_subtitle_overlay_video_sink_event));
- self->video_sink_setcaps = GST_PAD_SETCAPSFUNC (self->video_sinkpad);
- gst_pad_set_setcaps_function (self->video_sinkpad,
- GST_DEBUG_FUNCPTR (gst_subtitle_overlay_video_sink_setcaps));
- self->video_sink_chain = GST_PAD_CHAINFUNC (self->video_sinkpad);
- gst_pad_set_chain_function (self->video_sinkpad,
- GST_DEBUG_FUNCPTR (gst_subtitle_overlay_video_sink_chain));
-
- proxypad = NULL;
- it = gst_pad_iterate_internal_links (self->video_sinkpad);
- if (G_UNLIKELY (!it
- || gst_iterator_next (it, (gpointer) & proxypad) != GST_ITERATOR_OK
- || proxypad == NULL)) {
- GST_ERROR_OBJECT (self,
- "Failed to get internally linked pad from video sinkpad");
- }
- if (it)
- gst_iterator_free (it);
- self->video_block_pad = proxypad;
- gst_element_add_pad (GST_ELEMENT_CAST (self), self->video_sinkpad);
-
- templ = gst_static_pad_template_get (&subtitle_sinktemplate);
- self->subtitle_sinkpad =
- gst_ghost_pad_new_no_target_from_template ("subtitle_sink", templ);
- self->subtitle_sink_link = GST_PAD_LINKFUNC (self->subtitle_sinkpad);
- gst_pad_set_link_function (self->subtitle_sinkpad,
- GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_link));
- self->subtitle_sink_unlink = GST_PAD_UNLINKFUNC (self->subtitle_sinkpad);
- gst_pad_set_unlink_function (self->subtitle_sinkpad,
- GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_unlink));
- self->subtitle_sink_event = GST_PAD_EVENTFUNC (self->subtitle_sinkpad);
- gst_pad_set_event_function (self->subtitle_sinkpad,
- GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_event));
- self->subtitle_sink_setcaps = GST_PAD_SETCAPSFUNC (self->subtitle_sinkpad);
- gst_pad_set_setcaps_function (self->subtitle_sinkpad,
- GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_setcaps));
- self->subtitle_sink_chain = GST_PAD_CHAINFUNC (self->subtitle_sinkpad);
- gst_pad_set_chain_function (self->subtitle_sinkpad,
- GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_chain));
- gst_pad_set_getcaps_function (self->subtitle_sinkpad,
- GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_getcaps));
- gst_pad_set_acceptcaps_function (self->subtitle_sinkpad,
- GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_acceptcaps));
- gst_pad_set_bufferalloc_function (self->subtitle_sinkpad, NULL);
-
- proxypad = NULL;
- it = gst_pad_iterate_internal_links (self->subtitle_sinkpad);
- if (G_UNLIKELY (!it
- || gst_iterator_next (it, (gpointer) & proxypad) != GST_ITERATOR_OK
- || proxypad == NULL)) {
- GST_ERROR_OBJECT (self,
- "Failed to get internally linked pad from subtitle sinkpad");
- }
- if (it)
- gst_iterator_free (it);
- self->subtitle_block_pad = proxypad;
-
- gst_element_add_pad (GST_ELEMENT_CAST (self), self->subtitle_sinkpad);
-
- self->fps_n = 0;
- self->fps_d = 0;
-}
-
-gboolean
-gst_subtitle_overlay_plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (subtitle_overlay_debug, "subtitleoverlay", 0,
- "Subtitle Overlay");
-
- _subtitle_overlay_event_marker_id =
- g_quark_from_static_string ("gst-subtitle-overlay-event-marker");
-
- return gst_element_register (plugin, "subtitleoverlay", GST_RANK_NONE,
- GST_TYPE_SUBTITLE_OVERLAY);
-}
diff --git a/gst/playback/gstsubtitleoverlay.h b/gst/playback/gstsubtitleoverlay.h
deleted file mode 100644
index eee5c785..00000000
--- a/gst/playback/gstsubtitleoverlay.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* GStreamer
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_SUBTITLE_OVERLAY_H__
-#define __GST_SUBTITLE_OVERLAY_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-#define GST_TYPE_SUBTITLE_OVERLAY \
- (gst_subtitle_overlay_get_type())
-#define GST_SUBTITLE_OVERLAY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_SUBTITLE_OVERLAY, GstSubtitleOverlay))
-#define GST_SUBTITLE_OVERLAY_CAST(obj) \
- ((GstSubtitleOverlay *) obj)
-#define GST_SUBTITLE_OVERLAY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_SUBTITLE_OVERLAY, GstSubtitleOverlayClass))
-#define GST_IS_SUBTITLE_OVERLAY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_SUBTITLE_OVERLAY))
-#define GST_IS_SUBTITLE_OVERLAY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_SUBTITLE_OVERLAY))
-
-#define GST_SUBTITLE_OVERLAY_LOCK(obj) G_STMT_START { \
- GST_LOG_OBJECT (obj, \
- "locking from thread %p", \
- g_thread_self ()); \
- g_mutex_lock (GST_SUBTITLE_OVERLAY_CAST(obj)->lock); \
- GST_LOG_OBJECT (obj, \
- "locked from thread %p", \
- g_thread_self ()); \
-} G_STMT_END
-
-#define GST_SUBTITLE_OVERLAY_UNLOCK(obj) G_STMT_START { \
- GST_LOG_OBJECT (obj, \
- "unlocking from thread %p", \
- g_thread_self ()); \
- g_mutex_unlock (GST_SUBTITLE_OVERLAY_CAST(obj)->lock); \
-} G_STMT_END
-
-typedef struct _GstSubtitleOverlay GstSubtitleOverlay;
-typedef struct _GstSubtitleOverlayClass GstSubtitleOverlayClass;
-
-struct _GstSubtitleOverlay
-{
- GstBin parent;
-
- gboolean silent;
- gchar *font_desc;
- gchar *encoding;
-
- /* < private > */
- gboolean do_async;
-
- GstPad *srcpad;
- GstPadEventFunction src_proxy_event;
- GstPadChainFunction src_proxy_chain;
- gboolean downstream_chain_error;
-
- GstPad *video_sinkpad;
- GstPad *video_block_pad;
- GstPadSetCapsFunction video_sink_setcaps;
- GstPadEventFunction video_sink_event;
- GstPadChainFunction video_sink_chain;
- gboolean video_sink_blocked;
- GstSegment video_segment;
- gint fps_n, fps_d;
-
- GstPad *subtitle_sinkpad;
- GstPad *subtitle_block_pad;
- GstPadLinkFunction subtitle_sink_link;
- GstPadUnlinkFunction subtitle_sink_unlink;
- GstPadEventFunction subtitle_sink_event;
- GstPadChainFunction subtitle_sink_chain;
- GstPadSetCapsFunction subtitle_sink_setcaps;
- gboolean subtitle_sink_blocked;
- GstSegment subtitle_segment;
- gboolean subtitle_flush;
- gboolean subtitle_error;
-
- GMutex *factories_lock;
- GList *factories;
- guint32 factories_cookie;
- GstCaps *factory_caps;
-
- GMutex *lock;
- GstCaps *subcaps;
-
- GstElement *passthrough_identity;
-
- GstElement *pre_colorspace;
- GstElement *post_colorspace;
-
- GstElement *parser;
- GstElement *overlay;
-
- GstElement *renderer;
-
- const gchar *silent_property;
- gboolean silent_property_invert;
-};
-
-struct _GstSubtitleOverlayClass
-{
- GstBinClass parent;
-};
-
-GType gst_subtitle_overlay_get_type (void);
-gboolean gst_subtitle_overlay_plugin_init (GstPlugin * plugin);
-
-GstCaps *gst_subtitle_overlay_create_factory_caps (void);
-
-G_END_DECLS
-#endif /* __GST_SUBTITLE_OVERLAY_H__ */
diff --git a/gst/playback/gsturidecodebin.c b/gst/playback/gsturidecodebin.c
deleted file mode 100644
index 09f24afb..00000000
--- a/gst/playback/gsturidecodebin.c
+++ /dev/null
@@ -1,2226 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-uridecodebin
- *
- * Decodes data from a URI into raw media. It selects a source element that can
- * handle the given #GstURIDecodeBin:uri scheme and connects it to a decodebin2.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <string.h>
-
-#include <gst/gst.h>
-#include <gst/gst-i18n-plugin.h>
-#include <gst/pbutils/missing-plugins.h>
-
-#include "gstfactorylists.h"
-#include "gstplay-marshal.h"
-#include "gstplay-enum.h"
-#include "gstrawcaps.h"
-
-#define GST_TYPE_URI_DECODE_BIN \
- (gst_uri_decode_bin_get_type())
-#define GST_URI_DECODE_BIN(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_URI_DECODE_BIN,GstURIDecodeBin))
-#define GST_URI_DECODE_BIN_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_URI_DECODE_BIN,GstURIDecodeBinClass))
-#define GST_IS_URI_DECODE_BIN(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_URI_DECODE_BIN))
-#define GST_IS_URI_DECODE_BIN_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_URI_DECODE_BIN))
-#define GST_URI_DECODE_BIN_CAST(obj) ((GstURIDecodeBin *) (obj))
-
-typedef struct _GstURIDecodeBin GstURIDecodeBin;
-typedef struct _GstURIDecodeBinClass GstURIDecodeBinClass;
-
-#define GST_URI_DECODE_BIN_GET_LOCK(dec) (((GstURIDecodeBin*)(dec))->lock)
-#define GST_URI_DECODE_BIN_LOCK(dec) (g_mutex_lock(GST_URI_DECODE_BIN_GET_LOCK(dec)))
-#define GST_URI_DECODE_BIN_UNLOCK(dec) (g_mutex_unlock(GST_URI_DECODE_BIN_GET_LOCK(dec)))
-
-/**
- * GstURIDecodeBin
- *
- * uridecodebin element struct
- */
-struct _GstURIDecodeBin
-{
- GstBin parent_instance;
-
- GMutex *lock; /* lock for constructing */
-
- GMutex *factories_lock;
- guint32 factories_cookie;
- GValueArray *factories; /* factories we can use for selecting elements */
-
- gchar *uri;
- guint connection_speed;
- GstCaps *caps;
- gchar *encoding;
-
- gboolean is_stream;
- gboolean is_download;
- gboolean need_queue;
- guint64 buffer_duration; /* When buffering, buffer duration (ns) */
- guint buffer_size; /* When buffering, buffer size (bytes) */
- gboolean download;
- gboolean use_buffering;
-
- GstElement *source;
- GstElement *queue;
- GstElement *typefind;
- guint have_type_id; /* have-type signal id from typefind */
- GSList *decodebins;
- GSList *pending_decodebins;
- GSList *srcpads;
- gint numpads;
-
- /* for dynamic sources */
- guint src_np_sig_id; /* new-pad signal id */
- guint src_nmp_sig_id; /* no-more-pads signal id */
- gint pending;
-
- gboolean async_pending; /* async-start has been emited */
-};
-
-struct _GstURIDecodeBinClass
-{
- GstBinClass parent_class;
-
- /* signal fired when we found a pad that we cannot decode */
- void (*unknown_type) (GstElement * element, GstPad * pad, GstCaps * caps);
-
- /* signal fired to know if we continue trying to decode the given caps */
- gboolean (*autoplug_continue) (GstElement * element, GstPad * pad,
- GstCaps * caps);
- /* signal fired to get a list of factories to try to autoplug */
- GValueArray *(*autoplug_factories) (GstElement * element, GstPad * pad,
- GstCaps * caps);
- /* signal fired to select from the proposed list of factories */
- GstAutoplugSelectResult (*autoplug_select) (GstElement * element,
- GstPad * pad, GstCaps * caps, GValueArray * factories);
-
- /* emited when all data is decoded */
- void (*drained) (GstElement * element);
-};
-
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src%d",
- GST_PAD_SRC,
- GST_PAD_SOMETIMES,
- GST_STATIC_CAPS_ANY);
-
-static GstStaticCaps default_raw_caps = GST_STATIC_CAPS (DEFAULT_RAW_CAPS);
-
-GST_DEBUG_CATEGORY_STATIC (gst_uri_decode_bin_debug);
-#define GST_CAT_DEFAULT gst_uri_decode_bin_debug
-
-static const GstElementDetails gst_uri_decode_bin_details =
-GST_ELEMENT_DETAILS ("URI Decoder",
- "Generic/Bin/Decoder",
- "Autoplug and decode an URI to raw media",
- "Wim Taymans <wim.taymans@gmail.com>");
-
-/* signals */
-enum
-{
- SIGNAL_UNKNOWN_TYPE,
- SIGNAL_AUTOPLUG_CONTINUE,
- SIGNAL_AUTOPLUG_FACTORIES,
- SIGNAL_AUTOPLUG_SELECT,
- SIGNAL_DRAINED,
- LAST_SIGNAL
-};
-
-/* properties */
-#define DEFAULT_PROP_URI NULL
-#define DEFAULT_PROP_SOURCE NULL
-#define DEFAULT_CONNECTION_SPEED 0
-#define DEFAULT_CAPS (gst_static_caps_get (&default_raw_caps))
-#define DEFAULT_SUBTITLE_ENCODING NULL
-#define DEFAULT_BUFFER_DURATION -1
-#define DEFAULT_BUFFER_SIZE -1
-#define DEFAULT_DOWNLOAD FALSE
-#define DEFAULT_USE_BUFFERING FALSE
-
-enum
-{
- PROP_0,
- PROP_URI,
- PROP_SOURCE,
- PROP_CONNECTION_SPEED,
- PROP_CAPS,
- PROP_SUBTITLE_ENCODING,
- PROP_BUFFER_SIZE,
- PROP_BUFFER_DURATION,
- PROP_DOWNLOAD,
- PROP_USE_BUFFERING,
- PROP_LAST
-};
-
-static guint gst_uri_decode_bin_signals[LAST_SIGNAL] = { 0 };
-
-GST_BOILERPLATE (GstURIDecodeBin, gst_uri_decode_bin, GstBin, GST_TYPE_BIN);
-
-static void remove_decoders (GstURIDecodeBin * bin, gboolean force);
-static void gst_uri_decode_bin_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_uri_decode_bin_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_uri_decode_bin_finalize (GObject * obj);
-
-static void handle_message (GstBin * bin, GstMessage * msg);
-
-static gboolean gst_uri_decode_bin_query (GstElement * element,
- GstQuery * query);
-static GstStateChangeReturn gst_uri_decode_bin_change_state (GstElement *
- element, GstStateChange transition);
-
-static void
-gst_uri_decode_bin_base_init (gpointer g_class)
-{
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&srctemplate));
- gst_element_class_set_details (gstelement_class, &gst_uri_decode_bin_details);
-}
-
-static gboolean
-_gst_boolean_accumulator (GSignalInvocationHint * ihint,
- GValue * return_accu, const GValue * handler_return, gpointer dummy)
-{
- gboolean myboolean;
-
- myboolean = g_value_get_boolean (handler_return);
- if (!(ihint->run_type & G_SIGNAL_RUN_CLEANUP))
- g_value_set_boolean (return_accu, myboolean);
-
- /* stop emission if FALSE */
- return myboolean;
-}
-
-static gboolean
-_gst_array_accumulator (GSignalInvocationHint * ihint,
- GValue * return_accu, const GValue * handler_return, gpointer dummy)
-{
- gpointer array;
-
- array = g_value_get_boxed (handler_return);
- if (!(ihint->run_type & G_SIGNAL_RUN_CLEANUP))
- g_value_set_boxed (return_accu, array);
-
- return FALSE;
-}
-
-static gboolean
-_gst_select_accumulator (GSignalInvocationHint * ihint,
- GValue * return_accu, const GValue * handler_return, gpointer dummy)
-{
- GstAutoplugSelectResult res;
-
- res = g_value_get_enum (handler_return);
- if (!(ihint->run_type & G_SIGNAL_RUN_CLEANUP))
- g_value_set_enum (return_accu, res);
-
- return FALSE;
-}
-
-static gboolean
-gst_uri_decode_bin_autoplug_continue (GstElement * element, GstPad * pad,
- GstCaps * caps)
-{
- /* by default we always continue */
- return TRUE;
-}
-
-/* Must be called with factories lock! */
-static void
-gst_uri_decode_bin_update_factories_list (GstURIDecodeBin * dec)
-{
- if (!dec->factories ||
- dec->factories_cookie !=
- gst_default_registry_get_feature_list_cookie ()) {
- if (dec->factories)
- g_value_array_free (dec->factories);
- dec->factories = gst_factory_list_get_elements (GST_FACTORY_LIST_DECODER);
- dec->factories_cookie = gst_default_registry_get_feature_list_cookie ();
- }
-}
-
-static GValueArray *
-gst_uri_decode_bin_autoplug_factories (GstElement * element, GstPad * pad,
- GstCaps * caps)
-{
- GValueArray *result;
- GstURIDecodeBin *dec = GST_URI_DECODE_BIN_CAST (element);
-
- GST_DEBUG_OBJECT (element, "finding factories");
-
- /* return all compatible factories for caps */
- g_mutex_lock (dec->factories_lock);
- gst_uri_decode_bin_update_factories_list (dec);
- result = gst_factory_list_filter (dec->factories, caps);
- g_mutex_unlock (dec->factories_lock);
-
- GST_DEBUG_OBJECT (element, "autoplug-factories returns %p", result);
-
- return result;
-}
-
-
-static void
-gst_uri_decode_bin_class_init (GstURIDecodeBinClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- GstBinClass *gstbin_class;
-
- gobject_class = G_OBJECT_CLASS (klass);
- gstelement_class = GST_ELEMENT_CLASS (klass);
- gstbin_class = GST_BIN_CLASS (klass);
-
- gobject_class->set_property = gst_uri_decode_bin_set_property;
- gobject_class->get_property = gst_uri_decode_bin_get_property;
- gobject_class->finalize = gst_uri_decode_bin_finalize;
-
- g_object_class_install_property (gobject_class, PROP_URI,
- g_param_spec_string ("uri", "URI", "URI to decode",
- DEFAULT_PROP_URI, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SOURCE,
- g_param_spec_object ("source", "Source", "Source object used",
- GST_TYPE_ELEMENT, G_PARAM_READABLE));
-
- g_object_class_install_property (gobject_class, PROP_CONNECTION_SPEED,
- g_param_spec_uint ("connection-speed", "Connection Speed",
- "Network connection speed in kbps (0 = unknown)",
- 0, G_MAXUINT / 1000, DEFAULT_CONNECTION_SPEED,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CAPS,
- g_param_spec_boxed ("caps", "Caps",
- "The caps on which to stop decoding. (NULL = default)",
- GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SUBTITLE_ENCODING,
- g_param_spec_string ("subtitle-encoding", "subtitle encoding",
- "Encoding to assume if input subtitles are not in UTF-8 encoding. "
- "If not set, the GST_SUBTITLE_ENCODING environment variable will "
- "be checked for an encoding to use. If that is not set either, "
- "ISO-8859-15 will be assumed.", NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_BUFFER_SIZE,
- g_param_spec_int ("buffer-size", "Buffer size (bytes)",
- "Buffer size when buffering streams (-1 default value)",
- -1, G_MAXINT, DEFAULT_BUFFER_SIZE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_BUFFER_DURATION,
- g_param_spec_int64 ("buffer-duration", "Buffer duration (ns)",
- "Buffer duration when buffering streams (-1 default value)",
- -1, G_MAXINT64, DEFAULT_BUFFER_DURATION,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstURIDecodeBin::download:
- *
- * For certain media type, enable download buffering.
- */
- g_object_class_install_property (gobject_class, PROP_DOWNLOAD,
- g_param_spec_boolean ("download", "Download",
- "Attempt download buffering when buffering network streams",
- DEFAULT_DOWNLOAD, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstURIDecodeBin::use-buffering:
- *
- * Emit BUFFERING messages based on low-/high-percent thresholds of the
- * demuxed or parsed data.
- * When download buffering is activated and used for the current media
- * type, this property does nothing. Otherwise perform buffering on the
- * demuxed or parsed media.
- *
- * Since: 0.10.26
- */
- g_object_class_install_property (gobject_class, PROP_USE_BUFFERING,
- g_param_spec_boolean ("use-buffering", "Use Buffering",
- "Perform buffering on demuxed/parsed media",
- DEFAULT_USE_BUFFERING, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstURIDecodeBin::unknown-type:
- * @bin: The uridecodebin
- * @pad: the new pad containing caps that cannot be resolved to a 'final'
- * stream type.
- * @caps: the #GstCaps of the pad that cannot be resolved.
- *
- * This signal is emitted when a pad for which there is no further possible
- * decoding is added to the uridecodebin.
- */
- gst_uri_decode_bin_signals[SIGNAL_UNKNOWN_TYPE] =
- g_signal_new ("unknown-type", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstURIDecodeBinClass, unknown_type),
- NULL, NULL, gst_marshal_VOID__OBJECT_BOXED, G_TYPE_NONE, 2,
- GST_TYPE_PAD, GST_TYPE_CAPS);
-
- /**
- * GstURIDecodeBin::autoplug-continue:
- * @bin: The uridecodebin
- * @pad: The #GstPad.
- * @caps: The #GstCaps found.
- *
- * This signal is emitted whenever uridecodebin finds a new stream. It is
- * emitted before looking for any elements that can handle that stream.
- *
- * Returns: #TRUE if you wish uridecodebin to look for elements that can
- * handle the given @caps. If #FALSE, those caps will be considered as
- * final and the pad will be exposed as such (see 'new-decoded-pad'
- * signal).
- */
- gst_uri_decode_bin_signals[SIGNAL_AUTOPLUG_CONTINUE] =
- g_signal_new ("autoplug-continue", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstURIDecodeBinClass,
- autoplug_continue), _gst_boolean_accumulator, NULL,
- gst_play_marshal_BOOLEAN__OBJECT_BOXED, G_TYPE_BOOLEAN, 2, GST_TYPE_PAD,
- GST_TYPE_CAPS);
-
- /**
- * GstURIDecodeBin::autoplug-factories:
- * @bin: The decodebin
- * @pad: The #GstPad.
- * @caps: The #GstCaps found.
- *
- * This function is emited when an array of possible factories for @caps on
- * @pad is needed. Uridecodebin will by default return an array with all
- * compatible factories, sorted by rank.
- *
- * If this function returns NULL, @pad will be exposed as a final caps.
- *
- * If this function returns an empty array, the pad will be considered as
- * having an unhandled type media type.
- *
- * Returns: a #GValueArray* with a list of factories to try. The factories are
- * by default tried in the returned order or based on the index returned by
- * "autoplug-select".
- */
- gst_uri_decode_bin_signals[SIGNAL_AUTOPLUG_FACTORIES] =
- g_signal_new ("autoplug-factories", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstURIDecodeBinClass,
- autoplug_factories), _gst_array_accumulator, NULL,
- gst_play_marshal_BOXED__OBJECT_BOXED, G_TYPE_VALUE_ARRAY, 2,
- GST_TYPE_PAD, GST_TYPE_CAPS);
-
- /**
- * GstURIDecodeBin::autoplug-select:
- * @pad: The #GstPad.
- * @caps: The #GstCaps.
- * @factory: A #GstElementFactory to use
- *
- * This signal is emitted once uridecodebin has found all the possible
- * #GstElementFactory that can be used to handle the given @caps. For each of
- * those factories, this signal is emited.
- *
- * The signal handler should return a #GST_TYPE_AUTOPLUG_SELECT_RESULT enum
- * value indicating what decodebin2 should do next.
- *
- * A value of #GST_AUTOPLUG_SELECT_TRY will try to autoplug an element from
- * @factory.
- *
- * A value of #GST_AUTOPLUG_SELECT_EXPOSE will expose @pad without plugging
- * any element to it.
- *
- * A value of #GST_AUTOPLUG_SELECT_SKIP will skip @factory and move to the
- * next factory.
- *
- * Returns: a #GST_TYPE_AUTOPLUG_SELECT_RESULT that indicates the required
- * operation. The default handler will always return
- * #GST_AUTOPLUG_SELECT_TRY.
- */
- gst_uri_decode_bin_signals[SIGNAL_AUTOPLUG_SELECT] =
- g_signal_new ("autoplug-select", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstURIDecodeBinClass,
- autoplug_select), _gst_select_accumulator, NULL,
- gst_play_marshal_ENUM__OBJECT_BOXED_OBJECT,
- GST_TYPE_AUTOPLUG_SELECT_RESULT, 3, GST_TYPE_PAD, GST_TYPE_CAPS,
- GST_TYPE_ELEMENT_FACTORY);
-
- /**
- * GstURIDecodeBin::drained:
- *
- * This signal is emitted when the data for the current uri is played.
- */
- gst_uri_decode_bin_signals[SIGNAL_DRAINED] =
- g_signal_new ("drained", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstURIDecodeBinClass, drained), NULL, NULL,
- gst_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
-
- gstelement_class->query = GST_DEBUG_FUNCPTR (gst_uri_decode_bin_query);
- gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_uri_decode_bin_change_state);
-
- gstbin_class->handle_message = GST_DEBUG_FUNCPTR (handle_message);
-
- klass->autoplug_continue =
- GST_DEBUG_FUNCPTR (gst_uri_decode_bin_autoplug_continue);
- klass->autoplug_factories =
- GST_DEBUG_FUNCPTR (gst_uri_decode_bin_autoplug_factories);
-}
-
-static void
-gst_uri_decode_bin_init (GstURIDecodeBin * dec, GstURIDecodeBinClass * klass)
-{
- /* first filter out the interesting element factories */
- dec->factories_lock = g_mutex_new ();
- gst_uri_decode_bin_update_factories_list (dec);
-
- dec->lock = g_mutex_new ();
-
- dec->uri = g_strdup (DEFAULT_PROP_URI);
- dec->connection_speed = DEFAULT_CONNECTION_SPEED;
- dec->caps = DEFAULT_CAPS;
- dec->encoding = g_strdup (DEFAULT_SUBTITLE_ENCODING);
-
- dec->buffer_duration = DEFAULT_BUFFER_DURATION;
- dec->buffer_size = DEFAULT_BUFFER_SIZE;
- dec->download = DEFAULT_DOWNLOAD;
- dec->use_buffering = DEFAULT_USE_BUFFERING;
-}
-
-static void
-gst_uri_decode_bin_finalize (GObject * obj)
-{
- GstURIDecodeBin *dec = GST_URI_DECODE_BIN (obj);
-
- remove_decoders (dec, TRUE);
- g_mutex_free (dec->lock);
- g_mutex_free (dec->factories_lock);
- g_free (dec->uri);
- g_free (dec->encoding);
- if (dec->factories)
- g_value_array_free (dec->factories);
- if (dec->caps)
- gst_caps_unref (dec->caps);
-
- G_OBJECT_CLASS (parent_class)->finalize (obj);
-}
-
-static void
-gst_uri_decode_bin_set_encoding (GstURIDecodeBin * dec, const gchar * encoding)
-{
- GSList *walk;
-
- GST_URI_DECODE_BIN_LOCK (dec);
-
- /* set property first */
- GST_OBJECT_LOCK (dec);
- g_free (dec->encoding);
- dec->encoding = g_strdup (encoding);
- GST_OBJECT_UNLOCK (dec);
-
- /* set the property on all decodebins now */
- for (walk = dec->decodebins; walk; walk = g_slist_next (walk)) {
- GObject *decodebin = G_OBJECT (walk->data);
-
- g_object_set (decodebin, "subtitle-encoding", encoding, NULL);
- }
- GST_URI_DECODE_BIN_UNLOCK (dec);
-}
-
-static void
-gst_uri_decode_bin_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstURIDecodeBin *dec = GST_URI_DECODE_BIN (object);
-
- switch (prop_id) {
- case PROP_URI:
- GST_OBJECT_LOCK (dec);
- g_free (dec->uri);
- dec->uri = g_value_dup_string (value);
- GST_OBJECT_UNLOCK (dec);
- break;
- case PROP_CONNECTION_SPEED:
- GST_OBJECT_LOCK (dec);
- dec->connection_speed = g_value_get_uint (value) * 1000;
- GST_OBJECT_UNLOCK (dec);
- break;
- case PROP_CAPS:
- GST_OBJECT_LOCK (dec);
- if (dec->caps)
- gst_caps_unref (dec->caps);
- dec->caps = g_value_dup_boxed (value);
- GST_OBJECT_UNLOCK (dec);
- break;
- case PROP_SUBTITLE_ENCODING:
- gst_uri_decode_bin_set_encoding (dec, g_value_get_string (value));
- break;
- case PROP_BUFFER_SIZE:
- dec->buffer_size = g_value_get_int (value);
- break;
- case PROP_BUFFER_DURATION:
- dec->buffer_duration = g_value_get_int64 (value);
- break;
- case PROP_DOWNLOAD:
- dec->download = g_value_get_boolean (value);
- break;
- case PROP_USE_BUFFERING:
- dec->use_buffering = g_value_get_boolean (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_uri_decode_bin_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstURIDecodeBin *dec = GST_URI_DECODE_BIN (object);
-
- switch (prop_id) {
- case PROP_URI:
- GST_OBJECT_LOCK (dec);
- g_value_set_string (value, dec->uri);
- GST_OBJECT_UNLOCK (dec);
- break;
- case PROP_SOURCE:
- GST_OBJECT_LOCK (dec);
- g_value_set_object (value, dec->source);
- GST_OBJECT_UNLOCK (dec);
- break;
- case PROP_CONNECTION_SPEED:
- GST_OBJECT_LOCK (dec);
- g_value_set_uint (value, dec->connection_speed / 1000);
- GST_OBJECT_UNLOCK (dec);
- break;
- case PROP_CAPS:
- GST_OBJECT_LOCK (dec);
- g_value_set_boxed (value, dec->caps);
- GST_OBJECT_UNLOCK (dec);
- break;
- case PROP_SUBTITLE_ENCODING:
- GST_OBJECT_LOCK (dec);
- g_value_set_string (value, dec->encoding);
- GST_OBJECT_UNLOCK (dec);
- break;
- case PROP_BUFFER_SIZE:
- GST_OBJECT_LOCK (dec);
- g_value_set_int (value, dec->buffer_size);
- GST_OBJECT_UNLOCK (dec);
- break;
- case PROP_BUFFER_DURATION:
- GST_OBJECT_LOCK (dec);
- g_value_set_int64 (value, dec->buffer_duration);
- GST_OBJECT_UNLOCK (dec);
- break;
- case PROP_DOWNLOAD:
- g_value_set_boolean (value, dec->download);
- break;
- case PROP_USE_BUFFERING:
- g_value_set_boolean (value, dec->use_buffering);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-do_async_start (GstURIDecodeBin * dbin)
-{
- GstMessage *message;
-
- dbin->async_pending = TRUE;
-
- message = gst_message_new_async_start (GST_OBJECT_CAST (dbin), FALSE);
- parent_class->handle_message (GST_BIN_CAST (dbin), message);
-}
-
-static void
-do_async_done (GstURIDecodeBin * dbin)
-{
- GstMessage *message;
-
- if (dbin->async_pending) {
- GST_DEBUG_OBJECT (dbin, "posting ASYNC_DONE");
- message = gst_message_new_async_done (GST_OBJECT_CAST (dbin));
- parent_class->handle_message (GST_BIN_CAST (dbin), message);
-
- dbin->async_pending = FALSE;
- }
-}
-
-#define DEFAULT_QUEUE_SIZE (3 * GST_SECOND)
-#define DEFAULT_QUEUE_MIN_THRESHOLD ((DEFAULT_QUEUE_SIZE * 30) / 100)
-#define DEFAULT_QUEUE_THRESHOLD ((DEFAULT_QUEUE_SIZE * 95) / 100)
-
-static void
-unknown_type_cb (GstElement * element, GstPad * pad, GstCaps * caps,
- GstURIDecodeBin * decoder)
-{
- gchar *capsstr;
-
- capsstr = gst_caps_to_string (caps);
- GST_ELEMENT_WARNING (decoder, STREAM, CODEC_NOT_FOUND,
- (_("No decoder available for type \'%s\'."), capsstr), (NULL));
- g_free (capsstr);
-}
-
-/* add a streaminfo that indicates that the stream is handled by the
- * given element. This usually means that a stream without actual data is
- * produced but one that is sunken by an element. Examples of this are:
- * cdaudio, a hardware decoder/sink, dvd meta bins etc...
- */
-static void
-add_element_stream (GstElement * element, GstURIDecodeBin * decoder)
-{
- g_warning ("add element stream");
-}
-
-/* when the decoder element signals that no more pads will be generated, we
- * can commit the current group.
- */
-static void
-no_more_pads_full (GstElement * element, gboolean subs,
- GstURIDecodeBin * decoder)
-{
- gboolean final;
-
- /* setup phase */
- GST_DEBUG_OBJECT (element, "no more pads, %d pending", decoder->pending);
-
- GST_URI_DECODE_BIN_LOCK (decoder);
- final = (decoder->pending == 0);
-
- /* nothing pending, we can exit */
- if (final)
- goto done;
-
- /* the object has no pending no_more_pads */
- if (!g_object_get_data (G_OBJECT (element), "pending"))
- goto done;
- g_object_set_data (G_OBJECT (element), "pending", NULL);
-
- decoder->pending--;
- final = (decoder->pending == 0);
-
-done:
- GST_URI_DECODE_BIN_UNLOCK (decoder);
-
- if (final)
- gst_element_no_more_pads (GST_ELEMENT_CAST (decoder));
-
- return;
-}
-
-static void
-no_more_pads (GstElement * element, GstURIDecodeBin * decoder)
-{
- no_more_pads_full (element, FALSE, decoder);
-}
-
-static void
-source_no_more_pads (GstElement * element, GstURIDecodeBin * bin)
-{
- GST_DEBUG_OBJECT (bin, "No more pads in source element %s.",
- GST_ELEMENT_NAME (element));
-
- g_signal_handler_disconnect (element, bin->src_np_sig_id);
- bin->src_np_sig_id = 0;
- g_signal_handler_disconnect (element, bin->src_nmp_sig_id);
- bin->src_nmp_sig_id = 0;
-
- no_more_pads_full (element, FALSE, bin);
-}
-
-/* Called by the signal handlers when a decodebin has
- * found a new raw pad.
- */
-static void
-new_decoded_pad_cb (GstElement * element, GstPad * pad, gboolean last,
- GstURIDecodeBin * decoder)
-{
- GstPad *newpad;
- gchar *padname;
-
- GST_DEBUG_OBJECT (element, "new decoded pad, name: <%s>. Last: %d",
- GST_PAD_NAME (pad), last);
-
- GST_URI_DECODE_BIN_LOCK (decoder);
- padname = g_strdup_printf ("src%d", decoder->numpads);
- decoder->numpads++;
- GST_URI_DECODE_BIN_UNLOCK (decoder);
-
- newpad = gst_ghost_pad_new (padname, pad);
- g_free (padname);
-
- /* store ref to the ghostpad so we can remove it */
- g_object_set_data (G_OBJECT (pad), "uridecodebin.ghostpad", newpad);
-
- gst_pad_set_active (newpad, TRUE);
- gst_element_add_pad (GST_ELEMENT_CAST (decoder), newpad);
-}
-
-
-static gboolean
-source_pad_event_probe (GstPad * pad, GstEvent * event,
- GstURIDecodeBin * decoder)
-{
- GST_LOG_OBJECT (pad, "%s, decoder %p", GST_EVENT_TYPE_NAME (event), decoder);
-
- if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
- GST_DEBUG_OBJECT (pad, "we received EOS");
-
- g_signal_emit (decoder,
- gst_uri_decode_bin_signals[SIGNAL_DRAINED], 0, NULL);
- }
- /* never drop events */
- return TRUE;
-}
-
-/* called when we found a raw pad on the source element. We need to set up a
- * padprobe to detect EOS before exposing the pad. */
-static void
-expose_decoded_pad (GstElement * element, GstPad * pad,
- GstURIDecodeBin * decoder)
-{
- gst_pad_add_event_probe (pad, G_CALLBACK (source_pad_event_probe), decoder);
-
- new_decoded_pad_cb (element, pad, FALSE, decoder);
-}
-
-static void
-pad_removed_cb (GstElement * element, GstPad * pad, GstURIDecodeBin * decoder)
-{
- GstPad *ghost;
-
- GST_DEBUG_OBJECT (element, "pad removed name: <%s:%s>",
- GST_DEBUG_PAD_NAME (pad));
-
- /* we only care about srcpads */
- if (!GST_PAD_IS_SRC (pad))
- return;
-
- if (!(ghost = g_object_get_data (G_OBJECT (pad), "uridecodebin.ghostpad")))
- goto no_ghost;
-
- /* unghost the pad */
- gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (ghost), NULL);
-
- /* deactivate and remove */
- gst_pad_set_active (pad, FALSE);
- gst_element_remove_pad (GST_ELEMENT_CAST (decoder), ghost);
-
- return;
-
- /* ERRORS */
-no_ghost:
- {
- GST_WARNING_OBJECT (element, "no ghost pad found");
- return;
- }
-}
-
-/* helper function to lookup stuff in lists */
-static gboolean
-array_has_value (const gchar * values[], const gchar * value)
-{
- gint i;
-
- for (i = 0; values[i]; i++) {
- if (g_str_has_prefix (value, values[i]))
- return TRUE;
- }
- return FALSE;
-}
-
-static gboolean
-array_has_uri_value (const gchar * values[], const gchar * value)
-{
- gint i;
-
- for (i = 0; values[i]; i++) {
- if (!g_ascii_strncasecmp (value, values[i], strlen (values[i])))
- return TRUE;
- }
- return FALSE;
-}
-
-/* list of URIs that we consider to be streams and that need buffering.
- * We have no mechanism yet to figure this out with a query. */
-static const gchar *stream_uris[] = { "http://", "mms://", "mmsh://",
- "mmsu://", "mmst://", "fd://", "myth://", "ssh://", "ftp://", "sftp://",
- NULL
-};
-
-/* list of URIs that need a queue because they are pretty bursty */
-static const gchar *queue_uris[] = { "cdda://", NULL };
-
-/* blacklisted URIs, we know they will always fail. */
-static const gchar *blacklisted_uris[] = { NULL };
-
-/* mime types that we don't consider to be media types */
-#if 0
-static const gchar *no_media_mimes[] = {
- "application/x-executable", "application/x-bzip", "application/x-gzip",
- "application/zip", "application/x-compress", NULL
-};
-#endif
-
-/* media types we can download */
-static const gchar *download_media[] = {
- "video/quicktime", "video/x-flv", NULL
-};
-
-#define IS_STREAM_URI(uri) (array_has_uri_value (stream_uris, uri))
-#define IS_QUEUE_URI(uri) (array_has_uri_value (queue_uris, uri))
-#define IS_BLACKLISTED_URI(uri) (array_has_uri_value (blacklisted_uris, uri))
-#define IS_NO_MEDIA_MIME(mime) (array_has_value (no_media_mimes, mime))
-#define IS_DOWNLOAD_MEDIA(media) (array_has_value (download_media, media))
-
-/*
- * Generate and configure a source element.
- */
-static GstElement *
-gen_source_element (GstURIDecodeBin * decoder)
-{
- GstElement *source;
-
- if (!decoder->uri)
- goto no_uri;
-
- GST_LOG_OBJECT (decoder, "finding source for %s", decoder->uri);
-
- if (!gst_uri_is_valid (decoder->uri))
- goto invalid_uri;
-
- if (IS_BLACKLISTED_URI (decoder->uri))
- goto uri_blacklisted;
-
- source = gst_element_make_from_uri (GST_URI_SRC, decoder->uri, "source");
- if (!source)
- goto no_source;
-
- GST_LOG_OBJECT (decoder, "found source type %s", G_OBJECT_TYPE_NAME (source));
-
- decoder->is_stream = IS_STREAM_URI (decoder->uri);
- GST_LOG_OBJECT (decoder, "source is stream: %d", decoder->is_stream);
-
- decoder->need_queue = IS_QUEUE_URI (decoder->uri);
- GST_LOG_OBJECT (decoder, "source needs queue: %d", decoder->need_queue);
-
- /* make HTTP sources send extra headers so we get icecast
- * metadata in case the stream is an icecast stream */
- if (!strncmp (decoder->uri, "http://", 7) &&
- g_object_class_find_property (G_OBJECT_GET_CLASS (source),
- "iradio-mode")) {
- GST_LOG_OBJECT (decoder, "configuring iradio-mode");
- g_object_set (source, "iradio-mode", TRUE, NULL);
- }
-
- if (g_object_class_find_property (G_OBJECT_GET_CLASS (source),
- "connection-speed")) {
- GST_DEBUG_OBJECT (decoder,
- "setting connection-speed=%d to source element",
- decoder->connection_speed / 1000);
- g_object_set (source, "connection-speed",
- decoder->connection_speed / 1000, NULL);
- }
- if (g_object_class_find_property (G_OBJECT_GET_CLASS (source),
- "subtitle-encoding")) {
- GST_DEBUG_OBJECT (decoder,
- "setting subtitle-encoding=%s to source element", decoder->encoding);
- g_object_set (source, "subtitle-encoding", decoder->encoding, NULL);
- }
- return source;
-
- /* ERRORS */
-no_uri:
- {
- GST_ELEMENT_ERROR (decoder, RESOURCE, NOT_FOUND,
- (_("No URI specified to play from.")), (NULL));
- return NULL;
- }
-invalid_uri:
- {
- GST_ELEMENT_ERROR (decoder, RESOURCE, NOT_FOUND,
- (_("Invalid URI \"%s\"."), decoder->uri), (NULL));
- return NULL;
- }
-uri_blacklisted:
- {
- GST_ELEMENT_ERROR (decoder, RESOURCE, FAILED,
- (_("This stream type cannot be played yet.")), (NULL));
- return NULL;
- }
-no_source:
- {
- gchar *prot = gst_uri_get_protocol (decoder->uri);
-
- /* whoops, could not create the source element, dig a little deeper to
- * figure out what might be wrong. */
- if (prot) {
- GstMessage *msg;
-
- msg =
- gst_missing_uri_source_message_new (GST_ELEMENT_CAST (decoder), prot);
- gst_element_post_message (GST_ELEMENT_CAST (decoder), msg);
-
- GST_ELEMENT_ERROR (decoder, CORE, MISSING_PLUGIN,
- (_("No URI handler implemented for \"%s\"."), prot), (NULL));
- g_free (prot);
- } else
- goto invalid_uri;
-
- return NULL;
- }
-}
-
-/**
- * has_all_raw_caps:
- * @pad: a #GstPad
- * @all_raw: pointer to hold the result
- *
- * check if the caps of the pad are all raw. The caps are all raw if
- * all of its structures contain audio/x-raw or video/x-raw.
- *
- * Returns: %FALSE @pad has no caps. Else TRUE and @all_raw set t the result.
- */
-static gboolean
-has_all_raw_caps (GstPad * pad, GstCaps * rawcaps, gboolean * all_raw)
-{
- GstCaps *caps, *intersection;
- gint capssize;
- gboolean res = FALSE;
-
- caps = gst_pad_get_caps_reffed (pad);
- if (caps == NULL)
- return FALSE;
-
- GST_DEBUG_OBJECT (pad, "have caps %" GST_PTR_FORMAT, caps);
-
- capssize = gst_caps_get_size (caps);
- /* no caps, skip and move to the next pad */
- if (capssize == 0 || gst_caps_is_empty (caps) || gst_caps_is_any (caps))
- goto done;
-
- intersection = gst_caps_intersect (caps, rawcaps);
- *all_raw = !gst_caps_is_empty (intersection)
- && (gst_caps_get_size (intersection) == capssize);
- gst_caps_unref (intersection);
-
- res = TRUE;
-
-done:
- gst_caps_unref (caps);
- return res;
-}
-
-static void
-post_missing_plugin_error (GstElement * dec, const gchar * element_name)
-{
- GstMessage *msg;
-
- msg = gst_missing_element_message_new (dec, element_name);
- gst_element_post_message (dec, msg);
-
- GST_ELEMENT_ERROR (dec, CORE, MISSING_PLUGIN,
- (_("Missing element '%s' - check your GStreamer installation."),
- element_name), (NULL));
-}
-
-/**
- * analyse_source:
- * @decoder: a #GstURIDecodeBin
- * @is_raw: are all pads raw data
- * @have_out: does the source have output
- * @is_dynamic: is this a dynamic source
- * @use_queue: put a queue before raw output pads
- *
- * Check the source of @decoder and collect information about it.
- *
- * @is_raw will be set to TRUE if the source only produces raw pads. When this
- * function returns, all of the raw pad of the source will be added
- * to @decoder.
- *
- * @have_out: will be set to TRUE if the source has output pads.
- *
- * @is_dynamic: TRUE if the element will create (more) pads dynamically later
- * on.
- *
- * Returns: FALSE if a fatal error occured while scanning.
- */
-static gboolean
-analyse_source (GstURIDecodeBin * decoder, gboolean * is_raw,
- gboolean * have_out, gboolean * is_dynamic, gboolean use_queue)
-{
- GstIterator *pads_iter;
- gboolean done = FALSE;
- gboolean res = TRUE;
- GstCaps *rawcaps;
- GstPad *pad;
-
- *have_out = FALSE;
- *is_raw = FALSE;
- *is_dynamic = FALSE;
-
- g_object_get (decoder, "caps", &rawcaps, NULL);
- if (!rawcaps)
- rawcaps = DEFAULT_CAPS;
-
- pads_iter = gst_element_iterate_src_pads (decoder->source);
- while (!done) {
- switch (gst_iterator_next (pads_iter, (gpointer) & pad)) {
- case GST_ITERATOR_ERROR:
- res = FALSE;
- /* FALLTROUGH */
- case GST_ITERATOR_DONE:
- done = TRUE;
- break;
- case GST_ITERATOR_RESYNC:
- /* reset results and resync */
- *have_out = FALSE;
- *is_raw = FALSE;
- *is_dynamic = FALSE;
- gst_iterator_resync (pads_iter);
- break;
- case GST_ITERATOR_OK:
- /* we now officially have an ouput pad */
- *have_out = TRUE;
-
- /* if FALSE, this pad has no caps and we continue with the next pad. */
- if (!has_all_raw_caps (pad, rawcaps, is_raw)) {
- gst_object_unref (pad);
- break;
- }
-
- /* caps on source pad are all raw, we can add the pad */
- if (*is_raw) {
- GstElement *outelem;
-
- if (use_queue) {
- GstPad *sinkpad;
-
- /* insert a queue element right before the raw pad */
- outelem = gst_element_factory_make ("queue2", NULL);
- if (!outelem)
- goto no_queue2;
-
- gst_bin_add (GST_BIN_CAST (decoder), outelem);
-
- sinkpad = gst_element_get_static_pad (outelem, "sink");
- gst_pad_link (pad, sinkpad);
- gst_object_unref (sinkpad);
- gst_object_unref (pad);
-
- /* save queue pointer so we can remove it later */
- decoder->queue = outelem;
-
- /* get the new raw srcpad */
- pad = gst_element_get_static_pad (outelem, "src");
- } else {
- outelem = decoder->source;
- }
- expose_decoded_pad (outelem, pad, decoder);
- }
- gst_object_unref (pad);
- break;
- }
- }
- gst_iterator_free (pads_iter);
- gst_caps_unref (rawcaps);
-
- if (!*have_out) {
- GstElementClass *elemclass;
- GList *walk;
-
- /* element has no output pads, check for padtemplates that list SOMETIMES
- * pads. */
- elemclass = GST_ELEMENT_GET_CLASS (decoder->source);
-
- walk = gst_element_class_get_pad_template_list (elemclass);
- while (walk != NULL) {
- GstPadTemplate *templ;
-
- templ = (GstPadTemplate *) walk->data;
- if (GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SRC) {
- if (GST_PAD_TEMPLATE_PRESENCE (templ) == GST_PAD_SOMETIMES)
- *is_dynamic = TRUE;
- break;
- }
- walk = g_list_next (walk);
- }
- }
-
- return res;
-no_queue2:
- {
- post_missing_plugin_error (GST_ELEMENT_CAST (decoder), "queue2");
-
- gst_object_unref (pad);
- gst_iterator_free (pads_iter);
- gst_caps_unref (rawcaps);
-
- return FALSE;
- }
-}
-
-/* Remove all decodebin2 from ourself
- * If force is FALSE, then the decodebin2 instances will be stored in
- * pending_decodebins for re-use later on.
- * If force is TRUE, then all decodebin2 instances will be unreferenced
- * and cleared, including the pending ones. */
-static void
-remove_decoders (GstURIDecodeBin * bin, gboolean force)
-{
- GSList *walk;
-
- for (walk = bin->decodebins; walk; walk = g_slist_next (walk)) {
- GstElement *decoder = GST_ELEMENT_CAST (walk->data);
-
- GST_DEBUG_OBJECT (bin, "removing old decoder element");
- if (force) {
- gst_element_set_state (decoder, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (bin), decoder);
- } else {
- GstCaps *caps;
-
- gst_element_set_state (decoder, GST_STATE_READY);
- /* add it to our list of pending decodebins */
- g_object_ref (decoder);
- gst_bin_remove (GST_BIN_CAST (bin), decoder);
- /* restore some properties we might have changed */
- g_object_set (decoder, "sink-caps", NULL, NULL);
- caps = DEFAULT_CAPS;
- g_object_set (decoder, "caps", caps, NULL);
- gst_caps_unref (caps);
-
- bin->pending_decodebins =
- g_slist_prepend (bin->pending_decodebins, decoder);
- }
- }
- g_slist_free (bin->decodebins);
- bin->decodebins = NULL;
- if (force) {
- GSList *tmp;
-
- for (tmp = bin->pending_decodebins; tmp; tmp = tmp->next) {
- gst_element_set_state ((GstElement *) tmp->data, GST_STATE_NULL);
- gst_object_unref ((GstElement *) tmp->data);
- }
- g_slist_free (bin->pending_decodebins);
- bin->pending_decodebins = NULL;
-
- }
-}
-
-static void
-remove_pads (GstURIDecodeBin * bin)
-{
- GSList *walk;
-
- for (walk = bin->srcpads; walk; walk = g_slist_next (walk)) {
- GstPad *pad = GST_PAD_CAST (walk->data);
-
- GST_DEBUG_OBJECT (bin, "removing old pad");
- gst_pad_set_active (pad, FALSE);
- gst_element_remove_pad (GST_ELEMENT_CAST (bin), pad);
- }
- g_slist_free (bin->srcpads);
- bin->srcpads = NULL;
-}
-
-static void
-proxy_unknown_type_signal (GstElement * element, GstPad * pad, GstCaps * caps,
- GstURIDecodeBin * dec)
-{
- GST_DEBUG_OBJECT (dec, "unknown-type signaled");
-
- g_signal_emit (dec,
- gst_uri_decode_bin_signals[SIGNAL_UNKNOWN_TYPE], 0, pad, caps);
-}
-
-static gboolean
-proxy_autoplug_continue_signal (GstElement * element, GstPad * pad,
- GstCaps * caps, GstURIDecodeBin * dec)
-{
- gboolean result;
-
- g_signal_emit (dec,
- gst_uri_decode_bin_signals[SIGNAL_AUTOPLUG_CONTINUE], 0, pad, caps,
- &result);
-
- GST_DEBUG_OBJECT (dec, "autoplug-continue returned %d", result);
-
- return result;
-}
-
-static GValueArray *
-proxy_autoplug_factories_signal (GstElement * element, GstPad * pad,
- GstCaps * caps, GstURIDecodeBin * dec)
-{
- GValueArray *result;
-
- g_signal_emit (dec,
- gst_uri_decode_bin_signals[SIGNAL_AUTOPLUG_FACTORIES], 0, pad, caps,
- &result);
-
- GST_DEBUG_OBJECT (dec, "autoplug-factories returned %p", result);
-
- return result;
-}
-
-static GstAutoplugSelectResult
-proxy_autoplug_select_signal (GstElement * element, GstPad * pad,
- GstCaps * caps, GstElementFactory * factory, GstURIDecodeBin * dec)
-{
- GstAutoplugSelectResult result;
-
- g_signal_emit (dec,
- gst_uri_decode_bin_signals[SIGNAL_AUTOPLUG_SELECT], 0, pad, caps, factory,
- &result);
-
- GST_DEBUG_OBJECT (dec, "autoplug-select returned %d", result);
-
- return result;
-}
-
-static void
-proxy_drained_signal (GstElement * element, GstURIDecodeBin * dec)
-{
- GST_DEBUG_OBJECT (dec, "drained signaled");
-
- g_signal_emit (dec, gst_uri_decode_bin_signals[SIGNAL_DRAINED], 0, NULL);
-}
-
-/* make a decodebin and connect to all the signals */
-static GstElement *
-make_decoder (GstURIDecodeBin * decoder)
-{
- GstElement *decodebin;
-
- /* re-use pending decodebin2 */
- if (decoder->pending_decodebins) {
- GSList *first = decoder->pending_decodebins;
- GST_LOG_OBJECT (decoder, "re-using pending decodebin2");
- decodebin = (GstElement *) first->data;
- decoder->pending_decodebins =
- g_slist_delete_link (decoder->pending_decodebins, first);
- } else {
- GST_LOG_OBJECT (decoder, "making new decodebin2");
-
- /* now create the decoder element */
- decodebin = gst_element_factory_make ("decodebin2", NULL);
-
- if (!decodebin)
- goto no_decodebin;
- /* connect signals to proxy */
- g_signal_connect (decodebin, "unknown-type",
- G_CALLBACK (proxy_unknown_type_signal), decoder);
- g_signal_connect (decodebin, "autoplug-continue",
- G_CALLBACK (proxy_autoplug_continue_signal), decoder);
- g_signal_connect (decodebin, "autoplug-factories",
- G_CALLBACK (proxy_autoplug_factories_signal), decoder);
- g_signal_connect (decodebin, "autoplug-select",
- G_CALLBACK (proxy_autoplug_select_signal), decoder);
- g_signal_connect (decodebin, "drained",
- G_CALLBACK (proxy_drained_signal), decoder);
-
- /* set up callbacks to create the links between decoded data
- * and video/audio/subtitle rendering/output. */
- g_signal_connect (decodebin,
- "new-decoded-pad", G_CALLBACK (new_decoded_pad_cb), decoder);
- g_signal_connect (decodebin,
- "pad-removed", G_CALLBACK (pad_removed_cb), decoder);
- g_signal_connect (decodebin, "no-more-pads",
- G_CALLBACK (no_more_pads), decoder);
- g_signal_connect (decodebin,
- "unknown-type", G_CALLBACK (unknown_type_cb), decoder);
- }
-
- /* configure caps if we have any */
- if (decoder->caps)
- g_object_set (decodebin, "caps", decoder->caps, NULL);
-
- if (!decoder->is_stream) {
- /* propagate the use-buffering property but only when we are not already
- * doing stream buffering with queue2. FIXME, we might want to do stream
- * buffering with the multiqueue buffering instead of queue2. */
- g_object_set (decodebin, "use-buffering", decoder->use_buffering, NULL);
-
- if (decoder->use_buffering) {
- guint max_bytes;
- guint64 max_time;
-
- /* configure sizes when buffering */
- if ((max_bytes = decoder->buffer_size) == -1)
- max_bytes = 2 * 1024 * 1024;
- if ((max_time = decoder->buffer_duration) == -1)
- max_time = 2 * GST_SECOND;
-
- g_object_set (decodebin, "max-size-bytes", max_bytes, "max-size-buffers",
- (guint) 0, "max-size-time", max_time, NULL);
- }
- }
-
- g_object_set_data (G_OBJECT (decodebin), "pending", "1");
- g_object_set (decodebin, "subtitle-encoding", decoder->encoding, NULL);
- decoder->pending++;
- GST_LOG_OBJECT (decoder, "have %d pending dynamic objects", decoder->pending);
-
- gst_bin_add (GST_BIN_CAST (decoder), decodebin);
-
- decoder->decodebins = g_slist_prepend (decoder->decodebins, decodebin);
-
- return decodebin;
-
- /* ERRORS */
-no_decodebin:
- {
- post_missing_plugin_error (GST_ELEMENT_CAST (decoder), "decodebin2");
- return NULL;
- }
-}
-
-/* signaled when we have a stream and we need to configure the download
- * buffering or regular buffering */
-static void
-type_found (GstElement * typefind, guint probability,
- GstCaps * caps, GstURIDecodeBin * decoder)
-{
- GstElement *dec_elem, *queue;
- GstStructure *s;
- const gchar *media_type;
-
- GST_DEBUG_OBJECT (decoder, "typefind found caps %" GST_PTR_FORMAT, caps);
-
- s = gst_caps_get_structure (caps, 0);
- media_type = gst_structure_get_name (s);
-
- /* remember if we need download buffering */
- decoder->is_download = IS_DOWNLOAD_MEDIA (media_type) && decoder->download;
-
- dec_elem = make_decoder (decoder);
- if (!dec_elem)
- goto no_decodebin;
-
- queue = gst_element_factory_make ("queue2", NULL);
- if (!queue)
- goto no_queue2;
-
- g_object_set (queue, "use-buffering", TRUE, NULL);
-
- GST_DEBUG_OBJECT (decoder, "check media-type %s, %d", media_type,
- decoder->download);
-
- if (decoder->is_download) {
- gchar *temp_template, *filename;
- const gchar *tmp_dir, *prgname;
-
- tmp_dir = g_get_tmp_dir ();
- prgname = g_get_prgname ();
- if (prgname == NULL)
- prgname = "GStreamer";
-
- filename = g_strdup_printf ("%s-XXXXXX", prgname);
-
- /* build our filename */
- temp_template = g_build_filename (tmp_dir, filename, NULL);
-
- GST_DEBUG_OBJECT (decoder, "enable download buffering in %s (%s, %s, %s)",
- temp_template, tmp_dir, prgname, filename);
-
- /* configure progressive download for selected media types */
- g_object_set (queue, "temp-template", temp_template, NULL);
-
- g_free (filename);
- g_free (temp_template);
- }
-
- /* Disable max-size-buffers */
- g_object_set (queue, "max-size-buffers", 0, NULL);
-
- /* If buffer size or duration are set, set them on the queue2 element */
- if (decoder->buffer_size != -1)
- g_object_set (queue, "max-size-bytes", decoder->buffer_size, NULL);
- if (decoder->buffer_duration != -1)
- g_object_set (queue, "max-size-time", decoder->buffer_duration, NULL);
-
- gst_bin_add (GST_BIN_CAST (decoder), queue);
-
- if (!gst_element_link_pads (typefind, "src", queue, "sink"))
- goto could_not_link;
-
- /* to force caps on the decodebin element and avoid reparsing stuff by
- * typefind. It also avoids a deadlock in the way typefind activates pads in
- * the state change */
- g_object_set (dec_elem, "sink-caps", caps, NULL);
-
- if (!gst_element_link_pads (queue, "src", dec_elem, "sink"))
- goto could_not_link;
-
- gst_element_set_state (dec_elem, GST_STATE_PLAYING);
- gst_element_set_state (queue, GST_STATE_PLAYING);
-
- do_async_done (decoder);
-
- return;
-
- /* ERRORS */
-no_decodebin:
- {
- /* error was posted */
- return;
- }
-could_not_link:
- {
- GST_ELEMENT_ERROR (decoder, CORE, NEGOTIATION,
- (NULL), ("Can't link typefind to decodebin2 element"));
- return;
- }
-no_queue2:
- {
- post_missing_plugin_error (GST_ELEMENT_CAST (decoder), "queue2");
- return;
- }
-}
-
-/* setup a streaming source. This will first plug a typefind element to the
- * source. After we find the type, we decide to plug a queue2 and continue to
- * plug a decodebin2 starting from the found caps */
-static gboolean
-setup_streaming (GstURIDecodeBin * decoder)
-{
- GstElement *typefind;
-
- /* now create the decoder element */
- typefind = gst_element_factory_make ("typefind", NULL);
- if (!typefind)
- goto no_typefind;
-
- gst_bin_add (GST_BIN_CAST (decoder), typefind);
-
- if (!gst_element_link_pads (decoder->source, NULL, typefind, "sink"))
- goto could_not_link;
-
- decoder->typefind = typefind;
-
- /* connect a signal to find out when the typefind element found
- * a type */
- decoder->have_type_id =
- g_signal_connect (decoder->typefind, "have-type",
- G_CALLBACK (type_found), decoder);
-
- do_async_start (decoder);
-
- return TRUE;
-
- /* ERRORS */
-no_typefind:
- {
- post_missing_plugin_error (GST_ELEMENT_CAST (decoder), "typefind");
- return FALSE;
- }
-could_not_link:
- {
- GST_ELEMENT_ERROR (decoder, CORE, NEGOTIATION,
- (NULL), ("Can't link source to typefind element"));
- gst_bin_remove (GST_BIN_CAST (decoder), typefind);
- return FALSE;
- }
-}
-
-/* remove source and all related elements */
-static void
-remove_source (GstURIDecodeBin * bin)
-{
- GstElement *source = bin->source;
-
- if (source) {
- GST_DEBUG_OBJECT (bin, "removing old src element");
- gst_element_set_state (source, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (bin), source);
-
- if (bin->src_np_sig_id) {
- g_signal_handler_disconnect (source, bin->src_np_sig_id);
- bin->src_np_sig_id = 0;
- }
- if (bin->src_nmp_sig_id) {
- g_signal_handler_disconnect (source, bin->src_nmp_sig_id);
- bin->src_nmp_sig_id = 0;
- }
- bin->source = NULL;
- }
- if (bin->queue) {
- GST_DEBUG_OBJECT (bin, "removing old queue element");
- gst_element_set_state (bin->queue, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (bin), bin->queue);
- bin->queue = NULL;
- }
- if (bin->typefind) {
- GST_DEBUG_OBJECT (bin, "removing old typefind element");
- gst_element_set_state (bin->typefind, GST_STATE_NULL);
- gst_bin_remove (GST_BIN_CAST (bin), bin->typefind);
- bin->typefind = NULL;
- }
-}
-
-/* is called when a dynamic source element created a new pad. */
-static void
-source_new_pad (GstElement * element, GstPad * pad, GstURIDecodeBin * bin)
-{
- GstElement *decoder;
- gboolean is_raw;
- GstCaps *rawcaps;
-
- GST_URI_DECODE_BIN_LOCK (bin);
- GST_DEBUG_OBJECT (bin, "Found new pad %s.%s in source element %s",
- GST_DEBUG_PAD_NAME (pad), GST_ELEMENT_NAME (element));
-
- g_object_get (bin, "caps", &rawcaps, NULL);
- if (!rawcaps)
- rawcaps = DEFAULT_CAPS;
-
- /* if this is a pad with all raw caps, we can expose it */
- if (has_all_raw_caps (pad, rawcaps, &is_raw) && is_raw) {
- /* it's all raw, create output pads. */
- GST_URI_DECODE_BIN_UNLOCK (bin);
- gst_caps_unref (rawcaps);
- expose_decoded_pad (element, pad, bin);
- return;
- }
- gst_caps_unref (rawcaps);
-
- /* not raw, create decoder */
- decoder = make_decoder (bin);
- if (!decoder)
- goto no_decodebin;
-
- /* and link to decoder */
- if (!gst_element_link_pads (bin->source, NULL, decoder, "sink"))
- goto could_not_link;
-
- GST_DEBUG_OBJECT (bin, "linked decoder to new pad");
-
- gst_element_set_state (decoder, GST_STATE_PLAYING);
- GST_URI_DECODE_BIN_UNLOCK (bin);
-
- return;
-
- /* ERRORS */
-no_decodebin:
- {
- /* error was posted */
- GST_URI_DECODE_BIN_UNLOCK (bin);
- return;
- }
-could_not_link:
- {
- GST_ELEMENT_ERROR (bin, CORE, NEGOTIATION,
- (NULL), ("Can't link source to decoder element"));
- GST_URI_DECODE_BIN_UNLOCK (bin);
- return;
- }
-}
-
-/* construct and run the source and decoder elements until we found
- * all the streams or until a preroll queue has been filled.
-*/
-static gboolean
-setup_source (GstURIDecodeBin * decoder)
-{
- gboolean is_raw, have_out, is_dynamic;
-
- GST_DEBUG_OBJECT (decoder, "setup source");
-
- /* delete old src */
- remove_source (decoder);
-
- decoder->pending = 0;
-
- /* create and configure an element that can handle the uri */
- if (!(decoder->source = gen_source_element (decoder)))
- goto no_source;
-
- /* state will be merged later - if file is not found, error will be
- * handled by the application right after. */
- gst_bin_add (GST_BIN_CAST (decoder), decoder->source);
-
- /* notify of the new source used */
- g_object_notify (G_OBJECT (decoder), "source");
-
- /* remove the old decoders now, if any */
- remove_decoders (decoder, FALSE);
-
- /* see if the source element emits raw audio/video all by itself,
- * if so, we can create streams for the pads and be done with it.
- * Also check that is has source pads, if not, we assume it will
- * do everything itself. */
- if (!analyse_source (decoder, &is_raw, &have_out, &is_dynamic,
- decoder->need_queue))
- goto invalid_source;
-
- if (is_raw) {
- GST_DEBUG_OBJECT (decoder, "Source provides all raw data");
- /* source provides raw data, we added the pads and we can now signal a
- * no_more pads because we are done. */
- gst_element_no_more_pads (GST_ELEMENT_CAST (decoder));
- return TRUE;
- }
- if (!have_out && !is_dynamic) {
- GST_DEBUG_OBJECT (decoder, "Source has no output pads");
- /* create a stream to indicate that this uri is handled by a self
- * contained element. We are now done. */
- add_element_stream (decoder->source, decoder);
- return TRUE;
- }
- if (is_dynamic) {
- GST_DEBUG_OBJECT (decoder, "Source has dynamic output pads");
- /* connect a handler for the new-pad signal */
- decoder->src_np_sig_id =
- g_signal_connect (decoder->source, "pad-added",
- G_CALLBACK (source_new_pad), decoder);
- decoder->src_nmp_sig_id =
- g_signal_connect (decoder->source, "no-more-pads",
- G_CALLBACK (source_no_more_pads), decoder);
- g_object_set_data (G_OBJECT (decoder->source), "pending", "1");
- decoder->pending++;
- } else {
- if (decoder->is_stream) {
- GST_DEBUG_OBJECT (decoder, "Setting up streaming");
- /* do the stream things here */
- if (!setup_streaming (decoder))
- goto streaming_failed;
- } else {
- GstElement *dec_elem;
-
- /* no streaming source, we can link now */
- GST_DEBUG_OBJECT (decoder, "Plugging decodebin to source");
-
- dec_elem = make_decoder (decoder);
- if (!dec_elem)
- goto no_decoder;
-
- if (!gst_element_link_pads (decoder->source, NULL, dec_elem, "sink"))
- goto could_not_link;
- }
- }
- return TRUE;
-
- /* ERRORS */
-no_source:
- {
- /* error message was already posted */
- return FALSE;
- }
-invalid_source:
- {
- GST_ELEMENT_ERROR (decoder, CORE, FAILED,
- (_("Source element is invalid.")), (NULL));
- return FALSE;
- }
-no_decoder:
- {
- /* message was posted */
- return FALSE;
- }
-streaming_failed:
- {
- /* message was posted */
- return FALSE;
- }
-could_not_link:
- {
- GST_ELEMENT_ERROR (decoder, CORE, NEGOTIATION,
- (NULL), ("Can't link source to decoder element"));
- return FALSE;
- }
-}
-
-static void
-value_list_append_structure_list (GValue * list_val, GstStructure ** first,
- GList * structure_list)
-{
- GList *l;
-
- for (l = structure_list; l != NULL; l = l->next) {
- GValue val = { 0, };
-
- if (*first == NULL)
- *first = gst_structure_copy ((GstStructure *) l->data);
-
- g_value_init (&val, GST_TYPE_STRUCTURE);
- g_value_take_boxed (&val, gst_structure_copy ((GstStructure *) l->data));
- gst_value_list_append_value (list_val, &val);
- g_value_unset (&val);
- }
-}
-
-/* if it's a redirect message with multiple redirect locations we might
- * want to pick a different 'best' location depending on the required
- * bitrates and the connection speed */
-static GstMessage *
-handle_redirect_message (GstURIDecodeBin * dec, GstMessage * msg)
-{
- const GValue *locations_list, *location_val;
- GstMessage *new_msg;
- GstStructure *new_structure = NULL;
- GList *l_good = NULL, *l_neutral = NULL, *l_bad = NULL;
- GValue new_list = { 0, };
- guint size, i;
-
- GST_DEBUG_OBJECT (dec, "redirect message: %" GST_PTR_FORMAT, msg);
- GST_DEBUG_OBJECT (dec, "connection speed: %u", dec->connection_speed);
-
- if (dec->connection_speed == 0 || msg->structure == NULL)
- return msg;
-
- locations_list = gst_structure_get_value (msg->structure, "locations");
- if (locations_list == NULL)
- return msg;
-
- size = gst_value_list_get_size (locations_list);
- if (size < 2)
- return msg;
-
- /* maintain existing order as much as possible, just sort references
- * with too high a bitrate to the end (the assumption being that if
- * bitrates are given they are given for all interesting streams and
- * that the you-need-at-least-version-xyz redirect has the same bitrate
- * as the lowest referenced redirect alternative) */
- for (i = 0; i < size; ++i) {
- const GstStructure *s;
- gint bitrate = 0;
-
- location_val = gst_value_list_get_value (locations_list, i);
- s = (const GstStructure *) g_value_get_boxed (location_val);
- if (!gst_structure_get_int (s, "minimum-bitrate", &bitrate) || bitrate <= 0) {
- GST_DEBUG_OBJECT (dec, "no bitrate: %" GST_PTR_FORMAT, s);
- l_neutral = g_list_append (l_neutral, (gpointer) s);
- } else if (bitrate > dec->connection_speed) {
- GST_DEBUG_OBJECT (dec, "bitrate too high: %" GST_PTR_FORMAT, s);
- l_bad = g_list_append (l_bad, (gpointer) s);
- } else if (bitrate <= dec->connection_speed) {
- GST_DEBUG_OBJECT (dec, "bitrate OK: %" GST_PTR_FORMAT, s);
- l_good = g_list_append (l_good, (gpointer) s);
- }
- }
-
- g_value_init (&new_list, GST_TYPE_LIST);
- value_list_append_structure_list (&new_list, &new_structure, l_good);
- value_list_append_structure_list (&new_list, &new_structure, l_neutral);
- value_list_append_structure_list (&new_list, &new_structure, l_bad);
- gst_structure_set_value (new_structure, "locations", &new_list);
- g_value_unset (&new_list);
-
- g_list_free (l_good);
- g_list_free (l_neutral);
- g_list_free (l_bad);
-
- new_msg = gst_message_new_element (msg->src, new_structure);
- gst_message_unref (msg);
-
- GST_DEBUG_OBJECT (dec, "new redirect message: %" GST_PTR_FORMAT, new_msg);
- return new_msg;
-}
-
-static void
-handle_message (GstBin * bin, GstMessage * msg)
-{
- if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ELEMENT && msg->structure != NULL
- && gst_structure_has_name (msg->structure, "redirect")) {
- /* sort redirect messages based on the connection speed. This simplifies
- * the user of this element as it can in most cases just pick the first item
- * of the sorted list as a good redirection candidate. It can of course
- * choose something else from the list if it has a better way. */
- msg = handle_redirect_message (GST_URI_DECODE_BIN (bin), msg);
- }
- GST_BIN_CLASS (parent_class)->handle_message (bin, msg);
-}
-
-/* generic struct passed to all query fold methods
- * FIXME, move to core.
- */
-typedef struct
-{
- GstQuery *query;
- gint64 min;
- gint64 max;
- gboolean seekable;
- gboolean live;
-} QueryFold;
-
-typedef void (*QueryInitFunction) (GstURIDecodeBin * dec, QueryFold * fold);
-typedef void (*QueryDoneFunction) (GstURIDecodeBin * dec, QueryFold * fold);
-
-/* for duration/position we collect all durations/positions and take
- * the MAX of all valid results */
-static void
-decoder_query_init (GstURIDecodeBin * dec, QueryFold * fold)
-{
- fold->min = 0;
- fold->max = -1;
- fold->seekable = TRUE;
- fold->live = 0;
-}
-
-static gboolean
-decoder_query_duration_fold (GstPad * item, GValue * ret, QueryFold * fold)
-{
- if (gst_pad_query (item, fold->query)) {
- gint64 duration;
-
- g_value_set_boolean (ret, TRUE);
-
- gst_query_parse_duration (fold->query, NULL, &duration);
-
- GST_DEBUG_OBJECT (item, "got duration %" G_GINT64_FORMAT, duration);
-
- if (duration > fold->max)
- fold->max = duration;
- }
- gst_object_unref (item);
- return TRUE;
-}
-
-static void
-decoder_query_duration_done (GstURIDecodeBin * dec, QueryFold * fold)
-{
- GstFormat format;
-
- gst_query_parse_duration (fold->query, &format, NULL);
- /* store max in query result */
- gst_query_set_duration (fold->query, format, fold->max);
-
- GST_DEBUG ("max duration %" G_GINT64_FORMAT, fold->max);
-}
-
-static gboolean
-decoder_query_position_fold (GstPad * item, GValue * ret, QueryFold * fold)
-{
- if (gst_pad_query (item, fold->query)) {
- gint64 position;
-
- g_value_set_boolean (ret, TRUE);
-
- gst_query_parse_position (fold->query, NULL, &position);
-
- GST_DEBUG_OBJECT (item, "got position %" G_GINT64_FORMAT, position);
-
- if (position > fold->max)
- fold->max = position;
- }
-
- gst_object_unref (item);
- return TRUE;
-}
-
-static void
-decoder_query_position_done (GstURIDecodeBin * dec, QueryFold * fold)
-{
- GstFormat format;
-
- gst_query_parse_position (fold->query, &format, NULL);
- /* store max in query result */
- gst_query_set_position (fold->query, format, fold->max);
-
- GST_DEBUG_OBJECT (dec, "max position %" G_GINT64_FORMAT, fold->max);
-}
-
-static gboolean
-decoder_query_latency_fold (GstPad * item, GValue * ret, QueryFold * fold)
-{
- if (gst_pad_query (item, fold->query)) {
- GstClockTime min, max;
- gboolean live;
-
- g_value_set_boolean (ret, TRUE);
-
- gst_query_parse_latency (fold->query, &live, &min, &max);
-
- GST_DEBUG_OBJECT (item,
- "got latency min %" GST_TIME_FORMAT ", max %" GST_TIME_FORMAT
- ", live %d", GST_TIME_ARGS (min), GST_TIME_ARGS (max), live);
-
- /* for the combined latency we collect the MAX of all min latencies and
- * the MIN of all max latencies */
- if (min > fold->min)
- fold->min = min;
- if (fold->max == -1)
- fold->max = max;
- else if (max < fold->max)
- fold->max = max;
- if (fold->live == FALSE)
- fold->live = live;
- }
-
- gst_object_unref (item);
- return TRUE;
-}
-
-static void
-decoder_query_latency_done (GstURIDecodeBin * dec, QueryFold * fold)
-{
- /* store max in query result */
- gst_query_set_latency (fold->query, fold->live, fold->min, fold->max);
-
- GST_DEBUG_OBJECT (dec,
- "latency min %" GST_TIME_FORMAT ", max %" GST_TIME_FORMAT
- ", live %d", GST_TIME_ARGS (fold->min), GST_TIME_ARGS (fold->max),
- fold->live);
-}
-
-/* we are seekable if all srcpads are seekable */
-static gboolean
-decoder_query_seeking_fold (GstPad * item, GValue * ret, QueryFold * fold)
-{
- if (gst_pad_query (item, fold->query)) {
- gboolean seekable;
-
- g_value_set_boolean (ret, TRUE);
- gst_query_parse_seeking (fold->query, NULL, &seekable, NULL, NULL);
-
- GST_DEBUG_OBJECT (item, "got seekable %d", seekable);
-
- if (fold->seekable == TRUE)
- fold->seekable = seekable;
- }
- gst_object_unref (item);
-
- return TRUE;
-}
-
-static void
-decoder_query_seeking_done (GstURIDecodeBin * dec, QueryFold * fold)
-{
- GstFormat format;
-
- gst_query_parse_seeking (fold->query, &format, NULL, NULL, NULL);
- gst_query_set_seeking (fold->query, format, fold->seekable, 0, -1);
-
- GST_DEBUG_OBJECT (dec, "seekable %d", fold->seekable);
-}
-
-/* generic fold, return first valid result */
-static gboolean
-decoder_query_generic_fold (GstPad * item, GValue * ret, QueryFold * fold)
-{
- gboolean res;
-
- if ((res = gst_pad_query (item, fold->query))) {
- g_value_set_boolean (ret, TRUE);
- GST_DEBUG_OBJECT (item, "answered query %p", fold->query);
- }
-
- gst_object_unref (item);
-
- /* and stop as soon as we have a valid result */
- return !res;
-}
-
-
-/* we're a bin, the default query handler iterates sink elements, which we don't
- * have normally. We should just query all source pads.
- */
-static gboolean
-gst_uri_decode_bin_query (GstElement * element, GstQuery * query)
-{
- GstURIDecodeBin *decoder;
- gboolean res = FALSE;
- GstIterator *iter;
- GstIteratorFoldFunction fold_func;
- QueryInitFunction fold_init = NULL;
- QueryDoneFunction fold_done = NULL;
- QueryFold fold_data;
- GValue ret = { 0 };
-
- decoder = GST_URI_DECODE_BIN (element);
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_DURATION:
- /* iterate and collect durations */
- fold_func = (GstIteratorFoldFunction) decoder_query_duration_fold;
- fold_init = decoder_query_init;
- fold_done = decoder_query_duration_done;
- break;
- case GST_QUERY_POSITION:
- /* iterate and collect durations */
- fold_func = (GstIteratorFoldFunction) decoder_query_position_fold;
- fold_init = decoder_query_init;
- fold_done = decoder_query_position_done;
- break;
- case GST_QUERY_LATENCY:
- /* iterate and collect durations */
- fold_func = (GstIteratorFoldFunction) decoder_query_latency_fold;
- fold_init = decoder_query_init;
- fold_done = decoder_query_latency_done;
- break;
- case GST_QUERY_SEEKING:
- /* iterate and collect durations */
- fold_func = (GstIteratorFoldFunction) decoder_query_seeking_fold;
- fold_init = decoder_query_init;
- fold_done = decoder_query_seeking_done;
- break;
- default:
- fold_func = (GstIteratorFoldFunction) decoder_query_generic_fold;
- break;
- }
-
- fold_data.query = query;
-
- g_value_init (&ret, G_TYPE_BOOLEAN);
- g_value_set_boolean (&ret, FALSE);
-
- iter = gst_element_iterate_src_pads (element);
- GST_DEBUG_OBJECT (element, "Sending query %p (type %d) to src pads",
- query, GST_QUERY_TYPE (query));
-
- if (fold_init)
- fold_init (decoder, &fold_data);
-
- while (TRUE) {
- GstIteratorResult ires;
-
- ires = gst_iterator_fold (iter, fold_func, &ret, &fold_data);
-
- switch (ires) {
- case GST_ITERATOR_RESYNC:
- gst_iterator_resync (iter);
- if (fold_init)
- fold_init (decoder, &fold_data);
- g_value_set_boolean (&ret, FALSE);
- break;
- case GST_ITERATOR_OK:
- case GST_ITERATOR_DONE:
- res = g_value_get_boolean (&ret);
- if (fold_done != NULL && res)
- fold_done (decoder, &fold_data);
- goto done;
- default:
- res = FALSE;
- goto done;
- }
- }
-done:
- gst_iterator_free (iter);
-
- return res;
-}
-
-static GstStateChangeReturn
-gst_uri_decode_bin_change_state (GstElement * element,
- GstStateChange transition)
-{
- GstStateChangeReturn ret;
- GstURIDecodeBin *decoder;
-
- decoder = GST_URI_DECODE_BIN (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- g_mutex_lock (decoder->factories_lock);
- gst_uri_decode_bin_update_factories_list (decoder);
- g_mutex_unlock (decoder->factories_lock);
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- if (!setup_source (decoder))
- goto source_failed;
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- GST_DEBUG ("ready to paused");
- if (ret == GST_STATE_CHANGE_FAILURE)
- goto setup_failed;
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- GST_DEBUG ("paused to ready");
- remove_decoders (decoder, FALSE);
- remove_pads (decoder);
- remove_source (decoder);
- do_async_done (decoder);
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- GST_DEBUG ("ready to null");
- remove_decoders (decoder, TRUE);
- remove_pads (decoder);
- remove_source (decoder);
- break;
- default:
- break;
- }
- return ret;
-
- /* ERRORS */
-source_failed:
- {
- return GST_STATE_CHANGE_FAILURE;
- }
-setup_failed:
- {
- /* clean up leftover groups */
- return GST_STATE_CHANGE_FAILURE;
- }
-}
-
-gboolean gst_decode_bin_plugin_init (GstPlugin * plugin);
-
-static gboolean
-gst_uri_decode_bin_plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (gst_uri_decode_bin_debug, "uridecodebin", 0,
- "URI decoder element");
-
-#ifdef ENABLE_NLS
- GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
- LOCALEDIR);
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif /* ENABLE_NLS */
-
- return gst_element_register (plugin, "uridecodebin", GST_RANK_NONE,
- GST_TYPE_URI_DECODE_BIN);
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_decode_bin_plugin_init (plugin))
- return FALSE;
- if (!gst_uri_decode_bin_plugin_init (plugin))
- return FALSE;
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "uridecodebin",
- "URI Decoder bin", plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME,
- GST_PACKAGE_ORIGIN)
diff --git a/gst/playback/test.c b/gst/playback/test.c
deleted file mode 100644
index 3c944ecb..00000000
--- a/gst/playback/test.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) <2007> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <gst/gst.h>
-
-#include <stdlib.h>
-
-static GMainLoop *loop;
-
-static GstElement *
-gen_video_element (void)
-{
- GstElement *element;
- GstElement *conv;
- GstElement *sink;
- GstPad *pad;
-
- element = gst_bin_new ("vbin");
- conv = gst_element_factory_make ("ffmpegcolorspace", "conv");
- sink = gst_element_factory_make (DEFAULT_VIDEOSINK, "sink");
-
- gst_bin_add (GST_BIN (element), conv);
- gst_bin_add (GST_BIN (element), sink);
- gst_element_link_pads (conv, "src", sink, "sink");
-
- pad = gst_element_get_static_pad (conv, "sink");
- gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- return element;
-}
-
-static GstElement *
-gen_audio_element (void)
-{
- GstElement *element;
- GstElement *conv;
- GstElement *sink;
- GstPad *pad;
-
- element = gst_bin_new ("abin");
- conv = gst_element_factory_make ("audioconvert", "conv");
- sink = gst_element_factory_make (DEFAULT_AUDIOSINK, "sink");
-
- gst_bin_add (GST_BIN (element), conv);
- gst_bin_add (GST_BIN (element), sink);
- gst_element_link_pads (conv, "src", sink, "sink");
-
- pad = gst_element_get_static_pad (conv, "sink");
- gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- return element;
-}
-
-static void
-cb_newpad (GstElement * decodebin, GstPad * pad, gboolean last, gpointer data)
-{
- GstCaps *caps;
- GstStructure *str;
- GstPad *sinkpad;
- GstElement *sink;
- GstElement *pipeline;
- const gchar *name;
- GstStateChangeReturn ret;
- GstPadLinkReturn lret;
-
- /* check media type */
- caps = gst_pad_get_caps (pad);
- str = gst_caps_get_structure (caps, 0);
-
- name = gst_structure_get_name (str);
- g_print ("name: %s\n", name);
-
- if (g_strrstr (name, "audio")) {
- sink = gen_audio_element ();
- } else if (g_strrstr (name, "video")) {
- sink = gen_video_element ();
- } else {
- sink = NULL;
- }
- gst_caps_unref (caps);
-
- if (sink) {
- pipeline = GST_ELEMENT_CAST (data);
-
- /* add new sink to the pipeline */
- gst_bin_add (GST_BIN_CAST (pipeline), sink);
-
- /* set the new sink tp PAUSED as well */
- ret = gst_element_set_state (sink, GST_STATE_PAUSED);
- if (ret == GST_STATE_CHANGE_FAILURE)
- goto state_error;
-
- /* get the ghostpad of the sink bin */
- sinkpad = gst_element_get_static_pad (sink, "sink");
-
- /* link'n'play */
- lret = gst_pad_link (pad, sinkpad);
- if (lret != GST_PAD_LINK_OK)
- goto link_failed;
-
- gst_object_unref (sinkpad);
- }
- return;
-
- /* ERRORS */
-state_error:
- {
- gst_bin_remove (GST_BIN_CAST (pipeline), sink);
- g_warning ("could not change state of new sink (%d)", ret);
- return;
- }
-link_failed:
- {
- g_warning ("could not link pad and sink (%d)", lret);
- return;
- }
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
- GstElement *pipeline, *filesrc, *decodebin;
- GstStateChangeReturn res;
-
- gst_init (&argc, &argv);
-
- pipeline = gst_pipeline_new ("pipeline");
-
- filesrc = gst_element_factory_make ("filesrc", "filesrc");
- g_assert (filesrc);
- decodebin = gst_element_factory_make ("decodebin", "decodebin");
- g_assert (decodebin);
-
- g_signal_connect (G_OBJECT (decodebin), "new-decoded-pad",
- G_CALLBACK (cb_newpad), pipeline);
-
- gst_bin_add_many (GST_BIN (pipeline), filesrc, decodebin, NULL);
- gst_element_link (filesrc, decodebin);
-
- if (argc < 2) {
- g_print ("usage: %s <uri>\n", argv[0]);
- exit (-1);
- }
- g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
-
- /* set to paused, decodebin will autoplug and signal new_pad callbacks */
- res = gst_element_set_state (pipeline, GST_STATE_PAUSED);
- if (res == GST_STATE_CHANGE_FAILURE) {
- g_print ("could not pause\n");
- return -1;
- }
- /* wait for paused to complete */
- res = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
- if (res == GST_STATE_CHANGE_FAILURE) {
- g_print ("could not pause\n");
- return -1;
- }
-
- /* play, now all the sinks are added to the pipeline and are prerolled and
- * ready to play. */
- res = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (res == GST_STATE_CHANGE_FAILURE) {
- g_print ("could not play\n");
- return -1;
- }
-
- /* go in the mainloop now */
- loop = g_main_loop_new (NULL, TRUE);
- g_main_loop_run (loop);
-
- return 0;
-}
diff --git a/gst/playback/test2.c b/gst/playback/test2.c
deleted file mode 100644
index 86f3c4cc..00000000
--- a/gst/playback/test2.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#include <gst/gst.h>
-
-gint
-main (gint argc, gchar * argv[])
-{
- GstElement *player;
- GstStateChangeReturn res;
-
- gst_init (&argc, &argv);
-
- player = gst_element_factory_make ("playbin", "player");
- g_assert (player);
-
- g_object_set (G_OBJECT (player), "uri", argv[1], NULL);
-
- res = gst_element_set_state (player, GST_STATE_PLAYING);
- if (res != GST_STATE_CHANGE_SUCCESS) {
- g_print ("could not play\n");
- return -1;
- }
-
- g_main_loop_run (g_main_loop_new (NULL, TRUE));
-
- return 0;
-}
diff --git a/gst/playback/test3.c b/gst/playback/test3.c
deleted file mode 100644
index dd08f7cf..00000000
--- a/gst/playback/test3.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#include <gst/gst.h>
-
-#define UPDATE_INTERVAL 500
-
-static gboolean
-update_scale (GstElement * element)
-{
- gint64 duration = -1;
- gint64 position = -1;
- GstFormat format = GST_FORMAT_TIME;
- gchar dur_str[32], pos_str[32];
-
- if (gst_element_query_position (element, &format, &position) &&
- position != -1) {
- g_snprintf (pos_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (position));
- } else {
- g_snprintf (pos_str, 32, "-:--:--.---------");
- }
-
- if (gst_element_query_duration (element, &format, &duration) &&
- duration != -1) {
- g_snprintf (dur_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (duration));
- } else {
- g_snprintf (dur_str, 32, "-:--:--.---------");
- }
-
- g_print ("%s / %s\n", pos_str, dur_str);
-
- return TRUE;
-}
-
-static void
-warning_cb (GstBus * bus, GstMessage * msg, gpointer foo)
-{
- GError *err = NULL;
- gchar *dbg = NULL;
-
- gst_message_parse_warning (msg, &err, &dbg);
-
- g_printerr ("WARNING: %s (%s)\n", err->message, (dbg) ? dbg : "no details");
-
- g_error_free (err);
- g_free (dbg);
-}
-
-static void
-error_cb (GstBus * bus, GstMessage * msg, GMainLoop * main_loop)
-{
- GError *err = NULL;
- gchar *dbg = NULL;
-
- gst_message_parse_error (msg, &err, &dbg);
-
- g_printerr ("ERROR: %s (%s)\n", err->message, (dbg) ? dbg : "no details");
-
- g_main_loop_quit (main_loop);
-
- g_error_free (err);
- g_free (dbg);
-}
-
-static void
-eos_cb (GstBus * bus, GstMessage * msg, GMainLoop * main_loop)
-{
- g_print ("EOS\n");
- g_main_loop_quit (main_loop);
-}
-
-
-gint
-main (gint argc, gchar * argv[])
-{
- GstStateChangeReturn res;
- GstElement *player;
- GMainLoop *loop;
- GstBus *bus;
-
- gst_init (&argc, &argv);
-
- loop = g_main_loop_new (NULL, TRUE);
-
- player = gst_element_factory_make ("playbin", "player");
- g_assert (player);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (player));
- gst_bus_add_signal_watch (bus);
-
- g_signal_connect (bus, "message::eos", G_CALLBACK (eos_cb), loop);
- g_signal_connect (bus, "message::error", G_CALLBACK (error_cb), loop);
- g_signal_connect (bus, "message::warning", G_CALLBACK (warning_cb), NULL);
-
- g_object_set (G_OBJECT (player), "uri", argv[1], NULL);
-
- res = gst_element_set_state (player, GST_STATE_PLAYING);
- if (res == GST_STATE_CHANGE_FAILURE) {
- g_print ("could not play\n");
- return -1;
- }
-
- g_timeout_add (UPDATE_INTERVAL, (GSourceFunc) update_scale, player);
-
- g_main_loop_run (loop);
-
- /* tidy up */
- gst_element_set_state (player, GST_STATE_NULL);
- gst_object_unref (player);
- gst_object_unref (bus);
-
- return 0;
-}
diff --git a/gst/playback/test4.c b/gst/playback/test4.c
deleted file mode 100644
index c2bb7c91..00000000
--- a/gst/playback/test4.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h> /* exit() */
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <gst/gst.h>
-
-gint
-main (gint argc, gchar * argv[])
-{
- GstElement *player;
- GstStateChangeReturn res;
-
- gst_init (&argc, &argv);
-
- player = gst_element_factory_make ("playbin", "player");
- g_assert (player);
-
- if (argc < 2) {
- g_print ("usage: %s <uri>\n", argv[0]);
- exit (-1);
- }
-
- g_object_set (G_OBJECT (player), "uri", argv[1], NULL);
-
- g_print ("play...\n");
- res = gst_element_set_state (player, GST_STATE_PLAYING);
- if (res != GST_STATE_CHANGE_SUCCESS) {
- g_print ("could not play\n");
- return -1;
- }
-
- g_print ("sleep 2...\n");
- g_usleep (2 * G_USEC_PER_SEC);
-
- g_print ("pause...\n");
- res = gst_element_set_state (player, GST_STATE_PAUSED);
- if (res != GST_STATE_CHANGE_SUCCESS) {
- g_print ("could not play\n");
- return -1;
- }
-
- g_print ("sleep 2...\n");
- g_usleep (2 * G_USEC_PER_SEC);
-
- g_print ("play...\n");
- res = gst_element_set_state (player, GST_STATE_PLAYING);
- if (res != GST_STATE_CHANGE_SUCCESS) {
- g_print ("could not play\n");
- return -1;
- }
-
- g_print ("sleep 2...\n");
- g_usleep (2 * G_USEC_PER_SEC);
-
- g_print ("ready...\n");
- res = gst_element_set_state (player, GST_STATE_READY);
- if (res != GST_STATE_CHANGE_SUCCESS) {
- g_print ("could not play\n");
- return -1;
- }
-
- g_print ("sleep 2...\n");
- g_usleep (2 * G_USEC_PER_SEC);
-
- g_print ("play...\n");
- res = gst_element_set_state (player, GST_STATE_PLAYING);
- if (res != GST_STATE_CHANGE_SUCCESS) {
- g_print ("could not play\n");
- return -1;
- }
-
- g_main_loop_run (g_main_loop_new (NULL, TRUE));
-
- return 0;
-}
diff --git a/gst/playback/test5.c b/gst/playback/test5.c
deleted file mode 100644
index 715b4bbd..00000000
--- a/gst/playback/test5.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h> /* exit */
-#endif
-#include <gst/gst.h>
-
-static GMainLoop *loop;
-
-static void
-new_pad (GstElement * element, GstPad * pad, gboolean last, GstElement * sink)
-{
- g_print ("New pad...\n");
-}
-
-static void
-no_more_pads (GstElement * element)
-{
- g_print ("No more pads...\n");
- g_main_loop_quit (loop);
-}
-
-static gboolean
-start_finding (GstElement * pipeline)
-{
- GstStateChangeReturn res;
-
- g_print ("finding caps...\n");
- res = gst_element_set_state (pipeline, GST_STATE_PAUSED);
- if (res == GST_STATE_CHANGE_FAILURE) {
- g_print ("could not pause\n");
- exit (-1);
- }
- return FALSE;
-}
-
-static void
-dump_element_stats (GstElement * element)
-{
- GstIterator *it;
- gpointer data;
-
- it = gst_element_iterate_src_pads (element);
- while (gst_iterator_next (it, &data) == GST_ITERATOR_OK) {
- GstPad *pad = GST_PAD (data);
- GstCaps *caps;
- gchar *str;
- GstQuery *query;
-
- g_print ("stream %s:\n", GST_OBJECT_NAME (pad));
-
- caps = gst_pad_get_caps (pad);
- str = gst_caps_to_string (caps);
- g_print (" caps: %s\n", str);
- g_free (str);
- gst_caps_unref (caps);
-
- query = gst_query_new_duration (GST_FORMAT_TIME);
- if (gst_pad_query (pad, query)) {
- gint64 duration;
-
- gst_query_parse_duration (query, NULL, &duration);
-
- g_print (" duration: %" GST_TIME_FORMAT "\n", GST_TIME_ARGS (duration));
- }
- gst_query_unref (query);
-
- gst_object_unref (pad);
- }
- gst_iterator_free (it);
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
- GstElement *pipeline, *filesrc, *decodebin;
-
- gst_init (&argc, &argv);
-
- pipeline = gst_pipeline_new ("pipeline");
-
- filesrc = gst_element_factory_make ("filesrc", "filesrc");
- g_assert (filesrc);
-
- decodebin = gst_element_factory_make ("decodebin", "decodebin");
- g_assert (decodebin);
-
- g_signal_connect (G_OBJECT (decodebin), "new-decoded-pad",
- G_CALLBACK (new_pad), NULL);
- g_signal_connect (G_OBJECT (decodebin), "no-more-pads",
- G_CALLBACK (no_more_pads), NULL);
-
- gst_bin_add_many (GST_BIN (pipeline), filesrc, decodebin, NULL);
- gst_element_link (filesrc, decodebin);
-
- if (argc < 2) {
- g_print ("usage: %s <uri>\n", argv[0]);
- exit (-1);
- }
- g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
-
- /* event based programming approach */
- loop = g_main_loop_new (NULL, TRUE);
- g_idle_add ((GSourceFunc) start_finding, pipeline);
- g_main_loop_run (loop);
-
- dump_element_stats (decodebin);
-
- return 0;
-}
diff --git a/gst/playback/test6.c b/gst/playback/test6.c
deleted file mode 100644
index 17e50f9e..00000000
--- a/gst/playback/test6.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h> /* exit */
-#endif
-#include <gst/gst.h>
-
-static void
-new_decoded_pad_cb (GstElement * decodebin, GstPad * new_pad, gboolean last,
- GstElement * pipeline)
-{
- GstElement *fakesink;
- GstPad *sinkpad;
-
- fakesink = gst_element_factory_make ("fakesink", NULL);
- gst_bin_add (GST_BIN (pipeline), fakesink);
-
- sinkpad = gst_element_get_static_pad (fakesink, "sink");
- if (GST_PAD_LINK_FAILED (gst_pad_link (new_pad, sinkpad))) {
- g_warning ("Failed to link %s:%s to %s:%s", GST_DEBUG_PAD_NAME (new_pad),
- GST_DEBUG_PAD_NAME (sinkpad));
- gst_bin_remove (GST_BIN (pipeline), fakesink);
- } else {
- gst_element_set_state (fakesink, GST_STATE_PAUSED);
- }
-}
-
-static void
-show_error (const gchar * errmsg, GstBus * bus)
-{
- GstMessage *msg;
- GError *err = NULL;
- gchar *dbg = NULL;
-
- msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, 0);
- if (msg) {
- g_assert (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR);
-
- gst_message_parse_error (msg, &err, &dbg);
- }
-
- g_print ("ERROR: %s\n", errmsg);
- g_print (" %s\n", (err) ? err->message : "");
- if (dbg) {
- g_print ("\ndebug: %s\n\n", dbg);
- g_free (dbg);
- }
-
- if (err)
- g_error_free (err);
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
- GstElement *pipeline, *filesrc, *decodebin;
- GstStateChangeReturn res;
- GstIterator *it;
- GstBus *bus;
- gpointer data;
-
- gst_init (&argc, &argv);
-
- pipeline = gst_pipeline_new ("pipeline");
-
- filesrc = gst_element_factory_make ("filesrc", "filesrc");
- g_assert (filesrc);
-
- decodebin = gst_element_factory_make ("decodebin", "decodebin");
- g_assert (decodebin);
-
- gst_bin_add_many (GST_BIN (pipeline), filesrc, decodebin, NULL);
- gst_element_link (filesrc, decodebin);
-
- if (argc < 2) {
- g_print ("usage: %s <filenames>\n", argv[0]);
- exit (-1);
- }
-
- if (!g_str_has_prefix (argv[1], "file://")) {
- g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
- } else {
- g_object_set (G_OBJECT (filesrc), "location", argv[1] + 7, NULL);
- }
-
- /* we've got to connect fakesinks to newly decoded pads to make sure
- * buffers have actually been flowing over those pads and caps have
- * been set on them. decodebin might insert internal queues and
- * without fakesinks it's pot-luck what caps we get from the pad, because
- * it depends on whether the queues have started pushing buffers yet or not.
- * With fakesinks we make sure that the pipeline doesn't go to PAUSED state
- * before each fakesink has a buffer queued. */
- g_signal_connect (decodebin, "new-decoded-pad",
- G_CALLBACK (new_decoded_pad_cb), pipeline);
-
- bus = gst_element_get_bus (pipeline);
-
- g_print ("pause..\n");
- res = gst_element_set_state (pipeline, GST_STATE_PAUSED);
- if (res == GST_STATE_CHANGE_FAILURE) {
- show_error ("Could not go to PAUSED state", bus);
- exit (-1);
- }
- g_print ("waiting..\n");
- res = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
- if (res != GST_STATE_CHANGE_SUCCESS) {
- show_error ("Failed to complete state change to PAUSED", bus);
- exit (-1);
- }
- g_print ("stats..\n");
-
- it = gst_element_iterate_src_pads (decodebin);
- while (gst_iterator_next (it, &data) == GST_ITERATOR_OK) {
- GstPad *pad = GST_PAD (data);
- GstCaps *caps;
- gchar *str;
- GstQuery *query;
-
- g_print ("stream %s:\n", GST_OBJECT_NAME (pad));
-
- caps = gst_pad_get_caps (pad);
- str = gst_caps_to_string (caps);
- g_print (" caps: %s\n", str);
- g_free (str);
- gst_caps_unref (caps);
-
- query = gst_query_new_duration (GST_FORMAT_TIME);
- if (gst_pad_query (pad, query)) {
- gint64 duration;
-
- gst_query_parse_duration (query, NULL, &duration);
-
- g_print (" duration: %" GST_TIME_FORMAT "\n", GST_TIME_ARGS (duration));
- }
- gst_query_unref (query);
-
- gst_object_unref (pad);
- }
- gst_iterator_free (it);
-
- return 0;
-}
diff --git a/gst/playback/test7.c b/gst/playback/test7.c
deleted file mode 100644
index 31b97300..00000000
--- a/gst/playback/test7.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h> /* exit() */
-#endif
-#include <gst/gst.h>
-
-#define UPDATE_INTERVAL 500
-
-static int arg_count;
-static int max_count;
-
-static gboolean
-update_scale (GstElement * element)
-{
- gint64 duration = -1;
- gint64 position = -1;
- GstFormat format = GST_FORMAT_TIME;
- gchar dur_str[32], pos_str[32];
-
- if (gst_element_query_position (element, &format, &position) &&
- position != -1) {
- g_snprintf (pos_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (position));
- } else {
- g_snprintf (pos_str, 32, "-:--:--.---------");
- }
-
- if (gst_element_query_duration (element, &format, &duration) &&
- duration != -1) {
- g_snprintf (dur_str, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (duration));
- } else {
- g_snprintf (dur_str, 32, "-:--:--.---------");
- }
-
- g_print ("%s / %s\n", pos_str, dur_str);
-
- return TRUE;
-}
-
-static void
-warning_cb (GstBus * bus, GstMessage * msg, gpointer foo)
-{
- GError *err = NULL;
- gchar *dbg = NULL;
-
- gst_message_parse_warning (msg, &err, &dbg);
-
- g_printerr ("WARNING: %s (%s)\n", err->message, (dbg) ? dbg : "no details");
-
- g_error_free (err);
- g_free (dbg);
-}
-
-static void
-error_cb (GstBus * bus, GstMessage * msg, GMainLoop * main_loop)
-{
- GError *err = NULL;
- gchar *dbg = NULL;
-
- gst_message_parse_error (msg, &err, &dbg);
-
- g_printerr ("ERROR: %s (%s)\n", err->message, (dbg) ? dbg : "no details");
-
- g_main_loop_quit (main_loop);
-
- g_error_free (err);
- g_free (dbg);
-}
-
-static void
-eos_cb (GstBus * bus, GstMessage * msg, GMainLoop * main_loop)
-{
- g_print ("EOS\n");
- g_main_loop_quit (main_loop);
-}
-
-static void
-about_to_finish_cb (GstElement * element, gchar * uri[])
-{
- if (arg_count < max_count) {
- g_object_set (G_OBJECT (element), "uri", uri[arg_count], NULL);
- arg_count++;
- }
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
- GstStateChangeReturn res;
- GstElement *player;
- GMainLoop *loop;
- GstBus *bus;
-
- gst_init (&argc, &argv);
-
- loop = g_main_loop_new (NULL, TRUE);
-
- if (argc < 2) {
- g_print ("usage: %s <uri> [<uri> ... ]\n", argv[0]);
- exit (-1);
- }
-
- player = gst_element_factory_make ("playbin2", "player");
- g_assert (player);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (player));
- gst_bus_add_signal_watch (bus);
-
- g_signal_connect (bus, "message::eos", G_CALLBACK (eos_cb), loop);
- g_signal_connect (bus, "message::error", G_CALLBACK (error_cb), loop);
- g_signal_connect (bus, "message::warning", G_CALLBACK (warning_cb), NULL);
-
- g_object_set (G_OBJECT (player), "uri", argv[1], NULL);
-
- arg_count = 2;
- max_count = argc;
- g_signal_connect (player, "about-to-finish", G_CALLBACK (about_to_finish_cb),
- argv);
-
- res = gst_element_set_state (player, GST_STATE_PLAYING);
- if (res == GST_STATE_CHANGE_FAILURE) {
- g_print ("could not play\n");
- return -1;
- }
-
- g_timeout_add (UPDATE_INTERVAL, (GSourceFunc) update_scale, player);
-
- g_main_loop_run (loop);
-
- /* tidy up */
- gst_element_set_state (player, GST_STATE_NULL);
- gst_object_unref (player);
- gst_object_unref (bus);
-
- return 0;
-}
diff --git a/gst/subparse/Makefile.am b/gst/subparse/Makefile.am
deleted file mode 100644
index 4a33bd41..00000000
--- a/gst/subparse/Makefile.am
+++ /dev/null
@@ -1,33 +0,0 @@
-plugin_LTLIBRARIES = libgstsubparse.la
-
-if USE_XML
-SAMIPARSE_SOURCES = samiparse.c samiparse.h
-else
-SAMIPARSE_SOURCES =
-endif
-
-libgstsubparse_la_SOURCES = \
- gstssaparse.c \
- gstssaparse.h \
- gstsubparse.c \
- gstsubparse.h \
- $(SAMIPARSE_SOURCES) \
- tmplayerparse.c \
- tmplayerparse.h \
- mpl2parse.c \
- mpl2parse.h \
- qttextparse.c \
- qttextparse.h
-
-libgstsubparse_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS)
-libgstsubparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstsubparse_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS)
-libgstsubparse_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = \
- gstssaparse.h \
- gstsubparse.h \
- samiparse.h \
- tmplayerparse.h \
- mpl2parse.h \
- qttextparse.h
diff --git a/gst/subparse/gstssaparse.c b/gst/subparse/gstssaparse.c
deleted file mode 100644
index d4000770..00000000
--- a/gst/subparse/gstssaparse.c
+++ /dev/null
@@ -1,384 +0,0 @@
-/* GStreamer SSA subtitle parser
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/* Super-primitive SSA parser - we just want the text and ignore
- * everything else like styles and timing codes etc. for now */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h> /* atoi() */
-#include <string.h>
-
-#include "gstssaparse.h"
-
-GST_DEBUG_CATEGORY_STATIC (ssa_parse_debug);
-#define GST_CAT_DEFAULT ssa_parse_debug
-
-static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-ssa; application/x-ass")
- );
-
-static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("text/x-pango-markup")
- );
-
-GST_BOILERPLATE (GstSsaParse, gst_ssa_parse, GstElement, GST_TYPE_ELEMENT);
-
-static GstStateChangeReturn gst_ssa_parse_change_state (GstElement *
- element, GstStateChange transition);
-static gboolean gst_ssa_parse_setcaps (GstPad * sinkpad, GstCaps * caps);
-static gboolean gst_ssa_parse_src_event (GstPad * pad, GstEvent * event);
-static gboolean gst_ssa_parse_sink_event (GstPad * pad, GstEvent * event);
-static GstFlowReturn gst_ssa_parse_chain (GstPad * sinkpad, GstBuffer * buf);
-
-static void
-gst_ssa_parse_base_init (gpointer klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- static GstElementDetails ssa_parse_details = {
- "SSA Subtitle Parser",
- "Codec/Parser/Subtitle",
- "Parses SSA subtitle streams",
- "Tim-Philipp Müller <tim centricular net>"
- };
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_templ));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_templ));
- gst_element_class_set_details (element_class, &ssa_parse_details);
-
- GST_DEBUG_CATEGORY_INIT (ssa_parse_debug, "ssaparse", 0,
- "SSA subtitle parser");
-}
-
-static void
-gst_ssa_parse_dispose (GObject * object)
-{
- GstSsaParse *parse = GST_SSA_PARSE (object);
-
- g_free (parse->ini);
- parse->ini = NULL;
-
- GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
-}
-
-static void
-gst_ssa_parse_init (GstSsaParse * parse, GstSsaParseClass * klass)
-{
- parse->sinkpad = gst_pad_new_from_static_template (&sink_templ, "sink");
- gst_pad_set_setcaps_function (parse->sinkpad,
- GST_DEBUG_FUNCPTR (gst_ssa_parse_setcaps));
- gst_pad_set_chain_function (parse->sinkpad,
- GST_DEBUG_FUNCPTR (gst_ssa_parse_chain));
- gst_pad_set_event_function (parse->sinkpad,
- GST_DEBUG_FUNCPTR (gst_ssa_parse_sink_event));
- gst_element_add_pad (GST_ELEMENT (parse), parse->sinkpad);
-
- parse->srcpad = gst_pad_new_from_static_template (&src_templ, "src");
- gst_pad_set_event_function (parse->srcpad,
- GST_DEBUG_FUNCPTR (gst_ssa_parse_src_event));
- gst_element_add_pad (GST_ELEMENT (parse), parse->srcpad);
- gst_pad_use_fixed_caps (parse->srcpad);
- gst_pad_set_caps (parse->srcpad,
- gst_static_pad_template_get_caps (&src_templ));
-
- parse->ini = NULL;
- parse->framed = FALSE;
- parse->send_tags = FALSE;
-}
-
-static void
-gst_ssa_parse_class_init (GstSsaParseClass * klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- object_class->dispose = gst_ssa_parse_dispose;
-
- element_class->change_state = GST_DEBUG_FUNCPTR (gst_ssa_parse_change_state);
-}
-
-static gboolean
-gst_ssa_parse_src_event (GstPad * pad, GstEvent * event)
-{
- return gst_pad_event_default (pad, event);
-}
-
-static gboolean
-gst_ssa_parse_sink_event (GstPad * pad, GstEvent * event)
-{
- return gst_pad_event_default (pad, event);
-}
-
-static gboolean
-gst_ssa_parse_setcaps (GstPad * sinkpad, GstCaps * caps)
-{
- GstSsaParse *parse = GST_SSA_PARSE (GST_PAD_PARENT (sinkpad));
- const GValue *val;
- GstStructure *s;
- const guchar bom_utf8[] = { 0xEF, 0xBB, 0xBF };
- GstBuffer *priv;
- gchar *data;
- guint size;
-
- s = gst_caps_get_structure (caps, 0);
- val = gst_structure_get_value (s, "codec_data");
- if (val == NULL) {
- parse->framed = FALSE;
- GST_ERROR ("Only SSA subtitles embedded in containers are supported");
- return FALSE;
- }
-
- parse->framed = TRUE;
- parse->send_tags = TRUE;
-
- priv = (GstBuffer *) gst_value_get_mini_object (val);
- g_return_val_if_fail (priv != NULL, FALSE);
-
- gst_buffer_ref (priv);
-
- data = (gchar *) GST_BUFFER_DATA (priv);
- size = GST_BUFFER_SIZE (priv);
- /* skip UTF-8 BOM */
- if (size >= 3 && memcmp (data, bom_utf8, 3) == 0) {
- data += 3;
- size -= 3;
- }
-
- if (!strstr (data, "[Script Info]")) {
- GST_WARNING_OBJECT (parse, "Invalid Init section - no Script Info header");
- gst_buffer_unref (priv);
- return FALSE;
- }
-
- if (!g_utf8_validate (data, size, NULL)) {
- GST_WARNING_OBJECT (parse, "Init section is not valid UTF-8");
- gst_buffer_unref (priv);
- return FALSE;
- }
-
- /* FIXME: parse initial section */
- parse->ini = g_strndup (data, size);
- GST_LOG_OBJECT (parse, "Init section:\n%s", parse->ini);
-
- gst_buffer_unref (priv);
-
- return TRUE;
-}
-
-static gboolean
-gst_ssa_parse_remove_override_codes (GstSsaParse * parse, gchar * txt)
-{
- gchar *t, *end;
- gboolean removed_any = FALSE;
-
- while ((t = strchr (txt, '{'))) {
- end = strchr (txt, '}');
- if (end == NULL) {
- GST_WARNING_OBJECT (parse, "Missing { for style override code");
- return removed_any;
- }
- /* move terminating NUL character forward as well */
- g_memmove (t, end + 1, strlen (end + 1) + 1);
- removed_any = TRUE;
- }
-
- /* these may occur outside of curly brackets. We don't handle the different
- * wrapping modes yet, so just remove these markers from the text for now */
- while ((t = strstr (txt, "\\n"))) {
- t[0] = ' ';
- t[1] = '\n';
- }
- while ((t = strstr (txt, "\\N"))) {
- t[0] = ' ';
- t[1] = '\n';
- }
- while ((t = strstr (txt, "\\h"))) {
- t[0] = ' ';
- t[1] = ' ';
- }
-
- return removed_any;
-}
-
-/**
- * gst_ssa_parse_push_line:
- * @parse: caller element
- * @txt: text to push
- * @start: timestamp for the buffer
- * @duration: duration for the buffer
- *
- * Parse the text in a buffer with the given properties and
- * push it to the srcpad of the @parse element
- *
- * Returns: result of the push of the created buffer
- */
-static GstFlowReturn
-gst_ssa_parse_push_line (GstSsaParse * parse, gchar * txt,
- GstClockTime start, GstClockTime duration)
-{
- GstFlowReturn ret;
- GstBuffer *buf;
- gchar *t, *escaped;
- gint num, i, len;
-
- num = atoi (txt);
- GST_LOG_OBJECT (parse, "Parsing line #%d at %" GST_TIME_FORMAT,
- num, GST_TIME_ARGS (start));
-
- /* skip all non-text fields before the actual text */
- t = txt;
- for (i = 0; i < 8; ++i) {
- t = strchr (t, ',');
- if (t == NULL)
- return GST_FLOW_ERROR;
- ++t;
- }
-
- GST_LOG_OBJECT (parse, "Text : %s", t);
-
- if (gst_ssa_parse_remove_override_codes (parse, t)) {
- GST_LOG_OBJECT (parse, "Clean: %s", t);
- }
-
- /* we claim to output pango markup, so we must escape the
- * text even if we don't actually use any pango markup yet */
- escaped = g_markup_printf_escaped ("%s", t);
-
- len = strlen (escaped);
-
- /* allocate enough for a terminating NUL, but don't include it in buf size */
- buf = gst_buffer_new_and_alloc (len + 1);
- memcpy (GST_BUFFER_DATA (buf), escaped, len + 1);
- GST_BUFFER_SIZE (buf) = len;
- g_free (escaped);
-
- GST_BUFFER_TIMESTAMP (buf) = start;
- GST_BUFFER_DURATION (buf) = duration;
-
- gst_buffer_set_caps (buf, GST_PAD_CAPS (parse->srcpad));
-
- GST_LOG_OBJECT (parse, "Pushing buffer with timestamp %" GST_TIME_FORMAT
- " and duration %" GST_TIME_FORMAT, GST_TIME_ARGS (start),
- GST_TIME_ARGS (duration));
-
- ret = gst_pad_push (parse->srcpad, buf);
-
- if (ret != GST_FLOW_OK) {
- GST_DEBUG_OBJECT (parse, "Push of text '%s' returned flow %s", txt,
- gst_flow_get_name (ret));
- }
-
- return ret;
-}
-
-static GstFlowReturn
-gst_ssa_parse_chain (GstPad * sinkpad, GstBuffer * buf)
-{
- GstFlowReturn ret;
- GstSsaParse *parse = GST_SSA_PARSE (GST_PAD_PARENT (sinkpad));
- GstClockTime ts;
- gchar *txt;
-
- if (G_UNLIKELY (!parse->framed))
- goto not_framed;
-
- if (G_UNLIKELY (parse->send_tags)) {
- GstTagList *tags;
-
- tags = gst_tag_list_new ();
- gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_SUBTITLE_CODEC,
- "SubStation Alpha", NULL);
- gst_element_found_tags_for_pad (GST_ELEMENT (parse), parse->srcpad, tags);
- parse->send_tags = FALSE;
- }
-
- /* make double-sure it's 0-terminated and all */
- txt = g_strndup ((gchar *) GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
- if (txt == NULL)
- goto empty_text;
-
- ts = GST_BUFFER_TIMESTAMP (buf);
- ret = gst_ssa_parse_push_line (parse, txt, ts, GST_BUFFER_DURATION (buf));
-
- if (ret != GST_FLOW_OK && GST_CLOCK_TIME_IS_VALID (ts)) {
- /* just advance time without sending anything */
- gst_pad_push_event (parse->srcpad,
- gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, ts, -1, ts));
- ret = GST_FLOW_OK;
- }
-
- gst_buffer_unref (buf);
- g_free (txt);
-
- return ret;
-
-/* ERRORS */
-not_framed:
- {
- GST_ELEMENT_ERROR (parse, STREAM, FORMAT, (NULL),
- ("Only SSA subtitles embedded in containers are supported"));
- gst_buffer_unref (buf);
- return GST_FLOW_NOT_NEGOTIATED;
- }
-empty_text:
- {
- GST_ELEMENT_WARNING (parse, STREAM, FORMAT, (NULL),
- ("Received empty subtitle"));
- gst_buffer_unref (buf);
- return GST_FLOW_OK;
- }
-}
-
-static GstStateChangeReturn
-gst_ssa_parse_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
- GstSsaParse *parse = GST_SSA_PARSE (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- break;
- default:
- break;
- }
-
- ret = parent_class->change_state (element, transition);
- if (ret == GST_STATE_CHANGE_FAILURE)
- return ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- g_free (parse->ini);
- parse->ini = NULL;
- parse->framed = FALSE;
- break;
- default:
- break;
- }
-
- return ret;
-}
diff --git a/gst/subparse/gstssaparse.h b/gst/subparse/gstssaparse.h
deleted file mode 100644
index 518c3cd6..00000000
--- a/gst/subparse/gstssaparse.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* GStreamer SSA subtitle parser
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_SSA_PARSE_H__
-#define __GST_SSA_PARSE_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_SSA_PARSE (gst_ssa_parse_get_type ())
-#define GST_SSA_PARSE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_SSA_PARSE, GstSsaParse))
-#define GST_SSA_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_SSA_PARSE, GstSsaParseClass))
-#define GST_IS_SSA_PARSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_SSA_PARSE))
-#define GST_IS_SSA_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_SSA_PARSE))
-
-typedef struct _GstSsaParse GstSsaParse;
-typedef struct _GstSsaParseClass GstSsaParseClass;
-
-struct _GstSsaParse {
- GstElement element;
-
- GstPad *sinkpad;
- GstPad *srcpad;
-
- gboolean framed;
- gboolean send_tags;
-
- gchar *ini;
-};
-
-struct _GstSsaParseClass {
- GstElementClass parent_class;
-};
-
-GType gst_ssa_parse_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_SSA_PARSE_H__ */
-
diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c
deleted file mode 100644
index b73b45c7..00000000
--- a/gst/subparse/gstsubparse.c
+++ /dev/null
@@ -1,1888 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) 2004 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <glib.h>
-
-#include "gstsubparse.h"
-#include "gstssaparse.h"
-#include "samiparse.h"
-#include "tmplayerparse.h"
-#include "mpl2parse.h"
-#include "qttextparse.h"
-
-GST_DEBUG_CATEGORY (sub_parse_debug);
-
-#define DEFAULT_ENCODING NULL
-
-enum
-{
- PROP_0,
- PROP_ENCODING,
- PROP_VIDEOFPS
-};
-
-static void
-gst_sub_parse_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void
-gst_sub_parse_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-
-static const GstElementDetails sub_parse_details =
-GST_ELEMENT_DETAILS ("Subtitle parser",
- "Codec/Parser/Subtitle",
- "Parses subtitle (.sub) files into text streams",
- "Gustavo J. A. M. Carneiro <gjc@inescporto.pt>\n"
- "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
-
-#ifndef GST_DISABLE_XML
-static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-subtitle; application/x-subtitle-sami; "
- "application/x-subtitle-tmplayer; application/x-subtitle-mpl2; "
- "application/x-subtitle-dks; application/x-subtitle-qttext")
- );
-#else
-static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-subtitle; application/x-subtitle-dks; "
- "application/x-subtitle-tmplayer; application/x-subtitle-mpl2; "
- "application/x-subtitle-qttext")
- );
-#endif
-
-static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("text/plain; text/x-pango-markup")
- );
-
-static void gst_sub_parse_base_init (GstSubParseClass * klass);
-static void gst_sub_parse_class_init (GstSubParseClass * klass);
-static void gst_sub_parse_init (GstSubParse * subparse);
-
-static gboolean gst_sub_parse_src_event (GstPad * pad, GstEvent * event);
-static gboolean gst_sub_parse_src_query (GstPad * pad, GstQuery * query);
-static gboolean gst_sub_parse_sink_event (GstPad * pad, GstEvent * event);
-
-static GstStateChangeReturn gst_sub_parse_change_state (GstElement * element,
- GstStateChange transition);
-
-static GstFlowReturn gst_sub_parse_chain (GstPad * sinkpad, GstBuffer * buf);
-
-static GstElementClass *parent_class = NULL;
-
-GType
-gst_sub_parse_get_type (void)
-{
- static GType sub_parse_type = 0;
-
- if (!sub_parse_type) {
- static const GTypeInfo sub_parse_info = {
- sizeof (GstSubParseClass),
- (GBaseInitFunc) gst_sub_parse_base_init,
- NULL,
- (GClassInitFunc) gst_sub_parse_class_init,
- NULL,
- NULL,
- sizeof (GstSubParse),
- 0,
- (GInstanceInitFunc) gst_sub_parse_init,
- };
-
- sub_parse_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstSubParse", &sub_parse_info, 0);
- }
-
- return sub_parse_type;
-}
-
-static void
-gst_sub_parse_base_init (GstSubParseClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_templ));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_templ));
- gst_element_class_set_details (element_class, &sub_parse_details);
-}
-
-static void
-gst_sub_parse_dispose (GObject * object)
-{
- GstSubParse *subparse = GST_SUBPARSE (object);
-
- GST_DEBUG_OBJECT (subparse, "cleaning up subtitle parser");
-
- switch (subparse->parser_type) {
- case GST_SUB_PARSE_FORMAT_QTTEXT:
- qttext_context_deinit (&subparse->state);
- break;
-#ifndef GST_DISABLE_XML
- case GST_SUB_PARSE_FORMAT_SAMI:
- sami_context_deinit (&subparse->state);
- break;
-#endif
- default:
- break;
- }
-
- if (subparse->encoding) {
- g_free (subparse->encoding);
- subparse->encoding = NULL;
- }
-
- if (subparse->detected_encoding) {
- g_free (subparse->detected_encoding);
- subparse->detected_encoding = NULL;
- }
-
- if (subparse->adapter) {
- g_object_unref (subparse->adapter);
- subparse->adapter = NULL;
- }
-
- if (subparse->textbuf) {
- g_string_free (subparse->textbuf, TRUE);
- subparse->textbuf = NULL;
- }
-
- GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
-}
-
-static void
-gst_sub_parse_class_init (GstSubParseClass * klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->dispose = gst_sub_parse_dispose;
- object_class->set_property = gst_sub_parse_set_property;
- object_class->get_property = gst_sub_parse_get_property;
-
- element_class->change_state = gst_sub_parse_change_state;
-
- g_object_class_install_property (object_class, PROP_ENCODING,
- g_param_spec_string ("subtitle-encoding", "subtitle charset encoding",
- "Encoding to assume if input subtitles are not in UTF-8 or any other "
- "Unicode encoding. If not set, the GST_SUBTITLE_ENCODING environment "
- "variable will be checked for an encoding to use. If that is not set "
- "either, ISO-8859-15 will be assumed.", DEFAULT_ENCODING,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (object_class, PROP_VIDEOFPS,
- gst_param_spec_fraction ("video-fps", "Video framerate",
- "Framerate of the video stream. This is needed by some subtitle "
- "formats to synchronize subtitles and video properly. If not set "
- "and the subtitle format requires it subtitles may be out of sync.",
- 0, 1, G_MAXINT, 1, 24000, 1001, G_PARAM_READWRITE));
-}
-
-static void
-gst_sub_parse_init (GstSubParse * subparse)
-{
- subparse->sinkpad = gst_pad_new_from_static_template (&sink_templ, "sink");
- gst_pad_set_chain_function (subparse->sinkpad,
- GST_DEBUG_FUNCPTR (gst_sub_parse_chain));
- gst_pad_set_event_function (subparse->sinkpad,
- GST_DEBUG_FUNCPTR (gst_sub_parse_sink_event));
- gst_element_add_pad (GST_ELEMENT (subparse), subparse->sinkpad);
-
- subparse->srcpad = gst_pad_new_from_static_template (&src_templ, "src");
- gst_pad_set_event_function (subparse->srcpad,
- GST_DEBUG_FUNCPTR (gst_sub_parse_src_event));
- gst_pad_set_query_function (subparse->srcpad,
- GST_DEBUG_FUNCPTR (gst_sub_parse_src_query));
- gst_element_add_pad (GST_ELEMENT (subparse), subparse->srcpad);
-
- subparse->textbuf = g_string_new (NULL);
- subparse->parser_type = GST_SUB_PARSE_FORMAT_UNKNOWN;
- subparse->flushing = FALSE;
- gst_segment_init (&subparse->segment, GST_FORMAT_TIME);
- subparse->need_segment = TRUE;
- subparse->encoding = g_strdup (DEFAULT_ENCODING);
- subparse->detected_encoding = NULL;
- subparse->adapter = gst_adapter_new ();
-
- subparse->fps_n = 24000;
- subparse->fps_d = 1001;
-}
-
-/*
- * Source pad functions.
- */
-
-static gboolean
-gst_sub_parse_src_query (GstPad * pad, GstQuery * query)
-{
- GstSubParse *self = GST_SUBPARSE (gst_pad_get_parent (pad));
- gboolean ret = FALSE;
-
- GST_DEBUG ("Handling %s query", GST_QUERY_TYPE_NAME (query));
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_POSITION:{
- GstFormat fmt;
-
- gst_query_parse_position (query, &fmt, NULL);
- if (fmt != GST_FORMAT_TIME) {
- ret = gst_pad_peer_query (self->sinkpad, query);
- } else {
- ret = TRUE;
- gst_query_set_position (query, GST_FORMAT_TIME,
- self->segment.last_stop);
- }
- }
- case GST_QUERY_SEEKING:
- {
- GstFormat fmt;
- gboolean seekable = FALSE;
-
- ret = TRUE;
-
- gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
- if (fmt == GST_FORMAT_TIME) {
- GstQuery *peerquery = gst_query_new_seeking (GST_FORMAT_BYTES);
-
- seekable = gst_pad_peer_query (self->sinkpad, peerquery);
- if (seekable)
- gst_query_parse_seeking (peerquery, NULL, &seekable, NULL, NULL);
- gst_query_unref (peerquery);
- }
-
- gst_query_set_seeking (query, fmt, seekable, seekable ? 0 : -1, -1);
-
- break;
- }
- default:
- ret = gst_pad_peer_query (self->sinkpad, query);
- break;
- }
-
- gst_object_unref (self);
-
- return ret;
-}
-
-static gboolean
-gst_sub_parse_src_event (GstPad * pad, GstEvent * event)
-{
- GstSubParse *self = GST_SUBPARSE (gst_pad_get_parent (pad));
- gboolean ret = FALSE;
-
- GST_DEBUG ("Handling %s event", GST_EVENT_TYPE_NAME (event));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:
- {
- GstFormat format;
- GstSeekType start_type, stop_type;
- gint64 start, stop;
- gdouble rate;
- gboolean update;
-
- gst_event_parse_seek (event, &rate, &format, &self->segment_flags,
- &start_type, &start, &stop_type, &stop);
-
- if (format != GST_FORMAT_TIME) {
- GST_WARNING_OBJECT (self, "we only support seeking in TIME format");
- gst_event_unref (event);
- goto beach;
- }
-
- /* Convert that seek to a seeking in bytes at position 0,
- FIXME: could use an index */
- ret = gst_pad_push_event (self->sinkpad,
- gst_event_new_seek (rate, GST_FORMAT_BYTES, self->segment_flags,
- GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE, 0));
-
- if (ret) {
- /* Apply the seek to our segment */
- gst_segment_set_seek (&self->segment, rate, format, self->segment_flags,
- start_type, start, stop_type, stop, &update);
-
- GST_DEBUG_OBJECT (self, "segment after seek: %" GST_SEGMENT_FORMAT,
- &self->segment);
-
- self->next_offset = 0;
-
- self->need_segment = TRUE;
- } else {
- GST_WARNING_OBJECT (self, "seek to 0 bytes failed");
- }
-
- gst_event_unref (event);
- break;
- }
- default:
- ret = gst_pad_event_default (pad, event);
- break;
- }
-
-beach:
- gst_object_unref (self);
-
- return ret;
-}
-
-static void
-gst_sub_parse_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstSubParse *subparse = GST_SUBPARSE (object);
-
- GST_OBJECT_LOCK (subparse);
- switch (prop_id) {
- case PROP_ENCODING:
- g_free (subparse->encoding);
- subparse->encoding = g_value_dup_string (value);
- GST_LOG_OBJECT (object, "subtitle encoding set to %s",
- GST_STR_NULL (subparse->encoding));
- break;
- case PROP_VIDEOFPS:
- {
- subparse->fps_n = gst_value_get_fraction_numerator (value);
- subparse->fps_d = gst_value_get_fraction_denominator (value);
- GST_DEBUG_OBJECT (object, "video framerate set to %d/%d", subparse->fps_n,
- subparse->fps_d);
-
- if (!subparse->state.have_internal_fps) {
- subparse->state.fps_n = subparse->fps_n;
- subparse->state.fps_d = subparse->fps_d;
- }
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
- GST_OBJECT_UNLOCK (subparse);
-}
-
-static void
-gst_sub_parse_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstSubParse *subparse = GST_SUBPARSE (object);
-
- GST_OBJECT_LOCK (subparse);
- switch (prop_id) {
- case PROP_ENCODING:
- g_value_set_string (value, subparse->encoding);
- break;
- case PROP_VIDEOFPS:
- gst_value_set_fraction (value, subparse->fps_n, subparse->fps_d);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
- GST_OBJECT_UNLOCK (subparse);
-}
-
-static gchar *
-gst_sub_parse_get_format_description (GstSubParseFormat format)
-{
- switch (format) {
- case GST_SUB_PARSE_FORMAT_MDVDSUB:
- return "MicroDVD";
- case GST_SUB_PARSE_FORMAT_SUBRIP:
- return "SubRip";
- case GST_SUB_PARSE_FORMAT_MPSUB:
- return "MPSub";
- case GST_SUB_PARSE_FORMAT_SAMI:
- return "SAMI";
- case GST_SUB_PARSE_FORMAT_TMPLAYER:
- return "TMPlayer";
- case GST_SUB_PARSE_FORMAT_MPL2:
- return "MPL2";
- case GST_SUB_PARSE_FORMAT_SUBVIEWER:
- return "SubViewer";
- case GST_SUB_PARSE_FORMAT_DKS:
- return "DKS";
- case GST_SUB_PARSE_FORMAT_QTTEXT:
- return "QTtext";
- default:
- case GST_SUB_PARSE_FORMAT_UNKNOWN:
- break;
- }
- return NULL;
-}
-
-static gchar *
-gst_convert_to_utf8 (const gchar * str, gsize len, const gchar * encoding,
- gsize * consumed, GError ** err)
-{
- gchar *ret = NULL;
-
- *consumed = 0;
- ret =
- g_convert_with_fallback (str, len, "UTF-8", encoding, "*", consumed, NULL,
- err);
- if (ret == NULL)
- return ret;
-
- /* + 3 to skip UTF-8 BOM if it was added */
- len = strlen (ret);
- if (len >= 3 && (guint8) ret[0] == 0xEF && (guint8) ret[1] == 0xBB
- && (guint8) ret[2] == 0xBF)
- g_memmove (ret, ret + 3, len + 1 - 3);
-
- return ret;
-}
-
-static gchar *
-detect_encoding (const gchar * str, gsize len)
-{
- if (len >= 3 && (guint8) str[0] == 0xEF && (guint8) str[1] == 0xBB
- && (guint8) str[2] == 0xBF)
- return g_strdup ("UTF-8");
-
- if (len >= 2 && (guint8) str[0] == 0xFE && (guint8) str[1] == 0xFF)
- return g_strdup ("UTF-16BE");
-
- if (len >= 2 && (guint8) str[0] == 0xFF && (guint8) str[1] == 0xFE)
- return g_strdup ("UTF-16LE");
-
- if (len >= 4 && (guint8) str[0] == 0x00 && (guint8) str[1] == 0x00
- && (guint8) str[2] == 0xFE && (guint8) str[3] == 0xFF)
- return g_strdup ("UTF-32BE");
-
- if (len >= 4 && (guint8) str[0] == 0xFF && (guint8) str[1] == 0xFE
- && (guint8) str[2] == 0x00 && (guint8) str[3] == 0x00)
- return g_strdup ("UTF-32LE");
-
- return NULL;
-}
-
-static gchar *
-convert_encoding (GstSubParse * self, const gchar * str, gsize len,
- gsize * consumed)
-{
- const gchar *encoding;
- GError *err = NULL;
- gchar *ret = NULL;
-
- *consumed = 0;
-
- /* First try any detected encoding */
- if (self->detected_encoding) {
- ret =
- gst_convert_to_utf8 (str, len, self->detected_encoding, consumed, &err);
-
- if (!err)
- return ret;
-
- GST_WARNING_OBJECT (self, "could not convert string from '%s' to UTF-8: %s",
- self->detected_encoding, err->message);
- g_free (self->detected_encoding);
- self->detected_encoding = NULL;
- g_error_free (err);
- }
-
- /* Otherwise check if it's UTF8 */
- if (self->valid_utf8) {
- if (g_utf8_validate (str, len, NULL)) {
- GST_LOG_OBJECT (self, "valid UTF-8, no conversion needed");
- *consumed = len;
- return g_strndup (str, len);
- }
- GST_INFO_OBJECT (self, "invalid UTF-8!");
- self->valid_utf8 = FALSE;
- }
-
- /* Else try fallback */
- encoding = self->encoding;
- if (encoding == NULL || *encoding == '\0') {
- encoding = g_getenv ("GST_SUBTITLE_ENCODING");
- }
- if (encoding == NULL || *encoding == '\0') {
- /* if local encoding is UTF-8 and no encoding specified
- * via the environment variable, assume ISO-8859-15 */
- if (g_get_charset (&encoding)) {
- encoding = "ISO-8859-15";
- }
- }
-
- ret = gst_convert_to_utf8 (str, len, encoding, consumed, &err);
-
- if (err) {
- GST_WARNING_OBJECT (self, "could not convert string from '%s' to UTF-8: %s",
- encoding, err->message);
- g_error_free (err);
-
- /* invalid input encoding, fall back to ISO-8859-15 (always succeeds) */
- ret = gst_convert_to_utf8 (str, len, "ISO-8859-15", consumed, NULL);
- }
-
- GST_LOG_OBJECT (self,
- "successfully converted %" G_GSIZE_FORMAT " characters from %s to UTF-8"
- "%s", len, encoding, (err) ? " , using ISO-8859-15 as fallback" : "");
-
- return ret;
-}
-
-static gchar *
-get_next_line (GstSubParse * self)
-{
- char *line = NULL;
- const char *line_end;
- int line_len;
- gboolean have_r = FALSE;
-
- line_end = strchr (self->textbuf->str, '\n');
-
- if (!line_end) {
- /* end-of-line not found; return for more data */
- return NULL;
- }
-
- /* get rid of '\r' */
- if (line_end != self->textbuf->str && *(line_end - 1) == '\r') {
- line_end--;
- have_r = TRUE;
- }
-
- line_len = line_end - self->textbuf->str;
- line = g_strndup (self->textbuf->str, line_len);
- self->textbuf = g_string_erase (self->textbuf, 0,
- line_len + (have_r ? 2 : 1));
- return line;
-}
-
-static gchar *
-parse_mdvdsub (ParserState * state, const gchar * line)
-{
- const gchar *line_split;
- gchar *line_chunk;
- guint start_frame, end_frame;
- gint64 clip_start = 0, clip_stop = 0;
- gboolean in_seg = FALSE;
- GString *markup;
- gchar *ret;
-
- /* style variables */
- gboolean italic;
- gboolean bold;
- guint fontsize;
- gdouble fps = 0.0;
-
- if (sscanf (line, "{%u}{%u}", &start_frame, &end_frame) != 2) {
- g_warning ("Parse of the following line, assumed to be in microdvd .sub"
- " format, failed:\n%s", line);
- return NULL;
- }
-
- /* skip the {%u}{%u} part */
- line = strchr (line, '}') + 1;
- line = strchr (line, '}') + 1;
-
- /* see if there's a first line with a framerate */
- if (start_frame == 1 && end_frame == 1) {
- gchar *rest, *end = NULL;
-
- rest = g_strdup (line);
- g_strdelimit (rest, ",", '.');
- fps = g_ascii_strtod (rest, &end);
- if (end != rest) {
- gst_util_double_to_fraction (fps, &state->fps_n, &state->fps_d);
- GST_INFO ("framerate from file: %d/%d ('%s')", state->fps_n,
- state->fps_d, rest);
- }
- g_free (rest);
- return NULL;
- }
-
- state->start_time =
- gst_util_uint64_scale (start_frame, GST_SECOND * state->fps_d,
- state->fps_n);
- state->duration =
- gst_util_uint64_scale (end_frame - start_frame, GST_SECOND * state->fps_d,
- state->fps_n);
-
- /* Check our segment start/stop */
- in_seg = gst_segment_clip (state->segment, GST_FORMAT_TIME,
- state->start_time, state->start_time + state->duration, &clip_start,
- &clip_stop);
-
- /* No need to parse that text if it's out of segment */
- if (in_seg) {
- state->start_time = clip_start;
- state->duration = clip_stop - clip_start;
- } else {
- return NULL;
- }
-
- markup = g_string_new (NULL);
- while (1) {
- italic = FALSE;
- bold = FALSE;
- fontsize = 0;
- /* parse style markup */
- if (strncmp (line, "{y:i}", 5) == 0) {
- italic = TRUE;
- line = strchr (line, '}') + 1;
- }
- if (strncmp (line, "{y:b}", 5) == 0) {
- bold = TRUE;
- line = strchr (line, '}') + 1;
- }
- if (sscanf (line, "{s:%u}", &fontsize) == 1) {
- line = strchr (line, '}') + 1;
- }
- /* forward slashes at beginning/end signify italics too */
- if (g_str_has_prefix (line, "/")) {
- italic = TRUE;
- ++line;
- }
- if ((line_split = strchr (line, '|')))
- line_chunk = g_markup_escape_text (line, line_split - line);
- else
- line_chunk = g_markup_escape_text (line, strlen (line));
-
- /* Remove italics markers at end of line/stanza (CHECKME: are end slashes
- * always at the end of a line or can they span multiple lines?) */
- if (g_str_has_suffix (line_chunk, "/")) {
- line_chunk[strlen (line_chunk) - 1] = '\0';
- }
-
- markup = g_string_append (markup, "<span");
- if (italic)
- g_string_append (markup, " style=\"italic\"");
- if (bold)
- g_string_append (markup, " weight=\"bold\"");
- if (fontsize)
- g_string_append_printf (markup, " size=\"%u\"", fontsize * 1000);
- g_string_append_printf (markup, ">%s</span>", line_chunk);
- g_free (line_chunk);
- if (line_split) {
- g_string_append (markup, "\n");
- line = line_split + 1;
- } else {
- break;
- }
- }
- ret = markup->str;
- g_string_free (markup, FALSE);
- GST_DEBUG ("parse_mdvdsub returning (%f+%f): %s",
- state->start_time / (double) GST_SECOND,
- state->duration / (double) GST_SECOND, ret);
- return ret;
-}
-
-static void
-strip_trailing_newlines (gchar * txt)
-{
- if (txt) {
- guint len;
-
- len = strlen (txt);
- while (len > 1 && txt[len - 1] == '\n') {
- txt[len - 1] = '\0';
- --len;
- }
- }
-}
-
-/* we want to escape text in general, but retain basic markup like
- * <i></i>, <u></u>, and <b></b>. The easiest and safest way is to
- * just unescape a white list of allowed markups again after
- * escaping everything (the text between these simple markers isn't
- * necessarily escaped, so it seems best to do it like this) */
-static void
-subrip_unescape_formatting (gchar * txt)
-{
- gchar *pos;
-
- for (pos = txt; pos != NULL && *pos != '\0'; ++pos) {
- if (g_ascii_strncasecmp (pos, "&lt;u&gt;", 9) == 0 ||
- g_ascii_strncasecmp (pos, "&lt;i&gt;", 9) == 0 ||
- g_ascii_strncasecmp (pos, "&lt;b&gt;", 9) == 0) {
- pos[0] = '<';
- pos[1] = g_ascii_tolower (pos[4]);
- pos[2] = '>';
- /* move NUL terminator as well */
- g_memmove (pos + 3, pos + 9, strlen (pos + 9) + 1);
- pos += 2;
- }
- }
-
- for (pos = txt; pos != NULL && *pos != '\0'; ++pos) {
- if (g_ascii_strncasecmp (pos, "&lt;/u&gt;", 10) == 0 ||
- g_ascii_strncasecmp (pos, "&lt;/i&gt;", 10) == 0 ||
- g_ascii_strncasecmp (pos, "&lt;/b&gt;", 10) == 0) {
- pos[0] = '<';
- pos[1] = '/';
- pos[2] = g_ascii_tolower (pos[5]);
- pos[3] = '>';
- /* move NUL terminator as well */
- g_memmove (pos + 4, pos + 10, strlen (pos + 10) + 1);
- pos += 3;
- }
- }
-}
-
-
-static gboolean
-subrip_remove_unhandled_tag (gchar * start, gchar * stop)
-{
- gchar *tag, saved;
-
- tag = start + strlen ("&lt;");
- if (*tag == '/')
- ++tag;
-
- if (g_ascii_tolower (*tag) < 'a' || g_ascii_tolower (*tag) > 'z')
- return FALSE;
-
- saved = *stop;
- *stop = '\0';
- GST_LOG ("removing unhandled tag '%s'", start);
- *stop = saved;
- g_memmove (start, stop, strlen (stop) + 1);
- return TRUE;
-}
-
-/* remove tags we haven't explicitly allowed earlier on, like font tags
- * for example */
-static void
-subrip_remove_unhandled_tags (gchar * txt)
-{
- gchar *pos, *gt;
-
- for (pos = txt; pos != NULL && *pos != '\0'; ++pos) {
- if (strncmp (pos, "&lt;", 4) == 0 && (gt = strstr (pos + 4, "&gt;"))) {
- if (subrip_remove_unhandled_tag (pos, gt + strlen ("&gt;")))
- --pos;
- }
- }
-}
-
-/* we only allow <i>, <u> and <b>, so let's take a simple approach. This code
- * assumes the input has been escaped and subrip_unescape_formatting() has then
- * been run over the input! This function adds missing closing markup tags and
- * removes broken closing tags for tags that have never been opened. */
-static void
-subrip_fix_up_markup (gchar ** p_txt)
-{
- gchar *cur, *next_tag;
- gchar open_tags[32];
- guint num_open_tags = 0;
-
- g_assert (*p_txt != NULL);
-
- cur = *p_txt;
- while (*cur != '\0') {
- next_tag = strchr (cur, '<');
- if (next_tag == NULL)
- break;
- ++next_tag;
- switch (*next_tag) {
- case '/':{
- ++next_tag;
- if (num_open_tags == 0 || open_tags[num_open_tags - 1] != *next_tag) {
- GST_LOG ("broken input, closing tag '%c' is not open", *next_tag);
- g_memmove (next_tag - 2, next_tag + 2, strlen (next_tag + 2) + 1);
- next_tag -= 2;
- } else {
- /* it's all good, closing tag which is open */
- --num_open_tags;
- }
- break;
- }
- case 'i':
- case 'b':
- case 'u':
- if (num_open_tags == G_N_ELEMENTS (open_tags))
- return; /* something dodgy is going on, stop parsing */
- open_tags[num_open_tags] = *next_tag;
- ++num_open_tags;
- break;
- default:
- GST_ERROR ("unexpected tag '%c' (%s)", *next_tag, next_tag);
- g_assert_not_reached ();
- break;
- }
- cur = next_tag;
- }
-
- if (num_open_tags > 0) {
- GString *s;
-
- s = g_string_new (*p_txt);
- while (num_open_tags > 0) {
- GST_LOG ("adding missing closing tag '%c'", open_tags[num_open_tags - 1]);
- g_string_append_c (s, '<');
- g_string_append_c (s, '/');
- g_string_append_c (s, open_tags[num_open_tags - 1]);
- g_string_append_c (s, '>');
- --num_open_tags;
- }
- g_free (*p_txt);
- *p_txt = g_string_free (s, FALSE);
- }
-}
-
-static gboolean
-parse_subrip_time (const gchar * ts_string, GstClockTime * t)
-{
- gchar s[128] = { '\0', };
- gchar *end, *p;
- guint hour, min, sec, msec, len;
-
- while (*ts_string == ' ')
- ++ts_string;
-
- g_strlcpy (s, ts_string, sizeof (s));
- if ((end = strstr (s, "-->")))
- *end = '\0';
- g_strchomp (s);
-
- /* ms may be in these formats:
- * hh:mm:ss,500 = 500ms
- * hh:mm:ss, 5 = 5ms
- * hh:mm:ss, 5 = 50ms
- * hh:mm:ss, 50 = 50ms
- * hh:mm:ss,5 = 500ms
- * and the same with . instead of ,.
- * sscanf() doesn't differentiate between ' 5' and '5' so munge
- * the white spaces within the timestamp to '0' (I'm sure there's a
- * way to make sscanf() do this for us, but how?)
- */
- g_strdelimit (s, " ", '0');
- g_strdelimit (s, ".", ',');
-
- /* make sure we have exactly three digits after he comma */
- p = strchr (s, ',');
- g_assert (p != NULL);
- ++p;
- len = strlen (p);
- if (len > 3) {
- p[3] = '\0';
- } else
- while (len < 3) {
- g_strlcat (&p[len], "0", 2);
- ++len;
- }
-
- GST_LOG ("parsing timestamp '%s'", s);
- if (sscanf (s, "%u:%u:%u,%u", &hour, &min, &sec, &msec) != 4) {
- GST_WARNING ("failed to parse subrip timestamp string '%s'", s);
- return FALSE;
- }
-
- *t = ((hour * 3600) + (min * 60) + sec) * GST_SECOND + msec * GST_MSECOND;
- return TRUE;
-}
-
-static gchar *
-parse_subrip (ParserState * state, const gchar * line)
-{
- int subnum;
- gchar *ret;
-
- switch (state->state) {
- case 0:
- /* looking for a single integer */
- if (sscanf (line, "%u", &subnum) == 1)
- state->state = 1;
- return NULL;
- case 1:
- {
- GstClockTime ts_start, ts_end;
- gchar *end_time;
-
- /* looking for start_time --> end_time */
- if ((end_time = strstr (line, " --> ")) &&
- parse_subrip_time (line, &ts_start) &&
- parse_subrip_time (end_time + strlen (" --> "), &ts_end) &&
- state->start_time <= ts_end) {
- state->state = 2;
- state->start_time = ts_start;
- state->duration = ts_end - ts_start;
- } else {
- GST_DEBUG ("error parsing subrip time line '%s'", line);
- state->state = 0;
- }
- return NULL;
- }
- case 2:
- {
- /* No need to parse that text if it's out of segment */
- gint64 clip_start = 0, clip_stop = 0;
- gboolean in_seg = FALSE;
-
- /* Check our segment start/stop */
- in_seg = gst_segment_clip (state->segment, GST_FORMAT_TIME,
- state->start_time, state->start_time + state->duration,
- &clip_start, &clip_stop);
-
- if (in_seg) {
- state->start_time = clip_start;
- state->duration = clip_stop - clip_start;
- } else {
- state->state = 0;
- return NULL;
- }
- }
- /* looking for subtitle text; empty line ends this subtitle entry */
- if (state->buf->len)
- g_string_append_c (state->buf, '\n');
- g_string_append (state->buf, line);
- if (strlen (line) == 0) {
- ret = g_markup_escape_text (state->buf->str, state->buf->len);
- g_string_truncate (state->buf, 0);
- state->state = 0;
- subrip_unescape_formatting (ret);
- subrip_remove_unhandled_tags (ret);
- strip_trailing_newlines (ret);
- subrip_fix_up_markup (&ret);
- return ret;
- }
- return NULL;
- default:
- g_return_val_if_reached (NULL);
- }
-}
-
-static void
-unescape_newlines_br (gchar * read)
-{
- gchar *write = read;
-
- /* Replace all occurences of '[br]' with a newline as version 2
- * of the subviewer format uses this for newlines */
-
- if (read[0] == '\0' || read[1] == '\0' || read[2] == '\0' || read[3] == '\0')
- return;
-
- do {
- if (strncmp (read, "[br]", 4) == 0) {
- *write = '\n';
- read += 4;
- } else {
- *write = *read;
- read++;
- }
- write++;
- } while (*read);
-
- *write = '\0';
-}
-
-static gchar *
-parse_subviewer (ParserState * state, const gchar * line)
-{
- guint h1, m1, s1, ms1;
- guint h2, m2, s2, ms2;
- gchar *ret;
-
- /* TODO: Maybe also parse the fields in the header, especially DELAY.
- * For examples see the unit test or
- * http://www.doom9.org/index.html?/sub.htm */
-
- switch (state->state) {
- case 0:
- /* looking for start_time,end_time */
- if (sscanf (line, "%u:%u:%u.%u,%u:%u:%u.%u",
- &h1, &m1, &s1, &ms1, &h2, &m2, &s2, &ms2) == 8) {
- state->state = 1;
- state->start_time =
- (((guint64) h1) * 3600 + m1 * 60 + s1) * GST_SECOND +
- ms1 * GST_MSECOND;
- state->duration =
- (((guint64) h2) * 3600 + m2 * 60 + s2) * GST_SECOND +
- ms2 * GST_MSECOND - state->start_time;
- }
- return NULL;
- case 1:
- {
- /* No need to parse that text if it's out of segment */
- gint64 clip_start = 0, clip_stop = 0;
- gboolean in_seg = FALSE;
-
- /* Check our segment start/stop */
- in_seg = gst_segment_clip (state->segment, GST_FORMAT_TIME,
- state->start_time, state->start_time + state->duration,
- &clip_start, &clip_stop);
-
- if (in_seg) {
- state->start_time = clip_start;
- state->duration = clip_stop - clip_start;
- } else {
- state->state = 0;
- return NULL;
- }
- }
- /* looking for subtitle text; empty line ends this subtitle entry */
- if (state->buf->len)
- g_string_append_c (state->buf, '\n');
- g_string_append (state->buf, line);
- if (strlen (line) == 0) {
- ret = g_strdup (state->buf->str);
- unescape_newlines_br (ret);
- strip_trailing_newlines (ret);
- g_string_truncate (state->buf, 0);
- state->state = 0;
- return ret;
- }
- return NULL;
- default:
- g_assert_not_reached ();
- return NULL;
- }
-}
-
-static gchar *
-parse_mpsub (ParserState * state, const gchar * line)
-{
- gchar *ret;
- float t1, t2;
-
- switch (state->state) {
- case 0:
- /* looking for two floats (offset, duration) */
- if (sscanf (line, "%f %f", &t1, &t2) == 2) {
- state->state = 1;
- state->start_time += state->duration + GST_SECOND * t1;
- state->duration = GST_SECOND * t2;
- }
- return NULL;
- case 1:
- { /* No need to parse that text if it's out of segment */
- gint64 clip_start = 0, clip_stop = 0;
- gboolean in_seg = FALSE;
-
- /* Check our segment start/stop */
- in_seg = gst_segment_clip (state->segment, GST_FORMAT_TIME,
- state->start_time, state->start_time + state->duration,
- &clip_start, &clip_stop);
-
- if (in_seg) {
- state->start_time = clip_start;
- state->duration = clip_stop - clip_start;
- } else {
- state->state = 0;
- return NULL;
- }
- }
- /* looking for subtitle text; empty line ends this
- * subtitle entry */
- if (state->buf->len)
- g_string_append_c (state->buf, '\n');
- g_string_append (state->buf, line);
- if (strlen (line) == 0) {
- ret = g_strdup (state->buf->str);
- g_string_truncate (state->buf, 0);
- state->state = 0;
- return ret;
- }
- return NULL;
- default:
- g_assert_not_reached ();
- return NULL;
- }
-}
-
-static const gchar *
-dks_skip_timestamp (const gchar * line)
-{
- while (*line && *line != ']')
- line++;
- if (*line == ']')
- line++;
- return line;
-}
-
-static gchar *
-parse_dks (ParserState * state, const gchar * line)
-{
- guint h, m, s;
-
- switch (state->state) {
- case 0:
- /* Looking for the start time and text */
- if (sscanf (line, "[%u:%u:%u]", &h, &m, &s) == 3) {
- const gchar *text;
- state->start_time = (((guint64) h) * 3600 + m * 60 + s) * GST_SECOND;
- text = dks_skip_timestamp (line);
- if (*text) {
- state->state = 1;
- g_string_append (state->buf, text);
- }
- }
- return NULL;
- case 1:
- {
- gint64 clip_start = 0, clip_stop = 0;
- gboolean in_seg;
- gchar *ret;
-
- /* Looking for the end time */
- if (sscanf (line, "[%u:%u:%u]", &h, &m, &s) == 3) {
- state->state = 0;
- state->duration = (((guint64) h) * 3600 + m * 60 + s) * GST_SECOND -
- state->start_time;
- } else {
- GST_WARNING ("Failed to parse subtitle end time");
- return NULL;
- }
-
- /* Check if this subtitle is out of the current segment */
- in_seg = gst_segment_clip (state->segment, GST_FORMAT_TIME,
- state->start_time, state->start_time + state->duration,
- &clip_start, &clip_stop);
-
- if (!in_seg) {
- return NULL;
- }
-
- state->start_time = clip_start;
- state->duration = clip_stop - clip_start;
-
- ret = g_strdup (state->buf->str);
- g_string_truncate (state->buf, 0);
- unescape_newlines_br (ret);
- return ret;
- }
- default:
- g_assert_not_reached ();
- return NULL;
- }
-}
-
-static void
-parser_state_init (ParserState * state)
-{
- GST_DEBUG ("initialising parser");
-
- if (state->buf) {
- g_string_truncate (state->buf, 0);
- } else {
- state->buf = g_string_new (NULL);
- }
-
- state->start_time = 0;
- state->duration = 0;
- state->max_duration = 0; /* no limit */
- state->state = 0;
- state->segment = NULL;
-}
-
-static void
-parser_state_dispose (GstSubParse * self, ParserState * state)
-{
- if (state->buf) {
- g_string_free (state->buf, TRUE);
- state->buf = NULL;
- }
- if (state->user_data) {
- switch (self->parser_type) {
-#ifndef GST_DISABLE_XML
- case GST_SUB_PARSE_FORMAT_SAMI:
- sami_context_reset (state);
- break;
-#endif
- default:
- break;
- }
- }
-}
-
-/* regex type enum */
-typedef enum
-{
- GST_SUB_PARSE_REGEX_UNKNOWN = 0,
- GST_SUB_PARSE_REGEX_MDVDSUB = 1,
- GST_SUB_PARSE_REGEX_SUBRIP = 2,
- GST_SUB_PARSE_REGEX_DKS = 3,
-} GstSubParseRegex;
-
-static gpointer
-gst_sub_parse_data_format_autodetect_regex_once (GstSubParseRegex regtype)
-{
- gpointer result = NULL;
- GError *gerr = NULL;
- switch (regtype) {
- case GST_SUB_PARSE_REGEX_MDVDSUB:
- result =
- (gpointer) g_regex_new ("^\\{[0-9]+\\}\\{[0-9]+\\}", 0, 0, &gerr);
- if (result == NULL) {
- g_warning ("Compilation of mdvd regex failed: %s", gerr->message);
- g_error_free (gerr);
- }
- break;
- case GST_SUB_PARSE_REGEX_SUBRIP:
- result = (gpointer) g_regex_new ("^([ 0-9]){0,3}[0-9]\\s*(\x0d)?\x0a"
- "[ 0-9][0-9]:[ 0-9][0-9]:[ 0-9][0-9][,.][ 0-9]{0,2}[0-9]"
- " +--> +([ 0-9])?[0-9]:[ 0-9][0-9]:[ 0-9][0-9][,.][ 0-9]{0,2}[0-9]",
- 0, 0, &gerr);
- if (result == NULL) {
- g_warning ("Compilation of subrip regex failed: %s", gerr->message);
- g_error_free (gerr);
- }
- break;
- case GST_SUB_PARSE_REGEX_DKS:
- result = (gpointer) g_regex_new ("^\[[0-9]+:[0-9]+:[0-9]+].*",
- 0, 0, &gerr);
- if (result == NULL) {
- g_warning ("Compilation of dks regex failed: %s", gerr->message);
- g_error_free (gerr);
- }
- break;
- default:
- GST_WARNING ("Trying to allocate regex of unknown type %u", regtype);
- }
- return result;
-}
-
-/*
- * FIXME: maybe we should pass along a second argument, the preceding
- * text buffer, because that is how this originally worked, even though
- * I don't really see the use of that.
- */
-
-static GstSubParseFormat
-gst_sub_parse_data_format_autodetect (gchar * match_str)
-{
- guint n1, n2, n3;
-
- static GOnce mdvd_rx_once = G_ONCE_INIT;
- static GOnce subrip_rx_once = G_ONCE_INIT;
- static GOnce dks_rx_once = G_ONCE_INIT;
-
- GRegex *mdvd_grx;
- GRegex *subrip_grx;
- GRegex *dks_grx;
-
- g_once (&mdvd_rx_once,
- (GThreadFunc) gst_sub_parse_data_format_autodetect_regex_once,
- (gpointer) GST_SUB_PARSE_REGEX_MDVDSUB);
- g_once (&subrip_rx_once,
- (GThreadFunc) gst_sub_parse_data_format_autodetect_regex_once,
- (gpointer) GST_SUB_PARSE_REGEX_SUBRIP);
- g_once (&dks_rx_once,
- (GThreadFunc) gst_sub_parse_data_format_autodetect_regex_once,
- (gpointer) GST_SUB_PARSE_REGEX_DKS);
-
- mdvd_grx = (GRegex *) mdvd_rx_once.retval;
- subrip_grx = (GRegex *) subrip_rx_once.retval;
- dks_grx = (GRegex *) dks_rx_once.retval;
-
- if (g_regex_match (mdvd_grx, match_str, 0, NULL) == TRUE) {
- GST_LOG ("MicroDVD (frame based) format detected");
- return GST_SUB_PARSE_FORMAT_MDVDSUB;
- }
- if (g_regex_match (subrip_grx, match_str, 0, NULL) == TRUE) {
- GST_LOG ("SubRip (time based) format detected");
- return GST_SUB_PARSE_FORMAT_SUBRIP;
- }
- if (g_regex_match (dks_grx, match_str, 0, NULL) == TRUE) {
- GST_LOG ("DKS (time based) format detected");
- return GST_SUB_PARSE_FORMAT_DKS;
- }
-
- if (!strncmp (match_str, "FORMAT=TIME", 11)) {
- GST_LOG ("MPSub (time based) format detected");
- return GST_SUB_PARSE_FORMAT_MPSUB;
- }
-#ifndef GST_DISABLE_XML
- if (strstr (match_str, "<SAMI>") != NULL ||
- strstr (match_str, "<sami>") != NULL) {
- GST_LOG ("SAMI (time based) format detected");
- return GST_SUB_PARSE_FORMAT_SAMI;
- }
-#endif
- /* we're boldly assuming the first subtitle appears within the first hour */
- if (sscanf (match_str, "0:%02u:%02u:", &n1, &n2) == 2 ||
- sscanf (match_str, "0:%02u:%02u=", &n1, &n2) == 2 ||
- sscanf (match_str, "00:%02u:%02u:", &n1, &n2) == 2 ||
- sscanf (match_str, "00:%02u:%02u=", &n1, &n2) == 2 ||
- sscanf (match_str, "00:%02u:%02u,%u=", &n1, &n2, &n3) == 3) {
- GST_LOG ("TMPlayer (time based) format detected");
- return GST_SUB_PARSE_FORMAT_TMPLAYER;
- }
- if (sscanf (match_str, "[%u][%u]", &n1, &n2) == 2) {
- GST_LOG ("MPL2 (time based) format detected");
- return GST_SUB_PARSE_FORMAT_MPL2;
- }
- if (strstr (match_str, "[INFORMATION]") != NULL) {
- GST_LOG ("SubViewer (time based) format detected");
- return GST_SUB_PARSE_FORMAT_SUBVIEWER;
- }
- if (strstr (match_str, "{QTtext}") != NULL) {
- GST_LOG ("QTtext (time based) format detected");
- return GST_SUB_PARSE_FORMAT_QTTEXT;
- }
-
- GST_DEBUG ("no subtitle format detected");
- return GST_SUB_PARSE_FORMAT_UNKNOWN;
-}
-
-static GstCaps *
-gst_sub_parse_format_autodetect (GstSubParse * self)
-{
- gchar *data;
- GstSubParseFormat format;
-
- if (strlen (self->textbuf->str) < 30) {
- GST_DEBUG ("File too small to be a subtitles file");
- return NULL;
- }
-
- data = g_strndup (self->textbuf->str, 35);
- format = gst_sub_parse_data_format_autodetect (data);
- g_free (data);
-
- self->parser_type = format;
- self->subtitle_codec = gst_sub_parse_get_format_description (format);
- parser_state_init (&self->state);
-
- switch (format) {
- case GST_SUB_PARSE_FORMAT_MDVDSUB:
- self->parse_line = parse_mdvdsub;
- return gst_caps_new_simple ("text/x-pango-markup", NULL);
- case GST_SUB_PARSE_FORMAT_SUBRIP:
- self->parse_line = parse_subrip;
- return gst_caps_new_simple ("text/x-pango-markup", NULL);
- case GST_SUB_PARSE_FORMAT_MPSUB:
- self->parse_line = parse_mpsub;
- return gst_caps_new_simple ("text/plain", NULL);
-#ifndef GST_DISABLE_XML
- case GST_SUB_PARSE_FORMAT_SAMI:
- self->parse_line = parse_sami;
- sami_context_init (&self->state);
- return gst_caps_new_simple ("text/x-pango-markup", NULL);
-#endif
- case GST_SUB_PARSE_FORMAT_TMPLAYER:
- self->parse_line = parse_tmplayer;
- self->state.max_duration = 5 * GST_SECOND;
- return gst_caps_new_simple ("text/plain", NULL);
- case GST_SUB_PARSE_FORMAT_MPL2:
- self->parse_line = parse_mpl2;
- return gst_caps_new_simple ("text/x-pango-markup", NULL);
- case GST_SUB_PARSE_FORMAT_DKS:
- self->parse_line = parse_dks;
- return gst_caps_new_simple ("text/plain", NULL);
- case GST_SUB_PARSE_FORMAT_SUBVIEWER:
- self->parse_line = parse_subviewer;
- return gst_caps_new_simple ("text/plain", NULL);
- case GST_SUB_PARSE_FORMAT_QTTEXT:
- self->parse_line = parse_qttext;
- qttext_context_init (&self->state);
- return gst_caps_new_simple ("text/x-pango-markup", NULL);
- case GST_SUB_PARSE_FORMAT_UNKNOWN:
- default:
- GST_DEBUG ("no subtitle format detected");
- GST_ELEMENT_ERROR (self, STREAM, WRONG_TYPE,
- ("The input is not a valid/supported subtitle file"), (NULL));
- return NULL;
- }
-}
-
-static void
-feed_textbuf (GstSubParse * self, GstBuffer * buf)
-{
- gboolean discont;
- gsize consumed;
- gchar *input = NULL;
-
- discont = GST_BUFFER_IS_DISCONT (buf);
-
- if (GST_BUFFER_OFFSET_IS_VALID (buf) &&
- GST_BUFFER_OFFSET (buf) != self->offset) {
- self->offset = GST_BUFFER_OFFSET (buf);
- discont = TRUE;
- }
-
- if (discont) {
- GST_INFO ("discontinuity");
- /* flush the parser state */
- parser_state_init (&self->state);
- g_string_truncate (self->textbuf, 0);
- gst_adapter_clear (self->adapter);
-#ifndef GST_DISABLE_XML
- if (self->parser_type == GST_SUB_PARSE_FORMAT_SAMI)
- sami_context_reset (&self->state);
-#endif
- /* we could set a flag to make sure that the next buffer we push out also
- * has the DISCONT flag set, but there's no point really given that it's
- * subtitles which are discontinuous by nature. */
- }
-
- self->offset = GST_BUFFER_OFFSET (buf) + GST_BUFFER_SIZE (buf);
- self->next_offset = self->offset;
-
- gst_adapter_push (self->adapter, buf);
-
- input =
- convert_encoding (self, (const gchar *) gst_adapter_peek (self->adapter,
- gst_adapter_available (self->adapter)),
- (gsize) gst_adapter_available (self->adapter), &consumed);
-
- if (input && consumed > 0) {
- self->textbuf = g_string_append (self->textbuf, input);
- gst_adapter_flush (self->adapter, consumed);
- }
-
- g_free (input);
-}
-
-static GstFlowReturn
-handle_buffer (GstSubParse * self, GstBuffer * buf)
-{
- GstFlowReturn ret = GST_FLOW_OK;
- GstCaps *caps = NULL;
- gchar *line, *subtitle;
-
- if (self->first_buffer) {
- self->detected_encoding =
- detect_encoding ((gchar *) GST_BUFFER_DATA (buf),
- GST_BUFFER_SIZE (buf));
- self->first_buffer = FALSE;
- self->state.fps_n = self->fps_n;
- self->state.fps_d = self->fps_d;
- }
-
- feed_textbuf (self, buf);
-
- /* make sure we know the format */
- if (G_UNLIKELY (self->parser_type == GST_SUB_PARSE_FORMAT_UNKNOWN)) {
- if (!(caps = gst_sub_parse_format_autodetect (self))) {
- return GST_FLOW_UNEXPECTED;
- }
- if (!gst_pad_set_caps (self->srcpad, caps)) {
- gst_caps_unref (caps);
- return GST_FLOW_UNEXPECTED;
- }
- gst_caps_unref (caps);
-
- /* push tags */
- if (self->subtitle_codec != NULL) {
- GstTagList *tags;
-
- tags = gst_tag_list_new ();
- gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_SUBTITLE_CODEC,
- self->subtitle_codec, NULL);
- gst_element_found_tags_for_pad (GST_ELEMENT (self), self->srcpad, tags);
- }
- }
-
- while (!self->flushing && (line = get_next_line (self))) {
- guint offset = 0;
-
- /* Set segment on our parser state machine */
- self->state.segment = &self->segment;
- /* Now parse the line, out of segment lines will just return NULL */
- GST_LOG_OBJECT (self, "Parsing line '%s'", line + offset);
- subtitle = self->parse_line (&self->state, line + offset);
- g_free (line);
-
- if (subtitle) {
- guint subtitle_len = strlen (subtitle);
-
- /* +1 for terminating NUL character */
- ret = gst_pad_alloc_buffer_and_set_caps (self->srcpad,
- GST_BUFFER_OFFSET_NONE, subtitle_len + 1,
- GST_PAD_CAPS (self->srcpad), &buf);
-
- if (ret == GST_FLOW_OK) {
- /* copy terminating NUL character as well */
- memcpy (GST_BUFFER_DATA (buf), subtitle, subtitle_len + 1);
- GST_BUFFER_SIZE (buf) = subtitle_len;
- GST_BUFFER_TIMESTAMP (buf) = self->state.start_time;
- GST_BUFFER_DURATION (buf) = self->state.duration;
-
- /* in some cases (e.g. tmplayer) we can only determine the duration
- * of a text chunk from the timestamp of the next text chunk; in those
- * cases, we probably want to limit the duration to something
- * reasonable, so we don't end up showing some text for e.g. 40 seconds
- * just because nothing else is being said during that time */
- if (self->state.max_duration > 0 && GST_BUFFER_DURATION_IS_VALID (buf)) {
- if (GST_BUFFER_DURATION (buf) > self->state.max_duration)
- GST_BUFFER_DURATION (buf) = self->state.max_duration;
- }
-
- gst_segment_set_last_stop (&self->segment, GST_FORMAT_TIME,
- self->state.start_time);
-
- GST_DEBUG_OBJECT (self, "Sending text '%s', %" GST_TIME_FORMAT " + %"
- GST_TIME_FORMAT, subtitle, GST_TIME_ARGS (self->state.start_time),
- GST_TIME_ARGS (self->state.duration));
-
- ret = gst_pad_push (self->srcpad, buf);
- }
-
- /* move this forward (the tmplayer parser needs this) */
- if (self->state.duration != GST_CLOCK_TIME_NONE)
- self->state.start_time += self->state.duration;
-
- g_free (subtitle);
- subtitle = NULL;
-
- if (ret != GST_FLOW_OK) {
- GST_DEBUG_OBJECT (self, "flow: %s", gst_flow_get_name (ret));
- break;
- }
- }
- }
-
- return ret;
-}
-
-static GstFlowReturn
-gst_sub_parse_chain (GstPad * sinkpad, GstBuffer * buf)
-{
- GstFlowReturn ret;
- GstSubParse *self;
-
- self = GST_SUBPARSE (GST_PAD_PARENT (sinkpad));
-
- /* Push newsegment if needed */
- if (self->need_segment) {
- GST_LOG_OBJECT (self, "pushing newsegment event with %" GST_SEGMENT_FORMAT,
- &self->segment);
-
- gst_pad_push_event (self->srcpad, gst_event_new_new_segment (FALSE,
- self->segment.rate, self->segment.format,
- self->segment.last_stop, self->segment.stop, self->segment.time));
- self->need_segment = FALSE;
- }
-
- ret = handle_buffer (self, buf);
-
- return ret;
-}
-
-static gboolean
-gst_sub_parse_sink_event (GstPad * pad, GstEvent * event)
-{
- GstSubParse *self = GST_SUBPARSE (gst_pad_get_parent (pad));
- gboolean ret = FALSE;
-
- GST_DEBUG ("Handling %s event", GST_EVENT_TYPE_NAME (event));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_EOS:{
- /* Make sure the last subrip chunk is pushed out even
- * if the file does not have an empty line at the end */
- if (self->parser_type == GST_SUB_PARSE_FORMAT_SUBRIP ||
- self->parser_type == GST_SUB_PARSE_FORMAT_TMPLAYER ||
- self->parser_type == GST_SUB_PARSE_FORMAT_MPL2 ||
- self->parser_type == GST_SUB_PARSE_FORMAT_QTTEXT) {
- GstBuffer *buf = gst_buffer_new_and_alloc (2 + 1);
-
- GST_DEBUG ("EOS. Pushing remaining text (if any)");
- GST_BUFFER_DATA (buf)[0] = '\n';
- GST_BUFFER_DATA (buf)[1] = '\n';
- GST_BUFFER_DATA (buf)[2] = '\0'; /* play it safe */
- GST_BUFFER_SIZE (buf) = 2;
- GST_BUFFER_OFFSET (buf) = self->offset;
- gst_sub_parse_chain (pad, buf);
- }
- ret = gst_pad_event_default (pad, event);
- break;
- }
- case GST_EVENT_NEWSEGMENT:
- {
- GstFormat format;
- gdouble rate;
- gint64 start, stop, time;
- gboolean update;
-
- gst_event_parse_new_segment (event, &update, &rate, &format, &start,
- &stop, &time);
-
- GST_DEBUG_OBJECT (self, "newsegment (%s)", gst_format_get_name (format));
-
- if (format == GST_FORMAT_TIME) {
- gst_segment_set_newsegment (&self->segment, update, rate, format,
- start, stop, time);
- } else {
- /* if not time format, we'll either start with a 0 timestamp anyway or
- * it's following a seek in which case we'll have saved the requested
- * seek segment and don't want to overwrite it (remember that on a seek
- * we always just seek back to the start in BYTES format and just throw
- * away all text that's before the requested position; if the subtitles
- * come from an upstream demuxer, it won't be able to handle our BYTES
- * seek request and instead send us a newsegment from the seek request
- * it received via its video pads instead, so all is fine then too) */
- }
-
- ret = TRUE;
- gst_event_unref (event);
- break;
- }
- case GST_EVENT_FLUSH_START:
- {
- self->flushing = TRUE;
-
- ret = gst_pad_event_default (pad, event);
- break;
- }
- case GST_EVENT_FLUSH_STOP:
- {
- self->flushing = FALSE;
-
- ret = gst_pad_event_default (pad, event);
- break;
- }
- default:
- ret = gst_pad_event_default (pad, event);
- break;
- }
-
- gst_object_unref (self);
-
- return ret;
-}
-
-
-static GstStateChangeReturn
-gst_sub_parse_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
- GstSubParse *self = GST_SUBPARSE (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- /* format detection will init the parser state */
- self->offset = 0;
- self->next_offset = 0;
- self->parser_type = GST_SUB_PARSE_FORMAT_UNKNOWN;
- self->valid_utf8 = TRUE;
- self->first_buffer = TRUE;
- g_free (self->detected_encoding);
- self->detected_encoding = NULL;
- g_string_truncate (self->textbuf, 0);
- gst_adapter_clear (self->adapter);
- break;
- default:
- break;
- }
-
- ret = parent_class->change_state (element, transition);
- if (ret == GST_STATE_CHANGE_FAILURE)
- return ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- parser_state_dispose (self, &self->state);
- self->parser_type = GST_SUB_PARSE_FORMAT_UNKNOWN;
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-/*
- * Typefind support.
- */
-
-/* FIXME 0.11: these caps are ugly, use app/x-subtitle + type field or so;
- * also, give different subtitle formats really different types */
-static GstStaticCaps mpl2_caps =
-GST_STATIC_CAPS ("application/x-subtitle-mpl2");
-#define SUB_CAPS (gst_static_caps_get (&sub_caps))
-
-static GstStaticCaps tmp_caps =
-GST_STATIC_CAPS ("application/x-subtitle-tmplayer");
-#define TMP_CAPS (gst_static_caps_get (&tmp_caps))
-
-static GstStaticCaps sub_caps = GST_STATIC_CAPS ("application/x-subtitle");
-#define MPL2_CAPS (gst_static_caps_get (&mpl2_caps))
-
-#ifndef GST_DISABLE_XML
-static GstStaticCaps smi_caps = GST_STATIC_CAPS ("application/x-subtitle-sami");
-#define SAMI_CAPS (gst_static_caps_get (&smi_caps))
-#endif
-
-static GstStaticCaps dks_caps = GST_STATIC_CAPS ("application/x-subtitle-dks");
-#define DKS_CAPS (gst_static_caps_get (&dks_caps))
-
-static GstStaticCaps qttext_caps =
-GST_STATIC_CAPS ("application/x-subtitle-qttext");
-#define QTTEXT_CAPS (gst_static_caps_get (&qttext_caps))
-
-static void
-gst_subparse_type_find (GstTypeFind * tf, gpointer private)
-{
- GstSubParseFormat format;
- const guint8 *data;
- GstCaps *caps;
- gchar *str;
- gchar *encoding = NULL;
- const gchar *end;
-
- if (!(data = gst_type_find_peek (tf, 0, 129)))
- return;
-
- /* make sure string passed to _autodetect() is NUL-terminated */
- str = g_malloc0 (129);
- memcpy (str, data, 128);
-
- if ((encoding = detect_encoding (str, 128)) != NULL) {
- gchar *converted_str;
- GError *err = NULL;
- gsize tmp;
-
- converted_str = gst_convert_to_utf8 (str, 128, encoding, &tmp, &err);
- if (converted_str == NULL) {
- GST_DEBUG ("Encoding '%s' detected but conversion failed: %s", encoding,
- err->message);
- g_error_free (err);
- g_free (encoding);
- } else {
- g_free (str);
- str = converted_str;
- g_free (encoding);
- }
- }
-
- /* Check if at least the first 120 chars are valid UTF8,
- * otherwise convert as always */
- if (!g_utf8_validate (str, 128, &end) && (end - str) < 120) {
- gchar *converted_str;
- GError *err = NULL;
- gsize tmp;
- const gchar *enc;
-
- enc = g_getenv ("GST_SUBTITLE_ENCODING");
- if (enc == NULL || *enc == '\0') {
- /* if local encoding is UTF-8 and no encoding specified
- * via the environment variable, assume ISO-8859-15 */
- if (g_get_charset (&enc)) {
- enc = "ISO-8859-15";
- }
- }
- converted_str = gst_convert_to_utf8 (str, 128, enc, &tmp, &err);
- if (converted_str == NULL) {
- GST_DEBUG ("Charset conversion failed: %s", err->message);
- g_error_free (err);
- g_free (str);
- return;
- } else {
- g_free (str);
- str = converted_str;
- }
- }
-
- format = gst_sub_parse_data_format_autodetect (str);
- g_free (str);
-
- switch (format) {
- case GST_SUB_PARSE_FORMAT_MDVDSUB:
- GST_DEBUG ("MicroDVD format detected");
- caps = SUB_CAPS;
- break;
- case GST_SUB_PARSE_FORMAT_SUBRIP:
- GST_DEBUG ("SubRip format detected");
- caps = SUB_CAPS;
- break;
- case GST_SUB_PARSE_FORMAT_MPSUB:
- GST_DEBUG ("MPSub format detected");
- caps = SUB_CAPS;
- break;
-#ifndef GST_DISABLE_XML
- case GST_SUB_PARSE_FORMAT_SAMI:
- GST_DEBUG ("SAMI (time-based) format detected");
- caps = SAMI_CAPS;
- break;
-#endif
- case GST_SUB_PARSE_FORMAT_TMPLAYER:
- GST_DEBUG ("TMPlayer (time based) format detected");
- caps = TMP_CAPS;
- break;
- /* FIXME: our MPL2 typefinding is not really good enough to warrant
- * returning a high probability (however, since we registered our
- * typefinder here with a rank of MARGINAL we should pretty much only
- * be called if most other typefinders have already run */
- case GST_SUB_PARSE_FORMAT_MPL2:
- GST_DEBUG ("MPL2 (time based) format detected");
- caps = MPL2_CAPS;
- break;
- case GST_SUB_PARSE_FORMAT_SUBVIEWER:
- GST_DEBUG ("SubViewer format detected");
- caps = SUB_CAPS;
- break;
- case GST_SUB_PARSE_FORMAT_DKS:
- GST_DEBUG ("DKS format detected");
- caps = DKS_CAPS;
- break;
- case GST_SUB_PARSE_FORMAT_QTTEXT:
- GST_DEBUG ("QTtext format detected");
- caps = QTTEXT_CAPS;
- break;
- default:
- case GST_SUB_PARSE_FORMAT_UNKNOWN:
- GST_DEBUG ("no subtitle format detected");
- return;
- }
-
- /* if we're here, it's ok */
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, caps);
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- static gchar *sub_exts[] = { "srt", "sub", "mpsub", "mdvd", "smi", "txt",
- "dks", NULL
- };
-
- GST_DEBUG_CATEGORY_INIT (sub_parse_debug, "subparse", 0, ".sub parser");
-
- if (!gst_type_find_register (plugin, "subparse_typefind", GST_RANK_MARGINAL,
- gst_subparse_type_find, sub_exts, SUB_CAPS, NULL, NULL))
- return FALSE;
-
- if (!gst_element_register (plugin, "subparse",
- GST_RANK_PRIMARY, GST_TYPE_SUBPARSE) ||
- !gst_element_register (plugin, "ssaparse",
- GST_RANK_PRIMARY, GST_TYPE_SSA_PARSE)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "subparse",
- "Subtitle parsing",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/subparse/gstsubparse.h b/gst/subparse/gstsubparse.h
deleted file mode 100644
index 5731d918..00000000
--- a/gst/subparse/gstsubparse.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* GStreamer
- * Copyright (C) <2002> David A. Schleef <ds@schleef.org>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_SUBPARSE_H__
-#define __GST_SUBPARSE_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstadapter.h>
-
-GST_DEBUG_CATEGORY_EXTERN (sub_parse_debug);
-#define GST_CAT_DEFAULT sub_parse_debug
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_SUBPARSE \
- (gst_sub_parse_get_type ())
-#define GST_SUBPARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_SUBPARSE, GstSubParse))
-#define GST_SUBPARSE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_SUBPARSE, GstSubParseClass))
-#define GST_IS_SUBPARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_SUBPARSE))
-#define GST_IS_SUBPARSE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_SUBPARSE))
-
-typedef struct _GstSubParse GstSubParse;
-typedef struct _GstSubParseClass GstSubParseClass;
-
-/* format enum */
-typedef enum
-{
- GST_SUB_PARSE_FORMAT_UNKNOWN = 0,
- GST_SUB_PARSE_FORMAT_MDVDSUB = 1,
- GST_SUB_PARSE_FORMAT_SUBRIP = 2,
- GST_SUB_PARSE_FORMAT_MPSUB = 3,
- GST_SUB_PARSE_FORMAT_SAMI = 4,
- GST_SUB_PARSE_FORMAT_TMPLAYER = 5,
- GST_SUB_PARSE_FORMAT_MPL2 = 6,
- GST_SUB_PARSE_FORMAT_SUBVIEWER = 7,
- GST_SUB_PARSE_FORMAT_DKS = 8,
- GST_SUB_PARSE_FORMAT_QTTEXT = 9
-} GstSubParseFormat;
-
-typedef struct {
- int state;
- GString *buf;
- guint64 start_time;
- guint64 duration;
- guint64 max_duration; /* to clamp duration, 0 = no limit (used by tmplayer parser) */
- GstSegment *segment;
- gpointer user_data;
- gboolean have_internal_fps; /* If TRUE don't overwrite fps by property */
- gint fps_n, fps_d; /* used by frame based parsers */
-} ParserState;
-
-typedef gchar* (*Parser) (ParserState *state, const gchar *line);
-
-struct _GstSubParse {
- GstElement element;
-
- GstPad *sinkpad,*srcpad;
-
- /* contains the input in the input encoding */
- GstAdapter *adapter;
- /* contains the UTF-8 decoded input */
- GString *textbuf;
-
- GstSubParseFormat parser_type;
- gboolean parser_detected;
- const gchar *subtitle_codec;
-
- Parser parse_line;
- ParserState state;
-
- /* seek */
- guint64 offset;
- guint64 next_offset;
-
- /* Segment */
- GstSegment segment;
- GstSeekFlags segment_flags;
- gboolean need_segment;
-
- gboolean flushing;
- gboolean valid_utf8;
- gchar *detected_encoding;
- gchar *encoding;
-
- gboolean first_buffer;
-
- /* used by frame based parsers */
- gint fps_n, fps_d;
-};
-
-struct _GstSubParseClass {
- GstElementClass parent_class;
-};
-
-GType gst_sub_parse_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_SUBPARSE_H__ */
diff --git a/gst/subparse/mpl2parse.c b/gst/subparse/mpl2parse.c
deleted file mode 100644
index cd400bc0..00000000
--- a/gst/subparse/mpl2parse.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* GStreamer mpl2 format subtitle parser
- * Copyright (C) 2006 Kamil Pawlowski <kamilpe 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "mpl2parse.h"
-
-#include <stdio.h>
-#include <string.h>
-
-/* From http://lists.mplayerhq.hu/pipermail/mplayer-users/2003-February/030222.html
- *
- * [123][456] Sample subtitle
- * [1234][5678] Line 1|Line 2
- * [12345][67890] /Italic|Normal
- * [12345][67890] /Italic|/Italic
- * [12345][67890] Normal|/Italic
- *
- * (The space between the last ']' bracket and the text appears to be optional)
- */
-
-static gchar *
-mpl2_parse_line (ParserState * state, const gchar * line, guint line_num)
-{
- GString *markup;
- gint dc_start, dc_stop;
-
- /* parse subtitle file line */
- if (sscanf (line, "[%u][%u]", &dc_start, &dc_stop) != 2) {
- GST_WARNING ("failed to extract timestamps for line '%s'", line);
- return NULL;
- }
-
- GST_LOG ("line format %u %u", dc_start, dc_stop);
- state->start_time = GST_SECOND / 10 * dc_start;
- state->duration = (GST_SECOND / 10 * dc_stop) - state->start_time;
-
- /* skip brackets with timestamps */
- line = strchr (line, ']') + 1;
- line = strchr (line, ']') + 1;
-
- markup = g_string_new (NULL);
-
- while (1) {
- const gchar *format_string;
- const gchar *sep;
- gchar *line_chunk_escaped;
-
- /* skip leading white spaces */
- while (*line == ' ' || *line == '\t')
- ++line;
-
- /* a '/' at the beginning indicates italics */
- if (*line == '/') {
- format_string = "<i>%s</i>";
- ++line;
- } else {
- format_string = "%s";
- }
-
- if ((sep = strchr (line, '|')))
- line_chunk_escaped = g_markup_escape_text (line, sep - line);
- else
- line_chunk_escaped = g_markup_escape_text (line, -1);
-
- GST_LOG ("escaped line: %s", line_chunk_escaped);
- g_string_append_printf (markup, format_string, line_chunk_escaped);
-
- g_free (line_chunk_escaped);
-
- if (sep == NULL)
- break;
-
- /* move after the '|' and append another line */
- g_string_append (markup, "\n");
- line = sep + 1;
- }
-
- return g_strstrip (g_string_free (markup, FALSE));
-}
-
-gchar *
-parse_mpl2 (ParserState * state, const gchar * line)
-{
- gchar *ret;
-
- ret = mpl2_parse_line (state, line, state->state);
- ++state->state;
- return ret;
-}
diff --git a/gst/subparse/mpl2parse.h b/gst/subparse/mpl2parse.h
deleted file mode 100644
index aed62c0f..00000000
--- a/gst/subparse/mpl2parse.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* GStreamer mpl2 format subtitle parser
- * Copyright (C) 2006 Kamil Pawlowski <kamilpe 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _MPL2_PARSE_H_
-#define _MPL2_PARSE_H_
-
-#include "gstsubparse.h"
-
-G_BEGIN_DECLS
-
-gchar * parse_mpl2 (ParserState * state, const gchar * line);
-
-G_END_DECLS
-
-#endif /* _MPL2_PARSE_H_ */
-
diff --git a/gst/subparse/qttextparse.c b/gst/subparse/qttextparse.c
deleted file mode 100644
index b48daf91..00000000
--- a/gst/subparse/qttextparse.c
+++ /dev/null
@@ -1,453 +0,0 @@
-/* GStreamer QTtext subtitle parser
- * Copyright (c) 2009 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/* References:
- * http://www.apple.com/quicktime/tutorials/texttracks.html
- * http://www.apple.com/quicktime/tutorials/textdescriptors.html
- */
-
-#include "qttextparse.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#define MIN_TO_NSEC (60 * GST_SECOND)
-#define HOUR_TO_NSEC (60 * MIN_TO_NSEC)
-
-#define GST_QTTEXT_CONTEXT(state) ((GstQTTextContext *) (state)->user_data)
-
-typedef struct _GstQTTextContext GstQTTextContext;
-
-struct _GstQTTextContext
-{
- /* timing variables */
- gint timescale;
- gboolean absolute;
- guint64 start_time;
-
- gboolean markup_open;
- gboolean need_markup;
-
- gchar *font;
- gint font_size;
- gchar *bg_color;
- gchar *fg_color;
-
- gboolean bold;
- gboolean italic;
-};
-
-void
-qttext_context_init (ParserState * state)
-{
- GstQTTextContext *context;
-
- state->user_data = g_new0 (GstQTTextContext, 1);
-
- context = GST_QTTEXT_CONTEXT (state);
-
- /* we use 1000 as a default */
- context->timescale = 1000;
- context->absolute = TRUE;
-
- context->markup_open = FALSE;
- context->need_markup = FALSE;
-
- context->font_size = 12;
-}
-
-void
-qttext_context_deinit (ParserState * state)
-{
- if (state->user_data != NULL) {
- GstQTTextContext *context = GST_QTTEXT_CONTEXT (state);
- g_free (context->font);
- g_free (context->bg_color);
- g_free (context->fg_color);
-
- g_free (state->user_data);
- state->user_data = NULL;
- }
-}
-
-/*
- * Reads the string right after the ':'
- */
-static gchar *
-read_str (const gchar * line, const gchar * end)
-{
- gint index = 0;
-
- while (line[index] != ':' && line[index] != '}') {
- index++;
- }
- if (line[index] != ':')
- return NULL;
- index++;
- while (line[index] == ' ')
- index++;
-
- return g_strndup (line + index, (end - (line + index)));
-}
-
-/* search for the ':' and parse the number right after it */
-static gint
-read_int (const gchar * line)
-{
- gint index = 0;
- while (line[index] != ':' && line[index] != '}') {
- index++;
- }
- if (line[index] != ':')
- return 0;
- index++;
- return atoi (line + index);
-}
-
-/* skip the ':' and then match the following string
- * with 'match', but only if it before 'upto' */
-static gboolean
-string_match (const gchar * line, const gchar * match, const gchar * upto)
-{
- gchar *result = strstr (line, match);
- return (result < upto);
-}
-
-/*
- * Reads the color values and stores them in r, g and b.
- */
-static gboolean
-read_color (const gchar * line, gint * r, gint * g, gint * b)
-{
- gint index = 0;
- while (line[index] != ':' && line[index] != '}') {
- index++;
- }
- if (line[index] != ':')
- return FALSE;
- index++;
-
- *r = atoi (line + index);
-
- while (line[index] != '}' && line[index] != ',') {
- index++;
- }
- if (line[index] != ',')
- return FALSE;
- index++;
-
- *g = atoi (line + index);
-
- while (line[index] != '}' && line[index] != ',') {
- index++;
- }
- if (line[index] != ',')
- return FALSE;
- index++;
-
- *b = atoi (line + index);
-
- return TRUE;
-}
-
-static gchar *
-make_color (gint r, gint g, gint b)
-{
- /* qttext goes up to 65535, while pango goes to 255 */
- r /= 256;
- g /= 256;
- b /= 256;
- return g_strdup_printf ("#%02X%02X%02X", r, g, b);
-}
-
-static gboolean
-qttext_parse_tag (ParserState * state, const gchar * line, gint * index)
-{
- gchar *next;
- gint next_index;
- gint aux;
- gchar *str;
- gint r, g, b;
- GstQTTextContext *context = GST_QTTEXT_CONTEXT (state);
-
- g_assert (line[*index] == '{');
-
- next = strchr (line + *index, '}');
- if (next == NULL) {
- goto error_out;
- } else {
- next_index = 1 + (next - line);
- }
- g_assert (line[next_index - 1] == '}');
-
- *index = *index + 1; /* skip the { */
-
- /* now identify our tag */
- /* FIXME: those should be case unsensitive */
- /* TODO: there are other tags that could be added here */
- if (strncmp (line + *index, "QTtext", 6) == 0) {
- /* NOP */
-
- } else if (strncmp (line + *index, "font", 4) == 0) {
- str = read_str (line + *index + 4, line + next_index - 1);
- if (str) {
- g_free (context->font);
- context->font = str;
- context->need_markup = TRUE;
- GST_DEBUG ("Setting qttext font to %s", str);
- } else {
- GST_WARNING ("Failed to parse qttext font at line: %s", line);
- }
-
- } else if (strncmp (line + *index, "size", 4) == 0) {
- aux = read_int (line + *index + 4);
- if (aux == 0) {
- GST_WARNING ("Invalid size at line %s, using 12", line);
- context->font_size = 12;
- } else {
- GST_DEBUG ("Setting qttext font-size to: %d", aux);
- context->font_size = aux;
- }
- context->need_markup = TRUE;
-
- } else if (strncmp (line + *index, "textColor", 9) == 0) {
- if (read_color (line + *index + 9, &r, &g, &b)) {
- context->fg_color = make_color (r, g, b);
- GST_DEBUG ("Setting qttext fg color to %s", context->fg_color);
- } else {
- GST_WARNING ("Failed to read textColor at line %s", line);
- }
- context->need_markup = TRUE;
-
- } else if (strncmp (line + *index, "backColor", 9) == 0) {
- if (read_color (line + *index + 9, &r, &g, &b)) {
- context->bg_color = make_color (r, g, b);
- GST_DEBUG ("Setting qttext bg color to %s", context->bg_color);
- } else {
- GST_WARNING ("Failed to read backColor at line %s, disabling", line);
- g_free (context->bg_color);
- context->bg_color = NULL;
- }
- context->need_markup = TRUE;
-
- } else if (strncmp (line + *index, "plain", 5) == 0) {
- context->bold = FALSE;
- context->italic = FALSE;
- context->need_markup = TRUE;
- GST_DEBUG ("Setting qttext style to plain");
-
- } else if (strncmp (line + *index, "bold", 4) == 0) {
- context->bold = TRUE;
- context->italic = FALSE;
- context->need_markup = TRUE;
- GST_DEBUG ("Setting qttext style to bold");
-
- } else if (strncmp (line + *index, "italic", 6) == 0) {
- context->bold = FALSE;
- context->italic = TRUE;
- context->need_markup = TRUE;
- GST_DEBUG ("Setting qttext style to italic");
-
- } else if (strncmp (line + *index, "timescale", 9) == 0) {
- aux = read_int (line + *index + 9);
- if (aux == 0) {
- GST_WARNING ("Couldn't interpret timescale at line %s, using 1000", line);
- context->timescale = 1000;
- } else {
- GST_DEBUG ("Setting qttext timescale to: %d", aux);
- context->timescale = aux;
- }
-
- } else if (strncmp (line + *index, "timestamps", 10) == 0) {
- if (string_match (line + *index + 10, "relative", line + next_index)) {
- GST_DEBUG ("Setting qttext timestamps to relative");
- context->absolute = FALSE;
- } else {
- /* call it absolute otherwise */
- GST_DEBUG ("Setting qttext timestamps to absolute");
- context->absolute = TRUE;
- }
-
- } else {
- GST_WARNING ("Unused qttext tag starting at: %s", line + *index);
- }
-
- *index = next_index;
- return TRUE;
-
-error_out:
- {
- GST_WARNING ("Failed to parse qttext tag at line %s", line);
- return FALSE;
- }
-}
-
-static guint64
-qttext_parse_timestamp (ParserState * state, const gchar * line, gint index)
-{
- int ret;
- gint hour, min, sec, dec;
- GstQTTextContext *context = GST_QTTEXT_CONTEXT (state);
-
- ret = sscanf (line + index, "[%d:%d:%d.%d]", &hour, &min, &sec, &dec);
- if (ret != 3 && ret != 4) {
- /* bad timestamp */
- GST_WARNING ("Bad qttext timestamp found: %s", line);
- return 0;
- }
-
- if (ret == 3) {
- /* be forgiving for missing decimal part */
- dec = 0;
- }
-
- /* parse the decimal part according to the timescale */
- g_assert (context->timescale != 0);
- dec = (GST_SECOND * dec) / context->timescale;
-
- /* return the result */
- return hour * HOUR_TO_NSEC + min * MIN_TO_NSEC + sec * GST_SECOND + dec;
-}
-
-static void
-qttext_open_markup (ParserState * state)
-{
- GstQTTextContext *context = GST_QTTEXT_CONTEXT (state);
-
- g_string_append (state->buf, "<span");
-
- /* add your markup tags here */
- if (context->font)
- g_string_append_printf (state->buf, " font='%s %d'", context->font,
- context->font_size);
- else
- g_string_append_printf (state->buf, " font='%d'", context->font_size);
-
- if (context->bg_color)
- g_string_append_printf (state->buf, " bgcolor='%s'", context->bg_color);
- if (context->fg_color)
- g_string_append_printf (state->buf, " color='%s'", context->fg_color);
-
- if (context->bold)
- g_string_append (state->buf, " weight='bold'");
- if (context->italic)
- g_string_append (state->buf, " style='italic'");
-
- g_string_append (state->buf, ">");
-}
-
-static void
-qttext_prepare_text (ParserState * state)
-{
- GstQTTextContext *context = GST_QTTEXT_CONTEXT (state);
- if (state->buf == NULL) {
- state->buf = g_string_sized_new (256); /* this should be enough */
- } else {
- g_string_append (state->buf, "\n");
- }
-
- /* if needed, add pango markup */
- if (context->need_markup) {
- if (context->markup_open) {
- g_string_append (state->buf, "</span>");
- }
- qttext_open_markup (state);
- context->markup_open = TRUE;
- }
-}
-
-static void
-qttext_parse_text (ParserState * state, const gchar * line, gint index)
-{
- qttext_prepare_text (state);
- g_string_append (state->buf, line + index);
-}
-
-static gchar *
-qttext_get_text (ParserState * state)
-{
- gchar *ret;
- GstQTTextContext *context = GST_QTTEXT_CONTEXT (state);
- if (state->buf == NULL)
- return NULL;
-
- if (context->markup_open) {
- g_string_append (state->buf, "</span>");
- }
- ret = g_string_free (state->buf, FALSE);
- state->buf = NULL;
- context->markup_open = FALSE;
- return ret;
-}
-
-gchar *
-parse_qttext (ParserState * state, const gchar * line)
-{
- gint i;
- guint64 ts;
- gchar *ret = NULL;
- GstQTTextContext *context = GST_QTTEXT_CONTEXT (state);
-
- i = 0;
- while (line[i] != '\0') {
- /* find first interesting character from 'i' onwards */
-
- if (line[i] == '{') {
- /* this is a tag, parse it */
- if (!qttext_parse_tag (state, line, &i)) {
- break;
- }
- } else if (line[i] == '[') {
- /* this is a time, convert it to a timestamp */
- ts = qttext_parse_timestamp (state, line, i);
-
- /* check if we have pending text to send, in case we prepare it */
- if (state->buf) {
- ret = qttext_get_text (state);
- if (context->absolute)
- state->duration = ts - context->start_time;
- else
- state->duration = ts;
- state->start_time = context->start_time;
- }
- state->buf = NULL;
-
- if (ts == 0) {
- /* this is an error */
- } else {
- if (context->absolute)
- context->start_time = ts;
- else
- context->start_time += ts;
- }
-
- /* we assume there is nothing else on this line */
- break;
-
- } else if (line[i] == ' ' || line[i] == '\t') {
- i++; /* NOP */
- } else {
- /* this is the actual text, output the rest of the line as it */
- qttext_parse_text (state, line, i);
- break;
- }
- }
- return ret;
-}
diff --git a/gst/subparse/qttextparse.h b/gst/subparse/qttextparse.h
deleted file mode 100644
index 6d4f393b..00000000
--- a/gst/subparse/qttextparse.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* GStreamer QTtext subtitle parser
- * Copyright (c) 2009 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _QTTEXT_PARSE_H_
-#define _QTTEXT_PARSE_H_
-
-#include "gstsubparse.h"
-
-G_BEGIN_DECLS
-
-gchar * parse_qttext (ParserState * state, const gchar * line);
-
-void qttext_context_init (ParserState * state);
-
-void qttext_context_deinit (ParserState * state);
-
-G_END_DECLS
-
-#endif /* _QTTEXT_PARSE_H_ */
-
diff --git a/gst/subparse/samiparse.c b/gst/subparse/samiparse.c
deleted file mode 100644
index 955ee4c4..00000000
--- a/gst/subparse/samiparse.c
+++ /dev/null
@@ -1,474 +0,0 @@
-/* GStreamer SAMI subtitle parser
- * Copyright (c) 2006 Young-Ho Cha <ganadist at chollian 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "samiparse.h"
-
-#include <libxml/HTMLparser.h>
-#include <string.h>
-
-#define ITALIC_TAG 'i'
-#define SPAN_TAG 's'
-#define RUBY_TAG 'r'
-#define RT_TAG 't'
-#define CLEAR_TAG '0'
-
-typedef struct _GstSamiContext GstSamiContext;
-
-struct _GstSamiContext
-{
- GString *buf; /* buffer to collect content */
- GString *rubybuf; /* buffer to collect ruby content */
- GString *resultbuf; /* when opening the next 'sync' tag, move
- * from 'buf' to avoid to append following
- * content */
- GString *state; /* in many sami files there are tags that
- * are not closed, so for each open tag the
- * parser will append a tag flag here so
- * that tags can be closed properly on
- * 'sync' tags. See _context_push_state()
- * and _context_pop_state(). */
- htmlParserCtxtPtr htmlctxt; /* html parser context */
- gboolean has_result; /* set when ready to push out result */
- gboolean in_sync; /* flag to avoid appending anything except the
- * content of the sync elements to buf */
- guint64 time1; /* previous start attribute in sync tag */
- guint64 time2; /* current start attribute in sync tag */
-};
-
-static gchar *
-has_tag (GString * str, const gchar tag)
-{
- return strrchr (str->str, tag);
-}
-
-static void
-sami_context_push_state (GstSamiContext * sctx, char state)
-{
- GST_LOG ("state %c", state);
- g_string_append_c (sctx->state, state);
-}
-
-static void
-sami_context_pop_state (GstSamiContext * sctx, char state)
-{
- GString *str = g_string_new ("");
- GString *context_state = sctx->state;
- int i;
-
- GST_LOG ("state %c", state);
- for (i = context_state->len - 1; i >= 0; i--) {
- switch (context_state->str[i]) {
- case ITALIC_TAG: /* <i> */
- {
- g_string_append (str, "</i>");
- break;
- }
- case SPAN_TAG: /* <span foreground= > */
- {
- g_string_append (str, "</span>");
- break;
- }
- case RUBY_TAG: /* <span size= > -- ruby */
- {
- break;
- }
- case RT_TAG: /* ruby */
- {
- /* FIXME: support for furigana/ruby once implemented in pango */
- g_string_append (sctx->rubybuf, "</span>");
- if (has_tag (context_state, ITALIC_TAG)) {
- g_string_append (sctx->rubybuf, "</i>");
- }
-
- break;
- }
- default:
- break;
- }
- if (context_state->str[i] == state) {
- g_string_append (sctx->buf, str->str);
- g_string_free (str, TRUE);
- g_string_truncate (context_state, i);
- return;
- }
- }
- if (state == CLEAR_TAG) {
- g_string_append (sctx->buf, str->str);
- g_string_truncate (context_state, 0);
- }
- g_string_free (str, TRUE);
-}
-
-static void
-handle_start_sync (GstSamiContext * sctx, const xmlChar ** atts)
-{
- int i;
-
- sami_context_pop_state (sctx, CLEAR_TAG);
- if (atts != NULL) {
- for (i = 0; (atts[i] != NULL); i += 2) {
- const xmlChar *key, *value;
-
- key = atts[i];
- value = atts[i + 1];
-
- if (!value)
- continue;
- if (!xmlStrncmp ((const xmlChar *) "start", key, 5)) {
- /* Only set a new start time if we don't have text pending */
- if (sctx->resultbuf->len == 0)
- sctx->time1 = sctx->time2;
-
- sctx->time2 = atoi ((const char *) value) * GST_MSECOND;
- g_string_append (sctx->resultbuf, sctx->buf->str);
- sctx->has_result = (sctx->resultbuf->len != 0) ? TRUE : FALSE;
- g_string_truncate (sctx->buf, 0);
- }
- }
- }
-}
-
-static void
-handle_start_font (GstSamiContext * sctx, const xmlChar ** atts)
-{
- int i;
-
- sami_context_pop_state (sctx, SPAN_TAG);
- if (atts != NULL) {
- g_string_append (sctx->buf, "<span");
- for (i = 0; (atts[i] != NULL); i += 2) {
- const xmlChar *key, *value;
-
- key = atts[i];
- value = atts[i + 1];
-
- if (!value)
- continue;
- if (!xmlStrncmp ((const xmlChar *) "color", key, 5)) {
- /*
- * There are invalid color value in many
- * sami files.
- * It will fix hex color value that start without '#'
- */
- gchar *sharp = "";
- int len = xmlStrlen (value);
-
- if (!(*value == '#' && len == 7)) {
- gchar *r;
-
- /* check if it looks like hex */
- if (strtol ((const char *) value, &r, 16) >= 0 &&
- ((xmlChar *) r == (value + 6) && len == 6)) {
- sharp = "#";
- }
- }
- /* some colours can be found in many sami files, but X RGB database
- * doesn't contain a colour by this name, so map explicitly */
- if (!xmlStrncasecmp (value, (const xmlChar *) "aqua", len)) {
- value = (const xmlChar *) "#00ffff";
- } else if (!xmlStrncasecmp (value, (const xmlChar *) "crimson", len)) {
- value = (const xmlChar *) "#dc143c";
- } else if (!xmlStrncasecmp (value, (const xmlChar *) "fuchsia", len)) {
- value = (const xmlChar *) "#ff00ff";
- } else if (!xmlStrncasecmp (value, (const xmlChar *) "indigo", len)) {
- value = (const xmlChar *) "#4b0082";
- } else if (!xmlStrncasecmp (value, (const xmlChar *) "lime", len)) {
- value = (const xmlChar *) "#00ff00";
- } else if (!xmlStrncasecmp (value, (const xmlChar *) "olive", len)) {
- value = (const xmlChar *) "#808000";
- } else if (!xmlStrncasecmp (value, (const xmlChar *) "silver", len)) {
- value = (const xmlChar *) "#c0c0c0";
- } else if (!xmlStrncasecmp (value, (const xmlChar *) "teal", len)) {
- value = (const xmlChar *) "#008080";
- }
- g_string_append_printf (sctx->buf, " foreground=\"%s%s\"", sharp,
- value);
- } else if (!xmlStrncasecmp ((const xmlChar *) "face", key, 4)) {
- g_string_append_printf (sctx->buf, " font_family=\"%s\"", value);
- }
- }
- g_string_append_c (sctx->buf, '>');
- sami_context_push_state (sctx, SPAN_TAG);
- }
-}
-
-static void
-start_sami_element (void *ctx, const xmlChar * name, const xmlChar ** atts)
-{
- GstSamiContext *sctx = (GstSamiContext *) ctx;
-
- GST_LOG ("name:%s", name);
-
- if (!xmlStrncmp ((const xmlChar *) "sync", name, 4)) {
- handle_start_sync (sctx, atts);
- sctx->in_sync = TRUE;
- } else if (!xmlStrncmp ((const xmlChar *) "font", name, 4)) {
- handle_start_font (sctx, atts);
- } else if (!xmlStrncmp ((const xmlChar *) "ruby", name, 4)) {
- sami_context_push_state (sctx, RUBY_TAG);
- } else if (!xmlStrncmp ((const xmlChar *) "br", name, 2)) {
- g_string_append_c (sctx->buf, '\n');
- /* FIXME: support for furigana/ruby once implemented in pango */
- } else if (!xmlStrncmp ((const xmlChar *) "rt", name, 2)) {
- if (has_tag (sctx->state, ITALIC_TAG)) {
- g_string_append (sctx->rubybuf, "<i>");
- }
- g_string_append (sctx->rubybuf, "<span size='xx-small' rise='-100'>");
- sami_context_push_state (sctx, RT_TAG);
- } else if (!xmlStrncmp ((const xmlChar *) "p", name, 1)) {
- } else if (!xmlStrncmp ((const xmlChar *) "i", name, 1)) {
- g_string_append (sctx->buf, "<i>");
- sami_context_push_state (sctx, ITALIC_TAG);
- }
-}
-
-static void
-end_sami_element (void *ctx, const xmlChar * name)
-{
- GstSamiContext *sctx = (GstSamiContext *) ctx;
-
- GST_LOG ("name:%s", name);
-
- if (!xmlStrncmp ((const xmlChar *) "sync", name, 4)) {
- sctx->in_sync = FALSE;
- } else if ((!xmlStrncmp ((const xmlChar *) "body", name, 4)) ||
- (!xmlStrncmp ((const xmlChar *) "sami", name, 4))) {
- /* We will usually have one buffer left when the body is closed
- * as we need the next sync to actually send it */
- if (sctx->buf->len != 0) {
- /* Only set a new start time if we don't have text pending */
- if (sctx->resultbuf->len == 0)
- sctx->time1 = sctx->time2;
-
- sctx->time2 = GST_CLOCK_TIME_NONE;
- g_string_append (sctx->resultbuf, sctx->buf->str);
- sctx->has_result = (sctx->resultbuf->len != 0) ? TRUE : FALSE;
- g_string_truncate (sctx->buf, 0);
- }
- } else if (!xmlStrncmp ((const xmlChar *) "font", name, 4)) {
- sami_context_pop_state (sctx, SPAN_TAG);
- } else if (!xmlStrncmp ((const xmlChar *) "ruby", name, 4)) {
- sami_context_pop_state (sctx, RUBY_TAG);
- } else if (!xmlStrncmp ((const xmlChar *) "i", name, 1)) {
- sami_context_pop_state (sctx, ITALIC_TAG);
- }
-}
-
-static void
-characters_sami (void *ctx, const xmlChar * ch, int len)
-{
- GstSamiContext *sctx = (GstSamiContext *) ctx;
- gchar *escaped;
- gchar *tmp;
- gint i;
-
- /* Skip everything except content of the sync elements */
- if (!sctx->in_sync)
- return;
-
- escaped = g_markup_escape_text ((const gchar *) ch, len);
- g_strstrip (escaped);
-
- /* Remove double spaces forom the string as those are
- * usually added by newlines and indention */
- tmp = escaped;
- for (i = 0; i <= strlen (escaped); i++) {
- escaped[i] = *tmp;
- if (*tmp != ' ') {
- tmp++;
- continue;
- }
- while (*tmp == ' ')
- tmp++;
- }
-
- if (has_tag (sctx->state, RT_TAG)) {
- g_string_append_c (sctx->rubybuf, ' ');
- g_string_append (sctx->rubybuf, escaped);
- g_string_append_c (sctx->rubybuf, ' ');
- } else {
- g_string_append (sctx->buf, escaped);
- }
- g_free (escaped);
-}
-
-static xmlSAXHandler samiSAXHandlerStruct = {
- NULL, /* internalSubset */
- NULL, /* isStandalone */
- NULL, /* hasInternalSubset */
- NULL, /* hasExternalSubset */
- NULL, /* resolveEntity */
- NULL, /* getEntity */
- NULL, /* entityDecl */
- NULL, /* notationDecl */
- NULL, /* attributeDecl */
- NULL, /* elementDecl */
- NULL, /* unparsedEntityDecl */
- NULL, /* setDocumentLocator */
- NULL, /* startDocument */
- NULL, /* endDocument */
- start_sami_element, /* startElement */
- end_sami_element, /* endElement */
- NULL, /* reference */
- characters_sami, /* characters */
- NULL, /* ignorableWhitespace */
- NULL, /* processingInstruction */
- NULL, /* comment */
- NULL, /* xmlParserWarning */
- NULL, /* xmlParserError */
- NULL, /* xmlParserError */
- NULL, /* getParameterEntity */
- NULL, /* cdataBlock */
- NULL, /* externalSubset */
- 1, /* initialized */
- NULL, /* private */
- NULL, /* startElementNsSAX2Func */
- NULL, /* endElementNsSAX2Func */
- NULL /* xmlStructuredErrorFunc */
-};
-
-static xmlSAXHandlerPtr samiSAXHandler = &samiSAXHandlerStruct;
-
-void
-sami_context_init (ParserState * state)
-{
- GstSamiContext *context;
-
- g_assert (state->user_data == NULL);
- state->user_data = (gpointer) g_new0 (GstSamiContext, 1);
- context = (GstSamiContext *) state->user_data;
-
- context->htmlctxt = htmlCreatePushParserCtxt (samiSAXHandler, context,
- "", 0, NULL, XML_CHAR_ENCODING_UTF8);
- context->buf = g_string_new ("");
- context->rubybuf = g_string_new ("");
- context->resultbuf = g_string_new ("");
- context->state = g_string_new ("");
-}
-
-void
-sami_context_deinit (ParserState * state)
-{
- GstSamiContext *context = (GstSamiContext *) state->user_data;
-
- if (context) {
- htmlParserCtxtPtr htmlctxt = context->htmlctxt;
-
- /* destroy sax context */
- htmlDocPtr doc;
-
- htmlParseChunk (htmlctxt, "", 0, 1);
- doc = htmlctxt->myDoc;
- htmlFreeParserCtxt (htmlctxt);
- context->htmlctxt = NULL;
- if (doc)
- xmlFreeDoc (doc);
- g_string_free (context->buf, TRUE);
- g_string_free (context->rubybuf, TRUE);
- g_string_free (context->resultbuf, TRUE);
- g_string_free (context->state, TRUE);
- g_free (context);
- state->user_data = NULL;
- }
-}
-
-void
-sami_context_reset (ParserState * state)
-{
- GstSamiContext *context = (GstSamiContext *) state->user_data;
-
- if (context) {
- g_string_truncate (context->buf, 0);
- g_string_truncate (context->rubybuf, 0);
- g_string_truncate (context->resultbuf, 0);
- g_string_truncate (context->state, 0);
- context->has_result = FALSE;
- context->in_sync = FALSE;
- context->time1 = 0;
- context->time2 = 0;
- }
-}
-
-static gchar *
-fix_invalid_entities (const gchar * line)
-{
- const gchar *cp, *pp; /* current pointer, previous pointer */
- gssize size;
- GString *ret = g_string_new (NULL);
-
- pp = line;
- cp = strchr (line, '&');
- while (cp) {
- size = cp - pp;
- ret = g_string_append_len (ret, pp, size);
- cp++;
- if (g_ascii_strncasecmp (cp, "nbsp;", 5)
- && (!g_ascii_strncasecmp (cp, "nbsp", 4))) {
- /* translate "&nbsp" to "&nbsp;" */
- ret = g_string_append_len (ret, "&nbsp;", 6);
- cp += 4;
- } else if (g_ascii_strncasecmp (cp, "quot;", 5)
- && g_ascii_strncasecmp (cp, "amp;", 4)
- && g_ascii_strncasecmp (cp, "apos;", 5)
- && g_ascii_strncasecmp (cp, "lt;", 3)
- && g_ascii_strncasecmp (cp, "gt;", 3)
- && g_ascii_strncasecmp (cp, "nbsp;", 5)
- && cp[0] != '#') {
- /* translate "&" to "&amp;" */
- ret = g_string_append_len (ret, "&amp;", 5);
- } else {
- /* do not translate */
- ret = g_string_append_c (ret, '&');
- }
-
- pp = cp;
- cp = strchr (pp, '&');
- }
- ret = g_string_append (ret, pp);
- return g_string_free (ret, FALSE);
-}
-
-gchar *
-parse_sami (ParserState * state, const gchar * line)
-{
- gchar *fixed_line;
- GstSamiContext *context = (GstSamiContext *) state->user_data;
-
- fixed_line = fix_invalid_entities (line);
- htmlParseChunk (context->htmlctxt, fixed_line, strlen (fixed_line), 0);
- g_free (fixed_line);
-
- if (context->has_result) {
- gchar *r;
-
- if (context->rubybuf->len) {
- context->rubybuf = g_string_append_c (context->rubybuf, '\n');
- g_string_prepend (context->resultbuf, context->rubybuf->str);
- context->rubybuf = g_string_truncate (context->rubybuf, 0);
- }
-
- r = g_string_free (context->resultbuf, FALSE);
- context->resultbuf = g_string_new ("");
- state->start_time = context->time1;
- state->duration = context->time2 - context->time1;
- context->has_result = FALSE;
- return r;
- }
- return NULL;
-}
diff --git a/gst/subparse/samiparse.h b/gst/subparse/samiparse.h
deleted file mode 100644
index a45de018..00000000
--- a/gst/subparse/samiparse.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* GStreamer SAMI subtitle parser
- * Copyright (c) 2006 Young-Ho Cha <ganadist chollian 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _SAMI_PARSE_H_
-#define _SAMI_PARSE_H_
-
-#include "gstsubparse.h"
-
-G_BEGIN_DECLS
-
-gchar * parse_sami (ParserState * state, const gchar * line);
-
-void sami_context_init (ParserState * state);
-
-void sami_context_deinit (ParserState * state);
-
-void sami_context_reset (ParserState * state);
-
-G_END_DECLS
-
-#endif /* _SAMI_PARSE_H_ */
-
diff --git a/gst/subparse/tmplayerparse.c b/gst/subparse/tmplayerparse.c
deleted file mode 100644
index 8f48c6e9..00000000
--- a/gst/subparse/tmplayerparse.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/* GStreamer tmplayer format subtitle parser
- * Copyright (C) 2006-2008 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "tmplayerparse.h"
-
-#include <stdio.h>
-#include <string.h>
-
-/* From http://forum.doom9.org/archive/index.php/t-81059.html:
- *
- * TMPlayer format, which comes in five varieties:
- *
- * time-base 00:00:00:
- * 00:00:50:This is the Earth at a time|when the dinosaurs roamed...
- * 00:00:53:
- * 00:00:54:a lush and fertile planet.
- * 00:00:56:
- *
- * time-base 0:00:00:
- * 0:00:50:This is the Earth at a time|when the dinosaurs roamed...
- * 0:00:53:
- * 0:00:54:a lush and fertile planet.
- * 0:00:56:
- *
- * time-base 00:00:00=
- * 00:00:50=This is the Earth at a time|when the dinosaurs roamed...
- * 00:00:53=
- * 00:00:54=a lush and fertile planet.
- * 00:00:56=
- *
- * time-base 0:00:00=
- * 0:00:50=This is the Earth at a time|when the dinosaurs roamed...
- * 0:00:53=
- * 0:00:54=a lush and fertile planet.
- * 0:00:56=
- *
- * and multiline time-base 00:00:00,1=
- * 00:00:50,1=This is the Earth at a time
- * 00:00:50,2=when the dinosaurs roamed...
- * 00:00:53,1=
- * 00:00:54,1=a lush and fertile planet.
- * 00:00:56,1=
- *
- * --------------------------------------------------------------------------
- *
- * And another variety (which is 'time-base 0:00:00:' but without empty lines):
- *
- * 00:00:01:This is the Earth at a time|when the dinosaurs roamed...
- * 00:00:03:a lush and fertile planet.
- * 00:00:06:More text here
- * 00:00:12:Yet another line
- *
- */
-
-static gchar *
-tmplayer_process_buffer (ParserState * state)
-{
- gchar *ret;
-
- ret = g_strndup (state->buf->str, state->buf->len);
- g_strdelimit (ret, "|", '\n');
- g_string_truncate (state->buf, 0);
- return ret;
-}
-
-static gchar *
-tmplayer_parse_line (ParserState * state, const gchar * line, guint line_num)
-{
- GstClockTime ts = GST_CLOCK_TIME_NONE;
- const gchar *text_start = NULL;
- gboolean multiline = FALSE;
- gchar *ret = NULL;
- gchar divc = '\0';
- guint h, m, s, l = 1;
-
- if (sscanf (line, "%u:%02u:%02u,%u%c", &h, &m, &s, &l, &divc) == 5 &&
- (divc == '=')) {
- GST_LOG ("multiline format %u %u %u %u", h, m, s, l);
- ts = GST_SECOND * ((((h * 60) + m) * 60) + s);
- text_start = strchr (line, '=');
- multiline = TRUE;
- } else if (sscanf (line, "%u:%02u:%02u%c", &h, &m, &s, &divc) == 4 &&
- (divc == '=' || divc == ':')) {
- GST_LOG ("single line format %u %u %u %u %c", h, m, s, l, divc);
- ts = GST_SECOND * ((((h * 60) + m) * 60) + s);
- text_start = strchr (line + 6, divc);
- } else if (line[0] == '\0' && state->buf->len > 0 &&
- GST_CLOCK_TIME_IS_VALID (state->start_time)) {
- /* if we get an empty line (could be the end of the file, but doesn't have
- * to be), just push whatever is still in the buffer without a duration */
- GST_LOG ("empty line, and there's still text in the buffer");
- ret = tmplayer_process_buffer (state);
- state->duration = GST_CLOCK_TIME_NONE;
- return ret;
- } else {
- GST_WARNING ("failed to parse line: '%s'", line);
- return NULL;
- }
-
- /* if this is a line without text, or the first line in a multiline file,
- * process and return the data in the buffer, which is the previous line(s) */
- if (text_start == NULL || text_start[1] == '\0' ||
- (l == 1 && state->buf->len > 0)) {
-
- if (GST_CLOCK_TIME_IS_VALID (state->start_time) &&
- state->start_time < ts && line_num > 0) {
- ret = tmplayer_process_buffer (state);
- state->duration = ts - state->start_time;
- /* ..and append current line's text (if there is any) for the next round.
- * We don't have to store ts as pending_start_time, since we deduce the
- * durations from the start times anyway, so as long as the parser just
- * forwards state->start_time by duration after it pushes the line we
- * are about to return it will all be good. */
- g_string_append (state->buf, text_start + 1);
- } else if (line_num > 0) {
- GST_WARNING ("end of subtitle unit but no valid start time?!");
- }
- } else {
- if (l > 1)
- g_string_append_c (state->buf, '\n');
- g_string_append (state->buf, text_start + 1);
- state->start_time = ts;
- }
-
- GST_LOG ("returning: '%s'", GST_STR_NULL (ret));
- return ret;
-}
-
-gchar *
-parse_tmplayer (ParserState * state, const gchar * line)
-{
- gchar *ret;
-
- /* GST_LOG ("Parsing: %s", line); */
-
- ret = tmplayer_parse_line (state, line, state->state);
- ++state->state;
-
- return ret;
-}
diff --git a/gst/subparse/tmplayerparse.h b/gst/subparse/tmplayerparse.h
deleted file mode 100644
index a0001afc..00000000
--- a/gst/subparse/tmplayerparse.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* GStreamer tmplayer format subtitle parser
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef _TMPLAYER_PARSE_H_
-#define _TMPLAYER_PARSE_H_
-
-#include "gstsubparse.h"
-
-G_BEGIN_DECLS
-
-gchar * parse_tmplayer (ParserState * state, const gchar * line);
-
-G_END_DECLS
-
-#endif /* _TMPLAYER_PARSE_H_ */
-
diff --git a/gst/tcp/.gitignore b/gst/tcp/.gitignore
deleted file mode 100644
index 45ededdb..00000000
--- a/gst/tcp/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-gsttcp-enumtypes.c
-gsttcp-enumtypes.h
-gsttcp-marshal.c
-gsttcp-marshal.h
-fdsetstress
diff --git a/gst/tcp/Makefile.am b/gst/tcp/Makefile.am
deleted file mode 100644
index 02bc526c..00000000
--- a/gst/tcp/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-plugin_LTLIBRARIES = libgsttcp.la
-
-# variables used for enum/marshal generation
-glib_enum_headers = gsttcp.h
-glib_enum_define = GST_TCP
-glib_gen_prefix = gst_tcp
-glib_gen_basename = gsttcp
-
-include $(top_srcdir)/common/gst-glib-gen.mak
-
-built_sources = gsttcp-enumtypes.c gsttcp-marshal.c
-built_headers = gsttcp-enumtypes.h gsttcp-marshal.h
-
-BUILT_SOURCES = $(built_sources) $(built_headers)
-
-libgsttcp_la_SOURCES = \
- gsttcpplugin.c \
- gsttcp.c \
- gstmultifdsink.c \
- gsttcpclientsrc.c gsttcpclientsink.c \
- gsttcpserversrc.c gsttcpserversink.c
-
-nodist_libgsttcp_la_SOURCES = \
- $(built_sources)
-
-# remove ENABLE_NEW when dataprotocol is stable
-libgsttcp_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) -DGST_ENABLE_NEW
-libgsttcp_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgsttcp_la_LIBADD = $(GST_BASE_LIBS) $(GST_GDP_LIBS) $(GST_LIBS)
-libgsttcp_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = \
- gsttcpplugin.h \
- gsttcp.h \
- gstmultifdsink.h \
- gsttcpclientsrc.h gsttcpclientsink.h \
- gsttcpserversrc.h gsttcpserversink.h
-
-CLEANFILES = $(BUILT_SOURCES)
-
-EXTRA_DIST = gsttcp-marshal.list
diff --git a/gst/tcp/README b/gst/tcp/README
deleted file mode 100644
index 47e4894b..00000000
--- a/gst/tcp/README
+++ /dev/null
@@ -1,53 +0,0 @@
-This part of the documentation is for the new tcp elements:
-- tcpclientsrc
-- tcpclientsink
-- tcpserversrc
-- tcpserversink
-
-TESTS
------
-Use these tests to test functionality of the various tcp plugins
-
-* server: nc -l -p 3000
- client: nc localhost 3000
- everything you type in the server is shown on the client
- everything you type in the client is shown on the server
-
-* server: nc -l -p 3000
- client: gst-launch tcpclientsrc protocol=none port=3000 ! fdsink fd=2
- everything you type in the server is shown on the client
-
-* server: nc -l -p 3000
- client: gst-launch fdsrc fd=1 ! tcpclientsink protocol=none port=3000
- everything you type in the client is shown on the server
-
-* server: gst-launch tcpserversrc protocol=none port=3000 ! fdsink fd=2
- client: gst-launch fdsrc fd=1 ! tcpclientsink protocol=none port=3000
-
-* server: gst-launch fdsrc fd=1 ! tcpserversink protocol=none port=3000
- client: gst-launch tcpclientsrc protocol=none port=3000 ! fdsink fd=2
- -> Received first buffer without caps set
-
-TODO
-----
-- implement DNS resolution
-
-multifdsink
------------
-- operation:
- - client fd gets added when "add" signal gets emitted on multifdsink
- - signal handler creates a GstTCPClient structure, adds it to ->clients,
- and adds the fd to ->fd_hash, then emits client-added
- - client
-
- - when a buffer comes in:
- - the _render vmethod puts the buffer on the global queue
- - and increases bytes_to_serve
- - (currently it sets streamheaders, but since this is treated globally
- this is wrong - clients can be at different positions in the stream)
-
- - when a client issues a write (ie requests data):
- - when using GDP, if no caps sent yet, send caps first, then set caps_sent
- - if streamheader buffers, and we haven't sent yet to this client,
- send current streamheader buffers, then set streamheader_sent
- - send out buffers
diff --git a/gst/tcp/gstmultifdsink.c b/gst/tcp/gstmultifdsink.c
deleted file mode 100644
index 4a440e95..00000000
--- a/gst/tcp/gstmultifdsink.c
+++ /dev/null
@@ -1,2974 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
- * Copyright (C) 2006 Wim Taymans <wim at fluendo dot 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.
- */
-
-/**
- * SECTION:element-multifdsink
- * @see_also: tcpserversink
- *
- * This plugin writes incoming data to a set of file descriptors. The
- * file descriptors can be added to multifdsink by emitting the #GstMultiFdSink::add signal.
- * For each descriptor added, the #GstMultiFdSink::client-added signal will be called.
- *
- * As of version 0.10.8, a client can also be added with the #GstMultiFdSink::add-full signal
- * that allows for more control over what and how much data a client
- * initially receives.
- *
- * Clients can be removed from multifdsink by emitting the #GstMultiFdSink::remove signal. For
- * each descriptor removed, the #GstMultiFdSink::client-removed signal will be called. The
- * #GstMultiFdSink::client-removed signal can also be fired when multifdsink decides that a
- * client is not active anymore or, depending on the value of the
- * #GstMultiFdSink:recover-policy property, if the client is reading too slowly.
- * In all cases, multifdsink will never close a file descriptor itself.
- * The user of multifdsink is responsible for closing all file descriptors.
- * This can for example be done in response to the #GstMultiFdSink::client-fd-removed signal.
- * Note that multifdsink still has a reference to the file descriptor when the
- * #GstMultiFdSink::client-removed signal is emitted, so that "get-stats" can be performed on
- * the descriptor; it is therefore not safe to close the file descriptor in
- * the #GstMultiFdSink::client-removed signal handler, and you should use the
- * #GstMultiFdSink::client-fd-removed signal to safely close the fd.
- *
- * Multifdsink internally keeps a queue of the incoming buffers and uses a
- * separate thread to send the buffers to the clients. This ensures that no
- * client write can block the pipeline and that clients can read with different
- * speeds.
- *
- * When adding a client to multifdsink, the #GstMultiFdSink:sync-method property will define
- * which buffer in the queued buffers will be sent first to the client. Clients
- * can be sent the most recent buffer (which might not be decodable by the
- * client if it is not a keyframe), the next keyframe received in
- * multifdsink (which can take some time depending on the keyframe rate), or the
- * last received keyframe (which will cause a simple burst-on-connect).
- * Multifdsink will always keep at least one keyframe in its internal buffers
- * when the sync-mode is set to latest-keyframe.
- *
- * As of version 0.10.8, there are additional values for the #GstMultiFdSink:sync-method
- * property to allow finer control over burst-on-connect behaviour. By selecting
- * the 'burst' method a minimum burst size can be chosen, 'burst-keyframe'
- * additionally requires that the burst begin with a keyframe, and
- * 'burst-with-keyframe' attempts to burst beginning with a keyframe, but will
- * prefer a minimum burst size even if it requires not starting with a keyframe.
- *
- * Multifdsink can be instructed to keep at least a minimum amount of data
- * expressed in time or byte units in its internal queues with the the
- * #GstMultiFdSink:time-min and #GstMultiFdSink:bytes-min properties respectively.
- * These properties are useful if the application adds clients with the
- * #GstMultiFdSink::add-full signal to make sure that a burst connect can
- * actually be honored.
- *
- * When streaming data, clients are allowed to read at a different rate than
- * the rate at which multifdsink receives data. If the client is reading too
- * fast, no data will be send to the client until multifdsink receives more
- * data. If the client, however, reads too slowly, data for that client will be
- * queued up in multifdsink. Two properties control the amount of data
- * (buffers) that is queued in multifdsink: #GstMultiFdSink:buffers-max and
- * #GstMultiFdSink:buffers-soft-max. A client that falls behind by
- * #GstMultiFdSink:buffers-max is removed from multifdsink forcibly.
- *
- * A client with a lag of at least #GstMultiFdSink:buffers-soft-max enters the recovery
- * procedure which is controlled with the #GstMultiFdSink:recover-policy property.
- * A recover policy of NONE will do nothing, RESYNC_LATEST will send the most recently
- * received buffer as the next buffer for the client, RESYNC_SOFT_LIMIT
- * positions the client to the soft limit in the buffer queue and
- * RESYNC_KEYFRAME positions the client at the most recent keyframe in the
- * buffer queue.
- *
- * multifdsink will by default synchronize on the clock before serving the
- * buffers to the clients. This behaviour can be disabled by setting the sync
- * property to FALSE. Multifdsink will by default not do QoS and will never
- * drop late buffers.
- *
- * Last reviewed on 2006-09-12 (0.10.10)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <gst/gst-i18n-plugin.h>
-
-#include <sys/ioctl.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <netinet/in.h>
-
-#ifdef HAVE_FIONREAD_IN_SYS_FILIO
-#include <sys/filio.h>
-#endif
-
-#include "gstmultifdsink.h"
-#include "gsttcp-marshal.h"
-
-#define NOT_IMPLEMENTED 0
-
-/* elementfactory information */
-static const GstElementDetails gst_multi_fd_sink_details =
-GST_ELEMENT_DETAILS ("Multi filedescriptor sink",
- "Sink/Network",
- "Send data to multiple filedescriptors",
- "Thomas Vander Stichele <thomas at apestaart dot org>, "
- "Wim Taymans <wim@fluendo.com>");
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-GST_DEBUG_CATEGORY_STATIC (multifdsink_debug);
-#define GST_CAT_DEFAULT (multifdsink_debug)
-
-/* MultiFdSink signals and args */
-enum
-{
- /* methods */
- SIGNAL_ADD,
- SIGNAL_ADD_BURST,
- SIGNAL_REMOVE,
- SIGNAL_REMOVE_FLUSH,
- SIGNAL_CLEAR,
- SIGNAL_GET_STATS,
-
- /* signals */
- SIGNAL_CLIENT_ADDED,
- SIGNAL_CLIENT_REMOVED,
- SIGNAL_CLIENT_FD_REMOVED,
-
- LAST_SIGNAL
-};
-
-
-/* this is really arbitrarily chosen */
-#define DEFAULT_PROTOCOL GST_TCP_PROTOCOL_NONE
-#define DEFAULT_MODE 1
-#define DEFAULT_BUFFERS_MAX -1
-#define DEFAULT_BUFFERS_SOFT_MAX -1
-#define DEFAULT_TIME_MIN -1
-#define DEFAULT_BYTES_MIN -1
-#define DEFAULT_BUFFERS_MIN -1
-#define DEFAULT_UNIT_TYPE GST_TCP_UNIT_TYPE_BUFFERS
-#define DEFAULT_UNITS_MAX -1
-#define DEFAULT_UNITS_SOFT_MAX -1
-#define DEFAULT_RECOVER_POLICY GST_RECOVER_POLICY_NONE
-#define DEFAULT_TIMEOUT 0
-#define DEFAULT_SYNC_METHOD GST_SYNC_METHOD_LATEST
-
-#define DEFAULT_BURST_UNIT GST_TCP_UNIT_TYPE_UNDEFINED
-#define DEFAULT_BURST_VALUE 0
-
-#define DEFAULT_QOS_DSCP -1
-#define DEFAULT_HANDLE_READ TRUE
-
-#define DEFAULT_RESEND_STREAMHEADER TRUE
-
-enum
-{
- PROP_0,
- PROP_PROTOCOL,
- PROP_MODE,
- PROP_BUFFERS_QUEUED,
- PROP_BYTES_QUEUED,
- PROP_TIME_QUEUED,
-
- PROP_UNIT_TYPE,
- PROP_UNITS_MAX,
- PROP_UNITS_SOFT_MAX,
-
- PROP_BUFFERS_MAX,
- PROP_BUFFERS_SOFT_MAX,
-
- PROP_TIME_MIN,
- PROP_BYTES_MIN,
- PROP_BUFFERS_MIN,
-
- PROP_RECOVER_POLICY,
- PROP_TIMEOUT,
- PROP_SYNC_METHOD,
- PROP_BYTES_TO_SERVE,
- PROP_BYTES_SERVED,
-
- PROP_BURST_UNIT,
- PROP_BURST_VALUE,
-
- PROP_QOS_DSCP,
-
- PROP_HANDLE_READ,
-
- PROP_RESEND_STREAMHEADER,
-
- PROP_NUM_FDS,
-
- PROP_LAST
-};
-
-/* For backward compat, we can't really select the poll mode anymore with
- * GstPoll. */
-#define GST_TYPE_FDSET_MODE (gst_fdset_mode_get_type())
-static GType
-gst_fdset_mode_get_type (void)
-{
- static GType fdset_mode_type = 0;
- static const GEnumValue fdset_mode[] = {
- {0, "Select", "select"},
- {1, "Poll", "poll"},
- {2, "EPoll", "epoll"},
- {0, NULL, NULL},
- };
-
- if (!fdset_mode_type) {
- fdset_mode_type = g_enum_register_static ("GstFDSetMode", fdset_mode);
- }
- return fdset_mode_type;
-}
-
-#define GST_TYPE_RECOVER_POLICY (gst_recover_policy_get_type())
-static GType
-gst_recover_policy_get_type (void)
-{
- static GType recover_policy_type = 0;
- static const GEnumValue recover_policy[] = {
- {GST_RECOVER_POLICY_NONE,
- "Do not try to recover", "none"},
- {GST_RECOVER_POLICY_RESYNC_LATEST,
- "Resync client to latest buffer", "latest"},
- {GST_RECOVER_POLICY_RESYNC_SOFT_LIMIT,
- "Resync client to soft limit", "soft-limit"},
- {GST_RECOVER_POLICY_RESYNC_KEYFRAME,
- "Resync client to most recent keyframe", "keyframe"},
- {0, NULL, NULL},
- };
-
- if (!recover_policy_type) {
- recover_policy_type =
- g_enum_register_static ("GstRecoverPolicy", recover_policy);
- }
- return recover_policy_type;
-}
-
-#define GST_TYPE_SYNC_METHOD (gst_sync_method_get_type())
-static GType
-gst_sync_method_get_type (void)
-{
- static GType sync_method_type = 0;
- static const GEnumValue sync_method[] = {
- {GST_SYNC_METHOD_LATEST,
- "Serve starting from the latest buffer", "latest"},
- {GST_SYNC_METHOD_NEXT_KEYFRAME,
- "Serve starting from the next keyframe", "next-keyframe"},
- {GST_SYNC_METHOD_LATEST_KEYFRAME,
- "Serve everything since the latest keyframe (burst)",
- "latest-keyframe"},
- {GST_SYNC_METHOD_BURST, "Serve burst-value data to client", "burst"},
- {GST_SYNC_METHOD_BURST_KEYFRAME,
- "Serve burst-value data starting on a keyframe",
- "burst-keyframe"},
- {GST_SYNC_METHOD_BURST_WITH_KEYFRAME,
- "Serve burst-value data preferably starting on a keyframe",
- "burst-with-keyframe"},
- {0, NULL, NULL},
- };
-
- if (!sync_method_type) {
- sync_method_type = g_enum_register_static ("GstSyncMethod", sync_method);
- }
- return sync_method_type;
-}
-
-#define GST_TYPE_UNIT_TYPE (gst_unit_type_get_type())
-static GType
-gst_unit_type_get_type (void)
-{
- static GType unit_type_type = 0;
- static const GEnumValue unit_type[] = {
- {GST_TCP_UNIT_TYPE_UNDEFINED, "Undefined", "undefined"},
- {GST_TCP_UNIT_TYPE_BUFFERS, "Buffers", "buffers"},
- {GST_TCP_UNIT_TYPE_BYTES, "Bytes", "bytes"},
- {GST_TCP_UNIT_TYPE_TIME, "Time", "time"},
- {0, NULL, NULL},
- };
-
- if (!unit_type_type) {
- unit_type_type = g_enum_register_static ("GstTCPUnitType", unit_type);
- }
- return unit_type_type;
-}
-
-#define GST_TYPE_CLIENT_STATUS (gst_client_status_get_type())
-static GType
-gst_client_status_get_type (void)
-{
- static GType client_status_type = 0;
- static const GEnumValue client_status[] = {
- {GST_CLIENT_STATUS_OK, "ok", "ok"},
- {GST_CLIENT_STATUS_CLOSED, "Closed", "closed"},
- {GST_CLIENT_STATUS_REMOVED, "Removed", "removed"},
- {GST_CLIENT_STATUS_SLOW, "Too slow", "slow"},
- {GST_CLIENT_STATUS_ERROR, "Error", "error"},
- {GST_CLIENT_STATUS_DUPLICATE, "Duplicate", "duplicate"},
- {GST_CLIENT_STATUS_FLUSHING, "Flushing", "flushing"},
- {0, NULL, NULL},
- };
-
- if (!client_status_type) {
- client_status_type =
- g_enum_register_static ("GstClientStatus", client_status);
- }
- return client_status_type;
-}
-
-static void gst_multi_fd_sink_finalize (GObject * object);
-
-static void gst_multi_fd_sink_remove_client_link (GstMultiFdSink * sink,
- GList * link);
-
-static GstFlowReturn gst_multi_fd_sink_render (GstBaseSink * bsink,
- GstBuffer * buf);
-static GstStateChangeReturn gst_multi_fd_sink_change_state (GstElement *
- element, GstStateChange transition);
-
-static void gst_multi_fd_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_multi_fd_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-GST_BOILERPLATE (GstMultiFdSink, gst_multi_fd_sink, GstBaseSink,
- GST_TYPE_BASE_SINK);
-
-static guint gst_multi_fd_sink_signals[LAST_SIGNAL] = { 0 };
-
-static void
-gst_multi_fd_sink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sinktemplate));
-
- gst_element_class_set_details (element_class, &gst_multi_fd_sink_details);
-}
-
-static void
-gst_multi_fd_sink_class_init (GstMultiFdSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- GstBaseSinkClass *gstbasesink_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
- gstbasesink_class = (GstBaseSinkClass *) klass;
-
- gobject_class->set_property = gst_multi_fd_sink_set_property;
- gobject_class->get_property = gst_multi_fd_sink_get_property;
- gobject_class->finalize = gst_multi_fd_sink_finalize;
-
- g_object_class_install_property (gobject_class, PROP_PROTOCOL,
- g_param_spec_enum ("protocol", "Protocol", "The protocol to wrap data in",
- GST_TYPE_TCP_PROTOCOL, DEFAULT_PROTOCOL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstMultiFdSink::mode
- *
- * The mode for selecting activity on the fds.
- *
- * This property is deprecated since 0.10.18, if will now automatically
- * select and use the most optimal method.
- */
- g_object_class_install_property (gobject_class, PROP_MODE,
- g_param_spec_enum ("mode", "Mode",
- "The mode for selecting activity on the fds (deprecated)",
- GST_TYPE_FDSET_MODE, DEFAULT_MODE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_BUFFERS_MAX,
- g_param_spec_int ("buffers-max", "Buffers max",
- "max number of buffers to queue for a client (-1 = no limit)", -1,
- G_MAXINT, DEFAULT_BUFFERS_MAX,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_BUFFERS_SOFT_MAX,
- g_param_spec_int ("buffers-soft-max", "Buffers soft max",
- "Recover client when going over this limit (-1 = no limit)", -1,
- G_MAXINT, DEFAULT_BUFFERS_SOFT_MAX,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_BYTES_MIN,
- g_param_spec_int ("bytes-min", "Bytes min",
- "min number of bytes to queue (-1 = as little as possible)", -1,
- G_MAXINT, DEFAULT_BYTES_MIN,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_TIME_MIN,
- g_param_spec_int64 ("time-min", "Time min",
- "min number of time to queue (-1 = as little as possible)", -1,
- G_MAXINT64, DEFAULT_TIME_MIN,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_BUFFERS_MIN,
- g_param_spec_int ("buffers-min", "Buffers min",
- "min number of buffers to queue (-1 = as few as possible)", -1,
- G_MAXINT, DEFAULT_BUFFERS_MIN,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_UNIT_TYPE,
- g_param_spec_enum ("unit-type", "Units type",
- "The unit to measure the max/soft-max/queued properties",
- GST_TYPE_UNIT_TYPE, DEFAULT_UNIT_TYPE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_UNITS_MAX,
- g_param_spec_int64 ("units-max", "Units max",
- "max number of units to queue (-1 = no limit)", -1, G_MAXINT64,
- DEFAULT_UNITS_MAX, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_UNITS_SOFT_MAX,
- g_param_spec_int64 ("units-soft-max", "Units soft max",
- "Recover client when going over this limit (-1 = no limit)", -1,
- G_MAXINT64, DEFAULT_UNITS_SOFT_MAX,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_BUFFERS_QUEUED,
- g_param_spec_uint ("buffers-queued", "Buffers queued",
- "Number of buffers currently queued", 0, G_MAXUINT, 0,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-#if NOT_IMPLEMENTED
- g_object_class_install_property (gobject_class, PROP_BYTES_QUEUED,
- g_param_spec_uint ("bytes-queued", "Bytes queued",
- "Number of bytes currently queued", 0, G_MAXUINT, 0,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_TIME_QUEUED,
- g_param_spec_uint64 ("time-queued", "Time queued",
- "Number of time currently queued", 0, G_MAXUINT64, 0,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-#endif
-
- g_object_class_install_property (gobject_class, PROP_RECOVER_POLICY,
- g_param_spec_enum ("recover-policy", "Recover Policy",
- "How to recover when client reaches the soft max",
- GST_TYPE_RECOVER_POLICY, DEFAULT_RECOVER_POLICY,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_TIMEOUT,
- g_param_spec_uint64 ("timeout", "Timeout",
- "Maximum inactivity timeout in nanoseconds for a client (0 = no limit)",
- 0, G_MAXUINT64, DEFAULT_TIMEOUT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_SYNC_METHOD,
- g_param_spec_enum ("sync-method", "Sync Method",
- "How to sync new clients to the stream", GST_TYPE_SYNC_METHOD,
- DEFAULT_SYNC_METHOD, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_BYTES_TO_SERVE,
- g_param_spec_uint64 ("bytes-to-serve", "Bytes to serve",
- "Number of bytes received to serve to clients", 0, G_MAXUINT64, 0,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_BYTES_SERVED,
- g_param_spec_uint64 ("bytes-served", "Bytes served",
- "Total number of bytes send to all clients", 0, G_MAXUINT64, 0,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_BURST_UNIT,
- g_param_spec_enum ("burst-unit", "Burst unit",
- "The format of the burst units (when sync-method is burst[[-with]-keyframe])",
- GST_TYPE_UNIT_TYPE, DEFAULT_BURST_UNIT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_BURST_VALUE,
- g_param_spec_uint64 ("burst-value", "Burst value",
- "The amount of burst expressed in burst-unit", 0, G_MAXUINT64,
- DEFAULT_BURST_VALUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_QOS_DSCP,
- g_param_spec_int ("qos-dscp", "QoS diff srv code point",
- "Quality of Service, differentiated services code point (-1 default)",
- -1, 63, DEFAULT_QOS_DSCP,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstMultiFdSink::handle-read
- *
- * Handle read requests from clients and discard the data.
- *
- * Since: 0.10.23
- */
- g_object_class_install_property (gobject_class, PROP_HANDLE_READ,
- g_param_spec_boolean ("handle-read", "Handle Read",
- "Handle client reads and discard the data",
- DEFAULT_HANDLE_READ, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstMultiFdSink::resend-streamheader
- *
- * Resend the streamheaders to existing clients when they change.
- *
- * Since: 0.10.23
- */
- g_object_class_install_property (gobject_class, PROP_RESEND_STREAMHEADER,
- g_param_spec_boolean ("resend-streamheader", "Resend streamheader",
- "Resend the streamheader if it changes in the caps",
- DEFAULT_RESEND_STREAMHEADER,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_NUM_FDS,
- g_param_spec_uint ("num-fds", "Number of fds",
- "The current number of client file descriptors.",
- 0, G_MAXUINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstMultiFdSink::add:
- * @gstmultifdsink: the multifdsink element to emit this signal on
- * @fd: the file descriptor to add to multifdsink
- *
- * Hand the given open file descriptor to multifdsink to write to.
- */
- gst_multi_fd_sink_signals[SIGNAL_ADD] =
- g_signal_new ("add", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstMultiFdSinkClass,
- add), NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1,
- G_TYPE_INT);
- /**
- * GstMultiFdSink::add-full:
- * @gstmultifdsink: the multifdsink element to emit this signal on
- * @fd: the file descriptor to add to multifdsink
- * @sync: the sync method to use
- * @unit_type_min: the unit-type of @value_min
- * @value_min: the minimum amount of data to burst expressed in
- * @unit_type_min units.
- * @unit_type_max: the unit-type of @value_max
- * @value_max: the maximum amount of data to burst expressed in
- * @unit_type_max units.
- *
- * Hand the given open file descriptor to multifdsink to write to and
- * specify the burst parameters for the new connection.
- */
- gst_multi_fd_sink_signals[SIGNAL_ADD_BURST] =
- g_signal_new ("add-full", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstMultiFdSinkClass,
- add_full), NULL, NULL,
- gst_tcp_marshal_VOID__INT_ENUM_INT_UINT64_INT_UINT64, G_TYPE_NONE, 6,
- G_TYPE_INT, GST_TYPE_SYNC_METHOD, GST_TYPE_UNIT_TYPE, G_TYPE_UINT64,
- GST_TYPE_UNIT_TYPE, G_TYPE_UINT64);
- /**
- * GstMultiFdSink::remove:
- * @gstmultifdsink: the multifdsink element to emit this signal on
- * @fd: the file descriptor to remove from multifdsink
- *
- * Remove the given open file descriptor from multifdsink.
- */
- gst_multi_fd_sink_signals[SIGNAL_REMOVE] =
- g_signal_new ("remove", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstMultiFdSinkClass,
- remove), NULL, NULL, gst_tcp_marshal_VOID__INT, G_TYPE_NONE, 1,
- G_TYPE_INT);
- /**
- * GstMultiFdSink::remove-flush:
- * @gstmultifdsink: the multifdsink element to emit this signal on
- * @fd: the file descriptor to remove from multifdsink
- *
- * Remove the given open file descriptor from multifdsink after flushing all
- * the pending data to the fd.
- */
- gst_multi_fd_sink_signals[SIGNAL_REMOVE_FLUSH] =
- g_signal_new ("remove-flush", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstMultiFdSinkClass,
- remove_flush), NULL, NULL, gst_tcp_marshal_VOID__INT, G_TYPE_NONE, 1,
- G_TYPE_INT);
- /**
- * GstMultiFdSink::clear:
- * @gstmultifdsink: the multifdsink element to emit this signal on
- *
- * Remove all file descriptors from multifdsink. Since multifdsink did not
- * open fd's itself, it does not explicitly close the fd. The application
- * should do so by connecting to the client-fd-removed callback.
- */
- gst_multi_fd_sink_signals[SIGNAL_CLEAR] =
- g_signal_new ("clear", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstMultiFdSinkClass,
- clear), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
- /**
- * GstMultiFdSink::get-stats:
- * @gstmultifdsink: the multifdsink element to emit this signal on
- * @fd: the file descriptor to get stats of from multifdsink
- *
- * Get statistics about @fd. This function returns a GValueArray to ease
- * automatic wrapping for bindings.
- *
- * Returns: a GValueArray with the statistics. The array contains guint64
- * values that represent respectively: total number of bytes sent, time
- * when the client was added, time when the client was
- * disconnected/removed, time the client is/was active, last activity
- * time (in epoch seconds), number of buffers dropped.
- * All times are expressed in nanoseconds (GstClockTime).
- * The array can be 0-length if the client was not found.
- */
- gst_multi_fd_sink_signals[SIGNAL_GET_STATS] =
- g_signal_new ("get-stats", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstMultiFdSinkClass,
- get_stats), NULL, NULL, gst_tcp_marshal_BOXED__INT,
- G_TYPE_VALUE_ARRAY, 1, G_TYPE_INT);
-
- /**
- * GstMultiFdSink::client-added:
- * @gstmultifdsink: the multifdsink element that emitted this signal
- * @fd: the file descriptor that was added to multifdsink
- *
- * The given file descriptor was added to multifdsink. This signal will
- * be emitted from the streaming thread so application should be prepared
- * for that.
- */
- gst_multi_fd_sink_signals[SIGNAL_CLIENT_ADDED] =
- g_signal_new ("client-added", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstMultiFdSinkClass, client_added),
- NULL, NULL, gst_tcp_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
- /**
- * GstMultiFdSink::client-removed:
- * @gstmultifdsink: the multifdsink element that emitted this signal
- * @fd: the file descriptor that is to be removed from multifdsink
- * @status: the reason why the client was removed
- *
- * The given file descriptor is about to be removed from multifdsink. This
- * signal will be emitted from the streaming thread so applications should
- * be prepared for that.
- *
- * @gstmultifdsink still holds a handle to @fd so it is possible to call
- * the get-stats signal from this callback. For the same reason it is
- * not safe to close() and reuse @fd in this callback.
- */
- gst_multi_fd_sink_signals[SIGNAL_CLIENT_REMOVED] =
- g_signal_new ("client-removed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstMultiFdSinkClass,
- client_removed), NULL, NULL, gst_tcp_marshal_VOID__INT_BOXED,
- G_TYPE_NONE, 2, G_TYPE_INT, GST_TYPE_CLIENT_STATUS);
- /**
- * GstMultiFdSink::client-fd-removed:
- * @gstmultifdsink: the multifdsink element that emitted this signal
- * @fd: the file descriptor that was removed from multifdsink
- *
- * The given file descriptor was removed from multifdsink. This signal will
- * be emitted from the streaming thread so applications should be prepared
- * for that.
- *
- * In this callback, @gstmultifdsink has removed all the information
- * associated with @fd and it is therefore not possible to call get-stats
- * with @fd. It is however safe to close() and reuse @fd in the callback.
- *
- * Since: 0.10.7
- */
- gst_multi_fd_sink_signals[SIGNAL_CLIENT_FD_REMOVED] =
- g_signal_new ("client-fd-removed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstMultiFdSinkClass,
- client_fd_removed), NULL, NULL, gst_tcp_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_multi_fd_sink_change_state);
-
- gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_multi_fd_sink_render);
-
- klass->add = GST_DEBUG_FUNCPTR (gst_multi_fd_sink_add);
- klass->add_full = GST_DEBUG_FUNCPTR (gst_multi_fd_sink_add_full);
- klass->remove = GST_DEBUG_FUNCPTR (gst_multi_fd_sink_remove);
- klass->remove_flush = GST_DEBUG_FUNCPTR (gst_multi_fd_sink_remove_flush);
- klass->clear = GST_DEBUG_FUNCPTR (gst_multi_fd_sink_clear);
- klass->get_stats = GST_DEBUG_FUNCPTR (gst_multi_fd_sink_get_stats);
-
- GST_DEBUG_CATEGORY_INIT (multifdsink_debug, "multifdsink", 0, "FD sink");
-}
-
-static void
-gst_multi_fd_sink_init (GstMultiFdSink * this, GstMultiFdSinkClass * klass)
-{
- GST_OBJECT_FLAG_UNSET (this, GST_MULTI_FD_SINK_OPEN);
-
- this->protocol = DEFAULT_PROTOCOL;
- this->mode = DEFAULT_MODE;
-
- CLIENTS_LOCK_INIT (this);
- this->clients = NULL;
- this->fd_hash = g_hash_table_new (g_int_hash, g_int_equal);
-
- this->bufqueue = g_array_new (FALSE, TRUE, sizeof (GstBuffer *));
- this->unit_type = DEFAULT_UNIT_TYPE;
- this->units_max = DEFAULT_UNITS_MAX;
- this->units_soft_max = DEFAULT_UNITS_SOFT_MAX;
- this->time_min = DEFAULT_TIME_MIN;
- this->bytes_min = DEFAULT_BYTES_MIN;
- this->buffers_min = DEFAULT_BUFFERS_MIN;
- this->recover_policy = DEFAULT_RECOVER_POLICY;
-
- this->timeout = DEFAULT_TIMEOUT;
- this->def_sync_method = DEFAULT_SYNC_METHOD;
- this->def_burst_unit = DEFAULT_BURST_UNIT;
- this->def_burst_value = DEFAULT_BURST_VALUE;
-
- this->qos_dscp = DEFAULT_QOS_DSCP;
- this->handle_read = DEFAULT_HANDLE_READ;
-
- this->resend_streamheader = DEFAULT_RESEND_STREAMHEADER;
-
- this->header_flags = 0;
-}
-
-static void
-gst_multi_fd_sink_finalize (GObject * object)
-{
- GstMultiFdSink *this;
-
- this = GST_MULTI_FD_SINK (object);
-
- CLIENTS_LOCK_FREE (this);
- g_hash_table_destroy (this->fd_hash);
- g_array_free (this->bufqueue, TRUE);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static gint
-setup_dscp_client (GstMultiFdSink * sink, GstTCPClient * client)
-{
- gint tos;
- gint ret;
- union gst_sockaddr
- {
- struct sockaddr sa;
- struct sockaddr_in6 sa_in6;
- struct sockaddr_storage sa_stor;
- } sa;
- socklen_t slen = sizeof (sa);
- gint af;
-
- /* don't touch */
- if (sink->qos_dscp < 0)
- return 0;
-
- if ((ret = getsockname (client->fd.fd, &sa.sa, &slen)) < 0) {
- GST_DEBUG_OBJECT (sink, "could not get sockname: %s", g_strerror (errno));
- return ret;
- }
-
- af = sa.sa.sa_family;
-
- /* if this is an IPv4-mapped address then do IPv4 QoS */
- if (af == AF_INET6) {
-
- GST_DEBUG_OBJECT (sink, "check IP6 socket");
- if (IN6_IS_ADDR_V4MAPPED (&(sa.sa_in6.sin6_addr))) {
- GST_DEBUG_OBJECT (sink, "mapped to IPV4");
- af = AF_INET;
- }
- }
-
- /* extract and shift 6 bits of the DSCP */
- tos = (sink->qos_dscp & 0x3f) << 2;
-
- switch (af) {
- case AF_INET:
- ret = setsockopt (client->fd.fd, IPPROTO_IP, IP_TOS, &tos, sizeof (tos));
- break;
- case AF_INET6:
-#ifdef IPV6_TCLASS
- ret =
- setsockopt (client->fd.fd, IPPROTO_IPV6, IPV6_TCLASS, &tos,
- sizeof (tos));
- break;
-#endif
- default:
- ret = 0;
- GST_ERROR_OBJECT (sink, "unsupported AF");
- break;
- }
- if (ret)
- GST_DEBUG_OBJECT (sink, "could not set DSCP: %s", g_strerror (errno));
-
- return ret;
-}
-
-
-static void
-setup_dscp (GstMultiFdSink * sink)
-{
- GList *clients, *next;
-
- CLIENTS_LOCK (sink);
- for (clients = sink->clients; clients; clients = next) {
- GstTCPClient *client;
-
- client = (GstTCPClient *) clients->data;
- next = g_list_next (clients);
-
- setup_dscp_client (sink, client);
- }
- CLIENTS_UNLOCK (sink);
-}
-
-/* "add-full" signal implementation */
-void
-gst_multi_fd_sink_add_full (GstMultiFdSink * sink, int fd,
- GstSyncMethod sync_method, GstTCPUnitType min_unit, guint64 min_value,
- GstTCPUnitType max_unit, guint64 max_value)
-{
- GstTCPClient *client;
- GList *clink;
- GTimeVal now;
- gint flags, res;
- struct stat statbuf;
-
- GST_DEBUG_OBJECT (sink, "[fd %5d] adding client, sync_method %d, "
- "min_unit %d, min_value %" G_GUINT64_FORMAT
- ", max_unit %d, max_value %" G_GUINT64_FORMAT, fd, sync_method,
- min_unit, min_value, max_unit, max_value);
-
- /* do limits check if we can */
- if (min_unit == max_unit) {
- if (max_value != -1 && min_value != -1 && max_value < min_value)
- goto wrong_limits;
- }
-
- /* create client datastructure */
- client = g_new0 (GstTCPClient, 1);
- client->fd.fd = fd;
- client->status = GST_CLIENT_STATUS_OK;
- client->bufpos = -1;
- client->flushcount = -1;
- client->bufoffset = 0;
- client->sending = NULL;
- client->bytes_sent = 0;
- client->dropped_buffers = 0;
- client->avg_queue_size = 0;
- client->new_connection = TRUE;
- client->burst_min_unit = min_unit;
- client->burst_min_value = min_value;
- client->burst_max_unit = max_unit;
- client->burst_max_value = max_value;
- client->sync_method = sync_method;
- client->currently_removing = FALSE;
-
- /* update start time */
- g_get_current_time (&now);
- client->connect_time = GST_TIMEVAL_TO_TIME (now);
- client->disconnect_time = 0;
- /* set last activity time to connect time */
- client->last_activity_time = client->connect_time;
-
- CLIENTS_LOCK (sink);
-
- /* check the hash to find a duplicate fd */
- clink = g_hash_table_lookup (sink->fd_hash, &client->fd.fd);
- if (clink != NULL)
- goto duplicate;
-
- /* we can add the fd now */
- clink = sink->clients = g_list_prepend (sink->clients, client);
- g_hash_table_insert (sink->fd_hash, &client->fd.fd, clink);
- sink->clients_cookie++;
-
- /* set the socket to non blocking */
- res = fcntl (fd, F_SETFL, O_NONBLOCK);
- /* we always read from a client */
- gst_poll_add_fd (sink->fdset, &client->fd);
-
- /* we don't try to read from write only fds */
- if (sink->handle_read) {
- flags = fcntl (fd, F_GETFL, 0);
- if ((flags & O_ACCMODE) != O_WRONLY) {
- gst_poll_fd_ctl_read (sink->fdset, &client->fd, TRUE);
- }
- }
- /* figure out the mode, can't use send() for non sockets */
- res = fstat (fd, &statbuf);
- if (S_ISSOCK (statbuf.st_mode)) {
- client->is_socket = TRUE;
- setup_dscp_client (sink, client);
- }
-
- gst_poll_restart (sink->fdset);
-
- CLIENTS_UNLOCK (sink);
-
- g_signal_emit (G_OBJECT (sink),
- gst_multi_fd_sink_signals[SIGNAL_CLIENT_ADDED], 0, fd);
-
- return;
-
- /* errors */
-wrong_limits:
- {
- GST_WARNING_OBJECT (sink,
- "[fd %5d] wrong values min =%" G_GUINT64_FORMAT ", max=%"
- G_GUINT64_FORMAT ", unit %d specified when adding client", fd,
- min_value, max_value, min_unit);
- return;
- }
-duplicate:
- {
- client->status = GST_CLIENT_STATUS_DUPLICATE;
- CLIENTS_UNLOCK (sink);
- GST_WARNING_OBJECT (sink, "[fd %5d] duplicate client found, refusing", fd);
- g_signal_emit (G_OBJECT (sink),
- gst_multi_fd_sink_signals[SIGNAL_CLIENT_REMOVED], 0, fd,
- client->status);
- g_free (client);
- return;
- }
-}
-
-/* "add" signal implemntation */
-void
-gst_multi_fd_sink_add (GstMultiFdSink * sink, int fd)
-{
- gst_multi_fd_sink_add_full (sink, fd, sink->def_sync_method,
- sink->def_burst_unit, sink->def_burst_value, sink->def_burst_unit, -1);
-}
-
-/* "remove" signal implementation */
-void
-gst_multi_fd_sink_remove (GstMultiFdSink * sink, int fd)
-{
- GList *clink;
-
- GST_DEBUG_OBJECT (sink, "[fd %5d] removing client", fd);
-
- CLIENTS_LOCK (sink);
- clink = g_hash_table_lookup (sink->fd_hash, &fd);
- if (clink != NULL) {
- GstTCPClient *client = (GstTCPClient *) clink->data;
-
- if (client->status != GST_CLIENT_STATUS_OK) {
- GST_INFO_OBJECT (sink,
- "[fd %5d] Client already disconnecting with status %d",
- fd, client->status);
- goto done;
- }
-
- client->status = GST_CLIENT_STATUS_REMOVED;
- gst_multi_fd_sink_remove_client_link (sink, clink);
- gst_poll_restart (sink->fdset);
- } else {
- GST_WARNING_OBJECT (sink, "[fd %5d] no client with this fd found!", fd);
- }
-
-done:
- CLIENTS_UNLOCK (sink);
-}
-
-/* "remove-flush" signal implementation */
-void
-gst_multi_fd_sink_remove_flush (GstMultiFdSink * sink, int fd)
-{
- GList *clink;
-
- GST_DEBUG_OBJECT (sink, "[fd %5d] flushing client", fd);
-
- CLIENTS_LOCK (sink);
- clink = g_hash_table_lookup (sink->fd_hash, &fd);
- if (clink != NULL) {
- GstTCPClient *client = (GstTCPClient *) clink->data;
-
- if (client->status != GST_CLIENT_STATUS_OK) {
- GST_INFO_OBJECT (sink,
- "[fd %5d] Client already disconnecting with status %d",
- fd, client->status);
- goto done;
- }
-
- /* take the position of the client as the number of buffers left to flush.
- * If the client was at position -1, we flush 0 buffers, 0 == flush 1
- * buffer, etc... */
- client->flushcount = client->bufpos + 1;
- /* mark client as flushing. We can not remove the client right away because
- * it might have some buffers to flush in the ->sending queue. */
- client->status = GST_CLIENT_STATUS_FLUSHING;
- } else {
- GST_WARNING_OBJECT (sink, "[fd %5d] no client with this fd found!", fd);
- }
-done:
- CLIENTS_UNLOCK (sink);
-}
-
-/* can be called both through the signal (i.e. from any thread) or when
- * stopping, after the writing thread has shut down */
-void
-gst_multi_fd_sink_clear (GstMultiFdSink * sink)
-{
- GList *clients, *next;
- guint32 cookie;
-
- GST_DEBUG_OBJECT (sink, "clearing all clients");
-
- CLIENTS_LOCK (sink);
-restart:
- cookie = sink->clients_cookie;
- for (clients = sink->clients; clients; clients = next) {
- GstTCPClient *client;
-
- if (cookie != sink->clients_cookie) {
- GST_DEBUG_OBJECT (sink, "cookie changed while removing all clients");
- goto restart;
- }
-
- client = (GstTCPClient *) clients->data;
- next = g_list_next (clients);
-
- client->status = GST_CLIENT_STATUS_REMOVED;
- gst_multi_fd_sink_remove_client_link (sink, clients);
- }
- gst_poll_restart (sink->fdset);
- CLIENTS_UNLOCK (sink);
-}
-
-/* "get-stats" signal implementation
- * the array returned contains:
- *
- * guint64 : bytes_sent
- * guint64 : connect time (in nanoseconds, since Epoch)
- * guint64 : disconnect time (in nanoseconds, since Epoch)
- * guint64 : time the client is/was connected (in nanoseconds)
- * guint64 : last activity time (in nanoseconds, since Epoch)
- * guint64 : buffers dropped due to recovery
- */
-GValueArray *
-gst_multi_fd_sink_get_stats (GstMultiFdSink * sink, int fd)
-{
- GstTCPClient *client;
- GValueArray *result = NULL;
- GList *clink;
-
- CLIENTS_LOCK (sink);
- clink = g_hash_table_lookup (sink->fd_hash, &fd);
- if (clink == NULL)
- goto noclient;
-
- client = (GstTCPClient *) clink->data;
- if (client != NULL) {
- GValue value = { 0 };
- guint64 interval;
-
- result = g_value_array_new (5);
-
- g_value_init (&value, G_TYPE_UINT64);
- g_value_set_uint64 (&value, client->bytes_sent);
- result = g_value_array_append (result, &value);
- g_value_unset (&value);
- g_value_init (&value, G_TYPE_UINT64);
- g_value_set_uint64 (&value, client->connect_time);
- result = g_value_array_append (result, &value);
- g_value_unset (&value);
- if (client->disconnect_time == 0) {
- GTimeVal nowtv;
-
- g_get_current_time (&nowtv);
-
- interval = GST_TIMEVAL_TO_TIME (nowtv) - client->connect_time;
- } else {
- interval = client->disconnect_time - client->connect_time;
- }
- g_value_init (&value, G_TYPE_UINT64);
- g_value_set_uint64 (&value, client->disconnect_time);
- result = g_value_array_append (result, &value);
- g_value_unset (&value);
- g_value_init (&value, G_TYPE_UINT64);
- g_value_set_uint64 (&value, interval);
- result = g_value_array_append (result, &value);
- g_value_unset (&value);
- g_value_init (&value, G_TYPE_UINT64);
- g_value_set_uint64 (&value, client->last_activity_time);
- result = g_value_array_append (result, &value);
- g_value_unset (&value);
- g_value_init (&value, G_TYPE_UINT64);
- g_value_set_uint64 (&value, client->dropped_buffers);
- result = g_value_array_append (result, &value);
- }
-
-noclient:
- CLIENTS_UNLOCK (sink);
-
- /* python doesn't like a NULL pointer yet */
- if (result == NULL) {
- GST_WARNING_OBJECT (sink, "[fd %5d] no client with this found!", fd);
- result = g_value_array_new (0);
- }
-
- return result;
-}
-
-/* should be called with the clientslock helt.
- * Note that we don't close the fd as we didn't open it in the first
- * place. An application should connect to the client-fd-removed signal and
- * close the fd itself.
- */
-static void
-gst_multi_fd_sink_remove_client_link (GstMultiFdSink * sink, GList * link)
-{
- int fd;
- GTimeVal now;
- GstTCPClient *client = (GstTCPClient *) link->data;
- GstMultiFdSinkClass *fclass;
-
- fclass = GST_MULTI_FD_SINK_GET_CLASS (sink);
-
- fd = client->fd.fd;
-
- if (client->currently_removing) {
- GST_WARNING_OBJECT (sink, "[fd %5d] client is already being removed", fd);
- return;
- } else {
- client->currently_removing = TRUE;
- }
-
- /* FIXME: if we keep track of ip we can log it here and signal */
- switch (client->status) {
- case GST_CLIENT_STATUS_OK:
- GST_WARNING_OBJECT (sink, "[fd %5d] removing client %p for no reason",
- fd, client);
- break;
- case GST_CLIENT_STATUS_CLOSED:
- GST_DEBUG_OBJECT (sink, "[fd %5d] removing client %p because of close",
- fd, client);
- break;
- case GST_CLIENT_STATUS_REMOVED:
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] removing client %p because the app removed it", fd, client);
- break;
- case GST_CLIENT_STATUS_SLOW:
- GST_INFO_OBJECT (sink,
- "[fd %5d] removing client %p because it was too slow", fd, client);
- break;
- case GST_CLIENT_STATUS_ERROR:
- GST_WARNING_OBJECT (sink,
- "[fd %5d] removing client %p because of error", fd, client);
- break;
- case GST_CLIENT_STATUS_FLUSHING:
- default:
- GST_WARNING_OBJECT (sink,
- "[fd %5d] removing client %p with invalid reason %d", fd, client,
- client->status);
- break;
- }
-
- gst_poll_remove_fd (sink->fdset, &client->fd);
-
- g_get_current_time (&now);
- client->disconnect_time = GST_TIMEVAL_TO_TIME (now);
-
- /* free client buffers */
- g_slist_foreach (client->sending, (GFunc) gst_mini_object_unref, NULL);
- g_slist_free (client->sending);
- client->sending = NULL;
-
- if (client->caps)
- gst_caps_unref (client->caps);
- client->caps = NULL;
-
- /* unlock the mutex before signaling because the signal handler
- * might query some properties */
- CLIENTS_UNLOCK (sink);
-
- g_signal_emit (G_OBJECT (sink),
- gst_multi_fd_sink_signals[SIGNAL_CLIENT_REMOVED], 0, fd, client->status);
-
- /* lock again before we remove the client completely */
- CLIENTS_LOCK (sink);
-
- /* fd cannot be reused in the above signal callback so we can safely
- * remove it from the hashtable here */
- if (!g_hash_table_remove (sink->fd_hash, &client->fd.fd)) {
- GST_WARNING_OBJECT (sink,
- "[fd %5d] error removing client %p from hash", client->fd.fd, client);
- }
- /* after releasing the lock above, the link could be invalid, more
- * precisely, the next and prev pointers could point to invalid list
- * links. One optimisation could be to add a cookie to the linked list
- * and take a shortcut when it did not change between unlocking and locking
- * our mutex. For now we just walk the list again. */
- sink->clients = g_list_remove (sink->clients, client);
- sink->clients_cookie++;
-
- if (fclass->removed)
- fclass->removed (sink, client->fd.fd);
-
- g_free (client);
- CLIENTS_UNLOCK (sink);
-
- /* and the fd is really gone now */
- g_signal_emit (G_OBJECT (sink),
- gst_multi_fd_sink_signals[SIGNAL_CLIENT_FD_REMOVED], 0, fd);
-
- CLIENTS_LOCK (sink);
-}
-
-/* handle a read on a client fd,
- * which either indicates a close or should be ignored
- * returns FALSE if some error occured or the client closed. */
-static gboolean
-gst_multi_fd_sink_handle_client_read (GstMultiFdSink * sink,
- GstTCPClient * client)
-{
- int avail, fd;
- gboolean ret;
-
- fd = client->fd.fd;
-
- if (ioctl (fd, FIONREAD, &avail) < 0)
- goto ioctl_failed;
-
- GST_DEBUG_OBJECT (sink, "[fd %5d] select reports client read of %d bytes",
- fd, avail);
-
- ret = TRUE;
-
- if (avail == 0) {
- /* client sent close, so remove it */
- GST_DEBUG_OBJECT (sink, "[fd %5d] client asked for close, removing", fd);
- client->status = GST_CLIENT_STATUS_CLOSED;
- ret = FALSE;
- } else if (avail < 0) {
- GST_WARNING_OBJECT (sink, "[fd %5d] avail < 0, removing", fd);
- client->status = GST_CLIENT_STATUS_ERROR;
- ret = FALSE;
- } else {
- guint8 dummy[512];
- gint nread;
-
- /* just Read 'n' Drop, could also just drop the client as it's not supposed
- * to write to us except for closing the socket, I guess it's because we
- * like to listen to our customers. */
- do {
- /* this is the maximum we can read */
- gint to_read = MIN (avail, 512);
-
- GST_DEBUG_OBJECT (sink, "[fd %5d] client wants us to read %d bytes",
- fd, to_read);
-
- nread = read (fd, dummy, to_read);
- if (nread < -1) {
- GST_WARNING_OBJECT (sink, "[fd %5d] could not read %d bytes: %s (%d)",
- fd, to_read, g_strerror (errno), errno);
- client->status = GST_CLIENT_STATUS_ERROR;
- ret = FALSE;
- break;
- } else if (nread == 0) {
- GST_WARNING_OBJECT (sink, "[fd %5d] 0 bytes in read, removing", fd);
- client->status = GST_CLIENT_STATUS_ERROR;
- ret = FALSE;
- break;
- }
- avail -= nread;
- }
- while (avail > 0);
- }
- return ret;
-
- /* ERRORS */
-ioctl_failed:
- {
- GST_WARNING_OBJECT (sink, "[fd %5d] ioctl failed: %s (%d)",
- fd, g_strerror (errno), errno);
- client->status = GST_CLIENT_STATUS_ERROR;
- return FALSE;
- }
-}
-
-/* Queue raw data for this client, creating a new buffer.
- * This takes ownership of the data by
- * setting it as GST_BUFFER_MALLOCDATA() on the created buffer so
- * be sure to pass g_free()-able @data.
- */
-static gboolean
-gst_multi_fd_sink_client_queue_data (GstMultiFdSink * sink,
- GstTCPClient * client, gchar * data, gint len)
-{
- GstBuffer *buf;
-
- buf = gst_buffer_new ();
- GST_BUFFER_DATA (buf) = (guint8 *) data;
- GST_BUFFER_MALLOCDATA (buf) = (guint8 *) data;
- GST_BUFFER_SIZE (buf) = len;
-
- GST_LOG_OBJECT (sink, "[fd %5d] queueing data of length %d",
- client->fd.fd, len);
-
- client->sending = g_slist_append (client->sending, buf);
-
- return TRUE;
-}
-
-/* GDP-encode given caps and queue them for sending */
-static gboolean
-gst_multi_fd_sink_client_queue_caps (GstMultiFdSink * sink,
- GstTCPClient * client, const GstCaps * caps)
-{
- guint8 *header;
- guint8 *payload;
- guint length;
- gchar *string;
-
- g_return_val_if_fail (caps != NULL, FALSE);
-
- string = gst_caps_to_string (caps);
- GST_DEBUG_OBJECT (sink, "[fd %5d] Queueing caps %s through GDP",
- client->fd.fd, string);
- g_free (string);
-
- if (!gst_dp_packet_from_caps (caps, sink->header_flags, &length, &header,
- &payload)) {
- GST_DEBUG_OBJECT (sink, "Could not create GDP packet from caps");
- return FALSE;
- }
- gst_multi_fd_sink_client_queue_data (sink, client, (gchar *) header, length);
-
- length = gst_dp_header_payload_length (header);
- gst_multi_fd_sink_client_queue_data (sink, client, (gchar *) payload, length);
-
- return TRUE;
-}
-
-static gboolean
-is_sync_frame (GstMultiFdSink * sink, GstBuffer * buffer)
-{
- if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT)) {
- return FALSE;
- } else if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_IN_CAPS)) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-/* queue the given buffer for the given client, possibly adding the GDP
- * header if GDP is being used */
-static gboolean
-gst_multi_fd_sink_client_queue_buffer (GstMultiFdSink * sink,
- GstTCPClient * client, GstBuffer * buffer)
-{
- GstCaps *caps;
-
- /* TRUE: send them if the new caps have them */
- gboolean send_streamheader = FALSE;
- GstStructure *s;
-
- /* before we queue the buffer, we check if we need to queue streamheader
- * buffers (because it's a new client, or because they changed) */
- caps = gst_buffer_get_caps (buffer); /* cleaned up after streamheader */
- if (!client->caps) {
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] no previous caps for this client, send streamheader",
- client->fd.fd);
- send_streamheader = TRUE;
- client->caps = gst_caps_ref (caps);
- } else {
- /* there were previous caps recorded, so compare */
- if (!gst_caps_is_equal (caps, client->caps)) {
- const GValue *sh1, *sh2;
-
- /* caps are not equal, but could still have the same streamheader */
- s = gst_caps_get_structure (caps, 0);
- if (!gst_structure_has_field (s, "streamheader")) {
- /* no new streamheader, so nothing new to send */
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] new caps do not have streamheader, not sending",
- client->fd.fd);
- } else {
- /* there is a new streamheader */
- s = gst_caps_get_structure (client->caps, 0);
- if (!gst_structure_has_field (s, "streamheader")) {
- /* no previous streamheader, so send the new one */
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] previous caps did not have streamheader, sending",
- client->fd.fd);
- send_streamheader = TRUE;
- } else {
- /* both old and new caps have streamheader set */
- if (!sink->resend_streamheader) {
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] asked to not resend the streamheader, not sending",
- client->fd.fd);
- send_streamheader = FALSE;
- } else {
- sh1 = gst_structure_get_value (s, "streamheader");
- s = gst_caps_get_structure (caps, 0);
- sh2 = gst_structure_get_value (s, "streamheader");
- if (gst_value_compare (sh1, sh2) != GST_VALUE_EQUAL) {
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] new streamheader different from old, sending",
- client->fd.fd);
- send_streamheader = TRUE;
- }
- }
- }
- }
- }
- /* Replace the old caps */
- gst_caps_unref (client->caps);
- client->caps = gst_caps_ref (caps);
- }
-
- if (G_UNLIKELY (send_streamheader)) {
- const GValue *sh;
- GArray *buffers;
- int i;
-
- GST_LOG_OBJECT (sink,
- "[fd %5d] sending streamheader from caps %" GST_PTR_FORMAT,
- client->fd.fd, caps);
- s = gst_caps_get_structure (caps, 0);
- if (!gst_structure_has_field (s, "streamheader")) {
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] no new streamheader, so nothing to send", client->fd.fd);
- } else {
- GST_LOG_OBJECT (sink,
- "[fd %5d] sending streamheader from caps %" GST_PTR_FORMAT,
- client->fd.fd, caps);
- sh = gst_structure_get_value (s, "streamheader");
- g_assert (G_VALUE_TYPE (sh) == GST_TYPE_ARRAY);
- buffers = g_value_peek_pointer (sh);
- GST_DEBUG_OBJECT (sink, "%d streamheader buffers", buffers->len);
- for (i = 0; i < buffers->len; ++i) {
- GValue *bufval;
- GstBuffer *buffer;
-
- bufval = &g_array_index (buffers, GValue, i);
- g_assert (G_VALUE_TYPE (bufval) == GST_TYPE_BUFFER);
- buffer = g_value_peek_pointer (bufval);
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] queueing streamheader buffer of length %d",
- client->fd.fd, GST_BUFFER_SIZE (buffer));
- gst_buffer_ref (buffer);
-
- if (sink->protocol == GST_TCP_PROTOCOL_GDP) {
- guint8 *header;
- guint len;
-
- if (!gst_dp_header_from_buffer (buffer, sink->header_flags, &len,
- &header)) {
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] could not create header, removing client",
- client->fd.fd);
- return FALSE;
- }
- gst_multi_fd_sink_client_queue_data (sink, client, (gchar *) header,
- len);
- }
-
- client->sending = g_slist_append (client->sending, buffer);
- }
- }
- }
-
- gst_caps_unref (caps);
- caps = NULL;
- /* now we can send the buffer, possibly sending a GDP header first */
- if (sink->protocol == GST_TCP_PROTOCOL_GDP) {
- guint8 *header;
- guint len;
-
- if (!gst_dp_header_from_buffer (buffer, sink->header_flags, &len, &header)) {
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] could not create header, removing client", client->fd.fd);
- return FALSE;
- }
- gst_multi_fd_sink_client_queue_data (sink, client, (gchar *) header, len);
- }
-
- GST_LOG_OBJECT (sink, "[fd %5d] queueing buffer of length %d",
- client->fd.fd, GST_BUFFER_SIZE (buffer));
-
- gst_buffer_ref (buffer);
- client->sending = g_slist_append (client->sending, buffer);
-
- return TRUE;
-}
-
-/* find the keyframe in the list of buffers starting the
- * search from @idx. @direction as -1 will search backwards,
- * 1 will search forwards.
- * Returns: the index or -1 if there is no keyframe after idx.
- */
-static gint
-find_syncframe (GstMultiFdSink * sink, gint idx, gint direction)
-{
- gint i, len, result;
-
- /* take length of queued buffers */
- len = sink->bufqueue->len;
-
- /* assume we don't find a keyframe */
- result = -1;
-
- /* then loop over all buffers to find the first keyframe */
- for (i = idx; i >= 0 && i < len; i += direction) {
- GstBuffer *buf;
-
- buf = g_array_index (sink->bufqueue, GstBuffer *, i);
- if (is_sync_frame (sink, buf)) {
- GST_LOG_OBJECT (sink, "found keyframe at %d from %d, direction %d",
- i, idx, direction);
- result = i;
- break;
- }
- }
- return result;
-}
-
-#define find_next_syncframe(s,i) find_syncframe(s,i,1)
-#define find_prev_syncframe(s,i) find_syncframe(s,i,-1)
-
-/* Get the number of buffers from the buffer queue needed to satisfy
- * the maximum max in the configured units.
- * If units are not BUFFERS, and there are insufficient buffers in the
- * queue to satify the limit, return len(queue) + 1 */
-static gint
-get_buffers_max (GstMultiFdSink * sink, gint64 max)
-{
- switch (sink->unit_type) {
- case GST_TCP_UNIT_TYPE_BUFFERS:
- return max;
- case GST_TCP_UNIT_TYPE_TIME:
- {
- GstBuffer *buf;
- int i;
- int len;
- gint64 diff;
- GstClockTime first = GST_CLOCK_TIME_NONE;
-
- len = sink->bufqueue->len;
-
- for (i = 0; i < len; i++) {
- buf = g_array_index (sink->bufqueue, GstBuffer *, i);
- if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
- if (first == -1)
- first = GST_BUFFER_TIMESTAMP (buf);
-
- diff = first - GST_BUFFER_TIMESTAMP (buf);
-
- if (diff > max)
- return i + 1;
- }
- }
- return len + 1;
- }
- case GST_TCP_UNIT_TYPE_BYTES:
- {
- GstBuffer *buf;
- int i;
- int len;
- gint acc = 0;
-
- len = sink->bufqueue->len;
-
- for (i = 0; i < len; i++) {
- buf = g_array_index (sink->bufqueue, GstBuffer *, i);
- acc += GST_BUFFER_SIZE (buf);
-
- if (acc > max)
- return i + 1;
- }
- return len + 1;
- }
- default:
- return max;
- }
-}
-
-/* find the positions in the buffer queue where *_min and *_max
- * is satisfied
- */
-/* count the amount of data in the buffers and return the index
- * that satifies the given limits.
- *
- * Returns: index @idx in the buffer queue so that the given limits are
- * satisfied. TRUE if all the limits could be satisfied, FALSE if not
- * enough data was in the queue.
- *
- * FIXME, this code might now work if any of the units is in buffers...
- */
-static gboolean
-find_limits (GstMultiFdSink * sink,
- gint * min_idx, gint bytes_min, gint buffers_min, gint64 time_min,
- gint * max_idx, gint bytes_max, gint buffers_max, gint64 time_max)
-{
- GstClockTime first, time;
- gint i, len, bytes;
- gboolean result, max_hit;
-
- /* take length of queue */
- len = sink->bufqueue->len;
-
- /* this must hold */
- g_assert (len > 0);
-
- GST_LOG_OBJECT (sink,
- "bytes_min %d, buffers_min %d, time_min %" GST_TIME_FORMAT
- ", bytes_max %d, buffers_max %d, time_max %" GST_TIME_FORMAT, bytes_min,
- buffers_min, GST_TIME_ARGS (time_min), bytes_max, buffers_max,
- GST_TIME_ARGS (time_max));
-
- /* do the trivial buffer limit test */
- if (buffers_min != -1 && len < buffers_min) {
- *min_idx = len - 1;
- *max_idx = len - 1;
- return FALSE;
- }
-
- result = FALSE;
- /* else count bytes and time */
- first = -1;
- bytes = 0;
- /* unset limits */
- *min_idx = -1;
- *max_idx = -1;
- max_hit = FALSE;
-
- i = 0;
- /* loop through the buffers, when a limit is ok, mark it
- * as -1, we have at least one buffer in the queue. */
- do {
- GstBuffer *buf;
-
- /* if we checked all min limits, update result */
- if (bytes_min == -1 && time_min == -1 && *min_idx == -1) {
- /* don't go below 0 */
- *min_idx = MAX (i - 1, 0);
- }
- /* if we reached one max limit break out */
- if (max_hit) {
- /* i > 0 when we get here, we subtract one to get the position
- * of the previous buffer. */
- *max_idx = i - 1;
- /* we have valid complete result if we found a min_idx too */
- result = *min_idx != -1;
- break;
- }
- buf = g_array_index (sink->bufqueue, GstBuffer *, i);
-
- bytes += GST_BUFFER_SIZE (buf);
-
- /* take timestamp and save for the base first timestamp */
- if ((time = GST_BUFFER_TIMESTAMP (buf)) != -1) {
- GST_LOG_OBJECT (sink, "Ts %" GST_TIME_FORMAT " on buffer",
- GST_TIME_ARGS (time));
- if (first == -1)
- first = time;
-
- /* increase max usage if we did not fill enough. Note that
- * buffers are sorted from new to old, so the first timestamp is
- * bigger than the next one. */
- if (time_min != -1 && first - time >= time_min)
- time_min = -1;
- if (time_max != -1 && first - time >= time_max)
- max_hit = TRUE;
- } else {
- GST_LOG_OBJECT (sink, "No timestamp on buffer");
- }
- /* time is OK or unknown, check and increase if not enough bytes */
- if (bytes_min != -1) {
- if (bytes >= bytes_min)
- bytes_min = -1;
- }
- if (bytes_max != -1) {
- if (bytes >= bytes_max) {
- max_hit = TRUE;
- }
- }
- i++;
- }
- while (i < len);
-
- /* if we did not hit the max or min limit, set to buffer size */
- if (*max_idx == -1)
- *max_idx = len - 1;
- /* make sure min does not exceed max */
- if (*min_idx == -1)
- *min_idx = *max_idx;
-
- return result;
-}
-
-/* parse the unit/value pair and assign it to the result value of the
- * right type, leave the other values untouched
- *
- * Returns: FALSE if the unit is unknown or undefined. TRUE otherwise.
- */
-static gboolean
-assign_value (GstTCPUnitType unit, guint64 value, gint * bytes, gint * buffers,
- GstClockTime * time)
-{
- gboolean res = TRUE;
-
- /* set only the limit of the given format to the given value */
- switch (unit) {
- case GST_TCP_UNIT_TYPE_BUFFERS:
- *buffers = (gint) value;
- break;
- case GST_TCP_UNIT_TYPE_TIME:
- *time = value;
- break;
- case GST_TCP_UNIT_TYPE_BYTES:
- *bytes = (gint) value;
- break;
- case GST_TCP_UNIT_TYPE_UNDEFINED:
- default:
- res = FALSE;
- break;
- }
- return res;
-}
-
-/* count the index in the buffer queue to satisfy the given unit
- * and value pair starting from buffer at index 0.
- *
- * Returns: TRUE if there was enough data in the queue to satisfy the
- * burst values. @idx contains the index in the buffer that contains enough
- * data to satisfy the limits or the last buffer in the queue when the
- * function returns FALSE.
- */
-static gboolean
-count_burst_unit (GstMultiFdSink * sink, gint * min_idx,
- GstTCPUnitType min_unit, guint64 min_value, gint * max_idx,
- GstTCPUnitType max_unit, guint64 max_value)
-{
- gint bytes_min = -1, buffers_min = -1;
- gint bytes_max = -1, buffers_max = -1;
- GstClockTime time_min = GST_CLOCK_TIME_NONE, time_max = GST_CLOCK_TIME_NONE;
-
- assign_value (min_unit, min_value, &bytes_min, &buffers_min, &time_min);
- assign_value (max_unit, max_value, &bytes_max, &buffers_max, &time_max);
-
- return find_limits (sink, min_idx, bytes_min, buffers_min, time_min,
- max_idx, bytes_max, buffers_max, time_max);
-}
-
-/* decide where in the current buffer queue this new client should start
- * receiving buffers from.
- * This function is called whenever a client is connected and has not yet
- * received a buffer.
- * If this returns -1, it means that we haven't found a good point to
- * start streaming from yet, and this function should be called again later
- * when more buffers have arrived.
- */
-static gint
-gst_multi_fd_sink_new_client (GstMultiFdSink * sink, GstTCPClient * client)
-{
- gint result;
-
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] new client, deciding where to start in queue", client->fd.fd);
- GST_DEBUG_OBJECT (sink, "queue is currently %d buffers long",
- sink->bufqueue->len);
- switch (client->sync_method) {
- case GST_SYNC_METHOD_LATEST:
- /* no syncing, we are happy with whatever the client is going to get */
- result = client->bufpos;
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] SYNC_METHOD_LATEST, position %d", client->fd.fd, result);
- break;
- case GST_SYNC_METHOD_NEXT_KEYFRAME:
- {
- /* if one of the new buffers (between client->bufpos and 0) in the queue
- * is a sync point, we can proceed, otherwise we need to keep waiting */
- GST_LOG_OBJECT (sink,
- "[fd %5d] new client, bufpos %d, waiting for keyframe", client->fd.fd,
- client->bufpos);
-
- result = find_prev_syncframe (sink, client->bufpos);
- if (result != -1) {
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] SYNC_METHOD_NEXT_KEYFRAME: result %d",
- client->fd.fd, result);
- break;
- }
-
- /* client is not on a syncbuffer, need to skip these buffers and
- * wait some more */
- GST_LOG_OBJECT (sink,
- "[fd %5d] new client, skipping buffer(s), no syncpoint found",
- client->fd.fd);
- client->bufpos = -1;
- break;
- }
- case GST_SYNC_METHOD_LATEST_KEYFRAME:
- {
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] SYNC_METHOD_LATEST_KEYFRAME", client->fd.fd);
-
- /* for new clients we initially scan the complete buffer queue for
- * a sync point when a buffer is added. If we don't find a keyframe,
- * we need to wait for the next keyframe and so we change the client's
- * sync method to GST_SYNC_METHOD_NEXT_KEYFRAME.
- */
- result = find_next_syncframe (sink, 0);
- if (result != -1) {
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] SYNC_METHOD_LATEST_KEYFRAME: result %d", client->fd.fd,
- result);
- break;
- }
-
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] SYNC_METHOD_LATEST_KEYFRAME: no keyframe found, "
- "switching to SYNC_METHOD_NEXT_KEYFRAME", client->fd.fd);
- /* throw client to the waiting state */
- client->bufpos = -1;
- /* and make client sync to next keyframe */
- client->sync_method = GST_SYNC_METHOD_NEXT_KEYFRAME;
- break;
- }
- case GST_SYNC_METHOD_BURST:
- {
- gboolean ok;
- gint max;
-
- /* move to the position where we satisfy the client's burst
- * parameters. If we could not satisfy the parameters because there
- * is not enough data, we just send what we have (which is in result).
- * We use the max value to limit the search
- */
- ok = count_burst_unit (sink, &result, client->burst_min_unit,
- client->burst_min_value, &max, client->burst_max_unit,
- client->burst_max_value);
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] SYNC_METHOD_BURST: burst_unit returned %d, result %d",
- client->fd.fd, ok, result);
-
- GST_LOG_OBJECT (sink, "min %d, max %d", result, max);
-
- /* we hit the max and it is below the min, use that then */
- if (max != -1 && max <= result) {
- result = MAX (max - 1, 0);
- GST_DEBUG_OBJECT (sink,
- "[fd %5d] SYNC_METHOD_BURST: result above max, taken down to %d",
- client->fd.fd, result);
- }
- break;
- }
- case GST_SYNC_METHOD_BURST_KEYFRAME:
- {
- gboolean ok;
- gint min_idx, max_idx;
- gint next_syncframe, prev_syncframe;
-
- /* BURST_KEYFRAME:
- *
- * _always_ start sending a keyframe to the client. We first search
- * a keyframe between min/max limits. If there is none, we send it the
- * last keyframe before min. If there is none, the behaviour is like
- * NEXT_KEYFRAME.
- */
- /* gather burst limits */
- ok = count_burst_unit (sink, &min_idx, client->burst_min_unit,
- client->burst_min_value, &max_idx, client->burst_max_unit,
- client->burst_max_value);
-
- GST_LOG_OBJECT (sink, "min %d, max %d", min_idx, max_idx);
-
- /* first find a keyframe after min_idx */
- next_syncframe = find_next_syncframe (sink, min_idx);
- if (next_syncframe != -1 && next_syncframe < max_idx) {
- /* we have a valid keyframe and it's below the max */
- GST_LOG_OBJECT (sink, "found keyframe in min/max limits");
- result = next_syncframe;
- break;
- }
-
- /* no valid keyframe, try to find one below min */
- prev_syncframe = find_prev_syncframe (sink, min_idx);
- if (prev_syncframe != -1) {
- GST_WARNING_OBJECT (sink,
- "using keyframe below min in BURST_KEYFRAME sync mode");
- result = prev_syncframe;
- break;
- }
-
- /* no prev keyframe or not enough data */
- GST_WARNING_OBJECT (sink,
- "no prev keyframe found in BURST_KEYFRAME sync mode, waiting for next");
-
- /* throw client to the waiting state */
- client->bufpos = -1;
- /* and make client sync to next keyframe */
- client->sync_method = GST_SYNC_METHOD_NEXT_KEYFRAME;
- result = -1;
- break;
- }
- case GST_SYNC_METHOD_BURST_WITH_KEYFRAME:
- {
- gboolean ok;
- gint min_idx, max_idx;
- gint next_syncframe;
-
- /* BURST_WITH_KEYFRAME:
- *
- * try to start sending a keyframe to the client. We first search
- * a keyframe between min/max limits. If there is none, we send it the
- * amount of data up 'till min.
- */
- /* gather enough data to burst */
- ok = count_burst_unit (sink, &min_idx, client->burst_min_unit,
- client->burst_min_value, &max_idx, client->burst_max_unit,
- client->burst_max_value);
-
- GST_LOG_OBJECT (sink, "min %d, max %d", min_idx, max_idx);
-
- /* first find a keyframe after min_idx */
- next_syncframe = find_next_syncframe (sink, min_idx);
- if (next_syncframe != -1 && next_syncframe < max_idx) {
- /* we have a valid keyframe and it's below the max */
- GST_LOG_OBJECT (sink, "found keyframe in min/max limits");
- result = next_syncframe;
- break;
- }
-
- /* no keyframe, send data from min_idx */
- GST_WARNING_OBJECT (sink, "using min in BURST_WITH_KEYFRAME sync mode");
-
- /* make sure we don't go over the max limit */
- if (max_idx != -1 && max_idx <= min_idx) {
- result = MAX (max_idx - 1, 0);
- } else {
- result = min_idx;
- }
-
- break;
- }
- default:
- g_warning ("unknown sync method %d", client->sync_method);
- result = client->bufpos;
- break;
- }
- return result;
-}
-
-/* Handle a write on a client,
- * which indicates a read request from a client.
- *
- * For each client we maintain a queue of GstBuffers that contain the raw bytes
- * we need to send to the client. In the case of the GDP protocol, we create
- * buffers out of the header bytes so that we can focus only on sending
- * buffers.
- *
- * We first check to see if we need to send caps (in GDP) and streamheaders.
- * If so, we queue them.
- *
- * Then we run into the main loop that tries to send as many buffers as
- * possible. It will first exhaust the client->sending queue and if the queue
- * is empty, it will pick a buffer from the global queue.
- *
- * Sending the buffers from the client->sending queue is basically writing
- * the bytes to the socket and maintaining a count of the bytes that were
- * sent. When the buffer is completely sent, it is removed from the
- * client->sending queue and we try to pick a new buffer for sending.
- *
- * When the sending returns a partial buffer we stop sending more data as
- * the next send operation could block.
- *
- * This functions returns FALSE if some error occured.
- */
-static gboolean
-gst_multi_fd_sink_handle_client_write (GstMultiFdSink * sink,
- GstTCPClient * client)
-{
- int fd = client->fd.fd;
- gboolean more;
- gboolean res;
- gboolean flushing;
- GstClockTime now;
- GTimeVal nowtv;
-
- g_get_current_time (&nowtv);
- now = GST_TIMEVAL_TO_TIME (nowtv);
-
- flushing = client->status == GST_CLIENT_STATUS_FLUSHING;
-
- /* when using GDP, first check if we have queued caps yet */
- if (sink->protocol == GST_TCP_PROTOCOL_GDP) {
- /* don't need to do anything when the client is flushing */
- if (!client->caps_sent && !flushing) {
- GstPad *peer;
- GstCaps *caps;
-
- peer = gst_pad_get_peer (GST_BASE_SINK_PAD (sink));
- if (!peer) {
- GST_WARNING_OBJECT (sink, "pad has no peer");
- return FALSE;
- }
- gst_object_unref (peer);
-
- caps = gst_pad_get_negotiated_caps (GST_BASE_SINK_PAD (sink));
- if (!caps) {
- GST_WARNING_OBJECT (sink, "pad caps not yet negotiated");
- return FALSE;
- }
-
- /* queue caps for sending */
- res = gst_multi_fd_sink_client_queue_caps (sink, client, caps);
-
- gst_caps_unref (caps);
-
- if (!res) {
- GST_DEBUG_OBJECT (sink, "Failed queueing caps, removing client");
- return FALSE;
- }
- client->caps_sent = TRUE;
- }
- }
-
- more = TRUE;
- do {
- gint maxsize;
-
- if (!client->sending) {
- /* client is not working on a buffer */
- if (client->bufpos == -1) {
- /* client is too fast, remove from write queue until new buffer is
- * available */
- gst_poll_fd_ctl_write (sink->fdset, &client->fd, FALSE);
- /* if we flushed out all of the client buffers, we can stop */
- if (client->flushcount == 0)
- goto flushed;
-
- return TRUE;
- } else {
- /* client can pick a buffer from the global queue */
- GstBuffer *buf;
-
- /* for new connections, we need to find a good spot in the
- * bufqueue to start streaming from */
- if (client->new_connection && !flushing) {
- gint position = gst_multi_fd_sink_new_client (sink, client);
-
- if (position >= 0) {
- /* we got a valid spot in the queue */
- client->new_connection = FALSE;
- client->bufpos = position;
- } else {
- /* cannot send data to this client yet */
- gst_poll_fd_ctl_write (sink->fdset, &client->fd, FALSE);
- return TRUE;
- }
- }
-
- /* we flushed all remaining buffers, no need to get a new one */
- if (client->flushcount == 0)
- goto flushed;
-
- /* grab buffer */
- buf = g_array_index (sink->bufqueue, GstBuffer *, client->bufpos);
- client->bufpos--;
-
- /* decrease flushcount */
- if (client->flushcount != -1)
- client->flushcount--;
-
- GST_LOG_OBJECT (sink, "[fd %5d] client %p at position %d",
- fd, client, client->bufpos);
-
- /* queueing a buffer will ref it */
- gst_multi_fd_sink_client_queue_buffer (sink, client, buf);
-
- /* need to start from the first byte for this new buffer */
- client->bufoffset = 0;
- }
- }
-
- /* see if we need to send something */
- if (client->sending) {
- ssize_t wrote;
- GstBuffer *head;
-
- /* pick first buffer from list */
- head = GST_BUFFER (client->sending->data);
- maxsize = GST_BUFFER_SIZE (head) - client->bufoffset;
-
- /* try to write the complete buffer */
-#ifdef MSG_NOSIGNAL
-#define FLAGS MSG_NOSIGNAL
-#else
-#define FLAGS 0
-#endif
- if (client->is_socket) {
- wrote =
- send (fd, GST_BUFFER_DATA (head) + client->bufoffset, maxsize,
- FLAGS);
- } else {
- wrote = write (fd, GST_BUFFER_DATA (head) + client->bufoffset, maxsize);
- }
-
- if (wrote < 0) {
- /* hmm error.. */
- if (errno == EAGAIN) {
- /* nothing serious, resource was unavailable, try again later */
- more = FALSE;
- } else if (errno == ECONNRESET) {
- goto connection_reset;
- } else {
- goto write_error;
- }
- } else {
- if (wrote < maxsize) {
- /* partial write means that the client cannot read more and we should
- * stop sending more */
- GST_LOG_OBJECT (sink,
- "partial write on %d of %" G_GSSIZE_FORMAT " bytes", fd, wrote);
- client->bufoffset += wrote;
- more = FALSE;
- } else {
- /* complete buffer was written, we can proceed to the next one */
- client->sending = g_slist_remove (client->sending, head);
- gst_buffer_unref (head);
- /* make sure we start from byte 0 for the next buffer */
- client->bufoffset = 0;
- }
- /* update stats */
- client->bytes_sent += wrote;
- client->last_activity_time = now;
- sink->bytes_served += wrote;
- }
- }
- } while (more);
-
- return TRUE;
-
- /* ERRORS */
-flushed:
- {
- GST_DEBUG_OBJECT (sink, "[fd %5d] flushed, removing", fd);
- client->status = GST_CLIENT_STATUS_REMOVED;
- return FALSE;
- }
-connection_reset:
- {
- GST_DEBUG_OBJECT (sink, "[fd %5d] connection reset by peer, removing", fd);
- client->status = GST_CLIENT_STATUS_CLOSED;
- return FALSE;
- }
-write_error:
- {
- GST_WARNING_OBJECT (sink,
- "[fd %5d] could not write, removing client: %s (%d)", fd,
- g_strerror (errno), errno);
- client->status = GST_CLIENT_STATUS_ERROR;
- return FALSE;
- }
-}
-
-/* calculate the new position for a client after recovery. This function
- * does not update the client position but merely returns the required
- * position.
- */
-static gint
-gst_multi_fd_sink_recover_client (GstMultiFdSink * sink, GstTCPClient * client)
-{
- gint newbufpos;
-
- GST_WARNING_OBJECT (sink,
- "[fd %5d] client %p is lagging at %d, recover using policy %d",
- client->fd.fd, client, client->bufpos, sink->recover_policy);
-
- switch (sink->recover_policy) {
- case GST_RECOVER_POLICY_NONE:
- /* do nothing, client will catch up or get kicked out when it reaches
- * the hard max */
- newbufpos = client->bufpos;
- break;
- case GST_RECOVER_POLICY_RESYNC_LATEST:
- /* move to beginning of queue */
- newbufpos = -1;
- break;
- case GST_RECOVER_POLICY_RESYNC_SOFT_LIMIT:
- /* move to beginning of soft max */
- newbufpos = get_buffers_max (sink, sink->units_soft_max);
- break;
- case GST_RECOVER_POLICY_RESYNC_KEYFRAME:
- /* find keyframe in buffers, we search backwards to find the
- * closest keyframe relative to what this client already received. */
- newbufpos = MIN (sink->bufqueue->len - 1,
- get_buffers_max (sink, sink->units_soft_max) - 1);
-
- while (newbufpos >= 0) {
- GstBuffer *buf;
-
- buf = g_array_index (sink->bufqueue, GstBuffer *, newbufpos);
- if (is_sync_frame (sink, buf)) {
- /* found a buffer that is not a delta unit */
- break;
- }
- newbufpos--;
- }
- break;
- default:
- /* unknown recovery procedure */
- newbufpos = get_buffers_max (sink, sink->units_soft_max);
- break;
- }
- return newbufpos;
-}
-
-/* Queue a buffer on the global queue.
- *
- * This function adds the buffer to the front of a GArray. It removes the
- * tail buffer if the max queue size is exceeded, unreffing the queued buffer.
- * Note that unreffing the buffer is not a problem as clients who
- * started writing out this buffer will still have a reference to it in the
- * client->sending queue.
- *
- * After adding the buffer, we update all client positions in the queue. If
- * a client moves over the soft max, we start the recovery procedure for this
- * slow client. If it goes over the hard max, it is put into the slow list
- * and removed.
- *
- * Special care is taken of clients that were waiting for a new buffer (they
- * had a position of -1) because they can proceed after adding this new buffer.
- * This is done by adding the client back into the write fd_set and signalling
- * the select thread that the fd_set changed.
- */
-static void
-gst_multi_fd_sink_queue_buffer (GstMultiFdSink * sink, GstBuffer * buf)
-{
- GList *clients, *next;
- gint queuelen;
- gboolean need_signal = FALSE;
- gint max_buffer_usage;
- gint i;
- GTimeVal nowtv;
- GstClockTime now;
- gint max_buffers, soft_max_buffers;
- guint cookie;
-
- g_get_current_time (&nowtv);
- now = GST_TIMEVAL_TO_TIME (nowtv);
-
- CLIENTS_LOCK (sink);
- /* add buffer to queue */
- g_array_prepend_val (sink->bufqueue, buf);
- queuelen = sink->bufqueue->len;
-
- if (sink->units_max > 0)
- max_buffers = get_buffers_max (sink, sink->units_max);
- else
- max_buffers = -1;
-
- if (sink->units_soft_max > 0)
- soft_max_buffers = get_buffers_max (sink, sink->units_soft_max);
- else
- soft_max_buffers = -1;
- GST_LOG_OBJECT (sink, "Using max %d, softmax %d", max_buffers,
- soft_max_buffers);
-
- /* then loop over the clients and update the positions */
- max_buffer_usage = 0;
-
-restart:
- cookie = sink->clients_cookie;
- for (clients = sink->clients; clients; clients = next) {
- GstTCPClient *client;
-
- if (cookie != sink->clients_cookie) {
- GST_DEBUG_OBJECT (sink, "Clients cookie outdated, restarting");
- goto restart;
- }
-
- client = (GstTCPClient *) clients->data;
- next = g_list_next (clients);
-
- client->bufpos++;
- GST_LOG_OBJECT (sink, "[fd %5d] client %p at position %d",
- client->fd.fd, client, client->bufpos);
- /* check soft max if needed, recover client */
- if (soft_max_buffers > 0 && client->bufpos >= soft_max_buffers) {
- gint newpos;
-
- newpos = gst_multi_fd_sink_recover_client (sink, client);
- if (newpos != client->bufpos) {
- client->dropped_buffers += client->bufpos - newpos;
- client->bufpos = newpos;
- client->discont = TRUE;
- GST_INFO_OBJECT (sink, "[fd %5d] client %p position reset to %d",
- client->fd.fd, client, client->bufpos);
- } else {
- GST_INFO_OBJECT (sink,
- "[fd %5d] client %p not recovering position",
- client->fd.fd, client);
- }
- }
- /* check hard max and timeout, remove client */
- if ((max_buffers > 0 && client->bufpos >= max_buffers) ||
- (sink->timeout > 0
- && now - client->last_activity_time > sink->timeout)) {
- /* remove client */
- GST_WARNING_OBJECT (sink, "[fd %5d] client %p is too slow, removing",
- client->fd.fd, client);
- /* remove the client, the fd set will be cleared and the select thread
- * will be signaled */
- client->status = GST_CLIENT_STATUS_SLOW;
- /* set client to invalid position while being removed */
- client->bufpos = -1;
- gst_multi_fd_sink_remove_client_link (sink, clients);
- need_signal = TRUE;
- continue;
- } else if (client->bufpos == 0 || client->new_connection) {
- /* can send data to this client now. need to signal the select thread that
- * the fd_set changed */
- gst_poll_fd_ctl_write (sink->fdset, &client->fd, TRUE);
- need_signal = TRUE;
- }
- /* keep track of maximum buffer usage */
- if (client->bufpos > max_buffer_usage) {
- max_buffer_usage = client->bufpos;
- }
- }
-
- /* make sure we respect bytes-min, buffers-min and time-min when they are set */
- {
- gint usage, max;
-
- GST_LOG_OBJECT (sink,
- "extending queue %d to respect time_min %" GST_TIME_FORMAT
- ", bytes_min %d, buffers_min %d", max_buffer_usage,
- GST_TIME_ARGS (sink->time_min), sink->bytes_min, sink->buffers_min);
-
- /* get index where the limits are ok, we don't really care if all limits
- * are ok, we just queue as much as we need. We also don't compare against
- * the max limits. */
- find_limits (sink, &usage, sink->bytes_min, sink->buffers_min,
- sink->time_min, &max, -1, -1, -1);
-
- max_buffer_usage = MAX (max_buffer_usage, usage + 1);
- GST_LOG_OBJECT (sink, "extended queue to %d", max_buffer_usage);
- }
-
- /* now look for sync points and make sure there is at least one
- * sync point in the queue. We only do this if the LATEST_KEYFRAME or
- * BURST_KEYFRAME mode is selected */
- if (sink->def_sync_method == GST_SYNC_METHOD_LATEST_KEYFRAME ||
- sink->def_sync_method == GST_SYNC_METHOD_BURST_KEYFRAME) {
- /* no point in searching beyond the queue length */
- gint limit = queuelen;
- GstBuffer *buf;
-
- /* no point in searching beyond the soft-max if any. */
- if (soft_max_buffers > 0) {
- limit = MIN (limit, soft_max_buffers);
- }
- GST_LOG_OBJECT (sink,
- "extending queue to include sync point, now at %d, limit is %d",
- max_buffer_usage, limit);
- for (i = 0; i < limit; i++) {
- buf = g_array_index (sink->bufqueue, GstBuffer *, i);
- if (is_sync_frame (sink, buf)) {
- /* found a sync frame, now extend the buffer usage to
- * include at least this frame. */
- max_buffer_usage = MAX (max_buffer_usage, i);
- break;
- }
- }
- GST_LOG_OBJECT (sink, "max buffer usage is now %d", max_buffer_usage);
- }
-
- GST_LOG_OBJECT (sink, "len %d, usage %d", queuelen, max_buffer_usage);
-
- /* nobody is referencing units after max_buffer_usage so we can
- * remove them from the queue. We remove them in reverse order as
- * this is the most optimal for GArray. */
- for (i = queuelen - 1; i > max_buffer_usage; i--) {
- GstBuffer *old;
-
- /* queue exceeded max size */
- queuelen--;
- old = g_array_index (sink->bufqueue, GstBuffer *, i);
- sink->bufqueue = g_array_remove_index (sink->bufqueue, i);
-
- /* unref tail buffer */
- gst_buffer_unref (old);
- }
- /* save for stats */
- sink->buffers_queued = max_buffer_usage;
- CLIENTS_UNLOCK (sink);
-
- /* and send a signal to thread if fd_set changed */
- if (need_signal) {
- gst_poll_restart (sink->fdset);
- }
-}
-
-/* Handle the clients. Basically does a blocking select for one
- * of the client fds to become read or writable. We also have a
- * filedescriptor to receive commands on that we need to check.
- *
- * After going out of the select call, we read and write to all
- * clients that can do so. Badly behaving clients are put on a
- * garbage list and removed.
- */
-static void
-gst_multi_fd_sink_handle_clients (GstMultiFdSink * sink)
-{
- int result;
- GList *clients, *next;
- gboolean try_again;
- GstMultiFdSinkClass *fclass;
- guint cookie;
-
- fclass = GST_MULTI_FD_SINK_GET_CLASS (sink);
-
- do {
- try_again = FALSE;
-
- /* check for:
- * - server socket input (ie, new client connections)
- * - client socket input (ie, clients saying goodbye)
- * - client socket output (ie, client reads) */
- GST_LOG_OBJECT (sink, "waiting on action on fdset");
- result = gst_poll_wait (sink->fdset, GST_CLOCK_TIME_NONE);
-
- /* < 0 is an error, 0 just means a timeout happened, which is impossible */
- if (result < 0) {
- GST_WARNING_OBJECT (sink, "wait failed: %s (%d)", g_strerror (errno),
- errno);
- if (errno == EBADF) {
- /* ok, so one or more of the fds is invalid. We loop over them to find
- * the ones that give an error to the F_GETFL fcntl. */
- CLIENTS_LOCK (sink);
- restart:
- cookie = sink->clients_cookie;
- for (clients = sink->clients; clients; clients = next) {
- GstTCPClient *client;
- int fd;
- long flags;
- int res;
-
- if (cookie != sink->clients_cookie) {
- GST_DEBUG_OBJECT (sink, "Cookie changed finding bad fd");
- goto restart;
- }
-
- client = (GstTCPClient *) clients->data;
- next = g_list_next (clients);
-
- fd = client->fd.fd;
-
- res = fcntl (fd, F_GETFL, &flags);
- if (res == -1) {
- GST_WARNING_OBJECT (sink, "fnctl failed for %d, removing: %s (%d)",
- fd, g_strerror (errno), errno);
- if (errno == EBADF) {
- client->status = GST_CLIENT_STATUS_ERROR;
- /* releases the CLIENTS lock */
- gst_multi_fd_sink_remove_client_link (sink, clients);
- }
- }
- }
- CLIENTS_UNLOCK (sink);
- /* after this, go back in the select loop as the read/writefds
- * are not valid */
- try_again = TRUE;
- } else if (errno == EINTR) {
- /* interrupted system call, just redo the wait */
- try_again = TRUE;
- } else if (errno == EBUSY) {
- /* the call to gst_poll_wait() was flushed */
- return;
- } else {
- /* this is quite bad... */
- GST_ELEMENT_ERROR (sink, RESOURCE, READ, (NULL),
- ("select failed: %s (%d)", g_strerror (errno), errno));
- return;
- }
- } else {
- GST_LOG_OBJECT (sink, "wait done: %d sockets with events", result);
- }
- } while (try_again);
-
- /* subclasses can check fdset with this virtual function */
- if (fclass->wait)
- fclass->wait (sink, sink->fdset);
-
- /* Check the clients */
- CLIENTS_LOCK (sink);
-
-restart2:
- cookie = sink->clients_cookie;
- for (clients = sink->clients; clients; clients = next) {
- GstTCPClient *client;
-
- if (sink->clients_cookie != cookie) {
- GST_DEBUG_OBJECT (sink, "Restarting loop, cookie out of date");
- goto restart2;
- }
-
- client = (GstTCPClient *) clients->data;
- next = g_list_next (clients);
-
- if (client->status != GST_CLIENT_STATUS_FLUSHING
- && client->status != GST_CLIENT_STATUS_OK) {
- gst_multi_fd_sink_remove_client_link (sink, clients);
- continue;
- }
-
- if (gst_poll_fd_has_closed (sink->fdset, &client->fd)) {
- client->status = GST_CLIENT_STATUS_CLOSED;
- gst_multi_fd_sink_remove_client_link (sink, clients);
- continue;
- }
- if (gst_poll_fd_has_error (sink->fdset, &client->fd)) {
- GST_WARNING_OBJECT (sink, "gst_poll_fd_has_error for %d", client->fd.fd);
- client->status = GST_CLIENT_STATUS_ERROR;
- gst_multi_fd_sink_remove_client_link (sink, clients);
- continue;
- }
- if (gst_poll_fd_can_read (sink->fdset, &client->fd)) {
- /* handle client read */
- if (!gst_multi_fd_sink_handle_client_read (sink, client)) {
- gst_multi_fd_sink_remove_client_link (sink, clients);
- continue;
- }
- }
- if (gst_poll_fd_can_write (sink->fdset, &client->fd)) {
- /* handle client write */
- if (!gst_multi_fd_sink_handle_client_write (sink, client)) {
- gst_multi_fd_sink_remove_client_link (sink, clients);
- continue;
- }
- }
- }
- CLIENTS_UNLOCK (sink);
-}
-
-/* we handle the client communication in another thread so that we do not block
- * the gstreamer thread while we select() on the client fds */
-static gpointer
-gst_multi_fd_sink_thread (GstMultiFdSink * sink)
-{
- while (sink->running) {
- gst_multi_fd_sink_handle_clients (sink);
- }
- return NULL;
-}
-
-static GstFlowReturn
-gst_multi_fd_sink_render (GstBaseSink * bsink, GstBuffer * buf)
-{
- GstMultiFdSink *sink;
- gboolean in_caps;
- GstCaps *bufcaps, *padcaps;
-
- sink = GST_MULTI_FD_SINK (bsink);
-
- g_return_val_if_fail (GST_OBJECT_FLAG_IS_SET (sink, GST_MULTI_FD_SINK_OPEN),
- GST_FLOW_WRONG_STATE);
-
- /* since we check every buffer for streamheader caps, we need to make
- * sure every buffer has caps set */
- bufcaps = gst_buffer_get_caps (buf);
- padcaps = GST_PAD_CAPS (GST_BASE_SINK_PAD (bsink));
-
- /* make sure we have caps on the pad */
- if (!padcaps && !bufcaps)
- goto no_caps;
-
- /* get IN_CAPS first, code below might mess with the flags */
- in_caps = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
-
- /* stamp the buffer with previous caps if no caps set */
- if (!bufcaps) {
- if (!gst_buffer_is_metadata_writable (buf)) {
- /* metadata is not writable, copy will be made and original buffer
- * will be unreffed so we need to ref so that we don't lose the
- * buffer in the render method. */
- gst_buffer_ref (buf);
- /* the new buffer is ours only, we keep it out of the scope of this
- * function */
- buf = gst_buffer_make_metadata_writable (buf);
- } else {
- /* else the metadata is writable, we ref because we keep the buffer
- * out of the scope of this method */
- gst_buffer_ref (buf);
- }
- /* buffer metadata is writable now, set the caps */
- gst_buffer_set_caps (buf, padcaps);
- } else {
- gst_caps_unref (bufcaps);
-
- /* since we keep this buffer out of the scope of this method */
- gst_buffer_ref (buf);
- }
-
- GST_LOG_OBJECT (sink, "received buffer %p, in_caps: %s, offset %"
- G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT
- ", timestamp %" GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT,
- buf, in_caps ? "yes" : "no", GST_BUFFER_OFFSET (buf),
- GST_BUFFER_OFFSET_END (buf),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
- GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
-
- /* if we get IN_CAPS buffers, but the previous buffer was not IN_CAPS,
- * it means we're getting new streamheader buffers, and we should clear
- * the old ones */
- if (in_caps && sink->previous_buffer_in_caps == FALSE) {
- GST_DEBUG_OBJECT (sink,
- "receiving new IN_CAPS buffers, clearing old streamheader");
- g_slist_foreach (sink->streamheader, (GFunc) gst_mini_object_unref, NULL);
- g_slist_free (sink->streamheader);
- sink->streamheader = NULL;
- }
-
- /* save the current in_caps */
- sink->previous_buffer_in_caps = in_caps;
-
- /* if the incoming buffer is marked as IN CAPS, then we assume for now
- * it's a streamheader that needs to be sent to each new client, so we
- * put it on our internal list of streamheader buffers.
- * FIXME: we could check if the buffer's contents are in fact part of the
- * current streamheader.
- *
- * We don't send the buffer to the client, since streamheaders are sent
- * separately when necessary. */
- if (in_caps) {
- GST_DEBUG_OBJECT (sink,
- "appending IN_CAPS buffer with length %d to streamheader",
- GST_BUFFER_SIZE (buf));
- sink->streamheader = g_slist_append (sink->streamheader, buf);
- } else {
- /* queue the buffer, this is a regular data buffer. */
- gst_multi_fd_sink_queue_buffer (sink, buf);
-
- sink->bytes_to_serve += GST_BUFFER_SIZE (buf);
- }
- return GST_FLOW_OK;
-
- /* ERRORS */
-no_caps:
- {
- GST_ELEMENT_ERROR (sink, CORE, NEGOTIATION, (NULL),
- ("Received first buffer without caps set"));
- return GST_FLOW_NOT_NEGOTIATED;
- }
-}
-
-static void
-gst_multi_fd_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstMultiFdSink *multifdsink;
-
- multifdsink = GST_MULTI_FD_SINK (object);
-
- switch (prop_id) {
- case PROP_PROTOCOL:
- multifdsink->protocol = g_value_get_enum (value);
- break;
- case PROP_MODE:
- multifdsink->mode = g_value_get_enum (value);
- break;
- case PROP_BUFFERS_MAX:
- multifdsink->units_max = g_value_get_int (value);
- break;
- case PROP_BUFFERS_SOFT_MAX:
- multifdsink->units_soft_max = g_value_get_int (value);
- break;
- case PROP_TIME_MIN:
- multifdsink->time_min = g_value_get_int64 (value);
- break;
- case PROP_BYTES_MIN:
- multifdsink->bytes_min = g_value_get_int (value);
- break;
- case PROP_BUFFERS_MIN:
- multifdsink->buffers_min = g_value_get_int (value);
- break;
- case PROP_UNIT_TYPE:
- multifdsink->unit_type = g_value_get_enum (value);
- break;
- case PROP_UNITS_MAX:
- multifdsink->units_max = g_value_get_int64 (value);
- break;
- case PROP_UNITS_SOFT_MAX:
- multifdsink->units_soft_max = g_value_get_int64 (value);
- break;
- case PROP_RECOVER_POLICY:
- multifdsink->recover_policy = g_value_get_enum (value);
- break;
- case PROP_TIMEOUT:
- multifdsink->timeout = g_value_get_uint64 (value);
- break;
- case PROP_SYNC_METHOD:
- multifdsink->def_sync_method = g_value_get_enum (value);
- break;
- case PROP_BURST_UNIT:
- multifdsink->def_burst_unit = g_value_get_enum (value);
- break;
- case PROP_BURST_VALUE:
- multifdsink->def_burst_value = g_value_get_uint64 (value);
- break;
- case PROP_QOS_DSCP:
- multifdsink->qos_dscp = g_value_get_int (value);
- setup_dscp (multifdsink);
- break;
- case PROP_HANDLE_READ:
- multifdsink->handle_read = g_value_get_boolean (value);
- break;
- case PROP_RESEND_STREAMHEADER:
- multifdsink->resend_streamheader = g_value_get_boolean (value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_multi_fd_sink_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstMultiFdSink *multifdsink;
-
- multifdsink = GST_MULTI_FD_SINK (object);
-
- switch (prop_id) {
- case PROP_PROTOCOL:
- g_value_set_enum (value, multifdsink->protocol);
- break;
- case PROP_MODE:
- g_value_set_enum (value, multifdsink->mode);
- break;
- case PROP_BUFFERS_MAX:
- g_value_set_int (value, multifdsink->units_max);
- break;
- case PROP_BUFFERS_SOFT_MAX:
- g_value_set_int (value, multifdsink->units_soft_max);
- break;
- case PROP_TIME_MIN:
- g_value_set_int64 (value, multifdsink->time_min);
- break;
- case PROP_BYTES_MIN:
- g_value_set_int (value, multifdsink->bytes_min);
- break;
- case PROP_BUFFERS_MIN:
- g_value_set_int (value, multifdsink->buffers_min);
- break;
- case PROP_BUFFERS_QUEUED:
- g_value_set_uint (value, multifdsink->buffers_queued);
- break;
- case PROP_BYTES_QUEUED:
- g_value_set_uint (value, multifdsink->bytes_queued);
- break;
- case PROP_TIME_QUEUED:
- g_value_set_uint64 (value, multifdsink->time_queued);
- break;
- case PROP_UNIT_TYPE:
- g_value_set_enum (value, multifdsink->unit_type);
- break;
- case PROP_UNITS_MAX:
- g_value_set_int64 (value, multifdsink->units_max);
- break;
- case PROP_UNITS_SOFT_MAX:
- g_value_set_int64 (value, multifdsink->units_soft_max);
- break;
- case PROP_RECOVER_POLICY:
- g_value_set_enum (value, multifdsink->recover_policy);
- break;
- case PROP_TIMEOUT:
- g_value_set_uint64 (value, multifdsink->timeout);
- break;
- case PROP_SYNC_METHOD:
- g_value_set_enum (value, multifdsink->def_sync_method);
- break;
- case PROP_BYTES_TO_SERVE:
- g_value_set_uint64 (value, multifdsink->bytes_to_serve);
- break;
- case PROP_BYTES_SERVED:
- g_value_set_uint64 (value, multifdsink->bytes_served);
- break;
- case PROP_BURST_UNIT:
- g_value_set_enum (value, multifdsink->def_burst_unit);
- break;
- case PROP_BURST_VALUE:
- g_value_set_uint64 (value, multifdsink->def_burst_value);
- break;
- case PROP_QOS_DSCP:
- g_value_set_int (value, multifdsink->qos_dscp);
- break;
- case PROP_HANDLE_READ:
- g_value_set_boolean (value, multifdsink->handle_read);
- break;
- case PROP_RESEND_STREAMHEADER:
- g_value_set_boolean (value, multifdsink->resend_streamheader);
- break;
- case PROP_NUM_FDS:
- g_value_set_uint (value, g_hash_table_size (multifdsink->fd_hash));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-/* create a socket for sending to remote machine */
-static gboolean
-gst_multi_fd_sink_start (GstBaseSink * bsink)
-{
- GstMultiFdSinkClass *fclass;
- GstMultiFdSink *this;
-
- if (GST_OBJECT_FLAG_IS_SET (bsink, GST_MULTI_FD_SINK_OPEN))
- return TRUE;
-
- this = GST_MULTI_FD_SINK (bsink);
- fclass = GST_MULTI_FD_SINK_GET_CLASS (this);
-
- GST_INFO_OBJECT (this, "starting in mode %d", this->mode);
- if ((this->fdset = gst_poll_new (TRUE)) == NULL)
- goto socket_pair;
-
- this->streamheader = NULL;
- this->bytes_to_serve = 0;
- this->bytes_served = 0;
-
- if (fclass->init) {
- fclass->init (this);
- }
-
- this->running = TRUE;
- this->thread = g_thread_create ((GThreadFunc) gst_multi_fd_sink_thread,
- this, TRUE, NULL);
-
- GST_OBJECT_FLAG_SET (this, GST_MULTI_FD_SINK_OPEN);
-
- return TRUE;
-
- /* ERRORS */
-socket_pair:
- {
- GST_ELEMENT_ERROR (this, RESOURCE, OPEN_READ_WRITE, (NULL),
- GST_ERROR_SYSTEM);
- return FALSE;
- }
-}
-
-static gboolean
-multifdsink_hash_remove (gpointer key, gpointer value, gpointer data)
-{
- return TRUE;
-}
-
-static gboolean
-gst_multi_fd_sink_stop (GstBaseSink * bsink)
-{
- GstMultiFdSinkClass *fclass;
- GstMultiFdSink *this;
- GstBuffer *buf;
- int i;
-
- this = GST_MULTI_FD_SINK (bsink);
- fclass = GST_MULTI_FD_SINK_GET_CLASS (this);
-
- if (!GST_OBJECT_FLAG_IS_SET (bsink, GST_MULTI_FD_SINK_OPEN))
- return TRUE;
-
- this->running = FALSE;
-
- gst_poll_set_flushing (this->fdset, TRUE);
- if (this->thread) {
- GST_DEBUG_OBJECT (this, "joining thread");
- g_thread_join (this->thread);
- GST_DEBUG_OBJECT (this, "joined thread");
- this->thread = NULL;
- }
-
- /* free the clients */
- gst_multi_fd_sink_clear (this);
-
- if (this->streamheader) {
- g_slist_foreach (this->streamheader, (GFunc) gst_mini_object_unref, NULL);
- g_slist_free (this->streamheader);
- this->streamheader = NULL;
- }
-
- if (fclass->close)
- fclass->close (this);
-
- if (this->fdset) {
- gst_poll_free (this->fdset);
- this->fdset = NULL;
- }
- g_hash_table_foreach_remove (this->fd_hash, multifdsink_hash_remove, this);
-
- /* remove all queued buffers */
- if (this->bufqueue) {
- GST_DEBUG_OBJECT (this, "Emptying bufqueue with %d buffers",
- this->bufqueue->len);
- for (i = this->bufqueue->len - 1; i >= 0; --i) {
- buf = g_array_index (this->bufqueue, GstBuffer *, i);
- GST_LOG_OBJECT (this, "Removing buffer %p (%d) with refcount %d", buf, i,
- GST_MINI_OBJECT_REFCOUNT (buf));
- gst_buffer_unref (buf);
- this->bufqueue = g_array_remove_index (this->bufqueue, i);
- }
- /* freeing the array is done in _finalize */
- }
- GST_OBJECT_FLAG_UNSET (this, GST_MULTI_FD_SINK_OPEN);
-
- return TRUE;
-}
-
-static GstStateChangeReturn
-gst_multi_fd_sink_change_state (GstElement * element, GstStateChange transition)
-{
- GstMultiFdSink *sink;
- GstStateChangeReturn ret;
-
- sink = GST_MULTI_FD_SINK (element);
-
- /* we disallow changing the state from the streaming thread */
- if (g_thread_self () == sink->thread)
- return GST_STATE_CHANGE_FAILURE;
-
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- if (!gst_multi_fd_sink_start (GST_BASE_SINK (sink)))
- goto start_failed;
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- gst_multi_fd_sink_stop (GST_BASE_SINK (sink));
- break;
- default:
- break;
- }
- return ret;
-
- /* ERRORS */
-start_failed:
- {
- /* error message was posted */
- return GST_STATE_CHANGE_FAILURE;
- }
-}
diff --git a/gst/tcp/gstmultifdsink.h b/gst/tcp/gstmultifdsink.h
deleted file mode 100644
index d2d9ce4e..00000000
--- a/gst/tcp/gstmultifdsink.h
+++ /dev/null
@@ -1,286 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_MULTI_FD_SINK_H__
-#define __GST_MULTI_FD_SINK_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstbasesink.h>
-
-G_BEGIN_DECLS
-
-#include "gsttcp.h"
-
-#define GST_TYPE_MULTI_FD_SINK \
- (gst_multi_fd_sink_get_type())
-#define GST_MULTI_FD_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MULTI_FD_SINK,GstMultiFdSink))
-#define GST_MULTI_FD_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MULTI_FD_SINK,GstMultiFdSinkClass))
-#define GST_IS_MULTI_FD_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MULTI_FD_SINK))
-#define GST_IS_MULTI_FD_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MULTI_FD_SINK))
-#define GST_MULTI_FD_SINK_GET_CLASS(klass) \
- (G_TYPE_INSTANCE_GET_CLASS ((klass), GST_TYPE_MULTI_FD_SINK, GstMultiFdSinkClass))
-
-
-typedef struct _GstMultiFdSink GstMultiFdSink;
-typedef struct _GstMultiFdSinkClass GstMultiFdSinkClass;
-
-typedef enum {
- GST_MULTI_FD_SINK_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
-
- GST_MULTI_FD_SINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2)
-} GstMultiFdSinkFlags;
-
-/**
- * GstRecoverPolicy:
- * @GST_RECOVER_POLICY_NONE : no recovering is done
- * @GST_RECOVER_POLICY_RESYNC_LATEST : client is moved to last buffer
- * @GST_RECOVER_POLICY_RESYNC_SOFT_LIMIT: client is moved to the soft limit
- * @GST_RECOVER_POLICY_RESYNC_KEYFRAME : client is moved to latest keyframe
- *
- * Possible values for the recovery procedure to use when a client consumes
- * data too slow and has a backlag of more that soft-limit buffers.
- */
-typedef enum
-{
- GST_RECOVER_POLICY_NONE,
- GST_RECOVER_POLICY_RESYNC_LATEST,
- GST_RECOVER_POLICY_RESYNC_SOFT_LIMIT,
- GST_RECOVER_POLICY_RESYNC_KEYFRAME
-} GstRecoverPolicy;
-
-/**
- * GstSyncMethod:
- * @GST_SYNC_METHOD_LATEST : client receives most recent buffer
- * @GST_SYNC_METHOD_NEXT_KEYFRAME : client receives next keyframe
- * @GST_SYNC_METHOD_LATEST_KEYFRAME : client receives latest keyframe (burst)
- * @GST_SYNC_METHOD_BURST : client receives specific amount of data
- * @GST_SYNC_METHOD_BURST_KEYFRAME : client receives specific amount of data
- * starting from latest keyframe
- * @GST_SYNC_METHOD_BURST_WITH_KEYFRAME : client receives specific amount of data from
- * a keyframe, or if there is not enough data after
- * the keyframe, starting before the keyframe
- *
- * This enum defines the selection of the first buffer that is sent
- * to a new client.
- */
-typedef enum
-{
- GST_SYNC_METHOD_LATEST,
- GST_SYNC_METHOD_NEXT_KEYFRAME,
- GST_SYNC_METHOD_LATEST_KEYFRAME,
- GST_SYNC_METHOD_BURST,
- GST_SYNC_METHOD_BURST_KEYFRAME,
- GST_SYNC_METHOD_BURST_WITH_KEYFRAME
-} GstSyncMethod;
-
-/**
- * GstTCPUnitType:
- * @GST_TCP_UNIT_TYPE_UNDEFINED: undefined
- * @GST_TCP_UNIT_TYPE_BUFFERS : buffers
- * @GST_TCP_UNIT_TYPE_TIME : timeunits (in nanoseconds)
- * @GST_TCP_UNIT_TYPE_BYTES : bytes
- *
- * The units used to specify limits.
- */
-typedef enum
-{
- GST_TCP_UNIT_TYPE_UNDEFINED,
- GST_TCP_UNIT_TYPE_BUFFERS,
- GST_TCP_UNIT_TYPE_TIME,
- GST_TCP_UNIT_TYPE_BYTES
-} GstTCPUnitType;
-
-/**
- * GstClientStatus:
- * @GST_CLIENT_STATUS_OK : client is ok
- * @GST_CLIENT_STATUS_CLOSED : client closed the socket
- * @GST_CLIENT_STATUS_REMOVED : client is removed
- * @GST_CLIENT_STATUS_SLOW : client is too slow
- * @GST_CLIENT_STATUS_ERROR : client is in error
- * @GST_CLIENT_STATUS_DUPLICATE: same client added twice
- * @GST_CLIENT_STATUS_FLUSHING : client is flushing out the remaining buffers.
- *
- * This specifies the reason why a client was removed from
- * multifdsink and is received in the "client-removed" signal.
- */
-typedef enum
-{
- GST_CLIENT_STATUS_OK = 0,
- GST_CLIENT_STATUS_CLOSED = 1,
- GST_CLIENT_STATUS_REMOVED = 2,
- GST_CLIENT_STATUS_SLOW = 3,
- GST_CLIENT_STATUS_ERROR = 4,
- GST_CLIENT_STATUS_DUPLICATE = 5,
- GST_CLIENT_STATUS_FLUSHING = 6
-} GstClientStatus;
-
-/* structure for a client
- */
-typedef struct {
- GstPollFD fd;
-
- gint bufpos; /* position of this client in the global queue */
- gint flushcount; /* the remaining number of buffers to flush out or -1 if the
- client is not flushing. */
-
- GstClientStatus status;
- gboolean is_socket;
-
- GSList *sending; /* the buffers we need to send */
- gint bufoffset; /* offset in the first buffer */
-
- gboolean discont;
-
- GstTCPProtocol protocol;
-
- gboolean caps_sent;
- gboolean new_connection;
-
- gboolean currently_removing;
-
- /* method to sync client when connecting */
- GstSyncMethod sync_method;
- GstTCPUnitType burst_min_unit;
- guint64 burst_min_value;
- GstTCPUnitType burst_max_unit;
- guint64 burst_max_value;
-
- GstCaps *caps; /* caps of last queued buffer */
-
- /* stats */
- guint64 bytes_sent;
- guint64 connect_time;
- guint64 disconnect_time;
- guint64 last_activity_time;
- guint64 dropped_buffers;
- guint64 avg_queue_size;
-} GstTCPClient;
-
-#define CLIENTS_LOCK_INIT(fdsink) (g_static_rec_mutex_init(&fdsink->clientslock))
-#define CLIENTS_LOCK_FREE(fdsink) (g_static_rec_mutex_free(&fdsink->clientslock))
-#define CLIENTS_LOCK(fdsink) (g_static_rec_mutex_lock(&fdsink->clientslock))
-#define CLIENTS_UNLOCK(fdsink) (g_static_rec_mutex_unlock(&fdsink->clientslock))
-
-/**
- * GstMultiFdSink:
- *
- * The multifdsink object structure.
- */
-struct _GstMultiFdSink {
- GstBaseSink element;
-
- /*< private >*/
- guint64 bytes_to_serve; /* how much bytes we must serve */
- guint64 bytes_served; /* how much bytes have we served */
-
- GStaticRecMutex clientslock; /* lock to protect the clients list */
- GList *clients; /* list of clients we are serving */
- GHashTable *fd_hash; /* index on fd to client */
- guint clients_cookie; /* Cookie to detect changes to the clients list */
-
- gint mode;
- GstPoll *fdset;
-
- GSList *streamheader; /* GSList of GstBuffers to use as streamheader */
- gboolean previous_buffer_in_caps;
-
- GstTCPProtocol protocol;
- guint mtu;
- gint qos_dscp;
- gboolean handle_read;
-
- GArray *bufqueue; /* global queue of buffers */
-
- gboolean running; /* the thread state */
- GThread *thread; /* the sender thread */
-
- /* these values are used to check if a client is reading fast
- * enough and to control receovery */
- GstTCPUnitType unit_type;/* the type of the units */
- gint64 units_max; /* max units to queue for a client */
- gint64 units_soft_max; /* max units a client can lag before recovery starts */
- GstRecoverPolicy recover_policy;
- GstClockTime timeout; /* max amount of nanoseconds to remain idle */
-
- GstSyncMethod def_sync_method; /* what method to use for connecting clients */
- GstTCPUnitType def_burst_unit;
- guint64 def_burst_value;
-
- /* these values are used to control the amount of data
- * kept in the queues. It allows clients to perform a burst
- * on connect. */
- gint bytes_min; /* min number of bytes to queue */
- gint64 time_min; /* min time to queue */
- gint buffers_min; /* min number of buffers to queue */
-
- gboolean resend_streamheader; /* resend streamheader if it changes */
-
- /* stats */
- gint buffers_queued; /* number of queued buffers */
- gint bytes_queued; /* number of queued bytes */
- gint time_queued; /* number of queued time */
-
- guint8 header_flags;
-};
-
-struct _GstMultiFdSinkClass {
- GstBaseSinkClass parent_class;
-
- /* element methods */
- void (*add) (GstMultiFdSink *sink, int fd);
- void (*add_full) (GstMultiFdSink *sink, int fd, GstSyncMethod sync,
- GstTCPUnitType format, guint64 value,
- GstTCPUnitType max_unit, guint64 max_value);
- void (*remove) (GstMultiFdSink *sink, int fd);
- void (*remove_flush) (GstMultiFdSink *sink, int fd);
- void (*clear) (GstMultiFdSink *sink);
- GValueArray* (*get_stats) (GstMultiFdSink *sink, int fd);
-
- /* vtable */
- gboolean (*init) (GstMultiFdSink *sink);
- gboolean (*wait) (GstMultiFdSink *sink, GstPoll *set);
- gboolean (*close) (GstMultiFdSink *sink);
- void (*removed) (GstMultiFdSink *sink, int fd);
-
- /* signals */
- void (*client_added) (GstElement *element, gint fd);
- void (*client_removed) (GstElement *element, gint fd, GstClientStatus status);
- void (*client_fd_removed) (GstElement *element, gint fd);
-};
-
-GType gst_multi_fd_sink_get_type (void);
-
-void gst_multi_fd_sink_add (GstMultiFdSink *sink, int fd);
-void gst_multi_fd_sink_add_full (GstMultiFdSink *sink, int fd, GstSyncMethod sync,
- GstTCPUnitType min_unit, guint64 min_value,
- GstTCPUnitType max_unit, guint64 max_value);
-void gst_multi_fd_sink_remove (GstMultiFdSink *sink, int fd);
-void gst_multi_fd_sink_remove_flush (GstMultiFdSink *sink, int fd);
-void gst_multi_fd_sink_clear (GstMultiFdSink *sink);
-GValueArray* gst_multi_fd_sink_get_stats (GstMultiFdSink *sink, int fd);
-
-G_END_DECLS
-
-#endif /* __GST_MULTI_FD_SINK_H__ */
diff --git a/gst/tcp/gsttcp-marshal.list b/gst/tcp/gsttcp-marshal.list
deleted file mode 100644
index 0d7208e1..00000000
--- a/gst/tcp/gsttcp-marshal.list
+++ /dev/null
@@ -1,5 +0,0 @@
-VOID:STRING,UINT
-VOID:INT
-VOID:INT,BOXED
-VOID:INT,ENUM,INT,UINT64,INT,UINT64
-BOXED:INT
diff --git a/gst/tcp/gsttcp.c b/gst/tcp/gsttcp.c
deleted file mode 100644
index 5e8aae7c..00000000
--- a/gst/tcp/gsttcp.c
+++ /dev/null
@@ -1,569 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
- *
- * gsttcp.c: TCP 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-
-#ifdef HAVE_FIONREAD_IN_SYS_FILIO
-#include <sys/filio.h>
-#endif
-
-#include "gsttcp.h"
-#include <gst/gst-i18n-plugin.h>
-
-GST_DEBUG_CATEGORY_EXTERN (tcp_debug);
-#define GST_CAT_DEFAULT tcp_debug
-
-#ifndef MSG_NOSIGNAL
-#define MSG_NOSIGNAL 0
-#endif
-
-/* resolve host to IP address, throwing errors if it fails */
-/* host can already be an IP address */
-/* returns a newly allocated gchar * with the dotted ip address,
- or NULL, in which case it already fired an error. */
-gchar *
-gst_tcp_host_to_ip (GstElement * element, const gchar * host)
-{
- struct hostent *hostinfo;
- char **addrs;
- gchar *ip;
- struct in_addr addr;
-
- GST_DEBUG_OBJECT (element, "resolving host %s", host);
-
- /* first check if it already is an IP address */
- if (inet_aton (host, &addr)) {
- ip = g_strdup (host);
- goto beach;
- }
- /* FIXME: could do a localhost check here */
-
- /* perform a name lookup */
- if (!(hostinfo = gethostbyname (host)))
- goto resolve_error;
-
- if (hostinfo->h_addrtype != AF_INET)
- goto not_ip;
-
- addrs = hostinfo->h_addr_list;
-
- /* There could be more than one IP address, but we just return the first */
- ip = g_strdup (inet_ntoa (*(struct in_addr *) *addrs));
-
-beach:
- GST_DEBUG_OBJECT (element, "resolved to IP %s", ip);
- return ip;
-
-resolve_error:
- {
- GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND, (NULL),
- ("Could not find IP address for host \"%s\".", host));
- return NULL;
- }
-not_ip:
- {
- GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND, (NULL),
- ("host \"%s\" is not an IP host", host));
- return NULL;
- }
-}
-
-/* write buffer to given socket incrementally.
- * Returns number of bytes written.
- */
-gint
-gst_tcp_socket_write (int socket, const void *buf, size_t count)
-{
- size_t bytes_written = 0;
-
- while (bytes_written < count) {
- ssize_t wrote = send (socket, (const char *) buf + bytes_written,
- count - bytes_written, MSG_NOSIGNAL);
-
- if (wrote <= 0) {
- GST_WARNING ("error while writing");
- return bytes_written;
- }
- bytes_written += wrote;
- }
-
- GST_LOG ("wrote %" G_GSIZE_FORMAT " bytes succesfully", bytes_written);
- return bytes_written;
-}
-
-/* atomically read count bytes into buf, cancellable. return val of GST_FLOW_OK
- * indicates success, anything else is failure.
- */
-static GstFlowReturn
-gst_tcp_socket_read (GstElement * this, int socket, void *buf, size_t count,
- GstPoll * fdset)
-{
- ssize_t n;
- size_t bytes_read;
- int num_to_read;
- int ret;
-
- bytes_read = 0;
-
- while (bytes_read < count) {
- /* do a blocking select on the socket */
- /* no action (0) is an error too in our case */
- if ((ret = gst_poll_wait (fdset, GST_CLOCK_TIME_NONE)) <= 0) {
- if (ret == -1 && errno == EBUSY)
- goto cancelled;
- else
- goto select_error;
- }
-
- /* ask how much is available for reading on the socket */
- if (ioctl (socket, FIONREAD, &num_to_read) < 0)
- goto ioctl_error;
-
- if (num_to_read == 0)
- goto got_eos;
-
- /* sizeof(ssize_t) >= sizeof(int), so I know num_to_read <= SSIZE_MAX */
-
- num_to_read = MIN (num_to_read, count - bytes_read);
-
- n = read (socket, ((guint8 *) buf) + bytes_read, num_to_read);
-
- if (n < 0)
- goto read_error;
-
- if (n < num_to_read)
- goto short_read;
-
- bytes_read += num_to_read;
- }
-
- return GST_FLOW_OK;
-
- /* ERRORS */
-select_error:
- {
- GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
- ("select failed: %s", g_strerror (errno)));
- return GST_FLOW_ERROR;
- }
-cancelled:
- {
- GST_DEBUG_OBJECT (this, "Select was cancelled");
- return GST_FLOW_WRONG_STATE;
- }
-ioctl_error:
- {
- GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
- ("ioctl failed: %s", g_strerror (errno)));
- return GST_FLOW_ERROR;
- }
-got_eos:
- {
- GST_DEBUG_OBJECT (this, "Got EOS on socket stream");
- return GST_FLOW_UNEXPECTED;
- }
-read_error:
- {
- GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
- ("read failed: %s", g_strerror (errno)));
- return GST_FLOW_ERROR;
- }
-short_read:
- {
- GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
- ("short read: wanted %d bytes, got %" G_GSSIZE_FORMAT, num_to_read, n));
- return GST_FLOW_ERROR;
- }
-}
-
-/* close the socket and reset the fd. Used to clean up after errors. */
-void
-gst_tcp_socket_close (GstPollFD * socket)
-{
- if (socket->fd >= 0) {
- close (socket->fd);
- socket->fd = -1;
- }
-}
-
-/* read a buffer from the given socket
- * returns:
- * - a GstBuffer in which data should be read
- * - NULL, indicating a connection close or an error, to be handled with
- * EOS
- */
-GstFlowReturn
-gst_tcp_read_buffer (GstElement * this, int socket, GstPoll * fdset,
- GstBuffer ** buf)
-{
- int ret;
- ssize_t bytes_read;
- int readsize;
-
- *buf = NULL;
-
- /* do a blocking select on the socket */
- /* no action (0) is an error too in our case */
- if ((ret = gst_poll_wait (fdset, GST_CLOCK_TIME_NONE)) <= 0) {
- if (ret == -1 && errno == EBUSY)
- goto cancelled;
- else
- goto select_error;
- }
-
- /* ask how much is available for reading on the socket */
- if ((ret = ioctl (socket, FIONREAD, &readsize)) < 0)
- goto ioctl_error;
-
- if (readsize == 0)
- goto got_eos;
-
- /* sizeof(ssize_t) >= sizeof(int), so I know readsize <= SSIZE_MAX */
-
- *buf = gst_buffer_new_and_alloc (readsize);
-
- bytes_read = read (socket, GST_BUFFER_DATA (*buf), readsize);
-
- if (bytes_read < 0)
- goto read_error;
-
- if (bytes_read < readsize)
- /* but mom, you promised to give me readsize bytes! */
- goto short_read;
-
- GST_LOG_OBJECT (this, "returning buffer of size %d", GST_BUFFER_SIZE (*buf));
- return GST_FLOW_OK;
-
- /* ERRORS */
-select_error:
- {
- GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
- ("select failed: %s", g_strerror (errno)));
- return GST_FLOW_ERROR;
- }
-cancelled:
- {
- GST_DEBUG_OBJECT (this, "Select was cancelled");
- return GST_FLOW_WRONG_STATE;
- }
-ioctl_error:
- {
- GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
- ("ioctl failed: %s", g_strerror (errno)));
- return GST_FLOW_ERROR;
- }
-got_eos:
- {
- GST_DEBUG_OBJECT (this, "Got EOS on socket stream");
- return GST_FLOW_UNEXPECTED;
- }
-read_error:
- {
- GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
- ("read failed: %s", g_strerror (errno)));
- gst_buffer_unref (*buf);
- *buf = NULL;
- return GST_FLOW_ERROR;
- }
-short_read:
- {
- GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
- ("short read: wanted %d bytes, got %" G_GSSIZE_FORMAT, readsize,
- bytes_read));
- gst_buffer_unref (*buf);
- *buf = NULL;
- return GST_FLOW_ERROR;
- }
-}
-
-/* read a buffer from the given socket
- * returns:
- * - a GstBuffer in which data should be read
- * - NULL, indicating a connection close or an error, to be handled with
- * EOS
- */
-GstFlowReturn
-gst_tcp_gdp_read_buffer (GstElement * this, int socket, GstPoll * fdset,
- GstBuffer ** buf)
-{
- GstFlowReturn ret;
- guint8 *header = NULL;
-
- GST_LOG_OBJECT (this, "Reading %d bytes for buffer packet header",
- GST_DP_HEADER_LENGTH);
-
- *buf = NULL;
- header = g_malloc (GST_DP_HEADER_LENGTH);
-
- ret = gst_tcp_socket_read (this, socket, header, GST_DP_HEADER_LENGTH, fdset);
-
- if (ret != GST_FLOW_OK)
- goto header_read_error;
-
- if (!gst_dp_validate_header (GST_DP_HEADER_LENGTH, header))
- goto validate_error;
-
- if (gst_dp_header_payload_type (header) != GST_DP_PAYLOAD_BUFFER)
- goto is_not_buffer;
-
- GST_LOG_OBJECT (this, "validated buffer packet header");
-
- *buf = gst_dp_buffer_from_header (GST_DP_HEADER_LENGTH, header);
-
- g_free (header);
-
- ret = gst_tcp_socket_read (this, socket, GST_BUFFER_DATA (*buf),
- GST_BUFFER_SIZE (*buf), fdset);
-
- if (ret != GST_FLOW_OK)
- goto data_read_error;
-
- return GST_FLOW_OK;
-
- /* ERRORS */
-header_read_error:
- {
- g_free (header);
- return ret;
- }
-validate_error:
- {
- GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
- ("GDP buffer packet header does not validate"));
- g_free (header);
- return GST_FLOW_ERROR;
- }
-is_not_buffer:
- {
- GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
- ("GDP packet contains something that is not a buffer (type %d)",
- gst_dp_header_payload_type (header)));
- g_free (header);
- return GST_FLOW_ERROR;
- }
-data_read_error:
- {
- gst_buffer_unref (*buf);
- *buf = NULL;
- return ret;
- }
-}
-
-GstFlowReturn
-gst_tcp_gdp_read_caps (GstElement * this, int socket, GstPoll * fdset,
- GstCaps ** caps)
-{
- GstFlowReturn ret;
- guint8 *header = NULL;
- guint8 *payload = NULL;
- size_t payload_length;
-
- GST_LOG_OBJECT (this, "Reading %d bytes for caps packet header",
- GST_DP_HEADER_LENGTH);
-
- *caps = NULL;
- header = g_malloc (GST_DP_HEADER_LENGTH);
-
- ret = gst_tcp_socket_read (this, socket, header, GST_DP_HEADER_LENGTH, fdset);
-
- if (ret != GST_FLOW_OK)
- goto header_read_error;
-
- if (!gst_dp_validate_header (GST_DP_HEADER_LENGTH, header))
- goto header_validate_error;
-
- if (gst_dp_header_payload_type (header) != GST_DP_PAYLOAD_CAPS)
- goto is_not_caps;
-
- GST_LOG_OBJECT (this, "validated caps packet header");
-
- payload_length = gst_dp_header_payload_length (header);
- payload = g_malloc (payload_length);
-
- GST_LOG_OBJECT (this,
- "Reading %" G_GSIZE_FORMAT " bytes for caps packet payload",
- payload_length);
-
- ret = gst_tcp_socket_read (this, socket, payload, payload_length, fdset);
-
- if (ret != GST_FLOW_OK)
- goto payload_read_error;
-
- if (!gst_dp_validate_payload (GST_DP_HEADER_LENGTH, header, payload))
- goto payload_validate_error;
-
- *caps = gst_dp_caps_from_packet (GST_DP_HEADER_LENGTH, header, payload);
-
- GST_DEBUG_OBJECT (this, "Got caps over GDP: %" GST_PTR_FORMAT, *caps);
-
- g_free (header);
- g_free (payload);
-
- return GST_FLOW_OK;
-
- /* ERRORS */
-header_read_error:
- {
- g_free (header);
- return ret;
- }
-header_validate_error:
- {
- GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
- ("GDP caps packet header does not validate"));
- g_free (header);
- return GST_FLOW_ERROR;
- }
-is_not_caps:
- {
- GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
- ("GDP packet contains something that is not a caps (type %d)",
- gst_dp_header_payload_type (header)));
- g_free (header);
- return GST_FLOW_ERROR;
- }
-payload_read_error:
- {
- g_free (header);
- g_free (payload);
- return ret;
- }
-payload_validate_error:
- {
- GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
- ("GDP caps packet payload does not validate"));
- g_free (header);
- g_free (payload);
- return GST_FLOW_ERROR;
- }
-}
-
-/* write a GDP header to the socket. Return false if fails. */
-gboolean
-gst_tcp_gdp_write_buffer (GstElement * this, int socket, GstBuffer * buffer,
- gboolean fatal, const gchar * host, int port)
-{
- guint length;
- guint8 *header;
- size_t wrote;
-
- if (!gst_dp_header_from_buffer (buffer, 0, &length, &header))
- goto create_error;
-
- GST_LOG_OBJECT (this, "writing %d bytes for GDP buffer header", length);
- wrote = gst_tcp_socket_write (socket, header, length);
- g_free (header);
-
- if (wrote != length)
- goto write_error;
-
- return TRUE;
-
- /* ERRORS */
-create_error:
- {
- if (fatal)
- GST_ELEMENT_ERROR (this, CORE, TOO_LAZY, (NULL),
- ("Could not create GDP header from buffer"));
- return FALSE;
- }
-write_error:
- {
- if (fatal)
- GST_ELEMENT_ERROR (this, RESOURCE, WRITE,
- (_("Error while sending data to \"%s:%d\"."), host, port),
- ("Only %" G_GSIZE_FORMAT " of %u bytes written: %s",
- wrote, GST_BUFFER_SIZE (buffer), g_strerror (errno)));
- return FALSE;
- }
-}
-
-/* write GDP header and payload to the given socket for the given caps.
- * Return false if fails. */
-gboolean
-gst_tcp_gdp_write_caps (GstElement * this, int socket, const GstCaps * caps,
- gboolean fatal, const char *host, int port)
-{
- guint length;
- guint8 *header;
- guint8 *payload;
- size_t wrote;
-
- if (!gst_dp_packet_from_caps (caps, 0, &length, &header, &payload))
- goto create_error;
-
- GST_LOG_OBJECT (this, "writing %d bytes for GDP caps header", length);
- wrote = gst_tcp_socket_write (socket, header, length);
- if (wrote != length)
- goto write_header_error;
-
- length = gst_dp_header_payload_length (header);
- g_free (header);
-
- GST_LOG_OBJECT (this, "writing %d bytes for GDP caps payload", length);
- wrote = gst_tcp_socket_write (socket, payload, length);
- g_free (payload);
-
- if (wrote != length)
- goto write_payload_error;
-
- return TRUE;
-
- /* ERRORS */
-create_error:
- {
- if (fatal)
- GST_ELEMENT_ERROR (this, CORE, TOO_LAZY, (NULL),
- ("Could not create GDP packet from caps"));
- return FALSE;
- }
-write_header_error:
- {
- g_free (header);
- g_free (payload);
- if (fatal)
- GST_ELEMENT_ERROR (this, RESOURCE, WRITE,
- (_("Error while sending gdp header data to \"%s:%d\"."), host, port),
- ("Only %" G_GSIZE_FORMAT " of %u bytes written: %s",
- wrote, length, g_strerror (errno)));
- return FALSE;
- }
-write_payload_error:
- {
- if (fatal)
- GST_ELEMENT_ERROR (this, RESOURCE, WRITE,
- (_("Error while sending gdp payload data to \"%s:%d\"."), host, port),
- ("Only %" G_GSIZE_FORMAT " of %u bytes written: %s",
- wrote, length, g_strerror (errno)));
- return FALSE;
- }
-}
diff --git a/gst/tcp/gsttcp.h b/gst/tcp/gsttcp.h
deleted file mode 100644
index 533c1622..00000000
--- a/gst/tcp/gsttcp.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
- *
- * gsttcp.h: helper 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_TCP_HELP_H__
-#define __GST_TCP_HELP_H__
-
-#include "gsttcp-enumtypes.h"
-#include <gst/gst.h>
-#undef GST_DISABLE_DEPRECATED
-#include <gst/dataprotocol/dataprotocol.h>
-
-#define TCP_HIGHEST_PORT 65535
-#define TCP_DEFAULT_HOST "localhost"
-#define TCP_DEFAULT_PORT 4953
-
-G_BEGIN_DECLS
-
-/**
- * GstTCPProtocol:
- * @GST_TCP_PROTOCOL_NONE: Raw data transmission
- * @GST_TCP_PROTOCOL_GDP: #GstBuffers are wrapped and sent/received using the
- * GDP protocol.
- *
- * This enum is provided by the tcp/multifd elements to configure the format of
- * data transmission/reception.
- *
- * The GDP protocol wraps data buffers in a header that also carries format
- * information and timestamps. The None value indicates the data is
- * sent/received as-is. In that case, format information and timestamping
- * must be transmitted separately, or implicit in the bytestream itself.
- */
-typedef enum
-{
- GST_TCP_PROTOCOL_NONE,
- GST_TCP_PROTOCOL_GDP
-} GstTCPProtocol;
-
-gchar * gst_tcp_host_to_ip (GstElement *element, const gchar *host);
-
-gint gst_tcp_socket_write (int socket, const void *buf, size_t count);
-
-void gst_tcp_socket_close (GstPollFD *socket);
-
-GstFlowReturn gst_tcp_read_buffer (GstElement * this, int socket, GstPoll * fdset, GstBuffer **buf);
-
-GstFlowReturn gst_tcp_gdp_read_buffer (GstElement * this, int socket, GstPoll * fdset, GstBuffer **buf);
-GstFlowReturn gst_tcp_gdp_read_caps (GstElement * this, int socket, GstPoll * fdset, GstCaps **caps);
-
-GstEvent * gst_tcp_gdp_read_event (GstElement *elem, int socket, GstPoll * fdset);
-
-gboolean gst_tcp_gdp_write_buffer (GstElement *elem, int socket, GstBuffer *buffer, gboolean fatal, const gchar *host, int port);
-gboolean gst_tcp_gdp_write_event (GstElement *elem, int socket, GstEvent *event, gboolean fatal, const gchar *host, int port);
-gboolean gst_tcp_gdp_write_caps (GstElement *elem, int socket, const GstCaps *caps, gboolean fatal, const gchar *host, int port);
-
-G_END_DECLS
-
-#endif /* __GST_TCP_HELP_H__ */
diff --git a/gst/tcp/gsttcpclientsink.c b/gst/tcp/gsttcpclientsink.c
deleted file mode 100644
index 53394442..00000000
--- a/gst/tcp/gsttcpclientsink.c
+++ /dev/null
@@ -1,464 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-tcpclientsink
- * @see_also: #tcpclientsrc
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * # server:
- * nc -l -p 3000
- * # client:
- * gst-launch fdsrc fd=1 ! tcpclientsink protocol=none port=3000
- * ]| everything you type in the client is shown on the server
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <gst/gst-i18n-plugin.h>
-#include <gst/dataprotocol/dataprotocol.h>
-#include "gsttcp.h"
-#include "gsttcpclientsink.h"
-#include <string.h> /* memset */
-
-/* elementfactory information */
-static const GstElementDetails gst_tcp_client_sink_details =
-GST_ELEMENT_DETAILS ("TCP client sink",
- "Sink/Network",
- "Send data as a client over the network via TCP",
- "Thomas Vander Stichele <thomas at apestaart dot org>");
-
-/* TCPClientSink signals and args */
-enum
-{
- FRAME_ENCODED,
- /* FILL ME */
- LAST_SIGNAL
-};
-
-GST_DEBUG_CATEGORY_STATIC (tcpclientsink_debug);
-#define GST_CAT_DEFAULT (tcpclientsink_debug)
-
-enum
-{
- ARG_0,
- ARG_HOST,
- ARG_PORT,
- ARG_PROTOCOL
- /* FILL ME */
-};
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-static void gst_tcp_client_sink_base_init (gpointer g_class);
-static void gst_tcp_client_sink_class_init (GstTCPClientSink * klass);
-static void gst_tcp_client_sink_init (GstTCPClientSink * tcpclientsink);
-static void gst_tcp_client_sink_finalize (GObject * gobject);
-
-static gboolean gst_tcp_client_sink_setcaps (GstBaseSink * bsink,
- GstCaps * caps);
-static GstFlowReturn gst_tcp_client_sink_render (GstBaseSink * bsink,
- GstBuffer * buf);
-static GstStateChangeReturn gst_tcp_client_sink_change_state (GstElement *
- element, GstStateChange transition);
-
-static void gst_tcp_client_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_tcp_client_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-
-static GstElementClass *parent_class = NULL;
-
-/*static guint gst_tcp_client_sink_signals[LAST_SIGNAL] = { 0 }; */
-
-GType
-gst_tcp_client_sink_get_type (void)
-{
- static GType tcpclientsink_type = 0;
-
-
- if (!tcpclientsink_type) {
- static const GTypeInfo tcpclientsink_info = {
- sizeof (GstTCPClientSinkClass),
- gst_tcp_client_sink_base_init,
- NULL,
- (GClassInitFunc) gst_tcp_client_sink_class_init,
- NULL,
- NULL,
- sizeof (GstTCPClientSink),
- 0,
- (GInstanceInitFunc) gst_tcp_client_sink_init,
- NULL
- };
-
- tcpclientsink_type =
- g_type_register_static (GST_TYPE_BASE_SINK, "GstTCPClientSink",
- &tcpclientsink_info, 0);
- }
- return tcpclientsink_type;
-}
-
-static void
-gst_tcp_client_sink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sinktemplate));
-
- gst_element_class_set_details (element_class, &gst_tcp_client_sink_details);
-}
-
-static void
-gst_tcp_client_sink_class_init (GstTCPClientSink * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- GstBaseSinkClass *gstbasesink_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
- gstbasesink_class = (GstBaseSinkClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->set_property = gst_tcp_client_sink_set_property;
- gobject_class->get_property = gst_tcp_client_sink_get_property;
- gobject_class->finalize = gst_tcp_client_sink_finalize;
-
- g_object_class_install_property (gobject_class, ARG_HOST,
- g_param_spec_string ("host", "Host", "The host/IP to send the packets to",
- TCP_DEFAULT_HOST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_PORT,
- g_param_spec_int ("port", "Port", "The port to send the packets to",
- 0, TCP_HIGHEST_PORT, TCP_DEFAULT_PORT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_PROTOCOL,
- g_param_spec_enum ("protocol", "Protocol", "The protocol to wrap data in",
- GST_TYPE_TCP_PROTOCOL, GST_TCP_PROTOCOL_NONE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstelement_class->change_state = gst_tcp_client_sink_change_state;
-
- gstbasesink_class->set_caps = gst_tcp_client_sink_setcaps;
- gstbasesink_class->render = gst_tcp_client_sink_render;
-
- GST_DEBUG_CATEGORY_INIT (tcpclientsink_debug, "tcpclientsink", 0, "TCP sink");
-}
-
-static void
-gst_tcp_client_sink_init (GstTCPClientSink * this)
-{
- this->host = g_strdup (TCP_DEFAULT_HOST);
- this->port = TCP_DEFAULT_PORT;
-
- this->sock_fd.fd = -1;
- this->protocol = GST_TCP_PROTOCOL_NONE;
- GST_OBJECT_FLAG_UNSET (this, GST_TCP_CLIENT_SINK_OPEN);
-}
-
-static void
-gst_tcp_client_sink_finalize (GObject * gobject)
-{
- GstTCPClientSink *this = GST_TCP_CLIENT_SINK (gobject);
-
- g_free (this->host);
-
- G_OBJECT_CLASS (parent_class)->finalize (gobject);
-}
-
-static gboolean
-gst_tcp_client_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
-{
- GstTCPClientSink *sink;
-
- sink = GST_TCP_CLIENT_SINK (bsink);
-
- /* write the buffer header if we have one */
- switch (sink->protocol) {
- case GST_TCP_PROTOCOL_NONE:
- break;
-
- case GST_TCP_PROTOCOL_GDP:
- /* if we haven't send caps yet, send them first */
- if (!sink->caps_sent) {
- const GstCaps *caps;
- gchar *string;
-
- caps = GST_PAD_CAPS (GST_PAD_PEER (GST_BASE_SINK_PAD (bsink)));
- string = gst_caps_to_string (caps);
- GST_DEBUG_OBJECT (sink, "Sending caps %s through GDP", string);
- g_free (string);
-
- if (!gst_tcp_gdp_write_caps (GST_ELEMENT (sink), sink->sock_fd.fd,
- caps, TRUE, sink->host, sink->port))
- goto gdp_write_error;
-
- sink->caps_sent = TRUE;
- }
- break;
- default:
- g_warning ("Unhandled protocol type");
- break;
- }
-
- return TRUE;
-
- /* ERRORS */
-gdp_write_error:
- {
- return FALSE;
- }
-}
-
-static GstFlowReturn
-gst_tcp_client_sink_render (GstBaseSink * bsink, GstBuffer * buf)
-{
- size_t wrote = 0;
- GstTCPClientSink *sink;
- gint size;
-
- sink = GST_TCP_CLIENT_SINK (bsink);
-
- g_return_val_if_fail (GST_OBJECT_FLAG_IS_SET (sink, GST_TCP_CLIENT_SINK_OPEN),
- GST_FLOW_WRONG_STATE);
-
- size = GST_BUFFER_SIZE (buf);
-
- GST_LOG_OBJECT (sink, "writing %d bytes for buffer data", size);
-
- /* write the buffer header if we have one */
- switch (sink->protocol) {
- case GST_TCP_PROTOCOL_NONE:
- break;
- case GST_TCP_PROTOCOL_GDP:
- GST_LOG_OBJECT (sink, "Sending buffer header through GDP");
- if (!gst_tcp_gdp_write_buffer (GST_ELEMENT (sink), sink->sock_fd.fd, buf,
- TRUE, sink->host, sink->port))
- goto gdp_write_error;
- break;
- default:
- break;
- }
-
- /* write buffer data */
- wrote = gst_tcp_socket_write (sink->sock_fd.fd, GST_BUFFER_DATA (buf), size);
-
- if (wrote < size)
- goto write_error;
-
- sink->data_written += wrote;
-
- return GST_FLOW_OK;
-
- /* ERRORS */
-gdp_write_error:
- {
- return FALSE;
- }
-write_error:
- {
- GST_ELEMENT_ERROR (sink, RESOURCE, WRITE,
- (_("Error while sending data to \"%s:%d\"."), sink->host, sink->port),
- ("Only %" G_GSIZE_FORMAT " of %u bytes written: %s",
- wrote, GST_BUFFER_SIZE (buf), g_strerror (errno)));
- return GST_FLOW_ERROR;
- }
-}
-
-static void
-gst_tcp_client_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstTCPClientSink *tcpclientsink;
-
- g_return_if_fail (GST_IS_TCP_CLIENT_SINK (object));
- tcpclientsink = GST_TCP_CLIENT_SINK (object);
-
- switch (prop_id) {
- case ARG_HOST:
- if (!g_value_get_string (value)) {
- g_warning ("host property cannot be NULL");
- break;
- }
- g_free (tcpclientsink->host);
- tcpclientsink->host = g_strdup (g_value_get_string (value));
- break;
- case ARG_PORT:
- tcpclientsink->port = g_value_get_int (value);
- break;
- case ARG_PROTOCOL:
- tcpclientsink->protocol = g_value_get_enum (value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_tcp_client_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstTCPClientSink *tcpclientsink;
-
- g_return_if_fail (GST_IS_TCP_CLIENT_SINK (object));
- tcpclientsink = GST_TCP_CLIENT_SINK (object);
-
- switch (prop_id) {
- case ARG_HOST:
- g_value_set_string (value, tcpclientsink->host);
- break;
- case ARG_PORT:
- g_value_set_int (value, tcpclientsink->port);
- break;
- case ARG_PROTOCOL:
- g_value_set_enum (value, tcpclientsink->protocol);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-/* create a socket for sending to remote machine */
-static gboolean
-gst_tcp_client_sink_start (GstTCPClientSink * this)
-{
- int ret;
- gchar *ip;
-
- if (GST_OBJECT_FLAG_IS_SET (this, GST_TCP_CLIENT_SINK_OPEN))
- return TRUE;
-
- /* reset caps_sent flag */
- this->caps_sent = FALSE;
-
- /* create sending client socket */
- GST_DEBUG_OBJECT (this, "opening sending client socket to %s:%d", this->host,
- this->port);
- if ((this->sock_fd.fd = socket (AF_INET, SOCK_STREAM, 0)) == -1) {
- GST_ELEMENT_ERROR (this, RESOURCE, OPEN_WRITE, (NULL), GST_ERROR_SYSTEM);
- return FALSE;
- }
- GST_DEBUG_OBJECT (this, "opened sending client socket with fd %d",
- this->sock_fd.fd);
-
- /* look up name if we need to */
- ip = gst_tcp_host_to_ip (GST_ELEMENT (this), this->host);
- if (!ip) {
- gst_tcp_socket_close (&this->sock_fd);
- return FALSE;
- }
- GST_DEBUG_OBJECT (this, "IP address for host %s is %s", this->host, ip);
-
- /* connect to server */
- memset (&this->server_sin, 0, sizeof (this->server_sin));
- this->server_sin.sin_family = AF_INET; /* network socket */
- this->server_sin.sin_port = htons (this->port); /* on port */
- this->server_sin.sin_addr.s_addr = inet_addr (ip); /* on host ip */
- g_free (ip);
-
- GST_DEBUG_OBJECT (this, "connecting to server");
- ret = connect (this->sock_fd.fd, (struct sockaddr *) &this->server_sin,
- sizeof (this->server_sin));
-
- if (ret) {
- gst_tcp_socket_close (&this->sock_fd);
- switch (errno) {
- case ECONNREFUSED:
- GST_ELEMENT_ERROR (this, RESOURCE, OPEN_WRITE,
- (_("Connection to %s:%d refused."), this->host, this->port),
- (NULL));
- return FALSE;
- break;
- default:
- GST_ELEMENT_ERROR (this, RESOURCE, OPEN_READ, (NULL),
- ("connect to %s:%d failed: %s", this->host, this->port,
- g_strerror (errno)));
- return FALSE;
- break;
- }
- }
-
- GST_OBJECT_FLAG_SET (this, GST_TCP_CLIENT_SINK_OPEN);
-
- this->data_written = 0;
-
- return TRUE;
-}
-
-static gboolean
-gst_tcp_client_sink_stop (GstTCPClientSink * this)
-{
- if (!GST_OBJECT_FLAG_IS_SET (this, GST_TCP_CLIENT_SINK_OPEN))
- return TRUE;
-
- gst_tcp_socket_close (&this->sock_fd);
-
- GST_OBJECT_FLAG_UNSET (this, GST_TCP_CLIENT_SINK_OPEN);
-
- return TRUE;
-}
-
-static GstStateChangeReturn
-gst_tcp_client_sink_change_state (GstElement * element,
- GstStateChange transition)
-{
- GstTCPClientSink *sink;
- GstStateChangeReturn res;
-
- sink = GST_TCP_CLIENT_SINK (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- if (!gst_tcp_client_sink_start (sink))
- goto start_failure;
- break;
- default:
- break;
- }
- res = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_NULL:
- gst_tcp_client_sink_stop (sink);
- default:
- break;
- }
- return res;
-
-start_failure:
- {
- return GST_STATE_CHANGE_FAILURE;
- }
-}
diff --git a/gst/tcp/gsttcpclientsink.h b/gst/tcp/gsttcpclientsink.h
deleted file mode 100644
index 43998704..00000000
--- a/gst/tcp/gsttcpclientsink.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_TCP_CLIENT_SINK_H__
-#define __GST_TCP_CLIENT_SINK_H__
-
-
-#include <gst/gst.h>
-#include <gst/base/gstbasesink.h>
-
-#include "gsttcp.h"
-
-G_BEGIN_DECLS
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <arpa/inet.h>
-#include "gsttcp.h"
-
-#define GST_TYPE_TCP_CLIENT_SINK \
- (gst_tcp_client_sink_get_type())
-#define GST_TCP_CLIENT_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TCP_CLIENT_SINK,GstTCPClientSink))
-#define GST_TCP_CLIENT_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TCP_CLIENT_SINK,GstTCPClientSinkClass))
-#define GST_IS_TCP_CLIENT_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TCP_CLIENT_SINK))
-#define GST_IS_TCP_CLIENT_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TCP_CLIENT_SINK))
-
-typedef struct _GstTCPClientSink GstTCPClientSink;
-typedef struct _GstTCPClientSinkClass GstTCPClientSinkClass;
-
-typedef enum {
- GST_TCP_CLIENT_SINK_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
-
- GST_TCP_CLIENT_SINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2),
-} GstTCPClientSinkFlags;
-
-struct _GstTCPClientSink {
- GstBaseSink element;
-
- /* server information */
- int port;
- gchar *host;
- struct sockaddr_in server_sin;
-
- /* socket */
- GstPollFD sock_fd;
-
- size_t data_written; /* how much bytes have we written ? */
- GstTCPProtocol protocol; /* used with the protocol enum */
- gboolean caps_sent; /* whether or not we sent caps already */
-};
-
-struct _GstTCPClientSinkClass {
- GstBaseSinkClass parent_class;
-};
-
-GType gst_tcp_client_sink_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_TCP_CLIENT_SINK_H__ */
diff --git a/gst/tcp/gsttcpclientsrc.c b/gst/tcp/gsttcpclientsrc.c
deleted file mode 100644
index a0548b99..00000000
--- a/gst/tcp/gsttcpclientsrc.c
+++ /dev/null
@@ -1,444 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-tcpclientsrc
- * @see_also: #tcpclientsink
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * # server:
- * nc -l -p 3000
- * # client:
- * gst-launch tcpclientsrc protocol=none port=3000 ! fdsink fd=2
- * ]| everything you type in the server is shown on the client
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst-i18n-plugin.h>
-#include "gsttcp.h"
-#include "gsttcpclientsrc.h"
-#include <string.h> /* memset */
-#include <unistd.h>
-#include <arpa/inet.h>
-#include <fcntl.h>
-
-
-GST_DEBUG_CATEGORY_STATIC (tcpclientsrc_debug);
-#define GST_CAT_DEFAULT tcpclientsrc_debug
-
-#define MAX_READ_SIZE 4 * 1024
-
-
-static const GstElementDetails gst_tcp_client_src_details =
-GST_ELEMENT_DETAILS ("TCP client source",
- "Source/Network",
- "Receive data as a client over the network via TCP",
- "Thomas Vander Stichele <thomas at apestaart dot org>");
-
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-
-enum
-{
- PROP_0,
- PROP_HOST,
- PROP_PORT,
- PROP_PROTOCOL
-};
-
-
-GST_BOILERPLATE (GstTCPClientSrc, gst_tcp_client_src, GstPushSrc,
- GST_TYPE_PUSH_SRC);
-
-
-static void gst_tcp_client_src_finalize (GObject * gobject);
-
-static GstCaps *gst_tcp_client_src_getcaps (GstBaseSrc * psrc);
-
-static GstFlowReturn gst_tcp_client_src_create (GstPushSrc * psrc,
- GstBuffer ** outbuf);
-static gboolean gst_tcp_client_src_stop (GstBaseSrc * bsrc);
-static gboolean gst_tcp_client_src_start (GstBaseSrc * bsrc);
-static gboolean gst_tcp_client_src_unlock (GstBaseSrc * bsrc);
-static gboolean gst_tcp_client_src_unlock_stop (GstBaseSrc * bsrc);
-
-static void gst_tcp_client_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_tcp_client_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-
-static void
-gst_tcp_client_src_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&srctemplate));
-
- gst_element_class_set_details (element_class, &gst_tcp_client_src_details);
-}
-
-static void
-gst_tcp_client_src_class_init (GstTCPClientSrcClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseSrcClass *gstbasesrc_class;
- GstPushSrcClass *gstpush_src_class;
-
- gobject_class = (GObjectClass *) klass;
- gstbasesrc_class = (GstBaseSrcClass *) klass;
- gstpush_src_class = (GstPushSrcClass *) klass;
-
- gobject_class->set_property = gst_tcp_client_src_set_property;
- gobject_class->get_property = gst_tcp_client_src_get_property;
- gobject_class->finalize = gst_tcp_client_src_finalize;
-
- g_object_class_install_property (gobject_class, PROP_HOST,
- g_param_spec_string ("host", "Host",
- "The host IP address to receive packets from", TCP_DEFAULT_HOST,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_PORT,
- g_param_spec_int ("port", "Port", "The port to receive packets from", 0,
- TCP_HIGHEST_PORT, TCP_DEFAULT_PORT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_PROTOCOL,
- g_param_spec_enum ("protocol", "Protocol", "The protocol to wrap data in",
- GST_TYPE_TCP_PROTOCOL, GST_TCP_PROTOCOL_NONE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstbasesrc_class->get_caps = gst_tcp_client_src_getcaps;
- gstbasesrc_class->start = gst_tcp_client_src_start;
- gstbasesrc_class->stop = gst_tcp_client_src_stop;
- gstbasesrc_class->unlock = gst_tcp_client_src_unlock;
- gstbasesrc_class->unlock_stop = gst_tcp_client_src_unlock_stop;
-
- gstpush_src_class->create = gst_tcp_client_src_create;
-
- GST_DEBUG_CATEGORY_INIT (tcpclientsrc_debug, "tcpclientsrc", 0,
- "TCP Client Source");
-}
-
-static void
-gst_tcp_client_src_init (GstTCPClientSrc * this, GstTCPClientSrcClass * g_class)
-{
- this->port = TCP_DEFAULT_PORT;
- this->host = g_strdup (TCP_DEFAULT_HOST);
- this->sock_fd.fd = -1;
- this->protocol = GST_TCP_PROTOCOL_NONE;
- this->caps = NULL;
-
- GST_OBJECT_FLAG_UNSET (this, GST_TCP_CLIENT_SRC_OPEN);
-}
-
-static void
-gst_tcp_client_src_finalize (GObject * gobject)
-{
- GstTCPClientSrc *this = GST_TCP_CLIENT_SRC (gobject);
-
- g_free (this->host);
-
- G_OBJECT_CLASS (parent_class)->finalize (gobject);
-}
-
-static GstCaps *
-gst_tcp_client_src_getcaps (GstBaseSrc * bsrc)
-{
- GstTCPClientSrc *src;
- GstCaps *caps = NULL;
-
- src = GST_TCP_CLIENT_SRC (bsrc);
-
- if (!GST_OBJECT_FLAG_IS_SET (src, GST_TCP_CLIENT_SRC_OPEN))
- caps = gst_caps_new_any ();
- else if (src->caps)
- caps = gst_caps_copy (src->caps);
- else
- caps = gst_caps_new_any ();
- GST_DEBUG_OBJECT (src, "returning caps %" GST_PTR_FORMAT, caps);
- g_assert (GST_IS_CAPS (caps));
- return caps;
-}
-
-static GstFlowReturn
-gst_tcp_client_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
-{
- GstTCPClientSrc *src;
- GstFlowReturn ret = GST_FLOW_OK;
-
- src = GST_TCP_CLIENT_SRC (psrc);
-
- if (!GST_OBJECT_FLAG_IS_SET (src, GST_TCP_CLIENT_SRC_OPEN))
- goto wrong_state;
-
- GST_LOG_OBJECT (src, "asked for a buffer");
-
- /* read the buffer header if we're using a protocol */
- switch (src->protocol) {
- case GST_TCP_PROTOCOL_NONE:
- ret = gst_tcp_read_buffer (GST_ELEMENT (src), src->sock_fd.fd,
- src->fdset, outbuf);
- break;
-
- case GST_TCP_PROTOCOL_GDP:
- /* get the caps if we're using GDP */
- if (!src->caps_received) {
- GstCaps *caps;
-
- GST_DEBUG_OBJECT (src, "getting caps through GDP");
- ret = gst_tcp_gdp_read_caps (GST_ELEMENT (src), src->sock_fd.fd,
- src->fdset, &caps);
-
- if (ret != GST_FLOW_OK)
- goto no_caps;
-
- src->caps_received = TRUE;
- src->caps = caps;
- }
-
- ret = gst_tcp_gdp_read_buffer (GST_ELEMENT (src), src->sock_fd.fd,
- src->fdset, outbuf);
- break;
- default:
- /* need to assert as buf == NULL */
- g_assert ("Unhandled protocol type");
- break;
- }
-
- if (ret == GST_FLOW_OK) {
- GST_LOG_OBJECT (src,
- "Returning buffer from _get of size %d, ts %"
- GST_TIME_FORMAT ", dur %" GST_TIME_FORMAT
- ", offset %" G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT,
- GST_BUFFER_SIZE (*outbuf),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (*outbuf)),
- GST_TIME_ARGS (GST_BUFFER_DURATION (*outbuf)),
- GST_BUFFER_OFFSET (*outbuf), GST_BUFFER_OFFSET_END (*outbuf));
-
- gst_buffer_set_caps (*outbuf, src->caps);
- }
-
- return ret;
-
-wrong_state:
- {
- GST_DEBUG_OBJECT (src, "connection to closed, cannot read data");
- return GST_FLOW_WRONG_STATE;
- }
-no_caps:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
- ("Could not read caps through GDP"));
- return ret;
- }
-}
-
-static void
-gst_tcp_client_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstTCPClientSrc *tcpclientsrc = GST_TCP_CLIENT_SRC (object);
-
- switch (prop_id) {
- case PROP_HOST:
- if (!g_value_get_string (value)) {
- g_warning ("host property cannot be NULL");
- break;
- }
- g_free (tcpclientsrc->host);
- tcpclientsrc->host = g_strdup (g_value_get_string (value));
- break;
- case PROP_PORT:
- tcpclientsrc->port = g_value_get_int (value);
- break;
- case PROP_PROTOCOL:
- tcpclientsrc->protocol = g_value_get_enum (value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_tcp_client_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstTCPClientSrc *tcpclientsrc = GST_TCP_CLIENT_SRC (object);
-
- switch (prop_id) {
- case PROP_HOST:
- g_value_set_string (value, tcpclientsrc->host);
- break;
- case PROP_PORT:
- g_value_set_int (value, tcpclientsrc->port);
- break;
- case PROP_PROTOCOL:
- g_value_set_enum (value, tcpclientsrc->protocol);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/* create a socket for connecting to remote server */
-static gboolean
-gst_tcp_client_src_start (GstBaseSrc * bsrc)
-{
- int ret;
- gchar *ip;
- GstTCPClientSrc *src = GST_TCP_CLIENT_SRC (bsrc);
-
- if ((src->fdset = gst_poll_new (TRUE)) == NULL)
- goto socket_pair;
-
- /* create receiving client socket */
- GST_DEBUG_OBJECT (src, "opening receiving client socket to %s:%d",
- src->host, src->port);
-
- if ((src->sock_fd.fd = socket (AF_INET, SOCK_STREAM, 0)) == -1)
- goto no_socket;
-
- GST_DEBUG_OBJECT (src, "opened receiving client socket with fd %d",
- src->sock_fd.fd);
- GST_OBJECT_FLAG_SET (src, GST_TCP_CLIENT_SRC_OPEN);
-
- /* look up name if we need to */
- if (!(ip = gst_tcp_host_to_ip (GST_ELEMENT (src), src->host)))
- goto name_resolv;
-
- GST_DEBUG_OBJECT (src, "IP address for host %s is %s", src->host, ip);
-
- /* connect to server */
- memset (&src->server_sin, 0, sizeof (src->server_sin));
- src->server_sin.sin_family = AF_INET; /* network socket */
- src->server_sin.sin_port = htons (src->port); /* on port */
- src->server_sin.sin_addr.s_addr = inet_addr (ip); /* on host ip */
- g_free (ip);
-
- GST_DEBUG_OBJECT (src, "connecting to server");
- ret = connect (src->sock_fd.fd, (struct sockaddr *) &src->server_sin,
- sizeof (src->server_sin));
- if (ret)
- goto connect_failed;
-
- /* add the socket to the poll */
- gst_poll_add_fd (src->fdset, &src->sock_fd);
- gst_poll_fd_ctl_read (src->fdset, &src->sock_fd, TRUE);
-
- return TRUE;
-
-socket_pair:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ_WRITE, (NULL),
- GST_ERROR_SYSTEM);
- return FALSE;
- }
-no_socket:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), GST_ERROR_SYSTEM);
- return FALSE;
- }
-name_resolv:
- {
- gst_tcp_client_src_stop (GST_BASE_SRC (src));
- return FALSE;
- }
-connect_failed:
- {
- gst_tcp_client_src_stop (GST_BASE_SRC (src));
- switch (errno) {
- case ECONNREFUSED:
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
- (_("Connection to %s:%d refused."), src->host, src->port), (NULL));
- break;
- default:
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
- ("connect to %s:%d failed: %s", src->host, src->port,
- g_strerror (errno)));
- break;
- }
- return FALSE;
- }
-}
-
-/* close the socket and associated resources
- * unset OPEN flag
- * used both to recover from errors and go to NULL state */
-static gboolean
-gst_tcp_client_src_stop (GstBaseSrc * bsrc)
-{
- GstTCPClientSrc *src;
-
- src = GST_TCP_CLIENT_SRC (bsrc);
-
- GST_DEBUG_OBJECT (src, "closing socket");
-
- if (src->fdset != NULL) {
- gst_poll_free (src->fdset);
- src->fdset = NULL;
- }
-
- gst_tcp_socket_close (&src->sock_fd);
- src->caps_received = FALSE;
- if (src->caps) {
- gst_caps_unref (src->caps);
- src->caps = NULL;
- }
- GST_OBJECT_FLAG_UNSET (src, GST_TCP_CLIENT_SRC_OPEN);
-
- return TRUE;
-}
-
-/* will be called only between calls to start() and stop() */
-static gboolean
-gst_tcp_client_src_unlock (GstBaseSrc * bsrc)
-{
- GstTCPClientSrc *src = GST_TCP_CLIENT_SRC (bsrc);
-
- GST_DEBUG_OBJECT (src, "set to flushing");
- gst_poll_set_flushing (src->fdset, TRUE);
-
- return TRUE;
-}
-
-/* will be called only between calls to start() and stop() */
-static gboolean
-gst_tcp_client_src_unlock_stop (GstBaseSrc * bsrc)
-{
- GstTCPClientSrc *src = GST_TCP_CLIENT_SRC (bsrc);
-
- GST_DEBUG_OBJECT (src, "unset flushing");
- gst_poll_set_flushing (src->fdset, FALSE);
-
- return TRUE;
-}
diff --git a/gst/tcp/gsttcpclientsrc.h b/gst/tcp/gsttcpclientsrc.h
deleted file mode 100644
index 24d31e8a..00000000
--- a/gst/tcp/gsttcpclientsrc.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_TCP_CLIENT_SRC_H__
-#define __GST_TCP_CLIENT_SRC_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstpushsrc.h>
-
-G_BEGIN_DECLS
-
-#include <netdb.h> /* sockaddr_in */
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h> /* sockaddr_in */
-#include <unistd.h>
-
-#include "gsttcp.h"
-
-#define GST_TYPE_TCP_CLIENT_SRC \
- (gst_tcp_client_src_get_type())
-#define GST_TCP_CLIENT_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TCP_CLIENT_SRC,GstTCPClientSrc))
-#define GST_TCP_CLIENT_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TCP_CLIENT_SRC,GstTCPClientSrcClass))
-#define GST_IS_TCP_CLIENT_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TCP_CLIENT_SRC))
-#define GST_IS_TCP_CLIENT_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TCP_CLIENT_SRC))
-
-typedef struct _GstTCPClientSrc GstTCPClientSrc;
-typedef struct _GstTCPClientSrcClass GstTCPClientSrcClass;
-
-typedef enum {
- GST_TCP_CLIENT_SRC_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
-
- GST_TCP_CLIENT_SRC_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2)
-} GstTCPClientSrcFlags;
-
-struct _GstTCPClientSrc {
- GstPushSrc element;
-
- /* server information */
- int port;
- gchar *host;
- struct sockaddr_in server_sin;
-
- /* socket */
- GstPollFD sock_fd;
- GstPoll *fdset;
-
- GstTCPProtocol protocol; /* protocol used for reading data */
- gboolean caps_received; /* if we have received caps yet */
- GstCaps *caps;
-};
-
-struct _GstTCPClientSrcClass {
- GstPushSrcClass parent_class;
-};
-
-GType gst_tcp_client_src_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_TCP_CLIENT_SRC_H__ */
diff --git a/gst/tcp/gsttcpplugin.c b/gst/tcp/gsttcpplugin.c
deleted file mode 100644
index bb2cf489..00000000
--- a/gst/tcp/gsttcpplugin.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/dataprotocol/dataprotocol.h>
-#include "gsttcpclientsrc.h"
-#include "gsttcpclientsink.h"
-#include "gsttcpserversrc.h"
-#include "gsttcpserversink.h"
-#include "gstmultifdsink.h"
-
-GST_DEBUG_CATEGORY (tcp_debug);
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- gst_dp_init ();
-
- if (!gst_element_register (plugin, "tcpclientsink", GST_RANK_NONE,
- GST_TYPE_TCP_CLIENT_SINK))
- return FALSE;
- if (!gst_element_register (plugin, "tcpclientsrc", GST_RANK_NONE,
- GST_TYPE_TCP_CLIENT_SRC))
- return FALSE;
- if (!gst_element_register (plugin, "tcpserversink", GST_RANK_NONE,
- GST_TYPE_TCP_SERVER_SINK))
- return FALSE;
- if (!gst_element_register (plugin, "tcpserversrc", GST_RANK_NONE,
- GST_TYPE_TCP_SERVER_SRC))
- return FALSE;
- if (!gst_element_register (plugin, "multifdsink", GST_RANK_NONE,
- GST_TYPE_MULTI_FD_SINK))
- return FALSE;
-
- GST_DEBUG_CATEGORY_INIT (tcp_debug, "tcp", 0, "TCP calls");
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "tcp",
- "transfer data over the network via TCP",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/tcp/gsttcpplugin.h b/gst/tcp/gsttcpplugin.h
deleted file mode 100644
index 38b91be1..00000000
--- a/gst/tcp/gsttcpplugin.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_TCP_H__
-#define __GST_TCP_H__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
- typedef enum
- {
- CONTROL_ZERO,
- CONTROL_NONE,
- CONTROL_TCP
- } Gst_TCP_Control;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __GST_TCP_H__ */
diff --git a/gst/tcp/gsttcpserversink.c b/gst/tcp/gsttcpserversink.c
deleted file mode 100644
index fcec3159..00000000
--- a/gst/tcp/gsttcpserversink.c
+++ /dev/null
@@ -1,382 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-tcpserversink
- * @see_also: #multifdsink
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * # server:
- * gst-launch fdsrc fd=1 ! tcpserversink protocol=none port=3000
- * # client:
- * gst-launch tcpclientsrc protocol=none port=3000 ! fdsink fd=2
- * ]|
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <gst/gst-i18n-plugin.h>
-#include <string.h> /* memset */
-
-#include <sys/ioctl.h>
-
-#ifdef HAVE_FIONREAD_IN_SYS_FILIO
-#include <sys/filio.h>
-#endif
-
-#include "gsttcp.h"
-#include "gsttcpserversink.h"
-#include "gsttcp-marshal.h"
-
-#define TCP_BACKLOG 5
-
-/* elementfactory information */
-static const GstElementDetails gst_tcp_server_sink_details =
-GST_ELEMENT_DETAILS ("TCP server sink",
- "Sink/Network",
- "Send data as a server over the network via TCP",
- "Thomas Vander Stichele <thomas at apestaart dot org>");
-
-GST_DEBUG_CATEGORY_STATIC (tcpserversink_debug);
-#define GST_CAT_DEFAULT (tcpserversink_debug)
-
-enum
-{
- ARG_0,
- ARG_HOST,
- ARG_PORT,
-};
-
-static void gst_tcp_server_sink_finalize (GObject * gobject);
-
-static gboolean gst_tcp_server_sink_handle_wait (GstMultiFdSink * sink,
- GstPoll * set);
-static gboolean gst_tcp_server_sink_init_send (GstMultiFdSink * this);
-static gboolean gst_tcp_server_sink_close (GstMultiFdSink * this);
-static void gst_tcp_server_sink_removed (GstMultiFdSink * sink, int fd);
-
-static void gst_tcp_server_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_tcp_server_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-
-GST_BOILERPLATE (GstTCPServerSink, gst_tcp_server_sink, GstMultiFdSink,
- GST_TYPE_MULTI_FD_SINK);
-
-
-static void
-gst_tcp_server_sink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &gst_tcp_server_sink_details);
-}
-
-static void
-gst_tcp_server_sink_class_init (GstTCPServerSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstMultiFdSinkClass *gstmultifdsink_class;
-
- gobject_class = (GObjectClass *) klass;
- gstmultifdsink_class = (GstMultiFdSinkClass *) klass;
-
- gobject_class->set_property = gst_tcp_server_sink_set_property;
- gobject_class->get_property = gst_tcp_server_sink_get_property;
- gobject_class->finalize = gst_tcp_server_sink_finalize;
-
- g_object_class_install_property (gobject_class, ARG_HOST,
- g_param_spec_string ("host", "host", "The host/IP to send the packets to",
- TCP_DEFAULT_HOST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_PORT,
- g_param_spec_int ("port", "port", "The port to send the packets to",
- 0, TCP_HIGHEST_PORT, TCP_DEFAULT_PORT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstmultifdsink_class->init = gst_tcp_server_sink_init_send;
- gstmultifdsink_class->wait = gst_tcp_server_sink_handle_wait;
- gstmultifdsink_class->close = gst_tcp_server_sink_close;
- gstmultifdsink_class->removed = gst_tcp_server_sink_removed;
-
- GST_DEBUG_CATEGORY_INIT (tcpserversink_debug, "tcpserversink", 0, "TCP sink");
-}
-
-static void
-gst_tcp_server_sink_init (GstTCPServerSink * this,
- GstTCPServerSinkClass * klass)
-{
- this->server_port = TCP_DEFAULT_PORT;
- /* should support as minimum 576 for IPV4 and 1500 for IPV6 */
- /* this->mtu = 1500; */
- this->host = g_strdup (TCP_DEFAULT_HOST);
-
- this->server_sock.fd = -1;
-}
-
-static void
-gst_tcp_server_sink_finalize (GObject * gobject)
-{
- GstTCPServerSink *this = GST_TCP_SERVER_SINK (gobject);
-
- g_free (this->host);
-
- G_OBJECT_CLASS (parent_class)->finalize (gobject);
-}
-
-/* handle a read request on the server,
- * which indicates a new client connection */
-static gboolean
-gst_tcp_server_sink_handle_server_read (GstTCPServerSink * sink)
-{
- /* new client */
- int client_sock_fd;
- struct sockaddr_in client_address;
- unsigned int client_address_len;
-
- /* For some stupid reason, client_address and client_address_len has to be
- * zeroed */
- memset (&client_address, 0, sizeof (client_address));
- client_address_len = 0;
-
- client_sock_fd =
- accept (sink->server_sock.fd, (struct sockaddr *) &client_address,
- &client_address_len);
- if (client_sock_fd == -1)
- goto accept_failed;
-
- gst_multi_fd_sink_add (GST_MULTI_FD_SINK (sink), client_sock_fd);
-
- GST_DEBUG_OBJECT (sink, "added new client ip %s with fd %d",
- inet_ntoa (client_address.sin_addr), client_sock_fd);
-
- return TRUE;
-
- /* ERRORS */
-accept_failed:
- {
- GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL),
- ("Could not accept client on server socket %d: %s (%d)",
- sink->server_sock.fd, g_strerror (errno), errno));
- return FALSE;
- }
-}
-
-static void
-gst_tcp_server_sink_removed (GstMultiFdSink * sink, int fd)
-{
-#ifndef GST_DISABLE_GST_DEBUG
- GstTCPServerSink *this = GST_TCP_SERVER_SINK (sink);
-#endif
-
- GST_LOG_OBJECT (this, "closing fd %d", fd);
- if (close (fd) < 0) {
- GST_WARNING_OBJECT (this, "error closing fd %d: %s", fd,
- g_strerror (errno));
- }
-}
-
-static gboolean
-gst_tcp_server_sink_handle_wait (GstMultiFdSink * sink, GstPoll * set)
-{
- GstTCPServerSink *this = GST_TCP_SERVER_SINK (sink);
-
- if (gst_poll_fd_can_read (set, &this->server_sock)) {
- /* handle new client connection on server socket */
- if (!gst_tcp_server_sink_handle_server_read (this))
- goto connection_failed;
- }
- return TRUE;
-
- /* ERRORS */
-connection_failed:
- {
- GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
- ("client connection failed: %s", g_strerror (errno)));
- return FALSE;
- }
-}
-
-static void
-gst_tcp_server_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstTCPServerSink *sink;
-
- g_return_if_fail (GST_IS_TCP_SERVER_SINK (object));
- sink = GST_TCP_SERVER_SINK (object);
-
- switch (prop_id) {
- case ARG_HOST:
- if (!g_value_get_string (value)) {
- g_warning ("host property cannot be NULL");
- break;
- }
- g_free (sink->host);
- sink->host = g_strdup (g_value_get_string (value));
- break;
- case ARG_PORT:
- sink->server_port = g_value_get_int (value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_tcp_server_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstTCPServerSink *sink;
-
- g_return_if_fail (GST_IS_TCP_SERVER_SINK (object));
- sink = GST_TCP_SERVER_SINK (object);
-
- switch (prop_id) {
- case ARG_HOST:
- g_value_set_string (value, sink->host);
- break;
- case ARG_PORT:
- g_value_set_int (value, sink->server_port);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-/* create a socket for sending to remote machine */
-static gboolean
-gst_tcp_server_sink_init_send (GstMultiFdSink * parent)
-{
- int ret;
- GstTCPServerSink *this = GST_TCP_SERVER_SINK (parent);
-
- /* create sending server socket */
- if ((this->server_sock.fd = socket (AF_INET, SOCK_STREAM, 0)) == -1)
- goto no_socket;
-
- GST_DEBUG_OBJECT (this, "opened sending server socket with fd %d",
- this->server_sock.fd);
-
- /* make address reusable */
- ret = 1;
- if (setsockopt (this->server_sock.fd, SOL_SOCKET, SO_REUSEADDR,
- (void *) &ret, sizeof (ret)) < 0)
- goto reuse_failed;
-
- /* keep connection alive; avoids SIGPIPE during write */
- ret = 1;
- if (setsockopt (this->server_sock.fd, SOL_SOCKET, SO_KEEPALIVE,
- (void *) &ret, sizeof (ret)) < 0)
- goto keepalive_failed;
-
- /* name the socket */
- memset (&this->server_sin, 0, sizeof (this->server_sin));
- this->server_sin.sin_family = AF_INET; /* network socket */
- this->server_sin.sin_port = htons (this->server_port); /* on port */
- this->server_sin.sin_addr.s_addr = htonl (INADDR_ANY); /* for hosts */
-
- /* bind it */
- GST_DEBUG_OBJECT (this, "binding server socket to address");
- ret = bind (this->server_sock.fd, (struct sockaddr *) &this->server_sin,
- sizeof (this->server_sin));
- if (ret)
- goto bind_failed;
-
- /* set the server socket to nonblocking */
- fcntl (this->server_sock.fd, F_SETFL, O_NONBLOCK);
-
- GST_DEBUG_OBJECT (this, "listening on server socket %d with queue of %d",
- this->server_sock.fd, TCP_BACKLOG);
- if (listen (this->server_sock.fd, TCP_BACKLOG) == -1)
- goto listen_failed;
-
- GST_DEBUG_OBJECT (this,
- "listened on server socket %d, returning from connection setup",
- this->server_sock.fd);
-
- gst_poll_add_fd (parent->fdset, &this->server_sock);
- gst_poll_fd_ctl_read (parent->fdset, &this->server_sock, TRUE);
-
- return TRUE;
-
- /* ERRORS */
-no_socket:
- {
- GST_ELEMENT_ERROR (this, RESOURCE, OPEN_WRITE, (NULL), GST_ERROR_SYSTEM);
- return FALSE;
- }
-reuse_failed:
- {
- gst_tcp_socket_close (&this->server_sock);
- GST_ELEMENT_ERROR (this, RESOURCE, SETTINGS, (NULL),
- ("Could not setsockopt: %s", g_strerror (errno)));
- return FALSE;
- }
-keepalive_failed:
- {
- gst_tcp_socket_close (&this->server_sock);
- GST_ELEMENT_ERROR (this, RESOURCE, SETTINGS, (NULL),
- ("Could not setsockopt: %s", g_strerror (errno)));
- return FALSE;
- }
-listen_failed:
- {
- gst_tcp_socket_close (&this->server_sock);
- GST_ELEMENT_ERROR (this, RESOURCE, OPEN_READ, (NULL),
- ("Could not listen on server socket: %s", g_strerror (errno)));
- return FALSE;
- }
-bind_failed:
- {
- gst_tcp_socket_close (&this->server_sock);
- switch (errno) {
- default:
- GST_ELEMENT_ERROR (this, RESOURCE, OPEN_READ, (NULL),
- ("bind on port %d failed: %s", this->server_port,
- g_strerror (errno)));
- break;
- }
- return FALSE;
- }
-}
-
-static gboolean
-gst_tcp_server_sink_close (GstMultiFdSink * parent)
-{
- GstTCPServerSink *this = GST_TCP_SERVER_SINK (parent);
-
- if (this->server_sock.fd != -1) {
- gst_poll_remove_fd (parent->fdset, &this->server_sock);
-
- close (this->server_sock.fd);
- this->server_sock.fd = -1;
- }
- return TRUE;
-}
diff --git a/gst/tcp/gsttcpserversink.h b/gst/tcp/gsttcpserversink.h
deleted file mode 100644
index ac8846da..00000000
--- a/gst/tcp/gsttcpserversink.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_TCP_SERVER_SINK_H__
-#define __GST_TCP_SERVER_SINK_H__
-
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <arpa/inet.h>
-#include "gstmultifdsink.h"
-
-#define GST_TYPE_TCP_SERVER_SINK \
- (gst_tcp_server_sink_get_type())
-#define GST_TCP_SERVER_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TCP_SERVER_SINK,GstTCPServerSink))
-#define GST_TCP_SERVER_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TCP_SERVER_SINK,GstTCPServerSinkClass))
-#define GST_IS_TCP_SERVER_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TCP_SERVER_SINK))
-#define GST_IS_TCP_SERVER_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TCP_SERVER_SINK))
-
-typedef struct _GstTCPServerSink GstTCPServerSink;
-typedef struct _GstTCPServerSinkClass GstTCPServerSinkClass;
-
-typedef enum {
- GST_TCP_SERVER_SINK_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
-
- GST_TCP_SERVER_SINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2)
-} GstTCPServerSinkFlags;
-
-/**
- * GstTCPServerSink:
- *
- * Opaque data structure.
- */
-struct _GstTCPServerSink {
- GstMultiFdSink element;
-
- /* server information */
- int server_port;
- gchar *host;
- struct sockaddr_in server_sin;
-
- /* socket */
- GstPollFD server_sock;
-};
-
-struct _GstTCPServerSinkClass {
- GstMultiFdSinkClass parent_class;
-};
-
-GType gst_tcp_server_sink_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_TCP_SERVER_SINK_H__ */
diff --git a/gst/tcp/gsttcpserversrc.c b/gst/tcp/gsttcpserversrc.c
deleted file mode 100644
index 1273e0a8..00000000
--- a/gst/tcp/gsttcpserversrc.c
+++ /dev/null
@@ -1,486 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-tcpserversrc
- * @see_also: #tcpserversink
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * # server:
- * gst-launch tcpserversrc protocol=none port=3000 ! fdsink fd=2
- * # client:
- * gst-launch fdsrc fd=1 ! tcpclientsink protocol=none port=3000
- * ]|
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst-i18n-plugin.h>
-#include "gsttcp.h"
-#include "gsttcpserversrc.h"
-#include <string.h> /* memset */
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-
-
-GST_DEBUG_CATEGORY_STATIC (tcpserversrc_debug);
-#define GST_CAT_DEFAULT tcpserversrc_debug
-
-#define TCP_DEFAULT_LISTEN_HOST NULL /* listen on all interfaces */
-#define TCP_BACKLOG 1 /* client connection queue */
-
-
-static const GstElementDetails gst_tcp_server_src_details =
-GST_ELEMENT_DETAILS ("TCP server source",
- "Source/Network",
- "Receive data as a server over the network via TCP",
- "Thomas Vander Stichele <thomas at apestaart dot org>");
-
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-
-enum
-{
- PROP_0,
- PROP_HOST,
- PROP_PORT,
- PROP_PROTOCOL
-};
-
-
-GST_BOILERPLATE (GstTCPServerSrc, gst_tcp_server_src, GstPushSrc,
- GST_TYPE_PUSH_SRC);
-
-
-static void gst_tcp_server_src_finalize (GObject * gobject);
-
-static gboolean gst_tcp_server_src_start (GstBaseSrc * bsrc);
-static gboolean gst_tcp_server_src_stop (GstBaseSrc * bsrc);
-static gboolean gst_tcp_server_src_unlock (GstBaseSrc * bsrc);
-static GstFlowReturn gst_tcp_server_src_create (GstPushSrc * psrc,
- GstBuffer ** buf);
-
-static void gst_tcp_server_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_tcp_server_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-
-static void
-gst_tcp_server_src_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&srctemplate));
-
- gst_element_class_set_details (element_class, &gst_tcp_server_src_details);
-}
-
-static void
-gst_tcp_server_src_class_init (GstTCPServerSrcClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseSrcClass *gstbasesrc_class;
- GstPushSrcClass *gstpush_src_class;
-
- gobject_class = (GObjectClass *) klass;
- gstbasesrc_class = (GstBaseSrcClass *) klass;
- gstpush_src_class = (GstPushSrcClass *) klass;
-
- gobject_class->set_property = gst_tcp_server_src_set_property;
- gobject_class->get_property = gst_tcp_server_src_get_property;
- gobject_class->finalize = gst_tcp_server_src_finalize;
-
- g_object_class_install_property (gobject_class, PROP_HOST,
- g_param_spec_string ("host", "Host", "The hostname to listen as",
- TCP_DEFAULT_LISTEN_HOST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_PORT,
- g_param_spec_int ("port", "Port", "The port to listen to",
- 0, TCP_HIGHEST_PORT, TCP_DEFAULT_PORT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_PROTOCOL,
- g_param_spec_enum ("protocol", "Protocol", "The protocol to wrap data in",
- GST_TYPE_TCP_PROTOCOL, GST_TCP_PROTOCOL_NONE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstbasesrc_class->start = gst_tcp_server_src_start;
- gstbasesrc_class->stop = gst_tcp_server_src_stop;
- gstbasesrc_class->unlock = gst_tcp_server_src_unlock;
-
- gstpush_src_class->create = gst_tcp_server_src_create;
-
- GST_DEBUG_CATEGORY_INIT (tcpserversrc_debug, "tcpserversrc", 0,
- "TCP Server Source");
-}
-
-static void
-gst_tcp_server_src_init (GstTCPServerSrc * src, GstTCPServerSrcClass * g_class)
-{
- src->server_port = TCP_DEFAULT_PORT;
- src->host = g_strdup (TCP_DEFAULT_HOST);
- src->server_sock_fd.fd = -1;
- src->client_sock_fd.fd = -1;
- src->protocol = GST_TCP_PROTOCOL_NONE;
-
- GST_OBJECT_FLAG_UNSET (src, GST_TCP_SERVER_SRC_OPEN);
-}
-
-static void
-gst_tcp_server_src_finalize (GObject * gobject)
-{
- GstTCPServerSrc *src = GST_TCP_SERVER_SRC (gobject);
-
- g_free (src->host);
-
- G_OBJECT_CLASS (parent_class)->finalize (gobject);
-}
-
-static GstFlowReturn
-gst_tcp_server_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
-{
- GstTCPServerSrc *src;
- GstFlowReturn ret = GST_FLOW_OK;
-
- src = GST_TCP_SERVER_SRC (psrc);
-
- if (!GST_OBJECT_FLAG_IS_SET (src, GST_TCP_SERVER_SRC_OPEN))
- goto wrong_state;
-
-restart:
- if (src->client_sock_fd.fd >= 0) {
- /* if we have a client, wait for read */
- gst_poll_fd_ctl_read (src->fdset, &src->server_sock_fd, FALSE);
- gst_poll_fd_ctl_read (src->fdset, &src->client_sock_fd, TRUE);
- } else {
- /* else wait on server socket for connections */
- gst_poll_fd_ctl_read (src->fdset, &src->server_sock_fd, TRUE);
- }
-
- /* no action (0) is an error too in our case */
- if ((ret = gst_poll_wait (src->fdset, GST_CLOCK_TIME_NONE)) <= 0) {
- if (ret == -1 && errno == EBUSY)
- goto select_cancelled;
- else
- goto select_error;
- }
-
- /* if we have no client socket we can accept one now */
- if (src->client_sock_fd.fd < 0) {
- if (gst_poll_fd_can_read (src->fdset, &src->server_sock_fd)) {
- if ((src->client_sock_fd.fd =
- accept (src->server_sock_fd.fd,
- (struct sockaddr *) &src->client_sin,
- &src->client_sin_len)) == -1)
- goto accept_error;
-
- gst_poll_add_fd (src->fdset, &src->client_sock_fd);
- }
- /* and restart now to poll the socket. */
- goto restart;
- }
-
- GST_LOG_OBJECT (src, "asked for a buffer");
-
- switch (src->protocol) {
- case GST_TCP_PROTOCOL_NONE:
- ret = gst_tcp_read_buffer (GST_ELEMENT (src), src->client_sock_fd.fd,
- src->fdset, outbuf);
- break;
-
- case GST_TCP_PROTOCOL_GDP:
- if (!src->caps_received) {
- GstCaps *caps;
- gchar *string;
-
- ret = gst_tcp_gdp_read_caps (GST_ELEMENT (src), src->client_sock_fd.fd,
- src->fdset, &caps);
-
- if (ret == GST_FLOW_WRONG_STATE)
- goto gdp_cancelled;
-
- if (ret != GST_FLOW_OK)
- goto gdp_caps_read_error;
-
- src->caps_received = TRUE;
- string = gst_caps_to_string (caps);
- GST_DEBUG_OBJECT (src, "Received caps through GDP: %s", string);
- g_free (string);
-
- gst_pad_set_caps (GST_BASE_SRC_PAD (psrc), caps);
- }
-
- ret = gst_tcp_gdp_read_buffer (GST_ELEMENT (src), src->client_sock_fd.fd,
- src->fdset, outbuf);
-
- if (ret == GST_FLOW_OK)
- gst_buffer_set_caps (*outbuf, GST_PAD_CAPS (GST_BASE_SRC_PAD (src)));
-
- break;
-
- default:
- /* need to assert as buf == NULL */
- g_assert ("Unhandled protocol type");
- break;
- }
-
- if (ret == GST_FLOW_OK) {
- GST_LOG_OBJECT (src,
- "Returning buffer from _get of size %d, ts %"
- GST_TIME_FORMAT ", dur %" GST_TIME_FORMAT
- ", offset %" G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT,
- GST_BUFFER_SIZE (*outbuf),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (*outbuf)),
- GST_TIME_ARGS (GST_BUFFER_DURATION (*outbuf)),
- GST_BUFFER_OFFSET (*outbuf), GST_BUFFER_OFFSET_END (*outbuf));
- }
-
- return ret;
-
-wrong_state:
- {
- GST_DEBUG_OBJECT (src, "connection to closed, cannot read data");
- return GST_FLOW_WRONG_STATE;
- }
-select_error:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
- ("Select error: %s", g_strerror (errno)));
- return GST_FLOW_ERROR;
- }
-select_cancelled:
- {
- GST_DEBUG_OBJECT (src, "select canceled");
- return GST_FLOW_WRONG_STATE;
- }
-accept_error:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
- ("Could not accept client on server socket: %s", g_strerror (errno)));
- return GST_FLOW_ERROR;
- }
-gdp_cancelled:
- {
- GST_DEBUG_OBJECT (src, "reading gdp canceled");
- return GST_FLOW_WRONG_STATE;
- }
-gdp_caps_read_error:
- {
- /* if we did not get canceled, report an error */
- if (ret != GST_FLOW_WRONG_STATE) {
- GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
- ("Could not read caps through GDP"));
- }
- return ret;
- }
-}
-
-static void
-gst_tcp_server_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstTCPServerSrc *tcpserversrc = GST_TCP_SERVER_SRC (object);
-
- switch (prop_id) {
- case PROP_HOST:
- if (!g_value_get_string (value)) {
- g_warning ("host property cannot be NULL");
- break;
- }
- g_free (tcpserversrc->host);
- tcpserversrc->host = g_strdup (g_value_get_string (value));
- break;
- case PROP_PORT:
- tcpserversrc->server_port = g_value_get_int (value);
- break;
- case PROP_PROTOCOL:
- tcpserversrc->protocol = g_value_get_enum (value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_tcp_server_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstTCPServerSrc *tcpserversrc = GST_TCP_SERVER_SRC (object);
-
- switch (prop_id) {
- case PROP_HOST:
- g_value_set_string (value, tcpserversrc->host);
- break;
- case PROP_PORT:
- g_value_set_int (value, tcpserversrc->server_port);
- break;
- case PROP_PROTOCOL:
- g_value_set_enum (value, tcpserversrc->protocol);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/* set up server */
-static gboolean
-gst_tcp_server_src_start (GstBaseSrc * bsrc)
-{
- int ret;
- GstTCPServerSrc *src = GST_TCP_SERVER_SRC (bsrc);
-
- /* reset caps_received flag */
- src->caps_received = FALSE;
-
- /* create the server listener socket */
- if ((src->server_sock_fd.fd = socket (AF_INET, SOCK_STREAM, 0)) == -1)
- goto socket_error;
-
- GST_DEBUG_OBJECT (src, "opened receiving server socket with fd %d",
- src->server_sock_fd.fd);
-
- /* make address reusable */
- ret = 1;
- if (setsockopt (src->server_sock_fd.fd, SOL_SOCKET, SO_REUSEADDR, &ret,
- sizeof (int)) < 0)
- goto sock_opt;
-
- /* name the socket */
- memset (&src->server_sin, 0, sizeof (src->server_sin));
- src->server_sin.sin_family = AF_INET; /* network socket */
- src->server_sin.sin_port = htons (src->server_port); /* on port */
- if (src->host) {
- gchar *host;
-
- if (!(host = gst_tcp_host_to_ip (GST_ELEMENT (src), src->host)))
- goto host_error;
- src->server_sin.sin_addr.s_addr = inet_addr (host);
- g_free (host);
- } else
- src->server_sin.sin_addr.s_addr = htonl (INADDR_ANY);
-
- /* bind it */
- GST_DEBUG_OBJECT (src, "binding server socket to address");
- if ((ret = bind (src->server_sock_fd.fd, (struct sockaddr *) &src->server_sin,
- sizeof (src->server_sin))) < 0)
- goto bind_error;
-
- GST_DEBUG_OBJECT (src, "listening on server socket %d with queue of %d",
- src->server_sock_fd.fd, TCP_BACKLOG);
-
- if (listen (src->server_sock_fd.fd, TCP_BACKLOG) == -1)
- goto listen_error;
-
- /* create an fdset to keep track of our file descriptors */
- if ((src->fdset = gst_poll_new (TRUE)) == NULL)
- goto socket_pair;
-
- gst_poll_add_fd (src->fdset, &src->server_sock_fd);
-
- GST_DEBUG_OBJECT (src, "received client");
-
- GST_OBJECT_FLAG_SET (src, GST_TCP_SERVER_SRC_OPEN);
-
- return TRUE;
-
- /* ERRORS */
-socket_error:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), GST_ERROR_SYSTEM);
- return FALSE;
- }
-sock_opt:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
- ("Could not setsockopt: %s", g_strerror (errno)));
- gst_tcp_socket_close (&src->server_sock_fd);
- return FALSE;
- }
-host_error:
- {
- gst_tcp_socket_close (&src->server_sock_fd);
- return FALSE;
- }
-bind_error:
- {
- gst_tcp_socket_close (&src->server_sock_fd);
- switch (errno) {
- default:
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
- ("bind failed: %s", g_strerror (errno)));
- break;
- }
- return FALSE;
- }
-listen_error:
- {
- gst_tcp_socket_close (&src->server_sock_fd);
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
- ("Could not listen on server socket: %s", g_strerror (errno)));
- return FALSE;
- }
-socket_pair:
- {
- GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ_WRITE, (NULL),
- GST_ERROR_SYSTEM);
- gst_tcp_socket_close (&src->server_sock_fd);
- return FALSE;
- }
-}
-
-static gboolean
-gst_tcp_server_src_stop (GstBaseSrc * bsrc)
-{
- GstTCPServerSrc *src = GST_TCP_SERVER_SRC (bsrc);
-
- gst_poll_free (src->fdset);
- src->fdset = NULL;
-
- gst_tcp_socket_close (&src->server_sock_fd);
- gst_tcp_socket_close (&src->client_sock_fd);
-
- GST_OBJECT_FLAG_UNSET (src, GST_TCP_SERVER_SRC_OPEN);
-
- return TRUE;
-}
-
-/* will be called only between calls to start() and stop() */
-static gboolean
-gst_tcp_server_src_unlock (GstBaseSrc * bsrc)
-{
- GstTCPServerSrc *src = GST_TCP_SERVER_SRC (bsrc);
-
- gst_poll_set_flushing (src->fdset, TRUE);
-
- return TRUE;
-}
diff --git a/gst/tcp/gsttcpserversrc.h b/gst/tcp/gsttcpserversrc.h
deleted file mode 100644
index 22c7afe2..00000000
--- a/gst/tcp/gsttcpserversrc.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_TCP_SERVER_SRC_H__
-#define __GST_TCP_SERVER_SRC_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstpushsrc.h>
-
-G_END_DECLS
-
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include "gsttcp.h"
-
-#include <fcntl.h>
-
-#define GST_TYPE_TCP_SERVER_SRC \
- (gst_tcp_server_src_get_type())
-#define GST_TCP_SERVER_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TCP_SERVER_SRC,GstTCPServerSrc))
-#define GST_TCP_SERVER_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TCP_SERVER_SRC,GstTCPServerSrcClass))
-#define GST_IS_TCP_SERVER_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TCP_SERVER_SRC))
-#define GST_IS_TCP_SERVER_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TCP_SERVER_SRC))
-
-typedef struct _GstTCPServerSrc GstTCPServerSrc;
-typedef struct _GstTCPServerSrcClass GstTCPServerSrcClass;
-
-typedef enum {
- GST_TCP_SERVER_SRC_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
-
- GST_TCP_SERVER_SRC_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2)
-} GstTCPServerSrcFlags;
-
-struct _GstTCPServerSrc {
- GstPushSrc element;
-
- /* server information */
- int server_port;
- gchar *host;
- struct sockaddr_in server_sin;
- GstPollFD server_sock_fd;
-
- /* client information */
- struct sockaddr_in client_sin;
- socklen_t client_sin_len;
- GstPollFD client_sock_fd;
-
- GstPoll *fdset;
-
- GstTCPProtocol protocol; /* protocol used for reading data */
- gboolean caps_received; /* if we have received caps yet */
-};
-
-struct _GstTCPServerSrcClass {
- GstPushSrcClass parent_class;
-};
-
-GType gst_tcp_server_src_get_type (void);
-
-G_BEGIN_DECLS
-
-#endif /* __GST_TCP_SERVER_SRC_H__ */
diff --git a/gst/tcp/tcp.vcproj b/gst/tcp/tcp.vcproj
deleted file mode 100644
index 4573f336..00000000
--- a/gst/tcp/tcp.vcproj
+++ /dev/null
@@ -1,160 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="avi"
- ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D678D1}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../win32/Debug"
- IntermediateDirectory="../../win32/Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;AVI_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstavi.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Debug;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/avi.pdb"
- SubSystem="2"
- OptimizeReferences="2"
- ImportLibrary="$(OutDir)/gstavi.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../win32/Release"
- IntermediateDirectory="../../win32/Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;AVI_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstavi.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Release;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/gstavi.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath=".\gstavi.c">
- </File>
- <File
- RelativePath=".\gstavidemux.c">
- </File>
- <File
- RelativePath=".\gstavimux.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- <File
- RelativePath=".\avi-ids.h">
- </File>
- <File
- RelativePath=".\gstavidemux.h">
- </File>
- <File
- RelativePath=".\gstavimux.h">
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/gst/typefind/Makefile.am b/gst/typefind/Makefile.am
deleted file mode 100644
index 131c4b22..00000000
--- a/gst/typefind/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-plugin_LTLIBRARIES = libgsttypefindfunctions.la
-
-libgsttypefindfunctions_la_SOURCES = gsttypefindfunctions.c
-libgsttypefindfunctions_la_CFLAGS = $(GST_CFLAGS) $(GIO_CFLAGS)
-libgsttypefindfunctions_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgsttypefindfunctions_la_LIBADD = $(GST_LIBS) $(GIO_LIBS)
-libgsttypefindfunctions_la_LIBTOOLFLAGS = --tag=disable-static
-
diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c
deleted file mode 100644
index a15eb174..00000000
--- a/gst/typefind/gsttypefindfunctions.c
+++ /dev/null
@@ -1,3930 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- * Copyright (C) 2005-2009 Tim-Philipp Müller <tim centricular net>
- * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
- *
- * gsttypefindfunctions.c: collection of various typefind 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <glib.h>
-
-/* don't want to add gio xdgmime typefinder if gio was disabled via configure */
-#ifdef HAVE_GIO
-#include <gio/gio.h>
-#define USE_GIO
-#endif
-
-#include <gst/gsttypefind.h>
-#include <gst/gstelement.h>
-#include <gst/gstversion.h>
-#include <gst/gstinfo.h>
-#include <gst/gstutils.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-
-GST_DEBUG_CATEGORY_STATIC (type_find_debug);
-#define GST_CAT_DEFAULT type_find_debug
-
-/* DataScanCtx: helper for typefind functions that scan through data
- * step-by-step, to avoid doing a peek at each and every offset */
-
-#define DATA_SCAN_CTX_CHUNK_SIZE 4096
-
-typedef struct
-{
- guint64 offset;
- const guint8 *data;
- gint size;
-} DataScanCtx;
-
-static inline void
-data_scan_ctx_advance (GstTypeFind * tf, DataScanCtx * c, guint bytes_to_skip)
-{
- c->offset += bytes_to_skip;
- if (G_LIKELY (c->size > bytes_to_skip)) {
- c->size -= bytes_to_skip;
- c->data += bytes_to_skip;
- } else {
- c->data += c->size;
- c->size = 0;
- }
-}
-
-static inline gboolean
-data_scan_ctx_ensure_data (GstTypeFind * tf, DataScanCtx * c, gint min_len)
-{
- const guint8 *data;
- guint64 len;
- guint chunk_len = MAX (DATA_SCAN_CTX_CHUNK_SIZE, min_len);
-
- if (G_LIKELY (c->size >= min_len))
- return TRUE;
-
- data = gst_type_find_peek (tf, c->offset, chunk_len);
- if (G_LIKELY (data != NULL)) {
- c->data = data;
- c->size = chunk_len;
- return TRUE;
- }
-
- /* if there's less than our chunk size, try to get as much as we can, but
- * always at least min_len bytes (we might be typefinding the first buffer
- * of the stream and not have as much data available as we'd like) */
- len = gst_type_find_get_length (tf);
- if (len > 0) {
- len = CLAMP (len - c->offset, min_len, chunk_len);
- } else {
- len = min_len;
- }
-
- data = gst_type_find_peek (tf, c->offset, len);
- if (data != NULL) {
- c->data = data;
- c->size = len;
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*** text/plain ***/
-static gboolean xml_check_first_element (GstTypeFind * tf,
- const gchar * element, guint elen, gboolean strict);
-static gboolean sdp_check_header (GstTypeFind * tf);
-
-static GstStaticCaps utf8_caps = GST_STATIC_CAPS ("text/plain");
-
-#define UTF8_CAPS gst_static_caps_get(&utf8_caps)
-
-static gboolean
-utf8_type_find_have_valid_utf8_at_offset (GstTypeFind * tf, guint64 offset,
- GstTypeFindProbability * prob)
-{
- guint8 *data;
-
- /* randomly decided values */
- guint min_size = 16; /* minimum size */
- guint size = 32 * 1024; /* starting size */
- guint probability = 95; /* starting probability */
- guint step = 10; /* how much we reduce probability in each
- * iteration */
-
- while (probability > step && size > min_size) {
- data = gst_type_find_peek (tf, offset, size);
- if (data) {
- gchar *end;
- gchar *start = (gchar *) data;
-
- if (g_utf8_validate (start, size, (const gchar **) &end) || (end - start + 4 > size)) { /* allow last char to be cut off */
- *prob = probability;
- return TRUE;
- }
- *prob = 0;
- return FALSE;
- }
- size /= 2;
- probability -= step;
- }
- *prob = 0;
- return FALSE;
-}
-
-static void
-utf8_type_find (GstTypeFind * tf, gpointer unused)
-{
- GstTypeFindProbability start_prob, mid_prob;
- guint64 length;
-
- /* leave xml to the xml typefinders */
- if (xml_check_first_element (tf, "", 0, TRUE))
- return;
-
- /* leave sdp to the sdp typefinders */
- if (sdp_check_header (tf))
- return;
-
- /* check beginning of stream */
- if (!utf8_type_find_have_valid_utf8_at_offset (tf, 0, &start_prob))
- return;
-
- GST_LOG ("start is plain text with probability of %u", start_prob);
-
- /* POSSIBLE is the highest probability we ever return if we can't
- * probe into the middle of the file and don't know its length */
-
- length = gst_type_find_get_length (tf);
- if (length == 0 || length == (guint64) - 1) {
- gst_type_find_suggest (tf, MIN (start_prob, GST_TYPE_FIND_POSSIBLE),
- UTF8_CAPS);
- return;
- }
-
- if (length < 64 * 1024) {
- gst_type_find_suggest (tf, start_prob, UTF8_CAPS);
- return;
- }
-
- /* check middle of stream */
- if (!utf8_type_find_have_valid_utf8_at_offset (tf, length / 2, &mid_prob))
- return;
-
- GST_LOG ("middle is plain text with probability of %u", mid_prob);
- gst_type_find_suggest (tf, (start_prob + mid_prob) / 2, UTF8_CAPS);
-}
-
-/*** text/uri-list ***/
-
-static GstStaticCaps uri_caps = GST_STATIC_CAPS ("text/uri-list");
-
-#define URI_CAPS (gst_static_caps_get(&uri_caps))
-#define BUFFER_SIZE 16 /* If the string is < 16 bytes we're screwed */
-#define INC_BUFFER { \
- pos++; \
- if (pos == BUFFER_SIZE) { \
- pos = 0; \
- offset += BUFFER_SIZE; \
- data = gst_type_find_peek (tf, offset, BUFFER_SIZE); \
- if (data == NULL) return; \
- } else { \
- data++; \
- } \
-}
-static void
-uri_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, BUFFER_SIZE);
- guint pos = 0;
- guint offset = 0;
-
- if (data) {
- /* Search for # comment lines */
- while (*data == '#') {
- /* Goto end of line */
- while (*data != '\n') {
- INC_BUFFER;
- }
-
- INC_BUFFER;
- }
-
- if (!g_ascii_isalpha (*data)) {
- /* Had a non alpha char - can't be uri-list */
- return;
- }
-
- INC_BUFFER;
-
- while (g_ascii_isalnum (*data)) {
- INC_BUFFER;
- }
-
- if (*data != ':') {
- /* First non alpha char is not a : */
- return;
- }
-
- /* Get the next 2 bytes as well */
- data = gst_type_find_peek (tf, offset + pos, 3);
- if (data == NULL)
- return;
-
- if (data[1] != '/' && data[2] != '/') {
- return;
- }
-
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, URI_CAPS);
- }
-}
-
-
-/*** application/xml **********************************************************/
-
-#define XML_BUFFER_SIZE 16
-#define XML_INC_BUFFER { \
- pos++; \
- if (pos == XML_BUFFER_SIZE) { \
- pos = 0; \
- offset += XML_BUFFER_SIZE; \
- data = gst_type_find_peek (tf, offset, XML_BUFFER_SIZE); \
- if (data == NULL) return FALSE; \
- } else { \
- data++; \
- } \
-}
-
-static gboolean
-xml_check_first_element (GstTypeFind * tf, const gchar * element, guint elen,
- gboolean strict)
-{
- gboolean got_xmldec;
- guint8 *data;
- guint offset = 0;
- guint pos = 0;
-
- data = gst_type_find_peek (tf, 0, XML_BUFFER_SIZE);
- if (!data)
- return FALSE;
-
- /* look for the XMLDec
- * see XML spec 2.8, Prolog and Document Type Declaration
- * http://www.w3.org/TR/2004/REC-xml-20040204/#sec-prolog-dtd */
- got_xmldec = (memcmp (data, "<?xml", 5) == 0);
-
- if (strict && !got_xmldec)
- return FALSE;
-
- /* skip XMLDec in any case if we've got one */
- if (got_xmldec) {
- pos += 5;
- data += 5;
- }
-
- /* look for the first element, it has to be the requested element. Bail
- * out if it is not within the first 4kB. */
- while (data && (offset + pos) < 4096) {
- while (*data != '<' && (offset + pos) < 4096) {
- XML_INC_BUFFER;
- }
-
- XML_INC_BUFFER;
- if (!g_ascii_isalpha (*data)) {
- /* if not alphabetic, it's a PI or an element / attribute declaration
- * like <?xxx or <!xxx */
- XML_INC_BUFFER;
- continue;
- }
-
- /* the first normal element, check if it's the one asked for */
- data = gst_type_find_peek (tf, offset + pos, elen + 1);
- return (data && element && strncmp ((char *) data, element, elen) == 0);
- }
-
- return FALSE;
-}
-
-static GstStaticCaps generic_xml_caps = GST_STATIC_CAPS ("application/xml");
-
-#define GENERIC_XML_CAPS (gst_static_caps_get(&generic_xml_caps))
-static void
-xml_type_find (GstTypeFind * tf, gpointer unused)
-{
- if (xml_check_first_element (tf, "", 0, TRUE)) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MINIMUM, GENERIC_XML_CAPS);
- }
-}
-
-/*** application/sdp *********************************************************/
-
-static GstStaticCaps sdp_caps = GST_STATIC_CAPS ("application/sdp");
-
-#define SDP_CAPS (gst_static_caps_get(&sdp_caps))
-static gboolean
-sdp_check_header (GstTypeFind * tf)
-{
- guint8 *data;
-
- data = gst_type_find_peek (tf, 0, 5);
- if (!data)
- return FALSE;
-
- /* sdp must start with v=0[\r]\n */
- if (memcmp (data, "v=0", 3))
- return FALSE;
-
- if (data[3] == '\r' && data[4] == '\n')
- return TRUE;
- if (data[3] == '\n')
- return TRUE;
-
- return FALSE;
-}
-
-static void
-sdp_type_find (GstTypeFind * tf, gpointer unused)
-{
- if (sdp_check_header (tf))
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SDP_CAPS);
-}
-
-/*** application/smil *********************************************************/
-
-static GstStaticCaps smil_caps = GST_STATIC_CAPS ("application/smil");
-
-#define SMIL_CAPS (gst_static_caps_get(&smil_caps))
-static void
-smil_type_find (GstTypeFind * tf, gpointer unused)
-{
- if (xml_check_first_element (tf, "smil", 4, FALSE)) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SMIL_CAPS);
- }
-}
-
-/*** text/html ***/
-
-static GstStaticCaps html_caps = GST_STATIC_CAPS ("text/html");
-
-#define HTML_CAPS gst_static_caps_get (&html_caps)
-
-static void
-html_type_find (GstTypeFind * tf, gpointer unused)
-{
- gchar *d, *data;
-
- data = (gchar *) gst_type_find_peek (tf, 0, 16);
- if (!data)
- return;
-
- if (!g_ascii_strncasecmp (data, "<!DOCTYPE HTML", 14)) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, HTML_CAPS);
- } else if (xml_check_first_element (tf, "html", 4, FALSE)) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, HTML_CAPS);
- } else if ((d = memchr (data, '<', 16))) {
- data = (gchar *) gst_type_find_peek (tf, d - data, 6);
- if (data && g_ascii_strncasecmp (data, "<html>", 6) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, HTML_CAPS);
- }
- }
-}
-
-/*** audio/midi ***/
-
-static GstStaticCaps mid_caps = GST_STATIC_CAPS ("audio/midi");
-
-#define MID_CAPS gst_static_caps_get(&mid_caps)
-static void
-mid_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
-
- /* http://jedi.ks.uiuc.edu/~johns/links/music/midifile.html */
- if (data && data[0] == 'M' && data[1] == 'T' && data[2] == 'h'
- && data[3] == 'd')
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MID_CAPS);
-}
-
-/*** audio/mobile-xmf ***/
-
-static GstStaticCaps mxmf_caps = GST_STATIC_CAPS ("audio/mobile-xmf");
-
-#define MXMF_CAPS gst_static_caps_get(&mxmf_caps)
-static void
-mxmf_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = NULL;
-
- /* Search FileId "XMF_" 4 bytes */
- data = gst_type_find_peek (tf, 0, 4);
- if (data && data[0] == 'X' && data[1] == 'M' && data[2] == 'F'
- && data[3] == '_') {
- /* Search Format version "2.00" 4 bytes */
- data = gst_type_find_peek (tf, 4, 4);
- if (data && data[0] == '2' && data[1] == '.' && data[2] == '0'
- && data[3] == '0') {
- /* Search TypeId 2 1 byte */
- data = gst_type_find_peek (tf, 11, 1);
- if (data && data[0] == 2) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MXMF_CAPS);
- }
- }
- }
-}
-
-
-/*** video/x-fli ***/
-
-static GstStaticCaps flx_caps = GST_STATIC_CAPS ("video/x-fli");
-
-#define FLX_CAPS gst_static_caps_get(&flx_caps)
-static void
-flx_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 134);
-
- if (data) {
- /* check magic and the frame type of the first frame */
- if ((data[4] == 0x11 || data[4] == 0x12 ||
- data[4] == 0x30 || data[4] == 0x44) &&
- data[5] == 0xaf &&
- ((data[132] == 0x00 || data[132] == 0xfa) && data[133] == 0xf1)) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, FLX_CAPS);
- }
- return;
- }
- data = gst_type_find_peek (tf, 0, 6);
- if (data) {
- /* check magic only */
- if ((data[4] == 0x11 || data[4] == 0x12 ||
- data[4] == 0x30 || data[4] == 0x44) && data[5] == 0xaf) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, FLX_CAPS);
- }
- return;
- }
-}
-
-/*** application/x-id3 ***/
-
-static GstStaticCaps id3_caps = GST_STATIC_CAPS ("application/x-id3");
-
-#define ID3_CAPS gst_static_caps_get(&id3_caps)
-static void
-id3v2_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 10);
-
- if (data && memcmp (data, "ID3", 3) == 0 &&
- data[3] != 0xFF && data[4] != 0xFF &&
- (data[6] & 0x80) == 0 && (data[7] & 0x80) == 0 &&
- (data[8] & 0x80) == 0 && (data[9] & 0x80) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, ID3_CAPS);
- }
-}
-
-static void
-id3v1_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, -128, 3);
-
- if (data && memcmp (data, "TAG", 3) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, ID3_CAPS);
- }
-}
-
-/*** application/x-ape ***/
-
-static GstStaticCaps apetag_caps = GST_STATIC_CAPS ("application/x-apetag");
-
-#define APETAG_CAPS gst_static_caps_get(&apetag_caps)
-static void
-apetag_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data;
-
- /* APEv1/2 at start of file */
- data = gst_type_find_peek (tf, 0, 8);
- if (data && !memcmp (data, "APETAGEX", 8)) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, APETAG_CAPS);
- return;
- }
-
- /* APEv1/2 at end of file */
- data = gst_type_find_peek (tf, -32, 8);
- if (data && !memcmp (data, "APETAGEX", 8)) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, APETAG_CAPS);
- return;
- }
-}
-
-/*** audio/x-ttafile ***/
-
-static GstStaticCaps tta_caps = GST_STATIC_CAPS ("audio/x-ttafile");
-
-#define TTA_CAPS gst_static_caps_get(&tta_caps)
-static void
-tta_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 3);
-
- if (data) {
- if (memcmp (data, "TTA", 3) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, TTA_CAPS);
- return;
- }
- }
-}
-
-/*** audio/x-flac ***/
-static GstStaticCaps flac_caps = GST_STATIC_CAPS ("audio/x-flac");
-
-#define FLAC_CAPS (gst_static_caps_get(&flac_caps))
-
-static void
-flac_type_find (GstTypeFind * tf, gpointer unused)
-{
- DataScanCtx c = { 0, NULL, 0 };
-
- if (G_UNLIKELY (!data_scan_ctx_ensure_data (tf, &c, 4)))
- return;
-
- /* standard flac (also old/broken flac-in-ogg with an initial 4-byte marker
- * packet and without the usual packet framing) */
- if (memcmp (c.data, "fLaC", 4) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, FLAC_CAPS);
- return;
- }
-
- if (G_UNLIKELY (!data_scan_ctx_ensure_data (tf, &c, 6)))
- return;
-
- /* flac-in-ogg, see http://flac.sourceforge.net/ogg_mapping.html */
- if (memcmp (c.data, "\177FLAC\001", 6) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, FLAC_CAPS);
- return;
- }
-
-/* disabled because it happily typefinds /dev/urandom as audio/x-flac, and
- * because I yet have to see header-less flac in the wild */
-#if 0
- /* flac without headers (subset format) */
- /* 64K should be enough */
- while (c.offset < (64 * 1024)) {
- if (G_UNLIKELY (!data_scan_ctx_ensure_data (tf, &c, 4)))
- break;
-
- /* look for frame header,
- * http://flac.sourceforge.net/format.html#frame_header
- */
- if (c.data[0] == 0xff && (c.data[1] >> 2) == 0x3e) {
- /* bit 15 in the header must be 0 */
- if (((c.data[1] >> 1) & 0x01) == 0x01)
- goto advance;
-
- /* blocksize must be != 0x00 */
- if ((c.data[2] >> 4) == 0x00)
- goto advance;
-
- /* samplerate must be != 0x0f */
- if ((c.data[2] & 0x0f) == 0x0f)
- goto advance;
- /* also 0 is invalid, as it means get the info from the header and we
- * don't have headers if we are here */
- if ((c.data[2] & 0x0f) == 0x00)
- goto advance;
-
- /* channel assignment must be < 11 */
- if ((c.data[3] >> 4) >= 11)
- goto advance;
-
- /* sample size must be != 0x07 and != 0x05 */
- if (((c.data[3] >> 1) & 0x07) == 0x07)
- goto advance;
- if (((c.data[3] >> 1) & 0x07) == 0x05)
- goto advance;
- /* also 0 is invalid, as it means get the info from the header and we
- * don't have headers if we are here */
- if (((c.data[3] >> 1) & 0x07) == 0x00)
- goto advance;
-
- /* next bit must be 0 */
- if ((c.data[3] & 0x01) == 0x01)
- goto advance;
-
- /* FIXME: shouldn't we include the crc check ? */
-
- GST_DEBUG ("Found flac without headers at %d", (gint) c.offset);
- gst_type_find_suggest (tf, GST_TYPE_FIND_POSSIBLE, FLAC_CAPS);
- return;
- }
- advance:
- data_scan_ctx_advance (tf, &c, 1);
- }
-#endif
-}
-
-/*** audio/mpeg version 2, 4 ***/
-
-static GstStaticCaps aac_caps = GST_STATIC_CAPS ("audio/mpeg, "
- "mpegversion = (int) { 2, 4 }, framed = (bool) false");
-#define AAC_CAPS (gst_static_caps_get(&aac_caps))
-#define AAC_AMOUNT (4096)
-static void
-aac_type_find (GstTypeFind * tf, gpointer unused)
-{
- DataScanCtx c = { 0, NULL, 0 };
-
- while (c.offset < AAC_AMOUNT) {
- guint snc, len;
-
- /* detect adts header or adif header.
- * The ADIF header is 4 bytes, that should be OK. The ADTS header, on
- * the other hand, is 14 bits only, so we require one valid frame with
- * again a valid syncpoint on the next one (28 bits) for certainty. We
- * require 4 kB, which is quite a lot, since frames are generally 200-400
- * bytes.
- */
- if (G_UNLIKELY (!data_scan_ctx_ensure_data (tf, &c, 6)))
- break;
-
- snc = GST_READ_UINT16_BE (c.data);
- if (G_UNLIKELY ((snc & 0xfff6) == 0xfff0)) {
- /* ADTS header - find frame length */
- GST_DEBUG ("Found one ADTS syncpoint at offset 0x%" G_GINT64_MODIFIER
- "x, tracing next...", c.offset);
- len = ((c.data[3] & 0x03) << 11) |
- (c.data[4] << 3) | ((c.data[5] & 0xe0) >> 5);
-
- if (len == 0 || !data_scan_ctx_ensure_data (tf, &c, len + 2)) {
- GST_DEBUG ("Wrong sync or next frame not within reach, len=%u", len);
- goto next;
- }
-
- snc = GST_READ_UINT16_BE (c.data + len);
- if ((snc & 0xfff6) == 0xfff0) {
- gint mpegversion;
-
- mpegversion = (c.data[1] & 0x08) ? 2 : 4;
- GST_DEBUG ("Found second ADTS-%d syncpoint at offset 0x%"
- G_GINT64_MODIFIER "x, framelen %u", mpegversion, c.offset, len);
- gst_type_find_suggest_simple (tf, GST_TYPE_FIND_LIKELY, "audio/mpeg",
- "framed", G_TYPE_BOOLEAN, FALSE,
- "mpegversion", G_TYPE_INT, mpegversion,
- "stream-type", G_TYPE_STRING, "adts", NULL);
- break;
- }
-
- GST_DEBUG ("No next frame found... (should have been at 0x%x)", len);
- } else if (!memcmp (c.data, "ADIF", 4)) {
- /* ADIF header */
- gst_type_find_suggest_simple (tf, GST_TYPE_FIND_LIKELY, "audio/mpeg",
- "framed", G_TYPE_BOOLEAN, FALSE, "mpegversion", G_TYPE_INT, 4,
- "stream-format", G_TYPE_STRING, "adif", NULL);
- break;
- }
-
- next:
-
- data_scan_ctx_advance (tf, &c, 1);
- }
-}
-
-/*** audio/mpeg version 1 ***/
-
-/*
- * The chance that random data is identified as a valid mp3 header is 63 / 2^18
- * (0.024%) per try. This makes the function for calculating false positives
- * 1 - (1 - ((63 / 2 ^18) ^ GST_MP3_TYPEFIND_MIN_HEADERS)) ^ buffersize)
- * This has the following probabilities of false positives:
- * datasize MIN_HEADERS
- * (bytes) 1 2 3 4
- * 4096 62.6% 0.02% 0% 0%
- * 16384 98% 0.09% 0% 0%
- * 1 MiB 100% 5.88% 0% 0%
- * 1 GiB 100% 100% 1.44% 0%
- * 1 TiB 100% 100% 100% 0.35%
- * This means that the current choice (3 headers by most of the time 4096 byte
- * buffers is pretty safe for now.
- *
- * The max. size of each frame is 1440 bytes, which means that for N frames to
- * be detected, we need 1440 * GST_MP3_TYPEFIND_MIN_HEADERS + 3 bytes of data.
- * Assuming we step into the stream right after the frame header, this
- * means we need 1440 * (GST_MP3_TYPEFIND_MIN_HEADERS + 1) - 1 + 3 bytes
- * of data (5762) to always detect any mp3.
- */
-
-static const guint mp3types_bitrates[2][3][16] =
- { {{0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448,},
- {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384,},
- {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320,}},
-{{0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256,},
- {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,},
- {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,}},
-};
-
-static const guint mp3types_freqs[3][3] = { {11025, 12000, 8000},
-{22050, 24000, 16000},
-{44100, 48000, 32000}
-};
-
-static inline guint
-mp3_type_frame_length_from_header (guint32 header, guint * put_layer,
- guint * put_channels, guint * put_bitrate, guint * put_samplerate,
- gboolean * may_be_free_format, gint possible_free_framelen)
-{
- guint bitrate, layer, length, mode, samplerate, version, channels;
-
- if ((header & 0xffe00000) != 0xffe00000)
- return 0;
-
- /* we don't need extension, copyright, original or
- * emphasis for the frame length */
- header >>= 6;
-
- /* mode */
- mode = header & 0x3;
- header >>= 3;
-
- /* padding */
- length = header & 0x1;
- header >>= 1;
-
- /* sampling frequency */
- samplerate = header & 0x3;
- if (samplerate == 3)
- return 0;
- header >>= 2;
-
- /* bitrate index */
- bitrate = header & 0xF;
- if (bitrate == 0 && possible_free_framelen == -1) {
- GST_LOG ("Possibly a free format mp3 - signalling");
- *may_be_free_format = TRUE;
- }
- if (bitrate == 15 || (bitrate == 0 && possible_free_framelen == -1))
- return 0;
-
- /* ignore error correction, too */
- header >>= 5;
-
- /* layer */
- layer = 4 - (header & 0x3);
- if (layer == 4)
- return 0;
- header >>= 2;
-
- /* version 0=MPEG2.5; 2=MPEG2; 3=MPEG1 */
- version = header & 0x3;
- if (version == 1)
- return 0;
-
- /* lookup */
- channels = (mode == 3) ? 1 : 2;
- samplerate = mp3types_freqs[version > 0 ? version - 1 : 0][samplerate];
- if (bitrate == 0) {
- if (layer == 1) {
- length *= 4;
- length += possible_free_framelen;
- bitrate = length * samplerate / 48000;
- } else {
- length += possible_free_framelen;
- bitrate = length * samplerate /
- ((layer == 3 && version != 3) ? 72000 : 144000);
- }
- } else {
- /* calculating */
- bitrate = mp3types_bitrates[version == 3 ? 0 : 1][layer - 1][bitrate];
- if (layer == 1) {
- length = ((12000 * bitrate / samplerate) + length) * 4;
- } else {
- length += ((layer == 3
- && version != 3) ? 72000 : 144000) * bitrate / samplerate;
- }
- }
-
- GST_LOG ("mp3typefind: calculated mp3 frame length of %u bytes", length);
- GST_LOG
- ("mp3typefind: samplerate = %u - bitrate = %u - layer = %u - version = %u"
- " - channels = %u", samplerate, bitrate, layer, version, channels);
-
- if (put_layer)
- *put_layer = layer;
- if (put_channels)
- *put_channels = channels;
- if (put_bitrate)
- *put_bitrate = bitrate;
- if (put_samplerate)
- *put_samplerate = samplerate;
-
- return length;
-}
-
-
-static GstStaticCaps mp3_caps = GST_STATIC_CAPS ("audio/mpeg, "
- "mpegversion = (int) 1, layer = (int) [ 1, 3 ]");
-#define MP3_CAPS (gst_static_caps_get(&mp3_caps))
-/*
- * random values for typefinding
- * if no more data is available, we will return a probability of
- * (found_headers/TRY_HEADERS) * (MAXIMUM * (TRY_SYNC - bytes_skipped)
- * / TRY_SYNC)
- * if found_headers >= MIN_HEADERS
- */
-#define GST_MP3_TYPEFIND_MIN_HEADERS (2)
-#define GST_MP3_TYPEFIND_TRY_HEADERS (5)
-#define GST_MP3_TYPEFIND_TRY_SYNC (GST_TYPE_FIND_MAXIMUM * 100) /* 10kB */
-#define GST_MP3_TYPEFIND_SYNC_SIZE (2048)
-#define GST_MP3_WRONG_HEADER (10)
-
-static void
-mp3_type_find_at_offset (GstTypeFind * tf, guint64 start_off,
- guint * found_layer, GstTypeFindProbability * found_prob)
-{
- guint8 *data = NULL;
- guint8 *data_end = NULL;
- guint size;
- guint64 skipped;
- gint last_free_offset = -1;
- gint last_free_framelen = -1;
- gboolean headerstart = TRUE;
-
- *found_layer = 0;
- *found_prob = 0;
-
- size = 0;
- skipped = 0;
- while (skipped < GST_MP3_TYPEFIND_TRY_SYNC) {
- if (size <= 0) {
- size = GST_MP3_TYPEFIND_SYNC_SIZE * 2;
- do {
- size /= 2;
- data = gst_type_find_peek (tf, skipped + start_off, size);
- } while (size > 10 && !data);
- if (!data)
- break;
- data_end = data + size;
- }
- if (*data == 0xFF) {
- guint8 *head_data = NULL;
- guint layer = 0, bitrate, samplerate, channels;
- guint found = 0; /* number of valid headers found */
- guint64 offset = skipped;
-
- while (found < GST_MP3_TYPEFIND_TRY_HEADERS) {
- guint32 head;
- guint length;
- guint prev_layer = 0, prev_bitrate = 0;
- guint prev_channels = 0, prev_samplerate = 0;
- gboolean free = FALSE;
-
- if ((gint64) (offset - skipped + 4) >= 0 &&
- data + offset - skipped + 4 < data_end) {
- head_data = data + offset - skipped;
- } else {
- head_data = gst_type_find_peek (tf, offset + start_off, 4);
- }
- if (!head_data)
- break;
- head = GST_READ_UINT32_BE (head_data);
- if (!(length = mp3_type_frame_length_from_header (head, &layer,
- &channels, &bitrate, &samplerate, &free,
- last_free_framelen))) {
- if (free) {
- if (last_free_offset == -1)
- last_free_offset = offset;
- else {
- last_free_framelen = offset - last_free_offset;
- offset = last_free_offset;
- continue;
- }
- } else {
- last_free_framelen = -1;
- }
-
- /* Mark the fact that we didn't find a valid header at the beginning */
- if (found == 0)
- headerstart = FALSE;
-
- GST_LOG ("%d. header at offset %" G_GUINT64_FORMAT
- " (0x%" G_GINT64_MODIFIER "x) was not an mp3 header "
- "(possibly-free: %s)", found + 1, start_off + offset,
- start_off + offset, free ? "yes" : "no");
- break;
- }
- if ((prev_layer && prev_layer != layer) ||
- /* (prev_bitrate && prev_bitrate != bitrate) || <-- VBR */
- (prev_samplerate && prev_samplerate != samplerate) ||
- (prev_channels && prev_channels != channels)) {
- /* this means an invalid property, or a change, which might mean
- * that this is not a mp3 but just a random bytestream. It could
- * be a freaking funky encoded mp3 though. We'll just not count
- * this header*/
- prev_layer = layer;
- prev_bitrate = bitrate;
- prev_channels = channels;
- prev_samplerate = samplerate;
- } else {
- found++;
- GST_LOG ("found %d. header at offset %" G_GUINT64_FORMAT " (0x%"
- G_GINT64_MODIFIER "X)", found, start_off + offset,
- start_off + offset);
- }
- offset += length;
- }
- g_assert (found <= GST_MP3_TYPEFIND_TRY_HEADERS);
- if (head_data == NULL &&
- gst_type_find_peek (tf, offset + start_off - 1, 1) == NULL)
- /* Incomplete last frame - don't count it. */
- found--;
- if (found == GST_MP3_TYPEFIND_TRY_HEADERS ||
- (found >= GST_MP3_TYPEFIND_MIN_HEADERS && head_data == NULL)) {
- /* we can make a valid guess */
- guint probability = found * GST_TYPE_FIND_MAXIMUM *
- (GST_MP3_TYPEFIND_TRY_SYNC - skipped) /
- GST_MP3_TYPEFIND_TRY_HEADERS / GST_MP3_TYPEFIND_TRY_SYNC;
-
- if (!headerstart
- && probability > (GST_TYPE_FIND_MINIMUM + GST_MP3_WRONG_HEADER))
- probability -= GST_MP3_WRONG_HEADER;
- if (probability < GST_TYPE_FIND_MINIMUM)
- probability = GST_TYPE_FIND_MINIMUM;
- if (start_off > 0)
- probability /= 2;
-
- GST_INFO
- ("audio/mpeg calculated %u = %u * %u / %u * (%u - %"
- G_GUINT64_FORMAT ") / %u", probability, GST_TYPE_FIND_MAXIMUM,
- found, GST_MP3_TYPEFIND_TRY_HEADERS, GST_MP3_TYPEFIND_TRY_SYNC,
- (guint64) skipped, GST_MP3_TYPEFIND_TRY_SYNC);
- /* make sure we're not id3 tagged */
- head_data = gst_type_find_peek (tf, -128, 3);
- if (head_data && (memcmp (head_data, "TAG", 3) == 0)) {
- probability = 0;
- }
- g_assert (probability <= GST_TYPE_FIND_MAXIMUM);
-
- *found_prob = probability;
- if (probability > 0)
- *found_layer = layer;
- return;
- }
- }
- data++;
- skipped++;
- size--;
- }
-}
-
-static void
-mp3_type_find (GstTypeFind * tf, gpointer unused)
-{
- GstTypeFindProbability prob, mid_prob;
- guint8 *data;
- guint layer, mid_layer;
- guint64 length;
-
- mp3_type_find_at_offset (tf, 0, &layer, &prob);
- length = gst_type_find_get_length (tf);
-
- if (length == 0 || length == (guint64) - 1) {
- if (prob != 0)
- goto suggest;
- return;
- }
-
- /* if we're pretty certain already, skip the additional check */
- if (prob >= GST_TYPE_FIND_LIKELY)
- goto suggest;
-
- mp3_type_find_at_offset (tf, length / 2, &mid_layer, &mid_prob);
-
- if (mid_prob > 0) {
- if (prob == 0) {
- GST_LOG ("detected audio/mpeg only in the middle (p=%u)", mid_prob);
- layer = mid_layer;
- prob = mid_prob;
- goto suggest;
- }
-
- if (layer != mid_layer) {
- GST_WARNING ("audio/mpeg layer discrepancy: %u vs. %u", layer, mid_layer);
- return; /* FIXME: or should we just go with the one in the middle? */
- }
-
- /* detected mpeg audio both in middle of the file and at the start */
- prob = (prob + mid_prob) / 2;
- goto suggest;
- }
-
- /* let's see if there's a valid header right at the start */
- data = gst_type_find_peek (tf, 0, 4); /* use min. frame size? */
- if (data && mp3_type_frame_length_from_header (GST_READ_UINT32_BE (data),
- &layer, NULL, NULL, NULL, NULL, 0) != 0) {
- if (prob == 0)
- prob = GST_TYPE_FIND_POSSIBLE - 10;
- else
- prob = MAX (GST_TYPE_FIND_POSSIBLE - 10, prob + 10);
- }
-
- if (prob > 0)
- goto suggest;
-
- return;
-
-suggest:
- {
- g_return_if_fail (layer >= 1 && layer <= 3);
-
- gst_type_find_suggest_simple (tf, prob, "audio/mpeg",
- "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, layer, NULL);
- }
-}
-
-/*** audio/x-musepack ***/
-
-static GstStaticCaps musepack_caps =
-GST_STATIC_CAPS ("audio/x-musepack, streamversion= (int) { 7, 8 }");
-
-#define MUSEPACK_CAPS (gst_static_caps_get(&musepack_caps))
-static void
-musepack_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
- GstTypeFindProbability prop = GST_TYPE_FIND_MINIMUM;
- gint streamversion = -1;
-
- if (data && memcmp (data, "MP+", 3) == 0) {
- streamversion = 7;
- if ((data[3] & 0x7f) == 7) {
- prop = GST_TYPE_FIND_MAXIMUM;
- } else {
- prop = GST_TYPE_FIND_LIKELY + 10;
- }
- } else if (data && memcmp (data, "MPCK", 4) == 0) {
- streamversion = 8;
- prop = GST_TYPE_FIND_MAXIMUM;
- }
-
- if (streamversion != -1) {
- gst_type_find_suggest_simple (tf, prop, "audio/x-musepack",
- "streamversion", G_TYPE_INT, streamversion, NULL);
- }
-}
-
-/*** audio/x-ac3 ***/
-/* FIXME 0.11: should be audio/ac3, but isn't for backwards compatibility */
-static GstStaticCaps ac3_caps = GST_STATIC_CAPS ("audio/x-ac3");
-
-#define AC3_CAPS (gst_static_caps_get(&ac3_caps))
-
-struct ac3_frmsize
-{
- unsigned short bit_rate;
- unsigned short frm_size[3];
-};
-
-static const struct ac3_frmsize ac3_frmsizecod_tbl[] = {
- {32, {64, 69, 96}},
- {32, {64, 70, 96}},
- {40, {80, 87, 120}},
- {40, {80, 88, 120}},
- {48, {96, 104, 144}},
- {48, {96, 105, 144}},
- {56, {112, 121, 168}},
- {56, {112, 122, 168}},
- {64, {128, 139, 192}},
- {64, {128, 140, 192}},
- {80, {160, 174, 240}},
- {80, {160, 175, 240}},
- {96, {192, 208, 288}},
- {96, {192, 209, 288}},
- {112, {224, 243, 336}},
- {112, {224, 244, 336}},
- {128, {256, 278, 384}},
- {128, {256, 279, 384}},
- {160, {320, 348, 480}},
- {160, {320, 349, 480}},
- {192, {384, 417, 576}},
- {192, {384, 418, 576}},
- {224, {448, 487, 672}},
- {224, {448, 488, 672}},
- {256, {512, 557, 768}},
- {256, {512, 558, 768}},
- {320, {640, 696, 960}},
- {320, {640, 697, 960}},
- {384, {768, 835, 1152}},
- {384, {768, 836, 1152}},
- {448, {896, 975, 1344}},
- {448, {896, 976, 1344}},
- {512, {1024, 1114, 1536}},
- {512, {1024, 1115, 1536}},
- {576, {1152, 1253, 1728}},
- {576, {1152, 1254, 1728}},
- {640, {1280, 1393, 1920}},
- {640, {1280, 1394, 1920}}
-};
-
-static void
-ac3_type_find (GstTypeFind * tf, gpointer unused)
-{
- DataScanCtx c = { 0, NULL, 0 };
-
- /* Search for an ac3 frame; not neccesarily right at the start, but give it
- * a lower probability if not found right at the start. Check that the
- * frame is followed by a second frame at the expected offset.
- * We could also check the two ac3 CRCs, but we don't do that right now */
- while (c.offset < 1024) {
- if (G_UNLIKELY (!data_scan_ctx_ensure_data (tf, &c, 5)))
- break;
-
- if (c.data[0] == 0x0b && c.data[1] == 0x77) {
- guint fscod = (c.data[4] >> 6) & 0x03;
- guint frmsizecod = c.data[4] & 0x3f;
-
- if (fscod < 3 && frmsizecod < 38) {
- DataScanCtx c_next = c;
- guint frame_size;
-
- frame_size = ac3_frmsizecod_tbl[frmsizecod].frm_size[fscod];
- if (data_scan_ctx_ensure_data (tf, &c_next, (frame_size * 2) + 5)) {
- data_scan_ctx_advance (tf, &c, frame_size * 2);
-
- if (c_next.data[0] == 0x0b && c_next.data[1] == 0x77) {
- guint fscod2 = (c_next.data[4] >> 6) & 0x03;
- guint frmsizecod2 = c_next.data[4] & 0x3f;
-
- if (fscod == fscod2 && frmsizecod == frmsizecod2) {
- GstTypeFindProbability prob;
-
- if (c.offset == 0)
- prob = GST_TYPE_FIND_MAXIMUM;
- else
- prob = GST_TYPE_FIND_NEARLY_CERTAIN;
-
- gst_type_find_suggest (tf, prob, AC3_CAPS);
- return;
- }
- }
- }
- }
- }
- data_scan_ctx_advance (tf, &c, 1);
- }
-}
-
-/*** gsm ***/
-
-/* can only be detected by using the extension, in which case we use the default
- * GSM properties */
-static GstStaticCaps gsm_caps =
-GST_STATIC_CAPS ("audio/x-gsm, rate=8000, channels=1");
-
-#define GSM_CAPS (gst_static_caps_get(&gsm_caps))
-
-/*** wavpack ***/
-
-static GstStaticCaps wavpack_caps =
-GST_STATIC_CAPS ("audio/x-wavpack, framed = (boolean) false");
-
-#define WAVPACK_CAPS (gst_static_caps_get(&wavpack_caps))
-
-static GstStaticCaps wavpack_correction_caps =
-GST_STATIC_CAPS ("audio/x-wavpack-correction, framed = (boolean) false");
-
-#define WAVPACK_CORRECTION_CAPS (gst_static_caps_get(&wavpack_correction_caps))
-
-static void
-wavpack_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint64 offset;
- guint32 blocksize;
- guint8 *data;
-
- data = gst_type_find_peek (tf, 0, 32);
- if (!data)
- return;
-
- if (data[0] != 'w' || data[1] != 'v' || data[2] != 'p' || data[3] != 'k')
- return;
-
- /* Note: wavpack blocks can be fairly large (easily 60-110k), possibly
- * larger than the max. limits imposed by certain typefinding elements
- * like id3demux or apedemux, so typefinding is most likely only going to
- * work in pull-mode */
- blocksize = GST_READ_UINT32_LE (data + 4);
- GST_LOG ("wavpack header, blocksize=0x%04x", blocksize);
- offset = 32;
- while (offset < 32 + blocksize) {
- guint32 sublen;
-
- /* get chunk header */
- GST_LOG ("peeking at chunk at offset 0x%04x", (guint) offset);
- data = gst_type_find_peek (tf, offset, 4);
- if (data == NULL)
- break;
- sublen = ((guint32) data[1]) << 1;
- if (data[0] & 0x80) {
- sublen |= (((guint32) data[2]) << 9) | (((guint32) data[3]) << 17);
- sublen += 1 + 3; /* id + length */
- } else {
- sublen += 1 + 1; /* id + length */
- }
- if (sublen > blocksize - offset + 32) {
- GST_LOG ("chunk length too big (%u > %" G_GUINT64_FORMAT ")", sublen,
- blocksize - offset);
- break;
- }
- if ((data[0] & 0x20) == 0) {
- switch (data[0] & 0x0f) {
- case 0xa: /* ID_WV_BITSTREAM */
- case 0xc: /* ID_WVX_BITSTREAM */
- gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, WAVPACK_CAPS);
- return;
- case 0xb: /* ID_WVC_BITSTREAM */
- gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY,
- WAVPACK_CORRECTION_CAPS);
- return;
- default:
- break;
- }
- }
- offset += sublen;
- }
-}
-
-/*** application/postscrip ***/
-static GstStaticCaps postscript_caps =
-GST_STATIC_CAPS ("application/postscript");
-
-#define POSTSCRIPT_CAPS (gst_static_caps_get(&postscript_caps))
-
-static void
-postscript_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 3);
- if (!data)
- return;
-
- if (data[0] == 0x04)
- data++;
- if (data[0] == '%' && data[1] == '!')
- gst_type_find_suggest (tf, GST_TYPE_FIND_POSSIBLE, POSTSCRIPT_CAPS);
-
-}
-
-/*** image/svg+xml ***/
-static GstStaticCaps svg_caps = GST_STATIC_CAPS ("image/svg+xml");
-
-#define SVG_CAPS (gst_static_caps_get(&svg_caps))
-
-static void
-svg_type_find (GstTypeFind * tf, gpointer unused)
-{
- static const gchar svg_doctype[] = "!DOCTYPE svg";
- static const gchar svg_tag[] = "<svg";
- DataScanCtx c = { 0, NULL, 0 };
-
- while (c.offset <= 1024) {
- if (G_UNLIKELY (!data_scan_ctx_ensure_data (tf, &c, 12)))
- break;
-
- if (memcmp (svg_doctype, c.data, 12) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SVG_CAPS);
- return;
- } else if (memcmp (svg_tag, c.data, 4) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, SVG_CAPS);
- return;
- }
- data_scan_ctx_advance (tf, &c, 1);
- }
-}
-
-/*** multipart/x-mixed-replace mimestream ***/
-
-static GstStaticCaps multipart_caps =
-GST_STATIC_CAPS ("multipart/x-mixed-replace");
-#define MULTIPART_CAPS gst_static_caps_get(&multipart_caps)
-
-/* multipart/x-mixed replace is:
- * <maybe some whitespace>--<some ascii chars>[\r]\n
- * <more ascii chars>[\r]\nContent-type:<more ascii>[\r]\n */
-static void
-multipart_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data;
- guint8 *x;
-
-#define MULTIPART_MAX_BOUNDARY_OFFSET 16
- data = gst_type_find_peek (tf, 0, MULTIPART_MAX_BOUNDARY_OFFSET);
- if (!data)
- return;
-
- for (x = data;
- x - data < MULTIPART_MAX_BOUNDARY_OFFSET - 2 && g_ascii_isspace (*x);
- x++);
- if (x[0] != '-' || x[1] != '-')
- return;
-
- /* Could be okay, peek what should be enough for a complete header */
-#define MULTIPART_MAX_HEADER_SIZE 256
- data = gst_type_find_peek (tf, 0, MULTIPART_MAX_HEADER_SIZE);
- if (!data)
- return;
-
- for (x = data; x - data < MULTIPART_MAX_HEADER_SIZE - 14; x++) {
- if (!isascii (*x)) {
- return;
- }
- if (*x == '\n' &&
- !g_ascii_strncasecmp ("content-type:", (gchar *) x + 1, 13)) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MULTIPART_CAPS);
- return;
- }
- }
-}
-
-/*** video/mpeg systemstream ***/
-static GstStaticCaps mpeg_sys_caps = GST_STATIC_CAPS ("video/mpeg, "
- "systemstream = (boolean) true, mpegversion = (int) [ 1, 2 ]");
-
-#define MPEG_SYS_CAPS gst_static_caps_get(&mpeg_sys_caps)
-#define IS_MPEG_HEADER(data) (G_UNLIKELY((((guint8 *)(data))[0] == 0x00) && \
- (((guint8 *)(data))[1] == 0x00) && \
- (((guint8 *)(data))[2] == 0x01)))
-
-#define IS_MPEG_PACK_CODE(b) ((b) == 0xBA)
-#define IS_MPEG_SYS_CODE(b) ((b) == 0xBB)
-#define IS_MPEG_PACK_HEADER(data) (IS_MPEG_HEADER (data) && \
- IS_MPEG_PACK_CODE (((guint8 *)(data))[3]))
-
-#define IS_MPEG_PES_CODE(b) (((b) & 0xF0) == 0xE0 || ((b) & 0xF0) == 0xC0 || \
- (b) >= 0xBD)
-#define IS_MPEG_PES_HEADER(data) (IS_MPEG_HEADER (data) && \
- IS_MPEG_PES_CODE (((guint8 *)(data))[3]))
-
-#define MPEG2_MAX_PROBE_LENGTH (128 * 1024) /* 128kB should be 64 packs of the
- * most common 2kB pack size. */
-
-#define MPEG2_MIN_SYS_HEADERS 2
-#define MPEG2_MAX_SYS_HEADERS 5
-
-static gboolean
-mpeg_sys_is_valid_pack (GstTypeFind * tf, const guint8 * data, guint len,
- guint * pack_size)
-{
- /* Check the pack header @ offset for validity, assuming that the 4 byte header
- * itself has already been checked. */
- guint8 stuff_len;
-
- if (len < 12)
- return FALSE;
-
- /* Check marker bits */
- if ((data[4] & 0xC4) == 0x44) {
- /* MPEG-2 PACK */
- if (len < 14)
- return FALSE;
-
- if ((data[6] & 0x04) != 0x04 ||
- (data[8] & 0x04) != 0x04 ||
- (data[9] & 0x01) != 0x01 || (data[12] & 0x03) != 0x03)
- return FALSE;
-
- stuff_len = data[13] & 0x07;
-
- /* Check the following header bytes, if we can */
- if ((14 + stuff_len + 4) <= len) {
- if (!IS_MPEG_HEADER (data + 14 + stuff_len))
- return FALSE;
- }
- if (pack_size)
- *pack_size = 14 + stuff_len;
- return TRUE;
- } else if ((data[4] & 0xF1) == 0x21) {
- /* MPEG-1 PACK */
- if ((data[6] & 0x01) != 0x01 ||
- (data[8] & 0x01) != 0x01 ||
- (data[9] & 0x80) != 0x80 || (data[11] & 0x01) != 0x01)
- return FALSE;
-
- /* Check the following header bytes, if we can */
- if ((12 + 4) <= len) {
- if (!IS_MPEG_HEADER (data + 12))
- return FALSE;
- }
- if (pack_size)
- *pack_size = 12;
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gboolean
-mpeg_sys_is_valid_pes (GstTypeFind * tf, guint8 * data, guint len,
- guint * pack_size)
-{
- guint pes_packet_len;
-
- /* Check the PES header at the given position, assuming the header code itself
- * was already checked */
- if (len < 6)
- return FALSE;
-
- /* For MPEG Program streams, unbounded PES is not allowed, so we must have a
- * valid length present */
- pes_packet_len = GST_READ_UINT16_BE (data + 4);
- if (pes_packet_len == 0)
- return FALSE;
-
- /* Check the following header, if we can */
- if (6 + pes_packet_len + 4 <= len) {
- if (!IS_MPEG_HEADER (data + 6 + pes_packet_len))
- return FALSE;
- }
-
- if (pack_size)
- *pack_size = 6 + pes_packet_len;
- return TRUE;
-}
-
-static gboolean
-mpeg_sys_is_valid_sys (GstTypeFind * tf, guint8 * data, guint len,
- guint * pack_size)
-{
- guint sys_hdr_len;
-
- /* Check the System header at the given position, assuming the header code itself
- * was already checked */
- if (len < 6)
- return FALSE;
- sys_hdr_len = GST_READ_UINT16_BE (data + 4);
- if (sys_hdr_len < 6)
- return FALSE;
-
- /* Check the following header, if we can */
- if (6 + sys_hdr_len + 4 <= len) {
- if (!IS_MPEG_HEADER (data + 6 + sys_hdr_len))
- return FALSE;
- }
-
- if (pack_size)
- *pack_size = 6 + sys_hdr_len;
-
- return TRUE;
-}
-
-/* calculation of possibility to identify random data as mpeg systemstream:
- * bits that must match in header detection: 32 (or more)
- * chance that random data is identifed: 1/2^32
- * chance that MPEG2_MIN_PACK_HEADERS headers are identified:
- * 1/2^(32*MPEG2_MIN_PACK_HEADERS)
- * chance that this happens in MPEG2_MAX_PROBE_LENGTH bytes:
- * 1-(1+1/2^(32*MPEG2_MIN_PACK_HEADERS)^MPEG2_MAX_PROBE_LENGTH)
- * for current values:
- * 1-(1+1/2^(32*4)^101024)
- * = <some_number>
- * Since we also check marker bits and pes packet lengths, this probability is a
- * very coarse upper bound.
- */
-static void
-mpeg_sys_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data, *data0, *first_sync, *end;
- gint mpegversion = 0;
- guint pack_headers = 0;
- guint pes_headers = 0;
- guint pack_size;
- guint since_last_sync = 0;
- guint32 sync_word = 0xffffffff;
-
- G_STMT_START {
- gint len;
-
- len = MPEG2_MAX_PROBE_LENGTH;
- do {
- len = len / 2;
- data = gst_type_find_peek (tf, 0, 5 + len);
- } while (data == NULL && len >= 32);
-
- if (!data)
- return;
-
- end = data + len;
- }
- G_STMT_END;
-
- data0 = data;
- first_sync = NULL;
-
- while (data < end) {
- sync_word <<= 8;
- if (sync_word == 0x00000100) {
- /* Found potential sync word */
- if (first_sync == NULL)
- first_sync = data - 3;
-
- if (since_last_sync > 4) {
- /* If more than 4 bytes since the last sync word, reset our counters,
- * as we're only interested in counting contiguous packets */
- pes_headers = pack_headers = 0;
- }
- pack_size = 0;
-
- if (IS_MPEG_PACK_CODE (data[0])) {
- if ((data[1] & 0xC0) == 0x40) {
- /* MPEG-2 */
- mpegversion = 2;
- } else if ((data[1] & 0xF0) == 0x20) {
- mpegversion = 1;
- }
- if (mpegversion != 0 &&
- mpeg_sys_is_valid_pack (tf, data - 3, end - data + 3, &pack_size)) {
- pack_headers++;
- }
- } else if (IS_MPEG_PES_CODE (data[0])) {
- /* PES stream */
- if (mpeg_sys_is_valid_pes (tf, data - 3, end - data + 3, &pack_size)) {
- pes_headers++;
- if (mpegversion == 0)
- mpegversion = 2;
- }
- } else if (IS_MPEG_SYS_CODE (data[0])) {
- if (mpeg_sys_is_valid_sys (tf, data - 3, end - data + 3, &pack_size)) {
- pack_headers++;
- }
- }
-
- /* If we found a packet with a known size, skip the bytes in it and loop
- * around to check the next packet. */
- if (pack_size != 0) {
- data += pack_size - 3;
- sync_word = 0xffffffff;
- since_last_sync = 0;
- continue;
- }
- }
-
- sync_word |= data[0];
- since_last_sync++;
- data++;
-
- /* If we have found MAX headers, and *some* were pes headers (pack headers
- * are optional in an mpeg system stream) then return our high-probability
- * result */
- if (pes_headers > 0 && (pack_headers + pes_headers) > MPEG2_MAX_SYS_HEADERS)
- goto suggest;
- }
-
- /* If we at least saw MIN headers, and *some* were pes headers (pack headers
- * are optional in an mpeg system stream) then return a lower-probability
- * result */
- if (pes_headers > 0 && (pack_headers + pes_headers) > MPEG2_MIN_SYS_HEADERS)
- goto suggest;
-
- return;
-suggest:
- {
- guint prob;
-
- prob = GST_TYPE_FIND_POSSIBLE + (10 * (pack_headers + pes_headers));
- prob = MIN (prob, GST_TYPE_FIND_MAXIMUM);
-
- /* lower probability if the first packet wasn't right at the start */
- if (data0 != first_sync && prob >= 10)
- prob -= 10;
-
- GST_LOG ("Suggesting MPEG %d system stream, %d packs, %d pes, prob %u%%\n",
- mpegversion, pack_headers, pes_headers, prob);
-
- gst_type_find_suggest_simple (tf, prob, "video/mpeg",
- "systemstream", G_TYPE_BOOLEAN, TRUE,
- "mpegversion", G_TYPE_INT, mpegversion, NULL);
- }
-};
-
-/*** video/mpegts Transport Stream ***/
-static GstStaticCaps mpegts_caps = GST_STATIC_CAPS ("video/mpegts, "
- "systemstream = (boolean) true, packetsize = (int) [ 188, 208 ]");
-#define MPEGTS_CAPS gst_static_caps_get(&mpegts_caps)
-
-#define GST_MPEGTS_TYPEFIND_MIN_HEADERS 4
-#define GST_MPEGTS_TYPEFIND_MAX_HEADERS 10
-#define GST_MPEGTS_MAX_PACKET_SIZE 208
-#define GST_MPEGTS_TYPEFIND_SYNC_SIZE \
- (GST_MPEGTS_TYPEFIND_MIN_HEADERS * GST_MPEGTS_MAX_PACKET_SIZE)
-#define GST_MPEGTS_TYPEFIND_MAX_SYNC \
- (GST_MPEGTS_TYPEFIND_MAX_HEADERS * GST_MPEGTS_MAX_PACKET_SIZE)
-
-#define MPEGTS_HDR_SIZE 4
-/* Check for sync byte, error_indicator == 0 and packet has payload */
-#define IS_MPEGTS_HEADER(data) (((data)[0] == 0x47) && \
- (((data)[1] & 0x80) == 0x00) && \
- (((data)[3] & 0x10) == 0x10))
-
-/* Helper function to search ahead at intervals of packet_size for mpegts
- * headers */
-static gint
-mpeg_ts_probe_headers (GstTypeFind * tf, guint64 offset, gint packet_size)
-{
- /* We always enter this function having found at least one header already */
- gint found = 1;
- guint8 *data = NULL;
-
- while (found < GST_MPEGTS_TYPEFIND_MAX_HEADERS) {
- offset += packet_size;
-
- data = gst_type_find_peek (tf, offset, MPEGTS_HDR_SIZE);
- if (data == NULL || !IS_MPEGTS_HEADER (data))
- return found;
-
- found++;
- }
-
- return found;
-}
-
-/* Try and detect at least 4 packets in at most 10 packets worth of
- * data. Need to try several possible packet sizes */
-static void
-mpeg_ts_type_find (GstTypeFind * tf, gpointer unused)
-{
- /* TS packet sizes to test: normal, DVHS packet size and
- * FEC with 16 or 20 byte codes packet size. */
- const gint pack_sizes[] = { 188, 192, 204, 208 };
- const gint n_pack_sizes = sizeof (pack_sizes) / sizeof (gint);
-
- guint8 *data = NULL;
- guint size = 0;
- guint64 skipped = 0;
-
- while (skipped < GST_MPEGTS_TYPEFIND_MAX_SYNC) {
- if (size < MPEGTS_HDR_SIZE) {
- data = gst_type_find_peek (tf, skipped, GST_MPEGTS_TYPEFIND_SYNC_SIZE);
- if (!data)
- break;
- size = GST_MPEGTS_TYPEFIND_SYNC_SIZE;
- }
-
- /* Have at least MPEGTS_HDR_SIZE bytes at this point */
- if (IS_MPEGTS_HEADER (data)) {
- gint p;
-
- for (p = 0; p < n_pack_sizes; p++) {
- gint found;
-
- /* Probe ahead at size pack_sizes[p] */
- found = mpeg_ts_probe_headers (tf, skipped, pack_sizes[p]);
- if (found >= GST_MPEGTS_TYPEFIND_MIN_HEADERS) {
- gint probability;
-
- /* found at least 4 headers. 10 headers = MAXIMUM probability.
- * Arbitrarily, I assigned 10% probability for each header we
- * found, 40% -> 100% */
- probability = MIN (10 * found, GST_TYPE_FIND_MAXIMUM);
-
- gst_type_find_suggest_simple (tf, probability, "video/mpegts",
- "systemstream", G_TYPE_BOOLEAN, TRUE,
- "packetsize", G_TYPE_INT, pack_sizes[p], NULL);
- return;
- }
- }
- }
- data++;
- skipped++;
- size--;
- }
-}
-
-#define GST_MPEGVID_TYPEFIND_TRY_PICTURES 6
-#define GST_MPEGVID_TYPEFIND_TRY_SYNC (100 * 1024) /* 100 kB */
-
-/* Scan ahead a maximum of max_extra_offset bytes until the next IS_MPEG_HEADER
- * offset. After the call, offset will be after the 0x000001, i.e. at the 4th
- * byte of the MPEG header. Returns TRUE if a header was found, FALSE if not.
- */
-static gboolean
-mpeg_find_next_header (GstTypeFind * tf, DataScanCtx * c,
- guint64 max_extra_offset)
-{
- guint64 extra_offset;
-
- for (extra_offset = 0; extra_offset <= max_extra_offset; ++extra_offset) {
- if (!data_scan_ctx_ensure_data (tf, c, 4))
- return FALSE;
- if (IS_MPEG_HEADER (c->data)) {
- data_scan_ctx_advance (tf, c, 3);
- return TRUE;
- }
- data_scan_ctx_advance (tf, c, 1);
- }
- return FALSE;
-}
-
-/*** video/mpeg MPEG-4 elementary video stream ***/
-
-static GstStaticCaps mpeg4_video_caps = GST_STATIC_CAPS ("video/mpeg, "
- "systemstream=(boolean)false, mpegversion=4, parsed=(boolean)false");
-#define MPEG4_VIDEO_CAPS gst_static_caps_get(&mpeg4_video_caps)
-
-/*
- * This typefind is based on the elementary video header defined in
- * http://xhelmboyx.tripod.com/formats/mpeg-layout.txt
- * In addition, it allows the visual object sequence header to be
- * absent, and even the VOS header to be absent. In the latter case,
- * a number of VOPs have to be present.
- */
-static void
-mpeg4_video_type_find (GstTypeFind * tf, gpointer unused)
-{
- DataScanCtx c = { 0, NULL, 0 };
- gboolean seen_vios_at_0 = FALSE;
- gboolean seen_vios = FALSE;
- gboolean seen_vos = FALSE;
- gboolean seen_vol = FALSE;
- guint num_vop_headers = 0;
- guint8 sc;
-
- while (c.offset < GST_MPEGVID_TYPEFIND_TRY_SYNC) {
- if (num_vop_headers >= GST_MPEGVID_TYPEFIND_TRY_PICTURES)
- break;
-
- if (!mpeg_find_next_header (tf, &c,
- GST_MPEGVID_TYPEFIND_TRY_SYNC - c.offset))
- break;
-
- sc = c.data[0];
-
- /* visual_object_sequence_start_code */
- if (sc == 0xB0) {
- if (seen_vios)
- break; /* Terminate at second vios */
- if (c.offset == 0)
- seen_vios_at_0 = TRUE;
- seen_vios = TRUE;
- data_scan_ctx_advance (tf, &c, 2);
- if (!mpeg_find_next_header (tf, &c, 0))
- break;
-
- sc = c.data[0];
-
- /* Optional metadata */
- if (sc == 0xB2)
- if (!mpeg_find_next_header (tf, &c, 24))
- break;
- }
-
- /* visual_object_start_code (consider it optional) */
- if (sc == 0xB5) {
- data_scan_ctx_advance (tf, &c, 2);
- /* may contain ID marker and YUV clamping */
- if (!mpeg_find_next_header (tf, &c, 7))
- break;
-
- sc = c.data[0];
- }
-
- /* video_object_start_code */
- if (sc <= 0x1F) {
- if (seen_vos)
- break; /* Terminate at second vos */
- seen_vos = TRUE;
- data_scan_ctx_advance (tf, &c, 2);
- continue;
- }
-
- /* video_object_layer_start_code */
- if (sc >= 0x20 && sc <= 0x2F) {
- seen_vol = TRUE;
- data_scan_ctx_advance (tf, &c, 5);
- continue;
- }
-
- /* video_object_plane_start_code */
- if (sc == 0xB6) {
- num_vop_headers++;
- data_scan_ctx_advance (tf, &c, 2);
- continue;
- }
-
- /* Unknown start code. */
- }
-
- if (num_vop_headers > 0 || seen_vol) {
- GstTypeFindProbability probability = 0;
-
- GST_LOG ("Found %d pictures, vios: %d, vos:%d, vol:%d", num_vop_headers,
- seen_vios, seen_vos, seen_vol);
-
- if (num_vop_headers >= GST_MPEGVID_TYPEFIND_TRY_PICTURES && seen_vios_at_0
- && seen_vos && seen_vol)
- probability = GST_TYPE_FIND_MAXIMUM - 1;
- else if (num_vop_headers >= GST_MPEGVID_TYPEFIND_TRY_PICTURES && seen_vios
- && seen_vos && seen_vol)
- probability = GST_TYPE_FIND_NEARLY_CERTAIN - 1;
- else if (seen_vios_at_0 && seen_vos && seen_vol)
- probability = GST_TYPE_FIND_NEARLY_CERTAIN - 6;
- else if (num_vop_headers >= GST_MPEGVID_TYPEFIND_TRY_PICTURES && seen_vos
- && seen_vol)
- probability = GST_TYPE_FIND_NEARLY_CERTAIN - 6;
- else if (num_vop_headers >= GST_MPEGVID_TYPEFIND_TRY_PICTURES && seen_vol)
- probability = GST_TYPE_FIND_NEARLY_CERTAIN - 9;
- else if (num_vop_headers >= GST_MPEGVID_TYPEFIND_TRY_PICTURES)
- probability = GST_TYPE_FIND_LIKELY - 1;
- else if (num_vop_headers > 2 && seen_vios && seen_vos && seen_vol)
- probability = GST_TYPE_FIND_LIKELY - 9;
- else if (seen_vios && seen_vos && seen_vol)
- probability = GST_TYPE_FIND_LIKELY - 20;
- else if (num_vop_headers > 0 && seen_vos && seen_vol)
- probability = GST_TYPE_FIND_POSSIBLE;
- else if (num_vop_headers > 0)
- probability = GST_TYPE_FIND_POSSIBLE - 10;
- else if (seen_vos && seen_vol)
- probability = GST_TYPE_FIND_POSSIBLE - 20;
-
- gst_type_find_suggest (tf, probability, MPEG4_VIDEO_CAPS);
- }
-}
-
-/*** video/x-h264 H264 elementary video stream ***/
-
-static GstStaticCaps h264_video_caps = GST_STATIC_CAPS ("video/x-h264");
-
-#define H264_VIDEO_CAPS gst_static_caps_get(&h264_video_caps)
-
-#define H264_MAX_PROBE_LENGTH (128 * 1024) /* 128kB for HD should be enough. */
-
-static void
-h264_video_type_find (GstTypeFind * tf, gpointer unused)
-{
- DataScanCtx c = { 0, NULL, 0 };
-
- /* Stream consists of: a series of sync codes (00 00 00 01) followed
- * by NALs
- */
- int nut, ref;
- int good = 0;
- int bad = 0;
-
- while (c.offset < H264_MAX_PROBE_LENGTH) {
- if (G_UNLIKELY (!data_scan_ctx_ensure_data (tf, &c, 4)))
- break;
-
- if (IS_MPEG_HEADER (c.data)) {
- nut = c.data[3] & 0x9f; /* forbiden_zero_bit | nal_unit_type */
- ref = c.data[3] & 0x60; /* nal_ref_idc */
-
- /* if forbiden bit is different to 0 won't be h264 */
- if (nut > 0x1f) {
- bad++;
- break;
- }
-
- /* collect statistics about the NAL types */
- if ((nut >= 1 && nut <= 13) || nut == 19) {
- if ((nut == 5 && ref == 0) ||
- ((nut == 6 || (nut >= 9 && nut <= 12)) && ref != 0)) {
- bad++;
- } else {
- good++;
- }
- } else if (nut >= 14 && nut <= 33) {
- /* reserved */
- /* Theoretically these are good, since if they exist in the
- stream it merely means that a newer backwards-compatible
- h.264 stream. But we should be identifying that separately. */
- bad++;
- } else {
- /* unspecified, application specific */
- /* don't consider these bad */
- }
-
- GST_DEBUG ("good %d bad %d", good, bad);
-
- if (good >= 10 && bad < 4) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, H264_VIDEO_CAPS);
- return;
- }
-
- data_scan_ctx_advance (tf, &c, 4);
- }
- data_scan_ctx_advance (tf, &c, 1);
- }
-
- if (good >= 2 && bad < 1) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_POSSIBLE, H264_VIDEO_CAPS);
- return;
- }
-}
-
-/*** video/mpeg video stream ***/
-
-static GstStaticCaps mpeg_video_caps = GST_STATIC_CAPS ("video/mpeg, "
- "systemstream = (boolean) false");
-#define MPEG_VIDEO_CAPS gst_static_caps_get(&mpeg_video_caps)
-
-/*
- * Idea is the same as MPEG system stream typefinding: We check each
- * byte of the stream to see if - from that point on - the stream
- * matches a predefined set of marker bits as defined in the MPEG
- * video specs.
- *
- * I'm sure someone will do a chance calculation here too.
- */
-
-static void
-mpeg_video_stream_type_find (GstTypeFind * tf, gpointer unused)
-{
- DataScanCtx c = { 0, NULL, 0 };
- gboolean seen_seq_at_0 = FALSE;
- gboolean seen_seq = FALSE;
- gboolean seen_gop = FALSE;
- guint64 last_pic_offset = 0;
- guint num_pic_headers = 0;
- gint found = 0;
-
- while (c.offset < GST_MPEGVID_TYPEFIND_TRY_SYNC) {
- if (found >= GST_MPEGVID_TYPEFIND_TRY_PICTURES)
- break;
-
- if (!data_scan_ctx_ensure_data (tf, &c, 5))
- break;
-
- if (!IS_MPEG_HEADER (c.data))
- goto next;
-
- /* a pack header indicates that this isn't an elementary stream */
- if (c.data[3] == 0xBA && mpeg_sys_is_valid_pack (tf, c.data, c.size, NULL))
- return;
-
- /* do we have a sequence header? */
- if (c.data[3] == 0xB3) {
- seen_seq_at_0 = seen_seq_at_0 || (c.offset == 0);
- seen_seq = TRUE;
- data_scan_ctx_advance (tf, &c, 4 + 8);
- continue;
- }
-
- /* or a GOP header */
- if (c.data[3] == 0xB8) {
- seen_gop = TRUE;
- data_scan_ctx_advance (tf, &c, 8);
- continue;
- }
-
- /* but what we'd really like to see is a picture header */
- if (c.data[3] == 0x00) {
- ++num_pic_headers;
- last_pic_offset = c.offset;
- data_scan_ctx_advance (tf, &c, 8);
- continue;
- }
-
- /* ... each followed by a slice header with slice_vertical_pos=1 that's
- * not too far away from the previously seen picture header. */
- if (c.data[3] == 0x01 && num_pic_headers > found &&
- (c.offset - last_pic_offset) >= 4 &&
- (c.offset - last_pic_offset) <= 64) {
- data_scan_ctx_advance (tf, &c, 4);
- found += 1;
- continue;
- }
-
- next:
-
- data_scan_ctx_advance (tf, &c, 1);
- }
-
- if (found > 0 || seen_seq) {
- GstTypeFindProbability probability = 0;
-
- GST_LOG ("Found %d pictures, seq:%d, gop:%d", found, seen_seq, seen_gop);
-
- if (found >= GST_MPEGVID_TYPEFIND_TRY_PICTURES && seen_seq && seen_gop)
- probability = GST_TYPE_FIND_NEARLY_CERTAIN - 1;
- else if (found >= GST_MPEGVID_TYPEFIND_TRY_PICTURES && seen_seq)
- probability = GST_TYPE_FIND_NEARLY_CERTAIN - 9;
- else if (found >= GST_MPEGVID_TYPEFIND_TRY_PICTURES)
- probability = GST_TYPE_FIND_LIKELY;
- else if (seen_seq_at_0 && seen_gop && found > 2)
- probability = GST_TYPE_FIND_LIKELY - 10;
- else if (seen_seq && seen_gop && found > 2)
- probability = GST_TYPE_FIND_LIKELY - 20;
- else if (seen_seq_at_0 && found > 0)
- probability = GST_TYPE_FIND_POSSIBLE;
- else if (seen_seq && found > 0)
- probability = GST_TYPE_FIND_POSSIBLE - 5;
- else if (found > 0)
- probability = GST_TYPE_FIND_POSSIBLE - 10;
- else if (seen_seq)
- probability = GST_TYPE_FIND_POSSIBLE - 20;
-
- gst_type_find_suggest_simple (tf, probability, "video/mpeg",
- "systemstream", G_TYPE_BOOLEAN, FALSE,
- "mpegversion", G_TYPE_INT, 1, NULL);
- }
-}
-
-/*** audio/x-aiff ***/
-
-static GstStaticCaps aiff_caps = GST_STATIC_CAPS ("audio/x-aiff");
-
-#define AIFF_CAPS gst_static_caps_get(&aiff_caps)
-static void
-aiff_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
-
- if (data && memcmp (data, "FORM", 4) == 0) {
- data += 8;
- if (memcmp (data, "AIFF", 4) == 0 || memcmp (data, "AIFC", 4) == 0)
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, AIFF_CAPS);
- }
-}
-
-/*** audio/x-svx ***/
-
-static GstStaticCaps svx_caps = GST_STATIC_CAPS ("audio/x-svx");
-
-#define SVX_CAPS gst_static_caps_get(&svx_caps)
-static void
-svx_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
-
- if (data && memcmp (data, "FORM", 4) == 0) {
- data += 8;
- if (memcmp (data, "8SVX", 4) == 0 || memcmp (data, "16SV", 4) == 0)
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SVX_CAPS);
- }
-}
-
-/*** audio/x-shorten ***/
-
-static GstStaticCaps shn_caps = GST_STATIC_CAPS ("audio/x-shorten");
-
-#define SHN_CAPS gst_static_caps_get(&shn_caps)
-static void
-shn_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
-
- if (data && memcmp (data, "ajkg", 4) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SHN_CAPS);
- }
- data = gst_type_find_peek (tf, -8, 8);
- if (data && memcmp (data, "SHNAMPSK", 8) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SHN_CAPS);
- }
-}
-
-/*** application/x-ape ***/
-
-static GstStaticCaps ape_caps = GST_STATIC_CAPS ("application/x-ape");
-
-#define APE_CAPS gst_static_caps_get(&ape_caps)
-static void
-ape_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
-
- if (data && memcmp (data, "MAC ", 4) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY + 10, APE_CAPS);
- }
-}
-
-/*** ISO FORMATS ***/
-
-/*** audio/x-m4a ***/
-
-static GstStaticCaps m4a_caps = GST_STATIC_CAPS ("audio/x-m4a");
-
-#define M4A_CAPS (gst_static_caps_get(&m4a_caps))
-static void
-m4a_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 4, 8);
-
- if (data &&
- (memcmp (data, "ftypM4A ", 8) == 0 ||
- memcmp (data, "ftypmp42", 8) == 0)) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, M4A_CAPS);
- }
-}
-
-/*** application/x-3gp ***/
-
-/* The Q is there because variables can't start with a number. */
-
-
-static GstStaticCaps q3gp_caps = GST_STATIC_CAPS ("application/x-3gp");
-
-#define Q3GP_CAPS (gst_static_caps_get(&q3gp_caps))
-static void
-q3gp_type_find (GstTypeFind * tf, gpointer unused)
-{
-
- guint32 ftyp_size = 0;
- gint offset = 0;
- guint8 *data = NULL;
-
- if ((data = gst_type_find_peek (tf, 0, 12)) == NULL) {
- return;
- }
-
- data += 4;
- if (memcmp (data, "ftyp", 4) != 0) {
- return;
- }
-
- /* check major brand */
- data += 4;
- if (memcmp (data, "3gp", 3) == 0 ||
- memcmp (data, "3gr", 3) == 0 ||
- memcmp (data, "3gs", 3) == 0 || memcmp (data, "3gg", 3) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, Q3GP_CAPS);
- return;
- }
-
- /* check compatible brands */
- if ((data = gst_type_find_peek (tf, 0, 4)) != NULL) {
- ftyp_size = GST_READ_UINT32_BE (data);
- }
- for (offset = 16; offset < ftyp_size; offset += 4) {
- if ((data = gst_type_find_peek (tf, offset, 3)) == NULL) {
- break;
- }
- if (memcmp (data, "3gp", 3) == 0 ||
- memcmp (data, "3gr", 3) == 0 ||
- memcmp (data, "3gs", 3) == 0 || memcmp (data, "3gg", 3) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, Q3GP_CAPS);
- break;
- }
- }
-
- return;
-
-}
-
-/*** video/mj2 and image/jp2 ***/
-static GstStaticCaps mj2_caps = GST_STATIC_CAPS ("video/mj2");
-
-#define MJ2_CAPS gst_static_caps_get(&mj2_caps)
-
-static GstStaticCaps jp2_caps = GST_STATIC_CAPS ("image/jp2");
-
-#define JP2_CAPS gst_static_caps_get(&jp2_caps)
-
-static void
-jp2_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data;
-
- data = gst_type_find_peek (tf, 0, 24);
- if (!data)
- return;
-
- /* jp2 signature */
- if (memcmp (data, "\000\000\000\014jP \015\012\207\012", 12) != 0)
- return;
-
- /* check ftyp box */
- data += 12;
- if (memcmp (data + 4, "ftyp", 4) == 0) {
- if (memcmp (data + 8, "jp2 ", 4) == 0)
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, JP2_CAPS);
- else if (memcmp (data + 8, "mjp2", 4) == 0)
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MJ2_CAPS);
- }
-}
-
-/*** video/quicktime ***/
-
-static GstStaticCaps qt_caps = GST_STATIC_CAPS ("video/quicktime");
-
-#define QT_CAPS gst_static_caps_get(&qt_caps)
-#define STRNCMP(x,y,z) (strncmp ((char*)(x), (char*)(y), z))
-
-static void
-qt_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data;
- guint tip = 0;
- guint64 offset = 0;
- guint64 size;
- const gchar *variant = NULL;
-
- while ((data = gst_type_find_peek (tf, offset, 12)) != NULL) {
- guint64 new_offset;
-
- if (STRNCMP (&data[4], "ftypqt ", 8) == 0) {
- tip = GST_TYPE_FIND_MAXIMUM;
- break;
- }
-
- if (STRNCMP (&data[4], "ftypisom", 8) == 0) {
- tip = GST_TYPE_FIND_MAXIMUM;
- variant = "iso";
- break;
- }
-
- /* box/atom types that are in common with ISO base media file format */
- if (STRNCMP (&data[4], "moov", 4) == 0 ||
- STRNCMP (&data[4], "mdat", 4) == 0 ||
- STRNCMP (&data[4], "ftyp", 4) == 0 ||
- STRNCMP (&data[4], "free", 4) == 0 ||
- STRNCMP (&data[4], "uuid", 4) == 0 ||
- STRNCMP (&data[4], "skip", 4) == 0) {
- if (tip == 0) {
- tip = GST_TYPE_FIND_LIKELY;
- } else {
- tip = GST_TYPE_FIND_NEARLY_CERTAIN;
- }
- }
- /* other box/atom types, apparently quicktime specific */
- else if (STRNCMP (&data[4], "pnot", 4) == 0 ||
- STRNCMP (&data[4], "PICT", 4) == 0 ||
- STRNCMP (&data[4], "wide", 4) == 0 ||
- STRNCMP (&data[4], "prfl", 4) == 0) {
- tip = GST_TYPE_FIND_MAXIMUM;
- break;
- } else {
- tip = 0;
- break;
- }
- size = GST_READ_UINT32_BE (data);
- if (size == 1) {
- guint8 *sizedata;
-
- sizedata = gst_type_find_peek (tf, offset + 8, 8);
- if (sizedata == NULL)
- break;
-
- size = GST_READ_UINT64_BE (sizedata);
- } else {
- if (size < 8)
- break;
- }
- new_offset = offset + size;
- if (new_offset <= offset)
- break;
- offset = new_offset;
- }
-
- if (tip > 0) {
- if (variant) {
- GstCaps *caps = gst_caps_copy (QT_CAPS);
-
- gst_caps_set_simple (caps, "variant", G_TYPE_STRING, variant, NULL);
- gst_type_find_suggest (tf, tip, caps);
- gst_caps_unref (caps);
- } else {
- gst_type_find_suggest (tf, tip, QT_CAPS);
- }
- }
-};
-
-
-/*** image/x-quicktime ***/
-
-static GstStaticCaps qtif_caps = GST_STATIC_CAPS ("image/x-quicktime");
-
-#define QTIF_CAPS gst_static_caps_get(&qtif_caps)
-
-/* how many atoms we check before we give up */
-#define QTIF_MAXROUNDS 25
-
-static void
-qtif_type_find (GstTypeFind * tf, gpointer unused)
-{
- const guint8 *data;
- gboolean found_idsc = FALSE;
- gboolean found_idat = FALSE;
- guint64 offset = 0;
- guint rounds = 0;
-
- while ((data = gst_type_find_peek (tf, offset, 8)) != NULL) {
- guint64 size;
-
- size = GST_READ_UINT32_BE (data);
- if (size == 1) {
- const guint8 *sizedata;
-
- sizedata = gst_type_find_peek (tf, offset + 8, 8);
- if (sizedata == NULL)
- break;
-
- size = GST_READ_UINT64_BE (sizedata);
- }
- if (size < 8)
- break;
-
- if (STRNCMP (data + 4, "idsc", 4) == 0)
- found_idsc = TRUE;
- if (STRNCMP (data + 4, "idat", 4) == 0)
- found_idat = TRUE;
-
- if (found_idsc && found_idat) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, QTIF_CAPS);
- return;
- }
-
- offset += size;
- if (++rounds > QTIF_MAXROUNDS)
- break;
- }
-
- if (found_idsc || found_idat) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, QTIF_CAPS);
- return;
- }
-};
-
-/*** audio/x-mod ***/
-
-static GstStaticCaps mod_caps = GST_STATIC_CAPS ("audio/x-mod");
-
-#define MOD_CAPS gst_static_caps_get(&mod_caps)
-/* FIXME: M15 CheckType to do */
-static void
-mod_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data;
-
- /* MOD */
- if ((data = gst_type_find_peek (tf, 1080, 4)) != NULL) {
- /* Protracker and variants */
- if ((memcmp (data, "M.K.", 4) == 0) || (memcmp (data, "M!K!", 4) == 0) ||
- /* Star Tracker */
- (memcmp (data, "FLT", 3) == 0 && isdigit (data[3])) ||
- (memcmp (data, "EXO", 3) == 0 && isdigit (data[3])) ||
- /* Oktalyzer (Amiga) */
- (memcmp (data, "OKTA", 4) == 0) ||
- /* Oktalyser (Atari) */
- (memcmp (data, "CD81", 4) == 0) ||
- /* Fasttracker */
- (memcmp (data + 1, "CHN", 3) == 0 && isdigit (data[0])) ||
- /* Fasttracker or Taketracker */
- (memcmp (data + 2, "CH", 2) == 0 && isdigit (data[0])
- && isdigit (data[1])) || (memcmp (data + 2, "CN", 2) == 0
- && isdigit (data[0]) && isdigit (data[1]))) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
- return;
- }
- }
- /* XM */
- if ((data = gst_type_find_peek (tf, 0, 38)) != NULL) {
- if (memcmp (data, "Extended Module: ", 17) == 0 && data[37] == 0x1A) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
- return;
- }
- }
- /* OKT */
- if (data || (data = gst_type_find_peek (tf, 0, 8)) != NULL) {
- if (memcmp (data, "OKTASONG", 8) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
- return;
- }
- }
- if (data || (data = gst_type_find_peek (tf, 0, 4)) != NULL) {
- /* 669 */
- if ((memcmp (data, "if", 2) == 0) || (memcmp (data, "JN", 2) == 0)) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, MOD_CAPS);
- return;
- }
- /* AMF */
- if ((memcmp (data, "AMF", 3) == 0 && data[3] > 10 && data[3] < 14) ||
- /* IT */
- (memcmp (data, "IMPM", 4) == 0) ||
- /* MED */
- (memcmp (data, "MMD0", 4) == 0) || (memcmp (data, "MMD1", 4) == 0) ||
- /* MTM */
- (memcmp (data, "MTM", 3) == 0)) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
- return;
- }
- /* DSM */
- if (memcmp (data, "RIFF", 4) == 0) {
- guint8 *data2 = gst_type_find_peek (tf, 8, 4);
-
- if (data2) {
- if (memcmp (data2, "DSMF", 4) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
- return;
- }
- }
- }
- /* FAM */
- if (memcmp (data, "FAM\xFE", 4) == 0) {
- guint8 *data2 = gst_type_find_peek (tf, 44, 3);
-
- if (data2) {
- if (memcmp (data2, "compare", 3) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
- return;
- }
- } else {
- gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, MOD_CAPS);
- return;
- }
- }
- /* GDM */
- if (memcmp (data, "GDM\xFE", 4) == 0) {
- guint8 *data2 = gst_type_find_peek (tf, 71, 4);
-
- if (data2) {
- if (memcmp (data2, "GMFS", 4) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
- return;
- }
- } else {
- gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, MOD_CAPS);
- return;
- }
- }
- }
- /* IMF */
- if ((data = gst_type_find_peek (tf, 60, 4)) != NULL) {
- if (memcmp (data, "IM10", 4) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
- return;
- }
- }
- /* S3M */
- if ((data = gst_type_find_peek (tf, 44, 4)) != NULL) {
- if (memcmp (data, "SCRM", 4) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
- return;
- }
- }
- /* STM */
- if ((data = gst_type_find_peek (tf, 20, 8)) != NULL) {
- if (strncasecmp ((gchar *) data, "!Scream!", 8) == 0 ||
- strncasecmp ((gchar *) data, "BMOD2STM", 8) == 0) {
- guint8 *id, *stmtype;
-
- if ((id = gst_type_find_peek (tf, 28, 1)) == NULL)
- return;
- if ((stmtype = gst_type_find_peek (tf, 29, 1)) == NULL)
- return;
- if (*id == 0x1A && *stmtype == 2)
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS);
- return;
- }
- }
-}
-
-/*** application/x-shockwave-flash ***/
-
-static GstStaticCaps swf_caps =
-GST_STATIC_CAPS ("application/x-shockwave-flash");
-#define SWF_CAPS (gst_static_caps_get(&swf_caps))
-static void
-swf_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
-
- if (data && (data[0] == 'F' || data[0] == 'C') &&
- data[1] == 'W' && data[2] == 'S') {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SWF_CAPS);
- }
-}
-
-/*** image/jpeg ***/
-
-static GstStaticCaps jpeg_caps = GST_STATIC_CAPS ("image/jpeg");
-
-#define JPEG_CAPS (gst_static_caps_get(&jpeg_caps))
-static void
-jpeg_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 10);
- guint8 header[2] = { 0xFF, 0xD8 };
-
- if (data && memcmp (data, header, 2) == 0) {
- if (memcmp (data + 6, "JFIF", 4) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, JPEG_CAPS);
- } else if (memcmp (data + 6, "Exif", 4) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, JPEG_CAPS);
- } else {
- gst_type_find_suggest (tf, GST_TYPE_FIND_POSSIBLE, JPEG_CAPS);
- }
- }
-}
-
-/*** image/bmp ***/
-
-static GstStaticCaps bmp_caps = GST_STATIC_CAPS ("image/bmp");
-
-#define BMP_CAPS (gst_static_caps_get(&bmp_caps))
-static void
-bmp_type_find (GstTypeFind * tf, gpointer unused)
-{
- DataScanCtx c = { 0, NULL, 0 };
- guint32 struct_size, w, h, planes, bpp;
-
- if (G_UNLIKELY (!data_scan_ctx_ensure_data (tf, &c, 54)))
- return;
-
- if (c.data[0] != 'B' || c.data[1] != 'M')
- return;
-
- /* skip marker + size */
- data_scan_ctx_advance (tf, &c, 2 + 4);
-
- /* reserved, must be 0 */
- if (c.data[0] != 0 || c.data[1] != 0 || c.data[2] != 0 || c.data[3] != 0)
- return;
-
- data_scan_ctx_advance (tf, &c, 2 + 2);
-
- /* offset to start of image data in bytes (check for sanity) */
- GST_LOG ("offset=%u", GST_READ_UINT32_LE (c.data));
- if (GST_READ_UINT32_LE (c.data) > (10 * 1024 * 1024))
- return;
-
- struct_size = GST_READ_UINT32_LE (c.data + 4);
- GST_LOG ("struct_size=%u", struct_size);
-
- data_scan_ctx_advance (tf, &c, 4 + 4);
-
- if (struct_size == 0x0C) {
- w = GST_READ_UINT16_LE (c.data);
- h = GST_READ_UINT16_LE (c.data + 2);
- planes = GST_READ_UINT16_LE (c.data + 2 + 2);
- bpp = GST_READ_UINT16_LE (c.data + 2 + 2 + 2);
- } else if (struct_size == 40 || struct_size == 64 || struct_size == 108
- || struct_size == 124 || struct_size == 0xF0) {
- w = GST_READ_UINT32_LE (c.data);
- h = GST_READ_UINT32_LE (c.data + 4);
- planes = GST_READ_UINT16_LE (c.data + 4 + 4);
- bpp = GST_READ_UINT16_LE (c.data + 4 + 4 + 2);
- } else {
- return;
- }
-
- /* image sizes sanity check */
- GST_LOG ("w=%u, h=%u, planes=%u, bpp=%u", w, h, planes, bpp);
- if (w == 0 || w > 0xfffff || h == 0 || h > 0xfffff || planes != 1 ||
- (bpp != 1 && bpp != 4 && bpp != 8 && bpp != 16 && bpp != 24 && bpp != 32))
- return;
-
- gst_type_find_suggest_simple (tf, GST_TYPE_FIND_MAXIMUM, "image/bmp",
- "width", G_TYPE_INT, w, "height", G_TYPE_INT, h, "bpp", G_TYPE_INT, bpp,
- NULL);
-}
-
-/*** image/tiff ***/
-static GstStaticCaps tiff_caps = GST_STATIC_CAPS ("image/tiff, "
- "endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }");
-#define TIFF_CAPS (gst_static_caps_get(&tiff_caps))
-static GstStaticCaps tiff_be_caps = GST_STATIC_CAPS ("image/tiff, "
- "endianness = (int) BIG_ENDIAN");
-#define TIFF_BE_CAPS (gst_static_caps_get(&tiff_be_caps))
-static GstStaticCaps tiff_le_caps = GST_STATIC_CAPS ("image/tiff, "
- "endianness = (int) LITTLE_ENDIAN");
-#define TIFF_LE_CAPS (gst_static_caps_get(&tiff_le_caps))
-static void
-tiff_type_find (GstTypeFind * tf, gpointer ununsed)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 8);
- guint8 le_header[4] = { 0x49, 0x49, 0x2A, 0x00 };
- guint8 be_header[4] = { 0x4D, 0x4D, 0x00, 0x2A };
-
- if (data) {
- if (memcmp (data, le_header, 4) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, TIFF_LE_CAPS);
- } else if (memcmp (data, be_header, 4) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, TIFF_BE_CAPS);
- }
- }
-}
-
-/*** PNM ***/
-
-static GstStaticCaps pnm_caps = GST_STATIC_CAPS ("image/x-portable-bitmap; "
- "image/x-portable-graymap; image/x-portable-pixmap; "
- "image/x-portable-anymap");
-
-#define PNM_CAPS (gst_static_caps_get(&pnm_caps))
-
-#define IS_PNM_WHITESPACE(c) \
- ((c) == ' ' || (c) == '\r' || (c) == '\n' || (c) == 't')
-
-static void
-pnm_type_find (GstTypeFind * tf, gpointer ununsed)
-{
- const gchar *media_type = NULL;
- DataScanCtx c = { 0, NULL, 0 };
- guint h = 0, w = 0;
-
- if (G_UNLIKELY (!data_scan_ctx_ensure_data (tf, &c, 16)))
- return;
-
- /* see http://en.wikipedia.org/wiki/Netpbm_format */
- if (c.data[0] != 'P' || c.data[1] < '1' || c.data[1] > '7' ||
- !IS_PNM_WHITESPACE (c.data[2]) ||
- (c.data[3] != '#' && c.data[3] < '0' && c.data[3] > '9'))
- return;
-
- switch (c.data[1]) {
- case '1':
- media_type = "image/x-portable-bitmap"; /* ASCII */
- break;
- case '2':
- media_type = "image/x-portable-graymap"; /* ASCII */
- break;
- case '3':
- media_type = "image/x-portable-pixmap"; /* ASCII */
- break;
- case '4':
- media_type = "image/x-portable-bitmap"; /* Raw */
- break;
- case '5':
- media_type = "image/x-portable-graymap"; /* Raw */
- break;
- case '6':
- media_type = "image/x-portable-pixmap"; /* Raw */
- break;
- case '7':
- media_type = "image/x-portable-anymap";
- break;
- default:
- g_return_if_reached ();
- }
-
- /* try to extract width and height as well */
- if (c.data[1] != '7') {
- gchar s[64] = { 0, }
- , sep1, sep2;
-
- /* need to skip any comment lines first */
- data_scan_ctx_advance (tf, &c, 3);
- while (c.data[0] == '#') { /* we know there's still data left */
- data_scan_ctx_advance (tf, &c, 1);
- while (c.data[0] != '\n' && c.data[0] != '\r') {
- if (!data_scan_ctx_ensure_data (tf, &c, 4))
- return;
- data_scan_ctx_advance (tf, &c, 1);
- }
- data_scan_ctx_advance (tf, &c, 1);
- GST_LOG ("skipped comment line in PNM header");
- }
-
- if (!data_scan_ctx_ensure_data (tf, &c, 32) &&
- !data_scan_ctx_ensure_data (tf, &c, 4)) {
- return;
- }
-
- /* need to NUL-terminate data for sscanf */
- memcpy (s, c.data, MIN (sizeof (s) - 1, c.size));
- if (sscanf (s, "%u%c%u%c", &w, &sep1, &h, &sep2) == 4 &&
- IS_PNM_WHITESPACE (sep1) && IS_PNM_WHITESPACE (sep2) &&
- w > 0 && w < G_MAXINT && h > 0 && h < G_MAXINT) {
- GST_LOG ("extracted PNM width and height: %dx%d", w, h);
- } else {
- w = 0;
- h = 0;
- }
- } else {
- /* FIXME: extract width + height for anymaps too */
- }
-
- if (w > 0 && h > 0) {
- gst_type_find_suggest_simple (tf, GST_TYPE_FIND_MAXIMUM, media_type,
- "width", G_TYPE_INT, w, "height", G_TYPE_INT, h, NULL);
- } else {
- gst_type_find_suggest_simple (tf, GST_TYPE_FIND_LIKELY, media_type, NULL);
- }
-}
-
-static GstStaticCaps sds_caps = GST_STATIC_CAPS ("audio/x-sds");
-
-#define SDS_CAPS (gst_static_caps_get(&sds_caps))
-static void
-sds_type_find (GstTypeFind * tf, gpointer ununsed)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
- guint8 mask[4] = { 0xFF, 0xFF, 0x80, 0xFF };
- guint8 match[4] = { 0xF0, 0x7E, 0, 0x01 };
- gint x;
-
- if (data) {
- for (x = 0; x < 4; x++) {
- if ((data[x] & mask[x]) != match[x]) {
- return;
- }
- }
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SDS_CAPS);
- }
-}
-
-static GstStaticCaps ircam_caps = GST_STATIC_CAPS ("audio/x-ircam");
-
-#define IRCAM_CAPS (gst_static_caps_get(&ircam_caps))
-static void
-ircam_type_find (GstTypeFind * tf, gpointer ununsed)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
- guint8 mask[4] = { 0xFF, 0xFF, 0xF8, 0xFF };
- guint8 match[4] = { 0x64, 0xA3, 0x00, 0x00 };
- gint x;
- gboolean matched = TRUE;
-
- if (!data) {
- return;
- }
- for (x = 0; x < 4; x++) {
- if ((data[x] & mask[x]) != match[x]) {
- matched = FALSE;
- }
- }
- if (matched) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, IRCAM_CAPS);
- return;
- }
- /* now try the reverse version */
- matched = TRUE;
- for (x = 0; x < 4; x++) {
- if ((data[x] & mask[3 - x]) != match[3 - x]) {
- matched = FALSE;
- }
- }
-}
-
-
-/*** video/x-matroska ***/
-static GstStaticCaps matroska_caps = GST_STATIC_CAPS ("video/x-matroska");
-
-#define MATROSKA_CAPS (gst_static_caps_get(&matroska_caps))
-static void
-matroska_type_find (GstTypeFind * tf, gpointer ununsed)
-{
- /* 4 bytes for EBML ID, 1 byte for header length identifier */
- guint8 *data = gst_type_find_peek (tf, 0, 4 + 1);
- gint len_mask = 0x80, size = 1, n = 1, total;
- guint8 probe_data[] = { 'm', 'a', 't', 'r', 'o', 's', 'k', 'a' };
-
- if (!data)
- return;
-
- /* ebml header? */
- if (data[0] != 0x1A || data[1] != 0x45 || data[2] != 0xDF || data[3] != 0xA3)
- return;
-
- /* length of header */
- total = data[4];
- while (size <= 8 && !(total & len_mask)) {
- size++;
- len_mask >>= 1;
- }
- if (size > 8)
- return;
- total &= (len_mask - 1);
- while (n < size)
- total = (total << 8) | data[4 + n++];
-
- /* get new data for full header, 4 bytes for EBML ID,
- * EBML length tag and the actual header */
- data = gst_type_find_peek (tf, 0, 4 + size + total);
- if (!data)
- return;
-
- /* the header must contain the document type 'matroska'. For now,
- * we don't parse the whole header but simply check for the
- * availability of that array of characters inside the header.
- * Not fully fool-proof, but good enough. */
- for (n = 4 + size; n <= 4 + size + total - sizeof (probe_data); n++)
- if (!memcmp (&data[n], probe_data, sizeof (probe_data))) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MATROSKA_CAPS);
- break;
- }
-}
-
-/*** application/mxf ***/
-static GstStaticCaps mxf_caps = GST_STATIC_CAPS ("application/mxf");
-
-#define MXF_MAX_PROBE_LENGTH (1024 * 64)
-#define MXF_CAPS (gst_static_caps_get(&mxf_caps))
-
-/*
- * MXF files start with a header partition pack key of 16 bytes which is defined
- * at SMPTE-377M 6.1. Before this there can be up to 64K of run-in which _must_
- * not contain the partition pack key.
- */
-static void
-mxf_type_find (GstTypeFind * tf, gpointer ununsed)
-{
- static const guint8 partition_pack_key[] =
- { 0x06, 0x0e, 0x2b, 0x34, 0x02, 0x05, 0x01, 0x01, 0x0d, 0x01, 0x02, 0x01,
- 0x01
- };
- DataScanCtx c = { 0, NULL, 0 };
-
- while (c.offset <= MXF_MAX_PROBE_LENGTH) {
- guint i;
- if (G_UNLIKELY (!data_scan_ctx_ensure_data (tf, &c, 1024)))
- break;
-
- /* look over in chunks of 1kbytes to avoid too much overhead */
-
- for (i = 0; i < 1024 - 16; i++) {
- /* Check first byte before calling more expensive memcmp function */
- if (G_UNLIKELY (c.data[i] == 0x06
- && memcmp (c.data + i, partition_pack_key, 13) == 0)) {
- /* Header partition pack? */
- if (c.data[i + 13] != 0x02)
- goto advance;
-
- /* Partition status */
- if (c.data[i + 14] >= 0x05)
- goto advance;
-
- /* Reserved, must be 0x00 */
- if (c.data[i + 15] != 0x00)
- goto advance;
-
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MXF_CAPS);
- return;
- }
- }
-
- advance:
- data_scan_ctx_advance (tf, &c, 1024 - 16);
- }
-}
-
-/*** video/x-dv ***/
-
-static GstStaticCaps dv_caps = GST_STATIC_CAPS ("video/x-dv, "
- "systemstream = (boolean) true");
-#define DV_CAPS (gst_static_caps_get(&dv_caps))
-static void
-dv_type_find (GstTypeFind * tf, gpointer private)
-{
- guint8 *data;
-
- data = gst_type_find_peek (tf, 0, 5);
-
- /* check for DIF and DV flag */
- if (data && (data[0] == 0x1f) && (data[1] == 0x07) && (data[2] == 0x00)) {
- const gchar *format;
-
- if (data[3] & 0x80) {
- format = "PAL";
- } else {
- format = "NTSC";
- }
-
- gst_type_find_suggest_simple (tf, GST_TYPE_FIND_MAXIMUM, "video/x-dv",
- "systemstream", G_TYPE_BOOLEAN, TRUE,
- "format", G_TYPE_STRING, format, NULL);
- }
-}
-
-
-/*** application/ogg and application/x-annodex ***/
-static GstStaticCaps ogg_caps = GST_STATIC_CAPS ("application/ogg");
-static GstStaticCaps annodex_caps = GST_STATIC_CAPS ("application/x-annodex");
-static GstStaticCaps ogg_annodex_caps =
- GST_STATIC_CAPS ("application/ogg;application/x-annodex");
-
-#define OGGANX_CAPS (gst_static_caps_get(&ogg_annodex_caps))
-
-static void
-ogganx_type_find (GstTypeFind * tf, gpointer private)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
-
- if ((data != NULL) && (memcmp (data, "OggS", 4) == 0)) {
-
- /* Check for an annodex fishbone header */
- data = gst_type_find_peek (tf, 28, 8);
- if (data && memcmp (data, "fishead\0", 8) == 0)
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM,
- gst_static_caps_get (&annodex_caps));
-
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM,
- gst_static_caps_get (&ogg_caps));
- }
-}
-
-/*** audio/x-vorbis ***/
-static GstStaticCaps vorbis_caps = GST_STATIC_CAPS ("audio/x-vorbis");
-
-#define VORBIS_CAPS (gst_static_caps_get(&vorbis_caps))
-static void
-vorbis_type_find (GstTypeFind * tf, gpointer private)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 30);
-
- if (data) {
- guint blocksize_0;
- guint blocksize_1;
-
- /* 1 byte packet type (identification=0x01)
- 6 byte string "vorbis"
- 4 byte vorbis version */
- if (memcmp (data, "\001vorbis\000\000\000\000", 11) != 0)
- return;
- data += 11;
- /* 1 byte channels must be != 0 */
- if (data[0] == 0)
- return;
- data++;
- /* 4 byte samplerate must be != 0 */
- if (GST_READ_UINT32_LE (data) == 0)
- return;
- data += 16;
- /* blocksize checks */
- blocksize_0 = data[0] & 0x0F;
- blocksize_1 = (data[0] & 0xF0) >> 4;
- if (blocksize_0 > blocksize_1)
- return;
- if (blocksize_0 < 6 || blocksize_0 > 13)
- return;
- if (blocksize_1 < 6 || blocksize_1 > 13)
- return;
- data++;
- /* framing bit */
- if ((data[0] & 0x01) != 1)
- return;
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, VORBIS_CAPS);
- }
-}
-
-/*** video/x-theora ***/
-
-static GstStaticCaps theora_caps = GST_STATIC_CAPS ("video/x-theora");
-
-#define THEORA_CAPS (gst_static_caps_get(&theora_caps))
-static void
-theora_type_find (GstTypeFind * tf, gpointer private)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 7); //42);
-
- if (data) {
- if (data[0] != 0x80)
- return;
- if (memcmp (&data[1], "theora", 6) != 0)
- return;
- /* FIXME: make this more reliable when specs are out */
-
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, THEORA_CAPS);
- }
-}
-
-/*** kate ***/
-static void
-kate_type_find (GstTypeFind * tf, gpointer private)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 64);
- gchar category[16] = { 0, };
-
- if (G_UNLIKELY (data == NULL))
- return;
-
- /* see: http://wiki.xiph.org/index.php/OggKate#Format_specification */
- if (G_LIKELY (memcmp (data, "\200kate\0\0\0", 8) != 0))
- return;
-
- /* make sure we always have a NUL-terminated string */
- memcpy (category, data + 48, 15);
- GST_LOG ("kate category: %s", category);
- /* canonical categories for subtitles: subtitles, spu-subtitles, SUB, K-SPU */
- if (strcmp (category, "subtitles") == 0 || strcmp (category, "SUB") == 0 ||
- strcmp (category, "spu-subtitles") == 0 ||
- strcmp (category, "K-SPU") == 0) {
- gst_type_find_suggest_simple (tf, GST_TYPE_FIND_MAXIMUM,
- "subtitle/x-kate", NULL);
- } else {
- gst_type_find_suggest_simple (tf, GST_TYPE_FIND_MAXIMUM,
- "application/x-kate", NULL);
- }
-}
-
-/*** application/x-ogm-video or audio***/
-
-static GstStaticCaps ogmvideo_caps =
-GST_STATIC_CAPS ("application/x-ogm-video");
-#define OGMVIDEO_CAPS (gst_static_caps_get(&ogmvideo_caps))
-static void
-ogmvideo_type_find (GstTypeFind * tf, gpointer private)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 9);
-
- if (data) {
- if (memcmp (data, "\001video\000\000\000", 9) != 0)
- return;
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, OGMVIDEO_CAPS);
- }
-}
-
-static GstStaticCaps ogmaudio_caps =
-GST_STATIC_CAPS ("application/x-ogm-audio");
-#define OGMAUDIO_CAPS (gst_static_caps_get(&ogmaudio_caps))
-static void
-ogmaudio_type_find (GstTypeFind * tf, gpointer private)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 9);
-
- if (data) {
- if (memcmp (data, "\001audio\000\000\000", 9) != 0)
- return;
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, OGMAUDIO_CAPS);
- }
-}
-
-static GstStaticCaps ogmtext_caps = GST_STATIC_CAPS ("application/x-ogm-text");
-
-#define OGMTEXT_CAPS (gst_static_caps_get(&ogmtext_caps))
-static void
-ogmtext_type_find (GstTypeFind * tf, gpointer private)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 9);
-
- if (data) {
- if (memcmp (data, "\001text\000\000\000\000", 9) != 0)
- return;
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, OGMTEXT_CAPS);
- }
-}
-
-/*** audio/x-speex ***/
-
-static GstStaticCaps speex_caps = GST_STATIC_CAPS ("audio/x-speex");
-
-#define SPEEX_CAPS (gst_static_caps_get(&speex_caps))
-static void
-speex_type_find (GstTypeFind * tf, gpointer private)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 80);
-
- if (data) {
- /* 8 byte string "Speex "
- 24 byte speex version string + int */
- if (memcmp (data, "Speex ", 8) != 0)
- return;
- data += 32;
-
- /* 4 byte header size >= 80 */
- if (GST_READ_UINT32_LE (data) < 80)
- return;
- data += 4;
-
- /* 4 byte sample rate <= 48000 */
- if (GST_READ_UINT32_LE (data) > 48000)
- return;
- data += 4;
-
- /* currently there are only 3 speex modes. */
- if (GST_READ_UINT32_LE (data) > 3)
- return;
- data += 12;
-
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SPEEX_CAPS);
- }
-}
-
-/*** audio/x-celt ***/
-
-static GstStaticCaps celt_caps = GST_STATIC_CAPS ("audio/x-celt");
-
-#define CELT_CAPS (gst_static_caps_get(&celt_caps))
-static void
-celt_type_find (GstTypeFind * tf, gpointer private)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 8);
-
- if (data) {
- /* 8 byte string "CELT " */
- if (memcmp (data, "CELT ", 8) != 0)
- return;
-
- /* TODO: Check other values of the CELT header */
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, CELT_CAPS);
- }
-}
-
-/*** application/x-ogg-skeleton ***/
-static GstStaticCaps ogg_skeleton_caps =
-GST_STATIC_CAPS ("application/x-ogg-skeleton, parsed=(boolean)FALSE");
-#define OGG_SKELETON_CAPS (gst_static_caps_get(&ogg_skeleton_caps))
-static void
-oggskel_type_find (GstTypeFind * tf, gpointer private)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 12);
-
- if (data) {
- /* 8 byte string "fishead\0" for the ogg skeleton stream */
- if (memcmp (data, "fishead\0", 8) != 0)
- return;
- data += 8;
-
- /* Require that the header contains version 3.0 */
- if (GST_READ_UINT16_LE (data) != 3)
- return;
- data += 2;
- if (GST_READ_UINT16_LE (data) != 0)
- return;
-
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, OGG_SKELETON_CAPS);
- }
-}
-
-static GstStaticCaps cmml_caps = GST_STATIC_CAPS ("text/x-cmml");
-
-#define CMML_CAPS (gst_static_caps_get(&cmml_caps))
-static void
-cmml_type_find (GstTypeFind * tf, gpointer private)
-{
- /* Header is 12 bytes minimum (though we don't check the minor version */
- guint8 *data = gst_type_find_peek (tf, 0, 12);
-
- if (data) {
-
- /* 8 byte string "CMML\0\0\0\0" for the magic number */
- if (memcmp (data, "CMML\0\0\0\0", 8) != 0)
- return;
- data += 8;
-
- /* Require that the header contains at least version 2.0 */
- if (GST_READ_UINT16_LE (data) < 2)
- return;
-
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, CMML_CAPS);
- }
-}
-
-/*** application/x-tar ***/
-
-static GstStaticCaps tar_caps = GST_STATIC_CAPS ("application/x-tar");
-
-#define TAR_CAPS (gst_static_caps_get(&tar_caps))
-#define OLDGNU_MAGIC "ustar " /* 7 chars and a NUL */
-#define NEWGNU_MAGIC "ustar" /* 5 chars and a NUL */
-static void
-tar_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 257, 8);
-
- /* of course we are not certain, but we don't want other typefind funcs
- * to detect formats of files within the tar archive, e.g. mp3s */
- if (data) {
- if (memcmp (data, OLDGNU_MAGIC, 8) == 0) { /* sic */
- gst_type_find_suggest (tf, GST_TYPE_FIND_NEARLY_CERTAIN, TAR_CAPS);
- } else if (memcmp (data, NEWGNU_MAGIC, 6) == 0 && /* sic */
- g_ascii_isdigit (data[6]) && g_ascii_isdigit (data[7])) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_NEARLY_CERTAIN, TAR_CAPS);
- }
- }
-}
-
-/*** application/x-ar ***/
-
-static GstStaticCaps ar_caps = GST_STATIC_CAPS ("application/x-ar");
-
-#define AR_CAPS (gst_static_caps_get(&ar_caps))
-static void
-ar_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 24);
-
- if (data && memcmp (data, "!<arch>", 7) == 0) {
- gint i;
-
- for (i = 7; i < 24; ++i) {
- if (!g_ascii_isprint (data[i]) && data[i] != '\n') {
- gst_type_find_suggest (tf, GST_TYPE_FIND_POSSIBLE, AR_CAPS);
- }
- }
-
- gst_type_find_suggest (tf, GST_TYPE_FIND_NEARLY_CERTAIN, AR_CAPS);
- }
-}
-
-/*** audio/x-au ***/
-
-/* NOTE: we cannot replace this function with TYPE_FIND_REGISTER_START_WITH,
- * as it is only possible to register one typefind factory per 'name'
- * (which is in this case the caps), and the first one would be replaced by
- * the second one. */
-static GstStaticCaps au_caps = GST_STATIC_CAPS ("audio/x-au");
-
-#define AU_CAPS (gst_static_caps_get(&au_caps))
-static void
-au_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
-
- if (data) {
- if (memcmp (data, ".snd", 4) == 0 || memcmp (data, "dns.", 4) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, AU_CAPS);
- }
- }
-}
-
-
-/*** video/x-nuv ***/
-
-/* NOTE: we cannot replace this function with TYPE_FIND_REGISTER_START_WITH,
- * as it is only possible to register one typefind factory per 'name'
- * (which is in this case the caps), and the first one would be replaced by
- * the second one. */
-static GstStaticCaps nuv_caps = GST_STATIC_CAPS ("video/x-nuv");
-
-#define NUV_CAPS (gst_static_caps_get(&nuv_caps))
-static void
-nuv_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 11);
-
- if (data) {
- if (memcmp (data, "MythTVVideo", 11) == 0
- || memcmp (data, "NuppelVideo", 11) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, NUV_CAPS);
- }
- }
-}
-
-/*** audio/x-paris ***/
-/* NOTE: do not replace this function with two TYPE_FIND_REGISTER_START_WITH */
-static GstStaticCaps paris_caps = GST_STATIC_CAPS ("audio/x-paris");
-
-#define PARIS_CAPS (gst_static_caps_get(&paris_caps))
-static void
-paris_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
-
- if (data) {
- if (memcmp (data, " paf", 4) == 0 || memcmp (data, "fap ", 4) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, PARIS_CAPS);
- }
- }
-}
-
-/*** audio/iLBC-sh ***/
-/* NOTE: do not replace this function with two TYPE_FIND_REGISTER_START_WITH */
-static GstStaticCaps ilbc_caps = GST_STATIC_CAPS ("audio/iLBC-sh");
-
-#define ILBC_CAPS (gst_static_caps_get(&ilbc_caps))
-static void
-ilbc_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 8);
-
- if (data) {
- if (memcmp (data, "#!iLBC30", 8) == 0 || memcmp (data, "#!iLBC20", 8) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, ILBC_CAPS);
- }
- }
-}
-
-/*** application/x-ms-dos-executable ***/
-
-static GstStaticCaps msdos_caps =
-GST_STATIC_CAPS ("application/x-ms-dos-executable");
-#define MSDOS_CAPS (gst_static_caps_get(&msdos_caps))
-/* see http://www.madchat.org/vxdevl/papers/winsys/pefile/pefile.htm */
-static void
-msdos_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 64);
-
- if (data && data[0] == 'M' && data[1] == 'Z' &&
- GST_READ_UINT16_LE (data + 8) == 4) {
- guint32 pe_offset = GST_READ_UINT32_LE (data + 60);
-
- data = gst_type_find_peek (tf, pe_offset, 2);
- if (data && data[0] == 'P' && data[1] == 'E') {
- gst_type_find_suggest (tf, GST_TYPE_FIND_NEARLY_CERTAIN, MSDOS_CAPS);
- }
- }
-}
-
-/*** application/x-mmsh ***/
-
-static GstStaticCaps mmsh_caps = GST_STATIC_CAPS ("application/x-mmsh");
-
-#define MMSH_CAPS gst_static_caps_get(&mmsh_caps)
-
-/* This is to recognise mssh-over-http */
-static void
-mmsh_type_find (GstTypeFind * tf, gpointer unused)
-{
- static const guint8 asf_marker[16] = { 0x30, 0x26, 0xb2, 0x75, 0x8e, 0x66,
- 0xcf, 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c
- };
-
- guint8 *data;
-
- data = gst_type_find_peek (tf, 0, 2 + 2 + 4 + 2 + 2 + 16);
- if (data && data[0] == 0x24 && data[1] == 0x48 &&
- GST_READ_UINT16_LE (data + 2) > 2 + 2 + 4 + 2 + 2 + 16 &&
- memcmp (data + 2 + 2 + 4 + 2 + 2, asf_marker, 16) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, MMSH_CAPS);
- }
-}
-
-/*** video/x-dirac ***/
-
-/* NOTE: we cannot replace this function with TYPE_FIND_REGISTER_START_WITH,
- * as it is only possible to register one typefind factory per 'name'
- * (which is in this case the caps), and the first one would be replaced by
- * the second one. */
-static GstStaticCaps dirac_caps = GST_STATIC_CAPS ("video/x-dirac");
-
-#define DIRAC_CAPS (gst_static_caps_get(&dirac_caps))
-static void
-dirac_type_find (GstTypeFind * tf, gpointer unused)
-{
- guint8 *data = gst_type_find_peek (tf, 0, 8);
-
- if (data) {
- if (memcmp (data, "BBCD", 4) == 0 || memcmp (data, "KW-DIRAC", 8) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, DIRAC_CAPS);
- }
- }
-}
-
-/*** video/vivo ***/
-
-static GstStaticCaps vivo_caps = GST_STATIC_CAPS ("video/vivo");
-
-#define VIVO_CAPS gst_static_caps_get(&vivo_caps)
-
-static void
-vivo_type_find (GstTypeFind * tf, gpointer unused)
-{
- static const guint8 vivo_marker[] = { 'V', 'e', 'r', 's', 'i', 'o', 'n',
- ':', 'V', 'i', 'v', 'o', '/'
- };
- guint8 *data;
- guint hdr_len, pos;
-
- data = gst_type_find_peek (tf, 0, 1024);
- if (data == NULL || data[0] != 0x00)
- return;
-
- if ((data[1] & 0x80)) {
- if ((data[2] & 0x80))
- return;
- hdr_len = ((guint) (data[1] & 0x7f)) << 7;
- hdr_len += data[2];
- if (hdr_len > 2048)
- return;
- pos = 3;
- } else {
- hdr_len = data[1];
- pos = 2;
- }
-
- /* 1008 = 1022 - strlen ("Version:Vivo/") - 1 */
- while (pos < 1008 && data[pos] == '\r' && data[pos + 1] == '\n')
- pos += 2;
-
- if (memcmp (data + pos, vivo_marker, sizeof (vivo_marker)) == 0) {
- gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, VIVO_CAPS);
- }
-}
-
-/*** XDG MIME typefinder (to avoid false positives mostly) ***/
-
-#ifdef USE_GIO
-static void
-xdgmime_typefind (GstTypeFind * find, gpointer user_data)
-{
- gchar *mimetype;
- gsize length = 16384;
- guint64 tf_length;
- guint8 *data;
- gchar *tmp;
-
- if ((tf_length = gst_type_find_get_length (find)) > 0)
- length = MIN (length, tf_length);
-
- if ((data = gst_type_find_peek (find, 0, length)) == NULL)
- return;
-
- tmp = g_content_type_guess (NULL, data, length, NULL);
- if (tmp == NULL || g_content_type_is_unknown (tmp)) {
- g_free (tmp);
- return;
- }
-
- mimetype = g_content_type_get_mime_type (tmp);
- g_free (tmp);
-
- if (mimetype == NULL)
- return;
-
- GST_DEBUG ("Got mimetype '%s'", mimetype);
-
- /* Ignore audio/video types:
- * - our own typefinders in -base are likely to be better at this
- * (and if they're not, we really want to fix them, that's why we don't
- * report xdg-detected audio/video types at all, not even with a low
- * probability)
- * - we want to detect GStreamer media types and not MIME types
- * - the purpose of this xdg mime finder is mainly to prevent false
- * positives of non-media formats, not to typefind audio/video formats */
- if (g_str_has_prefix (mimetype, "audio/") ||
- g_str_has_prefix (mimetype, "video/")) {
- GST_LOG ("Ignoring audio/video mime type");
- g_free (mimetype);
- return;
- }
-
- /* Again, we mainly want the xdg typefinding to prevent false-positives on
- * non-media formats, so suggest the type with a probability that trumps
- * uncertain results of our typefinders, but not more than that. */
- GST_LOG ("Suggesting '%s' with probability POSSIBLE", mimetype);
- gst_type_find_suggest_simple (find, GST_TYPE_FIND_POSSIBLE, mimetype, NULL);
- g_free (mimetype);
-}
-#endif /* USE_GIO */
-
-/*** generic typefind for streams that have some data at a specific position***/
-typedef struct
-{
- const guint8 *data;
- guint size;
- guint probability;
- GstCaps *caps;
-}
-GstTypeFindData;
-
-static void
-start_with_type_find (GstTypeFind * tf, gpointer private)
-{
- GstTypeFindData *start_with = (GstTypeFindData *) private;
- guint8 *data;
-
- GST_LOG ("trying to find mime type %s with the first %u bytes of data",
- gst_structure_get_name (gst_caps_get_structure (start_with->caps, 0)),
- start_with->size);
- data = gst_type_find_peek (tf, 0, start_with->size);
- if (data && memcmp (data, start_with->data, start_with->size) == 0) {
- gst_type_find_suggest (tf, start_with->probability, start_with->caps);
- }
-}
-
-static void
-sw_data_destroy (GstTypeFindData * sw_data)
-{
- if (G_LIKELY (sw_data->caps != NULL))
- gst_caps_unref (sw_data->caps);
- g_free (sw_data);
-}
-
-#define TYPE_FIND_REGISTER_START_WITH(plugin,name,rank,ext,_data,_size,_probability)\
-G_BEGIN_DECLS{ \
- GstTypeFindData *sw_data = g_new (GstTypeFindData, 1); \
- sw_data->data = (const guint8 *)_data; \
- sw_data->size = _size; \
- sw_data->probability = _probability; \
- sw_data->caps = gst_caps_new_simple (name, NULL); \
- if (!gst_type_find_register (plugin, name, rank, start_with_type_find,\
- ext, sw_data->caps, sw_data, \
- (GDestroyNotify) (sw_data_destroy))) { \
- gst_caps_unref (sw_data->caps); \
- g_free (sw_data); \
- } \
-}G_END_DECLS
-
-/*** same for riff types ***/
-
-static void
-riff_type_find (GstTypeFind * tf, gpointer private)
-{
- GstTypeFindData *riff_data = (GstTypeFindData *) private;
- guint8 *data = gst_type_find_peek (tf, 0, 12);
-
- if (data && (memcmp (data, "RIFF", 4) == 0 || memcmp (data, "AVF0", 4) == 0)) {
- data += 8;
- if (memcmp (data, riff_data->data, 4) == 0)
- gst_type_find_suggest (tf, riff_data->probability, riff_data->caps);
- }
-}
-
-#define TYPE_FIND_REGISTER_RIFF(plugin,name,rank,ext,_data) \
-G_BEGIN_DECLS{ \
- GstTypeFindData *sw_data = g_new (GstTypeFindData, 1); \
- sw_data->data = (gpointer)_data; \
- sw_data->size = 4; \
- sw_data->probability = GST_TYPE_FIND_MAXIMUM; \
- sw_data->caps = gst_caps_new_simple (name, NULL); \
- if (!gst_type_find_register (plugin, name, rank, riff_type_find, \
- ext, sw_data->caps, sw_data, \
- (GDestroyNotify) (sw_data_destroy))) { \
- gst_caps_unref (sw_data->caps); \
- g_free (sw_data); \
- } \
-}G_END_DECLS
-
-
-/*** plugin initialization ***/
-
-#define TYPE_FIND_REGISTER(plugin,name,rank,func,ext,caps,priv,notify) \
-G_BEGIN_DECLS{\
- if (!gst_type_find_register (plugin, name, rank, func, ext, caps, priv, notify))\
- return FALSE; \
-}G_END_DECLS
-
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- /* can't initialize this via a struct as caps can't be statically initialized */
-
- /* note: asx/wax/wmx are XML files, asf doesn't handle them */
- /* FIXME-0.11: these should be const,
- this requires gstreamer/gst/gsttypefind::gst_type_find_register()
- to have define the parameter as const
- */
- static gchar *asf_exts[] = { "asf", "wm", "wma", "wmv", NULL };
- static gchar *au_exts[] = { "au", "snd", NULL };
- static gchar *avi_exts[] = { "avi", NULL };
- static gchar *qcp_exts[] = { "qcp", NULL };
- static gchar *cdxa_exts[] = { "dat", NULL };
- static gchar *flac_exts[] = { "flac", NULL };
- static gchar *flx_exts[] = { "flc", "fli", NULL };
- static gchar *id3_exts[] =
- { "mp3", "mp2", "mp1", "mpga", "ogg", "flac", "tta", NULL };
- static gchar *apetag_exts[] = { "ape", "mpc", "wv", NULL }; /* and mp3 and wav? */
- static gchar *tta_exts[] = { "tta", NULL };
- static gchar *mod_exts[] = { "669", "amf", "dsm", "gdm", "far", "imf",
- "it", "med", "mod", "mtm", "okt", "sam",
- "s3m", "stm", "stx", "ult", "xm", NULL
- };
- static gchar *mp3_exts[] = { "mp3", "mp2", "mp1", "mpga", NULL };
- static gchar *ac3_exts[] = { "ac3", NULL };
- static gchar *gsm_exts[] = { "gsm", NULL };
- static gchar *musepack_exts[] = { "mpc", "mpp", "mp+", NULL };
- static gchar *mpeg_sys_exts[] = { "mpe", "mpeg", "mpg", NULL };
- static gchar *mpeg_video_exts[] = { "mpv", "mpeg", "mpg", NULL };
- static gchar *mpeg_ts_exts[] = { "ts", NULL };
- static gchar *ogg_exts[] = { "anx", "ogg", "ogm", NULL };
- static gchar *qt_exts[] = { "mov", NULL };
- static gchar *qtif_exts[] = { "qif", "qtif", "qti", NULL };
- static gchar *mj2_exts[] = { "mj2", NULL };
- static gchar *jp2_exts[] = { "jp2", NULL };
- static gchar *rm_exts[] = { "ra", "ram", "rm", "rmvb", NULL };
- static gchar *swf_exts[] = { "swf", "swfl", NULL };
- static gchar *utf8_exts[] = { "txt", NULL };
- static gchar *wav_exts[] = { "wav", NULL };
- static gchar *aiff_exts[] = { "aiff", "aif", "aifc", NULL };
- static gchar *svx_exts[] = { "iff", "svx", NULL };
- static gchar *paris_exts[] = { "paf", NULL };
- static gchar *nist_exts[] = { "nist", NULL };
- static gchar *voc_exts[] = { "voc", NULL };
- static gchar *sds_exts[] = { "sds", NULL };
- static gchar *ircam_exts[] = { "sf", NULL };
- static gchar *w64_exts[] = { "w64", NULL };
- static gchar *shn_exts[] = { "shn", NULL };
- static gchar *ape_exts[] = { "ape", NULL };
- static gchar *uri_exts[] = { "ram", NULL };
- static gchar *sdp_exts[] = { "sdp", NULL };
- static gchar *smil_exts[] = { "smil", NULL };
- static gchar *html_exts[] = { "htm", "html", NULL };
- static gchar *xml_exts[] = { "xml", NULL };
- static gchar *jpeg_exts[] = { "jpg", "jpe", "jpeg", NULL };
- static gchar *gif_exts[] = { "gif", NULL };
- static gchar *png_exts[] = { "png", NULL };
- static gchar *bmp_exts[] = { "bmp", NULL };
- static gchar *tiff_exts[] = { "tif", "tiff", NULL };
- static gchar *matroska_exts[] = { "mkv", "mka", NULL };
- static gchar *mve_exts[] = { "mve", NULL };
- static gchar *dv_exts[] = { "dv", "dif", NULL };
- static gchar *amr_exts[] = { "amr", NULL };
- static gchar *ilbc_exts[] = { "ilbc", NULL };
- static gchar *sid_exts[] = { "sid", NULL };
- static gchar *xcf_exts[] = { "xcf", NULL };
- static gchar *mng_exts[] = { "mng", NULL };
- static gchar *jng_exts[] = { "jng", NULL };
- static gchar *xpm_exts[] = { "xpm", NULL };
- static gchar *pnm_exts[] = { "pnm", "ppm", "pgm", "pbm", NULL };
- static gchar *ras_exts[] = { "ras", NULL };
- static gchar *bz2_exts[] = { "bz2", NULL };
- static gchar *gz_exts[] = { "gz", NULL };
- static gchar *zip_exts[] = { "zip", NULL };
- static gchar *compress_exts[] = { "Z", NULL };
- static gchar *m4a_exts[] = { "m4a", NULL };
- static gchar *q3gp_exts[] = { "3gp", NULL };
- static gchar *aac_exts[] = { "aac", NULL };
- static gchar *spc_exts[] = { "spc", NULL };
- static gchar *wavpack_exts[] = { "wv", "wvp", NULL };
- static gchar *wavpack_correction_exts[] = { "wvc", NULL };
- static gchar *rar_exts[] = { "rar", NULL };
- static gchar *tar_exts[] = { "tar", NULL };
- static gchar *ar_exts[] = { "a", NULL };
- static gchar *msdos_exts[] = { "dll", "exe", "ocx", "sys", "scr",
- "msstyles", "cpl", NULL
- };
- static gchar *flv_exts[] = { "flv", NULL };
- static gchar *m4v_exts[] = { "m4v", NULL };
- static gchar *h264_exts[] = { "h264", "x264", "264", NULL };
- static gchar *nuv_exts[] = { "nuv", NULL };
- static gchar *vivo_exts[] = { "viv", NULL };
- static gchar *nsf_exts[] = { "nsf", NULL };
- static gchar *gym_exts[] = { "gym", NULL };
- static gchar *ay_exts[] = { "ay", NULL };
- static gchar *gbs_exts[] = { "gbs", NULL };
- static gchar *kss_exts[] = { "kss", NULL };
- static gchar *sap_exts[] = { "sap", NULL };
- static gchar *vgm_exts[] = { "vgm", NULL };
- static gchar *mid_exts[] = { "mid", "midi", NULL };
- static gchar *mxmf_exts[] = { "mxmf", NULL };
- static gchar *imelody_exts[] = { "imy", "ime", "imelody", NULL };
- static gchar *pdf_exts[] = { "pdf", NULL };
- static gchar *ps_exts[] = { "ps", NULL };
- static gchar *svg_exts[] = { "svg", NULL };
- static gchar *mxf_exts[] = { "mxf", NULL };
- static gchar *msword_exts[] = { "doc", NULL };
- static gchar *dsstore_exts[] = { "DS_Store", NULL };
- static gchar *psd_exts[] = { "psd", NULL };
-
- GST_DEBUG_CATEGORY_INIT (type_find_debug, "typefindfunctions",
- GST_DEBUG_FG_GREEN | GST_DEBUG_BG_RED, "generic type find functions");
-
- /* must use strings, macros don't accept initializers */
- TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-ms-asf", GST_RANK_SECONDARY,
- asf_exts,
- "\060\046\262\165\216\146\317\021\246\331\000\252\000\142\316\154", 16,
- GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER (plugin, "audio/x-musepack", GST_RANK_PRIMARY,
- musepack_type_find, musepack_exts, MUSEPACK_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "audio/x-au", GST_RANK_MARGINAL,
- au_type_find, au_exts, AU_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER_RIFF (plugin, "video/x-msvideo", GST_RANK_PRIMARY,
- avi_exts, "AVI ");
- TYPE_FIND_REGISTER_RIFF (plugin, "audio/qcelp", GST_RANK_PRIMARY,
- qcp_exts, "QLCM");
- TYPE_FIND_REGISTER_RIFF (plugin, "video/x-cdxa", GST_RANK_PRIMARY,
- cdxa_exts, "CDXA");
- TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-vcd", GST_RANK_PRIMARY,
- cdxa_exts, "\000\377\377\377\377\377\377\377\377\377\377\000", 12,
- GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-imelody", GST_RANK_PRIMARY,
- imelody_exts, "BEGIN:IMELODY", 13, GST_TYPE_FIND_MAXIMUM);
-#if 0
- TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-smoke", GST_RANK_PRIMARY,
- NULL, "\x80smoke\x00\x01\x00", 6, GST_TYPE_FIND_MAXIMUM);
-#endif
- TYPE_FIND_REGISTER (plugin, "audio/midi", GST_RANK_PRIMARY, mid_type_find,
- mid_exts, MID_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER_RIFF (plugin, "audio/riff-midi", GST_RANK_PRIMARY,
- mid_exts, "RMID");
- TYPE_FIND_REGISTER (plugin, "audio/mobile-xmf", GST_RANK_PRIMARY,
- mxmf_type_find, mxmf_exts, MXMF_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "video/x-fli", GST_RANK_MARGINAL, flx_type_find,
- flx_exts, FLX_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "application/x-id3v2", GST_RANK_PRIMARY + 103,
- id3v2_type_find, id3_exts, ID3_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "application/x-id3v1", GST_RANK_PRIMARY + 101,
- id3v1_type_find, id3_exts, ID3_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "application/x-apetag", GST_RANK_PRIMARY + 102,
- apetag_type_find, apetag_exts, APETAG_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "audio/x-ttafile", GST_RANK_PRIMARY,
- tta_type_find, tta_exts, TTA_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "audio/x-mod", GST_RANK_SECONDARY, mod_type_find,
- mod_exts, MOD_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "audio/mpeg", GST_RANK_PRIMARY, mp3_type_find,
- mp3_exts, MP3_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "audio/x-ac3", GST_RANK_PRIMARY, ac3_type_find,
- ac3_exts, AC3_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "audio/x-gsm", GST_RANK_PRIMARY, NULL, gsm_exts,
- GSM_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "video/mpeg-sys", GST_RANK_PRIMARY,
- mpeg_sys_type_find, mpeg_sys_exts, MPEG_SYS_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "video/mpegts", GST_RANK_PRIMARY,
- mpeg_ts_type_find, mpeg_ts_exts, MPEGTS_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "application/ogg", GST_RANK_PRIMARY,
- ogganx_type_find, ogg_exts, OGGANX_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "video/mpeg-elementary", GST_RANK_MARGINAL,
- mpeg_video_stream_type_find, mpeg_video_exts, MPEG_VIDEO_CAPS, NULL,
- NULL);
- TYPE_FIND_REGISTER (plugin, "video/mpeg4", GST_RANK_PRIMARY,
- mpeg4_video_type_find, m4v_exts, MPEG_VIDEO_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "video/x-h264", GST_RANK_PRIMARY,
- h264_video_type_find, h264_exts, MPEG_VIDEO_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "video/x-nuv", GST_RANK_SECONDARY, nuv_type_find,
- nuv_exts, NUV_CAPS, NULL, NULL);
-
- /* ISO formats */
- TYPE_FIND_REGISTER (plugin, "audio/x-m4a", GST_RANK_PRIMARY, m4a_type_find,
- m4a_exts, M4A_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "application/x-3gp", GST_RANK_PRIMARY,
- q3gp_type_find, q3gp_exts, Q3GP_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "video/quicktime", GST_RANK_SECONDARY,
- qt_type_find, qt_exts, QT_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "image/x-quicktime", GST_RANK_SECONDARY,
- qtif_type_find, qtif_exts, QTIF_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "image/jp2", GST_RANK_PRIMARY,
- jp2_type_find, jp2_exts, JP2_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "video/mj2", GST_RANK_PRIMARY,
- jp2_type_find, mj2_exts, MJ2_CAPS, NULL, NULL);
-
- TYPE_FIND_REGISTER (plugin, "text/html", GST_RANK_SECONDARY, html_type_find,
- html_exts, HTML_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER_START_WITH (plugin, "application/vnd.rn-realmedia",
- GST_RANK_SECONDARY, rm_exts, ".RMF", 4, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-pn-realaudio",
- GST_RANK_SECONDARY, rm_exts, ".ra\375", 4, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER (plugin, "application/x-shockwave-flash",
- GST_RANK_SECONDARY, swf_type_find, swf_exts, SWF_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-flv", GST_RANK_SECONDARY,
- flv_exts, "FLV", 3, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER (plugin, "text/plain", GST_RANK_MARGINAL, utf8_type_find,
- utf8_exts, UTF8_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "text/uri-list", GST_RANK_MARGINAL, uri_type_find,
- uri_exts, URI_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "application/sdp", GST_RANK_SECONDARY,
- sdp_type_find, sdp_exts, SDP_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "application/smil", GST_RANK_SECONDARY,
- smil_type_find, smil_exts, SMIL_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "application/xml", GST_RANK_MARGINAL,
- xml_type_find, xml_exts, GENERIC_XML_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER_RIFF (plugin, "audio/x-wav", GST_RANK_PRIMARY, wav_exts,
- "WAVE");
- TYPE_FIND_REGISTER (plugin, "audio/x-aiff", GST_RANK_SECONDARY,
- aiff_type_find, aiff_exts, AIFF_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "audio/x-svx", GST_RANK_SECONDARY, svx_type_find,
- svx_exts, SVX_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "audio/x-paris", GST_RANK_SECONDARY,
- paris_type_find, paris_exts, PARIS_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-nist", GST_RANK_SECONDARY,
- nist_exts, "NIST", 4, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-voc", GST_RANK_SECONDARY,
- voc_exts, "Creative", 8, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER (plugin, "audio/x-sds", GST_RANK_SECONDARY, sds_type_find,
- sds_exts, SDS_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "audio/x-ircam", GST_RANK_SECONDARY,
- ircam_type_find, ircam_exts, IRCAM_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-w64", GST_RANK_SECONDARY,
- w64_exts, "riff", 4, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER (plugin, "audio/x-shorten", GST_RANK_SECONDARY,
- shn_type_find, shn_exts, SHN_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "application/x-ape", GST_RANK_SECONDARY,
- ape_type_find, ape_exts, APE_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "image/jpeg", GST_RANK_PRIMARY + 15,
- jpeg_type_find, jpeg_exts, JPEG_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER_START_WITH (plugin, "image/gif", GST_RANK_PRIMARY,
- gif_exts, "GIF8", 4, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER_START_WITH (plugin, "image/png", GST_RANK_PRIMARY + 14,
- png_exts, "\211PNG\015\012\032\012", 8, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER (plugin, "image/bmp", GST_RANK_PRIMARY, bmp_type_find,
- bmp_exts, BMP_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "image/tiff", GST_RANK_PRIMARY, tiff_type_find,
- tiff_exts, TIFF_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "image/x-portable-pixmap", GST_RANK_SECONDARY,
- pnm_type_find, pnm_exts, PNM_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "video/x-matroska", GST_RANK_PRIMARY,
- matroska_type_find, matroska_exts, MATROSKA_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "application/mxf", GST_RANK_PRIMARY,
- mxf_type_find, mxf_exts, MXF_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-mve", GST_RANK_SECONDARY,
- mve_exts, "Interplay MVE File\032\000\032\000\000\001\063\021", 26,
- GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER (plugin, "video/x-dv", GST_RANK_SECONDARY, dv_type_find,
- dv_exts, DV_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-amr-nb-sh", GST_RANK_PRIMARY,
- amr_exts, "#!AMR", 5, GST_TYPE_FIND_LIKELY);
- TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-amr-wb-sh", GST_RANK_PRIMARY,
- amr_exts, "#!AMR-WB", 7, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER (plugin, "audio/iLBC-sh", GST_RANK_PRIMARY,
- ilbc_type_find, ilbc_exts, ILBC_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-sid", GST_RANK_MARGINAL,
- sid_exts, "PSID", 4, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER_START_WITH (plugin, "image/x-xcf", GST_RANK_SECONDARY,
- xcf_exts, "gimp xcf", 8, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-mng", GST_RANK_SECONDARY,
- mng_exts, "\212MNG\015\012\032\012", 8, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER_START_WITH (plugin, "image/x-jng", GST_RANK_SECONDARY,
- jng_exts, "\213JNG\015\012\032\012", 8, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER_START_WITH (plugin, "image/x-xpixmap", GST_RANK_SECONDARY,
- xpm_exts, "/* XPM */", 9, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER_START_WITH (plugin, "image/x-sun-raster",
- GST_RANK_SECONDARY, ras_exts, "\131\246\152\225", 4,
- GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-bzip",
- GST_RANK_SECONDARY, bz2_exts, "BZh", 3, GST_TYPE_FIND_LIKELY);
- TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-gzip",
- GST_RANK_SECONDARY, gz_exts, "\037\213", 2, GST_TYPE_FIND_LIKELY);
- TYPE_FIND_REGISTER_START_WITH (plugin, "application/zip", GST_RANK_SECONDARY,
- zip_exts, "PK\003\004", 4, GST_TYPE_FIND_LIKELY);
- TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-compress",
- GST_RANK_SECONDARY, compress_exts, "\037\235", 2, GST_TYPE_FIND_LIKELY);
- TYPE_FIND_REGISTER (plugin, "subtitle/x-kate", GST_RANK_MARGINAL,
- kate_type_find, NULL, NULL, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "audio/x-flac", GST_RANK_PRIMARY,
- flac_type_find, flac_exts, FLAC_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "audio/x-vorbis", GST_RANK_PRIMARY,
- vorbis_type_find, NULL, VORBIS_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "video/x-theora", GST_RANK_PRIMARY,
- theora_type_find, NULL, THEORA_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "application/x-ogm-video", GST_RANK_PRIMARY,
- ogmvideo_type_find, NULL, OGMVIDEO_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "application/x-ogm-audio", GST_RANK_PRIMARY,
- ogmaudio_type_find, NULL, OGMAUDIO_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "application/x-ogm-text", GST_RANK_PRIMARY,
- ogmtext_type_find, NULL, OGMTEXT_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "audio/x-speex", GST_RANK_PRIMARY,
- speex_type_find, NULL, SPEEX_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "audio/x-celt", GST_RANK_PRIMARY,
- celt_type_find, NULL, CELT_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "application/x-ogg-skeleton", GST_RANK_PRIMARY,
- oggskel_type_find, NULL, OGG_SKELETON_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "text/x-cmml", GST_RANK_PRIMARY, cmml_type_find,
- NULL, CMML_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-executable",
- GST_RANK_MARGINAL, NULL, "\177ELF", 4, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER (plugin, "adts_mpeg_stream", GST_RANK_SECONDARY,
- aac_type_find, aac_exts, AAC_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-spc", GST_RANK_SECONDARY,
- spc_exts, "SNES-SPC700 Sound File Data", 27, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER (plugin, "audio/x-wavpack", GST_RANK_SECONDARY,
- wavpack_type_find, wavpack_exts, WAVPACK_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "audio/x-wavpack-correction", GST_RANK_SECONDARY,
- wavpack_type_find, wavpack_correction_exts, WAVPACK_CORRECTION_CAPS, NULL,
- NULL);
- TYPE_FIND_REGISTER (plugin, "application/postscript", GST_RANK_SECONDARY,
- postscript_type_find, ps_exts, POSTSCRIPT_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "image/svg+xml", GST_RANK_SECONDARY,
- svg_type_find, svg_exts, SVG_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER_START_WITH (plugin, "application/x-rar",
- GST_RANK_SECONDARY, rar_exts, "Rar!", 4, GST_TYPE_FIND_LIKELY);
- TYPE_FIND_REGISTER (plugin, "application/x-tar", GST_RANK_SECONDARY,
- tar_type_find, tar_exts, TAR_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "application/x-ar", GST_RANK_SECONDARY,
- ar_type_find, ar_exts, AR_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "application/x-ms-dos-executable",
- GST_RANK_SECONDARY, msdos_type_find, msdos_exts, MSDOS_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "video/x-dirac", GST_RANK_PRIMARY,
- dirac_type_find, NULL, DIRAC_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "multipart/x-mixed-replace", GST_RANK_SECONDARY,
- multipart_type_find, NULL, MULTIPART_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "application/x-mmsh", GST_RANK_SECONDARY,
- mmsh_type_find, NULL, MMSH_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER (plugin, "video/vivo", GST_RANK_SECONDARY,
- vivo_type_find, vivo_exts, VIVO_CAPS, NULL, NULL);
- TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-nsf",
- GST_RANK_SECONDARY, nsf_exts, "NESM\x1a", 5, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-gym",
- GST_RANK_SECONDARY, gym_exts, "GYMX", 4, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-ay",
- GST_RANK_SECONDARY, ay_exts, "ZXAYEMUL", 8, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-gbs",
- GST_RANK_SECONDARY, gbs_exts, "GBS\x01", 4, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-vgm",
- GST_RANK_SECONDARY, vgm_exts, "Vgm\x20", 4, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-sap",
- GST_RANK_SECONDARY, sap_exts, "SAP\x0d\x0aAUTHOR\x20", 12,
- GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-kss", GST_RANK_SECONDARY,
- kss_exts, "KSSX\0", 5, GST_TYPE_FIND_MAXIMUM);
- TYPE_FIND_REGISTER_START_WITH (plugin, "application/pdf", GST_RANK_SECONDARY,
- pdf_exts, "%PDF-", 5, GST_TYPE_FIND_LIKELY);
- TYPE_FIND_REGISTER_START_WITH (plugin, "application/msword",
- GST_RANK_SECONDARY, msword_exts, "\320\317\021\340\241\261\032\341", 8,
- GST_TYPE_FIND_LIKELY);
- /* Mac OS X .DS_Store files tend to be taken for video/mpeg */
- TYPE_FIND_REGISTER_START_WITH (plugin, "application/octet-stream",
- GST_RANK_SECONDARY, dsstore_exts, "\000\000\000\001Bud1", 8,
- GST_TYPE_FIND_LIKELY);
- TYPE_FIND_REGISTER_START_WITH (plugin, "image/vnd.adobe.photoshop",
- GST_RANK_SECONDARY, psd_exts, "8BPS\000\001\000\000\000\000", 10,
- GST_TYPE_FIND_LIKELY);
-
-#ifdef USE_GIO
- TYPE_FIND_REGISTER (plugin, "xdgmime-base", GST_RANK_MARGINAL,
- xdgmime_typefind, NULL, NULL, NULL, NULL);
-#endif
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "typefindfunctions",
- "default typefind functions",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/typefind/typefindfunctions.vcproj b/gst/typefind/typefindfunctions.vcproj
deleted file mode 100644
index 0a8922c3..00000000
--- a/gst/typefind/typefindfunctions.vcproj
+++ /dev/null
@@ -1,145 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="typefindfunctions"
- ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D678D2}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../win32/Debug"
- IntermediateDirectory="../../win32/Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;typefindfunctions_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gsttypefindfunctions.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Debug;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/typefindfunctions.pdb"
- SubSystem="2"
- OptimizeReferences="2"
- ImportLibrary="$(OutDir)/gsttypefindfunctions.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../win32/Release"
- IntermediateDirectory="../../win32/Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;typefindfunctions_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gsttypefindfunctions.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Release;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/gsttypefindfunctions.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath=".\gsttypefindfunctions.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/gst/videorate/Makefile.am b/gst/videorate/Makefile.am
deleted file mode 100644
index 8dd9d781..00000000
--- a/gst/videorate/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-noinst_HEADERS = gstvideorate.h
-
-plugin_LTLIBRARIES = libgstvideorate.la
-
-libgstvideorate_la_SOURCES = gstvideorate.c
-libgstvideorate_la_CFLAGS = $(GST_CFLAGS)
-libgstvideorate_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstvideorate_la_LIBADD = $(GST_LIBS)
-libgstvideorate_la_LIBTOOLFLAGS = --tag=disable-static
-
diff --git a/gst/videorate/gstvideorate.c b/gst/videorate/gstvideorate.c
deleted file mode 100644
index b3481338..00000000
--- a/gst/videorate/gstvideorate.c
+++ /dev/null
@@ -1,920 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-videorate
- *
- * This element takes an incoming stream of timestamped video frames.
- * It will produce a perfect stream that matches the source pad's framerate.
- *
- * The correction is performed by dropping and duplicating frames, no fancy
- * algorithm is used to interpolate frames (yet).
- *
- * By default the element will simply negotiate the same framerate on its
- * source and sink pad.
- *
- * This operation is useful to link to elements that require a perfect stream.
- * Typical examples are formats that do not store timestamps for video frames,
- * but only store a framerate, like Ogg and AVI.
- *
- * A conversion to a specific framerate can be forced by using filtered caps on
- * the source pad.
- *
- * The properties #GstVideoRate:in, #GstVideoRate:out, #GstVideoRate:duplicate
- * and #GstVideoRate:drop can be read to obtain information about number of
- * input frames, output frames, dropped frames (i.e. the number of unused input
- * frames) and duplicated frames (i.e. the number of times an input frame was
- * duplicated, beside being used normally).
- *
- * An input stream that needs no adjustments will thus never have dropped or
- * duplicated frames.
- *
- * When the #GstVideoRate:silent property is set to FALSE, a GObject property
- * notification will be emitted whenever one of the #GstVideoRate:duplicate or
- * #GstVideoRate:drop values changes.
- * This can potentially cause performance degradation.
- * Note that property notification will happen from the streaming thread, so
- * applications should be prepared for this.
- *
- * <refsect2>
- * <title>Example pipelines</title>
- * |[
- * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! videorate ! video/x-raw-yuv,framerate=15/1 ! xvimagesink
- * ]| Decode an Ogg/Theora file and adjust the framerate to 15 fps before playing.
- * To create the test Ogg/Theora file refer to the documentation of theoraenc.
- * |[
- * gst-launch -v v4lsrc ! videorate ! video/x-raw-yuv,framerate=25/2 ! theoraenc ! oggmux ! filesink location=v4l.ogg
- * ]| Capture video from a V4L device, and adjust the stream to 12.5 fps before
- * encoding to Ogg/Theora.
- * </refsect2>
- *
- * Last reviewed on 2006-09-02 (0.10.11)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstvideorate.h"
-
-GST_DEBUG_CATEGORY_STATIC (video_rate_debug);
-#define GST_CAT_DEFAULT video_rate_debug
-
-/* elementfactory information */
-static const GstElementDetails video_rate_details =
-GST_ELEMENT_DETAILS ("Video rate adjuster",
- "Filter/Effect/Video",
- "Drops/duplicates/adjusts timestamps on video frames to make a perfect stream",
- "Wim Taymans <wim@fluendo.com>");
-
-/* GstVideoRate signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-#define DEFAULT_SILENT TRUE
-#define DEFAULT_NEW_PREF 1.0
-#define DEFAULT_SKIP_TO_FIRST FALSE
-
-enum
-{
- ARG_0,
- ARG_IN,
- ARG_OUT,
- ARG_DUP,
- ARG_DROP,
- ARG_SILENT,
- ARG_NEW_PREF,
- ARG_SKIP_TO_FIRST
- /* FILL ME */
-};
-
-static GstStaticPadTemplate gst_video_rate_src_template =
- GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-yuv; video/x-raw-rgb; image/jpeg; image/png")
- );
-
-static GstStaticPadTemplate gst_video_rate_sink_template =
- GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-yuv; video/x-raw-rgb; image/jpeg; image/png")
- );
-
-static void gst_video_rate_swap_prev (GstVideoRate * videorate,
- GstBuffer * buffer, gint64 time);
-static gboolean gst_video_rate_event (GstPad * pad, GstEvent * event);
-static gboolean gst_video_rate_query (GstPad * pad, GstQuery * query);
-static GstFlowReturn gst_video_rate_chain (GstPad * pad, GstBuffer * buffer);
-
-static void gst_video_rate_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_video_rate_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static GstStateChangeReturn gst_video_rate_change_state (GstElement * element,
- GstStateChange transition);
-
-/*static guint gst_video_rate_signals[LAST_SIGNAL] = { 0 }; */
-
-GST_BOILERPLATE (GstVideoRate, gst_video_rate, GstElement, GST_TYPE_ELEMENT);
-
-static void
-gst_video_rate_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &video_rate_details);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_video_rate_sink_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_video_rate_src_template));
-}
-
-static void
-gst_video_rate_class_init (GstVideoRateClass * klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->set_property = gst_video_rate_set_property;
- object_class->get_property = gst_video_rate_get_property;
-
- g_object_class_install_property (object_class, ARG_IN,
- g_param_spec_uint64 ("in", "In",
- "Number of input frames", 0, G_MAXUINT64, 0,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class, ARG_OUT,
- g_param_spec_uint64 ("out", "Out", "Number of output frames", 0,
- G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class, ARG_DUP,
- g_param_spec_uint64 ("duplicate", "Duplicate",
- "Number of duplicated frames", 0, G_MAXUINT64, 0,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class, ARG_DROP,
- g_param_spec_uint64 ("drop", "Drop", "Number of dropped frames", 0,
- G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class, ARG_SILENT,
- g_param_spec_boolean ("silent", "silent",
- "Don't emit notify for dropped and duplicated frames", DEFAULT_SILENT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class, ARG_NEW_PREF,
- g_param_spec_double ("new-pref", "New Pref",
- "Value indicating how much to prefer new frames (unused)", 0.0, 1.0,
- DEFAULT_NEW_PREF, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstVideoRate:skip-to-first:
- *
- * Don't produce buffers before the first one we receive.
- *
- * Since: 0.10.25
- */
- g_object_class_install_property (object_class, ARG_SKIP_TO_FIRST,
- g_param_spec_boolean ("skip-to-first", "Skip to first buffer",
- "Don't produce buffers before the first one we receive",
- DEFAULT_SKIP_TO_FIRST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- element_class->change_state = gst_video_rate_change_state;
-}
-
-/* return the caps that can be used on out_pad given in_caps on in_pad */
-static gboolean
-gst_video_rate_transformcaps (GstPad * in_pad, GstCaps * in_caps,
- GstPad * out_pad, GstCaps ** out_caps)
-{
- GstCaps *intersect;
- const GstCaps *in_templ;
- gint i;
- GSList *extra_structures = NULL;
- GSList *iter;
-
- in_templ = gst_pad_get_pad_template_caps (in_pad);
- intersect = gst_caps_intersect (in_caps, in_templ);
-
- /* all possible framerates are allowed */
- for (i = 0; i < gst_caps_get_size (intersect); i++) {
- GstStructure *structure;
-
- structure = gst_caps_get_structure (intersect, i);
-
- if (gst_structure_has_field (structure, "framerate")) {
- GstStructure *copy_structure;
-
- copy_structure = gst_structure_copy (structure);
- gst_structure_set (copy_structure,
- "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
- extra_structures = g_slist_append (extra_structures, copy_structure);
- }
- }
-
- /* append the extra structures */
- for (iter = extra_structures; iter != NULL; iter = g_slist_next (iter)) {
- gst_caps_append_structure (intersect, (GstStructure *) iter->data);
- }
- g_slist_free (extra_structures);
-
- *out_caps = intersect;
-
- return TRUE;
-}
-
-static GstCaps *
-gst_video_rate_getcaps (GstPad * pad)
-{
- GstVideoRate *videorate;
- GstPad *otherpad;
- GstCaps *caps;
-
- videorate = GST_VIDEO_RATE (GST_PAD_PARENT (pad));
-
- otherpad = (pad == videorate->srcpad) ? videorate->sinkpad :
- videorate->srcpad;
-
- /* we can do what the peer can */
- caps = gst_pad_peer_get_caps (otherpad);
- if (caps) {
- GstCaps *transform;
-
- gst_video_rate_transformcaps (otherpad, caps, pad, &transform);
- gst_caps_unref (caps);
- caps = transform;
- } else {
- /* no peer, our padtemplate is enough then */
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
- }
-
- return caps;
-}
-
-static gboolean
-gst_video_rate_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstVideoRate *videorate;
- GstStructure *structure;
- gboolean ret = TRUE;
- GstPad *otherpad, *opeer;
- gint rate_numerator, rate_denominator;
-
- videorate = GST_VIDEO_RATE (gst_pad_get_parent (pad));
-
- GST_DEBUG ("setcaps called %" GST_PTR_FORMAT, caps);
-
- structure = gst_caps_get_structure (caps, 0);
- if (!gst_structure_get_fraction (structure, "framerate",
- &rate_numerator, &rate_denominator))
- goto no_framerate;
-
- if (pad == videorate->srcpad) {
- videorate->to_rate_numerator = rate_numerator;
- videorate->to_rate_denominator = rate_denominator;
- otherpad = videorate->sinkpad;
- } else {
- videorate->from_rate_numerator = rate_numerator;
- videorate->from_rate_denominator = rate_denominator;
- otherpad = videorate->srcpad;
- }
-
- /* now try to find something for the peer */
- opeer = gst_pad_get_peer (otherpad);
- if (opeer) {
- if (gst_pad_accept_caps (opeer, caps)) {
- /* the peer accepts the caps as they are */
- gst_pad_set_caps (otherpad, caps);
-
- ret = TRUE;
- } else {
- GstCaps *peercaps;
- GstCaps *intersect;
- GstCaps *transform = NULL;
-
- ret = FALSE;
-
- /* see how we can transform the input caps */
- if (!gst_video_rate_transformcaps (pad, caps, otherpad, &transform))
- goto no_transform;
-
- /* see what the peer can do */
- peercaps = gst_pad_get_caps (opeer);
-
- GST_DEBUG ("icaps %" GST_PTR_FORMAT, peercaps);
- GST_DEBUG ("transform %" GST_PTR_FORMAT, transform);
-
- /* filter against our possibilities */
- intersect = gst_caps_intersect (peercaps, transform);
- gst_caps_unref (peercaps);
- gst_caps_unref (transform);
-
- GST_DEBUG ("intersect %" GST_PTR_FORMAT, intersect);
-
- /* take first possibility */
- caps = gst_caps_copy_nth (intersect, 0);
- gst_caps_unref (intersect);
- structure = gst_caps_get_structure (caps, 0);
-
- /* and fixate */
- gst_structure_fixate_field_nearest_fraction (structure, "framerate",
- rate_numerator, rate_denominator);
-
- gst_structure_get_fraction (structure, "framerate",
- &rate_numerator, &rate_denominator);
-
- if (otherpad == videorate->srcpad) {
- videorate->to_rate_numerator = rate_numerator;
- videorate->to_rate_denominator = rate_denominator;
- } else {
- videorate->from_rate_numerator = rate_numerator;
- videorate->from_rate_denominator = rate_denominator;
- }
- gst_pad_set_caps (otherpad, caps);
- gst_caps_unref (caps);
- ret = TRUE;
- }
- gst_object_unref (opeer);
- }
-done:
- /* After a setcaps, our caps may have changed. In that case, we can't use
- * the old buffer, if there was one (it might have different dimensions) */
- GST_DEBUG ("swapping old buffers");
- gst_video_rate_swap_prev (videorate, NULL, GST_CLOCK_TIME_NONE);
-
- gst_object_unref (videorate);
- return ret;
-
-no_framerate:
- {
- GST_DEBUG_OBJECT (videorate, "no framerate specified");
- goto done;
- }
-no_transform:
- {
- GST_DEBUG_OBJECT (videorate, "no framerate transform possible");
- ret = FALSE;
- goto done;
- }
-}
-
-static void
-gst_video_rate_reset (GstVideoRate * videorate)
-{
- GST_DEBUG ("resetting internal variables");
-
- videorate->in = 0;
- videorate->out = 0;
- videorate->segment_out = 0;
- videorate->drop = 0;
- videorate->dup = 0;
- videorate->next_ts = GST_CLOCK_TIME_NONE;
- videorate->last_ts = GST_CLOCK_TIME_NONE;
- videorate->discont = TRUE;
- gst_video_rate_swap_prev (videorate, NULL, 0);
-
- gst_segment_init (&videorate->segment, GST_FORMAT_TIME);
-}
-
-static void
-gst_video_rate_init (GstVideoRate * videorate, GstVideoRateClass * klass)
-{
- GST_DEBUG ("gst_video_rate_init");
- videorate->sinkpad =
- gst_pad_new_from_static_template (&gst_video_rate_sink_template, "sink");
- gst_pad_set_event_function (videorate->sinkpad, gst_video_rate_event);
- gst_pad_set_chain_function (videorate->sinkpad, gst_video_rate_chain);
- gst_pad_set_getcaps_function (videorate->sinkpad, gst_video_rate_getcaps);
- gst_pad_set_setcaps_function (videorate->sinkpad, gst_video_rate_setcaps);
- gst_element_add_pad (GST_ELEMENT (videorate), videorate->sinkpad);
-
- videorate->srcpad =
- gst_pad_new_from_static_template (&gst_video_rate_src_template, "src");
- gst_pad_set_query_function (videorate->srcpad, gst_video_rate_query);
- gst_pad_set_getcaps_function (videorate->srcpad, gst_video_rate_getcaps);
- gst_pad_set_setcaps_function (videorate->srcpad, gst_video_rate_setcaps);
- gst_element_add_pad (GST_ELEMENT (videorate), videorate->srcpad);
-
- gst_video_rate_reset (videorate);
- videorate->silent = DEFAULT_SILENT;
- videorate->new_pref = DEFAULT_NEW_PREF;
-
- videorate->from_rate_numerator = 0;
- videorate->from_rate_denominator = 0;
- videorate->to_rate_numerator = 0;
- videorate->to_rate_denominator = 0;
-}
-
-/* flush the oldest buffer */
-static GstFlowReturn
-gst_video_rate_flush_prev (GstVideoRate * videorate)
-{
- GstFlowReturn res;
- GstBuffer *outbuf;
- GstClockTime push_ts;
-
- if (!videorate->prevbuf)
- goto eos_before_buffers;
-
- /* make sure we can write to the metadata */
- outbuf = gst_buffer_make_metadata_writable
- (gst_buffer_ref (videorate->prevbuf));
-
- GST_BUFFER_OFFSET (outbuf) = videorate->out;
- GST_BUFFER_OFFSET_END (outbuf) = videorate->out + 1;
-
- if (videorate->discont) {
- GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
- videorate->discont = FALSE;
- } else
- GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_DISCONT);
-
- /* this is the timestamp we put on the buffer */
- push_ts = videorate->next_ts;
-
- videorate->out++;
- videorate->segment_out++;
- if (videorate->to_rate_numerator) {
- /* interpolate next expected timestamp in the segment */
- videorate->next_ts = videorate->segment.accum + videorate->segment.start +
- gst_util_uint64_scale (videorate->segment_out,
- videorate->to_rate_denominator * GST_SECOND,
- videorate->to_rate_numerator);
- GST_BUFFER_DURATION (outbuf) = videorate->next_ts - push_ts;
- }
-
- /* adapt for looping, bring back to time in current segment. */
- GST_BUFFER_TIMESTAMP (outbuf) = push_ts - videorate->segment.accum;
-
- gst_buffer_set_caps (outbuf, GST_PAD_CAPS (videorate->srcpad));
-
- GST_LOG_OBJECT (videorate,
- "old is best, dup, pushing buffer outgoing ts %" GST_TIME_FORMAT,
- GST_TIME_ARGS (push_ts));
-
- res = gst_pad_push (videorate->srcpad, outbuf);
-
- return res;
-
- /* WARNINGS */
-eos_before_buffers:
- {
- GST_INFO_OBJECT (videorate, "got EOS before any buffer was received");
- return GST_FLOW_OK;
- }
-}
-
-static void
-gst_video_rate_swap_prev (GstVideoRate * videorate, GstBuffer * buffer,
- gint64 time)
-{
- GST_LOG_OBJECT (videorate, "swap_prev: storing buffer %p in prev", buffer);
- if (videorate->prevbuf)
- gst_buffer_unref (videorate->prevbuf);
- videorate->prevbuf = buffer;
- videorate->prev_ts = time;
-}
-
-#define MAGIC_LIMIT 25
-static gboolean
-gst_video_rate_event (GstPad * pad, GstEvent * event)
-{
- GstVideoRate *videorate;
- gboolean ret;
-
- videorate = GST_VIDEO_RATE (gst_pad_get_parent (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:
- {
- gint64 start, stop, time;
- gdouble rate, arate;
- gboolean update;
- GstFormat format;
-
- gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
- &start, &stop, &time);
-
- if (format != GST_FORMAT_TIME)
- goto format_error;
-
- GST_DEBUG_OBJECT (videorate, "handle NEWSEGMENT");
-
- /* close up the previous segment, if appropriate */
- if (!update && videorate->prevbuf) {
- gint count = 0;
- GstFlowReturn res;
-
- res = GST_FLOW_OK;
- /* fill up to the end of current segment,
- * or only send out the stored buffer if there is no specific stop.
- * regardless, prevent going loopy in strange cases */
- while (res == GST_FLOW_OK && count <= MAGIC_LIMIT &&
- ((GST_CLOCK_TIME_IS_VALID (videorate->segment.stop) &&
- videorate->next_ts - videorate->segment.accum
- < videorate->segment.stop)
- || count < 1)) {
- gst_video_rate_flush_prev (videorate);
- count++;
- }
- if (count > 1) {
- videorate->dup += count - 1;
- if (!videorate->silent)
- g_object_notify (G_OBJECT (videorate), "duplicate");
- } else if (count == 0) {
- videorate->drop++;
- if (!videorate->silent)
- g_object_notify (G_OBJECT (videorate), "drop");
- }
- /* clean up for the new one; _chain will resume from the new start */
- videorate->segment_out = 0;
- gst_video_rate_swap_prev (videorate, NULL, 0);
- videorate->next_ts = GST_CLOCK_TIME_NONE;
- }
-
- /* We just want to update the accumulated stream_time */
- gst_segment_set_newsegment_full (&videorate->segment, update, rate, arate,
- format, start, stop, time);
-
- GST_DEBUG_OBJECT (videorate, "updated segment: %" GST_SEGMENT_FORMAT,
- &videorate->segment);
- break;
- }
- case GST_EVENT_EOS:
- /* flush last queued frame */
- GST_DEBUG_OBJECT (videorate, "Got EOS");
- gst_video_rate_flush_prev (videorate);
- break;
- case GST_EVENT_FLUSH_STOP:
- /* also resets the segment */
- GST_DEBUG_OBJECT (videorate, "Got FLUSH_STOP");
- gst_video_rate_reset (videorate);
- break;
- default:
- break;
- }
-
- ret = gst_pad_push_event (videorate->srcpad, event);
-
-done:
- gst_object_unref (videorate);
-
- return ret;
-
- /* ERRORS */
-format_error:
- {
- GST_WARNING_OBJECT (videorate,
- "Got segment but doesn't have GST_FORMAT_TIME value");
- gst_event_unref (event);
- ret = FALSE;
- goto done;
- }
-}
-
-static gboolean
-gst_video_rate_query (GstPad * pad, GstQuery * query)
-{
- GstVideoRate *videorate;
- gboolean res = FALSE;
-
- videorate = GST_VIDEO_RATE (gst_pad_get_parent (pad));
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_LATENCY:
- {
- GstClockTime min, max;
- gboolean live;
- guint64 latency;
- GstPad *peer;
-
- if ((peer = gst_pad_get_peer (videorate->sinkpad))) {
- if ((res = gst_pad_query (peer, query))) {
- gst_query_parse_latency (query, &live, &min, &max);
-
- GST_DEBUG_OBJECT (videorate, "Peer latency: min %"
- GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
- GST_TIME_ARGS (min), GST_TIME_ARGS (max));
-
- if (videorate->from_rate_numerator != 0) {
- /* add latency. We don't really know since we hold on to the frames
- * until we get a next frame, which can be anything. We assume
- * however that this will take from_rate time. */
- latency = gst_util_uint64_scale (GST_SECOND,
- videorate->from_rate_denominator,
- videorate->from_rate_numerator);
- } else {
- /* no input framerate, we don't know */
- latency = 0;
- }
-
- GST_DEBUG_OBJECT (videorate, "Our latency: %"
- GST_TIME_FORMAT, GST_TIME_ARGS (latency));
-
- min += latency;
- if (max != -1)
- max += latency;
-
- GST_DEBUG_OBJECT (videorate, "Calculated total latency : min %"
- GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
- GST_TIME_ARGS (min), GST_TIME_ARGS (max));
-
- gst_query_set_latency (query, live, min, max);
- }
- gst_object_unref (peer);
- }
- break;
- }
- default:
- res = gst_pad_query_default (pad, query);
- break;
- }
- gst_object_unref (videorate);
-
- return res;
-}
-
-static GstFlowReturn
-gst_video_rate_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstVideoRate *videorate;
- GstFlowReturn res = GST_FLOW_OK;
- GstClockTime intime, in_ts, in_dur;
-
- videorate = GST_VIDEO_RATE (GST_PAD_PARENT (pad));
-
- /* make sure the denominators are not 0 */
- if (videorate->from_rate_denominator == 0 ||
- videorate->to_rate_denominator == 0)
- goto not_negotiated;
-
- in_ts = GST_BUFFER_TIMESTAMP (buffer);
- in_dur = GST_BUFFER_DURATION (buffer);
-
- if (G_UNLIKELY (in_ts == GST_CLOCK_TIME_NONE)) {
- in_ts = videorate->last_ts;
- if (G_UNLIKELY (in_ts == GST_CLOCK_TIME_NONE))
- goto invalid_buffer;
- }
-
- /* get the time of the next expected buffer timestamp, we use this when the
- * next buffer has -1 as a timestamp */
- videorate->last_ts = in_ts;
- if (in_dur != GST_CLOCK_TIME_NONE)
- videorate->last_ts += in_dur;
-
- GST_DEBUG_OBJECT (videorate, "got buffer with timestamp %" GST_TIME_FORMAT,
- GST_TIME_ARGS (in_ts));
-
- /* the input time is the time in the segment + all previously accumulated
- * segments */
- intime = in_ts + videorate->segment.accum;
-
- /* we need to have two buffers to compare */
- if (videorate->prevbuf == NULL) {
- gst_video_rate_swap_prev (videorate, buffer, intime);
- videorate->in++;
- if (!GST_CLOCK_TIME_IS_VALID (videorate->next_ts)) {
- /* new buffer, we expect to output a buffer that matches the first
- * timestamp in the segment */
- if (videorate->skip_to_first) {
- videorate->next_ts = in_ts;
- videorate->segment_out = gst_util_uint64_scale (in_ts,
- videorate->to_rate_numerator,
- videorate->to_rate_denominator * GST_SECOND) -
- (videorate->segment.accum + videorate->segment.start);
- } else {
- videorate->next_ts =
- videorate->segment.start + videorate->segment.accum;
- }
- }
- } else {
- GstClockTime prevtime;
- gint count = 0;
- gint64 diff1, diff2;
-
- prevtime = videorate->prev_ts;
-
- GST_LOG_OBJECT (videorate,
- "BEGINNING prev buf %" GST_TIME_FORMAT " new buf %" GST_TIME_FORMAT
- " outgoing ts %" GST_TIME_FORMAT, GST_TIME_ARGS (prevtime),
- GST_TIME_ARGS (intime), GST_TIME_ARGS (videorate->next_ts));
-
- videorate->in++;
-
- /* drop new buffer if it's before previous one */
- if (intime < prevtime) {
- GST_DEBUG_OBJECT (videorate,
- "The new buffer (%" GST_TIME_FORMAT
- ") is before the previous buffer (%"
- GST_TIME_FORMAT "). Dropping new buffer.",
- GST_TIME_ARGS (intime), GST_TIME_ARGS (prevtime));
- videorate->drop++;
- if (!videorate->silent)
- g_object_notify (G_OBJECT (videorate), "drop");
- gst_buffer_unref (buffer);
- goto done;
- }
-
- /* got 2 buffers, see which one is the best */
- do {
-
- diff1 = prevtime - videorate->next_ts;
- diff2 = intime - videorate->next_ts;
-
- /* take absolute values, beware: abs and ABS don't work for gint64 */
- if (diff1 < 0)
- diff1 = -diff1;
- if (diff2 < 0)
- diff2 = -diff2;
-
- GST_LOG_OBJECT (videorate,
- "diff with prev %" GST_TIME_FORMAT " diff with new %"
- GST_TIME_FORMAT " outgoing ts %" GST_TIME_FORMAT,
- GST_TIME_ARGS (diff1), GST_TIME_ARGS (diff2),
- GST_TIME_ARGS (videorate->next_ts));
-
- /* output first one when its the best */
- if (diff1 <= diff2) {
- count++;
-
- /* on error the _flush function posted a warning already */
- if ((res = gst_video_rate_flush_prev (videorate)) != GST_FLOW_OK) {
- gst_buffer_unref (buffer);
- goto done;
- }
- }
- /* continue while the first one was the best, if they were equal avoid
- * going into an infinite loop */
- }
- while (diff1 < diff2);
-
- /* if we outputed the first buffer more then once, we have dups */
- if (count > 1) {
- videorate->dup += count - 1;
- if (!videorate->silent)
- g_object_notify (G_OBJECT (videorate), "duplicate");
- }
- /* if we didn't output the first buffer, we have a drop */
- else if (count == 0) {
- videorate->drop++;
-
- if (!videorate->silent)
- g_object_notify (G_OBJECT (videorate), "drop");
-
- GST_LOG_OBJECT (videorate,
- "new is best, old never used, drop, outgoing ts %"
- GST_TIME_FORMAT, GST_TIME_ARGS (videorate->next_ts));
- }
- GST_LOG_OBJECT (videorate,
- "END, putting new in old, diff1 %" GST_TIME_FORMAT
- ", diff2 %" GST_TIME_FORMAT ", next_ts %" GST_TIME_FORMAT
- ", in %" G_GUINT64_FORMAT ", out %" G_GUINT64_FORMAT ", drop %"
- G_GUINT64_FORMAT ", dup %" G_GUINT64_FORMAT, GST_TIME_ARGS (diff1),
- GST_TIME_ARGS (diff2), GST_TIME_ARGS (videorate->next_ts),
- videorate->in, videorate->out, videorate->drop, videorate->dup);
-
- /* swap in new one when it's the best */
- gst_video_rate_swap_prev (videorate, buffer, intime);
- }
-done:
- return res;
-
- /* ERRORS */
-not_negotiated:
- {
- GST_WARNING_OBJECT (videorate, "no framerate negotiated");
- gst_buffer_unref (buffer);
- res = GST_FLOW_NOT_NEGOTIATED;
- goto done;
- }
-
-invalid_buffer:
- {
- GST_WARNING_OBJECT (videorate,
- "Got buffer with GST_CLOCK_TIME_NONE timestamp, discarding it");
- gst_buffer_unref (buffer);
- goto done;
- }
-}
-
-static void
-gst_video_rate_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
-{
- GstVideoRate *videorate = GST_VIDEO_RATE (object);
-
- switch (prop_id) {
- case ARG_SILENT:
- videorate->silent = g_value_get_boolean (value);
- break;
- case ARG_NEW_PREF:
- videorate->new_pref = g_value_get_double (value);
- break;
- case ARG_SKIP_TO_FIRST:
- videorate->skip_to_first = g_value_get_boolean (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_video_rate_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- GstVideoRate *videorate = GST_VIDEO_RATE (object);
-
- switch (prop_id) {
- case ARG_IN:
- g_value_set_uint64 (value, videorate->in);
- break;
- case ARG_OUT:
- g_value_set_uint64 (value, videorate->out);
- break;
- case ARG_DUP:
- g_value_set_uint64 (value, videorate->dup);
- break;
- case ARG_DROP:
- g_value_set_uint64 (value, videorate->drop);
- break;
- case ARG_SILENT:
- g_value_set_boolean (value, videorate->silent);
- break;
- case ARG_NEW_PREF:
- g_value_set_double (value, videorate->new_pref);
- break;
- case ARG_SKIP_TO_FIRST:
- g_value_set_boolean (value, videorate->skip_to_first);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstStateChangeReturn
-gst_video_rate_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret;
- GstVideoRate *videorate;
-
- videorate = GST_VIDEO_RATE (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- videorate->discont = TRUE;
- videorate->last_ts = -1;
- break;
- default:
- break;
- }
-
- ret = parent_class->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- gst_video_rate_reset (videorate);
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (video_rate_debug, "videorate", 0,
- "VideoRate stream fixer");
-
- return gst_element_register (plugin, "videorate", GST_RANK_NONE,
- GST_TYPE_VIDEO_RATE);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "videorate",
- "Adjusts video frames",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/videorate/gstvideorate.h b/gst/videorate/gstvideorate.h
deleted file mode 100644
index a1a5007f..00000000
--- a/gst/videorate/gstvideorate.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_VIDEO_RATE_H__
-#define __GST_VIDEO_RATE_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_VIDEO_RATE \
- (gst_video_rate_get_type())
-#define GST_VIDEO_RATE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_RATE,GstVideoRate))
-#define GST_VIDEO_RATE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_RATE,GstVideoRateClass))
-#define GST_IS_VIDEO_RATE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_RATE))
-#define GST_IS_VIDEO_RATE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_RATE))
-
-typedef struct _GstVideoRate GstVideoRate;
-typedef struct _GstVideoRateClass GstVideoRateClass;
-
-/**
- * GstVideoRate:
- *
- * Opaque data structure.
- */
-struct _GstVideoRate
-{
- GstElement element;
-
- GstPad *sinkpad, *srcpad;
-
- /* video state */
- gint from_rate_numerator, from_rate_denominator;
- gint to_rate_numerator, to_rate_denominator;
- guint64 next_ts; /* Timestamp of next buffer to output */
- GstBuffer *prevbuf;
- guint64 prev_ts; /* Previous buffer timestamp */
- guint64 segment_out; /* in-segment counting */
- gboolean discont;
- guint64 last_ts; /* Timestamp of last input buffer */
-
- /* segment handling */
- GstSegment segment;
-
- /* properties */
- guint64 in, out, dup, drop;
- gboolean silent;
- gdouble new_pref;
- gboolean skip_to_first;
-};
-
-struct _GstVideoRateClass
-{
- GstElementClass parent_class;
-};
-
-G_END_DECLS
-
-#endif /* __GST_VIDEO_RATE_H__ */
diff --git a/gst/videorate/videorate.vcproj b/gst/videorate/videorate.vcproj
deleted file mode 100644
index d42d9ca8..00000000
--- a/gst/videorate/videorate.vcproj
+++ /dev/null
@@ -1,145 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="videorate"
- ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D678DD}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../win32/Debug"
- IntermediateDirectory="../../win32/Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;videorate_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstvideorate.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Debug;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/videorate.pdb"
- SubSystem="2"
- OptimizeReferences="2"
- ImportLibrary="$(OutDir)/gstvideorate.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../win32/Release"
- IntermediateDirectory="../../win32/Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;videorate_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstvideorate.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Release;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/gstvideorate.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath=".\gstvideorate.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/gst/videoscale/.gitignore b/gst/videoscale/.gitignore
deleted file mode 100644
index 08f5ed37..00000000
--- a/gst/videoscale/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-Makefile
-Makefile.in
-*.o
-*.lo
-*.la
-.deps
-.libs
diff --git a/gst/videoscale/Makefile.am b/gst/videoscale/Makefile.am
deleted file mode 100644
index 359e238d..00000000
--- a/gst/videoscale/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-plugin_LTLIBRARIES = libgstvideoscale.la
-
-libgstvideoscale_la_SOURCES = \
- gstvideoscale.c \
- vs_image.c \
- vs_scanline.c \
- vs_4tap.c
-
-libgstvideoscale_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(LIBOIL_CFLAGS)
-libgstvideoscale_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstvideoscale_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_MAJORMINOR).la \
- $(GST_BASE_LIBS) $(GST_LIBS) $(LIBOIL_LIBS)
-libgstvideoscale_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = \
- gstvideoscale.h \
- vs_image.h \
- vs_scanline.h \
- vs_4tap.h
diff --git a/gst/videoscale/README b/gst/videoscale/README
deleted file mode 100644
index 3e08f4ec..00000000
--- a/gst/videoscale/README
+++ /dev/null
@@ -1,5 +0,0 @@
-- test different strides using
-gst-launch -v videotestsrc ! video/x-raw-yuv,width=320,height=240,format=\(fourcc\)UYVY ! videoscale ! video/x-raw-yuv,width=328,height=240 ! xvimagesink
-gst-launch -v videotestsrc ! video/x-raw-yuv,width=320,height=240,format=\(fourcc\)UYVY ! videoscale ! video/x-raw-yuv,width=324,height=240 ! xvimagesink
-gst-launch -v videotestsrc ! video/x-raw-yuv,width=320,height=240,format=\(fourcc\)UYVY ! videoscale ! video/x-raw-yuv,width=322,height=240 ! xvimagesink
-gst-launch -v videotestsrc ! video/x-raw-yuv,width=320,height=240,format=\(fourcc\)UYVY ! videoscale ! video/x-raw-yuv,width=321,height=240 ! xvimagesink
diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c
deleted file mode 100644
index f572377c..00000000
--- a/gst/videoscale/gstvideoscale.c
+++ /dev/null
@@ -1,1034 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) 2005 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-videoscale
- * @see_also: videorate, ffmpegcolorspace
- *
- * This element resizes video frames. By default the element will try to
- * negotiate to the same size on the source and sinkpad so that no scaling
- * is needed. It is therefore safe to insert this element in a pipeline to
- * get more robust behaviour without any cost if no scaling is needed.
- *
- * This element supports a wide range of color spaces including various YUV and
- * RGB formats and is therefore generally able to operate anywhere in a
- * pipeline.
- *
- * <refsect2>
- * <title>Example pipelines</title>
- * |[
- * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! ffmpegcolorspace ! videoscale ! ximagesink
- * ]| Decode an Ogg/Theora and display the video using ximagesink. Since
- * ximagesink cannot perform scaling, the video scaling will be performed by
- * videoscale when you resize the video window.
- * To create the test Ogg/Theora file refer to the documentation of theoraenc.
- * |[
- * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! videoscale ! video/x-raw-yuv, width=50 ! xvimagesink
- * ]| Decode an Ogg/Theora and display the video using xvimagesink with a width
- * of 50.
- * </refsect2>
- *
- * Last reviewed on 2006-03-02 (0.10.4)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include <gst/video/video.h>
-#include <liboil/liboil.h>
-
-#include "gstvideoscale.h"
-#include "vs_image.h"
-#include "vs_4tap.h"
-
-
-/* debug variable definition */
-GST_DEBUG_CATEGORY (video_scale_debug);
-
-/* elementfactory information */
-static const GstElementDetails video_scale_details =
-GST_ELEMENT_DETAILS ("Video scaler",
- "Filter/Effect/Video",
- "Resizes video",
- "Wim Taymans <wim.taymans@chello.be>");
-
-#define DEFAULT_PROP_METHOD GST_VIDEO_SCALE_BILINEAR
-
-enum
-{
- PROP_0,
- PROP_METHOD
- /* FILL ME */
-};
-
-#undef GST_VIDEO_SIZE_RANGE
-#define GST_VIDEO_SIZE_RANGE "(int) [ 1, 32767]"
-
-static GstStaticCaps gst_video_scale_format_caps[] = {
- GST_STATIC_CAPS (GST_VIDEO_CAPS_RGBx),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_xBGR),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_RGBA),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_ARGB),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRA),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_ABGR),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_BGR),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("v308")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("AYUV")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("YUY2")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("YVYU")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("UYVY")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("Y800")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("YV12")),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB_16),
- GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB_15),
- GST_STATIC_CAPS ("video/x-raw-gray, "
- "bpp = 8, "
- "depth = 8, "
- "width = " GST_VIDEO_SIZE_RANGE ", "
- "height = " GST_VIDEO_SIZE_RANGE ", " "framerate = " GST_VIDEO_FPS_RANGE),
- GST_STATIC_CAPS ("video/x-raw-gray, "
- "bpp = 16, "
- "depth = 16, "
- "endianness = BYTE_ORDER, "
- "width = " GST_VIDEO_SIZE_RANGE ", "
- "height = " GST_VIDEO_SIZE_RANGE ", " "framerate = " GST_VIDEO_FPS_RANGE)
-};
-
-enum
-{
- GST_VIDEO_SCALE_RGBx = 0,
- GST_VIDEO_SCALE_xRGB,
- GST_VIDEO_SCALE_BGRx,
- GST_VIDEO_SCALE_xBGR,
- GST_VIDEO_SCALE_RGBA,
- GST_VIDEO_SCALE_ARGB,
- GST_VIDEO_SCALE_BGRA,
- GST_VIDEO_SCALE_ABGR,
- GST_VIDEO_SCALE_RGB,
- GST_VIDEO_SCALE_BGR,
- GST_VIDEO_SCALE_v308,
- GST_VIDEO_SCALE_AYUV,
- GST_VIDEO_SCALE_YUY2,
- GST_VIDEO_SCALE_YVYU,
- GST_VIDEO_SCALE_UYVY,
- GST_VIDEO_SCALE_Y,
- GST_VIDEO_SCALE_I420,
- GST_VIDEO_SCALE_YV12,
- GST_VIDEO_SCALE_RGB565,
- GST_VIDEO_SCALE_RGB555,
- GST_VIDEO_SCALE_GRAY8,
- GST_VIDEO_SCALE_GRAY16
-};
-
-#define GST_TYPE_VIDEO_SCALE_METHOD (gst_video_scale_method_get_type())
-static GType
-gst_video_scale_method_get_type (void)
-{
- static GType video_scale_method_type = 0;
-
- static const GEnumValue video_scale_methods[] = {
- {GST_VIDEO_SCALE_NEAREST, "Nearest Neighbour", "nearest-neighbour"},
- {GST_VIDEO_SCALE_BILINEAR, "Bilinear", "bilinear"},
- {GST_VIDEO_SCALE_4TAP, "4-tap", "4-tap"},
- {0, NULL, NULL},
- };
-
- if (!video_scale_method_type) {
- video_scale_method_type =
- g_enum_register_static ("GstVideoScaleMethod", video_scale_methods);
- }
- return video_scale_method_type;
-}
-
-static GstCaps *
-gst_video_scale_get_capslist (void)
-{
- static GstCaps *caps;
-
- if (caps == NULL) {
- int i;
-
- caps = gst_caps_new_empty ();
- for (i = 0; i < G_N_ELEMENTS (gst_video_scale_format_caps); i++)
- gst_caps_append (caps,
- gst_caps_make_writable
- (gst_static_caps_get (&gst_video_scale_format_caps[i])));
- }
-
- return caps;
-}
-
-static GstPadTemplate *
-gst_video_scale_src_template_factory (void)
-{
- return gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
- gst_caps_ref (gst_video_scale_get_capslist ()));
-}
-
-static GstPadTemplate *
-gst_video_scale_sink_template_factory (void)
-{
- return gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
- gst_caps_ref (gst_video_scale_get_capslist ()));
-}
-
-
-static void gst_video_scale_base_init (gpointer g_class);
-
-static void gst_video_scale_class_init (GstVideoScaleClass * klass);
-
-static void gst_video_scale_init (GstVideoScale * videoscale);
-
-static void gst_video_scale_finalize (GstVideoScale * videoscale);
-
-static gboolean gst_video_scale_src_event (GstBaseTransform * trans,
- GstEvent * event);
-
-/* base transform vmethods */
-static GstCaps *gst_video_scale_transform_caps (GstBaseTransform * trans,
- GstPadDirection direction, GstCaps * caps);
-static gboolean gst_video_scale_set_caps (GstBaseTransform * trans,
- GstCaps * in, GstCaps * out);
-static gboolean gst_video_scale_get_unit_size (GstBaseTransform * trans,
- GstCaps * caps, guint * size);
-static GstFlowReturn gst_video_scale_transform (GstBaseTransform * trans,
- GstBuffer * in, GstBuffer * out);
-static void gst_video_scale_fixate_caps (GstBaseTransform * base,
- GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
-
-static void gst_video_scale_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_video_scale_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static GstElementClass *parent_class = NULL;
-
-
-GType
-gst_video_scale_get_type (void)
-{
- static GType video_scale_type = 0;
-
- if (!video_scale_type) {
- static const GTypeInfo video_scale_info = {
- sizeof (GstVideoScaleClass),
- gst_video_scale_base_init,
- NULL,
- (GClassInitFunc) gst_video_scale_class_init,
- NULL,
- NULL,
- sizeof (GstVideoScale),
- 0,
- (GInstanceInitFunc) gst_video_scale_init,
- };
-
- video_scale_type =
- g_type_register_static (GST_TYPE_BASE_TRANSFORM, "GstVideoScale",
- &video_scale_info, 0);
- }
- return video_scale_type;
-}
-
-static void
-gst_video_scale_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &video_scale_details);
-
- gst_element_class_add_pad_template (element_class,
- gst_video_scale_sink_template_factory ());
- gst_element_class_add_pad_template (element_class,
- gst_video_scale_src_template_factory ());
-}
-
-static void
-gst_video_scale_class_init (GstVideoScaleClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseTransformClass *trans_class;
-
- gobject_class = (GObjectClass *) klass;
- trans_class = (GstBaseTransformClass *) klass;
-
- gobject_class->finalize = (GObjectFinalizeFunc) gst_video_scale_finalize;
- gobject_class->set_property = gst_video_scale_set_property;
- gobject_class->get_property = gst_video_scale_get_property;
-
- g_object_class_install_property (gobject_class, PROP_METHOD,
- g_param_spec_enum ("method", "method", "method",
- GST_TYPE_VIDEO_SCALE_METHOD, DEFAULT_PROP_METHOD,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- trans_class->transform_caps =
- GST_DEBUG_FUNCPTR (gst_video_scale_transform_caps);
- trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_video_scale_set_caps);
- trans_class->get_unit_size =
- GST_DEBUG_FUNCPTR (gst_video_scale_get_unit_size);
- trans_class->transform = GST_DEBUG_FUNCPTR (gst_video_scale_transform);
- trans_class->fixate_caps = GST_DEBUG_FUNCPTR (gst_video_scale_fixate_caps);
- trans_class->src_event = GST_DEBUG_FUNCPTR (gst_video_scale_src_event);
-
- trans_class->passthrough_on_same_caps = TRUE;
-
- parent_class = g_type_class_peek_parent (klass);
-}
-
-static void
-gst_video_scale_init (GstVideoScale * videoscale)
-{
- gst_base_transform_set_qos_enabled (GST_BASE_TRANSFORM (videoscale), TRUE);
- videoscale->tmp_buf = NULL;
- videoscale->method = DEFAULT_PROP_METHOD;
-}
-
-static void
-gst_video_scale_finalize (GstVideoScale * videoscale)
-{
- if (videoscale->tmp_buf)
- g_free (videoscale->tmp_buf);
-
- G_OBJECT_CLASS (parent_class)->finalize (G_OBJECT (videoscale));
-}
-
-static void
-gst_video_scale_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstVideoScale *vscale = GST_VIDEO_SCALE (object);
-
- switch (prop_id) {
- case PROP_METHOD:
- GST_OBJECT_LOCK (vscale);
- vscale->method = g_value_get_enum (value);
- GST_OBJECT_UNLOCK (vscale);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_video_scale_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstVideoScale *vscale = GST_VIDEO_SCALE (object);
-
- switch (prop_id) {
- case PROP_METHOD:
- GST_OBJECT_LOCK (vscale);
- g_value_set_enum (value, vscale->method);
- GST_OBJECT_UNLOCK (vscale);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstCaps *
-gst_video_scale_transform_caps (GstBaseTransform * trans,
- GstPadDirection direction, GstCaps * caps)
-{
- GstVideoScale *videoscale;
- GstCaps *ret;
- GstStructure *structure;
-
- /* this function is always called with a simple caps */
- g_return_val_if_fail (GST_CAPS_IS_SIMPLE (caps), NULL);
-
- videoscale = GST_VIDEO_SCALE (trans);
-
- ret = gst_caps_copy (caps);
- structure = gst_structure_copy (gst_caps_get_structure (ret, 0));
-
- gst_structure_set (structure,
- "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
- "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
-
- gst_caps_merge_structure (ret, gst_structure_copy (structure));
-
- /* if pixel aspect ratio, make a range of it */
- if (gst_structure_get_value (structure, "pixel-aspect-ratio")) {
- gst_structure_set (structure,
- "pixel-aspect-ratio", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
-
- gst_caps_merge_structure (ret, structure);
- } else {
- gst_structure_free (structure);
- }
-
- GST_DEBUG_OBJECT (trans, "returning caps: %" GST_PTR_FORMAT, ret);
-
- return ret;
-}
-
-static int
-gst_video_scale_get_format (GstCaps * caps)
-{
- int i;
- GstCaps *icaps, *scaps;
-
- for (i = 0; i < G_N_ELEMENTS (gst_video_scale_format_caps); i++) {
- scaps = gst_static_caps_get (&gst_video_scale_format_caps[i]);
- icaps = gst_caps_intersect (caps, scaps);
- if (!gst_caps_is_empty (icaps)) {
- gst_caps_unref (icaps);
- return i;
- }
- gst_caps_unref (icaps);
- }
-
- return -1;
-}
-
-/* calculate the size of a buffer */
-static gboolean
-gst_video_scale_prepare_size (GstVideoScale * videoscale, gint format,
- VSImage * img, gint width, gint height, guint * size)
-{
- gboolean res = TRUE;
-
- img->width = width;
- img->height = height;
-
- switch (format) {
- case GST_VIDEO_SCALE_RGBx:
- case GST_VIDEO_SCALE_xRGB:
- case GST_VIDEO_SCALE_BGRx:
- case GST_VIDEO_SCALE_xBGR:
- case GST_VIDEO_SCALE_RGBA:
- case GST_VIDEO_SCALE_ARGB:
- case GST_VIDEO_SCALE_BGRA:
- case GST_VIDEO_SCALE_ABGR:
- case GST_VIDEO_SCALE_AYUV:
- img->stride = img->width * 4;
- *size = img->stride * img->height;
- break;
- case GST_VIDEO_SCALE_RGB:
- case GST_VIDEO_SCALE_BGR:
- case GST_VIDEO_SCALE_v308:
- img->stride = GST_ROUND_UP_4 (img->width * 3);
- *size = img->stride * img->height;
- break;
- case GST_VIDEO_SCALE_YUY2:
- case GST_VIDEO_SCALE_YVYU:
- case GST_VIDEO_SCALE_UYVY:
- img->stride = GST_ROUND_UP_4 (img->width * 2);
- *size = img->stride * img->height;
- break;
- case GST_VIDEO_SCALE_Y:
- case GST_VIDEO_SCALE_GRAY8:
- img->stride = GST_ROUND_UP_4 (img->width);
- *size = img->stride * img->height;
- break;
- case GST_VIDEO_SCALE_GRAY16:
- img->stride = GST_ROUND_UP_4 (img->width * 2);
- *size = img->stride * img->height;
- break;
- case GST_VIDEO_SCALE_I420:
- case GST_VIDEO_SCALE_YV12:
- {
- gulong img_u_stride, img_u_height;
-
- img->stride = GST_ROUND_UP_4 (img->width);
-
- img_u_height = GST_ROUND_UP_2 (img->height) / 2;
- img_u_stride = GST_ROUND_UP_4 (img->stride / 2);
-
- *size = img->stride * GST_ROUND_UP_2 (img->height) +
- 2 * img_u_stride * img_u_height;
- break;
- }
- case GST_VIDEO_SCALE_RGB565:
- img->stride = GST_ROUND_UP_4 (img->width * 2);
- *size = img->stride * img->height;
- break;
- case GST_VIDEO_SCALE_RGB555:
- img->stride = GST_ROUND_UP_4 (img->width * 2);
- *size = img->stride * img->height;
- break;
- default:
- goto unknown_format;
- }
-
- return res;
-
- /* ERRORS */
-unknown_format:
- {
- GST_ELEMENT_ERROR (videoscale, STREAM, NOT_IMPLEMENTED, (NULL),
- ("Unsupported format %d", videoscale->format));
- return FALSE;
- }
-}
-
-static gboolean
-parse_caps (GstCaps * caps, gint * format, gint * width, gint * height,
- gboolean * interlaced)
-{
- gboolean ret;
- GstStructure *structure;
-
- structure = gst_caps_get_structure (caps, 0);
- ret = gst_structure_get_int (structure, "width", width);
- ret &= gst_structure_get_int (structure, "height", height);
-
- if (format)
- *format = gst_video_scale_get_format (caps);
-
- if (interlaced) {
- *interlaced = FALSE;
- gst_structure_get_boolean (structure, "interlaced", interlaced);
- }
-
- return ret;
-}
-
-static gboolean
-gst_video_scale_set_caps (GstBaseTransform * trans, GstCaps * in, GstCaps * out)
-{
- GstVideoScale *videoscale;
- gboolean ret;
-
- videoscale = GST_VIDEO_SCALE (trans);
-
- ret = parse_caps (in, &videoscale->format, &videoscale->from_width,
- &videoscale->from_height, &videoscale->interlaced);
- ret &=
- parse_caps (out, NULL, &videoscale->to_width, &videoscale->to_height,
- NULL);
- if (!ret)
- goto done;
-
- if (!(ret = gst_video_scale_prepare_size (videoscale, videoscale->format,
- &videoscale->src, videoscale->from_width, videoscale->from_height,
- &videoscale->src_size)))
- /* prepare size has posted an error when it returns FALSE */
- goto done;
-
- if (!(ret = gst_video_scale_prepare_size (videoscale, videoscale->format,
- &videoscale->dest, videoscale->to_width, videoscale->to_height,
- &videoscale->dest_size)))
- /* prepare size has posted an error when it returns FALSE */
- goto done;
-
- if (videoscale->tmp_buf)
- g_free (videoscale->tmp_buf);
-
- videoscale->tmp_buf =
- g_malloc (videoscale->dest.stride * 4 * (videoscale->interlaced ? 2 : 1));
-
- /* FIXME: par */
- GST_DEBUG_OBJECT (videoscale, "from=%dx%d, size %d -> to=%dx%d, size %d",
- videoscale->from_width, videoscale->from_height, videoscale->src_size,
- videoscale->to_width, videoscale->to_height, videoscale->dest_size);
-
-done:
- return ret;
-}
-
-static gboolean
-gst_video_scale_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
- guint * size)
-{
- GstVideoScale *videoscale;
- gint format, width, height;
- VSImage img;
-
- g_assert (size);
-
- videoscale = GST_VIDEO_SCALE (trans);
-
- if (!parse_caps (caps, &format, &width, &height, NULL))
- return FALSE;
-
- if (!gst_video_scale_prepare_size (videoscale, format, &img, width, height,
- size))
- return FALSE;
-
- return TRUE;
-}
-
-static void
-gst_video_scale_fixate_caps (GstBaseTransform * base, GstPadDirection direction,
- GstCaps * caps, GstCaps * othercaps)
-{
- GstStructure *ins, *outs;
- const GValue *from_par, *to_par;
-
- g_return_if_fail (gst_caps_is_fixed (caps));
-
- GST_DEBUG_OBJECT (base, "trying to fixate othercaps %" GST_PTR_FORMAT
- " based on caps %" GST_PTR_FORMAT, othercaps, caps);
-
- ins = gst_caps_get_structure (caps, 0);
- outs = gst_caps_get_structure (othercaps, 0);
-
- from_par = gst_structure_get_value (ins, "pixel-aspect-ratio");
- to_par = gst_structure_get_value (outs, "pixel-aspect-ratio");
-
- /* we have both PAR but they might not be fixated */
- if (from_par && to_par) {
- gint from_w, from_h, from_par_n, from_par_d, to_par_n, to_par_d;
-
- gint count = 0, w = 0, h = 0;
-
- guint num, den;
-
- /* from_par should be fixed */
- g_return_if_fail (gst_value_is_fixed (from_par));
-
- from_par_n = gst_value_get_fraction_numerator (from_par);
- from_par_d = gst_value_get_fraction_denominator (from_par);
-
- /* fixate the out PAR */
- if (!gst_value_is_fixed (to_par)) {
- GST_DEBUG_OBJECT (base, "fixating to_par to %dx%d", from_par_n,
- from_par_d);
- gst_structure_fixate_field_nearest_fraction (outs, "pixel-aspect-ratio",
- from_par_n, from_par_d);
- }
-
- to_par_n = gst_value_get_fraction_numerator (to_par);
- to_par_d = gst_value_get_fraction_denominator (to_par);
-
- /* if both width and height are already fixed, we can't do anything
- * about it anymore */
- if (gst_structure_get_int (outs, "width", &w))
- ++count;
- if (gst_structure_get_int (outs, "height", &h))
- ++count;
- if (count == 2) {
- GST_DEBUG_OBJECT (base, "dimensions already set to %dx%d, not fixating",
- w, h);
- return;
- }
-
- gst_structure_get_int (ins, "width", &from_w);
- gst_structure_get_int (ins, "height", &from_h);
-
- if (!gst_video_calculate_display_ratio (&num, &den, from_w, from_h,
- from_par_n, from_par_d, to_par_n, to_par_d)) {
- GST_ELEMENT_ERROR (base, CORE, NEGOTIATION, (NULL),
- ("Error calculating the output scaled size - integer overflow"));
- return;
- }
-
- GST_DEBUG_OBJECT (base,
- "scaling input with %dx%d and PAR %d/%d to output PAR %d/%d",
- from_w, from_h, from_par_n, from_par_d, to_par_n, to_par_d);
- GST_DEBUG_OBJECT (base, "resulting output should respect ratio of %d/%d",
- num, den);
-
- /* now find a width x height that respects this display ratio.
- * prefer those that have one of w/h the same as the incoming video
- * using wd / hd = num / den */
-
- /* if one of the output width or height is fixed, we work from there */
- if (h) {
- GST_DEBUG_OBJECT (base, "height is fixed,scaling width");
- w = (guint) gst_util_uint64_scale_int (h, num, den);
- } else if (w) {
- GST_DEBUG_OBJECT (base, "width is fixed, scaling height");
- h = (guint) gst_util_uint64_scale_int (w, den, num);
- } else {
- /* none of width or height is fixed, figure out both of them based only on
- * the input width and height */
- /* check hd / den is an integer scale factor, and scale wd with the PAR */
- if (from_h % den == 0) {
- GST_DEBUG_OBJECT (base, "keeping video height");
- h = from_h;
- w = (guint) gst_util_uint64_scale_int (h, num, den);
- } else if (from_w % num == 0) {
- GST_DEBUG_OBJECT (base, "keeping video width");
- w = from_w;
- h = (guint) gst_util_uint64_scale_int (w, den, num);
- } else {
- GST_DEBUG_OBJECT (base, "approximating but keeping video height");
- h = from_h;
- w = (guint) gst_util_uint64_scale_int (h, num, den);
- }
- }
- GST_DEBUG_OBJECT (base, "scaling to %dx%d", w, h);
-
- /* now fixate */
- gst_structure_fixate_field_nearest_int (outs, "width", w);
- gst_structure_fixate_field_nearest_int (outs, "height", h);
- } else {
- gint width, height;
-
- if (gst_structure_get_int (ins, "width", &width)) {
- if (gst_structure_has_field (outs, "width")) {
- gst_structure_fixate_field_nearest_int (outs, "width", width);
- }
- }
- if (gst_structure_get_int (ins, "height", &height)) {
- if (gst_structure_has_field (outs, "height")) {
- gst_structure_fixate_field_nearest_int (outs, "height", height);
- }
- }
- }
-
- GST_DEBUG_OBJECT (base, "fixated othercaps to %" GST_PTR_FORMAT, othercaps);
-}
-
-static gboolean
-gst_video_scale_prepare_image (gint format, GstBuffer * buf,
- VSImage * img, VSImage * img_u, VSImage * img_v, gint step,
- gboolean interlaced)
-{
- gboolean res = TRUE;
-
- switch (format) {
- case GST_VIDEO_SCALE_I420:
- case GST_VIDEO_SCALE_YV12:
- img_u->pixels =
- GST_BUFFER_DATA (buf) + GST_ROUND_UP_2 (img->height) * img->stride;
- img_u->height = GST_ROUND_UP_2 (img->height) / 2;
- img_u->width = GST_ROUND_UP_2 (img->width) / 2;
- img_u->stride = GST_ROUND_UP_4 (img_u->width);
- if (interlaced) {
- }
- memcpy (img_v, img_u, sizeof (*img_v));
- img_v->pixels = img_u->pixels + img_u->height * img_u->stride;
- if (interlaced && step == 1) {
- img_v->pixels += img_v->stride;
- img_u->pixels += img_u->stride;
-
- img_u->height = (img_u->height / 2) + ((step == 0
- && img_u->height % 2 == 1) ? 1 : 0);
- img_u->stride *= 2;
- img_v->height = (img_v->height / 2) + ((step == 0
- && img_v->height % 2 == 1) ? 1 : 0);
- img_v->stride *= 2;
- }
- break;
- default:
- break;
- }
- return res;
-}
-
-static GstFlowReturn
-gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
- GstBuffer * out)
-{
- GstVideoScale *videoscale = GST_VIDEO_SCALE (trans);
- GstFlowReturn ret = GST_FLOW_OK;
- VSImage dest = videoscale->dest;
- VSImage src = videoscale->src;
- VSImage dest_u = { NULL, };
- VSImage dest_v = { NULL, };
- VSImage src_u = { NULL, };
- VSImage src_v = { NULL, };
- gint method;
- gint step;
- gboolean interlaced = videoscale->interlaced;
-
- GST_OBJECT_LOCK (videoscale);
- method = videoscale->method;
- GST_OBJECT_UNLOCK (videoscale);
-
- src.pixels = GST_BUFFER_DATA (in);
- dest.pixels = GST_BUFFER_DATA (out);
-
- /* For interlaced content we have to run two times with half height
- * and doubled stride */
- if (interlaced) {
- dest.height /= 2;
- src.height /= 2;
- dest.stride *= 2;
- src.stride *= 2;
- }
-
- if (src.height < 4 && method == GST_VIDEO_SCALE_4TAP)
- method = GST_VIDEO_SCALE_BILINEAR;
-
- for (step = 0; step < (interlaced ? 2 : 1); step++) {
- gst_video_scale_prepare_image (videoscale->format, in, &videoscale->src,
- &src_u, &src_v, step, interlaced);
- gst_video_scale_prepare_image (videoscale->format, out, &videoscale->dest,
- &dest_u, &dest_v, step, interlaced);
-
- if (step == 0 && interlaced) {
- if (videoscale->from_height % 2 == 1) {
- src.height += 1;
- }
-
- if (videoscale->to_height % 2 == 1) {
- dest.height += 1;
- }
- } else if (step == 1 && interlaced) {
- if (videoscale->from_height % 2 == 1) {
- src.height -= 1;
- }
-
- if (videoscale->to_height % 2 == 1) {
- dest.height -= 1;
- }
- src.pixels += (src.stride / 2);
- dest.pixels += (dest.stride / 2);
- }
-
- switch (method) {
- case GST_VIDEO_SCALE_NEAREST:
- GST_LOG_OBJECT (videoscale, "doing nearest scaling");
- switch (videoscale->format) {
- case GST_VIDEO_SCALE_RGBx:
- case GST_VIDEO_SCALE_xRGB:
- case GST_VIDEO_SCALE_BGRx:
- case GST_VIDEO_SCALE_xBGR:
- case GST_VIDEO_SCALE_RGBA:
- case GST_VIDEO_SCALE_ARGB:
- case GST_VIDEO_SCALE_BGRA:
- case GST_VIDEO_SCALE_ABGR:
- case GST_VIDEO_SCALE_AYUV:
- vs_image_scale_nearest_RGBA (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_RGB:
- case GST_VIDEO_SCALE_BGR:
- case GST_VIDEO_SCALE_v308:
- vs_image_scale_nearest_RGB (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_YUY2:
- case GST_VIDEO_SCALE_YVYU:
- vs_image_scale_nearest_YUYV (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_UYVY:
- vs_image_scale_nearest_UYVY (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_Y:
- case GST_VIDEO_SCALE_GRAY8:
- vs_image_scale_nearest_Y (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_GRAY16:
- vs_image_scale_nearest_Y16 (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_I420:
- case GST_VIDEO_SCALE_YV12:
- vs_image_scale_nearest_Y (&dest, &src, videoscale->tmp_buf);
- vs_image_scale_nearest_Y (&dest_u, &src_u, videoscale->tmp_buf);
- vs_image_scale_nearest_Y (&dest_v, &src_v, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_RGB565:
- vs_image_scale_nearest_RGB565 (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_RGB555:
- vs_image_scale_nearest_RGB555 (&dest, &src, videoscale->tmp_buf);
- break;
- default:
- goto unsupported;
- }
- break;
- case GST_VIDEO_SCALE_BILINEAR:
- GST_LOG_OBJECT (videoscale, "doing bilinear scaling");
- switch (videoscale->format) {
- case GST_VIDEO_SCALE_RGBx:
- case GST_VIDEO_SCALE_xRGB:
- case GST_VIDEO_SCALE_BGRx:
- case GST_VIDEO_SCALE_xBGR:
- case GST_VIDEO_SCALE_RGBA:
- case GST_VIDEO_SCALE_ARGB:
- case GST_VIDEO_SCALE_BGRA:
- case GST_VIDEO_SCALE_ABGR:
- case GST_VIDEO_SCALE_AYUV:
- vs_image_scale_linear_RGBA (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_RGB:
- case GST_VIDEO_SCALE_BGR:
- case GST_VIDEO_SCALE_v308:
- vs_image_scale_linear_RGB (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_YUY2:
- case GST_VIDEO_SCALE_YVYU:
- vs_image_scale_linear_YUYV (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_UYVY:
- vs_image_scale_linear_UYVY (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_Y:
- case GST_VIDEO_SCALE_GRAY8:
- vs_image_scale_linear_Y (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_GRAY16:
- vs_image_scale_linear_Y16 (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_I420:
- case GST_VIDEO_SCALE_YV12:
- vs_image_scale_linear_Y (&dest, &src, videoscale->tmp_buf);
- vs_image_scale_linear_Y (&dest_u, &src_u, videoscale->tmp_buf);
- vs_image_scale_linear_Y (&dest_v, &src_v, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_RGB565:
- vs_image_scale_linear_RGB565 (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_RGB555:
- vs_image_scale_linear_RGB555 (&dest, &src, videoscale->tmp_buf);
- break;
- default:
- goto unsupported;
- }
- break;
- case GST_VIDEO_SCALE_4TAP:
- GST_LOG_OBJECT (videoscale, "doing 4tap scaling");
- switch (videoscale->format) {
- case GST_VIDEO_SCALE_RGBx:
- case GST_VIDEO_SCALE_xRGB:
- case GST_VIDEO_SCALE_BGRx:
- case GST_VIDEO_SCALE_xBGR:
- case GST_VIDEO_SCALE_RGBA:
- case GST_VIDEO_SCALE_ARGB:
- case GST_VIDEO_SCALE_BGRA:
- case GST_VIDEO_SCALE_ABGR:
- case GST_VIDEO_SCALE_AYUV:
- vs_image_scale_4tap_RGBA (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_RGB:
- case GST_VIDEO_SCALE_BGR:
- case GST_VIDEO_SCALE_v308:
- vs_image_scale_4tap_RGB (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_YUY2:
- case GST_VIDEO_SCALE_YVYU:
- vs_image_scale_4tap_YUYV (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_UYVY:
- vs_image_scale_4tap_UYVY (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_Y:
- case GST_VIDEO_SCALE_GRAY8:
- vs_image_scale_4tap_Y (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_GRAY16:
- vs_image_scale_4tap_Y16 (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_I420:
- case GST_VIDEO_SCALE_YV12:
- vs_image_scale_4tap_Y (&dest, &src, videoscale->tmp_buf);
- vs_image_scale_4tap_Y (&dest_u, &src_u, videoscale->tmp_buf);
- vs_image_scale_4tap_Y (&dest_v, &src_v, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_RGB565:
- vs_image_scale_4tap_RGB565 (&dest, &src, videoscale->tmp_buf);
- break;
- case GST_VIDEO_SCALE_RGB555:
- vs_image_scale_4tap_RGB555 (&dest, &src, videoscale->tmp_buf);
- break;
- default:
- goto unsupported;
- }
- break;
- default:
- goto unknown_mode;
- }
-
- }
-
- GST_LOG_OBJECT (videoscale, "pushing buffer of %d bytes",
- GST_BUFFER_SIZE (out));
-
- return ret;
-
- /* ERRORS */
-unsupported:
- {
- GST_ELEMENT_ERROR (videoscale, STREAM, NOT_IMPLEMENTED, (NULL),
- ("Unsupported format %d for scaling method %d",
- videoscale->format, method));
- return GST_FLOW_ERROR;
- }
-unknown_mode:
- {
- GST_ELEMENT_ERROR (videoscale, STREAM, NOT_IMPLEMENTED, (NULL),
- ("Unknown scaling method %d", videoscale->method));
- return GST_FLOW_ERROR;
- }
-}
-
-static gboolean
-gst_video_scale_src_event (GstBaseTransform * trans, GstEvent * event)
-{
- GstVideoScale *videoscale;
- gboolean ret;
- double a;
- GstStructure *structure;
-
- videoscale = GST_VIDEO_SCALE (trans);
-
- GST_DEBUG_OBJECT (videoscale, "handling %s event",
- GST_EVENT_TYPE_NAME (event));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NAVIGATION:
- event =
- GST_EVENT (gst_mini_object_make_writable (GST_MINI_OBJECT (event)));
-
- structure = (GstStructure *) gst_event_get_structure (event);
- if (gst_structure_get_double (structure, "pointer_x", &a)) {
- gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE,
- a * videoscale->from_width / videoscale->to_width, NULL);
- }
- if (gst_structure_get_double (structure, "pointer_y", &a)) {
- gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE,
- a * videoscale->from_height / videoscale->to_height, NULL);
- }
- break;
- case GST_EVENT_QOS:
- break;
- default:
- break;
- }
-
- ret = GST_BASE_TRANSFORM_CLASS (parent_class)->src_event (trans, event);
-
- return ret;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- oil_init ();
-
- if (!gst_element_register (plugin, "videoscale", GST_RANK_NONE,
- GST_TYPE_VIDEO_SCALE))
- return FALSE;
-
- GST_DEBUG_CATEGORY_INIT (video_scale_debug, "videoscale", 0,
- "videoscale element");
-
- vs_4tap_init ();
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "videoscale",
- "Resizes video", plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME,
- GST_PACKAGE_ORIGIN)
diff --git a/gst/videoscale/gstvideoscale.h b/gst/videoscale/gstvideoscale.h
deleted file mode 100644
index 9ccb575d..00000000
--- a/gst/videoscale/gstvideoscale.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_VIDEO_SCALE_H__
-#define __GST_VIDEO_SCALE_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
-
-#include "vs_image.h"
-
-G_BEGIN_DECLS
-
-GST_DEBUG_CATEGORY_EXTERN (video_scale_debug);
-#define GST_CAT_DEFAULT video_scale_debug
-
-#define GST_TYPE_VIDEO_SCALE \
- (gst_video_scale_get_type())
-#define GST_VIDEO_SCALE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_SCALE,GstVideoScale))
-#define GST_VIDEO_SCALE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_SCALE,GstVideoScaleClass))
-#define GST_IS_VIDEO_SCALE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_SCALE))
-#define GST_IS_VIDEO_SCALE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_SCALE))
-
-/**
- * GstVideoScaleMethod:
- * @GST_VIDEO_SCALE_NEAREST: use nearest neighbour scaling (fast and ugly)
- * @GST_VIDEO_SCALE_BILINEAR: use bilinear scaling (slower but prettier).
- * @GST_VIDEO_SCALE_4TAP: use a 4-tap filter for scaling (slow).
- *
- * The videoscale method to use.
- */
-typedef enum {
- GST_VIDEO_SCALE_NEAREST,
- GST_VIDEO_SCALE_BILINEAR,
- GST_VIDEO_SCALE_4TAP
-} GstVideoScaleMethod;
-
-typedef struct _GstVideoScale GstVideoScale;
-typedef struct _GstVideoScaleClass GstVideoScaleClass;
-
-/**
- * GstVideoScale:
- *
- * Opaque data structure
- */
-struct _GstVideoScale {
- GstBaseTransform element;
-
- GstVideoScaleMethod method;
-
- /* negotiated stuff */
- int format;
- VSImage src;
- VSImage dest;
- guint src_size;
- guint dest_size;
- gint to_width;
- gint to_height;
- gint from_width;
- gint from_height;
- gboolean interlaced;
-
- /*< private >*/
- guint8 *tmp_buf;
-};
-
-struct _GstVideoScaleClass {
- GstBaseTransformClass parent_class;
-};
-
-GType gst_video_scale_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_VIDEO_SCALE_H__ */
diff --git a/gst/videoscale/videoscale.vcproj b/gst/videoscale/videoscale.vcproj
deleted file mode 100644
index 9388f67c..00000000
--- a/gst/videoscale/videoscale.vcproj
+++ /dev/null
@@ -1,154 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="videoscale"
- ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D678DE}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../win32/Debug"
- IntermediateDirectory="../../win32/Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;videoscale_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstvideoscale.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Debug;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/videoscale.pdb"
- SubSystem="2"
- OptimizeReferences="2"
- ImportLibrary="$(OutDir)/gstvideoscale.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../win32/Release"
- IntermediateDirectory="../../win32/Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;videoscale_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstvideoscale.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Release;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/gstvideoscale.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath=".\gstvideoscale.c">
- </File>
- <File
- RelativePath=".\videoscale.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- <File
- RelativePath=".\gstvideoscale.h">
- </File>
- <File
- RelativePath=".\videoscale.h">
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/gst/videoscale/vs_4tap.c b/gst/videoscale/vs_4tap.c
deleted file mode 100644
index ffe96aae..00000000
--- a/gst/videoscale/vs_4tap.c
+++ /dev/null
@@ -1,1339 +0,0 @@
-/*
- * Image Scaling Functions (4 tap)
- * Copyright (c) 2005 David A. Schleef <ds@schleef.org>
- * Copyright (c) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
- * All rights reserved.
- *
- * 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 AUTHOR ``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 AUTHOR 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.
- */
-
-#include "vs_image.h"
-#include "vs_scanline.h"
-
-#include "vs_4tap.h"
-
-#include <liboil/liboil.h>
-#include <math.h>
-
-#define SHIFT 10
-
-#define MAX(a,b) (((a) > (b)) ? (a) : (b))
-#define MIN(a,b) (((a) < (b)) ? (a) : (b))
-#define CLAMP(x,a,b) MAX(MIN((x),(b)),(a))
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#ifdef _MSC_VER
-#define rint(x) (floor((x)+0.5))
-#endif
-
-static int16_t vs_4tap_taps[256][4];
-
-static double
-vs_4tap_func (double x)
-{
-#if 0
- if (x < -1)
- return 0;
- if (x > 1)
- return 0;
- if (x < 0)
- return 1 + x;
- return 1 - x;
-#endif
-#if 0
- if (x == 0)
- return 1;
- return sin (M_PI * x) / (M_PI * x) * (1 - 0.25 * x * x);
-#endif
-#if 1
- if (x == 0)
- return 1;
- return sin (M_PI * x) / (M_PI * x);
-#endif
-}
-
-void
-vs_4tap_init (void)
-{
- int i;
- double a, b, c, d;
- double sum;
-
- for (i = 0; i < 256; i++) {
- a = vs_4tap_func (-1 - i / 256.0);
- b = vs_4tap_func (0 - i / 256.0);
- c = vs_4tap_func (1 - i / 256.0);
- d = vs_4tap_func (2 - i / 256.0);
- sum = a + b + c + d;
-
- vs_4tap_taps[i][0] = rint ((1 << SHIFT) * (a / sum));
- vs_4tap_taps[i][1] = rint ((1 << SHIFT) * (b / sum));
- vs_4tap_taps[i][2] = rint ((1 << SHIFT) * (c / sum));
- vs_4tap_taps[i][3] = rint ((1 << SHIFT) * (d / sum));
- }
-}
-
-
-void
-vs_scanline_resample_4tap_Y (uint8_t * dest, uint8_t * src,
- int n, int src_width, int *xacc, int increment)
-{
- int i;
- int j;
- int acc;
- int x;
- int y;
-
- acc = *xacc;
- for (i = 0; i < n; i++) {
- j = acc >> 16;
- x = (acc & 0xff00) >> 8;
- if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * src[MAX (j - 1, 0)];
- y += vs_4tap_taps[x][1] * src[j];
- y += vs_4tap_taps[x][2] * src[j + 1];
- y += vs_4tap_taps[x][3] * src[j + 2];
- } else {
- y = vs_4tap_taps[x][0] * src[CLAMP (j - 1, 0, src_width - 1)];
- y += vs_4tap_taps[x][1] * src[CLAMP (j, 0, src_width - 1)];
- y += vs_4tap_taps[x][2] * src[CLAMP (j + 1, 0, src_width - 1)];
- y += vs_4tap_taps[x][3] * src[CLAMP (j + 2, 0, src_width - 1)];
- }
- y += (1 << (SHIFT - 1));
- dest[i] = CLAMP (y >> SHIFT, 0, 255);
- acc += increment;
- }
- *xacc = acc;
-}
-
-void
-vs_scanline_merge_4tap_Y (uint8_t * dest, uint8_t * src1, uint8_t * src2,
- uint8_t * src3, uint8_t * src4, int n, int acc)
-{
- int i;
- int y;
- int a, b, c, d;
-
- acc = (acc >> 8) & 0xff;
- a = vs_4tap_taps[acc][0];
- b = vs_4tap_taps[acc][1];
- c = vs_4tap_taps[acc][2];
- d = vs_4tap_taps[acc][3];
- for (i = 0; i < n; i++) {
- y = a * src1[i];
- y += b * src2[i];
- y += c * src3[i];
- y += d * src4[i];
- y += (1 << (SHIFT - 1));
- dest[i] = CLAMP (y >> SHIFT, 0, 255);
- }
-}
-
-
-void
-vs_image_scale_4tap_Y (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int yacc;
- int y_increment;
- int x_increment;
- int i;
- int j;
- int xacc;
- int k;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- k = 0;
- for (i = 0; i < 4; i++) {
- xacc = 0;
- vs_scanline_resample_4tap_Y (tmpbuf + i * dest->width,
- src->pixels + i * src->stride, dest->width, src->width,
- &xacc, x_increment);
- }
-
- yacc = 0;
- for (i = 0; i < dest->height; i++) {
- uint8_t *t0, *t1, *t2, *t3;
-
- j = yacc >> 16;
-
- while (j > k) {
- k++;
- if (k + 3 < src->height) {
- xacc = 0;
- vs_scanline_resample_4tap_Y (tmpbuf + ((k + 3) & 3) * dest->width,
- src->pixels + (k + 3) * src->stride,
- dest->width, src->width, &xacc, x_increment);
- }
- }
-
- t0 = tmpbuf + (CLAMP (j - 1, 0, src->height - 1) & 3) * dest->width;
- t1 = tmpbuf + (CLAMP (j, 0, src->height - 1) & 3) * dest->width;
- t2 = tmpbuf + (CLAMP (j + 1, 0, src->height - 1) & 3) * dest->width;
- t3 = tmpbuf + (CLAMP (j + 2, 0, src->height - 1) & 3) * dest->width;
- vs_scanline_merge_4tap_Y (dest->pixels + i * dest->stride,
- t0, t1, t2, t3, dest->width, yacc & 0xffff);
-
- yacc += y_increment;
- }
-}
-
-void
-vs_scanline_resample_4tap_Y16 (uint8_t * dest, uint8_t * src,
- int n, int src_width, int *xacc, int increment)
-{
- int i;
- int j;
- int acc;
- int x;
- int y;
- uint16_t *d = (uint16_t *) dest, *s = (uint16_t *) src;
-
- acc = *xacc;
- for (i = 0; i < n; i++) {
- j = acc >> 16;
- x = (acc & 0xff00) >> 8;
- if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * s[MAX (j - 1, 0)];
- y += vs_4tap_taps[x][1] * s[j];
- y += vs_4tap_taps[x][2] * s[j + 1];
- y += vs_4tap_taps[x][3] * s[j + 2];
- } else {
- y = vs_4tap_taps[x][0] * s[CLAMP (j - 1, 0, src_width - 1)];
- y += vs_4tap_taps[x][1] * s[CLAMP (j, 0, src_width - 1)];
- y += vs_4tap_taps[x][2] * s[CLAMP (j + 1, 0, src_width - 1)];
- y += vs_4tap_taps[x][3] * s[CLAMP (j + 2, 0, src_width - 1)];
- }
- y += (1 << (SHIFT - 1));
- d[i] = CLAMP (y >> SHIFT, 0, 65535);
- acc += increment;
- }
- *xacc = acc;
-}
-
-void
-vs_scanline_merge_4tap_Y16 (uint8_t * dest, uint8_t * src1, uint8_t * src2,
- uint8_t * src3, uint8_t * src4, int n, int acc)
-{
- int i;
- int y;
- int a, b, c, d;
- uint16_t *de = (uint16_t *) dest, *s1 = (uint16_t *) src1;
- uint16_t *s2 = (uint16_t *) src2, *s3 = (uint16_t *) src3;
- uint16_t *s4 = (uint16_t *) src4;
-
- acc = (acc >> 8) & 0xff;
- a = vs_4tap_taps[acc][0];
- b = vs_4tap_taps[acc][1];
- c = vs_4tap_taps[acc][2];
- d = vs_4tap_taps[acc][3];
- for (i = 0; i < n; i++) {
- y = a * s1[i];
- y += b * s2[i];
- y += c * s3[i];
- y += d * s4[i];
- y += (1 << (SHIFT - 1));
- de[i] = CLAMP (y >> SHIFT, 0, 65535);
- }
-}
-
-
-void
-vs_image_scale_4tap_Y16 (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int yacc;
- int y_increment;
- int x_increment;
- int i;
- int j;
- int xacc;
- int k;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- k = 0;
- for (i = 0; i < 4; i++) {
- xacc = 0;
- vs_scanline_resample_4tap_Y16 (tmpbuf + i * dest->stride,
- src->pixels + i * src->stride, dest->width, src->width,
- &xacc, x_increment);
- }
-
- yacc = 0;
- for (i = 0; i < dest->height; i++) {
- uint8_t *t0, *t1, *t2, *t3;
-
- j = yacc >> 16;
-
- while (j > k) {
- k++;
- if (k + 3 < src->height) {
- xacc = 0;
- vs_scanline_resample_4tap_Y16 (tmpbuf + ((k + 3) & 3) * dest->stride,
- src->pixels + (k + 3) * src->stride,
- dest->width, src->width, &xacc, x_increment);
- }
- }
-
- t0 = tmpbuf + (CLAMP (j - 1, 0, src->height - 1) & 3) * dest->stride;
- t1 = tmpbuf + (CLAMP (j, 0, src->height - 1) & 3) * dest->stride;
- t2 = tmpbuf + (CLAMP (j + 1, 0, src->height - 1) & 3) * dest->stride;
- t3 = tmpbuf + (CLAMP (j + 2, 0, src->height - 1) & 3) * dest->stride;
- vs_scanline_merge_4tap_Y16 (dest->pixels + i * dest->stride,
- t0, t1, t2, t3, dest->width, yacc & 0xffff);
-
- yacc += y_increment;
- }
-}
-
-void
-vs_scanline_resample_4tap_RGBA (uint8_t * dest, uint8_t * src,
- int n, int src_width, int *xacc, int increment)
-{
- int i;
- int j;
- int acc;
- int x;
- int y;
- int off;
-
- acc = *xacc;
- for (i = 0; i < n; i++) {
- j = acc >> 16;
- x = (acc & 0xffff) >> 8;
-
- for (off = 0; off < 4; off++) {
- if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * src[MAX ((j - 1) * 4 + off, 0)];
- y += vs_4tap_taps[x][1] * src[j * 4 + off];
- y += vs_4tap_taps[x][2] * src[(j + 1) * 4 + off];
- y += vs_4tap_taps[x][3] * src[(j + 2) * 4 + off];
- } else {
- y = vs_4tap_taps[x][0] * src[CLAMP ((j - 1) * 4 + off, 0,
- 4 * (src_width - 1) + off)];
- y += vs_4tap_taps[x][1] * src[CLAMP (j * 4 + off, 0,
- 4 * (src_width - 1) + off)];
- y += vs_4tap_taps[x][2] * src[CLAMP ((j + 1) * 4 + off, 0,
- 4 * (src_width - 1) + off)];
- y += vs_4tap_taps[x][3] * src[CLAMP ((j + 2) * 4 + off, 0,
- 4 * (src_width - 1) + off)];
- }
- y += (1 << (SHIFT - 1));
- dest[i * 4 + off] = CLAMP (y >> SHIFT, 0, 255);
- }
- acc += increment;
- }
- *xacc = acc;
-}
-
-void
-vs_scanline_merge_4tap_RGBA (uint8_t * dest, uint8_t * src1, uint8_t * src2,
- uint8_t * src3, uint8_t * src4, int n, int acc)
-{
- int i;
- int y;
- int off;
- int a, b, c, d;
-
- acc = (acc >> 8) & 0xff;
- a = vs_4tap_taps[acc][0];
- b = vs_4tap_taps[acc][1];
- c = vs_4tap_taps[acc][2];
- d = vs_4tap_taps[acc][3];
- for (i = 0; i < n; i++) {
- for (off = 0; off < 4; off++) {
- y = a * src1[i * 4 + off];
- y += b * src2[i * 4 + off];
- y += c * src3[i * 4 + off];
- y += d * src4[i * 4 + off];
- y += (1 << (SHIFT - 1));
- dest[i * 4 + off] = CLAMP (y >> SHIFT, 0, 255);
- }
- }
-}
-
-void
-vs_image_scale_4tap_RGBA (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int yacc;
- int y_increment;
- int x_increment;
- int i;
- int j;
- int xacc;
- int k;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- k = 0;
- for (i = 0; i < 4; i++) {
- xacc = 0;
- vs_scanline_resample_4tap_RGBA (tmpbuf + i * dest->stride,
- src->pixels + i * src->stride, dest->width, src->width,
- &xacc, x_increment);
- }
-
- yacc = 0;
- for (i = 0; i < dest->height; i++) {
- uint8_t *t0, *t1, *t2, *t3;
-
- j = yacc >> 16;
-
- while (j > k) {
- k++;
- if (k + 3 < src->height) {
- xacc = 0;
- vs_scanline_resample_4tap_RGBA (tmpbuf + ((k + 3) & 3) * dest->stride,
- src->pixels + (k + 3) * src->stride,
- dest->width, src->width, &xacc, x_increment);
- }
- }
-
- t0 = tmpbuf + (CLAMP (j - 1, 0, src->height - 1) & 3) * dest->stride;
- t1 = tmpbuf + (CLAMP (j, 0, src->height - 1) & 3) * dest->stride;
- t2 = tmpbuf + (CLAMP (j + 1, 0, src->height - 1) & 3) * dest->stride;
- t3 = tmpbuf + (CLAMP (j + 2, 0, src->height - 1) & 3) * dest->stride;
- vs_scanline_merge_4tap_RGBA (dest->pixels + i * dest->stride,
- t0, t1, t2, t3, dest->width, yacc & 0xffff);
-
- yacc += y_increment;
- }
-}
-
-void
-vs_scanline_resample_4tap_RGB (uint8_t * dest, uint8_t * src,
- int n, int src_width, int *xacc, int increment)
-{
- int i;
- int j;
- int acc;
- int x;
- int y;
- int off;
-
- acc = *xacc;
- for (i = 0; i < n; i++) {
- j = acc >> 16;
- x = (acc & 0xffff) >> 8;
-
- for (off = 0; off < 3; off++) {
- if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * src[MAX ((j - 1) * 3 + off, 0)];
- y += vs_4tap_taps[x][1] * src[j * 3 + off];
- y += vs_4tap_taps[x][2] * src[(j + 1) * 3 + off];
- y += vs_4tap_taps[x][3] * src[(j + 2) * 3 + off];
- } else {
- y = vs_4tap_taps[x][0] * src[CLAMP ((j - 1) * 3 + off, 0,
- 3 * (src_width - 1) + off)];
- y += vs_4tap_taps[x][1] * src[CLAMP (j * 3 + off, 0,
- 3 * (src_width - 1) + off)];
- y += vs_4tap_taps[x][2] * src[CLAMP ((j + 1) * 3 + off, 0,
- 3 * (src_width - 1) + off)];
- y += vs_4tap_taps[x][3] * src[CLAMP ((j + 2) * 3 + off, 0,
- 3 * (src_width - 1) + off)];
- }
- y += (1 << (SHIFT - 1));
- dest[i * 3 + off] = CLAMP (y >> SHIFT, 0, 255);
- }
- acc += increment;
- }
- *xacc = acc;
-}
-
-void
-vs_scanline_merge_4tap_RGB (uint8_t * dest, uint8_t * src1, uint8_t * src2,
- uint8_t * src3, uint8_t * src4, int n, int acc)
-{
- int i;
- int y;
- int off;
- int a, b, c, d;
-
- acc = (acc >> 8) & 0xff;
- a = vs_4tap_taps[acc][0];
- b = vs_4tap_taps[acc][1];
- c = vs_4tap_taps[acc][2];
- d = vs_4tap_taps[acc][3];
- for (i = 0; i < n; i++) {
- for (off = 0; off < 3; off++) {
- y = a * src1[i * 3 + off];
- y += b * src2[i * 3 + off];
- y += c * src3[i * 3 + off];
- y += d * src4[i * 3 + off];
- y += (1 << (SHIFT - 1));
- dest[i * 3 + off] = CLAMP (y >> SHIFT, 0, 255);
- }
- }
-}
-
-void
-vs_image_scale_4tap_RGB (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int yacc;
- int y_increment;
- int x_increment;
- int i;
- int j;
- int xacc;
- int k;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- k = 0;
- for (i = 0; i < 4; i++) {
- xacc = 0;
- vs_scanline_resample_4tap_RGB (tmpbuf + i * dest->stride,
- src->pixels + i * src->stride, dest->width, src->width,
- &xacc, x_increment);
- }
-
- yacc = 0;
- for (i = 0; i < dest->height; i++) {
- uint8_t *t0, *t1, *t2, *t3;
-
- j = yacc >> 16;
-
- while (j > k) {
- k++;
- if (k + 3 < src->height) {
- xacc = 0;
- vs_scanline_resample_4tap_RGB (tmpbuf + ((k + 3) & 3) * dest->stride,
- src->pixels + (k + 3) * src->stride,
- dest->width, src->width, &xacc, x_increment);
- }
- }
-
- t0 = tmpbuf + (CLAMP (j - 1, 0, src->height - 1) & 3) * dest->stride;
- t1 = tmpbuf + (CLAMP (j, 0, src->height - 1) & 3) * dest->stride;
- t2 = tmpbuf + (CLAMP (j + 1, 0, src->height - 1) & 3) * dest->stride;
- t3 = tmpbuf + (CLAMP (j + 2, 0, src->height - 1) & 3) * dest->stride;
- vs_scanline_merge_4tap_RGB (dest->pixels + i * dest->stride,
- t0, t1, t2, t3, dest->width, yacc & 0xffff);
-
- yacc += y_increment;
- }
-}
-
-void
-vs_scanline_resample_4tap_YUYV (uint8_t * dest, uint8_t * src,
- int n, int src_width, int *xacc, int increment)
-{
- int i;
- int j;
- int acc;
- int x;
- int y;
- int quads = (n + 1) / 2;
- int last_y = 2 * (src_width - 1);
- int last_u =
- MAX ((2 * (src_width - 1) % 4 ==
- 0) ? 2 * (src_width - 1) + 1 : 2 * (src_width - 1) - 1, 1);
- int last_v =
- MAX ((2 * (src_width - 1) % 4 ==
- 2) ? 2 * (src_width - 1) + 1 : 2 * (src_width - 1) - 1, 1);
-
- acc = *xacc;
- for (i = 0; i < quads; i++) {
- j = acc >> 16;
- x = (acc & 0xffff) >> 8;
-
- if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * src[MAX (j * 2 + 0 - 2, 0)];
- y += vs_4tap_taps[x][1] * src[j * 2 + 0];
- y += vs_4tap_taps[x][2] * src[j * 2 + 0 + 2];
- y += vs_4tap_taps[x][3] * src[j * 2 + 0 + 4];
- } else {
- y = vs_4tap_taps[x][0] * src[CLAMP (j * 2 + 0 - 2, 0, last_y)];
- y += vs_4tap_taps[x][1] * src[CLAMP (j * 2 + 0, 0, last_y)];
- y += vs_4tap_taps[x][2] * src[CLAMP (j * 2 + 0 + 2, 0, last_y)];
- y += vs_4tap_taps[x][3] * src[CLAMP (j * 2 + 0 + 4, 0, last_y)];
- }
- y += (1 << (SHIFT - 1));
- dest[i * 4 + 0] = CLAMP (y >> SHIFT, 0, 255);
-
- j = acc >> 17;
- x = (acc & 0x1ffff) >> 9;
-
- if (2 * (j - 1) >= 0 && 2 * (j + 4) < src_width) {
- y = vs_4tap_taps[x][0] * src[MAX (j * 4 + 1 - 4, 1)];
- y += vs_4tap_taps[x][1] * src[j * 4 + 1];
- y += vs_4tap_taps[x][2] * src[j * 4 + 1 + 4];
- y += vs_4tap_taps[x][3] * src[j * 4 + 1 + 8];
- } else {
- y = vs_4tap_taps[x][0] * src[CLAMP (j * 4 + 1 - 4, 1, last_u)];
- y += vs_4tap_taps[x][1] * src[CLAMP (j * 4 + 1, 1, last_u)];
- y += vs_4tap_taps[x][2] * src[CLAMP (j * 4 + 1 + 4, 1, last_u)];
- y += vs_4tap_taps[x][3] * src[CLAMP (j * 4 + 1 + 8, 1, last_u)];
- }
- y += (1 << (SHIFT - 1));
- dest[i * 4 + 1] = CLAMP (y >> SHIFT, 0, 255);
-
- if (2 * i + 1 < n) {
- if (2 * (j - 1) >= 0 && 2 * (j + 4) < src_width) {
- y = vs_4tap_taps[x][0] * src[MAX (j * 4 + 3 - 4, 3)];
- y += vs_4tap_taps[x][1] * src[j * 4 + 3];
- y += vs_4tap_taps[x][2] * src[j * 4 + 3 + 4];
- y += vs_4tap_taps[x][3] * src[j * 4 + 3 + 8];
- } else {
- y = vs_4tap_taps[x][0] * src[CLAMP (j * 4 + 3 - 4, 3, last_v)];
- y += vs_4tap_taps[x][1] * src[CLAMP (j * 4 + 3, 3, last_v)];
- y += vs_4tap_taps[x][2] * src[CLAMP (j * 4 + 3 + 4, 3, last_v)];
- y += vs_4tap_taps[x][3] * src[CLAMP (j * 4 + 3 + 8, 3, last_v)];
- }
- y += (1 << (SHIFT - 1));
- dest[i * 4 + 3] = CLAMP (y >> SHIFT, 0, 255);
- }
-
- acc += increment;
- j = acc >> 16;
- x = (acc & 0xffff) >> 8;
-
- if (2 * i + 1 < n) {
- if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * src[MAX (j * 2 + 0 - 2, 0)];
- y += vs_4tap_taps[x][1] * src[j * 2 + 0];
- y += vs_4tap_taps[x][2] * src[j * 2 + 0 + 2];
- y += vs_4tap_taps[x][3] * src[j * 2 + 0 + 4];
- } else {
- y = vs_4tap_taps[x][0] * src[CLAMP (j * 2 + 0 - 2, 0, last_y)];
- y += vs_4tap_taps[x][1] * src[CLAMP (j * 2 + 0, 0, last_y)];
- y += vs_4tap_taps[x][2] * src[CLAMP (j * 2 + 0 + 2, 0, last_y)];
- y += vs_4tap_taps[x][3] * src[CLAMP (j * 2 + 0 + 4, 0, last_y)];
- }
- y += (1 << (SHIFT - 1));
- dest[i * 4 + 2] = CLAMP (y >> SHIFT, 0, 255);
- acc += increment;
- }
- }
- *xacc = acc;
-}
-
-void
-vs_scanline_merge_4tap_YUYV (uint8_t * dest, uint8_t * src1, uint8_t * src2,
- uint8_t * src3, uint8_t * src4, int n, int acc)
-{
- int i;
- int y;
- int a, b, c, d;
- int quads = (n + 1) / 2;
-
- acc = (acc >> 8) & 0xff;
- a = vs_4tap_taps[acc][0];
- b = vs_4tap_taps[acc][1];
- c = vs_4tap_taps[acc][2];
- d = vs_4tap_taps[acc][3];
- for (i = 0; i < quads; i++) {
- y = a * src1[i * 4 + 0];
- y += b * src2[i * 4 + 0];
- y += c * src3[i * 4 + 0];
- y += d * src4[i * 4 + 0];
- y += (1 << (SHIFT - 1));
- dest[i * 4 + 0] = CLAMP (y >> SHIFT, 0, 255);
-
- y = a * src1[i * 4 + 1];
- y += b * src2[i * 4 + 1];
- y += c * src3[i * 4 + 1];
- y += d * src4[i * 4 + 1];
- y += (1 << (SHIFT - 1));
- dest[i * 4 + 1] = CLAMP (y >> SHIFT, 0, 255);
-
- if (2 * i + 1 < n) {
- y = a * src1[i * 4 + 2];
- y += b * src2[i * 4 + 2];
- y += c * src3[i * 4 + 2];
- y += d * src4[i * 4 + 2];
- y += (1 << (SHIFT - 1));
- dest[i * 4 + 2] = CLAMP (y >> SHIFT, 0, 255);
-
- y = a * src1[i * 4 + 3];
- y += b * src2[i * 4 + 3];
- y += c * src3[i * 4 + 3];
- y += d * src4[i * 4 + 3];
- y += (1 << (SHIFT - 1));
- dest[i * 4 + 3] = CLAMP (y >> SHIFT, 0, 255);
- }
- }
-}
-
-void
-vs_image_scale_4tap_YUYV (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int yacc;
- int y_increment;
- int x_increment;
- int i;
- int j;
- int xacc;
- int k;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- k = 0;
- for (i = 0; i < 4; i++) {
- xacc = 0;
- vs_scanline_resample_4tap_YUYV (tmpbuf + i * dest->stride,
- src->pixels + i * src->stride, dest->width, src->width,
- &xacc, x_increment);
- }
-
- yacc = 0;
- for (i = 0; i < dest->height; i++) {
- uint8_t *t0, *t1, *t2, *t3;
-
- j = yacc >> 16;
-
- while (j > k) {
- k++;
- if (k + 3 < src->height) {
- xacc = 0;
- vs_scanline_resample_4tap_YUYV (tmpbuf + ((k + 3) & 3) * dest->stride,
- src->pixels + (k + 3) * src->stride,
- dest->width, src->width, &xacc, x_increment);
- }
- }
-
- t0 = tmpbuf + (CLAMP (j - 1, 0, src->height - 1) & 3) * dest->stride;
- t1 = tmpbuf + (CLAMP (j, 0, src->height - 1) & 3) * dest->stride;
- t2 = tmpbuf + (CLAMP (j + 1, 0, src->height - 1) & 3) * dest->stride;
- t3 = tmpbuf + (CLAMP (j + 2, 0, src->height - 1) & 3) * dest->stride;
- vs_scanline_merge_4tap_YUYV (dest->pixels + i * dest->stride,
- t0, t1, t2, t3, dest->width, yacc & 0xffff);
-
- yacc += y_increment;
- }
-}
-
-void
-vs_scanline_resample_4tap_UYVY (uint8_t * dest, uint8_t * src,
- int n, int src_width, int *xacc, int increment)
-{
- int i;
- int j;
- int acc;
- int x;
- int y;
- int quads = (n + 1) / 2;
- int last_y = 2 * (src_width - 1) + 1;
- int last_u =
- MAX ((2 * (src_width - 1) % 4 ==
- 0) ? 2 * (src_width - 1) : 2 * (src_width - 1) - 2, 0);
- int last_v =
- MAX ((2 * (src_width - 1) % 4 ==
- 2) ? 2 * (src_width - 1) : 2 * (src_width - 1) - 2, 0);
-
- acc = *xacc;
- for (i = 0; i < quads; i++) {
- j = acc >> 16;
- x = (acc & 0xffff) >> 8;
-
- if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * src[MAX (j * 2 + 1 - 2, 1)];
- y += vs_4tap_taps[x][1] * src[j * 2 + 1];
- y += vs_4tap_taps[x][2] * src[j * 2 + 1 + 2];
- y += vs_4tap_taps[x][3] * src[j * 2 + 1 + 4];
- } else {
- y = vs_4tap_taps[x][0] * src[CLAMP (j * 2 + 1 - 2, 1, last_y)];
- y += vs_4tap_taps[x][1] * src[CLAMP (j * 2 + 1, 1, last_y)];
- y += vs_4tap_taps[x][2] * src[CLAMP (j * 2 + 1 + 2, 1, last_y)];
- y += vs_4tap_taps[x][3] * src[CLAMP (j * 2 + 1 + 4, 1, last_y)];
- }
- y += (1 << (SHIFT - 1));
- dest[i * 4 + 1] = CLAMP (y >> SHIFT, 0, 255);
-
- j = acc >> 17;
- x = (acc & 0x1ffff) >> 9;
-
- if (2 * (j - 2) >= 0 && 2 * (j + 4) < src_width) {
- y = vs_4tap_taps[x][0] * src[MAX (j * 4 + 0 - 4, 0)];
- y += vs_4tap_taps[x][1] * src[j * 4 + 0];
- y += vs_4tap_taps[x][2] * src[j * 4 + 0 + 4];
- y += vs_4tap_taps[x][3] * src[j * 4 + 0 + 8];
- } else {
- y = vs_4tap_taps[x][0] * src[CLAMP (j * 4 + 0 - 4, 0, last_u)];
- y += vs_4tap_taps[x][1] * src[CLAMP (j * 4 + 0, 0, last_u)];
- y += vs_4tap_taps[x][2] * src[CLAMP (j * 4 + 0 + 4, 0, last_u)];
- y += vs_4tap_taps[x][3] * src[CLAMP (j * 4 + 0 + 8, 0, last_u)];
- }
- y += (1 << (SHIFT - 1));
- dest[i * 4 + 0] = CLAMP (y >> SHIFT, 0, 255);
-
- if (2 * i + 1 < n) {
- if (2 * (j - 1) >= 0 && 2 * (j + 4) < src_width) {
- y = vs_4tap_taps[x][0] * src[MAX (j * 4 + 2 - 4, 2)];
- y += vs_4tap_taps[x][1] * src[j * 4 + 2];
- y += vs_4tap_taps[x][2] * src[j * 4 + 2 + 4];
- y += vs_4tap_taps[x][3] * src[j * 4 + 2 + 8];
- } else {
- y = vs_4tap_taps[x][0] * src[CLAMP (j * 4 + 2 - 4, 2, last_v)];
- y += vs_4tap_taps[x][1] * src[CLAMP (j * 4 + 2, 2, last_v)];
- y += vs_4tap_taps[x][2] * src[CLAMP (j * 4 + 2 + 4, 2, last_v)];
- y += vs_4tap_taps[x][3] * src[CLAMP (j * 4 + 2 + 8, 2, last_v)];
- }
- y += (1 << (SHIFT - 1));
- dest[i * 4 + 2] = CLAMP (y >> SHIFT, 0, 255);
- }
-
- acc += increment;
- j = acc >> 16;
- x = (acc & 0xffff) >> 8;
-
- if (2 * i + 1 < n) {
- if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * src[MAX (j * 2 + 1 - 2, 0)];
- y += vs_4tap_taps[x][1] * src[j * 2 + 1];
- y += vs_4tap_taps[x][2] * src[j * 2 + 1 + 2];
- y += vs_4tap_taps[x][3] * src[j * 2 + 1 + 4];
- } else {
- y = vs_4tap_taps[x][0] * src[CLAMP (j * 2 + 1 - 2, 1, last_y)];
- y += vs_4tap_taps[x][1] * src[CLAMP (j * 2 + 1, 1, last_y)];
- y += vs_4tap_taps[x][2] * src[CLAMP (j * 2 + 1 + 2, 1, last_y)];
- y += vs_4tap_taps[x][3] * src[CLAMP (j * 2 + 1 + 4, 1, last_y)];
- }
- y += (1 << (SHIFT - 1));
- dest[i * 4 + 3] = CLAMP (y >> SHIFT, 0, 255);
- acc += increment;
- }
- }
- *xacc = acc;
-}
-
-void
-vs_scanline_merge_4tap_UYVY (uint8_t * dest, uint8_t * src1, uint8_t * src2,
- uint8_t * src3, uint8_t * src4, int n, int acc)
-{
- int i;
- int y;
- int a, b, c, d;
- int quads = (n + 1) / 2;
-
- acc = (acc >> 8) & 0xff;
- a = vs_4tap_taps[acc][0];
- b = vs_4tap_taps[acc][1];
- c = vs_4tap_taps[acc][2];
- d = vs_4tap_taps[acc][3];
- for (i = 0; i < quads; i++) {
- y = a * src1[i * 4 + 0];
- y += b * src2[i * 4 + 0];
- y += c * src3[i * 4 + 0];
- y += d * src4[i * 4 + 0];
- y += (1 << (SHIFT - 1));
- dest[i * 4 + 0] = CLAMP (y >> SHIFT, 0, 255);
-
- y = a * src1[i * 4 + 1];
- y += b * src2[i * 4 + 1];
- y += c * src3[i * 4 + 1];
- y += d * src4[i * 4 + 1];
- y += (1 << (SHIFT - 1));
- dest[i * 4 + 1] = CLAMP (y >> SHIFT, 0, 255);
-
- if (2 * i + 1 < n) {
- y = a * src1[i * 4 + 2];
- y += b * src2[i * 4 + 2];
- y += c * src3[i * 4 + 2];
- y += d * src4[i * 4 + 2];
- y += (1 << (SHIFT - 1));
- dest[i * 4 + 2] = CLAMP (y >> SHIFT, 0, 255);
-
- y = a * src1[i * 4 + 3];
- y += b * src2[i * 4 + 3];
- y += c * src3[i * 4 + 3];
- y += d * src4[i * 4 + 3];
- y += (1 << (SHIFT - 1));
- dest[i * 4 + 3] = CLAMP (y >> SHIFT, 0, 255);
- }
- }
-}
-
-void
-vs_image_scale_4tap_UYVY (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int yacc;
- int y_increment;
- int x_increment;
- int i;
- int j;
- int xacc;
- int k;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- k = 0;
- for (i = 0; i < 4; i++) {
- xacc = 0;
- vs_scanline_resample_4tap_UYVY (tmpbuf + i * dest->stride,
- src->pixels + i * src->stride, dest->width, src->width,
- &xacc, x_increment);
- }
-
- yacc = 0;
- for (i = 0; i < dest->height; i++) {
- uint8_t *t0, *t1, *t2, *t3;
-
- j = yacc >> 16;
-
- while (j > k) {
- k++;
- if (k + 3 < src->height) {
- xacc = 0;
- vs_scanline_resample_4tap_UYVY (tmpbuf + ((k + 3) & 3) * dest->stride,
- src->pixels + (k + 3) * src->stride,
- dest->width, src->width, &xacc, x_increment);
- }
- }
-
- t0 = tmpbuf + (CLAMP (j - 1, 0, src->height - 1) & 3) * dest->stride;
- t1 = tmpbuf + (CLAMP (j, 0, src->height - 1) & 3) * dest->stride;
- t2 = tmpbuf + (CLAMP (j + 1, 0, src->height - 1) & 3) * dest->stride;
- t3 = tmpbuf + (CLAMP (j + 2, 0, src->height - 1) & 3) * dest->stride;
- vs_scanline_merge_4tap_UYVY (dest->pixels + i * dest->stride,
- t0, t1, t2, t3, dest->width, yacc & 0xffff);
-
- yacc += y_increment;
- }
-}
-
-/* note that src and dest are uint16_t, and thus endian dependent */
-
-#define RGB565_R(x) (((x)&0xf800)>>8 | ((x)&0xf800)>>13)
-#define RGB565_G(x) (((x)&0x07e0)>>3 | ((x)&0x07e0)>>9)
-#define RGB565_B(x) (((x)&0x001f)<<3 | ((x)&0x001f)>>2)
-
-#define RGB565(r,g,b) \
- ((((r)<<8)&0xf800) | (((g)<<3)&0x07e0) | (((b)>>3)&0x001f))
-
-void
-vs_scanline_resample_4tap_RGB565 (uint8_t * dest_u8, uint8_t * src_u8,
- int n, int src_width, int *xacc, int increment)
-{
- int i;
- int j;
- int acc;
- int x;
- int y, y_r, y_b, y_g;
- uint16_t *dest = (uint16_t *) dest_u8;
- uint16_t *src = (uint16_t *) src_u8;
-
- acc = *xacc;
- for (i = 0; i < n; i++) {
- j = acc >> 16;
- x = acc & 0xffff >> 8;
-
- if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * RGB565_R (src[MAX ((j - 1), 0)]);
- y += vs_4tap_taps[x][1] * RGB565_R (src[j]);
- y += vs_4tap_taps[x][2] * RGB565_R (src[(j + 1)]);
- y += vs_4tap_taps[x][3] * RGB565_R (src[(j + 2)]);
- } else {
- y = vs_4tap_taps[x][0] * RGB565_R (src[CLAMP ((j - 1), 0,
- src_width - 1)]);
- y += vs_4tap_taps[x][1] * RGB565_R (src[CLAMP (j, 0, src_width - 1)]);
- y += vs_4tap_taps[x][2] * RGB565_R (src[CLAMP ((j + 1), 0,
- src_width - 1)]);
- y += vs_4tap_taps[x][3] * RGB565_R (src[CLAMP ((j + 2), 0,
- src_width - 1)]);
- }
- y += (1 << (SHIFT - 1));
- y_r = CLAMP (y >> SHIFT, 0, 255);
-
- if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * RGB565_G (src[MAX ((j - 1), 0)]);
- y += vs_4tap_taps[x][1] * RGB565_G (src[j]);
- y += vs_4tap_taps[x][2] * RGB565_G (src[(j + 1)]);
- y += vs_4tap_taps[x][3] * RGB565_G (src[(j + 2)]);
- } else {
- y = vs_4tap_taps[x][0] * RGB565_G (src[CLAMP ((j - 1), 0,
- src_width - 1)]);
- y += vs_4tap_taps[x][1] * RGB565_G (src[CLAMP (j, 0, src_width - 1)]);
- y += vs_4tap_taps[x][2] * RGB565_G (src[CLAMP ((j + 1), 0,
- src_width - 1)]);
- y += vs_4tap_taps[x][3] * RGB565_G (src[CLAMP ((j + 2), 0,
- src_width - 1)]);
- }
- y += (1 << (SHIFT - 1));
- y_g = CLAMP (y >> SHIFT, 0, 255);
-
- if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * RGB565_B (src[MAX ((j - 1), 0)]);
- y += vs_4tap_taps[x][1] * RGB565_B (src[j]);
- y += vs_4tap_taps[x][2] * RGB565_B (src[(j + 1)]);
- y += vs_4tap_taps[x][3] * RGB565_B (src[(j + 2)]);
- } else {
- y = vs_4tap_taps[x][0] * RGB565_B (src[CLAMP ((j - 1), 0,
- src_width - 1)]);
- y += vs_4tap_taps[x][1] * RGB565_B (src[CLAMP (j, 0, src_width - 1)]);
- y += vs_4tap_taps[x][2] * RGB565_B (src[CLAMP ((j + 1), 0,
- src_width - 1)]);
- y += vs_4tap_taps[x][3] * RGB565_B (src[CLAMP ((j + 2), 0,
- src_width - 1)]);
- }
- y += (1 << (SHIFT - 1));
- y_b = CLAMP (y >> SHIFT, 0, 255);
-
- dest[i] = RGB565 (y_r, y_b, y_g);
- acc += increment;
- }
- *xacc = acc;
-}
-
-void
-vs_scanline_merge_4tap_RGB565 (uint8_t * dest_u8, uint8_t * src1_u8,
- uint8_t * src2_u8, uint8_t * src3_u8, uint8_t * src4_u8, int n, int acc)
-{
- int i;
- int y, y_r, y_b, y_g;
- int a, b, c, d;
- uint16_t *dest = (uint16_t *) dest_u8;
- uint16_t *src1 = (uint16_t *) src1_u8;
- uint16_t *src2 = (uint16_t *) src2_u8;
- uint16_t *src3 = (uint16_t *) src3_u8;
- uint16_t *src4 = (uint16_t *) src4_u8;
-
- acc = (acc >> 8) & 0xff;
- a = vs_4tap_taps[acc][0];
- b = vs_4tap_taps[acc][1];
- c = vs_4tap_taps[acc][2];
- d = vs_4tap_taps[acc][3];
-
- for (i = 0; i < n; i++) {
- y = a * RGB565_R (src1[i]);
- y += b * RGB565_R (src2[i]);
- y += c * RGB565_R (src3[i]);
- y += d * RGB565_R (src4[i]);
- y += (1 << (SHIFT - 1));
- y_r = CLAMP (y >> SHIFT, 0, 255);
-
- y = a * RGB565_G (src1[i]);
- y += b * RGB565_G (src2[i]);
- y += c * RGB565_G (src3[i]);
- y += d * RGB565_G (src4[i]);
- y += (1 << (SHIFT - 1));
- y_g = CLAMP (y >> SHIFT, 0, 255);
-
- y = a * RGB565_B (src1[i]);
- y += b * RGB565_B (src2[i]);
- y += c * RGB565_B (src3[i]);
- y += d * RGB565_B (src4[i]);
- y += (1 << (SHIFT - 1));
- y_b = CLAMP (y >> SHIFT, 0, 255);
-
- dest[i] = RGB565 (y_r, y_b, y_g);
- }
-}
-
-void
-vs_image_scale_4tap_RGB565 (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int yacc;
- int y_increment;
- int x_increment;
- int i;
- int j;
- int xacc;
- int k;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- k = 0;
- for (i = 0; i < 4; i++) {
- xacc = 0;
- vs_scanline_resample_4tap_RGB565 (tmpbuf + i * dest->stride,
- src->pixels + i * src->stride, dest->width, src->width,
- &xacc, x_increment);
- }
-
- yacc = 0;
- for (i = 0; i < dest->height; i++) {
- uint8_t *t0, *t1, *t2, *t3;
-
- j = yacc >> 16;
-
- while (j > k) {
- k++;
- if (k + 3 < src->height) {
- xacc = 0;
- vs_scanline_resample_4tap_RGB565 (tmpbuf + ((k + 3) & 3) * dest->stride,
- src->pixels + (k + 3) * src->stride,
- dest->width, src->width, &xacc, x_increment);
- }
- }
-
- t0 = tmpbuf + (CLAMP (j - 1, 0, src->height - 1) & 3) * dest->stride;
- t1 = tmpbuf + (CLAMP (j, 0, src->height - 1) & 3) * dest->stride;
- t2 = tmpbuf + (CLAMP (j + 1, 0, src->height - 1) & 3) * dest->stride;
- t3 = tmpbuf + (CLAMP (j + 2, 0, src->height - 1) & 3) * dest->stride;
- vs_scanline_merge_4tap_RGB565 (dest->pixels + i * dest->stride,
- t0, t1, t2, t3, dest->width, yacc & 0xffff);
-
- yacc += y_increment;
- }
-}
-
-/* note that src and dest are uint16_t, and thus endian dependent */
-
-#define RGB555_R(x) (((x)&0x7c00)>>8 | ((x)&0x7c00)>>13)
-#define RGB555_G(x) (((x)&0x03e0)>>3 | ((x)&0x03e0)>>9)
-#define RGB555_B(x) (((x)&0x001f)<<3 | ((x)&0x001f)>>2)
-
-#define RGB555(r,g,b) \
- ((((r)<<7)&0x7c00) | (((g)<<2)&0x03e0) | (((b)>>3)&0x001f))
-
-void
-vs_scanline_resample_4tap_RGB555 (uint8_t * dest_u8, uint8_t * src_u8,
- int n, int src_width, int *xacc, int increment)
-{
- int i;
- int j;
- int acc;
- int x;
- int y, y_r, y_b, y_g;
- uint16_t *dest = (uint16_t *) dest_u8;
- uint16_t *src = (uint16_t *) src_u8;
-
- acc = *xacc;
- for (i = 0; i < n; i++) {
- j = acc >> 16;
- x = acc & 0xffff >> 8;
-
- if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * RGB555_R (src[MAX ((j - 1), 0)]);
- y += vs_4tap_taps[x][1] * RGB555_R (src[j]);
- y += vs_4tap_taps[x][2] * RGB555_R (src[(j + 1)]);
- y += vs_4tap_taps[x][3] * RGB555_R (src[(j + 2)]);
- } else {
- y = vs_4tap_taps[x][0] * RGB555_R (src[CLAMP ((j - 1), 0,
- src_width - 1)]);
- y += vs_4tap_taps[x][1] * RGB555_R (src[CLAMP (j, 0, src_width - 1)]);
- y += vs_4tap_taps[x][2] * RGB555_R (src[CLAMP ((j + 1), 0,
- src_width - 1)]);
- y += vs_4tap_taps[x][3] * RGB555_R (src[CLAMP ((j + 2), 0,
- src_width - 1)]);
- }
- y += (1 << (SHIFT - 1));
- y_r = CLAMP (y >> SHIFT, 0, 255);
-
- if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * RGB555_G (src[MAX ((j - 1), 0)]);
- y += vs_4tap_taps[x][1] * RGB555_G (src[j]);
- y += vs_4tap_taps[x][2] * RGB555_G (src[(j + 1)]);
- y += vs_4tap_taps[x][3] * RGB555_G (src[(j + 2)]);
- } else {
- y = vs_4tap_taps[x][0] * RGB555_G (src[CLAMP ((j - 1), 0,
- src_width - 1)]);
- y += vs_4tap_taps[x][1] * RGB555_G (src[CLAMP (j, 0, src_width - 1)]);
- y += vs_4tap_taps[x][2] * RGB555_G (src[CLAMP ((j + 1), 0,
- src_width - 1)]);
- y += vs_4tap_taps[x][3] * RGB555_G (src[CLAMP ((j + 2), 0,
- src_width - 1)]);
- }
- y += (1 << (SHIFT - 1));
- y_g = CLAMP (y >> SHIFT, 0, 255);
-
- if (j - 1 >= 0 && j + 2 < src_width) {
- y = vs_4tap_taps[x][0] * RGB555_B (src[MAX ((j - 1), 0)]);
- y += vs_4tap_taps[x][1] * RGB555_B (src[j]);
- y += vs_4tap_taps[x][2] * RGB555_B (src[(j + 1)]);
- y += vs_4tap_taps[x][3] * RGB555_B (src[(j + 2)]);
- } else {
- y = vs_4tap_taps[x][0] * RGB555_B (src[CLAMP ((j - 1), 0,
- src_width - 1)]);
- y += vs_4tap_taps[x][1] * RGB555_B (src[CLAMP (j, 0, src_width - 1)]);
- y += vs_4tap_taps[x][2] * RGB555_B (src[CLAMP ((j + 1), 0,
- src_width - 1)]);
- y += vs_4tap_taps[x][3] * RGB555_B (src[CLAMP ((j + 2), 0,
- src_width - 1)]);
- }
- y += (1 << (SHIFT - 1));
- y_b = CLAMP (y >> SHIFT, 0, 255);
-
- dest[i] = RGB555 (y_r, y_b, y_g);
- acc += increment;
- }
- *xacc = acc;
-}
-
-void
-vs_scanline_merge_4tap_RGB555 (uint8_t * dest_u8, uint8_t * src1_u8,
- uint8_t * src2_u8, uint8_t * src3_u8, uint8_t * src4_u8, int n, int acc)
-{
- int i;
- int y, y_r, y_b, y_g;
- int a, b, c, d;
- uint16_t *dest = (uint16_t *) dest_u8;
- uint16_t *src1 = (uint16_t *) src1_u8;
- uint16_t *src2 = (uint16_t *) src2_u8;
- uint16_t *src3 = (uint16_t *) src3_u8;
- uint16_t *src4 = (uint16_t *) src4_u8;
-
- acc = (acc >> 8) & 0xff;
- a = vs_4tap_taps[acc][0];
- b = vs_4tap_taps[acc][1];
- c = vs_4tap_taps[acc][2];
- d = vs_4tap_taps[acc][3];
-
- for (i = 0; i < n; i++) {
- y = a * RGB555_R (src1[i]);
- y += b * RGB555_R (src2[i]);
- y += c * RGB555_R (src3[i]);
- y += d * RGB555_R (src4[i]);
- y += (1 << (SHIFT - 1));
- y_r = CLAMP (y >> SHIFT, 0, 255);
-
- y = a * RGB555_G (src1[i]);
- y += b * RGB555_G (src2[i]);
- y += c * RGB555_G (src3[i]);
- y += d * RGB555_G (src4[i]);
- y += (1 << (SHIFT - 1));
- y_g = CLAMP (y >> SHIFT, 0, 255);
-
- y = a * RGB555_B (src1[i]);
- y += b * RGB555_B (src2[i]);
- y += c * RGB555_B (src3[i]);
- y += d * RGB555_B (src4[i]);
- y += (1 << (SHIFT - 1));
- y_b = CLAMP (y >> SHIFT, 0, 255);
-
- dest[i] = RGB555 (y_r, y_b, y_g);
- }
-}
-
-void
-vs_image_scale_4tap_RGB555 (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int yacc;
- int y_increment;
- int x_increment;
- int i;
- int j;
- int xacc;
- int k;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- k = 0;
- for (i = 0; i < 4; i++) {
- xacc = 0;
- vs_scanline_resample_4tap_RGB555 (tmpbuf + i * dest->stride,
- src->pixels + i * src->stride, dest->width, src->width,
- &xacc, x_increment);
- }
-
- yacc = 0;
- for (i = 0; i < dest->height; i++) {
- uint8_t *t0, *t1, *t2, *t3;
-
- j = yacc >> 16;
-
- while (j > k) {
- k++;
- if (k + 3 < src->height) {
- xacc = 0;
- vs_scanline_resample_4tap_RGB555 (tmpbuf + ((k + 3) & 3) * dest->stride,
- src->pixels + (k + 3) * src->stride,
- dest->width, src->width, &xacc, x_increment);
- }
- }
-
- t0 = tmpbuf + (CLAMP (j - 1, 0, src->height - 1) & 3) * dest->stride;
- t1 = tmpbuf + (CLAMP (j, 0, src->height - 1) & 3) * dest->stride;
- t2 = tmpbuf + (CLAMP (j + 1, 0, src->height - 1) & 3) * dest->stride;
- t3 = tmpbuf + (CLAMP (j + 2, 0, src->height - 1) & 3) * dest->stride;
- vs_scanline_merge_4tap_RGB555 (dest->pixels + i * dest->stride,
- t0, t1, t2, t3, dest->width, yacc & 0xffff);
-
- yacc += y_increment;
- }
-}
diff --git a/gst/videoscale/vs_4tap.h b/gst/videoscale/vs_4tap.h
deleted file mode 100644
index 3b13662d..00000000
--- a/gst/videoscale/vs_4tap.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Image Scaling Functions (4 tap)
- * Copyright (c) 2005 David A. Schleef <ds@schleef.org>
- * All rights reserved.
- *
- * 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 AUTHOR ``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 AUTHOR 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 _VS_4TAP_H_
-#define _VS_4TAP_H_
-
-#include "vs_image.h"
-
-#include <liboil/liboil.h>
-
-void vs_4tap_init (void);
-void vs_scanline_resample_4tap_Y (uint8_t *dest, uint8_t *src,
- int n, int src_width, int *xacc, int increment);
-void vs_scanline_merge_4tap_Y (uint8_t *dest, uint8_t *src1, uint8_t *src2,
- uint8_t *src3, uint8_t *src4, int n, int acc);
-void vs_image_scale_4tap_Y (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf);
-
-void vs_scanline_resample_4tap_RGBA (uint8_t *dest, uint8_t *src,
- int n, int src_width, int *xacc, int increment);
-void vs_scanline_merge_4tap_RGBA (uint8_t *dest, uint8_t *src1, uint8_t *src2,
- uint8_t *src3, uint8_t *src4, int n, int acc);
-void vs_image_scale_4tap_RGBA (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf);
-
-void vs_scanline_resample_4tap_RGB (uint8_t *dest, uint8_t *src,
- int n, int src_width, int *xacc, int increment);
-void vs_scanline_merge_4tap_RGB (uint8_t *dest, uint8_t *src1, uint8_t *src2,
- uint8_t *src3, uint8_t *src4, int n, int acc);
-void vs_image_scale_4tap_RGB (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf);
-
-void vs_scanline_resample_4tap_YUYV (uint8_t *dest, uint8_t *src,
- int n, int src_width, int *xacc, int increment);
-void vs_scanline_merge_4tap_YUYV (uint8_t *dest, uint8_t *src1, uint8_t *src2,
- uint8_t *src3, uint8_t *src4, int n, int acc);
-void vs_image_scale_4tap_YUYV (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf);
-
-void vs_scanline_resample_4tap_UYVY (uint8_t *dest, uint8_t *src,
- int n, int src_width, int *xacc, int increment);
-void vs_scanline_merge_4tap_UYVY (uint8_t *dest, uint8_t *src1, uint8_t *src2,
- uint8_t *src3, uint8_t *src4, int n, int acc);
-void vs_image_scale_4tap_UYVY (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf);
-
-void vs_scanline_resample_4tap_RGB565 (uint8_t *dest, uint8_t *src,
- int n, int src_width, int *xacc, int increment);
-void vs_scanline_merge_4tap_RGB565 (uint8_t *dest, uint8_t *src1, uint8_t *src2,
- uint8_t *src3, uint8_t *src4, int n, int acc);
-void vs_image_scale_4tap_RGB565 (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf);
-
-void vs_scanline_resample_4tap_RGB555 (uint8_t *dest, uint8_t *src,
- int n, int src_width, int *xacc, int increment);
-void vs_scanline_merge_4tap_RGB555 (uint8_t *dest, uint8_t *src1, uint8_t *src2,
- uint8_t *src3, uint8_t *src4, int n, int acc);
-void vs_image_scale_4tap_RGB555 (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf);
-
-void vs_scanline_resample_4tap_Y16 (uint8_t *dest, uint8_t *src,
- int n, int src_width, int *xacc, int increment);
-void vs_scanline_merge_4tap_Y16 (uint8_t *dest, uint8_t *src1, uint8_t *src2,
- uint8_t *src3, uint8_t *src4, int n, int acc);
-void vs_image_scale_4tap_Y16 (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf);
-
-#endif
-
diff --git a/gst/videoscale/vs_image.c b/gst/videoscale/vs_image.c
deleted file mode 100644
index afbcf4c8..00000000
--- a/gst/videoscale/vs_image.c
+++ /dev/null
@@ -1,1071 +0,0 @@
-/*
- * Image Scaling Functions
- * Copyright (c) 2005 David A. Schleef <ds@schleef.org>
- * All rights reserved.
- *
- * 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 AUTHOR ``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 AUTHOR 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.
- */
-
-#include <string.h>
-
-#include "vs_scanline.h"
-#include "vs_image.h"
-
-#define ROUND_UP_2(x) (((x)+1)&~1)
-#define ROUND_UP_4(x) (((x)+3)&~3)
-#define ROUND_UP_8(x) (((x)+7)&~7)
-
-void
-vs_image_scale_nearest_RGBA (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int acc;
- int y_increment;
- int x_increment;
- int i;
- int j;
- int xacc;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
-
- acc = 0;
- for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
-
- xacc = 0;
- vs_scanline_resample_nearest_RGBA (dest->pixels + i * dest->stride,
- src->pixels + j * src->stride, src->width, dest->width, &xacc,
- x_increment);
-
- acc += y_increment;
- }
-}
-
-void
-vs_image_scale_linear_RGBA (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int acc;
- int y_increment;
- int x_increment;
- uint8_t *tmp1;
- uint8_t *tmp2;
- int y1;
- int y2;
- int i;
- int j;
- int x;
- int dest_size;
- int xacc;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- dest_size = dest->width * 4;
-
- tmp1 = tmpbuf;
- tmp2 = tmpbuf + dest_size;
-
- acc = 0;
- xacc = 0;
- y2 = -1;
- vs_scanline_resample_linear_RGBA (tmp1, src->pixels, src->width, dest->width,
- &xacc, x_increment);
- y1 = 0;
- for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (x == 0) {
- if (j == y1) {
- memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
- } else if (j == y2) {
- memcpy (dest->pixels + i * dest->stride, tmp2, dest_size);
- } else {
- xacc = 0;
- vs_scanline_resample_linear_RGBA (tmp1, src->pixels + j * src->stride,
- src->width, dest->width, &xacc, x_increment);
- y1 = j;
- memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
- }
- } else {
- if (j == y1) {
- if (j + 1 != y2) {
- xacc = 0;
- vs_scanline_resample_linear_RGBA (tmp2,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y2 = j + 1;
- }
- vs_scanline_merge_linear_RGBA (dest->pixels + i * dest->stride,
- tmp1, tmp2, dest->width, x);
- } else if (j == y2) {
- if (j + 1 != y1) {
- xacc = 0;
- vs_scanline_resample_linear_RGBA (tmp1,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y1 = j + 1;
- }
- vs_scanline_merge_linear_RGBA (dest->pixels + i * dest->stride,
- tmp2, tmp1, dest->width, x);
- } else {
- xacc = 0;
- vs_scanline_resample_linear_RGBA (tmp1, src->pixels + j * src->stride,
- src->width, dest->width, &xacc, x_increment);
- y1 = j;
- xacc = 0;
- vs_scanline_resample_linear_RGBA (tmp2,
- src->pixels + (j + 1) * src->stride, src->width, dest->width, &xacc,
- x_increment);
- y2 = (j + 1);
- vs_scanline_merge_linear_RGBA (dest->pixels + i * dest->stride,
- tmp1, tmp2, dest->width, x);
- }
- }
-
- acc += y_increment;
- }
-}
-
-
-void
-vs_image_scale_nearest_RGB (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int acc;
- int y_increment;
- int x_increment;
- int i;
- int j;
- int xacc;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- acc = 0;
- for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
-
- xacc = 0;
- vs_scanline_resample_nearest_RGB (dest->pixels + i * dest->stride,
- src->pixels + j * src->stride, src->width, dest->width, &xacc,
- x_increment);
-
- acc += y_increment;
- }
-}
-
-void
-vs_image_scale_linear_RGB (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int acc;
- int y_increment;
- int x_increment;
- uint8_t *tmp1;
- uint8_t *tmp2;
- int y1;
- int y2;
- int i;
- int j;
- int x;
- int dest_size;
- int xacc;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- dest_size = dest->width * 3;
-
- tmp1 = tmpbuf;
- tmp2 = tmpbuf + dest_size;
-
- acc = 0;
- xacc = 0;
- y2 = -1;
- vs_scanline_resample_linear_RGB (tmp1, src->pixels, src->width, dest->width,
- &xacc, x_increment);
- y1 = 0;
- for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (x == 0) {
- if (j == y1) {
- memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
- } else if (j == y2) {
- memcpy (dest->pixels + i * dest->stride, tmp2, dest_size);
- } else {
- xacc = 0;
- vs_scanline_resample_linear_RGB (tmp1, src->pixels + j * src->stride,
- src->width, dest->width, &xacc, x_increment);
- y1 = j;
- memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
- }
- } else {
- if (j == y1) {
- if (j + 1 != y2) {
- xacc = 0;
- vs_scanline_resample_linear_RGB (tmp2,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y2 = j + 1;
- }
- vs_scanline_merge_linear_RGB (dest->pixels + i * dest->stride,
- tmp1, tmp2, dest->width, x);
- } else if (j == y2) {
- if (j + 1 != y1) {
- xacc = 0;
- vs_scanline_resample_linear_RGB (tmp1,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y1 = j + 1;
- }
- vs_scanline_merge_linear_RGB (dest->pixels + i * dest->stride,
- tmp2, tmp1, dest->width, x);
- } else {
- xacc = 0;
- vs_scanline_resample_linear_RGB (tmp1, src->pixels + j * src->stride,
- src->width, dest->width, &xacc, x_increment);
- y1 = j;
- xacc = 0;
- vs_scanline_resample_linear_RGB (tmp2,
- src->pixels + (j + 1) * src->stride, src->width, dest->width, &xacc,
- x_increment);
- y2 = (j + 1);
- vs_scanline_merge_linear_RGB (dest->pixels + i * dest->stride,
- tmp1, tmp2, dest->width, x);
- }
- }
-
- acc += y_increment;
- }
-}
-
-/* YUYV */
-
-void
-vs_image_scale_nearest_YUYV (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int acc;
- int y_increment;
- int x_increment;
- int i;
- int j;
- int xacc;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- acc = 0;
- for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
-
- xacc = 0;
- vs_scanline_resample_nearest_YUYV (dest->pixels + i * dest->stride,
- src->pixels + j * src->stride, src->width, dest->width, &xacc,
- x_increment);
-
- acc += y_increment;
- }
-}
-
-void
-vs_image_scale_linear_YUYV (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int acc;
- int y_increment;
- int x_increment;
- uint8_t *tmp1;
- uint8_t *tmp2;
- int y1;
- int y2;
- int i;
- int j;
- int x;
- int dest_size;
- int xacc;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- dest_size = ROUND_UP_4 (dest->width * 2);
-
- tmp1 = tmpbuf;
- tmp2 = tmpbuf + dest_size;
-
- acc = 0;
- xacc = 0;
- y2 = -1;
- vs_scanline_resample_linear_YUYV (tmp1, src->pixels, src->width, dest->width,
- &xacc, x_increment);
- y1 = 0;
- for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (x == 0) {
- if (j == y1) {
- memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
- } else if (j == y2) {
- memcpy (dest->pixels + i * dest->stride, tmp2, dest_size);
- } else {
- xacc = 0;
- vs_scanline_resample_linear_YUYV (tmp1, src->pixels + j * src->stride,
- src->width, dest->width, &xacc, x_increment);
- y1 = j;
- memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
- }
- } else {
- if (j == y1) {
- if (j + 1 != y2) {
- xacc = 0;
- vs_scanline_resample_linear_YUYV (tmp2,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y2 = j + 1;
- }
- vs_scanline_merge_linear_YUYV (dest->pixels + i * dest->stride,
- tmp1, tmp2, dest->width, x);
- } else if (j == y2) {
- if (j + 1 != y1) {
- xacc = 0;
- vs_scanline_resample_linear_YUYV (tmp1,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y1 = j + 1;
- }
- vs_scanline_merge_linear_YUYV (dest->pixels + i * dest->stride,
- tmp2, tmp1, dest->width, x);
- } else {
- xacc = 0;
- vs_scanline_resample_linear_YUYV (tmp1, src->pixels + j * src->stride,
- src->width, dest->width, &xacc, x_increment);
- y1 = j;
- xacc = 0;
- vs_scanline_resample_linear_YUYV (tmp2,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y2 = (j + 1);
- vs_scanline_merge_linear_YUYV (dest->pixels + i * dest->stride,
- tmp1, tmp2, dest->width, x);
- }
- }
-
- acc += y_increment;
- }
-}
-
-/* UYVY */
-
-void
-vs_image_scale_nearest_UYVY (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int acc;
- int y_increment;
- int x_increment;
- int i;
- int j;
- int xacc;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- acc = 0;
- for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
-
- xacc = 0;
- vs_scanline_resample_nearest_UYVY (dest->pixels + i * dest->stride,
- src->pixels + j * src->stride, src->width, dest->width, &xacc,
- x_increment);
-
- acc += y_increment;
- }
-}
-
-void
-vs_image_scale_linear_UYVY (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int acc;
- int y_increment;
- int x_increment;
- uint8_t *tmp1;
- uint8_t *tmp2;
- int y1;
- int y2;
- int i;
- int j;
- int x;
- int dest_size;
- int xacc;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- dest_size = ROUND_UP_4 (dest->width * 2);
-
- tmp1 = tmpbuf;
- tmp2 = tmpbuf + dest_size;
-
- acc = 0;
- xacc = 0;
- y2 = -1;
- vs_scanline_resample_linear_UYVY (tmp1, src->pixels, src->width, dest->width,
- &xacc, x_increment);
- y1 = 0;
- for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (x == 0) {
- if (j == y1) {
- memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
- } else if (j == y2) {
- memcpy (dest->pixels + i * dest->stride, tmp2, dest_size);
- } else {
- xacc = 0;
- vs_scanline_resample_linear_UYVY (tmp1, src->pixels + j * src->stride,
- src->width, dest->width, &xacc, x_increment);
- y1 = j;
- memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
- }
- } else {
- if (j == y1) {
- if (j + 1 != y2) {
- xacc = 0;
- vs_scanline_resample_linear_UYVY (tmp2,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y2 = j + 1;
- }
- vs_scanline_merge_linear_UYVY (dest->pixels + i * dest->stride,
- tmp1, tmp2, dest->width, x);
- } else if (j == y2) {
- if (j + 1 != y1) {
- xacc = 0;
- vs_scanline_resample_linear_UYVY (tmp1,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y1 = j + 1;
- }
- vs_scanline_merge_linear_UYVY (dest->pixels + i * dest->stride,
- tmp2, tmp1, dest->width, x);
- } else {
- xacc = 0;
- vs_scanline_resample_linear_UYVY (tmp1, src->pixels + j * src->stride,
- src->width, dest->width, &xacc, x_increment);
- y1 = j;
- xacc = 0;
- vs_scanline_resample_linear_UYVY (tmp2,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y2 = (j + 1);
- vs_scanline_merge_linear_UYVY (dest->pixels + i * dest->stride,
- tmp1, tmp2, dest->width, x);
- }
- }
-
- acc += y_increment;
- }
-}
-
-/* greyscale */
-
-void
-vs_image_scale_nearest_Y (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int acc;
- int y_increment;
- int x_increment;
- int i;
- int j;
- int xacc;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- acc = 0;
- for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
-
- xacc = 0;
- vs_scanline_resample_nearest_Y (dest->pixels + i * dest->stride,
- src->pixels + j * src->stride, src->width, dest->width, &xacc,
- x_increment);
-
- acc += y_increment;
- }
-}
-
-void
-vs_image_scale_linear_Y (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int acc;
- int y_increment;
- int x_increment;
- uint8_t *tmp1;
- uint8_t *tmp2;
- int y1;
- int y2;
- int i;
- int j;
- int x;
- int dest_size;
- int xacc;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- dest_size = dest->width;
-
- tmp1 = tmpbuf;
- tmp2 = tmpbuf + dest_size;
-
- acc = 0;
- xacc = 0;
- y2 = -1;
- vs_scanline_resample_linear_Y (tmp1, src->pixels, src->width, dest->width,
- &xacc, x_increment);
- y1 = 0;
- for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (x == 0) {
- if (j == y1) {
- memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
- } else if (j == y2) {
- memcpy (dest->pixels + i * dest->stride, tmp2, dest_size);
- } else {
- xacc = 0;
- vs_scanline_resample_linear_Y (tmp1, src->pixels + j * src->stride,
- src->width, dest->width, &xacc, x_increment);
- y1 = j;
- memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
- }
- } else {
- if (j == y1) {
- if (j + 1 != y2) {
- xacc = 0;
- vs_scanline_resample_linear_Y (tmp2,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y2 = j + 1;
- }
- vs_scanline_merge_linear_Y (dest->pixels + i * dest->stride,
- tmp1, tmp2, dest->width, x);
- } else if (j == y2) {
- if (j + 1 != y1) {
- xacc = 0;
- vs_scanline_resample_linear_Y (tmp1,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y1 = j + 1;
- }
- vs_scanline_merge_linear_Y (dest->pixels + i * dest->stride,
- tmp2, tmp1, dest->width, x);
- } else {
- xacc = 0;
- vs_scanline_resample_linear_Y (tmp1, src->pixels + j * src->stride,
- src->width, dest->width, &xacc, x_increment);
- y1 = j;
- xacc = 0;
- vs_scanline_resample_linear_Y (tmp2,
- src->pixels + (j + 1) * src->stride, src->width, dest->width, &xacc,
- x_increment);
- y2 = (j + 1);
- vs_scanline_merge_linear_Y (dest->pixels + i * dest->stride,
- tmp1, tmp2, dest->width, x);
- }
- }
-
- acc += y_increment;
- }
-}
-
-void
-vs_image_scale_nearest_Y16 (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int acc;
- int y_increment;
- int x_increment;
- int i;
- int j;
- int xacc;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- acc = 0;
- for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
-
- xacc = 0;
- vs_scanline_resample_nearest_Y16 (dest->pixels + i * dest->stride,
- src->pixels + j * src->stride, src->width, dest->width, &xacc,
- x_increment);
-
- acc += y_increment;
- }
-}
-
-void
-vs_image_scale_linear_Y16 (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int acc;
- int y_increment;
- int x_increment;
- uint8_t *tmp1;
- uint8_t *tmp2;
- int y1;
- int y2;
- int i;
- int j;
- int x;
- int dest_size;
- int xacc;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- dest_size = 2 * dest->width;
-
- tmp1 = tmpbuf;
- tmp2 = tmpbuf + dest_size;
-
- acc = 0;
- xacc = 0;
- y2 = -1;
- vs_scanline_resample_linear_Y16 (tmp1, src->pixels, src->width, dest->width,
- &xacc, x_increment);
- y1 = 0;
- for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (x == 0) {
- if (j == y1) {
- memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
- } else if (j == y2) {
- memcpy (dest->pixels + i * dest->stride, tmp2, dest_size);
- } else {
- xacc = 0;
- vs_scanline_resample_linear_Y16 (tmp1, src->pixels + j * src->stride,
- src->width, dest->width, &xacc, x_increment);
- y1 = j;
- memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
- }
- } else {
- if (j == y1) {
- if (j + 1 != y2) {
- xacc = 0;
- vs_scanline_resample_linear_Y16 (tmp2,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y2 = j + 1;
- }
- vs_scanline_merge_linear_Y16 (dest->pixels + i * dest->stride,
- tmp1, tmp2, dest->width, x);
- } else if (j == y2) {
- if (j + 1 != y1) {
- xacc = 0;
- vs_scanline_resample_linear_Y16 (tmp1,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y1 = j + 1;
- }
- vs_scanline_merge_linear_Y16 (dest->pixels + i * dest->stride,
- tmp2, tmp1, dest->width, x);
- } else {
- xacc = 0;
- vs_scanline_resample_linear_Y16 (tmp1, src->pixels + j * src->stride,
- src->width, dest->width, &xacc, x_increment);
- y1 = j;
- xacc = 0;
- vs_scanline_resample_linear_Y16 (tmp2,
- src->pixels + (j + 1) * src->stride, src->width, dest->width, &xacc,
- x_increment);
- y2 = (j + 1);
- vs_scanline_merge_linear_Y16 (dest->pixels + i * dest->stride,
- tmp1, tmp2, dest->width, x);
- }
- }
-
- acc += y_increment;
- }
-}
-
-/* RGB565 */
-
-void
-vs_image_scale_nearest_RGB565 (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int acc;
- int y_increment;
- int x_increment;
- int i;
- int j;
- int xacc;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- acc = 0;
- for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
-
- xacc = 0;
- vs_scanline_resample_nearest_RGB565 (dest->pixels + i * dest->stride,
- src->pixels + j * src->stride, src->width, dest->width, &xacc,
- x_increment);
-
- acc += y_increment;
- }
-}
-
-void
-vs_image_scale_linear_RGB565 (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int acc;
- int y_increment;
- int x_increment;
- uint8_t *tmp1;
- uint8_t *tmp2;
- int y1;
- int y2;
- int i;
- int j;
- int x;
- int dest_size;
- int xacc;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- dest_size = dest->width * 2;
-
- tmp1 = tmpbuf;
- tmp2 = tmpbuf + dest_size;
-
- acc = 0;
- xacc = 0;
- y2 = -1;
- vs_scanline_resample_linear_RGB565 (tmp1, src->pixels, src->width,
- dest->width, &xacc, x_increment);
- y1 = 0;
- for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (x == 0) {
- if (j == y1) {
- memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
- } else if (j == y2) {
- memcpy (dest->pixels + i * dest->stride, tmp2, dest_size);
- } else {
- xacc = 0;
- vs_scanline_resample_linear_RGB565 (tmp1, src->pixels + j * src->stride,
- src->width, dest->width, &xacc, x_increment);
- y1 = j;
- memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
- }
- } else {
- if (j == y1) {
- if (j + 1 != y2) {
- xacc = 0;
- vs_scanline_resample_linear_RGB565 (tmp2,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y2 = j + 1;
- }
- vs_scanline_merge_linear_RGB565 (dest->pixels + i * dest->stride,
- tmp1, tmp2, dest->width, x);
- } else if (j == y2) {
- if (j + 1 != y1) {
- xacc = 0;
- vs_scanline_resample_linear_RGB565 (tmp1,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y1 = j + 1;
- }
- vs_scanline_merge_linear_RGB565 (dest->pixels + i * dest->stride,
- tmp2, tmp1, dest->width, x);
- } else {
- xacc = 0;
- vs_scanline_resample_linear_RGB565 (tmp1, src->pixels + j * src->stride,
- src->width, dest->width, &xacc, x_increment);
- y1 = j;
- xacc = 0;
- vs_scanline_resample_linear_RGB565 (tmp2,
- src->pixels + (j + 1) * src->stride, src->width, dest->width, &xacc,
- x_increment);
- y2 = (j + 1);
- vs_scanline_merge_linear_RGB565 (dest->pixels + i * dest->stride,
- tmp1, tmp2, dest->width, x);
- }
- }
-
- acc += y_increment;
- }
-}
-
-/* RGB555 */
-
-void
-vs_image_scale_nearest_RGB555 (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int acc;
- int y_increment;
- int x_increment;
- int i;
- int j;
- int xacc;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- acc = 0;
- for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
-
- xacc = 0;
- vs_scanline_resample_nearest_RGB555 (dest->pixels + i * dest->stride,
- src->pixels + j * src->stride, src->width, dest->width, &xacc,
- x_increment);
-
- acc += y_increment;
- }
-}
-
-void
-vs_image_scale_linear_RGB555 (const VSImage * dest, const VSImage * src,
- uint8_t * tmpbuf)
-{
- int acc;
- int y_increment;
- int x_increment;
- uint8_t *tmp1;
- uint8_t *tmp2;
- int y1;
- int y2;
- int i;
- int j;
- int x;
- int dest_size;
- int xacc;
-
- if (dest->height == 1)
- y_increment = 0;
- else
- y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
- if (dest->width == 1)
- x_increment = 0;
- else
- x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
- dest_size = dest->width * 2;
-
- tmp1 = tmpbuf;
- tmp2 = tmpbuf + dest_size;
-
- acc = 0;
- xacc = 0;
- y2 = -1;
- vs_scanline_resample_linear_RGB555 (tmp1, src->pixels, src->width,
- dest->width, &xacc, x_increment);
- y1 = 0;
- for (i = 0; i < dest->height; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (x == 0) {
- if (j == y1) {
- memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
- } else if (j == y2) {
- memcpy (dest->pixels + i * dest->stride, tmp2, dest_size);
- } else {
- xacc = 0;
- vs_scanline_resample_linear_RGB555 (tmp1, src->pixels + j * src->stride,
- src->width, dest->width, &xacc, x_increment);
- y1 = j;
- memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
- }
- } else {
- if (j == y1) {
- if (j + 1 != y2) {
- xacc = 0;
- vs_scanline_resample_linear_RGB555 (tmp2,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y2 = j + 1;
- }
- vs_scanline_merge_linear_RGB555 (dest->pixels + i * dest->stride,
- tmp1, tmp2, dest->width, x);
- } else if (j == y2) {
- if (j + 1 != y1) {
- xacc = 0;
- vs_scanline_resample_linear_RGB555 (tmp1,
- src->pixels + (j + 1) * src->stride, src->width, dest->width,
- &xacc, x_increment);
- y1 = j + 1;
- }
- vs_scanline_merge_linear_RGB555 (dest->pixels + i * dest->stride,
- tmp2, tmp1, dest->width, x);
- } else {
- xacc = 0;
- vs_scanline_resample_linear_RGB555 (tmp1, src->pixels + j * src->stride,
- src->width, dest->width, &xacc, x_increment);
- y1 = j;
- xacc = 0;
- vs_scanline_resample_linear_RGB555 (tmp2,
- src->pixels + (j + 1) * src->stride, src->width, dest->width, &xacc,
- x_increment);
- y2 = (j + 1);
- vs_scanline_merge_linear_RGB555 (dest->pixels + i * dest->stride,
- tmp1, tmp2, dest->width, x);
- }
- }
-
- acc += y_increment;
- }
-}
diff --git a/gst/videoscale/vs_image.h b/gst/videoscale/vs_image.h
deleted file mode 100644
index 9771c774..00000000
--- a/gst/videoscale/vs_image.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Image Scaling Functions
- * Copyright (c) 2005 David A. Schleef <ds@schleef.org>
- * All rights reserved.
- *
- * 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 AUTHOR ``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 AUTHOR 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 __VS_IMAGE_H__
-#define __VS_IMAGE_H__
-
-#include <liboil/liboil-stdint.h>
-
-typedef struct _VSImage VSImage;
-
-struct _VSImage {
- uint8_t *pixels;
- int width;
- int height;
- int stride;
-};
-
-void vs_image_scale_nearest_RGBA (const VSImage *dest, const VSImage *src,
- uint8_t *tmpbuf);
-void vs_image_scale_linear_RGBA (const VSImage *dest, const VSImage *src,
- uint8_t *tmpbuf);
-
-void vs_image_scale_nearest_RGB (const VSImage *dest, const VSImage *src,
- uint8_t *tmpbuf);
-void vs_image_scale_linear_RGB (const VSImage *dest, const VSImage *src,
- uint8_t *tmpbuf);
-
-void vs_image_scale_nearest_YUYV (const VSImage *dest, const VSImage *src,
- uint8_t *tmpbuf);
-void vs_image_scale_linear_YUYV (const VSImage *dest, const VSImage *src,
- uint8_t *tmpbuf);
-
-void vs_image_scale_nearest_UYVY (const VSImage *dest, const VSImage *src,
- uint8_t *tmpbuf);
-void vs_image_scale_linear_UYVY (const VSImage *dest, const VSImage *src,
- uint8_t *tmpbuf);
-
-void vs_image_scale_nearest_Y (const VSImage *dest, const VSImage *src,
- uint8_t *tmpbuf);
-void vs_image_scale_linear_Y (const VSImage *dest, const VSImage *src,
- uint8_t *tmpbuf);
-
-void vs_image_scale_nearest_RGB565 (const VSImage *dest, const VSImage *src,
- uint8_t *tmpbuf);
-void vs_image_scale_linear_RGB565 (const VSImage *dest, const VSImage *src,
- uint8_t *tmpbuf);
-
-void vs_image_scale_nearest_RGB555 (const VSImage *dest, const VSImage *src,
- uint8_t *tmpbuf);
-void vs_image_scale_linear_RGB555 (const VSImage *dest, const VSImage *src,
- uint8_t *tmpbuf);
-
-void vs_image_scale_nearest_Y16 (const VSImage *dest, const VSImage *src,
- uint8_t *tmpbuf);
-void vs_image_scale_linear_Y16 (const VSImage *dest, const VSImage *src,
- uint8_t *tmpbuf);
-
-#endif
-
diff --git a/gst/videoscale/vs_scanline.c b/gst/videoscale/vs_scanline.c
deleted file mode 100644
index d524e73b..00000000
--- a/gst/videoscale/vs_scanline.c
+++ /dev/null
@@ -1,810 +0,0 @@
-/*
- * Image Scaling Functions
- * Copyright (c) 2005 David A. Schleef <ds@schleef.org>
- * All rights reserved.
- *
- * 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 AUTHOR ``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 AUTHOR 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.
- */
-
-#include "vs_scanline.h"
-
-#include <liboil/liboil.h>
-
-/* greyscale, i.e., single componenet */
-
-void
-vs_scanline_downsample_Y (uint8_t * dest, uint8_t * src, int n)
-{
- int i;
-
- for (i = 0; i < n; i++) {
- dest[i] = (src[i * 2] + src[i * 2 + 1]) / 2;
- }
-}
-
-void
-vs_scanline_resample_nearest_Y (uint8_t * dest, uint8_t * src, int src_width,
- int n, int *accumulator, int increment)
-{
- int acc = *accumulator;
- int i;
- int j;
- int x;
-
- for (i = 0; i < n; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
- dest[i] = (x < 32768 || j + 1 >= src_width) ? src[j] : src[j + 1];
-
- acc += increment;
- }
-
- *accumulator = acc;
-}
-
-#include <glib.h>
-void
-vs_scanline_resample_linear_Y (uint8_t * dest, uint8_t * src, int src_width,
- int n, int *accumulator, int increment)
-{
- int acc = *accumulator;
- int i;
- int j;
- int x;
-
- for (i = 0; i < n; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (j + 1 < src_width)
- dest[i] = (src[j] * (65536 - x) + src[j + 1] * x) >> 16;
- else
- dest[i] = src[j];
-
- acc += increment;
- }
-
- *accumulator = acc;
-}
-
-void
-vs_scanline_merge_linear_Y (uint8_t * dest, uint8_t * src1, uint8_t * src2,
- int n, int x)
-{
- uint32_t value = x >> 8;
-
- oil_merge_linear_u8 (dest, src1, src2, &value, n);
-}
-
-void
-vs_scanline_downsample_Y16 (uint8_t * dest, uint8_t * src, int n)
-{
- int i;
- uint16_t *d = (uint16_t *) dest, *s = (uint16_t *) src;
-
- for (i = 0; i < n; i++) {
- d[i] = (s[i * 2] + s[i * 2 + 1]) / 2;
- }
-}
-
-void
-vs_scanline_resample_nearest_Y16 (uint8_t * dest, uint8_t * src, int src_width,
- int n, int *accumulator, int increment)
-{
- int acc = *accumulator;
- int i;
- int j;
- int x;
- uint16_t *d = (uint16_t *) dest, *s = (uint16_t *) src;
-
- for (i = 0; i < n; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
- d[i] = (x < 32768 || j + 1 >= src_width) ? s[j] : s[j + 1];
-
- acc += increment;
- }
-
- *accumulator = acc;
-}
-
-#include <glib.h>
-void
-vs_scanline_resample_linear_Y16 (uint8_t * dest, uint8_t * src, int src_width,
- int n, int *accumulator, int increment)
-{
- int acc = *accumulator;
- int i;
- int j;
- int x;
- uint16_t *d = (uint16_t *) dest, *s = (uint16_t *) src;
-
- for (i = 0; i < n; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (j + 1 < src_width)
- d[i] = (s[j] * (65536 - x) + s[j + 1] * x) >> 16;
- else
- d[i] = s[j];
-
- acc += increment;
- }
-
- *accumulator = acc;
-}
-
-void
-vs_scanline_merge_linear_Y16 (uint8_t * dest, uint8_t * src1, uint8_t * src2,
- int n, int x)
-{
- int i;
- uint16_t *d = (uint16_t *) dest, *s1 = (uint16_t *) src1, *s2 =
- (uint16_t *) src2;
-
- for (i = 0; i < n; i++) {
- d[i] = (s1[i] * (65536 - x) + s2[i] * x) >> 16;
- }
-}
-
-/* RGBA */
-
-void
-vs_scanline_downsample_RGBA (uint8_t * dest, uint8_t * src, int n)
-{
- int i;
-
- for (i = 0; i < n; i++) {
- dest[i * 4 + 0] = (src[i * 8 + 0] + src[i * 8 + 4]) / 2;
- dest[i * 4 + 1] = (src[i * 8 + 1] + src[i * 8 + 5]) / 2;
- dest[i * 4 + 2] = (src[i * 8 + 2] + src[i * 8 + 6]) / 2;
- dest[i * 4 + 3] = (src[i * 8 + 3] + src[i * 8 + 7]) / 2;
- }
-}
-
-void
-vs_scanline_resample_nearest_RGBA (uint8_t * dest, uint8_t * src, int src_width,
- int n, int *accumulator, int increment)
-{
- int acc = *accumulator;
- int i;
- int j;
- int x;
-
- for (i = 0; i < n; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (j + 1 < src_width) {
- dest[i * 4 + 0] = (x < 32768) ? src[j * 4 + 0] : src[j * 4 + 4];
- dest[i * 4 + 1] = (x < 32768) ? src[j * 4 + 1] : src[j * 4 + 5];
- dest[i * 4 + 2] = (x < 32768) ? src[j * 4 + 2] : src[j * 4 + 6];
- dest[i * 4 + 3] = (x < 32768) ? src[j * 4 + 3] : src[j * 4 + 7];
- } else {
- dest[i * 4 + 0] = src[j * 4 + 0];
- dest[i * 4 + 1] = src[j * 4 + 1];
- dest[i * 4 + 2] = src[j * 4 + 2];
- dest[i * 4 + 3] = src[j * 4 + 3];
- }
-
- acc += increment;
- }
-
- *accumulator = acc;
-}
-
-#include <stdio.h>
-void
-vs_scanline_resample_linear_RGBA (uint8_t * dest, uint8_t * src, int src_width,
- int n, int *accumulator, int increment)
-{
- uint32_t vals[2];
-
- vals[0] = *accumulator;
- vals[1] = increment;
-
- if (src_width % 2 == 0) {
- oil_resample_linear_argb ((uint32_t *) dest, (uint32_t *) src, n, vals);
- } else if (src_width > 1) {
- if (n > 1)
- oil_resample_linear_argb ((uint32_t *) dest, (uint32_t *) src, n - 1,
- vals);
- dest[4 * (n - 1) + 0] = src[(vals[0] >> 16) + 0];
- dest[4 * (n - 1) + 1] = src[(vals[0] >> 16) + 1];
- dest[4 * (n - 1) + 2] = src[(vals[0] >> 16) + 2];
- dest[4 * (n - 1) + 3] = src[(vals[0] >> 16) + 3];
- vals[0] += increment;
- } else {
- int i;
-
- for (i = 0; i < n; i++) {
- dest[4 * i + 0] = src[0];
- dest[4 * i + 1] = src[1];
- dest[4 * i + 2] = src[2];
- dest[4 * i + 3] = src[3];
- vals[0] += increment;
- }
- }
-
- *accumulator = vals[0];
-}
-
-void
-vs_scanline_merge_linear_RGBA (uint8_t * dest, uint8_t * src1, uint8_t * src2,
- int n, int x)
-{
- uint32_t value = x >> 8;
-
- oil_merge_linear_argb ((uint32_t *) dest, (uint32_t *) src1,
- (uint32_t *) src2, &value, n);
-}
-
-
-/* RGB */
-
-void
-vs_scanline_downsample_RGB (uint8_t * dest, uint8_t * src, int n)
-{
- int i;
-
- for (i = 0; i < n; i++) {
- dest[i * 3 + 0] = (src[i * 6 + 0] + src[i * 6 + 3]) / 2;
- dest[i * 3 + 1] = (src[i * 6 + 1] + src[i * 6 + 4]) / 2;
- dest[i * 3 + 2] = (src[i * 6 + 2] + src[i * 6 + 5]) / 2;
- }
-}
-
-void
-vs_scanline_resample_nearest_RGB (uint8_t * dest, uint8_t * src, int src_width,
- int n, int *accumulator, int increment)
-{
- int acc = *accumulator;
- int i;
- int j;
- int x;
-
- for (i = 0; i < n; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
- dest[i * 3 + 0] = (x < 32768
- || j + 1 >= src_width) ? src[j * 3 + 0] : src[j * 3 + 3];
- dest[i * 3 + 1] = (x < 32768
- || j + 1 >= src_width) ? src[j * 3 + 1] : src[j * 3 + 4];
- dest[i * 3 + 2] = (x < 32768
- || j + 1 >= src_width) ? src[j * 3 + 2] : src[j * 3 + 5];
-
- acc += increment;
- }
-
- *accumulator = acc;
-}
-
-void
-vs_scanline_resample_linear_RGB (uint8_t * dest, uint8_t * src, int src_width,
- int n, int *accumulator, int increment)
-{
- int acc = *accumulator;
- int i;
- int j;
- int x;
-
- for (i = 0; i < n; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (j + 1 < src_width) {
- dest[i * 3 + 0] =
- (src[j * 3 + 0] * (65536 - x) + src[j * 3 + 3] * x) >> 16;
- dest[i * 3 + 1] =
- (src[j * 3 + 1] * (65536 - x) + src[j * 3 + 4] * x) >> 16;
- dest[i * 3 + 2] =
- (src[j * 3 + 2] * (65536 - x) + src[j * 3 + 5] * x) >> 16;
- } else {
- dest[i * 3 + 0] = src[j * 3 + 0];
- dest[i * 3 + 1] = src[j * 3 + 1];
- dest[i * 3 + 2] = src[j * 3 + 2];
- }
-
- acc += increment;
- }
-
- *accumulator = acc;
-}
-
-void
-vs_scanline_merge_linear_RGB (uint8_t * dest, uint8_t * src1, uint8_t * src2,
- int n, int x)
-{
- uint32_t value = x >> 8;
-
- oil_merge_linear_u8 (dest, src1, src2, &value, n * 3);
-}
-
-
-/* YUYV */
-
-/* n is the number of pixels */
-/* increment is per Y pixel */
-
-void
-vs_scanline_downsample_YUYV (uint8_t * dest, uint8_t * src, int n)
-{
- int i;
-
- for (i = 0; i < n; i++) {
- dest[i * 4 + 0] = (src[i * 8 + 0] + src[i * 8 + 2]) / 2;
- dest[i * 4 + 1] = (src[i * 8 + 1] + src[i * 8 + 5]) / 2;
- dest[i * 4 + 2] = (src[i * 8 + 4] + src[i * 8 + 6]) / 2;
- dest[i * 4 + 3] = (src[i * 8 + 3] + src[i * 8 + 7]) / 2;
- }
-}
-
-void
-vs_scanline_resample_nearest_YUYV (uint8_t * dest, uint8_t * src, int src_width,
- int n, int *accumulator, int increment)
-{
- int acc = *accumulator;
- int i;
- int j;
- int x;
- int quads = (n + 1) / 2;
-
- for (i = 0; i < quads; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
- dest[i * 4 + 0] = (x < 32768
- || j + 1 >= src_width) ? src[j * 2 + 0] : src[j * 2 + 2];
-
- j = acc >> 17;
- x = acc & 0x1ffff;
- dest[i * 4 + 1] = (x < 65536
- || 2 * (j + 2) >= src_width) ? src[j * 4 + 1] : src[j * 4 + 5];
-
- if (2 * i + 1 < n && 2 * (j + 1) < src_width)
- dest[i * 4 + 3] = (x < 65536
- || 2 * (j + 3) >= src_width) ? src[j * 4 + 3] : src[j * 4 + 7];
-
- acc += increment;
-
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (2 * i + 1 < n && j < src_width) {
- dest[i * 4 + 2] = (x < 32768
- || j + 1 >= src_width) ? src[j * 2 + 0] : src[j * 2 + 2];
- acc += increment;
- }
- }
-
- *accumulator = acc;
-}
-
-void
-vs_scanline_resample_linear_YUYV (uint8_t * dest, uint8_t * src, int src_width,
- int n, int *accumulator, int increment)
-{
- int acc = *accumulator;
- int i;
- int j;
- int x;
- int quads = (n + 1) / 2;
-
- for (i = 0; i < quads; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (j + 1 < src_width)
- dest[i * 4 + 0] =
- (src[j * 2 + 0] * (65536 - x) + src[j * 2 + 2] * x) >> 16;
- else
- dest[i * 4 + 0] = src[j * 2 + 0];
-
- j = acc >> 17;
- x = acc & 0x1ffff;
-
- if (2 * (j + 2) < src_width)
- dest[i * 4 + 1] =
- (src[j * 4 + 1] * (131072 - x) + src[j * 4 + 5] * x) >> 17;
- else
- dest[i * 4 + 1] = src[j * 4 + 1];
-
- if (2 * i + 1 < n && 2 * (j + 1) < src_width) {
- if (2 * (j + 3) < src_width)
- dest[i * 4 + 3] =
- (src[j * 4 + 3] * (131072 - x) + src[j * 4 + 7] * x) >> 17;
- else
- dest[i * 4 + 3] = src[j * 4 + 3];
- }
-
- acc += increment;
-
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (2 * i + 1 < n && j < src_width) {
- if (j + 1 < src_width)
- dest[i * 4 + 2] =
- (src[j * 2 + 0] * (65536 - x) + src[j * 2 + 2] * x) >> 16;
- else
- dest[i * 4 + 2] = src[j * 2 + 0];
- acc += increment;
- }
- }
-
-
- *accumulator = acc;
-}
-
-void
-vs_scanline_merge_linear_YUYV (uint8_t * dest, uint8_t * src1, uint8_t * src2,
- int n, int x)
-{
- int i;
- int quads = (n + 1) / 2;
-
- for (i = 0; i < quads; i++) {
- dest[i * 4 + 0] =
- (src1[i * 4 + 0] * (65536 - x) + src2[i * 4 + 0] * x) >> 16;
- dest[i * 4 + 1] =
- (src1[i * 4 + 1] * (65536 - x) + src2[i * 4 + 1] * x) >> 16;
-
- if (2 * i + 1 < n) {
- dest[i * 4 + 2] =
- (src1[i * 4 + 2] * (65536 - x) + src2[i * 4 + 2] * x) >> 16;
- dest[i * 4 + 3] =
- (src1[i * 4 + 3] * (65536 - x) + src2[i * 4 + 3] * x) >> 16;
- }
- }
-}
-
-
-/* UYVY */
-
-/* n is the number of bi-pixels */
-/* increment is per Y pixel */
-
-void
-vs_scanline_downsample_UYVY (uint8_t * dest, uint8_t * src, int n)
-{
- int i;
-
- for (i = 0; i < n; i++) {
- dest[i * 4 + 0] = (src[i * 8 + 0] + src[i * 8 + 4]) / 2;
- dest[i * 4 + 1] = (src[i * 8 + 1] + src[i * 8 + 3]) / 2;
- dest[i * 4 + 2] = (src[i * 8 + 2] + src[i * 8 + 6]) / 2;
- dest[i * 4 + 3] = (src[i * 8 + 5] + src[i * 8 + 7]) / 2;
- }
-}
-
-void
-vs_scanline_resample_nearest_UYVY (uint8_t * dest, uint8_t * src, int src_width,
- int n, int *accumulator, int increment)
-{
- int acc = *accumulator;
- int i;
- int j;
- int x;
- int quads = (n + 1) / 2;
-
- for (i = 0; i < quads; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
-
- dest[i * 4 + 1] = (x < 32768
- || j + 1 >= src_width) ? src[j * 2 + 1] : src[j * 2 + 3];
-
- j = acc >> 17;
- x = acc & 0x1ffff;
-
- dest[i * 4 + 0] = (x < 65536
- || 2 * (j + 2) >= src_width) ? src[j * 4 + 0] : src[j * 4 + 4];
-
- if (2 * i + 1 < n && 2 * (j + 1) < src_width)
- dest[i * 4 + 2] = (x < 65536
- || 2 * (j + 3) >= src_width) ? src[j * 4 + 2] : src[j * 4 + 6];
-
- acc += increment;
-
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (2 * i + 1 < n && j < src_width) {
- dest[i * 4 + 3] = (x < 32768
- || j + 1 >= src_width) ? src[j * 2 + 1] : src[j * 2 + 3];
- acc += increment;
- }
- }
-
- *accumulator = acc;
-}
-
-void
-vs_scanline_resample_linear_UYVY (uint8_t * dest, uint8_t * src, int src_width,
- int n, int *accumulator, int increment)
-{
- int acc = *accumulator;
- int i;
- int j;
- int x;
- int quads = (n + 1) / 2;
-
- for (i = 0; i < quads; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (j + 1 < src_width)
- dest[i * 4 + 1] =
- (src[j * 2 + 1] * (65536 - x) + src[j * 2 + 3] * x) >> 16;
- else
- dest[i * 4 + 1] = src[j * 2 + 1];
-
- j = acc >> 17;
- x = acc & 0x1ffff;
- if (2 * (j + 2) < src_width)
- dest[i * 4 + 0] =
- (src[j * 4 + 0] * (131072 - x) + src[j * 4 + 4] * x) >> 17;
- else
- dest[i * 4 + 0] = src[j * 4 + 0];
-
- if (i * 2 + 1 < n && 2 * (j + 1) < src_width) {
- if (2 * (j + 3) < src_width)
- dest[i * 4 + 2] =
- (src[j * 4 + 2] * (131072 - x) + src[j * 4 + 6] * x) >> 17;
- else
- dest[i * 4 + 2] = src[j * 4 + 2];
- }
-
- acc += increment;
-
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (2 * i + 1 < n && j < src_width) {
- if (j + 1 < src_width)
- dest[i * 4 + 3] =
- (src[j * 2 + 1] * (65536 - x) + src[j * 2 + 3] * x) >> 16;
- else
- dest[i * 4 + 3] = src[j * 2 + 1];
- acc += increment;
- }
- }
-
- *accumulator = acc;
-}
-
-void
-vs_scanline_merge_linear_UYVY (uint8_t * dest, uint8_t * src1,
- uint8_t * src2, int n, int x)
-{
- int i;
- int quads = (n + 1) / 2;
-
- for (i = 0; i < quads; i++) {
- dest[i * 4 + 0] =
- (src1[i * 4 + 0] * (65536 - x) + src2[i * 4 + 0] * x) >> 16;
- dest[i * 4 + 1] =
- (src1[i * 4 + 1] * (65536 - x) + src2[i * 4 + 1] * x) >> 16;
-
- if (2 * i + 1 < n) {
- dest[i * 4 + 2] =
- (src1[i * 4 + 2] * (65536 - x) + src2[i * 4 + 2] * x) >> 16;
- dest[i * 4 + 3] =
- (src1[i * 4 + 3] * (65536 - x) + src2[i * 4 + 3] * x) >> 16;
- }
- }
-}
-
-
-/* RGB565 */
-
-/* note that src and dest are uint16_t, and thus endian dependent */
-
-#define RGB565_R(x) (((x)&0xf800)>>8 | ((x)&0xf800)>>13)
-#define RGB565_G(x) (((x)&0x07e0)>>3 | ((x)&0x07e0)>>9)
-#define RGB565_B(x) (((x)&0x001f)<<3 | ((x)&0x001f)>>2)
-
-#define RGB565(r,g,b) \
- ((((r)<<8)&0xf800) | (((g)<<3)&0x07e0) | (((b)>>3)&0x001f))
-
-
-void
-vs_scanline_downsample_RGB565 (uint8_t * dest_u8, uint8_t * src_u8, int n)
-{
- uint16_t *dest = (uint16_t *) dest_u8;
- uint16_t *src = (uint16_t *) src_u8;
- int i;
-
- for (i = 0; i < n; i++) {
- dest[i] = RGB565 (
- (RGB565_R (src[i * 2]) + RGB565_R (src[i * 2 + 1])) / 2,
- (RGB565_G (src[i * 2]) + RGB565_G (src[i * 2 + 1])) / 2,
- (RGB565_B (src[i * 2]) + RGB565_B (src[i * 2 + 1])) / 2);
- }
-}
-
-void
-vs_scanline_resample_nearest_RGB565 (uint8_t * dest_u8, uint8_t * src_u8,
- int src_width, int n, int *accumulator, int increment)
-{
- uint16_t *dest = (uint16_t *) dest_u8;
- uint16_t *src = (uint16_t *) src_u8;
- int acc = *accumulator;
- int i;
- int j;
- int x;
-
- for (i = 0; i < n; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
- dest[i] = (x < 32768 || j + 1 >= src_width) ? src[j] : src[j + 1];
-
- acc += increment;
- }
-
- *accumulator = acc;
-}
-
-void
-vs_scanline_resample_linear_RGB565 (uint8_t * dest_u8, uint8_t * src_u8,
- int src_width, int n, int *accumulator, int increment)
-{
- uint16_t *dest = (uint16_t *) dest_u8;
- uint16_t *src = (uint16_t *) src_u8;
- int acc = *accumulator;
- int i;
- int j;
- int x;
-
- for (i = 0; i < n; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (j + 1 < src_width) {
- dest[i] = RGB565 (
- (RGB565_R (src[j]) * (65536 - x) + RGB565_R (src[j + 1]) * x) >> 16,
- (RGB565_G (src[j]) * (65536 - x) + RGB565_G (src[j + 1]) * x) >> 16,
- (RGB565_B (src[j]) * (65536 - x) + RGB565_B (src[j + 1]) * x) >> 16);
- } else {
- dest[i] = RGB565 (RGB565_R (src[j]),
- RGB565_G (src[j]), RGB565_B (src[j]));
- }
-
- acc += increment;
- }
-
- *accumulator = acc;
-}
-
-void
-vs_scanline_merge_linear_RGB565 (uint8_t * dest_u8, uint8_t * src1_u8,
- uint8_t * src2_u8, int n, int x)
-{
- uint16_t *dest = (uint16_t *) dest_u8;
- uint16_t *src1 = (uint16_t *) src1_u8;
- uint16_t *src2 = (uint16_t *) src2_u8;
- int i;
-
- for (i = 0; i < n; i++) {
- dest[i] = RGB565 (
- (RGB565_R (src1[i]) * (65536 - x) + RGB565_R (src2[i]) * x) >> 16,
- (RGB565_G (src1[i]) * (65536 - x) + RGB565_G (src2[i]) * x) >> 16,
- (RGB565_B (src1[i]) * (65536 - x) + RGB565_B (src2[i]) * x) >> 16);
- }
-}
-
-
-/* RGB555 */
-
-/* note that src and dest are uint16_t, and thus endian dependent */
-
-#define RGB555_R(x) (((x)&0x7c00)>>8 | ((x)&0x7c00)>>13)
-#define RGB555_G(x) (((x)&0x03e0)>>3 | ((x)&0x03e0)>>9)
-#define RGB555_B(x) (((x)&0x001f)<<3 | ((x)&0x001f)>>2)
-
-#define RGB555(r,g,b) \
- ((((r)<<7)&0x7c00) | (((g)<<3)&0x03e0) | (((b)>>3)&0x001f))
-
-
-void
-vs_scanline_downsample_RGB555 (uint8_t * dest_u8, uint8_t * src_u8, int n)
-{
- uint16_t *dest = (uint16_t *) dest_u8;
- uint16_t *src = (uint16_t *) src_u8;
- int i;
-
- for (i = 0; i < n; i++) {
- dest[i] = RGB555 (
- (RGB555_R (src[i * 2]) + RGB555_R (src[i * 2 + 1])) / 2,
- (RGB555_G (src[i * 2]) + RGB555_G (src[i * 2 + 1])) / 2,
- (RGB555_B (src[i * 2]) + RGB555_B (src[i * 2 + 1])) / 2);
- }
-}
-
-void
-vs_scanline_resample_nearest_RGB555 (uint8_t * dest_u8, uint8_t * src_u8,
- int src_width, int n, int *accumulator, int increment)
-{
- uint16_t *dest = (uint16_t *) dest_u8;
- uint16_t *src = (uint16_t *) src_u8;
- int acc = *accumulator;
- int i;
- int j;
- int x;
-
- for (i = 0; i < n; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
- dest[i] = (x < 32768 || j + 1 >= src_width) ? src[j] : src[j + 1];
-
- acc += increment;
- }
-
- *accumulator = acc;
-}
-
-void
-vs_scanline_resample_linear_RGB555 (uint8_t * dest_u8, uint8_t * src_u8,
- int src_width, int n, int *accumulator, int increment)
-{
- uint16_t *dest = (uint16_t *) dest_u8;
- uint16_t *src = (uint16_t *) src_u8;
- int acc = *accumulator;
- int i;
- int j;
- int x;
-
- for (i = 0; i < n; i++) {
- j = acc >> 16;
- x = acc & 0xffff;
-
- if (j + 1 < src_width) {
- dest[i] = RGB555 (
- (RGB555_R (src[j]) * (65536 - x) + RGB555_R (src[j + 1]) * x) >> 16,
- (RGB555_G (src[j]) * (65536 - x) + RGB555_G (src[j + 1]) * x) >> 16,
- (RGB555_B (src[j]) * (65536 - x) + RGB555_B (src[j + 1]) * x) >> 16);
- } else {
- dest[i] = RGB555 (RGB555_R (src[j]),
- RGB555_G (src[j]), RGB555_B (src[j]));
- }
-
- acc += increment;
- }
-
- *accumulator = acc;
-}
-
-void
-vs_scanline_merge_linear_RGB555 (uint8_t * dest_u8, uint8_t * src1_u8,
- uint8_t * src2_u8, int n, int x)
-{
- uint16_t *dest = (uint16_t *) dest_u8;
- uint16_t *src1 = (uint16_t *) src1_u8;
- uint16_t *src2 = (uint16_t *) src2_u8;
- int i;
-
- for (i = 0; i < n; i++) {
- dest[i] = RGB555 (
- (RGB555_R (src1[i]) * (65536 - x) + RGB555_R (src2[i]) * x) >> 16,
- (RGB555_G (src1[i]) * (65536 - x) + RGB555_G (src2[i]) * x) >> 16,
- (RGB555_B (src1[i]) * (65536 - x) + RGB555_B (src2[i]) * x) >> 16);
- }
-}
diff --git a/gst/videoscale/vs_scanline.h b/gst/videoscale/vs_scanline.h
deleted file mode 100644
index 2e0b1796..00000000
--- a/gst/videoscale/vs_scanline.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Image Scaling Functions
- * Copyright (c) 2005 David A. Schleef <ds@schleef.org>
- * All rights reserved.
- *
- * 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 AUTHOR ``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 AUTHOR 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 __VS_SCANLINE_H__
-#define __VS_SCANLINE_H__
-
-#include <liboil/liboil-stdint.h>
-
-void vs_scanline_downsample_Y (uint8_t *dest, uint8_t *src, int n);
-void vs_scanline_resample_nearest_Y (uint8_t *dest, uint8_t *src, int n, int src_width, int *accumulator, int increment);
-void vs_scanline_resample_linear_Y (uint8_t *dest, uint8_t *src, int n, int src_width, int *accumulator, int increment);
-void vs_scanline_merge_linear_Y (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
-
-void vs_scanline_downsample_RGBA (uint8_t *dest, uint8_t *src, int n);
-void vs_scanline_resample_nearest_RGBA (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
-void vs_scanline_resample_linear_RGBA (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
-void vs_scanline_merge_linear_RGBA (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
-
-void vs_scanline_downsample_RGB (uint8_t *dest, uint8_t *src, int n);
-void vs_scanline_resample_nearest_RGB (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
-void vs_scanline_resample_linear_RGB (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
-void vs_scanline_merge_linear_RGB (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
-
-void vs_scanline_downsample_YUYV (uint8_t *dest, uint8_t *src, int n);
-void vs_scanline_resample_nearest_YUYV (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
-void vs_scanline_resample_linear_YUYV (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
-void vs_scanline_merge_linear_YUYV (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
-
-void vs_scanline_downsample_UYVY (uint8_t *dest, uint8_t *src, int n);
-void vs_scanline_resample_nearest_UYVY (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
-void vs_scanline_resample_linear_UYVY (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
-void vs_scanline_merge_linear_UYVY (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
-
-void vs_scanline_downsample_RGB565 (uint8_t *dest, uint8_t *src, int n);
-void vs_scanline_resample_nearest_RGB565 (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
-void vs_scanline_resample_linear_RGB565 (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
-void vs_scanline_merge_linear_RGB565 (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
-
-void vs_scanline_downsample_RGB555 (uint8_t *dest, uint8_t *src, int n);
-void vs_scanline_resample_nearest_RGB555 (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
-void vs_scanline_resample_linear_RGB555 (uint8_t *dest, uint8_t *src, int src_width, int n, int *accumulator, int increment);
-void vs_scanline_merge_linear_RGB555 (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
-
-void vs_scanline_downsample_Y16 (uint8_t *dest, uint8_t *src, int n);
-void vs_scanline_resample_nearest_Y16 (uint8_t *dest, uint8_t *src, int n, int src_width, int *accumulator, int increment);
-void vs_scanline_resample_linear_Y16 (uint8_t *dest, uint8_t *src, int n, int src_width, int *accumulator, int increment);
-void vs_scanline_merge_linear_Y16 (uint8_t *dest, uint8_t *src1, uint8_t *src2, int n, int x);
-
-#endif
-
diff --git a/gst/videotestsrc/Makefile.am b/gst/videotestsrc/Makefile.am
deleted file mode 100644
index 9403a11e..00000000
--- a/gst/videotestsrc/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-plugin_LTLIBRARIES = libgstvideotestsrc.la
-
-libgstvideotestsrc_la_SOURCES = \
- gstvideotestsrc.c \
- videotestsrc.c
-
-libgstvideotestsrc_la_CFLAGS = $(GST_CFLAGS) $(LIBOIL_CFLAGS)
-libgstvideotestsrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstvideotestsrc_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(LIBOIL_LIBS)
-libgstvideotestsrc_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = gstvideotestsrc.h videotestsrc.h
diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c
deleted file mode 100644
index 03c55f27..00000000
--- a/gst/videotestsrc/gstvideotestsrc.c
+++ /dev/null
@@ -1,856 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * Copyright (C) <2002> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-videotestsrc
- *
- * The videotestsrc element is used to produce test video data in a wide variaty
- * of formats. The video test data produced can be controlled with the "pattern"
- * property.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch -v videotestsrc pattern=snow ! ximagesink
- * ]| Shows random noise in an X window.
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "gstvideotestsrc.h"
-#include "videotestsrc.h"
-
-#include <string.h>
-#include <stdlib.h>
-#include <liboil/liboil.h>
-
-GST_DEBUG_CATEGORY_STATIC (video_test_src_debug);
-#define GST_CAT_DEFAULT video_test_src_debug
-
-static const GstElementDetails video_test_src_details =
-GST_ELEMENT_DETAILS ("Video test source",
- "Source/Video",
- "Creates a test video stream",
- "David A. Schleef <ds@schleef.org>");
-
-#define DEFAULT_PATTERN GST_VIDEO_TEST_SRC_SMPTE
-#define DEFAULT_TIMESTAMP_OFFSET 0
-#define DEFAULT_IS_LIVE FALSE
-#define DEFAULT_PEER_ALLOC TRUE
-#define DEFAULT_COLOR_SPEC GST_VIDEO_TEST_SRC_BT601
-
-enum
-{
- PROP_0,
- PROP_PATTERN,
- PROP_TIMESTAMP_OFFSET,
- PROP_IS_LIVE,
- PROP_PEER_ALLOC,
- PROP_COLOR_SPEC,
- PROP_K0,
- PROP_KX,
- PROP_KY,
- PROP_KT,
- PROP_KXT,
- PROP_KYT,
- PROP_KXY,
- PROP_KX2,
- PROP_KY2,
- PROP_KT2,
- PROP_XOFFSET,
- PROP_YOFFSET,
- PROP_LAST
-};
-
-
-GST_BOILERPLATE (GstVideoTestSrc, gst_video_test_src, GstPushSrc,
- GST_TYPE_PUSH_SRC);
-
-
-static void gst_video_test_src_set_pattern (GstVideoTestSrc * videotestsrc,
- int pattern_type);
-static void gst_video_test_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_video_test_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static GstCaps *gst_video_test_src_getcaps (GstBaseSrc * bsrc);
-static gboolean gst_video_test_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps);
-static void gst_video_test_src_src_fixate (GstPad * pad, GstCaps * caps);
-
-static gboolean gst_video_test_src_is_seekable (GstBaseSrc * psrc);
-static gboolean gst_video_test_src_do_seek (GstBaseSrc * bsrc,
- GstSegment * segment);
-static gboolean gst_video_test_src_query (GstBaseSrc * bsrc, GstQuery * query);
-
-static void gst_video_test_src_get_times (GstBaseSrc * basesrc,
- GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
-static GstFlowReturn gst_video_test_src_create (GstPushSrc * psrc,
- GstBuffer ** buffer);
-static gboolean gst_video_test_src_start (GstBaseSrc * basesrc);
-
-#define GST_TYPE_VIDEO_TEST_SRC_PATTERN (gst_video_test_src_pattern_get_type ())
-static GType
-gst_video_test_src_pattern_get_type (void)
-{
- static GType video_test_src_pattern_type = 0;
- static const GEnumValue pattern_types[] = {
- {GST_VIDEO_TEST_SRC_SMPTE, "SMPTE 100% color bars", "smpte"},
- {GST_VIDEO_TEST_SRC_SNOW, "Random (television snow)", "snow"},
- {GST_VIDEO_TEST_SRC_BLACK, "100% Black", "black"},
- {GST_VIDEO_TEST_SRC_WHITE, "100% White", "white"},
- {GST_VIDEO_TEST_SRC_RED, "Red", "red"},
- {GST_VIDEO_TEST_SRC_GREEN, "Green", "green"},
- {GST_VIDEO_TEST_SRC_BLUE, "Blue", "blue"},
- {GST_VIDEO_TEST_SRC_CHECKERS1, "Checkers 1px", "checkers-1"},
- {GST_VIDEO_TEST_SRC_CHECKERS2, "Checkers 2px", "checkers-2"},
- {GST_VIDEO_TEST_SRC_CHECKERS4, "Checkers 4px", "checkers-4"},
- {GST_VIDEO_TEST_SRC_CHECKERS8, "Checkers 8px", "checkers-8"},
- {GST_VIDEO_TEST_SRC_CIRCULAR, "Circular", "circular"},
- {GST_VIDEO_TEST_SRC_BLINK, "Blink", "blink"},
- {GST_VIDEO_TEST_SRC_SMPTE75, "SMPTE 75% color bars", "smpte75"},
- {GST_VIDEO_TEST_SRC_ZONE_PLATE, "Zone plate", "zone-plate"},
- {GST_VIDEO_TEST_SRC_GAMUT, "Gamut checkers", "gamut"},
- {0, NULL, NULL}
- };
-
- if (!video_test_src_pattern_type) {
- video_test_src_pattern_type =
- g_enum_register_static ("GstVideoTestSrcPattern", pattern_types);
- }
- return video_test_src_pattern_type;
-}
-
-#define GST_TYPE_VIDEO_TEST_SRC_COLOR_SPEC (gst_video_test_src_color_spec_get_type ())
-static GType
-gst_video_test_src_color_spec_get_type (void)
-{
- static GType video_test_src_color_spec_type = 0;
- static const GEnumValue color_spec_types[] = {
- {GST_VIDEO_TEST_SRC_BT601, "ITU-R Rec. BT.601", "bt601"},
- {GST_VIDEO_TEST_SRC_BT709, "ITU-R Rec. BT.709", "bt709"},
- {0, NULL, NULL}
- };
-
- if (!video_test_src_color_spec_type) {
- video_test_src_color_spec_type =
- g_enum_register_static ("GstVideoTestSrcColorSpec", color_spec_types);
- }
- return video_test_src_color_spec_type;
-}
-
-static void
-gst_video_test_src_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &video_test_src_details);
-
- gst_element_class_add_pad_template (element_class,
- gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
- gst_video_test_src_getcaps (NULL)));
-}
-
-static void
-gst_video_test_src_class_init (GstVideoTestSrcClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseSrcClass *gstbasesrc_class;
- GstPushSrcClass *gstpushsrc_class;
-
- gobject_class = (GObjectClass *) klass;
- gstbasesrc_class = (GstBaseSrcClass *) klass;
- gstpushsrc_class = (GstPushSrcClass *) klass;
-
- gobject_class->set_property = gst_video_test_src_set_property;
- gobject_class->get_property = gst_video_test_src_get_property;
-
- g_object_class_install_property (gobject_class, PROP_PATTERN,
- g_param_spec_enum ("pattern", "Pattern",
- "Type of test pattern to generate", GST_TYPE_VIDEO_TEST_SRC_PATTERN,
- DEFAULT_PATTERN, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_TIMESTAMP_OFFSET,
- g_param_spec_int64 ("timestamp-offset", "Timestamp offset",
- "An offset added to timestamps set on buffers (in ns)", G_MININT64,
- G_MAXINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_IS_LIVE,
- g_param_spec_boolean ("is-live", "Is Live",
- "Whether to act as a live source", DEFAULT_IS_LIVE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_PEER_ALLOC,
- g_param_spec_boolean ("peer-alloc", "Peer Alloc",
- "Ask the peer to allocate an output buffer", DEFAULT_PEER_ALLOC,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_COLOR_SPEC,
- g_param_spec_enum ("colorspec", "Color Specification",
- "Generate video in the given color specification",
- GST_TYPE_VIDEO_TEST_SRC_COLOR_SPEC,
- DEFAULT_COLOR_SPEC, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_K0,
- g_param_spec_int ("k0", "Zoneplate zero order phase",
- "Zoneplate zero order phase, for generating plain fields or phase offsets",
- G_MININT32, G_MAXINT32, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_KX,
- g_param_spec_int ("kx", "Zoneplate 1st order x phase",
- "Zoneplate 1st order x phase, for generating constant horizontal frequencies",
- G_MININT32, G_MAXINT32, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_KY,
- g_param_spec_int ("ky", "Zoneplate 1st order y phase",
- "Zoneplate 1st order y phase, for generating contant vertical frequencies",
- G_MININT32, G_MAXINT32, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_KT,
- g_param_spec_int ("kt", "Zoneplate 1st order t phase",
- "Zoneplate 1st order t phase, for generating phase rotation as a function of time",
- G_MININT32, G_MAXINT32, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_KXT,
- g_param_spec_int ("kxt", "Zoneplate x*t product phase",
- "Zoneplate x*t product phase, normalised to kxy/256 cycles per vertical pixel at width/2 from origin",
- G_MININT32, G_MAXINT32, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_KYT,
- g_param_spec_int ("kyt", "Zoneplate y*t product phase",
- "Zoneplate y*t product phase", G_MININT32, G_MAXINT32, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_KXY,
- g_param_spec_int ("kxy", "Zoneplate x*y product phase",
- "Zoneplate x*t product phase", G_MININT32, G_MAXINT32, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_KX2,
- g_param_spec_int ("kx2", "Zoneplate 2nd order x phase",
- "Zoneplate 2nd order x phase, normalised to kx2/256 cycles per horizontal pixel at width/2 from origin",
- G_MININT32, G_MAXINT32, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_KY2,
- g_param_spec_int ("ky2", "Zoneplate 2nd order y phase",
- "Zoneplate 2nd order y phase, normailsed to ky2/256 cycles per vertical pixel at height/2 from origin",
- G_MININT32, G_MAXINT32, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_KT2,
- g_param_spec_int ("kt2", "Zoneplate 2nd order t phase",
- "Zoneplate 2nd order t phase, t*t/256 cycles per picture", G_MININT32,
- G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_XOFFSET,
- g_param_spec_int ("xoffset", "Zoneplate 2nd order products x offset",
- "Zoneplate 2nd order products x offset", G_MININT32, G_MAXINT32, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_YOFFSET,
- g_param_spec_int ("yoffset", "Zoneplate 2nd order products y offset",
- "Zoneplate 2nd order products y offset", G_MININT32, G_MAXINT32, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstbasesrc_class->get_caps = gst_video_test_src_getcaps;
- gstbasesrc_class->set_caps = gst_video_test_src_setcaps;
- gstbasesrc_class->is_seekable = gst_video_test_src_is_seekable;
- gstbasesrc_class->do_seek = gst_video_test_src_do_seek;
- gstbasesrc_class->query = gst_video_test_src_query;
- gstbasesrc_class->get_times = gst_video_test_src_get_times;
- gstbasesrc_class->start = gst_video_test_src_start;
-
- gstpushsrc_class->create = gst_video_test_src_create;
-}
-
-static void
-gst_video_test_src_init (GstVideoTestSrc * src, GstVideoTestSrcClass * g_class)
-{
- GstPad *pad = GST_BASE_SRC_PAD (src);
-
- gst_pad_set_fixatecaps_function (pad, gst_video_test_src_src_fixate);
-
- gst_video_test_src_set_pattern (src, DEFAULT_PATTERN);
-
- src->timestamp_offset = DEFAULT_TIMESTAMP_OFFSET;
-
- /* we operate in time */
- gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
- gst_base_src_set_live (GST_BASE_SRC (src), DEFAULT_IS_LIVE);
- src->peer_alloc = DEFAULT_PEER_ALLOC;
-}
-
-static void
-gst_video_test_src_src_fixate (GstPad * pad, GstCaps * caps)
-{
- GstStructure *structure;
-
- structure = gst_caps_get_structure (caps, 0);
-
- gst_structure_fixate_field_nearest_int (structure, "width", 320);
- gst_structure_fixate_field_nearest_int (structure, "height", 240);
- gst_structure_fixate_field_nearest_fraction (structure, "framerate", 30, 1);
-}
-
-static void
-gst_video_test_src_set_pattern (GstVideoTestSrc * videotestsrc,
- int pattern_type)
-{
- videotestsrc->pattern_type = pattern_type;
-
- GST_DEBUG_OBJECT (videotestsrc, "setting pattern to %d", pattern_type);
-
- switch (pattern_type) {
- case GST_VIDEO_TEST_SRC_SMPTE:
- videotestsrc->make_image = gst_video_test_src_smpte;
- break;
- case GST_VIDEO_TEST_SRC_SNOW:
- videotestsrc->make_image = gst_video_test_src_snow;
- break;
- case GST_VIDEO_TEST_SRC_BLACK:
- videotestsrc->make_image = gst_video_test_src_black;
- break;
- case GST_VIDEO_TEST_SRC_WHITE:
- videotestsrc->make_image = gst_video_test_src_white;
- break;
- case GST_VIDEO_TEST_SRC_RED:
- videotestsrc->make_image = gst_video_test_src_red;
- break;
- case GST_VIDEO_TEST_SRC_GREEN:
- videotestsrc->make_image = gst_video_test_src_green;
- break;
- case GST_VIDEO_TEST_SRC_BLUE:
- videotestsrc->make_image = gst_video_test_src_blue;
- break;
- case GST_VIDEO_TEST_SRC_CHECKERS1:
- videotestsrc->make_image = gst_video_test_src_checkers1;
- break;
- case GST_VIDEO_TEST_SRC_CHECKERS2:
- videotestsrc->make_image = gst_video_test_src_checkers2;
- break;
- case GST_VIDEO_TEST_SRC_CHECKERS4:
- videotestsrc->make_image = gst_video_test_src_checkers4;
- break;
- case GST_VIDEO_TEST_SRC_CHECKERS8:
- videotestsrc->make_image = gst_video_test_src_checkers8;
- break;
- case GST_VIDEO_TEST_SRC_CIRCULAR:
- videotestsrc->make_image = gst_video_test_src_circular;
- break;
- case GST_VIDEO_TEST_SRC_BLINK:
- videotestsrc->make_image = gst_video_test_src_black;
- break;
- case GST_VIDEO_TEST_SRC_SMPTE75:
- videotestsrc->make_image = gst_video_test_src_smpte75;
- break;
- case GST_VIDEO_TEST_SRC_ZONE_PLATE:
- videotestsrc->make_image = gst_video_test_src_zoneplate;
- break;
- case GST_VIDEO_TEST_SRC_GAMUT:
- videotestsrc->make_image = gst_video_test_src_gamut;
- break;
- default:
- g_assert_not_reached ();
- }
-}
-
-static void
-gst_video_test_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstVideoTestSrc *src = GST_VIDEO_TEST_SRC (object);
-
- switch (prop_id) {
- case PROP_PATTERN:
- gst_video_test_src_set_pattern (src, g_value_get_enum (value));
- break;
- case PROP_TIMESTAMP_OFFSET:
- src->timestamp_offset = g_value_get_int64 (value);
- break;
- case PROP_IS_LIVE:
- gst_base_src_set_live (GST_BASE_SRC (src), g_value_get_boolean (value));
- break;
- case PROP_PEER_ALLOC:
- src->peer_alloc = g_value_get_boolean (value);
- break;
- case PROP_COLOR_SPEC:
- src->color_spec = g_value_get_enum (value);
- break;
- case PROP_K0:
- src->k0 = g_value_get_int (value);
- break;
- case PROP_KX:
- src->kx = g_value_get_int (value);
- break;
- case PROP_KY:
- src->ky = g_value_get_int (value);
- break;
- case PROP_KT:
- src->kt = g_value_get_int (value);
- break;
- case PROP_KXT:
- src->kxt = g_value_get_int (value);
- break;
- case PROP_KYT:
- src->kyt = g_value_get_int (value);
- break;
- case PROP_KXY:
- src->kxy = g_value_get_int (value);
- break;
- case PROP_KX2:
- src->kx2 = g_value_get_int (value);
- break;
- case PROP_KY2:
- src->ky2 = g_value_get_int (value);
- break;
- case PROP_KT2:
- src->kt2 = g_value_get_int (value);
- break;
- case PROP_XOFFSET:
- src->xoffset = g_value_get_int (value);
- break;
- case PROP_YOFFSET:
- src->yoffset = g_value_get_int (value);
- break;
- default:
- break;
- }
-}
-
-static void
-gst_video_test_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstVideoTestSrc *src = GST_VIDEO_TEST_SRC (object);
-
- switch (prop_id) {
- case PROP_PATTERN:
- g_value_set_enum (value, src->pattern_type);
- break;
- case PROP_TIMESTAMP_OFFSET:
- g_value_set_int64 (value, src->timestamp_offset);
- break;
- case PROP_IS_LIVE:
- g_value_set_boolean (value, gst_base_src_is_live (GST_BASE_SRC (src)));
- break;
- case PROP_PEER_ALLOC:
- g_value_set_boolean (value, src->peer_alloc);
- break;
- case PROP_COLOR_SPEC:
- g_value_set_enum (value, src->color_spec);
- break;
- case PROP_K0:
- g_value_set_int (value, src->k0);
- break;
- case PROP_KX:
- g_value_set_int (value, src->kx);
- break;
- case PROP_KY:
- g_value_set_int (value, src->ky);
- break;
- case PROP_KT:
- g_value_set_int (value, src->kt);
- break;
- case PROP_KXT:
- g_value_set_int (value, src->kxt);
- break;
- case PROP_KYT:
- g_value_set_int (value, src->kyt);
- break;
- case PROP_KXY:
- g_value_set_int (value, src->kxy);
- break;
- case PROP_KX2:
- g_value_set_int (value, src->kx2);
- break;
- case PROP_KY2:
- g_value_set_int (value, src->ky2);
- break;
- case PROP_KT2:
- g_value_set_int (value, src->kt2);
- break;
- case PROP_XOFFSET:
- g_value_set_int (value, src->xoffset);
- break;
- case PROP_YOFFSET:
- g_value_set_int (value, src->yoffset);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/* threadsafe because this gets called as the plugin is loaded */
-static GstCaps *
-gst_video_test_src_getcaps (GstBaseSrc * bsrc)
-{
- static GstCaps *capslist = NULL;
-
- if (!capslist) {
- GstCaps *caps;
- GstStructure *structure;
- int i;
-
- caps = gst_caps_new_empty ();
- for (i = 0; i < n_fourccs; i++) {
- structure = paint_get_structure (fourcc_list + i);
- gst_structure_set (structure,
- "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
- "height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
- "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
- gst_caps_append_structure (caps, structure);
- }
-
- capslist = caps;
- }
-
- return gst_caps_copy (capslist);
-}
-
-static gboolean
-gst_video_test_src_parse_caps (const GstCaps * caps,
- gint * width, gint * height, gint * rate_numerator, gint * rate_denominator,
- struct fourcc_list_struct **fourcc)
-{
- const GstStructure *structure;
- GstPadLinkReturn ret;
- const GValue *framerate;
-
- GST_DEBUG ("parsing caps");
-
- if (gst_caps_get_size (caps) < 1)
- return FALSE;
-
- structure = gst_caps_get_structure (caps, 0);
-
- if (!(*fourcc = paintinfo_find_by_structure (structure)))
- goto unknown_format;
-
- ret = gst_structure_get_int (structure, "width", width);
- ret &= gst_structure_get_int (structure, "height", height);
- framerate = gst_structure_get_value (structure, "framerate");
-
- if (framerate) {
- *rate_numerator = gst_value_get_fraction_numerator (framerate);
- *rate_denominator = gst_value_get_fraction_denominator (framerate);
- } else
- goto no_framerate;
-
- return ret;
-
- /* ERRORS */
-unknown_format:
- {
- GST_DEBUG ("videotestsrc format not found");
- return FALSE;
- }
-no_framerate:
- {
- GST_DEBUG ("videotestsrc no framerate given");
- return FALSE;
- }
-}
-
-static gboolean
-gst_video_test_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
-{
- gboolean res;
- gint width, height, rate_denominator, rate_numerator;
- struct fourcc_list_struct *fourcc;
- GstVideoTestSrc *videotestsrc;
-
- videotestsrc = GST_VIDEO_TEST_SRC (bsrc);
-
- res = gst_video_test_src_parse_caps (caps, &width, &height,
- &rate_numerator, &rate_denominator, &fourcc);
- if (res) {
- /* looks ok here */
- videotestsrc->fourcc = fourcc;
- videotestsrc->width = width;
- videotestsrc->height = height;
- videotestsrc->rate_numerator = rate_numerator;
- videotestsrc->rate_denominator = rate_denominator;
- videotestsrc->bpp = videotestsrc->fourcc->bitspp;
-
- GST_DEBUG_OBJECT (videotestsrc, "size %dx%d, %d/%d fps",
- videotestsrc->width, videotestsrc->height,
- videotestsrc->rate_numerator, videotestsrc->rate_denominator);
- }
- return res;
-}
-
-static gboolean
-gst_video_test_src_query (GstBaseSrc * bsrc, GstQuery * query)
-{
- gboolean res;
- GstVideoTestSrc *src;
-
- src = GST_VIDEO_TEST_SRC (bsrc);
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_CONVERT:
- {
- GstFormat src_fmt, dest_fmt;
- gint64 src_val, dest_val;
-
- gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
- if (src_fmt == dest_fmt) {
- dest_val = src_val;
- goto done;
- }
-
- switch (src_fmt) {
- case GST_FORMAT_DEFAULT:
- switch (dest_fmt) {
- case GST_FORMAT_TIME:
- /* frames to time */
- if (src->rate_numerator) {
- dest_val = gst_util_uint64_scale (src_val,
- src->rate_denominator * GST_SECOND, src->rate_numerator);
- } else {
- dest_val = 0;
- }
- break;
- default:
- goto error;
- }
- break;
- case GST_FORMAT_TIME:
- switch (dest_fmt) {
- case GST_FORMAT_DEFAULT:
- /* time to frames */
- if (src->rate_numerator) {
- dest_val = gst_util_uint64_scale (src_val,
- src->rate_numerator, src->rate_denominator * GST_SECOND);
- } else {
- dest_val = 0;
- }
- break;
- default:
- goto error;
- }
- break;
- default:
- goto error;
- }
- done:
- gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
- res = TRUE;
- break;
- }
- default:
- res = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
- }
- return res;
-
- /* ERROR */
-error:
- {
- GST_DEBUG_OBJECT (src, "query failed");
- return FALSE;
- }
-}
-
-static void
-gst_video_test_src_get_times (GstBaseSrc * basesrc, GstBuffer * buffer,
- GstClockTime * start, GstClockTime * end)
-{
- /* for live sources, sync on the timestamp of the buffer */
- if (gst_base_src_is_live (basesrc)) {
- GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buffer);
-
- if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
- /* get duration to calculate end time */
- GstClockTime duration = GST_BUFFER_DURATION (buffer);
-
- if (GST_CLOCK_TIME_IS_VALID (duration)) {
- *end = timestamp + duration;
- }
- *start = timestamp;
- }
- } else {
- *start = -1;
- *end = -1;
- }
-}
-
-static gboolean
-gst_video_test_src_do_seek (GstBaseSrc * bsrc, GstSegment * segment)
-{
- GstClockTime time;
- GstVideoTestSrc *src;
-
- src = GST_VIDEO_TEST_SRC (bsrc);
-
- segment->time = segment->start;
- time = segment->last_stop;
-
- /* now move to the time indicated */
- if (src->rate_numerator) {
- src->n_frames = gst_util_uint64_scale (time,
- src->rate_numerator, src->rate_denominator * GST_SECOND);
- } else {
- src->n_frames = 0;
- }
- if (src->rate_numerator) {
- src->running_time = gst_util_uint64_scale (src->n_frames,
- src->rate_denominator * GST_SECOND, src->rate_numerator);
- } else {
- /* FIXME : Not sure what to set here */
- src->running_time = 0;
- }
-
- g_assert (src->running_time <= time);
-
- return TRUE;
-}
-
-static gboolean
-gst_video_test_src_is_seekable (GstBaseSrc * psrc)
-{
- /* we're seekable... */
- return TRUE;
-}
-
-static GstFlowReturn
-gst_video_test_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
-{
- GstVideoTestSrc *src;
- gulong newsize, size;
- GstBuffer *outbuf = NULL;
- GstFlowReturn res;
- GstClockTime next_time;
-
- src = GST_VIDEO_TEST_SRC (psrc);
-
- if (G_UNLIKELY (src->fourcc == NULL))
- goto not_negotiated;
-
- /* 0 framerate and we are at the second frame, eos */
- if (G_UNLIKELY (src->rate_numerator == 0 && src->n_frames == 1))
- goto eos;
-
- newsize = gst_video_test_src_get_size (src, src->width, src->height);
-
- g_return_val_if_fail (newsize > 0, GST_FLOW_ERROR);
-
- GST_LOG_OBJECT (src,
- "creating buffer of %lu bytes with %dx%d image for frame %d", newsize,
- src->width, src->height, (gint) src->n_frames);
-
- if (src->peer_alloc) {
- res =
- gst_pad_alloc_buffer_and_set_caps (GST_BASE_SRC_PAD (psrc),
- GST_BUFFER_OFFSET_NONE, newsize, GST_PAD_CAPS (GST_BASE_SRC_PAD (psrc)),
- &outbuf);
- if (res != GST_FLOW_OK)
- goto no_buffer;
-
- /* the buffer could have renegotiated, we need to discard any buffers of the
- * wrong size. */
- size = GST_BUFFER_SIZE (outbuf);
- newsize = gst_video_test_src_get_size (src, src->width, src->height);
-
- if (size != newsize) {
- gst_buffer_unref (outbuf);
- outbuf = NULL;
- }
- }
-
- if (outbuf == NULL) {
- outbuf = gst_buffer_new_and_alloc (newsize);
- gst_buffer_set_caps (outbuf, GST_PAD_CAPS (GST_BASE_SRC_PAD (psrc)));
- }
-
- memset (GST_BUFFER_DATA (outbuf), 0, GST_BUFFER_SIZE (outbuf));
-
- if (src->pattern_type == GST_VIDEO_TEST_SRC_BLINK) {
- if (src->n_frames & 0x1) {
- gst_video_test_src_white (src, (void *) GST_BUFFER_DATA (outbuf),
- src->width, src->height);
- } else {
- gst_video_test_src_black (src, (void *) GST_BUFFER_DATA (outbuf),
- src->width, src->height);
- }
- } else {
- src->make_image (src, (void *) GST_BUFFER_DATA (outbuf),
- src->width, src->height);
- }
-
- GST_BUFFER_TIMESTAMP (outbuf) = src->timestamp_offset + src->running_time;
- GST_BUFFER_OFFSET (outbuf) = src->n_frames;
- src->n_frames++;
- GST_BUFFER_OFFSET_END (outbuf) = src->n_frames;
- if (src->rate_numerator) {
- next_time = gst_util_uint64_scale_int (src->n_frames * GST_SECOND,
- src->rate_denominator, src->rate_numerator);
- GST_BUFFER_DURATION (outbuf) = next_time - src->running_time;
- } else {
- next_time = src->timestamp_offset;
- /* NONE means forever */
- GST_BUFFER_DURATION (outbuf) = GST_CLOCK_TIME_NONE;
- }
-
- src->running_time = next_time;
-
- *buffer = outbuf;
-
- return GST_FLOW_OK;
-
-not_negotiated:
- {
- GST_ELEMENT_ERROR (src, CORE, NEGOTIATION, (NULL),
- ("format wasn't negotiated before get function"));
- return GST_FLOW_NOT_NEGOTIATED;
- }
-eos:
- {
- GST_DEBUG_OBJECT (src, "eos: 0 framerate, frame %d", (gint) src->n_frames);
- return GST_FLOW_UNEXPECTED;
- }
-no_buffer:
- {
- GST_DEBUG_OBJECT (src, "could not allocate buffer, reason %s",
- gst_flow_get_name (res));
- return res;
- }
-}
-
-static gboolean
-gst_video_test_src_start (GstBaseSrc * basesrc)
-{
- GstVideoTestSrc *src = GST_VIDEO_TEST_SRC (basesrc);
-
- src->running_time = 0;
- src->n_frames = 0;
-
- return TRUE;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- oil_init ();
-
- GST_DEBUG_CATEGORY_INIT (video_test_src_debug, "videotestsrc", 0,
- "Video Test Source");
-
- return gst_element_register (plugin, "videotestsrc", GST_RANK_NONE,
- GST_TYPE_VIDEO_TEST_SRC);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "videotestsrc",
- "Creates a test video stream",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/videotestsrc/gstvideotestsrc.h b/gst/videotestsrc/gstvideotestsrc.h
deleted file mode 100644
index 0cc80b20..00000000
--- a/gst/videotestsrc/gstvideotestsrc.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/* GStreamer
- * Copyright (C) <2002> David A. Schleef <ds@schleef.org>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_VIDEO_TEST_SRC_H__
-#define __GST_VIDEO_TEST_SRC_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstpushsrc.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_VIDEO_TEST_SRC \
- (gst_video_test_src_get_type())
-#define GST_VIDEO_TEST_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_TEST_SRC,GstVideoTestSrc))
-#define GST_VIDEO_TEST_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_TEST_SRC,GstVideoTestSrcClass))
-#define GST_IS_VIDEO_TEST_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_TEST_SRC))
-#define GST_IS_VIDEO_TEST_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_TEST_SRC))
-
-/**
- * GstVideoTestSrcPattern:
- * @GST_VIDEO_TEST_SRC_SMPTE: A standard SMPTE test pattern
- * @GST_VIDEO_TEST_SRC_SNOW: Random noise
- * @GST_VIDEO_TEST_SRC_BLACK: A black image
- * @GST_VIDEO_TEST_SRC_WHITE: A white image
- * @GST_VIDEO_TEST_SRC_RED: A red image
- * @GST_VIDEO_TEST_SRC_GREEN: A green image
- * @GST_VIDEO_TEST_SRC_BLUE: A blue image
- * @GST_VIDEO_TEST_SRC_CHECKERS1: Checkers pattern (1px)
- * @GST_VIDEO_TEST_SRC_CHECKERS2: Checkers pattern (2px)
- * @GST_VIDEO_TEST_SRC_CHECKERS4: Checkers pattern (4px)
- * @GST_VIDEO_TEST_SRC_CHECKERS8: Checkers pattern (8px)
- * @GST_VIDEO_TEST_SRC_CIRCULAR: Circular pattern
- * @GST_VIDEO_TEST_SRC_BLINK: Alternate between black and white
- * @GST_VIDEO_TEST_SRC_SMPTE75: SMPTE test pattern (75% color bars)
- * @GST_VIDEO_TEST_SRC_ZONE_PLATE: Zone plate
- * @GST_VIDEO_TEST_SRC_GAMUT: Gamut checking pattern
- *
- * The test pattern to produce.
- *
- * The Gamut pattern creates a checkerboard pattern of colors at the
- * edge of the YCbCr gamut and nearby colors that are out of gamut.
- * The pattern is divided into 4 regions: black, white, red, and blue.
- * After conversion to RGB, the out-of-gamut colors should be converted
- * to the same value as their in-gamut neighbors. If the checkerboard
- * pattern is still visible after conversion, this indicates a faulty
- * conversion. Image manipulation, such as adjusting contrast or
- * brightness, can also cause the pattern to be visible.
- */
-typedef enum {
- GST_VIDEO_TEST_SRC_SMPTE,
- GST_VIDEO_TEST_SRC_SNOW,
- GST_VIDEO_TEST_SRC_BLACK,
- GST_VIDEO_TEST_SRC_WHITE,
- GST_VIDEO_TEST_SRC_RED,
- GST_VIDEO_TEST_SRC_GREEN,
- GST_VIDEO_TEST_SRC_BLUE,
- GST_VIDEO_TEST_SRC_CHECKERS1,
- GST_VIDEO_TEST_SRC_CHECKERS2,
- GST_VIDEO_TEST_SRC_CHECKERS4,
- GST_VIDEO_TEST_SRC_CHECKERS8,
- GST_VIDEO_TEST_SRC_CIRCULAR,
- GST_VIDEO_TEST_SRC_BLINK,
- GST_VIDEO_TEST_SRC_SMPTE75,
- GST_VIDEO_TEST_SRC_ZONE_PLATE,
- GST_VIDEO_TEST_SRC_GAMUT
-} GstVideoTestSrcPattern;
-
-/**
- * GstVideoTestSrcColorSpec:
- * @GST_VIDEO_TEST_SRC_BT601: ITU-R Rec. BT.601/BT.470 (SD)
- * @GST_VIDEO_TEST_SRC_BT709: ITU-R Rec. BT.709 (HD)
- *
- * The color specification to use.
- */
-typedef enum {
- GST_VIDEO_TEST_SRC_BT601,
- GST_VIDEO_TEST_SRC_BT709
-} GstVideoTestSrcColorSpec;
-
-typedef struct _GstVideoTestSrc GstVideoTestSrc;
-typedef struct _GstVideoTestSrcClass GstVideoTestSrcClass;
-
-/**
- * GstVideoTestSrc:
- *
- * Opaque data structure.
- */
-struct _GstVideoTestSrc {
- GstPushSrc element;
-
- /*< private >*/
-
- /* type of output */
- GstVideoTestSrcPattern pattern_type;
-
- /* Color spec of output */
- GstVideoTestSrcColorSpec color_spec;
-
- /* video state */
- char *format_name;
- gint width;
- gint height;
- struct fourcc_list_struct *fourcc;
- gint bpp;
- gint rate_numerator;
- gint rate_denominator;
-
- /* private */
- gint64 timestamp_offset; /* base offset */
- GstClockTime running_time; /* total running time */
- gint64 n_frames; /* total frames sent */
- gboolean peer_alloc;
-
- /* zoneplate */
- gint k0;
- gint kx;
- gint ky;
- gint kt;
- gint kxt;
- gint kyt;
- gint kxy;
- gint kx2;
- gint ky2;
- gint kt2;
- gint xoffset;
- gint yoffset;
-
- void (*make_image) (GstVideoTestSrc *v, unsigned char *dest, int w, int h);
-};
-
-struct _GstVideoTestSrcClass {
- GstPushSrcClass parent_class;
-};
-
-GType gst_video_test_src_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_VIDEO_TEST_SRC_H__ */
diff --git a/gst/videotestsrc/videotestsrc.c b/gst/videotestsrc/videotestsrc.c
deleted file mode 100644
index 52088948..00000000
--- a/gst/videotestsrc/videotestsrc.c
+++ /dev/null
@@ -1,2227 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-/* non-GST-specific stuff */
-
-#include "gstvideotestsrc.h"
-#include "videotestsrc.h"
-#include <liboil/liboil.h>
-
-
-#include <string.h>
-#include <stdlib.h>
-#include <math.h>
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-static unsigned char
-random_char (void)
-{
- static unsigned int state;
-
- state *= 1103515245;
- state += 12345;
- return (state >> 16) & 0xff;
-}
-
-#if 0
-static void
-random_chars (unsigned char *dest, int nbytes)
-{
- int i;
- static unsigned int state;
-
- for (i = 0; i < nbytes; i++) {
- state *= 1103515245;
- state += 12345;
- dest[i] = (state >> 16);
- }
-}
-#endif
-
-#if 0
-static void
-paint_rect_random (unsigned char *dest, int stride, int x, int y, int w, int h)
-{
- unsigned char *d = dest + stride * y + x;
- int i;
-
- for (i = 0; i < h; i++) {
- random_chars (d, w);
- d += stride;
- }
-}
-#endif
-
-#if 0
-static void
-paint_rect (unsigned char *dest, int stride, int x, int y, int w, int h,
- unsigned char color)
-{
- unsigned char *d = dest + stride * y + x;
- int i;
-
- for (i = 0; i < h; i++) {
- oil_splat_u8_ns (d, &color, w);
- d += stride;
- }
-}
-#endif
-
-#if 0
-static void
-paint_rect_s2 (unsigned char *dest, int stride, int x, int y, int w, int h,
- unsigned char col)
-{
- unsigned char *d = dest + stride * y + x * 2;
- unsigned char *dp;
- int i, j;
-
- for (i = 0; i < h; i++) {
- dp = d;
- for (j = 0; j < w; j++) {
- *dp = col;
- dp += 2;
- }
- d += stride;
- }
-}
-#endif
-
-#if 0
-static void
-paint_rect2 (unsigned char *dest, int stride, int x, int y, int w, int h,
- unsigned char *col)
-{
- unsigned char *d = dest + stride * y + x * 2;
- unsigned char *dp;
- int i, j;
-
- for (i = 0; i < h; i++) {
- dp = d;
- for (j = 0; j < w; j++) {
- *dp++ = col[0];
- *dp++ = col[1];
- }
- d += stride;
- }
-}
-#endif
-
-#if 0
-static void
-paint_rect3 (unsigned char *dest, int stride, int x, int y, int w, int h,
- unsigned char *col)
-{
- unsigned char *d = dest + stride * y + x * 3;
- unsigned char *dp;
- int i, j;
-
- for (i = 0; i < h; i++) {
- dp = d;
- for (j = 0; j < w; j++) {
- *dp++ = col[0];
- *dp++ = col[1];
- *dp++ = col[2];
- }
- d += stride;
- }
-}
-#endif
-
-#if 0
-static void
-paint_rect4 (unsigned char *dest, int stride, int x, int y, int w, int h,
- unsigned char *col)
-{
- unsigned char *d = dest + stride * y + x * 4;
- unsigned char *dp;
- int i, j;
-
- for (i = 0; i < h; i++) {
- dp = d;
- for (j = 0; j < w; j++) {
- *dp++ = col[0];
- *dp++ = col[1];
- *dp++ = col[2];
- *dp++ = col[3];
- }
- d += stride;
- }
-}
-#endif
-
-#if 0
-static void
-paint_rect_s4 (unsigned char *dest, int stride, int x, int y, int w, int h,
- unsigned char col)
-{
- unsigned char *d = dest + stride * y + x * 4;
- unsigned char *dp;
- int i, j;
-
- for (i = 0; i < h; i++) {
- dp = d;
- for (j = 0; j < w; j++) {
- *dp = col;
- dp += 4;
- }
- d += stride;
- }
-}
-#endif
-
-enum
-{
- COLOR_WHITE = 0,
- COLOR_YELLOW,
- COLOR_CYAN,
- COLOR_GREEN,
- COLOR_MAGENTA,
- COLOR_RED,
- COLOR_BLUE,
- COLOR_BLACK,
- COLOR_NEG_I,
- COLOR_POS_Q,
- COLOR_SUPER_BLACK,
- COLOR_DARK_GREY
-};
-
-static const struct vts_color_struct_rgb vts_colors_rgb[] = {
- {255, 255, 255},
- {255, 255, 0},
- {0, 255, 255},
- {0, 255, 0},
- {255, 0, 255},
- {255, 0, 0},
- {0, 0, 255},
- {0, 0, 0},
- {0, 0, 128}, /* -I ? */
- {0, 128, 255}, /* +Q ? */
- {0, 0, 0},
- {19, 19, 19},
-};
-
-static const struct vts_color_struct_rgb vts_colors_rgb_75[] = {
- {191, 191, 191},
- {191, 191, 0},
- {0, 191, 191},
- {0, 191, 0},
- {191, 0, 191},
- {191, 0, 0},
- {0, 0, 191},
- {0, 0, 0},
- {0, 0, 128}, /* -I ? */
- {0, 128, 255}, /* +Q ? */
- {0, 0, 0},
- {19, 19, 19},
-};
-
-static const struct vts_color_struct_yuv vts_colors_bt709_ycbcr_100[] = {
- {235, 128, 128},
- {219, 16, 138},
- {188, 154, 16},
- {173, 42, 26},
- {78, 214, 230},
- {63, 102, 240},
- {32, 240, 118},
- {16, 128, 128},
- {16, 198, 21}, /* -I ? */
- {16, 235, 198}, /* +Q ? */
- {0, 128, 128},
- {32, 128, 128},
-};
-
-static const struct vts_color_struct_yuv vts_colors_bt709_ycbcr_75[] = {
- {180, 128, 128},
- {168, 44, 136},
- {145, 147, 44},
- {133, 63, 52},
- {63, 193, 204},
- {51, 109, 212},
- {28, 212, 120},
- {16, 128, 128},
- {16, 198, 21}, /* -I ? */
- {16, 235, 198}, /* +Q ? */
- {0, 128, 128},
- {32, 128, 128},
-};
-
-static const struct vts_color_struct_yuv vts_colors_bt601_ycbcr_100[] = {
- {235, 128, 128},
- {210, 16, 146},
- {170, 166, 16},
- {145, 54, 34},
- {106, 202, 222},
- {81, 90, 240},
- {41, 240, 110},
- {16, 128, 128},
- {16, 198, 21}, /* -I ? */
- {16, 235, 198}, /* +Q ? */
- {-0, 128, 128},
- {32, 128, 128},
-};
-
-static const struct vts_color_struct_yuv vts_colors_bt601_ycbcr_75[] = {
- {180, 128, 128},
- {162, 44, 142},
- {131, 156, 44},
- {112, 72, 58},
- {84, 184, 198},
- {65, 100, 212},
- {35, 212, 114},
- {16, 128, 128},
- {16, 198, 21}, /* -I ? */
- {16, 235, 198}, /* +Q ? */
- {-0, 128, 128},
- {32, 128, 128},
-};
-
-static const struct vts_color_struct_gray vts_colors_gray_100[] = {
- {235 << 8},
- {210 << 8},
- {170 << 8},
- {145 << 8},
- {106 << 8},
- {81 << 8},
- {41 << 8},
- {16 << 8},
- {16 << 8},
- {16 << 8},
- {-0 << 8},
- {32 << 8},
-};
-
-static const struct vts_color_struct_gray vts_colors_gray_75[] = {
- {180 << 8},
- {162 << 8},
- {131 << 8},
- {112 << 8},
- {84 << 8},
- {65 << 8},
- {35 << 8},
- {16 << 8},
- {16 << 8},
- {16 << 8},
- {-0 << 8},
- {32 << 8},
-};
-
-static void paint_setup_I420 (paintinfo * p, unsigned char *dest);
-static void paint_setup_YV12 (paintinfo * p, unsigned char *dest);
-static void paint_setup_YUY2 (paintinfo * p, unsigned char *dest);
-static void paint_setup_UYVY (paintinfo * p, unsigned char *dest);
-static void paint_setup_YVYU (paintinfo * p, unsigned char *dest);
-static void paint_setup_IYU2 (paintinfo * p, unsigned char *dest);
-static void paint_setup_Y41B (paintinfo * p, unsigned char *dest);
-static void paint_setup_Y42B (paintinfo * p, unsigned char *dest);
-static void paint_setup_Y444 (paintinfo * p, unsigned char *dest);
-static void paint_setup_Y800 (paintinfo * p, unsigned char *dest);
-static void paint_setup_AYUV (paintinfo * p, unsigned char *dest);
-static void paint_setup_v308 (paintinfo * p, unsigned char *dest);
-static void paint_setup_NV12 (paintinfo * p, unsigned char *dest);
-static void paint_setup_NV21 (paintinfo * p, unsigned char *dest);
-static void paint_setup_v410 (paintinfo * p, unsigned char *dest);
-static void paint_setup_v216 (paintinfo * p, unsigned char *dest);
-static void paint_setup_v210 (paintinfo * p, unsigned char *dest);
-
-#if 0
-static void paint_setup_IMC1 (paintinfo * p, unsigned char *dest);
-static void paint_setup_IMC2 (paintinfo * p, unsigned char *dest);
-static void paint_setup_IMC3 (paintinfo * p, unsigned char *dest);
-static void paint_setup_IMC4 (paintinfo * p, unsigned char *dest);
-#endif
-static void paint_setup_YUV9 (paintinfo * p, unsigned char *dest);
-static void paint_setup_YVU9 (paintinfo * p, unsigned char *dest);
-static void paint_setup_ARGB8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_ABGR8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_RGBA8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_BGRA8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_xRGB8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_xBGR8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_RGBx8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_BGRx8888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_RGB888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_BGR888 (paintinfo * p, unsigned char *dest);
-static void paint_setup_RGB565 (paintinfo * p, unsigned char *dest);
-static void paint_setup_xRGB1555 (paintinfo * p, unsigned char *dest);
-
-static void paint_setup_bayer (paintinfo * p, unsigned char *dest);
-
-static void paint_hline_I420 (paintinfo * p, int x, int y, int w);
-static void paint_hline_NV12_NV21 (paintinfo * p, int x, int y, int w);
-static void paint_hline_YUY2 (paintinfo * p, int x, int y, int w);
-static void paint_hline_IYU2 (paintinfo * p, int x, int y, int w);
-static void paint_hline_Y41B (paintinfo * p, int x, int y, int w);
-static void paint_hline_Y42B (paintinfo * p, int x, int y, int w);
-static void paint_hline_Y444 (paintinfo * p, int x, int y, int w);
-static void paint_hline_Y800 (paintinfo * p, int x, int y, int w);
-static void paint_hline_v308 (paintinfo * p, int x, int y, int w);
-static void paint_hline_AYUV (paintinfo * p, int x, int y, int w);
-static void paint_hline_v410 (paintinfo * p, int x, int y, int w);
-static void paint_hline_v216 (paintinfo * p, int x, int y, int w);
-static void paint_hline_v210 (paintinfo * p, int x, int y, int w);
-
-#if 0
-static void paint_hline_IMC1 (paintinfo * p, int x, int y, int w);
-#endif
-static void paint_hline_YUV9 (paintinfo * p, int x, int y, int w);
-static void paint_hline_str4 (paintinfo * p, int x, int y, int w);
-static void paint_hline_str3 (paintinfo * p, int x, int y, int w);
-static void paint_hline_RGB565 (paintinfo * p, int x, int y, int w);
-static void paint_hline_xRGB1555 (paintinfo * p, int x, int y, int w);
-
-static void paint_hline_bayer (paintinfo * p, int x, int y, int w);
-
-static void paint_setup_GRAY8 (paintinfo * p, unsigned char *dest);
-static void paint_setup_GRAY16 (paintinfo * p, unsigned char *dest);
-static void paint_hline_GRAY8 (paintinfo * p, int x, int y, int w);
-static void paint_hline_GRAY16 (paintinfo * p, int x, int y, int w);
-
-struct fourcc_list_struct fourcc_list[] = {
-/* packed */
- {VTS_YUV, "YUY2", "YUY2", 16, paint_setup_YUY2, paint_hline_YUY2},
- {VTS_YUV, "UYVY", "UYVY", 16, paint_setup_UYVY, paint_hline_YUY2},
- {VTS_YUV, "Y422", "Y422", 16, paint_setup_UYVY, paint_hline_YUY2},
- {VTS_YUV, "UYNV", "UYNV", 16, paint_setup_UYVY, paint_hline_YUY2}, /* FIXME: UYNV? */
- {VTS_YUV, "YVYU", "YVYU", 16, paint_setup_YVYU, paint_hline_YUY2},
- {VTS_YUV, "v308", "v308", 24, paint_setup_v308, paint_hline_v308},
- {VTS_YUV, "AYUV", "AYUV", 32, paint_setup_AYUV, paint_hline_AYUV},
- {VTS_YUV, "v410", "v410", 32, paint_setup_v410, paint_hline_v410},
- {VTS_YUV, "v210", "v210", 21, paint_setup_v210, paint_hline_v210},
- {VTS_YUV, "v216", "v216", 32, paint_setup_v216, paint_hline_v216},
-
- /* interlaced */
- /*{ VTS_YUV, "IUYV", "IUY2", 16, paint_setup_YVYU, paint_hline_YUY2 }, */
-
- /* inverted */
- /*{ VTS_YUV, "cyuv", "cyuv", 16, paint_setup_YVYU, paint_hline_YUY2 }, */
-
- /*{ VTS_YUV, "Y41P", "Y41P", 12, paint_setup_YVYU, paint_hline_YUY2 }, */
-
- /* interlaced */
- /*{ VTS_YUV, "IY41", "IY41", 12, paint_setup_YVYU, paint_hline_YUY2 }, */
-
- /*{ VTS_YUV, "Y211", "Y211", 8, paint_setup_YVYU, paint_hline_YUY2 }, */
-
- /*{ VTS_YUV, "Y41T", "Y41T", 12, paint_setup_YVYU, paint_hline_YUY2 }, */
- /*{ VTS_YUV, "Y42P", "Y42P", 16, paint_setup_YVYU, paint_hline_YUY2 }, */
- /*{ VTS_YUV, "CLJR", "CLJR", 8, paint_setup_YVYU, paint_hline_YUY2 }, */
- /*{ VTS_YUV, "IYU1", "IYU1", 12, paint_setup_YVYU, paint_hline_YUY2 }, */
- {VTS_YUV, "IYU2", "IYU2", 24, paint_setup_IYU2, paint_hline_IYU2},
-
-/* planar */
- /* YVU9 */
- {VTS_YUV, "YVU9", "YVU9", 9, paint_setup_YVU9, paint_hline_YUV9},
- /* YUV9 */
- {VTS_YUV, "YUV9", "YUV9", 9, paint_setup_YUV9, paint_hline_YUV9},
- /* IF09 */
- /* YV12 */
- {VTS_YUV, "YV12", "YV12", 12, paint_setup_YV12, paint_hline_I420},
- /* I420 */
- {VTS_YUV, "I420", "I420", 12, paint_setup_I420, paint_hline_I420},
- /* NV12 */
- {VTS_YUV, "NV12", "NV12", 12, paint_setup_NV12, paint_hline_NV12_NV21},
- /* NV21 */
- {VTS_YUV, "NV21", "NV21", 12, paint_setup_NV21, paint_hline_NV12_NV21},
-#if 0
- /* IMC1 */
- {VTS_YUV, "IMC1", "IMC1", 16, paint_setup_IMC1, paint_hline_IMC1},
- /* IMC2 */
- {VTS_YUV, "IMC2", "IMC2", 12, paint_setup_IMC2, paint_hline_IMC1},
- /* IMC3 */
- {VTS_YUV, "IMC3", "IMC3", 16, paint_setup_IMC3, paint_hline_IMC1},
- /* IMC4 */
- {VTS_YUV, "IMC4", "IMC4", 12, paint_setup_IMC4, paint_hline_IMC1},
-#endif
- /* CLPL */
- /* Y41B */
- {VTS_YUV, "Y41B", "Y41B", 12, paint_setup_Y41B, paint_hline_Y41B},
- /* Y42B */
- {VTS_YUV, "Y42B", "Y42B", 16, paint_setup_Y42B, paint_hline_Y42B},
- /* Y444 */
- {VTS_YUV, "Y444", "Y444", 24, paint_setup_Y444, paint_hline_Y444},
- /* Y800 grayscale */
- {VTS_YUV, "Y800", "Y800", 8, paint_setup_Y800, paint_hline_Y800},
-
- /* Not exactly YUV but it's the same as above */
- {VTS_GRAY, "GRAY8", "GRAY8", 8, paint_setup_GRAY8, paint_hline_GRAY8},
- {VTS_GRAY, "GRAY16", "GRAY16", 16, paint_setup_GRAY16, paint_hline_GRAY16},
-
- {VTS_RGB, "RGB ", "xRGB8888", 32, paint_setup_xRGB8888, paint_hline_str4, 24,
- 0x00ff0000, 0x0000ff00, 0x000000ff},
- {VTS_RGB, "RGB ", "xBGR8888", 32, paint_setup_xBGR8888, paint_hline_str4, 24,
- 0x000000ff, 0x0000ff00, 0x00ff0000},
- {VTS_RGB, "RGB ", "RGBx8888", 32, paint_setup_RGBx8888, paint_hline_str4, 24,
- 0xff000000, 0x00ff0000, 0x0000ff00},
- {VTS_RGB, "RGB ", "BGRx8888", 32, paint_setup_BGRx8888, paint_hline_str4, 24,
- 0x0000ff00, 0x00ff0000, 0xff000000},
- {VTS_RGB, "RGB ", "ARGB8888", 32, paint_setup_ARGB8888, paint_hline_str4, 32,
- 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000},
- {VTS_RGB, "RGB ", "ABGR8888", 32, paint_setup_ABGR8888, paint_hline_str4, 32,
- 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000},
- {VTS_RGB, "RGB ", "RGBA8888", 32, paint_setup_RGBA8888, paint_hline_str4, 32,
- 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff},
- {VTS_RGB, "RGB ", "BGRA8888", 32, paint_setup_BGRA8888, paint_hline_str4, 32,
- 0x0000ff00, 0x00ff0000, 0xff000000, 0x000000ff},
- {VTS_RGB, "RGB ", "RGB888", 24, paint_setup_RGB888, paint_hline_str3, 24,
- 0x00ff0000, 0x0000ff00, 0x000000ff},
- {VTS_RGB, "RGB ", "BGR888", 24, paint_setup_BGR888, paint_hline_str3, 24,
- 0x000000ff, 0x0000ff00, 0x00ff0000},
- {VTS_RGB, "RGB ", "RGB565", 16, paint_setup_RGB565, paint_hline_RGB565, 16,
- 0x0000f800, 0x000007e0, 0x0000001f},
- {VTS_RGB, "RGB ", "xRGB1555", 16, paint_setup_xRGB1555, paint_hline_xRGB1555,
- 15,
- 0x00007c00, 0x000003e0, 0x0000001f},
-
- {VTS_BAYER, "BAY8", "Bayer", 8, paint_setup_bayer, paint_hline_bayer}
-};
-
-int n_fourccs = G_N_ELEMENTS (fourcc_list);
-
-struct fourcc_list_struct *
-paintinfo_find_by_structure (const GstStructure * structure)
-{
- int i;
- const char *media_type = gst_structure_get_name (structure);
- int ret;
-
- g_return_val_if_fail (structure, NULL);
-
- if (strcmp (media_type, "video/x-raw-gray") == 0) {
- gint bpp, depth, endianness = 0;
-
- ret = gst_structure_get_int (structure, "bpp", &bpp) &&
- gst_structure_get_int (structure, "depth", &depth);
- if (!ret || bpp != depth || (depth != 8 && depth != 16))
- return NULL;
-
- ret = gst_structure_get_int (structure, "endianness", &endianness);
- if ((!ret || endianness != G_BYTE_ORDER) && bpp == 16)
- return NULL;
-
- for (i = 0; i < n_fourccs; i++) {
- if (fourcc_list[i].type == VTS_GRAY && fourcc_list[i].bitspp == bpp) {
- return fourcc_list + i;
- }
- }
- } else if (strcmp (media_type, "video/x-raw-yuv") == 0) {
- char *s;
- int fourcc;
- guint32 format;
-
- ret = gst_structure_get_fourcc (structure, "format", &format);
- if (!ret)
- return NULL;
- for (i = 0; i < n_fourccs; i++) {
- s = fourcc_list[i].fourcc;
- /* g_print("testing %" GST_FOURCC_FORMAT " and %s\n", GST_FOURCC_ARGS(format), s); */
- fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]);
- if (fourcc_list[i].type == VTS_YUV && fourcc == format) {
- return fourcc_list + i;
- }
- }
- } else if (strcmp (media_type, "video/x-raw-rgb") == 0) {
- int red_mask;
- int green_mask;
- int blue_mask;
- int alpha_mask;
- int depth;
- int bpp;
-
- ret = gst_structure_get_int (structure, "red_mask", &red_mask);
- ret &= gst_structure_get_int (structure, "green_mask", &green_mask);
- ret &= gst_structure_get_int (structure, "blue_mask", &blue_mask);
- ret &= gst_structure_get_int (structure, "depth", &depth);
- ret &= gst_structure_get_int (structure, "bpp", &bpp);
-
- if (depth == 32) {
- ret &= gst_structure_get_int (structure, "alpha_mask", &alpha_mask);
- ret &= (alpha_mask != 0);
- } else {
- alpha_mask = 0;
- }
-
- if (!ret) {
- GST_WARNING ("incomplete caps structure: %" GST_PTR_FORMAT, structure);
- return NULL;
- }
-
- for (i = 0; i < n_fourccs; i++) {
- if (fourcc_list[i].type == VTS_RGB &&
- fourcc_list[i].red_mask == red_mask &&
- fourcc_list[i].green_mask == green_mask &&
- fourcc_list[i].blue_mask == blue_mask &&
- (alpha_mask == 0 || fourcc_list[i].alpha_mask == alpha_mask) &&
- fourcc_list[i].depth == depth && fourcc_list[i].bitspp == bpp) {
- return fourcc_list + i;
- }
- }
- return NULL;
- } else if (strcmp (media_type, "video/x-raw-bayer") == 0) {
- for (i = 0; i < n_fourccs; i++) {
- if (fourcc_list[i].type == VTS_BAYER) {
- return fourcc_list + i;
- }
- }
- return NULL;
- }
-
- g_critical ("format not found for media type %s", media_type);
-
- return NULL;
-}
-
-struct fourcc_list_struct *
-paintrect_find_fourcc (int find_fourcc)
-{
- int i;
-
- for (i = 0; i < n_fourccs; i++) {
- char *s;
- int fourcc;
-
- s = fourcc_list[i].fourcc;
- fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]);
- if (find_fourcc == fourcc) {
- /* If YUV format, it's good */
- if (!fourcc_list[i].type == VTS_YUV) {
- return fourcc_list + i;
- }
-
- return fourcc_list + i;
- }
- }
- return NULL;
-}
-
-struct fourcc_list_struct *
-paintrect_find_name (const char *name)
-{
- int i;
-
- for (i = 0; i < n_fourccs; i++) {
- if (strcmp (name, fourcc_list[i].name) == 0) {
- return fourcc_list + i;
- }
- }
- return NULL;
-}
-
-
-GstStructure *
-paint_get_structure (struct fourcc_list_struct * format)
-{
- GstStructure *structure = NULL;
- unsigned int fourcc;
- int endianness;
-
- g_return_val_if_fail (format, NULL);
-
- fourcc =
- GST_MAKE_FOURCC (format->fourcc[0], format->fourcc[1], format->fourcc[2],
- format->fourcc[3]);
-
- switch (format->type) {
- case VTS_RGB:
- if (format->bitspp == 16) {
- endianness = G_BYTE_ORDER;
- } else {
- endianness = G_BIG_ENDIAN;
- }
- structure = gst_structure_new ("video/x-raw-rgb",
- "bpp", G_TYPE_INT, format->bitspp,
- "endianness", G_TYPE_INT, endianness,
- "depth", G_TYPE_INT, format->depth,
- "red_mask", G_TYPE_INT, format->red_mask,
- "green_mask", G_TYPE_INT, format->green_mask,
- "blue_mask", G_TYPE_INT, format->blue_mask, NULL);
- if (format->depth == 32 && format->alpha_mask > 0) {
- gst_structure_set (structure, "alpha_mask", G_TYPE_INT,
- format->alpha_mask, NULL);
- }
- break;
- case VTS_GRAY:
- structure = gst_structure_new ("video/x-raw-gray",
- "bpp", G_TYPE_INT, format->bitspp, "depth", G_TYPE_INT,
- format->bitspp, NULL);
- if (format->bitspp == 16)
- gst_structure_set (structure, "endianness", G_TYPE_INT, G_BYTE_ORDER,
- NULL);
- break;
- case VTS_YUV:
- structure = gst_structure_new ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, fourcc, NULL);
- break;
- case VTS_BAYER:
- structure = gst_structure_new ("video/x-raw-bayer", NULL);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
- return structure;
-}
-
-/* returns the size in bytes for one video frame of the given dimensions
- * given the fourcc in GstVideoTestSrc */
-int
-gst_video_test_src_get_size (GstVideoTestSrc * v, int w, int h)
-{
- paintinfo pi = { NULL, };
- paintinfo *p = &pi;
- struct fourcc_list_struct *fourcc;
-
- p->width = w;
- p->height = h;
- fourcc = v->fourcc;
- if (fourcc == NULL)
- return 0;
-
- fourcc->paint_setup (p, NULL);
-
- return (unsigned long) p->endptr;
-}
-
-void
-gst_video_test_src_smpte (GstVideoTestSrc * v, unsigned char *dest, int w,
- int h)
-{
- int i;
- int y1, y2;
- int j;
- paintinfo pi = { NULL, };
- paintinfo *p = &pi;
- struct fourcc_list_struct *fourcc;
-
- p->rgb_colors = vts_colors_rgb;
- if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
- p->yuv_colors = vts_colors_bt601_ycbcr_100;
- } else {
- p->yuv_colors = vts_colors_bt709_ycbcr_100;
- }
- p->gray_colors = vts_colors_gray_100;
- p->width = w;
- p->height = h;
- fourcc = v->fourcc;
- if (fourcc == NULL)
- return;
-
- fourcc->paint_setup (p, dest);
- p->paint_hline = fourcc->paint_hline;
-
- y1 = 2 * h / 3;
- y2 = h * 0.75;
-
- /* color bars */
- for (i = 0; i < 7; i++) {
- int x1 = i * w / 7;
- int x2 = (i + 1) * w / 7;
-
- p->yuv_color = p->yuv_colors + i;
- p->rgb_color = p->rgb_colors + i;
- p->gray_color = p->gray_colors + i;
- for (j = 0; j < y1; j++) {
- p->paint_hline (p, x1, j, (x2 - x1));
- }
- }
-
- /* inverse blue bars */
- for (i = 0; i < 7; i++) {
- int x1 = i * w / 7;
- int x2 = (i + 1) * w / 7;
- int k;
-
- if (i & 1) {
- k = 7;
- } else {
- k = 6 - i;
- }
- p->yuv_color = p->yuv_colors + k;
- p->rgb_color = p->rgb_colors + k;
- p->gray_color = p->gray_colors + k;
- for (j = y1; j < y2; j++) {
- p->paint_hline (p, x1, j, (x2 - x1));
- }
- }
-
- /* -I, white, Q regions */
- for (i = 0; i < 3; i++) {
- int x1 = i * w / 6;
- int x2 = (i + 1) * w / 6;
- int k;
-
- if (i == 0) {
- k = 8;
- } else if (i == 1) {
- k = 0;
- } else
- k = 9;
-
- p->yuv_color = p->yuv_colors + k;
- p->rgb_color = p->rgb_colors + k;
- p->gray_color = p->gray_colors + k;
- for (j = y2; j < h; j++) {
- p->paint_hline (p, x1, j, (x2 - x1));
- }
- }
-
- /* superblack, black, dark grey */
- for (i = 0; i < 3; i++) {
- int x1 = w / 2 + i * w / 12;
- int x2 = w / 2 + (i + 1) * w / 12;
- int k;
-
- if (i == 0) {
- k = COLOR_SUPER_BLACK;
- } else if (i == 1) {
- k = COLOR_BLACK;
- } else
- k = COLOR_DARK_GREY;
-
- p->yuv_color = p->yuv_colors + k;
- p->rgb_color = p->rgb_colors + k;
- p->gray_color = p->gray_colors + k;
- for (j = y2; j < h; j++) {
- p->paint_hline (p, x1, j, (x2 - x1));
- }
- }
-
- {
- int x1 = w * 3 / 4;
- struct vts_color_struct_rgb rgb_color;
- struct vts_color_struct_yuv yuv_color;
- struct vts_color_struct_gray gray_color;
-
- rgb_color = p->rgb_colors[COLOR_BLACK];
- yuv_color = p->yuv_colors[COLOR_BLACK];
- gray_color = p->gray_colors[COLOR_BLACK];
- p->rgb_color = &rgb_color;
- p->yuv_color = &yuv_color;
- p->gray_color = &gray_color;
-
- for (i = x1; i < w; i++) {
- for (j = y2; j < h; j++) {
- /* FIXME not strictly correct */
- int y = random_char ();
- yuv_color.Y = y;
- rgb_color.R = y;
- rgb_color.G = y;
- rgb_color.B = y;
- gray_color.G = (y << 8) | random_char ();
- p->paint_hline (p, i, j, 1);
- }
- }
-
- }
-}
-
-void
-gst_video_test_src_smpte75 (GstVideoTestSrc * v, unsigned char *dest, int w,
- int h)
-{
- int i;
- int j;
- paintinfo pi = { NULL, };
- paintinfo *p = &pi;
- struct fourcc_list_struct *fourcc;
-
- p->rgb_colors = vts_colors_rgb_75;
- if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
- p->yuv_colors = vts_colors_bt601_ycbcr_75;
- } else {
- p->yuv_colors = vts_colors_bt709_ycbcr_75;
- }
- p->gray_colors = vts_colors_gray_75;
- p->width = w;
- p->height = h;
- fourcc = v->fourcc;
- if (fourcc == NULL)
- return;
-
- fourcc->paint_setup (p, dest);
- p->paint_hline = fourcc->paint_hline;
-
- /* color bars */
- for (i = 0; i < 7; i++) {
- int x1 = i * w / 7;
- int x2 = (i + 1) * w / 7;
-
- p->yuv_color = p->yuv_colors + i;
- p->rgb_color = p->rgb_colors + i;
- p->gray_color = p->gray_colors + i;
- for (j = 0; j < h; j++) {
- p->paint_hline (p, x1, j, (x2 - x1));
- }
- }
-}
-
-void
-gst_video_test_src_snow (GstVideoTestSrc * v, unsigned char *dest, int w, int h)
-{
- int i;
- int j;
- paintinfo pi = { NULL, };
- paintinfo *p = &pi;
- struct fourcc_list_struct *fourcc;
- struct vts_color_struct_rgb rgb_color;
- struct vts_color_struct_yuv yuv_color;
- struct vts_color_struct_gray gray_color;
-
- p->rgb_colors = vts_colors_rgb;
- if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
- p->yuv_colors = vts_colors_bt601_ycbcr_100;
- } else {
- p->yuv_colors = vts_colors_bt709_ycbcr_100;
- }
- p->gray_colors = vts_colors_gray_100;
- p->width = w;
- p->height = h;
- fourcc = v->fourcc;
- if (fourcc == NULL)
- return;
-
- fourcc->paint_setup (p, dest);
- p->paint_hline = fourcc->paint_hline;
-
- rgb_color = p->rgb_colors[COLOR_BLACK];
- yuv_color = p->yuv_colors[COLOR_BLACK];
- gray_color = p->gray_colors[COLOR_BLACK];
- p->rgb_color = &rgb_color;
- p->yuv_color = &yuv_color;
- p->gray_color = &gray_color;
-
- for (i = 0; i < w; i++) {
- for (j = 0; j < h; j++) {
- /* FIXME not strictly correct */
- int y = random_char ();
- yuv_color.Y = y;
- rgb_color.R = y;
- rgb_color.G = y;
- rgb_color.B = y;
- gray_color.G = (y << 8) | random_char ();
- p->paint_hline (p, i, j, 1);
- }
- }
-}
-
-static void
-gst_video_test_src_unicolor (GstVideoTestSrc * v, unsigned char *dest, int w,
- int h, int color_index)
-{
- int i;
- paintinfo pi = { NULL, };
- paintinfo *p = &pi;
- struct fourcc_list_struct *fourcc;
-
- p->rgb_colors = vts_colors_rgb;
- if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
- p->yuv_colors = vts_colors_bt601_ycbcr_100;
- } else {
- p->yuv_colors = vts_colors_bt709_ycbcr_100;
- }
- p->gray_colors = vts_colors_gray_100;
- p->width = w;
- p->height = h;
- fourcc = v->fourcc;
- if (fourcc == NULL)
- return;
-
- fourcc->paint_setup (p, dest);
- p->paint_hline = fourcc->paint_hline;
-
- p->rgb_color = p->rgb_colors + color_index;
- p->yuv_color = p->yuv_colors + color_index;
- p->gray_color = p->gray_colors + color_index;
-
- for (i = 0; i < h; i++) {
- p->paint_hline (p, 0, i, w);
- }
-}
-
-void
-gst_video_test_src_black (GstVideoTestSrc * v, guchar * dest, int w, int h)
-{
- gst_video_test_src_unicolor (v, dest, w, h, COLOR_BLACK);
-}
-
-void
-gst_video_test_src_white (GstVideoTestSrc * v, guchar * dest, int w, int h)
-{
- gst_video_test_src_unicolor (v, dest, w, h, COLOR_WHITE);
-}
-
-void
-gst_video_test_src_red (GstVideoTestSrc * v, guchar * dest, int w, int h)
-{
- gst_video_test_src_unicolor (v, dest, w, h, COLOR_RED);
-}
-
-void
-gst_video_test_src_green (GstVideoTestSrc * v, guchar * dest, int w, int h)
-{
- gst_video_test_src_unicolor (v, dest, w, h, COLOR_GREEN);
-}
-
-void
-gst_video_test_src_blue (GstVideoTestSrc * v, guchar * dest, int w, int h)
-{
- gst_video_test_src_unicolor (v, dest, w, h, COLOR_BLUE);
-}
-
-void
-gst_video_test_src_checkers1 (GstVideoTestSrc * v, guchar * dest, int w, int h)
-{
- int x, y;
- paintinfo pi = { NULL, };
- paintinfo *p = &pi;
- struct fourcc_list_struct *fourcc;
-
- p->rgb_colors = vts_colors_rgb;
- if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
- p->yuv_colors = vts_colors_bt601_ycbcr_100;
- } else {
- p->yuv_colors = vts_colors_bt709_ycbcr_100;
- }
- p->gray_colors = vts_colors_gray_100;
- p->width = w;
- p->height = h;
- fourcc = v->fourcc;
- if (fourcc == NULL)
- return;
-
- fourcc->paint_setup (p, dest);
- p->paint_hline = fourcc->paint_hline;
-
- for (y = 0; y < h; y++) {
- p->rgb_color = p->rgb_colors + COLOR_GREEN;
- p->yuv_color = p->yuv_colors + COLOR_GREEN;
- p->gray_color = p->gray_colors + COLOR_GREEN;
- p->paint_hline (p, 0, y, w);
- for (x = (y % 2); x < w; x += 2) {
- p->rgb_color = p->rgb_colors + COLOR_RED;
- p->yuv_color = p->yuv_colors + COLOR_RED;
- p->gray_color = p->gray_colors + COLOR_RED;
- p->paint_hline (p, x, y, 1);
- }
- }
-}
-
-void
-gst_video_test_src_checkers2 (GstVideoTestSrc * v, guchar * dest, int w, int h)
-{
- int x, y;
- paintinfo pi = { NULL, };
- paintinfo *p = &pi;
- struct fourcc_list_struct *fourcc;
-
- p->rgb_colors = vts_colors_rgb;
- if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
- p->yuv_colors = vts_colors_bt601_ycbcr_100;
- } else {
- p->yuv_colors = vts_colors_bt709_ycbcr_100;
- }
- p->gray_colors = vts_colors_gray_100;
- p->width = w;
- p->height = h;
- fourcc = v->fourcc;
- if (fourcc == NULL)
- return;
-
- fourcc->paint_setup (p, dest);
- p->paint_hline = fourcc->paint_hline;
-
- p->rgb_color = p->rgb_colors + COLOR_GREEN;
- p->yuv_color = p->yuv_colors + COLOR_GREEN;
- p->gray_color = p->gray_colors + COLOR_GREEN;
- for (y = 0; y < h; y++) {
- p->paint_hline (p, 0, y, w);
- }
-
- for (y = 0; y < h; y += 2) {
- for (x = ((y % 4) == 0) ? 0 : 2; x < w; x += 4) {
- guint len = (x < (w - 1)) ? 2 : (w - x);
-
- p->rgb_color = p->rgb_colors + COLOR_RED;
- p->yuv_color = p->yuv_colors + COLOR_RED;
- p->gray_color = p->gray_colors + COLOR_RED;
- p->paint_hline (p, x, y + 0, len);
- if (G_LIKELY ((y + 1) < h)) {
- p->paint_hline (p, x, y + 1, len);
- }
- }
- }
-}
-
-void
-gst_video_test_src_checkers4 (GstVideoTestSrc * v, guchar * dest, int w, int h)
-{
- int x, y;
- paintinfo pi = { NULL, };
- paintinfo *p = &pi;
- struct fourcc_list_struct *fourcc;
-
- p->rgb_colors = vts_colors_rgb;
- if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
- p->yuv_colors = vts_colors_bt601_ycbcr_100;
- } else {
- p->yuv_colors = vts_colors_bt709_ycbcr_100;
- }
- p->gray_colors = vts_colors_gray_100;
- p->width = w;
- p->height = h;
- fourcc = v->fourcc;
- if (fourcc == NULL)
- return;
-
- fourcc->paint_setup (p, dest);
- p->paint_hline = fourcc->paint_hline;
-
- p->rgb_color = p->rgb_colors + COLOR_GREEN;
- p->yuv_color = p->yuv_colors + COLOR_GREEN;
- p->gray_color = p->gray_colors + COLOR_GREEN;
- for (y = 0; y < h; y++) {
- p->paint_hline (p, 0, y, w);
- }
-
- for (y = 0; y < h; y += 4) {
- for (x = ((y % 8) == 0) ? 0 : 4; x < w; x += 8) {
- guint len = (x < (w - 3)) ? 4 : (w - x);
-
- p->rgb_color = p->rgb_colors + COLOR_RED;
- p->yuv_color = p->yuv_colors + COLOR_RED;
- p->gray_color = p->gray_colors + COLOR_RED;
- p->paint_hline (p, x, y + 0, len);
- if (G_LIKELY ((y + 1) < h)) {
- p->paint_hline (p, x, y + 1, len);
- if (G_LIKELY ((y + 2) < h)) {
- p->paint_hline (p, x, y + 2, len);
- if (G_LIKELY ((y + 3) < h)) {
- p->paint_hline (p, x, y + 3, len);
- }
- }
- }
- }
- }
-}
-
-void
-gst_video_test_src_checkers8 (GstVideoTestSrc * v, guchar * dest, int w, int h)
-{
- int x, y;
- paintinfo pi = { NULL, };
- paintinfo *p = &pi;
- struct fourcc_list_struct *fourcc;
-
- p->rgb_colors = vts_colors_rgb;
- if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
- p->yuv_colors = vts_colors_bt601_ycbcr_100;
- } else {
- p->yuv_colors = vts_colors_bt709_ycbcr_100;
- }
- p->gray_colors = vts_colors_gray_100;
- p->width = w;
- p->height = h;
- fourcc = v->fourcc;
- if (fourcc == NULL)
- return;
-
- fourcc->paint_setup (p, dest);
- p->paint_hline = fourcc->paint_hline;
-
- p->rgb_color = p->rgb_colors + COLOR_GREEN;
- p->yuv_color = p->yuv_colors + COLOR_GREEN;
- p->gray_color = p->gray_colors + COLOR_GREEN;
- for (y = 0; y < h; y++) {
- for (x = 0; x < w; x += 8) {
- int len = MIN (8, w - x);
-
- if ((x ^ y) & (1 << 3)) {
- p->rgb_color = p->rgb_colors + COLOR_GREEN;
- p->yuv_color = p->yuv_colors + COLOR_GREEN;
- p->gray_color = p->gray_colors + COLOR_GREEN;
- } else {
- p->rgb_color = p->rgb_colors + COLOR_RED;
- p->yuv_color = p->yuv_colors + COLOR_RED;
- p->gray_color = p->gray_colors + COLOR_RED;
- }
- p->paint_hline (p, x, y, len);
- }
- }
-}
-
-void
-gst_video_test_src_zoneplate (GstVideoTestSrc * v, unsigned char *dest,
- int w, int h)
-{
- int i;
- int j;
- paintinfo pi = { NULL, };
- paintinfo *p = &pi;
- struct fourcc_list_struct *fourcc;
- struct vts_color_struct_rgb rgb_color;
- struct vts_color_struct_yuv yuv_color;
- struct vts_color_struct_gray gray_color;
- static uint8_t sine_array[256];
- static int sine_array_inited = FALSE;
-
- static int t = 0; /* time - increment phase vs time by 1 for each generated frame */
- /* this may not fit with the correct gstreamer notion of time, so maybe FIXME? */
-
- int xreset = -(w / 2) - v->xoffset; /* starting values for x^2 and y^2, centering the ellipse */
- int yreset = -(h / 2) - v->yoffset;
-
- int x, y;
- int accum_kx;
- int accum_kxt;
- int accum_ky;
- int accum_kyt;
- int accum_kxy;
- int kt;
- int kt2;
- int ky2;
- int delta_kxt = v->kxt * t;
- int delta_kxy;
- int scale_kxy = 0xffff / (w / 2);
- int scale_kx2 = 0xffff / w;
-
- if (!sine_array_inited) {
- int black = 16;
- int white = 235;
- int range = white - black;
- for (i = 0; i < 256; i++) {
- sine_array[i] =
- floor (range * (0.5 + 0.5 * sin (i * 2 * M_PI / 256)) + 0.5 + black);
- }
- sine_array_inited = TRUE;
- }
-
- p->rgb_colors = vts_colors_rgb;
- if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
- p->yuv_colors = vts_colors_bt601_ycbcr_100;
- } else {
- p->yuv_colors = vts_colors_bt709_ycbcr_100;
- }
- p->gray_colors = vts_colors_gray_100;
- p->width = w;
- p->height = h;
- fourcc = v->fourcc;
- if (fourcc == NULL)
- return;
-
- fourcc->paint_setup (p, dest);
- p->paint_hline = fourcc->paint_hline;
-
- rgb_color = p->rgb_colors[COLOR_BLACK];
- yuv_color = p->yuv_colors[COLOR_BLACK];
- gray_color = p->gray_colors[COLOR_BLACK];
- p->rgb_color = &rgb_color;
- p->yuv_color = &yuv_color;
- p->gray_color = &gray_color;
-
- /* Zoneplate equation:
- *
- * phase = k0 + kx*x + ky*y + kt*t
- * + kxt*x*t + kyt*y*t + kxy*x*y
- * + kx2*x*x + ky2*y*y + Kt2*t*t
- */
-
-#if 0
- for (j = 0, y = yreset; j < h; j++, y++) {
- for (i = 0, x = xreset; i < w; i++, x++) {
-
- //zero order
- int phase = v->k0;
-
- //first order
- phase = phase + (v->kx * i) + (v->ky * j) + (v->kt * t);
-
- //cross term
- //phase = phase + (v->kxt * i * t) + (v->kyt * j * t);
- //phase = phase + (v->kxy * x * y) / (w/2);
-
- /*second order */
- /*normalise x/y terms to rate of change of phase at the picture edge */
- phase =
- phase + ((v->kx2 * x * x) / w) + ((v->ky2 * y * y) / h) +
- ((v->kt2 * t * t) >> 1);
-
- color.Y = sine_array[phase & 0xff];
-
- color.R = color.Y;
- color.G = color.Y;
- color.B = color.Y;
- p->paint_hline (p, i, j, 1);
- }
- }
-#endif
-
- /* optimised version, with original code shown in comments */
- accum_ky = 0;
- accum_kyt = 0;
- kt = v->kt * t;
- kt2 = v->kt2 * t * t;
- for (j = 0, y = yreset; j < h; j++, y++) {
- accum_kx = 0;
- accum_kxt = 0;
- accum_ky += v->ky;
- accum_kyt += v->kyt * t;
- delta_kxy = v->kxy * y * scale_kxy;
- accum_kxy = delta_kxy * xreset;
- ky2 = (v->ky2 * y * y) / h;
- for (i = 0, x = xreset; i < w; i++, x++) {
-
- //zero order
- int phase = v->k0;
-
- //first order
- accum_kx += v->kx;
- //phase = phase + (v->kx * i) + (v->ky * j) + (v->kt * t);
- phase = phase + accum_kx + accum_ky + kt;
-
- //cross term
- accum_kxt += delta_kxt;
- accum_kxy += delta_kxy;
- //phase = phase + (v->kxt * i * t) + (v->kyt * j * t);
- phase = phase + accum_kxt + accum_kyt;
-
- //phase = phase + (v->kxy * x * y) / (w/2);
- //phase = phase + accum_kxy / (w/2) ;
- phase = phase + (accum_kxy >> 16);
-
- /*second order */
- /*normalise x/y terms to rate of change of phase at the picture edge */
- //phase = phase + ((v->kx2 * x * x)/w) + ((v->ky2 * y * y)/h) + ((v->kt2 * t * t)>>1);
- phase = phase + ((v->kx2 * x * x * scale_kx2) >> 16) + ky2 + (kt2 >> 1);
-
- yuv_color.Y = sine_array[phase & 0xff];
-
- rgb_color.R = yuv_color.Y;
- rgb_color.G = yuv_color.Y;
- rgb_color.B = yuv_color.Y;
-
- gray_color.G = yuv_color.Y << 8;
- p->paint_hline (p, i, j, 1);
- }
- }
-
- t++;
-}
-
-#undef SCALE_AMPLITUDE
-void
-gst_video_test_src_circular (GstVideoTestSrc * v, unsigned char *dest,
- int w, int h)
-{
- int i;
- int j;
- paintinfo pi = { NULL, };
- paintinfo *p = &pi;
- struct fourcc_list_struct *fourcc;
- struct vts_color_struct_rgb rgb_color;
- struct vts_color_struct_yuv yuv_color;
- struct vts_color_struct_gray gray_color;
- static uint8_t sine_array[256];
- static int sine_array_inited = FALSE;
- double freq[8];
-
-#ifdef SCALE_AMPLITUDE
- double ampl[8];
-#endif
- int d;
-
- if (!sine_array_inited) {
- for (i = 0; i < 256; i++) {
- sine_array[i] =
- floor (255 * (0.5 + 0.5 * sin (i * 2 * M_PI / 256)) + 0.5);
- }
- sine_array_inited = TRUE;
- }
-
- p->rgb_colors = vts_colors_rgb;
- if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
- p->yuv_colors = vts_colors_bt601_ycbcr_100;
- } else {
- p->yuv_colors = vts_colors_bt709_ycbcr_100;
- }
- p->gray_colors = vts_colors_gray_100;
- p->width = w;
- p->height = h;
- fourcc = v->fourcc;
- if (fourcc == NULL)
- return;
-
- fourcc->paint_setup (p, dest);
- p->paint_hline = fourcc->paint_hline;
-
- rgb_color = p->rgb_colors[COLOR_BLACK];
- yuv_color = p->yuv_colors[COLOR_BLACK];
- gray_color = p->gray_colors[COLOR_BLACK];
- p->rgb_color = &rgb_color;
- p->yuv_color = &yuv_color;
- p->gray_color = &gray_color;
-
- for (i = 1; i < 8; i++) {
- freq[i] = 200 * pow (2.0, -(i - 1) / 4.0);
-#ifdef SCALE_AMPLITUDE
- {
- double x;
-
- x = 2 * M_PI * freq[i] / w;
- ampl[i] = sin (x) / x;
- }
-#endif
- }
-
- for (i = 0; i < w; i++) {
- for (j = 0; j < h; j++) {
- double dist;
- int seg;
-
- dist =
- sqrt ((2 * i - w) * (2 * i - w) + (2 * j - h) * (2 * j -
- h)) / (2 * w);
- seg = floor (dist * 16);
- if (seg == 0 || seg >= 8) {
- yuv_color.Y = 255;
- gray_color.G = 65535;
- } else {
-#ifdef SCALE_AMPLITUDE
- double a;
-#endif
- d = floor (256 * dist * freq[seg] + 0.5);
-#ifdef SCALE_AMPLITUDE
- a = ampl[seg];
- if (a < 0)
- a = 0;
- yuv_color.Y = 128 + a * (sine_array[d & 0xff] - 128);
- gray_color.G = 128 + a * (sine_array[d & 0xff] - 128);
-#else
- yuv_color.Y = sine_array[d & 0xff];
- gray_color.G = sine_array[d & 0xff];
-#endif
- }
- rgb_color.R = yuv_color.Y;
- rgb_color.G = yuv_color.Y;
- rgb_color.B = yuv_color.Y;
- p->paint_hline (p, i, j, 1);
- }
- }
-}
-
-void
-gst_video_test_src_gamut (GstVideoTestSrc * v, guchar * dest, int w, int h)
-{
- int x, y;
- paintinfo pi = { NULL, };
- paintinfo *p = &pi;
- struct fourcc_list_struct *fourcc;
- struct vts_color_struct_yuv yuv_primary;
- struct vts_color_struct_yuv yuv_secondary;
- struct vts_color_struct_rgb rgb_primary = { 0 };
- struct vts_color_struct_rgb rgb_secondary = { 0 };
- struct vts_color_struct_gray gray_primary = { 0 };
- struct vts_color_struct_gray gray_secondary = { 0 };
-
- p->rgb_colors = vts_colors_rgb;
- if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
- p->yuv_colors = vts_colors_bt601_ycbcr_100;
- } else {
- p->yuv_colors = vts_colors_bt709_ycbcr_100;
- }
- p->gray_colors = vts_colors_gray_100;
- p->width = w;
- p->height = h;
- fourcc = v->fourcc;
- if (fourcc == NULL)
- return;
-
- fourcc->paint_setup (p, dest);
- p->paint_hline = fourcc->paint_hline;
-
- for (y = 0; y < h; y++) {
- int region = (y * 4) / h;
-
- switch (region) {
- case 0: /* black */
- yuv_primary = p->yuv_colors[COLOR_BLACK];
- yuv_secondary = p->yuv_colors[COLOR_BLACK];
- yuv_secondary.Y = 0;
- rgb_primary = p->rgb_colors[COLOR_BLACK];
- rgb_secondary = p->rgb_colors[COLOR_BLACK];
- gray_primary = p->gray_colors[COLOR_BLACK];
- gray_secondary = p->gray_colors[COLOR_BLACK];
- break;
- case 1:
- yuv_primary = p->yuv_colors[COLOR_WHITE];
- yuv_secondary = p->yuv_colors[COLOR_WHITE];
- yuv_secondary.Y = 255;
- rgb_primary = p->rgb_colors[COLOR_WHITE];
- rgb_secondary = p->rgb_colors[COLOR_WHITE];
- gray_primary = p->gray_colors[COLOR_WHITE];
- gray_secondary = p->gray_colors[COLOR_WHITE];
- break;
- case 2:
- yuv_primary = p->yuv_colors[COLOR_RED];
- yuv_secondary = p->yuv_colors[COLOR_RED];
- yuv_secondary.V = 255;
- rgb_primary = p->rgb_colors[COLOR_RED];
- rgb_secondary = p->rgb_colors[COLOR_RED];
- gray_primary = p->gray_colors[COLOR_RED];
- gray_secondary = p->gray_colors[COLOR_RED];
- break;
- case 3:
- yuv_primary = p->yuv_colors[COLOR_BLUE];
- yuv_secondary = p->yuv_colors[COLOR_BLUE];
- yuv_secondary.U = 255;
- rgb_primary = p->rgb_colors[COLOR_BLUE];
- rgb_secondary = p->rgb_colors[COLOR_BLUE];
- gray_primary = p->gray_colors[COLOR_BLUE];
- gray_secondary = p->gray_colors[COLOR_BLUE];
- break;
- }
-
- for (x = 0; x < w; x += 8) {
- int len = MIN (8, w - x);
-
- if ((x ^ y) & (1 << 4)) {
- p->rgb_color = &rgb_primary;
- p->yuv_color = &yuv_primary;
- p->gray_color = &gray_primary;
- } else {
- p->rgb_color = &rgb_secondary;
- p->yuv_color = &yuv_secondary;
- p->gray_color = &gray_secondary;
- }
- p->paint_hline (p, x, y, len);
- }
- }
-}
-
-static void
-paint_setup_I420 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
- p->ustride = GST_ROUND_UP_8 (p->width) / 2;
- p->vp = p->up + p->ustride * GST_ROUND_UP_2 (p->height) / 2;
- p->vstride = GST_ROUND_UP_8 (p->ystride) / 2;
- p->endptr = p->vp + p->vstride * GST_ROUND_UP_2 (p->height) / 2;
-}
-
-static void
-paint_setup_NV12 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
- p->vp = p->up + 1;
- p->ustride = p->ystride;
- p->vstride = p->ystride;
- p->endptr = p->up + (p->ystride * GST_ROUND_UP_2 (p->height)) / 2;
-}
-
-static void
-paint_setup_NV21 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->vp = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
- p->up = p->vp + 1;
- p->ustride = p->ystride;
- p->vstride = p->ystride;
- p->endptr = p->vp + (p->ystride * GST_ROUND_UP_2 (p->height)) / 2;
-}
-
-static void
-paint_hline_I420 (paintinfo * p, int x, int y, int w)
-{
- int x1 = x / 2;
- int w1 = (x + w) / 2 - x1;
- int offset = y * p->ystride;
- int offset1 = (y / 2) * p->ustride;
-
- if (x + w == p->width && p->width % 2 != 0)
- w1++;
- oil_splat_u8_ns (p->yp + offset + x, &p->yuv_color->Y, w);
- oil_splat_u8_ns (p->up + offset1 + x1, &p->yuv_color->U, w1);
- oil_splat_u8_ns (p->vp + offset1 + x1, &p->yuv_color->V, w1);
-}
-
-static void
-paint_hline_NV12_NV21 (paintinfo * p, int x, int y, int w)
-{
- int x1 = x / 2;
- int x2 = (x + w) / 2;
- int offset = y * p->ystride;
- int offsetuv = (y / 2) * p->ustride + (x & ~0x01);
- int uvlength = x2 - x1 + 1;
-
- oil_splat_u8_ns (p->yp + offset + x, &p->yuv_color->Y, w);
- if (uvlength) {
- oil_splat_u8 (p->up + offsetuv, 2, &p->yuv_color->U, uvlength);
- oil_splat_u8 (p->vp + offsetuv, 2, &p->yuv_color->V, uvlength);
- }
-}
-
-static void
-paint_setup_YV12 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->vp = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
- p->vstride = GST_ROUND_UP_8 (p->ystride) / 2;
- p->up = p->vp + p->vstride * GST_ROUND_UP_2 (p->height) / 2;
- p->ustride = GST_ROUND_UP_8 (p->ystride) / 2;
- p->endptr = p->up + p->ustride * GST_ROUND_UP_2 (p->height) / 2;
-}
-
-static void
-paint_setup_v308 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->up = dest + 1;
- p->vp = dest + 2;
- p->ystride = GST_ROUND_UP_4 (p->width * 3);
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_AYUV (paintinfo * p, unsigned char *dest)
-{
- p->ap = dest;
- p->yp = dest + 1;
- p->up = dest + 2;
- p->vp = dest + 3;
- p->ystride = p->width * 4;
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_v410 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest + 0;
- p->up = dest + 0;
- p->vp = dest + 0;
- p->ystride = p->width * 4;
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_v216 (paintinfo * p, unsigned char *dest)
-{
- p->ap = dest;
- p->yp = dest + 2;
- p->up = dest + 0;
- p->vp = dest + 4;
- p->ystride = p->width * 4;
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_v210 (paintinfo * p, unsigned char *dest)
-{
- p->ap = dest;
- p->yp = dest + 0;
- p->up = dest + 0;
- p->vp = dest + 0;
- p->ystride = ((p->width + 47) / 48) * 128; /* no, really. */
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_YUY2 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->up = dest + 1;
- p->vp = dest + 3;
- p->ystride = GST_ROUND_UP_2 (p->width) * 2;
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_UYVY (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest + 1;
- p->up = dest;
- p->vp = dest + 2;
- p->ystride = GST_ROUND_UP_2 (p->width) * 2;
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_YVYU (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->up = dest + 3;
- p->vp = dest + 1;
- p->ystride = GST_ROUND_UP_2 (p->width) * 2;
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_hline_v308 (paintinfo * p, int x, int y, int w)
-{
- int offset;
-
- offset = (y * p->ystride) + (x * 3);
- oil_splat_u8 (p->yp + offset, 3, &p->yuv_color->Y, w);
- oil_splat_u8 (p->up + offset, 3, &p->yuv_color->U, w);
- oil_splat_u8 (p->vp + offset, 3, &p->yuv_color->V, w);
-}
-
-static void
-paint_hline_AYUV (paintinfo * p, int x, int y, int w)
-{
- int offset;
- guint8 alpha = 255;
-
- offset = (y * p->ystride) + (x * 4);
- oil_splat_u8 (p->yp + offset, 4, &p->yuv_color->Y, w);
- oil_splat_u8 (p->up + offset, 4, &p->yuv_color->U, w);
- oil_splat_u8 (p->vp + offset, 4, &p->yuv_color->V, w);
- oil_splat_u8 (p->ap + offset, 4, &alpha, w);
-}
-
-#define TO_16(x) (((x)<<8) | (x))
-#define TO_10(x) (((x)<<2) | ((x)>>6))
-
-static void
-paint_hline_v216 (paintinfo * p, int x, int y, int w)
-{
- int x1 = x / 2;
- int x2 = (x + w) / 2;
- uint16_t Y, U, V;
- int i;
- int offset;
-
- offset = y * p->ystride;
- Y = TO_16 (p->yuv_color->Y);
- U = TO_16 (p->yuv_color->U);
- V = TO_16 (p->yuv_color->V);
- for (i = x; i < x + w; i++) {
- GST_WRITE_UINT16_LE (p->yp + offset + i * 4, Y);
- }
- for (i = x1; i < x2; i++) {
- GST_WRITE_UINT16_LE (p->up + offset + i * 8, U);
- GST_WRITE_UINT16_LE (p->vp + offset + i * 8, V);
- }
-}
-
-static void
-paint_hline_v410 (paintinfo * p, int x, int y, int w)
-{
- uint32_t a;
- uint8_t *data;
- int i;
-
- a = (TO_10 (p->yuv_color->U) << 22) |
- (TO_10 (p->yuv_color->Y) << 12) | (TO_10 (p->yuv_color->V) << 2);
-
- data = p->yp + y * p->ystride + x * 4;
- for (i = 0; i < w; i++) {
- GST_WRITE_UINT32_LE (data, a);
- }
-}
-
-static void
-paint_hline_v210 (paintinfo * p, int x, int y, int w)
-{
- uint32_t a0, a1, a2, a3;
- uint8_t *data;
- int i;
-
- /* FIXME this is kinda gross. it only handles x values in
- multiples of 6 */
-
- a0 = TO_10 (p->yuv_color->U) | (TO_10 (p->yuv_color->Y) << 10)
- | (TO_10 (p->yuv_color->V) << 20);
- a1 = TO_10 (p->yuv_color->Y) | (TO_10 (p->yuv_color->U) << 10)
- | (TO_10 (p->yuv_color->Y) << 20);
- a2 = TO_10 (p->yuv_color->V) | (TO_10 (p->yuv_color->Y) << 10)
- | (TO_10 (p->yuv_color->U) << 20);
- a3 = TO_10 (p->yuv_color->Y) | (TO_10 (p->yuv_color->V) << 10)
- | (TO_10 (p->yuv_color->Y) << 20);
-
- data = p->yp + y * p->ystride;
- for (i = x / 6; i < (x + w) / 6; i++) {
- GST_WRITE_UINT32_LE (data + i * 16 + 0, a0);
- GST_WRITE_UINT32_LE (data + i * 16 + 4, a1);
- GST_WRITE_UINT32_LE (data + i * 16 + 8, a2);
- GST_WRITE_UINT32_LE (data + i * 16 + 12, a3);
- }
-}
-
-static void
-paint_hline_YUY2 (paintinfo * p, int x, int y, int w)
-{
- int x1 = x / 2;
- int w1 = (x + w) / 2 - x1;
- int offset = y * p->ystride;
-
- if (x + w == p->width && p->width % 2 != 0)
- w1++;
- oil_splat_u8 (p->yp + offset + x * 2, 2, &p->yuv_color->Y, w);
- oil_splat_u8 (p->up + offset + x1 * 4, 4, &p->yuv_color->U, w1);
- oil_splat_u8 (p->vp + offset + x1 * 4, 4, &p->yuv_color->V, w1);
-}
-
-static void
-paint_setup_IYU2 (paintinfo * p, unsigned char *dest)
-{
- /* untested */
- p->yp = dest + 1;
- p->up = dest + 0;
- p->vp = dest + 2;
- p->ystride = GST_ROUND_UP_4 (p->width * 3);
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_hline_IYU2 (paintinfo * p, int x, int y, int w)
-{
- int offset;
-
- offset = y * p->ystride;
- oil_splat_u8 (p->yp + offset + x * 3, 3, &p->yuv_color->Y, w);
- oil_splat_u8 (p->up + offset + x * 3, 3, &p->yuv_color->U, w);
- oil_splat_u8 (p->vp + offset + x * 3, 3, &p->yuv_color->V, w);
-}
-
-static void
-paint_setup_Y41B (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * p->height;
- p->ustride = GST_ROUND_UP_16 (p->width) / 4;
- p->vp = p->up + p->ustride * p->height;
- p->vstride = GST_ROUND_UP_16 (p->width) / 4;
- p->endptr = p->vp + p->vstride * p->height;
-}
-
-static void
-paint_hline_Y41B (paintinfo * p, int x, int y, int w)
-{
- int x1 = x / 4;
- int w1 = (x + w) / 4 - x1;
- int offset = y * p->ystride;
- int offset1 = y * p->ustride;
-
- if (x + w == p->width && p->width % 4 != 0)
- w1++;
- oil_splat_u8_ns (p->yp + offset + x, &p->yuv_color->Y, w);
- oil_splat_u8_ns (p->up + offset1 + x1, &p->yuv_color->U, w1);
- oil_splat_u8_ns (p->vp + offset1 + x1, &p->yuv_color->V, w1);
-}
-
-static void
-paint_setup_Y42B (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * p->height;
- p->ustride = GST_ROUND_UP_8 (p->width) / 2;
- p->vp = p->up + p->ustride * p->height;
- p->vstride = GST_ROUND_UP_8 (p->width) / 2;
- p->endptr = p->vp + p->vstride * p->height;
-}
-
-static void
-paint_hline_Y42B (paintinfo * p, int x, int y, int w)
-{
- int x1 = x / 2;
- int w1 = (x + w) / 2 - x1;
- int offset = y * p->ystride;
- int offset1 = y * p->ustride;
-
- if (x + w == p->width && p->width % 2 != 0)
- w1++;
- oil_splat_u8_ns (p->yp + offset + x, &p->yuv_color->Y, w);
- oil_splat_u8_ns (p->up + offset1 + x1, &p->yuv_color->U, w1);
- oil_splat_u8_ns (p->vp + offset1 + x1, &p->yuv_color->V, w1);
-}
-
-static void
-paint_setup_Y444 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * p->height;
- p->vp = p->up + p->ystride * p->height;
- p->endptr = p->vp + p->ystride * p->height;
-}
-
-static void
-paint_hline_Y444 (paintinfo * p, int x, int y, int w)
-{
- int offset = y * p->ystride;
-
- oil_splat_u8_ns (p->yp + offset + x, &p->yuv_color->Y, w);
- oil_splat_u8_ns (p->up + offset + x, &p->yuv_color->U, w);
- oil_splat_u8_ns (p->vp + offset + x, &p->yuv_color->V, w);
-}
-
-static void
-paint_setup_Y800 (paintinfo * p, unsigned char *dest)
-{
- /* untested */
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_hline_Y800 (paintinfo * p, int x, int y, int w)
-{
- int offset = y * p->ystride;
-
- oil_splat_u8_ns (p->yp + offset + x, &p->yuv_color->Y, w);
-}
-
-#if 0
-static void
-paint_setup_IMC1 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->up = dest + p->width * p->height;
- p->vp = dest + p->width * p->height + p->width * p->height / 2;
-}
-
-static void
-paint_setup_IMC2 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->vp = dest + p->width * p->height;
- p->up = dest + p->width * p->height + p->width / 2;
-}
-
-static void
-paint_setup_IMC3 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->up = dest + p->width * p->height + p->width * p->height / 2;
- p->vp = dest + p->width * p->height;
-}
-
-static void
-paint_setup_IMC4 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->vp = dest + p->width * p->height + p->width / 2;
- p->up = dest + p->width * p->height;
-}
-
-static void
-paint_hline_IMC1 (paintinfo * p, int x, int y, int w)
-{
- int x1 = x / 2;
- int x2 = (x + w) / 2;
- int offset = y * p->width;
- int offset1 = (y / 2) * p->width;
-
- oil_splat_u8_ns (p->yp + offset + x, &p->yuv_color->Y, w);
- oil_splat_u8_ns (p->up + offset1 + x1, &p->yuv_color->U, x2 - x1);
- oil_splat_u8_ns (p->vp + offset1 + x1, &p->yuv_color->V, x2 - x1);
-}
-#endif
-
-static void
-paint_setup_YVU9 (paintinfo * p, unsigned char *dest)
-{
- int h = GST_ROUND_UP_4 (p->height);
-
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->vp = p->yp + p->ystride * h;
- p->vstride = GST_ROUND_UP_4 (p->ystride / 4);
- p->up = p->vp + p->vstride * h / 4;
- p->ustride = GST_ROUND_UP_4 (p->ystride / 4);
- p->endptr = p->up + p->ustride * h / 4;
-}
-
-static void
-paint_setup_YUV9 (paintinfo * p, unsigned char *dest)
-{
- /* untested */
- int h = GST_ROUND_UP_4 (p->height);
-
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * h;
- p->ustride = GST_ROUND_UP_4 (p->ystride / 4);
- p->vp = p->up + p->ustride * h / 4;
- p->vstride = GST_ROUND_UP_4 (p->ystride / 4);
- p->endptr = p->vp + p->vstride * h / 4;
-}
-
-static void
-paint_hline_YUV9 (paintinfo * p, int x, int y, int w)
-{
- int x1 = x / 4;
- int w1 = (x + w) / 4 - x1;
- int offset = y * p->ystride;
- int offset1 = (y / 4) * p->ustride;
-
- if (x + w == p->width && p->width % 4 != 0)
- w1++;
- oil_splat_u8_ns (p->yp + offset + x, &p->yuv_color->Y, w);
- oil_splat_u8_ns (p->up + offset1 + x1, &p->yuv_color->U, w1);
- oil_splat_u8_ns (p->vp + offset1 + x1, &p->yuv_color->V, w1);
-}
-
-static void
-paint_setup_ARGB8888 (paintinfo * p, unsigned char *dest)
-{
- paint_setup_xRGB8888 (p, dest);
- p->ap = dest;
-}
-
-static void
-paint_setup_ABGR8888 (paintinfo * p, unsigned char *dest)
-{
- paint_setup_xBGR8888 (p, dest);
- p->ap = dest;
-}
-
-static void
-paint_setup_RGBA8888 (paintinfo * p, unsigned char *dest)
-{
- paint_setup_RGBx8888 (p, dest);
- p->ap = dest + 3;
-}
-
-static void
-paint_setup_BGRA8888 (paintinfo * p, unsigned char *dest)
-{
- paint_setup_BGRx8888 (p, dest);
- p->ap = dest + 3;
-}
-
-static void
-paint_setup_xRGB8888 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest + 1;
- p->up = dest + 2;
- p->vp = dest + 3;
- p->ystride = p->width * 4;
- p->endptr = p->dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_xBGR8888 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest + 3;
- p->up = dest + 2;
- p->vp = dest + 1;
- p->ystride = p->width * 4;
- p->endptr = p->dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_RGBx8888 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest + 0;
- p->up = dest + 1;
- p->vp = dest + 2;
- p->ystride = p->width * 4;
- p->endptr = p->dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_BGRx8888 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest + 2;
- p->up = dest + 1;
- p->vp = dest + 0;
- p->ystride = p->width * 4;
- p->endptr = p->dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_RGB888 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest + 0;
- p->up = dest + 1;
- p->vp = dest + 2;
- p->ystride = GST_ROUND_UP_4 (p->width * 3);
- p->endptr = p->dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_BGR888 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest + 2;
- p->up = dest + 1;
- p->vp = dest + 0;
- p->ystride = GST_ROUND_UP_4 (p->width * 3);
- p->endptr = p->dest + p->ystride * p->height;
-}
-
-static void
-paint_hline_str4 (paintinfo * p, int x, int y, int w)
-{
- int offset = y * p->ystride;
- guint8 alpha = 255;
-
- oil_splat_u8 (p->yp + offset + x * 4, 4, &p->rgb_color->R, w);
- oil_splat_u8 (p->up + offset + x * 4, 4, &p->rgb_color->G, w);
- oil_splat_u8 (p->vp + offset + x * 4, 4, &p->rgb_color->B, w);
-
- if (p->ap != NULL) {
- oil_splat_u8 (p->ap + offset + (x * 4), 4, &alpha, w);
- }
-}
-
-static void
-paint_hline_str3 (paintinfo * p, int x, int y, int w)
-{
- int offset = y * p->ystride;
-
- oil_splat_u8 (p->yp + offset + x * 3, 3, &p->rgb_color->R, w);
- oil_splat_u8 (p->up + offset + x * 3, 3, &p->rgb_color->G, w);
- oil_splat_u8 (p->vp + offset + x * 3, 3, &p->rgb_color->B, w);
-}
-
-static void
-paint_setup_RGB565 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width * 2);
- p->endptr = p->dest + p->ystride * p->height;
-}
-
-static void
-paint_hline_RGB565 (paintinfo * p, int x, int y, int w)
-{
- int offset = y * p->ystride;
- uint8_t a, b;
-
- a = (p->rgb_color->R & 0xf8) | (p->rgb_color->G >> 5);
- b = ((p->rgb_color->G << 3) & 0xe0) | (p->rgb_color->B >> 3);
-
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
- oil_splat_u8 (p->yp + offset + x * 2 + 0, 2, &b, w);
- oil_splat_u8 (p->yp + offset + x * 2 + 1, 2, &a, w);
-#else
- oil_splat_u8 (p->yp + offset + x * 2 + 0, 2, &a, w);
- oil_splat_u8 (p->yp + offset + x * 2 + 1, 2, &b, w);
-#endif
-}
-
-static void
-paint_setup_xRGB1555 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width * 2);
- p->endptr = p->dest + p->ystride * p->height;
-}
-
-static void
-paint_hline_xRGB1555 (paintinfo * p, int x, int y, int w)
-{
- int offset = y * p->ystride;
- uint8_t a, b;
-
- a = ((p->rgb_color->R >> 1) & 0x7c) | (p->rgb_color->G >> 6);
- b = ((p->rgb_color->G << 2) & 0xe0) | (p->rgb_color->B >> 3);
-
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
- oil_splat_u8 (p->yp + offset + x * 2 + 0, 2, &b, w);
- oil_splat_u8 (p->yp + offset + x * 2 + 1, 2, &a, w);
-#else
- oil_splat_u8 (p->yp + offset + x * 2 + 0, 2, &a, w);
- oil_splat_u8 (p->yp + offset + x * 2 + 1, 2, &b, w);
-#endif
-}
-
-
-static void
-paint_setup_bayer (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->endptr = p->dest + p->ystride * p->height;
-}
-
-static void
-paint_hline_bayer (paintinfo * p, int x, int y, int w)
-{
- int offset = y * p->ystride;
- uint8_t *dest = p->yp + offset;
- int i;
-
- if (y & 1) {
- for (i = x; i < x + w; i++) {
- if (i & 1) {
- dest[i] = p->rgb_color->G;
- } else {
- dest[i] = p->rgb_color->B;
- }
- }
- } else {
- for (i = x; i < x + w; i++) {
- if (i & 1) {
- dest[i] = p->rgb_color->R;
- } else {
- dest[i] = p->rgb_color->G;
- }
- }
- }
-}
-
-static void
-paint_setup_GRAY8 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_hline_GRAY8 (paintinfo * p, int x, int y, int w)
-{
- int offset = y * p->ystride;
- guint8 color = p->gray_color->G >> 8;
-
- oil_splat_u8_ns (p->yp + offset + x, &color, w);
-}
-
-static void
-paint_setup_GRAY16 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width * 2);
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_hline_GRAY16 (paintinfo * p, int x, int y, int w)
-{
- int offset = y * p->ystride;
-
- oil_splat_u16_ns ((guint16 *) (p->yp + offset + 2 * x), &p->gray_color->G, w);
-}
diff --git a/gst/videotestsrc/videotestsrc.h b/gst/videotestsrc/videotestsrc.h
deleted file mode 100644
index f3f823f0..00000000
--- a/gst/videotestsrc/videotestsrc.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __VIDEO_TEST_SRC_H__
-#define __VIDEO_TEST_SRC_H__
-
-#include <glib.h>
-
-enum {
- VTS_YUV,
- VTS_RGB,
- VTS_GRAY,
- VTS_BAYER
-};
-
-struct vts_color_struct_yuv {
- guint8 Y, U, V;
-};
-struct vts_color_struct_rgb {
- guint8 R, G, B;
-};
-struct vts_color_struct_gray {
- guint16 G;
-};
-
-typedef struct paintinfo_struct paintinfo;
-struct paintinfo_struct
-{
- unsigned char *dest; /* pointer to first byte of video data */
- unsigned char *yp, *up, *vp; /* pointers to first byte of each component
- * for both packed/planar YUV and RGB */
- unsigned char *ap; /* pointer to first byte of alpha component */
- unsigned char *endptr; /* pointer to byte beyond last video data */
- int ystride;
- int ustride;
- int vstride;
- int width;
- int height;
- const struct vts_color_struct_rgb *rgb_colors;
- const struct vts_color_struct_yuv *yuv_colors;
- const struct vts_color_struct_gray *gray_colors;
- const struct vts_color_struct_rgb *rgb_color;
- const struct vts_color_struct_yuv *yuv_color;
- const struct vts_color_struct_gray *gray_color;
- //const struct vts_color_struct *color;
- void (*paint_hline) (paintinfo * p, int x, int y, int w);
-};
-
-struct fourcc_list_struct
-{
- int type;
- char *fourcc;
- char *name;
- int bitspp;
- void (*paint_setup) (paintinfo * p, unsigned char *dest);
- void (*paint_hline) (paintinfo * p, int x, int y, int w);
- int depth;
- unsigned int red_mask;
- unsigned int green_mask;
- unsigned int blue_mask;
- unsigned int alpha_mask;
-};
-
-struct fourcc_list_struct *
- paintrect_find_fourcc (int find_fourcc);
-struct fourcc_list_struct *
- paintrect_find_name (const char *name);
-struct fourcc_list_struct *
- paintinfo_find_by_structure (const GstStructure *structure);
-GstStructure *
- paint_get_structure (struct fourcc_list_struct *format);
-int gst_video_test_src_get_size (GstVideoTestSrc * v, int w, int h);
-void gst_video_test_src_smpte (GstVideoTestSrc * v,
- unsigned char *dest, int w, int h);
-void gst_video_test_src_smpte75 (GstVideoTestSrc * v,
- unsigned char *dest, int w, int h);
-void gst_video_test_src_snow (GstVideoTestSrc * v,
- unsigned char *dest, int w, int h);
-void gst_video_test_src_black (GstVideoTestSrc * v,
- unsigned char *dest, int w, int h);
-void gst_video_test_src_white (GstVideoTestSrc * v,
- unsigned char *dest, int w, int h);
-void gst_video_test_src_red (GstVideoTestSrc * v,
- unsigned char *dest, int w, int h);
-void gst_video_test_src_green (GstVideoTestSrc * v,
- unsigned char *dest, int w, int h);
-void gst_video_test_src_blue (GstVideoTestSrc * v,
- unsigned char *dest, int w, int h);
-void gst_video_test_src_checkers1 (GstVideoTestSrc * v,
- unsigned char *dest, int w, int h);
-void gst_video_test_src_checkers2 (GstVideoTestSrc * v,
- unsigned char *dest, int w, int h);
-void gst_video_test_src_checkers4 (GstVideoTestSrc * v,
- unsigned char *dest, int w, int h);
-void gst_video_test_src_checkers8 (GstVideoTestSrc * v,
- unsigned char *dest, int w, int h);
-void gst_video_test_src_circular (GstVideoTestSrc * v,
- unsigned char *dest, int w, int h);
-void gst_video_test_src_zoneplate (GstVideoTestSrc * v,
- unsigned char *dest, int w, int h);
-void gst_video_test_src_gamut (GstVideoTestSrc * v,
- unsigned char *dest, int w, int h);
-extern struct fourcc_list_struct fourcc_list[];
-extern int n_fourccs;
-
-#endif
diff --git a/gst/videotestsrc/videotestsrc.vcproj b/gst/videotestsrc/videotestsrc.vcproj
deleted file mode 100644
index baff9fe0..00000000
--- a/gst/videotestsrc/videotestsrc.vcproj
+++ /dev/null
@@ -1,154 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="videotestsrc"
- ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D678DF}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../win32/Debug"
- IntermediateDirectory="../../win32/Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;videotestsrc_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstvideotestsrc.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Debug;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/videotestsrc.pdb"
- SubSystem="2"
- OptimizeReferences="2"
- ImportLibrary="$(OutDir)/gstvideotestsrc.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../win32/Release"
- IntermediateDirectory="../../win32/Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;videotestsrc_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstvideotestsrc.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Release;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/gstvideotestsrc.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath=".\gstvideotestsrc.c">
- </File>
- <File
- RelativePath=".\videotestsrc.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- <File
- RelativePath=".\videotestsrc.h">
- </File>
- <File
- RelativePath=".\gstvideotestsrc.h">
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/gst/volume/.gitignore b/gst/volume/.gitignore
deleted file mode 100644
index 1549b67c..00000000
--- a/gst/volume/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-demo
diff --git a/gst/volume/Makefile.am b/gst/volume/Makefile.am
deleted file mode 100644
index 393b2eff..00000000
--- a/gst/volume/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-plugin_LTLIBRARIES = libgstvolume.la
-
-libgstvolume_la_SOURCES = gstvolume.c
-libgstvolume_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CONTROLLER_CFLAGS) $(GST_CFLAGS) $(LIBOIL_CFLAGS)
-libgstvolume_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstvolume_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la \
- $(top_builddir)/gst-libs/gst/audio/libgstaudio-$(GST_MAJORMINOR).la \
- $(GST_BASE_LIBS) \
- $(GST_CONTROLLER_LIBS) \
- $(GST_LIBS) \
- $(LIBOIL_LIBS)
-libgstvolume_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = gstvolume.h
-
diff --git a/gst/volume/gstvolume.c b/gst/volume/gstvolume.c
deleted file mode 100644
index f859c958..00000000
--- a/gst/volume/gstvolume.c
+++ /dev/null
@@ -1,858 +0,0 @@
-/* -*- c-basic-offset: 2 -*-
- * vi:si:et:sw=2:sts=8:ts=8:expandtab
- *
- * GStreamer
- * Copyright (C) 1999-2001 Erik Walthinsen <omega@cse.ogi.edu>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-volume
- *
- * The volume element changes the volume of the audio data.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch -v -m audiotestsrc ! volume volume=0.5 ! level ! fakesink silent=TRUE
- * ]| This pipeline shows that the level of audiotestsrc has been halved
- * (peak values are around -6 dB and RMS around -9 dB) compared to
- * the same pipeline without the volume element.
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
-#include <gst/audio/audio.h>
-#include <gst/interfaces/mixer.h>
-#include <gst/controller/gstcontroller.h>
-#include <gst/audio/audio.h>
-#include <gst/audio/gstaudiofilter.h>
-#include <liboil/liboil.h>
-
-#include "gstvolume.h"
-
-/* some defines for audio processing */
-/* the volume factor is a range from 0.0 to (arbitrary) VOLUME_MAX_DOUBLE = 10.0
- * we map 1.0 to VOLUME_UNITY_INT*
- */
-#define VOLUME_UNITY_INT8 32 /* internal int for unity 2^(8-3) */
-#define VOLUME_UNITY_INT8_BIT_SHIFT 5 /* number of bits to shift for unity */
-#define VOLUME_UNITY_INT16 8192 /* internal int for unity 2^(16-3) */
-#define VOLUME_UNITY_INT16_BIT_SHIFT 13 /* number of bits to shift for unity */
-#define VOLUME_UNITY_INT24 2097152 /* internal int for unity 2^(24-3) */
-#define VOLUME_UNITY_INT24_BIT_SHIFT 21 /* number of bits to shift for unity */
-#define VOLUME_UNITY_INT32 134217728 /* internal int for unity 2^(32-5) */
-#define VOLUME_UNITY_INT32_BIT_SHIFT 27
-#define VOLUME_MAX_DOUBLE 10.0
-#define VOLUME_MAX_INT8 G_MAXINT8
-#define VOLUME_MIN_INT8 G_MININT8
-#define VOLUME_MAX_INT16 G_MAXINT16
-#define VOLUME_MIN_INT16 G_MININT16
-#define VOLUME_MAX_INT24 8388607
-#define VOLUME_MIN_INT24 -8388608
-#define VOLUME_MAX_INT32 G_MAXINT32
-#define VOLUME_MIN_INT32 G_MININT32
-
-/* number of steps we use for the mixer interface to go from 0.0 to 1.0 */
-# define VOLUME_STEPS 100
-
-#define GST_CAT_DEFAULT gst_volume_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-/* Filter signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-#define DEFAULT_PROP_MUTE FALSE
-#define DEFAULT_PROP_VOLUME 1.0
-
-enum
-{
- PROP_0,
- PROP_MUTE,
- PROP_VOLUME
-};
-
-#define ALLOWED_CAPS \
- "audio/x-raw-float, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) {32, 64}; " \
- "audio/x-raw-int, " \
- "channels = (int) [ 1, MAX ], " \
- "rate = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 8, " \
- "depth = (int) 8, " \
- "signed = (bool) TRUE; " \
- "audio/x-raw-int, " \
- "channels = (int) [ 1, MAX ], " \
- "rate = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 16, " \
- "depth = (int) 16, " \
- "signed = (bool) TRUE; " \
- "audio/x-raw-int, " \
- "channels = (int) [ 1, MAX ], " \
- "rate = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 24, " \
- "depth = (int) 24, " \
- "signed = (bool) TRUE; " \
- "audio/x-raw-int, " \
- "channels = (int) [ 1, MAX ], " \
- "rate = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 32, " \
- "depth = (int) 32, " \
- "signed = (bool) TRUE"
-
-static void gst_volume_interface_init (GstImplementsInterfaceClass * klass);
-static void gst_volume_mixer_init (GstMixerClass * iface);
-
-#define _init_interfaces(type) \
- { \
- static const GInterfaceInfo voliface_info = { \
- (GInterfaceInitFunc) gst_volume_interface_init, \
- NULL, \
- NULL \
- }; \
- static const GInterfaceInfo volmixer_info = { \
- (GInterfaceInitFunc) gst_volume_mixer_init, \
- NULL, \
- NULL \
- }; \
- static const GInterfaceInfo svol_info = { \
- NULL, \
- NULL, \
- NULL \
- }; \
- \
- g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, \
- &voliface_info); \
- g_type_add_interface_static (type, GST_TYPE_MIXER, &volmixer_info); \
- g_type_add_interface_static (type, GST_TYPE_STREAM_VOLUME, &svol_info); \
- }
-
-GST_BOILERPLATE_FULL (GstVolume, gst_volume, GstAudioFilter,
- GST_TYPE_AUDIO_FILTER, _init_interfaces);
-
-static void volume_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void volume_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static void volume_before_transform (GstBaseTransform * base,
- GstBuffer * buffer);
-static GstFlowReturn volume_transform_ip (GstBaseTransform * base,
- GstBuffer * outbuf);
-static gboolean volume_setup (GstAudioFilter * filter,
- GstRingBufferSpec * format);
-
-static void volume_process_double (GstVolume * self, gpointer bytes,
- guint n_bytes);
-static void volume_process_float (GstVolume * self, gpointer bytes,
- guint n_bytes);
-static void volume_process_int32 (GstVolume * self, gpointer bytes,
- guint n_bytes);
-static void volume_process_int32_clamp (GstVolume * self, gpointer bytes,
- guint n_bytes);
-static void volume_process_int24 (GstVolume * self, gpointer bytes,
- guint n_bytes);
-static void volume_process_int24_clamp (GstVolume * self, gpointer bytes,
- guint n_bytes);
-static void volume_process_int16 (GstVolume * self, gpointer bytes,
- guint n_bytes);
-static void volume_process_int16_clamp (GstVolume * self, gpointer bytes,
- guint n_bytes);
-static void volume_process_int8 (GstVolume * self, gpointer bytes,
- guint n_bytes);
-static void volume_process_int8_clamp (GstVolume * self, gpointer bytes,
- guint n_bytes);
-
-
-/* helper functions */
-
-static gboolean
-volume_choose_func (GstVolume * self)
-{
- self->process = NULL;
-
- if (GST_AUDIO_FILTER (self)->format.caps == NULL)
- return FALSE;
-
- switch (GST_AUDIO_FILTER (self)->format.type) {
- case GST_BUFTYPE_LINEAR:
- switch (GST_AUDIO_FILTER (self)->format.width) {
- case 32:
- /* only clamp if the gain is greater than 1.0
- * FIXME: current_vol_i can change while processing the buffer!
- */
- if (self->current_vol_i32 > VOLUME_UNITY_INT32)
- self->process = volume_process_int32_clamp;
- else
- self->process = volume_process_int32;
- break;
- case 24:
- /* only clamp if the gain is greater than 1.0
- * FIXME: current_vol_i can change while processing the buffer!
- */
- if (self->current_vol_i24 > VOLUME_UNITY_INT24)
- self->process = volume_process_int24_clamp;
- else
- self->process = volume_process_int24;
- break;
- case 16:
- /* only clamp if the gain is greater than 1.0
- * FIXME: current_vol_i can change while processing the buffer!
- */
- if (self->current_vol_i16 > VOLUME_UNITY_INT16)
- self->process = volume_process_int16_clamp;
- else
- self->process = volume_process_int16;
- break;
- case 8:
- /* only clamp if the gain is greater than 1.0
- * FIXME: current_vol_i can change while processing the buffer!
- */
- if (self->current_vol_i16 > VOLUME_UNITY_INT8)
- self->process = volume_process_int8_clamp;
- else
- self->process = volume_process_int8;
- break;
- }
- break;
- case GST_BUFTYPE_FLOAT:
- switch (GST_AUDIO_FILTER (self)->format.width) {
- case 32:
- self->process = volume_process_float;
- break;
- case 64:
- self->process = volume_process_double;
- break;
- }
- break;
- default:
- break;
- }
-
- return (self->process != NULL);
-}
-
-static gboolean
-volume_update_volume (GstVolume * self, gfloat volume, gboolean mute)
-{
- gboolean passthrough;
- gboolean res;
-
- GST_DEBUG_OBJECT (self, "configure mute %d, volume %f", mute, volume);
-
- if (mute) {
- self->current_mute = TRUE;
- self->current_volume = 0.0;
-
- self->current_vol_i8 = 0;
- self->current_vol_i16 = 0;
- self->current_vol_i24 = 0;
- self->current_vol_i32 = 0;
-
- passthrough = FALSE;
- } else {
- self->current_mute = FALSE;
- self->current_volume = volume;
-
- self->current_vol_i8 = volume * VOLUME_UNITY_INT8;
- self->current_vol_i16 = volume * VOLUME_UNITY_INT16;
- self->current_vol_i24 = volume * VOLUME_UNITY_INT24;
- self->current_vol_i32 = volume * VOLUME_UNITY_INT32;
-
- passthrough = (self->current_vol_i16 == VOLUME_UNITY_INT16);
- }
-
- GST_DEBUG_OBJECT (self, "set passthrough %d", passthrough);
-
- gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (self), passthrough);
-
- res = self->negotiated = volume_choose_func (self);
-
- return res;
-}
-
-/* Mixer interface */
-
-static gboolean
-gst_volume_interface_supported (GstImplementsInterface * iface, GType type)
-{
- return (type == GST_TYPE_MIXER || type == GST_TYPE_STREAM_VOLUME);
-}
-
-static void
-gst_volume_interface_init (GstImplementsInterfaceClass * klass)
-{
- klass->supported = gst_volume_interface_supported;
-}
-
-static const GList *
-gst_volume_list_tracks (GstMixer * mixer)
-{
- GstVolume *self = GST_VOLUME (mixer);
-
- g_return_val_if_fail (self != NULL, NULL);
- g_return_val_if_fail (GST_IS_VOLUME (self), NULL);
-
- return self->tracklist;
-}
-
-static void
-gst_volume_set_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
-{
- GstVolume *self = GST_VOLUME (mixer);
-
- g_return_if_fail (self != NULL);
- g_return_if_fail (GST_IS_VOLUME (self));
-
- GST_OBJECT_LOCK (self);
- self->volume = (gfloat) volumes[0] / VOLUME_STEPS;
- GST_OBJECT_UNLOCK (self);
-}
-
-static void
-gst_volume_get_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
-{
- GstVolume *self = GST_VOLUME (mixer);
-
- g_return_if_fail (self != NULL);
- g_return_if_fail (GST_IS_VOLUME (self));
-
- GST_OBJECT_LOCK (self);
- volumes[0] = (gint) self->volume * VOLUME_STEPS;
- GST_OBJECT_UNLOCK (self);
-}
-
-static void
-gst_volume_set_mute (GstMixer * mixer, GstMixerTrack * track, gboolean mute)
-{
- GstVolume *self = GST_VOLUME (mixer);
-
- g_return_if_fail (self != NULL);
- g_return_if_fail (GST_IS_VOLUME (self));
-
- GST_OBJECT_LOCK (self);
- self->mute = mute;
- GST_OBJECT_UNLOCK (self);
-}
-
-static void
-gst_volume_mixer_init (GstMixerClass * klass)
-{
- GST_MIXER_TYPE (klass) = GST_MIXER_SOFTWARE;
-
- /* default virtual functions */
- klass->list_tracks = gst_volume_list_tracks;
- klass->set_volume = gst_volume_set_volume;
- klass->get_volume = gst_volume_get_volume;
- klass->set_mute = gst_volume_set_mute;
-}
-
-/* Element class */
-
-static void
-gst_volume_dispose (GObject * object)
-{
- GstVolume *volume = GST_VOLUME (object);
-
- if (volume->tracklist) {
- if (volume->tracklist->data)
- g_object_unref (volume->tracklist->data);
- g_list_free (volume->tracklist);
- volume->tracklist = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_volume_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- GstAudioFilterClass *filter_class = GST_AUDIO_FILTER_CLASS (g_class);
- GstCaps *caps;
-
- gst_element_class_set_details_simple (element_class, "Volume",
- "Filter/Effect/Audio",
- "Set volume on audio/raw streams", "Andy Wingo <wingo@pobox.com>");
-
- caps = gst_caps_from_string (ALLOWED_CAPS);
- gst_audio_filter_class_add_pad_templates (filter_class, caps);
- gst_caps_unref (caps);
-}
-
-static void
-gst_volume_class_init (GstVolumeClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseTransformClass *trans_class;
- GstAudioFilterClass *filter_class;
-
- gobject_class = (GObjectClass *) klass;
- trans_class = (GstBaseTransformClass *) klass;
- filter_class = (GstAudioFilterClass *) (klass);
-
- gobject_class->set_property = volume_set_property;
- gobject_class->get_property = volume_get_property;
- gobject_class->dispose = gst_volume_dispose;
-
- g_object_class_install_property (gobject_class, PROP_MUTE,
- g_param_spec_boolean ("mute", "Mute", "mute channel",
- DEFAULT_PROP_MUTE,
- G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_VOLUME,
- g_param_spec_double ("volume", "Volume", "volume factor, 1.0=100%",
- 0.0, VOLUME_MAX_DOUBLE, DEFAULT_PROP_VOLUME,
- G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
-
- trans_class->before_transform = GST_DEBUG_FUNCPTR (volume_before_transform);
- trans_class->transform_ip = GST_DEBUG_FUNCPTR (volume_transform_ip);
- filter_class->setup = GST_DEBUG_FUNCPTR (volume_setup);
-}
-
-static void
-gst_volume_init (GstVolume * self, GstVolumeClass * g_class)
-{
- GstMixerTrack *track = NULL;
-
- self->mute = DEFAULT_PROP_MUTE;;
- self->volume = DEFAULT_PROP_VOLUME;
-
- self->tracklist = NULL;
- self->negotiated = FALSE;
-
- track = g_object_new (GST_TYPE_MIXER_TRACK, NULL);
-
- if (GST_IS_MIXER_TRACK (track)) {
- track->label = g_strdup ("volume");
- track->num_channels = 1;
- track->min_volume = 0;
- track->max_volume = VOLUME_STEPS;
- track->flags = GST_MIXER_TRACK_SOFTWARE;
- self->tracklist = g_list_append (self->tracklist, track);
- }
-
- gst_base_transform_set_gap_aware (GST_BASE_TRANSFORM (self), TRUE);
-}
-
-static void
-volume_process_double (GstVolume * self, gpointer bytes, guint n_bytes)
-{
- gdouble *data = (gdouble *) bytes;
- guint num_samples = n_bytes / sizeof (gdouble);
-
- gdouble vol = self->current_volume;
-
- oil_scalarmultiply_f64_ns (data, data, &vol, num_samples);
-}
-
-static void
-volume_process_float (GstVolume * self, gpointer bytes, guint n_bytes)
-{
- gfloat *data = (gfloat *) bytes;
- guint num_samples = n_bytes / sizeof (gfloat);
-
-#if 0
- guint i;
-
- for (i = 0; i < num_samples; i++) {
- *data++ *= self->real_vol_f;
- }
- /* time "gst-launch 2>/dev/null audiotestsrc wave=7 num-buffers=10000 ! audio/x-raw-float !
- * volume volume=1.5 ! fakesink" goes from 0m0.850s -> 0m0.717s with liboil
- */
-#endif
- oil_scalarmultiply_f32_ns (data, data, &self->current_volume, num_samples);
-}
-
-static void
-volume_process_int32 (GstVolume * self, gpointer bytes, guint n_bytes)
-{
- gint *data = (gint *) bytes;
- guint i, num_samples;
- gint64 val;
-
- num_samples = n_bytes / sizeof (gint);
- for (i = 0; i < num_samples; i++) {
- /* we use bitshifting instead of dividing by UNITY_INT for speed */
- val = (gint64) * data;
- val =
- (((gint64) self->current_vol_i32 *
- val) >> VOLUME_UNITY_INT32_BIT_SHIFT);
- *data++ = (gint32) val;
- }
-}
-
-static void
-volume_process_int32_clamp (GstVolume * self, gpointer bytes, guint n_bytes)
-{
- gint *data = (gint *) bytes;
- guint i, num_samples;
- gint64 val;
-
- num_samples = n_bytes / sizeof (gint);
-
- for (i = 0; i < num_samples; i++) {
- /* we use bitshifting instead of dividing by UNITY_INT for speed */
- val = (gint64) * data;
- val =
- (((gint64) self->current_vol_i32 *
- val) >> VOLUME_UNITY_INT32_BIT_SHIFT);
- *data++ = (gint32) CLAMP (val, VOLUME_MIN_INT32, VOLUME_MAX_INT32);
- }
-}
-
-#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
-#define get_unaligned_i24(_x) ( (((guint8*)_x)[0]) | ((((guint8*)_x)[1]) << 8) | ((((gint8*)_x)[2]) << 16) )
-
-#define write_unaligned_u24(_x,samp) \
-G_STMT_START { \
- *(_x)++ = samp & 0xFF; \
- *(_x)++ = (samp >> 8) & 0xFF; \
- *(_x)++ = (samp >> 16) & 0xFF; \
-} G_STMT_END
-
-#else /* BIG ENDIAN */
-#define get_unaligned_i24(_x) ( (((guint8*)_x)[2]) | ((((guint8*)_x)[1]) << 8) | ((((gint8*)_x)[0]) << 16) )
-#define write_unaligned_u24(_x,samp) \
-G_STMT_START { \
- *(_x)++ = (samp >> 16) & 0xFF; \
- *(_x)++ = (samp >> 8) & 0xFF; \
- *(_x)++ = samp & 0xFF; \
-} G_STMT_END
-#endif
-
-static void
-volume_process_int24 (GstVolume * self, gpointer bytes, guint n_bytes)
-{
- gint8 *data = (gint8 *) bytes; /* treat the data as a byte stream */
- guint i, num_samples;
- guint32 samp;
- gint64 val;
-
- num_samples = n_bytes / (sizeof (gint8) * 3);
- for (i = 0; i < num_samples; i++) {
- samp = get_unaligned_i24 (data);
-
- val = (gint32) samp;
- val =
- (((gint64) self->current_vol_i24 *
- val) >> VOLUME_UNITY_INT24_BIT_SHIFT);
- samp = (guint32) val;
-
- /* write the value back into the stream */
- write_unaligned_u24 (data, samp);
- }
-}
-
-static void
-volume_process_int24_clamp (GstVolume * self, gpointer bytes, guint n_bytes)
-{
- gint8 *data = (gint8 *) bytes; /* treat the data as a byte stream */
- guint i, num_samples;
- guint32 samp;
- gint64 val;
-
- num_samples = n_bytes / (sizeof (gint8) * 3);
- for (i = 0; i < num_samples; i++) {
- samp = get_unaligned_i24 (data);
-
- val = (gint32) samp;
- val =
- (((gint64) self->current_vol_i24 *
- val) >> VOLUME_UNITY_INT24_BIT_SHIFT);
- samp = (guint32) CLAMP (val, VOLUME_MIN_INT24, VOLUME_MAX_INT24);
-
- /* write the value back into the stream */
- write_unaligned_u24 (data, samp);
- }
-}
-
-static void
-volume_process_int16 (GstVolume * self, gpointer bytes, guint n_bytes)
-{
- gint16 *data = (gint16 *) bytes;
- guint num_samples = n_bytes / sizeof (gint16);
-
-#if 1
- guint i;
- gint val;
-
- for (i = 0; i < num_samples; i++) {
- /* we use bitshifting instead of dividing by UNITY_INT for speed */
- val = (gint) * data;
- *data++ =
- (gint16) ((self->current_vol_i16 *
- val) >> VOLUME_UNITY_INT16_BIT_SHIFT);
- }
-#else
- /* FIXME: need oil_scalarmultiply_s16_ns ?
- * https://bugs.freedesktop.org/show_bug.cgi?id=7060
- * code below
- * - crashes :/
- * - real_vol_i is scaled by VOLUME_UNITY_INT16 and needs the bitshift
- * time gst-launch 2>/dev/null audiotestsrc wave=7 num-buffers=100 ! volume volume=1.5 ! fakesink
- */
- oil_scalarmult_s16 (data, 0, data, 0,
- ((gint16 *) (void *) (&self->current_vol_i)), num_samples);
-#endif
-}
-
-static void
-volume_process_int16_clamp (GstVolume * self, gpointer bytes, guint n_bytes)
-{
- gint16 *data = (gint16 *) bytes;
- guint i, num_samples;
- gint val;
-
- num_samples = n_bytes / sizeof (gint16);
-
- /* FIXME: oil_scalarmultiply_s16_ns ?
- * https://bugs.freedesktop.org/show_bug.cgi?id=7060
- */
- for (i = 0; i < num_samples; i++) {
- /* we use bitshifting instead of dividing by UNITY_INT for speed */
- val = (gint) * data;
- *data++ =
- (gint16) CLAMP ((self->current_vol_i16 *
- val) >> VOLUME_UNITY_INT16_BIT_SHIFT, VOLUME_MIN_INT16,
- VOLUME_MAX_INT16);
- }
-}
-
-static void
-volume_process_int8 (GstVolume * self, gpointer bytes, guint n_bytes)
-{
- gint8 *data = (gint8 *) bytes;
- guint num_samples = n_bytes / sizeof (gint8);
- guint i;
- gint val;
-
- for (i = 0; i < num_samples; i++) {
- /* we use bitshifting instead of dividing by UNITY_INT for speed */
- val = (gint) * data;
- *data++ =
- (gint8) ((self->current_vol_i8 * val) >> VOLUME_UNITY_INT8_BIT_SHIFT);
- }
-}
-
-static void
-volume_process_int8_clamp (GstVolume * self, gpointer bytes, guint n_bytes)
-{
- gint8 *data = (gint8 *) bytes;
- guint i, num_samples;
- gint val;
-
- num_samples = n_bytes / sizeof (gint8);
-
- for (i = 0; i < num_samples; i++) {
- /* we use bitshifting instead of dividing by UNITY_INT for speed */
- val = (gint) * data;
- *data++ =
- (gint8) CLAMP ((self->current_vol_i8 *
- val) >> VOLUME_UNITY_INT8_BIT_SHIFT, VOLUME_MIN_INT8,
- VOLUME_MAX_INT8);
- }
-}
-
-/* GstBaseTransform vmethod implementations */
-
-/* get notified of caps and plug in the correct process function */
-static gboolean
-volume_setup (GstAudioFilter * filter, GstRingBufferSpec * format)
-{
- gboolean res;
- GstVolume *self = GST_VOLUME (filter);
- gfloat volume;
- gboolean mute;
-
- GST_OBJECT_LOCK (self);
- volume = self->volume;
- mute = self->mute;
- GST_OBJECT_UNLOCK (self);
-
- res = volume_update_volume (self, volume, mute);
- if (!res) {
- GST_ELEMENT_ERROR (self, CORE, NEGOTIATION,
- ("Invalid incoming format"), (NULL));
- }
- self->negotiated = res;
-
- return res;
-}
-
-static void
-volume_before_transform (GstBaseTransform * base, GstBuffer * buffer)
-{
- GstClockTime timestamp;
- GstVolume *self = GST_VOLUME (base);
- gfloat volume;
- gboolean mute;
-
- /* FIXME: if controllers are bound, subdivide GST_BUFFER_SIZE into small
- * chunks for smooth fades, what is small? 1/10th sec.
- */
- timestamp = GST_BUFFER_TIMESTAMP (buffer);
- timestamp =
- gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, timestamp);
-
- GST_DEBUG_OBJECT (base, "sync to %" GST_TIME_FORMAT,
- GST_TIME_ARGS (timestamp));
-
- if (GST_CLOCK_TIME_IS_VALID (timestamp))
- gst_object_sync_values (G_OBJECT (self), timestamp);
-
- /* get latest values */
- GST_OBJECT_LOCK (self);
- volume = self->volume;
- mute = self->mute;
- GST_OBJECT_UNLOCK (self);
-
- if ((volume != self->current_volume) || (mute != self->current_mute)) {
- /* the volume or mute was updated, update our internal state before
- * we continue processing. */
- volume_update_volume (self, volume, mute);
- }
-}
-
-/* call the plugged-in process function for this instance
- * needs to be done with this indirection since volume_transform is
- * a class-global method
- */
-static GstFlowReturn
-volume_transform_ip (GstBaseTransform * base, GstBuffer * outbuf)
-{
- GstVolume *self = GST_VOLUME (base);
- guint8 *data;
- guint size;
-
- if (G_UNLIKELY (!self->negotiated))
- goto not_negotiated;
-
- /* don't process data in passthrough-mode */
- if (gst_base_transform_is_passthrough (base) ||
- GST_BUFFER_FLAG_IS_SET (outbuf, GST_BUFFER_FLAG_GAP))
- return GST_FLOW_OK;
-
- data = GST_BUFFER_DATA (outbuf);
- size = GST_BUFFER_SIZE (outbuf);
-
- if (self->current_volume == 0.0) {
- memset (data, 0, size);
- GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP);
- } else if (self->current_volume != 1.0) {
- self->process (self, data, size);
- }
-
- return GST_FLOW_OK;
-
- /* ERRORS */
-not_negotiated:
- {
- GST_ELEMENT_ERROR (self, CORE, NEGOTIATION,
- ("No format was negotiated"), (NULL));
- return GST_FLOW_NOT_NEGOTIATED;
- }
-}
-
-static void
-volume_set_property (GObject * object, guint prop_id, const GValue * value,
- GParamSpec * pspec)
-{
- GstVolume *self = GST_VOLUME (object);
-
- switch (prop_id) {
- case PROP_MUTE:
- GST_OBJECT_LOCK (self);
- self->mute = g_value_get_boolean (value);
- GST_OBJECT_UNLOCK (self);
- break;
- case PROP_VOLUME:
- GST_OBJECT_LOCK (self);
- self->volume = g_value_get_double (value);
- GST_OBJECT_UNLOCK (self);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-volume_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstVolume *self = GST_VOLUME (object);
-
- switch (prop_id) {
- case PROP_MUTE:
- GST_OBJECT_LOCK (self);
- g_value_set_boolean (value, self->mute);
- GST_OBJECT_UNLOCK (self);
- break;
- case PROP_VOLUME:
- GST_OBJECT_LOCK (self);
- g_value_set_double (value, self->volume);
- GST_OBJECT_UNLOCK (self);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- oil_init ();
-
- /* initialize gst controller library */
- gst_controller_init (NULL, NULL);
-
- GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "volume", 0, "Volume gain");
-
- /* ref class from a thread-safe context to work around missing bit of
- * thread-safety in GObject */
- g_type_class_ref (GST_TYPE_MIXER_TRACK);
-
- return gst_element_register (plugin, "volume", GST_RANK_NONE,
- GST_TYPE_VOLUME);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "volume",
- "plugin for controlling audio volume",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
diff --git a/gst/volume/gstvolume.h b/gst/volume/gstvolume.h
deleted file mode 100644
index 41999e19..00000000
--- a/gst/volume/gstvolume.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- c-basic-offset: 2 -*-
- * vi:si:et:sw=2:sts=8:ts=8:expandtab
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_VOLUME_H__
-#define __GST_VOLUME_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
-#include <gst/interfaces/streamvolume.h>
-#include <gst/audio/audio.h>
-#include <gst/audio/gstaudiofilter.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_VOLUME \
- (gst_volume_get_type())
-#define GST_VOLUME(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VOLUME,GstVolume))
-#define GST_VOLUME_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VOLUME,GstVolumeClass))
-#define GST_IS_VOLUME(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VOLUME))
-#define GST_IS_VOLUME_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VOLUME))
-
-typedef struct _GstVolume GstVolume;
-typedef struct _GstVolumeClass GstVolumeClass;
-
-/**
- * GstVolume:
- *
- * Opaque data structure.
- */
-struct _GstVolume {
- GstAudioFilter element;
-
- void (*process)(GstVolume*, gpointer, guint);
-
- gboolean mute;
- gfloat volume;
-
- gboolean current_mute;
- gfloat current_volume;
-
- gint current_vol_i32;
- gint current_vol_i24; /* the _i(nt) values get synchronized with the */
- gint current_vol_i16; /* the _i(nt) values get synchronized with the */
- gint current_vol_i8; /* the _i(nt) values get synchronized with the */
-
- GList *tracklist;
- gboolean negotiated;
-};
-
-struct _GstVolumeClass {
- GstAudioFilterClass parent_class;
-};
-
-GType gst_volume_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_VOLUME_H__ */
diff --git a/gst/volume/volume.vcproj b/gst/volume/volume.vcproj
deleted file mode 100644
index 149b8d89..00000000
--- a/gst/volume/volume.vcproj
+++ /dev/null
@@ -1,148 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="volume"
- ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D678E2}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../win32/Debug"
- IntermediateDirectory="../../win32/Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;volume_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstvolume.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Debug;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/volume.pdb"
- SubSystem="2"
- OptimizeReferences="2"
- ImportLibrary="$(OutDir)/gstvolume.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../win32/Release"
- IntermediateDirectory="../../win32/Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;volume_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstvolume.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/Release;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
- ModuleDefinitionFile=""
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/gstvolume.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath=".\gstvolume.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- <File
- RelativePath=".\gstvolume.h">
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/pkgconfig/.gitignore b/pkgconfig/.gitignore
deleted file mode 100644
index 6fd0ef02..00000000
--- a/pkgconfig/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.pc
diff --git a/pkgconfig/Makefile.am b/pkgconfig/Makefile.am
deleted file mode 100644
index f0bdfd01..00000000
--- a/pkgconfig/Makefile.am
+++ /dev/null
@@ -1,65 +0,0 @@
-### all of the standard pc files we need to generate
-pcverfiles = \
- gstreamer-audio-@GST_MAJORMINOR@.pc \
- gstreamer-app-@GST_MAJORMINOR@.pc \
- gstreamer-cdda-@GST_MAJORMINOR@.pc \
- gstreamer-fft-@GST_MAJORMINOR@.pc \
- gstreamer-floatcast-@GST_MAJORMINOR@.pc \
- gstreamer-interfaces-@GST_MAJORMINOR@.pc \
- gstreamer-netbuffer-@GST_MAJORMINOR@.pc \
- gstreamer-pbutils-@GST_MAJORMINOR@.pc \
- gstreamer-riff-@GST_MAJORMINOR@.pc \
- gstreamer-rtp-@GST_MAJORMINOR@.pc \
- gstreamer-rtsp-@GST_MAJORMINOR@.pc \
- gstreamer-sdp-@GST_MAJORMINOR@.pc \
- gstreamer-tag-@GST_MAJORMINOR@.pc \
- gstreamer-video-@GST_MAJORMINOR@.pc \
- gstreamer-plugins-base-@GST_MAJORMINOR@.pc
-pcverfiles_uninstalled = \
- gstreamer-audio-@GST_MAJORMINOR@-uninstalled.pc \
- gstreamer-app-@GST_MAJORMINOR@-uninstalled.pc \
- gstreamer-cdda-@GST_MAJORMINOR@-uninstalled.pc \
- gstreamer-fft-@GST_MAJORMINOR@-uninstalled.pc \
- gstreamer-floatcast-@GST_MAJORMINOR@-uninstalled.pc \
- gstreamer-interfaces-@GST_MAJORMINOR@-uninstalled.pc \
- gstreamer-netbuffer-@GST_MAJORMINOR@-uninstalled.pc \
- gstreamer-pbutils-@GST_MAJORMINOR@-uninstalled.pc \
- gstreamer-riff-@GST_MAJORMINOR@-uninstalled.pc \
- gstreamer-rtp-@GST_MAJORMINOR@-uninstalled.pc \
- gstreamer-rtsp-@GST_MAJORMINOR@-uninstalled.pc \
- gstreamer-sdp-@GST_MAJORMINOR@-uninstalled.pc \
- gstreamer-tag-@GST_MAJORMINOR@-uninstalled.pc \
- gstreamer-video-@GST_MAJORMINOR@-uninstalled.pc \
- gstreamer-plugins-base-@GST_MAJORMINOR@-uninstalled.pc
-
-all-local: $(pcverfiles) $(pcverfiles_uninstalled)
-
-### how to generate versioned .pc files from .pc files in this dir
-%-@GST_MAJORMINOR@.pc: %.pc
- cp $< $@
-%-@GST_MAJORMINOR@-uninstalled.pc: %-uninstalled.pc
- cp $< $@
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = $(pcverfiles)
-
-CLEANFILES = $(pcverfiles) $(pcverfiles_uninstalled)
-pcinfiles = \
- gstreamer-audio.pc.in gstreamer-audio-uninstalled.pc.in \
- gstreamer-app.pc.in gstreamer-app-uninstalled.pc.in \
- gstreamer-cdda.pc.in gstreamer-cdda-uninstalled.pc.in \
- gstreamer-fft.pc.in gstreamer-fft-uninstalled.pc.in \
- gstreamer-floatcast.pc.in gstreamer-floatcast-uninstalled.pc.in \
- gstreamer-interfaces.pc.in gstreamer-interfaces-uninstalled.pc.in \
- gstreamer-netbuffer.pc.in gstreamer-netbuffer-uninstalled.pc.in \
- gstreamer-pbutils.pc.in gstreamer-pbutils-uninstalled.pc.in \
- gstreamer-riff.pc.in gstreamer-riff-uninstalled.pc.in \
- gstreamer-rtp.pc.in gstreamer-rtp-uninstalled.pc.in \
- gstreamer-rtsp.pc.in gstreamer-rtsp-uninstalled.pc.in \
- gstreamer-sdp.pc.in gstreamer-sdp-uninstalled.pc.in \
- gstreamer-tag.pc.in gstreamer-tag-uninstalled.pc.in \
- gstreamer-video.pc.in gstreamer-video-uninstalled.pc.in \
- gstreamer-plugins-base.pc.in gstreamer-plugins-base-uninstalled.pc.in
-
-DISTCLEANFILES = $(pcinfiles:.in=)
-EXTRA_DIST = $(pcinfiles)
diff --git a/pkgconfig/gstreamer-app-uninstalled.pc.in b/pkgconfig/gstreamer-app-uninstalled.pc.in
deleted file mode 100644
index 20b52f5e..00000000
--- a/pkgconfig/gstreamer-app-uninstalled.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=
-exec_prefix=
-libdir=${pcfiledir}/../gst-libs/gst/app
-includedir=${pcfiledir}/../gst-libs
-
-Name: GStreamer Application Library, Uninstalled
-Description: Helper functions and base classes for application integration, uninstalled
-Version: @VERSION@
-Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-base-@GST_MAJORMINOR@
-
-Libs: -L${libdir} ${libdir}/libgstapp-@GST_MAJORMINOR@.la
-Cflags: -I${includedir} -I@srcdir@/../gst-libs
-
diff --git a/pkgconfig/gstreamer-app.pc.in b/pkgconfig/gstreamer-app.pc.in
deleted file mode 100644
index ef3d27c3..00000000
--- a/pkgconfig/gstreamer-app.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
-
-Name: GStreamer Application Library
-Description: Helper functions and base classes for application integration
-Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-base-@GST_MAJORMINOR@
-Version: @VERSION@
-Libs: -L${libdir} -lgstapp-@GST_MAJORMINOR@
-Cflags: -I${includedir}
-
diff --git a/pkgconfig/gstreamer-audio-uninstalled.pc.in b/pkgconfig/gstreamer-audio-uninstalled.pc.in
deleted file mode 100644
index 429e7136..00000000
--- a/pkgconfig/gstreamer-audio-uninstalled.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=
-exec_prefix=
-libdir=${pcfiledir}/../gst-libs/gst/audio
-includedir=${pcfiledir}/../gst-libs
-
-Name: GStreamer Audio Library, Uninstalled
-Description: Audio helper functions and base classes, uninstalled
-Version: @VERSION@
-Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-base-@GST_MAJORMINOR@ gstreamer-interfaces-@GST_MAJORMINOR@
-
-Libs: -L${libdir} ${libdir}/libgstaudio-@GST_MAJORMINOR@.la
-Cflags: -I${includedir} -I@srcdir@/../gst-libs
-
diff --git a/pkgconfig/gstreamer-audio.pc.in b/pkgconfig/gstreamer-audio.pc.in
deleted file mode 100644
index 62363814..00000000
--- a/pkgconfig/gstreamer-audio.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
-
-Name: GStreamer Audio library
-Description: Audio helper functions and base classes
-Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-base-@GST_MAJORMINOR@ gstreamer-interfaces-@GST_MAJORMINOR@
-Version: @VERSION@
-Libs: -L${libdir} -lgstaudio-@GST_MAJORMINOR@
-Cflags: -I${includedir}
-
diff --git a/pkgconfig/gstreamer-cdda-uninstalled.pc.in b/pkgconfig/gstreamer-cdda-uninstalled.pc.in
deleted file mode 100644
index 481dd77a..00000000
--- a/pkgconfig/gstreamer-cdda-uninstalled.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=
-exec_prefix=
-libdir=${pcfiledir}/../gst-libs/gst/cdda
-includedir=${pcfiledir}/../gst-libs
-
-Name: GStreamer CDDA Library, Uninstalled
-Description: CDDA base classes, uninstalled
-Version: @VERSION@
-Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-base-@GST_MAJORMINOR@ gstreamer-tag-@GST_MAJORMINOR@
-
-Libs: -L${libdir} ${libdir}/libgstcdda-@GST_MAJORMINOR@.la
-Cflags: -I${includedir} -I@srcdir@/../gst-libs
-
diff --git a/pkgconfig/gstreamer-cdda.pc.in b/pkgconfig/gstreamer-cdda.pc.in
deleted file mode 100644
index b67eac16..00000000
--- a/pkgconfig/gstreamer-cdda.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
-
-Name: GStreamer CDDA Library
-Description: CDDA base classes
-Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-base-@GST_MAJORMINOR@ gstreamer-tag-@GST_MAJORMINOR@
-Version: @VERSION@
-Libs: -L${libdir} -lgstcdda-@GST_MAJORMINOR@
-Cflags: -I${includedir}
-
diff --git a/pkgconfig/gstreamer-fft-uninstalled.pc.in b/pkgconfig/gstreamer-fft-uninstalled.pc.in
deleted file mode 100644
index 6a3e8d54..00000000
--- a/pkgconfig/gstreamer-fft-uninstalled.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=
-exec_prefix=
-libdir=${pcfiledir}/../gst-libs/gst/fft
-includedir=${pcfiledir}/../gst-libs
-
-Name: GStreamer FFT Library, Uninstalled
-Description: FFT implementation, uninstalled
-Version: @VERSION@
-Requires: gstreamer-@GST_MAJORMINOR@
-
-Libs: -L${libdir} ${libdir}/libgstfft-@GST_MAJORMINOR@.la -lm
-Cflags: -I${includedir} -I@srcdir@/../gst-libs
-
diff --git a/pkgconfig/gstreamer-fft.pc.in b/pkgconfig/gstreamer-fft.pc.in
deleted file mode 100644
index c9f17ec2..00000000
--- a/pkgconfig/gstreamer-fft.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
-
-Name: GStreamer FFT Library
-Description: FFT implementation
-Requires: gstreamer-@GST_MAJORMINOR@
-Version: @VERSION@
-Libs: -L${libdir} -lgstfft-@GST_MAJORMINOR@ -lm
-Cflags: -I${includedir}
-
diff --git a/pkgconfig/gstreamer-floatcast-uninstalled.pc.in b/pkgconfig/gstreamer-floatcast-uninstalled.pc.in
deleted file mode 100644
index 0653ade6..00000000
--- a/pkgconfig/gstreamer-floatcast-uninstalled.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=
-exec_prefix=
-libdir=${pcfiledir}/../gst-libs/gst/floatcast
-includedir=${pcfiledir}/../gst-libs
-
-Name: GStreamer Floatcast Library, Uninstalled
-Description: Platform independent floating point macros, uninstalled
-Version: @VERSION@
-Requires: glib-2.0
-Libs: -lm
-Cflags: -I${includedir} -I@srcdir@/../gst-libs
-
diff --git a/pkgconfig/gstreamer-floatcast.pc.in b/pkgconfig/gstreamer-floatcast.pc.in
deleted file mode 100644
index 3ca7ec31..00000000
--- a/pkgconfig/gstreamer-floatcast.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
-
-Name: GStreamer Floatcast Library
-Description: Platform independent floating point macros
-Requires: glib-2.0
-Version: @VERSION@
-Cflags: -I${includedir}
-Libs: -lm
-
diff --git a/pkgconfig/gstreamer-interfaces-uninstalled.pc.in b/pkgconfig/gstreamer-interfaces-uninstalled.pc.in
deleted file mode 100644
index 77d2d7db..00000000
--- a/pkgconfig/gstreamer-interfaces-uninstalled.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=
-exec_prefix=
-libdir=${pcfiledir}/../gst-libs/gst/interfaces
-includedir=${pcfiledir}/../gst-libs
-
-Name: GStreamer Interfaces Library, Uninstalled
-Description: Interfaces for GStreamer elements, uninstalled
-Version: @VERSION@
-Requires: gstreamer-@GST_MAJORMINOR@
-
-Libs: -L${libdir} ${libdir}/libgstinterfaces-@GST_MAJORMINOR@.la
-Cflags: -I${includedir} -I@srcdir@/../gst-libs
-
diff --git a/pkgconfig/gstreamer-interfaces.pc.in b/pkgconfig/gstreamer-interfaces.pc.in
deleted file mode 100644
index 30828e4b..00000000
--- a/pkgconfig/gstreamer-interfaces.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
-
-Name: GStreamer Interfaces Library
-Description: Interfaces for GStreamer elements
-Requires: gstreamer-@GST_MAJORMINOR@
-Version: @VERSION@
-Libs: -L${libdir} -lgstinterfaces-@GST_MAJORMINOR@
-Cflags: -I${includedir}
-
diff --git a/pkgconfig/gstreamer-netbuffer-uninstalled.pc.in b/pkgconfig/gstreamer-netbuffer-uninstalled.pc.in
deleted file mode 100644
index f18f47fb..00000000
--- a/pkgconfig/gstreamer-netbuffer-uninstalled.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=
-exec_prefix=
-libdir=${pcfiledir}/../gst-libs/gst/netbuffer
-includedir=${pcfiledir}/../gst-libs
-
-Name: GStreamer Network Buffer Library, Uninstalled
-Description: Network buffer for use in network sources/sinks, uninstalled
-Version: @VERSION@
-Requires: gstreamer-@GST_MAJORMINOR@
-
-Libs: -L${libdir} ${libdir}/libgstnetbuffer-@GST_MAJORMINOR@.la
-Cflags: -I${includedir} -I@srcdir@/../gst-libs
-
diff --git a/pkgconfig/gstreamer-netbuffer.pc.in b/pkgconfig/gstreamer-netbuffer.pc.in
deleted file mode 100644
index 44809fb6..00000000
--- a/pkgconfig/gstreamer-netbuffer.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
-
-Name: GStreamer Network Buffer Library
-Description: Network buffer for use in network sources/sinks
-Requires: gstreamer-@GST_MAJORMINOR@
-Version: @VERSION@
-Libs: -L${libdir} -lgstnetbuffer-@GST_MAJORMINOR@
-Cflags: -I${includedir}
-
diff --git a/pkgconfig/gstreamer-pbutils-uninstalled.pc.in b/pkgconfig/gstreamer-pbutils-uninstalled.pc.in
deleted file mode 100644
index 4dc2f2cc..00000000
--- a/pkgconfig/gstreamer-pbutils-uninstalled.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=
-exec_prefix=
-libdir=${pcfiledir}/../gst-libs/gst/pbutils
-includedir=${pcfiledir}/../gst-libs
-
-Name: GStreamer Base Utils Library, Uninstalled
-Description: General utility functions, uninstalled
-Version: @VERSION@
-Requires: gstreamer-@GST_MAJORMINOR@
-
-Libs: -L${libdir} ${libdir}/libgstpbutils-@GST_MAJORMINOR@.la
-Cflags: -I${includedir} -I@srcdir@/../gst-libs
-
diff --git a/pkgconfig/gstreamer-pbutils.pc.in b/pkgconfig/gstreamer-pbutils.pc.in
deleted file mode 100644
index 59954240..00000000
--- a/pkgconfig/gstreamer-pbutils.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
-
-Name: GStreamer Base Utils Library
-Description: General utility functions
-Requires: gstreamer-@GST_MAJORMINOR@
-Version: @VERSION@
-Libs: -L${libdir} -lgstpbutils-@GST_MAJORMINOR@
-Cflags: -I${includedir}
-
diff --git a/pkgconfig/gstreamer-plugins-base-uninstalled.pc.in b/pkgconfig/gstreamer-plugins-base-uninstalled.pc.in
deleted file mode 100644
index f87345a1..00000000
--- a/pkgconfig/gstreamer-plugins-base-uninstalled.pc.in
+++ /dev/null
@@ -1,15 +0,0 @@
-prefix=
-exec_prefix=
-libdir=${pcfiledir}/../gst-libs/gst
-includedir=${pcfiledir}/../gst-libs
-pluginsdir=${pcfiledir}/..
-
-Name: GStreamer Base Plugins Libraries, Uninstalled
-Description: Streaming media framework, base plugins libraries, uninstalled
-Version: @VERSION@
-Requires: gstreamer-@GST_MAJORMINOR@
-
-Libs: -L${libdir}/audio -L${libdir}/cdda -L${libdir}/fft -L${libdir}/floatcast -L${libdir}/interfaces -L${libdir}/netbuffer -L${libdir}/riff -L${libdir}/rtp -L${libdir}/rtsp -L${libdir}/sdp -L${libdir}/tag -L${libdir}/pbutils -L${libdir}/video -L${libdir}/app
-Cflags: -I${includedir} -I@srcdir@/../gst-libs
-
-libraries=audio cdda fft floatcast interfaces netbuffer riff tag pbutils video
diff --git a/pkgconfig/gstreamer-plugins-base.pc.in b/pkgconfig/gstreamer-plugins-base.pc.in
deleted file mode 100644
index 4bc6088c..00000000
--- a/pkgconfig/gstreamer-plugins-base.pc.in
+++ /dev/null
@@ -1,14 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
-pluginsdir=@libdir@/gstreamer-@GST_MAJORMINOR@
-
-Name: GStreamer Base Plugins Libraries
-Description: Streaming media framework, base plugins libraries
-Requires: gstreamer-@GST_MAJORMINOR@
-Version: @VERSION@
-Libs: -L${libdir}
-Cflags: -I${includedir}
-
-libraries=audio cdda fft floatcast interfaces netbuffer riff rtp tag pbutils video
diff --git a/pkgconfig/gstreamer-riff-uninstalled.pc.in b/pkgconfig/gstreamer-riff-uninstalled.pc.in
deleted file mode 100644
index 61c1a41e..00000000
--- a/pkgconfig/gstreamer-riff-uninstalled.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=
-exec_prefix=
-libdir=${pcfiledir}/../gst-libs/gst/riff
-includedir=${pcfiledir}/../gst-libs
-
-Name: GStreamer RIFF Library, Uninstalled
-Description: RIFF helper functions, uninstalled
-Version: @VERSION@
-Requires: gstreamer-@GST_MAJORMINOR@
-
-Libs: -L${libdir} ${libdir}/libgstriff-@GST_MAJORMINOR@.la
-Cflags: -I${includedir} -I@srcdir@/../gst-libs
-
diff --git a/pkgconfig/gstreamer-riff.pc.in b/pkgconfig/gstreamer-riff.pc.in
deleted file mode 100644
index 054d417e..00000000
--- a/pkgconfig/gstreamer-riff.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
-
-Name: GStreamer RIFF Library
-Description: RIFF helper functions
-Requires: gstreamer-@GST_MAJORMINOR@
-Version: @VERSION@
-Libs: -L${libdir} -lgstriff-@GST_MAJORMINOR@
-Cflags: -I${includedir}
-
diff --git a/pkgconfig/gstreamer-rtp-uninstalled.pc.in b/pkgconfig/gstreamer-rtp-uninstalled.pc.in
deleted file mode 100644
index a427d81f..00000000
--- a/pkgconfig/gstreamer-rtp-uninstalled.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=
-exec_prefix=
-libdir=${pcfiledir}/../gst-libs/gst/rtp
-includedir=${pcfiledir}/../gst-libs
-
-Name: GStreamer RTP Library, Uninstalled
-Description: RTP base classes and helper functions, uninstalled
-Version: @VERSION@
-Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-base-@GST_MAJORMINOR@
-
-Libs: -L${libdir} ${libdir}/libgstrtp-@GST_MAJORMINOR@.la
-Cflags: -I${includedir} -I@srcdir@/../gst-libs
-
diff --git a/pkgconfig/gstreamer-rtp.pc.in b/pkgconfig/gstreamer-rtp.pc.in
deleted file mode 100644
index c7a3b15d..00000000
--- a/pkgconfig/gstreamer-rtp.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
-
-Name: GStreamer RTP Library
-Description: RTP base classes and helper functions
-Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-base-@GST_MAJORMINOR@
-Version: @VERSION@
-Libs: -L${libdir} -lgstrtp-@GST_MAJORMINOR@
-Cflags: -I${includedir}
-
diff --git a/pkgconfig/gstreamer-rtsp-uninstalled.pc.in b/pkgconfig/gstreamer-rtsp-uninstalled.pc.in
deleted file mode 100644
index aa66ee1c..00000000
--- a/pkgconfig/gstreamer-rtsp-uninstalled.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=
-exec_prefix=
-libdir=${pcfiledir}/../gst-libs/gst/rtsp
-includedir=${pcfiledir}/../gst-libs
-
-Name: GStreamer RTSP Library, Uninstalled
-Description: RTSP base classes and helper functions, uninstalled
-Version: @VERSION@
-Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-sdp-@GST_MAJORMINOR@
-
-Libs: -L${libdir} ${libdir}/libgstrtsp-@GST_MAJORMINOR@.la
-Cflags: -I${includedir} -I@srcdir@/../gst-libs
-
diff --git a/pkgconfig/gstreamer-rtsp.pc.in b/pkgconfig/gstreamer-rtsp.pc.in
deleted file mode 100644
index b2ca7cf6..00000000
--- a/pkgconfig/gstreamer-rtsp.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
-
-Name: GStreamer RTSP Library
-Description: RTSP base classes and helper functions
-Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-sdp-@GST_MAJORMINOR@
-Version: @VERSION@
-Libs: -L${libdir} -lgstrtsp-@GST_MAJORMINOR@
-Cflags: -I${includedir}
-
diff --git a/pkgconfig/gstreamer-sdp-uninstalled.pc.in b/pkgconfig/gstreamer-sdp-uninstalled.pc.in
deleted file mode 100644
index 7fe33363..00000000
--- a/pkgconfig/gstreamer-sdp-uninstalled.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=
-exec_prefix=
-libdir=${pcfiledir}/../gst-libs/gst/sdp
-includedir=${pcfiledir}/../gst-libs
-
-Name: GStreamer SDP Library, Uninstalled
-Description: SDP helper functions, uninstalled
-Version: @VERSION@
-Requires: glib-2.0
-
-Libs: -L${libdir} ${libdir}/libgstsdp-@GST_MAJORMINOR@.la
-Cflags: -I${includedir} -I@srcdir@/../gst-libs
-
diff --git a/pkgconfig/gstreamer-sdp.pc.in b/pkgconfig/gstreamer-sdp.pc.in
deleted file mode 100644
index bf9c56ac..00000000
--- a/pkgconfig/gstreamer-sdp.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
-
-Name: GStreamer SDP Library
-Description: SDP helper functions
-Requires: glib-2.0
-Version: @VERSION@
-Libs: -L${libdir} -lgstsdp-@GST_MAJORMINOR@
-Cflags: -I${includedir}
-
diff --git a/pkgconfig/gstreamer-tag-uninstalled.pc.in b/pkgconfig/gstreamer-tag-uninstalled.pc.in
deleted file mode 100644
index 8b7df368..00000000
--- a/pkgconfig/gstreamer-tag-uninstalled.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=
-exec_prefix=
-libdir=${pcfiledir}/../gst-libs/gst/tag
-includedir=${pcfiledir}/../gst-libs
-
-Name: GStreamer Tag Library, Uninstalled
-Description: Tag base classes and helper functions, uninstalled
-Version: @VERSION@
-Requires: gstreamer-@GST_MAJORMINOR@
-
-Libs: -L${libdir} ${libdir}/libgsttag-@GST_MAJORMINOR@.la
-Cflags: -I${includedir} -I@srcdir@/../gst-libs
-
diff --git a/pkgconfig/gstreamer-tag.pc.in b/pkgconfig/gstreamer-tag.pc.in
deleted file mode 100644
index 33c27b54..00000000
--- a/pkgconfig/gstreamer-tag.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
-
-Name: GStreamer Tag Library
-Description: Tag base classes and helper functions
-Requires: gstreamer-@GST_MAJORMINOR@
-Version: @VERSION@
-Libs: -L${libdir} -lgsttag-@GST_MAJORMINOR@
-Cflags: -I${includedir}
-
diff --git a/pkgconfig/gstreamer-video-uninstalled.pc.in b/pkgconfig/gstreamer-video-uninstalled.pc.in
deleted file mode 100644
index 00abf174..00000000
--- a/pkgconfig/gstreamer-video-uninstalled.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=
-exec_prefix=
-libdir=${pcfiledir}/../gst-libs/gst/video
-includedir=${pcfiledir}/../gst-libs
-
-Name: GStreamer Video Library, Uninstalled
-Description: Video base classes and helper functions, uninstalled
-Version: @VERSION@
-Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-base-@GST_MAJORMINOR@
-
-Libs: -L${libdir} ${libdir}/libgstvideo-@GST_MAJORMINOR@.la
-Cflags: -I${includedir} -I@srcdir@/../gst-libs
-
diff --git a/pkgconfig/gstreamer-video.pc.in b/pkgconfig/gstreamer-video.pc.in
deleted file mode 100644
index cdddeb31..00000000
--- a/pkgconfig/gstreamer-video.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
-
-Name: GStreamer Video Library
-Description: Video base classes and helper functions
-Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-base-@GST_MAJORMINOR@
-Version: @VERSION@
-Libs: -L${libdir} -lgstvideo-@GST_MAJORMINOR@
-Cflags: -I${includedir}
-
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d8aa8cc8..8b137891 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,23 +1 @@
-ext/alsa/gstalsamixertrack.c
-ext/alsa/gstalsasink.c
-ext/alsa/gstalsasrc.c
-ext/cdparanoia/gstcdparanoiasrc.c
-ext/gnomevfs/gstgnomevfssrc.c
-ext/gnomevfs/gstgnomevfssink.c
-ext/ogg/gstoggdemux.c
-gst/playback/gstdecodebin.c
-gst/playback/gstdecodebin2.c
-gst/playback/gstplaybasebin.c
-gst/playback/gstplaybin.c
-gst/playback/gstplaysink.c
-gst/playback/gsturidecodebin.c
-gst/tcp/gsttcp.c
-gst/tcp/gsttcpclientsink.c
-gst/tcp/gsttcpclientsrc.c
-gst-libs/gst/audio/gstbaseaudiosrc.c
-gst-libs/gst/tag/gsttagdemux.c
-gst-libs/gst/tag/tags.c
-gst-libs/gst/cdda/gstcddabasesrc.c
-gst-libs/gst/pbutils/descriptions.c
-gst-libs/gst/pbutils/missing-plugins.c
-sys/v4l/v4l_calls.c
+
diff --git a/sys/Makefile.am b/sys/Makefile.am
index 0c896178..cd858730 100644
--- a/sys/Makefile.am
+++ b/sys/Makefile.am
@@ -1,36 +1,12 @@
-if USE_GST_V4L
-V4L_DIR=v4l
-else
-V4L_DIR=
-endif
-
-if USE_X
-XIMAGE_DIR=ximage
-else
-XIMAGE_DIR=
-endif
-
if USE_XVBO
XVBOIMAGE_DIR=xvboimage
else
XVBOIMAGE_DIR=
endif
-if USE_XVIDEO
-XVIMAGE_DIR=xvimage
-else
-XVIMAGE_DIR=
-endif
-
SUBDIRS = \
- $(XIMAGE_DIR) \
- $(XVBOIMAGE_DIR) \
- $(XVIMAGE_DIR) \
- $(V4L_DIR)
+ $(XVBOIMAGE_DIR)
DIST_SUBDIRS = \
- v4l \
- ximage \
- xvboimage \
- xvimage
+ xvboimage
diff --git a/sys/v4l/.gitignore b/sys/v4l/.gitignore
deleted file mode 100644
index bcb497ac..00000000
--- a/sys/v4l/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-gstv4lelement-marshal.h
-gstv4lelement-marshal.c
diff --git a/sys/v4l/Makefile.am b/sys/v4l/Makefile.am
deleted file mode 100644
index 688ec963..00000000
--- a/sys/v4l/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-plugin_LTLIBRARIES = libgstvideo4linux.la
-
-if USE_XVIDEO
-xv_source = gstv4lxoverlay.c
-xv_libs = $(X_LIBS) $(XVIDEO_LIBS)
-else
-xv_source =
-xv_libs =
-endif
-
-libgstvideo4linux_la_SOURCES = \
- gstv4l.c \
- gstv4lcolorbalance.c \
- gstv4lelement.c \
- gstv4lsrc.c \
- gstv4ltuner.c \
- v4l_calls.c \
- v4lsrc_calls.c $(xv_source)
-
-# gstv4ljpegsrc.c \
-# gstv4lmjpegsrc.c v4lmjpegsrc_calls.c \
-# gstv4lmjpegsink.c v4lmjpegsink_calls.c
-
-libgstvideo4linux_la_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS) \
- $(GUDEV_CFLAGS)
-libgstvideo4linux_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la \
- $(GST_BASE_LIBS) $(GST_LIBS) $(xv_libs) \
- $(GUDEV_LIBS)
-libgstvideo4linux_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstvideo4linux_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = gstv4lelement.h v4l_calls.h \
- gstv4lsrc.h v4lsrc_calls.h \
- gstv4ljpegsrc.h \
- gstv4lmjpegsrc.h v4lmjpegsrc_calls.h \
- gstv4lmjpegsink.h v4lmjpegsink_calls.h \
- videodev_mjpeg.h \
- gstv4ltuner.h gstv4lxoverlay.h \
- gstv4lcolorbalance.h
diff --git a/sys/v4l/README b/sys/v4l/README
deleted file mode 100644
index 980e193f..00000000
--- a/sys/v4l/README
+++ /dev/null
@@ -1,35 +0,0 @@
-General Idea:
-=============
-
- _____/ gstv4lsrc.[ch]
- _____/ \ v4lsrc_calls.[ch]
- /
-gstv4lelement.[ch] _/____________/ gstv4lmjpegsrc.[ch]
-v4l_calls.[ch] \ \ v4lmjpegsrc_calls.[ch]
- \_____
- \_____/ gstv4lmjpegsink.[ch]
- \ v4lmjpegsink_calls.[ch]
-
-I.e., all the files on the right are child classes of
-the v4lelement 'parent' on the left.
-
-* v4lelement handles generic v4l stuff (picture settings,
- audio, norm/input setting, open()/close())
-* v4lsrc, v4lmjpegsrc handle the capture specific
- functions. Maybe we'd need a v4lmpegsrc too
-* v4lmjpegsink handles mjpeg hardware playback of video
-
-Useful Documentation:
-=====================
-MJPEG/V4L API : ./videodev_mjpeg.h
-
-V4L API : /usr/include/linux/videodev.h or
- /usr/src/linux/Documentation/video4linux/API.html or
- http://linux.bytesex.org/v4l2/API.html
-
-V4L2 API : /usr/include/linux/videodev2.h or
- http://v4l2spec.bytesex.org/
-
-BSD/Meteor API: /usr/include/machine/ioctl_meteor.h
-
-mjpegtools : http://www.sourceforge.net/projects/mjpeg
diff --git a/sys/v4l/TODO b/sys/v4l/TODO
deleted file mode 100644
index 96616c08..00000000
--- a/sys/v4l/TODO
+++ /dev/null
@@ -1,44 +0,0 @@
-TODO list (short term):
-=======================
-* v4lsrc/v4lmjpegsrc/v4l2src: fix interlacing (not handled at all...)
-
-TODO list (long term):
-======================
-* v4lmpegsrc (*hint* MPEG card needed *hint*)
-* v4l2sink
-* BSD-videosrc (bktr)
-
-Useful Documentation:
-=====================
-MJPEG/V4L API : ./videodev_mjpeg.h
-
-V4L API : /usr/include/linux/videodev.h or
- /usr/src/linux/Documentation/video4linux/API.html or
- http://linux.bytesex.org/v4l2/API.html
-
-V4L2 API : /usr/include/linux/videodev2.h or
- http://v4l2spec.bytesex.org/
-
-BSD/Meteor API: /usr/include/machine/ioctl_meteor.h
-
-mjpegtools : http://www.sourceforge.net/projects/mjpeg
-
-Capturing:
-==========
-* sound is the master clock
-* it's probably a good idea to create an audiosource element:
- - autodetect alsa/oss
- - first try alsa, then oss... they work the same internally
-* same for videosource:
- - autodetect v4l/v4l2 + mjpeg capabilities
- - for this, just open device using v4l2element. On success:
- + use v4l2
- - on failure:
- + use v4lelement and query for MJPEG capabilities
- + if that's available, combine caps of v4lmjpegsrc and v4lsrc
-* both sources run in their own GstThread with a high priority
-* an encoder element takes care of encoding + muxing. A toplevel element
- (reverse of spider) is probably a good idea here. How? Don't know...
-* format negotiation via filtered caps
-* statistics via listening to the frame_{lost,inserted,deleted,captures}
- signals and GST_PAD_QUERY_POSITION (gst_pad_query())
diff --git a/sys/v4l/gstv4l.c b/sys/v4l/gstv4l.c
deleted file mode 100644
index aa467c44..00000000
--- a/sys/v4l/gstv4l.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* GStreamer
- *
- * gstv4l.c: plugin for v4l elements
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gst/gst-i18n-plugin.h"
-
-#include <gst/gst.h>
-
-#include "gstv4lelement.h"
-#include "gstv4lsrc.h"
-/* #include "gstv4ljpegsrc.h" */
-/* #include "gstv4lmjpegsrc.h" */
-/* #include "gstv4lmjpegsink.h" */
-
-GST_DEBUG_CATEGORY (v4l_debug); /* used in v4l_calls.c and v4lsrc_calls.c */
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (v4l_debug, "v4l", 0, "V4L API calls");
-
- if (!gst_element_register (plugin, "v4lsrc", GST_RANK_MARGINAL,
- GST_TYPE_V4LSRC))
-/* !gst_element_register (plugin, "v4ljpegsrc", */
-/* GST_RANK_NONE, GST_TYPE_V4LJPEGSRC) || */
-/* !gst_element_register (plugin, "v4lmjpegsrc", */
-/* GST_RANK_NONE, GST_TYPE_V4LMJPEGSRC) || */
-/* !gst_element_register (plugin, "v4lmjpegsink", */
-/* GST_RANK_NONE, GST_TYPE_V4LMJPEGSINK)) */
- return FALSE;
-
-#ifdef ENABLE_NLS
- setlocale (LC_ALL, "");
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif /* ENABLE_NLS */
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "video4linux",
- "elements for Video 4 Linux",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/sys/v4l/gstv4lcolorbalance.c b/sys/v4l/gstv4lcolorbalance.c
deleted file mode 100644
index 35745bb5..00000000
--- a/sys/v4l/gstv4lcolorbalance.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/* GStreamer
- *
- * gstv4lcolorbalance.c: color balance interface implementation for V4L
- *
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include "gstv4lcolorbalance.h"
-#include "gstv4lelement.h"
-
-static void
-gst_v4l_color_balance_channel_class_init (GstV4lColorBalanceChannelClass *
- klass);
-static void gst_v4l_color_balance_channel_init (GstV4lColorBalanceChannel *
- channel);
-
-static const GList *gst_v4l_color_balance_list_channels (GstColorBalance *
- balance);
-static void gst_v4l_color_balance_set_value (GstColorBalance * balance,
- GstColorBalanceChannel * channel, gint value);
-static gint gst_v4l_color_balance_get_value (GstColorBalance * balance,
- GstColorBalanceChannel * channel);
-
-static GstColorBalanceChannelClass *parent_class = NULL;
-
-GType
-gst_v4l_color_balance_channel_get_type (void)
-{
- static GType gst_v4l_color_balance_channel_type = 0;
-
- if (!gst_v4l_color_balance_channel_type) {
- static const GTypeInfo v4l_tuner_channel_info = {
- sizeof (GstV4lColorBalanceChannelClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_v4l_color_balance_channel_class_init,
- NULL,
- NULL,
- sizeof (GstV4lColorBalanceChannel),
- 0,
- (GInstanceInitFunc) gst_v4l_color_balance_channel_init,
- NULL
- };
-
- gst_v4l_color_balance_channel_type =
- g_type_register_static (GST_TYPE_COLOR_BALANCE_CHANNEL,
- "GstV4lColorBalanceChannel", &v4l_tuner_channel_info, 0);
- }
-
- return gst_v4l_color_balance_channel_type;
-}
-
-static void
-gst_v4l_color_balance_channel_class_init (GstV4lColorBalanceChannelClass *
- klass)
-{
- parent_class = g_type_class_peek_parent (klass);
-}
-
-static void
-gst_v4l_color_balance_channel_init (GstV4lColorBalanceChannel * channel)
-{
- channel->index = 0;
-}
-
-void
-gst_v4l_color_balance_interface_init (GstColorBalanceClass * klass)
-{
- GST_COLOR_BALANCE_TYPE (klass) = GST_COLOR_BALANCE_HARDWARE;
-
- /* default virtual functions */
- klass->list_channels = gst_v4l_color_balance_list_channels;
- klass->set_value = gst_v4l_color_balance_set_value;
- klass->get_value = gst_v4l_color_balance_get_value;
-}
-
-static G_GNUC_UNUSED gboolean
-gst_v4l_color_balance_contains_channel (GstV4lElement * v4lelement,
- GstV4lColorBalanceChannel * v4lchannel)
-{
- const GList *item;
-
- for (item = v4lelement->colors; item != NULL; item = item->next)
- if (item->data == v4lchannel)
- return TRUE;
-
- return FALSE;
-}
-
-static const GList *
-gst_v4l_color_balance_list_channels (GstColorBalance * balance)
-{
- return GST_V4LELEMENT (balance)->colors;
-}
-
-static void
-gst_v4l_color_balance_set_value (GstColorBalance * balance,
- GstColorBalanceChannel * channel, gint value)
-{
- GstV4lElement *v4lelement = GST_V4LELEMENT (balance);
- GstV4lColorBalanceChannel *v4lchannel =
- GST_V4L_COLOR_BALANCE_CHANNEL (channel);
-
- /* assert that we're opened and that we're using a known item */
- g_return_if_fail (GST_V4L_IS_OPEN (v4lelement));
- g_return_if_fail (gst_v4l_color_balance_contains_channel (v4lelement,
- v4lchannel));
-
- gst_v4l_set_picture (v4lelement, v4lchannel->index, value);
-}
-
-static gint
-gst_v4l_color_balance_get_value (GstColorBalance * balance,
- GstColorBalanceChannel * channel)
-{
- GstV4lElement *v4lelement = GST_V4LELEMENT (balance);
- GstV4lColorBalanceChannel *v4lchannel =
- GST_V4L_COLOR_BALANCE_CHANNEL (channel);
- gint value;
-
- /* assert that we're opened and that we're using a known item */
- g_return_val_if_fail (GST_V4L_IS_OPEN (v4lelement), 0);
- g_return_val_if_fail (gst_v4l_color_balance_contains_channel (v4lelement,
- v4lchannel), 0);
-
- if (!gst_v4l_get_picture (v4lelement, v4lchannel->index, &value))
- return 0;
-
- return value;
-}
diff --git a/sys/v4l/gstv4lcolorbalance.h b/sys/v4l/gstv4lcolorbalance.h
deleted file mode 100644
index 7f5c2235..00000000
--- a/sys/v4l/gstv4lcolorbalance.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GStreamer
- *
- * gstv4lcolorbalance.h: color balance interface implementation for V4L
- *
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_V4L_COLOR_BALANCE_H__
-#define __GST_V4L_COLOR_BALANCE_H__
-
-#include <gst/gst.h>
-#include <gst/interfaces/colorbalance.h>
-#include "v4l_calls.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_V4L_COLOR_BALANCE_CHANNEL \
- (gst_v4l_color_balance_channel_get_type ())
-#define GST_V4L_COLOR_BALANCE_CHANNEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_V4L_COLOR_BALANCE_CHANNEL, \
- GstV4lColorBalanceChannel))
-#define GST_V4L_COLOR_BALANCE_CHANNEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_V4L_COLOR_BALANCE_CHANNEL, \
- GstV4lColorBalanceChannelClass))
-#define GST_IS_V4L_COLOR_BALANCE_CHANNEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_V4L_COLOR_BALANCE_CHANNEL))
-#define GST_IS_V4L_COLOR_BALANCE_CHANNEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_V4L_COLOR_BALANCE_CHANNEL))
-
-typedef struct _GstV4lColorBalanceChannel {
- GstColorBalanceChannel parent;
-
- GstV4lPictureType index;
-} GstV4lColorBalanceChannel;
-
-typedef struct _GstV4lColorBalanceChannelClass {
- GstColorBalanceChannelClass parent;
-} GstV4lColorBalanceChannelClass;
-
-GType gst_v4l_color_balance_channel_get_type (void);
-
-void gst_v4l_color_balance_interface_init (GstColorBalanceClass *klass);
-
-#endif /* __GST_V4L_COLOR_BALANCE_H__ */
diff --git a/sys/v4l/gstv4lelement.c b/sys/v4l/gstv4lelement.c
deleted file mode 100644
index 27fae757..00000000
--- a/sys/v4l/gstv4lelement.c
+++ /dev/null
@@ -1,552 +0,0 @@
-/* GStreamer
- *
- * gstv4lelement.c: base class for V4L elements
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <gst/interfaces/propertyprobe.h>
-
-#ifdef HAVE_GUDEV
-#include <gudev/gudev.h>
-#endif
-
-#include "v4l_calls.h"
-#include "gstv4ltuner.h"
-#ifdef HAVE_XVIDEO
-#include "gstv4lxoverlay.h"
-#endif
-#include "gstv4lcolorbalance.h"
-
-
-enum
-{
- PROP_0,
- PROP_DEVICE,
- PROP_DEVICE_NAME,
- PROP_FLAGS
-};
-
-GST_DEBUG_CATEGORY (v4lelement_debug);
-#define GST_CAT_DEFAULT v4lelement_debug
-
-static void gst_v4lelement_init_interfaces (GType type);
-
-GST_BOILERPLATE_FULL (GstV4lElement, gst_v4lelement, GstPushSrc,
- GST_TYPE_PUSH_SRC, gst_v4lelement_init_interfaces);
-
-static void gst_v4lelement_dispose (GObject * object);
-static void gst_v4lelement_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_v4lelement_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-/* element methods */
-static GstStateChangeReturn gst_v4lelement_change_state (GstElement * element,
- GstStateChange transition);
-
-static gboolean
-gst_v4l_iface_supported (GstImplementsInterface * iface, GType iface_type)
-{
- GstV4lElement *v4lelement = GST_V4LELEMENT (iface);
-
-#ifdef HAVE_XVIDEO
- g_assert (iface_type == GST_TYPE_TUNER ||
- iface_type == GST_TYPE_X_OVERLAY || iface_type == GST_TYPE_COLOR_BALANCE);
-#else
- g_assert (iface_type == GST_TYPE_TUNER ||
- iface_type == GST_TYPE_COLOR_BALANCE);
-#endif
-
- if (v4lelement->video_fd == -1)
- return FALSE;
-
-#ifdef HAVE_XVIDEO
- if (iface_type == GST_TYPE_X_OVERLAY && !GST_V4L_IS_OVERLAY (v4lelement))
- return FALSE;
-#endif
-
- return TRUE;
-}
-
-static void
-gst_v4l_interface_init (GstImplementsInterfaceClass * klass)
-{
- /* default virtual functions */
- klass->supported = gst_v4l_iface_supported;
-}
-
-static const GList *
-gst_v4l_probe_get_properties (GstPropertyProbe * probe)
-{
- GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
- static GList *list = NULL;
-
- if (!list) {
- list = g_list_append (NULL, g_object_class_find_property (klass, "device"));
- }
-
- return list;
-}
-
-static gboolean init = FALSE;
-static GList *devices = NULL;
-
-#ifdef HAVE_GUDEV
-static gboolean
-gst_v4l_class_probe_devices_with_udev (GstV4lElementClass * klass,
- gboolean check)
-{
- GUdevClient *client = NULL;
- GList *item;
-
- if (!check) {
- while (devices) {
- gchar *device = devices->data;
- devices = g_list_remove (devices, device);
- g_free (device);
- }
-
- GST_INFO ("Enumerating video4linux devices from udev");
- client = g_udev_client_new (NULL);
- if (!client) {
- GST_WARNING ("Failed to initialize gudev client");
- goto finish;
- }
-
- item = g_udev_client_query_by_subsystem (client, "video4linux");
- while (item) {
- GUdevDevice *device = item->data;
- gchar *devnode = g_strdup (g_udev_device_get_device_file (device));
- gint api = g_udev_device_get_property_as_int (device, "ID_V4L_VERSION");
- GST_INFO ("Found new device: %s, API: %d", devnode, api);
- /* Append v4l1 devices only. If api is 0 probably v4l_id has
- been stripped out of the current udev installation, append
- anyway */
- if (api == 0) {
- GST_WARNING
- ("Couldn't retrieve ID_V4L_VERSION, silly udev installation?");
- }
- if ((api == 1 || api == 0)) {
- devices = g_list_append (devices, devnode);
- } else {
- g_free (devnode);
- }
- g_object_unref (device);
- item = item->next;
- }
- g_list_free (item);
- init = TRUE;
- }
-
-finish:
- if (client) {
- g_object_unref (client);
- }
-
- klass->devices = devices;
-
- return init;
-}
-#endif /* HAVE_GUDEV */
-
-static gboolean
-gst_v4l_class_probe_devices (GstV4lElementClass * klass, gboolean check)
-{
- if (!check) {
- gchar *dev_base[] = { "/dev/video", "/dev/v4l/video", NULL };
- gint base, n, fd;
-
- while (devices) {
- gchar *device = devices->data;
- devices = g_list_remove (devices, device);
- g_free (device);
- }
-
- /* detect /dev entries */
- for (n = 0; n < 64; n++) {
- for (base = 0; dev_base[base] != NULL; base++) {
- struct stat s;
- gchar *device = g_strdup_printf ("%s%d", dev_base[base], n);
-
- /* does the /dev/ entry exist at all? */
- if (stat (device, &s) == 0) {
- /* yes: is a device attached? */
- if ((fd = open (device, O_RDONLY)) > 0 || errno == EBUSY) {
- if (fd > 0)
- close (fd);
-
- devices = g_list_append (devices, device);
- break;
- }
- }
- g_free (device);
- }
- }
-
- init = TRUE;
- }
-
- klass->devices = devices;
-
- return init;
-}
-
-static void
-gst_v4l_probe_probe_property (GstPropertyProbe * probe,
- guint prop_id, const GParamSpec * pspec)
-{
- GstV4lElementClass *klass = GST_V4LELEMENT_GET_CLASS (probe);
-
- switch (prop_id) {
- case PROP_DEVICE:
-#ifdef HAVE_GUDEV
- if (!gst_v4l_class_probe_devices_with_udev (klass, FALSE))
- gst_v4l_class_probe_devices (klass, FALSE);
-#else /* !HAVE_GUDEV */
- gst_v4l_class_probe_devices (klass, FALSE);
-#endif /* HAVE_GUDEV */
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-gst_v4l_probe_needs_probe (GstPropertyProbe * probe,
- guint prop_id, const GParamSpec * pspec)
-{
- GstV4lElementClass *klass = GST_V4LELEMENT_GET_CLASS (probe);
- gboolean ret = FALSE;
-
- switch (prop_id) {
- case PROP_DEVICE:
-#ifdef HAVE_GUDEV
- ret = !gst_v4l_class_probe_devices_with_udev (klass, FALSE);
-#else /* !HAVE_GUDEV */
- ret = !gst_v4l_class_probe_devices (klass, TRUE);
-#endif /* HAVE_GUDEV */
- ret = !gst_v4l_class_probe_devices (klass, TRUE);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
- break;
- }
-
- return ret;
-}
-
-static GValueArray *
-gst_v4l_class_list_devices (GstV4lElementClass * klass)
-{
- GValueArray *array;
- GValue value = { 0 };
- GList *item;
-
- if (!klass->devices)
- return NULL;
-
- array = g_value_array_new (g_list_length (klass->devices));
- item = klass->devices;
- g_value_init (&value, G_TYPE_STRING);
- while (item) {
- gchar *device = item->data;
-
- g_value_set_string (&value, device);
- g_value_array_append (array, &value);
-
- item = item->next;
- }
- g_value_unset (&value);
-
- return array;
-}
-
-static GValueArray *
-gst_v4l_probe_get_values (GstPropertyProbe * probe,
- guint prop_id, const GParamSpec * pspec)
-{
- GstV4lElementClass *klass = GST_V4LELEMENT_GET_CLASS (probe);
- GValueArray *array = NULL;
-
- switch (prop_id) {
- case PROP_DEVICE:
- array = gst_v4l_class_list_devices (klass);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
- break;
- }
-
- return array;
-}
-
-static void
-gst_v4l_property_probe_interface_init (GstPropertyProbeInterface * iface)
-{
- iface->get_properties = gst_v4l_probe_get_properties;
- iface->probe_property = gst_v4l_probe_probe_property;
- iface->needs_probe = gst_v4l_probe_needs_probe;
- iface->get_values = gst_v4l_probe_get_values;
-}
-
-#define GST_TYPE_V4L_DEVICE_FLAGS (gst_v4l_device_get_type ())
-static GType
-gst_v4l_device_get_type (void)
-{
- static GType v4l_device_type = 0;
-
- if (v4l_device_type == 0) {
- static const GFlagsValue values[] = {
- {VID_TYPE_CAPTURE, "CAPTURE", "Device can capture"},
- {VID_TYPE_TUNER, "TUNER", "Device has a tuner"},
- {VID_TYPE_OVERLAY, "OVERLAY", "Device can do overlay"},
- {VID_TYPE_MPEG_DECODER, "MPEG_DECODER", "Device can decode MPEG"},
- {VID_TYPE_MPEG_ENCODER, "MPEG_ENCODER", "Device can encode MPEG"},
- {VID_TYPE_MJPEG_DECODER, "MJPEG_DECODER", "Device can decode MJPEG"},
- {VID_TYPE_MJPEG_ENCODER, "MJPEG_ENCODER", "Device can encode MJPEG"},
- {0x10000, "AUDIO", "Device handles audio"},
- {0, NULL, NULL}
- };
-
- v4l_device_type = g_flags_register_static ("GstV4lDeviceTypeFlags", values);
- }
-
- return v4l_device_type;
-}
-
-static void
-gst_v4lelement_init_interfaces (GType type)
-{
- static const GInterfaceInfo v4liface_info = {
- (GInterfaceInitFunc) gst_v4l_interface_init,
- NULL,
- NULL,
- };
- static const GInterfaceInfo v4l_tuner_info = {
- (GInterfaceInitFunc) gst_v4l_tuner_interface_init,
- NULL,
- NULL,
- };
-#ifdef HAVE_XVIDEO
- static const GInterfaceInfo v4l_xoverlay_info = {
- (GInterfaceInitFunc) gst_v4l_xoverlay_interface_init,
- NULL,
- NULL,
- };
-#endif
- static const GInterfaceInfo v4l_colorbalance_info = {
- (GInterfaceInitFunc) gst_v4l_color_balance_interface_init,
- NULL,
- NULL,
- };
- static const GInterfaceInfo v4l_propertyprobe_info = {
- (GInterfaceInitFunc) gst_v4l_property_probe_interface_init,
- NULL,
- NULL,
- };
-
- g_type_add_interface_static (type,
- GST_TYPE_IMPLEMENTS_INTERFACE, &v4liface_info);
- g_type_add_interface_static (type, GST_TYPE_TUNER, &v4l_tuner_info);
-#ifdef HAVE_XVIDEO
- g_type_add_interface_static (type, GST_TYPE_X_OVERLAY, &v4l_xoverlay_info);
-#endif
- g_type_add_interface_static (type,
- GST_TYPE_COLOR_BALANCE, &v4l_colorbalance_info);
- g_type_add_interface_static (type,
- GST_TYPE_PROPERTY_PROBE, &v4l_propertyprobe_info);
-}
-
-
-static void
-gst_v4lelement_base_init (gpointer g_class)
-{
- GstV4lElementClass *klass = GST_V4LELEMENT_CLASS (g_class);
-
- klass->devices = NULL;
-
- GST_DEBUG_CATEGORY_INIT (v4lelement_debug, "v4lelement", 0,
- "V4L Base Class debug");
-}
-
-static void
-gst_v4lelement_class_init (GstV4lElementClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *element_class;
-
- gobject_class = (GObjectClass *) klass;
- element_class = GST_ELEMENT_CLASS (klass);
-
- gobject_class->set_property = gst_v4lelement_set_property;
- gobject_class->get_property = gst_v4lelement_get_property;
- gobject_class->dispose = gst_v4lelement_dispose;
-
- element_class->change_state = gst_v4lelement_change_state;
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DEVICE,
- g_param_spec_string ("device", "Device", "Device location",
- NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DEVICE_NAME,
- g_param_spec_string ("device-name", "Device name", "Name of the device",
- NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_FLAGS,
- g_param_spec_flags ("flags", "Flags", "Device type flags",
- GST_TYPE_V4L_DEVICE_FLAGS, 0,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
-}
-
-
-static void
-gst_v4lelement_init (GstV4lElement * v4lelement, GstV4lElementClass * klass)
-{
- /* some default values */
- v4lelement->video_fd = -1;
- v4lelement->buffer = NULL;
- v4lelement->videodev = g_strdup ("/dev/video0");
-
- v4lelement->norms = NULL;
- v4lelement->channels = NULL;
- v4lelement->colors = NULL;
-
- v4lelement->xwindow_id = 0;
-}
-
-
-static void
-gst_v4lelement_dispose (GObject * object)
-{
- GstV4lElement *v4lelement = GST_V4LELEMENT (object);
-
- if (v4lelement->videodev) {
- g_free (v4lelement->videodev);
- v4lelement->videodev = NULL;
- }
-
- if (((GObjectClass *) parent_class)->dispose)
- ((GObjectClass *) parent_class)->dispose (object);
-}
-
-
-static void
-gst_v4lelement_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
-{
- GstV4lElement *v4lelement = GST_V4LELEMENT (object);
-
- switch (prop_id) {
- case PROP_DEVICE:
- if (v4lelement->videodev)
- g_free (v4lelement->videodev);
- v4lelement->videodev = g_strdup (g_value_get_string (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static void
-gst_v4lelement_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- GstV4lElement *v4lelement = GST_V4LELEMENT (object);
-
- switch (prop_id) {
- case PROP_DEVICE:
- g_value_set_string (value, v4lelement->videodev);
- break;
- case PROP_DEVICE_NAME:{
- gchar *new = NULL;
-
- if (GST_V4L_IS_OPEN (v4lelement)) {
- new = v4lelement->vcap.name;
- } else if (gst_v4l_open (v4lelement)) {
- new = v4lelement->vcap.name;
- gst_v4l_close (v4lelement);
- }
- g_value_set_string (value, new);
- break;
- }
- case PROP_FLAGS:{
- guint flags = 0;
-
- if (GST_V4L_IS_OPEN (v4lelement)) {
- flags |= v4lelement->vcap.type & 0x3C0B;
- if (v4lelement->vcap.audios)
- flags |= 0x10000;
- }
- g_value_set_flags (value, flags);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstStateChangeReturn
-gst_v4lelement_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
- GstV4lElement *v4lelement = GST_V4LELEMENT (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- /* open the device */
- if (!gst_v4l_open (v4lelement))
- return GST_STATE_CHANGE_FAILURE;
-#ifdef HAVE_XVIDEO
- gst_v4l_xoverlay_start (v4lelement);
-#endif
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_NULL:
- /* close the device */
-#ifdef HAVE_XVIDEO
- gst_v4l_xoverlay_stop (v4lelement);
-#endif
- if (!gst_v4l_close (v4lelement))
- return GST_STATE_CHANGE_FAILURE;
- break;
- default:
- break;
- }
-
- return ret;
-}
diff --git a/sys/v4l/gstv4lelement.h b/sys/v4l/gstv4lelement.h
deleted file mode 100644
index 056873c4..00000000
--- a/sys/v4l/gstv4lelement.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* GStreamer
- *
- * gstv4lelement.h: base class for V4L elements
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_V4LELEMENT_H__
-#define __GST_V4LELEMENT_H__
-
-/* Because of some really cool feature in video4linux1, also known as
- * 'not including sys/types.h and sys/time.h', we had to include it
- * ourselves. In all their intelligence, these people decided to fix
- * this in the next version (video4linux2) in such a cool way that it
- * breaks all compilations of old stuff...
- * The real problem is actually that linux/time.h doesn't use proper
- * macro checks before defining types like struct timeval. The proper
- * fix here is to either fuck the kernel header (which is what we do
- * by defining _LINUX_TIME_H, an innocent little hack) or by fixing it
- * upstream, which I'll consider doing later on. If you get compiler
- * errors here, check your linux/time.h && sys/time.h header setup.
- */
-#include <sys/types.h>
-#define _LINUX_TIME_H
-#include <linux/videodev.h>
-
-#include <gst/gst.h>
-#include <gst/base/gstpushsrc.h>
-
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_V4LELEMENT \
- (gst_v4lelement_get_type())
-#define GST_V4LELEMENT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_V4LELEMENT,GstV4lElement))
-#define GST_V4LELEMENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4LELEMENT,GstV4lElementClass))
-#define GST_IS_V4LELEMENT(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4LELEMENT))
-#define GST_IS_V4LELEMENT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4LELEMENT))
-#define GST_V4LELEMENT_GET_CLASS(klass) \
- (G_TYPE_INSTANCE_GET_CLASS ((klass), GST_TYPE_V4LELEMENT, GstV4lElementClass))
-
-typedef struct _GstV4lElement GstV4lElement;
-typedef struct _GstV4lElementClass GstV4lElementClass;
-typedef struct _GstV4lXv GstV4lXv;
-
-struct _GstV4lElement {
- GstPushSrc element;
-
- /* the video device */
- char *videodev;
-
- /* the video-device's file descriptor */
- gint video_fd;
-
- /* the video buffer (mmap()'ed) */
- guint8 *buffer;
-
- /* the video device's capabilities */
- struct video_capability vcap;
-
- /* the video device's window properties */
- struct video_window vwin;
-
- /* some more info about the current input's capabilities */
- struct video_channel vchan;
-
- /* lists... */
- GList *colors;
- GList *norms;
- GList *channels;
-
- /* X-overlay */
- GstV4lXv *xv;
- gulong xwindow_id;
-};
-
-struct _GstV4lElementClass {
- GstPushSrcClass parent_class;
-
- /* probed devices */
- GList *devices;
-
- /* actions */
- gboolean (*get_attribute) (GstElement *element,
- const gchar *attr_name,
- int *value);
- gboolean (*set_attribute) (GstElement *element,
- const gchar *attr_name,
- const int value);
-};
-
-GType gst_v4lelement_get_type(void);
-
-
-G_END_DECLS
-
-#endif /* __GST_V4LELEMENT_H__ */
diff --git a/sys/v4l/gstv4ljpegsrc.c b/sys/v4l/gstv4ljpegsrc.c
deleted file mode 100644
index c640cb42..00000000
--- a/sys/v4l/gstv4ljpegsrc.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/* GStreamer
- *
- * gstv4ljpegsrc.c: V4L source element for JPEG cameras
- *
- * Copyright (C) 2004-2005 Jan Schmidt <thaytan@mad.scientist.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,
- e Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <sys/time.h>
-#include "gstv4ljpegsrc.h"
-#include "v4lsrc_calls.h"
-
-/* elementfactory information */
-static const GstElementDetails gst_v4ljpegsrc_details =
-GST_ELEMENT_DETAILS ("Video (video4linux/raw) Jpeg Source",
- "Source/Video",
- "Reads jpeg frames from a video4linux (eg ov519) device",
- "Jan Schmidt <thaytan@mad.scientist.com>");
-
-GST_DEBUG_CATEGORY_STATIC (v4ljpegsrc_debug);
-#define GST_CAT_DEFAULT v4ljpegsrc_debug
-
-/* init functions */
-static void gst_v4ljpegsrc_base_init (gpointer g_class);
-static void gst_v4ljpegsrc_class_init (GstV4lJpegSrcClass * klass);
-static void gst_v4ljpegsrc_init (GstV4lJpegSrc * v4ljpegsrc);
-
-/* buffer functions */
-static GstPadLinkReturn gst_v4ljpegsrc_src_link (GstPad * pad,
- const GstCaps * caps);
-static GstCaps *gst_v4ljpegsrc_getcaps (GstPad * pad);
-static GstData *gst_v4ljpegsrc_get (GstPad * pad);
-
-static GstElementClass *parent_class = NULL;
-
-GType
-gst_v4ljpegsrc_get_type (void)
-{
- static GType v4ljpegsrc_type = 0;
-
- if (!v4ljpegsrc_type) {
- static const GTypeInfo v4ljpegsrc_info = {
- sizeof (GstV4lJpegSrcClass),
- gst_v4ljpegsrc_base_init,
- NULL,
- (GClassInitFunc) gst_v4ljpegsrc_class_init,
- NULL,
- NULL,
- sizeof (GstV4lJpegSrc),
- 0,
- (GInstanceInitFunc) gst_v4ljpegsrc_init,
- NULL
- };
-
- v4ljpegsrc_type =
- g_type_register_static (GST_TYPE_V4LSRC, "GstV4lJpegSrc",
- &v4ljpegsrc_info, 0);
- GST_DEBUG_CATEGORY_INIT (v4ljpegsrc_debug, "v4ljpegsrc", 0,
- "V4L JPEG source element");
- }
- return v4ljpegsrc_type;
-}
-
-static void
-gst_v4ljpegsrc_base_init (gpointer g_class)
-{
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (gstelement_class, &gst_v4ljpegsrc_details);
-}
-
-static void
-gst_v4ljpegsrc_class_init (GstV4lJpegSrcClass * klass)
-{
- parent_class = g_type_class_peek_parent (klass);
-}
-
-static void
-gst_v4ljpegsrc_init (GstV4lJpegSrc * v4ljpegsrc)
-{
- GstV4lSrc *v4lsrc = GST_V4LSRC (v4ljpegsrc);
- GstPad *pad = v4lsrc->srcpad;
-
- /*
- * Stash away and then replace the getcaps and get functions on the src pad
- */
- v4ljpegsrc->getfn = GST_RPAD_GETFUNC (pad);
- v4ljpegsrc->getcapsfn = GST_RPAD_GETCAPSFUNC (pad);
-
- gst_pad_set_get_function (v4lsrc->srcpad, gst_v4ljpegsrc_get);
- gst_pad_set_getcaps_function (v4lsrc->srcpad, gst_v4ljpegsrc_getcaps);
- gst_pad_set_link_function (v4lsrc->srcpad, gst_v4ljpegsrc_src_link);
-}
-
-static GstPadLinkReturn
-gst_v4ljpegsrc_src_link (GstPad * pad, const GstCaps * vscapslist)
-{
- GstV4lJpegSrc *v4ljpegsrc;
- GstV4lSrc *v4lsrc;
- gint w, h, palette = -1;
- const GValue *fps;
- GstStructure *structure;
- gboolean was_capturing;
- struct video_window *vwin;
-
- v4ljpegsrc = GST_V4LJPEGSRC (gst_pad_get_parent (pad));
- v4lsrc = GST_V4LSRC (v4ljpegsrc);
- vwin = &GST_V4LELEMENT (v4lsrc)->vwin;
- was_capturing = v4lsrc->is_capturing;
-
- /* in case the buffers are active (which means that we already
- * did capsnego before and didn't clean up), clean up anyways */
- if (GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lsrc))) {
- if (was_capturing) {
- if (!gst_v4lsrc_capture_stop (v4lsrc))
- return GST_PAD_LINK_REFUSED;
- }
- if (!gst_v4lsrc_capture_deinit (v4lsrc))
- return GST_PAD_LINK_REFUSED;
- } else if (!GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lsrc))) {
- return GST_PAD_LINK_DELAYED;
- }
-
- structure = gst_caps_get_structure (vscapslist, 0);
-
- gst_structure_get_int (structure, "width", &w);
- gst_structure_get_int (structure, "height", &h);
- fps = gst_structure_get_value (structure, "framerate");
-
- GST_DEBUG_OBJECT (v4ljpegsrc, "linking with %dx%d at %d/%d fps", w, h,
- gst_value_get_fraction_numerator (fps),
- gst_value_get_fraction_denominator (fps));
-
- /* set framerate if it's not already correct */
- if (fps != gst_v4lsrc_get_fps (v4lsrc)) {
- int fps_index = fps / 15.0 * 16;
-
- GST_DEBUG_OBJECT (v4ljpegsrc, "Trying to set fps index %d", fps_index);
- /* set bits 16 to 21 to 0 */
- vwin->flags &= (0x3F00 - 1);
- /* set bits 16 to 21 to the index */
- vwin->flags |= fps_index << 16;
- if (!gst_v4l_set_window_properties (GST_V4LELEMENT (v4lsrc))) {
- return GST_PAD_LINK_DELAYED;
- }
- }
-
- /*
- * Try to set the camera to capture RGB24
- */
- palette = VIDEO_PALETTE_RGB24;
- v4lsrc->buffer_size = w * h * 3;
-
- GST_DEBUG_OBJECT (v4ljpegsrc, "trying to set_capture %dx%d, palette %d",
- w, h, palette);
- /* this only fills in v4lsrc->mmap values */
- if (!gst_v4lsrc_set_capture (v4lsrc, w, h, palette)) {
- GST_WARNING_OBJECT (v4ljpegsrc, "could not set_capture %dx%d, palette %d",
- w, h, palette);
- return GST_PAD_LINK_REFUSED;
- }
-
- /* first try the negotiated settings using try_capture */
- if (!gst_v4lsrc_try_capture (v4lsrc, w, h, palette)) {
- GST_DEBUG_OBJECT (v4ljpegsrc, "failed trying palette %d for %dx%d", palette,
- w, h);
- return GST_PAD_LINK_REFUSED;
- }
-
- if (!gst_v4lsrc_capture_init (v4lsrc))
- return GST_PAD_LINK_REFUSED;
-
- if (was_capturing || GST_STATE (v4lsrc) == GST_STATE_PLAYING) {
- if (!gst_v4lsrc_capture_start (v4lsrc))
- return GST_PAD_LINK_REFUSED;
- }
-
- return GST_PAD_LINK_OK;
-}
-
-static GstCaps *
-gst_v4ljpegsrc_getcaps (GstPad * pad)
-{
- GstCaps *list;
- GstV4lJpegSrc *v4ljpegsrc = GST_V4LJPEGSRC (gst_pad_get_parent (pad));
- GstV4lSrc *v4lsrc = GST_V4LSRC (v4ljpegsrc);
- struct video_capability *vcap = &GST_V4LELEMENT (v4lsrc)->vcap;
- gfloat fps = 0.0;
-
- if (!GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lsrc))) {
- return gst_caps_new_any ();
- }
- if (!v4lsrc->autoprobe) {
- /* FIXME: query current caps and return those, with _any appended */
- return gst_caps_new_any ();
- }
-
- list = gst_caps_new_simple ("image/jpeg", NULL);
- GST_DEBUG_OBJECT (v4ljpegsrc,
- "Device reports w: %d-%d, h: %d-%d, fps: %f",
- vcap->minwidth, vcap->maxwidth, vcap->minheight, vcap->maxheight, fps);
-
- if (vcap->minwidth < vcap->maxwidth) {
- gst_caps_set_simple (list, "width", GST_TYPE_INT_RANGE, vcap->minwidth,
- vcap->maxwidth, NULL);
- } else {
- gst_caps_set_simple (list, "width", G_TYPE_INT, vcap->minwidth, NULL);
- }
- if (vcap->minheight < vcap->maxheight) {
- gst_caps_set_simple (list, "height", GST_TYPE_INT_RANGE, vcap->minheight,
- vcap->maxheight, NULL);
- } else {
- gst_caps_set_simple (list, "height", G_TYPE_INT, vcap->minheight, NULL);
- }
-
- if (v4lsrc->fps_list) {
- GstStructure *structure = gst_caps_get_structure (list, 0);
-
- gst_structure_set_value (structure, "framerate", v4lsrc->fps_list);
- }
- GST_DEBUG_OBJECT (v4ljpegsrc, "caps: %" GST_PTR_FORMAT, list);
-
- return list;
-}
-
-static GstData *
-gst_v4ljpegsrc_get (GstPad * pad)
-{
- GstV4lJpegSrc *v4ljpegsrc;
- GstV4lSrc *v4lsrc;
- GstData *data;
- GstBuffer *buf;
- GstBuffer *outbuf;
- int jpeg_size;
-
- g_return_val_if_fail (pad != NULL, NULL);
- v4ljpegsrc = GST_V4LJPEGSRC (gst_pad_get_parent (pad));
- v4lsrc = GST_V4LSRC (v4ljpegsrc);
-
- /* Fetch from the v4lsrc class get fn. */
- data = v4ljpegsrc->getfn (pad);
-
- /* If not a buffer, return it unchanged */
- if (!data || (!GST_IS_BUFFER (data)))
- return data;
-
- buf = GST_BUFFER (data);
-
- /* Confirm that the buffer contains jpeg data */
-
- /*
- * Create a new subbuffer from the jpeg data
- * The first 2 bytes in the buffer are the size of the jpeg data
- */
- if (GST_BUFFER_SIZE (buf) > 2) {
- jpeg_size = (int) (GST_READ_UINT16_LE (GST_BUFFER_DATA (buf))) * 8;
- } else
- jpeg_size = 0;
-
- /* Check that the size is sensible */
- if ((jpeg_size <= 0) || (jpeg_size > GST_BUFFER_SIZE (buf) - 2)) {
- GST_ELEMENT_ERROR (v4ljpegsrc, STREAM, FORMAT, (NULL),
- ("Invalid non-jpeg frame from camera"));
- return NULL;
- }
-
- GST_DEBUG_OBJECT (v4ljpegsrc, "Creating JPEG subbuffer of size %d",
- jpeg_size);
- outbuf = gst_buffer_create_sub (buf, 2, jpeg_size);
-
- /* Copy timestamps onto the subbuffer */
- gst_buffer_stamp (outbuf, buf);
-
- /* Release the main buffer */
- gst_buffer_unref (buf);
-
- return GST_DATA (outbuf);
-}
diff --git a/sys/v4l/gstv4ljpegsrc.h b/sys/v4l/gstv4ljpegsrc.h
deleted file mode 100644
index 1d4eab01..00000000
--- a/sys/v4l/gstv4ljpegsrc.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* GStreamer
- *
- * gstv4ljpegsrc.h: V4L video source element for JPEG cameras
- *
- * Copyright (C) 2001-2005 Jan Schmidt <thaytan@mad.scientist.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_V4LJPEGSRC_H__
-#define __GST_V4LJPEGSRC_H__
-
-#include <gstv4lsrc.h>
-
-G_BEGIN_DECLS
-#define GST_TYPE_V4LJPEGSRC \
- (gst_v4ljpegsrc_get_type())
-#define GST_V4LJPEGSRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_V4LJPEGSRC,GstV4lJpegSrc))
-#define GST_V4LJPEGSRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4LJPEGSRC,GstV4lJpegSrcClass))
-#define GST_IS_V4LJPEGSRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4LJPEGSRC))
-#define GST_IS_V4LJPEGSRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4LJPEGSRC))
-typedef struct _GstV4lJpegSrc GstV4lJpegSrc;
-typedef struct _GstV4lJpegSrcClass GstV4lJpegSrcClass;
-
-struct _GstV4lJpegSrc
-{
- GstV4lSrc v4lsrc;
- GstPadGetFunction getfn;
- GstPadGetCapsFunction getcapsfn;
-};
-
-struct _GstV4lJpegSrcClass
-{
- GstV4lSrcClass parent_class;
-};
-
-GType gst_v4ljpegsrc_get_type (void);
-
-G_END_DECLS
-#endif /* __GST_V4LJPEGSRC_H__ */
diff --git a/sys/v4l/gstv4lmjpegsink.c b/sys/v4l/gstv4lmjpegsink.c
deleted file mode 100644
index ed1e9267..00000000
--- a/sys/v4l/gstv4lmjpegsink.c
+++ /dev/null
@@ -1,435 +0,0 @@
-/* GStreamer
- *
- * gstv4lmjpegsink.c: hardware MJPEG video sink plugin
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include "v4lmjpegsink_calls.h"
-
-GST_DEBUG_CATEGORY_STATIC (v4lmjpegsink_debug);
-#define GST_CAT_DEFAULT v4lmjpegsink_debug
-
-/* elementfactory information */
-static const GstElementDetails gst_v4lmjpegsink_details =
-GST_ELEMENT_DETAILS ("Video (video4linux/MJPEG) sink",
- "Sink/Video",
- "Writes MJPEG-encoded frames to a zoran MJPEG/video4linux device",
- "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
-
-/* v4lmjpegsink signals and args */
-enum
-{
- SIGNAL_FRAME_DISPLAYED,
- LAST_SIGNAL
-};
-
-enum
-{
- ARG_0,
- ARG_NUMBUFS,
- ARG_BUFSIZE,
- ARG_X_OFFSET,
- ARG_Y_OFFSET,
- ARG_FRAMES_DISPLAYED,
- ARG_FRAME_TIME
-};
-
-
-/* init functions */
-static void gst_v4lmjpegsink_base_init (gpointer g_class);
-static void gst_v4lmjpegsink_class_init (GstV4lMjpegSinkClass * klass);
-static void gst_v4lmjpegsink_init (GstV4lMjpegSink * v4lmjpegsink);
-
-/* the chain of buffers */
-static GstPadLinkReturn gst_v4lmjpegsink_sinkconnect (GstPad * pad,
- const GstCaps * vscapslist);
-static void gst_v4lmjpegsink_chain (GstPad * pad, GstData * _data);
-
-/* get/set gst object functions */
-static void gst_v4lmjpegsink_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_v4lmjpegsink_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-static GstStateChangeReturn gst_v4lmjpegsink_change_state (GstElement *
- element);
-static void gst_v4lmjpegsink_set_clock (GstElement * element, GstClock * clock);
-
-
-static GstElementClass *parent_class = NULL;
-static guint gst_v4lmjpegsink_signals[LAST_SIGNAL] = { 0 };
-
-
-GType
-gst_v4lmjpegsink_get_type (void)
-{
- static GType v4lmjpegsink_type = 0;
-
- if (!v4lmjpegsink_type) {
- static const GTypeInfo v4lmjpegsink_info = {
- sizeof (GstV4lMjpegSinkClass),
- gst_v4lmjpegsink_base_init,
- NULL,
- (GClassInitFunc) gst_v4lmjpegsink_class_init,
- NULL,
- NULL,
- sizeof (GstV4lMjpegSink),
- 0,
- (GInstanceInitFunc) gst_v4lmjpegsink_init,
- };
-
- v4lmjpegsink_type =
- g_type_register_static (GST_TYPE_V4LELEMENT, "GstV4lMjpegSink",
- &v4lmjpegsink_info, 0);
- }
- return v4lmjpegsink_type;
-}
-
-static void
-gst_v4lmjpegsink_base_init (gpointer g_class)
-{
- static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("image/jpeg, "
- "width = (int) [ 1, MAX ], "
- "height = (int) [ 1, MAX ], " "framerate = (fraction) [ 0, MAX ]")
- );
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (gstelement_class, &gst_v4lmjpegsink_details);
-
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&sink_template));
-}
-
-static void
-gst_v4lmjpegsink_class_init (GstV4lMjpegSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUMBUFS,
- g_param_spec_int ("num-buffers", "num-buffers", "num-buffers",
- G_MININT, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFSIZE,
- g_param_spec_int ("buffer-size", "buffer-size", "buffer-size",
- G_MININT, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_X_OFFSET,
- g_param_spec_int ("x-offset", "x-offset", "x-offset",
- G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_Y_OFFSET,
- g_param_spec_int ("y-offset", "y-offset", "y-offset",
- G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAMES_DISPLAYED,
- g_param_spec_int ("frames-displayed", "frames-displayed",
- "frames-displayed", G_MININT, G_MAXINT, 0,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAME_TIME,
- g_param_spec_int ("frame-time", "frame-time", "frame-time", G_MININT,
- G_MAXINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- GST_DEBUG_CATEGORY_INIT (v4lmjpegsink_debug, "v4lmjpegsink", 0,
- "V4L MJPEG sink element");
- gobject_class->set_property = gst_v4lmjpegsink_set_property;
- gobject_class->get_property = gst_v4lmjpegsink_get_property;
-
- gst_v4lmjpegsink_signals[SIGNAL_FRAME_DISPLAYED] =
- g_signal_new ("frame-displayed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstV4lMjpegSinkClass,
- frame_displayed), NULL, NULL, g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- gstelement_class->change_state = gst_v4lmjpegsink_change_state;
- gstelement_class->set_clock = gst_v4lmjpegsink_set_clock;
-}
-
-
-static void
-gst_v4lmjpegsink_init (GstV4lMjpegSink * v4lmjpegsink)
-{
- GstElementClass *klass = GST_ELEMENT_GET_CLASS (v4lmjpegsink);
-
- v4lmjpegsink->sinkpad =
- gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
- "sink"), "sink");
- gst_element_add_pad (GST_ELEMENT (v4lmjpegsink), v4lmjpegsink->sinkpad);
-
- gst_pad_set_chain_function (v4lmjpegsink->sinkpad, gst_v4lmjpegsink_chain);
- gst_pad_set_link_function (v4lmjpegsink->sinkpad,
- gst_v4lmjpegsink_sinkconnect);
-
- v4lmjpegsink->clock = NULL;
-
- v4lmjpegsink->width = -1;
- v4lmjpegsink->height = -1;
-
- v4lmjpegsink->x_offset = -1;
- v4lmjpegsink->y_offset = -1;
-
- v4lmjpegsink->numbufs = 64;
- v4lmjpegsink->bufsize = 256;
-
- GST_OBJECT_FLAG_SET (v4lmjpegsink, GST_ELEMENT_THREAD_SUGGESTED);
-}
-
-
-static GstPadLinkReturn
-gst_v4lmjpegsink_sinkconnect (GstPad * pad, const GstCaps * vscapslist)
-{
- GstV4lMjpegSink *v4lmjpegsink;
- GstStructure *structure;
-
- v4lmjpegsink = GST_V4LMJPEGSINK (gst_pad_get_parent (pad));
-
- /* in case the buffers are active (which means that we already
- * did capsnego before and didn't clean up), clean up anyways */
- if (GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsink)))
- if (!gst_v4lmjpegsink_playback_deinit (v4lmjpegsink))
- return GST_PAD_LINK_REFUSED;
-
- structure = gst_caps_get_structure (vscapslist, 0);
-
- gst_structure_get_int (structure, "width", &v4lmjpegsink->width);
- gst_structure_get_int (structure, "height", &v4lmjpegsink->height);
-
- if (!gst_v4lmjpegsink_set_playback (v4lmjpegsink, v4lmjpegsink->width, v4lmjpegsink->height, v4lmjpegsink->x_offset, v4lmjpegsink->y_offset, GST_V4LELEMENT (v4lmjpegsink)->vchan.norm, 0)) /* TODO: interlacing */
- return GST_PAD_LINK_REFUSED;
-
- /* set buffer info */
- if (!gst_v4lmjpegsink_set_buffer (v4lmjpegsink,
- v4lmjpegsink->numbufs, v4lmjpegsink->bufsize))
- return GST_PAD_LINK_REFUSED;
- if (!gst_v4lmjpegsink_playback_init (v4lmjpegsink))
- return GST_PAD_LINK_REFUSED;
-
- return GST_PAD_LINK_OK;
-
-}
-
-
-static void
-gst_v4lmjpegsink_set_clock (GstElement * element, GstClock * clock)
-{
- GstV4lMjpegSink *v4mjpegsink = GST_V4LMJPEGSINK (element);
-
- v4mjpegsink->clock = clock;
-}
-
-
-static void
-gst_v4lmjpegsink_chain (GstPad * pad, GstData * _data)
-{
- GstBuffer *buf = GST_BUFFER (_data);
- GstV4lMjpegSink *v4lmjpegsink;
- gint num;
-
- g_return_if_fail (pad != NULL);
- g_return_if_fail (GST_IS_PAD (pad));
- g_return_if_fail (buf != NULL);
-
- v4lmjpegsink = GST_V4LMJPEGSINK (gst_pad_get_parent (pad));
-
- if (v4lmjpegsink->clock) {
- GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT,
- GST_BUFFER_TIMESTAMP (buf));
-
- gst_element_wait (GST_ELEMENT (v4lmjpegsink), GST_BUFFER_TIMESTAMP (buf));
- }
-#if 0
- if (GST_BUFFER_POOL (buf) == v4lmjpegsink->bufferpool) {
- num = GPOINTER_TO_INT (GST_BUFFER_POOL_PRIVATE (buf));
- gst_v4lmjpegsink_play_frame (v4lmjpegsink, num);
- } else {
-#endif
- /* check size */
- if (GST_BUFFER_SIZE (buf) > v4lmjpegsink->breq.size) {
- GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, WRITE, (NULL),
- ("Buffer too big (%d KB), max. buffersize is %ld KB",
- GST_BUFFER_SIZE (buf) / 1024, v4lmjpegsink->breq.size / 1024));
- return;
- }
-
- /* put JPEG data to the device */
- gst_v4lmjpegsink_wait_frame (v4lmjpegsink, &num);
- memcpy (gst_v4lmjpegsink_get_buffer (v4lmjpegsink, num),
- GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
- gst_v4lmjpegsink_play_frame (v4lmjpegsink, num);
-#if 0
- }
-#endif
-
- g_signal_emit (G_OBJECT (v4lmjpegsink),
- gst_v4lmjpegsink_signals[SIGNAL_FRAME_DISPLAYED], 0);
-
- gst_buffer_unref (buf);
-}
-
-
-#if 0
-static GstBuffer *
-gst_v4lmjpegsink_buffer_new (GstBufferPool * pool,
- guint64 offset, guint size, gpointer user_data)
-{
- GstV4lMjpegSink *v4lmjpegsink = GST_V4LMJPEGSINK (user_data);
- GstBuffer *buffer = NULL;
- guint8 *data;
- gint num;
-
- if (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsink)))
- return NULL;
- if (v4lmjpegsink->breq.size < size) {
- GST_DEBUG ("Requested buffer size is too large (%d > %ld)",
- size, v4lmjpegsink->breq.size);
- return NULL;
- }
- if (!gst_v4lmjpegsink_wait_frame (v4lmjpegsink, &num))
- return NULL;
- data = gst_v4lmjpegsink_get_buffer (v4lmjpegsink, num);
- if (!data)
- return NULL;
- buffer = gst_buffer_new ();
- GST_BUFFER_DATA (buffer) = data;
- GST_BUFFER_MAXSIZE (buffer) = v4lmjpegsink->breq.size;
- GST_BUFFER_SIZE (buffer) = size;
- GST_BUFFER_POOL (buffer) = pool;
- GST_BUFFER_POOL_PRIVATE (buffer) = GINT_TO_POINTER (num);
-
- /* with this flag set, we don't need our own buffer_free() function */
- GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_DONTFREE);
-
- return buffer;
-}
-#endif
-
-
-static void
-gst_v4lmjpegsink_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
-{
- GstV4lMjpegSink *v4lmjpegsink;
-
- g_return_if_fail (GST_IS_V4LMJPEGSINK (object));
-
- v4lmjpegsink = GST_V4LMJPEGSINK (object);
-
- switch (prop_id) {
- case ARG_NUMBUFS:
- v4lmjpegsink->numbufs = g_value_get_int (value);
- break;
- case ARG_BUFSIZE:
- v4lmjpegsink->bufsize = g_value_get_int (value);
- break;
- case ARG_X_OFFSET:
- v4lmjpegsink->x_offset = g_value_get_int (value);
- break;
- case ARG_Y_OFFSET:
- v4lmjpegsink->y_offset = g_value_get_int (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static void
-gst_v4lmjpegsink_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- GstV4lMjpegSink *v4lmjpegsink;
-
- v4lmjpegsink = GST_V4LMJPEGSINK (object);
-
- switch (prop_id) {
- case ARG_FRAMES_DISPLAYED:
- g_value_set_int (value, v4lmjpegsink->frames_displayed);
- break;
- case ARG_FRAME_TIME:
- g_value_set_int (value, v4lmjpegsink->frame_time / 1000000);
- break;
- case ARG_NUMBUFS:
- g_value_set_int (value, v4lmjpegsink->numbufs);
- break;
- case ARG_BUFSIZE:
- g_value_set_int (value, v4lmjpegsink->bufsize);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static GstStateChangeReturn
-gst_v4lmjpegsink_change_state (GstElement * element, GstStateChange transition)
-{
- GstV4lMjpegSink *v4lmjpegsink;
- GstStateChangeReturn parent_value;
-
- g_return_val_if_fail (GST_IS_V4LMJPEGSINK (element),
- GST_STATE_CHANGE_FAILURE);
- v4lmjpegsink = GST_V4LMJPEGSINK (element);
-
- /* set up change state */
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- /* we used to do buffer setup here, but that's now done
- * right after capsnego */
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- /* start */
- if (!gst_v4lmjpegsink_playback_start (v4lmjpegsink))
- return GST_STATE_CHANGE_FAILURE;
- break;
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- /* de-queue all queued buffers */
- if (!gst_v4lmjpegsink_playback_stop (v4lmjpegsink))
- return GST_STATE_CHANGE_FAILURE;
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- /* stop playback, unmap all buffers */
- if (!gst_v4lmjpegsink_playback_deinit (v4lmjpegsink))
- return GST_STATE_CHANGE_FAILURE;
- break;
- }
-
- if (GST_ELEMENT_CLASS (parent_class)->change_state) {
- parent_value =
- GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- } else {
- parent_value = GST_STATE_CHANGE_FAILURE;
- }
-
- if (GST_ELEMENT_CLASS (parent_class)->change_state)
- return parent_value;
-
- return GST_STATE_CHANGE_SUCCESS;
-}
diff --git a/sys/v4l/gstv4lmjpegsink.h b/sys/v4l/gstv4lmjpegsink.h
deleted file mode 100644
index e778f53c..00000000
--- a/sys/v4l/gstv4lmjpegsink.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* GStreamer
- *
- * gstv4lmjpegsink.h: hardware MJPEG video sink element
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_V4LMJPEGSINK_H__
-#define __GST_V4LMJPEGSINK_H__
-
-#include <gstv4lelement.h>
-#include <sys/time.h>
-#include <videodev_mjpeg.h>
-
-
-G_BEGIN_DECLS
-
-
-#define GST_TYPE_V4LMJPEGSINK \
- (gst_v4lmjpegsink_get_type())
-#define GST_V4LMJPEGSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_V4LMJPEGSINK,GstV4lMjpegSink))
-#define GST_V4LMJPEGSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4LMJPEGSINK,GstV4lMjpegSinkClass))
-#define GST_IS_V4LMJPEGSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4LMJPEGSINK))
-#define GST_IS_V4LMJPEGSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4LMJPEGSINK))
-
-typedef struct _GstV4lMjpegSink GstV4lMjpegSink;
-typedef struct _GstV4lMjpegSinkClass GstV4lMjpegSinkClass;
-
-struct _GstV4lMjpegSink {
- GstV4lElement v4lelement;
-
- /* the sink pas */
- GstPad *sinkpad;
-
- /* frame properties for common players */
- gint frames_displayed;
- guint64 frame_time;
-
- /* system clock object */
- GstClock *clock;
-
- /* buffer/capture info */
- struct mjpeg_sync bsync;
- struct mjpeg_requestbuffers breq;
-
- /* thread to keep track of synced frames */
- gint8 *isqueued_queued_frames; /* 1 = queued, 0 = unqueued, -1 = error */
- GThread *thread_queued_frames;
- GMutex *mutex_queued_frames;
- GCond **cond_queued_frames;
- gint current_frame;
-
- /* width/height/norm of the jpeg stream */
- gint width;
- gint height;
- gint norm;
-
- /* cache values */
- gint x_offset;
- gint y_offset;
-
- gint numbufs;
- gint bufsize; /* in KB */
-};
-
-struct _GstV4lMjpegSinkClass {
- GstV4lElementClass parent_class;
-
- /* signals */
- void (*frame_displayed) (GstElement *element);
-};
-
-GType gst_v4lmjpegsink_get_type(void);
-
-
-G_END_DECLS
-
-#endif /* __GST_SDLVIDEOSINK_H__ */
diff --git a/sys/v4l/gstv4lmjpegsrc.c b/sys/v4l/gstv4lmjpegsrc.c
deleted file mode 100644
index fbe10a4c..00000000
--- a/sys/v4l/gstv4lmjpegsrc.c
+++ /dev/null
@@ -1,872 +0,0 @@
-/* GStreamer
- *
- * gstv4lmjpegsrc.c: hardware MJPEG video source plugin
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include "v4lmjpegsrc_calls.h"
-
-GST_DEBUG_CATEGORY (v4lmjpegsrc_debug);
-#define GST_CAT_DEFAULT v4lmjpegsrc_debug
-
-/* elementfactory information */
-static const GstElementDetails gst_v4lmjpegsrc_details =
-GST_ELEMENT_DETAILS ("Video (video4linux/MJPEG) Source",
- "Source/Video",
- "Reads MJPEG-encoded frames from a zoran MJPEG/video4linux device",
- "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
-
-/* V4lMjpegSrc signals and args */
-enum
-{
- SIGNAL_FRAME_CAPTURE,
- SIGNAL_FRAME_DROP,
- SIGNAL_FRAME_INSERT,
- SIGNAL_FRAME_LOST,
- LAST_SIGNAL
-};
-
-/* arguments */
-enum
-{
- ARG_0,
-#if 0
- ARG_X_OFFSET,
- ARG_Y_OFFSET,
- ARG_F_WIDTH,
- ARG_F_HEIGHT,
- /* normally, we would want to use subframe capture, however,
- * for the time being it's easier if we disable it first */
-#endif
- ARG_QUALITY,
- ARG_NUMBUFS,
- ARG_BUFSIZE,
- ARG_USE_FIXED_FPS
-};
-
-GST_FORMATS_FUNCTION (GstPad *, gst_v4lmjpegsrc_get_formats,
- GST_FORMAT_TIME, GST_FORMAT_DEFAULT);
-GST_QUERY_TYPE_FUNCTION (GstPad *, gst_v4lmjpegsrc_get_query_types,
- GST_QUERY_POSITION);
-
-/* init functions */
-static void gst_v4lmjpegsrc_base_init (gpointer g_class);
-static void gst_v4lmjpegsrc_class_init (GstV4lMjpegSrcClass * klass);
-static void gst_v4lmjpegsrc_init (GstV4lMjpegSrc * v4lmjpegsrc);
-
-/* pad/info functions */
-static gboolean gst_v4lmjpegsrc_src_convert (GstPad * pad,
- GstFormat src_format,
- gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
-static gboolean gst_v4lmjpegsrc_src_query (GstPad * pad,
- GstQueryType type, GstFormat * format, gint64 * value);
-
-/* buffer functions */
-static GstPadLinkReturn gst_v4lmjpegsrc_srcconnect (GstPad * pad,
- const GstCaps * caps);
-static GstData *gst_v4lmjpegsrc_get (GstPad * pad);
-static GstCaps *gst_v4lmjpegsrc_getcaps (GstPad * pad);
-
-/* get/set params */
-static void gst_v4lmjpegsrc_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_v4lmjpegsrc_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-/* set_clock function for A/V sync */
-static void gst_v4lmjpegsrc_set_clock (GstElement * element, GstClock * clock);
-
-/* state handling */
-static GstStateChangeReturn gst_v4lmjpegsrc_change_state (GstElement * element);
-
-/* requeue buffer after use */
-static void gst_v4lmjpegsrc_buffer_free (GstBuffer * buffer);
-
-static GstElementClass *parent_class = NULL;
-static guint gst_v4lmjpegsrc_signals[LAST_SIGNAL] = { 0 };
-
-
-GType
-gst_v4lmjpegsrc_get_type (void)
-{
- static GType v4lmjpegsrc_type = 0;
-
- if (!v4lmjpegsrc_type) {
- static const GTypeInfo v4lmjpegsrc_info = {
- sizeof (GstV4lMjpegSrcClass),
- gst_v4lmjpegsrc_base_init,
- NULL,
- (GClassInitFunc) gst_v4lmjpegsrc_class_init,
- NULL,
- NULL,
- sizeof (GstV4lMjpegSrc),
- 0,
- (GInstanceInitFunc) gst_v4lmjpegsrc_init,
- NULL
- };
-
- v4lmjpegsrc_type =
- g_type_register_static (GST_TYPE_V4LELEMENT, "GstV4lMjpegSrc",
- &v4lmjpegsrc_info, 0);
- }
- return v4lmjpegsrc_type;
-}
-
-
-static void
-gst_v4lmjpegsrc_base_init (gpointer g_class)
-{
- static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("image/jpeg, "
- "width = (int) [ 0, MAX ], "
- "height = (int) [ 0, MAX ], " "framerate = (fraction) [ 0, MAX ]")
- );
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (gstelement_class, &gst_v4lmjpegsrc_details);
-
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&src_template));
-}
-
-static void
-gst_v4lmjpegsrc_class_init (GstV4lMjpegSrcClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
-#if 0
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_X_OFFSET,
- g_param_spec_int ("x-offset", "x_offset", "x_offset",
- G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_Y_OFFSET,
- g_param_spec_int ("y-offset", "y_offset", "y_offset",
- G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_F_WIDTH,
- g_param_spec_int ("frame-width", "frame_width", "frame_width",
- G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_F_HEIGHT,
- g_param_spec_int ("frame-height", "frame_height", "frame_height",
- G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
-#endif
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY,
- g_param_spec_int ("quality", "Quality", "JPEG frame quality",
- 1, 100, 50, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUMBUFS,
- g_param_spec_int ("num-buffers", "Num Buffers", "Number of Buffers",
- 1, 256, 64, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFSIZE,
- g_param_spec_int ("buffer-size", "Buffer Size", "Size of buffers",
- 0, 512 * 1024, 128 * 1024,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_USE_FIXED_FPS,
- g_param_spec_boolean ("use-fixed-fps", "Use Fixed FPS",
- "Drop/Insert frames to reach a certain FPS (TRUE) "
- "or adapt FPS to suit the number of grabbed frames",
- TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /* signals */
- gst_v4lmjpegsrc_signals[SIGNAL_FRAME_CAPTURE] =
- g_signal_new ("frame-capture", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstV4lMjpegSrcClass, frame_capture),
- NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
- gst_v4lmjpegsrc_signals[SIGNAL_FRAME_DROP] =
- g_signal_new ("frame-drop", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstV4lMjpegSrcClass, frame_drop), NULL, NULL,
- g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
- gst_v4lmjpegsrc_signals[SIGNAL_FRAME_INSERT] =
- g_signal_new ("frame-insert", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstV4lMjpegSrcClass, frame_insert),
- NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
- gst_v4lmjpegsrc_signals[SIGNAL_FRAME_LOST] =
- g_signal_new ("frame-lost", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstV4lMjpegSrcClass, frame_lost), NULL, NULL,
- g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
-
- GST_DEBUG_CATEGORY_INIT (v4lmjpegsrc_debug, "v4lmjpegsrc", 0,
- "V4L MJPEG source element");
- gobject_class->set_property = gst_v4lmjpegsrc_set_property;
- gobject_class->get_property = gst_v4lmjpegsrc_get_property;
-
- gstelement_class->change_state = gst_v4lmjpegsrc_change_state;
-
- gstelement_class->set_clock = gst_v4lmjpegsrc_set_clock;
-}
-
-
-static void
-gst_v4lmjpegsrc_init (GstV4lMjpegSrc * v4lmjpegsrc)
-{
- GstElementClass *klass = GST_ELEMENT_GET_CLASS (v4lmjpegsrc);
-
- GST_OBJECT_FLAG_SET (GST_ELEMENT (v4lmjpegsrc), GST_ELEMENT_THREAD_SUGGESTED);
-
- v4lmjpegsrc->srcpad =
- gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
- "src"), "src");
- gst_element_add_pad (GST_ELEMENT (v4lmjpegsrc), v4lmjpegsrc->srcpad);
-
- gst_pad_set_get_function (v4lmjpegsrc->srcpad, gst_v4lmjpegsrc_get);
- gst_pad_set_getcaps_function (v4lmjpegsrc->srcpad, gst_v4lmjpegsrc_getcaps);
- gst_pad_set_link_function (v4lmjpegsrc->srcpad, gst_v4lmjpegsrc_srcconnect);
- gst_pad_set_convert_function (v4lmjpegsrc->srcpad,
- gst_v4lmjpegsrc_src_convert);
- gst_pad_set_formats_function (v4lmjpegsrc->srcpad,
- gst_v4lmjpegsrc_get_formats);
- gst_pad_set_query_function (v4lmjpegsrc->srcpad, gst_v4lmjpegsrc_src_query);
- gst_pad_set_query_type_function (v4lmjpegsrc->srcpad,
- gst_v4lmjpegsrc_get_query_types);
-
-#if 0
- v4lmjpegsrc->frame_width = 0;
- v4lmjpegsrc->frame_height = 0;
- v4lmjpegsrc->x_offset = -1;
- v4lmjpegsrc->y_offset = -1;
-#endif
-
- v4lmjpegsrc->quality = 50;
-
- v4lmjpegsrc->numbufs = 64;
-
- /* no clock */
- v4lmjpegsrc->clock = NULL;
-
- /* fps */
- v4lmjpegsrc->use_fixed_fps = TRUE;
-
- v4lmjpegsrc->is_capturing = FALSE;
-}
-
-
-static gboolean
-gst_v4lmjpegsrc_get_fps (GstV4lMjpegSrc * v4lmjpegsrc, GValue * fps)
-{
- gint norm;
-
- g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION (fps), FALSE);
-
- if (!v4lmjpegsrc->use_fixed_fps &&
- v4lmjpegsrc->clock != NULL && v4lmjpegsrc->handled > 0) {
- /* try to get time from clock master and calculate fps */
- GstClockTime time =
- gst_clock_get_time (v4lmjpegsrc->clock) - v4lmjpegsrc->substract_time;
- return v4lmjpegsrc->handled * GST_SECOND / time;
- }
-
- /* if that failed ... */
-
- if (!GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lmjpegsrc)))
- return FALSE;
-
- if (!gst_v4l_get_chan_norm (GST_V4LELEMENT (v4lmjpegsrc), NULL, &norm))
- return FALSE;
-
- if (norm == VIDEO_MODE_NTSC)
- gst_value_set_fraction (fps, 30000, 1001);
- else
- gst_value_set_fraction (fps, 25, 1);
-
- return TRUE;
-}
-
-static gboolean
-gst_v4lmjpegsrc_src_convert (GstPad * pad,
- GstFormat src_format,
- gint64 src_value, GstFormat * dest_format, gint64 * dest_value)
-{
- GstV4lMjpegSrc *v4lmjpegsrc;
- GValue fps = { 0 };
- gboolean result = TRUE;
-
- v4lmjpegsrc = GST_V4LMJPEGSRC (gst_pad_get_parent (pad));
-
- g_value_init (&fps, GST_VALUE_FRACTION);
- if (!gst_v4lmjpegsrc_get_fps (v4lmjpegsrc, &fps))
- return FALSE;
-
- switch (src_format) {
- case GST_FORMAT_TIME:
- switch (*dest_format) {
- case GST_FORMAT_DEFAULT:
- *dest_value = gst_util_uint64_scale (src_value,
- gst_value_get_fraction_numerator (&fps),
- gst_value_get_fraction_denominator (&fps) * GST_SECOND);
- break;
- default:
- result = FALSE;
- }
- break;
-
- case GST_FORMAT_DEFAULT:
- switch (*dest_format) {
- case GST_FORMAT_TIME:
- *dest_value = src_value * gst_util_uint64_scale_int (GST_SECOND,
- gst_value_get_fraction_denominator (&fps),
- gst_value_get_fraction_numerator (&fps));
- break;
- default:
- result = FALSE;
- }
- break;
-
- default:
- result = FALSE;
- }
-
- g_value_unset (&fps);
- return result;
-}
-
-static gboolean
-gst_v4lmjpegsrc_src_query (GstPad * pad,
- GstQueryType type, GstFormat * format, gint64 * value)
-{
- GstV4lMjpegSrc *v4lmjpegsrc = GST_V4LMJPEGSRC (gst_pad_get_parent (pad));
- gboolean res = TRUE;
- GValue fps = { 0 };
-
- g_value_init (&fps, GST_VALUE_FRACTION);
- if (!gst_v4lmjpegsrc_get_fps (v4lmjpegsrc, &fps))
- return FALSE;
-
- switch (type) {
- case GST_QUERY_POSITION:
- switch (*format) {
- case GST_FORMAT_TIME:
- *value = v4lmjpegsrc->handled * gst_util_uint64_scale_int (GST_SECOND,
- gst_value_get_fraction_denominator (&fps),
- gst_value_get_fraction_numerator (&fps));
- break;
- case GST_FORMAT_DEFAULT:
- *value = v4lmjpegsrc->handled;
- break;
- default:
- res = FALSE;
- break;
- }
- break;
- default:
- res = FALSE;
- break;
- }
-
- g_value_unset (&fps);
- return res;
-}
-
-static inline gulong
-calc_bufsize (int hor_dec, int ver_dec)
-{
- guint8 div = hor_dec * ver_dec;
- guint32 num = (1024 * 512) / (div);
- guint32 result = 2;
-
- num--;
- while (num) {
- num >>= 1;
- result <<= 1;
- }
-
- if (result > (512 * 1024))
- return (512 * 1024);
- if (result < 8192)
- return 8192;
- return result;
-}
-
-static GstPadLinkReturn
-gst_v4lmjpegsrc_srcconnect (GstPad * pad, const GstCaps * caps)
-{
- GstV4lMjpegSrc *v4lmjpegsrc = GST_V4LMJPEGSRC (gst_pad_get_parent (pad));
- gint hor_dec, ver_dec;
- gint w, h;
- gint max_w = GST_V4LELEMENT (v4lmjpegsrc)->vcap.maxwidth,
- max_h = GST_V4LELEMENT (v4lmjpegsrc)->vcap.maxheight;
- gulong bufsize;
- GstStructure *structure;
- gboolean was_capturing;
-
- /* in case the buffers are active (which means that we already
- * did capsnego before and didn't clean up), clean up anyways */
- if ((was_capturing = v4lmjpegsrc->is_capturing)) {
- if (!gst_v4lmjpegsrc_capture_stop (v4lmjpegsrc))
- return GST_PAD_LINK_REFUSED;
- }
- if (GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc))) {
- if (!gst_v4lmjpegsrc_capture_deinit (v4lmjpegsrc))
- return GST_PAD_LINK_REFUSED;
- } else if (!GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lmjpegsrc))) {
- return GST_PAD_LINK_DELAYED;
- }
-
- /* Note: basically, we don't give a damn about the opposite caps here.
- * that might seem odd, but it isn't. we know that the opposite caps is
- * either NULL or has mime type image/jpeg, and in both cases, we'll set
- * our own mime type back and it'll work. Other properties are to be set
- * by the src, not by the opposite caps */
-
- structure = gst_caps_get_structure (caps, 0);
- gst_structure_get_int (structure, "width", &w);
- gst_structure_get_int (structure, "height", &h);
-
- /* figure out decimation */
- if (w >= max_w) {
- hor_dec = 1;
- } else if (w * 2 >= max_w) {
- hor_dec = 2;
- } else {
- hor_dec = 4;
- }
- if (h >= max_h) {
- ver_dec = 1;
- } else if (h * 2 >= max_h) {
- ver_dec = 2;
- } else {
- ver_dec = 4;
- }
-
- /* calculate bufsize */
- bufsize = calc_bufsize (hor_dec, ver_dec);
-
- /* set buffer info */
- if (!gst_v4lmjpegsrc_set_buffer (v4lmjpegsrc, v4lmjpegsrc->numbufs, bufsize)) {
- return GST_PAD_LINK_REFUSED;
- }
-
- /* set capture parameters and mmap the buffers */
- if (hor_dec == ver_dec) {
- if (!gst_v4lmjpegsrc_set_capture (v4lmjpegsrc,
- hor_dec, v4lmjpegsrc->quality)) {
- return GST_PAD_LINK_REFUSED;
- }
- } else {
- if (!gst_v4lmjpegsrc_set_capture_m (v4lmjpegsrc,
- 0, 0, max_w, max_h, hor_dec, ver_dec, v4lmjpegsrc->quality)) {
- return GST_PAD_LINK_REFUSED;
- }
- }
-#if 0
- if (!v4lmjpegsrc->frame_width && !v4lmjpegsrc->frame_height &&
- v4lmjpegsrc->x_offset < 0 && v4lmjpegsrc->y_offset < 0 &&
- v4lmjpegsrc->horizontal_decimation == v4lmjpegsrc->vertical_decimation) {
- if (!gst_v4lmjpegsrc_set_capture (v4lmjpegsrc,
- v4lmjpegsrc->horizontal_decimation, v4lmjpegsrc->quality))
- return GST_PAD_LINK_REFUSED;
- } else {
- if (!gst_v4lmjpegsrc_set_capture_m (v4lmjpegsrc,
- v4lmjpegsrc->x_offset, v4lmjpegsrc->y_offset,
- v4lmjpegsrc->frame_width, v4lmjpegsrc->frame_height,
- v4lmjpegsrc->horizontal_decimation,
- v4lmjpegsrc->vertical_decimation, v4lmjpegsrc->quality))
- return GST_PAD_LINK_REFUSED;
- }
-#endif
-
- if (!gst_v4lmjpegsrc_capture_init (v4lmjpegsrc))
- return GST_PAD_LINK_REFUSED;
-
- if (was_capturing || GST_STATE (v4lmjpegsrc) == GST_STATE_PLAYING)
- if (!gst_v4lmjpegsrc_capture_start (v4lmjpegsrc))
- return GST_PAD_LINK_REFUSED;
-
- return GST_PAD_LINK_OK;
-}
-
-
-static GstData *
-gst_v4lmjpegsrc_get (GstPad * pad)
-{
- GstV4lMjpegSrc *v4lmjpegsrc;
- GstBuffer *buf;
- gint num;
- GValue fps = { 0 };
- GstClockTime duration;
- GstClockTime cur_frame_time;
-
- g_return_val_if_fail (pad != NULL, NULL);
-
- v4lmjpegsrc = GST_V4LMJPEGSRC (gst_pad_get_parent (pad));
-
- if (v4lmjpegsrc->use_fixed_fps) {
- g_value_init (&fps, GST_VALUE_FRACTION);
- duration = gst_util_uint64_scale_int (GST_SECOND,
- gst_value_get_fraction_denominator (&fps),
- gst_value_get_fraction_numerator (&fps));
- cur_frame_time =
- gst_util_uint64_scale_int (v4lmjpegsrc->handled * GST_SECOND,
- gst_value_get_fraction_denominator (&fps),
- gst_value_get_fraction_numerator (&fps));
-
-
- if (!gst_v4lmjpegsrc_get_fps (v4lmjpegsrc, &fps)) {
- g_value_unset (&fps);
- return NULL;
- }
- }
-
- if (v4lmjpegsrc->need_writes > 0) {
- /* use last frame */
- num = v4lmjpegsrc->last_frame;
- v4lmjpegsrc->need_writes--;
- } else if (v4lmjpegsrc->clock && v4lmjpegsrc->use_fixed_fps) {
- GstClockTime time;
- gboolean have_frame = FALSE;
-
- do {
- /* by default, we use the frame once */
- v4lmjpegsrc->need_writes = 1;
-
- /* grab a frame from the device */
- if (!gst_v4lmjpegsrc_grab_frame (v4lmjpegsrc, &num,
- &v4lmjpegsrc->last_size))
- return NULL;
-
- v4lmjpegsrc->last_frame = num;
- time = GST_TIMEVAL_TO_TIME (v4lmjpegsrc->bsync.timestamp) -
- v4lmjpegsrc->substract_time;
-
- /* first check whether we lost any frames according to the device */
- if (v4lmjpegsrc->last_seq != 0) {
- if (v4lmjpegsrc->bsync.seq - v4lmjpegsrc->last_seq > 1) {
- v4lmjpegsrc->need_writes =
- v4lmjpegsrc->bsync.seq - v4lmjpegsrc->last_seq;
- g_signal_emit (G_OBJECT (v4lmjpegsrc),
- gst_v4lmjpegsrc_signals[SIGNAL_FRAME_LOST], 0,
- v4lmjpegsrc->bsync.seq - v4lmjpegsrc->last_seq - 1);
- }
- }
- v4lmjpegsrc->last_seq = v4lmjpegsrc->bsync.seq;
-
- /* decide how often we're going to write the frame - set
- * v4lmjpegsrc->need_writes to (that-1) and have_frame to TRUE
- * if we're going to write it - else, just continue.
- *
- * time is generally the system or audio clock. Let's
- * say that we've written one second of audio, then we want
- * to have written one second of video too, within the same
- * timeframe. This means that if time - begin_time = X sec,
- * we want to have written X*fps frames. If we've written
- * more - drop, if we've written less - dup... */
- if (cur_frame_time - time > 1.5 * duration) {
- /* yo dude, we've got too many frames here! Drop! DROP! */
- v4lmjpegsrc->need_writes--; /* -= (v4lmjpegsrc->handled - (time / fps)); */
- g_signal_emit (G_OBJECT (v4lmjpegsrc),
- gst_v4lmjpegsrc_signals[SIGNAL_FRAME_DROP], 0);
- } else if (cur_frame_time - time < -1.5 * duration) {
- /* this means we're lagging far behind */
- v4lmjpegsrc->need_writes++; /* += ((time / fps) - v4lmjpegsrc->handled); */
- g_signal_emit (G_OBJECT (v4lmjpegsrc),
- gst_v4lmjpegsrc_signals[SIGNAL_FRAME_INSERT], 0);
- }
-
- if (v4lmjpegsrc->need_writes > 0) {
- have_frame = TRUE;
- v4lmjpegsrc->use_num_times[num] = v4lmjpegsrc->need_writes;
- v4lmjpegsrc->need_writes--;
- } else {
- gst_v4lmjpegsrc_requeue_frame (v4lmjpegsrc, num);
- }
- } while (!have_frame);
- } else {
- /* grab a frame from the device */
- if (!gst_v4lmjpegsrc_grab_frame (v4lmjpegsrc, &num,
- &v4lmjpegsrc->last_size))
- return NULL;
-
- v4lmjpegsrc->use_num_times[num] = 1;
- }
-
- buf = gst_buffer_new ();
- GST_BUFFER_FREE_DATA_FUNC (buf) = gst_v4lmjpegsrc_buffer_free;
- GST_BUFFER_PRIVATE (buf) = v4lmjpegsrc;
- GST_BUFFER_DATA (buf) = gst_v4lmjpegsrc_get_buffer (v4lmjpegsrc, num);
- GST_BUFFER_SIZE (buf) = v4lmjpegsrc->last_size;
- GST_BUFFER_MAXSIZE (buf) = v4lmjpegsrc->breq.size;
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_READONLY);
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE);
- if (v4lmjpegsrc->use_fixed_fps)
- GST_BUFFER_TIMESTAMP (buf) = cur_frame_time;
- else /* calculate time based on our own clock */
- GST_BUFFER_TIMESTAMP (buf) =
- GST_TIMEVAL_TO_TIME (v4lmjpegsrc->bsync.timestamp) -
- v4lmjpegsrc->substract_time;
-
- v4lmjpegsrc->handled++;
- g_signal_emit (G_OBJECT (v4lmjpegsrc),
- gst_v4lmjpegsrc_signals[SIGNAL_FRAME_CAPTURE], 0);
-
- return GST_DATA (buf);
-}
-
-
-static GstCaps *
-gst_v4lmjpegsrc_getcaps (GstPad * pad)
-{
- GstV4lMjpegSrc *v4lmjpegsrc = GST_V4LMJPEGSRC (gst_pad_get_parent (pad));
- struct video_capability *vcap = &GST_V4LELEMENT (v4lmjpegsrc)->vcap;
- GstCaps *caps;
- GstStructure *str;
- gint i;
- GValue w = { 0 }, h = {
- 0}, w1 = {
- 0}, h1 = {
- 0}, fps = {
- 0};
-
- if (!GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lmjpegsrc))) {
- return gst_caps_copy (gst_pad_get_pad_template_caps (pad));
- }
-
- g_value_init (&fps, GST_TYPE_FRACTION);
- gst_return_val_if_fail (gst_v4lmjpegsrc_get_fps (v4lmjpegsrc, &fps), NULL);
-
- caps = gst_caps_new_simple ("image/jpeg", NULL);
- str = gst_caps_get_structure (caps, 0);
- gst_structure_set_value (str, "framerate", &fps);
- g_value_unset (&fps);
-
- g_value_init (&w, GST_TYPE_LIST);
- g_value_init (&h, GST_TYPE_LIST);
- g_value_init (&w1, G_TYPE_INT);
- g_value_init (&h1, G_TYPE_INT);
- for (i = 0; i <= 2; i++) {
- g_value_set_int (&w1, vcap->maxwidth / (1 << i));
- g_value_set_int (&h1, vcap->maxheight / (1 << i));
- gst_value_list_append_value (&w, &w1);
- gst_value_list_append_value (&h, &h1);
- }
- g_value_unset (&h1);
- g_value_unset (&w1);
- gst_structure_set_value (str, "width", &w);
- gst_structure_set_value (str, "height", &h);
- g_value_unset (&w);
- g_value_unset (&h);
-
- return caps;
-}
-
-
-static void
-gst_v4lmjpegsrc_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
-{
- GstV4lMjpegSrc *v4lmjpegsrc;
-
- g_return_if_fail (GST_IS_V4LMJPEGSRC (object));
- v4lmjpegsrc = GST_V4LMJPEGSRC (object);
-
- switch (prop_id) {
-#if 0
- case ARG_X_OFFSET:
- v4lmjpegsrc->x_offset = g_value_get_int (value);
- break;
- case ARG_Y_OFFSET:
- v4lmjpegsrc->y_offset = g_value_get_int (value);
- break;
- case ARG_F_WIDTH:
- v4lmjpegsrc->frame_width = g_value_get_int (value);
- break;
- case ARG_F_HEIGHT:
- v4lmjpegsrc->frame_height = g_value_get_int (value);
- break;
-#endif
- case ARG_QUALITY:
- v4lmjpegsrc->quality = g_value_get_int (value);
- break;
- case ARG_NUMBUFS:
- v4lmjpegsrc->numbufs = g_value_get_int (value);
- break;
- case ARG_USE_FIXED_FPS:
- if (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc))) {
- v4lmjpegsrc->use_fixed_fps = g_value_get_boolean (value);
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static void
-gst_v4lmjpegsrc_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- GstV4lMjpegSrc *v4lmjpegsrc;
-
- g_return_if_fail (GST_IS_V4LMJPEGSRC (object));
- v4lmjpegsrc = GST_V4LMJPEGSRC (object);
-
- switch (prop_id) {
-#if 0
- case ARG_X_OFFSET:
- g_value_set_int (value, v4lmjpegsrc->x_offset);
- break;
- case ARG_Y_OFFSET:
- g_value_set_int (value, v4lmjpegsrc->y_offset);
- break;
- case ARG_F_WIDTH:
- g_value_set_int (value, v4lmjpegsrc->frame_width);
- break;
- case ARG_F_HEIGHT:
- g_value_set_int (value, v4lmjpegsrc->frame_height);
- break;
-#endif
- case ARG_QUALITY:
- g_value_set_int (value, v4lmjpegsrc->quality);
- break;
- case ARG_NUMBUFS:
- if (GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc)))
- g_value_set_int (value, v4lmjpegsrc->breq.count);
- else
- g_value_set_int (value, v4lmjpegsrc->numbufs);
- break;
- case ARG_BUFSIZE:
- g_value_set_int (value, v4lmjpegsrc->breq.size);
- break;
- case ARG_USE_FIXED_FPS:
- g_value_set_boolean (value, v4lmjpegsrc->use_fixed_fps);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static GstStateChangeReturn
-gst_v4lmjpegsrc_change_state (GstElement * element, GstStateChange transition)
-{
- GstV4lMjpegSrc *v4lmjpegsrc;
- GTimeVal time;
-
- g_return_val_if_fail (GST_IS_V4LMJPEGSRC (element), GST_STATE_CHANGE_FAILURE);
-
- v4lmjpegsrc = GST_V4LMJPEGSRC (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- /* actual buffer set-up used to be done here - but I moved
- * it to capsnego itself */
- v4lmjpegsrc->handled = 0;
- v4lmjpegsrc->need_writes = 0;
- v4lmjpegsrc->last_frame = 0;
- v4lmjpegsrc->substract_time = 0;
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- /* queue all buffer, start streaming capture */
- if (GST_V4LELEMENT (v4lmjpegsrc)->buffer &&
- !gst_v4lmjpegsrc_capture_start (v4lmjpegsrc))
- return GST_STATE_CHANGE_FAILURE;
- g_get_current_time (&time);
- v4lmjpegsrc->substract_time = GST_TIMEVAL_TO_TIME (time) -
- v4lmjpegsrc->substract_time;
- v4lmjpegsrc->last_seq = 0;
- break;
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- g_get_current_time (&time);
- v4lmjpegsrc->substract_time = GST_TIMEVAL_TO_TIME (time) -
- v4lmjpegsrc->substract_time;
- /* de-queue all queued buffers */
- if (v4lmjpegsrc->is_capturing &&
- !gst_v4lmjpegsrc_capture_stop (v4lmjpegsrc))
- return GST_STATE_CHANGE_FAILURE;
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- /* stop capturing, unmap all buffers */
- if (GST_V4LELEMENT (v4lmjpegsrc)->buffer &&
- !gst_v4lmjpegsrc_capture_deinit (v4lmjpegsrc))
- return GST_STATE_CHANGE_FAILURE;
- break;
- }
-
- if (GST_ELEMENT_CLASS (parent_class)->change_state)
- return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- return GST_STATE_CHANGE_SUCCESS;
-}
-
-
-static void
-gst_v4lmjpegsrc_set_clock (GstElement * element, GstClock * clock)
-{
- GST_V4LMJPEGSRC (element)->clock = clock;
-}
-
-
-#if 0
-static GstBuffer *
-gst_v4lmjpegsrc_buffer_new (GstBufferPool * pool,
- guint64 offset, guint size, gpointer user_data)
-{
- GstBuffer *buffer;
- GstV4lMjpegSrc *v4lmjpegsrc = GST_V4LMJPEGSRC (user_data);
-
- if (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc)))
- return NULL;
-
- buffer = gst_buffer_new ();
- if (!buffer)
- return NULL;
-
- /* TODO: add interlacing info to buffer as metadata */
- GST_BUFFER_MAXSIZE (buffer) = v4lmjpegsrc->breq.size;
- GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_DONTFREE);
-
- return buffer;
-}
-#endif
-
-static void
-gst_v4lmjpegsrc_buffer_free (GstBuffer * buf)
-{
- GstV4lMjpegSrc *v4lmjpegsrc = GST_V4LMJPEGSRC (GST_BUFFER_PRIVATE (buf));
- int n;
-
- if (gst_element_get_state (GST_ELEMENT (v4lmjpegsrc)) != GST_STATE_PLAYING)
- return; /* we've already cleaned up ourselves */
-
- for (n = 0; n < v4lmjpegsrc->breq.count; n++)
- if (GST_BUFFER_DATA (buf) == gst_v4lmjpegsrc_get_buffer (v4lmjpegsrc, n)) {
- v4lmjpegsrc->use_num_times[n]--;
- if (v4lmjpegsrc->use_num_times[n] <= 0) {
- gst_v4lmjpegsrc_requeue_frame (v4lmjpegsrc, n);
- }
- break;
- }
-
- if (n == v4lmjpegsrc->breq.count)
- GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, TOO_LAZY, (NULL),
- ("Couldn't find the buffer"));
-}
diff --git a/sys/v4l/gstv4lmjpegsrc.h b/sys/v4l/gstv4lmjpegsrc.h
deleted file mode 100644
index 2e76906b..00000000
--- a/sys/v4l/gstv4lmjpegsrc.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* GStreamer
- *
- * gstv4lmjpegsrc.h: hardware MJPEG video source element
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_V4LMJPEGSRC_H__
-#define __GST_V4LMJPEGSRC_H__
-
-#include <gstv4lelement.h>
-#include <sys/time.h>
-#include <videodev_mjpeg.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_V4LMJPEGSRC \
- (gst_v4lmjpegsrc_get_type())
-#define GST_V4LMJPEGSRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_V4LMJPEGSRC,GstV4lMjpegSrc))
-#define GST_V4LMJPEGSRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4LMJPEGSRC,GstV4lMjpegSrcClass))
-#define GST_IS_V4LMJPEGSRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4LMJPEGSRC))
-#define GST_IS_V4LMJPEGSRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4LMJPEGSRC))
-
-typedef struct _GstV4lMjpegSrc GstV4lMjpegSrc;
-typedef struct _GstV4lMjpegSrcClass GstV4lMjpegSrcClass;
-
-struct _GstV4lMjpegSrc {
- GstV4lElement v4lelement;
-
- /* pads */
- GstPad *srcpad;
-
- /* buffer/capture info */
- struct mjpeg_sync bsync;
- struct mjpeg_requestbuffers breq;
-
- /* num of queued frames and some GThread stuff
- * to wait if there's not enough */
- gint8 *frame_queue_state;
- GMutex *mutex_queue_state;
- GCond *cond_queue_state;
- gint num_queued;
- gint queue_frame;
-
- /* True if we want to stop */
- gboolean quit, is_capturing;
-
- /* A/V sync... frame counter and internal cache */
- gulong handled;
- gint last_frame;
- gint last_size;
- gint need_writes;
- gulong last_seq;
-
- /* clock */
- GstClock *clock;
-
- /* time to substract from clock time to get back to timestamp */
- GstClockTime substract_time;
-
- /* how often are we going to use each frame? */
- gint *use_num_times;
-
- /* how are we going to push buffers? */
- gboolean use_fixed_fps;
-
- /* end size */
- gint end_width, end_height;
-
- /* caching values */
-#if 0
- gint x_offset;
- gint y_offset;
- gint frame_width;
- gint frame_height;
-#endif
-
- gint quality;
- gint numbufs;
-};
-
-struct _GstV4lMjpegSrcClass {
- GstV4lElementClass parent_class;
-
- void (*frame_capture) (GObject *object);
- void (*frame_drop) (GObject *object);
- void (*frame_insert) (GObject *object);
- void (*frame_lost) (GObject *object,
- gint num_lost);
-};
-
-GType gst_v4lmjpegsrc_get_type(void);
-
-
-G_END_DECLS
-
-#endif /* __GST_V4LMJPEGSRC_H__ */
diff --git a/sys/v4l/gstv4lsrc.c b/sys/v4l/gstv4lsrc.c
deleted file mode 100644
index 08583645..00000000
--- a/sys/v4l/gstv4lsrc.c
+++ /dev/null
@@ -1,731 +0,0 @@
-/* GStreamer
- *
- * gstv4lsrc.c: BT8x8/V4L source element
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <sys/time.h>
-#include "v4lsrc_calls.h"
-#include <sys/ioctl.h>
-
-
-static const GstElementDetails gst_v4lsrc_details =
-GST_ELEMENT_DETAILS ("Video (video4linux/raw) Source",
- "Source/Video",
- "Reads raw frames from a video4linux device",
- "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
-
-
-GST_DEBUG_CATEGORY_STATIC (v4lsrc_debug);
-#define GST_CAT_DEFAULT v4lsrc_debug
-
-
-enum
-{
- PROP_0,
- PROP_AUTOPROBE,
- PROP_AUTOPROBE_FPS,
- PROP_COPY_MODE,
- PROP_TIMESTAMP_OFFSET
-};
-
-
-GST_BOILERPLATE (GstV4lSrc, gst_v4lsrc, GstV4lElement, GST_TYPE_V4LELEMENT);
-
-static GstStaticPadTemplate v4l_src_template = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("ANY")
- );
-
-/* basesrc methods */
-static gboolean gst_v4lsrc_start (GstBaseSrc * src);
-static gboolean gst_v4lsrc_stop (GstBaseSrc * src);
-static gboolean gst_v4lsrc_set_caps (GstBaseSrc * src, GstCaps * caps);
-static GstCaps *gst_v4lsrc_get_caps (GstBaseSrc * src);
-static GstFlowReturn gst_v4lsrc_create (GstPushSrc * src, GstBuffer ** out);
-static gboolean gst_v4lsrc_query (GstBaseSrc * bsrc, GstQuery * query);
-static void gst_v4lsrc_fixate (GstBaseSrc * bsrc, GstCaps * caps);
-
-static void gst_v4lsrc_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_v4lsrc_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-
-static void
-gst_v4lsrc_base_init (gpointer g_class)
-{
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (gstelement_class, &gst_v4lsrc_details);
-
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&v4l_src_template));
-}
-
-static void
-gst_v4lsrc_class_init (GstV4lSrcClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseSrcClass *basesrc_class;
- GstPushSrcClass *pushsrc_class;
-
- gobject_class = (GObjectClass *) klass;
- basesrc_class = (GstBaseSrcClass *) klass;
- pushsrc_class = (GstPushSrcClass *) klass;
-
- gobject_class->set_property = gst_v4lsrc_set_property;
- gobject_class->get_property = gst_v4lsrc_get_property;
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_AUTOPROBE,
- g_param_spec_boolean ("autoprobe", "Autoprobe",
- "Whether the device should be probed for all possible features",
- TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_AUTOPROBE_FPS,
- g_param_spec_boolean ("autoprobe-fps", "Autoprobe FPS",
- "Whether the device should be probed for framerates",
- TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_COPY_MODE,
- g_param_spec_boolean ("copy-mode", "Copy mode",
- "Whether to send out copies of buffers, or direct pointers to the mmap region",
- TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass),
- PROP_TIMESTAMP_OFFSET, g_param_spec_int64 ("timestamp-offset",
- "Timestamp offset",
- "A time offset subtracted from timestamps set on buffers (in ns)",
- G_MININT64, G_MAXINT64, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- GST_DEBUG_CATEGORY_INIT (v4lsrc_debug, "v4lsrc", 0, "V4L source element");
-
- basesrc_class->get_caps = gst_v4lsrc_get_caps;
- basesrc_class->set_caps = gst_v4lsrc_set_caps;
- basesrc_class->start = gst_v4lsrc_start;
- basesrc_class->stop = gst_v4lsrc_stop;
- basesrc_class->fixate = gst_v4lsrc_fixate;
- basesrc_class->query = gst_v4lsrc_query;
-
- pushsrc_class->create = gst_v4lsrc_create;
-}
-
-static void
-gst_v4lsrc_init (GstV4lSrc * v4lsrc, GstV4lSrcClass * klass)
-{
- v4lsrc->buffer_size = 0;
-
- /* no colorspaces */
- v4lsrc->colorspaces = NULL;
-
- v4lsrc->is_capturing = FALSE;
- v4lsrc->autoprobe = TRUE;
- v4lsrc->autoprobe_fps = TRUE;
- v4lsrc->copy_mode = TRUE;
-
- v4lsrc->timestamp_offset = 0;
-
- v4lsrc->fps_list = NULL;
-
- gst_base_src_set_format (GST_BASE_SRC (v4lsrc), GST_FORMAT_TIME);
- gst_base_src_set_live (GST_BASE_SRC (v4lsrc), TRUE);
-}
-
-static void
-gst_v4lsrc_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
-{
- GstV4lSrc *v4lsrc = GST_V4LSRC (object);
-
- switch (prop_id) {
- case PROP_AUTOPROBE:
- g_return_if_fail (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lsrc)));
- v4lsrc->autoprobe = g_value_get_boolean (value);
- break;
- case PROP_AUTOPROBE_FPS:
- g_return_if_fail (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lsrc)));
- v4lsrc->autoprobe_fps = g_value_get_boolean (value);
- break;
- case PROP_COPY_MODE:
- v4lsrc->copy_mode = g_value_get_boolean (value);
- break;
- case PROP_TIMESTAMP_OFFSET:
- v4lsrc->timestamp_offset = g_value_get_int64 (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static void
-gst_v4lsrc_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- GstV4lSrc *v4lsrc = GST_V4LSRC (object);
-
- switch (prop_id) {
- case PROP_AUTOPROBE:
- g_value_set_boolean (value, v4lsrc->autoprobe);
- break;
- case PROP_AUTOPROBE_FPS:
- g_value_set_boolean (value, v4lsrc->autoprobe_fps);
- break;
- case PROP_COPY_MODE:
- g_value_set_boolean (value, v4lsrc->copy_mode);
- break;
- case PROP_TIMESTAMP_OFFSET:
- g_value_set_int64 (value, v4lsrc->timestamp_offset);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/* this function is a bit of a last resort */
-static void
-gst_v4lsrc_fixate (GstBaseSrc * bsrc, GstCaps * caps)
-{
- GstStructure *structure;
- int i;
- int targetwidth, targetheight;
- GstV4lSrc *v4lsrc = GST_V4LSRC (bsrc);
- struct video_capability *vcap = &GST_V4LELEMENT (v4lsrc)->vcap;
- struct video_window *vwin = &GST_V4LELEMENT (v4lsrc)->vwin;
-
- if (GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lsrc))) {
- GST_DEBUG_OBJECT (v4lsrc, "device reported w: %d-%d, h: %d-%d",
- vcap->minwidth, vcap->maxwidth, vcap->minheight, vcap->maxheight);
- targetwidth = vcap->minwidth;
- targetheight = vcap->minheight;
- /* if we can get the current vwin settings, we use those to fixate */
- if (!gst_v4l_get_capabilities (GST_V4LELEMENT (v4lsrc)))
- GST_DEBUG_OBJECT (v4lsrc, "failed getting capabilities");
- else {
- targetwidth = vwin->width;
- targetheight = vwin->height;
- }
- } else {
- GST_DEBUG_OBJECT (v4lsrc, "device closed, guessing");
- targetwidth = 320;
- targetheight = 200;
- }
-
- GST_DEBUG_OBJECT (v4lsrc, "targetting %dx%d", targetwidth, targetheight);
-
- for (i = 0; i < gst_caps_get_size (caps); ++i) {
- const GValue *v;
-
- structure = gst_caps_get_structure (caps, i);
- gst_structure_fixate_field_nearest_int (structure, "width", targetwidth);
- gst_structure_fixate_field_nearest_int (structure, "height", targetheight);
- gst_structure_fixate_field_nearest_fraction (structure, "framerate", 15, 2);
-
- v = gst_structure_get_value (structure, "format");
- if (v && G_VALUE_TYPE (v) != GST_TYPE_FOURCC) {
- guint32 fourcc;
-
- g_return_if_fail (G_VALUE_TYPE (v) == GST_TYPE_LIST);
-
- fourcc = gst_value_get_fourcc (gst_value_list_get_value (v, 0));
- gst_structure_set (structure, "format", GST_TYPE_FOURCC, fourcc, NULL);
- }
- }
-}
-
-static gint all_palettes[] = {
- VIDEO_PALETTE_YUV422,
- VIDEO_PALETTE_YUV420P,
- VIDEO_PALETTE_UYVY,
- VIDEO_PALETTE_YUV411P,
- VIDEO_PALETTE_YUV422P,
- VIDEO_PALETTE_YUV410P,
- VIDEO_PALETTE_YUV411,
- VIDEO_PALETTE_RGB555,
- VIDEO_PALETTE_RGB565,
- VIDEO_PALETTE_RGB24,
- VIDEO_PALETTE_RGB32,
- -1
-};
-
-static GstCaps *
-gst_v4lsrc_palette_to_caps (int palette)
-{
- guint32 fourcc;
- GstCaps *caps;
-
- switch (palette) {
- case VIDEO_PALETTE_YUV422:
- case VIDEO_PALETTE_YUYV:
- fourcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2');
- break;
- case VIDEO_PALETTE_YUV420P:
- fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0');
- break;
- case VIDEO_PALETTE_UYVY:
- fourcc = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y');
- break;
- case VIDEO_PALETTE_YUV411P:
- fourcc = GST_MAKE_FOURCC ('Y', '4', '1', 'B');
- break;
- case VIDEO_PALETTE_YUV411:
- fourcc = GST_MAKE_FOURCC ('Y', '4', '1', 'P');
- break;
- case VIDEO_PALETTE_YUV422P:
- fourcc = GST_MAKE_FOURCC ('Y', '4', '2', 'B');
- break;
- case VIDEO_PALETTE_YUV410P:
- fourcc = GST_MAKE_FOURCC ('Y', 'U', 'V', '9');
- break;
- case VIDEO_PALETTE_RGB555:
- case VIDEO_PALETTE_RGB565:
- case VIDEO_PALETTE_RGB24:
- case VIDEO_PALETTE_RGB32:
- fourcc = GST_MAKE_FOURCC ('R', 'G', 'B', ' ');
- break;
- default:
- return NULL;
- }
-
- if (fourcc == GST_MAKE_FOURCC ('R', 'G', 'B', ' ')) {
- switch (palette) {
- case VIDEO_PALETTE_RGB555:
- caps = gst_caps_from_string ("video/x-raw-rgb, "
- "bpp = (int) 16, "
- "depth = (int) 15, "
- "endianness = (int) BYTE_ORDER, "
- "red_mask = 0x7c00, " "green_mask = 0x03e0, " "blue_mask = 0x001f");
- break;
- case VIDEO_PALETTE_RGB565:
- caps = gst_caps_from_string ("video/x-raw-rgb, "
- "bpp = (int) 16, "
- "depth = (int) 16, "
- "endianness = (int) BYTE_ORDER, "
- "red_mask = 0xf800, " "green_mask = 0x07f0, " "blue_mask = 0x001f");
- break;
- case VIDEO_PALETTE_RGB24:
- caps = gst_caps_from_string ("video/x-raw-rgb, "
- "bpp = (int) 24, "
- "depth = (int) 24, "
- "endianness = (int) BIG_ENDIAN, "
- "red_mask = 0xFF0000, "
- "green_mask = 0x00FF00, " "blue_mask = 0x0000FF");
- break;
- case VIDEO_PALETTE_RGB32:
- caps = gst_caps_from_string ("video/x-raw-rgb, "
- "bpp = (int) 32, "
- "depth = (int) 24, "
- "endianness = (int) BIG_ENDIAN, "
- "red_mask = 0xFF000000, "
- "green_mask = 0x00FF0000, " "blue_mask = 0x0000FF00");
- break;
- default:
- g_assert_not_reached ();
- return NULL;
- }
- } else {
- caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, fourcc, NULL);
- }
-
- return caps;
-}
-
-static GstCaps *
-gst_v4lsrc_get_any_caps (void)
-{
- gint i;
- GstCaps *caps = gst_caps_new_empty (), *one;
-
- for (i = 0; all_palettes[i] != -1; i++) {
- one = gst_v4lsrc_palette_to_caps (all_palettes[i]);
- gst_caps_append (caps, one);
- }
-
- return caps;
-}
-
-static GstCaps *
-gst_v4lsrc_get_caps (GstBaseSrc * src)
-{
- GstCaps *list;
- GstV4lSrc *v4lsrc = GST_V4LSRC (src);
- struct video_capability *vcap = &GST_V4LELEMENT (v4lsrc)->vcap;
- gint width = GST_V4LELEMENT (src)->vcap.minwidth;
- gint height = GST_V4LELEMENT (src)->vcap.minheight;
- gint i;
- gint fps_n, fps_d;
- GList *item;
-
- if (!GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lsrc))) {
- return gst_v4lsrc_get_any_caps ();
- }
-
- if (!v4lsrc->autoprobe) {
- /* FIXME: query current caps and return those, with _any appended */
- return gst_v4lsrc_get_any_caps ();
- }
-
- if (!v4lsrc->colorspaces) {
- GST_DEBUG_OBJECT (v4lsrc, "Checking supported palettes");
- for (i = 0; all_palettes[i] != -1; i++) {
- /* try palette out */
- if (!gst_v4lsrc_try_capture (v4lsrc, width, height, all_palettes[i]))
- continue;
- GST_DEBUG_OBJECT (v4lsrc, "Added palette %d (%s) to supported list",
- all_palettes[i], gst_v4lsrc_palette_name (all_palettes[i]));
- v4lsrc->colorspaces = g_list_append (v4lsrc->colorspaces,
- GINT_TO_POINTER (all_palettes[i]));
- }
- GST_DEBUG_OBJECT (v4lsrc, "%d palette(s) supported",
- g_list_length (v4lsrc->colorspaces));
- if (v4lsrc->autoprobe_fps) {
- GST_DEBUG_OBJECT (v4lsrc, "autoprobing framerates");
- v4lsrc->fps_list = gst_v4lsrc_get_fps_list (v4lsrc);
- }
- }
-
-
- if (!gst_v4lsrc_get_fps (v4lsrc, &fps_n, &fps_d)) {
- fps_n = 0;
- fps_d = 1;
- }
-
- list = gst_caps_new_empty ();
- for (item = v4lsrc->colorspaces; item != NULL; item = item->next) {
- GstCaps *one;
-
- one = gst_v4lsrc_palette_to_caps (GPOINTER_TO_INT (item->data));
- if (!one) {
- GST_WARNING_OBJECT (v4lsrc, "Palette %d gave no caps\n",
- GPOINTER_TO_INT (item->data));
- continue;
- }
-
- GST_DEBUG_OBJECT (v4lsrc,
- "Device reports w: %d-%d, h: %d-%d, fps: %d/%d for palette %d",
- vcap->minwidth, vcap->maxwidth, vcap->minheight, vcap->maxheight,
- fps_n, fps_d, GPOINTER_TO_INT (item->data));
-
- if (vcap->minwidth < vcap->maxwidth) {
- gst_caps_set_simple (one, "width", GST_TYPE_INT_RANGE, vcap->minwidth,
- vcap->maxwidth, NULL);
- } else {
- gst_caps_set_simple (one, "width", G_TYPE_INT, vcap->minwidth, NULL);
- }
- if (vcap->minheight < vcap->maxheight) {
- gst_caps_set_simple (one, "height", GST_TYPE_INT_RANGE, vcap->minheight,
- vcap->maxheight, NULL);
- } else {
- gst_caps_set_simple (one, "height", G_TYPE_INT, vcap->minheight, NULL);
- }
-
- if (v4lsrc->autoprobe_fps) {
- GstStructure *structure = gst_caps_get_structure (one, 0);
-
- if (v4lsrc->fps_list) {
- gst_structure_set_value (structure, "framerate", v4lsrc->fps_list);
- } else {
- gst_structure_set (structure, "framerate", GST_TYPE_FRACTION,
- fps_n, fps_d, NULL);
- }
- } else {
- gst_caps_set_simple (one, "framerate", GST_TYPE_FRACTION_RANGE,
- 1, 1, 100, 1, NULL);
- }
-
- GST_DEBUG_OBJECT (v4lsrc, "caps: %" GST_PTR_FORMAT, one);
- gst_caps_append (list, one);
- }
-
- return list;
-}
-
-static gboolean
-gst_v4lsrc_set_caps (GstBaseSrc * src, GstCaps * caps)
-{
- GstV4lSrc *v4lsrc;
- guint32 fourcc;
- gint bpp, depth, w, h, palette = -1;
- const GValue *new_fps;
- gint cur_fps_n, cur_fps_d;
- GstStructure *structure;
- struct video_window *vwin;
-
- v4lsrc = GST_V4LSRC (src);
- vwin = &GST_V4LELEMENT (v4lsrc)->vwin;
-
- /* if we're not open, punt -- we'll get setcaps'd later via negotiate */
- if (!GST_V4L_IS_OPEN (v4lsrc))
- return FALSE;
-
- /* make sure we stop capturing and dealloc buffers */
- if (GST_V4L_IS_ACTIVE (v4lsrc)) {
- if (!gst_v4lsrc_capture_stop (v4lsrc))
- return FALSE;
- if (!gst_v4lsrc_capture_deinit (v4lsrc))
- return FALSE;
- }
-
- /* it's fixed, one struct */
- structure = gst_caps_get_structure (caps, 0);
-
- if (strcmp (gst_structure_get_name (structure), "video/x-raw-yuv") == 0)
- gst_structure_get_fourcc (structure, "format", &fourcc);
- else
- fourcc = GST_MAKE_FOURCC ('R', 'G', 'B', ' ');
-
- gst_structure_get_int (structure, "width", &w);
- gst_structure_get_int (structure, "height", &h);
- new_fps = gst_structure_get_value (structure, "framerate");
-
- /* set framerate if it's not already correct */
- if (!gst_v4lsrc_get_fps (v4lsrc, &cur_fps_n, &cur_fps_d))
- return FALSE;
-
- if (new_fps) {
- GST_DEBUG_OBJECT (v4lsrc, "linking with %dx%d at %d/%d fps", w, h,
- gst_value_get_fraction_numerator (new_fps),
- gst_value_get_fraction_denominator (new_fps));
-
- if (gst_value_get_fraction_numerator (new_fps) != cur_fps_n ||
- gst_value_get_fraction_denominator (new_fps) != cur_fps_d) {
- int fps_index = (gst_value_get_fraction_numerator (new_fps) * 16) /
- (gst_value_get_fraction_denominator (new_fps) * 15);
-
- GST_DEBUG_OBJECT (v4lsrc, "Trying to set fps index %d", fps_index);
- /* set bits 16 to 21 to 0 */
- vwin->flags &= (0x3F00 - 1);
- /* set bits 16 to 21 to the index */
- vwin->flags |= fps_index << 16;
- if (!gst_v4l_set_window_properties (GST_V4LELEMENT (v4lsrc))) {
- return FALSE;
- }
- }
- }
-
- switch (fourcc) {
- case GST_MAKE_FOURCC ('I', '4', '2', '0'):
- palette = VIDEO_PALETTE_YUV420P;
- v4lsrc->buffer_size = ((w + 1) & ~1) * ((h + 1) & ~1) * 1.5;
- break;
- case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
- palette = VIDEO_PALETTE_YUV422;
- v4lsrc->buffer_size = ((w + 1) & ~1) * h * 2;
- break;
- case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
- palette = VIDEO_PALETTE_UYVY;
- v4lsrc->buffer_size = ((w + 1) & ~1) * h * 2;
- break;
- case GST_MAKE_FOURCC ('Y', '4', '1', 'B'):
- palette = VIDEO_PALETTE_YUV411P;
- v4lsrc->buffer_size = ((w + 3) & ~3) * h * 1.5;
- break;
- case GST_MAKE_FOURCC ('Y', '4', '1', 'P'):
- palette = VIDEO_PALETTE_YUV411;
- v4lsrc->buffer_size = ((w + 3) & ~3) * h * 1.5;
- break;
- case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'):
- palette = VIDEO_PALETTE_YUV410P;
- v4lsrc->buffer_size = ((w + 3) & ~3) * ((h + 3) & ~3) * 1.125;
- break;
- case GST_MAKE_FOURCC ('Y', '4', '2', 'B'):
- palette = VIDEO_PALETTE_YUV422P;
- v4lsrc->buffer_size = ((w + 1) & ~1) * h * 2;
- break;
- case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
- gst_structure_get_int (structure, "depth", &depth);
- switch (depth) {
- case 15:
- palette = VIDEO_PALETTE_RGB555;
- v4lsrc->buffer_size = w * h * 2;
- break;
- case 16:
- palette = VIDEO_PALETTE_RGB565;
- v4lsrc->buffer_size = w * h * 2;
- break;
- case 24:
- gst_structure_get_int (structure, "bpp", &bpp);
- switch (bpp) {
- case 24:
- palette = VIDEO_PALETTE_RGB24;
- v4lsrc->buffer_size = w * h * 3;
- break;
- case 32:
- palette = VIDEO_PALETTE_RGB32;
- v4lsrc->buffer_size = w * h * 4;
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
-
- if (palette == -1) {
- GST_WARNING_OBJECT (v4lsrc, "palette for fourcc %" GST_FOURCC_FORMAT
- " is -1, refusing link", GST_FOURCC_ARGS (fourcc));
- return FALSE;
- }
-
- GST_DEBUG_OBJECT (v4lsrc, "trying to set_capture %dx%d, palette %d",
- w, h, palette);
- /* this only fills in v4lsrc->mmap values */
- if (!gst_v4lsrc_set_capture (v4lsrc, w, h, palette)) {
- GST_WARNING_OBJECT (v4lsrc, "could not set_capture %dx%d, palette %d",
- w, h, palette);
- return FALSE;
- }
-
- /* first try the negotiated settings using try_capture */
- if (!gst_v4lsrc_try_capture (v4lsrc, w, h, palette)) {
- GST_DEBUG_OBJECT (v4lsrc, "failed trying palette %d for %dx%d", palette,
- w, h);
- return FALSE;
- }
-
- if (!gst_v4lsrc_capture_init (v4lsrc))
- return FALSE;
-
- if (!gst_v4lsrc_capture_start (v4lsrc))
- return FALSE;
-
- return TRUE;
-}
-
-static gboolean
-gst_v4lsrc_query (GstBaseSrc * bsrc, GstQuery * query)
-{
- GstV4lSrc *v4lsrc;
- gboolean res = FALSE;
-
- v4lsrc = GST_V4LSRC (bsrc);
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_LATENCY:
- {
- GstClockTime min_latency, max_latency;
- gint fps_n, fps_d;
-
- /* device must be open */
- if (!GST_V4L_IS_OPEN (v4lsrc))
- goto done;
-
- /* we must have a framerate */
- if (!(res = gst_v4lsrc_get_fps (v4lsrc, &fps_n, &fps_d)))
- goto done;
-
- /* min latency is the time to capture one frame */
- min_latency = gst_util_uint64_scale_int (GST_SECOND, fps_d, fps_n);
-
- /* max latency is total duration of the frame buffer */
- max_latency = v4lsrc->mbuf.frames * min_latency;
-
- GST_DEBUG_OBJECT (bsrc,
- "report latency min %" GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
- GST_TIME_ARGS (min_latency), GST_TIME_ARGS (max_latency));
-
- /* we are always live, the min latency is 1 frame and the max latency is
- * the complete buffer of frames. */
- gst_query_set_latency (query, TRUE, min_latency, max_latency);
-
- res = TRUE;
- break;
- }
- default:
- res = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
- break;
- }
-done:
- return res;
-}
-
-/* start and stop are not symmetric -- start will open the device, but not start
- capture. it's setcaps that will start capture, which is called via basesrc's
- negotiate method. stop will both stop capture and close the device.
- */
-static gboolean
-gst_v4lsrc_start (GstBaseSrc * src)
-{
- GstV4lSrc *v4lsrc = GST_V4LSRC (src);
-
- v4lsrc->offset = 0;
-
- return TRUE;
-}
-
-static gboolean
-gst_v4lsrc_stop (GstBaseSrc * src)
-{
- GstV4lSrc *v4lsrc = GST_V4LSRC (src);
-
- if (GST_V4L_IS_ACTIVE (v4lsrc) && !gst_v4lsrc_capture_stop (v4lsrc))
- return FALSE;
-
- if (GST_V4LELEMENT (v4lsrc)->buffer != NULL) {
- if (!gst_v4lsrc_capture_deinit (v4lsrc))
- return FALSE;
- }
-
- g_list_free (v4lsrc->colorspaces);
- v4lsrc->colorspaces = NULL;
-
- if (v4lsrc->fps_list) {
- g_value_unset (v4lsrc->fps_list);
- g_free (v4lsrc->fps_list);
- v4lsrc->fps_list = NULL;
- }
-
- return TRUE;
-}
-
-static GstFlowReturn
-gst_v4lsrc_create (GstPushSrc * src, GstBuffer ** buf)
-{
- GstV4lSrc *v4lsrc;
- gint num;
-
- v4lsrc = GST_V4LSRC (src);
-
- /* grab a frame from the device */
- if (!gst_v4lsrc_grab_frame (v4lsrc, &num))
- return GST_FLOW_ERROR;
-
- *buf = gst_v4lsrc_buffer_new (v4lsrc, num);
-
- if (v4lsrc->copy_mode) {
- GstBuffer *copy = gst_buffer_copy (*buf);
-
- gst_buffer_unref (*buf);
- *buf = copy;
- }
-
- return GST_FLOW_OK;
-}
diff --git a/sys/v4l/gstv4lsrc.h b/sys/v4l/gstv4lsrc.h
deleted file mode 100644
index fbed86a2..00000000
--- a/sys/v4l/gstv4lsrc.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* GStreamer
- *
- * gstv4lsrc.h: BT8x8/V4L video source element
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_V4LSRC_H__
-#define __GST_V4LSRC_H__
-
-
-#include <gstv4lelement.h>
-
-
-G_BEGIN_DECLS
-
-
-#define GST_TYPE_V4LSRC \
- (gst_v4lsrc_get_type())
-#define GST_V4LSRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_V4LSRC,GstV4lSrc))
-#define GST_V4LSRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4LSRC,GstV4lSrcClass))
-#define GST_IS_V4LSRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4LSRC))
-#define GST_IS_V4LSRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4LSRC))
-
-
-typedef struct _GstV4lSrc GstV4lSrc;
-typedef struct _GstV4lSrcClass GstV4lSrcClass;
-
-
-enum
-{
- QUEUE_STATE_ERROR = -1,
- QUEUE_STATE_READY_FOR_QUEUE, /* the frame is ready to be queued for capture */
- QUEUE_STATE_QUEUED, /* the frame is queued for capture */
- QUEUE_STATE_SYNCED /* the frame is captured */
-};
-
-
-struct _GstV4lSrc
-{
- GstV4lElement v4lelement;
-
- /* pads */
- GstPad *srcpad;
-
- /* capture/buffer info */
- struct video_mmap mmap;
- struct video_mbuf mbuf;
- guint buffer_size;
- GstClockTime timestamp_sync;
-
- /* num of queued frames and some GThread stuff
- * to wait if there's not enough */
- gint8 *frame_queue_state;
- GMutex *mutex_queue_state;
- GCond *cond_queue_state;
- gint num_queued;
- gint sync_frame, queue_frame;
- gboolean is_capturing;
- GstClockTimeDiff timestamp_offset;
-
- /* True if we want to stop */
- gboolean quit;
-
- gint offset;
-
- /* list of supported colorspaces (as integers) */
- GList *colorspaces;
-
- gboolean autoprobe; /* probe features on startup ? */
- gboolean autoprobe_fps; /* probe fps on startup ? */
- gboolean copy_mode;
-
- GValue *fps_list; /* list of fps probed */
-};
-
-struct _GstV4lSrcClass
-{
- GstV4lElementClass parent_class;
-};
-
-
-GType gst_v4lsrc_get_type (void);
-
-
-G_END_DECLS
-
-
-#endif /* __GST_V4LSRC_H__ */
diff --git a/sys/v4l/gstv4ltuner.c b/sys/v4l/gstv4ltuner.c
deleted file mode 100644
index 8f432b4b..00000000
--- a/sys/v4l/gstv4ltuner.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/* GStreamer
- *
- * gstv4ltuner.c: tuner interface implementation for V4L
- *
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-#include "gstv4ltuner.h"
-#include "gstv4lelement.h"
-#include "v4l_calls.h"
-
-static void gst_v4l_tuner_channel_class_init (GstV4lTunerChannelClass * klass);
-static void gst_v4l_tuner_channel_init (GstV4lTunerChannel * channel);
-
-static void gst_v4l_tuner_norm_class_init (GstV4lTunerNormClass * klass);
-static void gst_v4l_tuner_norm_init (GstV4lTunerNorm * norm);
-
-static const GList *gst_v4l_tuner_list_channels (GstTuner * tuner);
-static void gst_v4l_tuner_set_channel (GstTuner * tuner,
- GstTunerChannel * channel);
-static GstTunerChannel *gst_v4l_tuner_get_channel (GstTuner * tuner);
-
-static const GList *gst_v4l_tuner_list_norms (GstTuner * tuner);
-static void gst_v4l_tuner_set_norm (GstTuner * tuner, GstTunerNorm * norm);
-static GstTunerNorm *gst_v4l_tuner_get_norm (GstTuner * tuner);
-
-static void gst_v4l_tuner_set_frequency (GstTuner * tuner,
- GstTunerChannel * channel, gulong frequency);
-static gulong gst_v4l_tuner_get_frequency (GstTuner * tuner,
- GstTunerChannel * channel);
-static gint gst_v4l_tuner_signal_strength (GstTuner * tuner,
- GstTunerChannel * channel);
-
-static GstTunerNormClass *norm_parent_class = NULL;
-static GstTunerChannelClass *channel_parent_class = NULL;
-
-GType
-gst_v4l_tuner_channel_get_type (void)
-{
- static GType gst_v4l_tuner_channel_type = 0;
-
- if (!gst_v4l_tuner_channel_type) {
- static const GTypeInfo v4l_tuner_channel_info = {
- sizeof (GstV4lTunerChannelClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_v4l_tuner_channel_class_init,
- NULL,
- NULL,
- sizeof (GstV4lTunerChannel),
- 0,
- (GInstanceInitFunc) gst_v4l_tuner_channel_init,
- NULL
- };
-
- gst_v4l_tuner_channel_type =
- g_type_register_static (GST_TYPE_TUNER_CHANNEL,
- "GstV4lTunerChannel", &v4l_tuner_channel_info, 0);
- }
-
- return gst_v4l_tuner_channel_type;
-}
-
-static void
-gst_v4l_tuner_channel_class_init (GstV4lTunerChannelClass * klass)
-{
- channel_parent_class = g_type_class_peek_parent (klass);
-}
-
-static void
-gst_v4l_tuner_channel_init (GstV4lTunerChannel * channel)
-{
- channel->index = 0;
- channel->audio = 0;
- channel->tuner = 0;
-}
-
-GType
-gst_v4l_tuner_norm_get_type (void)
-{
- static GType gst_v4l_tuner_norm_type = 0;
-
- if (!gst_v4l_tuner_norm_type) {
- static const GTypeInfo v4l_tuner_norm_info = {
- sizeof (GstV4lTunerNormClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_v4l_tuner_norm_class_init,
- NULL,
- NULL,
- sizeof (GstV4lTunerNorm),
- 0,
- (GInstanceInitFunc) gst_v4l_tuner_norm_init,
- NULL
- };
-
- gst_v4l_tuner_norm_type =
- g_type_register_static (GST_TYPE_TUNER_NORM,
- "GstV4lTunerNorm", &v4l_tuner_norm_info, 0);
- }
-
- return gst_v4l_tuner_norm_type;
-}
-
-static void
-gst_v4l_tuner_norm_class_init (GstV4lTunerNormClass * klass)
-{
- norm_parent_class = g_type_class_peek_parent (klass);
-}
-
-static void
-gst_v4l_tuner_norm_init (GstV4lTunerNorm * norm)
-{
- norm->index = 0;
-}
-
-void
-gst_v4l_tuner_interface_init (GstTunerClass * klass)
-{
- /* default virtual functions */
- klass->list_channels = gst_v4l_tuner_list_channels;
- klass->set_channel = gst_v4l_tuner_set_channel;
- klass->get_channel = gst_v4l_tuner_get_channel;
-
- klass->list_norms = gst_v4l_tuner_list_norms;
- klass->set_norm = gst_v4l_tuner_set_norm;
- klass->get_norm = gst_v4l_tuner_get_norm;
-
- klass->set_frequency = gst_v4l_tuner_set_frequency;
- klass->get_frequency = gst_v4l_tuner_get_frequency;
- klass->signal_strength = gst_v4l_tuner_signal_strength;
-}
-
-static G_GNUC_UNUSED gboolean
-gst_v4l_tuner_contains_channel (GstV4lElement * v4lelement,
- GstV4lTunerChannel * v4lchannel)
-{
- const GList *item;
-
- for (item = v4lelement->channels; item != NULL; item = item->next)
- if (item->data == v4lchannel)
- return TRUE;
-
- return FALSE;
-}
-
-static const GList *
-gst_v4l_tuner_list_channels (GstTuner * tuner)
-{
- return GST_V4LELEMENT (tuner)->channels;
-}
-
-static void
-gst_v4l_tuner_set_channel (GstTuner * tuner, GstTunerChannel * channel)
-{
- GstV4lElement *v4lelement = GST_V4LELEMENT (tuner);
- GstV4lTunerChannel *v4lchannel = GST_V4L_TUNER_CHANNEL (channel);
- gint norm;
-
- /* assert that we're opened and that we're using a known item */
- g_return_if_fail (GST_V4L_IS_OPEN (v4lelement));
- g_return_if_fail (gst_v4l_tuner_contains_channel (v4lelement, v4lchannel));
-
- gst_v4l_get_chan_norm (v4lelement, NULL, &norm);
- gst_v4l_set_chan_norm (v4lelement, v4lchannel->index, norm);
-}
-
-static GstTunerChannel *
-gst_v4l_tuner_get_channel (GstTuner * tuner)
-{
- GstV4lElement *v4lelement = GST_V4LELEMENT (tuner);
- GList *item;
- gint channel;
-
- /* assert that we're opened */
- g_return_val_if_fail (GST_V4L_IS_OPEN (v4lelement), NULL);
-
- gst_v4l_get_chan_norm (v4lelement, &channel, NULL);
-
- for (item = v4lelement->channels; item != NULL; item = item->next) {
- if (channel == GST_V4L_TUNER_CHANNEL (item->data)->index)
- return GST_TUNER_CHANNEL (item->data);
- }
-
- return NULL;
-}
-
-static G_GNUC_UNUSED gboolean
-gst_v4l_tuner_contains_norm (GstV4lElement * v4lelement,
- GstV4lTunerNorm * v4lnorm)
-{
- const GList *item;
-
- for (item = v4lelement->norms; item != NULL; item = item->next)
- if (item->data == v4lnorm)
- return TRUE;
-
- return FALSE;
-}
-
-static const GList *
-gst_v4l_tuner_list_norms (GstTuner * tuner)
-{
- return GST_V4LELEMENT (tuner)->norms;
-}
-
-static void
-gst_v4l_tuner_set_norm (GstTuner * tuner, GstTunerNorm * norm)
-{
- GstV4lElement *v4lelement = GST_V4LELEMENT (tuner);
- GstV4lTunerNorm *v4lnorm = GST_V4L_TUNER_NORM (norm);
- gint channel;
-
- /* assert that we're opened and that we're using a known item */
- g_return_if_fail (GST_V4L_IS_OPEN (v4lelement));
- g_return_if_fail (gst_v4l_tuner_contains_norm (v4lelement, v4lnorm));
-
- gst_v4l_get_chan_norm (v4lelement, &channel, NULL);
- gst_v4l_set_chan_norm (v4lelement, channel, v4lnorm->index);
-}
-
-static GstTunerNorm *
-gst_v4l_tuner_get_norm (GstTuner * tuner)
-{
- GstV4lElement *v4lelement = GST_V4LELEMENT (tuner);
- GList *item;
- gint norm;
-
- /* assert that we're opened */
- g_return_val_if_fail (GST_V4L_IS_OPEN (v4lelement), NULL);
-
- gst_v4l_get_chan_norm (v4lelement, NULL, &norm);
-
- for (item = v4lelement->norms; item != NULL; item = item->next) {
- if (norm == GST_V4L_TUNER_NORM (item->data)->index)
- return GST_TUNER_NORM (item->data);
- }
-
- return NULL;
-}
-
-static void
-gst_v4l_tuner_set_frequency (GstTuner * tuner,
- GstTunerChannel * channel, gulong frequency)
-{
- GstV4lElement *v4lelement = GST_V4LELEMENT (tuner);
- GstV4lTunerChannel *v4lchannel = GST_V4L_TUNER_CHANNEL (channel);
- gint chan;
-
- /* assert that we're opened and that we're using a known item */
- g_return_if_fail (GST_V4L_IS_OPEN (v4lelement));
- g_return_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
- GST_TUNER_CHANNEL_FREQUENCY));
- g_return_if_fail (gst_v4l_tuner_contains_channel (v4lelement, v4lchannel));
-
- gst_v4l_get_chan_norm (v4lelement, &chan, NULL);
- if (chan == GST_V4L_TUNER_CHANNEL (channel)->index) {
- gst_v4l_set_frequency (v4lelement, v4lchannel->tuner, frequency);
- }
-}
-
-static gulong
-gst_v4l_tuner_get_frequency (GstTuner * tuner, GstTunerChannel * channel)
-{
- GstV4lElement *v4lelement = GST_V4LELEMENT (tuner);
- GstV4lTunerChannel *v4lchannel = GST_V4L_TUNER_CHANNEL (channel);
- gint chan;
- gulong frequency = 0;
-
- /* assert that we're opened and that we're using a known item */
- g_return_val_if_fail (GST_V4L_IS_OPEN (v4lelement), 0);
- g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
- GST_TUNER_CHANNEL_FREQUENCY), 0);
- g_return_val_if_fail (gst_v4l_tuner_contains_channel (v4lelement,
- v4lchannel), 0);
-
- gst_v4l_get_chan_norm (v4lelement, &chan, NULL);
- if (chan == GST_V4L_TUNER_CHANNEL (channel)->index) {
- gst_v4l_get_frequency (v4lelement, v4lchannel->tuner, &frequency);
- }
-
- return frequency;
-}
-
-static gint
-gst_v4l_tuner_signal_strength (GstTuner * tuner, GstTunerChannel * channel)
-{
- GstV4lElement *v4lelement = GST_V4LELEMENT (tuner);
- GstV4lTunerChannel *v4lchannel = GST_V4L_TUNER_CHANNEL (channel);
- gint chan;
- guint signal = 0;
-
- /* assert that we're opened and that we're using a known item */
- g_return_val_if_fail (GST_V4L_IS_OPEN (v4lelement), 0);
- g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
- GST_TUNER_CHANNEL_FREQUENCY), 0);
- g_return_val_if_fail (gst_v4l_tuner_contains_channel (v4lelement,
- v4lchannel), 0);
-
- gst_v4l_get_chan_norm (v4lelement, &chan, NULL);
- if (chan == GST_V4L_TUNER_CHANNEL (channel)->index &&
- GST_TUNER_CHANNEL_HAS_FLAG (channel, GST_TUNER_CHANNEL_FREQUENCY)) {
- gst_v4l_get_signal (v4lelement, v4lchannel->tuner, &signal);
- }
-
- return (gint) signal;
-}
diff --git a/sys/v4l/gstv4ltuner.h b/sys/v4l/gstv4ltuner.h
deleted file mode 100644
index ca5b93aa..00000000
--- a/sys/v4l/gstv4ltuner.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* GStreamer
- *
- * gstv4ltuner.h: tuner interface implementation for V4L
- *
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_V4L_TUNER_H__
-#define __GST_V4L_TUNER_H__
-
-#include <gst/gst.h>
-#include <gst/interfaces/tuner.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_V4L_TUNER_CHANNEL \
- (gst_v4l_tuner_channel_get_type ())
-#define GST_V4L_TUNER_CHANNEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_V4L_TUNER_CHANNEL, \
- GstV4lTunerChannel))
-#define GST_V4L_TUNER_CHANNEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_V4L_TUNER_CHANNEL, \
- GstV4lTunerChannelClass))
-#define GST_IS_V4L_TUNER_CHANNEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_V4L_TUNER_CHANNEL))
-#define GST_IS_V4L_TUNER_CHANNEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_V4L_TUNER_CHANNEL))
-
-typedef struct _GstV4lTunerChannel {
- GstTunerChannel parent;
-
- gint index;
- gint tuner;
- gint audio;
-} GstV4lTunerChannel;
-
-typedef struct _GstV4lTunerChannelClass {
- GstTunerChannelClass parent;
-} GstV4lTunerChannelClass;
-
-#define GST_TYPE_V4L_TUNER_NORM \
- (gst_v4l_tuner_norm_get_type ())
-#define GST_V4L_TUNER_NORM(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_V4L_TUNER_NORM, \
- GstV4lTunerNorm))
-#define GST_V4L_TUNER_NORM_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_V4L_TUNER_NORM, \
- GstV4lTunerNormClass))
-#define GST_IS_V4L_TUNER_NORM(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_V4L_TUNER_NORM))
-#define GST_IS_V4L_TUNER_NORM_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_V4L_TUNER_NORM))
-
-typedef struct _GstV4lTunerNorm {
- GstTunerNorm parent;
-
- gint index;
-} GstV4lTunerNorm;
-
-typedef struct _GstV4lTunerNormClass {
- GstTunerNormClass parent;
-} GstV4lTunerNormClass;
-
-GType gst_v4l_tuner_channel_get_type (void);
-GType gst_v4l_tuner_norm_get_type (void);
-
-void gst_v4l_tuner_interface_init (GstTunerClass *klass);
-
-#endif /* __GST_V4L_TUNER_H__ */
diff --git a/sys/v4l/gstv4lxoverlay.c b/sys/v4l/gstv4lxoverlay.c
deleted file mode 100644
index cefb8835..00000000
--- a/sys/v4l/gstv4lxoverlay.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/* GStreamer
- *
- * gstv4lxoverlay.c: X-based overlay interface implementation for V4L
- *
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <sys/stat.h>
-
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/Xvlib.h>
-
-#include "gstv4lxoverlay.h"
-#include "gstv4lelement.h"
-#include "v4l_calls.h"
-
-GST_DEBUG_CATEGORY_STATIC (v4lxv_debug);
-#define GST_CAT_DEFAULT v4lxv_debug
-
-struct _GstV4lXv
-{
- Display *dpy;
- gint port, idle_id;
- GMutex *mutex;
-};
-
-static void gst_v4l_xoverlay_set_xwindow_id (GstXOverlay * overlay,
- XID xwindow_id);
-
-void
-gst_v4l_xoverlay_interface_init (GstXOverlayClass * klass)
-{
- /* default virtual functions */
- klass->set_xwindow_id = gst_v4l_xoverlay_set_xwindow_id;
-
- GST_DEBUG_CATEGORY_INIT (v4lxv_debug, "v4lxv", 0,
- "V4L XOverlay interface debugging");
-}
-
-static void
-gst_v4l_xoverlay_open (GstV4lElement * v4lelement)
-{
- struct stat s;
- GstV4lXv *v4lxv;
- const gchar *name = g_getenv ("DISPLAY");
- unsigned int ver, rel, req, ev, err, anum;
- int i, id = 0, first_id = 0, min;
- XvAdaptorInfo *ai;
- Display *dpy;
-
- /* we need a display, obviously */
- if (!name || !(dpy = XOpenDisplay (name))) {
- GST_WARNING ("No $DISPLAY set or failed to open - no overlay");
- return;
- }
-
- /* First let's check that XVideo extension is available */
- if (!XQueryExtension (dpy, "XVideo", &i, &i, &i)) {
- GST_WARNING ("Xv extension not available - no overlay");
- XCloseDisplay (dpy);
- return;
- }
-
- /* find port that belongs to this device */
- if (XvQueryExtension (dpy, &ver, &rel, &req, &ev, &err) != Success) {
- GST_WARNING ("Xv extension not supported - no overlay");
- XCloseDisplay (dpy);
- return;
- }
- if (XvQueryAdaptors (dpy, DefaultRootWindow (dpy), &anum, &ai) != Success) {
- GST_WARNING ("Failed to query Xv adaptors");
- XCloseDisplay (dpy);
- return;
- }
- if (fstat (v4lelement->video_fd, &s) < 0) {
- GST_ERROR ("Failed to stat() file descriptor: %s", g_strerror (errno));
- XCloseDisplay (dpy);
- return;
- }
- min = s.st_rdev & 0xff;
- for (i = 0; i < anum; i++) {
- if (!strcmp (ai[i].name, "video4linux")) {
- if (first_id == 0)
- first_id = ai[i].base_id;
-
- /* hmm... */
- if (first_id != 0 && ai[i].base_id == first_id + min)
- id = ai[i].base_id;
- }
- }
- XvFreeAdaptorInfo (ai);
-
- if (id == 0) {
- GST_WARNING ("Did not find XvPortID for device - no overlay");
- XCloseDisplay (dpy);
- return;
- }
-
- v4lxv = g_new0 (GstV4lXv, 1);
- v4lxv->dpy = dpy;
- v4lxv->port = id;
- v4lxv->mutex = g_mutex_new ();
- v4lxv->idle_id = 0;
- v4lelement->xv = v4lxv;
-
- if (v4lelement->xwindow_id) {
- gst_v4l_xoverlay_set_xwindow_id (GST_X_OVERLAY (v4lelement),
- v4lelement->xwindow_id);
- }
-}
-
-static void
-gst_v4l_xoverlay_close (GstV4lElement * v4lelement)
-{
- GstV4lXv *v4lxv = v4lelement->xv;
-
- if (!v4lelement->xv)
- return;
-
- if (v4lelement->xwindow_id) {
- gst_v4l_xoverlay_set_xwindow_id (GST_X_OVERLAY (v4lelement), 0);
- }
-
- XCloseDisplay (v4lxv->dpy);
- g_mutex_free (v4lxv->mutex);
- if (v4lxv->idle_id)
- g_source_remove (v4lxv->idle_id);
- g_free (v4lxv);
- v4lelement->xv = NULL;
-}
-
-void
-gst_v4l_xoverlay_start (GstV4lElement * v4lelement)
-{
- if (v4lelement->xwindow_id) {
- gst_v4l_xoverlay_open (v4lelement);
- }
-}
-
-void
-gst_v4l_xoverlay_stop (GstV4lElement * v4lelement)
-{
- gst_v4l_xoverlay_close (v4lelement);
-}
-
-static gboolean
-idle_refresh (gpointer data)
-{
- GstV4lElement *v4lelement = GST_V4LELEMENT (data);
- GstV4lXv *v4lxv = v4lelement->xv;
- XWindowAttributes attr;
-
- if (v4lxv) {
- g_mutex_lock (v4lxv->mutex);
-
- XGetWindowAttributes (v4lxv->dpy, v4lelement->xwindow_id, &attr);
- XvPutVideo (v4lxv->dpy, v4lxv->port, v4lelement->xwindow_id,
- DefaultGC (v4lxv->dpy, DefaultScreen (v4lxv->dpy)),
- 0, 0, attr.width, attr.height, 0, 0, attr.width, attr.height);
-
- v4lxv->idle_id = 0;
- g_mutex_unlock (v4lxv->mutex);
- }
-
- /* once */
- return FALSE;
-}
-
-static void
-gst_v4l_xoverlay_set_xwindow_id (GstXOverlay * overlay, XID xwindow_id)
-{
- GstV4lElement *v4lelement = GST_V4LELEMENT (overlay);
- GstV4lXv *v4lxv;
- XWindowAttributes attr;
- gboolean change = (v4lelement->xwindow_id != xwindow_id);
-
- GST_LOG_OBJECT (v4lelement, "Changing port to %lx", xwindow_id);
-
- if (!v4lelement->xv && GST_V4L_IS_OPEN (v4lelement))
- gst_v4l_xoverlay_open (v4lelement);
-
- v4lxv = v4lelement->xv;
-
- if (v4lxv)
- g_mutex_lock (v4lxv->mutex);
-
- if (change) {
- if (v4lelement->xwindow_id && v4lxv) {
- GST_DEBUG_OBJECT (v4lelement,
- "Disabling port %lx", v4lelement->xwindow_id);
-
- XvSelectPortNotify (v4lxv->dpy, v4lxv->port, 0);
- XvSelectVideoNotify (v4lxv->dpy, v4lelement->xwindow_id, 0);
- XvStopVideo (v4lxv->dpy, v4lxv->port, v4lelement->xwindow_id);
- }
-
- v4lelement->xwindow_id = xwindow_id;
- }
-
- if (!v4lxv || xwindow_id == 0) {
- if (v4lxv)
- g_mutex_unlock (v4lxv->mutex);
- return;
- }
-
- if (change) {
- GST_DEBUG_OBJECT (v4lelement, "Enabling port %lx", xwindow_id);
-
- /* draw */
- XvSelectPortNotify (v4lxv->dpy, v4lxv->port, 1);
- XvSelectVideoNotify (v4lxv->dpy, v4lelement->xwindow_id, 1);
- }
-
- XGetWindowAttributes (v4lxv->dpy, v4lelement->xwindow_id, &attr);
- XvPutVideo (v4lxv->dpy, v4lxv->port, v4lelement->xwindow_id,
- DefaultGC (v4lxv->dpy, DefaultScreen (v4lxv->dpy)),
- 0, 0, attr.width, attr.height, 0, 0, attr.width, attr.height);
-
- if (v4lxv->idle_id)
- g_source_remove (v4lxv->idle_id);
- v4lxv->idle_id = g_idle_add (idle_refresh, v4lelement);
- g_mutex_unlock (v4lxv->mutex);
-}
diff --git a/sys/v4l/gstv4lxoverlay.h b/sys/v4l/gstv4lxoverlay.h
deleted file mode 100644
index 959e5c9c..00000000
--- a/sys/v4l/gstv4lxoverlay.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* GStreamer
- *
- * gstv4lxoverlay.h: tv mixer interface implementation for V4L
- *
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_V4L_X_OVERLAY_H__
-#define __GST_V4L_X_OVERLAY_H__
-
-#include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
-
-#include "gstv4lelement.h"
-
-G_BEGIN_DECLS
-
-void gst_v4l_xoverlay_interface_init (GstXOverlayClass *klass);
-
-void gst_v4l_xoverlay_start (GstV4lElement * v4lelement);
-void gst_v4l_xoverlay_stop (GstV4lElement * v4lelement);
-
-G_END_DECLS
-
-#endif /* __GST_V4L_X_OVERLAY_H__ */
diff --git a/sys/v4l/v4l_calls.c b/sys/v4l/v4l_calls.c
deleted file mode 100644
index 05613d41..00000000
--- a/sys/v4l/v4l_calls.c
+++ /dev/null
@@ -1,732 +0,0 @@
-/* GStreamer
- *
- * v4l_calls.c: generic V4L calls
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include <gst/gst.h>
-#include <gst/interfaces/tuner.h>
-#include <gst/interfaces/colorbalance.h>
-
-#include "v4l_calls.h"
-#include "gstv4ltuner.h"
-#include "gstv4lcolorbalance.h"
-
-#include "gstv4lsrc.h"
-/* #include "gstv4lmjpegsrc.h" */
-/* #include "gstv4lmjpegsink.h" */
-
-GST_DEBUG_CATEGORY_EXTERN (v4l_debug);
-#define GST_CAT_DEFAULT v4l_debug
-
-static const char *picture_name[] = {
- "Hue",
- "Brightness",
- "Contrast",
- "Saturation",
- NULL
-};
-
-G_GNUC_UNUSED static const char *audio_name[] = {
- "Volume",
- "Mute",
- "Mode",
- NULL
-};
-
-static const char *norm_name[] = {
- "PAL",
- "NTSC",
- "SECAM",
- NULL
-};
-
-/******************************************************
- * gst_v4l_get_capabilities():
- * get the device's capturing capabilities
- * sets v4lelement->vcap and v4lelement->vwin
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_get_capabilities (GstV4lElement * v4lelement)
-{
- GST_DEBUG_OBJECT (v4lelement, "getting capabilities");
- GST_V4L_CHECK_OPEN (v4lelement);
-
- if (ioctl (v4lelement->video_fd, VIDIOCGCAP, &(v4lelement->vcap)) < 0) {
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("error getting capabilities %s of from device %s",
- g_strerror (errno), v4lelement->videodev));
- return FALSE;
- }
-
- if (ioctl (v4lelement->video_fd, VIDIOCGWIN, &(v4lelement->vwin)) < 0) {
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("error getting window properties %s of from device %s",
- g_strerror (errno), v4lelement->videodev));
- return FALSE;
- }
-
- return TRUE;
-}
-
-/******************************************************
- * gst_v4l_set_window_properties():
- * set the device's capturing parameters (vwin)
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_set_window_properties (GstV4lElement * v4lelement)
-{
- struct video_window vwin;
-
- GST_DEBUG_OBJECT (v4lelement, "setting window flags 0x%x to device %s",
- v4lelement->vwin.flags, v4lelement->videodev);
- GST_V4L_CHECK_OPEN (v4lelement);
-
- if (ioctl (v4lelement->video_fd, VIDIOCSWIN, &(v4lelement->vwin)) < 0) {
- GST_DEBUG_OBJECT (v4lelement,
- "could not ioctl window properties 0x%x to device %s",
- v4lelement->vwin.flags, v4lelement->videodev);
- return FALSE;
- }
-
- /* get it again to make sure we have it correctly */
- if (ioctl (v4lelement->video_fd, VIDIOCGWIN, &(vwin)) < 0) {
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("error getting window properties %s of from device %s",
- g_strerror (errno), v4lelement->videodev));
- return FALSE;
- }
- if (vwin.flags != v4lelement->vwin.flags) {
- GST_DEBUG_OBJECT (v4lelement, "set 0x%x but got 0x%x back",
- v4lelement->vwin.flags, vwin.flags);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/******************************************************
- * gst_v4l_open():
- * open the video device (v4lelement->videodev)
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_open (GstV4lElement * v4lelement)
-{
- int num;
-
- GST_DEBUG_OBJECT (v4lelement, "opening device %s", v4lelement->videodev);
- GST_V4L_CHECK_NOT_OPEN (v4lelement);
- GST_V4L_CHECK_NOT_ACTIVE (v4lelement);
-
- /* be sure we have a device */
- if (!v4lelement->videodev) {
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, NOT_FOUND,
- (_("No device specified.")), (NULL));
- return FALSE;
- }
-
- /* open the device */
- v4lelement->video_fd = open (v4lelement->videodev, O_RDWR);
- if (!GST_V4L_IS_OPEN (v4lelement)) {
- if (errno == ENODEV || errno == ENOENT) {
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, NOT_FOUND,
- (_("Device \"%s\" does not exist."), v4lelement->videodev), (NULL));
- return FALSE;
- }
- if (errno == EBUSY) {
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, BUSY,
- (_("Device \"%s\" is already being used."), v4lelement->videodev),
- (NULL));
- return FALSE;
- }
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, OPEN_READ_WRITE,
- (_("Could not open device \"%s\" for reading and writing."),
- v4lelement->videodev), GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- /* get capabilities */
- if (!gst_v4l_get_capabilities (v4lelement)) {
- close (v4lelement->video_fd);
- v4lelement->video_fd = -1;
- return FALSE;
- }
-
- /* device type check */
- if ((GST_IS_V4LSRC (v4lelement) &&
- !(v4lelement->vcap.type & VID_TYPE_CAPTURE))) {
-/* (GST_IS_V4LMJPEGSRC (v4lelement) && */
-/* !(v4lelement->vcap.type & VID_TYPE_MJPEG_ENCODER)) || */
-/* (GST_IS_V4LMJPEGSINK (v4lelement) && */
-/* !(v4lelement->vcap.type & VID_TYPE_MJPEG_DECODER))) { */
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("Device opened, but wrong type (0x%x)", v4lelement->vcap.type));
- close (v4lelement->video_fd);
- v4lelement->video_fd = -1;
- return FALSE;
- }
-
- GST_INFO_OBJECT (v4lelement, "Opened device \'%s\' (\'%s\') successfully",
- v4lelement->vcap.name, v4lelement->videodev);
-
- /* norms + inputs, for the tuner interface */
- for (num = 0; norm_name[num] != NULL; num++) {
- GstV4lTunerNorm *v4lnorm = g_object_new (GST_TYPE_V4L_TUNER_NORM,
- NULL);
- GstTunerNorm *norm = GST_TUNER_NORM (v4lnorm);
-
- norm->label = g_strdup (norm_name[num]);
- if (num == 1)
- gst_value_set_fraction (&norm->framerate, 30000, 1001);
- else
- gst_value_set_fraction (&norm->framerate, 25, 1);
-
- v4lnorm->index = num;
- v4lelement->norms = g_list_append (v4lelement->norms, (gpointer) norm);
- }
- v4lelement->channels = gst_v4l_get_chan_names (v4lelement);
-
- for (num = 0; picture_name[num] != NULL; num++) {
- GstV4lColorBalanceChannel *v4lchannel =
- g_object_new (GST_TYPE_V4L_COLOR_BALANCE_CHANNEL, NULL);
- GstColorBalanceChannel *channel = GST_COLOR_BALANCE_CHANNEL (v4lchannel);
-
- channel->label = g_strdup (picture_name[num]);
- channel->min_value = 0;
- channel->max_value = 65535;
- v4lchannel->index = num;
- v4lelement->colors = g_list_append (v4lelement->colors, channel);
- }
-
- GST_DEBUG_OBJECT (v4lelement, "Setting default norm/input");
- gst_v4l_set_chan_norm (v4lelement, 0, 0);
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_close():
- * close the video device (v4lelement->video_fd)
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_close (GstV4lElement * v4lelement)
-{
- GST_DEBUG_OBJECT (v4lelement, "closing device");
- GST_V4L_CHECK_OPEN (v4lelement);
- GST_V4L_CHECK_NOT_ACTIVE (v4lelement);
-
- close (v4lelement->video_fd);
- v4lelement->video_fd = -1;
-
- g_list_foreach (v4lelement->channels, (GFunc) g_object_unref, NULL);
- g_list_free (v4lelement->channels);
- v4lelement->channels = NULL;
-
- g_list_foreach (v4lelement->norms, (GFunc) g_object_unref, NULL);
- g_list_free (v4lelement->norms);
- v4lelement->norms = NULL;
-
- g_list_foreach (v4lelement->colors, (GFunc) g_object_unref, NULL);
- g_list_free (v4lelement->colors);
- v4lelement->colors = NULL;
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_get_num_chans()
- * return value: the number of video input channels
- ******************************************************/
-
-static gint
-gst_v4l_get_num_chans (GstV4lElement * v4lelement)
-{
- GST_DEBUG_OBJECT (v4lelement, "getting number of channels");
- GST_V4L_CHECK_OPEN (v4lelement);
-
- return v4lelement->vcap.channels;
-}
-
-
-/******************************************************
- * gst_v4l_get_chan_names()
- * return value: a GList containing the channel names
- ******************************************************/
-
-GList *
-gst_v4l_get_chan_names (GstV4lElement * v4lelement)
-{
- struct video_channel vchan = { 0 };
- GList *list = NULL;
- gint i;
-
- GST_DEBUG_OBJECT (v4lelement, "getting channel names");
-
- if (!GST_V4L_IS_OPEN (v4lelement))
- return NULL;
-
- for (i = 0; i < gst_v4l_get_num_chans (v4lelement); i++) {
- GstV4lTunerChannel *v4lchannel;
- GstTunerChannel *channel;
-
- vchan.channel = i;
- if (ioctl (v4lelement->video_fd, VIDIOCGCHAN, &vchan) < 0) {
- /* Skip this channel */
- continue;
- }
- v4lchannel = g_object_new (GST_TYPE_V4L_TUNER_CHANNEL, NULL);
- v4lchannel->index = i;
-
- channel = GST_TUNER_CHANNEL (v4lchannel);
- channel->label = g_strdup (vchan.name);
- channel->flags = GST_TUNER_CHANNEL_INPUT;
- if (vchan.flags & VIDEO_VC_TUNER) {
- struct video_tuner vtun;
- gint n;
-
- for (n = 0;; n++) {
- if (n >= vchan.tuners) {
- vtun.tuner = 0; /* default */
- } else {
- vtun.tuner = n;
- if (ioctl (v4lelement->video_fd, VIDIOCGTUNER, &vtun) < 0)
- continue; /* no more tuners */
- if (strcmp (vtun.name, vchan.name) != 0) {
- continue; /* not this one */
- }
- }
- /* FIXME: in the case of n >= vchan.tuners the code below accesses
- * uninitialised fields in vtun
- * Not sure if the codeblock below should go into the else above, but
- * then setting vtun.tuner=0 is a bit pointless.
- */
- v4lchannel->tuner = n;
- channel->flags |= GST_TUNER_CHANNEL_FREQUENCY;
- channel->freq_multiplicator =
- 62.5 * ((vtun.flags & VIDEO_TUNER_LOW) ? 1 : 1000);
- channel->min_frequency = vtun.rangelow * channel->freq_multiplicator;
- channel->max_frequency = vtun.rangehigh * channel->freq_multiplicator;
- channel->min_signal = 0;
- channel->max_signal = 0xffff;
- break;
- }
-
- }
- if (vchan.flags & VIDEO_VC_AUDIO) {
- struct video_audio vaud;
- gint n;
-
- for (n = 0; n < v4lelement->vcap.audios; n++) {
- vaud.audio = n;
- if (ioctl (v4lelement->video_fd, VIDIOCGAUDIO, &vaud) < 0)
- continue;
- if (!strcmp (vaud.name, vchan.name)) {
- v4lchannel->audio = n;
- channel->flags |= GST_TUNER_CHANNEL_AUDIO;
- break;
- }
- }
- }
- list = g_list_prepend (list, (gpointer) channel);
- }
-
- return g_list_reverse (list);
-}
-
-
-/******************************************************
- * gst_v4l_get_chan_norm():
- * get the currently active video-channel and it's
- * norm (VIDEO_MODE_{PAL|NTSC|SECAM|AUTO})
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_get_chan_norm (GstV4lElement * v4lelement, gint * channel, gint * norm)
-{
- GST_DEBUG_OBJECT (v4lelement, "getting current channel and norm");
- GST_V4L_CHECK_OPEN (v4lelement);
-
- if (channel)
- *channel = v4lelement->vchan.channel;
- if (norm)
- *norm = v4lelement->vchan.norm;
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_set_chan_norm():
- * set a new active channel and it's norm
- * (VIDEO_MODE_{PAL|NTSC|SECAM|AUTO})
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_set_chan_norm (GstV4lElement * v4lelement, gint channel, gint norm)
-{
- GST_DEBUG_OBJECT (v4lelement, "setting channel = %d, norm = %d (%s)",
- channel, norm, norm_name[norm]);
- GST_V4L_CHECK_OPEN (v4lelement);
- //GST_V4L_CHECK_NOT_ACTIVE (v4lelement);
-
- v4lelement->vchan.channel = channel;
- v4lelement->vchan.norm = norm;
-
- if (ioctl (v4lelement->video_fd, VIDIOCSCHAN, &(v4lelement->vchan)) < 0) {
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("Error setting the channel/norm settings: %s", g_strerror (errno)));
- return FALSE;
- }
-
- if (ioctl (v4lelement->video_fd, VIDIOCGCHAN, &(v4lelement->vchan)) < 0) {
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("Error getting the channel/norm settings: %s", g_strerror (errno)));
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_get_signal():
- * get the current signal
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_get_signal (GstV4lElement * v4lelement, gint tunernum, guint * signal)
-{
- struct video_tuner tuner;
-
- GST_DEBUG_OBJECT (v4lelement, "getting tuner signal");
- GST_V4L_CHECK_OPEN (v4lelement);
-
- tuner.tuner = tunernum;
- if (ioctl (v4lelement->video_fd, VIDIOCGTUNER, &tuner) < 0) {
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("Error getting tuner signal: %s", g_strerror (errno)));
- return FALSE;
- }
-
- *signal = tuner.signal;
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_get_frequency():
- * get the current frequency
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_get_frequency (GstV4lElement * v4lelement,
- gint tunernum, gulong * frequency)
-{
- struct video_tuner vtun;
- GstTunerChannel *channel;
-
- GST_DEBUG_OBJECT (v4lelement, "getting tuner frequency");
- GST_V4L_CHECK_OPEN (v4lelement);
-
- channel = gst_tuner_get_channel (GST_TUNER (v4lelement));
-
- /* check that this is the current input */
- vtun.tuner = tunernum;
- if (ioctl (v4lelement->video_fd, VIDIOCGTUNER, &vtun) < 0)
- return FALSE;
- if (strcmp (vtun.name, v4lelement->vchan.name))
- return FALSE;
-
- if (ioctl (v4lelement->video_fd, VIDIOCGFREQ, frequency) < 0) {
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("Error getting tuner frequency: %s", g_strerror (errno)));
- return FALSE;
- }
-
- *frequency = *frequency * channel->freq_multiplicator;
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_set_frequency():
- * set frequency
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_set_frequency (GstV4lElement * v4lelement,
- gint tunernum, gulong frequency)
-{
- struct video_tuner vtun;
- GstTunerChannel *channel;
-
- GST_DEBUG_OBJECT (v4lelement, "setting tuner frequency to %lu", frequency);
- GST_V4L_CHECK_OPEN (v4lelement);
-
- channel = gst_tuner_get_channel (GST_TUNER (v4lelement));
-
- /* check that this is the current input */
- vtun.tuner = tunernum;
- if (ioctl (v4lelement->video_fd, VIDIOCGTUNER, &vtun) < 0)
- return FALSE;
- if (strcmp (vtun.name, v4lelement->vchan.name))
- return FALSE;
-
- frequency = frequency / channel->freq_multiplicator;
-
- if (ioctl (v4lelement->video_fd, VIDIOCSFREQ, &frequency) < 0) {
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("Error setting tuner frequency: %s", g_strerror (errno)));
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_get_picture():
- * get a picture value
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_get_picture (GstV4lElement * v4lelement,
- GstV4lPictureType type, gint * value)
-{
- struct video_picture vpic;
-
- GST_DEBUG_OBJECT (v4lelement, "getting picture property type %d (%s)", type,
- picture_name[type]);
- GST_V4L_CHECK_OPEN (v4lelement);
-
- if (ioctl (v4lelement->video_fd, VIDIOCGPICT, &vpic) < 0) {
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("Error getting picture parameters: %s", g_strerror (errno)));
- return FALSE;
- }
-
- switch (type) {
- case V4L_PICTURE_HUE:
- *value = vpic.hue;
- break;
- case V4L_PICTURE_BRIGHTNESS:
- *value = vpic.brightness;
- break;
- case V4L_PICTURE_CONTRAST:
- *value = vpic.contrast;
- break;
- case V4L_PICTURE_SATURATION:
- *value = vpic.colour;
- break;
- default:
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("Error getting picture parameters: unknown type %d", type));
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_set_picture():
- * set a picture value
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_set_picture (GstV4lElement * v4lelement,
- GstV4lPictureType type, gint value)
-{
- struct video_picture vpic;
-
- GST_DEBUG_OBJECT (v4lelement, "setting picture type %d (%s) to value %d",
- type, picture_name[type], value);
- GST_V4L_CHECK_OPEN (v4lelement);
-
- if (ioctl (v4lelement->video_fd, VIDIOCGPICT, &vpic) < 0) {
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("Error getting picture parameters: %s", g_strerror (errno)));
- return FALSE;
- }
-
- switch (type) {
- case V4L_PICTURE_HUE:
- vpic.hue = value;
- break;
- case V4L_PICTURE_BRIGHTNESS:
- vpic.brightness = value;
- break;
- case V4L_PICTURE_CONTRAST:
- vpic.contrast = value;
- break;
- case V4L_PICTURE_SATURATION:
- vpic.colour = value;
- break;
- default:
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("Error setting picture parameters: unknown type %d", type));
- return FALSE;
- }
-
- if (ioctl (v4lelement->video_fd, VIDIOCSPICT, &vpic) < 0) {
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("Error setting picture parameters: %s", g_strerror (errno)));
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_get_audio():
- * get some audio value
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_get_audio (GstV4lElement * v4lelement,
- gint audionum, GstV4lAudioType type, gint * value)
-{
- struct video_audio vau;
-
- GST_DEBUG_OBJECT (v4lelement, "getting audio parameter type %d (%s)", type,
- audio_name[type]);
- GST_V4L_CHECK_OPEN (v4lelement);
-
- vau.audio = audionum;
- if (ioctl (v4lelement->video_fd, VIDIOCGAUDIO, &vau) < 0) {
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("Error getting audio parameters: %s", g_strerror (errno)));
- return FALSE;
- }
-
- switch (type) {
- case V4L_AUDIO_MUTE:
- *value = (vau.flags & VIDEO_AUDIO_MUTE);
- break;
- case V4L_AUDIO_VOLUME:
- *value = vau.volume;
- break;
- case V4L_AUDIO_MODE:
- *value = vau.mode;
- break;
- default:
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("Error getting audio parameters: unknown type %d", type));
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4l_set_audio():
- * set some audio value
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4l_set_audio (GstV4lElement * v4lelement,
- gint audionum, GstV4lAudioType type, gint value)
-{
- struct video_audio vau;
-
- GST_DEBUG_OBJECT (v4lelement,
- "setting audio parameter type %d (%s) to value %d", type,
- audio_name[type], value);
- GST_V4L_CHECK_OPEN (v4lelement);
-
- vau.audio = audionum;
- if (ioctl (v4lelement->video_fd, VIDIOCGAUDIO, &vau) < 0) {
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("Error getting audio parameters: %s", g_strerror (errno)));
- return FALSE;
- }
-
- switch (type) {
- case V4L_AUDIO_MUTE:
- if (!(vau.flags & VIDEO_AUDIO_MUTABLE)) {
- GST_ELEMENT_ERROR (v4lelement, CORE, NOT_IMPLEMENTED, (NULL),
- ("Error setting audio mute: (un)setting mute is not supported"));
- return FALSE;
- }
- if (value)
- vau.flags |= VIDEO_AUDIO_MUTE;
- else
- vau.flags &= ~VIDEO_AUDIO_MUTE;
- break;
- case V4L_AUDIO_VOLUME:
- if (!(vau.flags & VIDEO_AUDIO_VOLUME)) {
- GST_ELEMENT_ERROR (v4lelement, CORE, NOT_IMPLEMENTED, (NULL),
- ("Error setting audio volume: setting volume is not supported"));
- return FALSE;
- }
- vau.volume = value;
- break;
- case V4L_AUDIO_MODE:
- vau.mode = value;
- break;
- default:
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("Error setting audio parameters: unknown type %d", type));
- return FALSE;
- }
-
- if (ioctl (v4lelement->video_fd, VIDIOCSAUDIO, &vau) < 0) {
- GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
- ("Error setting audio parameters: %s", g_strerror (errno)));
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/sys/v4l/v4l_calls.h b/sys/v4l/v4l_calls.h
deleted file mode 100644
index 1f1d90a7..00000000
--- a/sys/v4l/v4l_calls.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/* GStreamer
- *
- * v4l_calls.h: header for generic V4L calls
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __V4L_CALLS_H__
-#define __V4L_CALLS_H__
-
-#include "gstv4lelement.h"
-#include "gst/gst-i18n-plugin.h"
-
-
-G_BEGIN_DECLS
-
-
-/* simple check whether the device is open */
-#define GST_V4L_IS_OPEN(element) \
- (GST_V4LELEMENT (element)->video_fd > 0)
-
-/* check whether the device is 'active' */
-#define GST_V4L_IS_ACTIVE(element) \
- (GST_V4LELEMENT (element)->buffer != NULL)
-
-#define GST_V4L_IS_OVERLAY(element) \
- (GST_V4LELEMENT (element)->vcap.type & VID_TYPE_OVERLAY)
-
-/* checks whether the current v4lelement has already been open()'ed or not */
-#define GST_V4L_CHECK_OPEN(element) \
- if (!GST_V4L_IS_OPEN (element)) \
- { \
- GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY, \
- (_("Device is not open.")), (NULL)); \
- return FALSE; \
- }
-
-/* checks whether the current v4lelement is close()'ed or whether it is still open */
-#define GST_V4L_CHECK_NOT_OPEN(element) \
- if (GST_V4L_IS_OPEN (element)) \
- { \
- GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY, \
- (_("Device is open.")), (NULL)); \
- return FALSE; \
- }
-
-/* checks whether the current v4lelement does video overlay */
-#define GST_V4L_CHECK_OVERLAY(element) \
- if (!(element->vcap.type & VID_TYPE_OVERLAY)) \
- { \
- GST_ELEMENT_ERROR (element, RESOURCE, TOO_LAZY, \
- (NULL), ("Device cannot handle overlay")); \
- return FALSE; \
- }
-
-/* checks whether we're in capture mode or not */
-#define GST_V4L_CHECK_ACTIVE(element) \
- if (!GST_V4L_IS_ACTIVE (element)) \
- { \
- GST_ELEMENT_ERROR (element, RESOURCE, SETTINGS, \
- (NULL), ("Device is not in streaming mode")); \
- return FALSE; \
- }
-
-/* checks whether we're out of capture mode or not */
-#define GST_V4L_CHECK_NOT_ACTIVE(element) \
- if (GST_V4L_IS_ACTIVE (element)) \
- { \
- GST_ELEMENT_ERROR (element, RESOURCE, SETTINGS, \
- (NULL), ("Device is in streaming mode")); \
- return FALSE; \
- }
-
-
-typedef enum {
- V4L_PICTURE_HUE = 0,
- V4L_PICTURE_BRIGHTNESS,
- V4L_PICTURE_CONTRAST,
- V4L_PICTURE_SATURATION,
-} GstV4lPictureType;
-
-typedef enum {
- V4L_AUDIO_VOLUME = 0,
- V4L_AUDIO_MUTE,
- V4L_AUDIO_MODE, /* stereo, mono, ... (see videodev.h) */
-} GstV4lAudioType;
-
-
-/* open/close the device */
-gboolean gst_v4l_open (GstV4lElement *v4lelement);
-gboolean gst_v4l_close (GstV4lElement *v4lelement);
-
-/* norm control (norm = VIDEO_MODE_{PAL|NTSC|SECAM|AUTO}) */
-gboolean gst_v4l_get_chan_norm (GstV4lElement *v4lelement,
- gint *channel,
- gint *norm);
-gboolean gst_v4l_set_chan_norm (GstV4lElement *v4lelement,
- gint channel,
- gint norm);
-GList *gst_v4l_get_chan_names (GstV4lElement *v4lelement);
-
-/* frequency control */
-gboolean gst_v4l_get_signal (GstV4lElement *v4lelement,
- gint tunernum,
- guint *signal);
-gboolean gst_v4l_get_frequency (GstV4lElement *v4lelement,
- gint tunernum,
- gulong *frequency);
-gboolean gst_v4l_set_frequency (GstV4lElement *v4lelement,
- gint tunernum,
- gulong frequency);
-
-/* picture control */
-gboolean gst_v4l_get_picture (GstV4lElement *v4lelement,
- GstV4lPictureType type,
- gint *value);
-gboolean gst_v4l_set_picture (GstV4lElement *v4lelement,
- GstV4lPictureType type,
- gint value);
-
-/* audio control */
-gboolean gst_v4l_get_audio (GstV4lElement *v4lelement,
- gint audionum,
- GstV4lAudioType type,
- gint *value);
-gboolean gst_v4l_set_audio (GstV4lElement *v4lelement,
- gint audionum,
- GstV4lAudioType type,
- gint value);
-
-/* functions that v4lsrc needs */
-gboolean gst_v4l_set_window_properties (GstV4lElement * v4lelement);
-gboolean gst_v4l_get_capabilities (GstV4lElement * v4lelement);
-
-
-G_END_DECLS
-
-
-#endif /* __V4L_CALLS_H__ */
diff --git a/sys/v4l/v4lmjpegsink_calls.c b/sys/v4l/v4lmjpegsink_calls.c
deleted file mode 100644
index 416f80ea..00000000
--- a/sys/v4l/v4lmjpegsink_calls.c
+++ /dev/null
@@ -1,525 +0,0 @@
-/* GStreamer
- *
- * v4lmjpegsink_calls.c: functions for hardware MJPEG video sink
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <string.h>
-#include <errno.h>
-#include "v4lmjpegsink_calls.h"
-
-/* On some systems MAP_FAILED seems to be missing */
-#ifndef MAP_FAILED
-#define MAP_FAILED ( (caddr_t) -1 )
-#endif
-
-GST_DEBUG_CATEGORY_EXTERN (v4lmjpegsink_debug);
-#define GST_CAT_DEFAULT v4lmjpegsink_debug
-
-/******************************************************
- * gst_v4lmjpegsink_sync_thread()
- * thread keeps track of played frames
- ******************************************************/
-
-static void *
-gst_v4lmjpegsink_sync_thread (void *arg)
-{
- GstV4lMjpegSink *v4lmjpegsink = GST_V4LMJPEGSINK (arg);
- gint frame = 0; /* frame that we're currently syncing on */
-
- GST_DEBUG_OBJECT (v4lmjpegsink, "starting sync thread");
-
-#if 0
- /* Allow easy shutting down by other processes... */
- pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL);
- pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
-#endif
-
- while (1) {
- g_mutex_lock (v4lmjpegsink->mutex_queued_frames);
- if (!v4lmjpegsink->isqueued_queued_frames[frame]) {
- g_cond_wait (v4lmjpegsink->cond_queued_frames[frame],
- v4lmjpegsink->mutex_queued_frames);
- }
- if (v4lmjpegsink->isqueued_queued_frames[frame] != 1) {
- g_mutex_unlock (v4lmjpegsink->mutex_queued_frames);
- goto end;
- }
- g_mutex_unlock (v4lmjpegsink->mutex_queued_frames);
-
- GST_DEBUG_OBJECT (v4lmjpegsink, "thread-syncing on next frame");
- if (ioctl (GST_V4LELEMENT (v4lmjpegsink)->video_fd, MJPIOC_SYNC,
- &(v4lmjpegsink->bsync)) < 0) {
- GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, SYNC, (NULL),
- ("Failed to sync on frame %d: %s", frame, g_strerror (errno)));
- g_mutex_lock (v4lmjpegsink->mutex_queued_frames);
- v4lmjpegsink->isqueued_queued_frames[frame] = -1;
- g_cond_broadcast (v4lmjpegsink->cond_queued_frames[frame]);
- g_mutex_unlock (v4lmjpegsink->mutex_queued_frames);
- goto end;
- } else {
- /* be sure that we're not confusing */
- if (frame != v4lmjpegsink->bsync.frame) {
- GST_ELEMENT_ERROR (v4lmjpegsink, CORE, TOO_LAZY, (NULL),
- ("Internal error: frame number confusion"));
- goto end;
- }
- g_mutex_lock (v4lmjpegsink->mutex_queued_frames);
- v4lmjpegsink->isqueued_queued_frames[frame] = 0;
- g_cond_broadcast (v4lmjpegsink->cond_queued_frames[frame]);
- g_mutex_unlock (v4lmjpegsink->mutex_queued_frames);
- }
-
- frame = (frame + 1) % v4lmjpegsink->breq.count;
- }
-
-end:
- GST_DEBUG_OBJECT (v4lmjpegsink, "Sync thread got signalled to exit");
- g_thread_exit (NULL);
- return NULL;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_queue_frame()
- * queue a frame for playback
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-static gboolean
-gst_v4lmjpegsink_queue_frame (GstV4lMjpegSink * v4lmjpegsink, gint num)
-{
- GST_DEBUG_OBJECT (v4lmjpegsink, "queueing frame %d", num);
-
- /* queue on this frame */
- if (ioctl (GST_V4LELEMENT (v4lmjpegsink)->video_fd, MJPIOC_QBUF_PLAY,
- &num) < 0) {
- GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, WRITE, (NULL),
- ("Failed to queue frame %d: %s", num, g_strerror (errno)));
- return FALSE;
- }
-
- g_mutex_lock (v4lmjpegsink->mutex_queued_frames);
- v4lmjpegsink->isqueued_queued_frames[num] = 1;
- g_cond_broadcast (v4lmjpegsink->cond_queued_frames[num]);
- g_mutex_unlock (v4lmjpegsink->mutex_queued_frames);
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_sync_frame()
- * wait for a frame to be finished playing
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-static gboolean
-gst_v4lmjpegsink_sync_frame (GstV4lMjpegSink * v4lmjpegsink, gint * num)
-{
- GST_DEBUG_OBJECT (v4lmjpegsink, "syncing on next frame");
-
- /* calculate next frame */
- v4lmjpegsink->current_frame =
- (v4lmjpegsink->current_frame + 1) % v4lmjpegsink->breq.count;
- *num = v4lmjpegsink->current_frame;
-
- g_mutex_lock (v4lmjpegsink->mutex_queued_frames);
- if (v4lmjpegsink->isqueued_queued_frames[*num] == 1) {
- g_cond_wait (v4lmjpegsink->cond_queued_frames[*num],
- v4lmjpegsink->mutex_queued_frames);
- }
- if (v4lmjpegsink->isqueued_queued_frames[*num] != 0) {
- g_mutex_unlock (v4lmjpegsink->mutex_queued_frames);
- return FALSE;
- } else
- g_mutex_unlock (v4lmjpegsink->mutex_queued_frames);
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_set_buffer()
- * set buffer options
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsink_set_buffer (GstV4lMjpegSink * v4lmjpegsink,
- gint numbufs, gint bufsize)
-{
- GST_DEBUG_OBJECT (v4lmjpegsink,
- "setting buffer info to numbufs = %d, bufsize = %d KB", numbufs, bufsize);
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsink));
- GST_V4L_CHECK_NOT_ACTIVE (GST_V4LELEMENT (v4lmjpegsink));
-
- v4lmjpegsink->breq.size = bufsize * 1024;
- v4lmjpegsink->breq.count = numbufs;
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_set_playback()
- * set playback options (video, interlacing, etc.)
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsink_set_playback (GstV4lMjpegSink * v4lmjpegsink,
- gint width,
- gint height, gint x_offset, gint y_offset, gint norm, gint interlacing)
-{
- gint mw, mh;
- struct mjpeg_params bparm;
-
- GST_DEBUG_OBJECT (v4lmjpegsink,
- "setting size=%dx%d, X/Y offsets=%d/%d, norm=%d, interlacing=%d\n",
- width, height, x_offset, y_offset, norm, interlacing);
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsink));
- /*GST_V4L_CHECK_NOT_ACTIVE(GST_V4LELEMENT(v4lmjpegsink)); */
-
- if (ioctl (GST_V4LELEMENT (v4lmjpegsink)->video_fd, MJPIOC_G_PARAMS,
- &bparm) < 0) {
- GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, SETTINGS, (NULL),
- GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- bparm.input = 0;
- bparm.norm = norm;
- bparm.decimation = 0; /* we'll set proper values later on */
-
- /* maxwidth is broken on marvel cards */
- mw = GST_V4LELEMENT (v4lmjpegsink)->vcap.maxwidth;
- if (mw != 768 && mw != 640)
- mw = 720;
- mh = (norm == VIDEO_MODE_NTSC ? 480 : 576);
-
- if (width > mw || height > mh) {
- GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL),
- ("Video dimensions (%dx%d) are larger than device max (%dx%d)",
- width, height, mw, mh));
- return FALSE;
- }
-
- if (width <= mw / 4)
- bparm.HorDcm = 4;
- else if (width <= mw / 2)
- bparm.HorDcm = 2;
- else
- bparm.HorDcm = 1;
-
- /* TODO: add proper interlacing handling */
-#if 0
- if (interlacing != INTERLACING_NOT_INTERLACED) {
- bparm.field_per_buff = 2;
- bparm.TmpDcm = 1;
-
- if (height <= mh / 2)
- bparm.VerDcm = 2;
- else
- bparm.VerDcm = 1;
- } else
-#endif
- {
- if (height > mh / 2) {
- GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL),
- ("Video dimensions (%dx%d) too large for non-interlaced playback (%dx%d)",
- width, height, mw, mh / 2));
- return FALSE;
- }
-
- bparm.field_per_buff = 1;
- bparm.TmpDcm = 2;
-
- if (height <= mh / 4)
- bparm.VerDcm = 2;
- else
- bparm.VerDcm = 1;
- }
-
- /* TODO: add proper interlacing handling */
-#if 0
- bparm.odd_even = (interlacing == INTERLACING_TOP_FIRST);
-#endif
-
- bparm.quality = 100;
- bparm.img_width = bparm.HorDcm * width;
- bparm.img_height = bparm.VerDcm * height / bparm.field_per_buff;
-
- /* image X/Y offset on device */
- if (x_offset < 0)
- bparm.img_x = (mw - bparm.img_width) / 2;
- else {
- if (x_offset + bparm.img_width > mw)
- bparm.img_x = mw - bparm.img_width;
- else
- bparm.img_x = x_offset;
- }
-
- if (y_offset < 0)
- bparm.img_y = (mh / 2 - bparm.img_height) / 2;
- else {
- if (y_offset + bparm.img_height * 2 > mh)
- bparm.img_y = mh / 2 - bparm.img_height;
- else
- bparm.img_y = y_offset / 2;
- }
-
- if (ioctl (GST_V4LELEMENT (v4lmjpegsink)->video_fd, MJPIOC_S_PARAMS,
- &bparm) < 0) {
- GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, SETTINGS, (NULL),
- GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_playback_init()
- * initialize playback system, set up buffer, etc.
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsink_playback_init (GstV4lMjpegSink * v4lmjpegsink)
-{
- gint n;
-
- GST_DEBUG_OBJECT (v4lmjpegsink, "initting playback subsystem");
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsink));
- GST_V4L_CHECK_NOT_ACTIVE (GST_V4LELEMENT (v4lmjpegsink));
-
- /* Request buffers */
- if (ioctl (GST_V4LELEMENT (v4lmjpegsink)->video_fd, MJPIOC_REQBUFS,
- &(v4lmjpegsink->breq)) < 0) {
- GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- GST_INFO_OBJECT (v4lmjpegsink, "Got %ld buffers of size %ld KB",
- v4lmjpegsink->breq.count, v4lmjpegsink->breq.size / 1024);
-
- /* Map the buffers */
- GST_V4LELEMENT (v4lmjpegsink)->buffer = mmap (0,
- v4lmjpegsink->breq.count * v4lmjpegsink->breq.size,
- PROT_READ | PROT_WRITE, MAP_SHARED,
- GST_V4LELEMENT (v4lmjpegsink)->video_fd, 0);
- if (GST_V4LELEMENT (v4lmjpegsink)->buffer == MAP_FAILED) {
- GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL),
- ("Error mapping video buffers: %s", g_strerror (errno)));
- GST_V4LELEMENT (v4lmjpegsink)->buffer = NULL;
- return FALSE;
- }
-
- /* allocate/init the GThread thingies */
- v4lmjpegsink->mutex_queued_frames = g_mutex_new ();
- v4lmjpegsink->isqueued_queued_frames = (gint8 *)
- malloc (sizeof (gint8) * v4lmjpegsink->breq.count);
- if (!v4lmjpegsink->isqueued_queued_frames) {
- GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL),
- ("Failed to create queue tracker: %s", g_strerror (errno)));
- return FALSE;
- }
- v4lmjpegsink->cond_queued_frames = (GCond **)
- malloc (sizeof (GCond *) * v4lmjpegsink->breq.count);
- if (!v4lmjpegsink->cond_queued_frames) {
- GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL),
- ("Failed to create queue condition holders: %s", g_strerror (errno)));
- return FALSE;
- }
- for (n = 0; n < v4lmjpegsink->breq.count; n++)
- v4lmjpegsink->cond_queued_frames[n] = g_cond_new ();
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_playback_start()
- * start playback system
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsink_playback_start (GstV4lMjpegSink * v4lmjpegsink)
-{
- GError *error;
- gint n;
-
- GST_DEBUG_OBJECT (v4lmjpegsink, "starting playback");
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsink));
- GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsink));
-
- /* mark all buffers as unqueued */
- for (n = 0; n < v4lmjpegsink->breq.count; n++)
- v4lmjpegsink->isqueued_queued_frames[n] = 0;
-
- v4lmjpegsink->current_frame = -1;
-
- /* create sync() thread */
- v4lmjpegsink->thread_queued_frames =
- g_thread_create (gst_v4lmjpegsink_sync_thread, (void *) v4lmjpegsink,
- TRUE, &error);
- if (!v4lmjpegsink->thread_queued_frames) {
- GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL),
- ("Failed to create sync thread: %s", error->message));
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_get_buffer()
- * get address of a buffer
- * return value: buffer's address or NULL
- ******************************************************/
-
-guint8 *
-gst_v4lmjpegsink_get_buffer (GstV4lMjpegSink * v4lmjpegsink, gint num)
-{
- /*GST_DEBUG_OBJECT (v4lmjpegsink, gst_v4lmjpegsink_get_buffer(), num = %d", num); */
-
- if (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsink)) ||
- !GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lmjpegsink)))
- return NULL;
-
- if (num < 0 || num >= v4lmjpegsink->breq.count)
- return NULL;
-
- return GST_V4LELEMENT (v4lmjpegsink)->buffer +
- (v4lmjpegsink->breq.size * num);
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_play_frame()
- * queue a new buffer
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsink_play_frame (GstV4lMjpegSink * v4lmjpegsink, gint num)
-{
- GST_DEBUG_OBJECT (v4lmjpegsink, "playing frame %d", num);
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsink));
- GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsink));
-
- if (!gst_v4lmjpegsink_queue_frame (v4lmjpegsink, num))
- return FALSE;
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_wait_frame()
- * wait for buffer to be actually played
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsink_wait_frame (GstV4lMjpegSink * v4lmjpegsink, gint * num)
-{
- GST_DEBUG_OBJECT (v4lmjpegsink,
- "waiting for next frame to be finished playing");
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsink));
- GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsink));
-
- if (!gst_v4lmjpegsink_sync_frame (v4lmjpegsink, num))
- return FALSE;
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_playback_stop()
- * stop playback system and sync on remaining frames
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsink_playback_stop (GstV4lMjpegSink * v4lmjpegsink)
-{
- gint num;
-
- GST_DEBUG_OBJECT (v4lmjpegsink, "stopping playback");
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsink));
- GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsink));
-
- /* mark next buffer as wrong */
- if (!gst_v4lmjpegsink_sync_frame (v4lmjpegsink, &num) ||
- !gst_v4lmjpegsink_queue_frame (v4lmjpegsink, num)) {
- return FALSE;
- }
-
- /* .. and wait for all buffers to be queued on */
- g_thread_join (v4lmjpegsink->thread_queued_frames);
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsink_playback_deinit()
- * deinitialize the playback system and unmap buffer
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsink_playback_deinit (GstV4lMjpegSink * v4lmjpegsink)
-{
- int n;
-
- GST_DEBUG_OBJECT (v4lmjpegsink, "quitting playback subsystem");
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsink));
- GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsink));
-
- /* free GThread thingies */
- g_mutex_free (v4lmjpegsink->mutex_queued_frames);
- for (n = 0; n < v4lmjpegsink->breq.count; n++)
- g_cond_free (v4lmjpegsink->cond_queued_frames[n]);
- free (v4lmjpegsink->cond_queued_frames);
- free (v4lmjpegsink->isqueued_queued_frames);
-
- /* unmap the buffer */
- munmap (GST_V4LELEMENT (v4lmjpegsink)->buffer,
- v4lmjpegsink->breq.size * v4lmjpegsink->breq.count);
- GST_V4LELEMENT (v4lmjpegsink)->buffer = NULL;
-
- return TRUE;
-}
diff --git a/sys/v4l/v4lmjpegsink_calls.h b/sys/v4l/v4lmjpegsink_calls.h
deleted file mode 100644
index beebaf45..00000000
--- a/sys/v4l/v4lmjpegsink_calls.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* GStreamer
- *
- * v4lmjpegsink_calls.c: functions for hardware MJPEG video sink
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __V4L_MJPEG_SINK_CALLS_H__
-#define __V4L_MJPEG_SINK_CALLS_H__
-
-#include "gstv4lmjpegsink.h"
-#include "v4l_calls.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* frame playback on device */
-gboolean gst_v4lmjpegsink_set_buffer (GstV4lMjpegSink *v4lmjpegsink,
- gint numbufs,
- gint bufsize);
-gboolean gst_v4lmjpegsink_set_playback (GstV4lMjpegSink *v4lmjpegsink,
- gint width,
- gint height,
- gint x_offset,
- gint y_offset,
- gint norm,
- gint interlacing);
-gboolean gst_v4lmjpegsink_playback_init (GstV4lMjpegSink *v4lmjpegsink);
-gboolean gst_v4lmjpegsink_playback_start (GstV4lMjpegSink *v4lmjpegsink);
-guint8 * gst_v4lmjpegsink_get_buffer (GstV4lMjpegSink *v4lmjpegsink,
- gint num);
-gboolean gst_v4lmjpegsink_play_frame (GstV4lMjpegSink *v4lmjpegsink,
- gint num);
-gboolean gst_v4lmjpegsink_wait_frame (GstV4lMjpegSink *v4lmjpegsink,
- gint *num);
-gboolean gst_v4lmjpegsink_playback_stop (GstV4lMjpegSink *v4lmjpegsink);
-gboolean gst_v4lmjpegsink_playback_deinit (GstV4lMjpegSink *v4lmjpegsink);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __V4L_MJPEG_SINK_CALLS_H__ */
diff --git a/sys/v4l/v4lmjpegsrc_calls.c b/sys/v4l/v4lmjpegsrc_calls.c
deleted file mode 100644
index 60bdfcea..00000000
--- a/sys/v4l/v4lmjpegsrc_calls.c
+++ /dev/null
@@ -1,577 +0,0 @@
-/* GStreamer
- *
- * v4lmjpegsrc_calls.c: functions for hardware MJPEG video source
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <string.h>
-#include <errno.h>
-#include "v4lmjpegsrc_calls.h"
-
-/* On some systems MAP_FAILED seems to be missing */
-#ifndef MAP_FAILED
-#define MAP_FAILED ( (caddr_t) -1 )
-#endif
-
-#define MIN_BUFFERS_QUEUED 2
-
-GST_DEBUG_CATEGORY_EXTERN (v4lmjpegsrc_debug);
-#define GST_CAT_DEFAULT v4lmjpegsrc_debug
-
-enum
-{
- QUEUE_STATE_ERROR = -1,
- QUEUE_STATE_READY_FOR_QUEUE,
- QUEUE_STATE_QUEUED,
- QUEUE_STATE_SYNCED,
-};
-
-/******************************************************
- * gst_v4lmjpegsrc_queue_frame():
- * queue a frame for capturing
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-static gboolean
-gst_v4lmjpegsrc_queue_frame (GstV4lMjpegSrc * v4lmjpegsrc, gint num)
-{
- GST_DEBUG_OBJECT (v4lmjpegsrc, "queueing frame %d", num);
-
- if (v4lmjpegsrc->frame_queue_state[num] != QUEUE_STATE_READY_FOR_QUEUE) {
- return FALSE;
- }
-
- if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd, MJPIOC_QBUF_CAPT,
- &num) < 0) {
- GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, READ, (NULL),
- ("Error queueing a buffer (%d): %s", num, g_strerror (errno)));
- return FALSE;
- }
-
- v4lmjpegsrc->frame_queue_state[num] = QUEUE_STATE_QUEUED;
- v4lmjpegsrc->num_queued++;
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_sync_next_frame():
- * sync on the next frame for capturing
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-static gboolean
-gst_v4lmjpegsrc_sync_next_frame (GstV4lMjpegSrc * v4lmjpegsrc, gint * num)
-{
- GST_DEBUG_OBJECT (v4lmjpegsrc, "syncing on next frame");
-
- if (v4lmjpegsrc->num_queued <= 0) {
- return FALSE;
- }
-
- while (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd,
- MJPIOC_SYNC, &(v4lmjpegsrc->bsync)) < 0) {
- if (errno != EINTR) {
- GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, SYNC, (NULL), GST_ERROR_SYSTEM);
- return FALSE;
- }
- GST_DEBUG_OBJECT (v4lmjpegsrc, "Sync got interrupted");
- }
-
- *num = v4lmjpegsrc->bsync.frame;
-
- v4lmjpegsrc->frame_queue_state[*num] = QUEUE_STATE_SYNCED;
- v4lmjpegsrc->num_queued--;
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_set_buffer():
- * set buffer parameters (size/count)
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_set_buffer (GstV4lMjpegSrc * v4lmjpegsrc,
- gint numbufs, gint bufsize)
-{
- GST_DEBUG_OBJECT (v4lmjpegsrc,
- "setting buffer info to numbufs = %d, bufsize = %d KB", numbufs, bufsize);
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
- GST_V4L_CHECK_NOT_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
- v4lmjpegsrc->breq.size = bufsize * 1024;
- v4lmjpegsrc->breq.count = numbufs;
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_set_capture():
- * set capture parameters (simple)
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_set_capture (GstV4lMjpegSrc * v4lmjpegsrc,
- gint decimation, gint quality)
-{
- int norm, input, mw;
- struct mjpeg_params bparm;
-
- GST_DEBUG_OBJECT (v4lmjpegsrc, "setting decimation = %d, quality = %d",
- decimation, quality);
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
- GST_V4L_CHECK_NOT_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
- gst_v4l_get_chan_norm (GST_V4LELEMENT (v4lmjpegsrc), &input, &norm);
-
- /* Query params for capture */
- if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd, MJPIOC_G_PARAMS,
- &bparm) < 0) {
- GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, SETTINGS, (NULL),
- GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- bparm.decimation = decimation;
- bparm.quality = quality;
- bparm.norm = norm;
- bparm.input = input;
- bparm.APP_len = 0; /* no JPEG markers - TODO: this is definately not right for decimation==1 */
-
- mw = GST_V4LELEMENT (v4lmjpegsrc)->vcap.maxwidth;
- if (mw != 768 && mw != 640) {
- if (decimation == 1)
- mw = 720;
- else
- mw = 704;
- }
- v4lmjpegsrc->end_width = mw / decimation;
- v4lmjpegsrc->end_height = (norm == VIDEO_MODE_NTSC ? 480 : 576) / decimation;
-
- /* TODO: interlacing */
-
- /* Set params for capture */
- if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd, MJPIOC_S_PARAMS,
- &bparm) < 0) {
- GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, SETTINGS, (NULL),
- GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_set_capture_m():
- * set capture parameters (advanced)
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_set_capture_m (GstV4lMjpegSrc * v4lmjpegsrc,
- gint x_offset,
- gint y_offset,
- gint width, gint height, gint h_decimation, gint v_decimation, gint quality)
-{
- gint norm, input;
- gint maxwidth;
- struct mjpeg_params bparm;
-
- GST_DEBUG_OBJECT (v4lmjpegsrc, "setting x_offset = %d, y_offset = %d, "
- "width = %d, height = %d, h_decimation = %d, v_decimation = %d, quality = %d\n",
- x_offset, y_offset, width, height, h_decimation, v_decimation, quality);
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
- GST_V4L_CHECK_NOT_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
- gst_v4l_get_chan_norm (GST_V4LELEMENT (v4lmjpegsrc), &input, &norm);
-
- if (GST_V4LELEMENT (v4lmjpegsrc)->vcap.maxwidth != 768 &&
- GST_V4LELEMENT (v4lmjpegsrc)->vcap.maxwidth != 640)
- maxwidth = 720;
- else
- maxwidth = GST_V4LELEMENT (v4lmjpegsrc)->vcap.maxwidth;
-
- /* Query params for capture */
- if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd, MJPIOC_G_PARAMS,
- &bparm) < 0) {
- GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, SETTINGS, (NULL),
- GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- bparm.decimation = 0;
- bparm.quality = quality;
- bparm.norm = norm;
- bparm.input = input;
- bparm.APP_len = 0; /* no JPEG markers - TODO: this is definately
- * not right for decimation==1 */
-
- if (width <= 0) {
- if (x_offset < 0)
- x_offset = 0;
- width = (maxwidth == 720
- && h_decimation != 1) ? 704 : maxwidth - 2 * x_offset;
- } else {
- if (x_offset < 0)
- x_offset = (maxwidth - width) / 2;
- }
-
- if (height <= 0) {
- if (y_offset < 0)
- y_offset = 0;
- height = (norm == VIDEO_MODE_NTSC) ? 480 : 576 - 2 * y_offset;
- } else {
- if (y_offset < 0)
- y_offset = ((norm == VIDEO_MODE_NTSC) ? 480 : 576 - height) / 2;
- }
-
- if (width + x_offset > maxwidth) {
- GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, TOO_LAZY, (NULL),
- ("Image width+offset (%d) bigger than maximum (%d)",
- width + x_offset, maxwidth));
- return FALSE;
- }
- if ((width % (bparm.HorDcm * 16)) != 0) {
- GST_ELEMENT_ERROR (v4lmjpegsrc, STREAM, FORMAT, (NULL),
- ("Image width (%d) not multiple of %d (required for JPEG)",
- width, bparm.HorDcm * 16));
- return FALSE;
- }
- if (height + y_offset > (norm == VIDEO_MODE_NTSC ? 480 : 576)) {
- GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, TOO_LAZY, (NULL),
- ("Image height+offset (%d) bigger than maximum (%d)",
- height + y_offset, (norm == VIDEO_MODE_NTSC ? 480 : 576)));
- return FALSE;
- }
- /* RJ: Image height must only be a multiple of 8, but geom_height
- * is double the field height
- */
- if ((height % (bparm.VerDcm * 16)) != 0) {
- GST_ELEMENT_ERROR (v4lmjpegsrc, STREAM, FORMAT, (NULL),
- ("Image height (%d) not multiple of %d (required for JPEG)",
- height, bparm.VerDcm * 16));
- return FALSE;
- }
-
- bparm.img_x = x_offset;
- bparm.img_width = width;
- bparm.img_y = y_offset;
- bparm.img_height = height;
- bparm.HorDcm = h_decimation;
- bparm.VerDcm = (v_decimation == 4) ? 2 : 1;
- bparm.TmpDcm = (v_decimation == 1) ? 1 : 2;
- bparm.field_per_buff = (v_decimation == 1) ? 2 : 1;
-
- v4lmjpegsrc->end_width = width / h_decimation;
- v4lmjpegsrc->end_width = height / v_decimation;
-
- /* TODO: interlacing */
-
- /* Set params for capture */
- if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd, MJPIOC_S_PARAMS,
- &bparm) < 0) {
- GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, SETTINGS, (NULL),
- GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_capture_init():
- * initialize the capture system
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_capture_init (GstV4lMjpegSrc * v4lmjpegsrc)
-{
- GST_DEBUG_OBJECT (v4lmjpegsrc, "initting capture subsystem");
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
- GST_V4L_CHECK_NOT_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
- /* Request buffers */
- if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd,
- MJPIOC_REQBUFS, &(v4lmjpegsrc->breq)) < 0) {
- GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- if (v4lmjpegsrc->breq.count < MIN_BUFFERS_QUEUED) {
- GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, READ, (NULL),
- ("Too little buffers. We got %ld, we want at least %d",
- v4lmjpegsrc->breq.count, MIN_BUFFERS_QUEUED));
- return FALSE;
- }
-
- GST_INFO_OBJECT (v4lmjpegsrc, "Got %ld buffers of size %ld KB",
- v4lmjpegsrc->breq.count, v4lmjpegsrc->breq.size / 1024);
-
- /* keep track of queued buffers */
- v4lmjpegsrc->frame_queue_state = (gint8 *)
- g_malloc (sizeof (gint8) * v4lmjpegsrc->breq.count);
-
- /* track how often to use each frame */
- v4lmjpegsrc->use_num_times = (gint *)
- g_malloc (sizeof (gint) * v4lmjpegsrc->breq.count);
-
- /* lock for the frame_state */
- v4lmjpegsrc->mutex_queue_state = g_mutex_new ();
- v4lmjpegsrc->cond_queue_state = g_cond_new ();
-
- /* Map the buffers */
- GST_V4LELEMENT (v4lmjpegsrc)->buffer = mmap (0,
- v4lmjpegsrc->breq.count * v4lmjpegsrc->breq.size,
- PROT_READ | PROT_WRITE, MAP_SHARED,
- GST_V4LELEMENT (v4lmjpegsrc)->video_fd, 0);
- if (GST_V4LELEMENT (v4lmjpegsrc)->buffer == MAP_FAILED) {
- GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, TOO_LAZY, (NULL),
- ("Error mapping video buffers: %s", g_strerror (errno)));
- GST_V4LELEMENT (v4lmjpegsrc)->buffer = NULL;
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_capture_start():
- * start streaming capture
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_capture_start (GstV4lMjpegSrc * v4lmjpegsrc)
-{
- int n;
-
- GST_DEBUG_OBJECT (v4lmjpegsrc, "starting capture");
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
- GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
- g_mutex_lock (v4lmjpegsrc->mutex_queue_state);
-
- v4lmjpegsrc->quit = FALSE;
- v4lmjpegsrc->num_queued = 0;
- v4lmjpegsrc->queue_frame = 0;
-
- /* set all buffers ready to queue , this starts streaming capture */
- for (n = 0; n < v4lmjpegsrc->breq.count; n++) {
- v4lmjpegsrc->frame_queue_state[n] = QUEUE_STATE_READY_FOR_QUEUE;
- if (!gst_v4lmjpegsrc_queue_frame (v4lmjpegsrc, n)) {
- g_mutex_unlock (v4lmjpegsrc->mutex_queue_state);
- gst_v4lmjpegsrc_capture_stop (v4lmjpegsrc);
- return FALSE;
- }
- }
-
- v4lmjpegsrc->is_capturing = TRUE;
- g_mutex_unlock (v4lmjpegsrc->mutex_queue_state);
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_grab_frame():
- * grab one frame during streaming capture
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_grab_frame (GstV4lMjpegSrc * v4lmjpegsrc,
- gint * num, gint * size)
-{
- GST_DEBUG_OBJECT (v4lmjpegsrc, "grabbing frame");
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
- GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
- g_mutex_lock (v4lmjpegsrc->mutex_queue_state);
-
- /* do we have enough frames? */
- while (v4lmjpegsrc->num_queued < MIN_BUFFERS_QUEUED ||
- v4lmjpegsrc->frame_queue_state[v4lmjpegsrc->queue_frame] ==
- QUEUE_STATE_READY_FOR_QUEUE) {
- while (v4lmjpegsrc->frame_queue_state[v4lmjpegsrc->queue_frame] !=
- QUEUE_STATE_READY_FOR_QUEUE && !v4lmjpegsrc->quit) {
- GST_DEBUG_OBJECT (v4lmjpegsrc,
- "Waiting for frames to become available (%d < %d)",
- v4lmjpegsrc->num_queued, MIN_BUFFERS_QUEUED);
- g_cond_wait (v4lmjpegsrc->cond_queue_state,
- v4lmjpegsrc->mutex_queue_state);
- }
- if (v4lmjpegsrc->quit) {
- g_mutex_unlock (v4lmjpegsrc->mutex_queue_state);
- return TRUE; /* it won't get through anyway */
- }
- if (!gst_v4lmjpegsrc_queue_frame (v4lmjpegsrc, v4lmjpegsrc->queue_frame)) {
- g_mutex_unlock (v4lmjpegsrc->mutex_queue_state);
- return FALSE;
- }
- v4lmjpegsrc->queue_frame =
- (v4lmjpegsrc->queue_frame + 1) % v4lmjpegsrc->breq.count;
- }
-
- /* syncing on the buffer grabs it */
- if (!gst_v4lmjpegsrc_sync_next_frame (v4lmjpegsrc, num)) {
- return FALSE;
- }
-
- *size = v4lmjpegsrc->bsync.length;
-
- g_mutex_unlock (v4lmjpegsrc->mutex_queue_state);
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_get_buffer():
- * get the memory address of a single buffer
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-guint8 *
-gst_v4lmjpegsrc_get_buffer (GstV4lMjpegSrc * v4lmjpegsrc, gint num)
-{
- /*DEBUG("gst_v4lmjpegsrc_get_buffer(), num = %d", num); */
-
- if (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc)) ||
- !GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lmjpegsrc)))
- return NULL;
-
- if (num < 0 || num >= v4lmjpegsrc->breq.count)
- return NULL;
-
- return GST_V4LELEMENT (v4lmjpegsrc)->buffer + (v4lmjpegsrc->breq.size * num);
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_requeue_frame():
- * requeue a frame for capturing
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_requeue_frame (GstV4lMjpegSrc * v4lmjpegsrc, gint num)
-{
- GST_DEBUG_OBJECT (v4lmjpegsrc, "requeueing frame %d", num);
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
- GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
- /* mark frame as 'ready to requeue' */
- g_mutex_lock (v4lmjpegsrc->mutex_queue_state);
-
- if (v4lmjpegsrc->frame_queue_state[num] != QUEUE_STATE_SYNCED) {
- GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, TOO_LAZY, (NULL),
- ("Invalid state %d (expected %d), can't requeue",
- v4lmjpegsrc->frame_queue_state[num], QUEUE_STATE_SYNCED));
- return FALSE;
- }
-
- v4lmjpegsrc->frame_queue_state[num] = QUEUE_STATE_READY_FOR_QUEUE;
-
- /* let an optional wait know */
- g_cond_broadcast (v4lmjpegsrc->cond_queue_state);
-
- g_mutex_unlock (v4lmjpegsrc->mutex_queue_state);
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_capture_stop():
- * stop streaming capture
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_capture_stop (GstV4lMjpegSrc * v4lmjpegsrc)
-{
- int n;
-
- GST_DEBUG_OBJECT (v4lmjpegsrc, "stopping capture");
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
- GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
- g_mutex_lock (v4lmjpegsrc->mutex_queue_state);
-
- /* make an optional pending wait stop */
- v4lmjpegsrc->quit = TRUE;
- g_cond_broadcast (v4lmjpegsrc->cond_queue_state);
-
- /* sync on remaining frames */
- while (v4lmjpegsrc->num_queued > 0) {
- gst_v4lmjpegsrc_sync_next_frame (v4lmjpegsrc, &n);
- }
-
- v4lmjpegsrc->is_capturing = FALSE;
- g_mutex_unlock (v4lmjpegsrc->mutex_queue_state);
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lmjpegsrc_capture_deinit():
- * deinitialize the capture system
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lmjpegsrc_capture_deinit (GstV4lMjpegSrc * v4lmjpegsrc)
-{
- GST_DEBUG_OBJECT (v4lmjpegsrc, "quitting capture subsystem");
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lmjpegsrc));
- GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc));
-
- /* unmap the buffer */
- munmap (GST_V4LELEMENT (v4lmjpegsrc)->buffer,
- v4lmjpegsrc->breq.size * v4lmjpegsrc->breq.count);
- GST_V4LELEMENT (v4lmjpegsrc)->buffer = NULL;
-
- /* free buffer tracker */
- g_mutex_free (v4lmjpegsrc->mutex_queue_state);
- g_cond_free (v4lmjpegsrc->cond_queue_state);
- g_free (v4lmjpegsrc->frame_queue_state);
- g_free (v4lmjpegsrc->use_num_times);
-
- return TRUE;
-}
diff --git a/sys/v4l/v4lmjpegsrc_calls.h b/sys/v4l/v4lmjpegsrc_calls.h
deleted file mode 100644
index e873ea01..00000000
--- a/sys/v4l/v4lmjpegsrc_calls.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* GStreamer
- *
- * v4lmjpegsrc_calls.h: functions for hardware MJPEG video source
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __V4L_MJPEG_SRC_CALLS_H__
-#define __V4L_MJPEG_SRC_CALLS_H__
-
-#include "gstv4lmjpegsrc.h"
-#include "v4l_calls.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* frame grabbing/capture */
-gboolean gst_v4lmjpegsrc_set_buffer (GstV4lMjpegSrc *v4lmjpegsrc,
- gint numbufs,
- gint bufsize);
-gboolean gst_v4lmjpegsrc_set_capture (GstV4lMjpegSrc *v4lmjpegsrc,
- gint decimation,
- gint quality);
-gboolean gst_v4lmjpegsrc_set_capture_m (GstV4lMjpegSrc *v4lmjpegsrc,
- gint x_offset,
- gint y_offset,
- gint width,
- gint height,
- gint h_decimation,
- gint v_decimation,
- gint quality);
-gboolean gst_v4lmjpegsrc_capture_init (GstV4lMjpegSrc *v4lmjpegsrc);
-gboolean gst_v4lmjpegsrc_capture_start (GstV4lMjpegSrc *v4lmjpegsrc);
-gboolean gst_v4lmjpegsrc_grab_frame (GstV4lMjpegSrc *v4lmjpegsrc,
- gint *num,
- gint *size);
-guint8 * gst_v4lmjpegsrc_get_buffer (GstV4lMjpegSrc *v4lmjpegsrc,
- gint num);
-gboolean gst_v4lmjpegsrc_requeue_frame (GstV4lMjpegSrc *v4lmjpegsrc,
- gint num);
-gboolean gst_v4lmjpegsrc_capture_stop (GstV4lMjpegSrc *v4lmjpegsrc);
-gboolean gst_v4lmjpegsrc_capture_deinit (GstV4lMjpegSrc *v4lmjpegsrc);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __V4L_MJPEG_SRC_CALLS_H__ */
diff --git a/sys/v4l/v4lsrc_calls.c b/sys/v4l/v4lsrc_calls.c
deleted file mode 100644
index 31bd6dee..00000000
--- a/sys/v4l/v4lsrc_calls.c
+++ /dev/null
@@ -1,764 +0,0 @@
-/* GStreamer
- *
- * v4lsrc_calls.c: generic V4L source functions
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <string.h>
-#include <errno.h>
-#include "v4lsrc_calls.h"
-#include <sys/time.h>
-
-/* number of buffers to be queued *at least* before syncing */
-#define MIN_BUFFERS_QUEUED 2
-
-/* On some systems MAP_FAILED seems to be missing */
-#ifndef MAP_FAILED
-#define MAP_FAILED ( (caddr_t) -1 )
-#endif
-
-GST_DEBUG_CATEGORY_EXTERN (v4l_debug);
-
-#define GST_CAT_DEFAULT v4l_debug
-
-#ifndef GST_DISABLE_GST_DEBUG
-/* palette names */
-static const char *v4l_palette_name[] = {
- "", /* 0 */
- "grayscale", /* VIDEO_PALETTE_GREY */
- "Hi-420", /* VIDEO_PALETTE_HI420 */
- "16-bit RGB (RGB-565)", /* VIDEO_PALETTE_RB565 */
- "24-bit RGB", /* VIDEO_PALETTE_RGB24 */
- "32-bit RGB", /* VIDEO_PALETTE_RGB32 */
- "15-bit RGB (RGB-555)", /* VIDEO_PALETTE_RGB555 */
- "YUV-4:2:2 (packed)", /* VIDEO_PALETTE_YUV422 */
- "YUYV", /* VIDEO_PALETTE_YUYV */
- "UYVY", /* VIDEO_PALETTE_UYVY */
- "YUV-4:2:0 (packed)", /* VIDEO_PALETTE_YUV420 */
- "YUV-4:1:1 (packed)", /* VIDEO_PALETTE_YUV411 */
- "Raw", /* VIDEO_PALETTE_RAW */
- "YUV-4:2:2 (planar)", /* VIDEO_PALETTE_YUV422P */
- "YUV-4:1:1 (planar)", /* VIDEO_PALETTE_YUV411P */
- "YUV-4:2:0 (planar)/I420", /* VIDEO_PALETTE_YUV420P */
- "YUV-4:1:0 (planar)" /* VIDEO_PALETTE_YUV410P */
-};
-#endif
-
-/******************************************************
- * gst_v4lsrc_queue_frame():
- * queue a frame for capturing
- * (ie. instruct the hardware to start capture)
- * Requires queue_state lock to be held!
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-static gboolean
-gst_v4lsrc_queue_frame (GstV4lSrc * v4lsrc, gint num)
-{
- GST_LOG_OBJECT (v4lsrc, "queueing frame %d", num);
-
- if (v4lsrc->frame_queue_state[num] != QUEUE_STATE_READY_FOR_QUEUE) {
- return FALSE;
- }
-
- /* instruct the driver to prepare capture using buffer frame num */
- v4lsrc->mmap.frame = num;
- if (ioctl (GST_V4LELEMENT (v4lsrc)->video_fd,
- VIDIOCMCAPTURE, &(v4lsrc->mmap)) < 0) {
- GST_ELEMENT_ERROR (v4lsrc, RESOURCE, WRITE, (NULL),
- ("Error queueing a buffer (%d): %s", num, g_strerror (errno)));
- return FALSE;
- }
-
- v4lsrc->frame_queue_state[num] = QUEUE_STATE_QUEUED;
- v4lsrc->num_queued++;
-
- return TRUE;
-}
-
-/******************************************************
- * gst_v4lsrc_hard_sync_frame(GstV4lSrc *v4lsrc,gint num)
- * sync a frame and set the timestamp correctly
- * Requires queue_state lock to be held
- *****************************************************/
-
-static gboolean
-gst_v4lsrc_sync_frame (GstV4lSrc * v4lsrc, gint num)
-{
- GST_LOG_OBJECT (v4lsrc, "VIOIOCSYNC on frame %d", num);
-
- if (v4lsrc->frame_queue_state[num] != QUEUE_STATE_QUEUED) {
- return FALSE;
- }
-
- while (ioctl (GST_V4LELEMENT (v4lsrc)->video_fd, VIDIOCSYNC, &num) < 0) {
- /* if the sync() got interrupted, we can retry */
- if (errno != EINTR) {
- v4lsrc->frame_queue_state[num] = QUEUE_STATE_ERROR;
- GST_ELEMENT_ERROR (v4lsrc, RESOURCE, SYNC, (NULL), GST_ERROR_SYSTEM);
- return FALSE;
- }
- GST_DEBUG_OBJECT (v4lsrc, "Sync got interrupted");
- }
- GST_LOG_OBJECT (v4lsrc, "VIOIOCSYNC on frame %d done", num);
-
- v4lsrc->frame_queue_state[num] = QUEUE_STATE_SYNCED;
- v4lsrc->num_queued--;
-
- return TRUE;
-}
-
-/******************************************************
- * gst_v4lsrc_set_capture():
- * set capture parameters, palette = VIDEO_PALETTE_*
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lsrc_set_capture (GstV4lSrc * v4lsrc,
- gint width, gint height, gint palette)
-{
- GST_DEBUG_OBJECT (v4lsrc,
- "capture properties set to %dx%d, palette %d", width, height, palette);
-
- v4lsrc->mmap.width = width;
- v4lsrc->mmap.height = height;
- v4lsrc->mmap.format = palette;
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lsrc_capture_init():
- * initialize the capture system
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lsrc_capture_init (GstV4lSrc * v4lsrc)
-{
- GST_DEBUG_OBJECT (v4lsrc, "initting capture subsystem");
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lsrc));
- GST_V4L_CHECK_NOT_ACTIVE (GST_V4LELEMENT (v4lsrc));
-
- /* request the mmap buffer info:
- * total size of mmap buffer, number of frames, offsets of frames */
- if (ioctl (GST_V4LELEMENT (v4lsrc)->video_fd, VIDIOCGMBUF,
- &(v4lsrc->mbuf)) < 0) {
- GST_ELEMENT_ERROR (v4lsrc, RESOURCE, READ, (NULL),
- ("Error getting buffer information: %s", g_strerror (errno)));
- return FALSE;
- }
-
- if (v4lsrc->mbuf.frames < MIN_BUFFERS_QUEUED) {
- GST_ELEMENT_ERROR (v4lsrc, RESOURCE, READ, (NULL),
- ("Not enough buffers. We got %d, we want at least %d",
- v4lsrc->mbuf.frames, MIN_BUFFERS_QUEUED));
- return FALSE;
- }
-
- GST_INFO_OBJECT (v4lsrc, "Got %d buffers (\'%s\') with total size %d KB",
- v4lsrc->mbuf.frames, v4l_palette_name[v4lsrc->mmap.format],
- v4lsrc->mbuf.size / (v4lsrc->mbuf.frames * 1024));
-
- /* keep track of queued buffers */
- v4lsrc->frame_queue_state = (gint8 *)
- g_malloc (sizeof (gint8) * v4lsrc->mbuf.frames);
-
- /* lock for the frame_state */
- v4lsrc->mutex_queue_state = g_mutex_new ();
- v4lsrc->cond_queue_state = g_cond_new ();
-
- /* Map the buffers */
- GST_V4LELEMENT (v4lsrc)->buffer = mmap (NULL, v4lsrc->mbuf.size,
- PROT_READ | PROT_WRITE, MAP_SHARED, GST_V4LELEMENT (v4lsrc)->video_fd, 0);
- if (GST_V4LELEMENT (v4lsrc)->buffer == MAP_FAILED) {
- GST_ELEMENT_ERROR (v4lsrc, RESOURCE, OPEN_READ_WRITE, (NULL),
- ("Error mapping video buffers: %s", g_strerror (errno)));
- GST_V4LELEMENT (v4lsrc)->buffer = NULL;
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lsrc_capture_start():
- * start streaming capture
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lsrc_capture_start (GstV4lSrc * v4lsrc)
-{
- int n;
-
- GST_DEBUG_OBJECT (v4lsrc, "starting capture");
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lsrc));
- GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lsrc));
-
- g_mutex_lock (v4lsrc->mutex_queue_state);
-
- v4lsrc->quit = FALSE;
- v4lsrc->num_queued = 0;
- v4lsrc->sync_frame = 0;
- v4lsrc->queue_frame = 0;
-
- /* set all buffers ready to queue, and queue captures to the device.
- * This starts streaming capture */
- for (n = 0; n < v4lsrc->mbuf.frames; n++) {
- v4lsrc->frame_queue_state[n] = QUEUE_STATE_READY_FOR_QUEUE;
- if (!gst_v4lsrc_queue_frame (v4lsrc, n)) {
- g_mutex_unlock (v4lsrc->mutex_queue_state);
- gst_v4lsrc_capture_stop (v4lsrc);
- return FALSE;
- }
- }
-
- v4lsrc->is_capturing = TRUE;
- g_mutex_unlock (v4lsrc->mutex_queue_state);
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lsrc_grab_frame():
- * capture one frame during streaming capture
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lsrc_grab_frame (GstV4lSrc * v4lsrc, gint * num)
-{
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lsrc));
- GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lsrc));
-
- GST_LOG_OBJECT (v4lsrc, "grabbing frame");
-
- g_mutex_lock (v4lsrc->mutex_queue_state);
-
- /* do we have enough frames? */
- while (v4lsrc->num_queued < MIN_BUFFERS_QUEUED ||
- v4lsrc->frame_queue_state[v4lsrc->queue_frame] ==
- QUEUE_STATE_READY_FOR_QUEUE) {
- while (v4lsrc->frame_queue_state[v4lsrc->queue_frame] !=
- QUEUE_STATE_READY_FOR_QUEUE && !v4lsrc->quit) {
- GST_DEBUG_OBJECT (v4lsrc,
- "Waiting for frames to become available (queued %d < minimum %d)",
- v4lsrc->num_queued, MIN_BUFFERS_QUEUED);
- g_cond_wait (v4lsrc->cond_queue_state, v4lsrc->mutex_queue_state);
- }
- if (v4lsrc->quit) {
- g_mutex_unlock (v4lsrc->mutex_queue_state);
- return FALSE;
- }
- if (!gst_v4lsrc_queue_frame (v4lsrc, v4lsrc->queue_frame)) {
- g_mutex_unlock (v4lsrc->mutex_queue_state);
- return FALSE;
- }
- v4lsrc->queue_frame = (v4lsrc->queue_frame + 1) % v4lsrc->mbuf.frames;
- }
-
- /* syncing on the buffer grabs it */
- *num = v4lsrc->sync_frame;
- if (!gst_v4lsrc_sync_frame (v4lsrc, *num)) {
- g_mutex_unlock (v4lsrc->mutex_queue_state);
- return FALSE;
- }
- v4lsrc->sync_frame = (v4lsrc->sync_frame + 1) % v4lsrc->mbuf.frames;
-
- g_mutex_unlock (v4lsrc->mutex_queue_state);
-
- GST_LOG_OBJECT (v4lsrc, "grabbed frame %d", *num);
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lsrc_get_buffer():
- * get the address of the given frame number in the mmap'd buffer
- * return value: the buffer's address or NULL
- ******************************************************/
-
-guint8 *
-gst_v4lsrc_get_buffer (GstV4lSrc * v4lsrc, gint num)
-{
- if (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lsrc)) ||
- !GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lsrc)))
- return NULL;
-
- if (num < 0 || num >= v4lsrc->mbuf.frames)
- return NULL;
-
- return GST_V4LELEMENT (v4lsrc)->buffer + v4lsrc->mbuf.offsets[num];
-}
-
-
-/******************************************************
- * gst_v4lsrc_requeue_frame():
- * re-queue a frame after we're done with the buffer
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lsrc_requeue_frame (GstV4lSrc * v4lsrc, gint num)
-{
- GST_LOG_OBJECT (v4lsrc, "requeueing frame %d", num);
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lsrc));
- GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lsrc));
-
- /* mark frame as 'ready to requeue' */
- g_mutex_lock (v4lsrc->mutex_queue_state);
-
- if (v4lsrc->frame_queue_state[num] != QUEUE_STATE_SYNCED) {
- GST_ELEMENT_ERROR (v4lsrc, RESOURCE, TOO_LAZY, (NULL),
- ("Invalid state %d (expected %d), can't requeue",
- v4lsrc->frame_queue_state[num], QUEUE_STATE_SYNCED));
- return FALSE;
- }
-
- v4lsrc->frame_queue_state[num] = QUEUE_STATE_READY_FOR_QUEUE;
-
- /* let an optional wait know */
- g_cond_broadcast (v4lsrc->cond_queue_state);
-
- g_mutex_unlock (v4lsrc->mutex_queue_state);
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lsrc_capture_stop():
- * stop streaming capture
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lsrc_capture_stop (GstV4lSrc * v4lsrc)
-{
- GST_DEBUG_OBJECT (v4lsrc, "stopping capture");
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lsrc));
- GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lsrc));
-
- g_mutex_lock (v4lsrc->mutex_queue_state);
- v4lsrc->is_capturing = FALSE;
-
- /* make an optional pending wait stop */
- v4lsrc->quit = TRUE;
- g_cond_broadcast (v4lsrc->cond_queue_state);
-
- /* sync on remaining frames */
- while (1) {
- if (v4lsrc->frame_queue_state[v4lsrc->sync_frame] == QUEUE_STATE_QUEUED) {
- gst_v4lsrc_sync_frame (v4lsrc, v4lsrc->sync_frame);
- v4lsrc->sync_frame = (v4lsrc->sync_frame + 1) % v4lsrc->mbuf.frames;
- } else {
- break;
- }
- }
-
- g_mutex_unlock (v4lsrc->mutex_queue_state);
-
- return TRUE;
-}
-
-
-/******************************************************
- * gst_v4lsrc_capture_deinit():
- * deinitialize the capture system
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lsrc_capture_deinit (GstV4lSrc * v4lsrc)
-{
- GST_DEBUG_OBJECT (v4lsrc, "quitting capture subsystem");
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lsrc));
- GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lsrc));
-
- /* free buffer tracker */
- g_mutex_free (v4lsrc->mutex_queue_state);
- v4lsrc->mutex_queue_state = NULL;
- g_cond_free (v4lsrc->cond_queue_state);
- v4lsrc->cond_queue_state = NULL;
- g_free (v4lsrc->frame_queue_state);
- v4lsrc->frame_queue_state = NULL;
-
- /* unmap the buffer */
- if (munmap (GST_V4LELEMENT (v4lsrc)->buffer, v4lsrc->mbuf.size) == -1) {
- GST_ELEMENT_ERROR (v4lsrc, RESOURCE, CLOSE, (NULL),
- ("error munmap'ing capture buffer: %s", g_strerror (errno)));
- return FALSE;
- }
- GST_V4LELEMENT (v4lsrc)->buffer = NULL;
-
- return TRUE;
-}
-
-/******************************************************
- * gst_v4lsrc_try_capture():
- * try out a capture on the device
- * This has to be done before initializing the
- * actual capture system, to make sure we don't
- * mess up anything. So we need to mini-mmap()
- * a buffer here, queue and sync on one buffer,
- * and unmap it.
- * This is ugly, yes, I know - but it's a major
- * design flaw of v4l1 that you don't know in
- * advance which formats will be supported...
- * This is better than "just assuming that it'll
- * work"...
- * return value: TRUE on success, FALSE on error
- ******************************************************/
-
-gboolean
-gst_v4lsrc_try_capture (GstV4lSrc * v4lsrc, gint width, gint height,
- gint palette)
-{
- /* so, we need a buffer and some more stuff */
- int frame = 0;
- guint8 *buffer;
- struct video_mbuf vmbuf;
- struct video_mmap vmmap;
-
- GST_DEBUG_OBJECT (v4lsrc, "try out %dx%d, palette format %d (%s)",
- width, height, palette, v4l_palette_name[palette]);
- GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lsrc));
- GST_V4L_CHECK_NOT_ACTIVE (GST_V4LELEMENT (v4lsrc));
-
- /* let's start by requesting a buffer and mmap()'ing it */
- if (ioctl (GST_V4LELEMENT (v4lsrc)->video_fd, VIDIOCGMBUF, &vmbuf) < 0) {
- GST_ELEMENT_ERROR (v4lsrc, RESOURCE, READ, (NULL),
- ("Error getting buffer information: %s", g_strerror (errno)));
- return FALSE;
- }
- /* Map the buffers */
- buffer = mmap (NULL, vmbuf.size, PROT_READ | PROT_WRITE,
- MAP_SHARED, GST_V4LELEMENT (v4lsrc)->video_fd, 0);
- if (buffer == MAP_FAILED) {
- GST_ELEMENT_ERROR (v4lsrc, RESOURCE, OPEN_READ_WRITE, (NULL),
- ("Error mapping our try-out buffer: %s", g_strerror (errno)));
- return FALSE;
- }
-
- /* now that we have a buffer, let's try out our format */
- vmmap.width = width;
- vmmap.height = height;
- vmmap.format = palette;
- vmmap.frame = frame;
- if (ioctl (GST_V4LELEMENT (v4lsrc)->video_fd, VIDIOCMCAPTURE, &vmmap) < 0) {
- if (errno != EINVAL) /* our format failed! */
- GST_ERROR_OBJECT (v4lsrc,
- "Error queueing our try-out buffer: %s", g_strerror (errno));
- munmap (buffer, vmbuf.size);
- return FALSE;
- }
-
- if (ioctl (GST_V4LELEMENT (v4lsrc)->video_fd, VIDIOCSYNC, &frame) < 0) {
- GST_ELEMENT_ERROR (v4lsrc, RESOURCE, SYNC, (NULL), GST_ERROR_SYSTEM);
- munmap (buffer, vmbuf.size);
- return FALSE;
- }
-
- munmap (buffer, vmbuf.size);
-
- /* if we got here, it worked! woohoo, the format is supported! */
- return TRUE;
-}
-
-#ifndef GST_DISABLE_GST_DEBUG
-const char *
-gst_v4lsrc_palette_name (int i)
-{
- return v4l_palette_name[i];
-}
-#endif
-
-gboolean
-gst_v4lsrc_get_fps (GstV4lSrc * v4lsrc, gint * fps_n, gint * fps_d)
-{
- gint norm;
- gint fps_index;
- struct video_window *vwin = &GST_V4LELEMENT (v4lsrc)->vwin;
-
- /* check if we have vwin window properties giving a framerate,
- * as is done for webcams
- * See http://www.smcc.demon.nl/webcam/api.html
- * which is used for the Philips and qce-ga drivers */
- fps_index = (vwin->flags >> 16) & 0x3F; /* 6 bit index for framerate */
-
- /* webcams have a non-zero fps_index */
- if (fps_index != 0) {
- /* index of 16 corresponds to 15 fps */
- GST_DEBUG_OBJECT (v4lsrc, "device reports fps of %d/%d (%.4f)",
- fps_index * 15, 16, fps_index * 15.0 / 16);
-
- if (fps_n)
- *fps_n = fps_index * 15;
- if (fps_d)
- *fps_d = 16;
-
- return TRUE;
- }
-
- /* removed fps estimation code here */
-
- /* if that failed ... */
-
- if (!GST_V4L_IS_OPEN (GST_V4LELEMENT (v4lsrc)))
- return FALSE;
-
- if (!gst_v4l_get_chan_norm (GST_V4LELEMENT (v4lsrc), NULL, &norm))
- return FALSE;
-
- if (norm == VIDEO_MODE_NTSC) {
- if (fps_n)
- *fps_n = 30000;
- if (fps_d)
- *fps_d = 1001;
- } else {
- if (fps_n)
- *fps_n = 25;
- if (fps_d)
- *fps_d = 1;
- }
-
- return TRUE;
-}
-
-/* get a list of possible framerates
- * this is only done for webcams;
- * other devices return NULL here.
- * this function takes a LONG time to execute.
- */
-GValue *
-gst_v4lsrc_get_fps_list (GstV4lSrc * v4lsrc)
-{
- gint fps_index;
- struct video_window *vwin = &GST_V4LELEMENT (v4lsrc)->vwin;
- GstV4lElement *v4lelement = GST_V4LELEMENT (v4lsrc);
-
- /* check if we have vwin window properties giving a framerate,
- * as is done for webcams
- * See http://www.smcc.demon.nl/webcam/api.html
- * which is used for the Philips and qce-ga drivers */
- fps_index = (vwin->flags >> 16) & 0x3F; /* 6 bit index for framerate */
-
- /* webcams have a non-zero fps_index */
- if (fps_index == 0) {
- GST_DEBUG_OBJECT (v4lsrc, "fps_index is 0, no webcam");
- return NULL;
- }
- GST_DEBUG_OBJECT (v4lsrc, "fps_index is %d, so webcam", fps_index);
-
- {
- int i;
- GValue *list = NULL;
- GValue value = { 0 };
-
- /* webcam detected, so try all framerates and return a list */
-
- list = g_new0 (GValue, 1);
- g_value_init (list, GST_TYPE_LIST);
-
- /* index of 16 corresponds to 15 fps */
- GST_DEBUG_OBJECT (v4lsrc, "device reports fps of %d/%d (%.4f)",
- fps_index * 15, 16, fps_index * 15.0 / 16);
- for (i = 0; i < 63; ++i) {
- /* set bits 16 to 21 to 0 */
- vwin->flags &= (0x3F00 - 1);
- /* set bits 16 to 21 to the index */
- vwin->flags |= i << 16;
- if (gst_v4l_set_window_properties (v4lelement)) {
- /* setting it succeeded. FIXME: get it and check. */
- g_value_init (&value, GST_TYPE_FRACTION);
- gst_value_set_fraction (&value, i * 15, 16);
- gst_value_list_append_value (list, &value);
- g_value_unset (&value);
- }
- }
- /* FIXME: set back the original fps_index */
- vwin->flags &= (0x3F00 - 1);
- vwin->flags |= fps_index << 16;
- gst_v4l_set_window_properties (v4lelement);
- return list;
- }
-}
-
-#define GST_TYPE_V4LSRC_BUFFER (gst_v4lsrc_buffer_get_type())
-#define GST_IS_V4LSRC_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_V4LSRC_BUFFER))
-#define GST_V4LSRC_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_V4LSRC_BUFFER, GstV4lSrcBuffer))
-
-typedef struct _GstV4lSrcBuffer
-{
- GstBuffer buffer;
-
- GstV4lSrc *v4lsrc;
-
- gint num;
-} GstV4lSrcBuffer;
-
-static void gst_v4lsrc_buffer_class_init (gpointer g_class,
- gpointer class_data);
-static void gst_v4lsrc_buffer_init (GTypeInstance * instance, gpointer g_class);
-static void gst_v4lsrc_buffer_finalize (GstV4lSrcBuffer * v4lsrc_buffer);
-
-static GstBufferClass *v4lbuffer_parent_class = NULL;
-
-static GType
-gst_v4lsrc_buffer_get_type (void)
-{
- static GType _gst_v4lsrc_buffer_type;
-
- if (G_UNLIKELY (_gst_v4lsrc_buffer_type == 0)) {
- static const GTypeInfo v4lsrc_buffer_info = {
- sizeof (GstBufferClass),
- NULL,
- NULL,
- gst_v4lsrc_buffer_class_init,
- NULL,
- NULL,
- sizeof (GstV4lSrcBuffer),
- 0,
- gst_v4lsrc_buffer_init,
- NULL
- };
- _gst_v4lsrc_buffer_type = g_type_register_static (GST_TYPE_BUFFER,
- "GstV4lSrcBuffer", &v4lsrc_buffer_info, 0);
- }
- return _gst_v4lsrc_buffer_type;
-}
-
-static void
-gst_v4lsrc_buffer_class_init (gpointer g_class, gpointer class_data)
-{
- GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
-
- v4lbuffer_parent_class = g_type_class_peek_parent (g_class);
-
- mini_object_class->finalize = (GstMiniObjectFinalizeFunction)
- gst_v4lsrc_buffer_finalize;
-}
-
-static void
-gst_v4lsrc_buffer_init (GTypeInstance * instance, gpointer g_class)
-{
-
-}
-
-static void
-gst_v4lsrc_buffer_finalize (GstV4lSrcBuffer * v4lsrc_buffer)
-{
- GstMiniObjectClass *miniobject_class;
- GstV4lSrc *v4lsrc;
- gint num;
-
- v4lsrc = v4lsrc_buffer->v4lsrc;
- num = v4lsrc_buffer->num;
-
- GST_LOG_OBJECT (v4lsrc, "freeing buffer %p for frame %d", v4lsrc_buffer, num);
-
- /* only requeue if we still have an mmap buffer */
- if (GST_V4LELEMENT (v4lsrc)->buffer) {
- GST_LOG_OBJECT (v4lsrc, "requeueing frame %d", num);
- gst_v4lsrc_requeue_frame (v4lsrc, num);
- }
-
- gst_object_unref (v4lsrc);
-
- miniobject_class = (GstMiniObjectClass *) v4lbuffer_parent_class;
- miniobject_class->finalize (GST_MINI_OBJECT_CAST (v4lsrc_buffer));
-}
-
-/* Create a V4lSrc buffer from our mmap'd data area */
-GstBuffer *
-gst_v4lsrc_buffer_new (GstV4lSrc * v4lsrc, gint num)
-{
- GstClockTime duration, timestamp, latency;
- GstBuffer *buf;
- GstClock *clock;
- gint fps_n, fps_d;
-
- GST_DEBUG_OBJECT (v4lsrc, "creating buffer for frame %d", num);
-
- if (!(gst_v4lsrc_get_fps (v4lsrc, &fps_n, &fps_d)))
- return NULL;
-
- buf = (GstBuffer *) gst_mini_object_new (GST_TYPE_V4LSRC_BUFFER);
-
- GST_V4LSRC_BUFFER (buf)->num = num;
- GST_V4LSRC_BUFFER (buf)->v4lsrc = gst_object_ref (v4lsrc);
-
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_READONLY);
- GST_BUFFER_DATA (buf) = gst_v4lsrc_get_buffer (v4lsrc, num);
- GST_BUFFER_SIZE (buf) = v4lsrc->buffer_size;
- GST_BUFFER_OFFSET (buf) = v4lsrc->offset++;
- GST_BUFFER_OFFSET_END (buf) = v4lsrc->offset;
-
- /* timestamps, LOCK to get clock and base time. */
- GST_OBJECT_LOCK (v4lsrc);
- if ((clock = GST_ELEMENT_CLOCK (v4lsrc))) {
- /* we have a clock, get base time and ref clock */
- timestamp = GST_ELEMENT_CAST (v4lsrc)->base_time;
- gst_object_ref (clock);
- } else {
- /* no clock, can't set timestamps */
- timestamp = GST_CLOCK_TIME_NONE;
- }
- GST_OBJECT_UNLOCK (v4lsrc);
-
- duration =
- gst_util_uint64_scale_int (GST_SECOND, fps_d * v4lsrc->offset, fps_n) -
- gst_util_uint64_scale_int (GST_SECOND, fps_d * (v4lsrc->offset - 1),
- fps_n);
-
- latency = gst_util_uint64_scale_int (GST_SECOND, fps_d, fps_n);
-
- if (clock) {
- /* the time now is the time of the clock minus the base time */
- timestamp = gst_clock_get_time (clock) - timestamp;
- gst_object_unref (clock);
-
- /* adjust timestamp for frame latency (we assume we have a framerate) */
- if (timestamp > latency)
- timestamp -= latency;
- else
- timestamp = 0;
- }
-
- GST_BUFFER_TIMESTAMP (buf) = timestamp;
- GST_BUFFER_DURATION (buf) = duration;
-
- return buf;
-}
diff --git a/sys/v4l/v4lsrc_calls.h b/sys/v4l/v4lsrc_calls.h
deleted file mode 100644
index 18b35254..00000000
--- a/sys/v4l/v4lsrc_calls.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* GStreamer
- *
- * v4lsrc_calls.h: functions for V4L video source
- *
- * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __V4L_SRC_CALLS_H__
-#define __V4L_SRC_CALLS_H__
-
-#include "gstv4lsrc.h"
-#include "v4l_calls.h"
-
-
-G_BEGIN_DECLS
-
-
-/* frame grabbing/capture (palette = VIDEO_PALETTE_* - see videodev.h) */
-gboolean gst_v4lsrc_set_capture (GstV4lSrc *v4lsrc, gint width, gint height, gint palette);
-gboolean gst_v4lsrc_capture_init (GstV4lSrc *v4lsrc);
-gboolean gst_v4lsrc_capture_start (GstV4lSrc *v4lsrc);
-gboolean gst_v4lsrc_grab_frame (GstV4lSrc *v4lsrc, gint *num);
-guint8 * gst_v4lsrc_get_buffer (GstV4lSrc *v4lsrc, gint num);
-gboolean gst_v4lsrc_requeue_frame (GstV4lSrc *v4lsrc, gint num);
-gboolean gst_v4lsrc_capture_stop (GstV4lSrc *v4lsrc);
-gboolean gst_v4lsrc_capture_deinit (GstV4lSrc *v4lsrc);
-gboolean gst_v4lsrc_get_fps (GstV4lSrc * v4lsrc, gint *fps_n, gint *fps_d);
-GValue * gst_v4lsrc_get_fps_list (GstV4lSrc * v4lsrc);
-GstBuffer *gst_v4lsrc_buffer_new (GstV4lSrc * v4lsrc, gint num);
-
-/* "the ugliest hack ever, now available at your local mirror" */
-gboolean gst_v4lsrc_try_capture (GstV4lSrc *v4lsrc, gint width, gint height, gint palette);
-
-/* For debug purposes, share the palette names */
-#ifndef GST_DISABLE_GST_DEBUG
-const char *gst_v4lsrc_palette_name (int i);
-#endif
-
-
-G_END_DECLS
-
-
-#endif /* __V4L_SRC_CALLS_H__ */
diff --git a/sys/v4l/videodev_mjpeg.h b/sys/v4l/videodev_mjpeg.h
deleted file mode 100644
index e217fe41..00000000
--- a/sys/v4l/videodev_mjpeg.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* These are the MJPEG API extensions for the Video4Linux API,
- first introduced by the Iomega Buz driver by Rainer Johanni
- <rainer@johanni.de>
-*/
-
-#ifndef __VIDEODEV_MJPEG_H__
-#define __VIDEODEV_MJPEG_H__
-
-/* This is identical with the mgavideo internal params struct,
- please tell me if you change this struct here ! <gz@lysator.liu.se) */
-struct mjpeg_params
-{
-
- /* The following parameters can only be queried */
-
- int major_version; /* Major version number of driver */
- int minor_version; /* Minor version number of driver */
-
- /* Main control parameters */
-
- int input; /* Input channel: 0 = Composite, 1 = S-VHS */
- int norm; /* Norm: VIDEO_MODE_PAL or VIDEO_MODE_NTSC */
- int decimation; /* decimation of captured video,
- enlargement of video played back.
- Valid values are 1, 2, 4 or 0.
- 0 is a special value where the user
- has full control over video scaling */
-
- /* The following parameters only have to be set if decimation==0,
- for other values of decimation they provide the data how the image is captured */
-
- int HorDcm; /* Horizontal decimation: 1, 2 or 4 */
- int VerDcm; /* Vertical decimation: 1 or 2 */
- int TmpDcm; /* Temporal decimation: 1 or 2,
- if TmpDcm==2 in capture every second frame is dropped,
- in playback every frame is played twice */
- int field_per_buff; /* Number of fields per buffer: 1 or 2 */
- int img_x; /* start of image in x direction */
- int img_y; /* start of image in y direction */
- int img_width; /* image width BEFORE decimation,
- must be a multiple of HorDcm*16 */
- int img_height; /* image height BEFORE decimation,
- must be a multiple of VerDcm*8 */
-
- /* --- End of parameters for decimation==0 only --- */
-
- /* JPEG control parameters */
-
- int quality; /* Measure for quality of compressed images.
- Scales linearly with the size of the compressed images.
- Must be beetween 0 and 100, 100 is a compression
- ratio of 1:4 */
-
- int odd_even; /* Which field should come first ???
- This is more aptly named "top_first",
- i.e. (odd_even==1) --> top-field-first */
-
- int APPn; /* Number of APP segment to be written, must be 0..15 */
- int APP_len; /* Length of data in JPEG APPn segment */
- char APP_data[60]; /* Data in the JPEG APPn segment. */
-
- int COM_len; /* Length of data in JPEG COM segment */
- char COM_data[60]; /* Data in JPEG COM segment */
-
- unsigned long jpeg_markers; /* Which markers should go into the JPEG output.
- Unless you exactly know what you do, leave them untouched.
- Inluding less markers will make the resulting code
- smaller, but there will be fewer applications
- which can read it.
- The presence of the APP and COM marker is
- influenced by APP0_len and COM_len ONLY! */
-#define JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */
-#define JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */
-#define JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */
-#define JPEG_MARKER_COM (1<<6) /* Comment segment */
-#define JPEG_MARKER_APP (1<<7) /* App segment, driver will allways use APP0 */
-
- int VFIFO_FB; /* Flag for enabling Video Fifo Feedback.
- If this flag is turned on and JPEG decompressing
- is going to the screen, the decompress process
- is stopped every time the Video Fifo is full.
- This enables a smooth decompress to the screen
- but the video output signal will get scrambled */
-
- /* Misc */
-
- char reserved[312]; /* Makes 512 bytes for this structure */
-};
-
-struct mjpeg_requestbuffers
-{
- unsigned long count; /* Number of buffers for MJPEG grabbing */
- unsigned long size; /* Size PER BUFFER in bytes */
-};
-
-struct mjpeg_sync
-{
- unsigned long frame; /* Frame (0 - n) for double buffer */
- unsigned long length; /* number of code bytes in buffer (capture only) */
- unsigned long seq; /* frame sequence number */
- struct timeval timestamp; /* timestamp */
-};
-
-struct mjpeg_status
-{
- int input; /* Input channel, has to be set prior to BUZIOC_G_STATUS */
- int signal; /* Returned: 1 if valid video signal detected */
- int norm; /* Returned: VIDEO_MODE_PAL or VIDEO_MODE_NTSC */
- int color; /* Returned: 1 if color signal detected */
-};
-
-/*
-Private IOCTL to set up for displaying MJPEG
-*/
-#define MJPIOC_G_PARAMS _IOR ('v', BASE_VIDIOCPRIVATE+0, struct mjpeg_params)
-#define MJPIOC_S_PARAMS _IOWR('v', BASE_VIDIOCPRIVATE+1, struct mjpeg_params)
-#define MJPIOC_REQBUFS _IOWR('v', BASE_VIDIOCPRIVATE+2, struct mjpeg_requestbuffers)
-#define MJPIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOCPRIVATE+3, int)
-#define MJPIOC_QBUF_PLAY _IOW ('v', BASE_VIDIOCPRIVATE+4, int)
-#define MJPIOC_SYNC _IOR ('v', BASE_VIDIOCPRIVATE+5, struct mjpeg_sync)
-#define MJPIOC_G_STATUS _IOWR('v', BASE_VIDIOCPRIVATE+6, struct mjpeg_status)
-
-#endif /* __VIDEODEV_MJPEG_H__ */
diff --git a/sys/ximage/Makefile.am b/sys/ximage/Makefile.am
deleted file mode 100644
index 69f9bbca..00000000
--- a/sys/ximage/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-plugin_LTLIBRARIES = libgstximagesink.la
-
-libgstximagesink_la_SOURCES = ximagesink.c ximage.c
-libgstximagesink_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS)
-libgstximagesink_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la \
- $(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_MAJORMINOR).la \
- $(GST_BASE_LIBS) \
- $(X_LIBS) $(XSHM_LIBS)
-libgstximagesink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstximagesink_la_DEPENDENCIES = $(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_MAJORMINOR).la
-libgstximagesink_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = ximagesink.h
diff --git a/sys/ximage/ximage.c b/sys/ximage/ximage.c
deleted file mode 100644
index 24b7bf28..00000000
--- a/sys/ximage/ximage.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* GStreamer
- * Copyright (C) <2003> Julien Moutte <julien@moutte.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "ximagesink.h"
-
-GST_DEBUG_CATEGORY (gst_debug_ximagesink);
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_element_register (plugin, "ximagesink",
- GST_RANK_SECONDARY, GST_TYPE_XIMAGESINK))
- return FALSE;
-
- GST_DEBUG_CATEGORY_INIT (gst_debug_ximagesink, "ximagesink", 0,
- "ximagesink element");
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "ximagesink",
- "X11 video output element based on standard Xlib calls",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c
deleted file mode 100644
index e54df39a..00000000
--- a/sys/ximage/ximagesink.c
+++ /dev/null
@@ -1,2447 +0,0 @@
-/* GStreamer
- * Copyright (C) <2005> Julien Moutte <julien@moutte.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-ximagesink
- *
- * XImageSink renders video frames to a drawable (XWindow) on a local or remote
- * display. This element can receive a Window ID from the application through
- * the XOverlay interface and will then render video frames in this drawable.
- * If no Window ID was provided by the application, the element will create its
- * own internal window and render into it.
- *
- * <refsect2>
- * <title>Scaling</title>
- * <para>
- * As standard XImage rendering to a drawable is not scaled, XImageSink will use
- * reverse caps negotiation to try to get scaled video frames for the drawable.
- * This is accomplished by asking the peer pad if it accepts some different caps
- * which in most cases implies that there is a scaling element in the pipeline,
- * or that an element generating the video frames can generate them with a
- * different geometry. This mechanism is handled during buffer allocations, for
- * each allocation request the video sink will check the drawable geometry, look
- * at the #GstXImageSink:force-aspect-ratio property, calculate the geometry of
- * desired video frames and then check that the peer pad accept those new caps.
- * If it does it will then allocate a buffer in video memory with this new
- * geometry and return it with the new caps.
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>Events</title>
- * <para>
- * XImageSink creates a thread to handle events coming from the drawable. There
- * are several kind of events that can be grouped in 2 big categories: input
- * events and window state related events. Input events will be translated to
- * navigation events and pushed upstream for other elements to react on them.
- * This includes events such as pointer moves, key press/release, clicks etc...
- * Other events are used to handle the drawable appearance even when the data
- * is not flowing (GST_STATE_PAUSED). That means that even when the element is
- * paused, it will receive expose events from the drawable and draw the latest
- * frame with correct borders/aspect-ratio.
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>Pixel aspect ratio</title>
- * <para>
- * When changing state to GST_STATE_READY, XImageSink will open a connection to
- * the display specified in the #GstXImageSink:display property or the default
- * display if nothing specified. Once this connection is open it will inspect
- * the display configuration including the physical display geometry and
- * then calculate the pixel aspect ratio. When caps negotiation will occur, the
- * video sink will set the calculated pixel aspect ratio on the caps to make
- * sure that incoming video frames will have the correct pixel aspect ratio for
- * this display. Sometimes the calculated pixel aspect ratio can be wrong, it is
- * then possible to enforce a specific pixel aspect ratio using the
- * #GstXImageSink:pixel-aspect-ratio property.
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>Examples</title>
- * |[
- * gst-launch -v videotestsrc ! queue ! ximagesink
- * ]| A pipeline to test reverse negotiation. When the test video signal appears
- * you can resize the window and see that scaled buffers of the desired size are
- * going to arrive with a short delay. This illustrates how buffers of desired
- * size are allocated along the way. If you take away the queue, scaling will
- * happen almost immediately.
- * |[
- * gst-launch -v videotestsrc ! navigationtest ! ffmpegcolorspace ! ximagesink
- * ]| A pipeline to test navigation events.
- * While moving the mouse pointer over the test signal you will see a black box
- * following the mouse pointer. If you press the mouse button somewhere on the
- * video and release it somewhere else a green box will appear where you pressed
- * the button and a red one where you released it. (The navigationtest element
- * is part of gst-plugins-good.)
- * |[
- * gst-launch -v videotestsrc ! video/x-raw-rgb, pixel-aspect-ratio=(fraction)4/3 ! videoscale ! ximagesink
- * ]| This is faking a 4/3 pixel aspect ratio caps on video frames produced by
- * videotestsrc, in most cases the pixel aspect ratio of the display will be
- * 1/1. This means that videoscale will have to do the scaling to convert
- * incoming frames to a size that will match the display pixel aspect ratio
- * (from 320x240 to 320x180 in this case). Note that you might have to escape
- * some characters for your shell like '\(fraction\)'.
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-/* Our interfaces */
-#include <gst/interfaces/navigation.h>
-#include <gst/interfaces/xoverlay.h>
-
-/* Object header */
-#include "ximagesink.h"
-
-/* Debugging category */
-#include <gst/gstinfo.h>
-
-GST_DEBUG_CATEGORY_EXTERN (gst_debug_ximagesink);
-#define GST_CAT_DEFAULT gst_debug_ximagesink
-
-typedef struct
-{
- unsigned long flags;
- unsigned long functions;
- unsigned long decorations;
- long input_mode;
- unsigned long status;
-}
-MotifWmHints, MwmHints;
-
-#define MWM_HINTS_DECORATIONS (1L << 1)
-
-static void gst_ximagesink_reset (GstXImageSink * ximagesink);
-static void gst_ximagesink_ximage_destroy (GstXImageSink * ximagesink,
- GstXImageBuffer * ximage);
-static void gst_ximagesink_xwindow_update_geometry (GstXImageSink * ximagesink,
- GstXWindow * xwindow);
-static void gst_ximagesink_expose (GstXOverlay * overlay);
-
-/* ElementFactory information */
-static const GstElementDetails gst_ximagesink_details =
-GST_ELEMENT_DETAILS ("Video sink",
- "Sink/Video",
- "A standard X based videosink",
- "Julien Moutte <julien@moutte.net>");
-
-static GstStaticPadTemplate gst_ximagesink_sink_template_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-rgb, "
- "framerate = (fraction) [ 0, MAX ], "
- "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
- );
-
-enum
-{
- PROP_0,
- PROP_DISPLAY,
- PROP_SYNCHRONOUS,
- PROP_PIXEL_ASPECT_RATIO,
- PROP_FORCE_ASPECT_RATIO,
- PROP_HANDLE_EVENTS,
- PROP_HANDLE_EXPOSE
-};
-
-static GstVideoSinkClass *parent_class = NULL;
-
-/* ============================================================= */
-/* */
-/* Private Methods */
-/* */
-/* ============================================================= */
-
-/* ximage buffers */
-
-static GstBufferClass *ximage_buffer_parent_class = NULL;
-
-#define GST_TYPE_XIMAGE_BUFFER (gst_ximage_buffer_get_type())
-
-#define GST_IS_XIMAGE_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_XIMAGE_BUFFER))
-#define GST_XIMAGE_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_XIMAGE_BUFFER, GstXImageBuffer))
-#define GST_XIMAGE_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_XIMAGE_BUFFER, GstXImageBufferClass))
-
-/* So some words about GstMiniObject, this is pretty messy...
- GstMiniObject does not use the standard finalizing of GObjects, you are
- supposed to call gst_buffer_unref that's going to call gst_mini_objec_unref
- which will handle its own refcount system and call gst_mini_object_free.
- gst_mini_object_free will call the class finalize method which is not the
- one from GObject, after calling this finalize method it will free the object
- instance for you if the refcount is still 0 so you should not chain up */
-static void
-gst_ximage_buffer_finalize (GstXImageBuffer * ximage)
-{
- GstXImageSink *ximagesink = NULL;
- gboolean recycled = FALSE;
- gboolean running;
-
- g_return_if_fail (ximage != NULL);
-
- ximagesink = ximage->ximagesink;
- if (G_UNLIKELY (ximagesink == NULL)) {
- GST_WARNING_OBJECT (ximagesink, "no sink found");
- goto beach;
- }
-
- GST_OBJECT_LOCK (ximagesink);
- running = ximagesink->running;
- GST_OBJECT_UNLOCK (ximagesink);
-
- if (running == FALSE) {
- /* If the sink is shutting down, need to clear the image */
- GST_DEBUG_OBJECT (ximagesink,
- "destroy image %p because the sink is shutting down", ximage);
- gst_ximagesink_ximage_destroy (ximagesink, ximage);
- } else if ((ximage->width != GST_VIDEO_SINK_WIDTH (ximagesink)) ||
- (ximage->height != GST_VIDEO_SINK_HEIGHT (ximagesink))) {
- /* If our geometry changed we can't reuse that image. */
- GST_DEBUG_OBJECT (ximagesink,
- "destroy image %p as its size changed %dx%d vs current %dx%d",
- ximage, ximage->width, ximage->height,
- GST_VIDEO_SINK_WIDTH (ximagesink), GST_VIDEO_SINK_HEIGHT (ximagesink));
- gst_ximagesink_ximage_destroy (ximagesink, ximage);
- } else {
- /* In that case we can reuse the image and add it to our image pool. */
- GST_LOG_OBJECT (ximagesink, "recycling image %p in pool", ximage);
- /* need to increment the refcount again to recycle */
- gst_buffer_ref (GST_BUFFER_CAST (ximage));
- g_mutex_lock (ximagesink->pool_lock);
- ximagesink->buffer_pool = g_slist_prepend (ximagesink->buffer_pool, ximage);
- g_mutex_unlock (ximagesink->pool_lock);
- recycled = TRUE;
- }
-
- if (!recycled)
- GST_MINI_OBJECT_CLASS (ximage_buffer_parent_class)->finalize
- (GST_MINI_OBJECT (ximage));
-
-beach:
- return;
-}
-
-static void
-gst_ximage_buffer_free (GstXImageBuffer * ximage)
-{
- /* make sure it is not recycled */
- ximage->width = -1;
- ximage->height = -1;
- gst_buffer_unref (GST_BUFFER_CAST (ximage));
-}
-
-static void
-gst_ximage_buffer_init (GstXImageBuffer * ximage_buffer, gpointer g_class)
-{
-#ifdef HAVE_XSHM
- ximage_buffer->SHMInfo.shmaddr = ((void *) -1);
- ximage_buffer->SHMInfo.shmid = -1;
-#endif
-}
-
-static void
-gst_ximage_buffer_class_init (gpointer g_class, gpointer class_data)
-{
- GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
-
- ximage_buffer_parent_class = g_type_class_peek_parent (g_class);
-
- mini_object_class->finalize = (GstMiniObjectFinalizeFunction)
- gst_ximage_buffer_finalize;
-}
-
-static GType
-gst_ximage_buffer_get_type (void)
-{
- static GType _gst_ximage_buffer_type;
-
- if (G_UNLIKELY (_gst_ximage_buffer_type == 0)) {
- static const GTypeInfo ximage_buffer_info = {
- sizeof (GstBufferClass),
- NULL,
- NULL,
- gst_ximage_buffer_class_init,
- NULL,
- NULL,
- sizeof (GstXImageBuffer),
- 0,
- (GInstanceInitFunc) gst_ximage_buffer_init,
- NULL
- };
- _gst_ximage_buffer_type = g_type_register_static (GST_TYPE_BUFFER,
- "GstXImageBuffer", &ximage_buffer_info, 0);
- }
- return _gst_ximage_buffer_type;
-}
-
-/* X11 stuff */
-
-static gboolean error_caught = FALSE;
-
-static int
-gst_ximagesink_handle_xerror (Display * display, XErrorEvent * xevent)
-{
- char error_msg[1024];
-
- XGetErrorText (display, xevent->error_code, error_msg, 1024);
- GST_DEBUG ("ximagesink triggered an XError. error: %s", error_msg);
- error_caught = TRUE;
- return 0;
-}
-
-#ifdef HAVE_XSHM /* Check that XShm calls actually work */
-
-static gboolean
-gst_ximagesink_check_xshm_calls (GstXImageSink * ximagesink,
- GstXContext * xcontext)
-{
- XImage *ximage;
- XShmSegmentInfo SHMInfo;
- size_t size;
- int (*handler) (Display *, XErrorEvent *);
- gboolean result = FALSE;
- gboolean did_attach = FALSE;
-
- g_return_val_if_fail (xcontext != NULL, FALSE);
-
- /* Sync to ensure any older errors are already processed */
- XSync (xcontext->disp, FALSE);
-
- /* Set defaults so we don't free these later unnecessarily */
- SHMInfo.shmaddr = ((void *) -1);
- SHMInfo.shmid = -1;
-
- /* Setting an error handler to catch failure */
- error_caught = FALSE;
- handler = XSetErrorHandler (gst_ximagesink_handle_xerror);
-
- /* Trying to create a 1x1 ximage */
- GST_DEBUG ("XShmCreateImage of 1x1");
-
- ximage = XShmCreateImage (xcontext->disp, xcontext->visual,
- xcontext->depth, ZPixmap, NULL, &SHMInfo, 1, 1);
-
- /* Might cause an error, sync to ensure it is noticed */
- XSync (xcontext->disp, FALSE);
- if (!ximage || error_caught) {
- GST_WARNING ("could not XShmCreateImage a 1x1 image");
- goto beach;
- }
- size = ximage->height * ximage->bytes_per_line;
-
- SHMInfo.shmid = shmget (IPC_PRIVATE, size, IPC_CREAT | 0777);
- if (SHMInfo.shmid == -1) {
- GST_WARNING ("could not get shared memory of %" G_GSIZE_FORMAT " bytes",
- size);
- goto beach;
- }
-
- SHMInfo.shmaddr = shmat (SHMInfo.shmid, NULL, 0);
- if (SHMInfo.shmaddr == ((void *) -1)) {
- GST_WARNING ("Failed to shmat: %s", g_strerror (errno));
- /* Clean up shm seg */
- shmctl (SHMInfo.shmid, IPC_RMID, NULL);
- goto beach;
- }
-
- ximage->data = SHMInfo.shmaddr;
- SHMInfo.readOnly = FALSE;
-
- if (XShmAttach (xcontext->disp, &SHMInfo) == 0) {
- GST_WARNING ("Failed to XShmAttach");
- /* Clean up shm seg */
- shmctl (SHMInfo.shmid, IPC_RMID, NULL);
- goto beach;
- }
-
- /* Sync to ensure we see any errors we caused */
- XSync (xcontext->disp, FALSE);
-
- /* Delete the shared memory segment as soon as everyone is attached.
- * This way, it will be deleted as soon as we detach later, and not
- * leaked if we crash. */
- shmctl (SHMInfo.shmid, IPC_RMID, NULL);
-
- if (!error_caught) {
- did_attach = TRUE;
- /* store whether we succeeded in result */
- result = TRUE;
- }
-
-beach:
- /* Sync to ensure we swallow any errors we caused and reset error_caught */
- XSync (xcontext->disp, FALSE);
- error_caught = FALSE;
- XSetErrorHandler (handler);
-
- if (did_attach) {
- XShmDetach (xcontext->disp, &SHMInfo);
- XSync (xcontext->disp, FALSE);
- }
- if (SHMInfo.shmaddr != ((void *) -1))
- shmdt (SHMInfo.shmaddr);
- if (ximage)
- XDestroyImage (ximage);
- return result;
-}
-#endif /* HAVE_XSHM */
-
-/* This function handles GstXImageBuffer creation depending on XShm availability */
-static GstXImageBuffer *
-gst_ximagesink_ximage_new (GstXImageSink * ximagesink, GstCaps * caps)
-{
- GstXImageBuffer *ximage = NULL;
- GstStructure *structure = NULL;
- gboolean succeeded = FALSE;
- int (*handler) (Display *, XErrorEvent *);
-
- g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), NULL);
-
- ximage = (GstXImageBuffer *) gst_mini_object_new (GST_TYPE_XIMAGE_BUFFER);
-
- structure = gst_caps_get_structure (caps, 0);
-
- if (!gst_structure_get_int (structure, "width", &ximage->width) ||
- !gst_structure_get_int (structure, "height", &ximage->height)) {
- GST_WARNING ("failed getting geometry from caps %" GST_PTR_FORMAT, caps);
- }
-
- GST_DEBUG_OBJECT (ximagesink, "creating image %p (%dx%d)", ximage,
- ximage->width, ximage->height);
-
- g_mutex_lock (ximagesink->x_lock);
-
- /* Setting an error handler to catch failure */
- error_caught = FALSE;
- handler = XSetErrorHandler (gst_ximagesink_handle_xerror);
-
-#ifdef HAVE_XSHM
- if (ximagesink->xcontext->use_xshm) {
- ximage->ximage = XShmCreateImage (ximagesink->xcontext->disp,
- ximagesink->xcontext->visual,
- ximagesink->xcontext->depth,
- ZPixmap, NULL, &ximage->SHMInfo, ximage->width, ximage->height);
- if (!ximage->ximage || error_caught) {
- g_mutex_unlock (ximagesink->x_lock);
- /* Reset error handler */
- error_caught = FALSE;
- XSetErrorHandler (handler);
- /* Push an error */
- GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
- ("Failed to create output image buffer of %dx%d pixels",
- ximage->width, ximage->height),
- ("could not XShmCreateImage a %dx%d image",
- ximage->width, ximage->height));
- goto beach;
- }
-
- /* we have to use the returned bytes_per_line for our shm size */
- ximage->size = ximage->ximage->bytes_per_line * ximage->ximage->height;
- GST_LOG_OBJECT (ximagesink,
- "XShm image size is %" G_GSIZE_FORMAT ", width %d, stride %d",
- ximage->size, ximage->width, ximage->ximage->bytes_per_line);
-
- ximage->SHMInfo.shmid = shmget (IPC_PRIVATE, ximage->size,
- IPC_CREAT | 0777);
- if (ximage->SHMInfo.shmid == -1) {
- g_mutex_unlock (ximagesink->x_lock);
- GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
- ("Failed to create output image buffer of %dx%d pixels",
- ximage->width, ximage->height),
- ("could not get shared memory of %" G_GSIZE_FORMAT " bytes",
- ximage->size));
- goto beach;
- }
-
- ximage->SHMInfo.shmaddr = shmat (ximage->SHMInfo.shmid, NULL, 0);
- if (ximage->SHMInfo.shmaddr == ((void *) -1)) {
- g_mutex_unlock (ximagesink->x_lock);
- GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
- ("Failed to create output image buffer of %dx%d pixels",
- ximage->width, ximage->height),
- ("Failed to shmat: %s", g_strerror (errno)));
- /* Clean up the shared memory segment */
- shmctl (ximage->SHMInfo.shmid, IPC_RMID, NULL);
- goto beach;
- }
-
- ximage->ximage->data = ximage->SHMInfo.shmaddr;
- ximage->SHMInfo.readOnly = FALSE;
-
- if (XShmAttach (ximagesink->xcontext->disp, &ximage->SHMInfo) == 0) {
- /* Clean up shm seg */
- shmctl (ximage->SHMInfo.shmid, IPC_RMID, NULL);
-
- g_mutex_unlock (ximagesink->x_lock);
- GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
- ("Failed to create output image buffer of %dx%d pixels",
- ximage->width, ximage->height), ("Failed to XShmAttach"));
- goto beach;
- }
-
- XSync (ximagesink->xcontext->disp, FALSE);
-
- /* Now that everyone has attached, we can delete the shared memory segment.
- * This way, it will be deleted as soon as we detach later, and not
- * leaked if we crash. */
- shmctl (ximage->SHMInfo.shmid, IPC_RMID, NULL);
-
- } else
-#endif /* HAVE_XSHM */
- {
- guint allocsize;
-
- ximage->ximage = XCreateImage (ximagesink->xcontext->disp,
- ximagesink->xcontext->visual,
- ximagesink->xcontext->depth,
- ZPixmap, 0, NULL,
- ximage->width, ximage->height, ximagesink->xcontext->bpp, 0);
- if (!ximage->ximage || error_caught) {
- g_mutex_unlock (ximagesink->x_lock);
- /* Reset error handler */
- error_caught = FALSE;
- XSetErrorHandler (handler);
- /* Push an error */
- GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
- ("Failed to create output image buffer of %dx%d pixels",
- ximage->width, ximage->height),
- ("could not XCreateImage a %dx%d image",
- ximage->width, ximage->height));
- goto beach;
- }
-
- /* upstream will assume that rowstrides are multiples of 4, but this
- * doesn't always seem to be the case with XCreateImage() */
- if ((ximage->ximage->bytes_per_line % 4) != 0) {
- GST_WARNING_OBJECT (ximagesink, "returned stride not a multiple of 4 as "
- "usually assumed");
- }
-
- /* we have to use the returned bytes_per_line for our image size */
- ximage->size = ximage->ximage->bytes_per_line * ximage->ximage->height;
-
- /* alloc a bit more for unexpected strides to avoid crashes upstream.
- * FIXME: if we get an unrounded stride, the image will be displayed
- * distorted, since all upstream elements assume a rounded stride */
- allocsize =
- GST_ROUND_UP_4 (ximage->ximage->bytes_per_line) *
- ximage->ximage->height;
- ximage->ximage->data = g_malloc (allocsize);
- GST_LOG_OBJECT (ximagesink,
- "non-XShm image size is %" G_GSIZE_FORMAT " (alloced: %u), width %d, "
- "stride %d", ximage->size, allocsize, ximage->width,
- ximage->ximage->bytes_per_line);
-
- XSync (ximagesink->xcontext->disp, FALSE);
- }
-
- /* Reset error handler */
- error_caught = FALSE;
- XSetErrorHandler (handler);
-
- succeeded = TRUE;
-
- GST_BUFFER_DATA (ximage) = (guchar *) ximage->ximage->data;
- GST_BUFFER_SIZE (ximage) = ximage->size;
-
- /* Keep a ref to our sink */
- ximage->ximagesink = gst_object_ref (ximagesink);
-
- g_mutex_unlock (ximagesink->x_lock);
-beach:
- if (!succeeded) {
- gst_ximage_buffer_free (ximage);
- ximage = NULL;
- }
-
- return ximage;
-}
-
-/* This function destroys a GstXImageBuffer handling XShm availability */
-static void
-gst_ximagesink_ximage_destroy (GstXImageSink * ximagesink,
- GstXImageBuffer * ximage)
-{
- g_return_if_fail (ximage != NULL);
- g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
-
- /* Hold the object lock to ensure the XContext doesn't disappear */
- GST_OBJECT_LOCK (ximagesink);
-
- /* If the destroyed image is the current one we destroy our reference too */
- if (ximagesink->cur_image == ximage) {
- ximagesink->cur_image = NULL;
- }
-
- /* We might have some buffers destroyed after changing state to NULL */
- if (!ximagesink->xcontext) {
- GST_DEBUG_OBJECT (ximagesink, "Destroying XImage after XContext");
-#ifdef HAVE_XSHM
- if (ximage->SHMInfo.shmaddr != ((void *) -1)) {
- shmdt (ximage->SHMInfo.shmaddr);
- }
-#endif
- goto beach;
- }
-
- g_mutex_lock (ximagesink->x_lock);
-
-#ifdef HAVE_XSHM
- if (ximagesink->xcontext->use_xshm) {
- if (ximage->SHMInfo.shmaddr != ((void *) -1)) {
- XShmDetach (ximagesink->xcontext->disp, &ximage->SHMInfo);
- XSync (ximagesink->xcontext->disp, 0);
- shmdt (ximage->SHMInfo.shmaddr);
- }
- if (ximage->ximage)
- XDestroyImage (ximage->ximage);
-
- } else
-#endif /* HAVE_XSHM */
- {
- if (ximage->ximage) {
- XDestroyImage (ximage->ximage);
- }
- }
-
- XSync (ximagesink->xcontext->disp, FALSE);
-
- g_mutex_unlock (ximagesink->x_lock);
-
-beach:
- GST_OBJECT_UNLOCK (ximagesink);
-
- if (ximage->ximagesink) {
- /* Release the ref to our sink */
- ximage->ximagesink = NULL;
- gst_object_unref (ximagesink);
- }
-
- return;
-}
-
-/* We are called with the x_lock taken */
-static void
-gst_ximagesink_xwindow_draw_borders (GstXImageSink * ximagesink,
- GstXWindow * xwindow, GstVideoRectangle rect)
-{
- g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
- g_return_if_fail (xwindow != NULL);
-
- XSetForeground (ximagesink->xcontext->disp, xwindow->gc,
- ximagesink->xcontext->black);
-
- /* Left border */
- if (rect.x > 0) {
- XFillRectangle (ximagesink->xcontext->disp, xwindow->win, xwindow->gc,
- 0, 0, rect.x, xwindow->height);
- }
-
- /* Right border */
- if ((rect.x + rect.w) < xwindow->width) {
- XFillRectangle (ximagesink->xcontext->disp, xwindow->win, xwindow->gc,
- rect.x + rect.w, 0, xwindow->width, xwindow->height);
- }
-
- /* Top border */
- if (rect.y > 0) {
- XFillRectangle (ximagesink->xcontext->disp, xwindow->win, xwindow->gc,
- 0, 0, xwindow->width, rect.y);
- }
-
- /* Bottom border */
- if ((rect.y + rect.h) < xwindow->height) {
- XFillRectangle (ximagesink->xcontext->disp, xwindow->win, xwindow->gc,
- 0, rect.y + rect.h, xwindow->width, xwindow->height);
- }
-}
-
-/* This function puts a GstXImageBuffer on a GstXImageSink's window */
-static gboolean
-gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImageBuffer * ximage)
-{
- GstVideoRectangle src, dst, result;
- gboolean draw_border = FALSE;
-
- g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), FALSE);
-
- /* We take the flow_lock. If expose is in there we don't want to run
- concurrently from the data flow thread */
- g_mutex_lock (ximagesink->flow_lock);
-
- if (G_UNLIKELY (ximagesink->xwindow == NULL)) {
- g_mutex_unlock (ximagesink->flow_lock);
- return FALSE;
- }
-
- /* Draw borders when displaying the first frame. After this
- draw borders only on expose event or caps change (ximagesink->draw_border = TRUE). */
- if (!ximagesink->cur_image || ximagesink->draw_border) {
- draw_border = TRUE;
- }
-
- /* Store a reference to the last image we put, lose the previous one */
- if (ximage && ximagesink->cur_image != ximage) {
- if (ximagesink->cur_image) {
- GST_LOG_OBJECT (ximagesink, "unreffing %p", ximagesink->cur_image);
- gst_buffer_unref (GST_BUFFER_CAST (ximagesink->cur_image));
- }
- GST_LOG_OBJECT (ximagesink, "reffing %p as our current image", ximage);
- ximagesink->cur_image =
- GST_XIMAGE_BUFFER (gst_buffer_ref (GST_BUFFER_CAST (ximage)));
- }
-
- /* Expose sends a NULL image, we take the latest frame */
- if (!ximage) {
- draw_border = TRUE;
- if (ximagesink->cur_image) {
- ximage = ximagesink->cur_image;
- } else {
- g_mutex_unlock (ximagesink->flow_lock);
- return TRUE;
- }
- }
-
- gst_ximagesink_xwindow_update_geometry (ximagesink, ximagesink->xwindow);
-
- src.w = ximage->width;
- src.h = ximage->height;
- dst.w = ximagesink->xwindow->width;
- dst.h = ximagesink->xwindow->height;
-
- gst_video_sink_center_rect (src, dst, &result, FALSE);
-
- g_mutex_lock (ximagesink->x_lock);
-
- if (draw_border) {
- gst_ximagesink_xwindow_draw_borders (ximagesink, ximagesink->xwindow,
- result);
- ximagesink->draw_border = FALSE;
- }
-#ifdef HAVE_XSHM
- if (ximagesink->xcontext->use_xshm) {
- GST_LOG_OBJECT (ximagesink,
- "XShmPutImage on %p, src: %d, %d - dest: %d, %d, dim: %dx%d, win %dx%d",
- ximage, 0, 0, result.x, result.y, result.w, result.h,
- ximagesink->xwindow->width, ximagesink->xwindow->height);
- XShmPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win,
- ximagesink->xwindow->gc, ximage->ximage, 0, 0, result.x, result.y,
- result.w, result.h, FALSE);
- } else
-#endif /* HAVE_XSHM */
- {
- GST_LOG_OBJECT (ximagesink,
- "XPutImage on %p, src: %d, %d - dest: %d, %d, dim: %dx%d, win %dx%d",
- ximage, 0, 0, result.x, result.y, result.w, result.h,
- ximagesink->xwindow->width, ximagesink->xwindow->height);
- XPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win,
- ximagesink->xwindow->gc, ximage->ximage, 0, 0, result.x, result.y,
- result.w, result.h);
- }
-
- XSync (ximagesink->xcontext->disp, FALSE);
-
- g_mutex_unlock (ximagesink->x_lock);
-
- g_mutex_unlock (ximagesink->flow_lock);
-
- return TRUE;
-}
-
-static gboolean
-gst_ximagesink_xwindow_decorate (GstXImageSink * ximagesink,
- GstXWindow * window)
-{
- Atom hints_atom = None;
- MotifWmHints *hints;
-
- g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), FALSE);
- g_return_val_if_fail (window != NULL, FALSE);
-
- g_mutex_lock (ximagesink->x_lock);
-
- hints_atom = XInternAtom (ximagesink->xcontext->disp, "_MOTIF_WM_HINTS", 1);
- if (hints_atom == None) {
- g_mutex_unlock (ximagesink->x_lock);
- return FALSE;
- }
-
- hints = g_malloc0 (sizeof (MotifWmHints));
-
- hints->flags |= MWM_HINTS_DECORATIONS;
- hints->decorations = 1 << 0;
-
- XChangeProperty (ximagesink->xcontext->disp, window->win,
- hints_atom, hints_atom, 32, PropModeReplace,
- (guchar *) hints, sizeof (MotifWmHints) / sizeof (long));
-
- XSync (ximagesink->xcontext->disp, FALSE);
-
- g_mutex_unlock (ximagesink->x_lock);
-
- g_free (hints);
-
- return TRUE;
-}
-
-static void
-gst_ximagesink_xwindow_set_title (GstXImageSink * ximagesink,
- GstXWindow * xwindow, const gchar * media_title)
-{
- if (media_title) {
- g_free (ximagesink->media_title);
- ximagesink->media_title = g_strdup (media_title);
- }
- if (xwindow) {
- /* we have a window */
- if (xwindow->internal) {
- XTextProperty xproperty;
- const gchar *app_name;
- const gchar *title = NULL;
- gchar *title_mem = NULL;
-
- /* set application name as a title */
- app_name = g_get_application_name ();
-
- if (app_name && ximagesink->media_title) {
- title = title_mem = g_strconcat (ximagesink->media_title, " : ",
- app_name, NULL);
- } else if (app_name) {
- title = app_name;
- } else if (ximagesink->media_title) {
- title = ximagesink->media_title;
- }
-
- if (title) {
- if ((XStringListToTextProperty (((char **) &title), 1,
- &xproperty)) != 0) {
- XSetWMName (ximagesink->xcontext->disp, xwindow->win, &xproperty);
- XFree (xproperty.value);
- }
-
- g_free (title_mem);
- }
- }
- }
-}
-
-/* This function handles a GstXWindow creation */
-static GstXWindow *
-gst_ximagesink_xwindow_new (GstXImageSink * ximagesink, gint width, gint height)
-{
- GstXWindow *xwindow = NULL;
- XGCValues values;
-
- g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), NULL);
-
- xwindow = g_new0 (GstXWindow, 1);
-
- xwindow->width = width;
- xwindow->height = height;
- xwindow->internal = TRUE;
-
- g_mutex_lock (ximagesink->x_lock);
-
- xwindow->win = XCreateSimpleWindow (ximagesink->xcontext->disp,
- ximagesink->xcontext->root,
- 0, 0, xwindow->width, xwindow->height, 0, 0, ximagesink->xcontext->black);
-
- /* We have to do that to prevent X from redrawing the background on
- ConfigureNotify. This takes away flickering of video when resizing. */
- XSetWindowBackgroundPixmap (ximagesink->xcontext->disp, xwindow->win, None);
-
- /* set application name as a title */
- gst_ximagesink_xwindow_set_title (ximagesink, xwindow, NULL);
-
- if (ximagesink->handle_events) {
- Atom wm_delete;
-
- XSelectInput (ximagesink->xcontext->disp, xwindow->win, ExposureMask |
- StructureNotifyMask | PointerMotionMask | KeyPressMask |
- KeyReleaseMask | ButtonPressMask | ButtonReleaseMask);
-
- /* Tell the window manager we'd like delete client messages instead of
- * being killed */
- wm_delete = XInternAtom (ximagesink->xcontext->disp,
- "WM_DELETE_WINDOW", False);
- (void) XSetWMProtocols (ximagesink->xcontext->disp, xwindow->win,
- &wm_delete, 1);
- }
-
- xwindow->gc = XCreateGC (ximagesink->xcontext->disp, xwindow->win,
- 0, &values);
-
- XMapRaised (ximagesink->xcontext->disp, xwindow->win);
-
- XSync (ximagesink->xcontext->disp, FALSE);
-
- g_mutex_unlock (ximagesink->x_lock);
-
- gst_ximagesink_xwindow_decorate (ximagesink, xwindow);
-
- gst_x_overlay_got_xwindow_id (GST_X_OVERLAY (ximagesink), xwindow->win);
-
- return xwindow;
-}
-
-/* This function destroys a GstXWindow */
-static void
-gst_ximagesink_xwindow_destroy (GstXImageSink * ximagesink,
- GstXWindow * xwindow)
-{
- g_return_if_fail (xwindow != NULL);
- g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
-
- g_mutex_lock (ximagesink->x_lock);
-
- /* If we did not create that window we just free the GC and let it live */
- if (xwindow->internal)
- XDestroyWindow (ximagesink->xcontext->disp, xwindow->win);
- else
- XSelectInput (ximagesink->xcontext->disp, xwindow->win, 0);
-
- XFreeGC (ximagesink->xcontext->disp, xwindow->gc);
-
- XSync (ximagesink->xcontext->disp, FALSE);
-
- g_mutex_unlock (ximagesink->x_lock);
-
- g_free (xwindow);
-}
-
-static void
-gst_ximagesink_xwindow_update_geometry (GstXImageSink * ximagesink,
- GstXWindow * xwindow)
-{
- XWindowAttributes attr;
-
- g_return_if_fail (xwindow != NULL);
- g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
-
- /* Update the window geometry */
- g_mutex_lock (ximagesink->x_lock);
-
- XGetWindowAttributes (ximagesink->xcontext->disp,
- ximagesink->xwindow->win, &attr);
-
- ximagesink->xwindow->width = attr.width;
- ximagesink->xwindow->height = attr.height;
-
- g_mutex_unlock (ximagesink->x_lock);
-}
-
-static void
-gst_ximagesink_xwindow_clear (GstXImageSink * ximagesink, GstXWindow * xwindow)
-{
- g_return_if_fail (xwindow != NULL);
- g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
-
- g_mutex_lock (ximagesink->x_lock);
-
- XSetForeground (ximagesink->xcontext->disp, xwindow->gc,
- ximagesink->xcontext->black);
-
- XFillRectangle (ximagesink->xcontext->disp, xwindow->win, xwindow->gc,
- 0, 0, xwindow->width, xwindow->height);
-
- XSync (ximagesink->xcontext->disp, FALSE);
-
- g_mutex_unlock (ximagesink->x_lock);
-}
-
-/* This function handles XEvents that might be in the queue. It generates
- GstEvent that will be sent upstream in the pipeline to handle interactivity
- and navigation.*/
-static void
-gst_ximagesink_handle_xevents (GstXImageSink * ximagesink)
-{
- XEvent e;
- guint pointer_x = 0, pointer_y = 0;
- gboolean pointer_moved = FALSE;
- gboolean exposed = FALSE, configured = FALSE;
-
- g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
-
- /* Then we get all pointer motion events, only the last position is
- interesting. */
- g_mutex_lock (ximagesink->flow_lock);
- g_mutex_lock (ximagesink->x_lock);
- while (XCheckWindowEvent (ximagesink->xcontext->disp,
- ximagesink->xwindow->win, PointerMotionMask, &e)) {
- g_mutex_unlock (ximagesink->x_lock);
- g_mutex_unlock (ximagesink->flow_lock);
-
- switch (e.type) {
- case MotionNotify:
- pointer_x = e.xmotion.x;
- pointer_y = e.xmotion.y;
- pointer_moved = TRUE;
- break;
- default:
- break;
- }
- g_mutex_lock (ximagesink->flow_lock);
- g_mutex_lock (ximagesink->x_lock);
- }
-
- if (pointer_moved) {
- g_mutex_unlock (ximagesink->x_lock);
- g_mutex_unlock (ximagesink->flow_lock);
-
- GST_DEBUG ("ximagesink pointer moved over window at %d,%d",
- pointer_x, pointer_y);
- gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink),
- "mouse-move", 0, pointer_x, pointer_y);
-
- g_mutex_lock (ximagesink->flow_lock);
- g_mutex_lock (ximagesink->x_lock);
- }
-
- /* We get all remaining events on our window to throw them upstream */
- while (XCheckWindowEvent (ximagesink->xcontext->disp,
- ximagesink->xwindow->win,
- KeyPressMask | KeyReleaseMask |
- ButtonPressMask | ButtonReleaseMask, &e)) {
- KeySym keysym;
-
- /* We lock only for the X function call */
- g_mutex_unlock (ximagesink->x_lock);
- g_mutex_unlock (ximagesink->flow_lock);
-
- switch (e.type) {
- case ButtonPress:
- /* Mouse button pressed/released over our window. We send upstream
- events for interactivity/navigation */
- GST_DEBUG ("ximagesink button %d pressed over window at %d,%d",
- e.xbutton.button, e.xbutton.x, e.xbutton.x);
- gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink),
- "mouse-button-press", e.xbutton.button, e.xbutton.x, e.xbutton.y);
- break;
- case ButtonRelease:
- GST_DEBUG ("ximagesink button %d release over window at %d,%d",
- e.xbutton.button, e.xbutton.x, e.xbutton.x);
- gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink),
- "mouse-button-release", e.xbutton.button, e.xbutton.x, e.xbutton.y);
- break;
- case KeyPress:
- case KeyRelease:
- /* Key pressed/released over our window. We send upstream
- events for interactivity/navigation */
- GST_DEBUG ("ximagesink key %d pressed over window at %d,%d",
- e.xkey.keycode, e.xkey.x, e.xkey.x);
- g_mutex_lock (ximagesink->x_lock);
- keysym = XKeycodeToKeysym (ximagesink->xcontext->disp,
- e.xkey.keycode, 0);
- g_mutex_unlock (ximagesink->x_lock);
- if (keysym != NoSymbol) {
- char *key_str = NULL;
-
- g_mutex_lock (ximagesink->x_lock);
- key_str = XKeysymToString (keysym);
- g_mutex_unlock (ximagesink->x_lock);
- gst_navigation_send_key_event (GST_NAVIGATION (ximagesink),
- e.type == KeyPress ? "key-press" : "key-release", key_str);
-
- } else {
- gst_navigation_send_key_event (GST_NAVIGATION (ximagesink),
- e.type == KeyPress ? "key-press" : "key-release", "unknown");
- }
- break;
- default:
- GST_DEBUG_OBJECT (ximagesink, "ximagesink unhandled X event (%d)",
- e.type);
- }
- g_mutex_lock (ximagesink->flow_lock);
- g_mutex_lock (ximagesink->x_lock);
- }
-
- while (XCheckWindowEvent (ximagesink->xcontext->disp,
- ximagesink->xwindow->win, ExposureMask | StructureNotifyMask, &e)) {
- switch (e.type) {
- case Expose:
- exposed = TRUE;
- break;
- case ConfigureNotify:
- configured = TRUE;
- break;
- default:
- break;
- }
- }
-
- if (ximagesink->handle_expose && (exposed || configured)) {
- g_mutex_unlock (ximagesink->x_lock);
- g_mutex_unlock (ximagesink->flow_lock);
-
- gst_ximagesink_expose (GST_X_OVERLAY (ximagesink));
-
- g_mutex_lock (ximagesink->flow_lock);
- g_mutex_lock (ximagesink->x_lock);
- }
-
- /* Handle Display events */
- while (XPending (ximagesink->xcontext->disp)) {
- XNextEvent (ximagesink->xcontext->disp, &e);
-
- switch (e.type) {
- case ClientMessage:{
- Atom wm_delete;
-
- wm_delete = XInternAtom (ximagesink->xcontext->disp,
- "WM_DELETE_WINDOW", False);
- if (wm_delete == (Atom) e.xclient.data.l[0]) {
- /* Handle window deletion by posting an error on the bus */
- GST_ELEMENT_ERROR (ximagesink, RESOURCE, NOT_FOUND,
- ("Output window was closed"), (NULL));
-
- g_mutex_unlock (ximagesink->x_lock);
- gst_ximagesink_xwindow_destroy (ximagesink, ximagesink->xwindow);
- ximagesink->xwindow = NULL;
- g_mutex_lock (ximagesink->x_lock);
- }
- break;
- }
- default:
- break;
- }
- }
-
- g_mutex_unlock (ximagesink->x_lock);
- g_mutex_unlock (ximagesink->flow_lock);
-}
-
-static gpointer
-gst_ximagesink_event_thread (GstXImageSink * ximagesink)
-{
- g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), NULL);
-
- GST_OBJECT_LOCK (ximagesink);
- while (ximagesink->running) {
- GST_OBJECT_UNLOCK (ximagesink);
-
- if (ximagesink->xwindow) {
- gst_ximagesink_handle_xevents (ximagesink);
- }
- /* FIXME: do we want to align this with the framerate or anything else? */
- g_usleep (G_USEC_PER_SEC / 20);
-
- GST_OBJECT_LOCK (ximagesink);
- }
- GST_OBJECT_UNLOCK (ximagesink);
-
- return NULL;
-}
-
-static void
-gst_ximagesink_manage_event_thread (GstXImageSink * ximagesink)
-{
- GThread *thread = NULL;
-
- /* don't start the thread too early */
- if (ximagesink->xcontext == NULL) {
- return;
- }
-
- GST_OBJECT_LOCK (ximagesink);
- if (ximagesink->handle_expose || ximagesink->handle_events) {
- if (!ximagesink->event_thread) {
- /* Setup our event listening thread */
- GST_DEBUG_OBJECT (ximagesink, "run xevent thread, expose %d, events %d",
- ximagesink->handle_expose, ximagesink->handle_events);
- ximagesink->running = TRUE;
- ximagesink->event_thread = g_thread_create (
- (GThreadFunc) gst_ximagesink_event_thread, ximagesink, TRUE, NULL);
- }
- } else {
- if (ximagesink->event_thread) {
- GST_DEBUG_OBJECT (ximagesink, "stop xevent thread, expose %d, events %d",
- ximagesink->handle_expose, ximagesink->handle_events);
- ximagesink->running = FALSE;
- /* grab thread and mark it as NULL */
- thread = ximagesink->event_thread;
- ximagesink->event_thread = NULL;
- }
- }
- GST_OBJECT_UNLOCK (ximagesink);
-
- /* Wait for our event thread to finish */
- if (thread)
- g_thread_join (thread);
-
-}
-
-
-/* This function calculates the pixel aspect ratio based on the properties
- * in the xcontext structure and stores it there. */
-static void
-gst_ximagesink_calculate_pixel_aspect_ratio (GstXContext * xcontext)
-{
- static const gint par[][2] = {
- {1, 1}, /* regular screen */
- {16, 15}, /* PAL TV */
- {11, 10}, /* 525 line Rec.601 video */
- {54, 59}, /* 625 line Rec.601 video */
- {64, 45}, /* 1280x1024 on 16:9 display */
- {5, 3}, /* 1280x1024 on 4:3 display */
- {4, 3} /* 800x600 on 16:9 display */
- };
- gint i;
- gint index;
- gdouble ratio;
- gdouble delta;
-
-#define DELTA(idx) (ABS (ratio - ((gdouble) par[idx][0] / par[idx][1])))
-
- /* first calculate the "real" ratio based on the X values;
- * which is the "physical" w/h divided by the w/h in pixels of the display */
- ratio = (gdouble) (xcontext->widthmm * xcontext->height)
- / (xcontext->heightmm * xcontext->width);
-
- /* DirectFB's X in 720x576 reports the physical dimensions wrong, so
- * override here */
- if (xcontext->width == 720 && xcontext->height == 576) {
- ratio = 4.0 * 576 / (3.0 * 720);
- }
- GST_DEBUG ("calculated pixel aspect ratio: %f", ratio);
-
- /* now find the one from par[][2] with the lowest delta to the real one */
- delta = DELTA (0);
- index = 0;
-
- for (i = 1; i < sizeof (par) / (sizeof (gint) * 2); ++i) {
- gdouble this_delta = DELTA (i);
-
- if (this_delta < delta) {
- index = i;
- delta = this_delta;
- }
- }
-
- GST_DEBUG ("Decided on index %d (%d/%d)", index,
- par[index][0], par[index][1]);
-
- g_free (xcontext->par);
- xcontext->par = g_new0 (GValue, 1);
- g_value_init (xcontext->par, GST_TYPE_FRACTION);
- gst_value_set_fraction (xcontext->par, par[index][0], par[index][1]);
- GST_DEBUG ("set xcontext PAR to %d/%d",
- gst_value_get_fraction_numerator (xcontext->par),
- gst_value_get_fraction_denominator (xcontext->par));
-}
-
-/* This function gets the X Display and global info about it. Everything is
- stored in our object and will be cleaned when the object is disposed. Note
- here that caps for supported format are generated without any window or
- image creation */
-static GstXContext *
-gst_ximagesink_xcontext_get (GstXImageSink * ximagesink)
-{
- GstXContext *xcontext = NULL;
- XPixmapFormatValues *px_formats = NULL;
- gint nb_formats = 0, i;
-
- g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), NULL);
-
- xcontext = g_new0 (GstXContext, 1);
-
- g_mutex_lock (ximagesink->x_lock);
-
- xcontext->disp = XOpenDisplay (ximagesink->display_name);
-
- if (!xcontext->disp) {
- g_mutex_unlock (ximagesink->x_lock);
- g_free (xcontext);
- GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
- ("Could not initialise X output"), ("Could not open display"));
- return NULL;
- }
-
- xcontext->screen = DefaultScreenOfDisplay (xcontext->disp);
- xcontext->screen_num = DefaultScreen (xcontext->disp);
- xcontext->visual = DefaultVisual (xcontext->disp, xcontext->screen_num);
- xcontext->root = DefaultRootWindow (xcontext->disp);
- xcontext->white = XWhitePixel (xcontext->disp, xcontext->screen_num);
- xcontext->black = XBlackPixel (xcontext->disp, xcontext->screen_num);
- xcontext->depth = DefaultDepthOfScreen (xcontext->screen);
-
- xcontext->width = DisplayWidth (xcontext->disp, xcontext->screen_num);
- xcontext->height = DisplayHeight (xcontext->disp, xcontext->screen_num);
- xcontext->widthmm = DisplayWidthMM (xcontext->disp, xcontext->screen_num);
- xcontext->heightmm = DisplayHeightMM (xcontext->disp, xcontext->screen_num);
-
- GST_DEBUG_OBJECT (ximagesink, "X reports %dx%d pixels and %d mm x %d mm",
- xcontext->width, xcontext->height, xcontext->widthmm, xcontext->heightmm);
-
- gst_ximagesink_calculate_pixel_aspect_ratio (xcontext);
-
- /* We get supported pixmap formats at supported depth */
- px_formats = XListPixmapFormats (xcontext->disp, &nb_formats);
-
- if (!px_formats) {
- XCloseDisplay (xcontext->disp);
- g_mutex_unlock (ximagesink->x_lock);
- g_free (xcontext->par);
- g_free (xcontext);
- return NULL;
- }
-
- /* We get bpp value corresponding to our running depth */
- for (i = 0; i < nb_formats; i++) {
- if (px_formats[i].depth == xcontext->depth)
- xcontext->bpp = px_formats[i].bits_per_pixel;
- }
-
- XFree (px_formats);
-
- xcontext->endianness =
- (ImageByteOrder (xcontext->disp) ==
- LSBFirst) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
-
- /* Search for XShm extension support */
-#ifdef HAVE_XSHM
- if (XShmQueryExtension (xcontext->disp) &&
- gst_ximagesink_check_xshm_calls (ximagesink, xcontext)) {
- xcontext->use_xshm = TRUE;
- GST_DEBUG ("ximagesink is using XShm extension");
- } else
-#endif
- {
- xcontext->use_xshm = FALSE;
- GST_DEBUG ("ximagesink is not using XShm extension");
- }
-
- /* our caps system handles 24/32bpp RGB as big-endian. */
- if ((xcontext->bpp == 24 || xcontext->bpp == 32) &&
- xcontext->endianness == G_LITTLE_ENDIAN) {
- xcontext->endianness = G_BIG_ENDIAN;
- xcontext->visual->red_mask = GUINT32_TO_BE (xcontext->visual->red_mask);
- xcontext->visual->green_mask = GUINT32_TO_BE (xcontext->visual->green_mask);
- xcontext->visual->blue_mask = GUINT32_TO_BE (xcontext->visual->blue_mask);
- if (xcontext->bpp == 24) {
- xcontext->visual->red_mask >>= 8;
- xcontext->visual->green_mask >>= 8;
- xcontext->visual->blue_mask >>= 8;
- }
- }
-
- /* update object's par with calculated one if not set yet */
- if (!ximagesink->par) {
- ximagesink->par = g_new0 (GValue, 1);
- gst_value_init_and_copy (ximagesink->par, xcontext->par);
- GST_DEBUG_OBJECT (ximagesink, "set calculated PAR on object's PAR");
- }
- xcontext->caps = gst_caps_new_simple ("video/x-raw-rgb",
- "bpp", G_TYPE_INT, xcontext->bpp,
- "depth", G_TYPE_INT, xcontext->depth,
- "endianness", G_TYPE_INT, xcontext->endianness,
- "red_mask", G_TYPE_INT, xcontext->visual->red_mask,
- "green_mask", G_TYPE_INT, xcontext->visual->green_mask,
- "blue_mask", G_TYPE_INT, xcontext->visual->blue_mask,
- "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
- "height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
- "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
- if (ximagesink->par) {
- int nom, den;
-
- nom = gst_value_get_fraction_numerator (ximagesink->par);
- den = gst_value_get_fraction_denominator (ximagesink->par);
- gst_caps_set_simple (xcontext->caps, "pixel-aspect-ratio",
- GST_TYPE_FRACTION, nom, den, NULL);
- }
-
- g_mutex_unlock (ximagesink->x_lock);
-
- return xcontext;
-}
-
-/* This function cleans the X context. Closing the Display and unrefing the
- caps for supported formats. */
-static void
-gst_ximagesink_xcontext_clear (GstXImageSink * ximagesink)
-{
- GstXContext *xcontext;
-
- g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
-
- GST_OBJECT_LOCK (ximagesink);
- if (ximagesink->xcontext == NULL) {
- GST_OBJECT_UNLOCK (ximagesink);
- return;
- }
-
- /* Take the xcontext reference and NULL it while we
- * clean it up, so that any buffer-alloced buffers
- * arriving after this will be freed correctly */
- xcontext = ximagesink->xcontext;
- ximagesink->xcontext = NULL;
-
- GST_OBJECT_UNLOCK (ximagesink);
-
- gst_caps_unref (xcontext->caps);
- g_free (xcontext->par);
- g_free (ximagesink->par);
- ximagesink->par = NULL;
-
- g_mutex_lock (ximagesink->x_lock);
-
- XCloseDisplay (xcontext->disp);
-
- g_mutex_unlock (ximagesink->x_lock);
-
- g_free (xcontext);
-}
-
-static void
-gst_ximagesink_bufferpool_clear (GstXImageSink * ximagesink)
-{
-
- g_mutex_lock (ximagesink->pool_lock);
-
- while (ximagesink->buffer_pool) {
- GstXImageBuffer *ximage = ximagesink->buffer_pool->data;
-
- ximagesink->buffer_pool = g_slist_delete_link (ximagesink->buffer_pool,
- ximagesink->buffer_pool);
- gst_ximage_buffer_free (ximage);
- }
-
- g_mutex_unlock (ximagesink->pool_lock);
-}
-
-/* Element stuff */
-
-static GstCaps *
-gst_ximagesink_getcaps (GstBaseSink * bsink)
-{
- GstXImageSink *ximagesink;
- GstCaps *caps;
- int i;
-
- ximagesink = GST_XIMAGESINK (bsink);
-
- if (ximagesink->xcontext)
- return gst_caps_ref (ximagesink->xcontext->caps);
-
- /* get a template copy and add the pixel aspect ratio */
- caps =
- gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SINK
- (ximagesink)->sinkpad));
- for (i = 0; i < gst_caps_get_size (caps); ++i) {
- GstStructure *structure = gst_caps_get_structure (caps, i);
-
- if (ximagesink->par) {
- int nom, den;
-
- nom = gst_value_get_fraction_numerator (ximagesink->par);
- den = gst_value_get_fraction_denominator (ximagesink->par);
- gst_structure_set (structure, "pixel-aspect-ratio",
- GST_TYPE_FRACTION, nom, den, NULL);
- }
- }
-
- return caps;
-}
-
-static gboolean
-gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
-{
- GstXImageSink *ximagesink;
- gboolean ret = TRUE;
- GstStructure *structure;
- GstCaps *intersection;
- const GValue *par;
- gint new_width, new_height;
- const GValue *fps;
-
- ximagesink = GST_XIMAGESINK (bsink);
-
- if (!ximagesink->xcontext)
- return FALSE;
-
- GST_DEBUG_OBJECT (ximagesink,
- "sinkconnect possible caps %" GST_PTR_FORMAT " with given caps %"
- GST_PTR_FORMAT, ximagesink->xcontext->caps, caps);
-
- /* We intersect those caps with our template to make sure they are correct */
- intersection = gst_caps_intersect (ximagesink->xcontext->caps, caps);
- GST_DEBUG_OBJECT (ximagesink, "intersection returned %" GST_PTR_FORMAT,
- intersection);
- if (gst_caps_is_empty (intersection)) {
- gst_caps_unref (intersection);
- return FALSE;
- }
-
- gst_caps_unref (intersection);
-
- structure = gst_caps_get_structure (caps, 0);
-
- ret &= gst_structure_get_int (structure, "width", &new_width);
- ret &= gst_structure_get_int (structure, "height", &new_height);
- fps = gst_structure_get_value (structure, "framerate");
- ret &= (fps != NULL);
- if (!ret)
- return FALSE;
-
- /* if the caps contain pixel-aspect-ratio, they have to match ours,
- * otherwise linking should fail */
- par = gst_structure_get_value (structure, "pixel-aspect-ratio");
- if (par) {
- if (ximagesink->par) {
- if (gst_value_compare (par, ximagesink->par) != GST_VALUE_EQUAL) {
- goto wrong_aspect;
- }
- } else if (ximagesink->xcontext->par) {
- if (gst_value_compare (par, ximagesink->xcontext->par) != GST_VALUE_EQUAL) {
- goto wrong_aspect;
- }
- }
- }
-
- GST_VIDEO_SINK_WIDTH (ximagesink) = new_width;
- GST_VIDEO_SINK_HEIGHT (ximagesink) = new_height;
- ximagesink->fps_n = gst_value_get_fraction_numerator (fps);
- ximagesink->fps_d = gst_value_get_fraction_denominator (fps);
-
- /* Notify application to set xwindow id now */
- g_mutex_lock (ximagesink->flow_lock);
- if (!ximagesink->xwindow) {
- g_mutex_unlock (ximagesink->flow_lock);
- gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (ximagesink));
- } else {
- g_mutex_unlock (ximagesink->flow_lock);
- }
-
- /* Creating our window and our image */
- if (GST_VIDEO_SINK_WIDTH (ximagesink) <= 0 ||
- GST_VIDEO_SINK_HEIGHT (ximagesink) <= 0) {
- GST_ELEMENT_ERROR (ximagesink, CORE, NEGOTIATION, (NULL),
- ("Invalid image size."));
- return FALSE;
- }
-
- g_mutex_lock (ximagesink->flow_lock);
- if (!ximagesink->xwindow) {
- ximagesink->xwindow = gst_ximagesink_xwindow_new (ximagesink,
- GST_VIDEO_SINK_WIDTH (ximagesink), GST_VIDEO_SINK_HEIGHT (ximagesink));
- }
- /* Remember to draw borders for next frame */
- ximagesink->draw_border = TRUE;
- g_mutex_unlock (ximagesink->flow_lock);
-
- /* If our ximage has changed we destroy it, next chain iteration will create
- a new one */
- if ((ximagesink->ximage) &&
- ((GST_VIDEO_SINK_WIDTH (ximagesink) != ximagesink->ximage->width) ||
- (GST_VIDEO_SINK_HEIGHT (ximagesink) != ximagesink->ximage->height))) {
- GST_DEBUG_OBJECT (ximagesink, "our image is not usable anymore, unref %p",
- ximagesink->ximage);
- gst_buffer_unref (GST_BUFFER_CAST (ximagesink->ximage));
- ximagesink->ximage = NULL;
- }
-
- return TRUE;
-
- /* ERRORS */
-wrong_aspect:
- {
- GST_INFO_OBJECT (ximagesink, "pixel aspect ratio does not match");
- return FALSE;
- }
-}
-
-static GstStateChangeReturn
-gst_ximagesink_change_state (GstElement * element, GstStateChange transition)
-{
- GstXImageSink *ximagesink;
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
- GstXContext *xcontext = NULL;
-
- ximagesink = GST_XIMAGESINK (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
-
- /* Initializing the XContext */
- if (ximagesink->xcontext == NULL) {
- xcontext = gst_ximagesink_xcontext_get (ximagesink);
- if (xcontext == NULL) {
- ret = GST_STATE_CHANGE_FAILURE;
- goto beach;
- }
- GST_OBJECT_LOCK (ximagesink);
- if (xcontext)
- ximagesink->xcontext = xcontext;
- GST_OBJECT_UNLOCK (ximagesink);
- }
-
- /* call XSynchronize with the current value of synchronous */
- GST_DEBUG_OBJECT (ximagesink, "XSynchronize called with %s",
- ximagesink->synchronous ? "TRUE" : "FALSE");
- g_mutex_lock (ximagesink->x_lock);
- XSynchronize (ximagesink->xcontext->disp, ximagesink->synchronous);
- g_mutex_unlock (ximagesink->x_lock);
- gst_ximagesink_manage_event_thread (ximagesink);
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- g_mutex_lock (ximagesink->flow_lock);
- if (ximagesink->xwindow)
- gst_ximagesink_xwindow_clear (ximagesink, ximagesink->xwindow);
- g_mutex_unlock (ximagesink->flow_lock);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- ximagesink->fps_n = 0;
- ximagesink->fps_d = 1;
- GST_VIDEO_SINK_WIDTH (ximagesink) = 0;
- GST_VIDEO_SINK_HEIGHT (ximagesink) = 0;
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- gst_ximagesink_reset (ximagesink);
- break;
- default:
- break;
- }
-
-beach:
- return ret;
-}
-
-static void
-gst_ximagesink_get_times (GstBaseSink * bsink, GstBuffer * buf,
- GstClockTime * start, GstClockTime * end)
-{
- GstXImageSink *ximagesink;
-
- ximagesink = GST_XIMAGESINK (bsink);
-
- if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
- *start = GST_BUFFER_TIMESTAMP (buf);
- if (GST_BUFFER_DURATION_IS_VALID (buf)) {
- *end = *start + GST_BUFFER_DURATION (buf);
- } else {
- if (ximagesink->fps_n > 0) {
- *end = *start +
- gst_util_uint64_scale_int (GST_SECOND, ximagesink->fps_d,
- ximagesink->fps_n);
- }
- }
- }
-}
-
-static GstFlowReturn
-gst_ximagesink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
-{
- GstXImageSink *ximagesink;
-
- g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR);
-
- ximagesink = GST_XIMAGESINK (vsink);
-
- /* If this buffer has been allocated using our buffer management we simply
- put the ximage which is in the PRIVATE pointer */
- if (GST_IS_XIMAGE_BUFFER (buf)) {
- GST_LOG_OBJECT (ximagesink, "buffer from our pool, writing directly");
- if (!gst_ximagesink_ximage_put (ximagesink, GST_XIMAGE_BUFFER (buf)))
- goto no_window;
- } else {
- /* Else we have to copy the data into our private image, */
- /* if we have one... */
- GST_LOG_OBJECT (ximagesink, "normal buffer, copying from it");
- if (!ximagesink->ximage) {
- GST_DEBUG_OBJECT (ximagesink, "creating our ximage");
- ximagesink->ximage = gst_ximagesink_ximage_new (ximagesink,
- GST_BUFFER_CAPS (buf));
- if (!ximagesink->ximage)
- /* The create method should have posted an informative error */
- goto no_ximage;
-
- if (ximagesink->ximage->size < GST_BUFFER_SIZE (buf)) {
- GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
- ("Failed to create output image buffer of %dx%d pixels",
- ximagesink->ximage->width, ximagesink->ximage->height),
- ("XServer allocated buffer size did not match input buffer"));
-
- gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage);
- ximagesink->ximage = NULL;
- goto no_ximage;
- }
- }
- memcpy (GST_BUFFER_DATA (ximagesink->ximage), GST_BUFFER_DATA (buf),
- MIN (GST_BUFFER_SIZE (buf), ximagesink->ximage->size));
- if (!gst_ximagesink_ximage_put (ximagesink, ximagesink->ximage))
- goto no_window;
- }
-
- return GST_FLOW_OK;
-
- /* ERRORS */
-no_ximage:
- {
- /* No image available. That's very bad ! */
- GST_WARNING_OBJECT (ximagesink, "could not create image");
- return GST_FLOW_ERROR;
- }
-no_window:
- {
- /* No Window available to put our image into */
- GST_WARNING_OBJECT (ximagesink, "could not output image - no window");
- return GST_FLOW_ERROR;
- }
-}
-
-
-static gboolean
-gst_ximagesink_event (GstBaseSink * sink, GstEvent * event)
-{
- GstXImageSink *ximagesink = GST_XIMAGESINK (sink);
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_TAG:{
- GstTagList *l;
- gchar *title = NULL;
-
- gst_event_parse_tag (event, &l);
- gst_tag_list_get_string (l, GST_TAG_TITLE, &title);
-
- if (title) {
- GST_DEBUG_OBJECT (ximagesink, "got tags, title='%s'", title);
- gst_ximagesink_xwindow_set_title (ximagesink, ximagesink->xwindow,
- title);
-
- g_free (title);
- }
- break;
- }
- default:
- break;
- }
- if (GST_BASE_SINK_CLASS (parent_class)->event)
- return GST_BASE_SINK_CLASS (parent_class)->event (sink, event);
- else
- return TRUE;
-}
-
-
-/* Buffer management
- *
- * The buffer_alloc function must either return a buffer with given size and
- * caps or create a buffer with different caps attached to the buffer. This
- * last option is called reverse negotiation, ie, where the sink suggests a
- * different format from the upstream peer.
- *
- * We try to do reverse negotiation when our geometry changes and we like a
- * resized buffer.
- */
-static GstFlowReturn
-gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
- GstCaps * caps, GstBuffer ** buf)
-{
- GstXImageSink *ximagesink;
- GstXImageBuffer *ximage = NULL;
- GstStructure *structure = NULL;
- GstFlowReturn ret = GST_FLOW_OK;
- GstCaps *alloc_caps;
- gboolean alloc_unref = FALSE;
- gint width, height;
- GstVideoRectangle dst, src, result;
-
- ximagesink = GST_XIMAGESINK (bsink);
-
- GST_LOG_OBJECT (ximagesink,
- "a buffer of %d bytes was requested with caps %" GST_PTR_FORMAT
- " and offset %" G_GUINT64_FORMAT, size, caps, offset);
-
- /* assume we're going to alloc what was requested, keep track of
- * wheter we need to unref or not. When we suggest a new format
- * upstream we will create a new caps that we need to unref. */
- alloc_caps = caps;
- alloc_unref = FALSE;
-
- /* get struct to see what is requested */
- structure = gst_caps_get_structure (caps, 0);
- if (!gst_structure_get_int (structure, "width", &width) ||
- !gst_structure_get_int (structure, "height", &height)) {
- GST_WARNING_OBJECT (ximagesink, "invalid caps for buffer allocation %"
- GST_PTR_FORMAT, caps);
- ret = GST_FLOW_NOT_NEGOTIATED;
- goto beach;
- }
-
- src.w = width;
- src.h = height;
-
- /* We take the flow_lock because the window might go away */
- g_mutex_lock (ximagesink->flow_lock);
- if (!ximagesink->xwindow) {
- g_mutex_unlock (ximagesink->flow_lock);
- goto alloc;
- }
-
- /* What is our geometry */
- gst_ximagesink_xwindow_update_geometry (ximagesink, ximagesink->xwindow);
- dst.w = ximagesink->xwindow->width;
- dst.h = ximagesink->xwindow->height;
-
- g_mutex_unlock (ximagesink->flow_lock);
-
- if (ximagesink->keep_aspect) {
- GST_LOG_OBJECT (ximagesink, "enforcing aspect ratio in reverse caps "
- "negotiation");
- gst_video_sink_center_rect (src, dst, &result, TRUE);
- } else {
- GST_LOG_OBJECT (ximagesink, "trying to resize to window geometry "
- "ignoring aspect ratio");
- result.x = result.y = 0;
- result.w = dst.w;
- result.h = dst.h;
- }
-
- /* We would like another geometry */
- if (width != result.w || height != result.h) {
- int nom, den;
- GstCaps *desired_caps;
- GstStructure *desired_struct;
-
- /* make a copy of the incomming caps to create the new
- * suggestion. We can't use make_writable because we might
- * then destroy the original caps which we still need when the
- * peer does not accept the suggestion. */
- desired_caps = gst_caps_copy (caps);
- desired_struct = gst_caps_get_structure (desired_caps, 0);
-
- GST_DEBUG ("we would love to receive a %dx%d video", result.w, result.h);
- gst_structure_set (desired_struct, "width", G_TYPE_INT, result.w, NULL);
- gst_structure_set (desired_struct, "height", G_TYPE_INT, result.h, NULL);
-
- /* PAR property overrides the X calculated one */
- if (ximagesink->par) {
- nom = gst_value_get_fraction_numerator (ximagesink->par);
- den = gst_value_get_fraction_denominator (ximagesink->par);
- gst_structure_set (desired_struct, "pixel-aspect-ratio",
- GST_TYPE_FRACTION, nom, den, NULL);
- } else if (ximagesink->xcontext->par) {
- nom = gst_value_get_fraction_numerator (ximagesink->xcontext->par);
- den = gst_value_get_fraction_denominator (ximagesink->xcontext->par);
- gst_structure_set (desired_struct, "pixel-aspect-ratio",
- GST_TYPE_FRACTION, nom, den, NULL);
- }
-
- /* see if peer accepts our new suggestion, if there is no peer, this
- * function returns true. */
- if (gst_pad_peer_accept_caps (GST_VIDEO_SINK_PAD (ximagesink),
- desired_caps)) {
- /* we will not alloc a buffer of the new suggested caps. Make sure
- * we also unref this new caps after we set it on the buffer. */
- alloc_caps = desired_caps;
- alloc_unref = TRUE;
- width = result.w;
- height = result.h;
- GST_DEBUG ("peer pad accepts our desired caps %" GST_PTR_FORMAT,
- desired_caps);
- } else {
- GST_DEBUG ("peer pad does not accept our desired caps %" GST_PTR_FORMAT,
- desired_caps);
- /* we alloc a buffer with the original incomming caps already in the
- * width and height variables */
- }
- }
-
-alloc:
- /* Inspect our buffer pool */
- g_mutex_lock (ximagesink->pool_lock);
- while (ximagesink->buffer_pool) {
- ximage = (GstXImageBuffer *) ximagesink->buffer_pool->data;
-
- if (ximage) {
- /* Removing from the pool */
- ximagesink->buffer_pool = g_slist_delete_link (ximagesink->buffer_pool,
- ximagesink->buffer_pool);
-
- /* If the ximage is invalid for our need, destroy */
- if ((ximage->width != width) || (ximage->height != height)) {
- gst_ximage_buffer_free (ximage);
- ximage = NULL;
- } else {
- /* We found a suitable ximage */
- break;
- }
- }
- }
- g_mutex_unlock (ximagesink->pool_lock);
-
- /* We haven't found anything, creating a new one */
- if (!ximage) {
- ximage = gst_ximagesink_ximage_new (ximagesink, alloc_caps);
- }
- /* Now we should have a ximage, set appropriate caps on it */
- if (ximage) {
- /* Make sure the buffer is cleared of any previously used flags */
- GST_MINI_OBJECT_CAST (ximage)->flags = 0;
- gst_buffer_set_caps (GST_BUFFER_CAST (ximage), alloc_caps);
- }
-
- /* could be our new reffed suggestion or the original unreffed caps */
- if (alloc_unref)
- gst_caps_unref (alloc_caps);
-
- *buf = GST_BUFFER_CAST (ximage);
-
-beach:
- return ret;
-}
-
-/* Interfaces stuff */
-
-static gboolean
-gst_ximagesink_interface_supported (GstImplementsInterface * iface, GType type)
-{
- g_assert (type == GST_TYPE_NAVIGATION || type == GST_TYPE_X_OVERLAY);
- return TRUE;
-}
-
-static void
-gst_ximagesink_interface_init (GstImplementsInterfaceClass * klass)
-{
- klass->supported = gst_ximagesink_interface_supported;
-}
-
-static void
-gst_ximagesink_navigation_send_event (GstNavigation * navigation,
- GstStructure * structure)
-{
- GstXImageSink *ximagesink = GST_XIMAGESINK (navigation);
- GstEvent *event;
- gint x_offset, y_offset;
- gdouble x, y;
- GstPad *pad = NULL;
-
- event = gst_event_new_navigation (structure);
-
- /* We are not converting the pointer coordinates as there's no hardware
- scaling done here. The only possible scaling is done by videoscale and
- videoscale will have to catch those events and tranform the coordinates
- to match the applied scaling. So here we just add the offset if the image
- is centered in the window. */
-
- /* We take the flow_lock while we look at the window */
- g_mutex_lock (ximagesink->flow_lock);
-
- if (!ximagesink->xwindow) {
- g_mutex_unlock (ximagesink->flow_lock);
- return;
- }
-
- x_offset = ximagesink->xwindow->width - GST_VIDEO_SINK_WIDTH (ximagesink);
- y_offset = ximagesink->xwindow->height - GST_VIDEO_SINK_HEIGHT (ximagesink);
-
- g_mutex_unlock (ximagesink->flow_lock);
-
- if (x_offset > 0 && gst_structure_get_double (structure, "pointer_x", &x)) {
- x -= x_offset / 2;
- gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE, x, NULL);
- }
- if (y_offset > 0 && gst_structure_get_double (structure, "pointer_y", &y)) {
- y -= y_offset / 2;
- gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE, y, NULL);
- }
-
- pad = gst_pad_get_peer (GST_VIDEO_SINK_PAD (ximagesink));
-
- if (GST_IS_PAD (pad) && GST_IS_EVENT (event)) {
- gst_pad_send_event (pad, event);
-
- gst_object_unref (pad);
- }
-}
-
-static void
-gst_ximagesink_navigation_init (GstNavigationInterface * iface)
-{
- iface->send_event = gst_ximagesink_navigation_send_event;
-}
-
-static void
-gst_ximagesink_set_xwindow_id (GstXOverlay * overlay, XID xwindow_id)
-{
- GstXImageSink *ximagesink = GST_XIMAGESINK (overlay);
- GstXWindow *xwindow = NULL;
- XWindowAttributes attr;
-
- /* We acquire the stream lock while setting this window in the element.
- We are basically cleaning tons of stuff replacing the old window, putting
- images while we do that would surely crash */
- g_mutex_lock (ximagesink->flow_lock);
-
- /* If we already use that window return */
- if (ximagesink->xwindow && (xwindow_id == ximagesink->xwindow->win)) {
- g_mutex_unlock (ximagesink->flow_lock);
- return;
- }
-
- /* If the element has not initialized the X11 context try to do so */
- if (!ximagesink->xcontext &&
- !(ximagesink->xcontext = gst_ximagesink_xcontext_get (ximagesink))) {
- g_mutex_unlock (ximagesink->flow_lock);
- /* we have thrown a GST_ELEMENT_ERROR now */
- return;
- }
-
- /* If a window is there already we destroy it */
- if (ximagesink->xwindow) {
- gst_ximagesink_xwindow_destroy (ximagesink, ximagesink->xwindow);
- ximagesink->xwindow = NULL;
- }
-
- /* If the xid is 0 we go back to an internal window */
- if (xwindow_id == 0) {
- /* If no width/height caps nego did not happen window will be created
- during caps nego then */
- if (GST_VIDEO_SINK_WIDTH (ximagesink) && GST_VIDEO_SINK_HEIGHT (ximagesink)) {
- xwindow = gst_ximagesink_xwindow_new (ximagesink,
- GST_VIDEO_SINK_WIDTH (ximagesink),
- GST_VIDEO_SINK_HEIGHT (ximagesink));
- }
- } else {
- xwindow = g_new0 (GstXWindow, 1);
-
- xwindow->win = xwindow_id;
-
- /* We get window geometry, set the event we want to receive,
- and create a GC */
- g_mutex_lock (ximagesink->x_lock);
- XGetWindowAttributes (ximagesink->xcontext->disp, xwindow->win, &attr);
- xwindow->width = attr.width;
- xwindow->height = attr.height;
- xwindow->internal = FALSE;
- if (ximagesink->handle_events) {
- XSelectInput (ximagesink->xcontext->disp, xwindow->win, ExposureMask |
- StructureNotifyMask | PointerMotionMask | KeyPressMask |
- KeyReleaseMask);
- }
-
- xwindow->gc = XCreateGC (ximagesink->xcontext->disp, xwindow->win, 0, NULL);
- g_mutex_unlock (ximagesink->x_lock);
- }
-
- if (xwindow)
- ximagesink->xwindow = xwindow;
-
- g_mutex_unlock (ximagesink->flow_lock);
-}
-
-static void
-gst_ximagesink_expose (GstXOverlay * overlay)
-{
- GstXImageSink *ximagesink = GST_XIMAGESINK (overlay);
-
- gst_ximagesink_ximage_put (ximagesink, NULL);
-}
-
-static void
-gst_ximagesink_set_event_handling (GstXOverlay * overlay,
- gboolean handle_events)
-{
- GstXImageSink *ximagesink = GST_XIMAGESINK (overlay);
-
- ximagesink->handle_events = handle_events;
-
- g_mutex_lock (ximagesink->flow_lock);
-
- if (G_UNLIKELY (!ximagesink->xwindow)) {
- g_mutex_unlock (ximagesink->flow_lock);
- return;
- }
-
- g_mutex_lock (ximagesink->x_lock);
-
- if (handle_events) {
- if (ximagesink->xwindow->internal) {
- XSelectInput (ximagesink->xcontext->disp, ximagesink->xwindow->win,
- ExposureMask | StructureNotifyMask | PointerMotionMask |
- KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask);
- } else {
- XSelectInput (ximagesink->xcontext->disp, ximagesink->xwindow->win,
- ExposureMask | StructureNotifyMask | PointerMotionMask |
- KeyPressMask | KeyReleaseMask);
- }
- } else {
- XSelectInput (ximagesink->xcontext->disp, ximagesink->xwindow->win, 0);
- }
-
- g_mutex_unlock (ximagesink->x_lock);
-
- g_mutex_unlock (ximagesink->flow_lock);
-}
-
-static void
-gst_ximagesink_xoverlay_init (GstXOverlayClass * iface)
-{
- iface->set_xwindow_id = gst_ximagesink_set_xwindow_id;
- iface->expose = gst_ximagesink_expose;
- iface->handle_events = gst_ximagesink_set_event_handling;
-}
-
-/* =========================================== */
-/* */
-/* Init & Class init */
-/* */
-/* =========================================== */
-
-static void
-gst_ximagesink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstXImageSink *ximagesink;
-
- g_return_if_fail (GST_IS_XIMAGESINK (object));
-
- ximagesink = GST_XIMAGESINK (object);
-
- switch (prop_id) {
- case PROP_DISPLAY:
- ximagesink->display_name = g_strdup (g_value_get_string (value));
- break;
- case PROP_SYNCHRONOUS:
- ximagesink->synchronous = g_value_get_boolean (value);
- if (ximagesink->xcontext) {
- GST_DEBUG_OBJECT (ximagesink, "XSynchronize called with %s",
- ximagesink->synchronous ? "TRUE" : "FALSE");
- g_mutex_lock (ximagesink->x_lock);
- XSynchronize (ximagesink->xcontext->disp, ximagesink->synchronous);
- g_mutex_unlock (ximagesink->x_lock);
- }
- break;
- case PROP_FORCE_ASPECT_RATIO:
- ximagesink->keep_aspect = g_value_get_boolean (value);
- break;
- case PROP_PIXEL_ASPECT_RATIO:
- {
- GValue *tmp;
-
- tmp = g_new0 (GValue, 1);
- g_value_init (tmp, GST_TYPE_FRACTION);
-
- if (!g_value_transform (value, tmp)) {
- GST_WARNING_OBJECT (ximagesink,
- "Could not transform string to aspect ratio");
- g_free (tmp);
- } else {
- GST_DEBUG_OBJECT (ximagesink, "set PAR to %d/%d",
- gst_value_get_fraction_numerator (tmp),
- gst_value_get_fraction_denominator (tmp));
- g_free (ximagesink->par);
- ximagesink->par = tmp;
- }
- }
- break;
- case PROP_HANDLE_EVENTS:
- gst_ximagesink_set_event_handling (GST_X_OVERLAY (ximagesink),
- g_value_get_boolean (value));
- gst_ximagesink_manage_event_thread (ximagesink);
- break;
- case PROP_HANDLE_EXPOSE:
- ximagesink->handle_expose = g_value_get_boolean (value);
- gst_ximagesink_manage_event_thread (ximagesink);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_ximagesink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstXImageSink *ximagesink;
-
- g_return_if_fail (GST_IS_XIMAGESINK (object));
-
- ximagesink = GST_XIMAGESINK (object);
-
- switch (prop_id) {
- case PROP_DISPLAY:
- g_value_set_string (value, ximagesink->display_name);
- break;
- case PROP_SYNCHRONOUS:
- g_value_set_boolean (value, ximagesink->synchronous);
- break;
- case PROP_FORCE_ASPECT_RATIO:
- g_value_set_boolean (value, ximagesink->keep_aspect);
- break;
- case PROP_PIXEL_ASPECT_RATIO:
- if (ximagesink->par)
- g_value_transform (ximagesink->par, value);
- break;
- case PROP_HANDLE_EVENTS:
- g_value_set_boolean (value, ximagesink->handle_events);
- break;
- case PROP_HANDLE_EXPOSE:
- g_value_set_boolean (value, ximagesink->handle_expose);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_ximagesink_reset (GstXImageSink * ximagesink)
-{
- GThread *thread;
-
- GST_OBJECT_LOCK (ximagesink);
- ximagesink->running = FALSE;
- /* grab thread and mark it as NULL */
- thread = ximagesink->event_thread;
- ximagesink->event_thread = NULL;
- GST_OBJECT_UNLOCK (ximagesink);
-
- /* Wait for our event thread to finish before we clean up our stuff. */
- if (thread)
- g_thread_join (thread);
-
- if (ximagesink->ximage) {
- gst_buffer_unref (GST_BUFFER_CAST (ximagesink->ximage));
- ximagesink->ximage = NULL;
- }
- if (ximagesink->cur_image) {
- gst_buffer_unref (GST_BUFFER_CAST (ximagesink->cur_image));
- ximagesink->cur_image = NULL;
- }
-
- gst_ximagesink_bufferpool_clear (ximagesink);
-
- g_mutex_lock (ximagesink->flow_lock);
- if (ximagesink->xwindow) {
- gst_ximagesink_xwindow_clear (ximagesink, ximagesink->xwindow);
- gst_ximagesink_xwindow_destroy (ximagesink, ximagesink->xwindow);
- ximagesink->xwindow = NULL;
- }
- g_mutex_unlock (ximagesink->flow_lock);
-
- gst_ximagesink_xcontext_clear (ximagesink);
-}
-
-static void
-gst_ximagesink_finalize (GObject * object)
-{
- GstXImageSink *ximagesink;
-
- ximagesink = GST_XIMAGESINK (object);
-
- gst_ximagesink_reset (ximagesink);
-
- if (ximagesink->display_name) {
- g_free (ximagesink->display_name);
- ximagesink->display_name = NULL;
- }
- if (ximagesink->par) {
- g_free (ximagesink->par);
- ximagesink->par = NULL;
- }
- if (ximagesink->x_lock) {
- g_mutex_free (ximagesink->x_lock);
- ximagesink->x_lock = NULL;
- }
- if (ximagesink->flow_lock) {
- g_mutex_free (ximagesink->flow_lock);
- ximagesink->flow_lock = NULL;
- }
- if (ximagesink->pool_lock) {
- g_mutex_free (ximagesink->pool_lock);
- ximagesink->pool_lock = NULL;
- }
-
- g_free (ximagesink->media_title);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_ximagesink_init (GstXImageSink * ximagesink)
-{
- ximagesink->display_name = NULL;
- ximagesink->xcontext = NULL;
- ximagesink->xwindow = NULL;
- ximagesink->ximage = NULL;
- ximagesink->cur_image = NULL;
-
- ximagesink->event_thread = NULL;
- ximagesink->running = FALSE;
-
- ximagesink->fps_n = 0;
- ximagesink->fps_d = 1;
-
- ximagesink->x_lock = g_mutex_new ();
- ximagesink->flow_lock = g_mutex_new ();
-
- ximagesink->par = NULL;
-
- ximagesink->pool_lock = g_mutex_new ();
- ximagesink->buffer_pool = NULL;
-
- ximagesink->synchronous = FALSE;
- ximagesink->keep_aspect = FALSE;
- ximagesink->handle_events = TRUE;
- ximagesink->handle_expose = TRUE;
-}
-
-static void
-gst_ximagesink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &gst_ximagesink_details);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_ximagesink_sink_template_factory));
-}
-
-static void
-gst_ximagesink_class_init (GstXImageSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- GstBaseSinkClass *gstbasesink_class;
- GstVideoSinkClass *videosink_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
- gstbasesink_class = (GstBaseSinkClass *) klass;
- videosink_class = (GstVideoSinkClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->finalize = gst_ximagesink_finalize;
- gobject_class->set_property = gst_ximagesink_set_property;
- gobject_class->get_property = gst_ximagesink_get_property;
-
- g_object_class_install_property (gobject_class, PROP_DISPLAY,
- g_param_spec_string ("display", "Display", "X Display name",
- NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_SYNCHRONOUS,
- g_param_spec_boolean ("synchronous", "Synchronous", "When enabled, runs "
- "the X display in synchronous mode. (used only for debugging)", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_FORCE_ASPECT_RATIO,
- g_param_spec_boolean ("force-aspect-ratio", "Force aspect ratio",
- "When enabled, reverse caps negotiation (scaling) will respect "
- "original aspect ratio", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_PIXEL_ASPECT_RATIO,
- g_param_spec_string ("pixel-aspect-ratio", "Pixel Aspect Ratio",
- "The pixel aspect ratio of the device", "1/1",
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_HANDLE_EVENTS,
- g_param_spec_boolean ("handle-events", "Handle XEvents",
- "When enabled, XEvents will be selected and handled", TRUE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_HANDLE_EXPOSE,
- g_param_spec_boolean ("handle-expose", "Handle expose",
- "When enabled, "
- "the current frame will always be drawn in response to X Expose "
- "events", TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstelement_class->change_state = gst_ximagesink_change_state;
-
- gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_ximagesink_getcaps);
- gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_ximagesink_setcaps);
- gstbasesink_class->buffer_alloc =
- GST_DEBUG_FUNCPTR (gst_ximagesink_buffer_alloc);
- gstbasesink_class->get_times = GST_DEBUG_FUNCPTR (gst_ximagesink_get_times);
- gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_ximagesink_event);
-
- videosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_ximagesink_show_frame);
-}
-
-/* ============================================================= */
-/* */
-/* Public Methods */
-/* */
-/* ============================================================= */
-
-/* =========================================== */
-/* */
-/* Object typing & Creation */
-/* */
-/* =========================================== */
-
-GType
-gst_ximagesink_get_type (void)
-{
- static GType ximagesink_type = 0;
-
- if (!ximagesink_type) {
- static const GTypeInfo ximagesink_info = {
- sizeof (GstXImageSinkClass),
- gst_ximagesink_base_init,
- NULL,
- (GClassInitFunc) gst_ximagesink_class_init,
- NULL,
- NULL,
- sizeof (GstXImageSink),
- 0,
- (GInstanceInitFunc) gst_ximagesink_init,
- };
- static const GInterfaceInfo iface_info = {
- (GInterfaceInitFunc) gst_ximagesink_interface_init,
- NULL,
- NULL,
- };
- static const GInterfaceInfo navigation_info = {
- (GInterfaceInitFunc) gst_ximagesink_navigation_init,
- NULL,
- NULL,
- };
- static const GInterfaceInfo overlay_info = {
- (GInterfaceInitFunc) gst_ximagesink_xoverlay_init,
- NULL,
- NULL,
- };
-
- ximagesink_type = g_type_register_static (GST_TYPE_VIDEO_SINK,
- "GstXImageSink", &ximagesink_info, 0);
-
- g_type_add_interface_static (ximagesink_type, GST_TYPE_IMPLEMENTS_INTERFACE,
- &iface_info);
- g_type_add_interface_static (ximagesink_type, GST_TYPE_NAVIGATION,
- &navigation_info);
- g_type_add_interface_static (ximagesink_type, GST_TYPE_X_OVERLAY,
- &overlay_info);
-
- /* register type and create class in a more safe place instead of at
- * runtime since the type registration and class creation is not
- * threadsafe. */
- g_type_class_ref (gst_ximage_buffer_get_type ());
- }
-
- return ximagesink_type;
-}
diff --git a/sys/ximage/ximagesink.h b/sys/ximage/ximagesink.h
deleted file mode 100644
index 75e5f52c..00000000
--- a/sys/ximage/ximagesink.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/* GStreamer
- * Copyright (C) <2005> Julien Moutte <julien@moutte.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_XIMAGESINK_H__
-#define __GST_XIMAGESINK_H__
-
-#include <gst/video/gstvideosink.h>
-
-#ifdef HAVE_XSHM
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#endif /* HAVE_XSHM */
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#ifdef HAVE_XSHM
-#include <X11/extensions/XShm.h>
-#endif /* HAVE_XSHM */
-
-#include <string.h>
-#include <math.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_XIMAGESINK \
- (gst_ximagesink_get_type())
-#define GST_XIMAGESINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_XIMAGESINK, GstXImageSink))
-#define GST_XIMAGESINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_XIMAGESINK, GstXImageSinkClass))
-#define GST_IS_XIMAGESINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_XIMAGESINK))
-#define GST_IS_XIMAGESINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_XIMAGESINK))
-
-typedef struct _GstXContext GstXContext;
-typedef struct _GstXWindow GstXWindow;
-
-typedef struct _GstXImageBuffer GstXImageBuffer;
-typedef struct _GstXImageBufferClass GstXImageBufferClass;
-
-typedef struct _GstXImageSink GstXImageSink;
-typedef struct _GstXImageSinkClass GstXImageSinkClass;
-
-/*
- * GstXContext:
- * @disp: the X11 Display of this context
- * @screen: the default Screen of Display @disp
- * @screen_num: the Screen number of @screen
- * @visual: the default Visual of Screen @screen
- * @root: the root Window of Display @disp
- * @white: the value of a white pixel on Screen @screen
- * @black: the value of a black pixel on Screen @screen
- * @depth: the color depth of Display @disp
- * @bpp: the number of bits per pixel on Display @disp
- * @endianness: the endianness of image bytes on Display @disp
- * @width: the width in pixels of Display @disp
- * @height: the height in pixels of Display @disp
- * @widthmm: the width in millimeters of Display @disp
- * @heightmm: the height in millimeters of Display @disp
- * @par: the pixel aspect ratio calculated from @width, @widthmm and @height,
- * @heightmm ratio
- * @use_xshm: used to known wether of not XShm extension is usable or not even
- * if the Extension is present
- * @caps: the #GstCaps that Display @disp can accept
- *
- * Structure used to store various informations collected/calculated for a
- * Display.
- */
-struct _GstXContext {
- Display *disp;
-
- Screen *screen;
- gint screen_num;
-
- Visual *visual;
-
- Window root;
-
- gulong white, black;
-
- gint depth;
- gint bpp;
- gint endianness;
-
- gint width, height;
- gint widthmm, heightmm;
- GValue *par; /* calculated pixel aspect ratio */
-
- gboolean use_xshm;
-
- GstCaps *caps;
-};
-
-/*
- * GstXWindow:
- * @win: the Window ID of this X11 window
- * @width: the width in pixels of Window @win
- * @height: the height in pixels of Window @win
- * @internal: used to remember if Window @win was created internally or passed
- * through the #GstXOverlay interface
- * @gc: the Graphical Context of Window @win
- *
- * Structure used to store informations about a Window.
- */
-struct _GstXWindow {
- Window win;
- gint width, height;
- gboolean internal;
- GC gc;
-};
-
-/**
- * GstXImageBuffer:
- * @ximagesink: a reference to our #GstXImageSink
- * @ximage: the XImage of this buffer
- * @width: the width in pixels of XImage @ximage
- * @height: the height in pixels of XImage @ximage
- * @size: the size in bytes of XImage @ximage
- *
- * Subclass of #GstBuffer containing additional information about an XImage.
- */
-struct _GstXImageBuffer {
- GstBuffer buffer;
-
- /* Reference to the ximagesink we belong to */
- GstXImageSink *ximagesink;
-
- XImage *ximage;
-
-#ifdef HAVE_XSHM
- XShmSegmentInfo SHMInfo;
-#endif /* HAVE_XSHM */
-
- gint width, height;
- size_t size;
-};
-
-/**
- * GstXImageSink:
- * @display_name: the name of the Display we want to render to
- * @xcontext: our instance's #GstXContext
- * @xwindow: the #GstXWindow we are rendering to
- * @ximage: internal #GstXImage used to store incoming buffers and render when
- * not using the buffer_alloc optimization mechanism
- * @cur_image: a reference to the last #GstXImage that was put to @xwindow. It
- * is used when Expose events are received to redraw the latest video frame
- * @event_thread: a thread listening for events on @xwindow and handling them
- * @running: used to inform @event_thread if it should run/shutdown
- * @fps_n: the framerate fraction numerator
- * @fps_d: the framerate fraction denominator
- * @x_lock: used to protect X calls as we are not using the XLib in threaded
- * mode
- * @flow_lock: used to protect data flow routines from external calls such as
- * events from @event_thread or methods from the #GstXOverlay interface
- * @par: used to override calculated pixel aspect ratio from @xcontext
- * @pool_lock: used to protect the buffer pool
- * @buffer_pool: a list of #GstXImageBuffer that could be reused at next buffer
- * allocation call
- * @synchronous: used to store if XSynchronous should be used or not (for
- * debugging purpose only)
- * @keep_aspect: used to remember if reverse negotiation scaling should respect
- * aspect ratio
- * @handle_events: used to know if we should handle select XEvents or not
- *
- * The #GstXImageSink data structure.
- */
-struct _GstXImageSink {
- /* Our element stuff */
- GstVideoSink videosink;
-
- char *display_name;
-
- GstXContext *xcontext;
- GstXWindow *xwindow;
- GstXImageBuffer *ximage;
- GstXImageBuffer *cur_image;
-
- GThread *event_thread;
- gboolean running;
-
- /* Framerate numerator and denominator */
- gint fps_n;
- gint fps_d;
-
- GMutex *x_lock;
- GMutex *flow_lock;
-
- /* object-set pixel aspect ratio */
- GValue *par;
-
- GMutex *pool_lock;
- GSList *buffer_pool;
-
- gboolean synchronous;
- gboolean keep_aspect;
- gboolean handle_events;
- gboolean handle_expose;
- gboolean draw_border;
-
- /* stream metadata */
- gchar *media_title;
-};
-
-struct _GstXImageSinkClass {
- GstVideoSinkClass parent_class;
-};
-
-GType gst_ximagesink_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_XIMAGESINK_H__ */
diff --git a/sys/xvimage/Makefile.am b/sys/xvimage/Makefile.am
deleted file mode 100644
index fbff4d8c..00000000
--- a/sys/xvimage/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-plugin_LTLIBRARIES = libgstxvimagesink.la
-
-libgstxvimagesink_la_SOURCES = xvimagesink.c
-libgstxvimagesink_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS)
-libgstxvimagesink_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la \
- $(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_MAJORMINOR).la \
- $(GST_BASE_LIBS) \
- $(GST_LIBS) \
- $(X_LIBS) $(XVIDEO_LIBS) $(XSHM_LIBS) $(LIBM)
-libgstxvimagesink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstxvimagesink_la_DEPENDENCIES = $(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_MAJORMINOR).la
-libgstxvimagesink_la_LIBTOOLFLAGS = --tag=disable-static
-
-noinst_HEADERS = xvimagesink.h
diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c
deleted file mode 100644
index ffc8f67f..00000000
--- a/sys/xvimage/xvimagesink.c
+++ /dev/null
@@ -1,3634 +0,0 @@
-/* GStreamer
- * Copyright (C) <2005> Julien Moutte <julien@moutte.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/**
- * SECTION:element-xvimagesink
- *
- * XvImageSink renders video frames to a drawable (XWindow) on a local display
- * using the XVideo extension. Rendering to a remote display is theorically
- * possible but i doubt that the XVideo extension is actually available when
- * connecting to a remote display. This element can receive a Window ID from the
- * application through the XOverlay interface and will then render video frames
- * in this drawable. If no Window ID was provided by the application, the
- * element will create its own internal window and render into it.
- *
- * <refsect2>
- * <title>Scaling</title>
- * <para>
- * The XVideo extension, when it's available, handles hardware accelerated
- * scaling of video frames. This means that the element will just accept
- * incoming video frames no matter their geometry and will then put them to the
- * drawable scaling them on the fly. Using the #GstXvImageSink:force-aspect-ratio
- * property it is possible to enforce scaling with a constant aspect ratio,
- * which means drawing black borders around the video frame.
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>Events</title>
- * <para>
- * XvImageSink creates a thread to handle events coming from the drawable. There
- * are several kind of events that can be grouped in 2 big categories: input
- * events and window state related events. Input events will be translated to
- * navigation events and pushed upstream for other elements to react on them.
- * This includes events such as pointer moves, key press/release, clicks etc...
- * Other events are used to handle the drawable appearance even when the data
- * is not flowing (GST_STATE_PAUSED). That means that even when the element is
- * paused, it will receive expose events from the drawable and draw the latest
- * frame with correct borders/aspect-ratio.
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>Pixel aspect ratio</title>
- * <para>
- * When changing state to GST_STATE_READY, XvImageSink will open a connection to
- * the display specified in the #GstXvImageSink:display property or the
- * default display if nothing specified. Once this connection is open it will
- * inspect the display configuration including the physical display geometry and
- * then calculate the pixel aspect ratio. When receiving video frames with a
- * different pixel aspect ratio, XvImageSink will use hardware scaling to
- * display the video frames correctly on display's pixel aspect ratio.
- * Sometimes the calculated pixel aspect ratio can be wrong, it is
- * then possible to enforce a specific pixel aspect ratio using the
- * #GstXvImageSink:pixel-aspect-ratio property.
- * </para>
- * </refsect2>
- * <refsect2>
- * <title>Examples</title>
- * |[
- * gst-launch -v videotestsrc ! xvimagesink
- * ]| A pipeline to test hardware scaling.
- * When the test video signal appears you can resize the window and see that
- * video frames are scaled through hardware (no extra CPU cost).
- * |[
- * gst-launch -v videotestsrc ! xvimagesink force-aspect-ratio=true
- * ]| Same pipeline with #GstXvImageSink:force-aspect-ratio property set to true
- * You can observe the borders drawn around the scaled image respecting aspect
- * ratio.
- * |[
- * gst-launch -v videotestsrc ! navigationtest ! xvimagesink
- * ]| A pipeline to test navigation events.
- * While moving the mouse pointer over the test signal you will see a black box
- * following the mouse pointer. If you press the mouse button somewhere on the
- * video and release it somewhere else a green box will appear where you pressed
- * the button and a red one where you released it. (The navigationtest element
- * is part of gst-plugins-good.) You can observe here that even if the images
- * are scaled through hardware the pointer coordinates are converted back to the
- * original video frame geometry so that the box can be drawn to the correct
- * position. This also handles borders correctly, limiting coordinates to the
- * image area
- * |[
- * gst-launch -v videotestsrc ! video/x-raw-yuv, pixel-aspect-ratio=(fraction)4/3 ! xvimagesink
- * ]| This is faking a 4/3 pixel aspect ratio caps on video frames produced by
- * videotestsrc, in most cases the pixel aspect ratio of the display will be
- * 1/1. This means that XvImageSink will have to do the scaling to convert
- * incoming frames to a size that will match the display pixel aspect ratio
- * (from 320x240 to 320x180 in this case). Note that you might have to escape
- * some characters for your shell like '\(fraction\)'.
- * |[
- * gst-launch -v videotestsrc ! xvimagesink hue=100 saturation=-100 brightness=100
- * ]| Demonstrates how to use the colorbalance interface.
- * </refsect2>
- */
-
-/* for developers: there are two useful tools : xvinfo and xvattr */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-/* Our interfaces */
-#include <gst/interfaces/navigation.h>
-#include <gst/interfaces/xoverlay.h>
-#include <gst/interfaces/colorbalance.h>
-#include <gst/interfaces/propertyprobe.h>
-/* Helper functions */
-#include <gst/video/video.h>
-
-/* Object header */
-#include "xvimagesink.h"
-
-/* Debugging category */
-#include <gst/gstinfo.h>
-GST_DEBUG_CATEGORY_STATIC (gst_debug_xvimagesink);
-#define GST_CAT_DEFAULT gst_debug_xvimagesink
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE);
-
-typedef struct
-{
- unsigned long flags;
- unsigned long functions;
- unsigned long decorations;
- long input_mode;
- unsigned long status;
-}
-MotifWmHints, MwmHints;
-
-#define MWM_HINTS_DECORATIONS (1L << 1)
-
-static void gst_xvimagesink_reset (GstXvImageSink * xvimagesink);
-
-static GstBufferClass *xvimage_buffer_parent_class = NULL;
-static void gst_xvimage_buffer_finalize (GstXvImageBuffer * xvimage);
-
-static void gst_xvimagesink_xwindow_update_geometry (GstXvImageSink *
- xvimagesink, GstXWindow * xwindow);
-static gint gst_xvimagesink_get_format_from_caps (GstXvImageSink * xvimagesink,
- GstCaps * caps);
-static void gst_xvimagesink_expose (GstXOverlay * overlay);
-
-/* ElementFactory information */
-static const GstElementDetails gst_xvimagesink_details =
-GST_ELEMENT_DETAILS ("Video sink",
- "Sink/Video",
- "A Xv based videosink",
- "Julien Moutte <julien@moutte.net>");
-
-/* Default template - initiated with class struct to allow gst-register to work
- without X running */
-static GstStaticPadTemplate gst_xvimagesink_sink_template_factory =
- GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-rgb, "
- "framerate = (fraction) [ 0, MAX ], "
- "width = (int) [ 1, MAX ], "
- "height = (int) [ 1, MAX ]; "
- "video/x-raw-yuv, "
- "framerate = (fraction) [ 0, MAX ], "
- "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
- );
-
-enum
-{
- ARG_0,
- ARG_CONTRAST,
- ARG_BRIGHTNESS,
- ARG_HUE,
- ARG_SATURATION,
- ARG_DISPLAY,
- ARG_SYNCHRONOUS,
- ARG_PIXEL_ASPECT_RATIO,
- ARG_FORCE_ASPECT_RATIO,
- ARG_HANDLE_EVENTS,
- ARG_DEVICE,
- ARG_DEVICE_NAME,
- ARG_HANDLE_EXPOSE,
- ARG_DOUBLE_BUFFER,
- ARG_AUTOPAINT_COLORKEY,
- ARG_COLORKEY,
- ARG_DRAW_BORDERS
-};
-
-static GstVideoSinkClass *parent_class = NULL;
-
-/* ============================================================= */
-/* */
-/* Private Methods */
-/* */
-/* ============================================================= */
-
-/* xvimage buffers */
-
-#define GST_TYPE_XVIMAGE_BUFFER (gst_xvimage_buffer_get_type())
-
-#define GST_IS_XVIMAGE_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_XVIMAGE_BUFFER))
-#define GST_XVIMAGE_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_XVIMAGE_BUFFER, GstXvImageBuffer))
-#define GST_XVIMAGE_BUFFER_CAST(obj) ((GstXvImageBuffer *)(obj))
-
-/* This function destroys a GstXvImage handling XShm availability */
-static void
-gst_xvimage_buffer_destroy (GstXvImageBuffer * xvimage)
-{
- GstXvImageSink *xvimagesink;
-
- GST_DEBUG_OBJECT (xvimage, "Destroying buffer");
-
- xvimagesink = xvimage->xvimagesink;
- if (G_UNLIKELY (xvimagesink == NULL))
- goto no_sink;
-
- g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
-
- GST_OBJECT_LOCK (xvimagesink);
-
- /* If the destroyed image is the current one we destroy our reference too */
- if (xvimagesink->cur_image == xvimage)
- xvimagesink->cur_image = NULL;
-
- /* We might have some buffers destroyed after changing state to NULL */
- if (xvimagesink->xcontext == NULL) {
- GST_DEBUG_OBJECT (xvimagesink, "Destroying XvImage after Xcontext");
-#ifdef HAVE_XSHM
- /* Need to free the shared memory segment even if the x context
- * was already cleaned up */
- if (xvimage->SHMInfo.shmaddr != ((void *) -1)) {
- shmdt (xvimage->SHMInfo.shmaddr);
- }
-#endif
- goto beach;
- }
-
- g_mutex_lock (xvimagesink->x_lock);
-
-#ifdef HAVE_XSHM
- if (xvimagesink->xcontext->use_xshm) {
- if (xvimage->SHMInfo.shmaddr != ((void *) -1)) {
- GST_DEBUG_OBJECT (xvimagesink, "XServer ShmDetaching from 0x%x id 0x%lx",
- xvimage->SHMInfo.shmid, xvimage->SHMInfo.shmseg);
- XShmDetach (xvimagesink->xcontext->disp, &xvimage->SHMInfo);
- XSync (xvimagesink->xcontext->disp, FALSE);
-
- shmdt (xvimage->SHMInfo.shmaddr);
- }
- if (xvimage->xvimage)
- XFree (xvimage->xvimage);
- } else
-#endif /* HAVE_XSHM */
- {
- if (xvimage->xvimage) {
- if (xvimage->xvimage->data) {
- g_free (xvimage->xvimage->data);
- }
- XFree (xvimage->xvimage);
- }
- }
-
- XSync (xvimagesink->xcontext->disp, FALSE);
-
- g_mutex_unlock (xvimagesink->x_lock);
-
-beach:
- GST_OBJECT_UNLOCK (xvimagesink);
- xvimage->xvimagesink = NULL;
- gst_object_unref (xvimagesink);
-
- GST_MINI_OBJECT_CLASS (xvimage_buffer_parent_class)->finalize (GST_MINI_OBJECT
- (xvimage));
-
- return;
-
-no_sink:
- {
- GST_WARNING ("no sink found");
- return;
- }
-}
-
-static void
-gst_xvimage_buffer_finalize (GstXvImageBuffer * xvimage)
-{
- GstXvImageSink *xvimagesink;
- gboolean running;
-
- xvimagesink = xvimage->xvimagesink;
- if (G_UNLIKELY (xvimagesink == NULL))
- goto no_sink;
-
- g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
-
- GST_OBJECT_LOCK (xvimagesink);
- running = xvimagesink->running;
- GST_OBJECT_UNLOCK (xvimagesink);
-
- /* If our geometry changed we can't reuse that image. */
- if (running == FALSE) {
- GST_LOG_OBJECT (xvimage, "destroy image as sink is shutting down");
- gst_xvimage_buffer_destroy (xvimage);
- } else if ((xvimage->width != xvimagesink->video_width) ||
- (xvimage->height != xvimagesink->video_height)) {
- GST_LOG_OBJECT (xvimage,
- "destroy image as its size changed %dx%d vs current %dx%d",
- xvimage->width, xvimage->height,
- xvimagesink->video_width, xvimagesink->video_height);
- gst_xvimage_buffer_destroy (xvimage);
- } else {
- /* In that case we can reuse the image and add it to our image pool. */
- GST_LOG_OBJECT (xvimage, "recycling image in pool");
- /* need to increment the refcount again to recycle */
- gst_buffer_ref (GST_BUFFER_CAST (xvimage));
- g_mutex_lock (xvimagesink->pool_lock);
- xvimagesink->image_pool = g_slist_prepend (xvimagesink->image_pool,
- xvimage);
- g_mutex_unlock (xvimagesink->pool_lock);
- }
- return;
-
-no_sink:
- {
- GST_WARNING ("no sink found");
- return;
- }
-}
-
-static void
-gst_xvimage_buffer_free (GstXvImageBuffer * xvimage)
-{
- /* make sure it is not recycled */
- xvimage->width = -1;
- xvimage->height = -1;
- gst_buffer_unref (GST_BUFFER (xvimage));
-}
-
-static void
-gst_xvimage_buffer_init (GstXvImageBuffer * xvimage, gpointer g_class)
-{
-#ifdef HAVE_XSHM
- xvimage->SHMInfo.shmaddr = ((void *) -1);
- xvimage->SHMInfo.shmid = -1;
-#endif
-}
-
-static void
-gst_xvimage_buffer_class_init (gpointer g_class, gpointer class_data)
-{
- GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
-
- xvimage_buffer_parent_class = g_type_class_peek_parent (g_class);
-
- mini_object_class->finalize = (GstMiniObjectFinalizeFunction)
- gst_xvimage_buffer_finalize;
-}
-
-static GType
-gst_xvimage_buffer_get_type (void)
-{
- static GType _gst_xvimage_buffer_type;
-
- if (G_UNLIKELY (_gst_xvimage_buffer_type == 0)) {
- static const GTypeInfo xvimage_buffer_info = {
- sizeof (GstBufferClass),
- NULL,
- NULL,
- gst_xvimage_buffer_class_init,
- NULL,
- NULL,
- sizeof (GstXvImageBuffer),
- 0,
- (GInstanceInitFunc) gst_xvimage_buffer_init,
- NULL
- };
- _gst_xvimage_buffer_type = g_type_register_static (GST_TYPE_BUFFER,
- "GstXvImageBuffer", &xvimage_buffer_info, 0);
- }
- return _gst_xvimage_buffer_type;
-}
-
-/* X11 stuff */
-
-static gboolean error_caught = FALSE;
-
-static int
-gst_xvimagesink_handle_xerror (Display * display, XErrorEvent * xevent)
-{
- char error_msg[1024];
-
- XGetErrorText (display, xevent->error_code, error_msg, 1024);
- GST_DEBUG ("xvimagesink triggered an XError. error: %s", error_msg);
- error_caught = TRUE;
- return 0;
-}
-
-#ifdef HAVE_XSHM
-/* This function checks that it is actually really possible to create an image
- using XShm */
-static gboolean
-gst_xvimagesink_check_xshm_calls (GstXContext * xcontext)
-{
- XvImage *xvimage;
- XShmSegmentInfo SHMInfo;
- gint size;
- int (*handler) (Display *, XErrorEvent *);
- gboolean result = FALSE;
- gboolean did_attach = FALSE;
-
- g_return_val_if_fail (xcontext != NULL, FALSE);
-
- /* Sync to ensure any older errors are already processed */
- XSync (xcontext->disp, FALSE);
-
- /* Set defaults so we don't free these later unnecessarily */
- SHMInfo.shmaddr = ((void *) -1);
- SHMInfo.shmid = -1;
-
- /* Setting an error handler to catch failure */
- error_caught = FALSE;
- handler = XSetErrorHandler (gst_xvimagesink_handle_xerror);
-
- /* Trying to create a 1x1 picture */
- GST_DEBUG ("XvShmCreateImage of 1x1");
- xvimage = XvShmCreateImage (xcontext->disp, xcontext->xv_port_id,
- xcontext->im_format, NULL, 1, 1, &SHMInfo);
-
- /* Might cause an error, sync to ensure it is noticed */
- XSync (xcontext->disp, FALSE);
- if (!xvimage || error_caught) {
- GST_WARNING ("could not XvShmCreateImage a 1x1 image");
- goto beach;
- }
- size = xvimage->data_size;
-
- SHMInfo.shmid = shmget (IPC_PRIVATE, size, IPC_CREAT | 0777);
- if (SHMInfo.shmid == -1) {
- GST_WARNING ("could not get shared memory of %d bytes", size);
- goto beach;
- }
-
- SHMInfo.shmaddr = shmat (SHMInfo.shmid, NULL, 0);
- if (SHMInfo.shmaddr == ((void *) -1)) {
- GST_WARNING ("Failed to shmat: %s", g_strerror (errno));
- /* Clean up the shared memory segment */
- shmctl (SHMInfo.shmid, IPC_RMID, NULL);
- goto beach;
- }
-
- xvimage->data = SHMInfo.shmaddr;
- SHMInfo.readOnly = FALSE;
-
- if (XShmAttach (xcontext->disp, &SHMInfo) == 0) {
- GST_WARNING ("Failed to XShmAttach");
- /* Clean up the shared memory segment */
- shmctl (SHMInfo.shmid, IPC_RMID, NULL);
- goto beach;
- }
-
- /* Sync to ensure we see any errors we caused */
- XSync (xcontext->disp, FALSE);
-
- /* Delete the shared memory segment as soon as everyone is attached.
- * This way, it will be deleted as soon as we detach later, and not
- * leaked if we crash. */
- shmctl (SHMInfo.shmid, IPC_RMID, NULL);
-
- if (!error_caught) {
- GST_DEBUG ("XServer ShmAttached to 0x%x, id 0x%lx", SHMInfo.shmid,
- SHMInfo.shmseg);
-
- did_attach = TRUE;
- /* store whether we succeeded in result */
- result = TRUE;
- } else {
- GST_WARNING ("MIT-SHM extension check failed at XShmAttach. "
- "Not using shared memory.");
- }
-
-beach:
- /* Sync to ensure we swallow any errors we caused and reset error_caught */
- XSync (xcontext->disp, FALSE);
-
- error_caught = FALSE;
- XSetErrorHandler (handler);
-
- if (did_attach) {
- GST_DEBUG ("XServer ShmDetaching from 0x%x id 0x%lx",
- SHMInfo.shmid, SHMInfo.shmseg);
- XShmDetach (xcontext->disp, &SHMInfo);
- XSync (xcontext->disp, FALSE);
- }
- if (SHMInfo.shmaddr != ((void *) -1))
- shmdt (SHMInfo.shmaddr);
- if (xvimage)
- XFree (xvimage);
- return result;
-}
-#endif /* HAVE_XSHM */
-
-/* This function handles GstXvImage creation depending on XShm availability */
-static GstXvImageBuffer *
-gst_xvimagesink_xvimage_new (GstXvImageSink * xvimagesink, GstCaps * caps)
-{
- GstXvImageBuffer *xvimage = NULL;
- GstStructure *structure = NULL;
- gboolean succeeded = FALSE;
- int (*handler) (Display *, XErrorEvent *);
-
- g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), NULL);
-
- if (caps == NULL)
- return NULL;
-
- xvimage = (GstXvImageBuffer *) gst_mini_object_new (GST_TYPE_XVIMAGE_BUFFER);
- GST_DEBUG_OBJECT (xvimage, "Creating new XvImageBuffer");
-
- structure = gst_caps_get_structure (caps, 0);
-
- if (!gst_structure_get_int (structure, "width", &xvimage->width) ||
- !gst_structure_get_int (structure, "height", &xvimage->height)) {
- GST_WARNING ("failed getting geometry from caps %" GST_PTR_FORMAT, caps);
- }
-
- GST_LOG_OBJECT (xvimagesink, "creating %dx%d", xvimage->width,
- xvimage->height);
-
- xvimage->im_format = gst_xvimagesink_get_format_from_caps (xvimagesink, caps);
- if (xvimage->im_format == -1) {
- GST_WARNING_OBJECT (xvimagesink, "failed to get format from caps %"
- GST_PTR_FORMAT, caps);
- GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
- ("Failed to create output image buffer of %dx%d pixels",
- xvimage->width, xvimage->height), ("Invalid input caps"));
- goto beach_unlocked;
- }
- xvimage->xvimagesink = gst_object_ref (xvimagesink);
-
- g_mutex_lock (xvimagesink->x_lock);
-
- /* Setting an error handler to catch failure */
- error_caught = FALSE;
- handler = XSetErrorHandler (gst_xvimagesink_handle_xerror);
-
-#ifdef HAVE_XSHM
- if (xvimagesink->xcontext->use_xshm) {
- int expected_size;
-
- xvimage->xvimage = XvShmCreateImage (xvimagesink->xcontext->disp,
- xvimagesink->xcontext->xv_port_id,
- xvimage->im_format, NULL,
- xvimage->width, xvimage->height, &xvimage->SHMInfo);
- if (!xvimage->xvimage || error_caught) {
- g_mutex_unlock (xvimagesink->x_lock);
- /* Reset error handler */
- error_caught = FALSE;
- XSetErrorHandler (handler);
- /* Push an error */
- GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
- ("Failed to create output image buffer of %dx%d pixels",
- xvimage->width, xvimage->height),
- ("could not XvShmCreateImage a %dx%d image",
- xvimage->width, xvimage->height));
- goto beach_unlocked;
- }
-
- /* we have to use the returned data_size for our shm size */
- xvimage->size = xvimage->xvimage->data_size;
- GST_LOG_OBJECT (xvimagesink, "XShm image size is %" G_GSIZE_FORMAT,
- xvimage->size);
-
- /* calculate the expected size. This is only for sanity checking the
- * number we get from X. */
- switch (xvimage->im_format) {
- case GST_MAKE_FOURCC ('I', '4', '2', '0'):
- case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
- {
- gint pitches[3];
- gint offsets[3];
- guint plane;
-
- offsets[0] = 0;
- pitches[0] = GST_ROUND_UP_4 (xvimage->width);
- offsets[1] = offsets[0] + pitches[0] * GST_ROUND_UP_2 (xvimage->height);
- pitches[1] = GST_ROUND_UP_8 (xvimage->width) / 2;
- offsets[2] =
- offsets[1] + pitches[1] * GST_ROUND_UP_2 (xvimage->height) / 2;
- pitches[2] = GST_ROUND_UP_8 (pitches[0]) / 2;
-
- expected_size =
- offsets[2] + pitches[2] * GST_ROUND_UP_2 (xvimage->height) / 2;
-
- for (plane = 0; plane < xvimage->xvimage->num_planes; plane++) {
- GST_DEBUG_OBJECT (xvimagesink,
- "Plane %u has a expected pitch of %d bytes, " "offset of %d",
- plane, pitches[plane], offsets[plane]);
- }
- break;
- }
- case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
- case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
- expected_size = xvimage->height * GST_ROUND_UP_4 (xvimage->width * 2);
- break;
- default:
- expected_size = 0;
- break;
- }
- if (expected_size != 0 && xvimage->size != expected_size) {
- GST_WARNING_OBJECT (xvimagesink,
- "unexpected XShm image size (got %" G_GSIZE_FORMAT ", expected %d)",
- xvimage->size, expected_size);
- }
-
- /* Be verbose about our XvImage stride */
- {
- guint plane;
-
- for (plane = 0; plane < xvimage->xvimage->num_planes; plane++) {
- GST_DEBUG_OBJECT (xvimagesink, "Plane %u has a pitch of %d bytes, "
- "offset of %d", plane, xvimage->xvimage->pitches[plane],
- xvimage->xvimage->offsets[plane]);
- }
- }
-
- xvimage->SHMInfo.shmid = shmget (IPC_PRIVATE, xvimage->size,
- IPC_CREAT | 0777);
- if (xvimage->SHMInfo.shmid == -1) {
- g_mutex_unlock (xvimagesink->x_lock);
- GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
- ("Failed to create output image buffer of %dx%d pixels",
- xvimage->width, xvimage->height),
- ("could not get shared memory of %" G_GSIZE_FORMAT " bytes",
- xvimage->size));
- goto beach_unlocked;
- }
-
- xvimage->SHMInfo.shmaddr = shmat (xvimage->SHMInfo.shmid, NULL, 0);
- if (xvimage->SHMInfo.shmaddr == ((void *) -1)) {
- g_mutex_unlock (xvimagesink->x_lock);
- GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
- ("Failed to create output image buffer of %dx%d pixels",
- xvimage->width, xvimage->height),
- ("Failed to shmat: %s", g_strerror (errno)));
- /* Clean up the shared memory segment */
- shmctl (xvimage->SHMInfo.shmid, IPC_RMID, NULL);
- goto beach_unlocked;
- }
-
- xvimage->xvimage->data = xvimage->SHMInfo.shmaddr;
- xvimage->SHMInfo.readOnly = FALSE;
-
- if (XShmAttach (xvimagesink->xcontext->disp, &xvimage->SHMInfo) == 0) {
- /* Clean up the shared memory segment */
- shmctl (xvimage->SHMInfo.shmid, IPC_RMID, NULL);
-
- g_mutex_unlock (xvimagesink->x_lock);
- GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
- ("Failed to create output image buffer of %dx%d pixels",
- xvimage->width, xvimage->height), ("Failed to XShmAttach"));
- goto beach_unlocked;
- }
-
- XSync (xvimagesink->xcontext->disp, FALSE);
-
- /* Delete the shared memory segment as soon as we everyone is attached.
- * This way, it will be deleted as soon as we detach later, and not
- * leaked if we crash. */
- shmctl (xvimage->SHMInfo.shmid, IPC_RMID, NULL);
-
- GST_DEBUG_OBJECT (xvimagesink, "XServer ShmAttached to 0x%x, id 0x%lx",
- xvimage->SHMInfo.shmid, xvimage->SHMInfo.shmseg);
- } else
-#endif /* HAVE_XSHM */
- {
- xvimage->xvimage = XvCreateImage (xvimagesink->xcontext->disp,
- xvimagesink->xcontext->xv_port_id,
- xvimage->im_format, NULL, xvimage->width, xvimage->height);
- if (!xvimage->xvimage || error_caught) {
- g_mutex_unlock (xvimagesink->x_lock);
- /* Reset error handler */
- error_caught = FALSE;
- XSetErrorHandler (handler);
- /* Push an error */
- GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
- ("Failed to create outputimage buffer of %dx%d pixels",
- xvimage->width, xvimage->height),
- ("could not XvCreateImage a %dx%d image",
- xvimage->width, xvimage->height));
- goto beach_unlocked;
- }
-
- /* we have to use the returned data_size for our image size */
- xvimage->size = xvimage->xvimage->data_size;
- xvimage->xvimage->data = g_malloc (xvimage->size);
-
- XSync (xvimagesink->xcontext->disp, FALSE);
- }
-
- /* Reset error handler */
- error_caught = FALSE;
- XSetErrorHandler (handler);
-
- succeeded = TRUE;
-
- GST_BUFFER_DATA (xvimage) = (guchar *) xvimage->xvimage->data;
- GST_BUFFER_SIZE (xvimage) = xvimage->size;
-
- g_mutex_unlock (xvimagesink->x_lock);
-
-beach_unlocked:
- if (!succeeded) {
- gst_xvimage_buffer_free (xvimage);
- xvimage = NULL;
- }
-
- return xvimage;
-}
-
-/* We are called with the x_lock taken */
-static void
-gst_xvimagesink_xwindow_draw_borders (GstXvImageSink * xvimagesink,
- GstXWindow * xwindow, GstVideoRectangle rect)
-{
- g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
- g_return_if_fail (xwindow != NULL);
-
- XSetForeground (xvimagesink->xcontext->disp, xwindow->gc,
- xvimagesink->xcontext->black);
-
- /* Left border */
- if (rect.x > 0) {
- XFillRectangle (xvimagesink->xcontext->disp, xwindow->win, xwindow->gc,
- 0, 0, rect.x, xwindow->height);
- }
-
- /* Right border */
- if ((rect.x + rect.w) < xwindow->width) {
- XFillRectangle (xvimagesink->xcontext->disp, xwindow->win, xwindow->gc,
- rect.x + rect.w, 0, xwindow->width, xwindow->height);
- }
-
- /* Top border */
- if (rect.y > 0) {
- XFillRectangle (xvimagesink->xcontext->disp, xwindow->win, xwindow->gc,
- 0, 0, xwindow->width, rect.y);
- }
-
- /* Bottom border */
- if ((rect.y + rect.h) < xwindow->height) {
- XFillRectangle (xvimagesink->xcontext->disp, xwindow->win, xwindow->gc,
- 0, rect.y + rect.h, xwindow->width, xwindow->height);
- }
-}
-
-/* This function puts a GstXvImage on a GstXvImageSink's window. Returns FALSE
- * if no window was available */
-static gboolean
-gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink,
- GstXvImageBuffer * xvimage)
-{
- GstVideoRectangle src, dst, result;
- gboolean draw_border = FALSE;
-
- /* We take the flow_lock. If expose is in there we don't want to run
- concurrently from the data flow thread */
- g_mutex_lock (xvimagesink->flow_lock);
-
- if (G_UNLIKELY (xvimagesink->xwindow == NULL)) {
- g_mutex_unlock (xvimagesink->flow_lock);
- return FALSE;
- }
-
- /* Draw borders when displaying the first frame. After this
- draw borders only on expose event or after a size change. */
- if (!xvimagesink->cur_image || xvimagesink->redraw_border) {
- draw_border = TRUE;
- }
-
- /* Store a reference to the last image we put, lose the previous one */
- if (xvimage && xvimagesink->cur_image != xvimage) {
- if (xvimagesink->cur_image) {
- GST_LOG_OBJECT (xvimagesink, "unreffing %p", xvimagesink->cur_image);
- gst_buffer_unref (GST_BUFFER_CAST (xvimagesink->cur_image));
- }
- GST_LOG_OBJECT (xvimagesink, "reffing %p as our current image", xvimage);
- xvimagesink->cur_image =
- GST_XVIMAGE_BUFFER_CAST (gst_buffer_ref (GST_BUFFER_CAST (xvimage)));
- }
-
- /* Expose sends a NULL image, we take the latest frame */
- if (!xvimage) {
- if (xvimagesink->cur_image) {
- draw_border = TRUE;
- xvimage = xvimagesink->cur_image;
- } else {
- g_mutex_unlock (xvimagesink->flow_lock);
- return TRUE;
- }
- }
-
- gst_xvimagesink_xwindow_update_geometry (xvimagesink, xvimagesink->xwindow);
-
- /* We use the calculated geometry from _setcaps as a source to respect
- source and screen pixel aspect ratios. */
- src.w = GST_VIDEO_SINK_WIDTH (xvimagesink);
- src.h = GST_VIDEO_SINK_HEIGHT (xvimagesink);
- dst.w = xvimagesink->xwindow->width;
- dst.h = xvimagesink->xwindow->height;
-
- if (xvimagesink->keep_aspect) {
- gst_video_sink_center_rect (src, dst, &result, TRUE);
- } else {
- result.x = result.y = 0;
- result.w = dst.w;
- result.h = dst.h;
- }
-
- g_mutex_lock (xvimagesink->x_lock);
-
- if (draw_border && xvimagesink->draw_borders) {
- gst_xvimagesink_xwindow_draw_borders (xvimagesink, xvimagesink->xwindow,
- result);
- xvimagesink->redraw_border = FALSE;
- }
-
- /* We scale to the window's geometry */
-#ifdef HAVE_XSHM
- if (xvimagesink->xcontext->use_xshm) {
- GST_LOG_OBJECT (xvimagesink,
- "XvShmPutImage with image %dx%d and window %dx%d, from xvimage %"
- GST_PTR_FORMAT,
- xvimage->width, xvimage->height,
- xvimagesink->xwindow->width, xvimagesink->xwindow->height, xvimage);
-
- XvShmPutImage (xvimagesink->xcontext->disp,
- xvimagesink->xcontext->xv_port_id,
- xvimagesink->xwindow->win,
- xvimagesink->xwindow->gc, xvimage->xvimage,
- xvimagesink->disp_x, xvimagesink->disp_y,
- xvimagesink->disp_width, xvimagesink->disp_height,
- result.x, result.y, result.w, result.h, FALSE);
- } else
-#endif /* HAVE_XSHM */
- {
- XvPutImage (xvimagesink->xcontext->disp,
- xvimagesink->xcontext->xv_port_id,
- xvimagesink->xwindow->win,
- xvimagesink->xwindow->gc, xvimage->xvimage,
- xvimagesink->disp_x, xvimagesink->disp_y,
- xvimagesink->disp_width, xvimagesink->disp_height,
- result.x, result.y, result.w, result.h);
- }
-
- XSync (xvimagesink->xcontext->disp, FALSE);
-
- g_mutex_unlock (xvimagesink->x_lock);
-
- g_mutex_unlock (xvimagesink->flow_lock);
-
- return TRUE;
-}
-
-static gboolean
-gst_xvimagesink_xwindow_decorate (GstXvImageSink * xvimagesink,
- GstXWindow * window)
-{
- Atom hints_atom = None;
- MotifWmHints *hints;
-
- g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), FALSE);
- g_return_val_if_fail (window != NULL, FALSE);
-
- g_mutex_lock (xvimagesink->x_lock);
-
- hints_atom = XInternAtom (xvimagesink->xcontext->disp, "_MOTIF_WM_HINTS",
- True);
- if (hints_atom == None) {
- g_mutex_unlock (xvimagesink->x_lock);
- return FALSE;
- }
-
- hints = g_malloc0 (sizeof (MotifWmHints));
-
- hints->flags |= MWM_HINTS_DECORATIONS;
- hints->decorations = 1 << 0;
-
- XChangeProperty (xvimagesink->xcontext->disp, window->win,
- hints_atom, hints_atom, 32, PropModeReplace,
- (guchar *) hints, sizeof (MotifWmHints) / sizeof (long));
-
- XSync (xvimagesink->xcontext->disp, FALSE);
-
- g_mutex_unlock (xvimagesink->x_lock);
-
- g_free (hints);
-
- return TRUE;
-}
-
-static void
-gst_xvimagesink_xwindow_set_title (GstXvImageSink * xvimagesink,
- GstXWindow * xwindow, const gchar * media_title)
-{
- if (media_title) {
- g_free (xvimagesink->media_title);
- xvimagesink->media_title = g_strdup (media_title);
- }
- if (xwindow) {
- /* we have a window */
- if (xwindow->internal) {
- XTextProperty xproperty;
- const gchar *app_name;
- const gchar *title = NULL;
- gchar *title_mem = NULL;
-
- /* set application name as a title */
- app_name = g_get_application_name ();
-
- if (app_name && xvimagesink->media_title) {
- title = title_mem = g_strconcat (xvimagesink->media_title, " : ",
- app_name, NULL);
- } else if (app_name) {
- title = app_name;
- } else if (xvimagesink->media_title) {
- title = xvimagesink->media_title;
- }
-
- if (title) {
- if ((XStringListToTextProperty (((char **) &title), 1,
- &xproperty)) != 0) {
- XSetWMName (xvimagesink->xcontext->disp, xwindow->win, &xproperty);
- XFree (xproperty.value);
- }
-
- g_free (title_mem);
- }
- }
- }
-}
-
-/* This function handles a GstXWindow creation
- * The width and height are the actual pixel size on the display */
-static GstXWindow *
-gst_xvimagesink_xwindow_new (GstXvImageSink * xvimagesink,
- gint width, gint height)
-{
- GstXWindow *xwindow = NULL;
- XGCValues values;
-
- g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), NULL);
-
- xwindow = g_new0 (GstXWindow, 1);
-
- xwindow->width = width;
- xwindow->height = height;
- xwindow->internal = TRUE;
-
- g_mutex_lock (xvimagesink->x_lock);
-
- xwindow->win = XCreateSimpleWindow (xvimagesink->xcontext->disp,
- xvimagesink->xcontext->root,
- 0, 0, xwindow->width, xwindow->height,
- 0, 0, xvimagesink->xcontext->black);
-
- /* We have to do that to prevent X from redrawing the background on
- * ConfigureNotify. This takes away flickering of video when resizing. */
- XSetWindowBackgroundPixmap (xvimagesink->xcontext->disp, xwindow->win, None);
-
- /* set application name as a title */
- gst_xvimagesink_xwindow_set_title (xvimagesink, xwindow, NULL);
-
- if (xvimagesink->handle_events) {
- Atom wm_delete;
-
- XSelectInput (xvimagesink->xcontext->disp, xwindow->win, ExposureMask |
- StructureNotifyMask | PointerMotionMask | KeyPressMask |
- KeyReleaseMask | ButtonPressMask | ButtonReleaseMask);
-
- /* Tell the window manager we'd like delete client messages instead of
- * being killed */
- wm_delete = XInternAtom (xvimagesink->xcontext->disp,
- "WM_DELETE_WINDOW", True);
- if (wm_delete != None) {
- (void) XSetWMProtocols (xvimagesink->xcontext->disp, xwindow->win,
- &wm_delete, 1);
- }
- }
-
- xwindow->gc = XCreateGC (xvimagesink->xcontext->disp,
- xwindow->win, 0, &values);
-
- XMapRaised (xvimagesink->xcontext->disp, xwindow->win);
-
- XSync (xvimagesink->xcontext->disp, FALSE);
-
- g_mutex_unlock (xvimagesink->x_lock);
-
- gst_xvimagesink_xwindow_decorate (xvimagesink, xwindow);
-
- gst_x_overlay_got_xwindow_id (GST_X_OVERLAY (xvimagesink), xwindow->win);
-
- return xwindow;
-}
-
-/* This function destroys a GstXWindow */
-static void
-gst_xvimagesink_xwindow_destroy (GstXvImageSink * xvimagesink,
- GstXWindow * xwindow)
-{
- g_return_if_fail (xwindow != NULL);
- g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
-
- g_mutex_lock (xvimagesink->x_lock);
-
- /* If we did not create that window we just free the GC and let it live */
- if (xwindow->internal)
- XDestroyWindow (xvimagesink->xcontext->disp, xwindow->win);
- else
- XSelectInput (xvimagesink->xcontext->disp, xwindow->win, 0);
-
- XFreeGC (xvimagesink->xcontext->disp, xwindow->gc);
-
- XSync (xvimagesink->xcontext->disp, FALSE);
-
- g_mutex_unlock (xvimagesink->x_lock);
-
- g_free (xwindow);
-}
-
-static void
-gst_xvimagesink_xwindow_update_geometry (GstXvImageSink * xvimagesink,
- GstXWindow * xwindow)
-{
- XWindowAttributes attr;
-
- g_return_if_fail (xwindow != NULL);
- g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
-
- /* Update the window geometry */
- g_mutex_lock (xvimagesink->x_lock);
-
- XGetWindowAttributes (xvimagesink->xcontext->disp,
- xvimagesink->xwindow->win, &attr);
-
- xvimagesink->xwindow->width = attr.width;
- xvimagesink->xwindow->height = attr.height;
-
- g_mutex_unlock (xvimagesink->x_lock);
-}
-
-static void
-gst_xvimagesink_xwindow_clear (GstXvImageSink * xvimagesink,
- GstXWindow * xwindow)
-{
- g_return_if_fail (xwindow != NULL);
- g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
-
- g_mutex_lock (xvimagesink->x_lock);
-
- XvStopVideo (xvimagesink->xcontext->disp, xvimagesink->xcontext->xv_port_id,
- xwindow->win);
-
- XSetForeground (xvimagesink->xcontext->disp, xwindow->gc,
- xvimagesink->xcontext->black);
-
- XFillRectangle (xvimagesink->xcontext->disp, xwindow->win, xwindow->gc,
- 0, 0, xwindow->width, xwindow->height);
-
- XSync (xvimagesink->xcontext->disp, FALSE);
-
- g_mutex_unlock (xvimagesink->x_lock);
-}
-
-/* This function commits our internal colorbalance settings to our grabbed Xv
- port. If the xcontext is not initialized yet it simply returns */
-static void
-gst_xvimagesink_update_colorbalance (GstXvImageSink * xvimagesink)
-{
- GList *channels = NULL;
-
- g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
-
- /* If we haven't initialized the X context we can't update anything */
- if (xvimagesink->xcontext == NULL)
- return;
-
- /* Don't set the attributes if they haven't been changed, to avoid
- * rounding errors changing the values */
- if (!xvimagesink->cb_changed)
- return;
-
- /* For each channel of the colorbalance we calculate the correct value
- doing range conversion and then set the Xv port attribute to match our
- values. */
- channels = xvimagesink->xcontext->channels_list;
-
- while (channels) {
- if (channels->data && GST_IS_COLOR_BALANCE_CHANNEL (channels->data)) {
- GstColorBalanceChannel *channel = NULL;
- Atom prop_atom;
- gint value = 0;
- gdouble convert_coef;
-
- channel = GST_COLOR_BALANCE_CHANNEL (channels->data);
- g_object_ref (channel);
-
- /* Our range conversion coef */
- convert_coef = (channel->max_value - channel->min_value) / 2000.0;
-
- if (g_ascii_strcasecmp (channel->label, "XV_HUE") == 0) {
- value = xvimagesink->hue;
- } else if (g_ascii_strcasecmp (channel->label, "XV_SATURATION") == 0) {
- value = xvimagesink->saturation;
- } else if (g_ascii_strcasecmp (channel->label, "XV_CONTRAST") == 0) {
- value = xvimagesink->contrast;
- } else if (g_ascii_strcasecmp (channel->label, "XV_BRIGHTNESS") == 0) {
- value = xvimagesink->brightness;
- } else {
- g_warning ("got an unknown channel %s", channel->label);
- g_object_unref (channel);
- return;
- }
-
- /* Committing to Xv port */
- g_mutex_lock (xvimagesink->x_lock);
- prop_atom =
- XInternAtom (xvimagesink->xcontext->disp, channel->label, True);
- if (prop_atom != None) {
- int xv_value;
- xv_value =
- floor (0.5 + (value + 1000) * convert_coef + channel->min_value);
- XvSetPortAttribute (xvimagesink->xcontext->disp,
- xvimagesink->xcontext->xv_port_id, prop_atom, xv_value);
- }
- g_mutex_unlock (xvimagesink->x_lock);
-
- g_object_unref (channel);
- }
- channels = g_list_next (channels);
- }
-}
-
-/* This function handles XEvents that might be in the queue. It generates
- GstEvent that will be sent upstream in the pipeline to handle interactivity
- and navigation. It will also listen for configure events on the window to
- trigger caps renegotiation so on the fly software scaling can work. */
-static void
-gst_xvimagesink_handle_xevents (GstXvImageSink * xvimagesink)
-{
- XEvent e;
- guint pointer_x = 0, pointer_y = 0;
- gboolean pointer_moved = FALSE;
- gboolean exposed = FALSE, configured = FALSE;
-
- g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
-
- /* Handle Interaction, produces navigation events */
-
- /* We get all pointer motion events, only the last position is
- interesting. */
- g_mutex_lock (xvimagesink->flow_lock);
- g_mutex_lock (xvimagesink->x_lock);
- while (XCheckWindowEvent (xvimagesink->xcontext->disp,
- xvimagesink->xwindow->win, PointerMotionMask, &e)) {
- g_mutex_unlock (xvimagesink->x_lock);
- g_mutex_unlock (xvimagesink->flow_lock);
-
- switch (e.type) {
- case MotionNotify:
- pointer_x = e.xmotion.x;
- pointer_y = e.xmotion.y;
- pointer_moved = TRUE;
- break;
- default:
- break;
- }
- g_mutex_lock (xvimagesink->flow_lock);
- g_mutex_lock (xvimagesink->x_lock);
- }
- if (pointer_moved) {
- g_mutex_unlock (xvimagesink->x_lock);
- g_mutex_unlock (xvimagesink->flow_lock);
-
- GST_DEBUG ("xvimagesink pointer moved over window at %d,%d",
- pointer_x, pointer_y);
- gst_navigation_send_mouse_event (GST_NAVIGATION (xvimagesink),
- "mouse-move", 0, e.xbutton.x, e.xbutton.y);
-
- g_mutex_lock (xvimagesink->flow_lock);
- g_mutex_lock (xvimagesink->x_lock);
- }
-
- /* We get all events on our window to throw them upstream */
- while (XCheckWindowEvent (xvimagesink->xcontext->disp,
- xvimagesink->xwindow->win,
- KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask,
- &e)) {
- KeySym keysym;
-
- /* We lock only for the X function call */
- g_mutex_unlock (xvimagesink->x_lock);
- g_mutex_unlock (xvimagesink->flow_lock);
-
- switch (e.type) {
- case ButtonPress:
- /* Mouse button pressed over our window. We send upstream
- events for interactivity/navigation */
- GST_DEBUG ("xvimagesink button %d pressed over window at %d,%d",
- e.xbutton.button, e.xbutton.x, e.xbutton.y);
- gst_navigation_send_mouse_event (GST_NAVIGATION (xvimagesink),
- "mouse-button-press", e.xbutton.button, e.xbutton.x, e.xbutton.y);
- break;
- case ButtonRelease:
- /* Mouse button released over our window. We send upstream
- events for interactivity/navigation */
- GST_DEBUG ("xvimagesink button %d released over window at %d,%d",
- e.xbutton.button, e.xbutton.x, e.xbutton.y);
- gst_navigation_send_mouse_event (GST_NAVIGATION (xvimagesink),
- "mouse-button-release", e.xbutton.button, e.xbutton.x, e.xbutton.y);
- break;
- case KeyPress:
- case KeyRelease:
- /* Key pressed/released over our window. We send upstream
- events for interactivity/navigation */
- GST_DEBUG ("xvimagesink key %d pressed over window at %d,%d",
- e.xkey.keycode, e.xkey.x, e.xkey.y);
- g_mutex_lock (xvimagesink->x_lock);
- keysym = XKeycodeToKeysym (xvimagesink->xcontext->disp,
- e.xkey.keycode, 0);
- g_mutex_unlock (xvimagesink->x_lock);
- if (keysym != NoSymbol) {
- char *key_str = NULL;
-
- g_mutex_lock (xvimagesink->x_lock);
- key_str = XKeysymToString (keysym);
- g_mutex_unlock (xvimagesink->x_lock);
- gst_navigation_send_key_event (GST_NAVIGATION (xvimagesink),
- e.type == KeyPress ? "key-press" : "key-release", key_str);
- } else {
- gst_navigation_send_key_event (GST_NAVIGATION (xvimagesink),
- e.type == KeyPress ? "key-press" : "key-release", "unknown");
- }
- break;
- default:
- GST_DEBUG ("xvimagesink unhandled X event (%d)", e.type);
- }
- g_mutex_lock (xvimagesink->flow_lock);
- g_mutex_lock (xvimagesink->x_lock);
- }
-
- /* Handle Expose */
- while (XCheckWindowEvent (xvimagesink->xcontext->disp,
- xvimagesink->xwindow->win, ExposureMask | StructureNotifyMask, &e)) {
- switch (e.type) {
- case Expose:
- exposed = TRUE;
- break;
- case ConfigureNotify:
- configured = TRUE;
- break;
- default:
- break;
- }
- }
-
- if (xvimagesink->handle_expose && (exposed || configured)) {
- g_mutex_unlock (xvimagesink->x_lock);
- g_mutex_unlock (xvimagesink->flow_lock);
-
- gst_xvimagesink_expose (GST_X_OVERLAY (xvimagesink));
-
- g_mutex_lock (xvimagesink->flow_lock);
- g_mutex_lock (xvimagesink->x_lock);
- }
-
- /* Handle Display events */
- while (XPending (xvimagesink->xcontext->disp)) {
- XNextEvent (xvimagesink->xcontext->disp, &e);
-
- switch (e.type) {
- case ClientMessage:{
- Atom wm_delete;
-
- wm_delete = XInternAtom (xvimagesink->xcontext->disp,
- "WM_DELETE_WINDOW", True);
- if (wm_delete != None && wm_delete == (Atom) e.xclient.data.l[0]) {
- /* Handle window deletion by posting an error on the bus */
- GST_ELEMENT_ERROR (xvimagesink, RESOURCE, NOT_FOUND,
- ("Output window was closed"), (NULL));
-
- g_mutex_unlock (xvimagesink->x_lock);
- gst_xvimagesink_xwindow_destroy (xvimagesink, xvimagesink->xwindow);
- xvimagesink->xwindow = NULL;
- g_mutex_lock (xvimagesink->x_lock);
- }
- break;
- }
- default:
- break;
- }
- }
-
- g_mutex_unlock (xvimagesink->x_lock);
- g_mutex_unlock (xvimagesink->flow_lock);
-}
-
-static void
-gst_lookup_xv_port_from_adaptor (GstXContext * xcontext,
- XvAdaptorInfo * adaptors, int adaptor_no)
-{
- gint j;
- gint res;
-
- /* Do we support XvImageMask ? */
- if (!(adaptors[adaptor_no].type & XvImageMask)) {
- GST_DEBUG ("XV Adaptor %s has no support for XvImageMask",
- adaptors[adaptor_no].name);
- return;
- }
-
- /* We found such an adaptor, looking for an available port */
- for (j = 0; j < adaptors[adaptor_no].num_ports && !xcontext->xv_port_id; j++) {
- /* We try to grab the port */
- res = XvGrabPort (xcontext->disp, adaptors[adaptor_no].base_id + j, 0);
- if (Success == res) {
- xcontext->xv_port_id = adaptors[adaptor_no].base_id + j;
- GST_DEBUG ("XV Adaptor %s with %ld ports", adaptors[adaptor_no].name,
- adaptors[adaptor_no].num_ports);
- } else {
- GST_DEBUG ("GrabPort %d for XV Adaptor %s failed: %d", j,
- adaptors[adaptor_no].name, res);
- }
- }
-}
-
-/* This function generates a caps with all supported format by the first
- Xv grabable port we find. We store each one of the supported formats in a
- format list and append the format to a newly created caps that we return
- If this function does not return NULL because of an error, it also grabs
- the port via XvGrabPort */
-static GstCaps *
-gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
- GstXContext * xcontext)
-{
- gint i;
- XvAdaptorInfo *adaptors;
- gint nb_formats;
- XvImageFormatValues *formats = NULL;
- guint nb_encodings;
- XvEncodingInfo *encodings = NULL;
- gulong max_w = G_MAXINT, max_h = G_MAXINT;
- GstCaps *caps = NULL;
- GstCaps *rgb_caps = NULL;
-
- g_return_val_if_fail (xcontext != NULL, NULL);
-
- /* First let's check that XVideo extension is available */
- if (!XQueryExtension (xcontext->disp, "XVideo", &i, &i, &i)) {
- GST_ELEMENT_ERROR (xvimagesink, RESOURCE, SETTINGS,
- ("Could not initialise Xv output"),
- ("XVideo extension is not available"));
- return NULL;
- }
-
- /* Then we get adaptors list */
- if (Success != XvQueryAdaptors (xcontext->disp, xcontext->root,
- &xcontext->nb_adaptors, &adaptors)) {
- GST_ELEMENT_ERROR (xvimagesink, RESOURCE, SETTINGS,
- ("Could not initialise Xv output"),
- ("Failed getting XV adaptors list"));
- return NULL;
- }
-
- xcontext->xv_port_id = 0;
-
- GST_DEBUG ("Found %u XV adaptor(s)", xcontext->nb_adaptors);
-
- xcontext->adaptors =
- (gchar **) g_malloc0 (xcontext->nb_adaptors * sizeof (gchar *));
-
- /* Now fill up our adaptor name array */
- for (i = 0; i < xcontext->nb_adaptors; i++) {
- xcontext->adaptors[i] = g_strdup (adaptors[i].name);
- }
-
- if (xvimagesink->adaptor_no >= 0 &&
- xvimagesink->adaptor_no < xcontext->nb_adaptors) {
- /* Find xv port from user defined adaptor */
- gst_lookup_xv_port_from_adaptor (xcontext, adaptors,
- xvimagesink->adaptor_no);
- }
-
- if (!xcontext->xv_port_id) {
- /* Now search for an adaptor that supports XvImageMask */
- for (i = 0; i < xcontext->nb_adaptors && !xcontext->xv_port_id; i++) {
- gst_lookup_xv_port_from_adaptor (xcontext, adaptors, i);
- xvimagesink->adaptor_no = i;
- }
- }
-
- XvFreeAdaptorInfo (adaptors);
-
- if (!xcontext->xv_port_id) {
- xvimagesink->adaptor_no = -1;
- GST_ELEMENT_ERROR (xvimagesink, RESOURCE, BUSY,
- ("Could not initialise Xv output"), ("No port available"));
- return NULL;
- }
-
- /* Set XV_AUTOPAINT_COLORKEY and XV_DOUBLE_BUFFER and XV_COLORKEY */
- {
- int count, todo = 3;
- XvAttribute *const attr = XvQueryPortAttributes (xcontext->disp,
- xcontext->xv_port_id, &count);
- static const char autopaint[] = "XV_AUTOPAINT_COLORKEY";
- static const char dbl_buffer[] = "XV_DOUBLE_BUFFER";
- static const char colorkey[] = "XV_COLORKEY";
-
- GST_DEBUG_OBJECT (xvimagesink, "Checking %d Xv port attributes", count);
-
- xvimagesink->have_autopaint_colorkey = FALSE;
- xvimagesink->have_double_buffer = FALSE;
- xvimagesink->have_colorkey = FALSE;
-
- for (i = 0; ((i < count) && todo); i++)
- if (!strcmp (attr[i].name, autopaint)) {
- const Atom atom = XInternAtom (xcontext->disp, autopaint, False);
-
- /* turn on autopaint colorkey */
- XvSetPortAttribute (xcontext->disp, xcontext->xv_port_id, atom,
- (xvimagesink->autopaint_colorkey ? 1 : 0));
- todo--;
- xvimagesink->have_autopaint_colorkey = TRUE;
- } else if (!strcmp (attr[i].name, dbl_buffer)) {
- const Atom atom = XInternAtom (xcontext->disp, dbl_buffer, False);
-
- XvSetPortAttribute (xcontext->disp, xcontext->xv_port_id, atom,
- (xvimagesink->double_buffer ? 1 : 0));
- todo--;
- xvimagesink->have_double_buffer = TRUE;
- } else if (!strcmp (attr[i].name, colorkey)) {
- /* Set the colorkey, default is something that is dark but hopefully
- * won't randomly appear on the screen elsewhere (ie not black or greys)
- * can be overridden by setting "colorkey" property
- */
- const Atom atom = XInternAtom (xcontext->disp, colorkey, False);
- guint32 ckey = 0;
- gboolean set_attr = TRUE;
- guint cr, cg, cb;
-
- /* set a colorkey in the right format RGB565/RGB888
- * We only handle these 2 cases, because they're the only types of
- * devices we've encountered. If we don't recognise it, leave it alone
- */
- cr = (xvimagesink->colorkey >> 16);
- cg = (xvimagesink->colorkey >> 8) & 0xFF;
- cb = (xvimagesink->colorkey) & 0xFF;
- switch (xcontext->depth) {
- case 16: /* RGB 565 */
- cr >>= 3;
- cg >>= 2;
- cb >>= 3;
- ckey = (cr << 11) | (cg << 5) | cb;
- break;
- case 24:
- case 32: /* RGB 888 / ARGB 8888 */
- ckey = (cr << 16) | (cg << 8) | cb;
- break;
- default:
- GST_DEBUG_OBJECT (xvimagesink,
- "Unknown bit depth %d for Xv Colorkey - not adjusting",
- xcontext->depth);
- set_attr = FALSE;
- break;
- }
-
- if (set_attr) {
- ckey = CLAMP (ckey, (guint32) attr[i].min_value,
- (guint32) attr[i].max_value);
- GST_LOG_OBJECT (xvimagesink,
- "Setting color key for display depth %d to 0x%x",
- xcontext->depth, ckey);
-
- XvSetPortAttribute (xcontext->disp, xcontext->xv_port_id, atom,
- (gint) ckey);
- }
- todo--;
- xvimagesink->have_colorkey = TRUE;
- }
-
- XFree (attr);
- }
-
- /* Get the list of encodings supported by the adapter and look for the
- * XV_IMAGE encoding so we can determine the maximum width and height
- * supported */
- XvQueryEncodings (xcontext->disp, xcontext->xv_port_id, &nb_encodings,
- &encodings);
-
- for (i = 0; i < nb_encodings; i++) {
- GST_LOG_OBJECT (xvimagesink,
- "Encoding %d, name %s, max wxh %lux%lu rate %d/%d",
- i, encodings[i].name, encodings[i].width, encodings[i].height,
- encodings[i].rate.numerator, encodings[i].rate.denominator);
- if (strcmp (encodings[i].name, "XV_IMAGE") == 0) {
- max_w = encodings[i].width;
- max_h = encodings[i].height;
- }
- }
-
- XvFreeEncodingInfo (encodings);
-
- /* We get all image formats supported by our port */
- formats = XvListImageFormats (xcontext->disp,
- xcontext->xv_port_id, &nb_formats);
- caps = gst_caps_new_empty ();
- for (i = 0; i < nb_formats; i++) {
- GstCaps *format_caps = NULL;
- gboolean is_rgb_format = FALSE;
-
- /* We set the image format of the xcontext to an existing one. This
- is just some valid image format for making our xshm calls check before
- caps negotiation really happens. */
- xcontext->im_format = formats[i].id;
-
- switch (formats[i].type) {
- case XvRGB:
- {
- XvImageFormatValues *fmt = &(formats[i]);
- gint endianness = G_BIG_ENDIAN;
-
- if (fmt->byte_order == LSBFirst) {
- /* our caps system handles 24/32bpp RGB as big-endian. */
- if (fmt->bits_per_pixel == 24 || fmt->bits_per_pixel == 32) {
- fmt->red_mask = GUINT32_TO_BE (fmt->red_mask);
- fmt->green_mask = GUINT32_TO_BE (fmt->green_mask);
- fmt->blue_mask = GUINT32_TO_BE (fmt->blue_mask);
-
- if (fmt->bits_per_pixel == 24) {
- fmt->red_mask >>= 8;
- fmt->green_mask >>= 8;
- fmt->blue_mask >>= 8;
- }
- } else
- endianness = G_LITTLE_ENDIAN;
- }
-
- format_caps = gst_caps_new_simple ("video/x-raw-rgb",
- "endianness", G_TYPE_INT, endianness,
- "depth", G_TYPE_INT, fmt->depth,
- "bpp", G_TYPE_INT, fmt->bits_per_pixel,
- "red_mask", G_TYPE_INT, fmt->red_mask,
- "green_mask", G_TYPE_INT, fmt->green_mask,
- "blue_mask", G_TYPE_INT, fmt->blue_mask,
- "width", GST_TYPE_INT_RANGE, 1, max_w,
- "height", GST_TYPE_INT_RANGE, 1, max_h,
- "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
-
- is_rgb_format = TRUE;
- break;
- }
- case XvYUV:
- format_caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, formats[i].id,
- "width", GST_TYPE_INT_RANGE, 1, max_w,
- "height", GST_TYPE_INT_RANGE, 1, max_h,
- "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-
- if (format_caps) {
- GstXvImageFormat *format = NULL;
-
- format = g_new0 (GstXvImageFormat, 1);
- if (format) {
- format->format = formats[i].id;
- format->caps = gst_caps_copy (format_caps);
- xcontext->formats_list = g_list_append (xcontext->formats_list, format);
- }
-
- if (is_rgb_format) {
- if (rgb_caps == NULL)
- rgb_caps = format_caps;
- else
- gst_caps_append (rgb_caps, format_caps);
- } else
- gst_caps_append (caps, format_caps);
- }
- }
-
- /* Collected all caps into either the caps or rgb_caps structures.
- * Append rgb_caps on the end of YUV, so that YUV is always preferred */
- if (rgb_caps)
- gst_caps_append (caps, rgb_caps);
-
- if (formats)
- XFree (formats);
-
- GST_DEBUG ("Generated the following caps: %" GST_PTR_FORMAT, caps);
-
- if (gst_caps_is_empty (caps)) {
- gst_caps_unref (caps);
- XvUngrabPort (xcontext->disp, xcontext->xv_port_id, 0);
- GST_ELEMENT_ERROR (xvimagesink, STREAM, WRONG_TYPE, (NULL),
- ("No supported format found"));
- return NULL;
- }
-
- return caps;
-}
-
-static gpointer
-gst_xvimagesink_event_thread (GstXvImageSink * xvimagesink)
-{
- g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), NULL);
-
- GST_OBJECT_LOCK (xvimagesink);
- while (xvimagesink->running) {
- GST_OBJECT_UNLOCK (xvimagesink);
-
- if (xvimagesink->xwindow) {
- gst_xvimagesink_handle_xevents (xvimagesink);
- }
- /* FIXME: do we want to align this with the framerate or anything else? */
- g_usleep (G_USEC_PER_SEC / 20);
-
- GST_OBJECT_LOCK (xvimagesink);
- }
- GST_OBJECT_UNLOCK (xvimagesink);
-
- return NULL;
-}
-
-static void
-gst_xvimagesink_manage_event_thread (GstXvImageSink * xvimagesink)
-{
- GThread *thread = NULL;
-
- /* don't start the thread too early */
- if (xvimagesink->xcontext == NULL) {
- return;
- }
-
- GST_OBJECT_LOCK (xvimagesink);
- if (xvimagesink->handle_expose || xvimagesink->handle_events) {
- if (!xvimagesink->event_thread) {
- /* Setup our event listening thread */
- GST_DEBUG_OBJECT (xvimagesink, "run xevent thread, expose %d, events %d",
- xvimagesink->handle_expose, xvimagesink->handle_events);
- xvimagesink->running = TRUE;
- xvimagesink->event_thread = g_thread_create (
- (GThreadFunc) gst_xvimagesink_event_thread, xvimagesink, TRUE, NULL);
- }
- } else {
- if (xvimagesink->event_thread) {
- GST_DEBUG_OBJECT (xvimagesink, "stop xevent thread, expose %d, events %d",
- xvimagesink->handle_expose, xvimagesink->handle_events);
- xvimagesink->running = FALSE;
- /* grab thread and mark it as NULL */
- thread = xvimagesink->event_thread;
- xvimagesink->event_thread = NULL;
- }
- }
- GST_OBJECT_UNLOCK (xvimagesink);
-
- /* Wait for our event thread to finish */
- if (thread)
- g_thread_join (thread);
-
-}
-
-
-/* This function calculates the pixel aspect ratio based on the properties
- * in the xcontext structure and stores it there. */
-static void
-gst_xvimagesink_calculate_pixel_aspect_ratio (GstXContext * xcontext)
-{
- static const gint par[][2] = {
- {1, 1}, /* regular screen */
- {16, 15}, /* PAL TV */
- {11, 10}, /* 525 line Rec.601 video */
- {54, 59}, /* 625 line Rec.601 video */
- {64, 45}, /* 1280x1024 on 16:9 display */
- {5, 3}, /* 1280x1024 on 4:3 display */
- {4, 3} /* 800x600 on 16:9 display */
- };
- gint i;
- gint index;
- gdouble ratio;
- gdouble delta;
-
-#define DELTA(idx) (ABS (ratio - ((gdouble) par[idx][0] / par[idx][1])))
-
- /* first calculate the "real" ratio based on the X values;
- * which is the "physical" w/h divided by the w/h in pixels of the display */
- ratio = (gdouble) (xcontext->widthmm * xcontext->height)
- / (xcontext->heightmm * xcontext->width);
-
- /* DirectFB's X in 720x576 reports the physical dimensions wrong, so
- * override here */
- if (xcontext->width == 720 && xcontext->height == 576) {
- ratio = 4.0 * 576 / (3.0 * 720);
- }
- GST_DEBUG ("calculated pixel aspect ratio: %f", ratio);
- /* now find the one from par[][2] with the lowest delta to the real one */
- delta = DELTA (0);
- index = 0;
-
- for (i = 1; i < sizeof (par) / (sizeof (gint) * 2); ++i) {
- gdouble this_delta = DELTA (i);
-
- if (this_delta < delta) {
- index = i;
- delta = this_delta;
- }
- }
-
- GST_DEBUG ("Decided on index %d (%d/%d)", index,
- par[index][0], par[index][1]);
-
- g_free (xcontext->par);
- xcontext->par = g_new0 (GValue, 1);
- g_value_init (xcontext->par, GST_TYPE_FRACTION);
- gst_value_set_fraction (xcontext->par, par[index][0], par[index][1]);
- GST_DEBUG ("set xcontext PAR to %d/%d",
- gst_value_get_fraction_numerator (xcontext->par),
- gst_value_get_fraction_denominator (xcontext->par));
-}
-
-/* This function gets the X Display and global info about it. Everything is
- stored in our object and will be cleaned when the object is disposed. Note
- here that caps for supported format are generated without any window or
- image creation */
-static GstXContext *
-gst_xvimagesink_xcontext_get (GstXvImageSink * xvimagesink)
-{
- GstXContext *xcontext = NULL;
- XPixmapFormatValues *px_formats = NULL;
- gint nb_formats = 0, i, j, N_attr;
- XvAttribute *xv_attr;
- Atom prop_atom;
- char *channels[4] = { "XV_HUE", "XV_SATURATION",
- "XV_BRIGHTNESS", "XV_CONTRAST"
- };
-
- g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), NULL);
-
- xcontext = g_new0 (GstXContext, 1);
- xcontext->im_format = 0;
-
- g_mutex_lock (xvimagesink->x_lock);
-
- xcontext->disp = XOpenDisplay (xvimagesink->display_name);
-
- if (!xcontext->disp) {
- g_mutex_unlock (xvimagesink->x_lock);
- g_free (xcontext);
- GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
- ("Could not initialise Xv output"), ("Could not open display"));
- return NULL;
- }
-
- xcontext->screen = DefaultScreenOfDisplay (xcontext->disp);
- xcontext->screen_num = DefaultScreen (xcontext->disp);
- xcontext->visual = DefaultVisual (xcontext->disp, xcontext->screen_num);
- xcontext->root = DefaultRootWindow (xcontext->disp);
- xcontext->white = XWhitePixel (xcontext->disp, xcontext->screen_num);
- xcontext->black = XBlackPixel (xcontext->disp, xcontext->screen_num);
- xcontext->depth = DefaultDepthOfScreen (xcontext->screen);
-
- xcontext->width = DisplayWidth (xcontext->disp, xcontext->screen_num);
- xcontext->height = DisplayHeight (xcontext->disp, xcontext->screen_num);
- xcontext->widthmm = DisplayWidthMM (xcontext->disp, xcontext->screen_num);
- xcontext->heightmm = DisplayHeightMM (xcontext->disp, xcontext->screen_num);
-
- GST_DEBUG_OBJECT (xvimagesink, "X reports %dx%d pixels and %d mm x %d mm",
- xcontext->width, xcontext->height, xcontext->widthmm, xcontext->heightmm);
-
- gst_xvimagesink_calculate_pixel_aspect_ratio (xcontext);
- /* We get supported pixmap formats at supported depth */
- px_formats = XListPixmapFormats (xcontext->disp, &nb_formats);
-
- if (!px_formats) {
- XCloseDisplay (xcontext->disp);
- g_mutex_unlock (xvimagesink->x_lock);
- g_free (xcontext->par);
- g_free (xcontext);
- GST_ELEMENT_ERROR (xvimagesink, RESOURCE, SETTINGS,
- ("Could not initialise Xv output"), ("Could not get pixel formats"));
- return NULL;
- }
-
- /* We get bpp value corresponding to our running depth */
- for (i = 0; i < nb_formats; i++) {
- if (px_formats[i].depth == xcontext->depth)
- xcontext->bpp = px_formats[i].bits_per_pixel;
- }
-
- XFree (px_formats);
-
- xcontext->endianness =
- (ImageByteOrder (xcontext->disp) ==
- LSBFirst) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
-
- /* our caps system handles 24/32bpp RGB as big-endian. */
- if ((xcontext->bpp == 24 || xcontext->bpp == 32) &&
- xcontext->endianness == G_LITTLE_ENDIAN) {
- xcontext->endianness = G_BIG_ENDIAN;
- xcontext->visual->red_mask = GUINT32_TO_BE (xcontext->visual->red_mask);
- xcontext->visual->green_mask = GUINT32_TO_BE (xcontext->visual->green_mask);
- xcontext->visual->blue_mask = GUINT32_TO_BE (xcontext->visual->blue_mask);
- if (xcontext->bpp == 24) {
- xcontext->visual->red_mask >>= 8;
- xcontext->visual->green_mask >>= 8;
- xcontext->visual->blue_mask >>= 8;
- }
- }
-
- xcontext->caps = gst_xvimagesink_get_xv_support (xvimagesink, xcontext);
-
- if (!xcontext->caps) {
- XCloseDisplay (xcontext->disp);
- g_mutex_unlock (xvimagesink->x_lock);
- g_free (xcontext->par);
- g_free (xcontext);
- /* GST_ELEMENT_ERROR is thrown by gst_xvimagesink_get_xv_support */
- return NULL;
- }
-#ifdef HAVE_XSHM
- /* Search for XShm extension support */
- if (XShmQueryExtension (xcontext->disp) &&
- gst_xvimagesink_check_xshm_calls (xcontext)) {
- xcontext->use_xshm = TRUE;
- GST_DEBUG ("xvimagesink is using XShm extension");
- } else
-#endif /* HAVE_XSHM */
- {
- xcontext->use_xshm = FALSE;
- GST_DEBUG ("xvimagesink is not using XShm extension");
- }
-
- xv_attr = XvQueryPortAttributes (xcontext->disp,
- xcontext->xv_port_id, &N_attr);
-
-
- /* Generate the channels list */
- for (i = 0; i < (sizeof (channels) / sizeof (char *)); i++) {
- XvAttribute *matching_attr = NULL;
-
- /* Retrieve the property atom if it exists. If it doesn't exist,
- * the attribute itself must not either, so we can skip */
- prop_atom = XInternAtom (xcontext->disp, channels[i], True);
- if (prop_atom == None)
- continue;
-
- if (xv_attr != NULL) {
- for (j = 0; j < N_attr && matching_attr == NULL; ++j)
- if (!g_ascii_strcasecmp (channels[i], xv_attr[j].name))
- matching_attr = xv_attr + j;
- }
-
- if (matching_attr) {
- GstColorBalanceChannel *channel;
-
- channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
- channel->label = g_strdup (channels[i]);
- channel->min_value = matching_attr ? matching_attr->min_value : -1000;
- channel->max_value = matching_attr ? matching_attr->max_value : 1000;
-
- xcontext->channels_list = g_list_append (xcontext->channels_list,
- channel);
-
- /* If the colorbalance settings have not been touched we get Xv values
- as defaults and update our internal variables */
- if (!xvimagesink->cb_changed) {
- gint val;
-
- XvGetPortAttribute (xcontext->disp, xcontext->xv_port_id,
- prop_atom, &val);
- /* Normalize val to [-1000, 1000] */
- val = floor (0.5 + -1000 + 2000 * (val - channel->min_value) /
- (double) (channel->max_value - channel->min_value));
-
- if (!g_ascii_strcasecmp (channels[i], "XV_HUE"))
- xvimagesink->hue = val;
- else if (!g_ascii_strcasecmp (channels[i], "XV_SATURATION"))
- xvimagesink->saturation = val;
- else if (!g_ascii_strcasecmp (channels[i], "XV_BRIGHTNESS"))
- xvimagesink->brightness = val;
- else if (!g_ascii_strcasecmp (channels[i], "XV_CONTRAST"))
- xvimagesink->contrast = val;
- }
- }
- }
-
- if (xv_attr)
- XFree (xv_attr);
-
- g_mutex_unlock (xvimagesink->x_lock);
-
- return xcontext;
-}
-
-/* This function cleans the X context. Closing the Display, releasing the XV
- port and unrefing the caps for supported formats. */
-static void
-gst_xvimagesink_xcontext_clear (GstXvImageSink * xvimagesink)
-{
- GList *formats_list, *channels_list;
- GstXContext *xcontext;
- gint i = 0;
-
- g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
-
- GST_OBJECT_LOCK (xvimagesink);
- if (xvimagesink->xcontext == NULL) {
- GST_OBJECT_UNLOCK (xvimagesink);
- return;
- }
-
- /* Take the XContext from the sink and clean it up */
- xcontext = xvimagesink->xcontext;
- xvimagesink->xcontext = NULL;
-
- GST_OBJECT_UNLOCK (xvimagesink);
-
-
- formats_list = xcontext->formats_list;
-
- while (formats_list) {
- GstXvImageFormat *format = formats_list->data;
-
- gst_caps_unref (format->caps);
- g_free (format);
- formats_list = g_list_next (formats_list);
- }
-
- if (xcontext->formats_list)
- g_list_free (xcontext->formats_list);
-
- channels_list = xcontext->channels_list;
-
- while (channels_list) {
- GstColorBalanceChannel *channel = channels_list->data;
-
- g_object_unref (channel);
- channels_list = g_list_next (channels_list);
- }
-
- if (xcontext->channels_list)
- g_list_free (xcontext->channels_list);
-
- gst_caps_unref (xcontext->caps);
- if (xcontext->last_caps)
- gst_caps_replace (&xcontext->last_caps, NULL);
-
- for (i = 0; i < xcontext->nb_adaptors; i++) {
- g_free (xcontext->adaptors[i]);
- }
-
- g_free (xcontext->adaptors);
-
- g_free (xcontext->par);
-
- g_mutex_lock (xvimagesink->x_lock);
-
- GST_DEBUG_OBJECT (xvimagesink, "Closing display and freeing X Context");
-
- XvUngrabPort (xcontext->disp, xcontext->xv_port_id, 0);
-
- XCloseDisplay (xcontext->disp);
-
- g_mutex_unlock (xvimagesink->x_lock);
-
- g_free (xcontext);
-}
-
-static void
-gst_xvimagesink_imagepool_clear (GstXvImageSink * xvimagesink)
-{
- g_mutex_lock (xvimagesink->pool_lock);
-
- while (xvimagesink->image_pool) {
- GstXvImageBuffer *xvimage = xvimagesink->image_pool->data;
-
- xvimagesink->image_pool = g_slist_delete_link (xvimagesink->image_pool,
- xvimagesink->image_pool);
- gst_xvimage_buffer_free (xvimage);
- }
-
- g_mutex_unlock (xvimagesink->pool_lock);
-}
-
-/* Element stuff */
-
-/* This function tries to get a format matching with a given caps in the
- supported list of formats we generated in gst_xvimagesink_get_xv_support */
-static gint
-gst_xvimagesink_get_format_from_caps (GstXvImageSink * xvimagesink,
- GstCaps * caps)
-{
- GList *list = NULL;
-
- g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), 0);
-
- list = xvimagesink->xcontext->formats_list;
-
- while (list) {
- GstXvImageFormat *format = list->data;
-
- if (format) {
- GstCaps *icaps = NULL;
-
- icaps = gst_caps_intersect (caps, format->caps);
- if (!gst_caps_is_empty (icaps)) {
- gst_caps_unref (icaps);
- return format->format;
- }
- gst_caps_unref (icaps);
- }
- list = g_list_next (list);
- }
-
- return -1;
-}
-
-static GstCaps *
-gst_xvimagesink_getcaps (GstBaseSink * bsink)
-{
- GstXvImageSink *xvimagesink;
-
- xvimagesink = GST_XVIMAGESINK (bsink);
-
- if (xvimagesink->xcontext)
- return gst_caps_ref (xvimagesink->xcontext->caps);
-
- return
- gst_caps_copy (gst_pad_get_pad_template_caps (GST_VIDEO_SINK_PAD
- (xvimagesink)));
-}
-
-static gboolean
-gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
-{
- GstXvImageSink *xvimagesink;
- GstStructure *structure;
- GstCaps *intersection;
- guint32 im_format = 0;
- gboolean ret;
- gint video_width, video_height;
- gint disp_x, disp_y;
- gint disp_width, disp_height;
- gint video_par_n, video_par_d; /* video's PAR */
- gint display_par_n, display_par_d; /* display's PAR */
- const GValue *caps_par;
- const GValue *caps_disp_reg;
- const GValue *fps;
- guint num, den;
-
- xvimagesink = GST_XVIMAGESINK (bsink);
-
- GST_DEBUG_OBJECT (xvimagesink,
- "In setcaps. Possible caps %" GST_PTR_FORMAT ", setting caps %"
- GST_PTR_FORMAT, xvimagesink->xcontext->caps, caps);
-
- intersection = gst_caps_intersect (xvimagesink->xcontext->caps, caps);
- GST_DEBUG_OBJECT (xvimagesink, "intersection returned %" GST_PTR_FORMAT,
- intersection);
- if (gst_caps_is_empty (intersection))
- goto incompatible_caps;
-
- gst_caps_unref (intersection);
-
- structure = gst_caps_get_structure (caps, 0);
- ret = gst_structure_get_int (structure, "width", &video_width);
- ret &= gst_structure_get_int (structure, "height", &video_height);
- fps = gst_structure_get_value (structure, "framerate");
- ret &= (fps != NULL);
-
- if (!ret)
- goto incomplete_caps;
-
- xvimagesink->fps_n = gst_value_get_fraction_numerator (fps);
- xvimagesink->fps_d = gst_value_get_fraction_denominator (fps);
-
- xvimagesink->video_width = video_width;
- xvimagesink->video_height = video_height;
-
- im_format = gst_xvimagesink_get_format_from_caps (xvimagesink, caps);
- if (im_format == -1)
- goto invalid_format;
-
- /* get aspect ratio from caps if it's present, and
- * convert video width and height to a display width and height
- * using wd / hd = wv / hv * PARv / PARd */
-
- /* get video's PAR */
- caps_par = gst_structure_get_value (structure, "pixel-aspect-ratio");
- if (caps_par) {
- video_par_n = gst_value_get_fraction_numerator (caps_par);
- video_par_d = gst_value_get_fraction_denominator (caps_par);
- } else {
- video_par_n = 1;
- video_par_d = 1;
- }
- /* get display's PAR */
- if (xvimagesink->par) {
- display_par_n = gst_value_get_fraction_numerator (xvimagesink->par);
- display_par_d = gst_value_get_fraction_denominator (xvimagesink->par);
- } else {
- display_par_n = 1;
- display_par_d = 1;
- }
-
- /* get the display region */
- caps_disp_reg = gst_structure_get_value (structure, "display-region");
- if (caps_disp_reg) {
- disp_x = g_value_get_int (gst_value_array_get_value (caps_disp_reg, 0));
- disp_y = g_value_get_int (gst_value_array_get_value (caps_disp_reg, 1));
- disp_width = g_value_get_int (gst_value_array_get_value (caps_disp_reg, 2));
- disp_height =
- g_value_get_int (gst_value_array_get_value (caps_disp_reg, 3));
- } else {
- disp_x = disp_y = 0;
- disp_width = video_width;
- disp_height = video_height;
- }
-
- if (!gst_video_calculate_display_ratio (&num, &den, video_width,
- video_height, video_par_n, video_par_d, display_par_n, display_par_d))
- goto no_disp_ratio;
-
- xvimagesink->disp_x = disp_x;
- xvimagesink->disp_y = disp_y;
- xvimagesink->disp_width = disp_width;
- xvimagesink->disp_height = disp_height;
-
- GST_DEBUG_OBJECT (xvimagesink,
- "video width/height: %dx%d, calculated display ratio: %d/%d",
- video_width, video_height, num, den);
-
- /* now find a width x height that respects this display ratio.
- * prefer those that have one of w/h the same as the incoming video
- * using wd / hd = num / den */
-
- /* start with same height, because of interlaced video */
- /* check hd / den is an integer scale factor, and scale wd with the PAR */
- if (video_height % den == 0) {
- GST_DEBUG_OBJECT (xvimagesink, "keeping video height");
- GST_VIDEO_SINK_WIDTH (xvimagesink) = (guint)
- gst_util_uint64_scale_int (video_height, num, den);
- GST_VIDEO_SINK_HEIGHT (xvimagesink) = video_height;
- } else if (video_width % num == 0) {
- GST_DEBUG_OBJECT (xvimagesink, "keeping video width");
- GST_VIDEO_SINK_WIDTH (xvimagesink) = video_width;
- GST_VIDEO_SINK_HEIGHT (xvimagesink) = (guint)
- gst_util_uint64_scale_int (video_width, den, num);
- } else {
- GST_DEBUG_OBJECT (xvimagesink, "approximating while keeping video height");
- GST_VIDEO_SINK_WIDTH (xvimagesink) = (guint)
- gst_util_uint64_scale_int (video_height, num, den);
- GST_VIDEO_SINK_HEIGHT (xvimagesink) = video_height;
- }
- GST_DEBUG_OBJECT (xvimagesink, "scaling to %dx%d",
- GST_VIDEO_SINK_WIDTH (xvimagesink), GST_VIDEO_SINK_HEIGHT (xvimagesink));
-
- /* Notify application to set xwindow id now */
- g_mutex_lock (xvimagesink->flow_lock);
- if (!xvimagesink->xwindow) {
- g_mutex_unlock (xvimagesink->flow_lock);
- gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (xvimagesink));
- } else {
- g_mutex_unlock (xvimagesink->flow_lock);
- }
-
- /* Creating our window and our image with the display size in pixels */
- if (GST_VIDEO_SINK_WIDTH (xvimagesink) <= 0 ||
- GST_VIDEO_SINK_HEIGHT (xvimagesink) <= 0)
- goto no_display_size;
-
- g_mutex_lock (xvimagesink->flow_lock);
- if (!xvimagesink->xwindow) {
- xvimagesink->xwindow = gst_xvimagesink_xwindow_new (xvimagesink,
- GST_VIDEO_SINK_WIDTH (xvimagesink),
- GST_VIDEO_SINK_HEIGHT (xvimagesink));
- }
-
- /* After a resize, we want to redraw the borders in case the new frame size
- * doesn't cover the same area */
- xvimagesink->redraw_border = TRUE;
-
- /* We renew our xvimage only if size or format changed;
- * the xvimage is the same size as the video pixel size */
- if ((xvimagesink->xvimage) &&
- ((im_format != xvimagesink->xvimage->im_format) ||
- (video_width != xvimagesink->xvimage->width) ||
- (video_height != xvimagesink->xvimage->height))) {
- GST_DEBUG_OBJECT (xvimagesink,
- "old format %" GST_FOURCC_FORMAT ", new format %" GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (xvimagesink->xvimage->im_format),
- GST_FOURCC_ARGS (im_format));
- GST_DEBUG_OBJECT (xvimagesink, "renewing xvimage");
- gst_buffer_unref (GST_BUFFER (xvimagesink->xvimage));
- xvimagesink->xvimage = NULL;
- }
-
- g_mutex_unlock (xvimagesink->flow_lock);
-
- return TRUE;
-
- /* ERRORS */
-incompatible_caps:
- {
- GST_ERROR_OBJECT (xvimagesink, "caps incompatible");
- gst_caps_unref (intersection);
- return FALSE;
- }
-incomplete_caps:
- {
- GST_DEBUG_OBJECT (xvimagesink, "Failed to retrieve either width, "
- "height or framerate from intersected caps");
- return FALSE;
- }
-invalid_format:
- {
- GST_DEBUG_OBJECT (xvimagesink,
- "Could not locate image format from caps %" GST_PTR_FORMAT, caps);
- return FALSE;
- }
-no_disp_ratio:
- {
- GST_ELEMENT_ERROR (xvimagesink, CORE, NEGOTIATION, (NULL),
- ("Error calculating the output display ratio of the video."));
- return FALSE;
- }
-no_display_size:
- {
- GST_ELEMENT_ERROR (xvimagesink, CORE, NEGOTIATION, (NULL),
- ("Error calculating the output display ratio of the video."));
- return FALSE;
- }
-}
-
-static GstStateChangeReturn
-gst_xvimagesink_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
- GstXvImageSink *xvimagesink;
- GstXContext *xcontext = NULL;
-
- xvimagesink = GST_XVIMAGESINK (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- /* Initializing the XContext */
- if (xvimagesink->xcontext == NULL) {
- xcontext = gst_xvimagesink_xcontext_get (xvimagesink);
- if (xcontext == NULL)
- return GST_STATE_CHANGE_FAILURE;
- GST_OBJECT_LOCK (xvimagesink);
- if (xcontext)
- xvimagesink->xcontext = xcontext;
- GST_OBJECT_UNLOCK (xvimagesink);
- }
-
- /* update object's par with calculated one if not set yet */
- if (!xvimagesink->par) {
- xvimagesink->par = g_new0 (GValue, 1);
- gst_value_init_and_copy (xvimagesink->par, xvimagesink->xcontext->par);
- GST_DEBUG_OBJECT (xvimagesink, "set calculated PAR on object's PAR");
- }
- /* call XSynchronize with the current value of synchronous */
- GST_DEBUG_OBJECT (xvimagesink, "XSynchronize called with %s",
- xvimagesink->synchronous ? "TRUE" : "FALSE");
- XSynchronize (xvimagesink->xcontext->disp, xvimagesink->synchronous);
- gst_xvimagesink_update_colorbalance (xvimagesink);
- gst_xvimagesink_manage_event_thread (xvimagesink);
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- g_mutex_lock (xvimagesink->pool_lock);
- xvimagesink->pool_invalid = FALSE;
- g_mutex_unlock (xvimagesink->pool_lock);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- g_mutex_lock (xvimagesink->pool_lock);
- xvimagesink->pool_invalid = TRUE;
- g_mutex_unlock (xvimagesink->pool_lock);
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- xvimagesink->fps_n = 0;
- xvimagesink->fps_d = 1;
- GST_VIDEO_SINK_WIDTH (xvimagesink) = 0;
- GST_VIDEO_SINK_HEIGHT (xvimagesink) = 0;
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- gst_xvimagesink_reset (xvimagesink);
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-static void
-gst_xvimagesink_get_times (GstBaseSink * bsink, GstBuffer * buf,
- GstClockTime * start, GstClockTime * end)
-{
- GstXvImageSink *xvimagesink;
-
- xvimagesink = GST_XVIMAGESINK (bsink);
-
- if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
- *start = GST_BUFFER_TIMESTAMP (buf);
- if (GST_BUFFER_DURATION_IS_VALID (buf)) {
- *end = *start + GST_BUFFER_DURATION (buf);
- } else {
- if (xvimagesink->fps_n > 0) {
- *end = *start +
- gst_util_uint64_scale_int (GST_SECOND, xvimagesink->fps_d,
- xvimagesink->fps_n);
- }
- }
- }
-}
-
-static GstFlowReturn
-gst_xvimagesink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
-{
- GstXvImageSink *xvimagesink;
-
- xvimagesink = GST_XVIMAGESINK (vsink);
-
- /* If this buffer has been allocated using our buffer management we simply
- put the ximage which is in the PRIVATE pointer */
- if (GST_IS_XVIMAGE_BUFFER (buf)) {
- GST_LOG_OBJECT (xvimagesink, "fast put of bufferpool buffer %p", buf);
- if (!gst_xvimagesink_xvimage_put (xvimagesink,
- GST_XVIMAGE_BUFFER_CAST (buf)))
- goto no_window;
- } else {
- GST_CAT_LOG_OBJECT (GST_CAT_PERFORMANCE, xvimagesink,
- "slow copy into bufferpool buffer %p", buf);
- /* Else we have to copy the data into our private image, */
- /* if we have one... */
- if (!xvimagesink->xvimage) {
- GST_DEBUG_OBJECT (xvimagesink, "creating our xvimage");
-
- xvimagesink->xvimage = gst_xvimagesink_xvimage_new (xvimagesink,
- GST_BUFFER_CAPS (buf));
-
- if (!xvimagesink->xvimage)
- /* The create method should have posted an informative error */
- goto no_image;
-
- if (xvimagesink->xvimage->size < GST_BUFFER_SIZE (buf)) {
- GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
- ("Failed to create output image buffer of %dx%d pixels",
- xvimagesink->xvimage->width, xvimagesink->xvimage->height),
- ("XServer allocated buffer size did not match input buffer"));
-
- gst_xvimage_buffer_destroy (xvimagesink->xvimage);
- xvimagesink->xvimage = NULL;
- goto no_image;
- }
- }
-
- memcpy (xvimagesink->xvimage->xvimage->data,
- GST_BUFFER_DATA (buf),
- MIN (GST_BUFFER_SIZE (buf), xvimagesink->xvimage->size));
-
- if (!gst_xvimagesink_xvimage_put (xvimagesink, xvimagesink->xvimage))
- goto no_window;
- }
-
- return GST_FLOW_OK;
-
- /* ERRORS */
-no_image:
- {
- /* No image available. That's very bad ! */
- GST_WARNING_OBJECT (xvimagesink, "could not create image");
- return GST_FLOW_ERROR;
- }
-no_window:
- {
- /* No Window available to put our image into */
- GST_WARNING_OBJECT (xvimagesink, "could not output image - no window");
- return GST_FLOW_ERROR;
- }
-}
-
-static gboolean
-gst_xvimagesink_event (GstBaseSink * sink, GstEvent * event)
-{
- GstXvImageSink *xvimagesink = GST_XVIMAGESINK (sink);
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_TAG:{
- GstTagList *l;
- gchar *title = NULL;
-
- gst_event_parse_tag (event, &l);
- gst_tag_list_get_string (l, GST_TAG_TITLE, &title);
-
- if (title) {
- GST_DEBUG_OBJECT (xvimagesink, "got tags, title='%s'", title);
- gst_xvimagesink_xwindow_set_title (xvimagesink, xvimagesink->xwindow,
- title);
-
- g_free (title);
- }
- break;
- }
- default:
- break;
- }
- if (GST_BASE_SINK_CLASS (parent_class)->event)
- return GST_BASE_SINK_CLASS (parent_class)->event (sink, event);
- else
- return TRUE;
-}
-
-/* Buffer management */
-
-static GstFlowReturn
-gst_xvimagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
- GstCaps * caps, GstBuffer ** buf)
-{
- GstFlowReturn ret = GST_FLOW_OK;
- GstXvImageSink *xvimagesink;
- GstXvImageBuffer *xvimage = NULL;
- GstCaps *intersection = NULL;
- GstStructure *structure = NULL;
- gint width, height, image_format;
- GstCaps *new_caps;
-
- xvimagesink = GST_XVIMAGESINK (bsink);
-
- g_mutex_lock (xvimagesink->pool_lock);
- if (G_UNLIKELY (xvimagesink->pool_invalid))
- goto invalid;
-
- if (G_LIKELY (xvimagesink->xcontext->last_caps &&
- gst_caps_is_equal (caps, xvimagesink->xcontext->last_caps))) {
- GST_LOG_OBJECT (xvimagesink,
- "buffer alloc for same last_caps, reusing caps");
- intersection = gst_caps_ref (caps);
- image_format = xvimagesink->xcontext->last_format;
- width = xvimagesink->xcontext->last_width;
- height = xvimagesink->xcontext->last_height;
-
- goto reuse_last_caps;
- }
-
- GST_DEBUG_OBJECT (xvimagesink, "buffer alloc requested size %d with caps %"
- GST_PTR_FORMAT ", intersecting with our caps %" GST_PTR_FORMAT, size,
- caps, xvimagesink->xcontext->caps);
-
- /* Check the caps against our xcontext */
- intersection = gst_caps_intersect (xvimagesink->xcontext->caps, caps);
-
- /* Ensure the returned caps are fixed */
- gst_caps_truncate (intersection);
-
- GST_DEBUG_OBJECT (xvimagesink, "intersection in buffer alloc returned %"
- GST_PTR_FORMAT, intersection);
-
- if (gst_caps_is_empty (intersection)) {
- /* So we don't support this kind of buffer, let's define one we'd like */
- new_caps = gst_caps_copy (caps);
-
- structure = gst_caps_get_structure (new_caps, 0);
-
- /* Try with YUV first */
- gst_structure_set_name (structure, "video/x-raw-yuv");
- gst_structure_remove_field (structure, "format");
- gst_structure_remove_field (structure, "endianness");
- gst_structure_remove_field (structure, "depth");
- gst_structure_remove_field (structure, "bpp");
- gst_structure_remove_field (structure, "red_mask");
- gst_structure_remove_field (structure, "green_mask");
- gst_structure_remove_field (structure, "blue_mask");
- gst_structure_remove_field (structure, "alpha_mask");
-
- /* Reuse intersection with Xcontext */
- gst_caps_unref (intersection);
- intersection = gst_caps_intersect (xvimagesink->xcontext->caps, new_caps);
-
- if (gst_caps_is_empty (intersection)) {
- /* Now try with RGB */
- gst_structure_set_name (structure, "video/x-raw-rgb");
- /* And interset again */
- gst_caps_unref (intersection);
- intersection = gst_caps_intersect (xvimagesink->xcontext->caps, new_caps);
-
- if (gst_caps_is_empty (intersection))
- goto incompatible;
- }
-
- /* Clean this copy */
- gst_caps_unref (new_caps);
- /* We want fixed caps */
- gst_caps_truncate (intersection);
-
- GST_DEBUG_OBJECT (xvimagesink, "allocating a buffer with caps %"
- GST_PTR_FORMAT, intersection);
- } else if (gst_caps_is_equal (intersection, caps)) {
- /* Things work better if we return a buffer with the same caps ptr
- * as was asked for when we can */
- gst_caps_replace (&intersection, caps);
- }
-
- /* Get image format from caps */
- image_format = gst_xvimagesink_get_format_from_caps (xvimagesink,
- intersection);
-
- /* Get geometry from caps */
- structure = gst_caps_get_structure (intersection, 0);
- if (!gst_structure_get_int (structure, "width", &width) ||
- !gst_structure_get_int (structure, "height", &height) ||
- image_format == -1)
- goto invalid_caps;
-
- /* Store our caps and format as the last_caps to avoid expensive
- * caps intersection next time */
- gst_caps_replace (&xvimagesink->xcontext->last_caps, intersection);
- xvimagesink->xcontext->last_format = image_format;
- xvimagesink->xcontext->last_width = width;
- xvimagesink->xcontext->last_height = height;
-
-reuse_last_caps:
-
- /* Walking through the pool cleaning unusable images and searching for a
- suitable one */
- while (xvimagesink->image_pool) {
- xvimage = xvimagesink->image_pool->data;
-
- if (xvimage) {
- /* Removing from the pool */
- xvimagesink->image_pool = g_slist_delete_link (xvimagesink->image_pool,
- xvimagesink->image_pool);
-
- /* We check for geometry or image format changes */
- if ((xvimage->width != width) ||
- (xvimage->height != height) || (xvimage->im_format != image_format)) {
- /* This image is unusable. Destroying... */
- gst_xvimage_buffer_free (xvimage);
- xvimage = NULL;
- } else {
- /* We found a suitable image */
- GST_LOG_OBJECT (xvimagesink, "found usable image in pool");
- break;
- }
- }
- }
-
- if (!xvimage) {
- /* We found no suitable image in the pool. Creating... */
- GST_DEBUG_OBJECT (xvimagesink, "no usable image in pool, creating xvimage");
- xvimage = gst_xvimagesink_xvimage_new (xvimagesink, intersection);
- if (xvimage && xvimage->size < size) {
- /* This image is unusable. Destroying... */
- GST_LOG_OBJECT (xvimagesink, "Discarding allocated buffer as unsuitable. "
- "Falling back to normal buffer");
- gst_xvimage_buffer_free (xvimage);
- xvimage = NULL;
- }
- }
- g_mutex_unlock (xvimagesink->pool_lock);
-
- if (xvimage) {
- /* Make sure the buffer is cleared of any previously used flags */
- GST_MINI_OBJECT_CAST (xvimage)->flags = 0;
- gst_buffer_set_caps (GST_BUFFER_CAST (xvimage), intersection);
- }
-
- *buf = GST_BUFFER_CAST (xvimage);
-
-beach:
- if (intersection) {
- gst_caps_unref (intersection);
- }
-
- return ret;
-
- /* ERRORS */
-invalid:
- {
- GST_DEBUG_OBJECT (xvimagesink, "the pool is flushing");
- ret = GST_FLOW_WRONG_STATE;
- g_mutex_unlock (xvimagesink->pool_lock);
- goto beach;
- }
-incompatible:
- {
- GST_WARNING_OBJECT (xvimagesink, "we were requested a buffer with "
- "caps %" GST_PTR_FORMAT ", but our xcontext caps %" GST_PTR_FORMAT
- " are completely incompatible with those caps", new_caps,
- xvimagesink->xcontext->caps);
- gst_caps_unref (new_caps);
- ret = GST_FLOW_NOT_NEGOTIATED;
- g_mutex_unlock (xvimagesink->pool_lock);
- goto beach;
- }
-invalid_caps:
- {
- GST_WARNING_OBJECT (xvimagesink, "invalid caps for buffer allocation %"
- GST_PTR_FORMAT, intersection);
- ret = GST_FLOW_NOT_NEGOTIATED;
- g_mutex_unlock (xvimagesink->pool_lock);
- goto beach;
- }
-}
-
-/* Interfaces stuff */
-
-static gboolean
-gst_xvimagesink_interface_supported (GstImplementsInterface * iface, GType type)
-{
- g_assert (type == GST_TYPE_NAVIGATION || type == GST_TYPE_X_OVERLAY ||
- type == GST_TYPE_COLOR_BALANCE || type == GST_TYPE_PROPERTY_PROBE);
- return TRUE;
-}
-
-static void
-gst_xvimagesink_interface_init (GstImplementsInterfaceClass * klass)
-{
- klass->supported = gst_xvimagesink_interface_supported;
-}
-
-static void
-gst_xvimagesink_navigation_send_event (GstNavigation * navigation,
- GstStructure * structure)
-{
- GstXvImageSink *xvimagesink = GST_XVIMAGESINK (navigation);
- GstPad *peer;
-
- if ((peer = gst_pad_get_peer (GST_VIDEO_SINK_PAD (xvimagesink)))) {
- GstEvent *event;
- GstVideoRectangle src, dst, result;
- gdouble x, y, xscale = 1.0, yscale = 1.0;
-
- event = gst_event_new_navigation (structure);
-
- /* We take the flow_lock while we look at the window */
- g_mutex_lock (xvimagesink->flow_lock);
-
- if (!xvimagesink->xwindow) {
- g_mutex_unlock (xvimagesink->flow_lock);
- return;
- }
-
- /* We get the frame position using the calculated geometry from _setcaps
- that respect pixel aspect ratios */
- src.w = GST_VIDEO_SINK_WIDTH (xvimagesink);
- src.h = GST_VIDEO_SINK_HEIGHT (xvimagesink);
- dst.w = xvimagesink->xwindow->width;
- dst.h = xvimagesink->xwindow->height;
-
- g_mutex_unlock (xvimagesink->flow_lock);
-
- if (xvimagesink->keep_aspect) {
- gst_video_sink_center_rect (src, dst, &result, TRUE);
- } else {
- result.x = result.y = 0;
- result.w = dst.w;
- result.h = dst.h;
- }
-
- /* We calculate scaling using the original video frames geometry to include
- pixel aspect ratio scaling. */
- xscale = (gdouble) xvimagesink->video_width / result.w;
- yscale = (gdouble) xvimagesink->video_height / result.h;
-
- /* Converting pointer coordinates to the non scaled geometry */
- if (gst_structure_get_double (structure, "pointer_x", &x)) {
- x = MIN (x, result.x + result.w);
- x = MAX (x - result.x, 0);
- gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE,
- (gdouble) x * xscale, NULL);
- }
- if (gst_structure_get_double (structure, "pointer_y", &y)) {
- y = MIN (y, result.y + result.h);
- y = MAX (y - result.y, 0);
- gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE,
- (gdouble) y * yscale, NULL);
- }
-
- gst_pad_send_event (peer, event);
- gst_object_unref (peer);
- }
-}
-
-static void
-gst_xvimagesink_navigation_init (GstNavigationInterface * iface)
-{
- iface->send_event = gst_xvimagesink_navigation_send_event;
-}
-
-static void
-gst_xvimagesink_set_xwindow_id (GstXOverlay * overlay, XID xwindow_id)
-{
- GstXvImageSink *xvimagesink = GST_XVIMAGESINK (overlay);
- GstXWindow *xwindow = NULL;
- XWindowAttributes attr;
-
- g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
-
- g_mutex_lock (xvimagesink->flow_lock);
-
- /* If we already use that window return */
- if (xvimagesink->xwindow && (xwindow_id == xvimagesink->xwindow->win)) {
- g_mutex_unlock (xvimagesink->flow_lock);
- return;
- }
-
- /* If the element has not initialized the X11 context try to do so */
- if (!xvimagesink->xcontext &&
- !(xvimagesink->xcontext = gst_xvimagesink_xcontext_get (xvimagesink))) {
- g_mutex_unlock (xvimagesink->flow_lock);
- /* we have thrown a GST_ELEMENT_ERROR now */
- return;
- }
-
- gst_xvimagesink_update_colorbalance (xvimagesink);
-
- /* Clear image pool as the images are unusable anyway */
- gst_xvimagesink_imagepool_clear (xvimagesink);
-
- /* Clear the xvimage */
- if (xvimagesink->xvimage) {
- gst_xvimage_buffer_free (xvimagesink->xvimage);
- xvimagesink->xvimage = NULL;
- }
-
- /* If a window is there already we destroy it */
- if (xvimagesink->xwindow) {
- gst_xvimagesink_xwindow_destroy (xvimagesink, xvimagesink->xwindow);
- xvimagesink->xwindow = NULL;
- }
-
- /* If the xid is 0 we go back to an internal window */
- if (xwindow_id == 0) {
- /* If no width/height caps nego did not happen window will be created
- during caps nego then */
- if (GST_VIDEO_SINK_WIDTH (xvimagesink)
- && GST_VIDEO_SINK_HEIGHT (xvimagesink)) {
- xwindow =
- gst_xvimagesink_xwindow_new (xvimagesink,
- GST_VIDEO_SINK_WIDTH (xvimagesink),
- GST_VIDEO_SINK_HEIGHT (xvimagesink));
- }
- } else {
- xwindow = g_new0 (GstXWindow, 1);
-
- xwindow->win = xwindow_id;
-
- /* We get window geometry, set the event we want to receive,
- and create a GC */
- g_mutex_lock (xvimagesink->x_lock);
- XGetWindowAttributes (xvimagesink->xcontext->disp, xwindow->win, &attr);
- xwindow->width = attr.width;
- xwindow->height = attr.height;
- xwindow->internal = FALSE;
- if (xvimagesink->handle_events) {
- XSelectInput (xvimagesink->xcontext->disp, xwindow->win, ExposureMask |
- StructureNotifyMask | PointerMotionMask | KeyPressMask |
- KeyReleaseMask);
- }
-
- xwindow->gc = XCreateGC (xvimagesink->xcontext->disp,
- xwindow->win, 0, NULL);
- g_mutex_unlock (xvimagesink->x_lock);
- }
-
- if (xwindow)
- xvimagesink->xwindow = xwindow;
-
- g_mutex_unlock (xvimagesink->flow_lock);
-}
-
-static void
-gst_xvimagesink_expose (GstXOverlay * overlay)
-{
- GstXvImageSink *xvimagesink = GST_XVIMAGESINK (overlay);
-
- gst_xvimagesink_xvimage_put (xvimagesink, NULL);
-}
-
-static void
-gst_xvimagesink_set_event_handling (GstXOverlay * overlay,
- gboolean handle_events)
-{
- GstXvImageSink *xvimagesink = GST_XVIMAGESINK (overlay);
-
- xvimagesink->handle_events = handle_events;
-
- g_mutex_lock (xvimagesink->flow_lock);
-
- if (G_UNLIKELY (!xvimagesink->xwindow)) {
- g_mutex_unlock (xvimagesink->flow_lock);
- return;
- }
-
- g_mutex_lock (xvimagesink->x_lock);
-
- if (handle_events) {
- if (xvimagesink->xwindow->internal) {
- XSelectInput (xvimagesink->xcontext->disp, xvimagesink->xwindow->win,
- ExposureMask | StructureNotifyMask | PointerMotionMask |
- KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask);
- } else {
- XSelectInput (xvimagesink->xcontext->disp, xvimagesink->xwindow->win,
- ExposureMask | StructureNotifyMask | PointerMotionMask |
- KeyPressMask | KeyReleaseMask);
- }
- } else {
- XSelectInput (xvimagesink->xcontext->disp, xvimagesink->xwindow->win, 0);
- }
-
- g_mutex_unlock (xvimagesink->x_lock);
-
- g_mutex_unlock (xvimagesink->flow_lock);
-}
-
-static void
-gst_xvimagesink_xoverlay_init (GstXOverlayClass * iface)
-{
- iface->set_xwindow_id = gst_xvimagesink_set_xwindow_id;
- iface->expose = gst_xvimagesink_expose;
- iface->handle_events = gst_xvimagesink_set_event_handling;
-}
-
-static const GList *
-gst_xvimagesink_colorbalance_list_channels (GstColorBalance * balance)
-{
- GstXvImageSink *xvimagesink = GST_XVIMAGESINK (balance);
-
- g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), NULL);
-
- if (xvimagesink->xcontext)
- return xvimagesink->xcontext->channels_list;
- else
- return NULL;
-}
-
-static void
-gst_xvimagesink_colorbalance_set_value (GstColorBalance * balance,
- GstColorBalanceChannel * channel, gint value)
-{
- GstXvImageSink *xvimagesink = GST_XVIMAGESINK (balance);
-
- g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
- g_return_if_fail (channel->label != NULL);
-
- xvimagesink->cb_changed = TRUE;
-
- /* Normalize val to [-1000, 1000] */
- value = floor (0.5 + -1000 + 2000 * (value - channel->min_value) /
- (double) (channel->max_value - channel->min_value));
-
- if (g_ascii_strcasecmp (channel->label, "XV_HUE") == 0) {
- xvimagesink->hue = value;
- } else if (g_ascii_strcasecmp (channel->label, "XV_SATURATION") == 0) {
- xvimagesink->saturation = value;
- } else if (g_ascii_strcasecmp (channel->label, "XV_CONTRAST") == 0) {
- xvimagesink->contrast = value;
- } else if (g_ascii_strcasecmp (channel->label, "XV_BRIGHTNESS") == 0) {
- xvimagesink->brightness = value;
- } else {
- g_warning ("got an unknown channel %s", channel->label);
- return;
- }
-
- gst_xvimagesink_update_colorbalance (xvimagesink);
-}
-
-static gint
-gst_xvimagesink_colorbalance_get_value (GstColorBalance * balance,
- GstColorBalanceChannel * channel)
-{
- GstXvImageSink *xvimagesink = GST_XVIMAGESINK (balance);
- gint value = 0;
-
- g_return_val_if_fail (GST_IS_XVIMAGESINK (xvimagesink), 0);
- g_return_val_if_fail (channel->label != NULL, 0);
-
- if (g_ascii_strcasecmp (channel->label, "XV_HUE") == 0) {
- value = xvimagesink->hue;
- } else if (g_ascii_strcasecmp (channel->label, "XV_SATURATION") == 0) {
- value = xvimagesink->saturation;
- } else if (g_ascii_strcasecmp (channel->label, "XV_CONTRAST") == 0) {
- value = xvimagesink->contrast;
- } else if (g_ascii_strcasecmp (channel->label, "XV_BRIGHTNESS") == 0) {
- value = xvimagesink->brightness;
- } else {
- g_warning ("got an unknown channel %s", channel->label);
- }
-
- /* Normalize val to [channel->min_value, channel->max_value] */
- value = channel->min_value + (channel->max_value - channel->min_value) *
- (value + 1000) / 2000;
-
- return value;
-}
-
-static void
-gst_xvimagesink_colorbalance_init (GstColorBalanceClass * iface)
-{
- GST_COLOR_BALANCE_TYPE (iface) = GST_COLOR_BALANCE_HARDWARE;
- iface->list_channels = gst_xvimagesink_colorbalance_list_channels;
- iface->set_value = gst_xvimagesink_colorbalance_set_value;
- iface->get_value = gst_xvimagesink_colorbalance_get_value;
-}
-
-static const GList *
-gst_xvimagesink_probe_get_properties (GstPropertyProbe * probe)
-{
- GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
- static GList *list = NULL;
-
- if (!list) {
- list = g_list_append (NULL, g_object_class_find_property (klass, "device"));
- list =
- g_list_append (list, g_object_class_find_property (klass,
- "autopaint-colorkey"));
- list =
- g_list_append (list, g_object_class_find_property (klass,
- "double-buffer"));
- list =
- g_list_append (list, g_object_class_find_property (klass, "colorkey"));
- }
-
- return list;
-}
-
-static void
-gst_xvimagesink_probe_probe_property (GstPropertyProbe * probe,
- guint prop_id, const GParamSpec * pspec)
-{
- GstXvImageSink *xvimagesink = GST_XVIMAGESINK (probe);
-
- switch (prop_id) {
- case ARG_DEVICE:
- case ARG_AUTOPAINT_COLORKEY:
- case ARG_DOUBLE_BUFFER:
- case ARG_COLORKEY:
- GST_DEBUG_OBJECT (xvimagesink,
- "probing device list and get capabilities");
- if (!xvimagesink->xcontext) {
- GST_DEBUG_OBJECT (xvimagesink, "generating xcontext");
- xvimagesink->xcontext = gst_xvimagesink_xcontext_get (xvimagesink);
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-gst_xvimagesink_probe_needs_probe (GstPropertyProbe * probe,
- guint prop_id, const GParamSpec * pspec)
-{
- GstXvImageSink *xvimagesink = GST_XVIMAGESINK (probe);
- gboolean ret = FALSE;
-
- switch (prop_id) {
- case ARG_DEVICE:
- case ARG_AUTOPAINT_COLORKEY:
- case ARG_DOUBLE_BUFFER:
- case ARG_COLORKEY:
- if (xvimagesink->xcontext != NULL) {
- ret = FALSE;
- } else {
- ret = TRUE;
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
- break;
- }
-
- return ret;
-}
-
-static GValueArray *
-gst_xvimagesink_probe_get_values (GstPropertyProbe * probe,
- guint prop_id, const GParamSpec * pspec)
-{
- GstXvImageSink *xvimagesink = GST_XVIMAGESINK (probe);
- GValueArray *array = NULL;
-
- if (G_UNLIKELY (!xvimagesink->xcontext)) {
- GST_WARNING_OBJECT (xvimagesink, "we don't have any xcontext, can't "
- "get values");
- goto beach;
- }
-
- switch (prop_id) {
- case ARG_DEVICE:
- {
- guint i;
- GValue value = { 0 };
-
- array = g_value_array_new (xvimagesink->xcontext->nb_adaptors);
- g_value_init (&value, G_TYPE_STRING);
-
- for (i = 0; i < xvimagesink->xcontext->nb_adaptors; i++) {
- gchar *adaptor_id_s = g_strdup_printf ("%u", i);
-
- g_value_set_string (&value, adaptor_id_s);
- g_value_array_append (array, &value);
- g_free (adaptor_id_s);
- }
- g_value_unset (&value);
- break;
- }
- case ARG_AUTOPAINT_COLORKEY:
- if (xvimagesink->have_autopaint_colorkey) {
- GValue value = { 0 };
-
- array = g_value_array_new (2);
- g_value_init (&value, G_TYPE_BOOLEAN);
- g_value_set_boolean (&value, FALSE);
- g_value_array_append (array, &value);
- g_value_set_boolean (&value, TRUE);
- g_value_array_append (array, &value);
- g_value_unset (&value);
- }
- break;
- case ARG_DOUBLE_BUFFER:
- if (xvimagesink->have_double_buffer) {
- GValue value = { 0 };
-
- array = g_value_array_new (2);
- g_value_init (&value, G_TYPE_BOOLEAN);
- g_value_set_boolean (&value, FALSE);
- g_value_array_append (array, &value);
- g_value_set_boolean (&value, TRUE);
- g_value_array_append (array, &value);
- g_value_unset (&value);
- }
- break;
- case ARG_COLORKEY:
- if (xvimagesink->have_colorkey) {
- GValue value = { 0 };
-
- array = g_value_array_new (1);
- g_value_init (&value, GST_TYPE_INT_RANGE);
- gst_value_set_int_range (&value, 0, 0xffffff);
- g_value_array_append (array, &value);
- g_value_unset (&value);
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
- break;
- }
-
-beach:
- return array;
-}
-
-static void
-gst_xvimagesink_property_probe_interface_init (GstPropertyProbeInterface *
- iface)
-{
- iface->get_properties = gst_xvimagesink_probe_get_properties;
- iface->probe_property = gst_xvimagesink_probe_probe_property;
- iface->needs_probe = gst_xvimagesink_probe_needs_probe;
- iface->get_values = gst_xvimagesink_probe_get_values;
-}
-
-/* =========================================== */
-/* */
-/* Init & Class init */
-/* */
-/* =========================================== */
-
-static void
-gst_xvimagesink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstXvImageSink *xvimagesink;
-
- g_return_if_fail (GST_IS_XVIMAGESINK (object));
-
- xvimagesink = GST_XVIMAGESINK (object);
-
- switch (prop_id) {
- case ARG_HUE:
- xvimagesink->hue = g_value_get_int (value);
- xvimagesink->cb_changed = TRUE;
- gst_xvimagesink_update_colorbalance (xvimagesink);
- break;
- case ARG_CONTRAST:
- xvimagesink->contrast = g_value_get_int (value);
- xvimagesink->cb_changed = TRUE;
- gst_xvimagesink_update_colorbalance (xvimagesink);
- break;
- case ARG_BRIGHTNESS:
- xvimagesink->brightness = g_value_get_int (value);
- xvimagesink->cb_changed = TRUE;
- gst_xvimagesink_update_colorbalance (xvimagesink);
- break;
- case ARG_SATURATION:
- xvimagesink->saturation = g_value_get_int (value);
- xvimagesink->cb_changed = TRUE;
- gst_xvimagesink_update_colorbalance (xvimagesink);
- break;
- case ARG_DISPLAY:
- xvimagesink->display_name = g_strdup (g_value_get_string (value));
- break;
- case ARG_SYNCHRONOUS:
- xvimagesink->synchronous = g_value_get_boolean (value);
- if (xvimagesink->xcontext) {
- XSynchronize (xvimagesink->xcontext->disp, xvimagesink->synchronous);
- GST_DEBUG_OBJECT (xvimagesink, "XSynchronize called with %s",
- xvimagesink->synchronous ? "TRUE" : "FALSE");
- }
- break;
- case ARG_PIXEL_ASPECT_RATIO:
- g_free (xvimagesink->par);
- xvimagesink->par = g_new0 (GValue, 1);
- g_value_init (xvimagesink->par, GST_TYPE_FRACTION);
- if (!g_value_transform (value, xvimagesink->par)) {
- g_warning ("Could not transform string to aspect ratio");
- gst_value_set_fraction (xvimagesink->par, 1, 1);
- }
- GST_DEBUG_OBJECT (xvimagesink, "set PAR to %d/%d",
- gst_value_get_fraction_numerator (xvimagesink->par),
- gst_value_get_fraction_denominator (xvimagesink->par));
- break;
- case ARG_FORCE_ASPECT_RATIO:
- xvimagesink->keep_aspect = g_value_get_boolean (value);
- break;
- case ARG_HANDLE_EVENTS:
- gst_xvimagesink_set_event_handling (GST_X_OVERLAY (xvimagesink),
- g_value_get_boolean (value));
- gst_xvimagesink_manage_event_thread (xvimagesink);
- break;
- case ARG_DEVICE:
- xvimagesink->adaptor_no = atoi (g_value_get_string (value));
- break;
- case ARG_HANDLE_EXPOSE:
- xvimagesink->handle_expose = g_value_get_boolean (value);
- gst_xvimagesink_manage_event_thread (xvimagesink);
- break;
- case ARG_DOUBLE_BUFFER:
- xvimagesink->double_buffer = g_value_get_boolean (value);
- break;
- case ARG_AUTOPAINT_COLORKEY:
- xvimagesink->autopaint_colorkey = g_value_get_boolean (value);
- break;
- case ARG_COLORKEY:
- xvimagesink->colorkey = g_value_get_int (value);
- break;
- case ARG_DRAW_BORDERS:
- xvimagesink->draw_borders = g_value_get_boolean (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_xvimagesink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstXvImageSink *xvimagesink;
-
- g_return_if_fail (GST_IS_XVIMAGESINK (object));
-
- xvimagesink = GST_XVIMAGESINK (object);
-
- switch (prop_id) {
- case ARG_HUE:
- g_value_set_int (value, xvimagesink->hue);
- break;
- case ARG_CONTRAST:
- g_value_set_int (value, xvimagesink->contrast);
- break;
- case ARG_BRIGHTNESS:
- g_value_set_int (value, xvimagesink->brightness);
- break;
- case ARG_SATURATION:
- g_value_set_int (value, xvimagesink->saturation);
- break;
- case ARG_DISPLAY:
- g_value_set_string (value, xvimagesink->display_name);
- break;
- case ARG_SYNCHRONOUS:
- g_value_set_boolean (value, xvimagesink->synchronous);
- break;
- case ARG_PIXEL_ASPECT_RATIO:
- if (xvimagesink->par)
- g_value_transform (xvimagesink->par, value);
- break;
- case ARG_FORCE_ASPECT_RATIO:
- g_value_set_boolean (value, xvimagesink->keep_aspect);
- break;
- case ARG_HANDLE_EVENTS:
- g_value_set_boolean (value, xvimagesink->handle_events);
- break;
- case ARG_DEVICE:
- {
- char *adaptor_no_s = g_strdup_printf ("%u", xvimagesink->adaptor_no);
-
- g_value_set_string (value, adaptor_no_s);
- g_free (adaptor_no_s);
- break;
- }
- case ARG_DEVICE_NAME:
- if (xvimagesink->xcontext && xvimagesink->xcontext->adaptors) {
- g_value_set_string (value,
- xvimagesink->xcontext->adaptors[xvimagesink->adaptor_no]);
- } else {
- g_value_set_string (value, NULL);
- }
- break;
- case ARG_HANDLE_EXPOSE:
- g_value_set_boolean (value, xvimagesink->handle_expose);
- break;
- case ARG_DOUBLE_BUFFER:
- g_value_set_boolean (value, xvimagesink->double_buffer);
- break;
- case ARG_AUTOPAINT_COLORKEY:
- g_value_set_boolean (value, xvimagesink->autopaint_colorkey);
- break;
- case ARG_COLORKEY:
- g_value_set_int (value, xvimagesink->colorkey);
- break;
- case ARG_DRAW_BORDERS:
- g_value_set_boolean (value, xvimagesink->draw_borders);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_xvimagesink_reset (GstXvImageSink * xvimagesink)
-{
- GThread *thread;
-
- GST_OBJECT_LOCK (xvimagesink);
- xvimagesink->running = FALSE;
- /* grab thread and mark it as NULL */
- thread = xvimagesink->event_thread;
- xvimagesink->event_thread = NULL;
- GST_OBJECT_UNLOCK (xvimagesink);
-
- /* invalidate the pool, current allocations continue, new buffer_alloc fails
- * with wrong_state */
- g_mutex_lock (xvimagesink->pool_lock);
- xvimagesink->pool_invalid = TRUE;
- g_mutex_unlock (xvimagesink->pool_lock);
-
- /* Wait for our event thread to finish before we clean up our stuff. */
- if (thread)
- g_thread_join (thread);
-
- if (xvimagesink->cur_image) {
- gst_buffer_unref (GST_BUFFER_CAST (xvimagesink->cur_image));
- xvimagesink->cur_image = NULL;
- }
- if (xvimagesink->xvimage) {
- gst_buffer_unref (GST_BUFFER_CAST (xvimagesink->xvimage));
- xvimagesink->xvimage = NULL;
- }
-
- gst_xvimagesink_imagepool_clear (xvimagesink);
-
- if (xvimagesink->xwindow) {
- gst_xvimagesink_xwindow_clear (xvimagesink, xvimagesink->xwindow);
- gst_xvimagesink_xwindow_destroy (xvimagesink, xvimagesink->xwindow);
- xvimagesink->xwindow = NULL;
- }
-
- gst_xvimagesink_xcontext_clear (xvimagesink);
-}
-
-/* Finalize is called only once, dispose can be called multiple times.
- * We use mutexes and don't reset stuff to NULL here so let's register
- * as a finalize. */
-static void
-gst_xvimagesink_finalize (GObject * object)
-{
- GstXvImageSink *xvimagesink;
-
- xvimagesink = GST_XVIMAGESINK (object);
-
- gst_xvimagesink_reset (xvimagesink);
-
- if (xvimagesink->display_name) {
- g_free (xvimagesink->display_name);
- xvimagesink->display_name = NULL;
- }
-
- if (xvimagesink->par) {
- g_free (xvimagesink->par);
- xvimagesink->par = NULL;
- }
- if (xvimagesink->x_lock) {
- g_mutex_free (xvimagesink->x_lock);
- xvimagesink->x_lock = NULL;
- }
- if (xvimagesink->flow_lock) {
- g_mutex_free (xvimagesink->flow_lock);
- xvimagesink->flow_lock = NULL;
- }
- if (xvimagesink->pool_lock) {
- g_mutex_free (xvimagesink->pool_lock);
- xvimagesink->pool_lock = NULL;
- }
-
- g_free (xvimagesink->media_title);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_xvimagesink_init (GstXvImageSink * xvimagesink)
-{
- xvimagesink->display_name = NULL;
- xvimagesink->adaptor_no = 0;
- xvimagesink->xcontext = NULL;
- xvimagesink->xwindow = NULL;
- xvimagesink->xvimage = NULL;
- xvimagesink->cur_image = NULL;
-
- xvimagesink->hue = xvimagesink->saturation = 0;
- xvimagesink->contrast = xvimagesink->brightness = 0;
- xvimagesink->cb_changed = FALSE;
-
- xvimagesink->fps_n = 0;
- xvimagesink->fps_d = 0;
- xvimagesink->video_width = 0;
- xvimagesink->video_height = 0;
-
- xvimagesink->x_lock = g_mutex_new ();
- xvimagesink->flow_lock = g_mutex_new ();
-
- xvimagesink->image_pool = NULL;
- xvimagesink->pool_lock = g_mutex_new ();
-
- xvimagesink->synchronous = FALSE;
- xvimagesink->double_buffer = TRUE;
- xvimagesink->running = FALSE;
- xvimagesink->keep_aspect = FALSE;
- xvimagesink->handle_events = TRUE;
- xvimagesink->par = NULL;
- xvimagesink->handle_expose = TRUE;
- xvimagesink->autopaint_colorkey = TRUE;
-
- /* on 16bit displays this becomes r,g,b = 1,2,3
- * on 24bit displays this becomes r,g,b = 8,8,16
- * as a port atom value
- */
- xvimagesink->colorkey = (8 << 16) | (8 << 8) | 16;
- xvimagesink->draw_borders = TRUE;
-}
-
-static void
-gst_xvimagesink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &gst_xvimagesink_details);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_xvimagesink_sink_template_factory));
-}
-
-static void
-gst_xvimagesink_class_init (GstXvImageSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- GstBaseSinkClass *gstbasesink_class;
- GstVideoSinkClass *videosink_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
- gstbasesink_class = (GstBaseSinkClass *) klass;
- videosink_class = (GstVideoSinkClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->set_property = gst_xvimagesink_set_property;
- gobject_class->get_property = gst_xvimagesink_get_property;
-
- g_object_class_install_property (gobject_class, ARG_CONTRAST,
- g_param_spec_int ("contrast", "Contrast", "The contrast of the video",
- -1000, 1000, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_BRIGHTNESS,
- g_param_spec_int ("brightness", "Brightness",
- "The brightness of the video", -1000, 1000, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_HUE,
- g_param_spec_int ("hue", "Hue", "The hue of the video", -1000, 1000, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_SATURATION,
- g_param_spec_int ("saturation", "Saturation",
- "The saturation of the video", -1000, 1000, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_DISPLAY,
- g_param_spec_string ("display", "Display", "X Display name", NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_SYNCHRONOUS,
- g_param_spec_boolean ("synchronous", "Synchronous",
- "When enabled, runs "
- "the X display in synchronous mode. (used only for debugging)", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_PIXEL_ASPECT_RATIO,
- g_param_spec_string ("pixel-aspect-ratio", "Pixel Aspect Ratio",
- "The pixel aspect ratio of the device", "1/1",
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_FORCE_ASPECT_RATIO,
- g_param_spec_boolean ("force-aspect-ratio", "Force aspect ratio",
- "When enabled, scaling will respect original aspect ratio", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_HANDLE_EVENTS,
- g_param_spec_boolean ("handle-events", "Handle XEvents",
- "When enabled, XEvents will be selected and handled", TRUE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_DEVICE,
- g_param_spec_string ("device", "Adaptor number",
- "The number of the video adaptor", "0",
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_DEVICE_NAME,
- g_param_spec_string ("device-name", "Adaptor name",
- "The name of the video adaptor", NULL,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- /**
- * GstXvImageSink:handle-expose
- *
- * When enabled, the current frame will always be drawn in response to X
- * Expose.
- *
- * Since: 0.10.14
- */
- g_object_class_install_property (gobject_class, ARG_HANDLE_EXPOSE,
- g_param_spec_boolean ("handle-expose", "Handle expose",
- "When enabled, "
- "the current frame will always be drawn in response to X Expose "
- "events", TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstXvImageSink:double-buffer
- *
- * Whether to double-buffer the output.
- *
- * Since: 0.10.14
- */
- g_object_class_install_property (gobject_class, ARG_DOUBLE_BUFFER,
- g_param_spec_boolean ("double-buffer", "Double-buffer",
- "Whether to double-buffer the output", TRUE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstXvImageSink:autopaint-colorkey
- *
- * Whether to autofill overlay with colorkey
- *
- * Since: 0.10.21
- */
- g_object_class_install_property (gobject_class, ARG_AUTOPAINT_COLORKEY,
- g_param_spec_boolean ("autopaint-colorkey", "Autofill with colorkey",
- "Whether to autofill overlay with colorkey", TRUE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /**
- * GstXvImageSink:colorkey
- *
- * Color to use for the overlay mask.
- *
- * Since: 0.10.21
- */
- g_object_class_install_property (gobject_class, ARG_COLORKEY,
- g_param_spec_int ("colorkey", "Colorkey",
- "Color to use for the overlay mask", G_MININT, G_MAXINT, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /**
- * GstXvImageSink:draw-borders
- *
- * Draw black borders when using GstXvImageSink:force-aspect-ratio to fill
- * unused parts of the video area.
- *
- * Since: 0.10.21
- */
- g_object_class_install_property (gobject_class, ARG_DRAW_BORDERS,
- g_param_spec_boolean ("draw-borders", "Colorkey",
- "Draw black borders to fill unused area in force-aspect-ratio mode",
- TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gobject_class->finalize = gst_xvimagesink_finalize;
-
- gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_xvimagesink_change_state);
-
- gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_xvimagesink_getcaps);
- gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_xvimagesink_setcaps);
- gstbasesink_class->buffer_alloc =
- GST_DEBUG_FUNCPTR (gst_xvimagesink_buffer_alloc);
- gstbasesink_class->get_times = GST_DEBUG_FUNCPTR (gst_xvimagesink_get_times);
- gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_xvimagesink_event);
-
- videosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_xvimagesink_show_frame);
-}
-
-/* ============================================================= */
-/* */
-/* Public Methods */
-/* */
-/* ============================================================= */
-
-/* =========================================== */
-/* */
-/* Object typing & Creation */
-/* */
-/* =========================================== */
-
-GType
-gst_xvimagesink_get_type (void)
-{
- static GType xvimagesink_type = 0;
-
- if (!xvimagesink_type) {
- static const GTypeInfo xvimagesink_info = {
- sizeof (GstXvImageSinkClass),
- gst_xvimagesink_base_init,
- NULL,
- (GClassInitFunc) gst_xvimagesink_class_init,
- NULL,
- NULL,
- sizeof (GstXvImageSink),
- 0,
- (GInstanceInitFunc) gst_xvimagesink_init,
- };
- static const GInterfaceInfo iface_info = {
- (GInterfaceInitFunc) gst_xvimagesink_interface_init,
- NULL,
- NULL,
- };
- static const GInterfaceInfo navigation_info = {
- (GInterfaceInitFunc) gst_xvimagesink_navigation_init,
- NULL,
- NULL,
- };
- static const GInterfaceInfo overlay_info = {
- (GInterfaceInitFunc) gst_xvimagesink_xoverlay_init,
- NULL,
- NULL,
- };
- static const GInterfaceInfo colorbalance_info = {
- (GInterfaceInitFunc) gst_xvimagesink_colorbalance_init,
- NULL,
- NULL,
- };
- static const GInterfaceInfo propertyprobe_info = {
- (GInterfaceInitFunc) gst_xvimagesink_property_probe_interface_init,
- NULL,
- NULL,
- };
- xvimagesink_type = g_type_register_static (GST_TYPE_VIDEO_SINK,
- "GstXvImageSink", &xvimagesink_info, 0);
-
- g_type_add_interface_static (xvimagesink_type,
- GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info);
- g_type_add_interface_static (xvimagesink_type, GST_TYPE_NAVIGATION,
- &navigation_info);
- g_type_add_interface_static (xvimagesink_type, GST_TYPE_X_OVERLAY,
- &overlay_info);
- g_type_add_interface_static (xvimagesink_type, GST_TYPE_COLOR_BALANCE,
- &colorbalance_info);
- g_type_add_interface_static (xvimagesink_type, GST_TYPE_PROPERTY_PROBE,
- &propertyprobe_info);
-
-
- /* register type and create class in a more safe place instead of at
- * runtime since the type registration and class creation is not
- * threadsafe. */
- g_type_class_ref (gst_xvimage_buffer_get_type ());
- }
-
- return xvimagesink_type;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_element_register (plugin, "xvimagesink",
- GST_RANK_PRIMARY, GST_TYPE_XVIMAGESINK))
- return FALSE;
-
- GST_DEBUG_CATEGORY_INIT (gst_debug_xvimagesink, "xvimagesink", 0,
- "xvimagesink element");
- GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "xvimagesink",
- "XFree86 video output plugin using Xv extension",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/sys/xvimage/xvimagesink.h b/sys/xvimage/xvimagesink.h
deleted file mode 100644
index 02995f83..00000000
--- a/sys/xvimage/xvimagesink.h
+++ /dev/null
@@ -1,299 +0,0 @@
-/* GStreamer
- * Copyright (C) <2005> Julien Moutte <julien@moutte.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_XVIMAGESINK_H__
-#define __GST_XVIMAGESINK_H__
-
-#include <gst/video/gstvideosink.h>
-
-#ifdef HAVE_XSHM
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#endif /* HAVE_XSHM */
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#ifdef HAVE_XSHM
-#include <X11/extensions/XShm.h>
-#endif /* HAVE_XSHM */
-
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/Xvlib.h>
-
-#include <string.h>
-#include <math.h>
-#include <stdlib.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_XVIMAGESINK \
- (gst_xvimagesink_get_type())
-#define GST_XVIMAGESINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_XVIMAGESINK, GstXvImageSink))
-#define GST_XVIMAGESINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_XVIMAGESINK, GstXvImageSinkClass))
-#define GST_IS_XVIMAGESINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_XVIMAGESINK))
-#define GST_IS_XVIMAGESINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_XVIMAGESINK))
-
-typedef struct _GstXContext GstXContext;
-typedef struct _GstXWindow GstXWindow;
-typedef struct _GstXvImageFormat GstXvImageFormat;
-typedef struct _GstXvImageBuffer GstXvImageBuffer;
-typedef struct _GstXvImageBufferClass GstXvImageBufferClass;
-
-typedef struct _GstXvImageSink GstXvImageSink;
-typedef struct _GstXvImageSinkClass GstXvImageSinkClass;
-
-/*
- * GstXContext:
- * @disp: the X11 Display of this context
- * @screen: the default Screen of Display @disp
- * @screen_num: the Screen number of @screen
- * @visual: the default Visual of Screen @screen
- * @root: the root Window of Display @disp
- * @white: the value of a white pixel on Screen @screen
- * @black: the value of a black pixel on Screen @screen
- * @depth: the color depth of Display @disp
- * @bpp: the number of bits per pixel on Display @disp
- * @endianness: the endianness of image bytes on Display @disp
- * @width: the width in pixels of Display @disp
- * @height: the height in pixels of Display @disp
- * @widthmm: the width in millimeters of Display @disp
- * @heightmm: the height in millimeters of Display @disp
- * @par: the pixel aspect ratio calculated from @width, @widthmm and @height,
- * @heightmm ratio
- * @use_xshm: used to known wether of not XShm extension is usable or not even
- * if the Extension is present
- * @xv_port_id: the XVideo port ID
- * @im_format: used to store at least a valid format for XShm calls checks
- * @formats_list: list of supported image formats on @xv_port_id
- * @channels_list: list of #GstColorBalanceChannels
- * @caps: the #GstCaps that Display @disp can accept
- *
- * Structure used to store various informations collected/calculated for a
- * Display.
- */
-struct _GstXContext {
- Display *disp;
-
- Screen *screen;
- gint screen_num;
-
- Visual *visual;
-
- Window root;
-
- gulong white, black;
-
- gint depth;
- gint bpp;
- gint endianness;
-
- gint width, height;
- gint widthmm, heightmm;
- GValue *par; /* calculated pixel aspect ratio */
-
- gboolean use_xshm;
-
- XvPortID xv_port_id;
- guint nb_adaptors;
- gchar ** adaptors;
- gint im_format;
-
- GList *formats_list;
- GList *channels_list;
-
- GstCaps *caps;
-
- /* Optimisation storage for buffer_alloc return */
- GstCaps *last_caps;
- gint last_format;
- gint last_width;
- gint last_height;
-};
-
-/*
- * GstXWindow:
- * @win: the Window ID of this X11 window
- * @width: the width in pixels of Window @win
- * @height: the height in pixels of Window @win
- * @internal: used to remember if Window @win was created internally or passed
- * through the #GstXOverlay interface
- * @gc: the Graphical Context of Window @win
- *
- * Structure used to store informations about a Window.
- */
-struct _GstXWindow {
- Window win;
- gint width, height;
- gboolean internal;
- GC gc;
-};
-
-/**
- * GstXvImageFormat:
- * @format: the image format
- * @caps: generated #GstCaps for this image format
- *
- * Structure storing image format to #GstCaps association.
- */
-struct _GstXvImageFormat {
- gint format;
- GstCaps *caps;
-};
-
-/**
- * GstXImageBuffer:
- * @xvimagesink: a reference to our #GstXvImageSink
- * @xvimage: the XvImage of this buffer
- * @width: the width in pixels of XvImage @xvimage
- * @height: the height in pixels of XvImage @xvimage
- * @im_format: the image format of XvImage @xvimage
- * @size: the size in bytes of XvImage @xvimage
- *
- * Subclass of #GstBuffer containing additional information about an XvImage.
- */
-struct _GstXvImageBuffer {
- GstBuffer buffer;
-
- /* Reference to the xvimagesink we belong to */
- GstXvImageSink *xvimagesink;
-
- XvImage *xvimage;
-
-#ifdef HAVE_XSHM
- XShmSegmentInfo SHMInfo;
-#endif /* HAVE_XSHM */
-
- gint width, height, im_format;
- size_t size;
-};
-
-/**
- * GstXvImageSink:
- * @display_name: the name of the Display we want to render to
- * @xcontext: our instance's #GstXContext
- * @xwindow: the #GstXWindow we are rendering to
- * @xvimage: internal #GstXvImage used to store incoming buffers and render when
- * not using the buffer_alloc optimization mechanism
- * @cur_image: a reference to the last #GstXvImage that was put to @xwindow. It
- * is used when Expose events are received to redraw the latest video frame
- * @event_thread: a thread listening for events on @xwindow and handling them
- * @running: used to inform @event_thread if it should run/shutdown
- * @fps_n: the framerate fraction numerator
- * @fps_d: the framerate fraction denominator
- * @x_lock: used to protect X calls as we are not using the XLib in threaded
- * mode
- * @flow_lock: used to protect data flow routines from external calls such as
- * events from @event_thread or methods from the #GstXOverlay interface
- * @par: used to override calculated pixel aspect ratio from @xcontext
- * @pool_lock: used to protect the buffer pool
- * @image_pool: a list of #GstXvImageBuffer that could be reused at next buffer
- * allocation call
- * @synchronous: used to store if XSynchronous should be used or not (for
- * debugging purpose only)
- * @keep_aspect: used to remember if reverse negotiation scaling should respect
- * aspect ratio
- * @handle_events: used to know if we should handle select XEvents or not
- * @brightness: used to store the user settings for color balance brightness
- * @contrast: used to store the user settings for color balance contrast
- * @hue: used to store the user settings for color balance hue
- * @saturation: used to store the user settings for color balance saturation
- * @cb_changed: used to store if the color balance settings where changed
- * @video_width: the width of incoming video frames in pixels
- * @video_height: the height of incoming video frames in pixels
- *
- * The #GstXvImageSink data structure.
- */
-struct _GstXvImageSink {
- /* Our element stuff */
- GstVideoSink videosink;
-
- char *display_name;
- guint adaptor_no;
-
- GstXContext *xcontext;
- GstXWindow *xwindow;
- GstXvImageBuffer *xvimage;
- GstXvImageBuffer *cur_image;
-
- GThread *event_thread;
- gboolean running;
-
- gint fps_n;
- gint fps_d;
-
- GMutex *x_lock;
- GMutex *flow_lock;
-
- /* object-set pixel aspect ratio */
- GValue *par;
-
- GMutex *pool_lock;
- gboolean pool_invalid;
- GSList *image_pool;
-
- gboolean synchronous;
- gboolean double_buffer;
- gboolean keep_aspect;
- gboolean redraw_border;
- gboolean handle_events;
- gboolean handle_expose;
-
- gint brightness;
- gint contrast;
- gint hue;
- gint saturation;
- gboolean cb_changed;
-
- /* size of incoming video, used as the size for XvImage */
- guint video_width, video_height;
-
- /* display sizes, used for clipping the image */
- gint disp_x, disp_y;
- gint disp_width, disp_height;
-
- /* port attributes */
- gboolean autopaint_colorkey;
- gint colorkey;
-
- gboolean draw_borders;
-
- /* port features */
- gboolean have_autopaint_colorkey;
- gboolean have_colorkey;
- gboolean have_double_buffer;
-
- /* stream metadata */
- gchar *media_title;
-};
-
-struct _GstXvImageSinkClass {
- GstVideoSinkClass parent_class;
-};
-
-GType gst_xvimagesink_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_XVIMAGESINK_H__ */
diff --git a/tests/Makefile.am b/tests/Makefile.am
deleted file mode 100644
index b5c677c0..00000000
--- a/tests/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-if BUILD_EXAMPLES
-SUBDIRS_EXAMPLES = examples
-else
-SUBDIRS_EXAMPLES =
-endif
-
-if HAVE_GST_CHECK
-SUBDIRS_CHECK = check
-else
-SUBDIRS_CHECK =
-endif
-
-if USE_X
-SUBDIRS_ICLES = icles
-else
-SUBDIRS_ICLES =
-endif
-
-SUBDIRS = \
- $(SUBDIRS_CHECK) \
- $(SUBDIRS_EXAMPLES) \
- $(SUBDIRS_ICLES)
-
-DIST_SUBDIRS = \
- check \
- examples \
- icles
diff --git a/tests/check/.gitignore b/tests/check/.gitignore
deleted file mode 100644
index 9af31302..00000000
--- a/tests/check/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-test-registry.*
diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am
deleted file mode 100644
index 78099541..00000000
--- a/tests/check/Makefile.am
+++ /dev/null
@@ -1,362 +0,0 @@
-include $(top_srcdir)/common/check.mak
-
-CHECK_REGISTRY = $(top_builddir)/tests/check/test-registry.reg
-
-REGISTRY_ENVIRONMENT = \
- GST_REGISTRY=$(CHECK_REGISTRY)
-
-TESTS_ENVIRONMENT = \
- CK_DEFAULT_TIMEOUT=120 \
- STATE_IGNORE_ELEMENTS="$(STATE_IGNORE_ELEMENTS)" \
- $(REGISTRY_ENVIRONMENT) \
- GST_PLUGIN_SYSTEM_PATH= \
- GST_PLUGIN_PATH=$(top_builddir)/gst:$(top_builddir)/sys:$(top_builddir)/ext:$(GST_PLUGINS_DIR)
-
-# ths core dumps of some machines have PIDs appended
-CLEANFILES = core.* test-registry.*
-
-clean-local: clean-local-check
-
-$(CHECK_REGISTRY):
- $(TESTS_ENVIRONMENT)
-
-# elements to ignore for the state tests
-STATE_IGNORE_ELEMENTS = cdio cdparanoiasrc libvisual_ alsasrc alsamixer alsasink
-
-TESTS = $(check_PROGRAMS)
-
-if USE_ALSA
-check_alsa = elements/alsa
-else
-check_alsa =
-endif
-
-if USE_GNOME_VFS
-check_gnomevfs = elements/gnomevfssink
-else
-check_gnomevfs =
-endif
-
-if USE_GIO
-check_gio = pipelines/gio
-else
-check_gio =
-endif
-
-if USE_LIBVISUAL
-check_libvisual = elements/libvisual
-else
-check_libvisual =
-endif
-
-if USE_OGG
-check_ogg = pipelines/oggmux
-else
-check_ogg =
-endif
-
-if USE_PANGO
-check_pango = elements/textoverlay
-else
-check_pango =
-endif
-
-if USE_VORBIS
-check_vorbis = elements/vorbisdec pipelines/vorbisenc pipelines/vorbisdec \
- elements/vorbistag
-else
-check_vorbis =
-endif
-
-if USE_THEORA
-check_theora = pipelines/theoraenc
-else
-check_theora =
-endif
-
-if USE_PLUGIN_SUBPARSE
-check_subparse = elements/subparse
-else
-check_subparse =
-endif
-
-check_PROGRAMS = \
- $(check_alsa) \
- $(check_gnomevfs) \
- $(check_gio) \
- $(check_ogg) \
- $(check_pango) \
- $(check_vorbis) \
- $(check_theora) \
- elements/adder \
- elements/appsink \
- elements/audioconvert \
- elements/audiorate \
- elements/audioresample \
- elements/audiotestsrc \
- elements/decodebin \
- elements/decodebin2 \
- elements/ffmpegcolorspace \
- elements/gdpdepay \
- elements/gdppay \
- elements/multifdsink \
- elements/playbin \
- elements/playbin2 \
- $(check_subparse) \
- elements/videorate \
- elements/videoscale \
- elements/videotestsrc \
- elements/volume \
- generic/clock-selection \
- generic/states \
- gst/typefindfunctions \
- libs/audio \
- libs/cddabasesrc \
- libs/fft \
- libs/mixer \
- libs/navigation \
- libs/netbuffer \
- libs/pbutils \
- libs/rtp \
- libs/tag \
- libs/video \
- pipelines/simple-launch-lines \
- pipelines/streamheader \
- pipelines/basetime
-
-# TORTURE_TO_FIX = \
-# elements/adder
-
-# ffmpegcolorspace takes too long, so disabled for now
-VALGRIND_TO_FIX = \
- elements/ffmpegcolorspace \
- libs/video
-
-# these tests don't even pass
-noinst_PROGRAMS = $(check_libvisual)
-
-AM_CFLAGS = $(GST_CFLAGS) $(GST_CHECK_CFLAGS)
-LDADD = $(GST_LIBS) $(GST_CHECK_LIBS)
-
-# valgrind testing
-VALGRIND_TESTS_DISABLE = $(VALGRIND_TO_FIX)
-
-SUPPRESSIONS = $(top_srcdir)/common/gst.supp $(srcdir)/gst-plugins-base.supp
-
-libs_audio_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(AM_CFLAGS)
-
-libs_audio_LDADD = \
- $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
- $(GST_BASE_LIBS) \
- $(LDADD)
-
-libs_cddabasesrc_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(AM_CFLAGS)
-
-libs_cddabasesrc_LDADD = \
- $(top_builddir)/gst-libs/gst/cdda/libgstcdda-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/tag/libgsttag-@GST_MAJORMINOR@.la \
- $(GST_BASE_LIBS) \
- $(LDADD)
-
-libs_fft_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(AM_CFLAGS)
-
-libs_fft_LDADD = \
- $(top_builddir)/gst-libs/gst/fft/libgstfft-@GST_MAJORMINOR@.la \
- $(GST_BASE_LIBS) \
- $(LDADD)
-
-libs_mixer_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(AM_CFLAGS)
-
-libs_mixer_LDADD = \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
- $(GST_BASE_LIBS) \
- $(LDADD)
-
-libs_navigation_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(AM_CFLAGS)
-
-libs_navigation_LDADD = \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
- $(GST_BASE_LIBS) \
- $(LDADD)
-
-libs_netbuffer_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(AM_CFLAGS)
-libs_netbuffer_LDADD = \
- $(top_builddir)/gst-libs/gst/netbuffer/libgstnetbuffer-@GST_MAJORMINOR@.la \
- $(LDADD)
-
-libs_rtp_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(AM_CFLAGS)
-libs_rtp_LDADD = \
- $(top_builddir)/gst-libs/gst/rtp/libgstrtp-@GST_MAJORMINOR@.la $(LDADD)
-
-libs_tag_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(AM_CFLAGS)
-libs_tag_LDADD = \
- $(top_builddir)/gst-libs/gst/tag/libgsttag-@GST_MAJORMINOR@.la $(LDADD)
-
-libs_pbutils_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(AM_CFLAGS)
-libs_pbutils_LDADD = \
- $(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la $(LDADD)
-
-elements_appsink_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(AM_CFLAGS)
-
-elements_appsink_LDADD = \
- $(top_builddir)/gst-libs/gst/app/libgstapp-@GST_MAJORMINOR@.la \
- $(LDADD)
-
-elements_alsa_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(AM_CFLAGS)
-
-elements_alsa_LDADD = \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
- $(LDADD)
-
-elements_audioconvert_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(AM_CFLAGS)
-
-elements_audioconvert_LDADD = \
- $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
- $(GST_BASE_LIBS) \
- $(LDADD)
-
-elements_audiorate_LDADD = $(LDADD)
-elements_audiorate_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
-
-elements_libvisual_LDADD = $(LDADD)
-elements_libvisual_CFLAGS = $(CFLAGS) $(AM_CFLAGS)
-
-elements_gdpdepay_LDADD = $(GST_GDP_LIBS) $(LDADD)
-elements_gdppay_LDADD = $(GST_GDP_LIBS) $(LDADD)
-
-elements_playbin_LDADD = $(GST_BASE_LIBS) $(LDADD)
-elements_playbin_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS)
-
-elements_playbin2_LDADD = $(GST_BASE_LIBS) $(LDADD)
-elements_playbin2_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS)
-
-elements_decodebin_LDADD = $(GST_BASE_LIBS) $(LDADD)
-elements_decodebin_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS)
-
-elements_decodebin2_LDADD = $(GST_BASE_LIBS) $(LDADD)
-elements_decodebin2_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS)
-
-elements_subparse_LDADD = $(LDADD)
-elements_subparse_CFLAGS = $(CFLAGS) $(AM_CFLAGS)
-
-elements_audioresample_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(AM_CFLAGS)
-
-elements_audioresample_LDADD = \
- $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
- $(GST_BASE_LIBS) \
- $(LDADD)
-
-elements_textoverlay_LDADD = $(GST_BASE_LIBS) $(LDADD)
-elements_textoverlay_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS)
-
-elements_volume_LDADD = \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
- $(GST_PLUGINS_BASE_LIBS) \
- $(GST_CONTROLLER_LIBS) \
- $(GST_BASE_LIBS) \
- $(LDADD)
-
-elements_volume_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_CONTROLLER_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(AM_CFLAGS)
-
-elements_vorbisdec_LDADD = \
- $(LDADD) \
- $(VORBIS_LIBS)
-
-elements_vorbisdec_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(AM_CFLAGS) \
- $(VORBIS_CFLAGS) \
- $(CFLAGS)
-
-elements_vorbistag_LDADD = \
- $(LDADD) \
- $(VORBIS_LIBS)
-
-elements_vorbistag_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(AM_CFLAGS) \
- $(VORBIS_CFLAGS) \
- $(CFLAGS)
-
-gst_typefindfunctions_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS)
-gst_typefindfunctions_LDADD = $(GST_BASE_LIBS) $(LDADD)
-
-libs_video_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(AM_CFLAGS)
-
-libs_video_LDADD = \
- $(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_MAJORMINOR@.la \
- $(GST_BASE_LIBS) \
- $(LDADD)
-
-pipelines_gio_CFLAGS = $(GIO_CFLAGS) $(AM_CFLAGS)
-pipelines_gio_LDADD = $(GIO_LIBS) $(LDADD)
-
-pipelines_vorbisenc_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(AM_CFLAGS)
-
-# this seemingly useless CFLAGS line is here only to avoid
-# vorbisdec.$(OBJEXT) by triggering creation of pipelines_vorbisdec.$(OBJEXT)
-# instead
-pipelines_vorbisdec_CFLAGS = $(AM_CFLAGS)
-
-pipelines_oggmux_LDADD = $(LDADD) $(OGG_LIBS)
-pipelines_oggmux_CFLAGS = $(AM_CFLAGS) $(OGG_CFLAGS)
-
-pipelines_theoraenc_CFLAGS = $(AM_CFLAGS) $(THEORA_CFLAGS)
-pipelines_theoraenc_LDADD = $(LDADD) $(THEORA_LIBS)
-
-pipelines_simple_launch_lines_CFLAGS = \
- $(GST_BASE_CFLAGS) \
- $(AM_CFLAGS)
-
-pipelines_simple_launch_lines_LDADD = \
- $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
- $(GST_BASE_LIBS) \
- $(LDADD)
-
-EXTRA_DIST = gst-plugins-base.supp
diff --git a/tests/check/elements/.gitignore b/tests/check/elements/.gitignore
deleted file mode 100644
index 00ab7d17..00000000
--- a/tests/check/elements/.gitignore
+++ /dev/null
@@ -1,27 +0,0 @@
-.dirstamp
-adder
-alsa
-appsink
-audioconvert
-audiorate
-audioresample
-audiotestsrc
-decodebin
-decodebin2
-gdpdepay
-gdppay
-gnomevfssink
-libvisual
-multifdsink
-videorate
-videotestsrc
-volume
-vorbisdec
-typefindfunctions
-textoverlay
-ffmpegcolorspace
-videoscale
-vorbistag
-playbin
-playbin2
-subparse
diff --git a/tests/check/elements/adder.c b/tests/check/elements/adder.c
deleted file mode 100644
index db0e79ac..00000000
--- a/tests/check/elements/adder.c
+++ /dev/null
@@ -1,889 +0,0 @@
-/* GStreamer
- *
- * unit test for adder
- *
- * Copyright (C) <2005> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef HAVE_VALGRIND
-# include <valgrind/valgrind.h>
-#endif
-
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-#include <gst/check/gstconsistencychecker.h>
-
-static GMainLoop *main_loop;
-
-static void
-message_received (GstBus * bus, GstMessage * message, GstPipeline * bin)
-{
- GST_INFO ("bus message from \"%" GST_PTR_FORMAT "\": %" GST_PTR_FORMAT,
- GST_MESSAGE_SRC (message), message);
-
- switch (message->type) {
- case GST_MESSAGE_EOS:
- g_main_loop_quit (main_loop);
- break;
- case GST_MESSAGE_WARNING:{
- GError *gerror;
- gchar *debug;
-
- gst_message_parse_warning (message, &gerror, &debug);
- gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug);
- g_error_free (gerror);
- g_free (debug);
- break;
- }
- case GST_MESSAGE_ERROR:{
- GError *gerror;
- gchar *debug;
-
- gst_message_parse_error (message, &gerror, &debug);
- gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug);
- g_error_free (gerror);
- g_free (debug);
- g_main_loop_quit (main_loop);
- break;
- }
- default:
- break;
- }
-}
-
-
-static GstFormat format = GST_FORMAT_UNDEFINED;
-static gint64 position = -1;
-
-static void
-test_event_message_received (GstBus * bus, GstMessage * message,
- GstPipeline * bin)
-{
- GST_INFO ("bus message from \"%" GST_PTR_FORMAT "\": %" GST_PTR_FORMAT,
- GST_MESSAGE_SRC (message), message);
-
- switch (message->type) {
- case GST_MESSAGE_SEGMENT_DONE:
- gst_message_parse_segment_done (message, &format, &position);
- GST_INFO ("received segment_done : %" G_GINT64_FORMAT, position);
- g_main_loop_quit (main_loop);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-}
-
-
-GST_START_TEST (test_event)
-{
- GstElement *bin, *src1, *src2, *adder, *sink;
- GstBus *bus;
- GstEvent *seek_event;
- gboolean res;
- GstPad *srcpad;
- GstStreamConsistency *consist;
-
- GST_INFO ("preparing test");
-
- /* build pipeline */
- bin = gst_pipeline_new ("pipeline");
- bus = gst_element_get_bus (bin);
- gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
-
- /* FIXME, fakesrc with default setting will produce 0 sized
- * buffers and incompatible caps for adder that will make
- * adder EOS and error out */
- src1 = gst_element_factory_make ("audiotestsrc", "src1");
- g_object_set (src1, "wave", 4, NULL); /* silence */
- src2 = gst_element_factory_make ("audiotestsrc", "src2");
- g_object_set (src2, "wave", 4, NULL); /* silence */
- adder = gst_element_factory_make ("adder", "adder");
- sink = gst_element_factory_make ("fakesink", "sink");
- gst_bin_add_many (GST_BIN (bin), src1, src2, adder, sink, NULL);
-
- res = gst_element_link (src1, adder);
- fail_unless (res == TRUE, NULL);
- res = gst_element_link (src2, adder);
- fail_unless (res == TRUE, NULL);
- res = gst_element_link (adder, sink);
- fail_unless (res == TRUE, NULL);
-
- srcpad = gst_element_get_static_pad (adder, "src");
- consist = gst_consistency_checker_new (srcpad);
- gst_object_unref (srcpad);
-
- seek_event = gst_event_new_seek (1.0, GST_FORMAT_TIME,
- GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_FLUSH,
- GST_SEEK_TYPE_SET, (GstClockTime) 0,
- GST_SEEK_TYPE_SET, (GstClockTime) 2 * GST_SECOND);
-
- format = GST_FORMAT_UNDEFINED;
- position = -1;
-
- main_loop = g_main_loop_new (NULL, FALSE);
- g_signal_connect (bus, "message::segment-done",
- (GCallback) test_event_message_received, bin);
- g_signal_connect (bus, "message::error", (GCallback) message_received, bin);
- g_signal_connect (bus, "message::warning", (GCallback) message_received, bin);
- g_signal_connect (bus, "message::eos", (GCallback) message_received, bin);
-
- GST_INFO ("starting test");
-
- /* prepare playing */
- res = gst_element_set_state (bin, GST_STATE_PAUSED);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- /* wait for completion */
- res = gst_element_get_state (bin, NULL, NULL, GST_CLOCK_TIME_NONE);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- res = gst_element_send_event (bin, seek_event);
- fail_unless (res == TRUE, NULL);
-
- /* run pipeline */
- res = gst_element_set_state (bin, GST_STATE_PLAYING);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- g_main_loop_run (main_loop);
-
- res = gst_element_set_state (bin, GST_STATE_NULL);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- fail_unless (position == 2 * GST_SECOND, NULL);
-
- /* cleanup */
- g_main_loop_unref (main_loop);
- gst_consistency_checker_free (consist);
- gst_object_unref (G_OBJECT (bus));
- gst_object_unref (G_OBJECT (bin));
-}
-
-GST_END_TEST;
-
-static guint play_count = 0;
-static GstEvent *play_seek_event = NULL;
-
-static void
-test_play_twice_message_received (GstBus * bus, GstMessage * message,
- GstPipeline * bin)
-{
- gboolean res;
-
- GST_INFO ("bus message from \"%" GST_PTR_FORMAT "\": %" GST_PTR_FORMAT,
- GST_MESSAGE_SRC (message), message);
-
- switch (message->type) {
- case GST_MESSAGE_SEGMENT_DONE:
- play_count++;
- if (play_count == 1) {
- res = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_READY);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- /* prepare playing again */
- res = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- /* wait for completion */
- res =
- gst_element_get_state (GST_ELEMENT (bin), NULL, NULL,
- GST_CLOCK_TIME_NONE);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- res = gst_element_send_event (GST_ELEMENT (bin),
- gst_event_ref (play_seek_event));
- fail_unless (res == TRUE, NULL);
-
- res = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
- } else {
- g_main_loop_quit (main_loop);
- }
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-}
-
-
-GST_START_TEST (test_play_twice)
-{
- GstElement *bin, *src1, *src2, *adder, *sink;
- GstBus *bus;
- gboolean res;
- GstPad *srcpad;
- GstStreamConsistency *consist;
-
- GST_INFO ("preparing test");
-
- /* build pipeline */
- bin = gst_pipeline_new ("pipeline");
- bus = gst_element_get_bus (bin);
- gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
-
- src1 = gst_element_factory_make ("audiotestsrc", "src1");
- g_object_set (src1, "wave", 4, NULL); /* silence */
- src2 = gst_element_factory_make ("audiotestsrc", "src2");
- g_object_set (src2, "wave", 4, NULL); /* silence */
- adder = gst_element_factory_make ("adder", "adder");
- sink = gst_element_factory_make ("fakesink", "sink");
- gst_bin_add_many (GST_BIN (bin), src1, src2, adder, sink, NULL);
-
- res = gst_element_link (src1, adder);
- fail_unless (res == TRUE, NULL);
- res = gst_element_link (src2, adder);
- fail_unless (res == TRUE, NULL);
- res = gst_element_link (adder, sink);
- fail_unless (res == TRUE, NULL);
-
- srcpad = gst_element_get_static_pad (adder, "src");
- consist = gst_consistency_checker_new (srcpad);
- gst_object_unref (srcpad);
-
- play_seek_event = gst_event_new_seek (1.0, GST_FORMAT_TIME,
- GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_FLUSH,
- GST_SEEK_TYPE_SET, (GstClockTime) 0,
- GST_SEEK_TYPE_SET, (GstClockTime) 2 * GST_SECOND);
-
- play_count = 0;
-
- main_loop = g_main_loop_new (NULL, FALSE);
- g_signal_connect (bus, "message::segment-done",
- (GCallback) test_play_twice_message_received, bin);
- g_signal_connect (bus, "message::error", (GCallback) message_received, bin);
- g_signal_connect (bus, "message::warning", (GCallback) message_received, bin);
- g_signal_connect (bus, "message::eos", (GCallback) message_received, bin);
-
- GST_INFO ("starting test");
-
- /* prepare playing */
- res = gst_element_set_state (bin, GST_STATE_PAUSED);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- /* wait for completion */
- res =
- gst_element_get_state (GST_ELEMENT (bin), NULL, NULL,
- GST_CLOCK_TIME_NONE);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- res = gst_element_send_event (bin, gst_event_ref (play_seek_event));
- fail_unless (res == TRUE, NULL);
-
- GST_INFO ("seeked");
-
- /* run pipeline */
- res = gst_element_set_state (bin, GST_STATE_PLAYING);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- g_main_loop_run (main_loop);
-
- res = gst_element_set_state (bin, GST_STATE_NULL);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- fail_unless (play_count == 2, NULL);
-
- /* cleanup */
- g_main_loop_unref (main_loop);
- gst_consistency_checker_free (consist);
- gst_event_ref (play_seek_event);
- gst_object_unref (G_OBJECT (bus));
- gst_object_unref (G_OBJECT (bin));
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_play_twice_then_add_and_play_again)
-{
- GstElement *bin, *src1, *src2, *src3, *adder, *sink;
- GstBus *bus;
- gboolean res;
- gint i;
- GstPad *srcpad;
- GstStreamConsistency *consist;
-
- GST_INFO ("preparing test");
-
- /* build pipeline */
- bin = gst_pipeline_new ("pipeline");
- bus = gst_element_get_bus (bin);
- gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
-
- src1 = gst_element_factory_make ("audiotestsrc", "src1");
- g_object_set (src1, "wave", 4, NULL); /* silence */
- src2 = gst_element_factory_make ("audiotestsrc", "src2");
- g_object_set (src2, "wave", 4, NULL); /* silence */
- adder = gst_element_factory_make ("adder", "adder");
- sink = gst_element_factory_make ("fakesink", "sink");
- gst_bin_add_many (GST_BIN (bin), src1, src2, adder, sink, NULL);
-
- srcpad = gst_element_get_static_pad (adder, "src");
- consist = gst_consistency_checker_new (srcpad);
- gst_object_unref (srcpad);
-
- res = gst_element_link (src1, adder);
- fail_unless (res == TRUE, NULL);
- res = gst_element_link (src2, adder);
- fail_unless (res == TRUE, NULL);
- res = gst_element_link (adder, sink);
- fail_unless (res == TRUE, NULL);
-
- play_seek_event = gst_event_new_seek (1.0, GST_FORMAT_TIME,
- GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_FLUSH,
- GST_SEEK_TYPE_SET, (GstClockTime) 0,
- GST_SEEK_TYPE_SET, (GstClockTime) 2 * GST_SECOND);
-
- main_loop = g_main_loop_new (NULL, FALSE);
- g_signal_connect (bus, "message::segment-done",
- (GCallback) test_play_twice_message_received, bin);
- g_signal_connect (bus, "message::error", (GCallback) message_received, bin);
- g_signal_connect (bus, "message::warning", (GCallback) message_received, bin);
- g_signal_connect (bus, "message::eos", (GCallback) message_received, bin);
-
- /* run it twice */
- for (i = 0; i < 2; i++) {
- play_count = 0;
-
- GST_INFO ("starting test-loop %d", i);
-
- /* prepare playing */
- res = gst_element_set_state (bin, GST_STATE_PAUSED);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- /* wait for completion */
- res =
- gst_element_get_state (GST_ELEMENT (bin), NULL, NULL,
- GST_CLOCK_TIME_NONE);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- res = gst_element_send_event (bin, gst_event_ref (play_seek_event));
- fail_unless (res == TRUE, NULL);
-
- GST_INFO ("seeked");
-
- /* run pipeline */
- res = gst_element_set_state (bin, GST_STATE_PLAYING);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- g_main_loop_run (main_loop);
-
- res = gst_element_set_state (bin, GST_STATE_READY);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- fail_unless (play_count == 2, NULL);
-
- /* plug another source */
- if (i == 0) {
- src3 = gst_element_factory_make ("audiotestsrc", "src3");
- g_object_set (src3, "wave", 4, NULL); /* silence */
- gst_bin_add (GST_BIN (bin), src3);
-
- res = gst_element_link (src3, adder);
- fail_unless (res == TRUE, NULL);
- }
-
- gst_consistency_checker_reset (consist);
- }
-
- res = gst_element_set_state (bin, GST_STATE_NULL);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- /* cleanup */
- g_main_loop_unref (main_loop);
- gst_event_ref (play_seek_event);
- gst_consistency_checker_free (consist);
- gst_object_unref (G_OBJECT (bus));
- gst_object_unref (G_OBJECT (bin));
-}
-
-GST_END_TEST;
-
-
-static void
-test_live_seeking_eos_message_received (GstBus * bus, GstMessage * message,
- GstPipeline * bin)
-{
- GST_INFO ("bus message from \"%" GST_PTR_FORMAT "\": %" GST_PTR_FORMAT,
- GST_MESSAGE_SRC (message), message);
-
- switch (message->type) {
- case GST_MESSAGE_EOS:
- g_main_loop_quit (main_loop);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-}
-
-
-/* test failing seeks on live-sources */
-GST_START_TEST (test_live_seeking)
-{
- GstElement *bin, *src1, *src2, *ac1, *ac2, *adder, *sink;
- GstBus *bus;
- gboolean res;
- GstPad *srcpad;
- gint i;
- GstStreamConsistency *consist;
-
- GST_INFO ("preparing test");
- main_loop = NULL;
- play_seek_event = NULL;
-
- /* build pipeline */
- bin = gst_pipeline_new ("pipeline");
- bus = gst_element_get_bus (bin);
- gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
-
- /* normal audiosources behave differently than audiotestsrc */
-#if 0
- src1 = gst_element_factory_make ("audiotestsrc", "src1");
- g_object_set (src1, "wave", 4, "is-live", TRUE, NULL); /* silence */
-#else
- src1 = gst_element_factory_make ("alsasrc", "src1");
- if (!src1) {
- GST_INFO ("no audiosrc, skipping");
- goto cleanup;
- }
- /* Test that the audio source can get to paused, else skip */
- res = gst_element_set_state (src1, GST_STATE_PAUSED);
- (void) gst_element_set_state (src1, GST_STATE_NULL);
- gst_object_unref (src1);
-
- if (res == GST_STATE_CHANGE_FAILURE)
- goto cleanup;
- src1 = gst_element_factory_make ("alsasrc", "src1");
-
- /* live sources ignore seeks, force eos after 2 sec (4 buffers half second
- * each) - don't use autoaudiosrc, as then we can't set anything here */
- g_object_set (src1, "num-buffers", 4, "blocksize", 44100, NULL);
-#endif
- ac1 = gst_element_factory_make ("audioconvert", "ac1");
- src2 = gst_element_factory_make ("audiotestsrc", "src2");
- g_object_set (src2, "wave", 4, NULL); /* silence */
- ac2 = gst_element_factory_make ("audioconvert", "ac2");
- adder = gst_element_factory_make ("adder", "adder");
- sink = gst_element_factory_make ("fakesink", "sink");
- gst_bin_add_many (GST_BIN (bin), src1, ac1, src2, ac2, adder, sink, NULL);
-
- res = gst_element_link (src1, ac1);
- fail_unless (res == TRUE, NULL);
- res = gst_element_link (ac1, adder);
- fail_unless (res == TRUE, NULL);
- res = gst_element_link (src2, ac2);
- fail_unless (res == TRUE, NULL);
- res = gst_element_link (ac2, adder);
- fail_unless (res == TRUE, NULL);
- res = gst_element_link (adder, sink);
- fail_unless (res == TRUE, NULL);
-
- play_seek_event = gst_event_new_seek (1.0, GST_FORMAT_TIME,
- GST_SEEK_FLAG_FLUSH,
- GST_SEEK_TYPE_SET, (GstClockTime) 0,
- GST_SEEK_TYPE_SET, (GstClockTime) 2 * GST_SECOND);
-
- main_loop = g_main_loop_new (NULL, FALSE);
- g_signal_connect (bus, "message::error", (GCallback) message_received, bin);
- g_signal_connect (bus, "message::warning", (GCallback) message_received, bin);
- g_signal_connect (bus, "message::eos",
- (GCallback) test_live_seeking_eos_message_received, bin);
-
- srcpad = gst_element_get_static_pad (adder, "src");
- consist = gst_consistency_checker_new (srcpad);
- gst_object_unref (srcpad);
-
- GST_INFO ("starting test");
-
- /* run it twice */
- for (i = 0; i < 2; i++) {
-
- GST_INFO ("starting test-loop %d", i);
-
- /* prepare playing */
- res = gst_element_set_state (bin, GST_STATE_PAUSED);
- fail_unless (res != GST_STATE_CHANGE_FAILURE);
-
- /* wait for completion */
- res =
- gst_element_get_state (GST_ELEMENT (bin), NULL, NULL,
- GST_CLOCK_TIME_NONE);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- res = gst_element_send_event (bin, gst_event_ref (play_seek_event));
-#if 1
- fail_unless (res == TRUE, NULL);
-#else
- /* adder is picky, if a single seek fails it totaly fails */
- fail_unless (res == FALSE, NULL);
-#endif
-
- GST_INFO ("seeked");
-
- /* run pipeline */
- res = gst_element_set_state (bin, GST_STATE_PLAYING);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- GST_INFO ("playing");
-
- g_main_loop_run (main_loop);
-
- res = gst_element_set_state (bin, GST_STATE_NULL);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- gst_consistency_checker_reset (consist);
- }
-
- /* cleanup */
-cleanup:
- GST_INFO ("cleaning up");
- if (main_loop)
- g_main_loop_unref (main_loop);
- if (play_seek_event)
- gst_event_unref (play_seek_event);
- gst_object_unref (G_OBJECT (bus));
- gst_object_unref (G_OBJECT (bin));
-}
-
-GST_END_TEST;
-
-/* check if adding pads work as expected */
-GST_START_TEST (test_add_pad)
-{
- GstElement *bin, *src1, *src2, *adder, *sink;
- GstBus *bus;
- GstPad *srcpad;
- GstStreamConsistency *consist;
- gboolean res;
-
- GST_INFO ("preparing test");
-
- /* build pipeline */
- bin = gst_pipeline_new ("pipeline");
- bus = gst_element_get_bus (bin);
- gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
-
- src1 = gst_element_factory_make ("audiotestsrc", "src1");
- g_object_set (src1, "num-buffers", 4, NULL);
- g_object_set (src1, "wave", 4, NULL); /* silence */
- src2 = gst_element_factory_make ("audiotestsrc", "src2");
- /* one buffer less, we connect with 1 buffer of delay */
- g_object_set (src2, "num-buffers", 3, NULL);
- g_object_set (src2, "wave", 4, NULL); /* silence */
- adder = gst_element_factory_make ("adder", "adder");
- sink = gst_element_factory_make ("fakesink", "sink");
- gst_bin_add_many (GST_BIN (bin), src1, adder, sink, NULL);
-
- res = gst_element_link (src1, adder);
- fail_unless (res == TRUE, NULL);
- res = gst_element_link (adder, sink);
- fail_unless (res == TRUE, NULL);
-
- srcpad = gst_element_get_static_pad (adder, "src");
- consist = gst_consistency_checker_new (srcpad);
- gst_object_unref (srcpad);
-
- main_loop = g_main_loop_new (NULL, FALSE);
- g_signal_connect (bus, "message::segment-done", (GCallback) message_received,
- bin);
- g_signal_connect (bus, "message::error", (GCallback) message_received, bin);
- g_signal_connect (bus, "message::warning", (GCallback) message_received, bin);
- g_signal_connect (bus, "message::eos", (GCallback) message_received, bin);
-
- GST_INFO ("starting test");
-
- /* prepare playing */
- res = gst_element_set_state (bin, GST_STATE_PAUSED);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- /* wait for completion */
- res =
- gst_element_get_state (GST_ELEMENT (bin), NULL, NULL,
- GST_CLOCK_TIME_NONE);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- /* add other element */
- gst_bin_add_many (GST_BIN (bin), src2, NULL);
-
- /* now link the second element */
- res = gst_element_link (src2, adder);
- fail_unless (res == TRUE, NULL);
-
- /* set to PAUSED as well */
- res = gst_element_set_state (src2, GST_STATE_PAUSED);
-
- /* now play all */
- res = gst_element_set_state (bin, GST_STATE_PLAYING);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- g_main_loop_run (main_loop);
-
- res = gst_element_set_state (bin, GST_STATE_NULL);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- /* cleanup */
- g_main_loop_unref (main_loop);
- gst_object_unref (G_OBJECT (bus));
- gst_object_unref (G_OBJECT (bin));
-}
-
-GST_END_TEST;
-
-/* check if removing pads work as expected */
-GST_START_TEST (test_remove_pad)
-{
- GstElement *bin, *src, *adder, *sink;
- GstBus *bus;
- GstPad *pad, *srcpad;
- gboolean res;
- GstStreamConsistency *consist;
-
- GST_INFO ("preparing test");
-
- /* build pipeline */
- bin = gst_pipeline_new ("pipeline");
- bus = gst_element_get_bus (bin);
- gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
-
- src = gst_element_factory_make ("audiotestsrc", "src");
- g_object_set (src, "num-buffers", 4, NULL);
- g_object_set (src, "wave", 4, NULL);
- adder = gst_element_factory_make ("adder", "adder");
- sink = gst_element_factory_make ("fakesink", "sink");
- gst_bin_add_many (GST_BIN (bin), src, adder, sink, NULL);
-
- res = gst_element_link (src, adder);
- fail_unless (res == TRUE, NULL);
- res = gst_element_link (adder, sink);
- fail_unless (res == TRUE, NULL);
-
- /* create an unconnected sinkpad in adder */
- pad = gst_element_get_request_pad (adder, "sink%d");
- fail_if (pad == NULL, NULL);
-
- srcpad = gst_element_get_static_pad (adder, "src");
- consist = gst_consistency_checker_new (srcpad);
- gst_object_unref (srcpad);
-
- main_loop = g_main_loop_new (NULL, FALSE);
- g_signal_connect (bus, "message::segment-done", (GCallback) message_received,
- bin);
- g_signal_connect (bus, "message::error", (GCallback) message_received, bin);
- g_signal_connect (bus, "message::warning", (GCallback) message_received, bin);
- g_signal_connect (bus, "message::eos", (GCallback) message_received, bin);
-
- GST_INFO ("starting test");
-
- /* prepare playing, this will not preroll as adder is waiting
- * on the unconnected sinkpad. */
- res = gst_element_set_state (bin, GST_STATE_PAUSED);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- /* wait for completion for one second, will return ASYNC */
- res = gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, GST_SECOND);
- fail_unless (res == GST_STATE_CHANGE_ASYNC, NULL);
-
- /* get rid of the pad now, adder should stop waiting on it and
- * continue the preroll */
- gst_element_release_request_pad (adder, pad);
- gst_object_unref (pad);
-
- /* wait for completion, should work now */
- res =
- gst_element_get_state (GST_ELEMENT (bin), NULL, NULL,
- GST_CLOCK_TIME_NONE);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- /* now play all */
- res = gst_element_set_state (bin, GST_STATE_PLAYING);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- g_main_loop_run (main_loop);
-
- res = gst_element_set_state (bin, GST_STATE_NULL);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- /* cleanup */
- g_main_loop_unref (main_loop);
- gst_object_unref (G_OBJECT (bus));
- gst_object_unref (G_OBJECT (bin));
-}
-
-GST_END_TEST;
-
-
-static GstBuffer *handoff_buffer = NULL;
-static void
-handoff_buffer_cb (GstElement * fakesink, GstBuffer * buffer, GstPad * pad,
- gpointer user_data)
-{
- GST_DEBUG ("got buffer %p", buffer);
- gst_buffer_replace (&handoff_buffer, buffer);
-}
-
-/* check if clipping works as expected */
-GST_START_TEST (test_clip)
-{
- GstElement *bin, *adder, *sink;
- GstBus *bus;
- GstPad *sinkpad;
- gboolean res;
- GstFlowReturn ret;
- GstEvent *event;
- GstBuffer *buffer;
- GstCaps *caps;
-
- GST_INFO ("preparing test");
-
- /* build pipeline */
- bin = gst_pipeline_new ("pipeline");
- bus = gst_element_get_bus (bin);
- gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
-
- g_signal_connect (bus, "message::error", (GCallback) message_received, bin);
- g_signal_connect (bus, "message::warning", (GCallback) message_received, bin);
- g_signal_connect (bus, "message::eos", (GCallback) message_received, bin);
-
- /* just an adder and a fakesink */
- adder = gst_element_factory_make ("adder", "adder");
- sink = gst_element_factory_make ("fakesink", "sink");
- g_object_set (sink, "signal-handoffs", TRUE, NULL);
- g_signal_connect (sink, "handoff", (GCallback) handoff_buffer_cb, NULL);
- gst_bin_add_many (GST_BIN (bin), adder, sink, NULL);
-
- res = gst_element_link (adder, sink);
- fail_unless (res == TRUE, NULL);
-
- /* set to playing */
- res = gst_element_set_state (bin, GST_STATE_PLAYING);
- fail_unless (res != GST_STATE_CHANGE_FAILURE, NULL);
-
- /* create an unconnected sinkpad in adder, should also automatically activate
- * the pad */
- sinkpad = gst_element_get_request_pad (adder, "sink%d");
- fail_if (sinkpad == NULL, NULL);
-
- /* send segment to adder */
- event = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME,
- GST_SECOND, 2 * GST_SECOND, 0);
- gst_pad_send_event (sinkpad, event);
-
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "rate", G_TYPE_INT, 44100,
- "channels", G_TYPE_INT, 2,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
-
- /* should be clipped and ok */
- buffer = gst_buffer_new_and_alloc (44100);
- GST_BUFFER_TIMESTAMP (buffer) = 0;
- GST_BUFFER_DURATION (buffer) = 250 * GST_MSECOND;
- gst_buffer_set_caps (buffer, caps);
- GST_DEBUG ("pushing buffer %p", buffer);
- ret = gst_pad_chain (sinkpad, buffer);
- fail_unless (ret == GST_FLOW_OK);
- fail_unless (handoff_buffer == NULL);
-
- /* should be partially clipped */
- buffer = gst_buffer_new_and_alloc (44100);
- GST_BUFFER_TIMESTAMP (buffer) = 900 * GST_MSECOND;
- GST_BUFFER_DURATION (buffer) = 250 * GST_MSECOND;
- gst_buffer_set_caps (buffer, caps);
- GST_DEBUG ("pushing buffer %p", buffer);
- ret = gst_pad_chain (sinkpad, buffer);
- fail_unless (ret == GST_FLOW_OK);
- fail_unless (handoff_buffer != NULL);
- gst_buffer_replace (&handoff_buffer, NULL);
-
- /* should not be clipped */
- buffer = gst_buffer_new_and_alloc (44100);
- GST_BUFFER_TIMESTAMP (buffer) = 1 * GST_SECOND;
- GST_BUFFER_DURATION (buffer) = 250 * GST_MSECOND;
- gst_buffer_set_caps (buffer, caps);
- GST_DEBUG ("pushing buffer %p", buffer);
- ret = gst_pad_chain (sinkpad, buffer);
- fail_unless (ret == GST_FLOW_OK);
- fail_unless (handoff_buffer != NULL);
- gst_buffer_replace (&handoff_buffer, NULL);
-
- /* should be clipped and ok */
- buffer = gst_buffer_new_and_alloc (44100);
- GST_BUFFER_TIMESTAMP (buffer) = 2 * GST_SECOND;
- GST_BUFFER_DURATION (buffer) = 250 * GST_MSECOND;
- gst_buffer_set_caps (buffer, caps);
- GST_DEBUG ("pushing buffer %p", buffer);
- ret = gst_pad_chain (sinkpad, buffer);
- fail_unless (ret == GST_FLOW_OK);
- fail_unless (handoff_buffer == NULL);
-
-
-}
-
-GST_END_TEST;
-
-static Suite *
-adder_suite (void)
-{
- Suite *s = suite_create ("adder");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_event);
- tcase_add_test (tc_chain, test_play_twice);
- tcase_add_test (tc_chain, test_play_twice_then_add_and_play_again);
- tcase_add_test (tc_chain, test_live_seeking);
- tcase_add_test (tc_chain, test_add_pad);
- tcase_add_test (tc_chain, test_remove_pad);
- tcase_add_test (tc_chain, test_clip);
-
- /* Use a longer timeout */
-#ifdef HAVE_VALGRIND
- if (RUNNING_ON_VALGRIND) {
- tcase_set_timeout (tc_chain, 5 * 60);
- } else
-#endif
- {
- /* this is shorter than the default 60 seconds?! (tpm) */
- /* tcase_set_timeout (tc_chain, 6); */
- }
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = adder_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/elements/alsa.c b/tests/check/elements/alsa.c
deleted file mode 100644
index ddd95c73..00000000
--- a/tests/check/elements/alsa.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* GStreamer
- *
- * unit test for alsa elements
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-#include <gst/interfaces/propertyprobe.h>
-#include <gst/interfaces/mixer.h>
-
-/* just a simple test that runs device probing on
- * an alsasrc, alsasink and alsamixer instance */
-
-GST_START_TEST (test_device_property_probe)
-{
- const gchar *elements[] = { "alsasink", "alsasrc", "alsamixer" };
- gint n;
-
- for (n = 0; n < G_N_ELEMENTS (elements); ++n) {
- GstPropertyProbe *probe;
- GValueArray *arr;
- GstElement *element;
- gint i;
-
- element = gst_element_factory_make (elements[n], elements[n]);
- fail_unless (element != NULL);
-
- probe = GST_PROPERTY_PROBE (element);
- fail_unless (probe != NULL);
-
- arr = gst_property_probe_probe_and_get_values_name (probe, "device");
- if (arr) {
- for (i = 0; i < arr->n_values; ++i) {
- const gchar *device;
- GValue *val;
-
- val = g_value_array_get_nth (arr, i);
- fail_unless (val != NULL);
- fail_unless (G_VALUE_HOLDS_STRING (val));
-
- device = g_value_get_string (val);
- fail_unless (device != NULL);
- GST_LOG_OBJECT (element, "device[%d] = %s", i, device);
- }
- g_value_array_free (arr);
- } else {
- GST_LOG_OBJECT (element, "no devices found");
- }
-
- gst_object_unref (element);
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_alsa_mixer_track)
-{
- GstStateChangeReturn state_ret;
- GstElement *mixer;
- GList *tracks, *l;
-
- mixer = gst_element_factory_make ("alsamixer", "alsamixer");
- fail_unless (mixer != NULL, "Failed to create 'alsamixer' element!");
-
- state_ret = gst_element_set_state (mixer, GST_STATE_READY);
- if (state_ret != GST_STATE_CHANGE_SUCCESS) {
- gst_object_unref (mixer);
- return;
- }
-
- GST_LOG ("opened alsamixer");
- fail_unless (GST_IS_MIXER (mixer), "is not a GstMixer?!");
-
- tracks = (GList *) gst_mixer_list_tracks (GST_MIXER (mixer));
- for (l = tracks; l != NULL; l = l->next) {
- GstMixerTrack *track;
- gchar *ulabel = NULL, *label = NULL;
-
- track = GST_MIXER_TRACK (l->data);
- g_object_get (track, "label", &label, "untranslated-label", &ulabel, NULL);
- fail_unless (label == NULL || g_utf8_validate (label, -1, NULL));
- if (ulabel != NULL) {
- gchar *p;
-
- for (p = ulabel; p != NULL && *p != '\0'; ++p) {
- fail_unless (g_ascii_isprint (*p),
- "untranslated label '%s' not printable ASCII", ulabel);
- }
- }
- GST_DEBUG ("%s: %s", GST_STR_NULL (ulabel), GST_STR_NULL (label));
- g_free (label);
- g_free (ulabel);
- }
-
- fail_unless_equals_int (gst_element_set_state (mixer, GST_STATE_NULL),
- GST_STATE_CHANGE_SUCCESS);
-
- gst_object_unref (mixer);
-}
-
-GST_END_TEST;
-
-static Suite *
-alsa_suite (void)
-{
- Suite *s = suite_create ("alsa");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_device_property_probe);
- tcase_add_test (tc_chain, test_alsa_mixer_track);
-
- return s;
-}
-
-GST_CHECK_MAIN (alsa)
diff --git a/tests/check/elements/appsink.c b/tests/check/elements/appsink.c
deleted file mode 100644
index f8bc68d4..00000000
--- a/tests/check/elements/appsink.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2009, Axis Communications AB, LUND, SWEDEN
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-#include <gst/check/gstcheck.h>
-#include <gst/app/gstappsink.h>
-
-gint global_testdata;
-
-static GstPad *mysrcpad;
-
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-gst-check")
- );
-
-static GstElement *
-setup_appsink (void)
-{
- GstElement *appsink;
-
- GST_DEBUG ("setup_appsink");
- appsink = gst_check_setup_element ("appsink");
- mysrcpad = gst_check_setup_src_pad (appsink, &srctemplate, NULL);
-
- return appsink;
-}
-
-static void
-cleanup_appsink (GstElement * appsink)
-{
- GST_DEBUG ("cleanup_appsink");
-
- gst_check_teardown_src_pad (appsink);
- gst_check_teardown_element (appsink);
-}
-
-/* This function does an operation to it's indata argument and returns it.
- * The exact operation performed doesn't matter. Currently it multiplies with
- * two, but it could do anything. The idea is to use the function to verify
- * that the code calling it gets run. */
-gint
-operate_on_data (gint indata)
-{
- return indata * 2;
-}
-
-void
-notify_test_function (gpointer userdata)
-{
- global_testdata = operate_on_data (GPOINTER_TO_INT (userdata));
-}
-
-static GstFlowReturn
-callback_function (GstAppSink * appsink, gpointer callback_data)
-{
- global_testdata = operate_on_data (*((gint *) callback_data));
-
- return GST_FLOW_OK;
-}
-
-void
-notify_function (gpointer callback_data)
-{
- global_testdata = operate_on_data (*((gint *) callback_data));
-}
-
-GST_START_TEST (test_non_clients)
-{
- GstElement *sink;
- GstBuffer *buffer;
- GstCaps *caps;
-
- sink = setup_appsink ();
-
- ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
-
- caps = gst_caps_from_string ("application/x-gst-check");
- buffer = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (buffer, caps);
- gst_caps_unref (caps);
- fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
-
- GST_DEBUG ("cleaning up appsink");
- ASSERT_SET_STATE (sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
- cleanup_appsink (sink);
-}
-
-GST_END_TEST;
-
-/* Verifies that the handoff callback gets run one time when passing a buffer */
-GST_START_TEST (test_handoff_callback)
-{
- GstElement *sink;
- GstBuffer *buffer;
- GstCaps *caps;
- gint testdata;
- GstAppSinkCallbacks callbacks = { NULL };
-
- sink = setup_appsink ();
-
- global_testdata = 0;
- testdata = 5; /* Arbitrary value */
-
- callbacks.new_buffer = callback_function;
-
- gst_app_sink_set_callbacks (GST_APP_SINK (sink), &callbacks, &testdata, NULL);
-
- ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
-
- caps = gst_caps_from_string ("application/x-gst-check");
- buffer = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (buffer, caps);
- gst_caps_unref (caps);
- /* Pushing a buffer should run our callback */
- fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
-
- testdata = operate_on_data (testdata);
-
- /* If both test_data & global_testdata have been operated on, we're happy. */
- fail_unless (testdata == global_testdata);
-
- GST_DEBUG ("cleaning up appsink");
- ASSERT_SET_STATE (sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
- cleanup_appsink (sink);
-}
-
-GST_END_TEST;
-
-/* Verifies that the notify function gets executed when the sink is destroyed */
-GST_START_TEST (test_notify0)
-{
- GstElement *sink;
- gint testdata;
- GstAppSinkCallbacks callbacks = { NULL };
-
- sink = gst_element_factory_make ("appsink", NULL);
-
- global_testdata = 0;
- testdata = 17; /* Arbitrary value */
-
- gst_app_sink_set_callbacks (GST_APP_SINK (sink), &callbacks,
- &testdata, (*notify_function));
-
- GST_DEBUG ("cleaning up appsink");
- /* Destroying sink should call our notify_function */
- gst_object_unref (sink);
-
- testdata = operate_on_data (testdata);
-
- /* If both test_data & global_testdata have been operated on, we're happy. */
- fail_unless (testdata == global_testdata);
-}
-
-GST_END_TEST;
-
-
-/* Verifies that the notify function gets executed when
- * gst_app_sink_set_callbacks () gets called */
-GST_START_TEST (test_notify1)
-{
- GstElement *sink;
- gint testdata;
- GstAppSinkCallbacks callbacks = { NULL };
-
- sink = gst_element_factory_make ("appsink", NULL);
-
- global_testdata = 0;
- testdata = 42; /* Arbitrary value */
-
- gst_app_sink_set_callbacks (GST_APP_SINK (sink), &callbacks,
- &testdata, (*notify_function));
- /* Setting new callbacks should trigger the destroy of the old data */
- gst_app_sink_set_callbacks (GST_APP_SINK (sink), &callbacks, &testdata, NULL);
-
- testdata = operate_on_data (testdata);
-
- /* If both test_data & global_testdata have been operated on, we're happy. */
- fail_unless (testdata == global_testdata);
-
- GST_DEBUG ("cleaning up appsink");
- gst_object_unref (sink);
-}
-
-GST_END_TEST;
-
-static GstBufferList *mylist;
-static GstCaps *mycaps;
-
-static GstBufferList *
-create_buffer_list (void)
-{
- GstBufferListIterator *it;
- GstBuffer *buffer;
-
- mylist = gst_buffer_list_new ();
- fail_if (mylist == NULL);
-
- mycaps = gst_caps_from_string ("application/x-gst-check");
- fail_if (mycaps == NULL);
-
- it = gst_buffer_list_iterate (mylist);
- fail_if (it == NULL);
-
- gst_buffer_list_iterator_add_group (it);
-
- buffer = gst_buffer_new_and_alloc (sizeof (gint));
- *(gint *) GST_BUFFER_DATA (buffer) = 1;
- gst_buffer_set_caps (buffer, mycaps);
- gst_buffer_list_iterator_add (it, buffer);
-
- gst_buffer_list_iterator_add_group (it);
-
- buffer = gst_buffer_new_and_alloc (sizeof (gint));
- *(gint *) GST_BUFFER_DATA (buffer) = 2;
- gst_buffer_set_caps (buffer, mycaps);
- gst_buffer_list_iterator_add (it, buffer);
-
- buffer = gst_buffer_new_and_alloc (sizeof (gint));
- *(gint *) GST_BUFFER_DATA (buffer) = 4;
- gst_buffer_set_caps (buffer, mycaps);
- gst_buffer_list_iterator_add (it, buffer);
-
- gst_buffer_list_iterator_free (it);
-
- return mylist;
-}
-
-static void
-check_buffer_list (GstBufferList * list)
-{
- GstBufferListIterator *it;
- GstBuffer *buf;
- GstCaps *caps;
-
- fail_unless (list == mylist);
- fail_unless (gst_buffer_list_n_groups (list) == 2);
-
- it = gst_buffer_list_iterate (list);
- fail_if (it == NULL);
-
- fail_unless (gst_buffer_list_iterator_next_group (it));
- fail_unless (gst_buffer_list_iterator_n_buffers (it) == 1);
- buf = gst_buffer_list_iterator_next (it);
- fail_if (buf == NULL);
- fail_unless (*(gint *) GST_BUFFER_DATA (buf) == 1);
- caps = gst_buffer_get_caps (buf);
- fail_unless (caps == mycaps);
- fail_unless (gst_caps_is_equal (caps, mycaps));
- gst_caps_unref (caps);
-
- fail_unless (gst_buffer_list_iterator_next_group (it));
- fail_unless (gst_buffer_list_iterator_n_buffers (it) == 2);
- buf = gst_buffer_list_iterator_next (it);
- fail_if (buf == NULL);
- fail_unless (*(gint *) GST_BUFFER_DATA (buf) == 2);
- caps = gst_buffer_get_caps (buf);
- fail_unless (caps == mycaps);
- gst_caps_unref (caps);
-
- buf = gst_buffer_list_iterator_next (it);
- fail_if (buf == NULL);
- fail_unless (*(gint *) GST_BUFFER_DATA (buf) == 4);
- caps = gst_buffer_get_caps (buf);
- fail_unless (caps == mycaps);
- gst_caps_unref (caps);
-
- gst_buffer_list_iterator_free (it);
-}
-
-static GstFlowReturn
-callback_function_buffer_list (GstAppSink * appsink, gpointer callback_data)
-{
- GstBufferList *list;
-
- list = gst_app_sink_pull_buffer_list (appsink);
- fail_unless (GST_IS_BUFFER_LIST (list));
-
- check_buffer_list (list);
-
- gst_buffer_list_unref (list);
-
- return GST_FLOW_OK;
-}
-
-GST_START_TEST (test_buffer_list)
-{
- GstElement *sink;
- GstBufferList *list;
- GstAppSinkCallbacks callbacks = { NULL };
-
- sink = setup_appsink ();
-
- callbacks.new_buffer_list = callback_function_buffer_list;
-
- gst_app_sink_set_callbacks (GST_APP_SINK (sink), &callbacks, NULL, NULL);
-
- ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
-
- list = create_buffer_list ();
- fail_unless (gst_pad_push_list (mysrcpad, list) == GST_FLOW_OK);
-
- ASSERT_SET_STATE (sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
- cleanup_appsink (sink);
-}
-
-GST_END_TEST;
-
-static Suite *
-appsink_suite (void)
-{
- Suite *s = suite_create ("appsink");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_non_clients);
- tcase_add_test (tc_chain, test_handoff_callback);
- tcase_add_test (tc_chain, test_notify0);
- tcase_add_test (tc_chain, test_notify1);
- tcase_add_test (tc_chain, test_buffer_list);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = appsink_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/elements/audioconvert.c b/tests/check/elements/audioconvert.c
deleted file mode 100644
index 58c69dd8..00000000
--- a/tests/check/elements/audioconvert.c
+++ /dev/null
@@ -1,1741 +0,0 @@
-/* GStreamer
- *
- * unit test for audioconvert
- *
- * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <unistd.h>
-
-#include <gst/floatcast/floatcast.h>
-#include <gst/check/gstcheck.h>
-#include <gst/audio/multichannel.h>
-
-/* For ease of programming we use globals to keep refs for our floating
- * src and sink pads we create; otherwise we always have to do get_pad,
- * get_peer, and then remove references in every test function */
-static GstPad *mysrcpad, *mysinkpad;
-
-#define CONVERT_CAPS_TEMPLATE_STRING \
- "audio/x-raw-float, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
- "width = (int) { 32, 64 };" \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
- "width = (int) 32, " \
- "depth = (int) [ 1, 32 ], " \
- "signed = (boolean) { true, false }; " \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
- "width = (int) 24, " \
- "depth = (int) [ 1, 24 ], " \
- "signed = (boolean) { true, false }; " \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
- "width = (int) 16, " \
- "depth = (int) [ 1, 16 ], " \
- "signed = (boolean) { true, false }; " \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, MAX ], " \
- "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
- "width = (int) 8, " \
- "depth = (int) [ 1, 8 ], " \
- "signed = (boolean) { true, false } "
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (CONVERT_CAPS_TEMPLATE_STRING)
- );
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (CONVERT_CAPS_TEMPLATE_STRING)
- );
-
-/* takes over reference for outcaps */
-static GstElement *
-setup_audioconvert (GstCaps * outcaps)
-{
- GstElement *audioconvert;
-
- GST_DEBUG ("setup_audioconvert with caps %" GST_PTR_FORMAT, outcaps);
- audioconvert = gst_check_setup_element ("audioconvert");
- g_object_set (G_OBJECT (audioconvert), "dithering", 0, NULL);
- g_object_set (G_OBJECT (audioconvert), "noise-shaping", 0, NULL);
- mysrcpad = gst_check_setup_src_pad (audioconvert, &srctemplate, NULL);
- mysinkpad = gst_check_setup_sink_pad (audioconvert, &sinktemplate, NULL);
- /* this installs a getcaps func that will always return the caps we set
- * later */
- gst_pad_use_fixed_caps (mysinkpad);
- gst_pad_set_caps (mysinkpad, outcaps);
- gst_caps_unref (outcaps);
- outcaps = gst_pad_get_negotiated_caps (mysinkpad);
- fail_unless (gst_caps_is_fixed (outcaps));
- gst_caps_unref (outcaps);
-
- gst_pad_set_active (mysrcpad, TRUE);
- gst_pad_set_active (mysinkpad, TRUE);
-
- return audioconvert;
-}
-
-static void
-cleanup_audioconvert (GstElement * audioconvert)
-{
- GST_DEBUG ("cleanup_audioconvert");
-
- gst_pad_set_active (mysrcpad, FALSE);
- gst_pad_set_active (mysinkpad, FALSE);
- gst_check_teardown_src_pad (audioconvert);
- gst_check_teardown_sink_pad (audioconvert);
- gst_check_teardown_element (audioconvert);
-}
-
-/* returns a newly allocated caps */
-static GstCaps *
-get_int_caps (guint channels, gchar * endianness, guint width,
- guint depth, gboolean signedness)
-{
- GstCaps *caps;
- gchar *string;
-
- string = g_strdup_printf ("audio/x-raw-int, "
- "rate = (int) 44100, "
- "channels = (int) %d, "
- "endianness = (int) %s, "
- "width = (int) %d, "
- "depth = (int) %d, "
- "signed = (boolean) %s ",
- channels, endianness, width, depth, signedness ? "true" : "false");
- GST_DEBUG ("creating caps from %s", string);
- caps = gst_caps_from_string (string);
- g_free (string);
- fail_unless (caps != NULL);
- GST_DEBUG ("returning caps %p", caps);
- return caps;
-}
-
-/* returns a newly allocated caps */
-static GstCaps *
-get_float_caps (guint channels, gchar * endianness, guint width)
-{
- GstCaps *caps;
- gchar *string;
-
- string = g_strdup_printf ("audio/x-raw-float, "
- "rate = (int) 44100, "
- "channels = (int) %d, "
- "endianness = (int) %s, "
- "width = (int) %d ", channels, endianness, width);
- GST_DEBUG ("creating caps from %s", string);
- caps = gst_caps_from_string (string);
- g_free (string);
- fail_unless (caps != NULL);
- GST_DEBUG ("returning caps %p", caps);
- return caps;
-}
-
-/* Copied from vorbis; the particular values used don't matter */
-static GstAudioChannelPosition channelpositions[][6] = {
- { /* Mono */
- GST_AUDIO_CHANNEL_POSITION_FRONT_MONO},
- { /* Stereo */
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT},
- { /* Stereo + Centre */
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT},
- { /* Quadraphonic */
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- },
- { /* Stereo + Centre + rear stereo */
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- },
- { /* Full 5.1 Surround */
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- }
-};
-
-/* these are a bunch of random positions, they are mostly just
- * different from the ones above, don't use elsewhere */
-static GstAudioChannelPosition mixed_up_positions[][6] = {
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_MONO},
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT},
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT},
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- },
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- },
- {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- }
-};
-
-/* we get this when recording from a soundcard with lots of input channels */
-static GstAudioChannelPosition undefined_positions[][15] = {
- {
- GST_AUDIO_CHANNEL_POSITION_NONE},
- {
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE},
- {
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE},
- {
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE},
- {
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE},
- {
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE},
- {
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE},
- {
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE},
- {
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE},
- {
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE},
- {
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE},
- {
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE},
- {
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE},
- {
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE},
- {
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE}
-};
-
-static void
-set_channel_positions (GstCaps * caps, int channels,
- GstAudioChannelPosition * channelpositions)
-{
- GValue chanpos = { 0 };
- GValue pos = { 0 };
- GstStructure *structure = gst_caps_get_structure (caps, 0);
- int c;
-
- g_value_init (&chanpos, GST_TYPE_ARRAY);
- g_value_init (&pos, GST_TYPE_AUDIO_CHANNEL_POSITION);
-
- for (c = 0; c < channels; c++) {
- g_value_set_enum (&pos, channelpositions[c]);
- gst_value_array_append_value (&chanpos, &pos);
- }
- g_value_unset (&pos);
-
- gst_structure_set_value (structure, "channel-positions", &chanpos);
- g_value_unset (&chanpos);
-}
-
-/* For channels > 2, caps have to have channel positions. This adds some simple
- * ones. Only implemented for channels between 1 and 6.
- */
-static GstCaps *
-get_float_mc_caps (guint channels, gchar * endianness, guint width,
- gboolean mixed_up_layout)
-{
- GstCaps *caps = get_float_caps (channels, endianness, width);
-
- if (channels <= 6) {
- if (mixed_up_layout)
- set_channel_positions (caps, channels, mixed_up_positions[channels - 1]);
- else
- set_channel_positions (caps, channels, channelpositions[channels - 1]);
- }
-
- return caps;
-}
-
-static GstCaps *
-get_int_mc_caps (guint channels, gchar * endianness, guint width,
- guint depth, gboolean signedness, gboolean mixed_up_layout)
-{
- GstCaps *caps = get_int_caps (channels, endianness, width, depth, signedness);
-
- if (channels <= 6) {
- if (mixed_up_layout)
- set_channel_positions (caps, channels, mixed_up_positions[channels - 1]);
- else
- set_channel_positions (caps, channels, channelpositions[channels - 1]);
- }
-
- return caps;
-}
-
-/* eats the refs to the caps */
-static void
-verify_convert (const gchar * which, void *in, int inlength,
- GstCaps * incaps, void *out, int outlength, GstCaps * outcaps,
- GstFlowReturn expected_flow)
-{
- GstBuffer *inbuffer, *outbuffer;
- GstElement *audioconvert;
-
- GST_DEBUG ("verifying conversion %s", which);
- GST_DEBUG ("incaps: %" GST_PTR_FORMAT, incaps);
- GST_DEBUG ("outcaps: %" GST_PTR_FORMAT, outcaps);
- ASSERT_CAPS_REFCOUNT (incaps, "incaps", 1);
- ASSERT_CAPS_REFCOUNT (outcaps, "outcaps", 1);
- audioconvert = setup_audioconvert (outcaps);
- ASSERT_CAPS_REFCOUNT (outcaps, "outcaps", 1);
-
- fail_unless (gst_element_set_state (audioconvert,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- GST_DEBUG ("Creating buffer of %d bytes", inlength);
- inbuffer = gst_buffer_new_and_alloc (inlength);
- memcpy (GST_BUFFER_DATA (inbuffer), in, inlength);
- gst_buffer_set_caps (inbuffer, incaps);
- ASSERT_CAPS_REFCOUNT (incaps, "incaps", 2);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- GST_DEBUG ("push it");
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), expected_flow);
- GST_DEBUG ("pushed it");
-
- if (expected_flow != GST_FLOW_OK)
- goto done;
-
- /* ... and puts a new buffer on the global list */
- fail_unless (g_list_length (buffers) == 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), outlength);
-
- if (memcmp (GST_BUFFER_DATA (outbuffer), out, outlength) != 0) {
- g_print ("\nInput data:\n");
- gst_util_dump_mem (in, inlength);
- g_print ("\nConverted data:\n");
- gst_util_dump_mem (GST_BUFFER_DATA (outbuffer), outlength);
- g_print ("\nExpected data:\n");
- gst_util_dump_mem (out, outlength);
- }
- fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, outlength) == 0,
- "failed converting %s", which);
-
- /* make sure that the channel positions are not lost */
- {
- GstStructure *in_s, *out_s;
- gint out_chans;
-
- in_s = gst_caps_get_structure (incaps, 0);
- out_s = gst_caps_get_structure (GST_BUFFER_CAPS (outbuffer), 0);
- fail_unless (gst_structure_get_int (out_s, "channels", &out_chans));
-
- /* positions for 1 and 2 channels are implicit if not provided */
- if (out_chans > 2 && gst_structure_has_field (in_s, "channel-positions")) {
- if (!gst_structure_has_field (out_s, "channel-positions")) {
- g_error ("Channel layout got lost somewhere:\n\nIns : %s\nOuts: %s\n",
- gst_structure_to_string (in_s), gst_structure_to_string (out_s));
- }
- }
- }
-
- buffers = g_list_remove (buffers, outbuffer);
- gst_buffer_unref (outbuffer);
-
-done:
- fail_unless (gst_element_set_state (audioconvert,
- GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
- /* cleanup */
- GST_DEBUG ("cleanup audioconvert");
- cleanup_audioconvert (audioconvert);
- GST_DEBUG ("cleanup, unref incaps");
- ASSERT_CAPS_REFCOUNT (incaps, "incaps", 1);
- gst_caps_unref (incaps);
-}
-
-
-#define RUN_CONVERSION(which, inarray, in_get_caps, outarray, out_get_caps) \
- verify_convert (which, inarray, sizeof (inarray), \
- in_get_caps, outarray, sizeof (outarray), out_get_caps, GST_FLOW_OK)
-
-#define RUN_CONVERSION_TO_FAIL(which, inarray, in_caps, outarray, out_caps) \
- verify_convert (which, inarray, sizeof (inarray), \
- in_caps, outarray, sizeof (outarray), out_caps, GST_FLOW_NOT_NEGOTIATED)
-
-
-GST_START_TEST (test_int16)
-{
- /* stereo to mono */
- {
- gint16 in[] = { 16384, -256, 1024, 1024 };
- gint16 out[] = { 8064, 1024 };
-
- RUN_CONVERSION ("int16 stereo to mono",
- in, get_int_caps (2, "BYTE_ORDER", 16, 16, TRUE),
- out, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE));
- }
- /* mono to stereo */
- {
- gint16 in[] = { 512, 1024 };
- gint16 out[] = { 512, 512, 1024, 1024 };
-
- RUN_CONVERSION ("int16 mono to stereo",
- in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE),
- out, get_int_caps (2, "BYTE_ORDER", 16, 16, TRUE));
- }
- /* signed -> unsigned */
- {
- gint16 in[] = { 0, -32767, 32767, -32768 };
- guint16 out[] = { 32768, 1, 65535, 0 };
-
- RUN_CONVERSION ("int16 signed to unsigned",
- in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE),
- out, get_int_caps (1, "BYTE_ORDER", 16, 16, FALSE));
- RUN_CONVERSION ("int16 unsigned to signed",
- out, get_int_caps (1, "BYTE_ORDER", 16, 16, FALSE),
- in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE));
- }
-}
-
-GST_END_TEST;
-
-
-GST_START_TEST (test_float32)
-{
- /* stereo to mono */
- {
- gfloat in[] = { 0.6, -0.0078125, 0.03125, 0.03125 };
- gfloat out[] = { 0.29609375, 0.03125 };
-
- RUN_CONVERSION ("float32 stereo to mono",
- in, get_float_caps (2, "BYTE_ORDER", 32),
- out, get_float_caps (1, "BYTE_ORDER", 32));
- }
- /* mono to stereo */
- {
- gfloat in[] = { 0.015625, 0.03125 };
- gfloat out[] = { 0.015625, 0.015625, 0.03125, 0.03125 };
-
- RUN_CONVERSION ("float32 mono to stereo",
- in, get_float_caps (1, "BYTE_ORDER", 32),
- out, get_float_caps (2, "BYTE_ORDER", 32));
- }
-}
-
-GST_END_TEST;
-
-
-GST_START_TEST (test_int_conversion)
-{
- /* 8 <-> 16 signed */
- /* NOTE: if audioconvert was doing dithering we'd have a problem */
- {
- gint8 in[] = { 0, 1, 2, 127, -127 };
- gint16 out[] = { 0, 256, 512, 32512, -32512 };
-
- RUN_CONVERSION ("int 8bit to 16bit signed",
- in, get_int_caps (1, "BYTE_ORDER", 8, 8, TRUE),
- out, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE)
- );
- RUN_CONVERSION ("int 16bit signed to 8bit",
- out, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE),
- in, get_int_caps (1, "BYTE_ORDER", 8, 8, TRUE)
- );
- }
- /* 16 -> 8 signed */
- {
- gint16 in[] = { 0, 127, 128, 256, 256 + 127, 256 + 128 };
- gint8 out[] = { 0, 0, 1, 1, 1, 2 };
-
- RUN_CONVERSION ("16 bit to 8 signed",
- in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE),
- out, get_int_caps (1, "BYTE_ORDER", 8, 8, TRUE)
- );
- }
- /* 8 unsigned <-> 16 signed */
- /* NOTE: if audioconvert was doing dithering we'd have a problem */
- {
- guint8 in[] = { 128, 129, 130, 255, 1 };
- gint16 out[] = { 0, 256, 512, 32512, -32512 };
- GstCaps *incaps, *outcaps;
-
- /* exploded for easier valgrinding */
- incaps = get_int_caps (1, "BYTE_ORDER", 8, 8, FALSE);
- outcaps = get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE);
- GST_DEBUG ("incaps: %" GST_PTR_FORMAT, incaps);
- GST_DEBUG ("outcaps: %" GST_PTR_FORMAT, outcaps);
- RUN_CONVERSION ("8 unsigned to 16 signed", in, incaps, out, outcaps);
- RUN_CONVERSION ("16 signed to 8 unsigned", out, get_int_caps (1,
- "BYTE_ORDER", 16, 16, TRUE), in, get_int_caps (1, "BYTE_ORDER", 8,
- 8, FALSE)
- );
- }
- /* 8 <-> 24 signed */
- /* NOTE: if audioconvert was doing dithering we'd have a problem */
- {
- gint8 in[] = { 0, 1, 127 };
- guint8 out[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x7f };
- /* out has the bytes in little-endian, so that's how they should be
- * interpreted during conversion */
-
- RUN_CONVERSION ("8 to 24 signed", in, get_int_caps (1, "BYTE_ORDER", 8, 8,
- TRUE), out, get_int_caps (1, "LITTLE_ENDIAN", 24, 24, TRUE)
- );
- RUN_CONVERSION ("24 signed to 8", out, get_int_caps (1, "LITTLE_ENDIAN", 24,
- 24, TRUE), in, get_int_caps (1, "BYTE_ORDER", 8, 8, TRUE)
- );
- }
-
- /* 16 bit signed <-> unsigned */
- {
- gint16 in[] = { 0, 128, -128 };
- guint16 out[] = { 32768, 32896, 32640 };
- RUN_CONVERSION ("16 signed to 16 unsigned",
- in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE),
- out, get_int_caps (1, "BYTE_ORDER", 16, 16, FALSE)
- );
- RUN_CONVERSION ("16 unsigned to 16 signed",
- out, get_int_caps (1, "BYTE_ORDER", 16, 16, FALSE),
- in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE)
- );
- }
-
- /* 16 bit signed <-> 8 in 16 bit signed */
- /* NOTE: if audioconvert was doing dithering we'd have a problem */
- {
- gint16 in[] = { 0, 64 << 8, -64 << 8 };
- gint16 out[] = { 0, 64, -64 };
- RUN_CONVERSION ("16 signed to 8 in 16 signed",
- in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE),
- out, get_int_caps (1, "BYTE_ORDER", 16, 8, TRUE)
- );
- RUN_CONVERSION ("8 in 16 signed to 16 signed",
- out, get_int_caps (1, "BYTE_ORDER", 16, 8, TRUE),
- in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE)
- );
- }
-
- /* 16 bit unsigned <-> 8 in 16 bit unsigned */
- /* NOTE: if audioconvert was doing dithering we'd have a problem */
- {
- guint16 in[] = { 1 << 15, (1 << 15) - (64 << 8), (1 << 15) + (64 << 8) };
- guint16 out[] = { 1 << 7, (1 << 7) - 64, (1 << 7) + 64 };
- RUN_CONVERSION ("16 unsigned to 8 in 16 unsigned",
- in, get_int_caps (1, "BYTE_ORDER", 16, 16, FALSE),
- out, get_int_caps (1, "BYTE_ORDER", 16, 8, FALSE)
- );
- RUN_CONVERSION ("8 in 16 unsigned to 16 unsigned",
- out, get_int_caps (1, "BYTE_ORDER", 16, 8, FALSE),
- in, get_int_caps (1, "BYTE_ORDER", 16, 16, FALSE)
- );
- }
-
- /* 32 bit signed -> 16 bit signed for rounding check */
- /* NOTE: if audioconvert was doing dithering we'd have a problem */
- {
- gint32 in[] = { 0, G_MININT32, G_MAXINT32,
- (32 << 16), (32 << 16) + (1 << 15), (32 << 16) - (1 << 15),
- (32 << 16) + (2 << 15), (32 << 16) - (2 << 15),
- (-32 << 16) + (1 << 15), (-32 << 16) - (1 << 15),
- (-32 << 16) + (2 << 15), (-32 << 16) - (2 << 15),
- (-32 << 16)
- };
- gint16 out[] = { 0, G_MININT16, G_MAXINT16,
- 32, 33, 32,
- 33, 31,
- -31, -32,
- -31, -33,
- -32
- };
- RUN_CONVERSION ("32 signed to 16 signed for rounding",
- in, get_int_caps (1, "BYTE_ORDER", 32, 32, TRUE),
- out, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE)
- );
- }
-
- /* 32 bit signed -> 16 bit unsigned for rounding check */
- /* NOTE: if audioconvert was doing dithering we'd have a problem */
- {
- gint32 in[] = { 0, G_MININT32, G_MAXINT32,
- (32 << 16), (32 << 16) + (1 << 15), (32 << 16) - (1 << 15),
- (32 << 16) + (2 << 15), (32 << 16) - (2 << 15),
- (-32 << 16) + (1 << 15), (-32 << 16) - (1 << 15),
- (-32 << 16) + (2 << 15), (-32 << 16) - (2 << 15),
- (-32 << 16)
- };
- guint16 out[] = { (1 << 15), 0, G_MAXUINT16,
- (1 << 15) + 32, (1 << 15) + 33, (1 << 15) + 32,
- (1 << 15) + 33, (1 << 15) + 31,
- (1 << 15) - 31, (1 << 15) - 32,
- (1 << 15) - 31, (1 << 15) - 33,
- (1 << 15) - 32
- };
- RUN_CONVERSION ("32 signed to 16 unsigned for rounding",
- in, get_int_caps (1, "BYTE_ORDER", 32, 32, TRUE),
- out, get_int_caps (1, "BYTE_ORDER", 16, 16, FALSE)
- );
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_float_conversion)
-{
- /* 32 float <-> 16 signed */
- /* NOTE: if audioconvert was doing dithering we'd have a problem */
- {
- gfloat in_le[] =
- { GFLOAT_TO_LE (0.0), GFLOAT_TO_LE (1.0), GFLOAT_TO_LE (-1.0),
- GFLOAT_TO_LE (0.5), GFLOAT_TO_LE (-0.5), GFLOAT_TO_LE (1.1),
- GFLOAT_TO_LE (-1.1)
- };
- gfloat in_be[] =
- { GFLOAT_TO_BE (0.0), GFLOAT_TO_BE (1.0), GFLOAT_TO_BE (-1.0),
- GFLOAT_TO_BE (0.5), GFLOAT_TO_BE (-0.5), GFLOAT_TO_BE (1.1),
- GFLOAT_TO_BE (-1.1)
- };
- gint16 out[] = { 0, 32767, -32768, 16384, -16384, 32767, -32768 };
-
- /* only one direction conversion, the other direction does
- * not produce exactly the same as the input due to floating
- * point rounding errors etc. */
- RUN_CONVERSION ("32 float le to 16 signed",
- in_le, get_float_caps (1, "LITTLE_ENDIAN", 32),
- out, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE));
- RUN_CONVERSION ("32 float be to 16 signed",
- in_be, get_float_caps (1, "BIG_ENDIAN", 32),
- out, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE));
- }
-
- {
- gint16 in[] = { 0, -32768, 16384, -16384 };
- gfloat out[] = { 0.0, -1.0, 0.5, -0.5 };
-
- RUN_CONVERSION ("16 signed to 32 float",
- in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE),
- out, get_float_caps (1, "BYTE_ORDER", 32));
- }
-
- /* 64 float <-> 16 signed */
- /* NOTE: if audioconvert was doing dithering we'd have a problem */
- {
- gdouble in_le[] =
- { GDOUBLE_TO_LE (0.0), GDOUBLE_TO_LE (1.0), GDOUBLE_TO_LE (-1.0),
- GDOUBLE_TO_LE (0.5), GDOUBLE_TO_LE (-0.5), GDOUBLE_TO_LE (1.1),
- GDOUBLE_TO_LE (-1.1)
- };
- gdouble in_be[] =
- { GDOUBLE_TO_BE (0.0), GDOUBLE_TO_BE (1.0), GDOUBLE_TO_BE (-1.0),
- GDOUBLE_TO_BE (0.5), GDOUBLE_TO_BE (-0.5), GDOUBLE_TO_BE (1.1),
- GDOUBLE_TO_BE (-1.1)
- };
- gint16 out[] = { 0, 32767, -32768, 16384, -16384, 32767, -32768 };
-
- /* only one direction conversion, the other direction does
- * not produce exactly the same as the input due to floating
- * point rounding errors etc. */
- RUN_CONVERSION ("64 float LE to 16 signed",
- in_le, get_float_caps (1, "LITTLE_ENDIAN", 64),
- out, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE));
- RUN_CONVERSION ("64 float BE to 16 signed",
- in_be, get_float_caps (1, "BIG_ENDIAN", 64),
- out, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE));
- }
- {
- gint16 in[] = { 0, -32768, 16384, -16384 };
- gdouble out[] = { 0.0,
- (gdouble) (-32768L << 16) / 2147483647.0, /* ~ -1.0 */
- (gdouble) (16384L << 16) / 2147483647.0, /* ~ 0.5 */
- (gdouble) (-16384L << 16) / 2147483647.0, /* ~ -0.5 */
- };
-
- RUN_CONVERSION ("16 signed to 64 float",
- in, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE),
- out, get_float_caps (1, "BYTE_ORDER", 64));
- }
- {
- gint32 in[] = { 0, (-1L << 31), (1L << 30), (-1L << 30) };
- gdouble out[] = { 0.0,
- (gdouble) (-1L << 31) / 2147483647.0, /* ~ -1.0 */
- (gdouble) (1L << 30) / 2147483647.0, /* ~ 0.5 */
- (gdouble) (-1L << 30) / 2147483647.0, /* ~ -0.5 */
- };
-
- RUN_CONVERSION ("32 signed to 64 float",
- in, get_int_caps (1, "BYTE_ORDER", 32, 32, TRUE),
- out, get_float_caps (1, "BYTE_ORDER", 64));
- }
-
- /* 64-bit float <-> 32-bit float */
- {
- gdouble in[] = { 0.0, 1.0, -1.0, 0.5, -0.5 };
- gfloat out[] = { 0.0, 1.0, -1.0, 0.5, -0.5 };
-
- RUN_CONVERSION ("64 float to 32 float",
- in, get_float_caps (1, "BYTE_ORDER", 64),
- out, get_float_caps (1, "BYTE_ORDER", 32));
-
- RUN_CONVERSION ("32 float to 64 float",
- out, get_float_caps (1, "BYTE_ORDER", 32),
- in, get_float_caps (1, "BYTE_ORDER", 64));
- }
-
- /* 32-bit float little endian <-> big endian */
- {
- gfloat le[] = { GFLOAT_TO_LE (0.0), GFLOAT_TO_LE (1.0), GFLOAT_TO_LE (-1.0),
- GFLOAT_TO_LE (0.5), GFLOAT_TO_LE (-0.5)
- };
- gfloat be[] = { GFLOAT_TO_BE (0.0), GFLOAT_TO_BE (1.0), GFLOAT_TO_BE (-1.0),
- GFLOAT_TO_BE (0.5), GFLOAT_TO_BE (-0.5)
- };
-
- RUN_CONVERSION ("32 float LE to BE",
- le, get_float_caps (1, "LITTLE_ENDIAN", 32),
- be, get_float_caps (1, "BIG_ENDIAN", 32));
-
- RUN_CONVERSION ("32 float BE to LE",
- be, get_float_caps (1, "BIG_ENDIAN", 32),
- le, get_float_caps (1, "LITTLE_ENDIAN", 32));
- }
-
- /* 64-bit float little endian <-> big endian */
- {
- gdouble le[] =
- { GDOUBLE_TO_LE (0.0), GDOUBLE_TO_LE (1.0), GDOUBLE_TO_LE (-1.0),
- GDOUBLE_TO_LE (0.5), GDOUBLE_TO_LE (-0.5)
- };
- gdouble be[] =
- { GDOUBLE_TO_BE (0.0), GDOUBLE_TO_BE (1.0), GDOUBLE_TO_BE (-1.0),
- GDOUBLE_TO_BE (0.5), GDOUBLE_TO_BE (-0.5)
- };
-
- RUN_CONVERSION ("64 float LE to BE",
- le, get_float_caps (1, "LITTLE_ENDIAN", 64),
- be, get_float_caps (1, "BIG_ENDIAN", 64));
-
- RUN_CONVERSION ("64 float BE to LE",
- be, get_float_caps (1, "BIG_ENDIAN", 64),
- le, get_float_caps (1, "LITTLE_ENDIAN", 64));
- }
-}
-
-GST_END_TEST;
-
-
-GST_START_TEST (test_multichannel_conversion)
-{
- {
- gfloat in[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
- gfloat out[] = { 0.0, 0.0 };
-
- RUN_CONVERSION ("3 channels to 1", in, get_float_mc_caps (3,
- "BYTE_ORDER", 32, FALSE), out, get_float_caps (1, "BYTE_ORDER",
- 32));
- RUN_CONVERSION ("1 channels to 3", out, get_float_caps (1,
- "BYTE_ORDER", 32), in, get_float_mc_caps (3, "BYTE_ORDER",
- 32, TRUE));
- }
-
- {
- gint16 in[] = { 0, 0, 0, 0, 0, 0 };
- gint16 out[] = { 0, 0 };
-
- RUN_CONVERSION ("3 channels to 1", in, get_int_mc_caps (3,
- "BYTE_ORDER", 16, 16, TRUE, FALSE), out, get_int_caps (1,
- "BYTE_ORDER", 16, 16, TRUE));
- RUN_CONVERSION ("1 channels to 3", out, get_int_caps (1, "BYTE_ORDER", 16,
- 16, TRUE), in, get_int_mc_caps (3, "BYTE_ORDER", 16, 16, TRUE,
- TRUE));
- }
-
- {
- gint16 in[] = { 1, 2 };
- gint16 out[] = { 1, 1, 2, 2 };
- GstCaps *in_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstAudioChannelPosition in_layout[1] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_MONO };
- GstAudioChannelPosition out_layout[2] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
- };
-
- set_channel_positions (in_caps, 1, in_layout);
- set_channel_positions (out_caps, 2, out_layout);
-
- RUN_CONVERSION ("1 channels to 2 with standard layout", in,
- in_caps, out, out_caps);
- }
-
- {
- gint16 in[] = { 1, 2 };
- gint16 out[] = { 1, 1, 2, 2 };
- GstCaps *in_caps = get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE);
- GstCaps *out_caps = get_int_caps (2, "BYTE_ORDER", 16, 16, TRUE);
-
- RUN_CONVERSION ("1 channels to 2 with standard layout and no positions set",
- in, gst_caps_copy (in_caps), out, gst_caps_copy (out_caps));
-
- RUN_CONVERSION ("2 channels to 1 with standard layout and no positions set",
- out, out_caps, in, in_caps);
- }
-
- {
- gint16 in[] = { 1, 2 };
- gint16 out[] = { 1, 0, 2, 0 };
- GstCaps *in_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstAudioChannelPosition in_layout[1] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT };
- GstAudioChannelPosition out_layout[2] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
- };
-
- set_channel_positions (in_caps, 1, in_layout);
- set_channel_positions (out_caps, 2, out_layout);
-
- RUN_CONVERSION ("1 channels to 2 with non-standard layout", in,
- in_caps, out, out_caps);
- }
-
- {
- gint16 in[] = { 1, 2, 3, 4 };
- gint16 out[] = { 2, 4 };
- GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstAudioChannelPosition in_layout[2] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
- };
- GstAudioChannelPosition out_layout[1] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER };
-
- set_channel_positions (in_caps, 2, in_layout);
- set_channel_positions (out_caps, 1, out_layout);
-
- RUN_CONVERSION ("2 channels to 1 with non-standard layout", in,
- in_caps, out, out_caps);
- }
-
- {
- gint16 in[] = { 1, 2, 3, 4 };
- gint16 out[] = { 2, 4 };
- GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstAudioChannelPosition in_layout[2] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
- };
- GstAudioChannelPosition out_layout[1] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_MONO };
-
- set_channel_positions (in_caps, 2, in_layout);
- set_channel_positions (out_caps, 1, out_layout);
-
- RUN_CONVERSION ("2 channels to 1 with standard layout", in,
- in_caps, out, out_caps);
- }
-
- {
- gint16 in[] = { 1, 2, 3, 4 };
- gint16 out[] = { 1, 3 };
- GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstAudioChannelPosition in_layout[2] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_REAR_CENTER
- };
- GstAudioChannelPosition out_layout[1] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_MONO };
-
- set_channel_positions (in_caps, 2, in_layout);
- set_channel_positions (out_caps, 1, out_layout);
-
- RUN_CONVERSION ("2 channels to 1 with non-standard layout", in,
- in_caps, out, out_caps);
- }
-
- {
- gint16 in[] = { 1, 2, 3, 4 };
- gint16 out[] = { 1, 3 };
- GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstAudioChannelPosition in_layout[2] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT
- };
- GstAudioChannelPosition out_layout[1] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_MONO };
-
- set_channel_positions (in_caps, 2, in_layout);
- set_channel_positions (out_caps, 1, out_layout);
-
- RUN_CONVERSION ("2 channels to 1 with non-standard layout", in,
- in_caps, out, out_caps);
- }
- {
- gint16 in[] = { 4, 5, 4, 2, 2, 1 };
- gint16 out[] = { 3, 3 };
- GstCaps *in_caps = get_int_mc_caps (6, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstCaps *out_caps = get_int_caps (2, "BYTE_ORDER", 16, 16, TRUE);
-
- RUN_CONVERSION ("5.1 to 2 channels", in, in_caps, out, out_caps);
- }
- {
- gint16 in[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- gint16 out[] = { 0, 0 };
- GstCaps *in_caps = get_int_mc_caps (11, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstAudioChannelPosition in_layout[11] = {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
- GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
- GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
- };
-
- set_channel_positions (in_caps, 11, in_layout);
-
- RUN_CONVERSION ("11 channels to 2", in,
- gst_caps_copy (in_caps), out, gst_caps_copy (out_caps));
- RUN_CONVERSION ("2 channels to 11", out, out_caps, in, in_caps);
- }
-
-}
-
-GST_END_TEST;
-
-/* for testing channel remapping with 8 channels */
-static GstAudioChannelPosition n8chan_pos_remap_in[8] = {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
- GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT
-};
-static GstAudioChannelPosition n8chan_pos_remap_out[8] = {
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
- GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_LFE
-};
-
-GST_START_TEST (test_channel_remapping)
-{
- /* float */
- {
- gfloat in[] = { 0.0, 1.0, -0.5 };
- gfloat out[] = { -0.5, 1.0, 0.0 };
- GstCaps *in_caps = get_float_mc_caps (3, "BYTE_ORDER", 32, FALSE);
- GstCaps *out_caps = get_float_mc_caps (3, "BYTE_ORDER", 32, TRUE);
-
- RUN_CONVERSION ("3 channels layout remapping float", in, in_caps,
- out, out_caps);
- }
-
- /* int */
- {
- guint16 in[] = { 0, 65535, 0x9999 };
- guint16 out[] = { 0x9999, 65535, 0 };
- GstCaps *in_caps = get_int_mc_caps (3, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (3, "BYTE_ORDER", 16, 16, FALSE, TRUE);
-
- RUN_CONVERSION ("3 channels layout remapping int", in, in_caps,
- out, out_caps);
- }
-
- /* int with 8 channels (= largest number allowed with channel positions) */
- {
- guint16 in[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
- guint16 out[] = { 4, 0, 1, 6, 7, 2, 3, 5 };
- GstCaps *in_caps = get_int_mc_caps (8, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (8, "BYTE_ORDER", 16, 16, FALSE, TRUE);
-
- set_channel_positions (in_caps, 8, n8chan_pos_remap_in);
- set_channel_positions (out_caps, 8, n8chan_pos_remap_out);
-
- RUN_CONVERSION ("8 channels layout remapping int", in, in_caps,
- out, out_caps);
- }
-
- /* int16 to int32 with 8 channels (= largest number allowed with channel positions) */
- {
- guint16 in[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
- guint32 out[] =
- { 4 << 16, 0, 1 << 16, 6 << 16, 7 << 16, 2 << 16, 3 << 16, 5 << 16 };
- GstCaps *in_caps = get_int_mc_caps (8, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (8, "BYTE_ORDER", 32, 32, FALSE, TRUE);
-
- set_channel_positions (in_caps, 8, n8chan_pos_remap_in);
- set_channel_positions (out_caps, 8, n8chan_pos_remap_out);
-
- RUN_CONVERSION ("8 channels layout remapping int16 --> int32", in, in_caps,
- out, out_caps);
-
- in_caps = get_int_mc_caps (8, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- out_caps = get_int_mc_caps (8, "BYTE_ORDER", 32, 32, FALSE, TRUE);
- set_channel_positions (in_caps, 8, n8chan_pos_remap_in);
- set_channel_positions (out_caps, 8, n8chan_pos_remap_out);
- RUN_CONVERSION ("8 channels layout remapping int16 <-- int32", out,
- out_caps, in, in_caps);
- }
-
- /* float to gint16 with 3 channels */
- {
- gfloat in[] = { 100.0 / G_MAXINT16, 0.0, -100.0 / G_MAXINT16 };
- gint16 out[] = { -100, 0, 100 };
- GstCaps *in_caps = get_float_mc_caps (3, "BYTE_ORDER", 32, TRUE);
- GstCaps *out_caps = get_int_mc_caps (3, "BYTE_ORDER", 16, 16, TRUE, FALSE);
-
- RUN_CONVERSION ("3 channels layout remapping float32 --> int16", in,
- in_caps, out, out_caps);
- }
-
- /* gint16 to gint16 with 2 channels and non-standard layout */
- {
- gint16 in[] = { 1, 2, 3, 4 };
- gint16 out[] = { 1, 2, 2, 4 };
- GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstAudioChannelPosition in_layout[2] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_LFE
- };
- GstAudioChannelPosition out_layout[2] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
- };
-
- set_channel_positions (in_caps, 2, in_layout);
- set_channel_positions (out_caps, 2, out_layout);
-
- RUN_CONVERSION ("2 channels layout remapping int16 --> int16", in,
- in_caps, out, out_caps);
- }
-
- /* gint16 to gint16 with 2 channels and non-standard layout */
- {
- gint16 in[] = { 1, 2, 3, 4 };
- gint16 out[] = { 2, 1, 4, 3 };
- GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstAudioChannelPosition in_layout[2] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT
- };
- GstAudioChannelPosition out_layout[2] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
- };
-
- set_channel_positions (in_caps, 2, in_layout);
- set_channel_positions (out_caps, 2, out_layout);
-
- RUN_CONVERSION ("2 channels layout remapping int16 --> int16", in,
- in_caps, out, out_caps);
- }
-
- /* gint16 to gint16 with 2 channels and non-standard layout */
- {
- gint16 in[] = { 1, 2, 3, 4 };
- gint16 out[] = { 1, 1, 3, 3 };
- GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstAudioChannelPosition in_layout[2] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_REAR_CENTER
- };
- GstAudioChannelPosition out_layout[2] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
- };
-
- set_channel_positions (in_caps, 2, in_layout);
- set_channel_positions (out_caps, 2, out_layout);
-
- RUN_CONVERSION ("2 channels layout remapping int16 --> int16", in,
- in_caps, out, out_caps);
- }
-
- /* gint16 to gint16 with 1 channel and non-standard layout */
- {
- gint16 in[] = { 1, 2, 3, 4 };
- gint16 out[] = { 0, 0, 0, 0 };
- GstCaps *in_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstAudioChannelPosition in_layout[1] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT };
- GstAudioChannelPosition out_layout[1] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT };
-
- set_channel_positions (in_caps, 1, in_layout);
- set_channel_positions (out_caps, 1, out_layout);
-
- RUN_CONVERSION ("1 channels layout remapping int16 --> int16", in,
- in_caps, out, out_caps);
- }
-
- /* gint16 to gint16 with 1 channel and non-standard layout */
- {
- gint16 in[] = { 1, 2, 3, 4 };
- gint16 out[] = { 1, 2, 3, 4 };
- GstCaps *in_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstAudioChannelPosition in_layout[1] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_MONO };
- GstAudioChannelPosition out_layout[1] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER };
-
- set_channel_positions (in_caps, 1, in_layout);
- set_channel_positions (out_caps, 1, out_layout);
-
- RUN_CONVERSION ("1 channels layout remapping int16 --> int16", in,
- in_caps, out, out_caps);
- }
-
- /* gint16 to gint16 with 1 channel and non-standard layout */
- {
- gint16 in[] = { 1, 2, 3, 4 };
- gint16 out[] = { 1, 2, 3, 4 };
- GstCaps *in_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstAudioChannelPosition in_layout[1] =
- { GST_AUDIO_CHANNEL_POSITION_FRONT_MONO };
- GstAudioChannelPosition out_layout[1] =
- { GST_AUDIO_CHANNEL_POSITION_REAR_LEFT };
-
- set_channel_positions (in_caps, 1, in_layout);
- set_channel_positions (out_caps, 1, out_layout);
-
- RUN_CONVERSION ("1 channels layout remapping int16 --> int16", in,
- in_caps, out, out_caps);
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_caps_negotiation)
-{
- GstElement *src, *ac1, *ac2, *ac3, *sink;
- GstElement *pipeline;
- GstPad *ac3_src;
- GstCaps *caps1, *caps2;
-
- pipeline = gst_pipeline_new ("test");
-
- /* create elements */
- src = gst_element_factory_make ("audiotestsrc", "src");
- ac1 = gst_element_factory_make ("audioconvert", "ac1");
- ac2 = gst_element_factory_make ("audioconvert", "ac2");
- ac3 = gst_element_factory_make ("audioconvert", "ac3");
- sink = gst_element_factory_make ("fakesink", "sink");
- ac3_src = gst_element_get_static_pad (ac3, "src");
-
- /* test with 2 audioconvert elements */
- gst_bin_add_many (GST_BIN (pipeline), src, ac1, ac3, sink, NULL);
- gst_element_link_many (src, ac1, ac3, sink, NULL);
-
- /* Set to PAUSED and wait for PREROLL */
- fail_if (gst_element_set_state (pipeline, GST_STATE_PAUSED) ==
- GST_STATE_CHANGE_FAILURE, "Failed to set test pipeline to PAUSED");
- fail_if (gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE) !=
- GST_STATE_CHANGE_SUCCESS, "Failed to set test pipeline to PAUSED");
-
- caps1 = gst_pad_get_caps (ac3_src);
- fail_if (caps1 == NULL, "gst_pad_get_caps returned NULL");
- GST_DEBUG ("Caps size 1 : %d", gst_caps_get_size (caps1));
-
- fail_if (gst_element_set_state (pipeline, GST_STATE_READY) ==
- GST_STATE_CHANGE_FAILURE, "Failed to set test pipeline back to READY");
- fail_if (gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE) !=
- GST_STATE_CHANGE_SUCCESS, "Failed to set test pipeline back to READY");
-
- /* test with 3 audioconvert elements */
- gst_element_unlink (ac1, ac3);
- gst_bin_add (GST_BIN (pipeline), ac2);
- gst_element_link_many (ac1, ac2, ac3, NULL);
-
- fail_if (gst_element_set_state (pipeline, GST_STATE_PAUSED) ==
- GST_STATE_CHANGE_FAILURE, "Failed to set test pipeline back to PAUSED");
- fail_if (gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE) !=
- GST_STATE_CHANGE_SUCCESS, "Failed to set test pipeline back to PAUSED");
-
- caps2 = gst_pad_get_caps (ac3_src);
-
- fail_if (caps2 == NULL, "gst_pad_get_caps returned NULL");
- GST_DEBUG ("Caps size 2 : %d", gst_caps_get_size (caps2));
- fail_unless (gst_caps_get_size (caps1) == gst_caps_get_size (caps2));
-
- gst_caps_unref (caps1);
- gst_caps_unref (caps2);
-
- fail_if (gst_element_set_state (pipeline, GST_STATE_NULL) ==
- GST_STATE_CHANGE_FAILURE, "Failed to set test pipeline back to NULL");
- fail_if (gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE) !=
- GST_STATE_CHANGE_SUCCESS, "Failed to set test pipeline back to NULL");
-
- gst_object_unref (ac3_src);
- gst_object_unref (pipeline);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_convert_undefined_multichannel)
-{
- /* (A) CONVERSION FROM 'WORSE' TO 'BETTER' FORMAT */
-
- /* 1 channel, NONE positions, int8 => int16 */
- {
- guint16 out[] = { 0x2000 };
- guint8 in[] = { 0x20 };
- GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *in_caps = get_int_mc_caps (1, "BYTE_ORDER", 8, 8, FALSE, FALSE);
-
- set_channel_positions (out_caps, 1, undefined_positions[1 - 1]);
- set_channel_positions (in_caps, 1, undefined_positions[1 - 1]);
-
- RUN_CONVERSION ("1 channel, undefined layout, identity conversion, "
- "int8 => int16", in, in_caps, out, out_caps);
- }
-
- /* 2 channels, NONE positions, int8 => int16 */
- {
- guint16 out[] = { 0x8000, 0x2000 };
- guint8 in[] = { 0x80, 0x20 };
- GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 8, 8, FALSE, FALSE);
-
- set_channel_positions (out_caps, 2, undefined_positions[2 - 1]);
- set_channel_positions (in_caps, 2, undefined_positions[2 - 1]);
-
- RUN_CONVERSION ("2 channels, undefined layout, identity conversion, "
- "int8 => int16", in, in_caps, out, out_caps);
- }
-
- /* 6 channels, NONE positions, int8 => int16 */
- {
- guint16 out[] = { 0x0000, 0x2000, 0x8000, 0x2000, 0x0000, 0xff00 };
- guint8 in[] = { 0x00, 0x20, 0x80, 0x20, 0x00, 0xff };
- GstCaps *out_caps = get_int_mc_caps (6, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *in_caps = get_int_mc_caps (6, "BYTE_ORDER", 8, 8, FALSE, FALSE);
-
- set_channel_positions (out_caps, 6, undefined_positions[6 - 1]);
- set_channel_positions (in_caps, 6, undefined_positions[6 - 1]);
-
- RUN_CONVERSION ("6 channels, undefined layout, identity conversion, "
- "int8 => int16", in, in_caps, out, out_caps);
- }
-
- /* 9 channels, NONE positions, int8 => int16 */
- {
- guint16 out[] = { 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
- 0x0000, 0xff00, 0x0000
- };
- guint8 in[] = { 0x00, 0xff, 0x00, 0x20, 0x80, 0x20, 0x00, 0xff, 0x00 };
- GstCaps *out_caps = get_int_mc_caps (9, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *in_caps = get_int_mc_caps (9, "BYTE_ORDER", 8, 8, FALSE, FALSE);
-
- set_channel_positions (out_caps, 9, undefined_positions[9 - 1]);
- set_channel_positions (in_caps, 9, undefined_positions[9 - 1]);
-
- RUN_CONVERSION ("9 channels, undefined layout, identity conversion, "
- "int8 => int16", in, in_caps, out, out_caps);
- }
-
- /* 15 channels, NONE positions, int8 => int16 */
- {
- guint16 out[] =
- { 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000, 0x0000, 0xff00,
- 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000, 0x0000
- };
- guint8 in[] =
- { 0x00, 0xff, 0x00, 0x20, 0x80, 0x20, 0x00, 0xff, 0x00, 0xff, 0x00,
- 0x20, 0x80, 0x20, 0x00
- };
- GstCaps *out_caps =
- get_int_mc_caps (15, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *in_caps = get_int_mc_caps (15, "BYTE_ORDER", 8, 8, FALSE, FALSE);
-
- set_channel_positions (out_caps, 15, undefined_positions[15 - 1]);
- set_channel_positions (in_caps, 15, undefined_positions[15 - 1]);
-
- RUN_CONVERSION ("15 channels, undefined layout, identity conversion, "
- "int8 => int16", in, in_caps, out, out_caps);
- }
-
- /* (B) CONVERSION FROM 'BETTER' TO 'WORSE' FORMAT */
-
- /* 1 channel, NONE positions, int16 => int8 */
- {
- guint16 in[] = { 0x2000 };
- guint8 out[] = { 0x20 };
- GstCaps *in_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 8, 8, FALSE, FALSE);
-
- set_channel_positions (out_caps, 1, undefined_positions[1 - 1]);
- set_channel_positions (in_caps, 1, undefined_positions[1 - 1]);
-
- RUN_CONVERSION ("1 channel, undefined layout, identity conversion, "
- "int16 => int8", in, in_caps, out, out_caps);
- }
-
- /* 2 channels, NONE positions, int16 => int8 */
- {
- guint16 in[] = { 0x8000, 0x2000 };
- guint8 out[] = { 0x80, 0x20 };
- GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 8, 8, FALSE, FALSE);
-
- set_channel_positions (out_caps, 2, undefined_positions[2 - 1]);
- set_channel_positions (in_caps, 2, undefined_positions[2 - 1]);
-
- RUN_CONVERSION ("2 channels, undefined layout, identity conversion, "
- "int16 => int8", in, in_caps, out, out_caps);
- }
-
- /* 6 channels, NONE positions, int16 => int8 */
- {
- guint16 in[] = { 0x0000, 0x2000, 0x8000, 0x2000, 0x0000, 0xff00 };
- guint8 out[] = { 0x00, 0x20, 0x80, 0x20, 0x00, 0xff };
- GstCaps *in_caps = get_int_mc_caps (6, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (6, "BYTE_ORDER", 8, 8, FALSE, FALSE);
-
- set_channel_positions (out_caps, 6, undefined_positions[6 - 1]);
- set_channel_positions (in_caps, 6, undefined_positions[6 - 1]);
-
- RUN_CONVERSION ("6 channels, undefined layout, identity conversion, "
- "int16 => int8", in, in_caps, out, out_caps);
- }
-
- /* 9 channels, NONE positions, int16 => int8 */
- {
- guint16 in[] = { 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
- 0x0000, 0xff00, 0x0000
- };
- guint8 out[] = { 0x00, 0xff, 0x00, 0x20, 0x80, 0x20, 0x00, 0xff, 0x00 };
- GstCaps *in_caps = get_int_mc_caps (9, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (9, "BYTE_ORDER", 8, 8, FALSE, FALSE);
-
- set_channel_positions (out_caps, 9, undefined_positions[9 - 1]);
- set_channel_positions (in_caps, 9, undefined_positions[9 - 1]);
-
- RUN_CONVERSION ("9 channels, undefined layout, identity conversion, "
- "int16 => int8", in, in_caps, out, out_caps);
- }
-
- /* 15 channels, NONE positions, int16 => int8 */
- {
- guint16 in[] = { 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
- 0x0000, 0xff00, 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
- 0x0000
- };
- guint8 out[] =
- { 0x00, 0xff, 0x00, 0x20, 0x80, 0x20, 0x00, 0xff, 0x00, 0xff, 0x00,
- 0x20, 0x80, 0x20, 0x00
- };
- GstCaps *in_caps = get_int_mc_caps (15, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (15, "BYTE_ORDER", 8, 8, FALSE, FALSE);
-
- set_channel_positions (out_caps, 15, undefined_positions[15 - 1]);
- set_channel_positions (in_caps, 15, undefined_positions[15 - 1]);
-
- RUN_CONVERSION ("15 channels, undefined layout, identity conversion, "
- "int16 => int8", in, in_caps, out, out_caps);
- }
-
-
- /* (C) NO CONVERSION, SAME FORMAT */
-
- /* 1 channel, NONE positions, int16 => int16 */
- {
- guint16 in[] = { 0x2000 };
- guint16 out[] = { 0x2000 };
- GstCaps *in_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (1, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-
- set_channel_positions (out_caps, 1, undefined_positions[1 - 1]);
- set_channel_positions (in_caps, 1, undefined_positions[1 - 1]);
-
- RUN_CONVERSION ("1 channel, undefined layout, identity conversion, "
- "int16 => int16", in, in_caps, out, out_caps);
- }
-
- /* 2 channels, NONE positions, int16 => int16 */
- {
- guint16 in[] = { 0x8000, 0x2000 };
- guint16 out[] = { 0x8000, 0x2000 };
- GstCaps *in_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-
- set_channel_positions (out_caps, 2, undefined_positions[2 - 1]);
- set_channel_positions (in_caps, 2, undefined_positions[2 - 1]);
-
- RUN_CONVERSION ("2 channels, undefined layout, identity conversion, "
- "int16 => int16", in, in_caps, out, out_caps);
- }
-
- /* 6 channels, NONE positions, int16 => int16 */
- {
- guint16 in[] = { 0x0000, 0x2000, 0x8000, 0x2000, 0x0000, 0xff00 };
- guint16 out[] = { 0x0000, 0x2000, 0x8000, 0x2000, 0x0000, 0xff00 };
- GstCaps *in_caps = get_int_mc_caps (6, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (6, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-
- set_channel_positions (out_caps, 6, undefined_positions[6 - 1]);
- set_channel_positions (in_caps, 6, undefined_positions[6 - 1]);
-
- RUN_CONVERSION ("6 channels, undefined layout, identity conversion, "
- "int16 => int16", in, in_caps, out, out_caps);
- }
-
- /* 9 channels, NONE positions, int16 => int16 */
- {
- guint16 in[] = { 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
- 0x0000, 0xff00, 0x0000
- };
- guint16 out[] = { 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
- 0x0000, 0xff00, 0x0000
- };
- GstCaps *in_caps = get_int_mc_caps (9, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (9, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-
- set_channel_positions (out_caps, 9, undefined_positions[9 - 1]);
- set_channel_positions (in_caps, 9, undefined_positions[9 - 1]);
-
- RUN_CONVERSION ("9 channels, undefined layout, identity conversion, "
- "int16 => int16", in, in_caps, out, out_caps);
- }
-
- /* 15 channels, NONE positions, int16 => int16 */
- {
- guint16 in[] = { 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
- 0x0000, 0xff00, 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
- 0x0000
- };
- guint16 out[] = { 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
- 0x0000, 0xff00, 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
- 0x0000
- };
- GstCaps *in_caps = get_int_mc_caps (15, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps =
- get_int_mc_caps (15, "BYTE_ORDER", 16, 16, FALSE, FALSE);
-
- set_channel_positions (out_caps, 15, undefined_positions[15 - 1]);
- set_channel_positions (in_caps, 15, undefined_positions[15 - 1]);
-
- RUN_CONVERSION ("15 channels, undefined layout, identity conversion, "
- "int16 => int16", in, in_caps, out, out_caps);
- }
-
-
- /* (C) int16 => float */
-
- /* 9 channels, NONE positions, int16 => float */
- {
- guint16 in[] = { 0x0000, 0x8000, 0x0000, 0x8000, 0x8000, 0x8000,
- 0x0000, 0x8000, 0x0000
- };
- gfloat out[] = { -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, -1.0 };
- GstCaps *in_caps = get_int_mc_caps (9, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps = get_float_mc_caps (9, "BYTE_ORDER", 32, FALSE);
-
- set_channel_positions (out_caps, 9, undefined_positions[9 - 1]);
- set_channel_positions (in_caps, 9, undefined_positions[9 - 1]);
-
- RUN_CONVERSION ("9 channels, undefined layout, identity conversion, "
- "int16 => float", in, in_caps, out, out_caps);
- }
-
- /* 15 channels, NONE positions, int16 => float */
- {
- guint16 in[] = { 0x0000, 0x8000, 0x0000, 0x8000, 0x8000, 0x8000,
- 0x0000, 0x8000, 0x0000, 0x8000, 0x0000, 0x8000, 0x8000, 0x8000,
- 0x0000
- };
- gfloat out[] =
- { -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, -1.0, 0.0, -1.0, 0.0, 0.0,
- 0.0, -1.0
- };
- GstCaps *in_caps = get_int_mc_caps (15, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps = get_float_mc_caps (15, "BYTE_ORDER", 32, FALSE);
-
- set_channel_positions (out_caps, 15, undefined_positions[15 - 1]);
- set_channel_positions (in_caps, 15, undefined_positions[15 - 1]);
-
- RUN_CONVERSION ("15 channels, undefined layout, identity conversion, "
- "int16 => float", in, in_caps, out, out_caps);
- }
-
-
- /* 9 channels, NONE positions, int16 => float (same as above, but no
- * position on output caps to see if audioconvert transforms correctly) */
- {
- guint16 in[] = { 0x0000, 0x8000, 0x0000, 0x8000, 0x8000, 0x8000,
- 0x0000, 0x8000, 0x0000
- };
- gfloat out[] = { -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, -1.0 };
- GstCaps *in_caps = get_int_mc_caps (9, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps = get_float_mc_caps (9, "BYTE_ORDER", 32, FALSE);
-
- //set_channel_positions (out_caps, 9, undefined_positions[9 - 1]);
- set_channel_positions (in_caps, 9, undefined_positions[9 - 1]);
-
- RUN_CONVERSION ("9 channels, undefined layout, identity conversion, "
- "int16 => float", in, in_caps, out, out_caps);
- }
-
- /* 15 channels, NONE positions, int16 => float (same as above, but no
- * position on output caps to see if audioconvert transforms correctly) */
- {
- guint16 in[] = { 0x0000, 0x8000, 0x0000, 0x8000, 0x8000, 0x8000,
- 0x0000, 0x8000, 0x0000, 0x8000, 0x0000, 0x8000, 0x8000, 0x8000,
- 0x0000
- };
- gfloat out[] =
- { -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, -1.0, 0.0, -1.0, 0.0, 0.0,
- 0.0, -1.0
- };
- GstCaps *in_caps = get_int_mc_caps (15, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps = get_float_mc_caps (15, "BYTE_ORDER", 32, FALSE);
-
- //set_channel_positions (out_caps, 9, undefined_positions[9 - 1]);
- set_channel_positions (in_caps, 15, undefined_positions[15 - 1]);
-
- RUN_CONVERSION ("15 channels, undefined layout, identity conversion, "
- "int16 => float", in, in_caps, out, out_caps);
- }
-
- /* 8 channels, NONE positions => 2 channels: should fail, no mixing allowed */
- {
- guint16 in[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- gfloat out[] = { -1.0, -1.0 };
- GstCaps *in_caps = get_int_mc_caps (8, "BYTE_ORDER", 16, 16, FALSE, FALSE);
- GstCaps *out_caps = get_float_mc_caps (2, "BYTE_ORDER", 32, FALSE);
-
- set_channel_positions (in_caps, 8, undefined_positions[8 - 1]);
-
- RUN_CONVERSION_TO_FAIL ("8 channels with layout => 2 channels",
- in, in_caps, out, out_caps);
- }
-
- /* 8 channels, with positions => 2 channels (makes sure channel-position
- * fields are removed properly in some cases in ::transform_caps, so we
- * don't up with caps with 2 channels and 8 channel positions) */
- {
- GstAudioChannelPosition layout8ch[] = {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- GST_AUDIO_CHANNEL_POSITION_LFE,
- GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
- GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT
- };
- gint16 in[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- gint16 out[] = { 0, 0 };
- GstCaps *in_caps = get_int_mc_caps (8, "BYTE_ORDER", 16, 16, TRUE, FALSE);
- GstCaps *out_caps = get_int_mc_caps (2, "BYTE_ORDER", 16, 16, TRUE, FALSE);
-
- set_channel_positions (in_caps, 8, layout8ch);
-
- RUN_CONVERSION ("8 channels with layout => 2 channels",
- in, in_caps, out, out_caps);
- }
-}
-
-GST_END_TEST;
-
-static Suite *
-audioconvert_suite (void)
-{
- Suite *s = suite_create ("audioconvert");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_int16);
- tcase_add_test (tc_chain, test_float32);
- tcase_add_test (tc_chain, test_int_conversion);
- tcase_add_test (tc_chain, test_float_conversion);
- tcase_add_test (tc_chain, test_multichannel_conversion);
- tcase_add_test (tc_chain, test_channel_remapping);
- tcase_add_test (tc_chain, test_caps_negotiation);
- tcase_add_test (tc_chain, test_convert_undefined_multichannel);
-
- return s;
-}
-
-GST_CHECK_MAIN (audioconvert);
diff --git a/tests/check/elements/audiorate.c b/tests/check/elements/audiorate.c
deleted file mode 100644
index 75654dd5..00000000
--- a/tests/check/elements/audiorate.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/* GStreamer unit tests for audiorate
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gst/check/gstcheck.h>
-
-/* helper element to insert additional buffers overlapping with previous ones */
-static gdouble injector_inject_probability = 0.0;
-
-typedef GstElement TestInjector;
-typedef GstElementClass TestInjectorClass;
-
-GST_BOILERPLATE (TestInjector, test_injector, GstElement, GST_TYPE_ELEMENT);
-
-#define INJECTOR_CAPS \
- "audio/x-raw-float, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, 8 ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 32;" \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, 8 ], " \
- "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
- "width = (int) { 8, 16, 32 }, " \
- "depth = (int) [ 1, 32 ], " \
- "signed = (boolean) { true, false }"
-
-static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (INJECTOR_CAPS));
-
-static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (INJECTOR_CAPS));
-
-static void
-test_injector_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_template));
-}
-
-static void
-test_injector_class_init (TestInjectorClass * klass)
-{
- /* nothing to do here */
-}
-
-static GstFlowReturn
-test_injector_chain (GstPad * pad, GstBuffer * buf)
-{
- GstFlowReturn ret;
- GstPad *srcpad;
-
- srcpad =
- gst_element_get_static_pad (GST_ELEMENT (GST_PAD_PARENT (pad)), "src");
-
- /* since we're increasing timestamp/offsets, push this one first */
- GST_LOG (" passing buffer [t=%" GST_TIME_FORMAT "-%" GST_TIME_FORMAT
- "], offset=%" G_GINT64_FORMAT ", offset_end=%" G_GINT64_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf)),
- GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf));
-
- gst_buffer_ref (buf);
-
- ret = gst_pad_push (srcpad, buf);
-
- if (g_random_double () < injector_inject_probability) {
- GstBuffer *ibuf;
-
- ibuf = gst_buffer_copy (buf);
-
- if (GST_BUFFER_OFFSET_IS_VALID (buf) &&
- GST_BUFFER_OFFSET_END_IS_VALID (buf)) {
- guint64 delta;
-
- delta = GST_BUFFER_OFFSET_END (buf) - GST_BUFFER_OFFSET (buf);
- GST_BUFFER_OFFSET (ibuf) += delta / 4;
- GST_BUFFER_OFFSET_END (ibuf) += delta / 4;
- } else {
- GST_BUFFER_OFFSET (ibuf) = GST_BUFFER_OFFSET_NONE;
- GST_BUFFER_OFFSET_END (ibuf) = GST_BUFFER_OFFSET_NONE;
- }
-
- if (GST_BUFFER_TIMESTAMP_IS_VALID (buf) &&
- GST_BUFFER_DURATION_IS_VALID (buf)) {
- GstClockTime delta;
-
- delta = GST_BUFFER_DURATION (buf);
- GST_BUFFER_TIMESTAMP (ibuf) += delta / 4;
- } else {
- GST_BUFFER_TIMESTAMP (ibuf) = GST_CLOCK_TIME_NONE;
- GST_BUFFER_DURATION (ibuf) = GST_CLOCK_TIME_NONE;
- }
-
- if (GST_BUFFER_TIMESTAMP_IS_VALID (ibuf) ||
- GST_BUFFER_OFFSET_IS_VALID (ibuf)) {
- GST_LOG ("injecting buffer [t=%" GST_TIME_FORMAT "-%" GST_TIME_FORMAT
- "], offset=%" G_GINT64_FORMAT ", offset_end=%" G_GINT64_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (ibuf)),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (ibuf) +
- GST_BUFFER_DURATION (ibuf)), GST_BUFFER_OFFSET (ibuf),
- GST_BUFFER_OFFSET_END (ibuf));
-
- if (gst_pad_push (srcpad, ibuf) != GST_FLOW_OK) {
- /* ignore return value */
- }
- } else {
- GST_WARNING ("couldn't inject buffer, no incoming timestamps or offsets");
- gst_buffer_unref (ibuf);
- }
- }
-
- gst_buffer_unref (buf);
-
- return ret;
-}
-
-static void
-test_injector_init (TestInjector * injector, TestInjectorClass * klass)
-{
- GstPad *pad;
-
- pad = gst_pad_new_from_static_template (&sink_template, "sink");
- gst_pad_set_chain_function (pad, test_injector_chain);
- gst_pad_set_getcaps_function (pad, gst_pad_proxy_getcaps);
- gst_pad_set_setcaps_function (pad, gst_pad_proxy_setcaps);
- gst_element_add_pad (GST_ELEMENT (injector), pad);
-
- pad = gst_pad_new_from_static_template (&src_template, "src");
- gst_pad_set_getcaps_function (pad, gst_pad_proxy_getcaps);
- gst_pad_set_setcaps_function (pad, gst_pad_proxy_setcaps);
- gst_element_add_pad (GST_ELEMENT (injector), pad);
-}
-
-static gboolean
-probe_cb (GstPad * pad, GstBuffer * buf, gdouble * drop_probability)
-{
- if (g_random_double () < *drop_probability) {
- GST_LOG ("dropping buffer [t=%" GST_TIME_FORMAT "-%" GST_TIME_FORMAT "], "
- "offset=%" G_GINT64_FORMAT ", offset_end=%" G_GINT64_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf)),
- GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf));
- return FALSE; /* drop buffer */
- }
-
- return TRUE; /* don't drop buffer */
-}
-
-static void
-got_buf (GstElement * fakesink, GstBuffer * buf, GstPad * pad, GList ** p_bufs)
-{
- *p_bufs = g_list_append (*p_bufs, gst_buffer_ref (buf));
-}
-
-static void
-do_perfect_stream_test (guint rate, guint width, gdouble drop_probability,
- gdouble inject_probability)
-{
- GstElement *pipe, *src, *conv, *filter, *injector, *audiorate, *sink;
- GstMessage *msg;
- GstCaps *caps;
- GstPad *srcpad;
- GList *l, *bufs = NULL;
- GstClockTime next_time = GST_CLOCK_TIME_NONE;
- guint64 next_offset = GST_BUFFER_OFFSET_NONE;
-
- caps = gst_caps_new_simple ("audio/x-raw-int", "rate", G_TYPE_INT,
- rate, "width", G_TYPE_INT, width, NULL);
-
- GST_INFO ("-------- drop=%.0f%% caps = %" GST_PTR_FORMAT " ---------- ",
- drop_probability * 100.0, caps);
-
- g_assert (drop_probability >= 0.0 && drop_probability <= 1.0);
- g_assert (inject_probability >= 0.0 && inject_probability <= 1.0);
- g_assert (width > 0 && (width % 8) == 0);
-
- pipe = gst_pipeline_new ("pipeline");
- fail_unless (pipe != NULL);
-
- src = gst_element_factory_make ("audiotestsrc", "audiotestsrc");
- fail_unless (src != NULL);
-
- g_object_set (src, "num-buffers", 100, NULL);
-
- conv = gst_element_factory_make ("audioconvert", "audioconvert");
- fail_unless (conv != NULL);
-
- filter = gst_element_factory_make ("capsfilter", "capsfilter");
- fail_unless (filter != NULL);
-
- g_object_set (filter, "caps", caps, NULL);
-
- injector_inject_probability = inject_probability;
-
- injector = GST_ELEMENT (g_object_new (test_injector_get_type (), NULL));
-
- srcpad = gst_element_get_static_pad (injector, "src");
- fail_unless (srcpad != NULL);
- gst_pad_add_buffer_probe (srcpad, G_CALLBACK (probe_cb), &drop_probability);
- gst_object_unref (srcpad);
-
- audiorate = gst_element_factory_make ("audiorate", "audiorate");
- fail_unless (audiorate != NULL);
-
- sink = gst_element_factory_make ("fakesink", "fakesink");
- fail_unless (sink != NULL);
-
- g_object_set (sink, "signal-handoffs", TRUE, NULL);
-
- g_signal_connect (sink, "handoff", G_CALLBACK (got_buf), &bufs);
-
- gst_bin_add_many (GST_BIN (pipe), src, conv, filter, injector, audiorate,
- sink, NULL);
- gst_element_link_many (src, conv, filter, injector, audiorate, sink, NULL);
-
- fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_PLAYING),
- GST_STATE_CHANGE_ASYNC);
-
- fail_unless_equals_int (gst_element_get_state (pipe, NULL, NULL, -1),
- GST_STATE_CHANGE_SUCCESS);
-
- msg = gst_bus_poll (GST_ELEMENT_BUS (pipe),
- GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1);
- fail_unless_equals_string (GST_MESSAGE_TYPE_NAME (msg), "eos");
-
- for (l = bufs; l != NULL; l = l->next) {
- GstBuffer *buf = GST_BUFFER (l->data);
- guint num_samples;
-
- fail_unless (GST_BUFFER_TIMESTAMP_IS_VALID (buf));
- fail_unless (GST_BUFFER_DURATION_IS_VALID (buf));
- fail_unless (GST_BUFFER_OFFSET_IS_VALID (buf));
- fail_unless (GST_BUFFER_OFFSET_END_IS_VALID (buf));
-
- GST_LOG ("buffer: ts=%" GST_TIME_FORMAT ", end_ts=%" GST_TIME_FORMAT
- " off=%" G_GINT64_FORMAT ", end_off=%" G_GINT64_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf)),
- GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf));
-
- if (GST_CLOCK_TIME_IS_VALID (next_time)) {
- fail_unless_equals_uint64 (next_time, GST_BUFFER_TIMESTAMP (buf));
- }
- if (next_offset != GST_BUFFER_OFFSET_NONE) {
- fail_unless_equals_uint64 (next_offset, GST_BUFFER_OFFSET (buf));
- }
-
- /* check buffer size for sanity */
- fail_unless_equals_int (GST_BUFFER_SIZE (buf) % (width / 8), 0);
-
- /* check there is actually as much data as there should be */
- num_samples = GST_BUFFER_OFFSET_END (buf) - GST_BUFFER_OFFSET (buf);
- fail_unless_equals_int (GST_BUFFER_SIZE (buf), num_samples * (width / 8));
-
- next_time = GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf);
- next_offset = GST_BUFFER_OFFSET_END (buf);
- }
-
- gst_message_unref (msg);
- gst_element_set_state (pipe, GST_STATE_NULL);
- gst_object_unref (pipe);
-
- g_list_foreach (bufs, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (bufs);
-
- gst_caps_unref (caps);
-}
-
-static const guint rates[] = { 8000, 11025, 16000, 22050, 32000, 44100,
- 48000, 3333, 33333, 66666, 9999
-};
-
-GST_START_TEST (test_perfect_stream_drop0)
-{
- guint i;
-
- for (i = 0; i < G_N_ELEMENTS (rates); ++i) {
- do_perfect_stream_test (rates[i], 8, 0.0, 0.0);
- do_perfect_stream_test (rates[i], 16, 0.0, 0.0);
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_perfect_stream_drop10)
-{
- guint i;
-
- for (i = 0; i < G_N_ELEMENTS (rates); ++i) {
- do_perfect_stream_test (rates[i], 8, 0.10, 0.0);
- do_perfect_stream_test (rates[i], 16, 0.10, 0.0);
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_perfect_stream_drop50)
-{
- guint i;
-
- for (i = 0; i < G_N_ELEMENTS (rates); ++i) {
- do_perfect_stream_test (rates[i], 8, 0.50, 0.0);
- do_perfect_stream_test (rates[i], 16, 0.50, 0.0);
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_perfect_stream_drop90)
-{
- guint i;
-
- for (i = 0; i < G_N_ELEMENTS (rates); ++i) {
- do_perfect_stream_test (rates[i], 8, 0.90, 0.0);
- do_perfect_stream_test (rates[i], 16, 0.90, 0.0);
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_perfect_stream_inject10)
-{
- guint i;
-
- for (i = 0; i < G_N_ELEMENTS (rates); ++i) {
- do_perfect_stream_test (rates[i], 8, 0.0, 0.10);
- do_perfect_stream_test (rates[i], 16, 0.0, 0.10);
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_perfect_stream_inject90)
-{
- guint i;
-
- for (i = 0; i < G_N_ELEMENTS (rates); ++i) {
- do_perfect_stream_test (rates[i], 8, 0.0, 0.90);
- do_perfect_stream_test (rates[i], 16, 0.0, 0.90);
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_perfect_stream_drop45_inject25)
-{
- guint i;
-
- for (i = 0; i < G_N_ELEMENTS (rates); ++i) {
- do_perfect_stream_test (rates[i], 8, 0.45, 0.25);
- do_perfect_stream_test (rates[i], 16, 0.45, 0.25);
- }
-}
-
-GST_END_TEST;
-
-/* TODO: also do all tests with channels=1 and channels=2 */
-
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-float,channels=1,rate=44100,width=32")
- );
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-float,channels=1,rate=44100,width=32")
- );
-
-GST_START_TEST (test_large_discont)
-{
- GstElement *audiorate;
- GstCaps *caps;
- GstPad *srcpad, *sinkpad;
- GstBuffer *buf;
-
- audiorate = gst_check_setup_element ("audiorate");
- caps = gst_caps_new_simple ("audio/x-raw-float",
- "channels", G_TYPE_INT, 1,
- "rate", G_TYPE_INT, 44100, "width", G_TYPE_INT, 32, NULL);
-
- srcpad = gst_check_setup_src_pad (audiorate, &srctemplate, caps);
- sinkpad = gst_check_setup_sink_pad (audiorate, &sinktemplate, caps);
-
- gst_pad_set_active (srcpad, TRUE);
- gst_pad_set_active (sinkpad, TRUE);
-
- fail_unless (gst_element_set_state (audiorate,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "failed to set audiorate playing");
-
- buf = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (buf, caps);
- GST_BUFFER_TIMESTAMP (buf) = 0;
- gst_pad_push (srcpad, buf);
-
- fail_unless_equals_int (g_list_length (buffers), 1);
-
- buf = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (buf, caps);
- GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
- gst_pad_push (srcpad, buf);
- /* Now we should have 3 more buffers: the one we injected, plus _two_ filler
- * buffers, because the gap is > 1 second (but less than 2 seconds) */
- fail_unless_equals_int (g_list_length (buffers), 4);
-
- gst_element_set_state (audiorate, GST_STATE_NULL);
- gst_caps_unref (caps);
-
- gst_check_teardown_sink_pad (audiorate);
- gst_check_teardown_src_pad (audiorate);
-
- gst_object_unref (audiorate);
-}
-
-GST_END_TEST;
-
-static Suite *
-audiorate_suite (void)
-{
- Suite *s = suite_create ("audiorate");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
-
- tcase_add_test (tc_chain, test_perfect_stream_drop0);
- tcase_add_test (tc_chain, test_perfect_stream_drop10);
- tcase_add_test (tc_chain, test_perfect_stream_drop50);
- tcase_add_test (tc_chain, test_perfect_stream_drop90);
- tcase_add_test (tc_chain, test_perfect_stream_inject10);
- tcase_add_test (tc_chain, test_perfect_stream_inject90);
- tcase_add_test (tc_chain, test_perfect_stream_drop45_inject25);
- tcase_add_test (tc_chain, test_large_discont);
-
- return s;
-}
-
-GST_CHECK_MAIN (audiorate);
diff --git a/tests/check/elements/audioresample.c b/tests/check/elements/audioresample.c
deleted file mode 100644
index 4a67a9e0..00000000
--- a/tests/check/elements/audioresample.c
+++ /dev/null
@@ -1,926 +0,0 @@
-/* GStreamer
- *
- * unit test for audioresample, based on the audioresample unit test
- *
- * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org>
- * Copyright (C) <2006> Tim-Philipp Müller <tim at 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-
-#include <gst/audio/audio.h>
-
-/* For ease of programming we use globals to keep refs for our floating
- * src and sink pads we create; otherwise we always have to do get_pad,
- * get_peer, and then remove references in every test function */
-static GstPad *mysrcpad, *mysinkpad;
-
-#define RESAMPLE_CAPS_FLOAT \
- "audio/x-raw-float, " \
- "channels = (int) [ 1, MAX ], " \
- "rate = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) { 32, 64 }"
-
-#define RESAMPLE_CAPS_INT \
- "audio/x-raw-int, " \
- "channels = (int) [ 1, MAX ], " \
- "rate = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 16, " \
- "depth = (int) 16, " \
- "signed = (bool) TRUE"
-
-#define RESAMPLE_CAPS_TEMPLATE_STRING \
- RESAMPLE_CAPS_FLOAT " ; " \
- RESAMPLE_CAPS_INT
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (RESAMPLE_CAPS_TEMPLATE_STRING)
- );
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (RESAMPLE_CAPS_TEMPLATE_STRING)
- );
-
-static GstElement *
-setup_audioresample (int channels, int inrate, int outrate, int width,
- gboolean fp)
-{
- GstElement *audioresample;
- GstCaps *caps;
- GstStructure *structure;
-
- GST_DEBUG ("setup_audioresample");
- audioresample = gst_check_setup_element ("audioresample");
-
- if (fp)
- caps = gst_caps_from_string (RESAMPLE_CAPS_FLOAT);
- else
- caps = gst_caps_from_string (RESAMPLE_CAPS_INT);
- structure = gst_caps_get_structure (caps, 0);
- gst_structure_set (structure, "channels", G_TYPE_INT, channels,
- "rate", G_TYPE_INT, inrate, "width", G_TYPE_INT, width, NULL);
- if (!fp)
- gst_structure_set (structure, "depth", G_TYPE_INT, width, NULL);
- fail_unless (gst_caps_is_fixed (caps));
-
- fail_unless (gst_element_set_state (audioresample,
- GST_STATE_PAUSED) == GST_STATE_CHANGE_SUCCESS,
- "could not set to paused");
-
- mysrcpad = gst_check_setup_src_pad (audioresample, &srctemplate, caps);
- gst_pad_set_caps (mysrcpad, caps);
- gst_caps_unref (caps);
-
- if (fp)
- caps = gst_caps_from_string (RESAMPLE_CAPS_FLOAT);
- else
- caps = gst_caps_from_string (RESAMPLE_CAPS_INT);
- structure = gst_caps_get_structure (caps, 0);
- gst_structure_set (structure, "channels", G_TYPE_INT, channels,
- "rate", G_TYPE_INT, outrate, "width", G_TYPE_INT, width, NULL);
- if (!fp)
- gst_structure_set (structure, "depth", G_TYPE_INT, width, NULL);
- fail_unless (gst_caps_is_fixed (caps));
-
- mysinkpad = gst_check_setup_sink_pad (audioresample, &sinktemplate, caps);
- /* this installs a getcaps func that will always return the caps we set
- * later */
- gst_pad_set_caps (mysinkpad, caps);
- gst_pad_use_fixed_caps (mysinkpad);
-
- gst_pad_set_active (mysinkpad, TRUE);
- gst_pad_set_active (mysrcpad, TRUE);
-
- gst_caps_unref (caps);
-
- return audioresample;
-}
-
-static void
-cleanup_audioresample (GstElement * audioresample)
-{
- GST_DEBUG ("cleanup_audioresample");
-
- fail_unless (gst_element_set_state (audioresample,
- GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to NULL");
-
- gst_pad_set_active (mysrcpad, FALSE);
- gst_pad_set_active (mysinkpad, FALSE);
- gst_check_teardown_src_pad (audioresample);
- gst_check_teardown_sink_pad (audioresample);
- gst_check_teardown_element (audioresample);
- gst_check_drop_buffers ();
-}
-
-static void
-fail_unless_perfect_stream (void)
-{
- guint64 timestamp = 0L, duration = 0L;
- guint64 offset = 0L, offset_end = 0L;
-
- GList *l;
- GstBuffer *buffer;
-
- for (l = buffers; l; l = l->next) {
- buffer = GST_BUFFER (l->data);
- ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1);
- GST_DEBUG ("buffer timestamp %" G_GUINT64_FORMAT ", duration %"
- G_GUINT64_FORMAT " offset %" G_GUINT64_FORMAT " offset_end %"
- G_GUINT64_FORMAT,
- GST_BUFFER_TIMESTAMP (buffer),
- GST_BUFFER_DURATION (buffer),
- GST_BUFFER_OFFSET (buffer), GST_BUFFER_OFFSET_END (buffer));
-
- fail_unless_equals_uint64 (timestamp, GST_BUFFER_TIMESTAMP (buffer));
- fail_unless_equals_uint64 (offset, GST_BUFFER_OFFSET (buffer));
- duration = GST_BUFFER_DURATION (buffer);
- offset_end = GST_BUFFER_OFFSET_END (buffer);
-
- timestamp += duration;
- offset = offset_end;
- gst_buffer_unref (buffer);
- }
- g_list_free (buffers);
- buffers = NULL;
-}
-
-/* this tests that the output is a perfect stream if the input is */
-static void
-test_perfect_stream_instance (int inrate, int outrate, int samples,
- int numbuffers)
-{
- GstElement *audioresample;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- guint64 offset = 0;
-
- int i, j;
- gint16 *p;
-
- audioresample = setup_audioresample (2, inrate, outrate, 16, FALSE);
- caps = gst_pad_get_negotiated_caps (mysrcpad);
- fail_unless (gst_caps_is_fixed (caps));
-
- fail_unless (gst_element_set_state (audioresample,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- for (j = 1; j <= numbuffers; ++j) {
-
- inbuffer = gst_buffer_new_and_alloc (samples * 4);
- GST_BUFFER_DURATION (inbuffer) = GST_FRAMES_TO_CLOCK_TIME (samples, inrate);
- GST_BUFFER_TIMESTAMP (inbuffer) = GST_BUFFER_DURATION (inbuffer) * (j - 1);
- GST_BUFFER_OFFSET (inbuffer) = offset;
- offset += samples;
- GST_BUFFER_OFFSET_END (inbuffer) = offset;
-
- gst_buffer_set_caps (inbuffer, caps);
-
- p = (gint16 *) GST_BUFFER_DATA (inbuffer);
-
- /* create a 16 bit signed ramp */
- for (i = 0; i < samples; ++i) {
- *p = -32767 + i * (65535 / samples);
- ++p;
- *p = -32767 + i * (65535 / samples);
- ++p;
- }
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being collected on the global buffer list */
- fail_unless_equals_int (g_list_length (buffers), j);
- }
-
- /* FIXME: we should make audioresample handle eos by flushing out the last
- * samples, which will give us one more, small, buffer */
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
-
- fail_unless_perfect_stream ();
-
- /* cleanup */
- gst_caps_unref (caps);
- cleanup_audioresample (audioresample);
-}
-
-
-/* make sure that outgoing buffers are contiguous in timestamp/duration and
- * offset/offsetend
- */
-GST_START_TEST (test_perfect_stream)
-{
- /* integral scalings */
- test_perfect_stream_instance (48000, 24000, 500, 20);
- test_perfect_stream_instance (48000, 12000, 500, 20);
- test_perfect_stream_instance (12000, 24000, 500, 20);
- test_perfect_stream_instance (12000, 48000, 500, 20);
-
- /* non-integral scalings */
- test_perfect_stream_instance (44100, 8000, 500, 20);
- test_perfect_stream_instance (8000, 44100, 500, 20);
-
- /* wacky scalings */
- test_perfect_stream_instance (12345, 54321, 500, 20);
- test_perfect_stream_instance (101, 99, 500, 20);
-}
-
-GST_END_TEST;
-
-/* this tests that the output is a correct discontinuous stream
- * if the input is; ie input drops in time come out the same way */
-static void
-test_discont_stream_instance (int inrate, int outrate, int samples,
- int numbuffers)
-{
- GstElement *audioresample;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- GstClockTime ints;
-
- int i, j;
- gint16 *p;
-
- GST_DEBUG ("inrate:%d outrate:%d samples:%d numbuffers:%d",
- inrate, outrate, samples, numbuffers);
-
- audioresample = setup_audioresample (2, inrate, outrate, 16, FALSE);
- caps = gst_pad_get_negotiated_caps (mysrcpad);
- fail_unless (gst_caps_is_fixed (caps));
-
- fail_unless (gst_element_set_state (audioresample,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- for (j = 1; j <= numbuffers; ++j) {
-
- inbuffer = gst_buffer_new_and_alloc (samples * 4);
- GST_BUFFER_DURATION (inbuffer) = samples * GST_SECOND / inrate;
- /* "drop" half the buffers */
- ints = GST_BUFFER_DURATION (inbuffer) * 2 * (j - 1);
- GST_BUFFER_TIMESTAMP (inbuffer) = ints;
- GST_BUFFER_OFFSET (inbuffer) = (j - 1) * 2 * samples;
- GST_BUFFER_OFFSET_END (inbuffer) = j * 2 * samples + samples;
-
- gst_buffer_set_caps (inbuffer, caps);
-
- p = (gint16 *) GST_BUFFER_DATA (inbuffer);
-
- /* create a 16 bit signed ramp */
- for (i = 0; i < samples; ++i) {
- *p = -32767 + i * (65535 / samples);
- ++p;
- *p = -32767 + i * (65535 / samples);
- ++p;
- }
-
- GST_DEBUG ("Sending Buffer time:%" G_GUINT64_FORMAT " duration:%"
- G_GINT64_FORMAT " discont:%d offset:%" G_GUINT64_FORMAT " offset_end:%"
- G_GUINT64_FORMAT, GST_BUFFER_TIMESTAMP (inbuffer),
- GST_BUFFER_DURATION (inbuffer), GST_BUFFER_IS_DISCONT (inbuffer),
- GST_BUFFER_OFFSET (inbuffer), GST_BUFFER_OFFSET_END (inbuffer));
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
-
- /* check if the timestamp of the pushed buffer matches the incoming one */
- outbuffer = g_list_nth_data (buffers, g_list_length (buffers) - 1);
- fail_if (outbuffer == NULL);
- fail_unless_equals_uint64 (ints, GST_BUFFER_TIMESTAMP (outbuffer));
- GST_DEBUG ("Got Buffer time:%" G_GUINT64_FORMAT " duration:%"
- G_GINT64_FORMAT " discont:%d offset:%" G_GUINT64_FORMAT " offset_end:%"
- G_GUINT64_FORMAT, GST_BUFFER_TIMESTAMP (outbuffer),
- GST_BUFFER_DURATION (outbuffer), GST_BUFFER_IS_DISCONT (outbuffer),
- GST_BUFFER_OFFSET (outbuffer), GST_BUFFER_OFFSET_END (outbuffer));
- if (j > 1) {
- fail_unless (GST_BUFFER_IS_DISCONT (outbuffer),
- "expected discont for buffer #%d", j);
- }
- }
-
- /* cleanup */
- gst_caps_unref (caps);
- cleanup_audioresample (audioresample);
-}
-
-GST_START_TEST (test_discont_stream)
-{
- /* integral scalings */
- test_discont_stream_instance (48000, 24000, 500, 20);
- test_discont_stream_instance (48000, 12000, 500, 20);
- test_discont_stream_instance (12000, 24000, 500, 20);
- test_discont_stream_instance (12000, 48000, 500, 20);
-
- /* non-integral scalings */
- test_discont_stream_instance (44100, 8000, 500, 20);
- test_discont_stream_instance (8000, 44100, 500, 20);
-
- /* wacky scalings */
- test_discont_stream_instance (12345, 54321, 500, 20);
- test_discont_stream_instance (101, 99, 500, 20);
-}
-
-GST_END_TEST;
-
-
-
-GST_START_TEST (test_reuse)
-{
- GstElement *audioresample;
- GstEvent *newseg;
- GstBuffer *inbuffer;
- GstCaps *caps;
-
- audioresample = setup_audioresample (1, 9343, 48000, 16, FALSE);
- caps = gst_pad_get_negotiated_caps (mysrcpad);
- fail_unless (gst_caps_is_fixed (caps));
-
- fail_unless (gst_element_set_state (audioresample,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- newseg = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0);
- fail_unless (gst_pad_push_event (mysrcpad, newseg) != FALSE);
-
- inbuffer = gst_buffer_new_and_alloc (9343 * 4);
- memset (GST_BUFFER_DATA (inbuffer), 0, GST_BUFFER_SIZE (inbuffer));
- GST_BUFFER_DURATION (inbuffer) = GST_SECOND;
- GST_BUFFER_TIMESTAMP (inbuffer) = 0;
- GST_BUFFER_OFFSET (inbuffer) = 0;
- gst_buffer_set_caps (inbuffer, caps);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
-
- /* ... but it ends up being collected on the global buffer list */
- fail_unless_equals_int (g_list_length (buffers), 1);
-
- /* now reset and try again ... */
- fail_unless (gst_element_set_state (audioresample,
- GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to NULL");
-
- fail_unless (gst_element_set_state (audioresample,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- newseg = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0);
- fail_unless (gst_pad_push_event (mysrcpad, newseg) != FALSE);
-
- inbuffer = gst_buffer_new_and_alloc (9343 * 4);
- memset (GST_BUFFER_DATA (inbuffer), 0, GST_BUFFER_SIZE (inbuffer));
- GST_BUFFER_DURATION (inbuffer) = GST_SECOND;
- GST_BUFFER_TIMESTAMP (inbuffer) = 0;
- GST_BUFFER_OFFSET (inbuffer) = 0;
- gst_buffer_set_caps (inbuffer, caps);
-
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
-
- /* ... it also ends up being collected on the global buffer list. If we
- * now have more than 2 buffers, then audioresample probably didn't clean
- * up its internal buffer properly and tried to push the remaining samples
- * when it got the second NEWSEGMENT event */
- fail_unless_equals_int (g_list_length (buffers), 2);
-
- cleanup_audioresample (audioresample);
- gst_caps_unref (caps);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_shutdown)
-{
- GstElement *pipeline, *src, *cf1, *ar, *cf2, *sink;
- GstCaps *caps;
- guint i;
-
- /* create pipeline, force audioresample to actually resample */
- pipeline = gst_pipeline_new (NULL);
-
- src = gst_check_setup_element ("audiotestsrc");
- cf1 = gst_check_setup_element ("capsfilter");
- ar = gst_check_setup_element ("audioresample");
- cf2 = gst_check_setup_element ("capsfilter");
- g_object_set (cf2, "name", "capsfilter2", NULL);
- sink = gst_check_setup_element ("fakesink");
-
- caps =
- gst_caps_new_simple ("audio/x-raw-int", "rate", G_TYPE_INT, 11025, NULL);
- g_object_set (cf1, "caps", caps, NULL);
- gst_caps_unref (caps);
-
- caps =
- gst_caps_new_simple ("audio/x-raw-int", "rate", G_TYPE_INT, 48000, NULL);
- g_object_set (cf2, "caps", caps, NULL);
- gst_caps_unref (caps);
-
- /* don't want to sync against the clock, the more throughput the better */
- g_object_set (src, "is-live", FALSE, NULL);
- g_object_set (sink, "sync", FALSE, NULL);
-
- gst_bin_add_many (GST_BIN (pipeline), src, cf1, ar, cf2, sink, NULL);
- fail_if (!gst_element_link_many (src, cf1, ar, cf2, sink, NULL));
-
- /* now, wait until pipeline is running and then shut it down again; repeat */
- for (i = 0; i < 20; ++i) {
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- gst_element_get_state (pipeline, NULL, NULL, -1);
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_usleep (100);
- gst_element_set_state (pipeline, GST_STATE_NULL);
- }
-
- gst_object_unref (pipeline);
-}
-
-GST_END_TEST;
-
-static GstFlowReturn
-live_switch_alloc_only_48000 (GstPad * pad, guint64 offset,
- guint size, GstCaps * caps, GstBuffer ** buf)
-{
- GstStructure *structure;
- gint rate;
- gint channels;
- GstCaps *desired;
-
- structure = gst_caps_get_structure (caps, 0);
- fail_unless (gst_structure_get_int (structure, "rate", &rate));
- fail_unless (gst_structure_get_int (structure, "channels", &channels));
-
- if (rate < 48000)
- return GST_FLOW_NOT_NEGOTIATED;
-
- desired = gst_caps_copy (caps);
- gst_caps_set_simple (desired, "rate", G_TYPE_INT, 48000, NULL);
-
- *buf = gst_buffer_new_and_alloc (channels * 48000);
- gst_buffer_set_caps (*buf, desired);
- gst_caps_unref (desired);
-
- return GST_FLOW_OK;
-}
-
-static GstCaps *
-live_switch_get_sink_caps (GstPad * pad)
-{
- GstCaps *result;
-
- result = gst_caps_copy (GST_PAD_CAPS (pad));
-
- gst_caps_set_simple (result,
- "rate", GST_TYPE_INT_RANGE, 48000, G_MAXINT, NULL);
-
- return result;
-}
-
-static void
-live_switch_push (int rate, GstCaps * caps)
-{
- GstBuffer *inbuffer;
- GstCaps *desired;
- GList *l;
-
- desired = gst_caps_copy (caps);
- gst_caps_set_simple (desired, "rate", G_TYPE_INT, rate, NULL);
- gst_pad_set_caps (mysrcpad, desired);
-
- fail_unless (gst_pad_alloc_buffer_and_set_caps (mysrcpad,
- GST_BUFFER_OFFSET_NONE, rate * 4, desired, &inbuffer) == GST_FLOW_OK);
-
- /* When the basetransform hits the non-configured case it always
- * returns a buffer with exactly the same caps as we requested so the actual
- * renegotiation (if needed) will be done in the _chain*/
- fail_unless (inbuffer != NULL);
- GST_DEBUG ("desired: %" GST_PTR_FORMAT ".... got: %" GST_PTR_FORMAT,
- desired, GST_BUFFER_CAPS (inbuffer));
- fail_unless (gst_caps_is_equal (desired, GST_BUFFER_CAPS (inbuffer)));
-
- memset (GST_BUFFER_DATA (inbuffer), 0, GST_BUFFER_SIZE (inbuffer));
- GST_BUFFER_DURATION (inbuffer) = GST_SECOND;
- GST_BUFFER_TIMESTAMP (inbuffer) = 0;
- GST_BUFFER_OFFSET (inbuffer) = 0;
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
-
- /* ... but it ends up being collected on the global buffer list */
- fail_unless_equals_int (g_list_length (buffers), 1);
-
- for (l = buffers; l; l = l->next) {
- GstBuffer *buffer = GST_BUFFER (l->data);
-
- gst_buffer_unref (buffer);
- }
-
- g_list_free (buffers);
- buffers = NULL;
-
- gst_caps_unref (desired);
-}
-
-GST_START_TEST (test_live_switch)
-{
- GstElement *audioresample;
- GstEvent *newseg;
- GstCaps *caps;
-
- audioresample = setup_audioresample (4, 48000, 48000, 16, FALSE);
-
- /* Let the sinkpad act like something that can only handle things of
- * rate 48000- and can only allocate buffers for that rate, but if someone
- * tries to get a buffer with a rate higher then 48000 tries to renegotiate
- * */
- gst_pad_set_bufferalloc_function (mysinkpad, live_switch_alloc_only_48000);
- gst_pad_set_getcaps_function (mysinkpad, live_switch_get_sink_caps);
-
- gst_pad_use_fixed_caps (mysrcpad);
-
- caps = gst_pad_get_negotiated_caps (mysrcpad);
- fail_unless (gst_caps_is_fixed (caps));
-
- fail_unless (gst_element_set_state (audioresample,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- newseg = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0);
- fail_unless (gst_pad_push_event (mysrcpad, newseg) != FALSE);
-
- /* downstream can provide the requested rate, a buffer alloc will be passed
- * on */
- live_switch_push (48000, caps);
-
- /* Downstream can never accept this rate, buffer alloc isn't passed on */
- live_switch_push (40000, caps);
-
- /* Downstream can provide the requested rate but will re-negotiate */
- live_switch_push (50000, caps);
-
- cleanup_audioresample (audioresample);
- gst_caps_unref (caps);
-}
-
-GST_END_TEST;
-
-#ifndef GST_DISABLE_PARSE
-
-static GMainLoop *loop;
-static gint messages = 0;
-
-static void
-element_message_cb (GstBus * bus, GstMessage * message, gpointer user_data)
-{
- gchar *s;
-
- s = gst_structure_to_string (gst_message_get_structure (message));
- GST_DEBUG ("Received message: %s", s);
- g_free (s);
-
- messages++;
-}
-
-static void
-eos_message_cb (GstBus * bus, GstMessage * message, gpointer user_data)
-{
- GST_DEBUG ("Received eos");
- g_main_loop_quit (loop);
-}
-
-static void
-test_pipeline (gint width, gboolean fp, gint inrate, gint outrate, gint quality)
-{
- GstElement *pipeline;
- GstBus *bus;
- GError *error = NULL;
- gchar *pipe_str;
-
- pipe_str =
- g_strdup_printf
- ("audiotestsrc num-buffers=10 ! audioconvert ! audio/x-raw-%s,rate=%d,width=%d,channels=2 ! audioresample quality=%d ! audio/x-raw-%s,rate=%d,width=%d ! identity check-imperfect-timestamp=TRUE ! fakesink",
- (fp) ? "float" : "int", inrate, width, quality, (fp) ? "float" : "int",
- outrate, width);
-
- pipeline = gst_parse_launch (pipe_str, &error);
- fail_unless (pipeline != NULL, "Error parsing pipeline: %s",
- error ? error->message : "(invalid error)");
- g_free (pipe_str);
-
- bus = gst_element_get_bus (pipeline);
- fail_if (bus == NULL);
- gst_bus_add_signal_watch (bus);
- g_signal_connect (bus, "message::element", (GCallback) element_message_cb,
- NULL);
- g_signal_connect (bus, "message::eos", (GCallback) eos_message_cb, NULL);
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- /* run until we receive EOS */
- loop = g_main_loop_new (NULL, FALSE);
-
- g_main_loop_run (loop);
-
- g_main_loop_unref (loop);
- loop = NULL;
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- fail_if (messages > 0, "Received imperfect timestamp messages");
- gst_object_unref (pipeline);
-}
-
-GST_START_TEST (test_pipelines)
-{
- gint quality;
-
- /* Test qualities 0, 5 and 10 */
- for (quality = 0; quality < 11; quality += 5) {
- GST_DEBUG ("Checking with quality %d", quality);
-
- test_pipeline (8, FALSE, 44100, 48000, quality);
- test_pipeline (8, FALSE, 48000, 44100, quality);
-
- test_pipeline (16, FALSE, 44100, 48000, quality);
- test_pipeline (16, FALSE, 48000, 44100, quality);
-
- test_pipeline (24, FALSE, 44100, 48000, quality);
- test_pipeline (24, FALSE, 48000, 44100, quality);
-
- test_pipeline (32, FALSE, 44100, 48000, quality);
- test_pipeline (32, FALSE, 48000, 44100, quality);
-
- test_pipeline (32, TRUE, 44100, 48000, quality);
- test_pipeline (32, TRUE, 48000, 44100, quality);
-
- test_pipeline (64, TRUE, 44100, 48000, quality);
- test_pipeline (64, TRUE, 48000, 44100, quality);
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_preference_passthrough)
-{
- GstStateChangeReturn ret;
- GstElement *pipeline, *src;
- GstStructure *s;
- GstMessage *msg;
- GstCaps *caps;
- GstPad *pad;
- GstBus *bus;
- GError *error = NULL;
- gint rate = 0;
-
- pipeline = gst_parse_launch ("audiotestsrc num-buffers=1 name=src ! "
- "audioresample ! audio/x-raw-int,channels=1,width=16,depth=16,"
- "endianness=BYTE_ORDER,signed=true,rate=8000 ! "
- "fakesink can-activate-pull=false", &error);
- fail_unless (pipeline != NULL, "Error parsing pipeline: %s",
- error ? error->message : "(invalid error)");
-
- ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- fail_unless_equals_int (ret, GST_STATE_CHANGE_ASYNC);
-
- /* run until we receive EOS */
- bus = gst_element_get_bus (pipeline);
- fail_if (bus == NULL);
- msg = gst_bus_timed_pop_filtered (bus, -1, GST_MESSAGE_EOS);
- gst_message_unref (msg);
- gst_object_unref (bus);
-
- src = gst_bin_get_by_name (GST_BIN (pipeline), "src");
- fail_unless (src != NULL);
- pad = gst_element_get_static_pad (src, "src");
- fail_unless (pad != NULL);
- caps = gst_pad_get_negotiated_caps (pad);
- GST_LOG ("negotiated audiotestsrc caps: %" GST_PTR_FORMAT, caps);
- fail_unless (caps != NULL);
- s = gst_caps_get_structure (caps, 0);
- fail_unless (gst_structure_get_int (s, "rate", &rate));
- /* there's no need to resample, audiotestsrc supports any rate, so make
- * sure audioresample provided upstream with the right caps to negotiate
- * this correctly */
- fail_unless_equals_int (rate, 8000);
- gst_caps_unref (caps);
- gst_object_unref (pad);
- gst_object_unref (src);
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-}
-
-GST_END_TEST;
-
-#endif
-
-static void
-_message_cb (GstBus * bus, GstMessage * message, gpointer user_data)
-{
- GMainLoop *loop = user_data;
-
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_ERROR:
- case GST_MESSAGE_WARNING:
- g_assert_not_reached ();
- break;
- case GST_MESSAGE_EOS:
- g_main_loop_quit (loop);
- break;
- default:
- break;
- }
-}
-
-typedef struct
-{
- guint64 latency;
- GstClockTime in_ts;
-
- GstClockTime next_out_ts;
- guint64 next_out_off;
-
- guint64 in_buffer_count, out_buffer_count;
-} TimestampDriftCtx;
-
-void
-fakesink_handoff_cb (GstElement * object, GstBuffer * buffer, GstPad * pad,
- gpointer user_data)
-{
- TimestampDriftCtx *ctx = user_data;
-
- ctx->out_buffer_count++;
- if (ctx->latency == GST_CLOCK_TIME_NONE) {
- ctx->latency = 1000 - GST_BUFFER_SIZE (buffer) / 8;
- }
-
- /* Check if we have a perfectly timestampped stream */
- if (ctx->next_out_ts != GST_CLOCK_TIME_NONE)
- fail_unless (ctx->next_out_ts == GST_BUFFER_TIMESTAMP (buffer),
- "expected timestamp %" GST_TIME_FORMAT " got timestamp %"
- GST_TIME_FORMAT, GST_TIME_ARGS (ctx->next_out_ts),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
-
- /* Check if we have a perfectly offsetted stream */
- fail_unless (GST_BUFFER_OFFSET_END (buffer) ==
- GST_BUFFER_OFFSET (buffer) + GST_BUFFER_SIZE (buffer) / 8,
- "expected offset end %" G_GUINT64_FORMAT " got offset end %"
- G_GUINT64_FORMAT,
- GST_BUFFER_OFFSET (buffer) + GST_BUFFER_SIZE (buffer) / 8,
- GST_BUFFER_OFFSET_END (buffer));
- if (ctx->next_out_off != GST_BUFFER_OFFSET_NONE) {
- fail_unless (GST_BUFFER_OFFSET (buffer) == ctx->next_out_off,
- "expected offset %" G_GUINT64_FORMAT " got offset %" G_GUINT64_FORMAT,
- ctx->next_out_off, GST_BUFFER_OFFSET (buffer));
- }
-
- if (ctx->in_buffer_count != ctx->out_buffer_count) {
- GST_INFO ("timestamp %" GST_TIME_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
- }
-
- if (ctx->in_ts != GST_CLOCK_TIME_NONE && ctx->in_buffer_count > 1
- && ctx->in_buffer_count == ctx->out_buffer_count) {
- fail_unless (GST_BUFFER_TIMESTAMP (buffer) ==
- ctx->in_ts - gst_util_uint64_scale_round (ctx->latency, GST_SECOND,
- 4096),
- "expected output timestamp %" GST_TIME_FORMAT " (%" G_GUINT64_FORMAT
- ") got output timestamp %" GST_TIME_FORMAT " (%" G_GUINT64_FORMAT ")",
- GST_TIME_ARGS (ctx->in_ts - gst_util_uint64_scale_round (ctx->latency,
- GST_SECOND, 4096)),
- ctx->in_ts - gst_util_uint64_scale_round (ctx->latency, GST_SECOND,
- 4096), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)),
- GST_BUFFER_TIMESTAMP (buffer));
- }
-
- ctx->next_out_ts =
- GST_BUFFER_TIMESTAMP (buffer) + GST_BUFFER_DURATION (buffer);
- ctx->next_out_off = GST_BUFFER_OFFSET_END (buffer);
-}
-
-void
-identity_handoff_cb (GstElement * object, GstBuffer * buffer,
- gpointer user_data)
-{
- TimestampDriftCtx *ctx = user_data;
-
- ctx->in_ts = GST_BUFFER_TIMESTAMP (buffer);
- ctx->in_buffer_count++;
-}
-
-GST_START_TEST (test_timestamp_drift)
-{
- TimestampDriftCtx ctx =
- { GST_CLOCK_TIME_NONE, GST_CLOCK_TIME_NONE, GST_CLOCK_TIME_NONE,
- GST_BUFFER_OFFSET_NONE, 0, 0
- };
- GstElement *pipeline;
- GstElement *audiotestsrc, *capsfilter1, *identity, *audioresample,
- *capsfilter2, *fakesink;
- GstBus *bus;
- GMainLoop *loop;
- GstCaps *caps;
-
- pipeline = gst_pipeline_new ("pipeline");
- fail_unless (pipeline != NULL);
-
- audiotestsrc = gst_element_factory_make ("audiotestsrc", "src");
- fail_unless (audiotestsrc != NULL);
- g_object_set (G_OBJECT (audiotestsrc), "num-buffers", 10000,
- "samplesperbuffer", 4000, NULL);
-
- capsfilter1 = gst_element_factory_make ("capsfilter", "capsfilter1");
- fail_unless (capsfilter1 != NULL);
- caps =
- gst_caps_from_string
- ("audio/x-raw-float, channels=1, width=64, rate=16384");
- g_object_set (G_OBJECT (capsfilter1), "caps", caps, NULL);
- gst_caps_unref (caps);
-
- identity = gst_element_factory_make ("identity", "identity");
- fail_unless (identity != NULL);
- g_object_set (G_OBJECT (identity), "sync", FALSE, "signal-handoffs", TRUE,
- NULL);
- g_signal_connect (identity, "handoff", (GCallback) identity_handoff_cb, &ctx);
-
- audioresample = gst_element_factory_make ("audioresample", "resample");
- fail_unless (audioresample != NULL);
- capsfilter2 = gst_element_factory_make ("capsfilter", "capsfilter2");
- fail_unless (capsfilter2 != NULL);
- caps =
- gst_caps_from_string
- ("audio/x-raw-float, channels=1, width=64, rate=4096");
- g_object_set (G_OBJECT (capsfilter2), "caps", caps, NULL);
- gst_caps_unref (caps);
-
- fakesink = gst_element_factory_make ("fakesink", "sink");
- fail_unless (fakesink != NULL);
- g_object_set (G_OBJECT (fakesink), "sync", FALSE, "async", FALSE,
- "signal-handoffs", TRUE, NULL);
- g_signal_connect (fakesink, "handoff", (GCallback) fakesink_handoff_cb, &ctx);
-
-
- gst_bin_add_many (GST_BIN (pipeline), audiotestsrc, capsfilter1, identity,
- audioresample, capsfilter2, fakesink, NULL);
- fail_unless (gst_element_link_many (audiotestsrc, capsfilter1, identity,
- audioresample, capsfilter2, fakesink, NULL));
-
- loop = g_main_loop_new (NULL, FALSE);
-
- bus = gst_element_get_bus (pipeline);
- gst_bus_add_signal_watch (bus);
- g_signal_connect (bus, "message", (GCallback) _message_cb, loop);
-
- fail_unless (gst_element_set_state (pipeline,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS);
- g_main_loop_run (loop);
-
- fail_unless (gst_element_set_state (pipeline,
- GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS);
- g_main_loop_unref (loop);
- gst_object_unref (pipeline);
-
-} GST_END_TEST;
-
-static Suite *
-audioresample_suite (void)
-{
- Suite *s = suite_create ("audioresample");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_perfect_stream);
- tcase_add_test (tc_chain, test_discont_stream);
- tcase_add_test (tc_chain, test_reuse);
- tcase_add_test (tc_chain, test_shutdown);
- tcase_add_test (tc_chain, test_live_switch);
- tcase_add_test (tc_chain, test_timestamp_drift);
-
-#ifndef GST_DISABLE_PARSE
- tcase_set_timeout (tc_chain, 360);
- tcase_add_test (tc_chain, test_pipelines);
- tcase_add_test (tc_chain, test_preference_passthrough);
-#endif
-
- return s;
-}
-
-GST_CHECK_MAIN (audioresample);
diff --git a/tests/check/elements/audiotestsrc.c b/tests/check/elements/audiotestsrc.c
deleted file mode 100644
index cd2dec64..00000000
--- a/tests/check/elements/audiotestsrc.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/* GStreamer
- *
- * unit test for audiotestsrc
- *
- * Copyright (C) <2005> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-
-/* For ease of programming we use globals to keep refs for our floating
- * src and sink pads we create; otherwise we always have to do get_pad,
- * get_peer, and then remove references in every test function */
-static GstPad *mysinkpad;
-
-
-#define CAPS_TEMPLATE_STRING \
- "audio/x-raw-int, " \
- "channels = (int) 1, " \
- "rate = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 16, " \
- "depth = (int) 16, " \
- "signed = (bool) TRUE"
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (CAPS_TEMPLATE_STRING)
- );
-
-static GstElement *
-setup_audiotestsrc (void)
-{
- GstElement *audiotestsrc;
-
- GST_DEBUG ("setup_audiotestsrc");
- audiotestsrc = gst_check_setup_element ("audiotestsrc");
- mysinkpad = gst_check_setup_sink_pad (audiotestsrc, &sinktemplate, NULL);
- gst_pad_set_active (mysinkpad, TRUE);
-
- return audiotestsrc;
-}
-
-static void
-cleanup_audiotestsrc (GstElement * audiotestsrc)
-{
- GST_DEBUG ("cleanup_audiotestsrc");
-
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
-
- gst_pad_set_active (mysinkpad, FALSE);
- gst_check_teardown_sink_pad (audiotestsrc);
- gst_check_teardown_element (audiotestsrc);
-}
-
-GST_START_TEST (test_all_waves)
-{
- GstElement *audiotestsrc;
- GObjectClass *oclass;
- GParamSpec *property;
- GEnumValue *values;
- guint j = 0;
-
- audiotestsrc = setup_audiotestsrc ();
- oclass = G_OBJECT_GET_CLASS (audiotestsrc);
- property = g_object_class_find_property (oclass, "wave");
- fail_unless (G_IS_PARAM_SPEC_ENUM (property));
- values = G_ENUM_CLASS (g_type_class_ref (property->value_type))->values;
-
-
- while (values[j].value_name) {
- GST_DEBUG_OBJECT (audiotestsrc, "testing wave %s", values[j].value_name);
-
- fail_unless (gst_element_set_state (audiotestsrc,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_mutex_lock (check_mutex);
- while (g_list_length (buffers) < 10)
- g_cond_wait (check_cond, check_mutex);
- g_mutex_unlock (check_mutex);
-
- gst_element_set_state (audiotestsrc, GST_STATE_READY);
-
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
- ++j;
- }
-
- /* cleanup */
- cleanup_audiotestsrc (audiotestsrc);
-}
-
-GST_END_TEST;
-
-static Suite *
-audiotestsrc_suite (void)
-{
- Suite *s = suite_create ("audiotestsrc");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_all_waves);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = audiotestsrc_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/elements/decodebin.c b/tests/check/elements/decodebin.c
deleted file mode 100644
index eb6f38a4..00000000
--- a/tests/check/elements/decodebin.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/* GStreamer unit tests for decodebin
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gst/check/gstcheck.h>
-#include <unistd.h>
-
-static const gchar dummytext[] =
- "Quick Brown Fox Jumps over a Lazy Frog Quick Brown "
- "Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick "
- "Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog "
- "Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy "
- "Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a "
- "Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps "
- "over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox "
- "jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown "
- "Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick "
- "Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog "
- "Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy "
- "Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a "
- "Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps "
- "over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox ";
-
-static void
-src_handoff_cb (GstElement * src, GstBuffer * buf, GstPad * pad, gpointer data)
-{
- GST_BUFFER_DATA (buf) = (guint8 *) dummytext;
- GST_BUFFER_SIZE (buf) = sizeof (dummytext);
- GST_BUFFER_OFFSET (buf) = 0;
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_READONLY);
-}
-
-static void
-decodebin_new_decoded_pad_cb (GstElement * decodebin, GstPad * pad,
- gboolean last, gboolean * p_flag)
-{
- /* we should not be reached */
- fail_unless (decodebin == NULL, "new-decoded-pad should not be emitted");
-}
-
-/* make sure that decodebin errors out instead of creating a new decoded pad
- * if the entire stream is a plain text file */
-GST_START_TEST (test_text_plain_streams)
-{
- GstElement *pipe, *src, *decodebin;
- GstMessage *msg;
-
- pipe = gst_pipeline_new (NULL);
- fail_unless (pipe != NULL, "failed to create pipeline");
-
- src = gst_element_factory_make ("fakesrc", "src");
- fail_unless (src != NULL, "Failed to create fakesrc element");
-
- g_object_set (src, "signal-handoffs", TRUE, NULL);
- g_object_set (src, "num-buffers", 1, NULL);
- g_object_set (src, "can-activate-pull", FALSE, NULL);
- g_signal_connect (src, "handoff", G_CALLBACK (src_handoff_cb), NULL);
-
- decodebin = gst_element_factory_make ("decodebin", "decodebin");
- fail_unless (decodebin != NULL, "Failed to create decodebin element");
-
- g_signal_connect (decodebin, "new-decoded-pad",
- G_CALLBACK (decodebin_new_decoded_pad_cb), NULL);
-
- fail_unless (gst_bin_add (GST_BIN (pipe), src));
- fail_unless (gst_bin_add (GST_BIN (pipe), decodebin));
- fail_unless (gst_element_link (src, decodebin), "can't link src<->decodebin");
-
- fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- /* it's push-based, so should be async */
- fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_PAUSED),
- GST_STATE_CHANGE_ASYNC);
-
- /* it should error out at some point */
- msg = gst_bus_poll (GST_ELEMENT_BUS (pipe), GST_MESSAGE_ERROR, -1);
- fail_unless (msg != NULL);
- fail_unless (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR);
- gst_message_unref (msg);
-
- gst_element_set_state (pipe, GST_STATE_NULL);
- gst_object_unref (pipe);
-}
-
-GST_END_TEST;
-
-static void
-new_decoded_pad_plug_fakesink_cb (GstElement * decodebin, GstPad * srcpad,
- gboolean last, GstElement * pipeline)
-{
- GstElement *sink;
- GstPad *sinkpad;
-
- sink = gst_element_factory_make ("fakesink", "sink");
- fail_unless (sink != NULL, "Failed to create fakesink element");
-
- gst_bin_add (GST_BIN (pipeline), sink);
-
- sinkpad = gst_element_get_static_pad (sink, "sink");
- fail_unless_equals_int (gst_pad_link (srcpad, sinkpad), GST_PAD_LINK_OK);
- gst_object_unref (sinkpad);
-
- gst_element_set_state (sink, GST_STATE_PLAYING);
-}
-
-GST_START_TEST (test_reuse_without_decoders)
-{
- GstElement *pipe, *src, *decodebin, *sink;
-
- pipe = gst_pipeline_new (NULL);
- fail_unless (pipe != NULL, "failed to create pipeline");
-
- src = gst_element_factory_make ("audiotestsrc", "src");
- fail_unless (src != NULL, "Failed to create audiotestsrc element");
-
- decodebin = gst_element_factory_make ("decodebin", "decodebin");
- fail_unless (decodebin != NULL, "Failed to create decodebin element");
-
- g_signal_connect (decodebin, "new-decoded-pad",
- G_CALLBACK (new_decoded_pad_plug_fakesink_cb), pipe);
-
- fail_unless (gst_bin_add (GST_BIN (pipe), src));
- fail_unless (gst_bin_add (GST_BIN (pipe), decodebin));
- fail_unless (gst_element_link (src, decodebin), "can't link src<->decodebin");
-
- fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- /* it's push-based, so should be async */
- fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_PAUSED),
- GST_STATE_CHANGE_ASYNC);
-
- /* wait for state change to complete */
- fail_unless_equals_int (gst_element_get_state (pipe, NULL, NULL, -1),
- GST_STATE_CHANGE_SUCCESS);
-
- /* there shouldn't be any errors */
- fail_if (gst_bus_poll (GST_ELEMENT_BUS (pipe), GST_MESSAGE_ERROR, 0) != NULL);
-
- /* reset */
- gst_element_set_state (pipe, GST_STATE_NULL);
-
- sink = gst_bin_get_by_name (GST_BIN (pipe), "sink");
- gst_bin_remove (GST_BIN (pipe), sink);
- gst_object_unref (sink);
-
- GST_LOG ("second try");
-
- fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- /* it's push-based, so should be async */
- fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_PAUSED),
- GST_STATE_CHANGE_ASYNC);
-
- /* wait for state change to complete */
- fail_unless_equals_int (gst_element_get_state (pipe, NULL, NULL, -1),
- GST_STATE_CHANGE_SUCCESS);
-
- /* there shouldn't be any errors */
- fail_if (gst_bus_poll (GST_ELEMENT_BUS (pipe), GST_MESSAGE_ERROR, 0) != NULL);
-
- gst_element_set_state (pipe, GST_STATE_NULL);
- gst_object_unref (pipe);
-}
-
-GST_END_TEST;
-
-static Suite *
-decodebin_suite (void)
-{
- Suite *s = suite_create ("decodebin");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_text_plain_streams);
- tcase_add_test (tc_chain, test_reuse_without_decoders);
-
- return s;
-}
-
-GST_CHECK_MAIN (decodebin);
diff --git a/tests/check/elements/decodebin2.c b/tests/check/elements/decodebin2.c
deleted file mode 100644
index 84cf4054..00000000
--- a/tests/check/elements/decodebin2.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/* GStreamer unit tests for decodebin2
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gst/check/gstcheck.h>
-#include <unistd.h>
-
-static const gchar dummytext[] =
- "Quick Brown Fox Jumps over a Lazy Frog Quick Brown "
- "Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick "
- "Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog "
- "Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy "
- "Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a "
- "Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps "
- "over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox "
- "jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown "
- "Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick "
- "Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog "
- "Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a Lazy "
- "Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps over a "
- "Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox Jumps "
- "over a Lazy Frog Quick Brown Fox Jumps over a Lazy Frog Quick Brown Fox ";
-
-static void
-src_handoff_cb (GstElement * src, GstBuffer * buf, GstPad * pad, gpointer data)
-{
- GST_BUFFER_DATA (buf) = (guint8 *) dummytext;
- GST_BUFFER_SIZE (buf) = sizeof (dummytext);
- GST_BUFFER_OFFSET (buf) = 0;
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_READONLY);
-}
-
-static void
-decodebin_new_decoded_pad_cb (GstElement * decodebin, GstPad * pad,
- gboolean last, gboolean * p_flag)
-{
- /* we should not be reached */
- fail_unless (decodebin == NULL, "new-decoded-pad should not be emitted");
-}
-
-/* make sure that decodebin errors out instead of creating a new decoded pad
- * if the entire stream is a plain text file */
-GST_START_TEST (test_text_plain_streams)
-{
- GstElement *pipe, *src, *decodebin;
- GstMessage *msg;
-
- pipe = gst_pipeline_new (NULL);
- fail_unless (pipe != NULL, "failed to create pipeline");
-
- src = gst_element_factory_make ("fakesrc", "src");
- fail_unless (src != NULL, "Failed to create fakesrc element");
-
- g_object_set (src, "signal-handoffs", TRUE, NULL);
- g_object_set (src, "num-buffers", 1, NULL);
- g_object_set (src, "can-activate-pull", FALSE, NULL);
- g_signal_connect (src, "handoff", G_CALLBACK (src_handoff_cb), NULL);
-
- decodebin = gst_element_factory_make ("decodebin2", "decodebin");
- fail_unless (decodebin != NULL, "Failed to create decodebin element");
-
- g_signal_connect (decodebin, "new-decoded-pad",
- G_CALLBACK (decodebin_new_decoded_pad_cb), NULL);
-
- fail_unless (gst_bin_add (GST_BIN (pipe), src));
- fail_unless (gst_bin_add (GST_BIN (pipe), decodebin));
- fail_unless (gst_element_link (src, decodebin), "can't link src<->decodebin");
-
- fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- /* it's push-based, so should be async */
- fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_PAUSED),
- GST_STATE_CHANGE_ASYNC);
-
- /* it should error out at some point */
- msg = gst_bus_poll (GST_ELEMENT_BUS (pipe), GST_MESSAGE_ERROR, -1);
- fail_unless (msg != NULL);
- fail_unless (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR);
- gst_message_unref (msg);
-
- gst_element_set_state (pipe, GST_STATE_NULL);
- gst_object_unref (pipe);
-}
-
-GST_END_TEST;
-
-static void
-new_decoded_pad_plug_fakesink_cb (GstElement * decodebin, GstPad * srcpad,
- gboolean last, GstElement * pipeline)
-{
- GstElement *sink;
- GstPad *sinkpad;
-
- GST_LOG ("Linking fakesink");
-
- sink = gst_element_factory_make ("fakesink", "sink");
- fail_unless (sink != NULL, "Failed to create fakesink element");
-
- gst_bin_add (GST_BIN (pipeline), sink);
-
- sinkpad = gst_element_get_static_pad (sink, "sink");
- fail_unless_equals_int (gst_pad_link (srcpad, sinkpad), GST_PAD_LINK_OK);
- gst_object_unref (sinkpad);
-
- gst_element_set_state (sink, GST_STATE_PLAYING);
-}
-
-GST_START_TEST (test_reuse_without_decoders)
-{
- GstElement *pipe, *src, *decodebin, *sink;
-
- pipe = gst_pipeline_new (NULL);
- fail_unless (pipe != NULL, "failed to create pipeline");
-
- src = gst_element_factory_make ("audiotestsrc", "src");
- fail_unless (src != NULL, "Failed to create audiotestsrc element");
-
- decodebin = gst_element_factory_make ("decodebin2", "decodebin");
- fail_unless (decodebin != NULL, "Failed to create decodebin element");
-
- g_signal_connect (decodebin, "new-decoded-pad",
- G_CALLBACK (new_decoded_pad_plug_fakesink_cb), pipe);
-
- fail_unless (gst_bin_add (GST_BIN (pipe), src));
- fail_unless (gst_bin_add (GST_BIN (pipe), decodebin));
- fail_unless (gst_element_link (src, decodebin), "can't link src<->decodebin");
-
- fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- /* it's push-based, so should be async */
- fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_PAUSED),
- GST_STATE_CHANGE_ASYNC);
-
- /* wait for state change to complete */
- fail_unless_equals_int (gst_element_get_state (pipe, NULL, NULL, -1),
- GST_STATE_CHANGE_SUCCESS);
-
- /* there shouldn't be any errors */
- fail_if (gst_bus_poll (GST_ELEMENT_BUS (pipe), GST_MESSAGE_ERROR, 0) != NULL);
-
- /* reset */
- gst_element_set_state (pipe, GST_STATE_READY);
-
- sink = gst_bin_get_by_name (GST_BIN (pipe), "sink");
- gst_bin_remove (GST_BIN (pipe), sink);
- gst_element_set_state (sink, GST_STATE_NULL);
- gst_object_unref (sink);
-
- GST_LOG ("second try");
-
- fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- /* it's push-based, so should be async */
- fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_PAUSED),
- GST_STATE_CHANGE_ASYNC);
-
- /* wait for state change to complete */
- fail_unless_equals_int (gst_element_get_state (pipe, NULL, NULL, -1),
- GST_STATE_CHANGE_SUCCESS);
-
- /* there shouldn't be any errors */
- fail_if (gst_bus_poll (GST_ELEMENT_BUS (pipe), GST_MESSAGE_ERROR, 0) != NULL);
-
- gst_element_set_state (pipe, GST_STATE_NULL);
- gst_object_unref (pipe);
-}
-
-GST_END_TEST;
-
-static Suite *
-decodebin2_suite (void)
-{
- Suite *s = suite_create ("decodebin2");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_text_plain_streams);
- tcase_add_test (tc_chain, test_reuse_without_decoders);
-
- return s;
-}
-
-GST_CHECK_MAIN (decodebin2);
diff --git a/tests/check/elements/ffmpegcolorspace.c b/tests/check/elements/ffmpegcolorspace.c
deleted file mode 100644
index 60179c61..00000000
--- a/tests/check/elements/ffmpegcolorspace.c
+++ /dev/null
@@ -1,439 +0,0 @@
-/* GStreamer
- *
- * unit test for ffmpegcolorspace
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef HAVE_VALGRIND
-# include <valgrind/valgrind.h>
-#endif
-
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-
-typedef struct _RGBFormat
-{
- const gchar *nick;
- guint bpp, depth;
- guint32 red_mask, green_mask, blue_mask, alpha_mask;
- guint endianness;
-} RGBFormat;
-
-typedef struct _RGBConversion
-{
- RGBFormat from_fmt;
- RGBFormat to_fmt;
- GstCaps *from_caps;
- GstCaps *to_caps;
-} RGBConversion;
-
-static GstCaps *
-rgb_format_to_caps (RGBFormat * fmt)
-{
- GstCaps *caps;
-
- g_assert (fmt != NULL);
- g_assert (fmt->endianness != 0);
-
- caps = gst_caps_new_simple ("video/x-raw-rgb",
- "bpp", G_TYPE_INT, fmt->bpp,
- "depth", G_TYPE_INT, fmt->depth,
- "red_mask", G_TYPE_INT, fmt->red_mask,
- "green_mask", G_TYPE_INT, fmt->green_mask,
- "blue_mask", G_TYPE_INT, fmt->blue_mask,
- "width", G_TYPE_INT, 16, "height", G_TYPE_INT, 16,
- "endianness", G_TYPE_INT, fmt->endianness,
- "framerate", GST_TYPE_FRACTION, 1, 1, NULL);
-
- fail_unless (fmt->alpha_mask == 0 || fmt->bpp == 32);
-
- if (fmt->alpha_mask != 0) {
- gst_structure_set (gst_caps_get_structure (caps, 0),
- "alpha_mask", G_TYPE_INT, fmt->alpha_mask, NULL);
- }
-
- return caps;
-}
-
-static GList *
-create_rgb_conversions (void)
-{
- const RGBFormat rgb_formats[] = {
- {
- "RGBA", 32, 32, 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff, 0}, {
- "ARGB", 32, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000, 0}, {
- "BGRA", 32, 32, 0x0000ff00, 0x00ff0000, 0xff000000, 0x000000ff, 0}, {
- "ABGR", 32, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000, 0}, {
- "RGBx", 32, 24, 0xff000000, 0x00ff0000, 0x0000ff00, 0x00000000, 0}, {
- "xRGB", 32, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000, 0}, {
- "BGRx", 32, 24, 0x0000ff00, 0x00ff0000, 0xff000000, 0x00000000, 0}, {
- "xBGR", 32, 24, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000, 0}, {
- "RGB ", 24, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000, 0}, {
- "BGR ", 24, 24, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000, 0}, {
- "RGB565", 16, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000, 0}, {
- "xRGB1555", 16, 15, 0x00007c00, 0x000003e0, 0x0000001f, 0x0000000, 0}
- };
- const struct
- {
- guint from_endianness, to_endianness;
- } end_arr[4] = {
- {
- G_LITTLE_ENDIAN, G_LITTLE_ENDIAN}, {
- G_BIG_ENDIAN, G_LITTLE_ENDIAN}, {
- G_LITTLE_ENDIAN, G_BIG_ENDIAN}, {
- G_BIG_ENDIAN, G_BIG_ENDIAN}
- };
- GList *conversions = NULL;
- guint from_fmt, to_fmt;
-
- for (from_fmt = 0; from_fmt < G_N_ELEMENTS (rgb_formats); ++from_fmt) {
- for (to_fmt = 0; to_fmt < G_N_ELEMENTS (rgb_formats); ++to_fmt) {
- guint i;
-
- for (i = 0; i < 4; ++i) {
- RGBConversion *conversion;
-
- conversion = g_new0 (RGBConversion, 1);
- conversion->from_fmt = rgb_formats[from_fmt];
- conversion->to_fmt = rgb_formats[to_fmt];
- conversion->from_fmt.endianness = end_arr[i].from_endianness;
- conversion->to_fmt.endianness = end_arr[i].to_endianness;
- conversion->from_caps = rgb_format_to_caps (&conversion->from_fmt);
- conversion->to_caps = rgb_format_to_caps (&conversion->to_fmt);
- conversions = g_list_prepend (conversions, conversion);
- }
- }
- }
-
- return g_list_reverse (conversions);
-}
-
-static void
-rgb_conversion_free (RGBConversion * conv)
-{
- gst_caps_unref (conv->from_caps);
- gst_caps_unref (conv->to_caps);
- memset (conv, 0x99, sizeof (RGBConversion));
- g_free (conv);
-}
-
-static guint32
-right_shift_colour (guint32 mask, guint32 pixel)
-{
- if (mask == 0)
- return 0;
-
- pixel = pixel & mask;
- while ((mask & 0x01) == 0) {
- mask = mask >> 1;
- pixel = pixel >> 1;
- }
-
- return pixel;
-}
-
-static guint8
-fix_expected_colour (guint32 col_mask, guint8 col_expected)
-{
- guint32 mask;
- gint last = g_bit_nth_msf (col_mask, -1);
- gint first = g_bit_nth_lsf (col_mask, -1);
-
- mask = 1 << (last - first + 1);
- mask -= 1;
-
- g_assert (col_expected == 0x00 || col_expected == 0xff);
-
- /* this only works because we only check for all-bits-set or no-bits-set */
- return col_expected & mask;
-}
-
-static void
-check_rgb_buf (const guint8 * pixels, guint32 r_mask, guint32 g_mask,
- guint32 b_mask, guint32 a_mask, guint8 r_expected, guint8 g_expected,
- guint8 b_expected, guint endianness, guint bpp, guint depth)
-{
- guint32 pixel, red, green, blue, alpha;
-
- switch (bpp) {
- case 32:{
- if (endianness == G_LITTLE_ENDIAN)
- pixel = GST_READ_UINT32_LE (pixels);
- else
- pixel = GST_READ_UINT32_BE (pixels);
- break;
- }
- case 24:{
- if (endianness == G_BIG_ENDIAN) {
- pixel = (GST_READ_UINT8 (pixels) << 16) |
- (GST_READ_UINT8 (pixels + 1) << 8) |
- (GST_READ_UINT8 (pixels + 2) << 0);
- } else {
- pixel = (GST_READ_UINT8 (pixels + 2) << 16) |
- (GST_READ_UINT8 (pixels + 1) << 8) |
- (GST_READ_UINT8 (pixels + 0) << 0);
- }
- break;
- }
- case 16:{
- if (endianness == G_LITTLE_ENDIAN)
- pixel = GST_READ_UINT16_LE (pixels);
- else
- pixel = GST_READ_UINT16_BE (pixels);
- break;
- }
- default:
- g_return_if_reached ();
- }
-
- red = right_shift_colour (r_mask, pixel);
- green = right_shift_colour (g_mask, pixel);
- blue = right_shift_colour (b_mask, pixel);
- alpha = right_shift_colour (a_mask, pixel);
-
- /* can't enable this by default, valgrind will complain about accessing
- * uninitialised memory for the depth=24,bpp=32 formats ... */
- /* GST_LOG ("pixels: 0x%02x 0x%02x 0x%02x 0x%02x => pixel = 0x%08x",
- pixels[0], (guint) pixels[1], pixels[2], pixels[3], pixel); */
-
- /* fix up the mask (for rgb15/16) */
- if (bpp == 16) {
- r_expected = fix_expected_colour (r_mask, r_expected);
- g_expected = fix_expected_colour (g_mask, g_expected);
- b_expected = fix_expected_colour (b_mask, b_expected);
- }
-
- fail_unless (red == r_expected, "RED: expected 0x%02x, found 0x%02x "
- "Bytes: 0x%02x 0x%02x 0x%02x 0x%02x Pixel: 0x%08x", r_expected, red,
- pixels[0], pixels[1], pixels[2], pixels[3], pixel);
- fail_unless (green == g_expected, "GREEN: expected 0x%02x, found 0x%02x "
- "Bytes: 0x%02x 0x%02x 0x%02x 0x%02x Pixel: 0x%08x", g_expected, green,
- pixels[0], pixels[1], pixels[2], pixels[3], pixel);
- fail_unless (blue == b_expected, "BLUE: expected 0x%02x, found 0x%02x "
- "Bytes: 0x%02x 0x%02x 0x%02x 0x%02x Pixel: 0x%08x", b_expected, blue,
- pixels[0], pixels[1], pixels[2], pixels[3], pixel);
-
-// FIXME: fix alpha check
-// fail_unless (a_mask == 0 || alpha != 0); /* better than nothing */
-}
-
-static void
-got_buf_cb (GstElement * sink, GstBuffer * new_buf, GstPad * pad,
- GstBuffer ** p_old_buf)
-{
- gst_buffer_replace (p_old_buf, new_buf);
-}
-
-/* Note: lots of this code here is also in the videotestsrc.c unit test */
-GST_START_TEST (test_rgb_to_rgb)
-{
- const struct
- {
- const gchar *pattern_name;
- gint pattern_enum;
- guint8 r_expected;
- guint8 g_expected;
- guint8 b_expected;
- } test_patterns[] = {
- {
- "white", 3, 0xff, 0xff, 0xff}, {
- "red", 4, 0xff, 0x00, 0x00}, {
- "green", 5, 0x00, 0xff, 0x00}, {
- "blue", 6, 0x00, 0x00, 0xff}, {
- "black", 2, 0x00, 0x00, 0x00}
- };
- GstElement *pipeline, *src, *filter1, *csp, *filter2, *sink;
- const GstCaps *template_caps;
- GstBuffer *buf = NULL;
- GstPad *srcpad;
- GList *conversions, *l;
- gint p;
-
- /* test check function */
- fail_unless (right_shift_colour (0x00ff0000, 0x11223344) == 0x22);
-
- pipeline = gst_pipeline_new ("pipeline");
- src = gst_check_setup_element ("videotestsrc");
- filter1 = gst_check_setup_element ("capsfilter");
- csp = gst_check_setup_element ("ffmpegcolorspace");
- filter2 = gst_element_factory_make ("capsfilter", "to_filter");
- sink = gst_check_setup_element ("fakesink");
-
- gst_bin_add_many (GST_BIN (pipeline), src, filter1, csp, filter2, sink, NULL);
-
- fail_unless (gst_element_link (src, filter1));
- fail_unless (gst_element_link (filter1, csp));
- fail_unless (gst_element_link (csp, filter2));
- fail_unless (gst_element_link (filter2, sink));
-
- srcpad = gst_element_get_static_pad (src, "src");
- template_caps = gst_pad_get_pad_template_caps (srcpad);
- gst_object_unref (srcpad);
-
- g_object_set (sink, "signal-handoffs", TRUE, NULL);
- g_signal_connect (sink, "preroll-handoff", G_CALLBACK (got_buf_cb), &buf);
-
- GST_LOG ("videotestsrc src template caps: %" GST_PTR_FORMAT, template_caps);
-
- conversions = create_rgb_conversions ();
-
- for (l = conversions; l != NULL; l = l->next) {
- RGBConversion *conv = (RGBConversion *) l->data;
-
- /* does videotestsrc support the from_caps? */
- if (!gst_caps_is_subset (conv->from_caps, template_caps)) {
- GST_DEBUG ("videotestsrc doesn't support from_caps %" GST_PTR_FORMAT,
- conv->from_caps);
- continue;
- }
-
- /* caps are supported, let's run some tests then ... */
- for (p = 0; p < G_N_ELEMENTS (test_patterns); ++p) {
- GstStateChangeReturn state_ret;
- RGBFormat *from = &conv->from_fmt;
- RGBFormat *to = &conv->to_fmt;
-
- /* trick compiler into thinking from is used, might throw warning
- * otherwise if the debugging system is disabled */
- fail_unless (from != NULL);
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- g_object_set (src, "pattern", test_patterns[p].pattern_enum, NULL);
-
- GST_INFO ("%5s %u/%u %08x %08x %08x %08x %u => "
- "%5s %u/%u %08x %08x %08x %08x %u, pattern=%s",
- from->nick, from->bpp, from->depth, from->red_mask,
- from->green_mask, from->blue_mask, from->alpha_mask,
- from->endianness, to->nick, to->bpp, to->depth, to->red_mask,
- to->green_mask, to->blue_mask, to->alpha_mask, to->endianness,
- test_patterns[p].pattern_name);
-
- /* now get videotestsrc to produce a buffer with the given caps */
- g_object_set (filter1, "caps", conv->from_caps, NULL);
-
- /* ... and force ffmpegcolorspace to convert to our target caps */
- g_object_set (filter2, "caps", conv->to_caps, NULL);
-
- state_ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
- if (state_ret == GST_STATE_CHANGE_FAILURE) {
- GstMessage *msg;
- GError *err = NULL;
-
- msg = gst_bus_poll (GST_ELEMENT_BUS (pipeline), GST_MESSAGE_ERROR, 0);
- fail_if (msg == NULL, "expected ERROR message on the bus");
- fail_unless (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR);
- gst_message_parse_error (msg, &err, NULL);
- fail_unless (err != NULL);
- if (msg->src == GST_OBJECT_CAST (src) &&
- err->code == GST_STREAM_ERROR_FORMAT) {
- GST_DEBUG ("ffmpegcolorspace does not support this conversion");
- gst_message_unref (msg);
- g_error_free (err);
- continue;
- }
- fail_unless (state_ret != GST_STATE_CHANGE_FAILURE,
- "pipeline _set_state() to PAUSED failed: %s", err->message);
- }
-
- state_ret = gst_element_get_state (pipeline, NULL, NULL, -1);
- fail_unless (state_ret == GST_STATE_CHANGE_SUCCESS,
- "pipeline failed going to PAUSED state");
-
- state_ret = gst_element_set_state (pipeline, GST_STATE_NULL);
- fail_unless (state_ret == GST_STATE_CHANGE_SUCCESS);
-
- fail_unless (buf != NULL);
-
- /* check buffer caps */
- {
- GstStructure *s;
- gint v;
-
- fail_unless (GST_BUFFER_CAPS (buf) != NULL);
- s = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0);
- fail_unless (gst_structure_get_int (s, "bpp", &v));
- fail_unless_equals_int (v, to->bpp);
- fail_unless (gst_structure_get_int (s, "depth", &v));
- fail_unless_equals_int (v, to->depth);
- fail_unless (gst_structure_get_int (s, "red_mask", &v));
- fail_unless_equals_int (v, to->red_mask);
- fail_unless (gst_structure_get_int (s, "green_mask", &v));
- fail_unless_equals_int (v, to->green_mask);
- fail_unless (gst_structure_get_int (s, "blue_mask", &v));
- fail_unless_equals_int (v, to->blue_mask);
- /* there mustn't be an alpha_mask if there's no alpha component */
- if (to->depth == 32) {
- fail_unless (gst_structure_get_int (s, "alpha_mask", &v));
- fail_unless_equals_int (v, to->alpha_mask);
- } else {
- fail_unless (gst_structure_get_value (s, "alpha_mask") == NULL);
- }
- }
-
- /* now check the top-left pixel */
- check_rgb_buf (GST_BUFFER_DATA (buf), to->red_mask,
- to->green_mask, to->blue_mask, to->alpha_mask,
- test_patterns[p].r_expected, test_patterns[p].g_expected,
- test_patterns[p].b_expected, to->endianness, to->bpp, to->depth);
-
- gst_buffer_unref (buf);
- buf = NULL;
- }
- }
-
- g_list_foreach (conversions, (GFunc) rgb_conversion_free, NULL);
- g_list_free (conversions);
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-}
-
-GST_END_TEST;
-
-static Suite *
-ffmpegcolorspace_suite (void)
-{
- Suite *s = suite_create ("ffmpegcolorspace");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
-
-#ifdef HAVE_VALGRIND
- if (RUNNING_ON_VALGRIND) {
- /* otherwise valgrind errors out when liboil probes CPU extensions
- * during which it causes SIGILLs etc. to be fired */
- g_setenv ("OIL_CPU_FLAGS", "0", 0);
- /* test_rgb_formats takes a bit longer, so increase timeout */
- tcase_set_timeout (tc_chain, 10 * 60);
- }
-#endif
-
- /* FIXME: add tests for YUV <=> YUV and YUV <=> RGB */
- tcase_add_test (tc_chain, test_rgb_to_rgb);
-
- return s;
-}
-
-GST_CHECK_MAIN (ffmpegcolorspace);
diff --git a/tests/check/elements/gdpdepay.c b/tests/check/elements/gdpdepay.c
deleted file mode 100644
index 60bc1aed..00000000
--- a/tests/check/elements/gdpdepay.c
+++ /dev/null
@@ -1,428 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2006 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-#include <string.h>
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-#include <gst/dataprotocol/dataprotocol.h>
-
-/* For ease of programming we use globals to keep refs for our floating
- * src and sink pads we create; otherwise we always have to do get_pad,
- * get_peer, and then remove references in every test function */
-static GstPad *mysrcpad, *mysinkpad, *myshsinkpad;
-
-#define AUDIO_CAPS_TEMPLATE_STRING \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, 8 ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) {8, 16}, " \
- "depth = (int) {8, 16}, " \
- "signed = (boolean) true"
-
-#define AUDIO_CAPS_STRING \
- "audio/x-raw-int, " \
- "rate = (int) 1000, " \
- "channels = (int) 2, " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 16, " \
- "depth = (int) 16, " \
- "signed = (boolean) true"
-
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (AUDIO_CAPS_TEMPLATE_STRING)
- );
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-gdp")
- );
-
-/* takes over reference for outcaps */
-static GstElement *
-setup_gdpdepay (void)
-{
- GstElement *gdpdepay;
-
- GST_DEBUG ("setup_gdpdepay");
- gdpdepay = gst_check_setup_element ("gdpdepay");
- mysrcpad = gst_check_setup_src_pad (gdpdepay, &srctemplate, NULL);
- mysinkpad = gst_check_setup_sink_pad (gdpdepay, &sinktemplate, NULL);
- gst_pad_set_active (mysrcpad, TRUE);
- gst_pad_set_active (mysinkpad, TRUE);
-
- return gdpdepay;
-}
-
-static void
-cleanup_gdpdepay (GstElement * gdpdepay)
-{
- GST_DEBUG ("cleanup_gdpdepay");
-
- gst_pad_set_active (mysrcpad, FALSE);
- if (mysinkpad)
- gst_pad_set_active (mysinkpad, FALSE);
- if (myshsinkpad)
- gst_pad_set_active (myshsinkpad, FALSE);
- gst_check_teardown_src_pad (gdpdepay);
- gst_check_teardown_sink_pad (gdpdepay);
- gst_check_teardown_element (gdpdepay);
- mysinkpad = NULL;
- myshsinkpad = NULL;
-}
-
-static void
-gdpdepay_push_per_byte (gchar * reason, guint8 * bytes, guint length)
-{
- int i;
- GstBuffer *inbuffer;
-
- for (i = 0; i < length; ++i) {
- inbuffer = gst_buffer_new_and_alloc (1);
- GST_BUFFER_DATA (inbuffer)[0] = bytes[i];
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK,
- "%s: failed pushing byte buffer", reason);
- }
-}
-
-GST_START_TEST (test_audio_per_byte)
-{
- GstCaps *caps;
- GstPad *srcpad;
- GstElement *gdpdepay;
- GstBuffer *buffer, *outbuffer;
- guint8 *header, *payload;
- guint len;
- GstDPPacketizer *pk;
-
- pk = gst_dp_packetizer_new (GST_DP_VERSION_1_0);
-
- gdpdepay = setup_gdpdepay ();
- srcpad = gst_element_get_static_pad (gdpdepay, "src");
-
- fail_unless (gst_element_set_state (gdpdepay,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- caps = gst_pad_get_caps (srcpad);
- fail_unless (gst_caps_is_any (caps));
- gst_caps_unref (caps);
- fail_if (gst_pad_get_negotiated_caps (srcpad));
-
- /* create caps and buffer packets and push them */
- caps = gst_caps_from_string (AUDIO_CAPS_STRING);
- fail_unless (pk->packet_from_caps (caps, 0, &len, &header, &payload));
- gst_caps_unref (caps);
- gdpdepay_push_per_byte ("caps header", header, len);
- fail_unless_equals_int (g_list_length (buffers), 0);
- gdpdepay_push_per_byte ("caps payload", payload,
- gst_dp_header_payload_length (header));
- fail_unless_equals_int (g_list_length (buffers), 0);
- caps = gst_pad_get_caps (srcpad);
- fail_if (gst_caps_is_any (caps));
- gst_caps_unref (caps);
-
- g_free (header);
- g_free (payload);
-
- buffer = gst_buffer_new_and_alloc (4);
- memcpy (GST_BUFFER_DATA (buffer), "f00d", 4);
- GST_BUFFER_TIMESTAMP (buffer) = GST_SECOND;
- GST_BUFFER_DURATION (buffer) = GST_SECOND / 10;
- fail_unless (pk->header_from_buffer (buffer, 0, &len, &header));
- gdpdepay_push_per_byte ("buffer header", header, len);
- fail_unless_equals_int (g_list_length (buffers), 0);
- gdpdepay_push_per_byte ("buffer payload", GST_BUFFER_DATA (buffer),
- gst_dp_header_payload_length (header));
- g_free (header);
- gst_buffer_unref (buffer);
-
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (outbuffer), GST_SECOND);
- fail_unless_equals_uint64 (GST_BUFFER_DURATION (outbuffer), GST_SECOND / 10);
-
- buffers = g_list_remove (buffers, outbuffer);
- gst_buffer_unref (outbuffer);
-
- fail_unless (gst_element_set_state (gdpdepay,
- GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
-
- ASSERT_OBJECT_REFCOUNT (gdpdepay, "gdpdepay", 1);
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
- gst_object_unref (srcpad);
- cleanup_gdpdepay (gdpdepay);
-
- gst_dp_packetizer_free (pk);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_audio_in_one_buffer)
-{
- GstCaps *caps;
- GstPad *srcpad;
- GstElement *gdpdepay;
- GstBuffer *buffer, *inbuffer;
- guint8 *caps_header, *caps_payload, *buf_header;
- guint header_len, payload_len;
- guint i;
- GstDPPacketizer *pk;
-
- pk = gst_dp_packetizer_new (GST_DP_VERSION_1_0);
-
- gdpdepay = setup_gdpdepay ();
- srcpad = gst_element_get_static_pad (gdpdepay, "src");
-
- fail_unless (gst_element_set_state (gdpdepay,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- /* make sure no caps are set yet */
- caps = gst_pad_get_caps (srcpad);
- fail_unless (gst_caps_is_any (caps));
- gst_caps_unref (caps);
- fail_if (gst_pad_get_negotiated_caps (srcpad));
-
- /* create caps and buffer packets and push them as one buffer */
- caps = gst_caps_from_string (AUDIO_CAPS_STRING);
- fail_unless (pk->packet_from_caps (caps, 0, &header_len, &caps_header,
- &caps_payload));
-
- buffer = gst_buffer_new_and_alloc (4);
- memcpy (GST_BUFFER_DATA (buffer), "f00d", 4);
- fail_unless (pk->header_from_buffer (buffer, 0, &header_len, &buf_header));
-
- payload_len = gst_dp_header_payload_length (caps_header);
-
- inbuffer = gst_buffer_new_and_alloc (2 * GST_DP_HEADER_LENGTH +
- payload_len + GST_BUFFER_SIZE (buffer));
- memcpy (GST_BUFFER_DATA (inbuffer), caps_header, GST_DP_HEADER_LENGTH);
- i = GST_DP_HEADER_LENGTH;
- memcpy (GST_BUFFER_DATA (inbuffer) + i, caps_payload, payload_len);
- i += payload_len;
- memcpy (GST_BUFFER_DATA (inbuffer) + i, buf_header, GST_DP_HEADER_LENGTH);
- i += GST_DP_HEADER_LENGTH;
- memcpy (GST_BUFFER_DATA (inbuffer) + i, GST_BUFFER_DATA (buffer),
- GST_BUFFER_SIZE (buffer));
-
- gst_caps_unref (caps);
- gst_buffer_unref (buffer);
-
- g_free (caps_header);
- g_free (caps_payload);
- g_free (buf_header);
-
- /* now push it */
- gst_pad_push (mysrcpad, inbuffer);
-
- /* the buffer is still queued */
- fail_unless_equals_int (g_list_length (buffers), 1);
-
- fail_unless (gst_element_set_state (gdpdepay,
- GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
-
- gst_object_unref (srcpad);
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
- ASSERT_OBJECT_REFCOUNT (gdpdepay, "gdpdepay", 1);
- cleanup_gdpdepay (gdpdepay);
-
- gst_dp_packetizer_free (pk);
-}
-
-GST_END_TEST;
-
-static GstStaticPadTemplate shsinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-gst-test-streamheader")
- );
-
-static GstElement *
-setup_gdpdepay_streamheader (void)
-{
- GstElement *gdpdepay;
-
- GST_DEBUG ("setup_gdpdepay");
- gdpdepay = gst_check_setup_element ("gdpdepay");
- mysrcpad = gst_check_setup_src_pad (gdpdepay, &srctemplate, NULL);
- myshsinkpad = gst_check_setup_sink_pad (gdpdepay, &shsinktemplate, NULL);
- gst_pad_set_active (mysrcpad, TRUE);
- gst_pad_set_active (myshsinkpad, TRUE);
-
- return gdpdepay;
-}
-
-/* this tests deserialization of a GDP stream where the serialized caps
- * have a streamheader set */
-GST_START_TEST (test_streamheader)
-{
- GstCaps *caps, *padcaps;
- GstPad *srcpad;
- GstElement *gdpdepay;
- GstBuffer *buffer, *inbuffer, *outbuffer, *shbuffer;
- guint8 *caps_header, *caps_payload, *buf_header;
- guint header_len, payload_len;
- guint i;
- GstStructure *structure;
- GValue array = { 0 };
- GValue value = { 0 };
- GstDPPacketizer *pk;
-
- pk = gst_dp_packetizer_new (GST_DP_VERSION_1_0);
-
- gdpdepay = setup_gdpdepay_streamheader ();
- srcpad = gst_element_get_static_pad (gdpdepay, "src");
- ASSERT_OBJECT_REFCOUNT (gdpdepay, "gdpdepay", 1);
-
- fail_unless (gst_element_set_state (gdpdepay,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- /* make sure no caps are set yet */
- caps = gst_pad_get_caps (srcpad);
- fail_unless (gst_caps_is_any (caps));
- gst_caps_unref (caps);
- fail_if (gst_pad_get_negotiated_caps (srcpad));
-
- /* create a streamheader buffer and the caps containing it */
- caps = gst_caps_from_string ("application/x-gst-test-streamheader");
- structure = gst_caps_get_structure (caps, 0);
- buffer = gst_buffer_new_and_alloc (4);
- memcpy (GST_BUFFER_DATA (buffer), "f00d", 4);
- GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_IN_CAPS);
- g_value_init (&array, GST_TYPE_ARRAY);
- g_value_init (&value, GST_TYPE_BUFFER);
- shbuffer = gst_buffer_copy (buffer);
- gst_value_set_buffer (&value, shbuffer);
- gst_buffer_unref (shbuffer);
- gst_value_array_append_value (&array, &value);
- g_value_unset (&value);
- gst_structure_set_value (structure, "streamheader", &array);
- g_value_unset (&array);
-
- gst_buffer_set_caps (buffer, caps);
-
- /* create GDP packets for the caps and the buffer, and put them in one
- * GDP buffer */
- fail_unless (pk->packet_from_caps (caps, 0, &header_len, &caps_header,
- &caps_payload));
-
- fail_unless (pk->header_from_buffer (buffer, 0, &header_len, &buf_header));
-
- payload_len = gst_dp_header_payload_length (caps_header);
-
- inbuffer = gst_buffer_new_and_alloc (2 * GST_DP_HEADER_LENGTH +
- payload_len + GST_BUFFER_SIZE (buffer));
- memcpy (GST_BUFFER_DATA (inbuffer), caps_header, GST_DP_HEADER_LENGTH);
- i = GST_DP_HEADER_LENGTH;
- memcpy (GST_BUFFER_DATA (inbuffer) + i, caps_payload, payload_len);
- i += payload_len;
- memcpy (GST_BUFFER_DATA (inbuffer) + i, buf_header, GST_DP_HEADER_LENGTH);
- i += GST_DP_HEADER_LENGTH;
- memcpy (GST_BUFFER_DATA (inbuffer) + i, GST_BUFFER_DATA (buffer),
- GST_BUFFER_SIZE (buffer));
-
- gst_caps_unref (caps);
- gst_buffer_unref (buffer);
-
- g_free (caps_header);
- g_free (caps_payload);
- g_free (buf_header);
-
- /* now push it */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- gst_pad_push (mysrcpad, inbuffer);
-
- /* our only output buffer is the streamheader buffer */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- buffers = g_list_remove (buffers, outbuffer);
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
- fail_unless (GST_BUFFER_FLAG_IS_SET (outbuffer, GST_BUFFER_FLAG_IN_CAPS));
-
- padcaps = gst_pad_get_negotiated_caps (myshsinkpad);
- caps = gst_buffer_get_caps (outbuffer);
- fail_if (caps == NULL);
- fail_if (padcaps == NULL);
- GST_DEBUG ("caps: %" GST_PTR_FORMAT ", padcaps: %" GST_PTR_FORMAT, caps,
- padcaps);
- fail_unless (gst_caps_is_equal (padcaps, caps));
-
- /* FIXME: get streamheader, compare data with buffer */
- gst_buffer_unref (outbuffer);
- gst_caps_unref (padcaps);
- gst_caps_unref (caps);
-
- /* clean up */
- fail_unless (gst_element_set_state (gdpdepay,
- GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
-
- gst_object_unref (srcpad);
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
- ASSERT_OBJECT_REFCOUNT (gdpdepay, "gdpdepay", 1);
- cleanup_gdpdepay (gdpdepay);
-
- gst_dp_packetizer_free (pk);
-}
-
-GST_END_TEST;
-
-static Suite *
-gdpdepay_suite (void)
-{
- Suite *s = suite_create ("gdpdepay");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_audio_per_byte);
- tcase_add_test (tc_chain, test_audio_in_one_buffer);
- tcase_add_test (tc_chain, test_streamheader);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = gdpdepay_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/elements/gdppay.c b/tests/check/elements/gdppay.c
deleted file mode 100644
index 267b266d..00000000
--- a/tests/check/elements/gdppay.c
+++ /dev/null
@@ -1,581 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2006 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <string.h>
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-#include <gst/dataprotocol/dataprotocol.h>
-
-/* For ease of programming we use globals to keep refs for our floating
- * src and sink pads we create; otherwise we always have to do get_pad,
- * get_peer, and then remove references in every test function */
-static GstPad *mysrcpad, *myshsrcpad, *mysinkpad;
-
-#define AUDIO_CAPS_TEMPLATE_STRING \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, 8 ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) {8, 16}, " \
- "depth = (int) {8, 16}, " \
- "signed = (boolean) true"
-
-#define AUDIO_CAPS_STRING \
- "audio/x-raw-int, " \
- "rate = (int) 1000, " \
- "channels = (int) 2, " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 16, " \
- "depth = (int) 16, " \
- "signed = (boolean) true"
-
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-gdp")
- );
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (AUDIO_CAPS_TEMPLATE_STRING)
- );
-
-/* takes over reference for outcaps */
-static GstElement *
-setup_gdppay (void)
-{
- GstElement *gdppay;
-
- GST_DEBUG ("setup_gdppay");
- gdppay = gst_check_setup_element ("gdppay");
- mysrcpad = gst_check_setup_src_pad (gdppay, &srctemplate, NULL);
- mysinkpad = gst_check_setup_sink_pad (gdppay, &sinktemplate, NULL);
- gst_pad_set_active (mysrcpad, TRUE);
- gst_pad_set_active (mysinkpad, TRUE);
-
- return gdppay;
-}
-
-static void
-cleanup_gdppay (GstElement * gdppay)
-{
- GST_DEBUG ("cleanup_gdppay");
-
- if (mysrcpad)
- gst_pad_set_active (mysrcpad, FALSE);
- if (myshsrcpad)
- gst_pad_set_active (myshsrcpad, FALSE);
- gst_pad_set_active (mysinkpad, FALSE);
- gst_check_teardown_src_pad (gdppay);
- gst_check_teardown_sink_pad (gdppay);
- gst_check_teardown_element (gdppay);
- mysrcpad = NULL;
- myshsrcpad = NULL;
-}
-
-GST_START_TEST (test_audio)
-{
- GstCaps *caps;
- GstElement *gdppay;
- GstBuffer *inbuffer, *outbuffer;
- GstEvent *event;
- gchar *caps_string;
- gint length;
-
- gdppay = setup_gdppay ();
-
- fail_unless (gst_element_set_state (gdppay,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- GST_DEBUG ("new segment");
- event =
- gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, GST_SECOND, 0);
- fail_unless (gst_pad_push_event (mysrcpad, event));
-
- /* no buffer should be pushed yet, waiting for caps */
- fail_unless_equals_int (g_list_length (buffers), 0);
-
- GST_DEBUG ("first buffer");
- inbuffer = gst_buffer_new_and_alloc (4);
- caps = gst_caps_from_string (AUDIO_CAPS_STRING);
- gst_buffer_set_caps (inbuffer, caps);
- caps_string = gst_caps_to_string (caps);
-
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
-
- /* we should have three buffers now */
- fail_unless_equals_int (g_list_length (buffers), 3);
-
- /* first buffer is the serialized new_segment event;
- * the element also holds a ref to it */
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- buffers = g_list_remove (buffers, outbuffer);
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 2);
- gst_buffer_unref (outbuffer);
-
- /* second buffer is the serialized caps;
- * the element also holds a ref to it */
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- buffers = g_list_remove (buffers, outbuffer);
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 2);
- length = GST_DP_HEADER_LENGTH + (strlen (caps_string) + 1);
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
- gst_buffer_unref (outbuffer);
-
- /* the third buffer is the GDP buffer for our pushed buffer */
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- buffers = g_list_remove (buffers, outbuffer);
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
- length = GST_DP_HEADER_LENGTH + 4;
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
- gst_buffer_unref (outbuffer);
-
- /* second buffer */
- GST_DEBUG ("second buffer");
- inbuffer = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (inbuffer, caps);
-
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
-
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- buffers = g_list_remove (buffers, outbuffer);
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
-
- /* the third output buffer is data */
- length = GST_DP_HEADER_LENGTH + 4;
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
- gst_buffer_unref (outbuffer);
-
- /* a third buffer without caps set explicitly; should work */
- GST_DEBUG ("Creating third buffer, no caps set");
- inbuffer = gst_buffer_new_and_alloc (4);
-
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
-
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- buffers = g_list_remove (buffers, outbuffer);
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
-
- /* the fourth output buffer is data */
- length = GST_DP_HEADER_LENGTH + 4;
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
- gst_buffer_unref (outbuffer);
-
-
- fail_unless (gst_element_set_state (gdppay,
- GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
-
- gst_caps_unref (caps);
- g_free (caps_string);
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
- ASSERT_OBJECT_REFCOUNT (gdppay, "gdppay", 1);
- cleanup_gdppay (gdppay);
-}
-
-GST_END_TEST;
-
-static GstStaticPadTemplate shsrctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-gst-test-streamheader")
- );
-
-
-static GstElement *
-setup_gdppay_streamheader (void)
-{
- GstElement *gdppay;
-
- GST_DEBUG ("setup_gdppay");
- gdppay = gst_check_setup_element ("gdppay");
- myshsrcpad = gst_check_setup_src_pad (gdppay, &shsrctemplate, NULL);
- mysinkpad = gst_check_setup_sink_pad (gdppay, &sinktemplate, NULL);
- gst_pad_set_active (myshsrcpad, TRUE);
- gst_pad_set_active (mysinkpad, TRUE);
-
- return gdppay;
-}
-
-/* this test serializes a stream that already has a streamheader of its own.
- * the streamheader should then be serialized and put on the GDP stream's
- * streamheader */
-GST_START_TEST (test_streamheader)
-{
- GstCaps *caps, *sinkcaps;
- GstElement *gdppay;
- GstBuffer *inbuffer, *outbuffer, *shbuffer;
- GstEvent *event;
- gchar *caps_string;
- gint length;
- GstStructure *structure;
- GValue array = { 0 };
- GValue value = { 0 };
- const GValue *sh;
- GArray *shbuffers;
-
-
- gdppay = setup_gdppay_streamheader ();
-
- fail_unless (gst_element_set_state (gdppay,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- GST_DEBUG ("new segment");
- event =
- gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, GST_SECOND, 0);
- fail_unless (gst_pad_push_event (myshsrcpad, event));
-
- /* no buffer should be pushed yet, still waiting for caps */
- fail_unless_equals_int (g_list_length (buffers), 0);
-
- GST_DEBUG ("first buffer");
- inbuffer = gst_buffer_new_and_alloc (4);
- memcpy (GST_BUFFER_DATA (inbuffer), "head", 4);
- caps = gst_caps_from_string ("application/x-gst-test-streamheader");
- structure = gst_caps_get_structure (caps, 0);
- GST_BUFFER_FLAG_SET (inbuffer, GST_BUFFER_FLAG_IN_CAPS);
- g_value_init (&array, GST_TYPE_ARRAY);
- g_value_init (&value, GST_TYPE_BUFFER);
- shbuffer = gst_buffer_copy (inbuffer);
- gst_value_set_buffer (&value, shbuffer);
- gst_buffer_unref (shbuffer);
- gst_value_array_append_value (&array, &value);
- g_value_unset (&value);
- gst_structure_set_value (structure, "streamheader", &array);
- g_value_unset (&array);
- caps_string = gst_caps_to_string (caps);
-
- gst_buffer_set_caps (inbuffer, caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference */
- fail_unless (gst_pad_push (myshsrcpad, inbuffer) == GST_FLOW_OK);
-
- /* we should have three buffers now */
- fail_unless_equals_int (g_list_length (buffers), 3);
-
- /* our sink pad should now have GDP caps with a streamheader that includes
- * GDP wrappings of our streamheader */
- sinkcaps = gst_pad_get_negotiated_caps (mysinkpad);
- structure = gst_caps_get_structure (sinkcaps, 0);
- fail_unless_equals_string ((gchar *) gst_structure_get_name (structure),
- "application/x-gdp");
- fail_unless (gst_structure_has_field (structure, "streamheader"));
- sh = gst_structure_get_value (structure, "streamheader");
- fail_unless (G_VALUE_TYPE (sh) == GST_TYPE_ARRAY);
- shbuffers = g_value_peek_pointer (sh);
- /* a serialized new_segment, a serialized caps, and serialization of our
- * incoming streamheader */
- fail_unless_equals_int (shbuffers->len, 3);
-
- gst_caps_unref (sinkcaps);
-
- /* first buffer is the serialized new_segment event;
- * the element also holds a ref to it */
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- buffers = g_list_remove (buffers, outbuffer);
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 2);
- gst_buffer_unref (outbuffer);
-
- /* second buffer is the serialized caps;
- * the element also holds a ref to it */
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- buffers = g_list_remove (buffers, outbuffer);
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 2);
- length = GST_DP_HEADER_LENGTH + (strlen (caps_string) + 1);
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
- gst_buffer_unref (outbuffer);
-
- /* the third buffer is the GDP buffer for our pushed buffer */
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- buffers = g_list_remove (buffers, outbuffer);
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
- length = GST_DP_HEADER_LENGTH + 4;
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
- gst_buffer_unref (outbuffer);
-
- /* second buffer */
- GST_DEBUG ("second buffer");
- inbuffer = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (inbuffer, caps);
-
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference */
- fail_unless (gst_pad_push (myshsrcpad, inbuffer) == GST_FLOW_OK);
-
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- buffers = g_list_remove (buffers, outbuffer);
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
-
- /* the third output buffer is data */
- length = GST_DP_HEADER_LENGTH + 4;
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
- gst_buffer_unref (outbuffer);
-
- /* a third buffer without caps set explicitly; should work */
- GST_DEBUG ("Creating third buffer, no caps set");
- inbuffer = gst_buffer_new_and_alloc (4);
-
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference */
- fail_unless (gst_pad_push (myshsrcpad, inbuffer) == GST_FLOW_OK);
-
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- buffers = g_list_remove (buffers, outbuffer);
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
-
- /* the fourth output buffer is data */
- length = GST_DP_HEADER_LENGTH + 4;
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
- gst_buffer_unref (outbuffer);
-
-
- fail_unless (gst_element_set_state (gdppay,
- GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
-
- gst_caps_unref (caps);
- g_free (caps_string);
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
- ASSERT_OBJECT_REFCOUNT (gdppay, "gdppay", 1);
- cleanup_gdppay (gdppay);
-}
-
-GST_END_TEST;
-
-
-GST_START_TEST (test_first_no_caps)
-{
- GstElement *gdppay;
- GstBuffer *inbuffer;
-
- gdppay = setup_gdppay ();
-
- fail_unless (gst_element_set_state (gdppay,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- GST_DEBUG ("first buffer");
- inbuffer = gst_buffer_new_and_alloc (4);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing should trigger an error */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_NOT_NEGOTIATED);
-
- fail_unless_equals_int (g_list_length (buffers), 0);
-
- fail_unless (gst_element_set_state (gdppay,
- GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
-
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
- ASSERT_OBJECT_REFCOUNT (gdppay, "gdppay", 1);
- cleanup_gdppay (gdppay);
-}
-
-GST_END_TEST;
-
-/* element should still work if no new_segment is sent before the first
- * buffer */
-GST_START_TEST (test_first_no_new_segment)
-{
- GstElement *gdppay;
- GstBuffer *inbuffer;
- GstCaps *caps;
-
- gdppay = setup_gdppay ();
-
- fail_unless (gst_element_set_state (gdppay,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- GST_DEBUG ("first buffer");
- inbuffer = gst_buffer_new_and_alloc (4);
- caps = gst_caps_from_string (AUDIO_CAPS_STRING);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
-
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
-
- /* we should have three buffers now;
- * one for an "invented" new segment, one for GDP caps, and one with our
- * buffer */
- fail_unless_equals_int (g_list_length (buffers), 3);
-
- fail_unless (gst_element_set_state (gdppay,
- GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
-
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
- ASSERT_OBJECT_REFCOUNT (gdppay, "gdppay", 1);
- cleanup_gdppay (gdppay);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_crc)
-{
- GstCaps *caps;
- GstElement *gdppay;
- GstBuffer *inbuffer, *outbuffer;
- GstEvent *event;
- gchar *caps_string;
- gint length;
- guint16 crc_calculated, crc_read;
-
- gdppay = setup_gdppay ();
- g_object_set (gdppay, "crc-header", TRUE, NULL);
-
- fail_unless (gst_element_set_state (gdppay,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- GST_DEBUG ("new segment");
- event =
- gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, GST_SECOND, 0);
- fail_unless (gst_pad_push_event (mysrcpad, event));
-
- /* no buffer should be pushed yet, waiting for caps */
- fail_unless_equals_int (g_list_length (buffers), 0);
-
- GST_DEBUG ("first buffer");
- inbuffer = gst_buffer_new_and_alloc (4);
- caps = gst_caps_from_string (AUDIO_CAPS_STRING);
- gst_buffer_set_caps (inbuffer, caps);
- caps_string = gst_caps_to_string (caps);
-
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
-
- /* we should have three buffers now */
- fail_unless_equals_int (g_list_length (buffers), 3);
-
- /* first buffer is the serialized new_segment event;
- * the element also holds a ref to it */
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- buffers = g_list_remove (buffers, outbuffer);
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 2);
-
- /* verify the header checksum */
- /* CRC's start at 58 in the header */
- crc_calculated = gst_dp_crc (GST_BUFFER_DATA (outbuffer), 58);
- crc_read = GST_READ_UINT16_BE (GST_BUFFER_DATA (outbuffer) + 58);
- fail_unless_equals_int (crc_calculated, crc_read);
-
- /* change a byte in the header and verify that the checksum now fails */
- GST_BUFFER_DATA (outbuffer)[0] = 0xff;
- crc_calculated = gst_dp_crc (GST_BUFFER_DATA (outbuffer), 58);
- fail_if (crc_calculated == crc_read,
- "Introducing a byte error in the header should make the checksum fail");
-
- gst_buffer_unref (outbuffer);
-
- /* second buffer is the serialized caps;
- * the element also holds a ref to it */
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- buffers = g_list_remove (buffers, outbuffer);
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 2);
- length = GST_DP_HEADER_LENGTH + (strlen (caps_string) + 1);
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
- gst_buffer_unref (outbuffer);
-
- /* the third buffer is the GDP buffer for our pushed buffer */
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- buffers = g_list_remove (buffers, outbuffer);
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
- length = GST_DP_HEADER_LENGTH + 4;
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), length);
- gst_buffer_unref (outbuffer);
-
- fail_unless (gst_element_set_state (gdppay,
- GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
-
- gst_caps_unref (caps);
- g_free (caps_string);
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
- ASSERT_OBJECT_REFCOUNT (gdppay, "gdppay", 1);
- cleanup_gdppay (gdppay);
-}
-
-GST_END_TEST;
-
-
-static Suite *
-gdppay_suite (void)
-{
- Suite *s = suite_create ("gdppay");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_audio);
- tcase_add_test (tc_chain, test_first_no_caps);
- tcase_add_test (tc_chain, test_first_no_new_segment);
- tcase_add_test (tc_chain, test_streamheader);
- tcase_add_test (tc_chain, test_crc);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = gdppay_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/elements/gnomevfssink.c b/tests/check/elements/gnomevfssink.c
deleted file mode 100644
index f0cf64d4..00000000
--- a/tests/check/elements/gnomevfssink.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/* GStreamer unit test for the gnomevfssink element
- *
- * Copyright (C) 2006 Thomas Vander Stichele <thomas at apestaart dot org>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-
-#include <glib.h>
-#include <glib/gstdio.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h> /* for close() */
-#endif
-
-#include <gst/check/gstcheck.h>
-
-static GstPad *mysrcpad;
-
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-static GstElement *
-setup_gnomevfssink (void)
-{
- GstElement *gnomevfssink;
-
- GST_DEBUG ("setup_gnomevfssink");
- gnomevfssink = gst_check_setup_element ("gnomevfssink");
- mysrcpad = gst_check_setup_src_pad (gnomevfssink, &srctemplate, NULL);
- gst_pad_set_active (mysrcpad, TRUE);
- return gnomevfssink;
-}
-
-static void
-cleanup_gnomevfssink (GstElement * gnomevfssink)
-{
- gst_pad_set_active (mysrcpad, FALSE);
- gst_check_teardown_src_pad (gnomevfssink);
- gst_check_teardown_element (gnomevfssink);
-}
-
-#if 0
-/* this queries via the element vfunc, which is currently not implemented */
-#define CHECK_QUERY_POSITION(gnomevfssink,format,position) \
- G_STMT_START { \
- GstFormat fmt = format; \
- gint64 pos; \
- fail_unless (gst_element_query_position (gnomevfssink, &fmt, &pos)); \
- fail_unless_equals_int (pos, position); \
- } G_STMT_END
-#else
-#define CHECK_QUERY_POSITION(gnomevfssink,format,position) \
- G_STMT_START { \
- GstFormat fmt = format; \
- GstPad *pad; \
- gint64 pos; \
- pad = gst_element_get_static_pad (gnomevfssink, "sink"); \
- fail_unless (gst_pad_query_position (pad, &fmt, &pos)); \
- fail_unless_equals_int (pos, position); \
- gst_object_unref (pad); \
- } G_STMT_END
-#endif
-
-#define PUSH_BYTES(num_bytes) \
- G_STMT_START { \
- GstBuffer *buf = gst_buffer_new_and_alloc(num_bytes); \
- GRand *rand = g_rand_new_with_seed (num_bytes); \
- guint i; \
- for (i = 0; i < num_bytes; ++i) \
- GST_BUFFER_DATA(buf)[i] = (g_rand_int (rand) >> 24) & 0xff; \
- fail_unless_equals_int (gst_pad_push (mysrcpad, buf), GST_FLOW_OK); \
- g_rand_free (rand); \
- } G_STMT_END
-
-/* TODO: we don't check that the data is actually written to the right
- * position after a seek */
-GST_START_TEST (test_seeking)
-{
- const gchar *tmpdir;
- GstElement *gnomevfssink;
- gchar *tmp_fn;
- gint fd;
-
- tmpdir = g_get_tmp_dir ();
- if (tmpdir == NULL)
- return;
-
- /* this is just silly, but gcc warns if we try to use tpmnam() */
- tmp_fn =
- g_build_filename (tmpdir, "gstreamer-gnomevfssink-test-XXXXXX", NULL);
- fd = g_mkstemp (tmp_fn);
- if (fd < 0) {
- GST_ERROR ("can't create temp file %s: %s", tmp_fn, g_strerror (errno));
- g_free (tmp_fn);
- return;
- }
- /* don't want the file, just a filename (hence silly, see above) */
- close (fd);
- g_remove (tmp_fn);
-
- gnomevfssink = setup_gnomevfssink ();
-
- GST_LOG ("using temp file '%s'", tmp_fn);
- g_object_set (gnomevfssink, "location", tmp_fn, NULL);
-
- fail_unless_equals_int (gst_element_set_state (gnomevfssink,
- GST_STATE_PLAYING), GST_STATE_CHANGE_ASYNC);
-
-#if 0
- /* Test that gnomevfssink is seekable with a file fd */
- /* gnomevfssink doesn't implement seekable query at the moment */
- GstQuery *seeking_query;
- gboolean seekable;
-
- fail_unless ((seeking_query = gst_query_new_seeking (GST_FORMAT_BYTES))
- != NULL);
- fail_unless (gst_element_query (gnomevfssink, seeking_query) == TRUE);
- gst_query_parse_seeking (seeking_query, NULL, &seekable, NULL, NULL);
- fail_unless (seekable == TRUE);
- gst_query_unref (seeking_query);
-#endif
-
- fail_unless (gst_pad_push_event (mysrcpad,
- gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_BYTES, 0, -1, 0)));
-
- CHECK_QUERY_POSITION (gnomevfssink, GST_FORMAT_BYTES, 0);
-
- /* push buffer with size 0 and NULL data */
- PUSH_BYTES (0);
- CHECK_QUERY_POSITION (gnomevfssink, GST_FORMAT_BYTES, 0);
-
- PUSH_BYTES (1);
- CHECK_QUERY_POSITION (gnomevfssink, GST_FORMAT_BYTES, 1);
-
- PUSH_BYTES (99);
- CHECK_QUERY_POSITION (gnomevfssink, GST_FORMAT_BYTES, 100);
-
- PUSH_BYTES (8800);
- CHECK_QUERY_POSITION (gnomevfssink, GST_FORMAT_BYTES, 8900);
-
- if (gst_pad_push_event (mysrcpad,
- gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_BYTES, 8800, -1,
- 0))) {
- GST_LOG ("seek ok");
- /* make sure that that new position is reported immediately */
- CHECK_QUERY_POSITION (gnomevfssink, GST_FORMAT_BYTES, 8800);
- PUSH_BYTES (1);
- CHECK_QUERY_POSITION (gnomevfssink, GST_FORMAT_BYTES, 8801);
- PUSH_BYTES (9256);
- CHECK_QUERY_POSITION (gnomevfssink, GST_FORMAT_BYTES, 18057);
- } else {
- GST_INFO ("seeking not supported for tempfile?!");
- }
-
- fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
-
- fail_unless_equals_int (gst_element_set_state (gnomevfssink, GST_STATE_NULL),
- GST_STATE_CHANGE_SUCCESS);
-
- /* cleanup */
- cleanup_gnomevfssink (gnomevfssink);
-
- /* check that we wrote data to the right position after the seek */
- {
- gchar *data = NULL;
- gsize len;
-
- fail_unless (g_file_get_contents (tmp_fn, &data, &len, NULL),
- "Failed to read in newly-created file '%s'", tmp_fn);
- fail_unless_equals_int (len, 18057);
- {
- /* we wrote 9256 bytes at position 8801 */
- GRand *rand = g_rand_new_with_seed (9256);
- guint i;
-
- for (i = 0; i < 9256; ++i) {
- guint8 byte_written = *(((guint8 *) data) + 8801 + i);
-
- fail_unless_equals_int (byte_written, g_rand_int (rand) >> 24);
- }
- g_rand_free (rand);
- }
- g_free (data);
- }
-
- /* remove file */
- g_remove (tmp_fn);
- g_free (tmp_fn);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_coverage)
-{
- GstElement *gnomevfssink;
- gchar *location;
- GstBus *bus;
- GstMessage *message;
-
- gnomevfssink = setup_gnomevfssink ();
- bus = gst_bus_new ();
-
- gst_element_set_bus (gnomevfssink, bus);
-
- g_object_set (gnomevfssink, "location", "/i/do/not/exist", NULL);
- g_object_get (gnomevfssink, "location", &location, NULL);
- fail_unless_equals_string (location, "/i/do/not/exist");
- g_free (location);
-
- fail_unless_equals_int (gst_element_set_state (gnomevfssink,
- GST_STATE_PLAYING), GST_STATE_CHANGE_FAILURE);
-
- /* a state change and an error */
- fail_if ((message = gst_bus_pop (bus)) == NULL);
- fail_unless_message_error (message, RESOURCE, OPEN_WRITE);
- gst_message_unref (message);
-
- g_object_set (gnomevfssink, "location", NULL, NULL);
- g_object_get (gnomevfssink, "location", &location, NULL);
- fail_if (location);
-
- /* cleanup */
- gst_element_set_bus (gnomevfssink, NULL);
- gst_object_unref (GST_OBJECT (bus));
- cleanup_gnomevfssink (gnomevfssink);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_uri_interface)
-{
- GstElement *gnomevfssink;
- gchar *location;
- GstBus *bus;
-
- gnomevfssink = setup_gnomevfssink ();
- bus = gst_bus_new ();
-
- gst_element_set_bus (gnomevfssink, bus);
-
- g_object_set (G_OBJECT (gnomevfssink), "location", "/i/do/not/exist", NULL);
- g_object_get (G_OBJECT (gnomevfssink), "location", &location, NULL);
- fail_unless_equals_string (location, "/i/do/not/exist");
- g_free (location);
-
- location = (gchar *) gst_uri_handler_get_uri (GST_URI_HANDLER (gnomevfssink));
- fail_unless_equals_string (location, "file://%2Fi%2Fdo%2Fnot%2Fexist");
-
- /* should accept file:///foo/bar URIs */
- fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (gnomevfssink),
- "file:///foo/bar"));
- location = (gchar *) gst_uri_handler_get_uri (GST_URI_HANDLER (gnomevfssink));
- fail_unless_equals_string (location, "file://%2Ffoo%2Fbar");
- g_object_get (G_OBJECT (gnomevfssink), "location", &location, NULL);
- fail_unless_equals_string (location, "/foo/bar");
- g_free (location);
-
- /* should accept file://localhost/foo/bar URIs */
- fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (gnomevfssink),
- "file://localhost/foo/baz"));
- location = (gchar *) gst_uri_handler_get_uri (GST_URI_HANDLER (gnomevfssink));
- fail_unless_equals_string (location, "file://%2Ffoo%2Fbaz");
- g_object_get (G_OBJECT (gnomevfssink), "location", &location, NULL);
- fail_unless_equals_string (location, "/foo/baz");
- g_free (location);
-
- /* should fail with other hostnames */
- fail_if (gst_uri_handler_set_uri (GST_URI_HANDLER (gnomevfssink),
- "file://hostname/foo/foo"));
-
- /* cleanup */
- gst_element_set_bus (gnomevfssink, NULL);
- gst_object_unref (GST_OBJECT (bus));
- cleanup_gnomevfssink (gnomevfssink);
-}
-
-GST_END_TEST;
-
-static Suite *
-gnomevfssink_suite (void)
-{
- Suite *s = suite_create ("gnomevfssink");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
-
- /* FIXME: these two tests fail right now because of uri/location stuff */
- if (0) {
- tcase_add_test (tc_chain, test_coverage);
- tcase_add_test (tc_chain, test_uri_interface);
- }
- tcase_add_test (tc_chain, test_seeking);
-
- return s;
-}
-
-GST_CHECK_MAIN (gnomevfssink);
diff --git a/tests/check/elements/libvisual.c b/tests/check/elements/libvisual.c
deleted file mode 100644
index 0f950060..00000000
--- a/tests/check/elements/libvisual.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/* GStreamer unit test for libvisual plugin
- *
- * Copyright (C) 2007 Tim-Philipp Müller <tim at 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <gst/check/gstcheck.h>
-
-static gboolean
-filter_func (GstPluginFeature * feature, gpointer user_data)
-{
- return (g_str_has_prefix (GST_PLUGIN_FEATURE_NAME (feature), "libvisual_"));
-}
-
-static void
-test_shutdown_for_factory (const gchar * factory_name)
-{
- GstElement *pipeline, *src, *q, *ac, *vis, *cf, *q2, *sink;
- GstCaps *caps;
- guint i;
-
- pipeline = gst_pipeline_new (NULL);
-
- src = gst_check_setup_element ("audiotestsrc");
- q = gst_check_setup_element ("queue");
- ac = gst_check_setup_element ("audioconvert");
-
- GST_INFO ("Using %s", factory_name);
- vis = gst_check_setup_element (factory_name);
-
- cf = gst_check_setup_element ("capsfilter");
- caps = gst_caps_new_simple ("video/x-raw-rgb", "width", G_TYPE_INT, 320,
- "height", G_TYPE_INT, 240, "framerate", GST_TYPE_FRACTION, 15, 1, NULL);
- g_object_set (cf, "caps", caps, NULL);
- gst_caps_unref (caps);
-
- q2 = gst_check_setup_element ("queue");
- gst_object_set_name (GST_OBJECT (q2), "queue2");
- sink = gst_check_setup_element ("fakesink");
-
- /* don't want to sync against the clock, the more throughput the better */
- g_object_set (src, "is-live", FALSE, NULL);
- g_object_set (sink, "sync", FALSE, NULL);
-
- gst_bin_add_many (GST_BIN (pipeline), src, q, ac, vis, cf, q2, sink, NULL);
- fail_if (!gst_element_link_many (src, q, ac, vis, cf, q2, sink, NULL));
-
- /* now, wait until pipeline is running and then shut it down again; repeat;
- * this makes sure we can shut down cleanly while stuff is going on in the
- * chain function */
- for (i = 0; i < 50; ++i) {
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- gst_element_get_state (pipeline, NULL, NULL, -1);
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_usleep (100);
- gst_element_set_state (pipeline, GST_STATE_NULL);
- }
-
- gst_object_unref (pipeline);
-}
-
-GST_START_TEST (test_shutdown)
-{
- const gchar *factory_to_test;
-
- factory_to_test = g_getenv ("LIBVISUAL_UNIT_TEST_FACTORY");
-
- if (factory_to_test == NULL) {
- GList *list, *l;
-
- list = gst_default_registry_feature_filter (filter_func, FALSE, NULL);
- if (list == NULL) {
- g_print ("No libvisual plugins installed.\n");
- return;
- }
- for (l = list; l != NULL; l = l->next) {
- test_shutdown_for_factory (GST_PLUGIN_FEATURE_NAME (l->data));
- }
- gst_plugin_feature_list_free (list);
- } else {
- test_shutdown_for_factory (factory_to_test);
- }
-}
-
-GST_END_TEST;
-
-static Suite *
-libvisual_suite (void)
-{
- Suite *s = suite_create ("libvisual");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
-
- /* set one manually, since we're currently built as uninst program with
- * the default timeout of 3 seconds, which is way too short */
- tcase_set_timeout (tc_chain, 30);
-
- tcase_add_test (tc_chain, test_shutdown);
-
- return s;
-}
-
-GST_CHECK_MAIN (libvisual);
diff --git a/tests/check/elements/multifdsink.c b/tests/check/elements/multifdsink.c
deleted file mode 100644
index a45230bf..00000000
--- a/tests/check/elements/multifdsink.c
+++ /dev/null
@@ -1,881 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2006 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <unistd.h>
-#include <sys/ioctl.h>
-#ifdef HAVE_FIONREAD_IN_SYS_FILIO
-#include <sys/filio.h>
-#endif
-
-#include <gst/check/gstcheck.h>
-
-static GstPad *mysrcpad;
-
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-gst-check")
- );
-
-static GstElement *
-setup_multifdsink (void)
-{
- GstElement *multifdsink;
-
- GST_DEBUG ("setup_multifdsink");
- multifdsink = gst_check_setup_element ("multifdsink");
- mysrcpad = gst_check_setup_src_pad (multifdsink, &srctemplate, NULL);
-
- return multifdsink;
-}
-
-static void
-cleanup_multifdsink (GstElement * multifdsink)
-{
- GST_DEBUG ("cleanup_multifdsink");
-
- gst_check_teardown_src_pad (multifdsink);
- gst_check_teardown_element (multifdsink);
-}
-
-static void
-wait_bytes_served (GstElement * sink, guint64 bytes)
-{
- guint64 bytes_served = 0;
-
- while (bytes_served != bytes) {
- g_object_get (sink, "bytes-served", &bytes_served, NULL);
- }
-}
-
-/* FIXME: possibly racy, since if it would write, we may not get it
- * immediately ? */
-#define fail_if_can_read(msg,fd) \
-G_STMT_START { \
- long avail; \
-\
- fail_if (ioctl (fd, FIONREAD, &avail) < 0, "%s: could not ioctl", msg); \
- fail_if (avail > 0, "%s: has bytes available to read"); \
-} G_STMT_END;
-
-
-GST_START_TEST (test_no_clients)
-{
- GstElement *sink;
- GstBuffer *buffer;
- GstCaps *caps;
-
- sink = setup_multifdsink ();
-
- ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
-
- caps = gst_caps_from_string ("application/x-gst-check");
- buffer = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (buffer, caps);
- gst_caps_unref (caps);
- fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
-
- GST_DEBUG ("cleaning up multifdsink");
- ASSERT_SET_STATE (sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
- cleanup_multifdsink (sink);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_add_client)
-{
- GstElement *sink;
- GstBuffer *buffer;
- GstCaps *caps;
- int pfd[2];
- gchar data[4];
-
- sink = setup_multifdsink ();
-
- fail_if (pipe (pfd) == -1);
-
- ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
-
- /* add the client */
- g_signal_emit_by_name (sink, "add", pfd[1]);
-
- caps = gst_caps_from_string ("application/x-gst-check");
- GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
- buffer = gst_buffer_new_and_alloc (4);
- gst_buffer_set_caps (buffer, caps);
- ASSERT_CAPS_REFCOUNT (caps, "caps", 2);
- memcpy (GST_BUFFER_DATA (buffer), "dead", 4);
- fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
-
- GST_DEBUG ("reading");
- fail_if (read (pfd[0], data, 4) < 4);
- fail_unless (strncmp (data, "dead", 4) == 0);
- wait_bytes_served (sink, 4);
-
- GST_DEBUG ("cleaning up multifdsink");
- ASSERT_SET_STATE (sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
- cleanup_multifdsink (sink);
-
- ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
- gst_caps_unref (caps);
-}
-
-GST_END_TEST;
-
-#define fail_unless_read(msg,fd,size,ref) \
-G_STMT_START { \
- char data[size + 1]; \
- int nbytes; \
-\
- GST_DEBUG ("%s: reading %d bytes", msg, size); \
- nbytes = read (fd, data, size); \
- data[size] = 0; \
- GST_DEBUG ("%s: read %d bytes", msg, nbytes); \
- fail_if (nbytes < size); \
- fail_unless (memcmp (data, ref, size) == 0, \
- "data read '%s' differs from '%s'", data, ref); \
-} G_STMT_END;
-
-/* from the given two data buffers, create two streamheader buffers and
- * some caps that match it, and store them in the given pointers
- * returns one ref to each of the buffers and the caps */
-static void
-gst_multifdsink_create_streamheader (const gchar * data1,
- const gchar * data2, GstBuffer ** hbuf1, GstBuffer ** hbuf2,
- GstCaps ** caps)
-{
- GstBuffer *buf;
- GValue array = { 0 };
- GValue value = { 0 };
- GstStructure *structure;
- guint size1 = strlen (data1);
- guint size2 = strlen (data2);
-
- fail_if (hbuf1 == NULL);
- fail_if (hbuf2 == NULL);
- fail_if (caps == NULL);
-
- /* create caps with streamheader, set the caps, and push the IN_CAPS
- * buffers */
- *hbuf1 = gst_buffer_new_and_alloc (size1);
- GST_BUFFER_FLAG_SET (*hbuf1, GST_BUFFER_FLAG_IN_CAPS);
- memcpy (GST_BUFFER_DATA (*hbuf1), data1, size1);
- *hbuf2 = gst_buffer_new_and_alloc (size2);
- GST_BUFFER_FLAG_SET (*hbuf2, GST_BUFFER_FLAG_IN_CAPS);
- memcpy (GST_BUFFER_DATA (*hbuf2), data2, size2);
- /* we want to keep them around for the tests */
- gst_buffer_ref (*hbuf1);
- gst_buffer_ref (*hbuf2);
-
- g_value_init (&array, GST_TYPE_ARRAY);
-
- g_value_init (&value, GST_TYPE_BUFFER);
- /* we take a copy, set it on the array (which refs it), then unref our copy */
- buf = gst_buffer_copy (*hbuf1);
- gst_value_set_buffer (&value, buf);
- ASSERT_BUFFER_REFCOUNT (buf, "copied buffer", 2);
- gst_buffer_unref (buf);
- gst_value_array_append_value (&array, &value);
- g_value_unset (&value);
-
- g_value_init (&value, GST_TYPE_BUFFER);
- buf = gst_buffer_copy (*hbuf2);
- gst_value_set_buffer (&value, buf);
- ASSERT_BUFFER_REFCOUNT (buf, "copied buffer", 2);
- gst_buffer_unref (buf);
- gst_value_array_append_value (&array, &value);
- g_value_unset (&value);
-
- *caps = gst_caps_from_string ("application/x-gst-check");
- structure = gst_caps_get_structure (*caps, 0);
-
- gst_structure_set_value (structure, "streamheader", &array);
- g_value_unset (&array);
- ASSERT_CAPS_REFCOUNT (*caps, "streamheader caps", 1);
-
- /* set our streamheadery caps on the buffers */
- gst_buffer_set_caps (*hbuf1, *caps);
- gst_buffer_set_caps (*hbuf2, *caps);
- ASSERT_CAPS_REFCOUNT (*caps, "streamheader caps", 3);
-
- GST_DEBUG ("created streamheader caps %p %" GST_PTR_FORMAT, *caps, *caps);
-}
-
-
-/* this test:
- * - adds a first client
- * - sets streamheader caps on the pad
- * - pushes the IN_CAPS buffers
- * - pushes a buffer
- * - verifies that the client received all the data correctly, and did not
- * get multiple copies of the streamheader
- * - adds a second client
- * - verifies that this second client receives the streamheader caps too, plus
- * - the new buffer
- */
-GST_START_TEST (test_streamheader)
-{
- GstElement *sink;
- GstBuffer *hbuf1, *hbuf2, *buf;
- GstCaps *caps;
- int pfd1[2], pfd2[2];
-
- sink = setup_multifdsink ();
-
- fail_if (pipe (pfd1) == -1);
- fail_if (pipe (pfd2) == -1);
-
- ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
-
- /* add the first client */
- g_signal_emit_by_name (sink, "add", pfd1[1]);
-
- /* create caps with streamheader, set the caps, and push the IN_CAPS
- * buffers */
- gst_multifdsink_create_streamheader ("babe", "deadbeef", &hbuf1, &hbuf2,
- &caps);
- fail_unless (gst_pad_set_caps (mysrcpad, caps));
- /* one is ours, two on the buffers, and one now on the pad */
- ASSERT_CAPS_REFCOUNT (caps, "caps", 4);
-
- fail_unless (gst_pad_push (mysrcpad, hbuf1) == GST_FLOW_OK);
- fail_unless (gst_pad_push (mysrcpad, hbuf2) == GST_FLOW_OK);
-
- //FIXME:
- //fail_if_can_read ("first client", pfd1[0]);
-
- /* push a non-IN_CAPS buffer, this should trigger the client receiving the
- * first three buffers */
- buf = gst_buffer_new_and_alloc (4);
- memcpy (GST_BUFFER_DATA (buf), "f00d", 4);
- gst_pad_push (mysrcpad, buf);
-
- fail_unless_read ("first client", pfd1[0], 4, "babe");
- fail_unless_read ("first client", pfd1[0], 8, "deadbeef");
- fail_unless_read ("first client", pfd1[0], 4, "f00d");
- wait_bytes_served (sink, 16);
-
- /* now add the second client */
- g_signal_emit_by_name (sink, "add", pfd2[1]);
- //FIXME:
- //fail_if_can_read ("second client", pfd2[0]);
-
- /* now push another buffer, which will trigger streamheader for second
- * client */
- buf = gst_buffer_new_and_alloc (4);
- memcpy (GST_BUFFER_DATA (buf), "deaf", 4);
- gst_pad_push (mysrcpad, buf);
-
- fail_unless_read ("first client", pfd1[0], 4, "deaf");
-
- fail_unless_read ("second client", pfd2[0], 4, "babe");
- fail_unless_read ("second client", pfd2[0], 8, "deadbeef");
- /* we missed the f00d buffer */
- fail_unless_read ("second client", pfd2[0], 4, "deaf");
- wait_bytes_served (sink, 36);
-
- GST_DEBUG ("cleaning up multifdsink");
-
- g_signal_emit_by_name (sink, "remove", pfd1[1]);
- g_signal_emit_by_name (sink, "remove", pfd2[1]);
-
- ASSERT_SET_STATE (sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
- cleanup_multifdsink (sink);
-
- ASSERT_BUFFER_REFCOUNT (hbuf1, "hbuf1", 1);
- ASSERT_BUFFER_REFCOUNT (hbuf2, "hbuf2", 1);
- gst_buffer_unref (hbuf1);
- gst_buffer_unref (hbuf2);
-
- ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
- gst_caps_unref (caps);
-}
-
-GST_END_TEST;
-
-/* this tests changing of streamheaders
- * - set streamheader caps on the pad
- * - pushes the IN_CAPS buffers
- * - pushes a buffer
- * - add a first client
- * - verifies that this first client receives the first streamheader caps,
- * plus a new buffer
- * - change streamheader caps
- * - verify that the first client receives the new streamheader buffers as well
- */
-GST_START_TEST (test_change_streamheader)
-{
- GstElement *sink;
- GstBuffer *hbuf1, *hbuf2, *buf;
- GstCaps *caps;
- int pfd1[2], pfd2[2];
-
- sink = setup_multifdsink ();
-
- fail_if (pipe (pfd1) == -1);
- fail_if (pipe (pfd2) == -1);
-
- ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
-
- /* create caps with streamheader, set the caps, and push the IN_CAPS
- * buffers */
- gst_multifdsink_create_streamheader ("first", "header", &hbuf1, &hbuf2,
- &caps);
- fail_unless (gst_pad_set_caps (mysrcpad, caps));
- /* one is ours, two on the buffers, and one now on the pad */
- ASSERT_CAPS_REFCOUNT (caps, "caps", 4);
-
- /* one to hold for the test and one to give away */
- ASSERT_BUFFER_REFCOUNT (hbuf1, "hbuf1", 2);
- ASSERT_BUFFER_REFCOUNT (hbuf2, "hbuf2", 2);
-
- fail_unless (gst_pad_push (mysrcpad, hbuf1) == GST_FLOW_OK);
- fail_unless (gst_pad_push (mysrcpad, hbuf2) == GST_FLOW_OK);
-
- /* add the first client */
- g_signal_emit_by_name (sink, "add", pfd1[1]);
-
- /* verify this hasn't triggered a write yet */
- /* FIXME: possibly racy, since if it would write, we may not get it
- * immediately ? */
- //fail_if_can_read ("first client, no buffer", pfd1[0]);
-
- /* now push a buffer and read */
- buf = gst_buffer_new_and_alloc (4);
- memcpy (GST_BUFFER_DATA (buf), "f00d", 4);
- gst_pad_push (mysrcpad, buf);
-
- fail_unless_read ("change: first client", pfd1[0], 5, "first");
- fail_unless_read ("change: first client", pfd1[0], 6, "header");
- fail_unless_read ("change: first client", pfd1[0], 4, "f00d");
- //wait_bytes_served (sink, 16);
-
- /* now add the second client */
- g_signal_emit_by_name (sink, "add", pfd2[1]);
- //fail_if_can_read ("second client, no buffer", pfd2[0]);
-
- /* change the streamheader */
-
- /* before we change, multifdsink still has a list of the old streamheaders */
- ASSERT_BUFFER_REFCOUNT (hbuf1, "hbuf1", 2);
- ASSERT_BUFFER_REFCOUNT (hbuf2, "hbuf2", 2);
- gst_buffer_unref (hbuf1);
- gst_buffer_unref (hbuf2);
-
- /* drop our ref to the previous caps */
- gst_caps_unref (caps);
-
- gst_multifdsink_create_streamheader ("second", "header", &hbuf1, &hbuf2,
- &caps);
- fail_unless (gst_pad_set_caps (mysrcpad, caps));
- /* one to hold for the test and one to give away */
- ASSERT_BUFFER_REFCOUNT (hbuf1, "hbuf1", 2);
- ASSERT_BUFFER_REFCOUNT (hbuf2, "hbuf2", 2);
-
- fail_unless (gst_pad_push (mysrcpad, hbuf1) == GST_FLOW_OK);
- fail_unless (gst_pad_push (mysrcpad, hbuf2) == GST_FLOW_OK);
-
- /* verify neither client has new data available to read */
- //fail_if_can_read ("first client, changed streamheader", pfd1[0]);
- //fail_if_can_read ("second client, changed streamheader", pfd2[0]);
-
- /* now push another buffer, which will trigger streamheader for second
- * client, but should also send new streamheaders to first client */
- buf = gst_buffer_new_and_alloc (8);
- memcpy (GST_BUFFER_DATA (buf), "deadbabe", 8);
- gst_pad_push (mysrcpad, buf);
-
- fail_unless_read ("first client", pfd1[0], 6, "second");
- fail_unless_read ("first client", pfd1[0], 6, "header");
- fail_unless_read ("first client", pfd1[0], 8, "deadbabe");
-
- /* new streamheader data */
- fail_unless_read ("second client", pfd2[0], 6, "second");
- fail_unless_read ("second client", pfd2[0], 6, "header");
- /* we missed the f00d buffer */
- fail_unless_read ("second client", pfd2[0], 8, "deadbabe");
- //wait_bytes_served (sink, 36);
-
- GST_DEBUG ("cleaning up multifdsink");
- g_signal_emit_by_name (sink, "remove", pfd1[1]);
- g_signal_emit_by_name (sink, "remove", pfd2[1]);
- ASSERT_SET_STATE (sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
-
- /* setting to NULL should have cleared the streamheader */
- ASSERT_BUFFER_REFCOUNT (hbuf1, "hbuf1", 1);
- ASSERT_BUFFER_REFCOUNT (hbuf2, "hbuf2", 1);
- gst_buffer_unref (hbuf1);
- gst_buffer_unref (hbuf2);
- cleanup_multifdsink (sink);
-
- ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
- gst_caps_unref (caps);
-}
-
-GST_END_TEST;
-
-/* keep 100 bytes and burst 80 bytes to clients */
-GST_START_TEST (test_burst_client_bytes)
-{
- GstElement *sink;
- GstBuffer *buffer;
- GstCaps *caps;
- int pfd1[2];
- int pfd2[2];
- int pfd3[2];
- gchar data[16];
- gint i;
- guint buffers_queued;
-
- sink = setup_multifdsink ();
- /* make sure we keep at least 100 bytes at all times */
- g_object_set (sink, "bytes-min", 100, NULL);
- g_object_set (sink, "sync-method", 3, NULL); /* 3 = burst */
- g_object_set (sink, "burst-unit", 3, NULL); /* 3 = bytes */
- g_object_set (sink, "burst-value", (guint64) 80, NULL);
-
- fail_if (pipe (pfd1) == -1);
- fail_if (pipe (pfd2) == -1);
- fail_if (pipe (pfd3) == -1);
-
- ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
-
- caps = gst_caps_from_string ("application/x-gst-check");
- GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
-
- /* push buffers in, 9 * 16 bytes = 144 bytes */
- for (i = 0; i < 9; i++) {
- gchar *data;
-
- buffer = gst_buffer_new_and_alloc (16);
- gst_buffer_set_caps (buffer, caps);
-
- /* copy some id */
- data = (gchar *) GST_BUFFER_DATA (buffer);
- g_snprintf (data, 16, "deadbee%08x", i);
-
- fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
- }
-
- /* check that at least 7 buffers (112 bytes) are in the queue */
- g_object_get (sink, "buffers-queued", &buffers_queued, NULL);
- fail_if (buffers_queued != 7);
-
- /* now add the clients */
- g_signal_emit_by_name (sink, "add", pfd1[1]);
- g_signal_emit_by_name (sink, "add_full", pfd2[1], 3,
- 3, (guint64) 50, 3, (guint64) 200);
- g_signal_emit_by_name (sink, "add_full", pfd3[1], 3,
- 3, (guint64) 50, 3, (guint64) 50);
-
- /* push last buffer to make client fds ready for reading */
- for (i = 9; i < 10; i++) {
- gchar *data;
-
- buffer = gst_buffer_new_and_alloc (16);
- gst_buffer_set_caps (buffer, caps);
-
- /* copy some id */
- data = (gchar *) GST_BUFFER_DATA (buffer);
- g_snprintf (data, 16, "deadbee%08x", i);
-
- fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
- }
-
- /* now we should only read the last 5 buffers (5 * 16 = 80 bytes) */
- GST_DEBUG ("Reading from client 1");
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000005", 16) == 0);
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000006", 16) == 0);
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000007", 16) == 0);
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000008", 16) == 0);
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000009", 16) == 0);
-
- /* second client only bursts 50 bytes = 4 buffers (we get 4 buffers since
- * the max alows it) */
- GST_DEBUG ("Reading from client 2");
- fail_if (read (pfd2[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000006", 16) == 0);
- fail_if (read (pfd2[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000007", 16) == 0);
- fail_if (read (pfd2[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000008", 16) == 0);
- fail_if (read (pfd2[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000009", 16) == 0);
-
- /* third client only bursts 50 bytes = 4 buffers, we can't send
- * more than 50 bytes so we only get 3 buffers (48 bytes). */
- GST_DEBUG ("Reading from client 3");
- fail_if (read (pfd3[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000007", 16) == 0);
- fail_if (read (pfd3[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000008", 16) == 0);
- fail_if (read (pfd3[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000009", 16) == 0);
-
- GST_DEBUG ("cleaning up multifdsink");
- ASSERT_SET_STATE (sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
- cleanup_multifdsink (sink);
-
- ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
- gst_caps_unref (caps);
-}
-
-GST_END_TEST;
-
-/* keep 100 bytes and burst 80 bytes to clients */
-GST_START_TEST (test_burst_client_bytes_keyframe)
-{
- GstElement *sink;
- GstBuffer *buffer;
- GstCaps *caps;
- int pfd1[2];
- int pfd2[2];
- int pfd3[2];
- gchar data[16];
- gint i;
- guint buffers_queued;
-
- sink = setup_multifdsink ();
- /* make sure we keep at least 100 bytes at all times */
- g_object_set (sink, "bytes-min", 100, NULL);
- g_object_set (sink, "sync-method", 4, NULL); /* 3 = burst_keyframe */
- g_object_set (sink, "burst-unit", 3, NULL); /* 3 = bytes */
- g_object_set (sink, "burst-value", (guint64) 80, NULL);
-
- fail_if (pipe (pfd1) == -1);
- fail_if (pipe (pfd2) == -1);
- fail_if (pipe (pfd3) == -1);
-
- ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
-
- caps = gst_caps_from_string ("application/x-gst-check");
- GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
-
- /* push buffers in, 9 * 16 bytes = 144 bytes */
- for (i = 0; i < 9; i++) {
- gchar *data;
-
- buffer = gst_buffer_new_and_alloc (16);
- gst_buffer_set_caps (buffer, caps);
-
- /* mark most buffers as delta */
- if (i != 0 && i != 4 && i != 8)
- GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
-
- /* copy some id */
- data = (gchar *) GST_BUFFER_DATA (buffer);
- g_snprintf (data, 16, "deadbee%08x", i);
-
- fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
- }
-
- /* check that at least 7 buffers (112 bytes) are in the queue */
- g_object_get (sink, "buffers-queued", &buffers_queued, NULL);
- fail_if (buffers_queued != 7);
-
- /* now add the clients */
- g_signal_emit_by_name (sink, "add", pfd1[1]);
- g_signal_emit_by_name (sink, "add_full", pfd2[1], 4,
- 3, (guint64) 50, 3, (guint64) 90);
- g_signal_emit_by_name (sink, "add_full", pfd3[1], 4,
- 3, (guint64) 50, 3, (guint64) 50);
-
- /* push last buffer to make client fds ready for reading */
- for (i = 9; i < 10; i++) {
- gchar *data;
-
- buffer = gst_buffer_new_and_alloc (16);
- gst_buffer_set_caps (buffer, caps);
- GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
-
- /* copy some id */
- data = (gchar *) GST_BUFFER_DATA (buffer);
- g_snprintf (data, 16, "deadbee%08x", i);
-
- fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
- }
-
- /* now we should only read the last 6 buffers (min 5 * 16 = 80 bytes),
- * keyframe at buffer 4 */
- GST_DEBUG ("Reading from client 1");
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000004", 16) == 0);
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000005", 16) == 0);
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000006", 16) == 0);
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000007", 16) == 0);
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000008", 16) == 0);
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000009", 16) == 0);
-
- /* second client only bursts 50 bytes = 4 buffers, there is
- * no keyframe above min and below max, so get one below min */
- GST_DEBUG ("Reading from client 2");
- fail_if (read (pfd2[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000008", 16) == 0);
- fail_if (read (pfd2[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000009", 16) == 0);
-
- /* third client only bursts 50 bytes = 4 buffers, we can't send
- * more than 50 bytes so we only get 2 buffers (32 bytes). */
- GST_DEBUG ("Reading from client 3");
- fail_if (read (pfd3[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000008", 16) == 0);
- fail_if (read (pfd3[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000009", 16) == 0);
-
- GST_DEBUG ("cleaning up multifdsink");
- ASSERT_SET_STATE (sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
- cleanup_multifdsink (sink);
-
- ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
- gst_caps_unref (caps);
-}
-
-GST_END_TEST;
-
-/* keep 100 bytes and burst 80 bytes to clients */
-GST_START_TEST (test_burst_client_bytes_with_keyframe)
-{
- GstElement *sink;
- GstBuffer *buffer;
- GstCaps *caps;
- int pfd1[2];
- int pfd2[2];
- int pfd3[2];
- gchar data[16];
- gint i;
- guint buffers_queued;
-
- sink = setup_multifdsink ();
- /* make sure we keep at least 100 bytes at all times */
- g_object_set (sink, "bytes-min", 100, NULL);
- g_object_set (sink, "sync-method", 5, NULL); /* 3 = burst_with_keyframe */
- g_object_set (sink, "burst-unit", 3, NULL); /* 3 = bytes */
- g_object_set (sink, "burst-value", (guint64) 80, NULL);
-
- fail_if (pipe (pfd1) == -1);
- fail_if (pipe (pfd2) == -1);
- fail_if (pipe (pfd3) == -1);
-
- ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
-
- caps = gst_caps_from_string ("application/x-gst-check");
- GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
-
- /* push buffers in, 9 * 16 bytes = 144 bytes */
- for (i = 0; i < 9; i++) {
- gchar *data;
-
- buffer = gst_buffer_new_and_alloc (16);
- gst_buffer_set_caps (buffer, caps);
-
- /* mark most buffers as delta */
- if (i != 0 && i != 4 && i != 8)
- GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
-
- /* copy some id */
- data = (gchar *) GST_BUFFER_DATA (buffer);
- g_snprintf (data, 16, "deadbee%08x", i);
-
- fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
- }
-
- /* check that at least 7 buffers (112 bytes) are in the queue */
- g_object_get (sink, "buffers-queued", &buffers_queued, NULL);
- fail_if (buffers_queued != 7);
-
- /* now add the clients */
- g_signal_emit_by_name (sink, "add", pfd1[1]);
- g_signal_emit_by_name (sink, "add_full", pfd2[1], 5,
- 3, (guint64) 50, 3, (guint64) 90);
- g_signal_emit_by_name (sink, "add_full", pfd3[1], 5,
- 3, (guint64) 50, 3, (guint64) 50);
-
- /* push last buffer to make client fds ready for reading */
- for (i = 9; i < 10; i++) {
- gchar *data;
-
- buffer = gst_buffer_new_and_alloc (16);
- gst_buffer_set_caps (buffer, caps);
- GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
-
- /* copy some id */
- data = (gchar *) GST_BUFFER_DATA (buffer);
- g_snprintf (data, 16, "deadbee%08x", i);
-
- fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
- }
-
- /* now we should only read the last 6 buffers (min 5 * 16 = 80 bytes),
- * keyframe at buffer 4 */
- GST_DEBUG ("Reading from client 1");
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000004", 16) == 0);
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000005", 16) == 0);
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000006", 16) == 0);
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000007", 16) == 0);
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000008", 16) == 0);
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000009", 16) == 0);
-
- /* second client only bursts 50 bytes = 4 buffers, there is
- * no keyframe above min and below max, so send min */
- GST_DEBUG ("Reading from client 2");
- fail_if (read (pfd2[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000006", 16) == 0);
- fail_if (read (pfd2[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000007", 16) == 0);
- fail_if (read (pfd2[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000008", 16) == 0);
- fail_if (read (pfd2[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000009", 16) == 0);
-
- /* third client only bursts 50 bytes = 4 buffers, we can't send
- * more than 50 bytes so we only get 3 buffers (48 bytes). */
- GST_DEBUG ("Reading from client 3");
- fail_if (read (pfd3[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000007", 16) == 0);
- fail_if (read (pfd3[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000008", 16) == 0);
- fail_if (read (pfd3[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000009", 16) == 0);
-
- GST_DEBUG ("cleaning up multifdsink");
- ASSERT_SET_STATE (sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
- cleanup_multifdsink (sink);
-
- ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
- gst_caps_unref (caps);
-}
-
-GST_END_TEST;
-
-/* Check that we can get data when multifdsink is configured in next-keyframe
- * mode */
-GST_START_TEST (test_client_next_keyframe)
-{
- GstElement *sink;
- GstBuffer *buffer;
- GstCaps *caps;
- int pfd1[2];
- gchar data[16];
- gint i;
-
- sink = setup_multifdsink ();
- g_object_set (sink, "sync-method", 1, NULL); /* 1 = next-keyframe */
-
- fail_if (pipe (pfd1) == -1);
-
- ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
-
- caps = gst_caps_from_string ("application/x-gst-check");
- GST_DEBUG ("Created test caps %p %" GST_PTR_FORMAT, caps, caps);
-
- /* now add our client */
- g_signal_emit_by_name (sink, "add", pfd1[1]);
-
- /* push buffers in: keyframe, then non-keyframe */
- for (i = 0; i < 2; i++) {
- gchar *data;
-
- buffer = gst_buffer_new_and_alloc (16);
- gst_buffer_set_caps (buffer, caps);
-
- /* copy some id */
- data = (gchar *) GST_BUFFER_DATA (buffer);
- g_snprintf (data, 16, "deadbee%08x", i);
- if (i > 0)
- GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
-
- fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
- }
-
- /* now we should be able to read some data */
- GST_DEBUG ("Reading from client 1");
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000000", 16) == 0);
- fail_if (read (pfd1[0], data, 16) < 16);
- fail_unless (strncmp (data, "deadbee00000001", 16) == 0);
-
- GST_DEBUG ("cleaning up multifdsink");
- ASSERT_SET_STATE (sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
- cleanup_multifdsink (sink);
-
- ASSERT_CAPS_REFCOUNT (caps, "caps", 1);
- gst_caps_unref (caps);
-}
-
-GST_END_TEST;
-
-/* FIXME: add test simulating chained oggs where:
- * sync-method is burst-on-connect
- * (when multifdsink actually does burst-on-connect based on byte size, not
- "last keyframe" which any frame for audio :))
- * an old client still needs to read from before the new streamheaders
- * a new client gets the new streamheaders
- */
-static Suite *
-multifdsink_suite (void)
-{
- Suite *s = suite_create ("multifdsink");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_no_clients);
- tcase_add_test (tc_chain, test_add_client);
- tcase_add_test (tc_chain, test_streamheader);
- tcase_add_test (tc_chain, test_change_streamheader);
- tcase_add_test (tc_chain, test_burst_client_bytes);
- tcase_add_test (tc_chain, test_burst_client_bytes_keyframe);
- tcase_add_test (tc_chain, test_burst_client_bytes_with_keyframe);
- tcase_add_test (tc_chain, test_client_next_keyframe);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = multifdsink_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/elements/playbin.c b/tests/check/elements/playbin.c
deleted file mode 100644
index f285df40..00000000
--- a/tests/check/elements/playbin.c
+++ /dev/null
@@ -1,652 +0,0 @@
-/* GStreamer unit tests for playbin
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gst/check/gstcheck.h>
-#include <gst/base/gstpushsrc.h>
-#include <unistd.h>
-
-#ifndef GST_DISABLE_REGISTRY
-
-static GType gst_red_video_src_get_type (void);
-static GType gst_codec_src_get_type (void);
-
-#define DEFINE_TEST(func) \
- static void func (void); \
- \
- GST_START_TEST(func ## _decodebin1) \
- { g_unsetenv("USE_DECODEBIN2"); func(); } \
- GST_END_TEST; \
- \
- GST_START_TEST(func ## _decodebin2) \
- { g_setenv("USE_DECODEBIN2", "1", TRUE); func(); } \
- GST_END_TEST;
-
-DEFINE_TEST (test_sink_usage_video_only_stream);
-
-/* make sure the audio sink is not touched for video-only streams */
-static void
-test_sink_usage_video_only_stream (void)
-{
- GstElement *playbin, *fakevideosink, *fakeaudiosink;
- GstState cur_state, pending_state;
-
- fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
- gst_red_video_src_get_type ()));
-
- playbin = gst_element_factory_make ("playbin", "playbin");
- fail_unless (playbin != NULL, "Failed to create playbin element");
-
- fakevideosink = gst_element_factory_make ("fakesink", "fakevideosink");
- fail_unless (fakevideosink != NULL, "Failed to create fakevideosink element");
-
- fakeaudiosink = gst_element_factory_make ("fakesink", "fakeaudiosink");
- fail_unless (fakeaudiosink != NULL, "Failed to create fakeaudiosink element");
-
- /* video-only stream, audiosink will error out in null => ready if used */
- g_object_set (fakeaudiosink, "state-error", 1, NULL);
-
- g_object_set (playbin, "video-sink", fakevideosink, NULL);
- g_object_set (playbin, "audio-sink", fakeaudiosink, NULL);
-
- g_object_set (playbin, "uri", "redvideo://", NULL);
-
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
- GST_STATE_CHANGE_ASYNC);
- fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL, -1),
- GST_STATE_CHANGE_SUCCESS);
-
- fail_unless_equals_int (gst_element_get_state (fakeaudiosink, &cur_state,
- &pending_state, 0), GST_STATE_CHANGE_SUCCESS);
- fail_unless_equals_int (cur_state, GST_STATE_NULL);
- fail_unless_equals_int (pending_state, GST_STATE_VOID_PENDING);
-
- {
- GValueArray *stream_info = NULL;
-
- g_object_get (playbin, "stream-info-value-array", &stream_info, NULL);
- fail_unless (stream_info != NULL);
- fail_unless_equals_int (stream_info->n_values, 1);
- g_value_array_free (stream_info);
- }
-
- gst_element_set_state (playbin, GST_STATE_NULL);
- gst_object_unref (playbin);
-}
-
-/* this tests async error handling when setting up the subbin */
-DEFINE_TEST (test_suburi_error_unknowntype);
-
-static void
-test_suburi_error_unknowntype (void)
-{
- GstElement *playbin, *fakesink;
-
- fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
- gst_red_video_src_get_type ()));
-
- playbin = gst_element_factory_make ("playbin", "playbin");
- fail_unless (playbin != NULL, "Failed to create playbin element");
-
- fakesink = gst_element_factory_make ("fakesink", "fakesink");
- fail_unless (fakesink != NULL, "Failed to create fakesink element");
- ASSERT_OBJECT_REFCOUNT (fakesink, "fakesink after creation", 1);
-
- g_object_set (playbin, "video-sink", fakesink, NULL);
-
- /* suburi file format unknown: playbin should just ignore the suburi and
- * preroll normally (if /dev/zero does not exist, this test should behave
- * the same as test_suburi_error_invalidfile() */
- g_object_set (playbin, "uri", "redvideo://", NULL);
- g_object_set (playbin, "suburi", "file:///dev/zero", NULL);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
- GST_STATE_CHANGE_ASYNC);
- fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL, -1),
- GST_STATE_CHANGE_SUCCESS);
-
- gst_element_set_state (playbin, GST_STATE_NULL);
- gst_object_unref (playbin);
-}
-
-DEFINE_TEST (test_suburi_error_invalidfile);
-
-static void
-test_suburi_error_invalidfile (void)
-{
- GstElement *playbin, *fakesink;
-
- fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
- gst_red_video_src_get_type ()));
-
- playbin = gst_element_factory_make ("playbin", "playbin");
- fail_unless (playbin != NULL, "Failed to create playbin element");
-
- fakesink = gst_element_factory_make ("fakesink", "fakesink");
- fail_unless (fakesink != NULL, "Failed to create fakesink element");
- ASSERT_OBJECT_REFCOUNT (fakesink, "fakesink after creation", 1);
-
- g_object_set (playbin, "video-sink", fakesink, NULL);
-
- /* suburi file does not exist: playbin should just ignore the suburi and
- * preroll normally */
- g_object_set (playbin, "uri", "redvideo://", NULL);
- g_object_set (playbin, "suburi", "file:///foo/bar/803129999/32x9ax1", NULL);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
- GST_STATE_CHANGE_ASYNC);
- fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL, -1),
- GST_STATE_CHANGE_SUCCESS);
-
- gst_element_set_state (playbin, GST_STATE_NULL);
- gst_object_unref (playbin);
-}
-
-DEFINE_TEST (test_suburi_error_wrongproto);
-
-static void
-test_suburi_error_wrongproto (void)
-{
- GstElement *playbin, *fakesink;
-
- fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
- gst_red_video_src_get_type ()));
-
- playbin = gst_element_factory_make ("playbin", "playbin");
- fail_unless (playbin != NULL, "Failed to create playbin element");
-
- fakesink = gst_element_factory_make ("fakesink", "fakesink");
- fail_unless (fakesink != NULL, "Failed to create fakesink element");
- ASSERT_OBJECT_REFCOUNT (fakesink, "fakesink after creation", 1);
-
- g_object_set (playbin, "video-sink", fakesink, NULL);
-
- /* wrong protocol for suburi: playbin should just ignore the suburi and
- * preroll normally */
- g_object_set (playbin, "uri", "redvideo://", NULL);
- g_object_set (playbin, "suburi", "nosuchproto://foo.bar:80", NULL);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
- GST_STATE_CHANGE_ASYNC);
- fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL, -1),
- GST_STATE_CHANGE_SUCCESS);
-
- gst_element_set_state (playbin, GST_STATE_NULL);
- gst_object_unref (playbin);
-}
-
-static GstElement *
-create_playbin (const gchar * uri)
-{
- GstElement *playbin, *fakesink1, *fakesink2;
-
- playbin = gst_element_factory_make ("playbin", "playbin");
- fail_unless (playbin != NULL, "Failed to create playbin element");
-
- fakesink1 = gst_element_factory_make ("fakesink", NULL);
- fail_unless (fakesink1 != NULL, "Failed to create fakesink element #1");
-
- fakesink2 = gst_element_factory_make ("fakesink", NULL);
- fail_unless (fakesink2 != NULL, "Failed to create fakesink element #2");
-
- /* make them behave like normal sinks, even if not needed for the test */
- g_object_set (fakesink1, "sync", TRUE, NULL);
- g_object_set (fakesink2, "sync", TRUE, NULL);
-
- g_object_set (playbin, "video-sink", fakesink1, NULL);
- g_object_set (playbin, "audio-sink", fakesink2, NULL);
-
- g_object_set (playbin, "uri", uri, NULL);
-
- return playbin;
-}
-
-DEFINE_TEST (test_missing_urisource_handler);
-
-static void
-test_missing_urisource_handler (void)
-{
- GstStructure *s;
- GstMessage *msg;
- GstElement *playbin;
- GError *err = NULL;
- GstBus *bus;
-
- playbin = create_playbin ("chocchipcookie://withahint.of/cinnamon");
-
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
- GST_STATE_CHANGE_FAILURE);
-
- /* there should be at least a missing-plugin message on the bus now and an
- * error message; the missing-plugin message should be first */
- bus = gst_element_get_bus (playbin);
-
- msg = gst_bus_poll (bus, GST_MESSAGE_ELEMENT | GST_MESSAGE_ERROR, -1);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
- fail_unless (msg->structure != NULL);
- s = msg->structure;
- fail_unless (gst_structure_has_name (s, "missing-plugin"));
- fail_unless (gst_structure_has_field_typed (s, "detail", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "detail"),
- "chocchipcookie");
- fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "type"), "urisource");
- gst_message_unref (msg);
-
- msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, -1);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ERROR);
-
- /* make sure the error is a CORE MISSING_PLUGIN one */
- gst_message_parse_error (msg, &err, NULL);
- fail_unless (err != NULL);
- fail_unless (err->domain == GST_CORE_ERROR, "error has wrong error domain "
- "%s instead of core-error-quark", g_quark_to_string (err->domain));
- fail_unless (err->code == GST_CORE_ERROR_MISSING_PLUGIN, "error has wrong "
- "code %u instead of GST_CORE_ERROR_MISSING_PLUGIN", err->code);
- g_error_free (err);
- gst_message_unref (msg);
- gst_object_unref (bus);
-
- gst_element_set_state (playbin, GST_STATE_NULL);
- gst_object_unref (playbin);
-}
-
-DEFINE_TEST (test_missing_suburisource_handler);
-
-static void
-test_missing_suburisource_handler (void)
-{
- GstStructure *s;
- GstMessage *msg;
- GstElement *playbin;
- GError *err = NULL;
- GstBus *bus;
-
- playbin = create_playbin ("file:///does/not/exis.t");
-
- g_object_set (playbin, "suburi", "cookie://withahint.of/cinnamon", NULL);
-
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
- GST_STATE_CHANGE_FAILURE);
-
- /* there should be at least a missing-plugin message on the bus now and an
- * error message; the missing-plugin message should be first */
- bus = gst_element_get_bus (playbin);
-
- msg = gst_bus_poll (bus, GST_MESSAGE_ELEMENT | GST_MESSAGE_ERROR, -1);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
- fail_unless (msg->structure != NULL);
- s = msg->structure;
- fail_unless (gst_structure_has_name (s, "missing-plugin"));
- fail_unless (gst_structure_has_field_typed (s, "detail", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "detail"), "cookie");
- fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "type"), "urisource");
- gst_message_unref (msg);
-
- msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, -1);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ERROR);
-
- /* make sure the error is a CORE MISSING_PLUGIN one */
- gst_message_parse_error (msg, &err, NULL);
- fail_unless (err != NULL);
- fail_unless (err->domain == GST_CORE_ERROR, "error has wrong error domain "
- "%s instead of core-error-quark", g_quark_to_string (err->domain));
- fail_unless (err->code == GST_CORE_ERROR_MISSING_PLUGIN, "error has wrong "
- "code %u instead of GST_CORE_ERROR_MISSING_PLUGIN", err->code);
- g_error_free (err);
- gst_message_unref (msg);
- gst_object_unref (bus);
-
- gst_element_set_state (playbin, GST_STATE_NULL);
- gst_object_unref (playbin);
-}
-
-DEFINE_TEST (test_missing_primary_decoder);
-
-static void
-test_missing_primary_decoder (void)
-{
- GstStructure *s;
- GstMessage *msg;
- GstElement *playbin;
- GError *err = NULL;
- GstBus *bus;
- gchar *use_decodebin2 = getenv ("USE_DECODEBIN2");
- gboolean decodebin2 = use_decodebin2 != NULL && *use_decodebin2 == '1';
-
- fail_unless (gst_element_register (NULL, "codecsrc", GST_RANK_PRIMARY,
- gst_codec_src_get_type ()));
-
- playbin = create_playbin ("codec://");
-
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
- GST_STATE_CHANGE_ASYNC);
-
- /* there should soon be at least a missing-plugin message on the bus and an
- * error message; the missing-plugin message should be first */
- bus = gst_element_get_bus (playbin);
-
- msg = gst_bus_poll (bus, GST_MESSAGE_ELEMENT | GST_MESSAGE_ERROR, -1);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
- fail_unless (msg->structure != NULL);
- s = msg->structure;
- fail_unless (gst_structure_has_name (s, "missing-plugin"));
- fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "type"), "decoder");
- fail_unless (gst_structure_has_field_typed (s, "detail", GST_TYPE_CAPS));
- gst_message_unref (msg);
-
- msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, -1);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ERROR);
-
- /* make sure the error is a STREAM CODEC_NOT_FOUND one */
- gst_message_parse_error (msg, &err, NULL);
- fail_unless (err != NULL);
- if (decodebin2) {
- fail_unless (err->domain == GST_CORE_ERROR, "error has wrong error domain "
- "%s instead of core-error-quark", g_quark_to_string (err->domain));
- fail_unless (err->code == GST_CORE_ERROR_MISSING_PLUGIN, "error has wrong "
- "code %u instead of GST_RESOURCE_ERROR_MISSING_PLUGIN", err->code);
- } else {
- fail_unless (err->domain == GST_STREAM_ERROR,
- "error has wrong error domain " "%s instead of stream-error-quark",
- g_quark_to_string (err->domain));
- fail_unless (err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND,
- "error has wrong "
- "code %u instead of GST_STREAM_ERROR_CODEC_NOT_FOUND", err->code);
- }
- g_error_free (err);
- gst_message_unref (msg);
- gst_object_unref (bus);
-
- gst_element_set_state (playbin, GST_STATE_NULL);
- gst_object_unref (playbin);
-}
-
-/*** redvideo:// source ***/
-
-static GstURIType
-gst_red_video_src_uri_get_type (void)
-{
- return GST_URI_SRC;
-}
-
-static gchar **
-gst_red_video_src_uri_get_protocols (void)
-{
- static gchar *protocols[] = { "redvideo", NULL };
-
- return protocols;
-}
-
-static const gchar *
-gst_red_video_src_uri_get_uri (GstURIHandler * handler)
-{
- return "redvideo://";
-}
-
-static gboolean
-gst_red_video_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
-{
- return (uri != NULL && g_str_has_prefix (uri, "redvideo:"));
-}
-
-static void
-gst_red_video_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
-{
- GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
-
- iface->get_type = gst_red_video_src_uri_get_type;
- iface->get_protocols = gst_red_video_src_uri_get_protocols;
- iface->get_uri = gst_red_video_src_uri_get_uri;
- iface->set_uri = gst_red_video_src_uri_set_uri;
-}
-
-static void
-gst_red_video_src_init_type (GType type)
-{
- static const GInterfaceInfo uri_hdlr_info = {
- gst_red_video_src_uri_handler_init, NULL, NULL
- };
-
- g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &uri_hdlr_info);
-}
-
-typedef GstPushSrc GstRedVideoSrc;
-typedef GstPushSrcClass GstRedVideoSrcClass;
-
-GST_BOILERPLATE_FULL (GstRedVideoSrc, gst_red_video_src, GstPushSrc,
- GST_TYPE_PUSH_SRC, gst_red_video_src_init_type);
-
-static void
-gst_red_video_src_base_init (gpointer klass)
-{
- static const GstElementDetails details =
- GST_ELEMENT_DETAILS ("Red Video Src", "Source/Video", "yep", "me");
- static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC, GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-yuv, format=(fourcc)I420")
- );
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_templ));
- gst_element_class_set_details (element_class, &details);
-}
-
-static GstFlowReturn
-gst_red_video_src_create (GstPushSrc * src, GstBuffer ** p_buf)
-{
- GstBuffer *buf;
- GstCaps *caps;
- guint8 *data;
- guint w = 64, h = 64;
- guint size;
-
- size = w * h * 3 / 2;
- buf = gst_buffer_new_and_alloc (size);
- data = GST_BUFFER_DATA (buf);
- memset (data, 76, w * h);
- memset (data + (w * h), 85, (w * h) / 4);
- memset (data + (w * h) + ((w * h) / 4), 255, (w * h) / 4);
-
- caps = gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC,
- GST_MAKE_FOURCC ('I', '4', '2', '0'), "width", G_TYPE_INT, w, "height",
- G_TYPE_INT, h, "framerate", GST_TYPE_FRACTION, 1, 1, NULL);
- gst_buffer_set_caps (buf, caps);
- gst_caps_unref (caps);
-
- *p_buf = buf;
- return GST_FLOW_OK;
-}
-
-static void
-gst_red_video_src_class_init (GstRedVideoSrcClass * klass)
-{
- GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
-
- pushsrc_class->create = gst_red_video_src_create;
-}
-
-static void
-gst_red_video_src_init (GstRedVideoSrc * src, GstRedVideoSrcClass * klass)
-{
-}
-
-/*** codec:// source ***/
-
-static GstURIType
-gst_codec_src_uri_get_type (void)
-{
- return GST_URI_SRC;
-}
-
-static gchar **
-gst_codec_src_uri_get_protocols (void)
-{
- static gchar *protocols[] = { "codec", NULL };
-
- return protocols;
-}
-
-static const gchar *
-gst_codec_src_uri_get_uri (GstURIHandler * handler)
-{
- return "codec://";
-}
-
-static gboolean
-gst_codec_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
-{
- return (uri != NULL && g_str_has_prefix (uri, "codec:"));
-}
-
-static void
-gst_codec_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
-{
- GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
-
- iface->get_type = gst_codec_src_uri_get_type;
- iface->get_protocols = gst_codec_src_uri_get_protocols;
- iface->get_uri = gst_codec_src_uri_get_uri;
- iface->set_uri = gst_codec_src_uri_set_uri;
-}
-
-static void
-gst_codec_src_init_type (GType type)
-{
- static const GInterfaceInfo uri_hdlr_info = {
- gst_codec_src_uri_handler_init, NULL, NULL
- };
-
- g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &uri_hdlr_info);
-}
-
-#undef parent_class
-#define parent_class codec_src_parent_class
-
-typedef GstPushSrc GstCodecSrc;
-typedef GstPushSrcClass GstCodecSrcClass;
-
-GST_BOILERPLATE_FULL (GstCodecSrc, gst_codec_src, GstPushSrc,
- GST_TYPE_PUSH_SRC, gst_codec_src_init_type);
-
-static void
-gst_codec_src_base_init (gpointer klass)
-{
- static const GstElementDetails details =
- GST_ELEMENT_DETAILS ("Codec Src", "Source/Video", "yep", "me");
- static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC, GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-codec")
- );
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_templ));
- gst_element_class_set_details (element_class, &details);
-}
-
-static GstFlowReturn
-gst_codec_src_create (GstPushSrc * src, GstBuffer ** p_buf)
-{
- GstBuffer *buf;
- GstCaps *caps;
-
- buf = gst_buffer_new_and_alloc (20);
- memset (GST_BUFFER_DATA (buf), 0, GST_BUFFER_SIZE (buf));
-
- caps = gst_caps_new_simple ("application/x-codec", NULL);
- gst_buffer_set_caps (buf, caps);
- gst_caps_unref (caps);
-
- *p_buf = buf;
- return GST_FLOW_OK;
-}
-
-static void
-gst_codec_src_class_init (GstCodecSrcClass * klass)
-{
- GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
-
- pushsrc_class->create = gst_codec_src_create;
-}
-
-static void
-gst_codec_src_init (GstCodecSrc * src, GstCodecSrcClass * klass)
-{
-}
-
-#endif /* GST_DISABLE_REGISTRY */
-
-
-static Suite *
-playbin_suite (void)
-{
- Suite *s = suite_create ("playbin");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
-
-#ifndef GST_DISABLE_REGISTRY
- /* with the old decodebin */
- tcase_add_test (tc_chain, test_sink_usage_video_only_stream_decodebin1);
- tcase_add_test (tc_chain, test_suburi_error_wrongproto_decodebin1);
- tcase_add_test (tc_chain, test_suburi_error_invalidfile_decodebin1);
- tcase_add_test (tc_chain, test_suburi_error_unknowntype_decodebin1);
- tcase_add_test (tc_chain, test_missing_urisource_handler_decodebin1);
- tcase_add_test (tc_chain, test_missing_suburisource_handler_decodebin1);
- tcase_add_test (tc_chain, test_missing_primary_decoder_decodebin1);
-
- /* and again with decodebin2 */
- tcase_add_test (tc_chain, test_missing_primary_decoder_decodebin2);
- tcase_add_test (tc_chain, test_sink_usage_video_only_stream_decodebin2);
- tcase_add_test (tc_chain, test_suburi_error_wrongproto_decodebin2);
- tcase_add_test (tc_chain, test_suburi_error_invalidfile_decodebin2);
- tcase_add_test (tc_chain, test_suburi_error_unknowntype_decodebin2);
- tcase_add_test (tc_chain, test_missing_urisource_handler_decodebin2);
- tcase_add_test (tc_chain, test_missing_suburisource_handler_decodebin2);
-
- /* one day we might also want to have the following checks:
- * tcase_add_test (tc_chain, test_missing_secondary_decoder_one_fatal);
- * tcase_add_test (tc_chain, test_missing_secondary_decoder_two_fatal);
- * tcase_add_test (tc_chain, test_missing_secondary_decoder_two_with_preroll);
- */
-#endif
-
- return s;
-}
-
-GST_CHECK_MAIN (playbin);
diff --git a/tests/check/elements/playbin2.c b/tests/check/elements/playbin2.c
deleted file mode 100644
index a90dc84b..00000000
--- a/tests/check/elements/playbin2.c
+++ /dev/null
@@ -1,712 +0,0 @@
-/* GStreamer unit tests for playbin2
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gst/check/gstcheck.h>
-#include <gst/base/gstpushsrc.h>
-#include <unistd.h>
-
-#ifndef GST_DISABLE_REGISTRY
-
-static GType gst_red_video_src_get_type (void);
-static GType gst_codec_src_get_type (void);
-
-/* make sure the audio sink is not touched for video-only streams */
-GST_START_TEST (test_sink_usage_video_only_stream)
-{
- GstElement *playbin, *fakevideosink, *fakeaudiosink;
- GstState cur_state, pending_state;
- GstElement *source;
- GstBuffer *last_frame;
- gint nstreams;
-
- fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
- gst_red_video_src_get_type ()));
-
- playbin = gst_element_factory_make ("playbin2", "playbin2");
- fail_unless (playbin != NULL, "Failed to create playbin element");
-
- fakevideosink = gst_element_factory_make ("fakesink", "fakevideosink");
- fail_unless (fakevideosink != NULL, "Failed to create fakevideosink element");
-
- fakeaudiosink = gst_element_factory_make ("fakesink", "fakeaudiosink");
- fail_unless (fakeaudiosink != NULL, "Failed to create fakeaudiosink element");
-
- /* video-only stream, audiosink will error out in null => ready if used */
- g_object_set (fakeaudiosink, "state-error", 1, NULL);
-
- g_object_set (playbin, "video-sink", fakevideosink, NULL);
- g_object_set (playbin, "audio-sink", fakeaudiosink, NULL);
-
- g_object_set (playbin, "uri", "redvideo://", NULL);
-
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
- GST_STATE_CHANGE_ASYNC);
- fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL, -1),
- GST_STATE_CHANGE_SUCCESS);
-
- fail_unless_equals_int (gst_element_get_state (fakeaudiosink, &cur_state,
- &pending_state, 0), GST_STATE_CHANGE_SUCCESS);
- fail_unless_equals_int (cur_state, GST_STATE_NULL);
- fail_unless_equals_int (pending_state, GST_STATE_VOID_PENDING);
-
- g_object_get (playbin, "n-video", &nstreams, NULL);
- fail_unless_equals_int (nstreams, 1);
-
- g_object_get (playbin, "n-audio", &nstreams, NULL);
- fail_unless_equals_int (nstreams, 0);
-
- g_object_get (playbin, "n-text", &nstreams, NULL);
- fail_unless_equals_int (nstreams, 0);
-
- g_object_get (playbin, "source", &source, NULL);
- fail_unless (G_TYPE_FROM_INSTANCE (source) == gst_red_video_src_get_type ());
- gst_object_unref (source);
-
- g_object_get (playbin, "frame", &last_frame, NULL);
- fail_unless (GST_IS_BUFFER (last_frame));
- gst_buffer_unref (last_frame);
-
- gst_element_set_state (playbin, GST_STATE_NULL);
- gst_object_unref (playbin);
-}
-
-GST_END_TEST;
-
-/* this tests async error handling when setting up the subbin */
-GST_START_TEST (test_suburi_error_unknowntype)
-{
- GstElement *playbin, *fakesink;
-
- fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
- gst_red_video_src_get_type ()));
-
- playbin = gst_element_factory_make ("playbin2", "playbin2");
- fail_unless (playbin != NULL, "Failed to create playbin element");
-
- fakesink = gst_element_factory_make ("fakesink", "fakesink");
- fail_unless (fakesink != NULL, "Failed to create fakesink element");
- ASSERT_OBJECT_REFCOUNT (fakesink, "fakesink after creation", 1);
-
- g_object_set (playbin, "video-sink", fakesink, NULL);
-
- /* suburi file format unknown: playbin should just ignore the suburi and
- * preroll normally (if /dev/zero does not exist, this test should behave
- * the same as test_suburi_error_invalidfile() */
- g_object_set (playbin, "uri", "redvideo://", NULL);
- g_object_set (playbin, "suburi", "file:///dev/zero", NULL);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
- GST_STATE_CHANGE_ASYNC);
- fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL, -1),
- GST_STATE_CHANGE_SUCCESS);
-
- gst_element_set_state (playbin, GST_STATE_NULL);
- gst_object_unref (playbin);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_suburi_error_invalidfile)
-{
- GstElement *playbin, *fakesink;
-
- fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
- gst_red_video_src_get_type ()));
-
- playbin = gst_element_factory_make ("playbin2", "playbin2");
- fail_unless (playbin != NULL, "Failed to create playbin element");
-
- fakesink = gst_element_factory_make ("fakesink", "fakesink");
- fail_unless (fakesink != NULL, "Failed to create fakesink element");
- ASSERT_OBJECT_REFCOUNT (fakesink, "fakesink after creation", 1);
-
- g_object_set (playbin, "video-sink", fakesink, NULL);
-
- /* suburi file does not exist: playbin should just ignore the suburi and
- * preroll normally */
- g_object_set (playbin, "uri", "redvideo://", NULL);
- g_object_set (playbin, "suburi", "file:///foo/bar/803129999/32x9ax1", NULL);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
- GST_STATE_CHANGE_ASYNC);
- fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL, -1),
- GST_STATE_CHANGE_SUCCESS);
-
- gst_element_set_state (playbin, GST_STATE_NULL);
- gst_object_unref (playbin);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_suburi_error_wrongproto)
-{
- GstElement *playbin, *fakesink;
-
- fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
- gst_red_video_src_get_type ()));
-
- playbin = gst_element_factory_make ("playbin2", "playbin2");
- fail_unless (playbin != NULL, "Failed to create playbin element");
-
- fakesink = gst_element_factory_make ("fakesink", "fakesink");
- fail_unless (fakesink != NULL, "Failed to create fakesink element");
- ASSERT_OBJECT_REFCOUNT (fakesink, "fakesink after creation", 1);
-
- g_object_set (playbin, "video-sink", fakesink, NULL);
-
- /* wrong protocol for suburi: playbin should just ignore the suburi and
- * preroll normally */
- g_object_set (playbin, "uri", "redvideo://", NULL);
- g_object_set (playbin, "suburi", "nosuchproto://foo.bar:80", NULL);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
- GST_STATE_CHANGE_ASYNC);
- fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL, -1),
- GST_STATE_CHANGE_SUCCESS);
-
- gst_element_set_state (playbin, GST_STATE_NULL);
- gst_object_unref (playbin);
-}
-
-GST_END_TEST;
-
-static GstElement *
-create_playbin (const gchar * uri)
-{
- GstElement *playbin, *fakesink1, *fakesink2;
-
- playbin = gst_element_factory_make ("playbin2", "playbin2");
- fail_unless (playbin != NULL, "Failed to create playbin element");
-
- fakesink1 = gst_element_factory_make ("fakesink", NULL);
- fail_unless (fakesink1 != NULL, "Failed to create fakesink element #1");
-
- fakesink2 = gst_element_factory_make ("fakesink", NULL);
- fail_unless (fakesink2 != NULL, "Failed to create fakesink element #2");
-
- /* make them behave like normal sinks, even if not needed for the test */
- g_object_set (fakesink1, "sync", TRUE, NULL);
- g_object_set (fakesink2, "sync", TRUE, NULL);
-
- g_object_set (playbin, "video-sink", fakesink1, NULL);
- g_object_set (playbin, "audio-sink", fakesink2, NULL);
-
- g_object_set (playbin, "uri", uri, NULL);
-
- return playbin;
-}
-
-GST_START_TEST (test_missing_urisource_handler)
-{
- GstStructure *s;
- GstMessage *msg;
- GstElement *playbin;
- GError *err = NULL;
- GstBus *bus;
-
- playbin = create_playbin ("chocchipcookie://withahint.of/cinnamon");
-
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
- GST_STATE_CHANGE_FAILURE);
-
- /* there should be at least a missing-plugin message on the bus now and an
- * error message; the missing-plugin message should be first */
- bus = gst_element_get_bus (playbin);
-
- msg = gst_bus_poll (bus, GST_MESSAGE_ELEMENT | GST_MESSAGE_ERROR, -1);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
- fail_unless (msg->structure != NULL);
- s = msg->structure;
- fail_unless (gst_structure_has_name (s, "missing-plugin"));
- fail_unless (gst_structure_has_field_typed (s, "detail", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "detail"),
- "chocchipcookie");
- fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "type"), "urisource");
- gst_message_unref (msg);
-
- msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, -1);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ERROR);
-
- /* make sure the error is a CORE MISSING_PLUGIN one */
- gst_message_parse_error (msg, &err, NULL);
- fail_unless (err != NULL);
- fail_unless (err->domain == GST_CORE_ERROR, "error has wrong error domain "
- "%s instead of core-error-quark", g_quark_to_string (err->domain));
- fail_unless (err->code == GST_CORE_ERROR_MISSING_PLUGIN, "error has wrong "
- "code %u instead of GST_CORE_ERROR_MISSING_PLUGIN", err->code);
- g_error_free (err);
- gst_message_unref (msg);
- gst_object_unref (bus);
-
- gst_element_set_state (playbin, GST_STATE_NULL);
- gst_object_unref (playbin);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_missing_suburisource_handler)
-{
- GstStructure *s;
- GstMessage *msg;
- GstElement *playbin;
- GError *err = NULL;
- GstBus *bus;
-
- playbin = create_playbin ("file:///does/not/exis.t");
-
- g_object_set (playbin, "suburi", "cookie://withahint.of/cinnamon", NULL);
-
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
- GST_STATE_CHANGE_FAILURE);
-
- /* there should be at least a missing-plugin message on the bus now and an
- * error message; the missing-plugin message should be first */
- bus = gst_element_get_bus (playbin);
-
- msg = gst_bus_poll (bus, GST_MESSAGE_ELEMENT | GST_MESSAGE_ERROR, -1);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
- fail_unless (msg->structure != NULL);
- s = msg->structure;
- fail_unless (gst_structure_has_name (s, "missing-plugin"));
- fail_unless (gst_structure_has_field_typed (s, "detail", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "detail"), "cookie");
- fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "type"), "urisource");
- gst_message_unref (msg);
-
- msg = gst_bus_poll (bus, GST_MESSAGE_WARNING, -1);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_WARNING);
-
- /* make sure the *warning* is a CORE MISSING_PLUGIN one */
- gst_message_parse_warning (msg, &err, NULL);
- fail_unless (err != NULL);
- fail_unless (err->domain == GST_CORE_ERROR, "error has wrong error domain "
- "%s instead of core-error-quark", g_quark_to_string (err->domain));
- fail_unless (err->code == GST_CORE_ERROR_MISSING_PLUGIN, "error has wrong "
- "code %u instead of GST_CORE_ERROR_MISSING_PLUGIN", err->code);
- g_error_free (err);
- gst_message_unref (msg);
-
- msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, -1);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ERROR);
-
- /* make sure the error is a RESOURCE NOT_FOUND one */
- gst_message_parse_error (msg, &err, NULL);
- fail_unless (err != NULL);
- fail_unless (err->domain == GST_RESOURCE_ERROR,
- "error has wrong error domain " "%s instead of resource-error-quark",
- g_quark_to_string (err->domain));
- fail_unless (err->code == GST_RESOURCE_ERROR_NOT_FOUND,
- "error has wrong " "code %u instead of GST_RESOURCE_ERROR_NOT_FOUND",
- err->code);
- g_error_free (err);
- gst_message_unref (msg);
-
- gst_object_unref (bus);
-
- gst_element_set_state (playbin, GST_STATE_NULL);
- gst_object_unref (playbin);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_missing_primary_decoder)
-{
- GstStructure *s;
- GstMessage *msg;
- GstElement *playbin;
- GError *err = NULL;
- GstBus *bus;
-
- fail_unless (gst_element_register (NULL, "codecsrc", GST_RANK_PRIMARY,
- gst_codec_src_get_type ()));
-
- playbin = create_playbin ("codec://");
-
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
- GST_STATE_CHANGE_SUCCESS);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
- GST_STATE_CHANGE_ASYNC);
-
- /* there should soon be at least a missing-plugin message on the bus and an
- * error message; the missing-plugin message should be first */
- bus = gst_element_get_bus (playbin);
-
- msg = gst_bus_poll (bus, GST_MESSAGE_ELEMENT | GST_MESSAGE_ERROR, -1);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
- fail_unless (msg->structure != NULL);
- s = msg->structure;
- fail_unless (gst_structure_has_name (s, "missing-plugin"));
- fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "type"), "decoder");
- fail_unless (gst_structure_has_field_typed (s, "detail", GST_TYPE_CAPS));
- gst_message_unref (msg);
-
- msg = gst_bus_poll (bus, GST_MESSAGE_WARNING, -1);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_WARNING);
-
- /* make sure the *warning* is a STREAM CODEC_NOT_FOUND one */
- gst_message_parse_warning (msg, &err, NULL);
- fail_unless (err != NULL);
- fail_unless (err->domain == GST_STREAM_ERROR, "error has wrong error domain "
- "%s instead of stream-error-quark", g_quark_to_string (err->domain));
- fail_unless (err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND, "error has wrong "
- "code %u instead of GST_STREAM_ERROR_CODEC_NOT_FOUND", err->code);
- g_error_free (err);
- gst_message_unref (msg);
-
- msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, -1);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ERROR);
-
- /* make sure the error is a CORE MISSING_PLUGIN one */
- gst_message_parse_error (msg, &err, NULL);
- fail_unless (err != NULL);
- fail_unless (err->domain == GST_CORE_ERROR, "error has wrong error domain "
- "%s instead of core-error-quark", g_quark_to_string (err->domain));
- fail_unless (err->code == GST_CORE_ERROR_MISSING_PLUGIN, "error has wrong "
- "code %u instead of GST_CORE_ERROR_MISSING_PLUGIN", err->code);
- g_error_free (err);
- gst_message_unref (msg);
-
- gst_object_unref (bus);
-
- gst_element_set_state (playbin, GST_STATE_NULL);
- gst_object_unref (playbin);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_refcount)
-{
- GstElement *playbin, *audiosink, *videosink, *vis;
-
- fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
- gst_red_video_src_get_type ()));
-
- playbin = gst_element_factory_make ("playbin2", NULL);
- audiosink = gst_element_factory_make ("fakesink", "myaudiosink");
- videosink = gst_element_factory_make ("fakesink", "myvideosink");
- vis = gst_element_factory_make ("identity", "myvis");
-
- /* ref because we need them after we unref playbin2 */
- gst_object_ref (audiosink);
- gst_object_ref (videosink);
- gst_object_ref (vis);
-
- /* Sinks have floating ref only, setting the properties takes ownership. */
- g_object_set (playbin,
- "audio-sink", audiosink,
- "video-sink", videosink,
- "vis-plugin", vis, "flags", 0x01 | 0x02 | 0x08, NULL);
-
- g_object_set (playbin, "uri", "redvideo://", NULL);
- //"uri", "file:///home/wim/data/cdda.ogg", NULL);
-
- ASSERT_OBJECT_REFCOUNT (playbin, "playbin", 1);
-
- /* we have two refs now, one from ourselves and one from playbin2 */
- ASSERT_OBJECT_REFCOUNT (audiosink, "myaudiosink", 2);
- ASSERT_OBJECT_REFCOUNT (videosink, "myvideosink", 2);
- ASSERT_OBJECT_REFCOUNT (vis, "myvis", 2);
-
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
- GST_STATE_CHANGE_ASYNC);
- fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL,
- GST_CLOCK_TIME_NONE), GST_STATE_CHANGE_SUCCESS);
- fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_NULL),
- GST_STATE_CHANGE_SUCCESS);
-
- ASSERT_OBJECT_REFCOUNT (playbin, "playbin", 1);
- /* refcount of our elements is undefined, playbin2 might keep additional refs
- * because it cached the elements in bins */
- gst_object_unref (playbin);
-
- /* now we are back to our refs */
- ASSERT_OBJECT_REFCOUNT (audiosink, "myaudiosink", 1);
- ASSERT_OBJECT_REFCOUNT (videosink, "myvideosink", 1);
- ASSERT_OBJECT_REFCOUNT (vis, "myvis", 1);
-
- gst_object_unref (audiosink);
- gst_object_unref (videosink);
- gst_object_unref (vis);
-}
-
-GST_END_TEST;
-
-/*** redvideo:// source ***/
-
-static GstURIType
-gst_red_video_src_uri_get_type (void)
-{
- return GST_URI_SRC;
-}
-
-static gchar **
-gst_red_video_src_uri_get_protocols (void)
-{
- static gchar *protocols[] = { "redvideo", NULL };
-
- return protocols;
-}
-
-static const gchar *
-gst_red_video_src_uri_get_uri (GstURIHandler * handler)
-{
- return "redvideo://";
-}
-
-static gboolean
-gst_red_video_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
-{
- return (uri != NULL && g_str_has_prefix (uri, "redvideo:"));
-}
-
-static void
-gst_red_video_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
-{
- GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
-
- iface->get_type = gst_red_video_src_uri_get_type;
- iface->get_protocols = gst_red_video_src_uri_get_protocols;
- iface->get_uri = gst_red_video_src_uri_get_uri;
- iface->set_uri = gst_red_video_src_uri_set_uri;
-}
-
-static void
-gst_red_video_src_init_type (GType type)
-{
- static const GInterfaceInfo uri_hdlr_info = {
- gst_red_video_src_uri_handler_init, NULL, NULL
- };
-
- g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &uri_hdlr_info);
-}
-
-typedef GstPushSrc GstRedVideoSrc;
-typedef GstPushSrcClass GstRedVideoSrcClass;
-
-GST_BOILERPLATE_FULL (GstRedVideoSrc, gst_red_video_src, GstPushSrc,
- GST_TYPE_PUSH_SRC, gst_red_video_src_init_type);
-
-static void
-gst_red_video_src_base_init (gpointer klass)
-{
- static const GstElementDetails details =
- GST_ELEMENT_DETAILS ("Red Video Src", "Source/Video", "yep", "me");
- static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC, GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-yuv, format=(fourcc)I420")
- );
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_templ));
- gst_element_class_set_details (element_class, &details);
-}
-
-static GstFlowReturn
-gst_red_video_src_create (GstPushSrc * src, GstBuffer ** p_buf)
-{
- GstBuffer *buf;
- GstCaps *caps;
- guint8 *data;
- guint w = 64, h = 64;
- guint size;
-
- size = w * h * 3 / 2;
- buf = gst_buffer_new_and_alloc (size);
- data = GST_BUFFER_DATA (buf);
- memset (data, 76, w * h);
- memset (data + (w * h), 85, (w * h) / 4);
- memset (data + (w * h) + ((w * h) / 4), 255, (w * h) / 4);
-
- caps = gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC,
- GST_MAKE_FOURCC ('I', '4', '2', '0'), "width", G_TYPE_INT, w, "height",
- G_TYPE_INT, h, "framerate", GST_TYPE_FRACTION, 1, 1, NULL);
- gst_buffer_set_caps (buf, caps);
- gst_caps_unref (caps);
-
- *p_buf = buf;
- return GST_FLOW_OK;
-}
-
-static void
-gst_red_video_src_class_init (GstRedVideoSrcClass * klass)
-{
- GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
-
- pushsrc_class->create = gst_red_video_src_create;
-}
-
-static void
-gst_red_video_src_init (GstRedVideoSrc * src, GstRedVideoSrcClass * klass)
-{
-}
-
-/*** codec:// source ***/
-
-static GstURIType
-gst_codec_src_uri_get_type (void)
-{
- return GST_URI_SRC;
-}
-
-static gchar **
-gst_codec_src_uri_get_protocols (void)
-{
- static gchar *protocols[] = { "codec", NULL };
-
- return protocols;
-}
-
-static const gchar *
-gst_codec_src_uri_get_uri (GstURIHandler * handler)
-{
- return "codec://";
-}
-
-static gboolean
-gst_codec_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
-{
- return (uri != NULL && g_str_has_prefix (uri, "codec:"));
-}
-
-static void
-gst_codec_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
-{
- GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
-
- iface->get_type = gst_codec_src_uri_get_type;
- iface->get_protocols = gst_codec_src_uri_get_protocols;
- iface->get_uri = gst_codec_src_uri_get_uri;
- iface->set_uri = gst_codec_src_uri_set_uri;
-}
-
-static void
-gst_codec_src_init_type (GType type)
-{
- static const GInterfaceInfo uri_hdlr_info = {
- gst_codec_src_uri_handler_init, NULL, NULL
- };
-
- g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &uri_hdlr_info);
-}
-
-#undef parent_class
-#define parent_class codec_src_parent_class
-
-typedef GstPushSrc GstCodecSrc;
-typedef GstPushSrcClass GstCodecSrcClass;
-
-GST_BOILERPLATE_FULL (GstCodecSrc, gst_codec_src, GstPushSrc,
- GST_TYPE_PUSH_SRC, gst_codec_src_init_type);
-
-static void
-gst_codec_src_base_init (gpointer klass)
-{
- static const GstElementDetails details =
- GST_ELEMENT_DETAILS ("Codec Src", "Source/Video", "yep", "me");
- static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC, GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-codec")
- );
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_templ));
- gst_element_class_set_details (element_class, &details);
-}
-
-static GstFlowReturn
-gst_codec_src_create (GstPushSrc * src, GstBuffer ** p_buf)
-{
- GstBuffer *buf;
- GstCaps *caps;
-
- buf = gst_buffer_new_and_alloc (20);
- memset (GST_BUFFER_DATA (buf), 0, GST_BUFFER_SIZE (buf));
-
- caps = gst_caps_new_simple ("application/x-codec", NULL);
- gst_buffer_set_caps (buf, caps);
- gst_caps_unref (caps);
-
- *p_buf = buf;
- return GST_FLOW_OK;
-}
-
-static void
-gst_codec_src_class_init (GstCodecSrcClass * klass)
-{
- GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
-
- pushsrc_class->create = gst_codec_src_create;
-}
-
-static void
-gst_codec_src_init (GstCodecSrc * src, GstCodecSrcClass * klass)
-{
-}
-
-#endif /* GST_DISABLE_REGISTRY */
-
-
-static Suite *
-playbin2_suite (void)
-{
- Suite *s = suite_create ("playbin2");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
-
-#ifndef GST_DISABLE_REGISTRY
- tcase_add_test (tc_chain, test_sink_usage_video_only_stream);
- tcase_add_test (tc_chain, test_suburi_error_wrongproto);
- tcase_add_test (tc_chain, test_suburi_error_invalidfile);
- tcase_add_test (tc_chain, test_suburi_error_unknowntype);
- tcase_add_test (tc_chain, test_missing_urisource_handler);
- tcase_add_test (tc_chain, test_missing_suburisource_handler);
- tcase_add_test (tc_chain, test_missing_primary_decoder);
- tcase_add_test (tc_chain, test_refcount);
-
- /* one day we might also want to have the following checks:
- * tcase_add_test (tc_chain, test_missing_secondary_decoder_one_fatal);
- * tcase_add_test (tc_chain, test_missing_secondary_decoder_two_fatal);
- * tcase_add_test (tc_chain, test_missing_secondary_decoder_two_with_preroll);
- */
-#endif
-
- return s;
-}
-
-GST_CHECK_MAIN (playbin2);
diff --git a/tests/check/elements/subparse.c b/tests/check/elements/subparse.c
deleted file mode 100644
index 884140b9..00000000
--- a/tests/check/elements/subparse.c
+++ /dev/null
@@ -1,719 +0,0 @@
-/* GStreamer unit tests for subparse
- * Copyright (C) 2006-2008 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gst/check/gstcheck.h>
-
-#include <string.h>
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("text/plain; text/x-pango-markup")
- );
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("ANY")
- );
-
-static GstElement *subparse;
-static GstPad *mysrcpad, *mysinkpad;
-
-static GstBuffer *
-buffer_from_static_string (const gchar * s)
-{
- GstBuffer *buf;
-
- buf = gst_buffer_new ();
- GST_BUFFER_DATA (buf) = (guint8 *) s;
- GST_BUFFER_SIZE (buf) = strlen (s);
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_READONLY);
-
- return buf;
-}
-
-typedef struct
-{
- const gchar *in;
- GstClockTime from_ts;
- GstClockTime to_ts;
- const gchar *out;
-} SubParseInputChunk;
-
-static SubParseInputChunk srt_input[] = {
- {
- "1\n00:00:01,000 --> 00:00:02,000\nOne\n\n",
- 1 * GST_SECOND, 2 * GST_SECOND, "One"}, {
- "2\n00:00:02,000 --> 00:00:03,000\nTwo\n\n",
- 2 * GST_SECOND, 3 * GST_SECOND, "Two"}, {
- "3\n00:00:03,000 --> 00:00:04,000\nThree\n\n",
- 3 * GST_SECOND, 4 * GST_SECOND, "Three"}, {
- "4\n00:00:04,000 --> 00:00:05,000\nFour\n\n",
- 4 * GST_SECOND, 5 * GST_SECOND, "Four"}, {
- "5\n00:00:05,000 --> 00:00:06,000\nFive\n\n",
- 5 * GST_SECOND, 6 * GST_SECOND, "Five"}, {
- /* markup should be preserved */
- "6\n00:00:06,000 --> 00:00:07,000\n<i>Six</i>\n\n",
- 6 * GST_SECOND, 7 * GST_SECOND, "<i>Six</i>"}, {
- /* open markup tags should be closed */
- "7\n00:00:07,000 --> 00:00:08,000\n<i>Seven\n\n",
- 7 * GST_SECOND, 8 * GST_SECOND, "<i>Seven</i>"}, {
- /* open markup tags should be closed (II) */
- "8\n00:00:08,000 --> 00:00:09,000\n<b><i>Eight\n\n",
- 8 * GST_SECOND, 9 * GST_SECOND, "<b><i>Eight</i></b>"}, {
- /* broken markup should be fixed */
- "9\n00:00:09,000 --> 00:00:10,000\n</b>\n\n",
- 9 * GST_SECOND, 10 * GST_SECOND, ""}, {
- "10\n00:00:10,000 --> 00:00:11,000\n</b></i>\n\n",
- 10 * GST_SECOND, 11 * GST_SECOND, ""}, {
- "11\n00:00:11,000 --> 00:00:12,000\n<i>xyz</b></i>\n\n",
- 11 * GST_SECOND, 12 * GST_SECOND, "<i>xyz</i>"}, {
- "12\n00:00:12,000 --> 00:00:13,000\n<i>xyz</b>\n\n",
- 12 * GST_SECOND, 13 * GST_SECOND, "<i>xyz</i>"}, {
- /* skip a few chunk numbers here, the numbers shouldn't matter */
- "24\n00:01:00,000 --> 00:02:00,000\nYep, still here\n\n",
- 60 * GST_SECOND, 120 * GST_SECOND, "Yep, still here"}, {
- /* make sure stuff is escaped properly, but allowed markup stays intact */
- "25\n00:03:00,000 --> 00:04:00,000\ngave <i>Rock & Roll</i> to\n\n",
- 180 * GST_SECOND, 240 * GST_SECOND, "gave <i>Rock &amp; Roll</i> to"}, {
- "26\n00:04:00,000 --> 00:05:00,000\n<i>Rock & Roll</i>\n\n",
- 240 * GST_SECOND, 300 * GST_SECOND, "<i>Rock &amp; Roll</i>"}, {
- "27\n00:06:00,000 --> 00:08:00,000\nRock & Roll\n\n",
- 360 * GST_SECOND, 480 * GST_SECOND, "Rock &amp; Roll"}, {
- "28\n00:10:00,000 --> 00:11:00,000\n"
- "<font \"#0000FF\"><joj>This is </xxx>in blue but <5</font>\n\n",
- 600 * GST_SECOND, 660 * GST_SECOND, "This is in blue but &lt;5"}
-};
-
-/* starts with chunk number 0 (not exactly according to spec) */
-static SubParseInputChunk srt_input0[] = {
- {
- "0\n00:00:01,000 --> 00:00:02,000\nOne\n\n",
- 1 * GST_SECOND, 2 * GST_SECOND, "One"}, {
- "1\n00:00:02,000 --> 00:00:03,000\nTwo\n\n",
- 2 * GST_SECOND, 3 * GST_SECOND, "Two"}, {
- "2\n00:00:03,000 --> 00:00:04,000\nThree\n\n",
- 3 * GST_SECOND, 4 * GST_SECOND, "Three"}
-};
-
-/* has spaces instead of doubled zeroes (not exactly according to spec) */
-static SubParseInputChunk srt_input1[] = {
- {
- "1\n 0: 0:26, 26 --> 0: 0:28, 17\nI cant see.\n\n",
- 26 * GST_SECOND + 26 * GST_MSECOND,
- 28 * GST_SECOND + 17 * GST_MSECOND, "I cant see."},
- {
- "2\n 0: 0:30, 30 --> 0: 0:33, 22\nI really cant see.\n\n",
- 30 * GST_SECOND + 30 * GST_MSECOND,
- 33 * GST_SECOND + 22 * GST_MSECOND, "I really cant see."},
- {
- "3\n 0: 0:40, 40 --> 0: 0:44, 44\nI still cant see anything.\n\n",
- 40 * GST_SECOND + 40 * GST_MSECOND,
- 44 * GST_SECOND + 44 * GST_MSECOND, "I still cant see anything."}
-};
-
-/* has UTF-8 BOM at the start */
-static SubParseInputChunk srt_input2[] = {
- {
- "\xef\xbb\xbf" "1\n00:00:00,000 --> 00:00:03,50\nJust testing.\n\n",
- 0, 3 * GST_SECOND + 50 * GST_MSECOND, "Just testing."}
-};
-
-/* starts with chunk number 0 and has less than three digits after the comma
- * and a few extra spaces before the arrow or at the end of the line */
-static SubParseInputChunk srt_input3[] = {
- {
- "0\n00:00:01,0 --> 00:00:02,0\nOne\n\n",
- 1000 * GST_MSECOND, 2000 * GST_MSECOND, "One"}, {
- "1\n00:00:02,5 --> 00:00:03, 5 \nTwo\n\n",
- 2500 * GST_MSECOND, 3005 * GST_MSECOND, "Two"}, {
- "2\n00:00:03, 9 --> 00:00:04,0 \nThree\n\n",
- 3090 * GST_MSECOND, 4000 * GST_MSECOND, "Three"}
-};
-
-static void
-setup_subparse (void)
-{
- subparse = gst_check_setup_element ("subparse");
-
- mysrcpad = gst_check_setup_src_pad (subparse, &srctemplate, NULL);
- mysinkpad = gst_check_setup_sink_pad (subparse, &sinktemplate, NULL);
-
- gst_pad_set_active (mysrcpad, TRUE);
- gst_pad_set_active (mysinkpad, TRUE);
-
- fail_unless_equals_int (gst_element_set_state (subparse, GST_STATE_PLAYING),
- GST_STATE_CHANGE_SUCCESS);
-}
-
-static void
-teardown_subparse (void)
-{
- GST_DEBUG ("cleaning up");
-
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
-
- gst_pad_set_active (mysrcpad, FALSE);
- gst_pad_set_active (mysinkpad, FALSE);
- gst_check_teardown_sink_pad (subparse);
- gst_check_teardown_src_pad (subparse);
- gst_check_teardown_element (subparse);
- subparse = NULL;
- mysrcpad = NULL;
- mysinkpad = NULL;
-}
-
-static void
-test_srt_do_test (SubParseInputChunk * input, guint start_idx, guint num)
-{
- guint n;
-
- GST_LOG ("srt test: start_idx = %u, num = %u", start_idx, num);
-
- setup_subparse ();
-
- for (n = start_idx; n < start_idx + num; ++n) {
- GstBuffer *buf;
-
- buf = buffer_from_static_string (input[n].in);
- fail_unless_equals_int (gst_pad_push (mysrcpad, buf), GST_FLOW_OK);
- }
-
- gst_pad_push_event (mysrcpad, gst_event_new_eos ());
-
- fail_unless_equals_int (g_list_length (buffers), num);
-
- for (n = start_idx; n < start_idx + num; ++n) {
- const GstStructure *buffer_caps_struct;
- GstBuffer *buf;
- gchar *out;
- guint out_size;
-
- buf = g_list_nth_data (buffers, n - start_idx);
- fail_unless (buf != NULL);
- fail_unless (GST_BUFFER_TIMESTAMP_IS_VALID (buf), NULL);
- fail_unless (GST_BUFFER_DURATION_IS_VALID (buf), NULL);
- fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (buf), input[n].from_ts);
- fail_unless_equals_uint64 (GST_BUFFER_DURATION (buf),
- input[n].to_ts - input[n].from_ts);
- out = (gchar *) GST_BUFFER_DATA (buf);
- out_size = GST_BUFFER_SIZE (buf);
- /* shouldn't have trailing newline characters */
- fail_if (out_size > 0 && out[out_size - 1] == '\n');
- /* shouldn't include NUL-terminator in data size */
- fail_if (out_size > 0 && out[out_size - 1] == '\0');
- /* but should still have a NUL-terminator behind the declared data */
- fail_unless_equals_int (out[out_size], '\0');
- /* make sure out string matches expected string */
- fail_unless_equals_string (out, input[n].out);
- /* check caps */
- fail_unless (GST_BUFFER_CAPS (buf) != NULL);
- buffer_caps_struct = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0);
- fail_unless_equals_string (gst_structure_get_name (buffer_caps_struct),
- "text/x-pango-markup");
- }
-
- teardown_subparse ();
-}
-
-GST_START_TEST (test_srt)
-{
- test_srt_do_test (srt_input, 0, G_N_ELEMENTS (srt_input));
-
- /* make sure everything works fine if we don't start with chunk 1 */
- test_srt_do_test (srt_input, 1, G_N_ELEMENTS (srt_input) - 1);
- test_srt_do_test (srt_input, 2, G_N_ELEMENTS (srt_input) - 2);
- test_srt_do_test (srt_input, 3, G_N_ELEMENTS (srt_input) - 3);
- test_srt_do_test (srt_input, 4, G_N_ELEMENTS (srt_input) - 4);
-
- /* try with empty input, immediate EOS */
- test_srt_do_test (srt_input, 5, G_N_ELEMENTS (srt_input) - 5);
-
- /* try with chunk number 0 (which is not exactly according to spec) */
- test_srt_do_test (srt_input0, 0, G_N_ELEMENTS (srt_input0));
-
- /* try with spaces instead of doubled zeroes (which is not exactly according to spec) */
- test_srt_do_test (srt_input1, 0, G_N_ELEMENTS (srt_input1));
-
- /* try with UTF-8 BOM at the start */
- test_srt_do_test (srt_input1, 0, G_N_ELEMENTS (srt_input2));
-
- /* try with fewer than three post-comma digits, and some extra spaces */
- test_srt_do_test (srt_input3, 0, G_N_ELEMENTS (srt_input3));
-}
-
-GST_END_TEST;
-
-static void
-do_test (SubParseInputChunk * input, guint num, const gchar * media_type)
-{
- guint n;
-
- setup_subparse ();
-
- for (n = 0; n < num; ++n) {
- GstBuffer *buf;
-
- buf = buffer_from_static_string (input[n].in);
- fail_unless_equals_int (gst_pad_push (mysrcpad, buf), GST_FLOW_OK);
- }
-
- gst_pad_push_event (mysrcpad, gst_event_new_eos ());
-
- fail_unless_equals_int (g_list_length (buffers), num);
-
- for (n = 0; n < num; ++n) {
- const GstStructure *buffer_caps_struct;
- GstBuffer *buf;
- gchar *out;
- guint out_size;
-
- buf = g_list_nth_data (buffers, n);
- fail_unless (buf != NULL);
-
- /* check timestamp */
- fail_unless (GST_BUFFER_TIMESTAMP_IS_VALID (buf), NULL);
- fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (buf), input[n].from_ts);
-
- /* might not be able to put a duration on the last buffer */
- if (input[n].to_ts != GST_CLOCK_TIME_NONE) {
- /* check duration */
- fail_unless (GST_BUFFER_DURATION_IS_VALID (buf), NULL);
- fail_unless_equals_uint64 (GST_BUFFER_DURATION (buf),
- input[n].to_ts - input[n].from_ts);
- }
-
- out = (gchar *) GST_BUFFER_DATA (buf);
- out_size = GST_BUFFER_SIZE (buf);
- /* shouldn't have trailing newline characters */
- fail_if (out_size > 0 && out[out_size - 1] == '\n');
- /* shouldn't include NUL-terminator in data size */
- fail_if (out_size > 0 && out[out_size - 1] == '\0');
- /* but should still have a NUL-terminator behind the declared data */
- fail_unless_equals_int (out[out_size], '\0');
- /* make sure out string matches expected string */
- fail_unless_equals_string (out, input[n].out);
- /* check caps */
- fail_unless (GST_BUFFER_CAPS (buf) != NULL);
- buffer_caps_struct = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0);
- fail_unless_equals_string (gst_structure_get_name (buffer_caps_struct),
- media_type);
- }
-
- teardown_subparse ();
-}
-
-static void
-test_tmplayer_do_test (SubParseInputChunk * input, guint num)
-{
- do_test (input, num, "text/plain");
-}
-
-static void
-test_microdvd_do_test (SubParseInputChunk * input, guint num)
-{
- do_test (input, num, "text/x-pango-markup");
-}
-
-GST_START_TEST (test_tmplayer_multiline)
-{
- static SubParseInputChunk tmplayer_multiline_input[] = {
- {
- "00:00:10,1=This is the Earth at a time\n"
- "00:00:10,2=when the dinosaurs roamed...\n" "00:00:13,1=\n",
- 10 * GST_SECOND, 13 * GST_SECOND,
- "This is the Earth at a time\nwhen the dinosaurs roamed..."}, {
- "00:00:14,1=a lush and fertile planet.\n" "00:00:16,1=\n",
- 14 * GST_SECOND, 16 * GST_SECOND,
- "a lush and fertile planet."}
- };
-
- test_tmplayer_do_test (tmplayer_multiline_input,
- G_N_ELEMENTS (tmplayer_multiline_input));
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_tmplayer_multiline_with_bogus_lines)
-{
- static SubParseInputChunk tmplayer_multiline_b_input[] = {
- {
- "00:00:10,1=This is the Earth at a time\n"
- "Yooboo wabahablablahuguug bogus line hello test 1-2-3-4\n"
- "00:00:10,2=when the dinosaurs roamed...\n" "00:00:13,1=\n",
- 10 * GST_SECOND, 13 * GST_SECOND,
- "This is the Earth at a time\nwhen the dinosaurs roamed..."}, {
- "00:00:14,1=a lush and fertile planet.\n" "00:00:16,1=\n",
- 14 * GST_SECOND, 16 * GST_SECOND,
- "a lush and fertile planet."}
- };
-
- test_tmplayer_do_test (tmplayer_multiline_b_input,
- G_N_ELEMENTS (tmplayer_multiline_b_input));
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_tmplayer_style1)
-{
- static SubParseInputChunk tmplayer_style1_input[] = {
- {
- "00:00:10:This is the Earth at a time|when the dinosaurs roamed...\n"
- "00:00:13:\n",
- 10 * GST_SECOND, 13 * GST_SECOND,
- "This is the Earth at a time\nwhen the dinosaurs roamed..."}, {
- "00:00:14:a lush and fertile planet.\n" "00:00:16:\n",
- 14 * GST_SECOND, 16 * GST_SECOND,
- "a lush and fertile planet."}
- };
-
- test_tmplayer_do_test (tmplayer_style1_input,
- G_N_ELEMENTS (tmplayer_style1_input));
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_tmplayer_style2)
-{
- static SubParseInputChunk tmplayer_style2_input[] = {
- {
- "00:00:10=This is the Earth at a time|when the dinosaurs roamed...\n"
- "00:00:13=\n",
- 10 * GST_SECOND, 13 * GST_SECOND,
- "This is the Earth at a time\nwhen the dinosaurs roamed..."}, {
- "00:00:14=a lush and fertile planet.\n" "00:00:16=\n",
- 14 * GST_SECOND, 16 * GST_SECOND,
- "a lush and fertile planet."}
- };
-
- test_tmplayer_do_test (tmplayer_style2_input,
- G_N_ELEMENTS (tmplayer_style2_input));
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_tmplayer_style3)
-{
- static SubParseInputChunk tmplayer_style3_input[] = {
- {
- "0:00:10:This is the Earth at a time|when the dinosaurs roamed...\n"
- "0:00:13:\n",
- 10 * GST_SECOND, 13 * GST_SECOND,
- "This is the Earth at a time\nwhen the dinosaurs roamed..."}, {
- "0:00:14:a lush and fertile planet.\n" "0:00:16:\n",
- 14 * GST_SECOND, 16 * GST_SECOND,
- "a lush and fertile planet."}
- };
-
- test_tmplayer_do_test (tmplayer_style3_input,
- G_N_ELEMENTS (tmplayer_style3_input));
-}
-
-GST_END_TEST;
-
-/* also tests the max_duration stuff (see second-last chunk which is supposed
- * to be clipped to 5s duration) */
-GST_START_TEST (test_tmplayer_style3b)
-{
- static SubParseInputChunk tmplayer_style3b_input[] = {
- {
- "0:00:10:This is the Earth at a time|when the dinosaurs roamed...\n",
- 10 * GST_SECOND, 14 * GST_SECOND,
- "This is the Earth at a time\nwhen the dinosaurs roamed..."}, {
- "0:00:14:a lush and fertile planet.\n",
- 14 * GST_SECOND, 16 * GST_SECOND,
- "a lush and fertile planet."}, {
- "0:00:16:And they liked it a lot.\n",
- 16 * GST_SECOND, (16 + 5) * GST_SECOND, "And they liked it a lot."}, {
- "0:00:30:Last line.",
- 30 * GST_SECOND, GST_CLOCK_TIME_NONE, "Last line."}
- };
-
- test_tmplayer_do_test (tmplayer_style3b_input,
- G_N_ELEMENTS (tmplayer_style3b_input));
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_tmplayer_style4)
-{
- static SubParseInputChunk tmplayer_style4_input[] = {
- {
- "0:00:10=This is the Earth at a time|when the dinosaurs roamed...\n"
- "0:00:13=\n",
- 10 * GST_SECOND, 13 * GST_SECOND,
- "This is the Earth at a time\nwhen the dinosaurs roamed..."}, {
- "0:00:14=a lush and fertile planet.\n" "0:00:16=\n",
- 14 * GST_SECOND, 16 * GST_SECOND,
- "a lush and fertile planet."}
- };
-
- test_tmplayer_do_test (tmplayer_style4_input,
- G_N_ELEMENTS (tmplayer_style4_input));
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_tmplayer_style4_with_bogus_lines)
-{
- static SubParseInputChunk tmplayer_style4b_input[] = {
- {
- "0:00:10=This is the Earth at a time|when the dinosaurs roamed...\n"
- "# This is a bogus line with a comment and should just be skipped\n"
- "0:00:13=\n",
- 10 * GST_SECOND, 13 * GST_SECOND,
- "This is the Earth at a time\nwhen the dinosaurs roamed..."}, {
- "0:00:14=a lush and fertile planet.\n"
- " \n"
- "0:00:16=\n",
- 14 * GST_SECOND, 16 * GST_SECOND,
- "a lush and fertile planet."}
- };
-
- test_tmplayer_do_test (tmplayer_style4b_input,
- G_N_ELEMENTS (tmplayer_style4b_input));
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_microdvd_with_italics)
-{
- static SubParseInputChunk microdvd_italics[] = {
- {
- "{1}{1}25.000 movie info: XVID 608x256 25.0fps 699.0 MB|"
- "/SubEdit b.4060(http://subedit.com.pl)/\n"
- "{100}{200}/italics/|not italics\n",
- 4 * GST_SECOND, 8 * GST_SECOND,
- "<span style=\"italic\">italics</span>\n" "<span>not italics</span>"}
- };
-
- test_microdvd_do_test (microdvd_italics, G_N_ELEMENTS (microdvd_italics));
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_microdvd_with_fps)
-{
- static SubParseInputChunk microdvd_input[] = {
- {
- "{1}{1}12.500\n{100}{200}- Hi, Eddie.|- Hiya, Scotty.\n",
- 8 * GST_SECOND, 16 * GST_SECOND,
- "<span>- Hi, Eddie.</span>\n<span>- Hiya, Scotty.</span>"}, {
- "{1250}{1350}- Cold enough for you?|- Well, I'm only faintly alive. "
- "It's 25 below\n",
- 100 * GST_SECOND, 108 * GST_SECOND,
- "<span>- Cold enough for you?</span>\n"
- "<span>- Well, I&apos;m only faintly alive. It&apos;s 25 below</span>"}
- };
-
- test_microdvd_do_test (microdvd_input, G_N_ELEMENTS (microdvd_input));
-
- /* and the same with ',' instead of '.' as floating point divider */
- microdvd_input[0].in =
- "{1}{1}12,500\n{100}{200}- Hi, Eddie.|- Hiya, Scotty.\n";
- test_microdvd_do_test (microdvd_input, G_N_ELEMENTS (microdvd_input));
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_mpl2)
-{
- SubParseInputChunk mpl2_input[] = {
- {
- "[123][456] This is the Earth at a time|when the dinosaurs roamed\n",
- (123 * GST_SECOND) / 10, (456 * GST_SECOND) / 10,
- "This is the Earth at a time\nwhen the dinosaurs roamed"}, {
- "[1234][5678]a lush and fertile planet.\n",
- (1234 * GST_SECOND) / 10, (5678 * GST_SECOND) / 10,
- "a lush and fertile planet."}, {
- "[12345][27890] /Italic|Normal\n",
- (12345 * GST_SECOND) / 10, (27890 * GST_SECOND) / 10,
- "<i>Italic</i>\nNormal"}, {
- "[32345][37890]/Italic|/Italic\n",
- (32345 * GST_SECOND) / 10, (37890 * GST_SECOND) / 10,
- "<i>Italic</i>\n<i>Italic</i>"}, {
- "[42345][47890] Normal|/Italic",
- (42345 * GST_SECOND) / 10, (47890 * GST_SECOND) / 10,
- "Normal\n<i>Italic</i>"}
- };
-
- do_test (mpl2_input, G_N_ELEMENTS (mpl2_input), "text/x-pango-markup");
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_subviewer)
-{
- SubParseInputChunk subviewer_input[] = {
- {
- "[INFORMATION]\n"
- "[TITLE]xxxxxxxxxx\n"
- "[AUTHOR]xxxxxxxx\n"
- "[SOURCE]xxxxxxxxxxxxxxxx\n"
- "[FILEPATH]\n"
- "[DELAY]0\n"
- "[COMMENT]\n"
- "[END INFORMATION]\n"
- "[SUBTITLE]\n"
- "[COLF]&HFFFFFF,[STYLE]bd,[SIZE]18,[FONT]Arial\n"
- "00:00:41.00,00:00:44.40\n"
- "The Age of Gods was closing.\n"
- "Eternity had come to an end.\n"
- "\n", 41 * GST_SECOND, 44 * GST_SECOND + 40 * GST_MSECOND,
- "The Age of Gods was closing.\nEternity had come to an end."}, {
- "00:00:55.00,00:00:58.40\n"
- "The heavens shook as the armies\n"
- "of Falis, God of Light...\n\n", 55 * GST_SECOND,
- 58 * GST_SECOND + 40 * GST_MSECOND,
- "The heavens shook as the armies\nof Falis, God of Light..."}
- };
-
- do_test (subviewer_input, G_N_ELEMENTS (subviewer_input), "text/plain");
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_subviewer2)
-{
- SubParseInputChunk subviewer2_input[] = {
- {
- "[INFORMATION]\n"
- "[TITLE]xxxxxxxxxx\n"
- "[AUTHOR]xxxxxxxxxx\n"
- "[SOURCE]xxxxxxxxxx\n"
- "[PRG]\n"
- "[FILEPATH]\n"
- "[DELAY]0\n"
- "[CD TRACK]0\n"
- "[COMMENT]\n"
- "[END INFORMATION]\n"
- "[SUBTITLE]\n"
- "[COLF]&H00FFFF,[STYLE]no,[SIZE]12,[FONT]Courier New\n"
- "00:00:07.00,00:00:11.91\n"
- "THERE IS A PLACE ON EARTH WHERE IT[br]IS STILL THE MORNING OF LIFE...\n\n",
- 7 * GST_SECOND, 11 * GST_SECOND + 91 * GST_MSECOND,
- "THERE IS A PLACE ON EARTH WHERE IT\nIS STILL THE MORNING OF LIFE..."}, {
- "00:00:12.48,00:00:15.17\n"
- "AND THE GREAT HERDS RUN FREE.[br]SO WHAT?!\n\n",
- 12 * GST_SECOND + 48 * GST_MSECOND,
- 15 * GST_SECOND + 17 * GST_MSECOND,
- "AND THE GREAT HERDS RUN FREE.\nSO WHAT?!"}
- };
-
- do_test (subviewer2_input, G_N_ELEMENTS (subviewer2_input), "text/plain");
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_dks)
-{
- SubParseInputChunk dks_input[] = {
- {
- "[00:00:07]THERE IS A PLACE ON EARTH WHERE IT[br]IS STILL THE MORNING OF LIFE...\n[00:00:12]\n",
- 7 * GST_SECOND, 12 * GST_SECOND,
- "THERE IS A PLACE ON EARTH WHERE IT\nIS STILL THE MORNING OF LIFE..."}, {
- "[00:00:13]AND THE GREAT HERDS RUN FREE.[br]SO WHAT?!\n[00:00:15]\n",
- 13 * GST_SECOND, 15 * GST_SECOND,
- "AND THE GREAT HERDS RUN FREE.\nSO WHAT?!"}
- };
-
- do_test (dks_input, G_N_ELEMENTS (dks_input), "text/plain");
-}
-
-GST_END_TEST;
-
-#ifndef GST_DISABLE_XML
-GST_START_TEST (test_sami)
-{
- SubParseInputChunk sami_input[] = {
- {"<SAMI>\n"
- "<HEAD>\n"
- " <TITLE>Subtitle</TITLE>\n"
- " <STYLE TYPE=\"text/css\">\n"
- " <!--\n"
- " P {margin-left:8pt; margin-right:8pt; margin-bottom:2pt; margin-top:2pt; text-align:center; font-size:12pt; font-weight:normal; color:black;}\n"
- " .CC {Name:English; lang:en-AU; SAMIType:CC;}\n"
- " #STDPrn {Name:Standard Print;}\n"
- " #LargePrn {Name:Large Print; font-size:24pt;}\n"
- " #SmallPrn {Name:Small Print; font-size:16pt;}\n"
- " -->\n"
- " </Style>\n"
- "</HEAD>\n"
- "<BODY>\n"
- " <SYNC Start=1000>\n"
- " <P Class=CC>\n"
- " This is a comment.<br>\n"
- " This is a second comment.\n",
- 1000 * GST_MSECOND, 2000 * GST_MSECOND,
- "This is a comment.\nThis is a second comment."},
- {" <SYNC Start=2000>\n"
- " <P Class=CC>\n"
- " This is a third comment.<br>\n"
- " This is a fourth comment.\n" "</BODY>\n" "</SAMI>\n",
- 2000 * GST_MSECOND, GST_CLOCK_TIME_NONE,
- "This is a third comment.\nThis is a fourth comment."}
- };
-
- do_test (sami_input, G_N_ELEMENTS (sami_input), "text/x-pango-markup");
-}
-
-GST_END_TEST;
-#endif
-
-/* TODO:
- * - add/modify tests so that lines aren't dogfed to the parsers in complete
- * lines or sets of complete lines, but rather in random chunks
- */
-
-static Suite *
-subparse_suite (void)
-{
- Suite *s = suite_create ("subparse");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
-
- tcase_add_test (tc_chain, test_srt);
- tcase_add_test (tc_chain, test_tmplayer_multiline);
- tcase_add_test (tc_chain, test_tmplayer_multiline_with_bogus_lines);
- tcase_add_test (tc_chain, test_tmplayer_style1);
- tcase_add_test (tc_chain, test_tmplayer_style2);
- tcase_add_test (tc_chain, test_tmplayer_style3);
- tcase_add_test (tc_chain, test_tmplayer_style3b);
- tcase_add_test (tc_chain, test_tmplayer_style4);
- tcase_add_test (tc_chain, test_tmplayer_style4_with_bogus_lines);
- tcase_add_test (tc_chain, test_microdvd_with_fps);
- tcase_add_test (tc_chain, test_microdvd_with_italics);
- tcase_add_test (tc_chain, test_mpl2);
- tcase_add_test (tc_chain, test_subviewer);
- tcase_add_test (tc_chain, test_subviewer2);
- tcase_add_test (tc_chain, test_dks);
-#ifndef GST_DISABLE_XML
- tcase_add_test (tc_chain, test_sami);
-#endif
- return s;
-}
-
-GST_CHECK_MAIN (subparse);
diff --git a/tests/check/elements/textoverlay.c b/tests/check/elements/textoverlay.c
deleted file mode 100644
index 63dd31d5..00000000
--- a/tests/check/elements/textoverlay.c
+++ /dev/null
@@ -1,751 +0,0 @@
-/* GStreamer unit tests for textoverlay
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-
-#define I420_Y_ROWSTRIDE(width) (GST_ROUND_UP_4(width))
-#define I420_U_ROWSTRIDE(width) (GST_ROUND_UP_8(width)/2)
-#define I420_V_ROWSTRIDE(width) ((GST_ROUND_UP_8(I420_Y_ROWSTRIDE(width)))/2)
-
-#define I420_Y_OFFSET(w,h) (0)
-#define I420_U_OFFSET(w,h) (I420_Y_OFFSET(w,h)+(I420_Y_ROWSTRIDE(w)*GST_ROUND_UP_2(h)))
-#define I420_V_OFFSET(w,h) (I420_U_OFFSET(w,h)+(I420_U_ROWSTRIDE(w)*GST_ROUND_UP_2(h)/2))
-
-#define I420_SIZE(w,h) (I420_V_OFFSET(w,h)+(I420_V_ROWSTRIDE(w)*GST_ROUND_UP_2(h)/2))
-
-#define WIDTH 240
-#define HEIGHT 120
-
-/* For ease of programming we use globals to keep refs for our floating
- * src and sink pads we create; otherwise we always have to do get_pad,
- * get_peer, and then remove references in every test function */
-static GstPad *myvideosrcpad, *mytextsrcpad, *mysinkpad;
-
-#define VIDEO_CAPS_STRING \
- "video/x-raw-yuv, " \
- "format = (fourcc) I420, " \
- "framerate = (fraction) 1/1, " \
- "width = (int) 240, " \
- "height = (int) 120"
-
-#define VIDEO_CAPS_TEMPLATE_STRING \
- "video/x-raw-yuv, " \
- "format = (fourcc) I420"
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (VIDEO_CAPS_TEMPLATE_STRING)
- );
-static GstStaticPadTemplate text_srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("text/plain")
- );
-
-static GstStaticPadTemplate video_srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (VIDEO_CAPS_TEMPLATE_STRING)
- );
-
-/* much like gst_check_setup_src_pad(), but with possibility to give a hint
- * which sink template of the element to use, if there are multiple ones */
-static GstPad *
-notgst_check_setup_src_pad2 (GstElement * element,
- GstStaticPadTemplate * template, GstCaps * caps,
- const gchar * sink_template_name)
-{
- GstPad *srcpad, *sinkpad;
-
- if (sink_template_name == NULL)
- sink_template_name = "sink";
-
- /* sending pad */
- srcpad = gst_pad_new_from_static_template (template, "src");
- GST_DEBUG_OBJECT (element, "setting up sending pad %p", srcpad);
- fail_if (srcpad == NULL, "Could not create a srcpad");
- ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
-
- if (!(sinkpad = gst_element_get_static_pad (element, sink_template_name)))
- sinkpad = gst_element_get_request_pad (element, sink_template_name);
- fail_if (sinkpad == NULL, "Could not get sink pad from %s",
- GST_ELEMENT_NAME (element));
- ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
- if (caps)
- fail_unless (gst_pad_set_caps (srcpad, caps));
- fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK,
- "Could not link source and %s sink pads", GST_ELEMENT_NAME (element));
- gst_object_unref (sinkpad); /* because we got it higher up */
- ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 1);
-
- return srcpad;
-}
-
-static void
-notgst_check_teardown_src_pad2 (GstElement * element,
- const gchar * sink_template_name)
-{
- GstPad *srcpad, *sinkpad;
-
- if (sink_template_name == NULL)
- sink_template_name = "sink";
-
- /* clean up floating src pad */
- if (!(sinkpad = gst_element_get_static_pad (element, sink_template_name)))
- sinkpad = gst_element_get_request_pad (element, sink_template_name);
- ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
- srcpad = gst_pad_get_peer (sinkpad);
-
- gst_pad_unlink (srcpad, sinkpad);
-
- /* caps could have been set, make sure they get unset */
- gst_pad_set_caps (srcpad, NULL);
-
- /* pad refs held by both creator and this function (through _get) */
- ASSERT_OBJECT_REFCOUNT (sinkpad, "element sinkpad", 2);
- gst_object_unref (sinkpad);
- /* one more ref is held by element itself */
-
- /* pad refs held by both creator and this function (through _get_peer) */
- ASSERT_OBJECT_REFCOUNT (srcpad, "check srcpad", 2);
- gst_object_unref (srcpad);
- gst_object_unref (srcpad);
-}
-
-static GstElement *
-setup_textoverlay (gboolean video_only_no_text)
-{
- GstElement *textoverlay;
-
- GST_DEBUG ("setup_textoverlay");
- textoverlay = gst_check_setup_element ("textoverlay");
- mysinkpad = gst_check_setup_sink_pad (textoverlay, &sinktemplate, NULL);
- myvideosrcpad =
- notgst_check_setup_src_pad2 (textoverlay, &video_srctemplate, NULL,
- "video_sink");
-
- if (!video_only_no_text) {
- mytextsrcpad =
- notgst_check_setup_src_pad2 (textoverlay, &text_srctemplate, NULL,
- "text_sink");
- gst_pad_set_active (mytextsrcpad, TRUE);
- } else {
- mytextsrcpad = NULL;
- }
-
- gst_pad_set_active (myvideosrcpad, TRUE);
- gst_pad_set_active (mysinkpad, TRUE);
-
- return textoverlay;
-}
-
-static gboolean
-buffer_is_all_black (GstBuffer * buf)
-{
- GstStructure *s;
- gint x, y, w, h;
-
- fail_unless (buf != NULL);
- fail_unless (GST_BUFFER_CAPS (buf) != NULL);
- s = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0);
- fail_unless (s != NULL);
- fail_unless (gst_structure_get_int (s, "width", &w));
- fail_unless (gst_structure_get_int (s, "height", &h));
-
- for (y = 0; y < h; ++y) {
- guint8 *data = GST_BUFFER_DATA (buf) + (y * GST_ROUND_UP_4 (w));
-
- for (x = 0; x < w; ++x) {
- if (data[x] != 0x00) {
- GST_LOG ("non-black pixel at (x,y) %d,%d", x, y);
- return FALSE;
- }
- }
- }
-
- return TRUE;
-}
-
-static GstBuffer *
-create_black_buffer (const gchar * caps_string)
-{
- GstStructure *s;
- GstBuffer *buffer;
- GstCaps *caps;
- gint w, h, size;
-
- fail_unless (caps_string != NULL);
-
- caps = gst_caps_from_string (caps_string);
- fail_unless (caps != NULL);
- fail_unless (gst_caps_is_fixed (caps));
-
- s = gst_caps_get_structure (caps, 0);
- fail_unless (gst_structure_get_int (s, "width", &w));
- fail_unless (gst_structure_get_int (s, "height", &h));
-
- GST_LOG ("creating buffer (%dx%d)", w, h);
- size = I420_SIZE (w, h);
- buffer = gst_buffer_new_and_alloc (size);
- /* we're only checking the Y plane later, so just zero it all out,
- * even if it's not the blackest black there is */
- memset (GST_BUFFER_DATA (buffer), 0, size);
-
- gst_buffer_set_caps (buffer, caps);
- gst_caps_unref (caps);
-
- /* double check to make sure it's been created right */
- fail_unless (buffer_is_all_black (buffer));
-
- return buffer;
-}
-
-static GstBuffer *
-create_text_buffer (const gchar * txt, GstClockTime ts, GstClockTime duration)
-{
- GstBuffer *buffer;
- GstCaps *caps;
- guint txt_len;
-
- fail_unless (txt != NULL);
-
- txt_len = strlen (txt);
-
- buffer = gst_buffer_new_and_alloc (txt_len);
- memcpy (GST_BUFFER_DATA (buffer), txt, txt_len);
-
- GST_BUFFER_TIMESTAMP (buffer) = ts;
- GST_BUFFER_DURATION (buffer) = duration;
-
- caps = gst_caps_new_simple ("text/plain", NULL);
- gst_buffer_set_caps (buffer, caps);
- gst_caps_unref (caps);
-
- return buffer;
-}
-
-static void
-cleanup_textoverlay (GstElement * textoverlay)
-{
- GST_DEBUG ("cleanup_textoverlay");
-
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
-
- gst_element_set_state (textoverlay, GST_STATE_NULL);
- gst_element_get_state (textoverlay, NULL, NULL, GST_CLOCK_TIME_NONE);
- gst_pad_set_active (myvideosrcpad, FALSE);
- gst_pad_set_active (mysinkpad, FALSE);
- notgst_check_teardown_src_pad2 (textoverlay, "video_sink");
- if (mytextsrcpad) {
- notgst_check_teardown_src_pad2 (textoverlay, "text_sink");
- }
- gst_check_teardown_sink_pad (textoverlay);
- gst_check_teardown_element (textoverlay);
-}
-
-GST_START_TEST (test_video_passthrough)
-{
- GstElement *textoverlay;
- GstBuffer *inbuffer;
-
- textoverlay = setup_textoverlay (TRUE);
- fail_unless (gst_element_set_state (textoverlay,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = create_black_buffer (VIDEO_CAPS_STRING);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* ========== (1) video buffer without timestamp => should be dropped ==== */
-
- /* take additional ref to keep it alive */
- gst_buffer_ref (inbuffer);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 2);
-
- /* pushing gives away one of the two references we have ... */
- fail_unless (gst_pad_push (myvideosrcpad, inbuffer) == GST_FLOW_OK);
-
- /* should have been discarded as out-of-segment since it has no timestamp */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 0);
-
- /* ========== (2) buffer with 0 timestamp => simple passthrough ========== */
-
- /* now try again, this time with timestamp (segment defaults to 0 start) */
- GST_BUFFER_TIMESTAMP (inbuffer) = 0;
- GST_BUFFER_DURATION (inbuffer) = GST_CLOCK_TIME_NONE;
-
- /* take additional ref to keep it alive */
- gst_buffer_ref (inbuffer);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 2);
-
- /* pushing gives away one of the two references we have ... */
- fail_unless (gst_pad_push (myvideosrcpad, inbuffer) == GST_FLOW_OK);
-
- /* text pad is not linked, timestamp is in segment, no static text to
- * render, should have gone through right away without modification */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_unless (GST_BUFFER_CAST (buffers->data) == inbuffer);
- fail_unless (buffer_is_all_black (inbuffer));
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 2);
-
- /* and clean up */
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* ========== (3) buffer with 0 timestamp and no duration, with the
- * segment starting from 1sec => should be discarded */
-
- gst_pad_push_event (myvideosrcpad,
- gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 1 * GST_SECOND,
- -1, 0));
-
- GST_BUFFER_TIMESTAMP (inbuffer) = 0;
- GST_BUFFER_DURATION (inbuffer) = GST_CLOCK_TIME_NONE;
-
- /* take additional ref to keep it alive */
- gst_buffer_ref (inbuffer);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 2);
-
- /* pushing gives away one of the two references we have ... */
- fail_unless (gst_pad_push (myvideosrcpad, inbuffer) == GST_FLOW_OK);
-
- /* should have been discarded as out-of-segment */
- fail_unless_equals_int (g_list_length (buffers), 0);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* ========== (4) buffer with 0 timestamp and small defined duration, with
- * segment starting from 1sec => should be discarded */
-
- gst_pad_push_event (myvideosrcpad,
- gst_event_new_new_segment (FALSE, 1.0, 1 * GST_FORMAT_TIME, GST_SECOND,
- -1, 0));
-
- GST_BUFFER_DURATION (inbuffer) = GST_SECOND / 10;
-
- /* take additional ref to keep it alive */
- gst_buffer_ref (inbuffer);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 2);
-
- /* pushing gives away one of the two references we have ... */
- fail_unless (gst_pad_push (myvideosrcpad, inbuffer) == GST_FLOW_OK);
-
- /* should have been discareded as out-of-segment since it has no timestamp */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 0);
-
- /* ========== (5) buffer partially overlapping into the segment => should
- * be pushed through, but with adjusted stamp values */
-
- gst_pad_push_event (myvideosrcpad,
- gst_event_new_new_segment (FALSE, 1.0, 1 * GST_FORMAT_TIME, GST_SECOND,
- -1, 0));
-
- GST_BUFFER_TIMESTAMP (inbuffer) = GST_SECOND / 4;
- GST_BUFFER_DURATION (inbuffer) = GST_SECOND;
-
- /* take additional ref to keep it alive */
- gst_buffer_ref (inbuffer);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 2);
-
- /* pushing gives away one of the two references we have ... */
- fail_unless (gst_pad_push (myvideosrcpad, inbuffer) == GST_FLOW_OK);
-
- /* should be the parent for a new subbuffer for the stamp fix-up */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 2);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_unless (GST_BUFFER_CAST (buffers->data) != inbuffer);
- fail_unless (GST_BUFFER_TIMESTAMP (GST_BUFFER_CAST (buffers->data)) ==
- GST_SECOND);
- fail_unless (GST_BUFFER_DURATION (GST_BUFFER_CAST (buffers->data)) ==
- (GST_SECOND / 4));
- fail_unless (buffer_is_all_black (GST_BUFFER_CAST (buffers->data)));
- /* and clean up */
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* cleanup */
- cleanup_textoverlay (textoverlay);
- gst_buffer_unref (inbuffer);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_video_render_static_text)
-{
- GstElement *textoverlay;
- GstBuffer *inbuffer;
-
- textoverlay = setup_textoverlay (TRUE);
-
- /* set static text to render */
- g_object_set (textoverlay, "text", "XLX", NULL);
-
- fail_unless (gst_element_set_state (textoverlay,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = create_black_buffer (VIDEO_CAPS_STRING);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- GST_BUFFER_TIMESTAMP (inbuffer) = 0;
- GST_BUFFER_DURATION (inbuffer) = GST_SECOND / 10;
-
- /* take additional ref to keep it alive */
- gst_buffer_ref (inbuffer);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 2);
-
- /* pushing gives away one of the two references we have ... */
- fail_unless (gst_pad_push (myvideosrcpad, inbuffer) == GST_FLOW_OK);
-
- /* should have been dropped in favour of a new writable buffer */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_unless (GST_BUFFER_CAST (buffers->data) != inbuffer);
-
- /* there should be text rendered */
- fail_unless (buffer_is_all_black (GST_BUFFER_CAST (buffers->data)) == FALSE);
-
- fail_unless (GST_BUFFER_TIMESTAMP (GST_BUFFER_CAST (buffers->data)) == 0);
- fail_unless (GST_BUFFER_DURATION (GST_BUFFER_CAST (buffers->data)) ==
- (GST_SECOND / 10));
-
- /* and clean up */
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* cleanup */
- cleanup_textoverlay (textoverlay);
- gst_buffer_unref (inbuffer);
-}
-
-GST_END_TEST;
-
-static gpointer
-test_video_waits_for_text_send_text_newsegment_thread (gpointer data)
-{
- g_usleep (1 * G_USEC_PER_SEC);
-
- /* send an update newsegment; the video buffer should now be pushed through
- * even though there is no text buffer queued at the moment */
- GST_INFO ("Sending newsegment update on text pad");
- gst_pad_push_event (mytextsrcpad,
- gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME,
- 35 * GST_SECOND, -1, 35 * GST_SECOND));
-
- return NULL;
-}
-
-static gpointer
-test_video_waits_for_text_shutdown_element (gpointer data)
-{
- g_usleep (1 * G_USEC_PER_SEC);
-
- GST_INFO ("Trying to shut down textoverlay element ...");
- /* set to NULL state to make sure we can shut it down while it's
- * blocking in the video chain function waiting for a text buffer */
- gst_element_set_state (GST_ELEMENT (data), GST_STATE_NULL);
- GST_INFO ("Done.");
-
- return NULL;
-}
-
-GST_START_TEST (test_video_waits_for_text)
-{
- GstElement *textoverlay;
- GstBuffer *inbuffer, *tbuf;
- GThread *thread;
-
- textoverlay = setup_textoverlay (FALSE);
-
- fail_unless (gst_element_set_state (textoverlay,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- tbuf = create_text_buffer ("XLX", 1 * GST_SECOND, 5 * GST_SECOND);
- gst_buffer_ref (tbuf);
- ASSERT_BUFFER_REFCOUNT (tbuf, "tbuf", 2);
-
- GST_LOG ("pushing text buffer");
- fail_unless (gst_pad_push (mytextsrcpad, tbuf) == GST_FLOW_OK);
-
- /* it should be stuck in textoverlay until it gets a text buffer or a
- * newsegment event that indicates it's not needed any longer */
- fail_unless_equals_int (g_list_length (buffers), 0);
-
- inbuffer = create_black_buffer (VIDEO_CAPS_STRING);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- GST_BUFFER_TIMESTAMP (inbuffer) = 0;
- GST_BUFFER_DURATION (inbuffer) = GST_SECOND / 2;
-
- /* take additional ref to keep it alive */
- gst_buffer_ref (inbuffer);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 2);
-
- /* pushing gives away one of the two references we have ... */
- GST_LOG ("pushing video buffer 1");
- fail_unless (gst_pad_push (myvideosrcpad, inbuffer) == GST_FLOW_OK);
-
- /* video buffer should have gone through untainted, since the text is later */
- fail_unless_equals_int (g_list_length (buffers), 1);
-
- /* text should still be stuck in textoverlay */
- ASSERT_BUFFER_REFCOUNT (tbuf, "tbuf", 2);
-
- /* there should be no text rendered */
- fail_unless (buffer_is_all_black (GST_BUFFER_CAST (buffers->data)));
-
- /* now, another video buffer */
- inbuffer = gst_buffer_make_metadata_writable (inbuffer);
- GST_BUFFER_TIMESTAMP (inbuffer) = GST_SECOND;
- GST_BUFFER_DURATION (inbuffer) = GST_SECOND / 2;
-
- /* pushing gives away one of the two references we have ... */
- GST_LOG ("pushing video buffer 2");
- gst_buffer_ref (inbuffer);
- fail_unless (gst_pad_push (myvideosrcpad, inbuffer) == GST_FLOW_OK);
-
- /* video buffer should have gone right away, with text rendered on it */
- fail_unless_equals_int (g_list_length (buffers), 2);
-
- /* text should still be stuck in textoverlay */
- ASSERT_BUFFER_REFCOUNT (tbuf, "tbuf", 2);
-
- /* there should be text rendered */
- fail_unless (buffer_is_all_black (GST_BUFFER_CAST (buffers->next->data)) ==
- FALSE);
-
- /* a third video buffer */
- inbuffer = gst_buffer_make_metadata_writable (inbuffer);
- GST_BUFFER_TIMESTAMP (inbuffer) = 30 * GST_SECOND;
- GST_BUFFER_DURATION (inbuffer) = GST_SECOND / 2;
-
- /* video buffer #3: should not go through, it should discard the current
- * text buffer as too old and then wait for the next text buffer (or a
- * newsegment event to arrive); we spawn a background thread to send such
- * a newsegment event after a second or so so we get back control */
- thread =
- g_thread_create (test_video_waits_for_text_send_text_newsegment_thread,
- NULL, FALSE, NULL);
- fail_unless (thread != NULL);
-
- GST_LOG ("pushing video buffer 3");
- gst_buffer_ref (inbuffer);
- fail_unless (gst_pad_push (myvideosrcpad, inbuffer) == GST_FLOW_OK);
-
- /* but the text should no longer be stuck in textoverlay */
- ASSERT_BUFFER_REFCOUNT (tbuf, "tbuf", 1);
-
- /* video buffer should have gone through after newsegment event */
- fail_unless_equals_int (g_list_length (buffers), 3);
-
- /* ... and there should not be any text rendered on it */
- fail_unless (buffer_is_all_black (GST_BUFFER_CAST (buffers->next->next->
- data)));
-
- /* a fourth video buffer */
- inbuffer = gst_buffer_make_metadata_writable (inbuffer);
- GST_BUFFER_TIMESTAMP (inbuffer) = 35 * GST_SECOND;
- GST_BUFFER_DURATION (inbuffer) = GST_SECOND;
-
- /* video buffer #4: should not go through, it should wait for the next
- * text buffer (or a newsegment event) to arrive; we spawn a background
- * thread to shut down the element while it's waiting to make sure that
- * works ok */
- thread = g_thread_create (test_video_waits_for_text_shutdown_element,
- textoverlay, FALSE, NULL);
- fail_unless (thread != NULL);
-
- GST_LOG ("pushing video buffer 4");
- gst_buffer_ref (inbuffer);
- fail_unless (gst_pad_push (myvideosrcpad, inbuffer) == GST_FLOW_WRONG_STATE);
-
- /* and clean up */
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* cleanup */
- cleanup_textoverlay (textoverlay);
- gst_buffer_unref (inbuffer);
-
- /* give up our ref, textoverlay should've cleared its queued buffer by now */
- ASSERT_BUFFER_REFCOUNT (tbuf, "tbuf", 1);
- gst_buffer_unref (tbuf);
-}
-
-GST_END_TEST;
-
-static gpointer
-test_render_continuity_push_video_buffers_thread (gpointer data)
-{
- /* push video buffers at 1fps */
- guint frame_count = 0;
-
- do {
- GstBuffer *vbuf;
-
- vbuf = create_black_buffer (VIDEO_CAPS_STRING);
- ASSERT_BUFFER_REFCOUNT (vbuf, "vbuf", 1);
-
- GST_BUFFER_TIMESTAMP (vbuf) = frame_count * GST_SECOND;
- GST_BUFFER_DURATION (vbuf) = GST_SECOND;
-
- /* pushing gives away one of the two references we have ... */
- GST_LOG ("pushing video buffer %u @ %" GST_TIME_FORMAT, frame_count,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (vbuf)));
- fail_unless (gst_pad_push (myvideosrcpad, vbuf) == GST_FLOW_OK);
-
- ++frame_count;
- } while (frame_count < 15);
-
- return NULL;
-}
-
-
-GST_START_TEST (test_render_continuity)
-{
- GThread *thread;
- GstElement *textoverlay;
- GstBuffer *tbuf;
-
- textoverlay = setup_textoverlay (FALSE);
-
- fail_unless (gst_element_set_state (textoverlay,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- thread = g_thread_create (test_render_continuity_push_video_buffers_thread,
- NULL, FALSE, NULL);
- fail_unless (thread != NULL);
-
- tbuf = create_text_buffer ("XLX", 2 * GST_SECOND, GST_SECOND);
- GST_LOG ("pushing text buffer @ %" GST_TIME_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (tbuf)));
- fail_unless (gst_pad_push (mytextsrcpad, tbuf) == GST_FLOW_OK);
-
- tbuf = create_text_buffer ("XLX", 3 * GST_SECOND, 2 * GST_SECOND);
- GST_LOG ("pushing text buffer @ %" GST_TIME_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (tbuf)));
- fail_unless (gst_pad_push (mytextsrcpad, tbuf) == GST_FLOW_OK);
-
- tbuf = create_text_buffer ("XLX", 7 * GST_SECOND, GST_SECOND);
- GST_LOG ("pushing text buffer @ %" GST_TIME_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (tbuf)));
- fail_unless (gst_pad_push (mytextsrcpad, tbuf) == GST_FLOW_OK);
-
- tbuf = create_text_buffer ("XLX", 8 * GST_SECOND, GST_SECOND);
- GST_LOG ("pushing text buffer @ %" GST_TIME_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (tbuf)));
- fail_unless (gst_pad_push (mytextsrcpad, tbuf) == GST_FLOW_OK);
-
- tbuf = create_text_buffer ("XLX", 9 * GST_SECOND, GST_SECOND);
- GST_LOG ("pushing text buffer @ %" GST_TIME_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (tbuf)));
- fail_unless (gst_pad_push (mytextsrcpad, tbuf) == GST_FLOW_OK);
-
- tbuf = create_text_buffer ("XLX", 10 * GST_SECOND, 30 * GST_SECOND);
- GST_LOG ("pushing text buffer @ %" GST_TIME_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (tbuf)));
- fail_unless (gst_pad_push (mytextsrcpad, tbuf) == GST_FLOW_OK);
-
- GST_LOG ("give the other thread some time to push through the remaining"
- "video buffers");
- g_usleep (G_USEC_PER_SEC);
- GST_LOG ("done");
-
- /* we should have 15 buffers each with one second length now */
- fail_unless_equals_int (g_list_length (buffers), 15);
-
- /* buffers 0 + 1 should be black */
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers, 0))));
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers, 1))));
-
- /* buffers 2 - 4 should have text */
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 2))) == FALSE);
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 3))) == FALSE);
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 4))) == FALSE);
-
- /* buffers 5 + 6 should be black */
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers, 5))));
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers, 6))));
-
- /* buffers 7 - last should have text */
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 7))) == FALSE);
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 8))) == FALSE);
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 9))) == FALSE);
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 10))) == FALSE);
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 11))) == FALSE);
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 12))) == FALSE);
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 13))) == FALSE);
- fail_unless (buffer_is_all_black (GST_BUFFER (g_list_nth_data (buffers,
- 14))) == FALSE);
-
- /* and clean up */
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
-
- /* cleanup */
- cleanup_textoverlay (textoverlay);
-}
-
-GST_END_TEST;
-
-static Suite *
-textoverlay_suite (void)
-{
- Suite *s = suite_create ("textoverlay");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
-
- tcase_add_test (tc_chain, test_video_passthrough);
- tcase_add_test (tc_chain, test_video_render_static_text);
- tcase_add_test (tc_chain, test_render_continuity);
- tcase_add_test (tc_chain, test_video_waits_for_text);
-
- return s;
-}
-
-GST_CHECK_MAIN (textoverlay);
diff --git a/tests/check/elements/videorate.c b/tests/check/elements/videorate.c
deleted file mode 100644
index 010ee775..00000000
--- a/tests/check/elements/videorate.c
+++ /dev/null
@@ -1,783 +0,0 @@
-/* GStreamer
- *
- * unit test for videorate
- *
- * Copyright (C) 2006 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-
-/* For ease of programming we use globals to keep refs for our floating
- * src and sink pads we create; otherwise we always have to do get_pad,
- * get_peer, and then remove references in every test function */
-static GstPad *mysrcpad, *mysinkpad;
-
-
-#define VIDEO_CAPS_TEMPLATE_STRING \
- "video/x-raw-yuv"
-
-#define VIDEO_CAPS_STRING \
- "video/x-raw-yuv, " \
- "width = (int) 320, " \
- "height = (int) 240, " \
- "framerate = (fraction) 25/1 , " \
- "format = (fourcc) I420"
-
-#define VIDEO_CAPS_NO_FRAMERATE_STRING \
- "video/x-raw-yuv, " \
- "width = (int) 320, " \
- "height = (int) 240, " \
- "format = (fourcc) I420"
-
-#define VIDEO_CAPS_NEWSIZE_STRING \
- "video/x-raw-yuv, " \
- "width = (int) 240, " \
- "height = (int) 120, " \
- "framerate = (fraction) 25/1 , " \
- "format = (fourcc) I420"
-
-#define VIDEO_CAPS_UNUSUAL_FRAMERATE \
- "video/x-raw-yuv, " \
- "width = (int) 240, " \
- "height = (int) 120, " \
- "framerate = (fraction) 999/7 , " \
- "format = (fourcc) I420"
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (VIDEO_CAPS_TEMPLATE_STRING)
- );
-static GstStaticPadTemplate downstreamsinktemplate =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (VIDEO_CAPS_STRING)
- );
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (VIDEO_CAPS_TEMPLATE_STRING)
- );
-
-static void
-assert_videorate_stats (GstElement * videorate, gchar * reason,
- guint64 xin, guint64 xout, guint64 xdropped, guint64 xduplicated)
-{
- guint64 in, out, dropped, duplicated;
-
- g_object_get (videorate, "in", &in, "out", &out, "drop", &dropped,
- "duplicate", &duplicated, NULL);
-#define _assert_equals_uint64(a, b) \
-G_STMT_START { \
- guint64 first = a; \
- guint64 second = b; \
- fail_unless(first == second, \
- "%s: '" #a "' (%" G_GUINT64_FORMAT ") is not equal to " \
- "expected '" #a"' (%" G_GUINT64_FORMAT ")", reason, first, second); \
-} G_STMT_END;
-
-
- _assert_equals_uint64 (in, xin);
- _assert_equals_uint64 (out, xout);
- _assert_equals_uint64 (dropped, xdropped);
- _assert_equals_uint64 (duplicated, xduplicated);
-}
-
-static GstElement *
-setup_videorate_full (GstStaticPadTemplate * srctemplate,
- GstStaticPadTemplate * sinktemplate)
-{
- GstElement *videorate;
-
- GST_DEBUG ("setup_videorate");
- videorate = gst_check_setup_element ("videorate");
- mysrcpad = gst_check_setup_src_pad (videorate, srctemplate, NULL);
- mysinkpad = gst_check_setup_sink_pad (videorate, sinktemplate, NULL);
- gst_pad_set_active (mysrcpad, TRUE);
- gst_pad_set_active (mysinkpad, TRUE);
-
- return videorate;
-}
-
-static GstElement *
-setup_videorate (void)
-{
- return setup_videorate_full (&srctemplate, &sinktemplate);
-}
-
-static void
-cleanup_videorate (GstElement * videorate)
-{
- GST_DEBUG ("cleanup_videorate");
-
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
-
- gst_element_set_state (videorate, GST_STATE_NULL);
- gst_element_get_state (videorate, NULL, NULL, GST_CLOCK_TIME_NONE);
- gst_pad_set_active (mysrcpad, FALSE);
- gst_pad_set_active (mysinkpad, FALSE);
- gst_check_teardown_src_pad (videorate);
- gst_check_teardown_sink_pad (videorate);
- gst_check_teardown_element (videorate);
-}
-
-GST_START_TEST (test_one)
-{
- GstElement *videorate;
- GstBuffer *inbuffer;
- GstCaps *caps;
-
- videorate = setup_videorate ();
- fail_unless (gst_element_set_state (videorate,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (4);
- memset (GST_BUFFER_DATA (inbuffer), 0, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (inbuffer, caps);
- GST_BUFFER_TIMESTAMP (inbuffer) = 0;
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and it is now stuck inside videorate */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 0);
-
- /* cleanup */
- cleanup_videorate (videorate);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_more)
-{
- GstElement *videorate;
- GstBuffer *first, *second, *third, *outbuffer;
- GList *l;
- GstCaps *caps;
- GRand *rand;
-
- videorate = setup_videorate ();
- fail_unless (gst_element_set_state (videorate,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
- assert_videorate_stats (videorate, "creation", 0, 0, 0, 0);
-
- rand = g_rand_new ();
-
- /* first buffer */
- first = gst_buffer_new_and_alloc (4);
- GST_BUFFER_TIMESTAMP (first) = 0;
- /* it shouldn't matter what the offsets are, videorate produces perfect
- streams */
- GST_BUFFER_OFFSET (first) = g_rand_int (rand);
- GST_BUFFER_OFFSET_END (first) = g_rand_int (rand);
- memset (GST_BUFFER_DATA (first), 1, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (first, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (first, "first", 1);
- gst_buffer_ref (first);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, first) == GST_FLOW_OK);
- /* ... and it is now stuck inside videorate */
- ASSERT_BUFFER_REFCOUNT (first, "first", 2);
- fail_unless_equals_int (g_list_length (buffers), 0);
- assert_videorate_stats (videorate, "first buffer", 1, 0, 0, 0);
-
- /* second buffer; inbetween second and third output frame's timestamp */
- second = gst_buffer_new_and_alloc (4);
- GST_BUFFER_TIMESTAMP (second) = GST_SECOND * 3 / 50;
- GST_BUFFER_OFFSET (first) = g_rand_int (rand);
- GST_BUFFER_OFFSET_END (first) = g_rand_int (rand);
- memset (GST_BUFFER_DATA (second), 2, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (second, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (second, "second", 1);
- gst_buffer_ref (second);
-
- /* pushing gives away one of my references ... */
- fail_unless (gst_pad_push (mysrcpad, second) == GST_FLOW_OK);
- /* ... and it is now stuck inside videorate */
- ASSERT_BUFFER_REFCOUNT (second, "second", 2);
-
- /* ... and the first one is pushed out, with timestamp 0 */
- fail_unless_equals_int (g_list_length (buffers), 1);
- assert_videorate_stats (videorate, "second buffer", 2, 1, 0, 0);
- ASSERT_BUFFER_REFCOUNT (first, "first", 2);
-
- outbuffer = buffers->data;
- fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (outbuffer), 0);
-
- /* third buffer */
- third = gst_buffer_new_and_alloc (4);
- GST_BUFFER_TIMESTAMP (third) = GST_SECOND * 12 / 50;
- GST_BUFFER_OFFSET (first) = g_rand_int (rand);
- GST_BUFFER_OFFSET_END (first) = g_rand_int (rand);
- memset (GST_BUFFER_DATA (third), 3, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (third, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (third, "third", 1);
- gst_buffer_ref (third);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, third) == GST_FLOW_OK);
- /* ... and it is now stuck inside videorate */
- ASSERT_BUFFER_REFCOUNT (third, "third", 2);
-
- /* submitting the third buffer has triggered flushing of three more frames */
- assert_videorate_stats (videorate, "third buffer", 3, 4, 0, 2);
-
- /* check timestamp and source correctness */
- l = buffers;
- fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (l->data), 0);
- fail_unless_equals_int (GST_BUFFER_DATA (l->data)[0], 1);
- fail_unless_equals_uint64 (GST_BUFFER_OFFSET (l->data), 0);
- fail_unless_equals_uint64 (GST_BUFFER_OFFSET_END (l->data), 1);
-
- l = g_list_next (l);
- fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (l->data), GST_SECOND / 25);
- fail_unless_equals_int (GST_BUFFER_DATA (l->data)[0], 2);
- fail_unless_equals_uint64 (GST_BUFFER_OFFSET (l->data), 1);
- fail_unless_equals_uint64 (GST_BUFFER_OFFSET_END (l->data), 2);
-
- l = g_list_next (l);
- fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (l->data),
- GST_SECOND * 2 / 25);
- fail_unless_equals_int (GST_BUFFER_DATA (l->data)[0], 2);
- fail_unless_equals_uint64 (GST_BUFFER_OFFSET (l->data), 2);
- fail_unless_equals_uint64 (GST_BUFFER_OFFSET_END (l->data), 3);
-
- l = g_list_next (l);
- fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (l->data),
- GST_SECOND * 3 / 25);
- fail_unless_equals_int (GST_BUFFER_DATA (l->data)[0], 2);
- fail_unless_equals_uint64 (GST_BUFFER_OFFSET (l->data), 3);
- fail_unless_equals_uint64 (GST_BUFFER_OFFSET_END (l->data), 4);
-
- fail_unless_equals_int (g_list_length (buffers), 4);
- /* one held by us, three held by each output frame taken from the second */
- ASSERT_BUFFER_REFCOUNT (second, "second", 4);
-
- /* now send EOS */
- fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
-
- /* submitting eos should flush out two more frames for tick 8 and 10 */
- /* FIXME: right now it only flushes out one, so out is 5 instead of 6 ! */
- assert_videorate_stats (videorate, "eos", 3, 5, 0, 2);
- fail_unless_equals_int (g_list_length (buffers), 5);
-
- /* cleanup */
- g_rand_free (rand);
- gst_buffer_unref (first);
- gst_buffer_unref (second);
- gst_buffer_unref (third);
- cleanup_videorate (videorate);
-}
-
-GST_END_TEST;
-
-/* frames at 1, 0, 2 -> second one should be ignored */
-GST_START_TEST (test_wrong_order_from_zero)
-{
- GstElement *videorate;
- GstBuffer *first, *second, *third, *outbuffer;
- GstCaps *caps;
-
- videorate = setup_videorate ();
- fail_unless (gst_element_set_state (videorate,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
- assert_videorate_stats (videorate, "start", 0, 0, 0, 0);
-
- /* first buffer */
- first = gst_buffer_new_and_alloc (4);
- GST_BUFFER_TIMESTAMP (first) = GST_SECOND;
- memset (GST_BUFFER_DATA (first), 0, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (first, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (first, "first", 1);
- gst_buffer_ref (first);
-
- GST_DEBUG ("pushing first buffer");
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, first) == GST_FLOW_OK);
- /* ... and it is now stuck inside videorate */
- ASSERT_BUFFER_REFCOUNT (first, "first", 2);
- fail_unless_equals_int (g_list_length (buffers), 0);
- assert_videorate_stats (videorate, "first", 1, 0, 0, 0);
-
- /* second buffer */
- second = gst_buffer_new_and_alloc (4);
- GST_BUFFER_TIMESTAMP (second) = 0;
- memset (GST_BUFFER_DATA (second), 0, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (second, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (second, "second", 1);
- gst_buffer_ref (second);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, second) == GST_FLOW_OK);
- /* ... and it is now dropped because it is too old */
- ASSERT_BUFFER_REFCOUNT (second, "second", 1);
- fail_unless_equals_int (g_list_length (buffers), 0);
-
- /* ... and the first one is still there */
- assert_videorate_stats (videorate, "second", 2, 0, 1, 0);
- ASSERT_BUFFER_REFCOUNT (first, "first", 2);
-
- /* third buffer */
- third = gst_buffer_new_and_alloc (4);
- GST_BUFFER_TIMESTAMP (third) = 2 * GST_SECOND;
- memset (GST_BUFFER_DATA (third), 0, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (third, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (third, "third", 1);
- gst_buffer_ref (third);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, third) == GST_FLOW_OK);
- /* ... and it is now stuck inside videorate */
- ASSERT_BUFFER_REFCOUNT (third, "third", 2);
-
- /* and now the first one should be pushed once and dupped 24 + 13 times, to
- * reach the half point between 1 s (first) and 2 s (third) */
- fail_unless_equals_int (g_list_length (buffers), 38);
- ASSERT_BUFFER_REFCOUNT (first, "first", 39);
- ASSERT_BUFFER_REFCOUNT (second, "second", 1);
- ASSERT_BUFFER_REFCOUNT (third, "third", 2);
- assert_videorate_stats (videorate, "third", 3, 38, 1, 37);
-
- /* verify last buffer */
- outbuffer = g_list_last (buffers)->data;
- fail_unless (GST_IS_BUFFER (outbuffer));
- fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (outbuffer),
- GST_SECOND * 37 / 25);
-
- /* cleanup */
- gst_buffer_unref (first);
- gst_buffer_unref (second);
- gst_buffer_unref (third);
- cleanup_videorate (videorate);
-}
-
-GST_END_TEST;
-
-/* send frames with 0, 1, 2, 0 seconds */
-GST_START_TEST (test_wrong_order)
-{
- GstElement *videorate;
- GstBuffer *first, *second, *third, *fourth, *outbuffer;
- GstCaps *caps;
-
- videorate = setup_videorate ();
- fail_unless (gst_element_set_state (videorate,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
- assert_videorate_stats (videorate, "start", 0, 0, 0, 0);
-
- /* first buffer */
- first = gst_buffer_new_and_alloc (4);
- GST_BUFFER_TIMESTAMP (first) = 0;
- memset (GST_BUFFER_DATA (first), 0, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (first, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (first, "first", 1);
- gst_buffer_ref (first);
-
- GST_DEBUG ("pushing first buffer");
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, first) == GST_FLOW_OK);
- /* ... and it is now stuck inside videorate */
- ASSERT_BUFFER_REFCOUNT (first, "first", 2);
- fail_unless_equals_int (g_list_length (buffers), 0);
- assert_videorate_stats (videorate, "first", 1, 0, 0, 0);
-
- /* second buffer */
- second = gst_buffer_new_and_alloc (4);
- GST_BUFFER_TIMESTAMP (second) = GST_SECOND;
- memset (GST_BUFFER_DATA (second), 0, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (second, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (second, "second", 1);
- gst_buffer_ref (second);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, second) == GST_FLOW_OK);
- /* ... and it is now stuck inside videorate */
- ASSERT_BUFFER_REFCOUNT (second, "second", 2);
- /* and it created 13 output buffers as copies of the first frame */
- fail_unless_equals_int (g_list_length (buffers), 13);
- assert_videorate_stats (videorate, "second", 2, 13, 0, 12);
- ASSERT_BUFFER_REFCOUNT (first, "first", 14);
-
- /* third buffer */
- third = gst_buffer_new_and_alloc (4);
- GST_BUFFER_TIMESTAMP (third) = 2 * GST_SECOND;
- memset (GST_BUFFER_DATA (third), 0, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (third, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (third, "third", 1);
- gst_buffer_ref (third);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, third) == GST_FLOW_OK);
- /* ... and it is now stuck inside videorate */
- ASSERT_BUFFER_REFCOUNT (third, "third", 2);
-
- /* submitting a frame with 2 seconds triggers output of 25 more frames */
- fail_unless_equals_int (g_list_length (buffers), 38);
- ASSERT_BUFFER_REFCOUNT (first, "first", 14);
- ASSERT_BUFFER_REFCOUNT (second, "second", 26);
- /* three frames submitted; two of them output as is, and 36 duplicated */
- assert_videorate_stats (videorate, "third", 3, 38, 0, 36);
-
- /* fourth buffer */
- fourth = gst_buffer_new_and_alloc (4);
- GST_BUFFER_TIMESTAMP (fourth) = 0;
- memset (GST_BUFFER_DATA (fourth), 0, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (fourth, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (fourth, "fourth", 1);
- gst_buffer_ref (fourth);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, fourth) == GST_FLOW_OK);
- /* ... and it is dropped */
- ASSERT_BUFFER_REFCOUNT (fourth, "fourth", 1);
-
- fail_unless_equals_int (g_list_length (buffers), 38);
- ASSERT_BUFFER_REFCOUNT (first, "first", 14);
- ASSERT_BUFFER_REFCOUNT (second, "second", 26);
- assert_videorate_stats (videorate, "fourth", 4, 38, 1, 36);
-
- /* verify last buffer */
- outbuffer = g_list_last (buffers)->data;
- fail_unless (GST_IS_BUFFER (outbuffer));
- fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (outbuffer),
- GST_SECOND * 37 / 25);
-
-
- /* cleanup */
- gst_buffer_unref (first);
- gst_buffer_unref (second);
- gst_buffer_unref (third);
- gst_buffer_unref (fourth);
- cleanup_videorate (videorate);
-}
-
-GST_END_TEST;
-
-
-/* if no framerate is negotiated, we should not be able to push a buffer */
-GST_START_TEST (test_no_framerate)
-{
- GstElement *videorate;
- GstBuffer *inbuffer;
- GstCaps *caps;
-
- videorate = setup_videorate ();
- fail_unless (gst_element_set_state (videorate,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (4);
- memset (GST_BUFFER_DATA (inbuffer), 0, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_NO_FRAMERATE_STRING);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* take a ref so we can later check refcount */
- gst_buffer_ref (inbuffer);
-
- /* no framerate is negotiated so pushing should fail */
- fail_if (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- gst_buffer_unref (inbuffer);
- fail_unless_equals_int (g_list_length (buffers), 0);
-
- /* cleanup */
- cleanup_videorate (videorate);
-}
-
-GST_END_TEST;
-
-/* This test outputs 2 buffers of same dimensions (320x240), then 1 buffer of
- * differing dimensions (240x120), and then another buffer of previous
- * dimensions (320x240) and checks that the 3 buffers output as a result have
- * correct caps (first 2 with 320x240 and 3rd with 240x120).
- */
-GST_START_TEST (test_changing_size)
-{
- GstElement *videorate;
- GstBuffer *first;
- GstBuffer *second;
- GstBuffer *third;
- GstBuffer *fourth;
- GstBuffer *fifth;
- GstBuffer *outbuf;
- GstEvent *newsegment;
- GstCaps *caps, *caps_newsize;
-
- videorate = setup_videorate ();
- fail_unless (gst_element_set_state (videorate,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- newsegment = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1,
- 0);
- fail_unless (gst_pad_push_event (mysrcpad, newsegment) == TRUE);
-
- first = gst_buffer_new_and_alloc (4);
- memset (GST_BUFFER_DATA (first), 0, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- GST_BUFFER_TIMESTAMP (first) = 0;
- gst_buffer_set_caps (first, caps);
-
- GST_DEBUG ("pushing first buffer");
- fail_unless (gst_pad_push (mysrcpad, first) == GST_FLOW_OK);
-
- /* second buffer */
- second = gst_buffer_new_and_alloc (4);
- GST_BUFFER_TIMESTAMP (second) = GST_SECOND / 25;
- memset (GST_BUFFER_DATA (second), 0, 4);
- gst_buffer_set_caps (second, caps);
-
- fail_unless (gst_pad_push (mysrcpad, second) == GST_FLOW_OK);
- fail_unless_equals_int (g_list_length (buffers), 1);
- outbuf = buffers->data;
- /* first buffer should be output here */
- fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (outbuf), caps));
- fail_unless (GST_BUFFER_TIMESTAMP (outbuf) == 0);
-
- /* third buffer with new size */
- third = gst_buffer_new_and_alloc (4);
- GST_BUFFER_TIMESTAMP (third) = 2 * GST_SECOND / 25;
- memset (GST_BUFFER_DATA (third), 0, 4);
- caps_newsize = gst_caps_from_string (VIDEO_CAPS_NEWSIZE_STRING);
- gst_buffer_set_caps (third, caps_newsize);
-
- fail_unless (gst_pad_push (mysrcpad, third) == GST_FLOW_OK);
- /* new caps flushed the internal state, no new output yet */
- fail_unless_equals_int (g_list_length (buffers), 1);
- outbuf = g_list_last (buffers)->data;
- /* first buffer should be output here */
- fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (outbuf), caps));
- fail_unless (GST_BUFFER_TIMESTAMP (outbuf) == 0);
-
- /* fourth buffer with original size */
- fourth = gst_buffer_new_and_alloc (4);
- GST_BUFFER_TIMESTAMP (fourth) = 3 * GST_SECOND / 25;
- memset (GST_BUFFER_DATA (fourth), 0, 4);
- gst_buffer_set_caps (fourth, caps);
-
- fail_unless (gst_pad_push (mysrcpad, fourth) == GST_FLOW_OK);
- fail_unless_equals_int (g_list_length (buffers), 1);
-
- /* fifth buffer with original size */
- fifth = gst_buffer_new_and_alloc (4);
- GST_BUFFER_TIMESTAMP (fifth) = 4 * GST_SECOND / 25;
- memset (GST_BUFFER_DATA (fifth), 0, 4);
- gst_buffer_set_caps (fifth, caps);
-
- fail_unless (gst_pad_push (mysrcpad, fifth) == GST_FLOW_OK);
- /* all four missing buffers here, dups of fourth buffer */
- fail_unless_equals_int (g_list_length (buffers), 4);
- outbuf = g_list_last (buffers)->data;
- /* third buffer should be output here */
- fail_unless (GST_BUFFER_TIMESTAMP (outbuf) == 3 * GST_SECOND / 25);
- fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (outbuf), caps));
-
- gst_caps_unref (caps);
- gst_caps_unref (caps_newsize);
- cleanup_videorate (videorate);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_non_ok_flow)
-{
- GstElement *videorate;
- GstClockTime ts;
- GstBuffer *buf;
- GstCaps *caps;
-
- videorate = setup_videorate ();
- fail_unless (gst_element_set_state (videorate,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- buf = gst_buffer_new_and_alloc (4);
- memset (GST_BUFFER_DATA (buf), 0, 4);
- caps = gst_caps_from_string (VIDEO_CAPS_STRING);
- gst_buffer_set_caps (buf, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (buf, "inbuffer", 1);
-
- /* push a few 'normal' buffers */
- for (ts = 0; ts < 100 * GST_SECOND; ts += GST_SECOND / 33) {
- GstBuffer *inbuf;
-
- inbuf = gst_buffer_copy (buf);
- GST_BUFFER_TIMESTAMP (inbuf) = ts;
-
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuf), GST_FLOW_OK);
- }
-
- /* we should have buffers according to the output framerate of 25/1 */
- fail_unless_equals_int (g_list_length (buffers), 100 * 25);
-
- /* now deactivate pad so we get a WRONG_STATE flow return */
- gst_pad_set_active (mysinkpad, FALSE);
-
- /* push buffer on deactivated pad */
- fail_unless (gst_buffer_is_metadata_writable (buf));
- GST_BUFFER_TIMESTAMP (buf) = ts;
-
- /* pushing gives away our reference */
- fail_unless_equals_int (gst_pad_push (mysrcpad, buf), GST_FLOW_WRONG_STATE);
-
- /* cleanup */
- cleanup_videorate (videorate);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_upstream_caps_nego)
-{
- GstElement *videorate;
- GstPad *videorate_pad;
- GstCaps *expected_caps;
- GstCaps *caps;
- GstStructure *structure;
-
- videorate = setup_videorate_full (&srctemplate, &downstreamsinktemplate);
- fail_unless (gst_element_set_state (videorate,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- videorate_pad = gst_element_get_pad (videorate, "sink");
- caps = gst_pad_get_caps (videorate_pad);
-
- /* assemble the expected caps */
- structure = gst_structure_from_string (VIDEO_CAPS_STRING, NULL);
- expected_caps = gst_caps_new_empty ();
- gst_caps_append_structure (expected_caps, structure);
- structure = gst_structure_copy (structure);
- gst_structure_set (structure, "framerate", GST_TYPE_FRACTION_RANGE,
- 0, 1, G_MAXINT, 1, NULL);
- gst_caps_append_structure (expected_caps, structure);
-
- fail_unless (gst_caps_is_equal (expected_caps, caps));
- gst_caps_unref (caps);
- gst_caps_unref (expected_caps);
- gst_object_unref (videorate_pad);
-
- /* cleanup */
- cleanup_videorate (videorate);
-}
-
-GST_END_TEST;
-
-
-GST_START_TEST (test_selected_caps)
-{
- GstElement *videorate;
- GstElement *pipeline;
- GstBus *bus;
- GstMessage *msg;
-
- GstPad *videorate_pad;
- GstCaps *caps = NULL;
- GstCaps *expected_caps = NULL;
-
- pipeline = gst_parse_launch ("videotestsrc num-buffers=1 ! "
- "! identity ! videorate name=videorate0 ! " VIDEO_CAPS_UNUSUAL_FRAMERATE
- " ! fakesink", NULL);
- fail_if (pipeline == NULL);
- videorate = gst_bin_get_by_name (GST_BIN (pipeline), "videorate0");
- fail_if (videorate == NULL);
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
-
- fail_if (gst_element_set_state (pipeline,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE,
- "could not set to playing");
-
- msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE,
- GST_MESSAGE_EOS | GST_MESSAGE_ERROR);
- fail_if (msg == NULL || GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR);
-
- videorate_pad = gst_element_get_pad (videorate, "sink");
- g_object_get (videorate_pad, "caps", &caps, NULL);
- expected_caps = gst_caps_from_string (VIDEO_CAPS_UNUSUAL_FRAMERATE);
-
- fail_unless (gst_caps_is_equal (expected_caps, caps));
-
- /* cleanup */
- gst_object_unref (bus);
- gst_message_unref (msg);
- gst_caps_unref (caps);
- gst_caps_unref (expected_caps);
- gst_object_unref (videorate_pad);
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
- gst_object_unref (pipeline);
-}
-
-GST_END_TEST;
-
-static Suite *
-videorate_suite (void)
-{
- Suite *s = suite_create ("videorate");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_one);
- tcase_add_test (tc_chain, test_more);
- tcase_add_test (tc_chain, test_wrong_order_from_zero);
- tcase_add_test (tc_chain, test_wrong_order);
- tcase_add_test (tc_chain, test_no_framerate);
- tcase_add_test (tc_chain, test_changing_size);
- tcase_add_test (tc_chain, test_non_ok_flow);
- tcase_add_test (tc_chain, test_upstream_caps_nego);
- tcase_add_test (tc_chain, test_selected_caps);
-
- return s;
-}
-
-GST_CHECK_MAIN (videorate)
diff --git a/tests/check/elements/videoscale.c b/tests/check/elements/videoscale.c
deleted file mode 100644
index 35e9c06d..00000000
--- a/tests/check/elements/videoscale.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/* GStreamer
- *
- * unit test for videoscale
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <gst/check/gstcheck.h>
-#include <string.h>
-
-static GstCaps **
-videoscale_get_allowed_caps (void)
-{
- GstElement *scale = gst_element_factory_make ("videoscale", "scale");
- GstPadTemplate *templ;
- GstCaps *caps, **ret;
- GstStructure *s;
- gint i, n;
-
- templ =
- gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (scale),
- "sink");
- fail_unless (templ != NULL);
-
- caps = gst_pad_template_get_caps (templ);
-
- n = gst_caps_get_size (caps);
- ret = g_new0 (GstCaps *, n + 1);
-
- for (i = 0; i < n; i++) {
- s = gst_caps_get_structure (caps, i);
- ret[i] = gst_caps_new_empty ();
- gst_caps_append_structure (ret[i], gst_structure_copy (s));
- }
-
- gst_object_unref (scale);
-
- return ret;
-}
-
-typedef struct
-{
- GMainLoop *loop;
- gboolean eos;
-} OnMessageUserData;
-
-static void
-on_message_cb (GstBus * bus, GstMessage * message, gpointer user_data)
-{
- OnMessageUserData *d = user_data;
-
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_ERROR:
- case GST_MESSAGE_WARNING:
- g_assert_not_reached ();
- break;
- case GST_MESSAGE_EOS:
- g_main_loop_quit (d->loop);
- d->eos = TRUE;
- break;
- default:
- break;
- }
-}
-
-static void
-on_sink_handoff (GstElement * element, GstBuffer * buffer, GstPad * pad,
- gpointer user_data)
-{
- guint *n_buffers = user_data;
-
- *n_buffers = *n_buffers + 1;
-}
-
-static void
-run_test (const GstCaps * caps, gint src_width, gint src_height,
- gint dest_width, gint dest_height, gint method,
- GCallback src_handoff, gpointer src_handoff_user_data,
- GCallback sink_handoff, gpointer sink_handoff_user_data)
-{
- GstElement *pipeline;
- GstElement *src, *capsfilter1, *identity, *scale, *capsfilter2, *sink;
- GstBus *bus;
- GMainLoop *loop;
- GstCaps *copy;
- guint n_buffers = 0;
- OnMessageUserData omud = { NULL, };
-
- pipeline = gst_element_factory_make ("pipeline", "pipeline");
- fail_unless (pipeline != NULL);
-
- src = gst_element_factory_make ("videotestsrc", "src");
- fail_unless (src != NULL);
- g_object_set (G_OBJECT (src), "num-buffers", 5, NULL);
-
- capsfilter1 = gst_element_factory_make ("capsfilter", "filter1");
- fail_unless (capsfilter1 != NULL);
- copy = gst_caps_copy (caps);
- gst_caps_set_simple (copy, "width", G_TYPE_INT, src_width, "height",
- G_TYPE_INT, src_height, "framerate", GST_TYPE_FRACTION, 30, 1, NULL);
- g_object_set (G_OBJECT (capsfilter1), "caps", copy, NULL);
- gst_caps_unref (copy);
-
- identity = gst_element_factory_make ("identity", "identity");
- fail_unless (identity != NULL);
- if (src_handoff) {
- g_object_set (G_OBJECT (identity), "signal-handoffs", TRUE, NULL);
- g_signal_connect (identity, "handoff", G_CALLBACK (src_handoff),
- src_handoff_user_data);
- }
-
- scale = gst_element_factory_make ("videoscale", "scale");
- fail_unless (scale != NULL);
- g_object_set (G_OBJECT (scale), "method", method, NULL);
-
- capsfilter2 = gst_element_factory_make ("capsfilter", "filter2");
- fail_unless (capsfilter2 != NULL);
- copy = gst_caps_copy (caps);
- gst_caps_set_simple (copy, "width", G_TYPE_INT, dest_width, "height",
- G_TYPE_INT, dest_height, NULL);
- g_object_set (G_OBJECT (capsfilter2), "caps", copy, NULL);
- gst_caps_unref (copy);
-
- sink = gst_element_factory_make ("fakesink", "sink");
- fail_unless (sink != NULL);
- g_object_set (G_OBJECT (sink), "signal-handoffs", TRUE, "async", FALSE, NULL);
- g_signal_connect (sink, "handoff", G_CALLBACK (on_sink_handoff), &n_buffers);
- if (sink_handoff) {
- g_signal_connect (sink, "handoff", G_CALLBACK (sink_handoff),
- sink_handoff_user_data);
- }
-
- gst_bin_add_many (GST_BIN (pipeline), src, capsfilter1, identity, scale,
- capsfilter2, sink, NULL);
- fail_unless (gst_element_link_many (src, capsfilter1, identity, scale,
- capsfilter2, sink, NULL));
-
- loop = g_main_loop_new (NULL, FALSE);
-
- bus = gst_element_get_bus (pipeline);
- fail_unless (bus != NULL);
- gst_bus_add_signal_watch (bus);
-
- omud.loop = loop;
- omud.eos = FALSE;
-
- g_signal_connect (bus, "message", (GCallback) on_message_cb, &omud);
-
- gst_object_unref (bus);
-
- fail_unless (gst_element_set_state (pipeline,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS);
-
- g_main_loop_run (loop);
-
- fail_unless (gst_element_set_state (pipeline,
- GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS);
-
- fail_unless (omud.eos == TRUE);
- fail_unless (n_buffers == 5);
-
- gst_object_unref (pipeline);
- g_main_loop_unref (loop);
-}
-
-static void
-on_sink_handoff_passthrough (GstElement * element, GstBuffer * buffer,
- GstPad * pad, gpointer user_data)
-{
- GList **list = user_data;
-
- *list = g_list_prepend (*list, gst_buffer_ref (buffer));
-}
-
-static void
-on_src_handoff_passthrough (GstElement * element, GstBuffer * buffer,
- gpointer user_data)
-{
- GList **list = user_data;
-
- *list = g_list_prepend (*list, gst_buffer_ref (buffer));
-}
-
-GST_START_TEST (test_passthrough)
-{
- GList *l1, *l2, *src_buffers = NULL, *sink_buffers = NULL;
- GstCaps **allowed_caps = NULL, **p;
- gint method;
- static const gint src_width = 640, src_height = 480;
- static const gint dest_width = 640, dest_height = 480;
-
- p = allowed_caps = videoscale_get_allowed_caps ();
-
- while (*p) {
- GstCaps *caps = *p;
-
- for (method = 0; method < 3; method++) {
- GST_DEBUG ("Running test for caps '%" GST_PTR_FORMAT "'"
- " from %dx%u to %dx%d with method %d", caps, src_width, src_height,
- dest_width, dest_height, method);
- run_test (caps, src_width, src_height,
- dest_width, dest_height, method,
- G_CALLBACK (on_src_handoff_passthrough), &src_buffers,
- G_CALLBACK (on_sink_handoff_passthrough), &sink_buffers);
-
- fail_unless (src_buffers && sink_buffers);
- fail_unless_equals_int (g_list_length (src_buffers),
- g_list_length (sink_buffers));
-
- for (l1 = src_buffers, l2 = sink_buffers; l1 && l2;
- l1 = l1->next, l2 = l2->next) {
- GstBuffer *a = l1->data;
- GstBuffer *b = l2->data;
-
- fail_unless_equals_int (GST_BUFFER_SIZE (a), GST_BUFFER_SIZE (b));
- fail_unless (GST_BUFFER_DATA (a) == GST_BUFFER_DATA (b));
-
- gst_buffer_unref (a);
- gst_buffer_unref (b);
- }
- g_list_free (src_buffers);
- src_buffers = NULL;
- g_list_free (sink_buffers);
- sink_buffers = NULL;
- }
-
- gst_caps_unref (caps);
- p++;
- }
- g_free (allowed_caps);
-}
-
-GST_END_TEST;
-
-#define CREATE_TEST(name,method,src_width,src_height,dest_width,dest_height) \
-GST_START_TEST (name) \
-{ \
- GstCaps **allowed_caps = NULL, **p; \
- \
- p = allowed_caps = videoscale_get_allowed_caps (); \
- \
- while (*p) { \
- GstCaps *caps = *p; \
- \
- GST_DEBUG ("Running test for caps '%" GST_PTR_FORMAT "'" \
- " from %dx%u to %dx%d with method %d", caps, src_width, src_height, \
- dest_width, dest_height, method); \
- run_test (caps, src_width, src_height, \
- dest_width, dest_height, method, \
- NULL, NULL, NULL, NULL); \
- \
- gst_caps_unref (caps); \
- p++; \
- } \
- g_free (allowed_caps); \
-} \
-\
-GST_END_TEST;
-
-CREATE_TEST (test_downscale_640x480_320x240_method_0, 0, 640, 480, 320, 240);
-CREATE_TEST (test_downscale_640x480_320x240_method_1, 1, 640, 480, 320, 240);
-CREATE_TEST (test_downscale_640x480_320x240_method_2, 2, 640, 480, 320, 240);
-CREATE_TEST (test_upscale_320x240_640x480_method_0, 0, 320, 240, 640, 480);
-CREATE_TEST (test_upscale_320x240_640x480_method_1, 1, 320, 240, 640, 480);
-CREATE_TEST (test_upscale_320x240_640x480_method_2, 2, 320, 240, 640, 480);
-CREATE_TEST (test_downscale_640x480_1x1_method_0, 0, 640, 480, 1, 1);
-CREATE_TEST (test_downscale_640x480_1x1_method_1, 1, 640, 480, 1, 1);
-CREATE_TEST (test_downscale_640x480_1x1_method_2, 2, 640, 480, 1, 1);
-CREATE_TEST (test_upscale_1x1_640x480_method_0, 0, 1, 1, 640, 480);
-CREATE_TEST (test_upscale_1x1_640x480_method_1, 1, 1, 1, 640, 480);
-CREATE_TEST (test_upscale_1x1_640x480_method_2, 2, 1, 1, 640, 480);
-CREATE_TEST (test_downscale_641x481_111x30_method_0, 0, 641, 481, 111, 30);
-CREATE_TEST (test_downscale_641x481_111x30_method_1, 1, 641, 481, 111, 30);
-CREATE_TEST (test_downscale_641x481_111x30_method_2, 2, 641, 481, 111, 30);
-CREATE_TEST (test_upscale_111x30_641x481_method_0, 0, 111, 30, 641, 481);
-CREATE_TEST (test_upscale_111x30_641x481_method_1, 1, 111, 30, 641, 481);
-CREATE_TEST (test_upscale_111x30_641x481_method_2, 2, 111, 30, 641, 481);
-CREATE_TEST (test_downscale_641x481_30x111_method_0, 0, 641, 481, 30, 111);
-CREATE_TEST (test_downscale_641x481_30x111_method_1, 1, 641, 481, 30, 111);
-CREATE_TEST (test_downscale_641x481_30x111_method_2, 2, 641, 481, 30, 111);
-CREATE_TEST (test_upscale_30x111_641x481_method_0, 0, 30, 111, 641, 481);
-CREATE_TEST (test_upscale_30x111_641x481_method_1, 1, 30, 111, 641, 481);
-CREATE_TEST (test_upscale_30x111_641x481_method_2, 2, 30, 111, 641, 481);
-CREATE_TEST (test_downscale_640x480_320x1_method_0, 0, 640, 480, 320, 1);
-CREATE_TEST (test_downscale_640x480_320x1_method_1, 1, 640, 480, 320, 1);
-CREATE_TEST (test_downscale_640x480_320x1_method_2, 2, 640, 480, 320, 1);
-CREATE_TEST (test_upscale_320x1_640x480_method_0, 0, 320, 1, 640, 480);
-CREATE_TEST (test_upscale_320x1_640x480_method_1, 1, 320, 1, 640, 480);
-CREATE_TEST (test_upscale_320x1_640x480_method_2, 2, 320, 1, 640, 480);
-CREATE_TEST (test_downscale_640x480_1x240_method_0, 0, 640, 480, 1, 240);
-CREATE_TEST (test_downscale_640x480_1x240_method_1, 1, 640, 480, 1, 240);
-CREATE_TEST (test_downscale_640x480_1x240_method_2, 2, 640, 480, 1, 240);
-CREATE_TEST (test_upscale_1x240_640x480_method_0, 0, 1, 240, 640, 480);
-CREATE_TEST (test_upscale_1x240_640x480_method_1, 1, 1, 240, 640, 480);
-CREATE_TEST (test_upscale_1x240_640x480_method_2, 2, 1, 240, 640, 480);
-
-static Suite *
-videoscale_suite (void)
-{
- Suite *s = suite_create ("videoscale");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_set_timeout (tc_chain, 180);
- tcase_add_test (tc_chain, test_passthrough);
- tcase_add_test (tc_chain, test_downscale_640x480_320x240_method_0);
- tcase_add_test (tc_chain, test_downscale_640x480_320x240_method_1);
- tcase_add_test (tc_chain, test_downscale_640x480_320x240_method_2);
- tcase_add_test (tc_chain, test_upscale_320x240_640x480_method_0);
- tcase_add_test (tc_chain, test_upscale_320x240_640x480_method_1);
- tcase_add_test (tc_chain, test_upscale_320x240_640x480_method_2);
- tcase_add_test (tc_chain, test_downscale_640x480_1x1_method_0);
- tcase_add_test (tc_chain, test_downscale_640x480_1x1_method_1);
- tcase_add_test (tc_chain, test_downscale_640x480_1x1_method_2);
- tcase_add_test (tc_chain, test_upscale_1x1_640x480_method_0);
- tcase_add_test (tc_chain, test_upscale_1x1_640x480_method_1);
- tcase_add_test (tc_chain, test_upscale_1x1_640x480_method_2);
- tcase_add_test (tc_chain, test_downscale_641x481_111x30_method_0);
- tcase_add_test (tc_chain, test_downscale_641x481_111x30_method_1);
- tcase_add_test (tc_chain, test_downscale_641x481_111x30_method_2);
- tcase_add_test (tc_chain, test_upscale_111x30_641x481_method_0);
- tcase_add_test (tc_chain, test_upscale_111x30_641x481_method_1);
- tcase_add_test (tc_chain, test_upscale_111x30_641x481_method_2);
- tcase_add_test (tc_chain, test_downscale_641x481_30x111_method_0);
- tcase_add_test (tc_chain, test_downscale_641x481_30x111_method_1);
- tcase_add_test (tc_chain, test_downscale_641x481_30x111_method_2);
- tcase_add_test (tc_chain, test_upscale_30x111_641x481_method_0);
- tcase_add_test (tc_chain, test_upscale_30x111_641x481_method_1);
- tcase_add_test (tc_chain, test_upscale_30x111_641x481_method_2);
- tcase_add_test (tc_chain, test_downscale_640x480_320x1_method_0);
- tcase_add_test (tc_chain, test_downscale_640x480_320x1_method_1);
- tcase_add_test (tc_chain, test_downscale_640x480_320x1_method_2);
- tcase_add_test (tc_chain, test_upscale_320x1_640x480_method_0);
- tcase_add_test (tc_chain, test_upscale_320x1_640x480_method_1);
- tcase_add_test (tc_chain, test_upscale_320x1_640x480_method_2);
- tcase_add_test (tc_chain, test_downscale_640x480_1x240_method_0);
- tcase_add_test (tc_chain, test_downscale_640x480_1x240_method_1);
- tcase_add_test (tc_chain, test_downscale_640x480_1x240_method_2);
- tcase_add_test (tc_chain, test_upscale_1x240_640x480_method_0);
- tcase_add_test (tc_chain, test_upscale_1x240_640x480_method_1);
- tcase_add_test (tc_chain, test_upscale_1x240_640x480_method_2);
-
- return s;
-}
-
-GST_CHECK_MAIN (videoscale);
diff --git a/tests/check/elements/videotestsrc.c b/tests/check/elements/videotestsrc.c
deleted file mode 100644
index 827c5b31..00000000
--- a/tests/check/elements/videotestsrc.c
+++ /dev/null
@@ -1,447 +0,0 @@
-/* GStreamer
- *
- * unit test for videotestsrc
- *
- * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org>
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef HAVE_VALGRIND
-# include <valgrind/valgrind.h>
-#endif
-
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-
-/* For ease of programming we use globals to keep refs for our floating
- * src and sink pads we create; otherwise we always have to do get_pad,
- * get_peer, and then remove references in every test function */
-static GstPad *mysinkpad;
-
-
-#define CAPS_TEMPLATE_STRING \
- "video/x-raw-yuv, " \
- "format = (fourcc) Y422, " \
- "width = (int) [ 1, MAX ], " \
- "height = (int) [ 1, MAX ], " \
- "framerate = (fraction) [ 0/1, MAX ]"
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (CAPS_TEMPLATE_STRING)
- );
-
-static GstElement *
-setup_videotestsrc (void)
-{
- GstElement *videotestsrc;
-
- GST_DEBUG ("setup_videotestsrc");
- videotestsrc = gst_check_setup_element ("videotestsrc");
- mysinkpad = gst_check_setup_sink_pad (videotestsrc, &sinktemplate, NULL);
- gst_pad_set_active (mysinkpad, TRUE);
-
- return videotestsrc;
-}
-
-static void
-cleanup_videotestsrc (GstElement * videotestsrc)
-{
- GST_DEBUG ("cleanup_videotestsrc");
-
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
-
- gst_pad_set_active (mysinkpad, FALSE);
- gst_check_teardown_sink_pad (videotestsrc);
- gst_check_teardown_element (videotestsrc);
-}
-
-GST_START_TEST (test_all_patterns)
-{
- GstElement *videotestsrc;
- GObjectClass *oclass;
- GParamSpec *property;
- GEnumValue *values;
- guint j = 0;
-
- videotestsrc = setup_videotestsrc ();
- oclass = G_OBJECT_GET_CLASS (videotestsrc);
- property = g_object_class_find_property (oclass, "pattern");
- fail_unless (G_IS_PARAM_SPEC_ENUM (property));
- values = G_ENUM_CLASS (g_type_class_ref (property->value_type))->values;
-
-
- while (values[j].value_name) {
- GST_DEBUG_OBJECT (videotestsrc, "testing pattern %s", values[j].value_name);
-
- fail_unless (gst_element_set_state (videotestsrc,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_mutex_lock (check_mutex);
- while (g_list_length (buffers) < 10) {
- GST_DEBUG_OBJECT (videotestsrc, "Waiting for more buffers");
- g_cond_wait (check_cond, check_mutex);
- }
- g_mutex_unlock (check_mutex);
-
-
- gst_element_set_state (videotestsrc, GST_STATE_READY);
-
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
- ++j;
- }
-
- /* cleanup */
- cleanup_videotestsrc (videotestsrc);
-}
-
-GST_END_TEST;
-
-static guint32
-right_shift_colour (guint32 mask, guint32 pixel)
-{
- if (mask == 0)
- return 0;
-
- pixel = pixel & mask;
- while ((mask & 0x01) == 0) {
- mask = mask >> 1;
- pixel = pixel >> 1;
- }
-
- return pixel;
-}
-
-static guint8
-fix_expected_colour (guint32 col_mask, guint8 col_expected)
-{
- guint32 mask;
- gint last = g_bit_nth_msf (col_mask, -1);
- gint first = g_bit_nth_lsf (col_mask, -1);
-
- mask = 1 << (last - first + 1);
- mask -= 1;
-
- g_assert (col_expected == 0x00 || col_expected == 0xff);
-
- /* this only works because we only check for all-bits-set or no-bits-set */
- return col_expected & mask;
-}
-
-static void
-check_rgb_buf (const guint8 * pixels, guint32 r_mask, guint32 g_mask,
- guint32 b_mask, guint32 a_mask, guint8 r_expected, guint8 g_expected,
- guint8 b_expected, guint endianness, guint bpp, guint depth)
-{
- guint32 pixel, red, green, blue, alpha;
-
- switch (bpp) {
- case 32:{
- if (endianness == G_LITTLE_ENDIAN)
- pixel = GST_READ_UINT32_LE (pixels);
- else
- pixel = GST_READ_UINT32_BE (pixels);
- break;
- }
- case 24:{
- if (endianness == G_BIG_ENDIAN) {
- pixel = (GST_READ_UINT8 (pixels) << 16) |
- (GST_READ_UINT8 (pixels + 1) << 8) |
- (GST_READ_UINT8 (pixels + 2) << 0);
- } else {
- pixel = (GST_READ_UINT8 (pixels + 2) << 16) |
- (GST_READ_UINT8 (pixels + 1) << 8) |
- (GST_READ_UINT8 (pixels + 0) << 0);
- }
- break;
- }
- case 16:{
- if (endianness == G_LITTLE_ENDIAN)
- pixel = GST_READ_UINT16_LE (pixels);
- else
- pixel = GST_READ_UINT16_BE (pixels);
- break;
- }
- default:
- g_return_if_reached ();
- }
-
- red = right_shift_colour (r_mask, pixel);
- green = right_shift_colour (g_mask, pixel);
- blue = right_shift_colour (b_mask, pixel);
- alpha = right_shift_colour (a_mask, pixel);
-
- /* can't enable this by default, valgrind will complain about accessing
- * uninitialised memory for the depth=24,bpp=32 formats ... */
- /* GST_LOG ("pixels: 0x%02x 0x%02x 0x%02x 0x%02x => pixel = 0x%08x",
- pixels[0], (guint) pixels[1], pixels[2], pixels[3], pixel); */
-
- /* fix up the mask (for rgb15/16) */
- if (bpp == 16) {
- r_expected = fix_expected_colour (r_mask, r_expected);
- g_expected = fix_expected_colour (g_mask, g_expected);
- b_expected = fix_expected_colour (b_mask, b_expected);
- }
-
- fail_unless (red == r_expected, "RED: expected 0x%02x, found 0x%02x",
- r_expected, red);
- fail_unless (green == g_expected, "GREEN: expected 0x%02x, found 0x%02x",
- g_expected, green);
- fail_unless (blue == b_expected, "BLUE: expected 0x%02x, found 0x%02x",
- b_expected, blue);
-
- fail_unless (a_mask == 0 || alpha != 0); /* better than nothing */
-}
-
-static void
-got_buf_cb (GstElement * sink, GstBuffer * new_buf, GstPad * pad,
- GstBuffer ** p_old_buf)
-{
- gst_buffer_replace (p_old_buf, new_buf);
-}
-
-/* tests the positioning of pixels within the various RGB pixel layouts */
-GST_START_TEST (test_rgb_formats)
-{
- const struct
- {
- const gchar *pattern_name;
- gint pattern_enum;
- guint8 r_expected;
- guint8 g_expected;
- guint8 b_expected;
- } test_patterns[] = {
- {
- "white", 3, 0xff, 0xff, 0xff}, {
- "red", 4, 0xff, 0x00, 0x00}, {
- "green", 5, 0x00, 0xff, 0x00}, {
- "blue", 6, 0x00, 0x00, 0xff}, {
- "black", 2, 0x00, 0x00, 0x00}
- };
- const struct
- {
- const gchar *nick;
- guint bpp, depth;
- guint32 red_mask, green_mask, blue_mask, alpha_mask;
- } rgb_formats[] = {
- {
- "RGBA", 32, 32, 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff}, {
- "ARGB", 32, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000}, {
- "BGRA", 32, 32, 0x0000ff00, 0x00ff0000, 0xff000000, 0x000000ff}, {
- "ABGR", 32, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000}, {
- "RGBx", 32, 24, 0xff000000, 0x00ff0000, 0x0000ff00, 0x00000000}, {
- "xRGB", 32, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000}, {
- "BGRx", 32, 24, 0x0000ff00, 0x00ff0000, 0xff000000, 0x00000000}, {
- "xBGR", 32, 24, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000}, {
- "RGB ", 24, 24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000}, {
- "BGR ", 24, 24, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000}, {
- "RGB565", 16, 16, 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000}, {
- "xRGB1555", 16, 15, 0x00007c00, 0x000003e0, 0x0000001f, 0x0000000}
- };
- GstElement *pipeline, *src, *filter, *sink;
- const GstCaps *template_caps;
- GstBuffer *buf = NULL;
- GstPad *srcpad;
- gint p, i, e;
-
- /* test check function */
- fail_unless (right_shift_colour (0x00ff0000, 0x11223344) == 0x22);
-
- pipeline = gst_pipeline_new ("pipeline");
- src = gst_check_setup_element ("videotestsrc");
- filter = gst_check_setup_element ("capsfilter");
- sink = gst_check_setup_element ("fakesink");
-
- gst_bin_add_many (GST_BIN (pipeline), src, filter, sink, NULL);
-
- fail_unless (gst_element_link (src, filter));
- fail_unless (gst_element_link (filter, sink));
-
- srcpad = gst_element_get_static_pad (src, "src");
- template_caps = gst_pad_get_pad_template_caps (srcpad);
- gst_object_unref (srcpad);
-
- g_object_set (sink, "signal-handoffs", TRUE, NULL);
- g_signal_connect (sink, "preroll-handoff", G_CALLBACK (got_buf_cb), &buf);
-
- GST_LOG ("videotestsrc src template caps: %" GST_PTR_FORMAT, template_caps);
-
- for (i = 0; i < G_N_ELEMENTS (rgb_formats); ++i) {
- for (e = 0; e < 2; ++e) {
- guint endianness;
- GstCaps *caps;
-
- if (e == 0) {
- endianness = G_BYTE_ORDER;
- } else {
- endianness =
- (G_BYTE_ORDER == G_BIG_ENDIAN) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
- }
-
- caps = gst_caps_new_simple ("video/x-raw-rgb",
- "bpp", G_TYPE_INT, rgb_formats[i].bpp,
- "depth", G_TYPE_INT, rgb_formats[i].depth,
- "red_mask", G_TYPE_INT, rgb_formats[i].red_mask,
- "green_mask", G_TYPE_INT, rgb_formats[i].green_mask,
- "blue_mask", G_TYPE_INT, rgb_formats[i].blue_mask,
- "width", G_TYPE_INT, 16, "height", G_TYPE_INT, 16,
- "endianness", G_TYPE_INT, endianness,
- "framerate", GST_TYPE_FRACTION, 1, 1, NULL);
-
- fail_unless (rgb_formats[i].alpha_mask == 0 || rgb_formats[i].bpp == 32);
-
- if (rgb_formats[i].alpha_mask != 0) {
- gst_structure_set (gst_caps_get_structure (caps, 0),
- "alpha_mask", G_TYPE_INT, rgb_formats[i].alpha_mask, NULL);
- }
-
- if (gst_caps_is_subset (caps, template_caps)) {
-
- /* caps are supported, let's run some tests then ... */
- for (p = 0; p < G_N_ELEMENTS (test_patterns); ++p) {
- GstStateChangeReturn state_ret;
-
- g_object_set (src, "pattern", test_patterns[p].pattern_enum, NULL);
-
- GST_INFO ("%5s %u/%u %08x %08x %08x %08x %u, pattern=%s",
- rgb_formats[i].nick, rgb_formats[i].bpp, rgb_formats[i].depth,
- rgb_formats[i].red_mask, rgb_formats[i].green_mask,
- rgb_formats[i].blue_mask, rgb_formats[i].alpha_mask, endianness,
- test_patterns[p].pattern_name);
-
- /* now get videotestsrc to produce a buffer with the given caps */
- g_object_set (filter, "caps", caps, NULL);
-
- state_ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
- fail_unless (state_ret != GST_STATE_CHANGE_FAILURE,
- "pipeline _set_state() to PAUSED failed");
- state_ret = gst_element_get_state (pipeline, NULL, NULL, -1);
- fail_unless (state_ret == GST_STATE_CHANGE_SUCCESS,
- "pipeline failed going to PAUSED state");
-
- state_ret = gst_element_set_state (pipeline, GST_STATE_NULL);
- fail_unless (state_ret == GST_STATE_CHANGE_SUCCESS);
-
- fail_unless (buf != NULL);
-
- /* check buffer caps */
- {
- GstStructure *s;
- gint v;
-
- fail_unless (GST_BUFFER_CAPS (buf) != NULL);
-
- s = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0);
- fail_unless (gst_structure_get_int (s, "bpp", &v));
- fail_unless_equals_int (v, rgb_formats[i].bpp);
- fail_unless (gst_structure_get_int (s, "depth", &v));
- fail_unless_equals_int (v, rgb_formats[i].depth);
- fail_unless (gst_structure_get_int (s, "red_mask", &v));
- fail_unless_equals_int (v, rgb_formats[i].red_mask);
- fail_unless (gst_structure_get_int (s, "green_mask", &v));
- fail_unless_equals_int (v, rgb_formats[i].green_mask);
- fail_unless (gst_structure_get_int (s, "blue_mask", &v));
- fail_unless_equals_int (v, rgb_formats[i].blue_mask);
- /* there mustn't be an alpha_mask if there's no alpha component */
- if (rgb_formats[i].depth == 32) {
- fail_unless (gst_structure_get_int (s, "alpha_mask", &v));
- fail_unless_equals_int (v, rgb_formats[i].alpha_mask);
- } else {
- fail_unless (gst_structure_get_value (s, "alpha_mask") == NULL);
- }
- }
-
-
- /* now check the first pixel */
- check_rgb_buf (GST_BUFFER_DATA (buf), rgb_formats[i].red_mask,
- rgb_formats[i].green_mask, rgb_formats[i].blue_mask,
- rgb_formats[i].alpha_mask, test_patterns[p].r_expected,
- test_patterns[p].g_expected, test_patterns[p].b_expected,
- endianness, rgb_formats[i].bpp, rgb_formats[i].depth);
-
- gst_buffer_unref (buf);
- buf = NULL;
- }
-
- } else {
- GST_INFO ("videotestsrc doesn't support format %" GST_PTR_FORMAT, caps);
- }
-
- gst_caps_unref (caps);
- }
- }
-
- gst_object_unref (pipeline);
-}
-
-GST_END_TEST;
-
-
-/* FIXME: add tests for YUV formats */
-
-static Suite *
-videotestsrc_suite (void)
-{
- Suite *s = suite_create ("videotestsrc");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
-
-#ifdef HAVE_VALGRIND
- if (RUNNING_ON_VALGRIND) {
- /* otherwise valgrind errors out when liboil probes CPU extensions
- * during which it causes SIGILLs etc. to be fired */
- g_setenv ("OIL_CPU_FLAGS", "0", 0);
- /* test_rgb_formats takes a bit longer, so increase timeout */
- tcase_set_timeout (tc_chain, 5 * 60);
- }
-#endif
-
- tcase_add_test (tc_chain, test_all_patterns);
- tcase_add_test (tc_chain, test_rgb_formats);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = videotestsrc_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/elements/volume.c b/tests/check/elements/volume.c
deleted file mode 100644
index d59a96f3..00000000
--- a/tests/check/elements/volume.c
+++ /dev/null
@@ -1,1525 +0,0 @@
-/* GStreamer
- *
- * unit test for volume
- *
- * Copyright (C) <2005> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <unistd.h>
-
-#include <gst/base/gstbasetransform.h>
-#include <gst/check/gstcheck.h>
-#include <gst/controller/gstcontroller.h>
-#include <gst/interfaces/streamvolume.h>
-
-/* For ease of programming we use globals to keep refs for our floating
- * src and sink pads we create; otherwise we always have to do get_pad,
- * get_peer, and then remove references in every test function */
-static GstPad *mysrcpad, *mysinkpad;
-
-
-#define VOLUME_CAPS_TEMPLATE_STRING \
- "audio/x-raw-int, " \
- "channels = (int) [ 1, MAX ], " \
- "rate = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) { 8, 16, 24, 32 }, " \
- "depth = (int) { 8, 16, 24, 32 }, " \
- "signed = (bool) TRUE; " \
- "audio/x-raw-float, " \
- "channels = (int) [ 1, MAX ], " \
- "rate = (int) [ 1, MAX ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) { 32, 64 }" \
-
-#define VOLUME_CAPS_STRING_S8 \
- "audio/x-raw-int, " \
- "channels = (int) 1, " \
- "rate = (int) 44100, " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 8, " \
- "depth = (int) 8, " \
- "signed = (bool) TRUE"
-
-#define VOLUME_CAPS_STRING_S16 \
- "audio/x-raw-int, " \
- "channels = (int) 1, " \
- "rate = (int) 44100, " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 16, " \
- "depth = (int) 16, " \
- "signed = (bool) TRUE"
-
-#define VOLUME_CAPS_STRING_S24 \
- "audio/x-raw-int, " \
- "channels = (int) 1, " \
- "rate = (int) 44100, " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 24, " \
- "depth = (int) 24, " \
- "signed = (bool) TRUE"
-
-#define VOLUME_CAPS_STRING_S32 \
- "audio/x-raw-int, " \
- "channels = (int) 1, " \
- "rate = (int) 44100, " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 32, " \
- "depth = (int) 32, " \
- "signed = (bool) TRUE"
-
-#define VOLUME_CAPS_STRING_F32 \
- "audio/x-raw-float, " \
- "channels = (int) 1, " \
- "rate = (int) 44100, " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 32"
-
-#define VOLUME_CAPS_STRING_F64 \
- "audio/x-raw-float, " \
- "channels = (int) 1, " \
- "rate = (int) 44100, " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 64"
-
-#define VOLUME_WRONG_CAPS_STRING \
- "audio/x-raw-int, " \
- "channels = (int) 1, " \
- "rate = (int) 44100, " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 16, " \
- "depth = (int) 16, " \
- "signed = (bool) FALSE"
-
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (VOLUME_CAPS_TEMPLATE_STRING)
- );
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (VOLUME_CAPS_TEMPLATE_STRING)
- );
-
-static GstElement *
-setup_volume (void)
-{
- GstElement *volume;
-
- GST_DEBUG ("setup_volume");
- volume = gst_check_setup_element ("volume");
- mysrcpad = gst_check_setup_src_pad (volume, &srctemplate, NULL);
- mysinkpad = gst_check_setup_sink_pad (volume, &sinktemplate, NULL);
- gst_pad_set_active (mysrcpad, TRUE);
- gst_pad_set_active (mysinkpad, TRUE);
-
- return volume;
-}
-
-static void
-cleanup_volume (GstElement * volume)
-{
- GST_DEBUG ("cleanup_volume");
-
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
-
- gst_pad_set_active (mysrcpad, FALSE);
- gst_pad_set_active (mysinkpad, FALSE);
- gst_check_teardown_src_pad (volume);
- gst_check_teardown_sink_pad (volume);
- gst_check_teardown_element (volume);
-}
-
-GST_START_TEST (test_get_set)
-{
- GstElement *volume = gst_element_factory_make ("volume", NULL);
- gdouble val;
-
- fail_unless (volume != NULL);
- g_object_get (G_OBJECT (volume), "volume", &val, NULL);
- fail_unless (val == 1.0);
- fail_unless (val == gst_stream_volume_get_volume (GST_STREAM_VOLUME (volume),
- GST_STREAM_VOLUME_FORMAT_LINEAR));
-
- g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
- g_object_get (G_OBJECT (volume), "volume", &val, NULL);
- fail_unless (val == 0.5);
- fail_unless (val == gst_stream_volume_get_volume (GST_STREAM_VOLUME (volume),
- GST_STREAM_VOLUME_FORMAT_LINEAR));
-
- gst_stream_volume_set_volume (GST_STREAM_VOLUME (volume),
- GST_STREAM_VOLUME_FORMAT_LINEAR, 1.0);
- g_object_get (G_OBJECT (volume), "volume", &val, NULL);
- fail_unless (val == 1.0);
- fail_unless (val == gst_stream_volume_get_volume (GST_STREAM_VOLUME (volume),
- GST_STREAM_VOLUME_FORMAT_LINEAR));
-
- gst_object_unref (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_unity_s8)
-{
- GstElement *volume;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gint8 in[2] = { 64, -16 };
- gint8 *res;
-
- volume = setup_volume ();
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (2);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 2);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gint8 *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", in[0], in[1], res[0], res[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 2) == 0);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_half_s8)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gint8 in[2] = { 64, -16 };
- gint8 out[2] = { 32, -8 };
- gint8 *res;
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (2);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 2);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 2) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gint8 *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
- res[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 2) == 0);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_double_s8)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gint8 in[2] = { 64, -16 };
- gint8 out[2] = { 127, -32 }; /* notice the clamped sample */
- gint8 *res;
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (2);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 2);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 2) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gint8 *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
- res[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 2) == 0);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_mute_s8)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gint8 in[2] = { 64, -16 };
- gint8 out[2] = { 0, 0 };
- gint8 *res;
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (2);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 2);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 2) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gint8 *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
- res[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 2) == 0);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_unity_s16)
-{
- GstElement *volume;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gint16 in[2] = { 16384, -256 };
- gint16 *res;
-
- volume = setup_volume ();
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (4);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gint16 *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", in[0], in[1], res[0], res[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_half_s16)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gint16 in[2] = { 16384, -256 };
- gint16 out[2] = { 8192, -128 };
- gint16 *res;
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (4);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gint16 *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
- res[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 4) == 0);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_double_s16)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gint16 in[2] = { 16384, -256 };
- gint16 out[2] = { 32767, -512 }; /* notice the clamped sample */
- gint16 *res;
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (4);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gint16 *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
- res[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 4) == 0);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-
-GST_START_TEST (test_mute_s16)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gint16 in[2] = { 16384, -256 };
- gint16 out[2] = { 0, 0 };
- gint16 *res;
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (4);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gint16 *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
- res[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 4) == 0);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
-#define get_unaligned_i24(_x) ( (((guint8*)_x)[0]) | ((((guint8*)_x)[1]) << 8) | ((((gint8*)_x)[2]) << 16) )
-#define write_unaligned_u24(_x,samp) do { (((guint8*)_x)[0]) = samp & 0xFF; (((guint8*)_x)[1]) = (samp >> 8) & 0xFF; (((guint8*)_x)[2]) = (samp >> 16) & 0xFF; } while (0)
-#else /* BIG ENDIAN */
-#define get_unaligned_i24(_x) ( (((guint8*)_x)[2]) | ((((guint8*)_x)[1]) << 8) | ((((gint8*)_x)[0]) << 16) )
-#define write_unaligned_u24(_x,samp) do { (((guint8*)_x)[0]) = (samp >> 16) & 0xFF; (((guint8*)_x)[1]) = (samp >> 8) & 0xFF; (((guint8*)_x)[2]) = samp & 0xFF; } while (0)
-#endif
-
-GST_START_TEST (test_unity_s24)
-{
- GstElement *volume;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gint32 in_32[2] = { 4194304, -4096 };
- guint8 in[6];
- guint8 *res;
- gint32 res_32[2];
-
-
- write_unaligned_u24 (in, in_32[0]);
- write_unaligned_u24 (in + 3, in_32[1]);
-
- volume = setup_volume ();
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (6);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 6);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = GST_BUFFER_DATA (outbuffer);
-
- res_32[0] = get_unaligned_i24 (res);
- res_32[1] = get_unaligned_i24 ((res + 3));
-
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", in_32[0], in_32[1], res_32[0],
- res_32[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 6) == 0);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_half_s24)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gint32 in_32[2] = { 4194304, -4096 };
- guint8 in[6];
- guint8 *res;
- gint32 res_32[2];
- gint32 out_32[2] = { 2097152, -2048 };
-
- write_unaligned_u24 (in, in_32[0]);
- write_unaligned_u24 (in + 3, in_32[1]);
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (6);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 6);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 6) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = GST_BUFFER_DATA (outbuffer);
-
- res_32[0] = get_unaligned_i24 (res);
- res_32[1] = get_unaligned_i24 ((res + 3));
-
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", out_32[0], out_32[1],
- res_32[0], res_32[1]);
- fail_unless (memcmp (res_32, out_32, 8) == 0);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_double_s24)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gint32 in_32[2] = { 4194304, -4096 };
- guint8 in[6];
- guint8 *res;
- gint32 res_32[2];
- gint32 out_32[2] = { 8388607, -8192 }; /* notice the clamped sample */
-
- write_unaligned_u24 (in, in_32[0]);
- write_unaligned_u24 (in + 3, in_32[1]);
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (6);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 6);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 6) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = GST_BUFFER_DATA (outbuffer);
-
- res_32[0] = get_unaligned_i24 (res);
- res_32[1] = get_unaligned_i24 ((res + 3));
-
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", out_32[0], out_32[1],
- res_32[0], res_32[1]);
- fail_unless (memcmp (res_32, out_32, 8) == 0);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-
-GST_START_TEST (test_mute_s24)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gint32 in_32[2] = { 4194304, -4096 };
- guint8 in[6];
- guint8 *res;
- gint32 res_32[2];
- gint32 out_32[2] = { 0, 0 }; /* notice the clamped sample */
-
- write_unaligned_u24 (in, in_32[0]);
- write_unaligned_u24 (in + 3, in_32[1]);
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (6);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 6);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 6) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
-
- res = GST_BUFFER_DATA (outbuffer);
-
- res_32[0] = get_unaligned_i24 (res);
- res_32[1] = get_unaligned_i24 ((res + 3));
-
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", out_32[0], out_32[1],
- res_32[0], res_32[1]);
- fail_unless (memcmp (res_32, out_32, 8) == 0);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_unity_s32)
-{
- GstElement *volume;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gint32 in[2] = { 1073741824, -65536 };
- gint32 *res;
-
- volume = setup_volume ();
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (8);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gint32 *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", in[0], in[1], res[0], res[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_half_s32)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gint32 in[2] = { 1073741824, -65536 };
- gint32 out[2] = { 536870912, -32768 };
- gint32 *res;
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (8);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gint32 *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
- res[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 8) == 0);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_double_s32)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gint32 in[2] = { 1073741824, -65536 };
- gint32 out[2] = { 2147483647, -131072 }; /* notice the clamped sample */
- gint32 *res;
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (8);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gint32 *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
- res[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 8) == 0);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-
-GST_START_TEST (test_mute_s32)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gint32 in[2] = { 1073741824, -65536 };
- gint32 out[2] = { 0, 0 };
- gint32 *res;
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (8);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gint32 *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
- res[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 8) == 0);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_unity_f32)
-{
- GstElement *volume;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat in[2] = { 0.75, -0.25 };
- gfloat *res;
-
- volume = setup_volume ();
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (8);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", in[0], in[1], res[0],
- res[1]);
- fail_unless_equals_float (res[0], in[0]);
- fail_unless_equals_float (res[1], in[1]);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_half_f32)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gfloat in[2] = { 0.75, -0.25 };
- gfloat out[2] = { 0.375, -0.125 };
- gfloat *res;
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (8);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
- res[0], res[1]);
- fail_unless_equals_float (res[0], out[0]);
- fail_unless_equals_float (res[1], out[1]);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_double_f32)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gfloat in[2] = { 0.75, -0.25 };
- gfloat out[2] = { 1.5, -0.5 }; /* nothing is clamped */
- gfloat *res;
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (8);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
- res[0], res[1]);
- fail_unless_equals_float (res[0], out[0]);
- fail_unless_equals_float (res[1], out[1]);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-
-GST_START_TEST (test_mute_f32)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gfloat in[2] = { 0.75, -0.25 };
- gfloat out[2] = { 0, 0 };
- gfloat *res;
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (8);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
- res[0], res[1]);
- fail_unless_equals_float (res[0], out[0]);
- fail_unless_equals_float (res[1], out[1]);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_unity_f64)
-{
- GstElement *volume;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble in[2] = { 0.75, -0.25 };
- gdouble *res;
-
- volume = setup_volume ();
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (16);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 16);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", in[0], in[1], res[0],
- res[1]);
- fail_unless_equals_float (res[0], in[0]);
- fail_unless_equals_float (res[1], in[1]);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_half_f64)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gdouble in[2] = { 0.75, -0.25 };
- gdouble out[2] = { 0.375, -0.125 };
- gdouble *res;
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (16);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 16);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 16) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
- res[0], res[1]);
- fail_unless_equals_float (res[0], out[0]);
- fail_unless_equals_float (res[1], out[1]);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_double_f64)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gdouble in[2] = { 0.75, -0.25 };
- gdouble out[2] = { 1.5, -0.5 }; /* nothing is clamped */
- gdouble *res;
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (16);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 16);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 16) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
- res[0], res[1]);
- fail_unless_equals_float (res[0], out[0]);
- fail_unless_equals_float (res[1], out[1]);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-
-GST_START_TEST (test_mute_f64)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- GstBuffer *outbuffer;
- GstCaps *caps;
- gdouble in[2] = { 0.75, -0.25 };
- gdouble out[2] = { 0, 0 };
- gdouble *res;
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (16);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 16);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 16) == 0);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- /* FIXME: reffing the inbuffer should make the transformation not be
- * inplace
- gst_buffer_ref (inbuffer);
- */
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being modified inplace and
- * collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
- res[0], res[1]);
- fail_unless_equals_float (res[0], out[0]);
- fail_unless_equals_float (res[1], out[1]);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_wrong_caps)
-{
- GstElement *volume;
- GstBuffer *inbuffer;
- gint16 in[2] = { 16384, -256 };
- GstBus *bus;
- GstMessage *message;
- GstCaps *caps;
-
- volume = setup_volume ();
- bus = gst_bus_new ();
-
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (4);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
- caps = gst_caps_from_string (VOLUME_WRONG_CAPS_STRING);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- gst_buffer_ref (inbuffer);
-
- /* set a bus here so we avoid getting state change messages */
- gst_element_set_bus (volume, bus);
-
- /* pushing gives an error because it can't negotiate with wrong caps */
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer),
- GST_FLOW_NOT_NEGOTIATED);
- /* ... and the buffer would have been lost if we didn't ref it ourselves */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- gst_buffer_unref (inbuffer);
- fail_unless_equals_int (g_list_length (buffers), 0);
-
- /* volume_set_caps should not have been called since basetransform caught
- * the negotiation problem */
- fail_if ((message = gst_bus_pop (bus)) != NULL);
-
- /* cleanup */
- gst_element_set_bus (volume, NULL);
- gst_object_unref (GST_OBJECT (bus));
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_passthrough)
-{
- GstElement *volume;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gint16 in[2] = { 16384, -256 };
- gint16 *res;
-
- volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "volume", 1.0, NULL);
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (4);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gint16 *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", in[0], in[1], res[0], res[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
-
- /* cleanup */
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_controller_usability)
-{
- GstInterpolationControlSource *csource;
- GstController *c;
- GstElement *volume;
- GValue value = { 0, };
-
- /* note: the volume element should init the controller library for us */
- volume = setup_volume ();
-
- c = gst_controller_new (G_OBJECT (volume), "volume", NULL);
-
- fail_unless (GST_IS_CONTROLLER (c));
-
- /* this shouldn't crash, whether this mode is implemented or not */
- csource = gst_interpolation_control_source_new ();
- gst_interpolation_control_source_set_interpolation_mode (csource,
- GST_INTERPOLATE_CUBIC);
- gst_controller_set_control_source (c, "volume", GST_CONTROL_SOURCE (csource));
- g_object_unref (csource);
-
- g_value_init (&value, G_TYPE_DOUBLE);
- g_value_set_double (&value, 0.0);
- gst_interpolation_control_source_set (csource, 0 * GST_SECOND, &value);
- g_value_set_double (&value, 1.0);
- gst_interpolation_control_source_set (csource, 5 * GST_SECOND, &value);
- g_value_set_double (&value, 0.0);
- gst_interpolation_control_source_set (csource, 10 * GST_SECOND, &value);
- g_value_unset (&value);
-
- g_object_unref (c);
-
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_controller_processing)
-{
- GstInterpolationControlSource *csource;
- GstController *c;
- GstElement *volume;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gint16 in[2] = { 16384, -256 };
- gint16 *res;
-
- volume = setup_volume ();
-
- c = gst_controller_new (G_OBJECT (volume), "volume", NULL);
-
- fail_unless (GST_IS_CONTROLLER (c));
-
- csource = gst_interpolation_control_source_new ();
- gst_interpolation_control_source_set_interpolation_mode (csource,
- GST_INTERPOLATE_CUBIC);
- gst_controller_set_control_source (c, "volume", GST_CONTROL_SOURCE (csource));
- g_object_unref (csource);
-
- fail_unless (gst_element_set_state (volume,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (4);
- memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
- caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
- gst_buffer_set_caps (inbuffer, caps);
- GST_BUFFER_TIMESTAMP (inbuffer) = 0;
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
- res = (gint16 *) GST_BUFFER_DATA (outbuffer);
- GST_INFO ("expected %+5d %+5d real %+5d %+5d", in[0], in[1], res[0], res[1]);
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
-
- g_object_unref (c);
-
- cleanup_volume (volume);
-}
-
-GST_END_TEST;
-
-static Suite *
-volume_suite (void)
-{
- Suite *s = suite_create ("volume");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_get_set);
- tcase_add_test (tc_chain, test_unity_s8);
- tcase_add_test (tc_chain, test_half_s8);
- tcase_add_test (tc_chain, test_double_s8);
- tcase_add_test (tc_chain, test_mute_s8);
- tcase_add_test (tc_chain, test_unity_s16);
- tcase_add_test (tc_chain, test_half_s16);
- tcase_add_test (tc_chain, test_double_s16);
- tcase_add_test (tc_chain, test_mute_s16);
- tcase_add_test (tc_chain, test_unity_s24);
- tcase_add_test (tc_chain, test_half_s24);
- tcase_add_test (tc_chain, test_double_s24);
- tcase_add_test (tc_chain, test_mute_s24);
- tcase_add_test (tc_chain, test_unity_s32);
- tcase_add_test (tc_chain, test_half_s32);
- tcase_add_test (tc_chain, test_double_s32);
- tcase_add_test (tc_chain, test_mute_s32);
- tcase_add_test (tc_chain, test_unity_f32);
- tcase_add_test (tc_chain, test_half_f32);
- tcase_add_test (tc_chain, test_double_f32);
- tcase_add_test (tc_chain, test_mute_f32);
- tcase_add_test (tc_chain, test_unity_f64);
- tcase_add_test (tc_chain, test_half_f64);
- tcase_add_test (tc_chain, test_double_f64);
- tcase_add_test (tc_chain, test_mute_f64);
- tcase_add_test (tc_chain, test_wrong_caps);
- tcase_add_test (tc_chain, test_passthrough);
- tcase_add_test (tc_chain, test_controller_usability);
- tcase_add_test (tc_chain, test_controller_processing);
-
- return s;
-}
-
-GST_CHECK_MAIN (volume)
diff --git a/tests/check/elements/vorbisdec.c b/tests/check/elements/vorbisdec.c
deleted file mode 100644
index 587fd199..00000000
--- a/tests/check/elements/vorbisdec.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/* GStreamer
- *
- * unit test for vorbisdec
- *
- * Copyright (C) <2005> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-
-#include <vorbis/codec.h>
-#include <vorbis/vorbisenc.h>
-
-/* For ease of programming we use globals to keep refs for our floating
- * src and sink pads we create; otherwise we always have to do get_pad,
- * get_peer, and then remove references in every test function */
-static GstPad *mysrcpad, *mysinkpad;
-
-/* a valid first header packet */
-static guchar identification_header[30] = {
- 1, /* packet_type */
- 'v', 'o', 'r', 'b', 'i', 's',
- 0, 0, 0, 0, /* vorbis_version */
- 2, /* audio_channels */
- 0x44, 0xac, 0, 0, /* sample_rate */
- 0xff, 0xff, 0xff, 0xff, /* bitrate_maximum */
- 0x00, 0xee, 0x02, 0x00, /* bitrate_nominal */
- 0xff, 0xff, 0xff, 0xff, /* bitrate_minimum */
- 0xb8, /* blocksize_0, blocksize_1 */
- 0x01, /* framing_flag */
-};
-
-static guchar comment_header[] = {
- 3, /* packet_type */
- 'v', 'o', 'r', 'b', 'i', 's',
- 2, 0, 0, 0, /* vendor_length */
- 'm', 'e',
- 1, 0, 0, 0, /* user_comment_list_length */
- 9, 0, 0, 0, /* length comment[0] */
- 'A', 'R', 'T', 'I', 'S', 'T', '=', 'm', 'e',
- 0x01, /* framing bit */
-};
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-static GstElement *
-setup_vorbisdec (void)
-{
- GstElement *vorbisdec;
-
- GST_DEBUG ("setup_vorbisdec");
- vorbisdec = gst_check_setup_element ("vorbisdec");
- mysrcpad = gst_check_setup_src_pad (vorbisdec, &srctemplate, NULL);
- mysinkpad = gst_check_setup_sink_pad (vorbisdec, &sinktemplate, NULL);
- gst_pad_set_active (mysrcpad, TRUE);
- gst_pad_set_active (mysinkpad, TRUE);
-
- return vorbisdec;
-}
-
-static void
-cleanup_vorbisdec (GstElement * vorbisdec)
-{
- GST_DEBUG ("cleanup_vorbisdec");
- gst_element_set_state (vorbisdec, GST_STATE_NULL);
-
- gst_pad_set_active (mysrcpad, FALSE);
- gst_pad_set_active (mysinkpad, FALSE);
- gst_check_teardown_src_pad (vorbisdec);
- gst_check_teardown_sink_pad (vorbisdec);
- gst_check_teardown_element (vorbisdec);
-}
-
-GST_START_TEST (test_empty_identification_header)
-{
- GstElement *vorbisdec;
- GstBuffer *inbuffer;
- GstBus *bus;
- GstMessage *message;
-
- vorbisdec = setup_vorbisdec ();
- bus = gst_bus_new ();
-
- fail_unless (gst_element_set_state (vorbisdec,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (0);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* set a bus here so we avoid getting state change messages */
- gst_element_set_bus (vorbisdec, bus);
-
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_ERROR);
- /* ... but it ends up being collected on the global buffer list */
- fail_unless_equals_int (g_list_length (buffers), 0);
-
- fail_if ((message = gst_bus_pop (bus)) == NULL);
- fail_unless_message_error (message, STREAM, DECODE);
- gst_message_unref (message);
- gst_element_set_bus (vorbisdec, NULL);
-
- /* cleanup */
- gst_object_unref (GST_OBJECT (bus));
- cleanup_vorbisdec (vorbisdec);
-}
-
-GST_END_TEST;
-
-/* FIXME: also tests comment header */
-GST_START_TEST (test_identification_header)
-{
- GstElement *vorbisdec;
- GstBuffer *inbuffer;
- GstBus *bus;
- GstMessage *message;
- GstTagList *tag_list;
- gchar *artist;
-
- vorbisdec = setup_vorbisdec ();
- fail_unless (gst_element_set_state (vorbisdec,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
- bus = gst_bus_new ();
-
- inbuffer = gst_buffer_new_and_alloc (30);
- memcpy (GST_BUFFER_DATA (inbuffer), identification_header, 30);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- gst_buffer_ref (inbuffer);
-
- gst_element_set_bus (vorbisdec, bus);
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and nothing ends up on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- gst_buffer_unref (inbuffer);
- fail_unless (g_list_length (buffers) == 0);
- fail_if ((message = gst_bus_pop (bus)) != NULL);
-
- inbuffer = gst_buffer_new_and_alloc (sizeof (comment_header));
- memcpy (GST_BUFFER_DATA (inbuffer), comment_header, sizeof (comment_header));
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- gst_buffer_ref (inbuffer);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and nothing ends up on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- gst_buffer_unref (inbuffer);
- fail_unless (g_list_length (buffers) == 0);
- /* there's a tag message waiting */
- fail_if ((message = gst_bus_pop (bus)) == NULL);
- gst_message_parse_tag (message, &tag_list);
- fail_unless_equals_int (gst_tag_list_get_tag_size (tag_list, GST_TAG_ARTIST),
- 1);
- fail_unless (gst_tag_list_get_string (tag_list, GST_TAG_ARTIST, &artist));
- fail_unless_equals_string (artist, "me");
- g_free (artist);
- fail_unless_equals_int (gst_tag_list_get_tag_size (tag_list, "album"), 0);
- gst_tag_list_free (tag_list);
- gst_message_unref (message);
-
- /* cleanup */
- gst_bus_set_flushing (bus, TRUE);
- gst_element_set_bus (vorbisdec, NULL);
- gst_object_unref (GST_OBJECT (bus));
- cleanup_vorbisdec (vorbisdec);
-}
-
-GST_END_TEST;
-
-static vorbis_comment vc;
-static vorbis_dsp_state vd;
-static vorbis_info vi;
-static vorbis_block vb;
-
-static GstBuffer *
-_create_codebook_header_buffer (void)
-{
- GstBuffer *buffer;
- ogg_packet header;
- ogg_packet header_comm;
- ogg_packet header_code;
-
- vorbis_info_init (&vi);
- vorbis_encode_setup_vbr (&vi, 1, 44000, 0.5);
- vorbis_encode_setup_init (&vi);
- vorbis_analysis_init (&vd, &vi);
- vorbis_block_init (&vd, &vb);
- vorbis_comment_init (&vc);
- vorbis_analysis_headerout (&vd, &vc, &header, &header_comm, &header_code);
-
- buffer = gst_buffer_new_and_alloc (header_code.bytes);
- memcpy (GST_BUFFER_DATA (buffer), header_code.packet, header_code.bytes);
-
- return buffer;
-}
-
-static GstBuffer *
-_create_audio_buffer (void)
-{
- GstBuffer *buffer;
- ogg_packet packet;
- float **vorbis_buffer;
- gint i;
-
- vorbis_buffer = vorbis_analysis_buffer (&vd, 44100);
- for (i = 0; i < 44100 * 1; ++i)
- vorbis_buffer[0][i] = 0.0;
- vorbis_analysis_wrote (&vd, 44100);
- vorbis_analysis_blockout (&vd, &vb);
- vorbis_analysis (&vb, NULL);
- vorbis_bitrate_addblock (&vb);
- vorbis_bitrate_flushpacket (&vd, &packet);
- buffer = gst_buffer_new_and_alloc (packet.bytes);
- memcpy (GST_BUFFER_DATA (buffer), packet.packet, packet.bytes);
-
- vorbis_comment_clear (&vc);
- vorbis_block_clear (&vb);
- vorbis_dsp_clear (&vd);
- vorbis_info_clear (&vi);
-
- return buffer;
-}
-
-GST_START_TEST (test_empty_vorbis_packet)
-{
- GstElement *vorbisdec;
- GstBuffer *inbuffer;
- GstMessage *message;
- GstBus *bus;
-
- vorbisdec = setup_vorbisdec ();
- fail_unless_equals_int (gst_element_set_state (vorbisdec, GST_STATE_PLAYING),
- GST_STATE_CHANGE_SUCCESS);
-
- bus = gst_bus_new ();
-
- inbuffer = gst_buffer_new_and_alloc (30);
- memcpy (GST_BUFFER_DATA (inbuffer), identification_header, 30);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- gst_buffer_ref (inbuffer);
-
- gst_element_set_bus (vorbisdec, bus);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and nothing ends up on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- gst_buffer_unref (inbuffer);
- fail_unless (g_list_length (buffers) == 0);
- fail_if ((message = gst_bus_pop (bus)) != NULL);
-
- inbuffer = gst_buffer_new_and_alloc (sizeof (comment_header));
- memcpy (GST_BUFFER_DATA (inbuffer), comment_header, sizeof (comment_header));
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- gst_buffer_ref (inbuffer);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and nothing ends up on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- gst_buffer_unref (inbuffer);
- fail_unless (g_list_length (buffers) == 0);
-
- /* send minimal codebook header and audio packers */
- inbuffer = _create_codebook_header_buffer ();
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
-
- /* now send an empty vorbis packet, which should just be skipped */
- inbuffer = gst_buffer_new_and_alloc (0);
- gst_buffer_ref (inbuffer);
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- gst_buffer_unref (inbuffer);
- fail_unless (g_list_length (buffers) == 0);
-
- /* create and push an encoded audio packet */
- inbuffer = _create_audio_buffer ();
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
-
- /* now send another empty vorbis packet, which should just be skipped */
- inbuffer = gst_buffer_new_and_alloc (0);
- gst_buffer_ref (inbuffer);
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- gst_buffer_unref (inbuffer);
-
- /* make sure there's no error on the bus */
- message = gst_bus_poll (bus, GST_MESSAGE_ERROR, 0);
- fail_if (message != NULL);
-
- /* cleanup */
- gst_bus_set_flushing (bus, TRUE);
- gst_element_set_bus (vorbisdec, NULL);
- gst_object_unref (GST_OBJECT (bus));
- cleanup_vorbisdec (vorbisdec);
-}
-
-GST_END_TEST;
-
-static Suite *
-vorbisdec_suite (void)
-{
- Suite *s = suite_create ("vorbisdec");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_empty_identification_header);
- tcase_add_test (tc_chain, test_identification_header);
- tcase_add_test (tc_chain, test_empty_vorbis_packet);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = vorbisdec_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/elements/vorbistag.c b/tests/check/elements/vorbistag.c
deleted file mode 100644
index 4b20d6d7..00000000
--- a/tests/check/elements/vorbistag.c
+++ /dev/null
@@ -1,409 +0,0 @@
-/* GStreamer
- *
- * unit test for vorbisdec
- *
- * Copyright (C) <2005> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <unistd.h>
-#include <glib.h>
-
-#include <vorbis/codec.h>
-#include <vorbis/vorbisenc.h>
-
-#include <gst/gsttagsetter.h>
-#include <gst/check/gstcheck.h>
-
-/* a valid first header packet */
-static guchar identification_header[30] = {
- 1, /* packet_type */
- 'v', 'o', 'r', 'b', 'i', 's',
- 0, 0, 0, 0, /* vorbis_version */
- 2, /* audio_channels */
- 0x44, 0xac, 0, 0, /* sample_rate */
- 0xff, 0xff, 0xff, 0xff, /* bitrate_maximum */
- 0x00, 0xee, 0x02, 0x00, /* bitrate_nominal */
- 0xff, 0xff, 0xff, 0xff, /* bitrate_minimum */
- 0xb8, /* blocksize_0, blocksize_1 */
- 0x01 /* framing_flag */
-};
-
-static guchar artist_comment_header[] = {
- 3, /* packet_type */
- 'v', 'o', 'r', 'b', 'i', 's',
- 2, 0, 0, 0, /* vendor_length */
- 'm', 'e',
- 1, 0, 0, 0, /* user_comment_list_length */
- 9, 0, 0, 0, /* length comment[0] */
- 'A', 'R', 'T', 'I', 'S', 'T', '=', 'm', 'e',
- 0x01, /* framing bit */
-};
-
-static guchar title_comment_header[] = {
- 3, /* packet_type */
- 'v', 'o', 'r', 'b', 'i', 's',
- 2, 0, 0, 0, /* vendor_length */
- 'm', 'e',
- 1, 0, 0, 0, /* user_comment_list_length */
- 12, 0, 0, 0, /* length comment[0] */
- 'T', 'I', 'T', 'L', 'E', '=', 'f', 'o', 'o', 'b', 'a', 'r',
- 0x01, /* framing bit */
-};
-
-static guchar empty_comment_header[] = {
- 3, /* packet_type */
- 'v', 'o', 'r', 'b', 'i', 's',
- 2, 0, 0, 0, /* vendor_length */
- 'm', 'e',
- 0, 0, 0, 0, /* user_comment_list_length */
- 0x01, /* framing bit */
-};
-
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-static GstPad *mysrcpad, *mysinkpad;
-static GAsyncQueue *pending_buffers;
-static gulong id;
-
-
-static GstElement *
-setup_vorbistag (void)
-{
- GstElement *vorbistag;
-
- GST_DEBUG ("setup_vorbistag");
- vorbistag = gst_check_setup_element ("vorbistag");
- mysrcpad = gst_check_setup_src_pad (vorbistag, &srctemplate, NULL);
- mysinkpad = gst_check_setup_sink_pad (vorbistag, &sinktemplate, NULL);
- gst_pad_set_active (mysrcpad, TRUE);
- gst_pad_set_active (mysinkpad, TRUE);
-
- return vorbistag;
-}
-
-static void
-cleanup_vorbistag (GstElement * vorbistag)
-{
- GST_DEBUG ("cleanup_vorbistag");
- gst_element_set_state (vorbistag, GST_STATE_NULL);
-
- gst_pad_set_active (mysrcpad, FALSE);
- gst_pad_set_active (mysinkpad, FALSE);
- gst_check_teardown_src_pad (vorbistag);
- gst_check_teardown_sink_pad (vorbistag);
- gst_check_teardown_element (vorbistag);
-}
-
-
-static gboolean
-buffer_probe (GstPad * pad, GstBuffer * buffer, gpointer unused)
-{
- g_async_queue_push (pending_buffers, gst_buffer_ref (buffer));
- return TRUE;
-}
-
-static void
-start_pipeline (GstElement * element)
-{
- id = gst_pad_add_buffer_probe (mysinkpad, G_CALLBACK (buffer_probe), NULL);
-
- pending_buffers = g_async_queue_new ();
- gst_element_set_state (element, GST_STATE_PLAYING);
-}
-
-static GstBuffer *
-get_buffer (void)
-{
- return GST_BUFFER (g_async_queue_pop (pending_buffers));
-}
-
-static void
-stop_pipeline (GstElement * element)
-{
- GstBuffer *buf;
-
- while ((buf = g_async_queue_try_pop (pending_buffers)))
- gst_buffer_unref (buf);
-
- gst_pad_remove_buffer_probe (mysinkpad, (guint) id);
- id = 0;
-
- gst_element_set_state (element, GST_STATE_NULL);
-
- while ((buf = g_async_queue_try_pop (pending_buffers)))
- gst_buffer_unref (buf);
-
- g_async_queue_unref (pending_buffers);
- pending_buffers = NULL;
-}
-
-static vorbis_comment vc;
-static vorbis_dsp_state vd;
-static vorbis_info vi;
-static vorbis_block vb;
-
-static GstBuffer *
-_create_codebook_header_buffer (void)
-{
- GstBuffer *buffer;
- ogg_packet header;
- ogg_packet header_comm;
- ogg_packet header_code;
-
- vorbis_info_init (&vi);
- vorbis_encode_setup_vbr (&vi, 1, 44000, 0.5);
- vorbis_encode_setup_init (&vi);
- vorbis_analysis_init (&vd, &vi);
- vorbis_block_init (&vd, &vb);
- vorbis_comment_init (&vc);
- vorbis_analysis_headerout (&vd, &vc, &header, &header_comm, &header_code);
-
- buffer = gst_buffer_new_and_alloc (header_code.bytes);
- memcpy (GST_BUFFER_DATA (buffer), header_code.packet, header_code.bytes);
-
- return buffer;
-}
-
-static GstBuffer *
-_create_audio_buffer (void)
-{
- GstBuffer *buffer;
- ogg_packet packet;
- float **vorbis_buffer;
-
- vorbis_buffer = vorbis_analysis_buffer (&vd, 0);
- vorbis_analysis_wrote (&vd, 0);
- vorbis_analysis_blockout (&vd, &vb);
- vorbis_analysis (&vb, NULL);
- vorbis_bitrate_addblock (&vb);
- vorbis_bitrate_flushpacket (&vd, &packet);
- buffer = gst_buffer_new_and_alloc (packet.bytes);
- memcpy (GST_BUFFER_DATA (buffer), packet.packet, packet.bytes);
-
- vorbis_comment_clear (&vc);
- vorbis_block_clear (&vb);
- vorbis_dsp_clear (&vd);
- vorbis_info_clear (&vi);
-
- return buffer;
-}
-
-
-GST_START_TEST (test_empty_tags_set)
-{
- GstTagList *tags;
- GstElement *vorbistag;
- GstBuffer *inbuffer, *outbuffer;
-
- vorbistag = setup_vorbistag ();
-
- tags = gst_tag_list_new ();
- gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE, GST_TAG_TITLE, "foobar", NULL);
- gst_tag_setter_merge_tags (GST_TAG_SETTER (vorbistag), tags,
- GST_TAG_MERGE_REPLACE);
- gst_tag_setter_set_tag_merge_mode (GST_TAG_SETTER (vorbistag),
- GST_TAG_MERGE_KEEP_ALL);
- gst_tag_list_free (tags);
-
- start_pipeline (vorbistag);
-
- /* send identification header */
- inbuffer = gst_buffer_new_and_alloc (sizeof (identification_header));
- memcpy (GST_BUFFER_DATA (inbuffer), identification_header,
- sizeof (identification_header));
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
-
- /* send empty comment buffer */
- inbuffer = gst_buffer_new_and_alloc (sizeof (empty_comment_header));
- memcpy (GST_BUFFER_DATA (inbuffer), empty_comment_header,
- sizeof (empty_comment_header));
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
-
- /* send minimal codebook header and audio packers */
- inbuffer = _create_codebook_header_buffer ();
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
- inbuffer = _create_audio_buffer ();
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
-
-
- /* check identification header is unchanged */
- outbuffer = get_buffer ();
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer),
- sizeof (identification_header));
- fail_unless_equals_int (memcmp (GST_BUFFER_DATA (outbuffer),
- identification_header, sizeof (identification_header)), 0);
- gst_buffer_unref (outbuffer);
-
- /* check comment header is correct */
- outbuffer = get_buffer ();
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer),
- sizeof (title_comment_header));
- fail_unless_equals_int (memcmp (GST_BUFFER_DATA (outbuffer),
- title_comment_header, sizeof (title_comment_header)), 0);
- gst_buffer_unref (outbuffer);
-
- stop_pipeline (vorbistag);
- cleanup_vorbistag (vorbistag);
-}
-
-GST_END_TEST;
-
-
-GST_START_TEST (test_filled_tags_unset)
-{
- GstTagList *tags;
- GstElement *vorbistag;
- GstBuffer *inbuffer, *outbuffer;
-
- vorbistag = setup_vorbistag ();
-
- tags = gst_tag_list_new ();
- gst_tag_setter_merge_tags (GST_TAG_SETTER (vorbistag), tags,
- GST_TAG_MERGE_REPLACE);
- gst_tag_setter_set_tag_merge_mode (GST_TAG_SETTER (vorbistag),
- GST_TAG_MERGE_KEEP_ALL);
- gst_tag_list_free (tags);
-
- start_pipeline (vorbistag);
-
- /* send identification header */
- inbuffer = gst_buffer_new_and_alloc (sizeof (identification_header));
- memcpy (GST_BUFFER_DATA (inbuffer), identification_header,
- sizeof (identification_header));
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
-
- /* send empty comment buffer */
- inbuffer = gst_buffer_new_and_alloc (sizeof (title_comment_header));
- memcpy (GST_BUFFER_DATA (inbuffer), title_comment_header,
- sizeof (title_comment_header));
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
-
- /* send minimal codebook header and audio packers */
- inbuffer = _create_codebook_header_buffer ();
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
- inbuffer = _create_audio_buffer ();
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
-
-
- /* check identification header is unchanged */
- outbuffer = get_buffer ();
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer),
- sizeof (identification_header));
- fail_unless_equals_int (memcmp (GST_BUFFER_DATA (outbuffer),
- identification_header, sizeof (identification_header)), 0);
- gst_buffer_unref (outbuffer);
-
- /* check comment header is correct */
- outbuffer = get_buffer ();
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer),
- sizeof (empty_comment_header));
- fail_unless_equals_int (memcmp (GST_BUFFER_DATA (outbuffer),
- empty_comment_header, sizeof (empty_comment_header)), 0);
- gst_buffer_unref (outbuffer);
-
- stop_pipeline (vorbistag);
- cleanup_vorbistag (vorbistag);
-}
-
-GST_END_TEST;
-
-
-GST_START_TEST (test_filled_tags_change)
-{
- GstTagList *tags;
- GstElement *vorbistag;
- GstBuffer *inbuffer, *outbuffer;
-
- vorbistag = setup_vorbistag ();
-
- tags = gst_tag_list_new ();
- gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE, GST_TAG_TITLE, "foobar", NULL);
- gst_tag_setter_merge_tags (GST_TAG_SETTER (vorbistag), tags,
- GST_TAG_MERGE_REPLACE);
- gst_tag_setter_set_tag_merge_mode (GST_TAG_SETTER (vorbistag),
- GST_TAG_MERGE_KEEP_ALL);
- gst_tag_list_free (tags);
-
- start_pipeline (vorbistag);
-
- /* send identification header */
- inbuffer = gst_buffer_new_and_alloc (sizeof (identification_header));
- memcpy (GST_BUFFER_DATA (inbuffer), identification_header,
- sizeof (identification_header));
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
-
- /* send empty comment buffer */
- inbuffer = gst_buffer_new_and_alloc (sizeof (artist_comment_header));
- memcpy (GST_BUFFER_DATA (inbuffer), artist_comment_header,
- sizeof (artist_comment_header));
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
-
- /* send minimal codebook header and audio packers */
- inbuffer = _create_codebook_header_buffer ();
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
- inbuffer = _create_audio_buffer ();
- fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), GST_FLOW_OK);
-
-
- /* check identification header is unchanged */
- outbuffer = get_buffer ();
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer),
- sizeof (identification_header));
- fail_unless_equals_int (memcmp (GST_BUFFER_DATA (outbuffer),
- identification_header, sizeof (identification_header)), 0);
- gst_buffer_unref (outbuffer);
-
- /* check comment header is correct */
- outbuffer = get_buffer ();
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer),
- sizeof (title_comment_header));
- fail_unless_equals_int (memcmp (GST_BUFFER_DATA (outbuffer),
- title_comment_header, sizeof (title_comment_header)), 0);
- gst_buffer_unref (outbuffer);
-
- stop_pipeline (vorbistag);
- cleanup_vorbistag (vorbistag);
-}
-
-GST_END_TEST;
-
-
-
-static Suite *
-vorbistag_suite (void)
-{
- Suite *s = suite_create ("vorbistag");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_empty_tags_set);
- tcase_add_test (tc_chain, test_filled_tags_unset);
- tcase_add_test (tc_chain, test_filled_tags_change);
-
- return s;
-}
-
-GST_CHECK_MAIN (vorbistag)
diff --git a/tests/check/generic/.gitignore b/tests/check/generic/.gitignore
deleted file mode 100644
index 0d69de1f..00000000
--- a/tests/check/generic/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-.dirstamp
-clock-selection
-states
diff --git a/tests/check/generic/clock-selection.c b/tests/check/generic/clock-selection.c
deleted file mode 100644
index 8e332f81..00000000
--- a/tests/check/generic/clock-selection.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* GStreamer
- *
- * unit test for clock selection
- *
- * Copyright (C) <2005> Wim Taymans <wim at fluendo dot 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.
- */
-
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-
-GST_START_TEST (test_add)
-{
- GstElement *pipeline;
- GstStateChangeReturn ret;
-
- pipeline = gst_pipeline_new ("pipeline");
- fail_unless (pipeline != NULL, "could not create pipeline");
-
- ret = gst_element_set_state (pipeline, GST_STATE_READY);
- fail_unless (ret == GST_STATE_CHANGE_SUCCESS, "could not set to READY");
-
- /* cleanup */
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-}
-
-GST_END_TEST;
-
-static Suite *
-volume_suite (void)
-{
- Suite *s = suite_create ("clocks");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_add);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = volume_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/generic/states.c b/tests/check/generic/states.c
deleted file mode 100644
index c6ebd6b1..00000000
--- a/tests/check/generic/states.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/* GStreamer
- *
- * unit test for state changes on all elements
- *
- * Copyright (C) <2005> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-
-static GList *elements = NULL;
-
-static void
-setup (void)
-{
- GList *features, *f;
- GList *plugins, *p;
- gchar **ignorelist = NULL;
- const gchar *STATE_IGNORE_ELEMENTS = NULL;
-
- GST_DEBUG ("getting elements for package %s", PACKAGE);
- STATE_IGNORE_ELEMENTS = g_getenv ("STATE_IGNORE_ELEMENTS");
- if (STATE_IGNORE_ELEMENTS) {
- GST_DEBUG ("Will ignore element factories: '%s'", STATE_IGNORE_ELEMENTS);
- ignorelist = g_strsplit (STATE_IGNORE_ELEMENTS, " ", 0);
- }
-
- plugins = gst_registry_get_plugin_list (gst_registry_get_default ());
-
- for (p = plugins; p; p = p->next) {
- GstPlugin *plugin = p->data;
-
- if (strcmp (gst_plugin_get_source (plugin), PACKAGE) != 0)
- continue;
-
- features =
- gst_registry_get_feature_list_by_plugin (gst_registry_get_default (),
- gst_plugin_get_name (plugin));
-
- for (f = features; f; f = f->next) {
- GstPluginFeature *feature = f->data;
- const gchar *name = gst_plugin_feature_get_name (feature);
- gboolean ignore = FALSE;
-
- if (!GST_IS_ELEMENT_FACTORY (feature))
- continue;
-
- if (ignorelist) {
- gchar **s;
-
- for (s = ignorelist; s && *s; ++s) {
- if (g_str_has_prefix (name, *s)) {
- GST_DEBUG ("ignoring element %s", name);
- ignore = TRUE;
- }
- }
- if (ignore)
- continue;
- }
-
- GST_DEBUG ("adding element %s", name);
- elements = g_list_prepend (elements, (gpointer) g_strdup (name));
- }
- gst_plugin_feature_list_free (features);
- }
- gst_plugin_list_free (plugins);
- g_strfreev (ignorelist);
-}
-
-static void
-teardown (void)
-{
- GList *e;
-
- for (e = elements; e; e = e->next) {
- g_free (e->data);
- }
- g_list_free (elements);
- elements = NULL;
-}
-
-
-GST_START_TEST (test_state_changes_up_and_down_seq)
-{
- GstElement *element;
- GList *e;
-
- for (e = elements; e; e = e->next) {
- const gchar *name = e->data;
-
- GST_DEBUG ("testing element %s", name);
- element = gst_element_factory_make (name, name);
- fail_if (element == NULL, "Could not make element from factory %s", name);
-
- if (GST_IS_PIPELINE (element)) {
- GST_DEBUG ("element %s is a pipeline", name);
- }
-
- gst_element_set_state (element, GST_STATE_READY);
- gst_element_set_state (element, GST_STATE_PAUSED);
- gst_element_set_state (element, GST_STATE_PLAYING);
- gst_element_set_state (element, GST_STATE_PAUSED);
- gst_element_set_state (element, GST_STATE_READY);
- gst_element_set_state (element, GST_STATE_NULL);
- gst_element_set_state (element, GST_STATE_PAUSED);
- gst_element_set_state (element, GST_STATE_READY);
- gst_element_set_state (element, GST_STATE_PLAYING);
- gst_element_set_state (element, GST_STATE_PAUSED);
- gst_element_set_state (element, GST_STATE_NULL);
- gst_object_unref (GST_OBJECT (element));
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_state_changes_up_seq)
-{
- GstElement *element;
- GList *e;
-
- for (e = elements; e; e = e->next) {
- const gchar *name = e->data;
-
- GST_DEBUG ("testing element %s", name);
- element = gst_element_factory_make (name, name);
- fail_if (element == NULL, "Could not make element from factory %s", name);
-
- if (GST_IS_PIPELINE (element)) {
- GST_DEBUG ("element %s is a pipeline", name);
- }
-
- gst_element_set_state (element, GST_STATE_READY);
-
- gst_element_set_state (element, GST_STATE_PAUSED);
- gst_element_set_state (element, GST_STATE_READY);
-
- gst_element_set_state (element, GST_STATE_PAUSED);
- gst_element_set_state (element, GST_STATE_PLAYING);
- gst_element_set_state (element, GST_STATE_PAUSED);
- gst_element_set_state (element, GST_STATE_READY);
-
- gst_element_set_state (element, GST_STATE_NULL);
- gst_object_unref (GST_OBJECT (element));
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_state_changes_down_seq)
-{
- GstElement *element;
- GList *e;
-
- for (e = elements; e; e = e->next) {
- const gchar *name = e->data;
-
- GST_DEBUG ("testing element %s", name);
- element = gst_element_factory_make (name, name);
- fail_if (element == NULL, "Could not make element from factory %s", name);
-
- if (GST_IS_PIPELINE (element)) {
- GST_DEBUG ("element %s is a pipeline", name);
- }
-
- gst_element_set_state (element, GST_STATE_READY);
- gst_element_set_state (element, GST_STATE_PAUSED);
- gst_element_set_state (element, GST_STATE_PLAYING);
-
- gst_element_set_state (element, GST_STATE_PAUSED);
- gst_element_set_state (element, GST_STATE_PLAYING);
-
- gst_element_set_state (element, GST_STATE_PAUSED);
- gst_element_set_state (element, GST_STATE_READY);
- gst_element_set_state (element, GST_STATE_PAUSED);
- gst_element_set_state (element, GST_STATE_PLAYING);
-
- gst_element_set_state (element, GST_STATE_PAUSED);
- gst_element_set_state (element, GST_STATE_READY);
- gst_element_set_state (element, GST_STATE_NULL);
- gst_object_unref (GST_OBJECT (element));
- }
-}
-
-GST_END_TEST;
-
-
-static Suite *
-states_suite (void)
-{
- Suite *s = suite_create ("states");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_checked_fixture (tc_chain, setup, teardown);
- tcase_add_test (tc_chain, test_state_changes_up_and_down_seq);
- tcase_add_test (tc_chain, test_state_changes_up_seq);
- tcase_add_test (tc_chain, test_state_changes_down_seq);
-
- return s;
-}
-
-GST_CHECK_MAIN (states);
diff --git a/tests/check/gst-plugins-base.supp b/tests/check/gst-plugins-base.supp
deleted file mode 100644
index 113b3f2e..00000000
--- a/tests/check/gst-plugins-base.supp
+++ /dev/null
@@ -1,397 +0,0 @@
-# A suppression for an old bug in libtheora (fixed in more recent versions,
-# but some of our buildslaves still have this)
-{
- <Leaky libtheora>
- Memcheck:Leak
- fun:realloc
- fun:oggpackB_write
- fun:EncodeData
- obj:/usr/lib/libtheora.so*
- fun:theora_encode_YUVin
-}
-
-# Suppression for pango on ubuntu edgy/x86 and textoverlay test
-{
- <pango>
- Memcheck:Param
- access(pathname)
- fun:access
- fun:pango_config_key_get
- fun:pango_find_map
-}
-
-{
- <suppression for a singleton in GIO that can't be cleaned up>
- Memcheck:Leak
- fun:realloc
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- fun:g_type_create_instance
- fun:g_object_constructor
- fun:g_object_newv
- fun:g_object_new_valist
- fun:g_object_new
- fun:get_default_vfs
- fun:g_once_impl
- fun:g_vfs_get_default
-}
-
-{
- <suppression for a singleton in GIO that can't be cleaned up>
- Memcheck:Leak
- fun:malloc
- obj:*
- obj:*
- obj:*
- obj:*
- fun:g_type_create_instance
- fun:g_object_constructor
- fun:g_object_newv
- fun:g_object_new_valist
- fun:g_object_new
- fun:get_default_vfs
- fun:g_once_impl
- fun:g_vfs_get_default
-}
-
-{
- <ALSA unitialised access>
- Memcheck:Cond
- obj:/usr/lib/libasound.so.*
- fun:snd_pcm_hw_params_set_buffer_time_near
-}
-
-{
- <ALSA unitialized access>
- Memcheck:Cond
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- fun:snd_pcm_hw_params_set_buffer_time_near
-}
-
-{
- <One time init in ALSA>
- Memcheck:Leak
- fun:malloc
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- fun:gst_alsa_device_property_probe_get_values
-}
-
-{
- <One time init in ALSA>
- Memcheck:Leak
- fun:calloc
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- fun:snd_config_hook_load
- obj:*
- obj:/usr/lib/libasound.so.*
- fun:snd_config_searcha_hooks
- fun:snd_config_searchva_hooks
- obj:/usr/lib/libasound.so.*
- fun:snd_config_search_definition
- obj:/usr/lib/libasound.so.*
- fun:gst_alsa_device_property_probe_get_values
-}
-
-{
- <One time init in ALSA>
- Memcheck:Leak
- fun:calloc
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:/usr/lib/libasound.so.*
- fun:snd_config_searcha_hooks
- fun:snd_config_searchva_hooks
- obj:/usr/lib/libasound.so.*
- fun:snd_config_search_definition
- obj:/usr/lib/libasound.so.*
- fun:gst_alsa_device_property_probe_get_values
-}
-
-{
- <One time init in ALSA>
- Memcheck:Leak
- fun:calloc
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:/usr/lib/libasound.so.*
- fun:snd_config_searcha_hooks
- fun:snd_config_searchva_hooks
- obj:/usr/lib/libasound.so.*
- fun:snd_config_search_definition
- obj:/usr/lib/libasound.so.*
- fun:gst_alsa_device_property_probe_get_values
-}
-
-{
- <One time init in ALSA>
- Memcheck:Leak
- fun:calloc
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:*
- obj:/usr/lib/libasound.so.*
- fun:snd_config_searcha_hooks
- fun:snd_config_searchva_hooks
- obj:/usr/lib/libasound.so.*
- fun:snd_config_search_definition
- obj:/usr/lib/libasound.so.*
- fun:gst_alsa_device_property_probe_get_values
-}
-
-{
- <One time init in ALSA>
- Memcheck:Leak
- fun:malloc
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- fun:snd_hctl_open
- fun:snd_mixer_attach
-}
-
-{
- <Pulseaudio ALSA plugin initialisation>
- Memcheck:Leak
- fun:calloc
- fun:pa_xmalloc0
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- fun:pa_proplist_sets
- fun:pa_context_new_with_proplist
- fun:pa_context_new
- obj:/usr/lib/alsa-lib/libasound_module_pcm_pulse.so
-}
-
-{
- <Pulseaudio ALSA plugin initialisation>
- Memcheck:Leak
- fun:calloc
- fun:pa_xmalloc0
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- fun:pa_mainloop_dispatch
- obj:/usr/lib/alsa-lib/libasound_module_pcm_pulse.so
-}
-
-{
- <Pulseaudio ALSA plugin initialisation>
- Memcheck:Leak
- fun:calloc
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- fun:snd_config_hook_load
- obj:/usr/lib/alsa-lib/libasound_module_ctl_pulse.so
-}
-
-{
- <Pulseaudio ALSA plugin initialisation>
- Memcheck:Leak
- fun:calloc
- fun:pa_xmalloc0
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- fun:pa_proplist_sets
- fun:pa_context_new_with_proplist
- fun:pa_context_new
- obj:/usr/lib/alsa-lib/libasound_module_ctl_pulse.so
-}
-
-{
- <Pulseaudio ALSA plugin initialisation>
- Memcheck:Leak
- fun:calloc
- fun:pa_xmalloc0
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- fun:pa_mainloop_dispatch
- obj:/usr/lib/alsa-lib/libasound_module_ctl_pulse.so
-}
-
-{
- <Pulseaudio ALSA plugin initialisation>
- Memcheck:Leak
- fun:calloc
- fun:pa_xmalloc0
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- fun:pa_mainloop_dispatch
- obj:/usr/lib/alsa-lib/libasound_module_ctl_pulse.so
-}
-
-{
- <Pulseaudio ALSA plugin initialisation>
- Memcheck:Leak
- fun:calloc
- fun:pa_xmalloc0
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- fun:pa_mainloop_dispatch
- obj:/usr/lib/alsa-lib/libasound_module_ctl_pulse.so
-}
-
-{
- <Pulseaudio ALSA plugin initialisation>
- Memcheck:Leak
- fun:calloc
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- fun:snd_config_hook_load
- obj:/usr/lib/alsa-lib/libasound_module_pcm_pulse.so
-}
-
-{
- <Pulseaudio ALSA plugin initialisation>
- Memcheck:Leak
- fun:calloc
- fun:pa_xmalloc0
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- fun:pa_mainloop_dispatch
- obj:/usr/lib/alsa-lib/libasound_module_pcm_pulse.so
-}
-
-{
- <Pulseaudio ALSA plugin initialisation>
- Memcheck:Leak
- fun:calloc
- fun:pa_xmalloc0
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- obj:/usr/lib/libpulse.so.*
- fun:pa_mainloop_dispatch
- obj:/usr/lib/alsa-lib/libasound_module_pcm_pulse.so
-}
-
-{
- <One time ALSA init>
- Memcheck:Leak
- fun:malloc
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- obj:/usr/lib/libasound.so.*
- fun:gst_alsasrc_open
-}
-
-{
- <Fontconfig init>
- Memcheck:Leak
- fun:malloc
- obj:/usr/lib/libfontconfig.so.*
- obj:/usr/lib/libfontconfig.so.*
- obj:/usr/lib/libfontconfig.so.*
- obj:/usr/lib/libfontconfig.so.*
- obj:/usr/lib/libexpat.so.*
- obj:/usr/lib/libexpat.so.*
- obj:/usr/lib/libexpat.so.*
- obj:/usr/lib/libexpat.so.*
- fun:XML_ParseBuffer
- fun:FcConfigParseAndLoad
-}
-
-{
- <Fontconfig init>
- Memcheck:Leak
- fun:realloc
- obj:/usr/lib/libfontconfig.so.*
- obj:/usr/lib/libfontconfig.so.*
- obj:/usr/lib/libfontconfig.so.*
- obj:/usr/lib/libfontconfig.so.*
- fun:FcDefaultSubstitute
-}
-
-{
- <Fontconfig init>
- Memcheck:Leak
- fun:realloc
- obj:/usr/lib/libfontconfig.so.*
- obj:/usr/lib/libfontconfig.so.*
- fun:FcConfigSubstituteWithPat
-}
-
-{
- <Fontconfig init>
- Memcheck:Leak
- fun:realloc
- obj:/usr/lib/libfontconfig.so.*
- obj:/usr/lib/libfontconfig.so.*
- obj:/usr/lib/libfontconfig.so.*
- fun:FcFontRenderPrepare
-}
diff --git a/tests/check/gst/.gitignore b/tests/check/gst/.gitignore
deleted file mode 100644
index b4690418..00000000
--- a/tests/check/gst/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-typefindfunctions
-.dirstamp
diff --git a/tests/check/gst/typefindfunctions.c b/tests/check/gst/typefindfunctions.c
deleted file mode 100644
index 08d3f1bc..00000000
--- a/tests/check/gst/typefindfunctions.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* GStreamer unit tests for the -base typefind functions
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gst/check/gstcheck.h>
-#include <gst/base/gsttypefindhelper.h>
-
-GST_START_TEST (test_quicktime_mpeg4video)
-{
- /* quicktime redirect file which starts with what could also be interpreted
- * as an MPEG-4 video object layer start code */
- const guint8 qt_redirect_396042[] =
- { 0x00, 0x00, 0x01, 0x22, 0x6d, 0x6f, 0x6f, 0x76, 0x00, 0x00, 0x01, 0x1a,
- 0x72, 0x6d, 0x72, 0x61, 0x00, 0x00, 0x00, 0x86, 0x72, 0x6d, 0x64, 0x61,
- 0x00, 0x00, 0x00, 0x54, 0x72, 0x64, 0x72, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x75, 0x72, 0x6c, 0x20, 0x00, 0x00, 0x00, 0x40, 0x68, 0x74, 0x74, 0x70,
- 0x3a, 0x2f, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x71, 0x74,
- 0x76, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
- 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x6a, 0x61, 0x6e, 0x2f, 0x6a,
- 0x34, 0x37, 0x64, 0x35, 0x32, 0x6f, 0x6f, 0x2f, 0x71, 0x74, 0x37, 0x72,
- 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x2e, 0x6d, 0x6f, 0x76, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x72, 0x6d, 0x64, 0x72, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0a, 0xf0, 0x00, 0x00, 0x00, 0x1a, 0x72, 0x6d, 0x76, 0x63,
- 0x00, 0x00, 0x00, 0x00, 0x71, 0x74, 0x69, 0x6d, 0x06, 0x50, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x72, 0x6d,
- 0x64, 0x61, 0x00, 0x00, 0x00, 0x5a, 0x72, 0x64, 0x72, 0x66, 0x00, 0x00,
- 0x00, 0x00, 0x75, 0x72, 0x6c, 0x20, 0x00, 0x00, 0x00, 0x46, 0x68, 0x74,
- 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e,
- 0x71, 0x74, 0x76, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f,
- 0x6d, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x6a, 0x61, 0x6e,
- 0x2f, 0x6a, 0x34, 0x37, 0x64, 0x35, 0x32, 0x6f, 0x6f, 0x2f, 0x38, 0x38,
- 0x34, 0x38, 0x31, 0x32, 0x35, 0x5f, 0x32, 0x5f, 0x33, 0x35, 0x30, 0x5f,
- 0x72, 0x65, 0x66, 0x2e, 0x6d, 0x6f, 0x76, 0x00, 0x00, 0x00, 0x00, 0x10,
- 0x72, 0x6d, 0x64, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xf0,
- 0x00, 0x00, 0x00, 0x1a, 0x72, 0x6d, 0x76, 0x63, 0x00, 0x00, 0x00, 0x00,
- 0x71, 0x74, 0x69, 0x6d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00
- };
- GstTypeFindProbability prob;
- const gchar *type;
- GstBuffer *buf;
- GstCaps *caps = NULL;
-
- buf = gst_buffer_new ();
- GST_BUFFER_DATA (buf) = (guint8 *) qt_redirect_396042;
- GST_BUFFER_SIZE (buf) = sizeof (qt_redirect_396042);
- GST_BUFFER_OFFSET (buf) = 0;
-
- caps = gst_type_find_helper_for_buffer (NULL, buf, &prob);
- fail_unless (caps != NULL);
- GST_LOG ("Found type: %" GST_PTR_FORMAT, caps);
-
- type = gst_structure_get_name (gst_caps_get_structure (caps, 0));
- fail_unless_equals_string (type, "video/quicktime");
- fail_unless (prob > GST_TYPE_FIND_MINIMUM && prob <= GST_TYPE_FIND_MAXIMUM);
-
- gst_buffer_unref (buf);
- gst_caps_unref (caps);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_broken_flac_in_ogg)
-{
- const guint8 flac_id_packet[4] = { 'f', 'L', 'a', 'C' };
- GstTypeFindProbability prob;
- const gchar *type;
- GstBuffer *buf;
- GstCaps *caps = NULL;
-
- buf = gst_buffer_new ();
- GST_BUFFER_DATA (buf) = (guint8 *) flac_id_packet;
- GST_BUFFER_SIZE (buf) = sizeof (flac_id_packet);
- GST_BUFFER_OFFSET (buf) = 0;
-
- caps = gst_type_find_helper_for_buffer (NULL, buf, &prob);
- fail_unless (caps != NULL);
- GST_LOG ("Found type: %" GST_PTR_FORMAT, caps);
-
- type = gst_structure_get_name (gst_caps_get_structure (caps, 0));
- fail_unless_equals_string (type, "audio/x-flac");
- fail_unless (prob > GST_TYPE_FIND_MINIMUM && prob <= GST_TYPE_FIND_MAXIMUM);
-
- gst_buffer_unref (buf);
- gst_caps_unref (caps);
-
-}
-
-GST_END_TEST;
-
-static Suite *
-typefindfunctions_suite (void)
-{
- Suite *s = suite_create ("typefindfunctions");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
-
- tcase_add_test (tc_chain, test_quicktime_mpeg4video);
- tcase_add_test (tc_chain, test_broken_flac_in_ogg);
-
- return s;
-}
-
-GST_CHECK_MAIN (typefindfunctions);
diff --git a/tests/check/libs/.gitignore b/tests/check/libs/.gitignore
deleted file mode 100644
index cd372588..00000000
--- a/tests/check/libs/.gitignore
+++ /dev/null
@@ -1,13 +0,0 @@
-.dirstamp
-audio
-cddabasesrc
-fft
-mixer
-navigation
-netbuffer
-pbutils
-rtp
-tag
-utils
-video
-
diff --git a/tests/check/libs/audio.c b/tests/check/libs/audio.c
deleted file mode 100644
index f5fab570..00000000
--- a/tests/check/libs/audio.c
+++ /dev/null
@@ -1,559 +0,0 @@
-/* GStreamer
- *
- * unit tests for audio support 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/check/gstcheck.h>
-
-#include <gst/audio/audio.h>
-#include <gst/audio/multichannel.h>
-#include <string.h>
-
-static gboolean
-structure_contains_channel_positions (const GstStructure * s)
-{
- return (gst_structure_get_value (s, "channel-positions") != NULL);
-}
-
-#if 0
-static gboolean
-fixed_caps_have_channel_positions (const GstCaps * caps)
-{
- GstStructure *s;
-
- fail_unless (caps != NULL);
-
- s = gst_caps_get_structure (caps, 0);
- fail_unless (s != NULL);
-
- return structure_contains_channel_positions (s);
-}
-#endif
-
-GST_START_TEST (test_multichannel_checks)
-{
- GstAudioChannelPosition pos_2_mixed[2] = {
- GST_AUDIO_CHANNEL_POSITION_FRONT_MONO,
- GST_AUDIO_CHANNEL_POSITION_NONE
- };
- GstAudioChannelPosition pos_2_none[2] = {
- GST_AUDIO_CHANNEL_POSITION_NONE,
- GST_AUDIO_CHANNEL_POSITION_NONE
- };
- GstAudioChannelPosition pos_2_flr[2] = {
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
- };
- GstAudioChannelPosition pos_2_frr[2] = {
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
- };
- GstStructure *s;
-
- s = gst_structure_new ("audio/x-raw-int", "channels", G_TYPE_INT, 2, NULL);
-
- /* check if the audio channel position checks work */
- fail_if (gst_audio_check_channel_positions (pos_2_mixed, 2));
- fail_unless (gst_audio_check_channel_positions (pos_2_none, 2));
- fail_unless (gst_audio_check_channel_positions (pos_2_flr, 2));
- fail_if (gst_audio_check_channel_positions (pos_2_frr, 2));
-
- /* this should not work and issue a warning: FRONT_MONO + NONE */
- _gst_check_expecting_log = TRUE;
- gst_audio_set_channel_positions (s, pos_2_mixed);
- _gst_check_expecting_log = FALSE;
- fail_if (structure_contains_channel_positions (s));
-
- /* this should work: NONE + NONE */
- gst_audio_set_channel_positions (s, pos_2_none);
- fail_unless (structure_contains_channel_positions (s));
- gst_structure_remove_field (s, "channel-positions");
-
- /* this should also work: FRONT_LEFT + FRONT_RIGHT */
- gst_audio_set_channel_positions (s, pos_2_flr);
- fail_unless (structure_contains_channel_positions (s));
- gst_structure_remove_field (s, "channel-positions");
-
- /* this should not work and issue a warning: FRONT_RIGHT twice */
- _gst_check_expecting_log = TRUE;
- gst_audio_set_channel_positions (s, pos_2_frr);
- _gst_check_expecting_log = FALSE;
-
-/* FIXME: did I misunderstand _set_structure_channel_positions_list? */
-#if 0
- /* this should not work and issue a warning: FRONT_RIGHT twice */
- _gst_check_expecting_log = TRUE;
- gst_audio_set_structure_channel_positions_list (s, pos_2_frr, 2);
- _gst_check_expecting_log = FALSE;
-
- /* this should not work and issue a warning: FRONT_MONO + NONE */
- _gst_check_expecting_log = TRUE;
- gst_audio_set_structure_channel_positions_list (s, pos_2_mixed, 2);
- _gst_check_expecting_log = FALSE;
-
- /* this should not work either (channel count mismatch) */
- _gst_check_expecting_log = TRUE;
- gst_audio_set_structure_channel_positions_list (s, pos_2_none, 44);
- _gst_check_expecting_log = FALSE;
- fail_if (structure_contains_channel_positions (s));
-#endif
-
- gst_structure_free (s);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_buffer_clipping_time)
-{
- GstSegment s;
-
- GstBuffer *buf;
-
- GstBuffer *ret;
-
- guint8 *data;
-
- /* Clip start and end */
- buf = gst_buffer_new ();
- data = (guint8 *) g_malloc (1000);
- GST_BUFFER_SIZE (buf) = 1000;
- GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
-
- gst_segment_init (&s, GST_FORMAT_TIME);
- gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_TIME, 4 * GST_SECOND,
- 8 * GST_SECOND, 4 * GST_SECOND);
-
- GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
- GST_BUFFER_DURATION (buf) = 10 * GST_SECOND;
- GST_BUFFER_OFFSET (buf) = 200;
- GST_BUFFER_OFFSET_END (buf) = 1200;
-
- ret = gst_audio_buffer_clip (buf, &s, 100, 1);
- fail_unless (ret != NULL);
-
- fail_unless (GST_BUFFER_TIMESTAMP (ret) == 4 * GST_SECOND);
- fail_unless (GST_BUFFER_DURATION (ret) == 4 * GST_SECOND);
- fail_unless (GST_BUFFER_OFFSET (ret) == 400);
- fail_unless (GST_BUFFER_OFFSET_END (ret) == 800);
- fail_unless (GST_BUFFER_DATA (ret) == data + 200);
- fail_unless (GST_BUFFER_SIZE (ret) == 400);
-
- gst_buffer_unref (ret);
-
- /* Clip only start */
- buf = gst_buffer_new ();
- data = (guint8 *) g_malloc (1000);
- GST_BUFFER_SIZE (buf) = 1000;
- GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
-
- gst_segment_init (&s, GST_FORMAT_TIME);
- gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_TIME, 4 * GST_SECOND,
- 12 * GST_SECOND, 4 * GST_SECOND);
-
- GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
- GST_BUFFER_DURATION (buf) = 10 * GST_SECOND;
- GST_BUFFER_OFFSET (buf) = 200;
- GST_BUFFER_OFFSET_END (buf) = 1200;
-
- ret = gst_audio_buffer_clip (buf, &s, 100, 1);
- fail_unless (ret != NULL);
-
- fail_unless (GST_BUFFER_TIMESTAMP (ret) == 4 * GST_SECOND);
- fail_unless (GST_BUFFER_DURATION (ret) == 8 * GST_SECOND);
- fail_unless (GST_BUFFER_OFFSET (ret) == 400);
- fail_unless (GST_BUFFER_OFFSET_END (ret) == 1200);
- fail_unless (GST_BUFFER_DATA (ret) == data + 200);
- fail_unless (GST_BUFFER_SIZE (ret) == 800);
-
- gst_buffer_unref (ret);
-
- /* Clip only stop */
- buf = gst_buffer_new ();
- data = (guint8 *) g_malloc (1000);
- GST_BUFFER_SIZE (buf) = 1000;
- GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
-
- gst_segment_init (&s, GST_FORMAT_TIME);
- gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_TIME, 2 * GST_SECOND,
- 10 * GST_SECOND, 2 * GST_SECOND);
-
- GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
- GST_BUFFER_DURATION (buf) = 10 * GST_SECOND;
- GST_BUFFER_OFFSET (buf) = 200;
- GST_BUFFER_OFFSET_END (buf) = 1200;
-
- ret = gst_audio_buffer_clip (buf, &s, 100, 1);
- fail_unless (ret != NULL);
-
- fail_unless (GST_BUFFER_TIMESTAMP (ret) == 2 * GST_SECOND);
- fail_unless (GST_BUFFER_DURATION (ret) == 8 * GST_SECOND);
- fail_unless (GST_BUFFER_OFFSET (ret) == 200);
- fail_unless (GST_BUFFER_OFFSET_END (ret) == 1000);
- fail_unless (GST_BUFFER_DATA (ret) == data);
- fail_unless (GST_BUFFER_SIZE (ret) == 800);
-
- gst_buffer_unref (ret);
-
- /* Buffer outside segment */
- buf = gst_buffer_new ();
- data = (guint8 *) g_malloc (1000);
- GST_BUFFER_SIZE (buf) = 1000;
- GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
-
- gst_segment_init (&s, GST_FORMAT_TIME);
- gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_TIME, 12 * GST_SECOND,
- 20 * GST_SECOND, 12 * GST_SECOND);
-
- GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
- GST_BUFFER_DURATION (buf) = 10 * GST_SECOND;
- GST_BUFFER_OFFSET (buf) = 200;
- GST_BUFFER_OFFSET_END (buf) = 1200;
-
- ret = gst_audio_buffer_clip (buf, &s, 100, 1);
- fail_unless (ret == NULL);
-
- /* Clip start and end but don't touch duration and offset_end */
- buf = gst_buffer_new ();
- data = (guint8 *) g_malloc (1000);
- GST_BUFFER_SIZE (buf) = 1000;
- GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
-
- gst_segment_init (&s, GST_FORMAT_TIME);
- gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_TIME, 4 * GST_SECOND,
- 8 * GST_SECOND, 4 * GST_SECOND);
-
- GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
- GST_BUFFER_DURATION (buf) = GST_CLOCK_TIME_NONE;
- GST_BUFFER_OFFSET (buf) = 200;
- GST_BUFFER_OFFSET_END (buf) = GST_BUFFER_OFFSET_NONE;
-
- ret = gst_audio_buffer_clip (buf, &s, 100, 1);
- fail_unless (ret != NULL);
-
- fail_unless (GST_BUFFER_TIMESTAMP (ret) == 4 * GST_SECOND);
- fail_unless (GST_BUFFER_DURATION (ret) == GST_CLOCK_TIME_NONE);
- fail_unless (GST_BUFFER_OFFSET (ret) == 400);
- fail_unless (GST_BUFFER_OFFSET_END (ret) == GST_BUFFER_OFFSET_NONE);
- fail_unless (GST_BUFFER_DATA (ret) == data + 200);
- fail_unless (GST_BUFFER_SIZE (ret) == 400);
-
- gst_buffer_unref (ret);
-
- /* If the buffer has no timestamp it should assert()
- * FIXME: check if return value is the same as the input buffer.
- * probably can't be done because the assert() does a SIGABRT.
- */
- buf = gst_buffer_new ();
- data = (guint8 *) g_malloc (1000);
- GST_BUFFER_SIZE (buf) = 1000;
- GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
-
- gst_segment_init (&s, GST_FORMAT_TIME);
- gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_TIME, 0 * GST_SECOND,
- 10 * GST_SECOND, 0 * GST_SECOND);
-
- GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE;
- GST_BUFFER_DURATION (buf) = GST_CLOCK_TIME_NONE;
- GST_BUFFER_OFFSET (buf) = GST_BUFFER_OFFSET_NONE;
- GST_BUFFER_OFFSET_END (buf) = GST_BUFFER_OFFSET_NONE;
-
- ret = gst_audio_buffer_clip (buf, &s, 100, 1);
- fail_unless (ret == buf);
-
- gst_buffer_unref (buf);
-
- /* If the format is not TIME or DEFAULT it should assert()
- * FIXME: check if return value is the same as the input buffer.
- * probably can't be done because the assert() does a SIGABRT.
- */
- buf = gst_buffer_new ();
- data = (guint8 *) g_malloc (1000);
- GST_BUFFER_SIZE (buf) = 1000;
- GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
-
- gst_segment_init (&s, GST_FORMAT_PERCENT);
- gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_PERCENT, 0, 10, 0);
-
- GST_BUFFER_TIMESTAMP (buf) = 0 * GST_SECOND;
- GST_BUFFER_DURATION (buf) = 0;
- GST_BUFFER_OFFSET (buf) = GST_BUFFER_OFFSET_NONE;
- GST_BUFFER_OFFSET_END (buf) = GST_BUFFER_OFFSET_NONE;
-
- ASSERT_CRITICAL (ret = gst_audio_buffer_clip (buf, &s, 100, 1));
-
- gst_buffer_unref (buf);
-
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_buffer_clipping_samples)
-{
- GstSegment s;
-
- GstBuffer *buf;
-
- GstBuffer *ret;
-
- guint8 *data;
-
- /* Clip start and end */
- buf = gst_buffer_new ();
- data = (guint8 *) g_malloc (1000);
- GST_BUFFER_SIZE (buf) = 1000;
- GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
-
- gst_segment_init (&s, GST_FORMAT_DEFAULT);
- gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_DEFAULT, 400,
- 800, 400);
-
- GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
- GST_BUFFER_DURATION (buf) = 10 * GST_SECOND;
- GST_BUFFER_OFFSET (buf) = 200;
- GST_BUFFER_OFFSET_END (buf) = 1200;
-
- ret = gst_audio_buffer_clip (buf, &s, 100, 1);
- fail_unless (ret != NULL);
-
- fail_unless (GST_BUFFER_TIMESTAMP (ret) == 4 * GST_SECOND);
- fail_unless (GST_BUFFER_DURATION (ret) == 4 * GST_SECOND);
- fail_unless (GST_BUFFER_OFFSET (ret) == 400);
- fail_unless (GST_BUFFER_OFFSET_END (ret) == 800);
- fail_unless (GST_BUFFER_DATA (ret) == data + 200);
- fail_unless (GST_BUFFER_SIZE (ret) == 400);
-
- gst_buffer_unref (ret);
-
- /* Clip only start */
- buf = gst_buffer_new ();
- data = (guint8 *) g_malloc (1000);
- GST_BUFFER_SIZE (buf) = 1000;
- GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
-
- gst_segment_init (&s, GST_FORMAT_DEFAULT);
- gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_DEFAULT, 400,
- 1200, 400);
-
- GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
- GST_BUFFER_DURATION (buf) = 10 * GST_SECOND;
- GST_BUFFER_OFFSET (buf) = 200;
- GST_BUFFER_OFFSET_END (buf) = 1200;
-
- ret = gst_audio_buffer_clip (buf, &s, 100, 1);
- fail_unless (ret != NULL);
-
- fail_unless (GST_BUFFER_TIMESTAMP (ret) == 4 * GST_SECOND);
- fail_unless (GST_BUFFER_DURATION (ret) == 8 * GST_SECOND);
- fail_unless (GST_BUFFER_OFFSET (ret) == 400);
- fail_unless (GST_BUFFER_OFFSET_END (ret) == 1200);
- fail_unless (GST_BUFFER_DATA (ret) == data + 200);
- fail_unless (GST_BUFFER_SIZE (ret) == 800);
-
- gst_buffer_unref (ret);
-
- /* Clip only stop */
- buf = gst_buffer_new ();
- data = (guint8 *) g_malloc (1000);
- GST_BUFFER_SIZE (buf) = 1000;
- GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
-
- gst_segment_init (&s, GST_FORMAT_DEFAULT);
- gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_DEFAULT, 200,
- 1000, 200);
-
- GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
- GST_BUFFER_DURATION (buf) = 10 * GST_SECOND;
- GST_BUFFER_OFFSET (buf) = 200;
- GST_BUFFER_OFFSET_END (buf) = 1200;
-
- ret = gst_audio_buffer_clip (buf, &s, 100, 1);
- fail_unless (ret != NULL);
-
- fail_unless (GST_BUFFER_TIMESTAMP (ret) == 2 * GST_SECOND);
- fail_unless (GST_BUFFER_DURATION (ret) == 8 * GST_SECOND);
- fail_unless (GST_BUFFER_OFFSET (ret) == 200);
- fail_unless (GST_BUFFER_OFFSET_END (ret) == 1000);
- fail_unless (GST_BUFFER_DATA (ret) == data);
- fail_unless (GST_BUFFER_SIZE (ret) == 800);
-
- gst_buffer_unref (ret);
-
- /* Buffer outside segment */
- buf = gst_buffer_new ();
- data = (guint8 *) g_malloc (1000);
- GST_BUFFER_SIZE (buf) = 1000;
- GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
-
- gst_segment_init (&s, GST_FORMAT_DEFAULT);
- gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_DEFAULT, 1200,
- 2000, 1200);
-
- GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
- GST_BUFFER_DURATION (buf) = 10 * GST_SECOND;
- GST_BUFFER_OFFSET (buf) = 200;
- GST_BUFFER_OFFSET_END (buf) = 1200;
-
- ret = gst_audio_buffer_clip (buf, &s, 100, 1);
- fail_unless (ret == NULL);
-
- /* Clip start and end but don't touch duration and offset_end */
- buf = gst_buffer_new ();
- data = (guint8 *) g_malloc (1000);
- GST_BUFFER_SIZE (buf) = 1000;
- GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
-
- gst_segment_init (&s, GST_FORMAT_DEFAULT);
- gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_DEFAULT, 400,
- 800, 400);
-
- GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND;
- GST_BUFFER_DURATION (buf) = GST_CLOCK_TIME_NONE;
- GST_BUFFER_OFFSET (buf) = 200;
- GST_BUFFER_OFFSET_END (buf) = GST_BUFFER_OFFSET_NONE;
-
- ret = gst_audio_buffer_clip (buf, &s, 100, 1);
- fail_unless (ret != NULL);
-
- fail_unless (GST_BUFFER_TIMESTAMP (ret) == 4 * GST_SECOND);
- fail_unless (GST_BUFFER_DURATION (ret) == GST_CLOCK_TIME_NONE);
- fail_unless (GST_BUFFER_OFFSET (ret) == 400);
- fail_unless (GST_BUFFER_OFFSET_END (ret) == GST_BUFFER_OFFSET_NONE);
- fail_unless (GST_BUFFER_DATA (ret) == data + 200);
- fail_unless (GST_BUFFER_SIZE (ret) == 400);
-
- gst_buffer_unref (ret);
-
- /* If the buffer has no offset it should assert()
- * FIXME: check if return value is the same as the input buffer.
- * probably can't be done because the assert() does a SIGABRT.
- */
- buf = gst_buffer_new ();
- data = (guint8 *) g_malloc (1000);
- GST_BUFFER_SIZE (buf) = 1000;
- GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
-
- gst_segment_init (&s, GST_FORMAT_DEFAULT);
- gst_segment_set_newsegment (&s, FALSE, 1.0, GST_FORMAT_DEFAULT, 0, 10, 0);
-
- GST_BUFFER_TIMESTAMP (buf) = 0 * GST_SECOND;
- GST_BUFFER_DURATION (buf) = GST_CLOCK_TIME_NONE;
- GST_BUFFER_OFFSET (buf) = GST_BUFFER_OFFSET_NONE;
- GST_BUFFER_OFFSET_END (buf) = GST_BUFFER_OFFSET_NONE;
-
- ASSERT_CRITICAL (ret = gst_audio_buffer_clip (buf, &s, 100, 1));
-
- gst_buffer_unref (buf);
-}
-
-GST_END_TEST;
-
-static void
-init_value_to_channel_layout (GValue * val, GstAudioChannelPosition pos1,
- GstAudioChannelPosition pos2)
-{
- GValue pos = { 0, };
-
- g_value_init (val, GST_TYPE_ARRAY);
- g_value_init (&pos, GST_TYPE_AUDIO_CHANNEL_POSITION);
- g_value_set_enum (&pos, pos1);
- gst_value_array_append_value (val, &pos);
- g_value_set_enum (&pos, pos2);
- gst_value_array_append_value (val, &pos);
- g_value_unset (&pos);
-}
-
-GST_START_TEST (test_channel_layout_value_intersect)
-{
- GValue layout = { 0, };
- GValue list = { 0, };
- GValue res = { 0, };
-
- g_value_init (&list, GST_TYPE_LIST);
- init_value_to_channel_layout (&layout, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT);
- gst_value_list_append_value (&list, &layout);
- g_value_unset (&layout);
- init_value_to_channel_layout (&layout, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT);
- gst_value_list_append_value (&list, &layout);
- g_value_unset (&layout);
-
- init_value_to_channel_layout (&layout, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT);
-
- /* we should get the second layout in the list, as it matches the input */
- fail_unless (gst_value_intersect (&res, &layout, &list));
- g_value_unset (&layout);
- fail_unless (GST_VALUE_HOLDS_ARRAY (&res));
- fail_unless_equals_int (gst_value_array_get_size (&res), 2);
- fail_unless_equals_int (g_value_get_enum (gst_value_array_get_value (&res,
- 0)), GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT);
- fail_unless_equals_int (g_value_get_enum (gst_value_array_get_value (&res,
- 1)), GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT);
- g_value_unset (&res);
-
- /* this (with rear position) should not yield any results */
- init_value_to_channel_layout (&layout, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT);
- fail_if (gst_value_intersect (&res, &layout, &list));
- g_value_unset (&layout);
-
- g_value_unset (&list);
-}
-
-GST_END_TEST;
-
-static Suite *
-audio_suite (void)
-{
- Suite *s = suite_create ("audio support library");
-
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_multichannel_checks);
- tcase_add_test (tc_chain, test_buffer_clipping_time);
- tcase_add_test (tc_chain, test_buffer_clipping_samples);
- tcase_add_test (tc_chain, test_channel_layout_value_intersect);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = audio_suite ();
-
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/libs/cddabasesrc.c b/tests/check/libs/cddabasesrc.c
deleted file mode 100644
index 33685d81..00000000
--- a/tests/check/libs/cddabasesrc.c
+++ /dev/null
@@ -1,518 +0,0 @@
-/* GStreamer
- *
- * unit test for cddabasesrc
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/* TODO:
- * - test different modes (when seeking to tracks in track mode, buffer
- * timestamps should start from 0, when seeking to tracks in disc mode,
- * buffer timestamps should increment, etc.)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-#include <gst/check/gstbufferstraw.h>
-
-#include <gst/cdda/gstcddabasesrc.h>
-#include <string.h>
-
-#define CD_FRAMESIZE_RAW 2352
-
-#define GST_TYPE_CD_FOO_SRC (gst_cd_foo_src_get_type())
-#define GST_CD_FOO_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CD_FOO_SRC,GstCdFooSrc))
-#define GST_CD_FOO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CD_FOO_SRC,GstCdFooSrcClass))
-#define GST_IS_CD_FOO_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CD_FOO_SRC))
-#define GST_IS_CD_FOO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CD_FOO_SRC))
-#define GST_CD_FOO_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CDDA_BASAE_SRC, GstCdFooSrcClass))
-
-typedef struct _GstCdFooSrc GstCdFooSrc;
-typedef struct _GstCdFooSrcClass GstCdFooSrcClass;
-
-
-/* Neue Heimat (CD 2) */
-static GstCddaBaseSrcTrack nh_cd2_tracks[] = {
- {TRUE, 1, 0, 20664, NULL,},
- {TRUE, 2, 20665, 52377, NULL,},
- {TRUE, 3, 52378, 84100, NULL,},
- {TRUE, 4, 84101, 105401, NULL,},
- {TRUE, 5, 105402, 123060, NULL,},
- {TRUE, 6, 123061, 146497, NULL,},
- {TRUE, 7, 146498, 175693, NULL,},
- {TRUE, 8, 175694, 203272, NULL,},
- {TRUE, 9, 203273, 217909, NULL,},
- {TRUE, 10, 217910, 240938, NULL,},
- {TRUE, 11, 240939, 256169, NULL,},
- {TRUE, 12, 256170, 282237, NULL,},
- {TRUE, 13, 282238, 307606, NULL,},
- {TRUE, 14, 307607, 337245, NULL,}
-};
-
-/* Offspring - Smash */
-static GstCddaBaseSrcTrack offspring_tracks[] = {
- {TRUE, 1, 0, 1924, NULL,},
- {TRUE, 2, 1925, 12947, NULL,},
- {TRUE, 3, 12948, 29739, NULL,},
- {TRUE, 4, 29740, 47202, NULL,},
- {TRUE, 5, 47203, 63134, NULL,},
- {TRUE, 6, 63135, 77954, NULL,},
- {TRUE, 7, 77955, 92789, NULL,},
- {TRUE, 8, 92790, 112127, NULL,},
- {TRUE, 9, 112128, 124372, NULL,},
- {TRUE, 10, 124373, 133574, NULL,},
- {TRUE, 11, 133575, 143484, NULL,},
- {TRUE, 12, 143485, 149279, NULL,},
- {TRUE, 13, 149280, 162357, NULL,},
- {TRUE, 14, 162358, 210372, NULL,}
-};
-
-/* this matches the sample TOC from the DiscIDCalculation
- * page in the Musicbrainz wiki. It's a tricky one because
- * it's got a data track as well. */
-static GstCddaBaseSrcTrack mb_sample_tracks[] = {
- {TRUE, 1, 0, 18640, NULL,},
- {TRUE, 2, 18641, 34666, NULL,},
- {TRUE, 3, 34667, 56349, NULL,},
- {TRUE, 4, 56350, 77005, NULL,},
- {TRUE, 5, 77006, 106093, NULL,},
- {TRUE, 6, 106094, 125728, NULL,},
- {TRUE, 7, 125729, 149784, NULL,},
- {TRUE, 8, 149785, 168884, NULL,},
- {TRUE, 9, 168885, 185909, NULL,},
- {TRUE, 10, 185910, 205828, NULL,},
- {TRUE, 11, 205829, 230141, NULL,},
- {TRUE, 12, 230142, 246658, NULL,},
- {TRUE, 13, 246659, 265613, NULL,},
- {TRUE, 14, 265614, 289478, NULL,},
- {FALSE, 15, 289479, 325731, NULL,}
-};
-
-/* Nicola Conte - Other Directions (also
- * tricky due to the extra data track) */
-static GstCddaBaseSrcTrack nconte_odir_tracks[] = {
- {TRUE, 1, 0, 17852, NULL,},
- {TRUE, 2, 17853, 39956, NULL,},
- {TRUE, 3, 39957, 68449, NULL,},
- {TRUE, 4, 68450, 88725, NULL,},
- {TRUE, 5, 88726, 106413, NULL,},
- {TRUE, 6, 106414, 131966, NULL,},
- {TRUE, 7, 131967, 152372, NULL,},
- {TRUE, 8, 152373, 168602, NULL,},
- {TRUE, 9, 168603, 190348, NULL,},
- {TRUE, 10, 190349, 209044, NULL,},
- {TRUE, 11, 209045, 235586, NULL,},
- {TRUE, 12, 235587, 253830, NULL,},
- {TRUE, 13, 253831, 272213, NULL,},
- {FALSE, 14, 272214, 332849, NULL,}
-};
-
-/* Pink Martini - Sympathique (11 track version) */
-static GstCddaBaseSrcTrack pm_symp_tracks[] = {
- {TRUE, 1, 0, 21667, NULL,},
- {TRUE, 2, 21668, 49576, NULL,},
- {TRUE, 3, 49577, 62397, NULL,},
- {TRUE, 4, 62398, 81087, NULL,},
- {TRUE, 5, 81088, 106595, NULL,},
- {TRUE, 6, 106596, 122012, NULL,},
- {TRUE, 7, 122013, 138469, NULL,},
- {TRUE, 8, 138470, 157306, NULL,},
- {TRUE, 9, 157307, 179635, NULL,},
- {TRUE, 10, 179636, 203673, NULL,},
- {TRUE, 11, 203674, 213645, NULL,}
-};
-
-#define NUM_TEST_DISCS 5
-
-struct _test_disc
-{
- GstCddaBaseSrcTrack *tracks;
- guint num_tracks;
- guint32 cddb_discid;
- const gchar *musicbrainz_discid;
-};
-
-/* FIXME: now we just need to find out how to treat
- * data tracks for the cddb id calculation .... */
-static struct _test_disc test_discs[NUM_TEST_DISCS] = {
- {nh_cd2_tracks, G_N_ELEMENTS (nh_cd2_tracks), 0xae11900e,
- NULL},
- {mb_sample_tracks, G_N_ELEMENTS (mb_sample_tracks), 0x00000000,
- "MUtMmKN402WPj3_VFsgUelxpc8U-"},
- {offspring_tracks, G_N_ELEMENTS (offspring_tracks), 0xc20af40e,
- "ahg7JUcfR3vCYBphSDIogOOWrr0-"},
- {nconte_odir_tracks, G_N_ELEMENTS (nconte_odir_tracks), 0x00000000,
- /* hKx_PejjG47X161ND_Sh0HyqaS0- according to libmusicbrainz, but that's
- * wrong according to the wiki docs (or not?) (neither discid is listed) */
- "fboaOQtfqwENv8WyXa9tRyvyUbQ-"},
- {pm_symp_tracks, G_N_ELEMENTS (pm_symp_tracks), 0xa00b200b,
- "iP0DOLdr4vt_IfKSIXoRUR.q_Wc-"}
-};
-
-struct _GstCdFooSrc
-{
- GstCddaBaseSrc cddabasesrc;
-
- struct _test_disc *cur_test;
- guint cur_disc;
-};
-
-struct _GstCdFooSrcClass
-{
- GstCddaBaseSrcClass parent_class;
-};
-
-GST_BOILERPLATE (GstCdFooSrc, gst_cd_foo_src, GstCddaBaseSrc,
- GST_TYPE_CDDA_BASE_SRC);
-
-static GstBuffer *gst_cd_foo_src_read_sector (GstCddaBaseSrc * src,
- gint sector);
-static gboolean gst_cd_foo_src_open (GstCddaBaseSrc * src,
- const gchar * device);
-static void gst_cd_foo_src_close (GstCddaBaseSrc * src);
-
-static const GstElementDetails cdfoo_details =
-GST_ELEMENT_DETAILS ("CD Audio (cdda) Source, FooBar",
- "Source/File",
- "Read audio from CD",
- "Foo Bar <foo@bar.com>");
-
-static void
-gst_cd_foo_src_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &cdfoo_details);
-}
-
-static void
-gst_cd_foo_src_init (GstCdFooSrc * src, GstCdFooSrcClass * klass)
-{
- src->cur_disc = 0;
-}
-
-static void
-gst_cd_foo_src_class_init (GstCdFooSrcClass * klass)
-{
- GstCddaBaseSrcClass *cddabasesrc_class = GST_CDDA_BASE_SRC_CLASS (klass);
-
- cddabasesrc_class->open = gst_cd_foo_src_open;
- cddabasesrc_class->close = gst_cd_foo_src_close;
- cddabasesrc_class->read_sector = gst_cd_foo_src_read_sector;
-}
-
-static gboolean
-gst_cd_foo_src_open (GstCddaBaseSrc * cddabasesrc, const gchar * device)
-{
- GstCddaBaseSrcTrack *tracks;
- GstCdFooSrc *src;
- gint i;
-
- src = GST_CD_FOO_SRC (cddabasesrc);
-
- /* if this fails, the test is wrong */
- g_assert (src->cur_disc < NUM_TEST_DISCS);
-
- src->cur_test = &test_discs[src->cur_disc];
-
- /* add tracks */
- tracks = src->cur_test->tracks;
- for (i = 0; i < src->cur_test->num_tracks; ++i) {
- gst_cdda_base_src_add_track (GST_CDDA_BASE_SRC (src), &tracks[i]);
- }
-
- return TRUE;
-}
-
-static void
-gst_cd_foo_src_close (GstCddaBaseSrc * cddabasesrc)
-{
- GstCdFooSrc *src = GST_CD_FOO_SRC (cddabasesrc);
-
- if (src->cur_test->cddb_discid != 0) {
- g_assert (cddabasesrc->discid == src->cur_test->cddb_discid);
- }
-
- if (src->cur_test->musicbrainz_discid != NULL) {
- g_assert (g_str_equal (cddabasesrc->mb_discid,
- src->cur_test->musicbrainz_discid));
- }
-}
-
-static GstBuffer *
-gst_cd_foo_src_read_sector (GstCddaBaseSrc * cddabasesrc, gint sector)
-{
- GstBuffer *buf;
-
- buf = gst_buffer_new_and_alloc (CD_FRAMESIZE_RAW);
- memset (GST_BUFFER_DATA (buf), 0, CD_FRAMESIZE_RAW);
-
- return buf;
-}
-
-static inline gboolean
-tag_list_has_tag (GstTagList * list, const gchar * tag, GType type)
-{
- const GValue *val = gst_tag_list_get_value_index (list, tag, 0);
-
- if (val == NULL) {
- GST_LOG ("no tag '%s' in taglist %" GST_PTR_FORMAT, tag, list);
- return FALSE;
- }
-
- if (!G_VALUE_HOLDS (val, type)) {
- GST_LOG ("tag '%s' in taglist %" GST_PTR_FORMAT " is not of type %s",
- tag, list, g_type_name (type));
- return FALSE;
- }
-
- return TRUE;
-}
-
-static void
-test_uri_parse (const gchar * uri, const gchar * device, gint track)
-{
- GstElement *foosrc;
- gchar *set_device = NULL;
- gint set_track = 0;
-
- foosrc = gst_element_factory_make ("cdfoosrc", "cdfoosrc");
- fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (foosrc), uri) == TRUE,
- "couldn't set uri %s", uri);
- g_object_get (foosrc, "device", &set_device, "track", &set_track, NULL);
- fail_unless (set_device != NULL);
- fail_unless (strcmp (set_device, device) == 0,
- "device set was %s, expected %s", set_device, device);
- fail_unless (set_track == track, "track set was %d, expected %d", set_track,
- track);
- g_free (set_device);
- gst_object_unref (foosrc);
-}
-
-GST_START_TEST (test_discid_calculations)
-{
- GstElement *foosrc, *pipeline, *sink;
- gint i;
-
- fail_unless (gst_element_register (NULL, "cdfoosrc", GST_RANK_SECONDARY,
- GST_TYPE_CD_FOO_SRC));
-
- pipeline = gst_pipeline_new ("pipeline");
-
- sink = gst_element_factory_make ("fakesink", "sink");
- fail_unless (sink != NULL, "couldn't create fakesink");
-
- foosrc = gst_element_factory_make ("cdfoosrc", "cdfoosrc");
- fail_unless (foosrc != NULL, "couldn't create cdfoosrc");
-
- gst_bin_add (GST_BIN (pipeline), foosrc);
- gst_bin_add (GST_BIN (pipeline), sink);
- fail_unless (gst_element_link (foosrc, sink));
-
- for (i = 0; i < G_N_ELEMENTS (test_discs); ++i) {
- GstTagList *tags = NULL;
- GstMessage *msg;
-
- GST_LOG ("Testing disc layout %u ...", i);
- GST_CD_FOO_SRC (foosrc)->cur_disc = i;
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- msg =
- gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipeline),
- GST_CLOCK_TIME_NONE, GST_MESSAGE_TAG);
- gst_message_parse_tag (msg, &tags);
- fail_unless (tags != NULL);
- fail_unless (tag_list_has_tag (tags, "track-count", G_TYPE_UINT));
- fail_unless (tag_list_has_tag (tags, "track-number", G_TYPE_UINT));
- fail_unless (tag_list_has_tag (tags, "duration", G_TYPE_UINT64));
- fail_unless (tag_list_has_tag (tags, "discid", G_TYPE_STRING));
- fail_unless (tag_list_has_tag (tags, "discid-full", G_TYPE_STRING));
- fail_unless (tag_list_has_tag (tags, "musicbrainz-discid", G_TYPE_STRING));
- fail_unless (tag_list_has_tag (tags, "musicbrainz-discid-full",
- G_TYPE_STRING));
- gst_tag_list_free (tags);
- gst_message_unref (msg);
-
- msg =
- gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipeline),
- GST_CLOCK_TIME_NONE, GST_MESSAGE_ASYNC_DONE);
- gst_message_unref (msg);
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- }
-
- gst_object_unref (pipeline);
-
- gst_task_cleanup_all ();
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_buffer_timestamps)
-{
- GstElement *foosrc, *pipeline, *fakesink;
- GstClockTime prev_ts, prev_duration, ts;
- GstPad *sinkpad;
- gint i;
-
- fail_unless (gst_element_register (NULL, "cdfoosrc", GST_RANK_SECONDARY,
- GST_TYPE_CD_FOO_SRC));
-
- pipeline = gst_pipeline_new ("pipeline");
- foosrc = gst_element_factory_make ("cdfoosrc", "cdfoosrc");
- fakesink = gst_element_factory_make ("fakesink", "fakesink");
- gst_bin_add_many (GST_BIN (pipeline), foosrc, fakesink, NULL);
- fail_unless (gst_element_link (foosrc, fakesink));
- sinkpad = gst_element_get_static_pad (fakesink, "sink");
-
- GST_CD_FOO_SRC (foosrc)->cur_disc = 0;
-
- gst_buffer_straw_start_pipeline (pipeline, sinkpad);
-
- prev_ts = GST_CLOCK_TIME_NONE;
- prev_duration = GST_CLOCK_TIME_NONE;
-
- for (i = 0; i < 100; ++i) {
- GstBuffer *buf;
-
- buf = gst_buffer_straw_get_buffer (pipeline, sinkpad);
- GST_LOG ("buffer, ts=%" GST_TIME_FORMAT ", dur=%" GST_TIME_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
- GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
- ts = GST_BUFFER_TIMESTAMP (buf);
- fail_unless (GST_CLOCK_TIME_IS_VALID (ts));
- fail_unless (GST_BUFFER_DURATION_IS_VALID (buf));
- if (i > 0) {
- fail_unless (GST_CLOCK_TIME_IS_VALID (prev_ts));
- fail_unless (GST_CLOCK_TIME_IS_VALID (prev_duration));
- fail_unless ((prev_ts + prev_duration) == ts);
- }
- prev_ts = ts;
- prev_duration = GST_BUFFER_DURATION (buf);
- gst_buffer_unref (buf);
- }
-
- gst_buffer_straw_stop_pipeline (pipeline, sinkpad);
-
- gst_task_cleanup_all ();
- gst_object_unref (pipeline);
- gst_object_unref (sinkpad);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_uri_parsing)
-{
- GstElement *foosrc;
-
- fail_unless (gst_element_register (NULL, "cdfoosrc", GST_RANK_SECONDARY,
- GST_TYPE_CD_FOO_SRC));
-
- /* wrong protocol */
- foosrc = gst_element_factory_make ("cdfoosrc", "cdfoosrc");
- fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (foosrc),
- "x://") == FALSE);
- fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (foosrc),
- "cddaq://") == FALSE);
-
- /* cdda://track */
- test_uri_parse ("cdda://", "/dev/cdrom", 1);
- test_uri_parse ("cdda://2", "/dev/cdrom", 2);
- test_uri_parse ("cdda://47", "/dev/cdrom", 47);
- fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (foosrc),
- "cdda://-1") == FALSE);
- fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (foosrc),
- "cdda://what") == FALSE);
-
- /* cdda://device#track */
- test_uri_parse ("cdda:///dev/hdb#1", "/dev/hdb", 1);
- test_uri_parse ("cdda://anything#8", "anything", 8);
- fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (foosrc),
- "cdda:///dev/hdb#nonsense") == FALSE);
- fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (foosrc),
- "cdda:///dev/hdb#-2") == FALSE);
-
- /* cdda://track#device (device should be ignored - FIXME 0.11) */
- test_uri_parse ("cdda://8#/dev/hdb", "/dev/cdrom", 8);
-
- gst_object_unref (foosrc);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_properties)
-{
- GstElement *foosrc;
- gchar *device;
- guint track;
-
- fail_unless (gst_element_register (NULL, "cdfoosrc", GST_RANK_SECONDARY,
- GST_TYPE_CD_FOO_SRC));
-
- foosrc = gst_element_factory_make ("cdfoosrc", "cdfoosrc");
-
- g_object_set (foosrc, "device", "/dev/cdrom", NULL);
- g_object_get (foosrc, "device", &device, "track", &track, NULL);
- fail_unless (g_str_equal (device, "/dev/cdrom"));
- fail_unless_equals_int (track, 1);
- g_free (device);
-
- g_object_set (foosrc, "device", "/dev/cdrom1", "track", 17, NULL);
- g_object_get (foosrc, "device", &device, "track", &track, NULL);
- fail_unless (g_str_equal (device, "/dev/cdrom1"));
- fail_unless_equals_int (track, 17);
- g_free (device);
-
- g_object_set (foosrc, "track", 17, "device", "/dev/cdrom1", NULL);
- g_object_get (foosrc, "device", &device, "track", &track, NULL);
- fail_unless (g_str_equal (device, "/dev/cdrom1"));
- fail_unless_equals_int (track, 17);
- g_free (device);
-
- g_object_set (foosrc, "track", 12, NULL);
- g_object_get (foosrc, "device", &device, "track", &track, NULL);
- fail_unless (g_str_equal (device, "/dev/cdrom1"));
- fail_unless_equals_int (track, 12);
- g_free (device);
-
- gst_object_unref (foosrc);
-}
-
-GST_END_TEST;
-
-static Suite *
-cddabasesrc_suite (void)
-{
- Suite *s = suite_create ("cddabasesrc");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_discid_calculations);
- tcase_add_test (tc_chain, test_buffer_timestamps);
- tcase_add_test (tc_chain, test_uri_parsing);
- tcase_add_test (tc_chain, test_properties);
-
- return s;
-}
-
-GST_CHECK_MAIN (cddabasesrc)
diff --git a/tests/check/libs/fft.c b/tests/check/libs/fft.c
deleted file mode 100644
index bcaf967e..00000000
--- a/tests/check/libs/fft.c
+++ /dev/null
@@ -1,563 +0,0 @@
-/* GStreamer
- *
- * unit test for FFT library
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/check/gstcheck.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>
-
-GST_START_TEST (test_next_fast_length)
-{
- fail_unless_equals_int (gst_fft_next_fast_length (13), 16);
- fail_unless_equals_int (gst_fft_next_fast_length (30), 30);
- fail_unless_equals_int (gst_fft_next_fast_length (31), 32);
- fail_unless_equals_int (gst_fft_next_fast_length (1), 2);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_s16_0hz)
-{
- gint i;
- gint16 *in;
- GstFFTS16Complex *out;
- GstFFTS16 *ctx;
-
- in = g_new (gint16, 2048);
- out = g_new (GstFFTS16Complex, 1025);
- ctx = gst_fft_s16_new (2048, FALSE);
-
- for (i = 0; i < 2048; i++)
- in[i] = G_MAXINT16;
-
- gst_fft_s16_window (ctx, in, GST_FFT_WINDOW_HAMMING);
- gst_fft_s16_fft (ctx, in, out);
-
- for (i = 0; i < 1025; i++) {
- gdouble mag;
-
- mag = (gdouble) out[i].r * (gdouble) out[i].r;
- mag += (gdouble) out[i].i * (gdouble) out[i].i;
- mag /= 32767.0 * 32767.0;
- mag = 10.0 * log10 (mag);
- if (i < 2)
- fail_unless (mag > -15.0);
- else
- fail_unless (mag < -55.0);
- }
-
- gst_fft_s16_free (ctx);
- g_free (in);
- g_free (out);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_s16_11025hz)
-{
- gint i;
- gint16 *in;
- GstFFTS16Complex *out;
- GstFFTS16 *ctx;
-
- in = g_new (gint16, 2048);
- out = g_new (GstFFTS16Complex, 1025);
- ctx = gst_fft_s16_new (2048, FALSE);
-
- for (i = 0; i < 2048; i += 4) {
- in[i] = 0;
- in[i + 1] = G_MAXINT16;
- in[i + 2] = 0;
- in[i + 3] = G_MININT16;
- }
-
- gst_fft_s16_window (ctx, in, GST_FFT_WINDOW_HAMMING);
- gst_fft_s16_fft (ctx, in, out);
-
- for (i = 0; i < 1025; i++) {
- gdouble mag;
-
- mag = (gdouble) out[i].r * (gdouble) out[i].r;
- mag += (gdouble) out[i].i * (gdouble) out[i].i;
- mag /= 32767.0 * 32767.0;
- mag = 10.0 * log10 (mag);
-
- if (abs (512 - i) < 2)
- fail_unless (mag > -20.0);
- else
- fail_unless (mag < -55.0);
- }
-
- gst_fft_s16_free (ctx);
- g_free (in);
- g_free (out);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_s16_22050hz)
-{
- gint i;
- gint16 *in;
- GstFFTS16Complex *out;
- GstFFTS16 *ctx;
-
- in = g_new (gint16, 2048);
- out = g_new (GstFFTS16Complex, 1025);
- ctx = gst_fft_s16_new (2048, FALSE);
-
- for (i = 0; i < 2048; i += 2) {
- in[i] = G_MAXINT16;
- in[i + 1] = G_MININT16;
- }
-
- gst_fft_s16_window (ctx, in, GST_FFT_WINDOW_HAMMING);
- gst_fft_s16_fft (ctx, in, out);
-
- for (i = 0; i < 1025; i++) {
- gdouble mag;
-
- mag = (gdouble) out[i].r * (gdouble) out[i].r;
- mag += (gdouble) out[i].i * (gdouble) out[i].i;
- mag /= 32767.0 * 32767.0;
- mag = 10.0 * log10 (mag);
-
- if (i > 1022)
- fail_unless (mag > -15.0);
- else
- fail_unless (mag < -55.0);
- }
-
- gst_fft_s16_free (ctx);
- g_free (in);
- g_free (out);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_s32_0hz)
-{
- gint i;
- gint32 *in;
- GstFFTS32Complex *out;
- GstFFTS32 *ctx;
-
- in = g_new (gint32, 2048);
- out = g_new (GstFFTS32Complex, 1025);
- ctx = gst_fft_s32_new (2048, FALSE);
-
- for (i = 0; i < 2048; i++)
- in[i] = 2147483647;
-
- gst_fft_s32_window (ctx, in, GST_FFT_WINDOW_HAMMING);
- gst_fft_s32_fft (ctx, in, out);
-
- for (i = 0; i < 1025; i++) {
- gdouble mag;
-
- mag = (gdouble) out[i].r * (gdouble) out[i].r;
- mag += (gdouble) out[i].i * (gdouble) out[i].i;
- mag /= 2147483647.0 * 2147483647.0;
- mag = 10.0 * log10 (mag);
-
- if (i < 2)
- fail_unless (mag > -15.0);
- else
- fail_unless (mag < -60.0);
- }
-
- gst_fft_s32_free (ctx);
- g_free (in);
- g_free (out);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_s32_11025hz)
-{
- gint i;
- gint32 *in;
- GstFFTS32Complex *out;
- GstFFTS32 *ctx;
-
- in = g_new (gint32, 2048);
- out = g_new (GstFFTS32Complex, 1025);
- ctx = gst_fft_s32_new (2048, FALSE);
-
- for (i = 0; i < 2048; i += 4) {
- in[i] = 0;
- in[i + 1] = G_MAXINT32;
- in[i + 2] = 0;
- in[i + 3] = G_MININT32;
- }
-
- gst_fft_s32_window (ctx, in, GST_FFT_WINDOW_HAMMING);
- gst_fft_s32_fft (ctx, in, out);
-
- for (i = 0; i < 1025; i++) {
- gdouble mag;
-
- mag = (gdouble) out[i].r * (gdouble) out[i].r;
- mag += (gdouble) out[i].i * (gdouble) out[i].i;
- mag /= 2147483647.0 * 2147483647.0;
- mag = 10.0 * log10 (mag);
-
- if (abs (512 - i) < 2)
- fail_unless (mag > -20.0);
- else
- fail_unless (mag < -60.0);
- }
-
- gst_fft_s32_free (ctx);
- g_free (in);
- g_free (out);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_s32_22050hz)
-{
- gint i;
- gint32 *in;
- GstFFTS32Complex *out;
- GstFFTS32 *ctx;
-
- in = g_new (gint32, 2048);
- out = g_new (GstFFTS32Complex, 1025);
- ctx = gst_fft_s32_new (2048, FALSE);
-
- for (i = 0; i < 2048; i += 2) {
- in[i] = G_MAXINT32;
- in[i + 1] = G_MININT32;
- }
-
- gst_fft_s32_window (ctx, in, GST_FFT_WINDOW_HAMMING);
- gst_fft_s32_fft (ctx, in, out);
-
- for (i = 0; i < 1025; i++) {
- gdouble mag;
-
- mag = (gdouble) out[i].r * (gdouble) out[i].r;
- mag += (gdouble) out[i].i * (gdouble) out[i].i;
- mag /= 2147483647.0 * 2147483647.0;
- mag = 10.0 * log10 (mag);
-
- if (i > 1022)
- fail_unless (mag > -15.0);
- else
- fail_unless (mag < -60.0);
- }
-
- gst_fft_s32_free (ctx);
- g_free (in);
- g_free (out);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_f32_0hz)
-{
- gint i;
- gfloat *in;
- GstFFTF32Complex *out;
- GstFFTF32 *ctx;
-
- in = g_new (gfloat, 2048);
- out = g_new (GstFFTF32Complex, 1025);
- ctx = gst_fft_f32_new (2048, FALSE);
-
- for (i = 0; i < 2048; i++)
- in[i] = 1.0;
-
- gst_fft_f32_window (ctx, in, GST_FFT_WINDOW_HAMMING);
- gst_fft_f32_fft (ctx, in, out);
-
- for (i = 0; i < 1025; i++) {
- gdouble mag;
-
- mag = (gdouble) out[i].r * (gdouble) out[i].r;
- mag += (gdouble) out[i].i * (gdouble) out[i].i;
- mag /= 2048.0 * 2048.0;
- mag = 10.0 * log10 (mag);
-
- if (i < 2)
- fail_unless (mag > -15.0);
- else
- fail_unless (mag < -60.0);
- }
-
- gst_fft_f32_free (ctx);
- g_free (in);
- g_free (out);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_f32_11025hz)
-{
- gint i;
- gfloat *in;
- GstFFTF32Complex *out;
- GstFFTF32 *ctx;
-
- in = g_new (gfloat, 2048);
- out = g_new (GstFFTF32Complex, 1025);
- ctx = gst_fft_f32_new (2048, FALSE);
-
- for (i = 0; i < 2048; i += 4) {
- in[i] = 0.0;
- in[i + 1] = 1.0;
- in[i + 2] = 0.0;
- in[i + 3] = -1.0;
- }
-
- gst_fft_f32_window (ctx, in, GST_FFT_WINDOW_HAMMING);
- gst_fft_f32_fft (ctx, in, out);
-
- for (i = 0; i < 1025; i++) {
- gdouble mag;
-
- mag = (gdouble) out[i].r * (gdouble) out[i].r;
- mag += (gdouble) out[i].i * (gdouble) out[i].i;
- mag /= 2048.0 * 2048.0;
- mag = 10.0 * log10 (mag);
-
- if (abs (512 - i) < 2)
- fail_unless (mag > -20.0);
- else
- fail_unless (mag < -60.0);
- }
-
- gst_fft_f32_free (ctx);
- g_free (in);
- g_free (out);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_f32_22050hz)
-{
- gint i;
- gfloat *in;
- GstFFTF32Complex *out;
- GstFFTF32 *ctx;
-
- in = g_new (gfloat, 2048);
- out = g_new (GstFFTF32Complex, 1025);
- ctx = gst_fft_f32_new (2048, FALSE);
-
- for (i = 0; i < 2048; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- gst_fft_f32_window (ctx, in, GST_FFT_WINDOW_HAMMING);
- gst_fft_f32_fft (ctx, in, out);
-
- for (i = 0; i < 1025; i++) {
- gdouble mag;
-
- mag = (gdouble) out[i].r * (gdouble) out[i].r;
- mag += (gdouble) out[i].i * (gdouble) out[i].i;
- mag /= 2048.0 * 2048.0;
- mag = 10.0 * log10 (mag);
-
- if (i > 1022)
- fail_unless (mag > -15.0);
- else
- fail_unless (mag < -60.0);
- }
-
- gst_fft_f32_free (ctx);
- g_free (in);
- g_free (out);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_f64_0hz)
-{
- gint i;
- gdouble *in;
- GstFFTF64Complex *out;
- GstFFTF64 *ctx;
-
- in = g_new (gdouble, 2048);
- out = g_new (GstFFTF64Complex, 1025);
- ctx = gst_fft_f64_new (2048, FALSE);
-
- for (i = 0; i < 2048; i++)
- in[i] = 1.0;
-
- gst_fft_f64_window (ctx, in, GST_FFT_WINDOW_HAMMING);
- gst_fft_f64_fft (ctx, in, out);
-
- for (i = 0; i < 1025; i++) {
- gdouble mag;
-
- mag = (gdouble) out[i].r * (gdouble) out[i].r;
- mag += (gdouble) out[i].i * (gdouble) out[i].i;
- mag /= 2048.0 * 2048.0;
- mag = 10.0 * log10 (mag);
-
- if (i < 2)
- fail_unless (mag > -15.0);
- else
- fail_unless (mag < -60.0);
- }
-
- gst_fft_f64_free (ctx);
- g_free (in);
- g_free (out);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_f64_11025hz)
-{
- gint i;
- gdouble *in;
- GstFFTF64Complex *out;
- GstFFTF64 *ctx;
-
- in = g_new (gdouble, 2048);
- out = g_new (GstFFTF64Complex, 1025);
- ctx = gst_fft_f64_new (2048, FALSE);
-
- for (i = 0; i < 2048; i += 4) {
- in[i] = 0.0;
- in[i + 1] = 1.0;
- in[i + 2] = 0.0;
- in[i + 3] = -1.0;
- }
-
- gst_fft_f64_window (ctx, in, GST_FFT_WINDOW_HAMMING);
- gst_fft_f64_fft (ctx, in, out);
-
- for (i = 0; i < 1025; i++) {
- gdouble mag;
-
- mag = (gdouble) out[i].r * (gdouble) out[i].r;
- mag += (gdouble) out[i].i * (gdouble) out[i].i;
- mag /= 2048.0 * 2048.0;
- mag = 10.0 * log10 (mag);
-
- if (abs (512 - i) < 2)
- fail_unless (mag > -20.0);
- else
- fail_unless (mag < -60.0);
- }
-
- gst_fft_f64_free (ctx);
- g_free (in);
- g_free (out);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_f64_22050hz)
-{
- gint i;
- gdouble *in;
- GstFFTF64Complex *out;
- GstFFTF64 *ctx;
-
- in = g_new (gdouble, 2048);
- out = g_new (GstFFTF64Complex, 1025);
- ctx = gst_fft_f64_new (2048, FALSE);
-
- for (i = 0; i < 2048; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- gst_fft_f64_window (ctx, in, GST_FFT_WINDOW_HAMMING);
- gst_fft_f64_fft (ctx, in, out);
-
- for (i = 0; i < 1025; i++) {
- gdouble mag;
-
- mag = (gdouble) out[i].r * (gdouble) out[i].r;
- mag += (gdouble) out[i].i * (gdouble) out[i].i;
- mag /= 2048.0 * 2048.0;
- mag = 10.0 * log10 (mag);
-
- if (i > 1022)
- fail_unless (mag > -15.0);
- else
- fail_unless (mag < -60.0);
- }
-
- gst_fft_f64_free (ctx);
- g_free (in);
- g_free (out);
-}
-
-GST_END_TEST;
-
-static Suite *
-fft_suite (void)
-{
- Suite *s = suite_create ("fft library");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_next_fast_length);
- tcase_add_test (tc_chain, test_s16_0hz);
- tcase_add_test (tc_chain, test_s16_11025hz);
- tcase_add_test (tc_chain, test_s16_22050hz);
- tcase_add_test (tc_chain, test_s32_0hz);
- tcase_add_test (tc_chain, test_s32_11025hz);
- tcase_add_test (tc_chain, test_s32_22050hz);
- tcase_add_test (tc_chain, test_f32_0hz);
- tcase_add_test (tc_chain, test_f32_11025hz);
- tcase_add_test (tc_chain, test_f32_22050hz);
- tcase_add_test (tc_chain, test_f64_0hz);
- tcase_add_test (tc_chain, test_f64_11025hz);
- tcase_add_test (tc_chain, test_f64_22050hz);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = fft_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/libs/mixer.c b/tests/check/libs/mixer.c
deleted file mode 100644
index 1133ecb1..00000000
--- a/tests/check/libs/mixer.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/* GStreamer
- *
- * unit tests for audio support library
- *
- * Copyright (C) 2007 Jan Schmidt <thaytan@noraisin.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/check/gstcheck.h>
-
-#include <gst/interfaces/mixer.h>
-
-#include <string.h>
-
-#define TEST_ELEMENT_TYPE (test_element_get_type())
-
-typedef struct TestElement TestElement;
-typedef struct TestElementClass TestElementClass;
-
-struct TestElement
-{
- GstElement parent;
-};
-
-struct TestElementClass
-{
- GstElementClass parent_class;
-};
-
-static void init_interface (GType type);
-static void gst_implements_interface_init (GstImplementsInterfaceClass * klass);
-
-GST_BOILERPLATE_FULL (TestElement, test_element, GstElement, GST_TYPE_ELEMENT,
- init_interface);
-
-static void
-test_element_mixer_interface_init (GstMixerClass * klass)
-{
- /* Not actually implementing any interfaces for this test atm */
-}
-
-static void
-init_interface (GType type)
-{
- static const GInterfaceInfo mixer_iface_info = {
- (GInterfaceInitFunc) test_element_mixer_interface_init,
- NULL,
- NULL,
- };
- static const GInterfaceInfo implements_iface_info = {
- (GInterfaceInitFunc) gst_implements_interface_init,
- NULL,
- NULL,
- };
-
- g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE,
- &implements_iface_info);
- g_type_add_interface_static (type, GST_TYPE_MIXER, &mixer_iface_info);
-}
-
-static void
-test_element_base_init (gpointer klass)
-{
-}
-
-static void
-test_element_class_init (TestElementClass * klass)
-{
-}
-
-static gboolean
-test_element_interface_supported (GstImplementsInterface * ifacE,
- GType interface_type)
-{
- if (interface_type == GST_TYPE_MIXER)
- return TRUE;
-
- return FALSE;
-}
-
-static void
-gst_implements_interface_init (GstImplementsInterfaceClass * klass)
-{
- klass->supported = test_element_interface_supported;
-}
-
-static void
-test_element_init (TestElement * this, TestElementClass * klass)
-{
-}
-
-GST_START_TEST (test_messages)
-{
- /* Create an empty GstElement that has a GstMixer interface and then
- * send some notifications and validate them */
- GstElement *test_element =
- (GstElement *) g_object_new (TEST_ELEMENT_TYPE, NULL);
- GstBus *bus = gst_bus_new ();
- GstMixerTrack *mtrack = g_object_new (GST_TYPE_MIXER_TRACK, NULL);
- GstMixerOptions *mopts = g_object_new (GST_TYPE_MIXER_OPTIONS, NULL);
- GstMixerTrack *t;
- GstMixerOptions *o;
- gint vols_in[2] = { 50, 75 };
- gboolean mute, record;
- gint *vols_out;
- gint n_chans, i;
- const gchar *val;
- GstMessage *message;
-
- mtrack->num_channels = 2;
- mtrack->flags = GST_MIXER_TRACK_MUTE | GST_MIXER_TRACK_RECORD;
-
- gst_element_set_bus (test_element, bus);
-
- /* Test mute-toggled */
- gst_mixer_mute_toggled (GST_MIXER (test_element), mtrack, TRUE);
- message = gst_bus_poll (bus, GST_MESSAGE_ELEMENT, GST_CLOCK_TIME_NONE);
- fail_if (message == NULL);
- fail_unless (gst_mixer_message_get_type (message) ==
- GST_MIXER_MESSAGE_MUTE_TOGGLED);
- /* Test that we can pass NULL args */
- gst_mixer_message_parse_mute_toggled (message, NULL, NULL);
- /* Test the parsing */
- gst_mixer_message_parse_mute_toggled (message, &t, &mute);
- fail_unless (t == mtrack);
- fail_unless (mute == TRUE);
- gst_message_unref (message);
-
- /* Test record-toggled */
- gst_mixer_record_toggled (GST_MIXER (test_element), mtrack, TRUE);
- message = gst_bus_poll (bus, GST_MESSAGE_ELEMENT, GST_CLOCK_TIME_NONE);
- fail_if (message == NULL);
- fail_unless (gst_mixer_message_get_type (message) ==
- GST_MIXER_MESSAGE_RECORD_TOGGLED);
- gst_mixer_message_parse_record_toggled (message, NULL, NULL);
- gst_mixer_message_parse_record_toggled (message, &t, &record);
- fail_unless (t == mtrack);
- fail_unless (record == TRUE);
- gst_message_unref (message);
-
- /* Test volume-changed */
- gst_mixer_volume_changed (GST_MIXER (test_element), mtrack, vols_in);
- message = gst_bus_poll (bus, GST_MESSAGE_ELEMENT, GST_CLOCK_TIME_NONE);
- fail_if (message == NULL);
- fail_unless (gst_mixer_message_get_type (message) ==
- GST_MIXER_MESSAGE_VOLUME_CHANGED);
- gst_mixer_message_parse_volume_changed (message, NULL, NULL, NULL);
- gst_mixer_message_parse_volume_changed (message, NULL, NULL, &n_chans);
- fail_unless (n_chans == 2);
- gst_mixer_message_parse_volume_changed (message, &t, &vols_out, &n_chans);
- fail_unless (mtrack == t);
- for (i = 0; i < n_chans; i++)
- fail_unless (vols_out[i] == vols_in[i]);
-
- gst_message_unref (message);
- g_free (vols_out);
-
- /* Test option-changed */
- gst_mixer_option_changed (GST_MIXER (test_element), mopts, "TESTING");
- message = gst_bus_poll (bus, GST_MESSAGE_ELEMENT, GST_CLOCK_TIME_NONE);
- fail_if (message == NULL);
- fail_unless (gst_mixer_message_get_type (message) ==
- GST_MIXER_MESSAGE_OPTION_CHANGED);
- gst_mixer_message_parse_option_changed (message, NULL, NULL);
- gst_mixer_message_parse_option_changed (message, &o, &val);
- fail_unless (o == mopts);
- fail_unless (g_str_equal (val, "TESTING"));
- gst_message_unref (message);
-
- /* Test options-list-changed */
- gst_mixer_options_list_changed (GST_MIXER (test_element), mopts);
- message = gst_bus_poll (bus, GST_MESSAGE_ELEMENT, GST_CLOCK_TIME_NONE);
- fail_if (message == NULL);
- fail_unless (gst_mixer_message_get_type (message) ==
- GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED);
- gst_mixer_message_parse_options_list_changed (message, &o);
- fail_unless (o == mopts);
- gst_message_unref (message);
-
- /* Test mixer-changed */
- gst_mixer_mixer_changed (GST_MIXER (test_element));
- message = gst_bus_poll (bus, GST_MESSAGE_ELEMENT, GST_CLOCK_TIME_NONE);
- fail_if (message == NULL);
- fail_unless (gst_mixer_message_get_type (message) ==
- GST_MIXER_MESSAGE_MIXER_CHANGED);
- gst_message_unref (message);
-
- gst_object_unref (mtrack);
- gst_object_unref (mopts);
- gst_object_unref (bus);
- gst_object_unref (test_element);
-}
-
-GST_END_TEST;
-
-static Suite *
-mixer_suite (void)
-{
- Suite *s = suite_create ("mixer interface");
- TCase *tc_chain = tcase_create ("notifications");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_messages);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = mixer_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/libs/navigation.c b/tests/check/libs/navigation.c
deleted file mode 100644
index 4712947b..00000000
--- a/tests/check/libs/navigation.c
+++ /dev/null
@@ -1,351 +0,0 @@
-/* GStreamer
- *
- * unit tests for the navigation interface library
- *
- * Copyright (C) 2009 Jan Schmidt <thaytan@noraisin.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/check/gstcheck.h>
-
-#include <gst/interfaces/navigation.h>
-
-#include <string.h>
-
-#define TEST_ELEMENT_TYPE (test_element_get_type())
-
-typedef struct TestElement TestElement;
-typedef struct TestElementClass TestElementClass;
-
-struct TestElement
-{
- GstElement parent;
-
- GstNavigationEventType sent_type;
- const gchar *sent_key;
- gdouble sent_x, sent_y;
- gint sent_button;
- GstNavigationCommand sent_command;
-};
-
-struct TestElementClass
-{
- GstElementClass parent_class;
-};
-
-static void init_interface (GType type);
-static void gst_implements_interface_init (GstImplementsInterfaceClass * klass);
-static void nav_send_event (GstNavigation * navigation,
- GstStructure * structure);
-
-GST_BOILERPLATE_FULL (TestElement, test_element, GstElement, GST_TYPE_ELEMENT,
- init_interface);
-
-static void
-test_element_navigation_interface_init (GstNavigationInterface * klass)
-{
- klass->send_event = nav_send_event;
-}
-
-static void
-init_interface (GType type)
-{
- static const GInterfaceInfo navigation_iface_info = {
- (GInterfaceInitFunc) test_element_navigation_interface_init,
- NULL,
- NULL,
- };
- static const GInterfaceInfo implements_iface_info = {
- (GInterfaceInitFunc) gst_implements_interface_init,
- NULL,
- NULL,
- };
-
- g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE,
- &implements_iface_info);
- g_type_add_interface_static (type, GST_TYPE_NAVIGATION,
- &navigation_iface_info);
-}
-
-static void
-test_element_base_init (gpointer klass)
-{
-}
-
-static void
-test_element_class_init (TestElementClass * klass)
-{
-}
-
-static gboolean
-test_element_interface_supported (GstImplementsInterface * ifacE,
- GType interface_type)
-{
- if (interface_type == GST_TYPE_NAVIGATION)
- return TRUE;
-
- return FALSE;
-}
-
-static void
-gst_implements_interface_init (GstImplementsInterfaceClass * klass)
-{
- klass->supported = test_element_interface_supported;
-}
-
-static void
-test_element_init (TestElement * this, TestElementClass * klass)
-{
-}
-
-static void
-nav_send_event (GstNavigation * navigation, GstStructure * structure)
-{
- GstEvent *event = gst_event_new_navigation (structure);
- GstNavigationEventType etype = gst_navigation_event_get_type (event);
- TestElement *self = (TestElement *) (navigation);
-
- fail_if (etype == GST_NAVIGATION_EVENT_INVALID,
- "Received navigation event could not be parsed");
- fail_unless (etype == self->sent_type,
- "Received navigation event did not match sent");
-
- switch (etype) {
- case GST_NAVIGATION_EVENT_KEY_PRESS:
- case GST_NAVIGATION_EVENT_KEY_RELEASE:{
- const gchar *key;
- fail_unless (gst_navigation_event_parse_key_event (event, &key));
- fail_unless (strcmp (key, self->sent_key) == 0);
- break;
- }
- case GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS:
- case GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE:{
- gint button;
- gdouble x, y;
- fail_unless (gst_navigation_event_parse_mouse_button_event (event,
- &button, &x, &y));
- fail_unless (button == self->sent_button);
- fail_unless (x == self->sent_x);
- fail_unless (y == self->sent_y);
- break;
- }
- case GST_NAVIGATION_EVENT_MOUSE_MOVE:{
- gdouble x, y;
- fail_unless (gst_navigation_event_parse_mouse_move_event (event, &x, &y));
- fail_unless (x == self->sent_x);
- fail_unless (y == self->sent_y);
- break;
- }
- case GST_NAVIGATION_EVENT_COMMAND:{
- GstNavigationCommand cmd;
- fail_unless (gst_navigation_event_parse_command (event, &cmd));
- fail_unless (cmd == self->sent_command);
- }
- default:
- break;
- }
-
- gst_event_unref (event);
-}
-
-GST_START_TEST (test_events)
-{
- /* Create an empty GstElement that has a GstNavigation interface and then
- * send some navigation events and validate them */
- TestElement *test_element =
- (TestElement *) g_object_new (TEST_ELEMENT_TYPE, NULL);
- GstNavigationCommand cmds[] = {
- GST_NAVIGATION_COMMAND_MENU1, GST_NAVIGATION_COMMAND_MENU2,
- GST_NAVIGATION_COMMAND_MENU3, GST_NAVIGATION_COMMAND_MENU4,
- GST_NAVIGATION_COMMAND_MENU5, GST_NAVIGATION_COMMAND_MENU6,
- GST_NAVIGATION_COMMAND_MENU7, GST_NAVIGATION_COMMAND_LEFT,
- GST_NAVIGATION_COMMAND_RIGHT, GST_NAVIGATION_COMMAND_UP,
- GST_NAVIGATION_COMMAND_DOWN, GST_NAVIGATION_COMMAND_ACTIVATE,
- GST_NAVIGATION_COMMAND_PREV_ANGLE, GST_NAVIGATION_COMMAND_NEXT_ANGLE
- };
- gint i;
-
- test_element->sent_type = GST_NAVIGATION_EVENT_KEY_PRESS;
- test_element->sent_key = "1";
- gst_navigation_send_key_event (GST_NAVIGATION (test_element), "key-press",
- "1");
-
- test_element->sent_type = GST_NAVIGATION_EVENT_KEY_RELEASE;
- test_element->sent_key = "2";
- gst_navigation_send_key_event (GST_NAVIGATION (test_element), "key-release",
- "2");
-
- test_element->sent_type = GST_NAVIGATION_EVENT_MOUSE_MOVE;
- test_element->sent_x = 50;
- test_element->sent_y = 100;
- gst_navigation_send_mouse_event (GST_NAVIGATION (test_element), "mouse-move",
- 0, 50, 100);
-
- test_element->sent_type = GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS;
- test_element->sent_x = 10;
- test_element->sent_y = 20;
- test_element->sent_button = 1;
- gst_navigation_send_mouse_event (GST_NAVIGATION (test_element),
- "mouse-button-press", 1, 10, 20);
-
- for (i = 0; i < G_N_ELEMENTS (cmds); i++) {
- test_element->sent_type = GST_NAVIGATION_EVENT_COMMAND;
- test_element->sent_command = cmds[i];
- gst_navigation_send_command (GST_NAVIGATION (test_element), cmds[i]);
- }
-
- gst_object_unref (test_element);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_messages)
-{
- GstMessage *m;
- /* GST_NAVIGATION_MESSAGE_MOUSE_OVER */
- {
- gboolean active;
- m = gst_navigation_message_new_mouse_over (NULL, TRUE);
- fail_if (m == NULL);
- fail_unless (gst_navigation_message_get_type (m) ==
- GST_NAVIGATION_MESSAGE_MOUSE_OVER);
- fail_unless (GST_MESSAGE_SRC (m) == NULL);
- fail_unless (gst_navigation_message_parse_mouse_over (m, &active));
- fail_unless (active == TRUE);
- gst_message_unref (m);
-
- m = gst_navigation_message_new_mouse_over (NULL, FALSE);
- fail_if (m == NULL);
- fail_unless (GST_MESSAGE_SRC (m) == NULL);
- fail_unless (gst_navigation_message_get_type (m) ==
- GST_NAVIGATION_MESSAGE_MOUSE_OVER);
- fail_unless (gst_navigation_message_parse_mouse_over (m, &active));
- fail_unless (active == FALSE);
- gst_message_unref (m);
- }
-
- /* GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED */
- {
- m = gst_navigation_message_new_commands_changed (NULL);
- fail_if (m == NULL);
- fail_unless (GST_MESSAGE_SRC (m) == NULL);
- fail_unless (gst_navigation_message_get_type (m) ==
- GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED);
- gst_message_unref (m);
- }
-
- /* GST_NAVIGATION_MESSAGE_ANGLES_CHANGED */
- {
- guint angle, angles;
- m = gst_navigation_message_new_angles_changed (NULL, 1, 5);
- fail_if (m == NULL);
- fail_unless (GST_MESSAGE_SRC (m) == NULL);
- fail_unless (gst_navigation_message_get_type (m) ==
- GST_NAVIGATION_MESSAGE_ANGLES_CHANGED);
- fail_unless (gst_navigation_message_parse_angles_changed (m, &angle,
- &angles));
- fail_unless (angle == 1);
- fail_unless (angles == 5);
- gst_message_unref (m);
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_queries)
-{
- GstQuery *q;
-
- /* GST_NAVIGATION_QUERY_COMMANDS */
- {
- guint n;
- GstNavigationCommand cmd;
-
- q = gst_navigation_query_new_commands ();
- fail_unless (q != NULL);
- fail_unless (gst_navigation_query_get_type (q) ==
- GST_NAVIGATION_QUERY_COMMANDS);
- gst_navigation_query_set_commands (q, 3, GST_NAVIGATION_COMMAND_LEFT,
- GST_NAVIGATION_COMMAND_MENU1, GST_NAVIGATION_COMMAND_MENU5);
- fail_unless (gst_navigation_query_parse_commands_length (q, &n));
- fail_unless (n == 3);
- fail_unless (gst_navigation_query_parse_commands_nth (q, 1, &cmd));
- fail_unless (cmd == GST_NAVIGATION_COMMAND_MENU1);
-
- fail_unless (gst_navigation_query_parse_commands_length (q, NULL));
- fail_unless (gst_navigation_query_parse_commands_nth (q, 2, NULL));
-
- gst_query_unref (q);
- }
-
- /* GST_NAVIGATION_QUERY_ANGLES */
- {
- guint angle, angles;
- q = gst_navigation_query_new_angles ();
- fail_unless (q != NULL);
- fail_unless (gst_navigation_query_get_type (q) ==
- GST_NAVIGATION_QUERY_ANGLES);
- gst_navigation_query_set_angles (q, 4, 8);
- fail_unless (gst_navigation_query_parse_angles (q, &angle, &angles));
- fail_unless (angle == 4);
- fail_unless (angles == 8);
-
- fail_unless (gst_navigation_query_parse_angles (q, NULL, &angles));
- fail_unless (gst_navigation_query_parse_angles (q, &angle, NULL));
- fail_unless (gst_navigation_query_parse_angles (q, NULL, NULL));
-
- gst_query_unref (q);
- }
-
-}
-
-GST_END_TEST;
-
-static Suite *
-navigation_suite (void)
-{
- Suite *s = suite_create ("navigation interface");
- TCase *tc_chain = tcase_create ("notifications");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_events);
- tcase_add_test (tc_chain, test_messages);
- tcase_add_test (tc_chain, test_queries);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = navigation_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/libs/netbuffer.c b/tests/check/libs/netbuffer.c
deleted file mode 100644
index 3236a0fa..00000000
--- a/tests/check/libs/netbuffer.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* GStreamer unit tests for libgstnetbuffer
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gst/check/gstcheck.h>
-#include <gst/netbuffer/gstnetbuffer.h>
-
-#define DATA_STRING "Yoho this is a string"
-
-GST_START_TEST (test_netbuffer_copy)
-{
- GstNetBuffer *netbuf, *copy;
- guint8 ipv6_addr[16] = { 0xff, 0x11, 0xee, 0x22, 0xdd, 0x33, 0xcc,
- 0x44, 0xbb, 0x55, 0xaa, 0x66, 0x00, 0x77, 0x99, 0x88
- };
- guint8 ipv6_copy[16];
- guint32 ipv4_copy, ipv4_addr = 0xfe12dc34;
- guint16 ipv6_port = 3490;
- guint16 ipv4_port = 5678;
- guint16 port;
-
- netbuf = gst_netbuffer_new ();
- fail_unless (netbuf != NULL, "failed to create net buffer");
-
- gst_netaddress_set_ip4_address (&netbuf->from, ipv4_addr, ipv4_port);
- gst_netaddress_set_ip6_address (&netbuf->to, ipv6_addr, ipv6_port);
-
- GST_BUFFER_DATA (netbuf) = (guint8 *) DATA_STRING;
- GST_BUFFER_SIZE (netbuf) = strlen (DATA_STRING);
- GST_BUFFER_FLAG_SET (netbuf, GST_BUFFER_FLAG_DISCONT);
- GST_BUFFER_FLAG_SET (netbuf, GST_BUFFER_FLAG_READONLY);
-
- copy = (GstNetBuffer *) gst_buffer_copy (GST_BUFFER_CAST (netbuf));
- fail_unless (copy != NULL, "failed to copy net buffer");
- fail_unless (GST_IS_NETBUFFER (copy), "copied buffer is not a GstNetBuffer!");
-
- fail_unless_equals_int (GST_MINI_OBJECT_REFCOUNT_VALUE (copy), 1);
-
- fail_unless_equals_int (GST_BUFFER_SIZE (copy), GST_BUFFER_SIZE (netbuf));
- fail_unless (memcmp (GST_BUFFER_DATA (copy), GST_BUFFER_DATA (netbuf),
- GST_BUFFER_SIZE (copy)) == 0);
-
- fail_if (GST_BUFFER_FLAG_IS_SET (copy, GST_BUFFER_FLAG_READONLY));
- fail_unless (GST_BUFFER_FLAG_IS_SET (copy, GST_BUFFER_FLAG_DISCONT));
-
- fail_unless (gst_netaddress_get_ip4_address (&copy->from, &ipv4_copy, &port));
- fail_unless (ipv4_copy == ipv4_addr,
- "Copied buffer has wrong IPV4 from address");
- fail_unless (port == ipv4_port, "Copied buffer has wrong IPV4 from port");
-
- fail_unless (gst_netaddress_get_ip6_address (&copy->to, ipv6_copy, &port));
- fail_unless (memcmp (ipv6_copy, ipv6_addr, 16) == 0,
- "Copied buffer has wrong IPv6 destination address");
- fail_unless (port == ipv6_port,
- "Copied buffer has wrong IPv6 destination port");
-
- gst_buffer_unref (GST_BUFFER_CAST (netbuf));
- gst_buffer_unref (GST_BUFFER_CAST (copy));
-}
-
-GST_END_TEST;
-
-static Suite *
-netbuffer_suite (void)
-{
- Suite *s = suite_create ("netbuffer");
- TCase *tc_chain = tcase_create ("netbuffer");
-
- suite_add_tcase (s, tc_chain);
-
- tcase_add_test (tc_chain, test_netbuffer_copy);
-
- return s;
-}
-
-GST_CHECK_MAIN (netbuffer);
diff --git a/tests/check/libs/pbutils.c b/tests/check/libs/pbutils.c
deleted file mode 100644
index 61b8b609..00000000
--- a/tests/check/libs/pbutils.c
+++ /dev/null
@@ -1,724 +0,0 @@
-/* GStreamer unit tests for libgstpbutils
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gst/check/gstcheck.h>
-#include <gst/pbutils/pbutils.h>
-
-#include <stdio.h>
-#include <glib/gstdio.h>
-#include <glib/gprintf.h>
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h> /* for chmod() and getpid () */
-#endif
-
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h> /* for chmod() */
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h> /* for unlink() */
-#endif
-
-static void
-missing_msg_check_getters (GstMessage * msg)
-{
- gchar *str;
-
- str = gst_missing_plugin_message_get_installer_detail (msg);
- fail_unless (str != NULL);
- fail_unless (*str != '\0');
- fail_unless (g_str_has_prefix (str, "gstreamer|"));
- g_free (str);
-
- str = gst_missing_plugin_message_get_description (msg);
- fail_unless (str != NULL);
- fail_unless (*str != '\0');
- g_free (str);
-}
-
-GST_START_TEST (test_pb_utils_post_missing_messages)
-{
- GstElement *pipeline;
- GstStructure *s;
- GstMessage *msg;
- GstCaps *caps;
- GstBus *bus;
-
- gst_pb_utils_init ();
-
- pipeline = gst_pipeline_new ("pipeline");
- bus = gst_element_get_bus (pipeline);
-
- /* first, test common assertion failure cases */
- ASSERT_CRITICAL (msg = gst_missing_uri_source_message_new (NULL, "http"););
- ASSERT_CRITICAL (gst_missing_uri_source_message_new (pipeline, NULL));
-
- ASSERT_CRITICAL (gst_missing_uri_sink_message_new (NULL, "http"));
- ASSERT_CRITICAL (gst_missing_uri_sink_message_new (pipeline, NULL));
-
- ASSERT_CRITICAL (gst_missing_element_message_new (NULL, "rgbfyltr"));
- ASSERT_CRITICAL (gst_missing_element_message_new (pipeline, NULL));
-
- caps = gst_caps_new_simple ("audio/x-dontexist", NULL);
-
- ASSERT_CRITICAL (gst_missing_decoder_message_new (NULL, caps));
- ASSERT_CRITICAL (gst_missing_decoder_message_new (pipeline, NULL));
-
- ASSERT_CRITICAL (gst_missing_encoder_message_new (NULL, caps));
- ASSERT_CRITICAL (gst_missing_encoder_message_new (pipeline, NULL));
-
- gst_caps_unref (caps);
-
- /* URI source (with existing protocol) */
- msg = gst_missing_uri_source_message_new (pipeline, "http");
- fail_unless (msg != NULL);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
- fail_unless (msg->structure != NULL);
- s = msg->structure;
- fail_unless (gst_structure_has_name (s, "missing-plugin"));
- fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "type"), "urisource");
- fail_unless (gst_structure_has_field_typed (s, "detail", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "detail"), "http");
- missing_msg_check_getters (msg);
- gst_message_unref (msg);
-
- /* URI sink (with existing protocol) */
- msg = gst_missing_uri_sink_message_new (pipeline, "smb");
- fail_unless (msg != NULL);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
- fail_unless (msg->structure != NULL);
- s = msg->structure;
- fail_unless (gst_structure_has_name (s, "missing-plugin"));
- fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "type"), "urisink");
- fail_unless (gst_structure_has_field_typed (s, "detail", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "detail"), "smb");
- missing_msg_check_getters (msg);
- gst_message_unref (msg);
-
- /* URI source (with bogus protocol) */
- msg = gst_missing_uri_source_message_new (pipeline, "chchck");
- fail_unless (msg != NULL);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
- fail_unless (msg->structure != NULL);
- s = msg->structure;
- fail_unless (gst_structure_has_name (s, "missing-plugin"));
- fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "type"), "urisource");
- fail_unless (gst_structure_has_field_typed (s, "detail", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "detail"), "chchck");
- missing_msg_check_getters (msg);
- gst_message_unref (msg);
-
- /* URI sink (with bogus protocol) */
- msg = gst_missing_uri_sink_message_new (pipeline, "chchck");
- fail_unless (msg != NULL);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
- fail_unless (msg->structure != NULL);
- s = msg->structure;
- fail_unless (gst_structure_has_name (s, "missing-plugin"));
- fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "type"), "urisink");
- fail_unless (gst_structure_has_field_typed (s, "detail", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "detail"), "chchck");
- missing_msg_check_getters (msg);
- gst_message_unref (msg);
-
- /* element */
- msg = gst_missing_element_message_new (pipeline, "foobar");
- fail_unless (msg != NULL);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
- fail_unless (msg->structure != NULL);
- s = msg->structure;
- fail_unless (gst_structure_has_name (s, "missing-plugin"));
- fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "type"), "element");
- fail_unless (gst_structure_has_field_typed (s, "detail", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "detail"), "foobar");
- missing_msg_check_getters (msg);
- gst_message_unref (msg);
-
- /* create bogus caps that don't exist */
- caps = gst_caps_new_simple ("do/x-not", "exist", G_TYPE_BOOLEAN, FALSE, NULL);
-
- /* decoder (with unknown caps) */
- msg = gst_missing_decoder_message_new (pipeline, caps);
- fail_unless (msg != NULL);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
- fail_unless (msg->structure != NULL);
- s = msg->structure;
- fail_unless (gst_structure_has_name (s, "missing-plugin"));
- fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "type"), "decoder");
- fail_unless (gst_structure_has_field_typed (s, "detail", GST_TYPE_CAPS));
- missing_msg_check_getters (msg);
- gst_message_unref (msg);
-
- /* encoder (with unknown caps) */
- msg = gst_missing_encoder_message_new (pipeline, caps);
- fail_unless (msg != NULL);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
- fail_unless (msg->structure != NULL);
- s = msg->structure;
- fail_unless (gst_structure_has_name (s, "missing-plugin"));
- fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "type"), "encoder");
- fail_unless (gst_structure_has_field_typed (s, "detail", GST_TYPE_CAPS));
- missing_msg_check_getters (msg);
- gst_message_unref (msg);
-
- gst_caps_unref (caps);
-
- /* create caps that exist */
- caps = gst_caps_new_simple ("video/x-matroska", NULL);
- /* decoder (with known caps) */
- msg = gst_missing_decoder_message_new (pipeline, caps);
- fail_unless (msg != NULL);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
- fail_unless (msg->structure != NULL);
- s = msg->structure;
- fail_unless (gst_structure_has_name (s, "missing-plugin"));
- fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "type"), "decoder");
- fail_unless (gst_structure_has_field_typed (s, "detail", GST_TYPE_CAPS));
- fail_unless (gst_structure_has_field_typed (s, "name", G_TYPE_STRING));
- fail_unless (gst_structure_get_string (s, "name") != NULL);
- missing_msg_check_getters (msg);
- gst_message_unref (msg);
-
- /* encoder (with known caps) */
- msg = gst_missing_encoder_message_new (pipeline, caps);
- fail_unless (msg != NULL);
- fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_ELEMENT);
- fail_unless (msg->structure != NULL);
- s = msg->structure;
- fail_unless (gst_structure_has_name (s, "missing-plugin"));
- fail_unless (gst_structure_has_field_typed (s, "type", G_TYPE_STRING));
- fail_unless_equals_string (gst_structure_get_string (s, "type"), "encoder");
- fail_unless (gst_structure_has_field_typed (s, "detail", GST_TYPE_CAPS));
- fail_unless (gst_structure_has_field_typed (s, "name", G_TYPE_STRING));
- fail_unless (gst_structure_get_string (s, "name") != NULL);
- missing_msg_check_getters (msg);
- gst_message_unref (msg);
-
- gst_caps_unref (caps);
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
- gst_object_unref (bus);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_pb_utils_init)
-{
- /* should be fine to call multiple times */
- gst_pb_utils_init ();
- gst_pb_utils_init ();
- gst_pb_utils_init ();
- gst_pb_utils_init ();
-}
-
-GST_END_TEST;
-
-static const gchar *caps_strings[] = {
- /* formats with static descriptions */
- "application/ogg", "application/vnd.rn-realmedia", "video/x-fli",
- "video/x-flv", "video/x-matroska", "video/x-ms-asf", "video/x-msvideo",
- "video/x-quicktime", "video/quicktime", "audio/x-ac3", "audio/ac3",
- "audio/x-private-ac3", "audio/x-private1-ac3", "audio/x-adpcm",
- "audio/aiff", "audio/x-alaw", "audio/amr", "audio/AMR", "audio/AMR-WB",
- "audio/iLBC-sh", "audio/ms-gsm", "audio/qcelp", "audio/x-adpcm",
- "audio/x-aiff", "audio/x-alac", "audio/x-amr-nb-sh", "audio/x-amr-wb-sh",
- "audio/x-au", "audio/x-cinepak", "audio/x-dpcm", "audio/x-dts",
- "audio/x-dv", "audio/x-flac", "audio/x-gsm", "audio/x-iec958",
- "audio/x-iLBC", "audio/x-ircam", "audio/x-lpcm", "audio/x-private1-lpcm",
- "audio/x-m4a", "audio/x-mod", "audio/x-mulaw", "audio/x-musepack",
- "audio/x-nist", "audio/x-nsf", "audio/x-paris", "audio/x-qdm2",
- "audio/x-ralf-mpeg4-generic", "audio/x-sds", "audio/x-shorten",
- "audio/x-sid", "audio/x-sipro", "audio/x-spc", "audio/x-speex",
- "audio/x-svx", "audio/x-tta", "audio/x-ttafile",
- "audio/x-vnd.sony.atrac3", "audio/x-vorbis", "audio/x-voc", "audio/x-w64",
- "audio/x-wav", "audio/x-wavpack", "audio/x-wavpack-correction",
- "audio/x-wms", "audio/x-voxware", "video/sp5x", "video/vivo",
- "video/x-3ivx", "video/x-4xm", "video/x-apple-video", "video/x-camtasia",
- "video/x-cdxa", "video/x-cinepak", "video/x-cirrus-logic-accupak",
- "video/x-compressed-yuv", "video/x-dirac", "video/x-dvd-subpicture",
- "video/x-ffv", "video/x-flash-screen", "video/x-flash-video",
- "video/x-h261", "video/x-huffyuv", "video/x-intel-h263", "video/x-jpeg",
- "video/x-mjpeg", "video/x-mjpeg-b", "video/mpegts", "video/x-mng",
- "video/x-mszh", "video/x-msvideocodec", "video/x-mve", "video/x-nut",
- "video/x-nuv", "video/x-qdrw", "video/x-raw-gray", "video/x-smc",
- "video/x-smoke", "video/x-tarkin", "video/x-theora", "video/x-rle",
- "video/x-ultimotion", "video/x-vcd", "video/x-vmnc", "video/x-vp3",
- "video/x-vp5", "video/x-vp6", "video/x-vp6-flash", "video/x-vp7",
- "video/x-xvid", "video/x-zlib", "image/bmp", "image/x-bmp",
- "image/x-MS-bmp", "image/gif", "image/jpeg", "image/jng", "image/png",
- "image/pbm", "image/ppm", "image/svg+xml", "image/tiff",
- "image/x-cmu-raster", "image/x-icon", "image/x-xcf", "image/x-pixmap",
- "image/x-xpixmap", "image/x-quicktime", "image/x-sun-raster",
- "image/x-tga", "video/x-dv", "video/x-dv",
- /* some RTP formats */
- "application/x-rtp, media=(string)video, encoding-name=(string)TimVCodec",
- "application/x-rtp, media=(string)audio, encoding-name=(string)TimACodec",
- "application/x-rtp, media=(string)application, encoding-name=(string)TimMux",
- "application/x-rtp, media=(string)woohoo, encoding-name=(string)TPM",
- /* incomplete RTP formats */
- "application/x-rtp, media=(string)woohoo",
- "application/x-rtp, encoding-name=(string)TPM",
- "application/x-rtp, media=(string)woohoo",
- /* formats with dynamic descriptions */
- "audio/x-adpcm",
- "audio/x-adpcm, layout=(string)dvi",
- "audio/x-adpcm, layout=(string)swf",
- "audio/x-adpcm, layout=(string)microsoft",
- "audio/x-adpcm, layout=(string)quicktime",
- "audio/mpeg, mpegversion=(int)4",
- "audio/mpeg, mpegversion=(int)1, layer=(int)1",
- "audio/mpeg, mpegversion=(int)1, layer=(int)2",
- "audio/mpeg, mpegversion=(int)1, layer=(int)3",
- "audio/mpeg, mpegversion=(int)1, layer=(int)99",
- "audio/mpeg, mpegversion=(int)99",
- "video/mpeg, mpegversion=(int)2, systemstream=(boolean)TRUE",
- "video/mpeg, systemstream=(boolean)FALSE",
- "video/mpeg, mpegversion=(int)2",
- "video/mpeg, mpegversion=(int)1, systemstream=(boolean)FALSE",
- "video/mpeg, mpegversion=(int)2, systemstream=(boolean)FALSE",
- "video/mpeg, mpegversion=(int)4, systemstream=(boolean)FALSE",
- "video/mpeg, mpegversion=(int)99, systemstream=(boolean)TRUE",
- "video/mpeg, mpegversion=(int)99, systemstream=(boolean)FALSE",
- "video/mpeg",
- "video/x-indeo, indeoversion=(int)3",
- "video/x-indeo, indeoversion=(int)5",
- "video/x-indeo",
- "video/x-wmv, wmvversion=(int)1",
- "video/x-wmv, wmvversion=(int)2",
- "video/x-wmv, wmvversion=(int)3",
- "video/x-wmv, wmvversion=(int)99",
- "video/x-wmv",
- "audio/x-wma, wmaversion=(int)1",
- "audio/x-wma, wmaversion=(int)2",
- "audio/x-wma, wmaversion=(int)3",
- "audio/x-wma, wmaversion=(int)99",
- "audio/x-wma",
- "video/x-divx, divxversion=(int)3",
- "video/x-divx, divxversion=(int)4",
- "video/x-divx, divxversion=(int)5",
- "video/x-divx, divxversion=(int)99",
- "video/x-divx",
- "video/x-svq, svqversion=(int)1",
- "video/x-svq, svqversion=(int)3",
- "video/x-svq, svqversion=(int)99",
- "video/x-svq",
- "video/x-h264, variant=(string)itu",
- "video/x-h264, variant=(string)videosoft",
- "video/x-h264, variant=(string)foobar",
- "video/x-h264",
- "video/x-h263, variant=(string)itu",
- "video/x-h263, variant=(string)lead",
- "video/x-h263, variant=(string)microsoft",
- "video/x-h263, variant=(string)vdolive",
- "video/x-h263, variant=(string)vivo",
- "video/x-h263, variant=(string)xirlink",
- "video/x-h263, variant=(string)foobar",
- "video/x-h263",
- "video/x-msmpeg, msmpegversion=(int)41",
- "video/x-msmpeg, msmpegversion=(int)42",
- "video/x-msmpeg, msmpegversion=(int)43",
- "video/x-msmpeg, msmpegversion=(int)99",
- "video/x-msmpeg",
- "video/x-pn-realvideo, rmversion=(int)1",
- "video/x-pn-realvideo, rmversion=(int)2",
- "video/x-pn-realvideo, rmversion=(int)3",
- "video/x-pn-realvideo, rmversion=(int)4",
- "video/x-pn-realvideo, rmversion=(int)99",
- "video/x-pn-realvideo",
- "audio/x-pn-realaudio, raversion=(int)1",
- "audio/x-pn-realaudio, raversion=(int)2",
- "audio/x-pn-realaudio, raversion=(int)99",
- "audio/x-pn-realaudio",
- "audio/x-mace, maceversion=(int)3",
- "audio/x-mace, maceversion=(int)6",
- "audio/x-mace, maceversion=(int)99",
- "audio/x-mace",
- "video/x-truemotion, trueversion=(int)1",
- "video/x-truemotion, trueversion=(int)2",
- "video/x-truemotion, trueversion=(int)99",
- "video/x-truemotion",
- "video/x-asus, asusversion=(int)1",
- "video/x-asus, asusversion=(int)2",
- "video/x-asus, asusversion=(int)99",
- "video/x-asus",
- "video/x-xan, wcversion=(int)1",
- "video/x-xan, wcversion=(int)99",
- "video/x-xan",
- "video/x-ati-vcr, vcrversion=(int)1",
- "video/x-ati-vcr, vcrversion=(int)2",
- "video/x-ati-vcr, vcrversion=(int)99",
- "video/x-ati-vcr",
- /* raw audio */
- "audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)44100, channels=(int)2",
- "audio/x-raw-float, rate=(int)22050, channels=(int)2, endianness=(int)1234, width=(int)32",
- /* raw video */
- "video/x-raw-rgb, bpp=(int)16, endianness=(int)1234, depth=(int)16, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)320, height=(int)240, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1",
- "video/x-raw-yuv, format=(fourcc)YUY2, width=(int)320, height=(int)240, framerate=(fraction)30/1",
- /* and a made-up format */
- "video/x-tpm"
-};
-
-GST_START_TEST (test_pb_utils_get_codec_description)
-{
- gint i;
-
- gst_pb_utils_init ();
-
- for (i = 0; i < G_N_ELEMENTS (caps_strings); ++i) {
- GstCaps *caps;
- gchar *desc;
-
- caps = gst_caps_from_string (caps_strings[i]);
- fail_unless (caps != NULL, "could not create caps from string '%s'",
- caps_strings[i]);
- GST_LOG ("Caps %s:", caps_strings[i]);
- desc = gst_pb_utils_get_codec_description (caps);
- fail_unless (desc != NULL);
- GST_LOG (" - codec : %s", desc);
- g_free (desc);
- desc = gst_pb_utils_get_decoder_description (caps);
- fail_unless (desc != NULL);
- GST_LOG (" - decoder : %s", desc);
- g_free (desc);
- desc = gst_pb_utils_get_encoder_description (caps);
- fail_unless (desc != NULL);
- GST_LOG (" - encoder : %s", desc);
- g_free (desc);
- gst_caps_unref (caps);
- }
-}
-
-GST_END_TEST;
-
-
-GST_START_TEST (test_pb_utils_taglist_add_codec_info)
-{
- GstTagList *list;
- GstCaps *caps;
-
- gst_pb_utils_init ();
- list = gst_tag_list_new ();
- caps = gst_caps_new_simple ("video/x-theora", NULL);
- ASSERT_CRITICAL (fail_if
- (gst_pb_utils_add_codec_description_to_tag_list (NULL,
- GST_TAG_VIDEO_CODEC, caps)));
- ASSERT_CRITICAL (fail_if
- (gst_pb_utils_add_codec_description_to_tag_list (list, NULL, caps)));
- ASSERT_CRITICAL (fail_if
- (gst_pb_utils_add_codec_description_to_tag_list (list, "asdfa", caps)));
- ASSERT_CRITICAL (fail_if
- (gst_pb_utils_add_codec_description_to_tag_list (list,
- GST_TAG_IMAGE, caps)));
- ASSERT_CRITICAL (fail_if
- (gst_pb_utils_add_codec_description_to_tag_list (list,
- GST_TAG_VIDEO_CODEC, NULL)));
- /* FIXME: do something here */
- fail_unless (gst_pb_utils_add_codec_description_to_tag_list (list,
- GST_TAG_VIDEO_CODEC, caps));
- fail_if (gst_tag_list_is_empty (list));
- gst_tag_list_free (list);
- gst_caps_unref (caps);
-}
-
-GST_END_TEST;
-
-static gint marker;
-
-static void
-result_cb (GstInstallPluginsReturn result, gpointer user_data)
-{
- GST_LOG ("result = %u, user_data = %p", result, user_data);
-
- fail_unless (user_data == (gpointer) & marker);
-
- marker = result;
-}
-
-#define SCRIPT_NO_XID \
- "#!/bin/sh\n" \
- "if test x$1 != xdetail1; then exit 21; fi;\n" \
- "if test x$2 != xdetail2; then exit 22; fi;\n" \
- "exit 1\n"
-
-#define SCRIPT_WITH_XID \
- "#!/bin/sh\n" \
- "if test x$1 != 'x--transient-for=42'; then exit 21; fi;\n" \
- "if test x$2 != xdetail1; then exit 22; fi;\n" \
- "if test x$3 != xdetail2; then exit 23; fi;\n" \
- "exit 0\n"
-
-/* make sure our script gets called with the right parameters */
-static void
-test_pb_utils_install_plugins_do_callout (gchar ** details,
- GstInstallPluginsContext * ctx, const gchar * script,
- GstInstallPluginsReturn expected_result)
-{
-#ifdef G_OS_UNIX
- GstInstallPluginsReturn ret;
- GError *err = NULL;
- gchar *path;
-
- path = g_strdup_printf ("%s/gst-plugins-base-unit-test-helper.%s.%lu",
- g_get_tmp_dir (), (g_get_user_name ())? g_get_user_name () : "nobody",
- (gulong) getpid ());
-
- if (!g_file_set_contents (path, script, -1, &err)) {
- GST_DEBUG ("Failed to write test script to %s: %s", path, err->message);
- g_error_free (err);
- goto done;
- }
-
- if (chmod (path, S_IRUSR | S_IWUSR | S_IXUSR) != 0) {
- GST_DEBUG ("Could not set mode u+rwx on '%s'", path);
- goto done;
- }
-
- /* test gst_install_plugins_supported() I */
- g_setenv ("GST_INSTALL_PLUGINS_HELPER", "/i/do/not/ex.ist!", 1);
- fail_if (gst_install_plugins_supported ());
-
- GST_LOG ("setting GST_INSTALL_PLUGINS_HELPER to '%s'", path);
- g_setenv ("GST_INSTALL_PLUGINS_HELPER", path, 1);
-
- /* test gst_install_plugins_supported() II */
- fail_unless (gst_install_plugins_supported ());
-
- /* test sync callout */
- ret = gst_install_plugins_sync (details, ctx);
- fail_unless (ret == GST_INSTALL_PLUGINS_HELPER_MISSING ||
- ret == expected_result,
- "gst_install_plugins_sync() failed with unexpected ret %d, which is "
- "neither HELPER_MISSING nor %d", ret, expected_result);
-
- /* test async callout */
- marker = -333;
- ret = gst_install_plugins_async (details, ctx, result_cb,
- (gpointer) & marker);
- fail_unless (ret == GST_INSTALL_PLUGINS_HELPER_MISSING ||
- ret == GST_INSTALL_PLUGINS_STARTED_OK,
- "gst_install_plugins_async() failed with unexpected ret %d", ret);
- if (ret == GST_INSTALL_PLUGINS_STARTED_OK) {
- while (marker == -333) {
- g_usleep (500);
- g_main_context_iteration (NULL, FALSE);
- }
- /* and check that the callback was called with the expected code */
- fail_unless_equals_int (marker, expected_result);
- }
-
-done:
-
- unlink (path);
- g_free (path);
-#endif /* G_OS_UNIX */
-}
-
-GST_START_TEST (test_pb_utils_install_plugins)
-{
- GstInstallPluginsContext *ctx;
- GstInstallPluginsReturn ret;
- gchar *details[] = { "detail1", "detail2", NULL };
- gchar *details_multi[] = { "detail1", "detail1", "detail2", NULL };
-
- ctx = gst_install_plugins_context_new ();
-
- ASSERT_CRITICAL (ret = gst_install_plugins_sync (NULL, ctx);
- );
- ASSERT_CRITICAL (ret =
- gst_install_plugins_async (NULL, ctx, result_cb, (gpointer) & marker);
- );
- ASSERT_CRITICAL (ret =
- gst_install_plugins_async (details, ctx, NULL, (gpointer) & marker);
- );
-
- /* make sure the functions return the right error code if the helper does
- * not exist */
- g_setenv ("GST_INSTALL_PLUGINS_HELPER", "/does/not/ex/is.t", 1);
- ret = gst_install_plugins_sync (details, NULL);
- fail_unless_equals_int (ret, GST_INSTALL_PLUGINS_HELPER_MISSING);
-
- marker = -333;
- ret =
- gst_install_plugins_async (details, NULL, result_cb, (gpointer) & marker);
- fail_unless_equals_int (ret, GST_INSTALL_PLUGINS_HELPER_MISSING);
- /* and check that the callback wasn't called */
- fail_unless_equals_int (marker, -333);
-
- /* now make sure our scripts are actually called as expected (if possible) */
- test_pb_utils_install_plugins_do_callout (details, NULL, SCRIPT_NO_XID,
- GST_INSTALL_PLUGINS_NOT_FOUND);
-
- /* and again with context */
- gst_install_plugins_context_set_xid (ctx, 42);
- test_pb_utils_install_plugins_do_callout (details, ctx, SCRIPT_WITH_XID,
- GST_INSTALL_PLUGINS_SUCCESS);
-
- /* and make sure that duplicate detail strings get dropped */
- test_pb_utils_install_plugins_do_callout (details_multi, NULL, SCRIPT_NO_XID,
- GST_INSTALL_PLUGINS_NOT_FOUND);
-
- /* and the same again with context */
- gst_install_plugins_context_set_xid (ctx, 42);
- test_pb_utils_install_plugins_do_callout (details_multi, ctx, SCRIPT_WITH_XID,
- GST_INSTALL_PLUGINS_SUCCESS);
-
- /* and free the context now that we don't need it any longer */
- gst_install_plugins_context_free (ctx);
-
- /* completely silly test to check gst_install_plugins_return_get_name()
- * is somewhat well-behaved */
- {
- gint i;
-
- for (i = -99; i < 16738; ++i) {
- const gchar *s;
-
- s = gst_install_plugins_return_get_name ((GstInstallPluginsReturn) i);
- fail_unless (s != NULL);
- /* GST_LOG ("%5d = %s", i, s); */
- }
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_pb_utils_installer_details)
-{
- GstMessage *msg;
- GstElement *el;
- GstCaps *caps;
- gchar *detail1, *detail2;
-
- el = gst_pipeline_new ("dummy-element");
-
- /* uri source */
- detail1 = gst_missing_uri_source_installer_detail_new ("http");
- fail_unless (detail1 != NULL);
- fail_unless (g_str_has_prefix (detail1, "gstreamer|0.10|"));
- fail_unless (g_str_has_suffix (detail1, "|urisource-http"));
- msg = gst_missing_uri_source_message_new (el, "http");
- fail_unless (msg != NULL);
- detail2 = gst_missing_plugin_message_get_installer_detail (msg);
- fail_unless (detail2 != NULL);
- gst_message_unref (msg);
- fail_unless_equals_string (detail1, detail2);
- g_free (detail1);
- g_free (detail2);
-
- /* uri sink */
- detail1 = gst_missing_uri_sink_installer_detail_new ("http");
- fail_unless (detail1 != NULL);
- fail_unless (g_str_has_prefix (detail1, "gstreamer|0.10|"));
- fail_unless (g_str_has_suffix (detail1, "|urisink-http"));
- msg = gst_missing_uri_sink_message_new (el, "http");
- fail_unless (msg != NULL);
- detail2 = gst_missing_plugin_message_get_installer_detail (msg);
- fail_unless (detail2 != NULL);
- gst_message_unref (msg);
- fail_unless_equals_string (detail1, detail2);
- g_free (detail1);
- g_free (detail2);
-
- /* element */
- detail1 = gst_missing_element_installer_detail_new ("deinterlace");
- fail_unless (detail1 != NULL);
- fail_unless (g_str_has_prefix (detail1, "gstreamer|0.10|"));
- fail_unless (g_str_has_suffix (detail1, "|element-deinterlace"));
- msg = gst_missing_element_message_new (el, "deinterlace");
- fail_unless (msg != NULL);
- detail2 = gst_missing_plugin_message_get_installer_detail (msg);
- fail_unless (detail2 != NULL);
- gst_message_unref (msg);
- fail_unless_equals_string (detail1, detail2);
- g_free (detail1);
- g_free (detail2);
-
- /* decoder */
- caps = gst_caps_new_simple ("audio/x-spiffy", "spiffyversion", G_TYPE_INT,
- 2, "channels", G_TYPE_INT, 6, NULL);
- detail1 = gst_missing_decoder_installer_detail_new (caps);
- fail_unless (detail1 != NULL);
- fail_unless (g_str_has_prefix (detail1, "gstreamer|0.10|"));
- fail_unless (g_str_has_suffix (detail1,
- "|decoder-audio/x-spiffy, spiffyversion=(int)2"));
- msg = gst_missing_decoder_message_new (el, caps);
- fail_unless (msg != NULL);
- detail2 = gst_missing_plugin_message_get_installer_detail (msg);
- fail_unless (detail2 != NULL);
- gst_message_unref (msg);
- gst_caps_unref (caps);
- fail_unless_equals_string (detail1, detail2);
- g_free (detail1);
- g_free (detail2);
-
- /* encoder */
- caps = gst_caps_new_simple ("audio/x-spiffy", "spiffyversion", G_TYPE_INT,
- 2, "channels", G_TYPE_INT, 6, NULL);
- detail1 = gst_missing_encoder_installer_detail_new (caps);
- fail_unless (g_str_has_prefix (detail1, "gstreamer|0.10|"));
- fail_unless (g_str_has_suffix (detail1,
- "|encoder-audio/x-spiffy, spiffyversion=(int)2"));
- fail_unless (detail1 != NULL);
- msg = gst_missing_encoder_message_new (el, caps);
- fail_unless (msg != NULL);
- detail2 = gst_missing_plugin_message_get_installer_detail (msg);
- fail_unless (detail2 != NULL);
- gst_message_unref (msg);
- gst_caps_unref (caps);
- fail_unless_equals_string (detail1, detail2);
- g_free (detail1);
- g_free (detail2);
-
- gst_object_unref (el);
-}
-
-GST_END_TEST;
-
-static Suite *
-libgstpbutils_suite (void)
-{
- Suite *s = suite_create ("pbutils library");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_pb_utils_init);
- tcase_add_test (tc_chain, test_pb_utils_post_missing_messages);
- tcase_add_test (tc_chain, test_pb_utils_taglist_add_codec_info);
- tcase_add_test (tc_chain, test_pb_utils_get_codec_description);
- tcase_add_test (tc_chain, test_pb_utils_install_plugins);
- tcase_add_test (tc_chain, test_pb_utils_installer_details);
- return s;
-}
-
-GST_CHECK_MAIN (libgstpbutils);
diff --git a/tests/check/libs/rtp.c b/tests/check/libs/rtp.c
deleted file mode 100644
index e19c96cd..00000000
--- a/tests/check/libs/rtp.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/* GStreamer unit tests for the RTP support library
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/check/gstcheck.h>
-
-#include <gst/rtp/gstrtpbuffer.h>
-#include <gst/rtp/gstrtcpbuffer.h>
-#include <string.h>
-
-#define RTP_HEADER_LEN 12
-
-GST_START_TEST (test_rtp_buffer)
-{
- GstBuffer *buf;
- guint8 *data;
-
- /* check GstRTPHeader structure alignment and packing */
- buf = gst_rtp_buffer_new_allocate (16, 4, 0);
- fail_unless (buf != NULL);
- fail_unless_equals_int (GST_BUFFER_SIZE (buf), RTP_HEADER_LEN + 16 + 4);
- data = GST_BUFFER_DATA (buf);
-
- /* check defaults */
- fail_unless_equals_int (gst_rtp_buffer_get_version (buf), 2);
- fail_unless (gst_rtp_buffer_get_padding (buf) == FALSE);
- fail_unless (gst_rtp_buffer_get_extension (buf) == FALSE);
- fail_unless_equals_int (gst_rtp_buffer_get_csrc_count (buf), 0);
- fail_unless (gst_rtp_buffer_get_marker (buf) == FALSE);
- fail_unless (gst_rtp_buffer_get_payload_type (buf) == 0);
- fail_unless_equals_int (GST_READ_UINT16_BE (data), 0x8000);
-
- /* check version in bitfield */
- gst_rtp_buffer_set_version (buf, 3);
- fail_unless_equals_int (gst_rtp_buffer_get_version (buf), 3);
- fail_unless_equals_int ((data[0] & 0xC0) >> 6, 3);
- gst_rtp_buffer_set_version (buf, 2);
- fail_unless_equals_int (gst_rtp_buffer_get_version (buf), 2);
- fail_unless_equals_int ((data[0] & 0xC0) >> 6, 2);
-
- /* check padding bit */
- gst_rtp_buffer_set_padding (buf, TRUE);
- fail_unless (gst_rtp_buffer_get_padding (buf) == TRUE);
- fail_unless_equals_int ((data[0] & 0x20) >> 5, 1);
- gst_rtp_buffer_set_padding (buf, FALSE);
- fail_unless (gst_rtp_buffer_get_padding (buf) == FALSE);
- fail_unless_equals_int ((data[0] & 0x20) >> 5, 0);
-
- /* check marker bit */
- gst_rtp_buffer_set_marker (buf, TRUE);
- fail_unless (gst_rtp_buffer_get_marker (buf) == TRUE);
- fail_unless_equals_int ((data[1] & 0x80) >> 7, 1);
- gst_rtp_buffer_set_marker (buf, FALSE);
- fail_unless (gst_rtp_buffer_get_marker (buf) == FALSE);
- fail_unless_equals_int ((data[1] & 0x80) >> 7, 0);
-
- /* check sequence offset */
- gst_rtp_buffer_set_seq (buf, 0xF2C9);
- fail_unless_equals_int (gst_rtp_buffer_get_seq (buf), 0xF2C9);
- fail_unless_equals_int (GST_READ_UINT16_BE (data + 2), 0xF2C9);
- gst_rtp_buffer_set_seq (buf, 0);
- fail_unless_equals_int (gst_rtp_buffer_get_seq (buf), 0);
- fail_unless_equals_int (GST_READ_UINT16_BE (data + 2), 0);
-
- /* check timestamp offset */
- gst_rtp_buffer_set_timestamp (buf, 432191);
- fail_unless_equals_int (GST_READ_UINT32_BE (data + 4), 432191);
- fail_unless_equals_int (gst_rtp_buffer_get_timestamp (buf), 432191);
- gst_rtp_buffer_set_timestamp (buf, 0);
- fail_unless_equals_int (gst_rtp_buffer_get_timestamp (buf), 0);
- fail_unless_equals_int (GST_READ_UINT32_BE (data + 4), 0);
-
- /* check ssrc offset */
- gst_rtp_buffer_set_ssrc (buf, 0xf04043C2);
- fail_unless_equals_int (gst_rtp_buffer_get_ssrc (buf), (gint) 0xf04043c2);
- fail_unless_equals_int (GST_READ_UINT32_BE (data + 4 + 4), (gint) 0xf04043c2);
- gst_rtp_buffer_set_ssrc (buf, 0);
- fail_unless_equals_int (gst_rtp_buffer_get_ssrc (buf), 0);
- fail_unless_equals_int (GST_READ_UINT32_BE (data + 4 + 4), 0);
-
- /* check csrc bits */
- fail_unless_equals_int (gst_rtp_buffer_get_csrc_count (buf), 0);
- ASSERT_CRITICAL (gst_rtp_buffer_get_csrc (buf, 0));
- fail_unless_equals_int (data[0] & 0xf, 0);
- gst_buffer_unref (buf);
-
- /* and again, this time with CSRCs */
- buf = gst_rtp_buffer_new_allocate (16, 4, 3);
- fail_unless (buf != NULL);
- fail_unless_equals_int (GST_BUFFER_SIZE (buf),
- RTP_HEADER_LEN + 16 + 4 + 4 * 3);
-
- data = GST_BUFFER_DATA (buf);
-
- fail_unless_equals_int (gst_rtp_buffer_get_csrc_count (buf), 3);
- ASSERT_CRITICAL (gst_rtp_buffer_get_csrc (buf, 3));
- fail_unless_equals_int (data[0] & 0xf, 3);
- fail_unless_equals_int (gst_rtp_buffer_get_csrc (buf, 0), 0);
- fail_unless_equals_int (gst_rtp_buffer_get_csrc (buf, 1), 0);
- fail_unless_equals_int (gst_rtp_buffer_get_csrc (buf, 2), 0);
-
- data += RTP_HEADER_LEN; /* skip the other header stuff */
- gst_rtp_buffer_set_csrc (buf, 0, 0xf7c0);
- fail_unless_equals_int (GST_READ_UINT32_BE (data + 0 * 4), 0xf7c0);
- gst_rtp_buffer_set_csrc (buf, 1, 0xf7c1);
- fail_unless_equals_int (GST_READ_UINT32_BE (data + 1 * 4), 0xf7c1);
- gst_rtp_buffer_set_csrc (buf, 2, 0xf7c2);
- fail_unless_equals_int (GST_READ_UINT32_BE (data + 2 * 4), 0xf7c2);
- ASSERT_CRITICAL (gst_rtp_buffer_set_csrc (buf, 3, 0xf123));
- gst_buffer_unref (buf);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_rtp_buffer_validate_corrupt)
-{
- GstBuffer *buf;
- guint8 corrupt_rtp_packet[58] = {
- 0x90, 0x7a, 0xbf, 0x28, 0x3a, 0x8a, 0x0a, 0xf4, 0x69, 0x6b, 0x76, 0xc0,
- 0x21, 0xe0, 0xe0, 0x60, 0x81, 0x10, 0x84, 0x30, 0x21, 0x52, 0x06, 0xc2,
- 0xb8, 0x30, 0x10, 0x4c, 0x08, 0x62, 0x67, 0xc2, 0x6e, 0x1a, 0x53, 0x3f,
- 0xaf, 0xd6, 0x1b, 0x29, 0x40, 0xe0, 0xa5, 0x83, 0x01, 0x4b, 0x04, 0x02,
- 0xb0, 0x97, 0x63, 0x08, 0x10, 0x4b, 0x43, 0x85, 0x37, 0x2c
- };
-
- buf = gst_buffer_new ();
- GST_BUFFER_DATA (buf) = corrupt_rtp_packet;
- GST_BUFFER_SIZE (buf) = sizeof (corrupt_rtp_packet);
- fail_if (gst_rtp_buffer_validate (buf));
- gst_buffer_unref (buf);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_rtp_buffer_list)
-{
- GstBuffer *rtp_header;
- GstBuffer *rtp_payload;
- GstBufferList *list = NULL;
- GstBufferListIterator *it;
- guint i;
-
- list = gst_buffer_list_new ();
- it = gst_buffer_list_iterate (list);
-
- /* Creating a list of two RTP packages */
-
- /* Create first group to hold the rtp header and the payload */
- gst_buffer_list_iterator_add_group (it);
- rtp_header = gst_rtp_buffer_new_allocate (0, 0, 0);
- gst_buffer_list_iterator_add (it, rtp_header);
- rtp_payload = gst_buffer_new_and_alloc (42);
- gst_buffer_list_iterator_add (it, rtp_payload);
-
- /* Create second group to hold an rtp header and a payload */
- gst_buffer_list_iterator_add_group (it);
- rtp_header = gst_rtp_buffer_new_allocate (0, 0, 0);
- gst_buffer_list_iterator_add (it, rtp_header);
- rtp_payload = gst_buffer_new_and_alloc (42);
- gst_buffer_list_iterator_add (it, rtp_payload);
-
- gst_buffer_list_iterator_free (it);
-
- /* Test SEQ number */
- i = gst_rtp_buffer_list_set_seq (list, 1024);
- fail_if (1026 != i);
- fail_if (!gst_rtp_buffer_list_validate (list));
-
- /* Timestamp */
- gst_rtp_buffer_list_set_timestamp (list, 432191);
- fail_unless_equals_int (gst_rtp_buffer_list_get_timestamp (list), 432191);
-
- /* SSRC */
- gst_rtp_buffer_list_set_ssrc (list, 0xf04043C2);
- fail_unless_equals_int (gst_rtp_buffer_list_get_ssrc (list),
- (gint) 0xf04043c2);
-
- /* Payload type */
- gst_rtp_buffer_list_set_payload_type (list, 127);
- fail_unless_equals_int (gst_rtp_buffer_list_get_payload_type (list), 127);
-
- gst_buffer_list_unref (list);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_rtp_buffer_set_extension_data)
-{
- GstBuffer *buf;
- guint8 *data;
- guint16 bits;
- guint size;
- gpointer pointer;
-
- /* check GstRTPHeader structure alignment and packing */
- buf = gst_rtp_buffer_new_allocate (4, 0, 0);
- data = GST_BUFFER_DATA (buf);
-
- /* should be impossible to set the extension data */
- ASSERT_WARNING (fail_unless (gst_rtp_buffer_set_extension_data (buf, 0,
- 4) == FALSE));
- fail_unless (gst_rtp_buffer_get_extension (buf) == FALSE);
-
- /* should be possible to set the extension data */
- fail_unless (gst_rtp_buffer_set_extension_data (buf, 270, 0) == TRUE);
- fail_unless (gst_rtp_buffer_get_extension (buf) == TRUE);
- gst_rtp_buffer_get_extension_data (buf, &bits, &pointer, &size);
- fail_unless (bits == 270);
- fail_unless (size == 0);
- fail_unless (pointer == GST_BUFFER_DATA (buf) + 16);
- pointer = gst_rtp_buffer_get_payload (buf);
- fail_unless (pointer == GST_BUFFER_DATA (buf) + 16);
- gst_buffer_unref (buf);
-
- buf = gst_rtp_buffer_new_allocate (20, 0, 0);
- data = GST_BUFFER_DATA (buf);
- fail_unless (gst_rtp_buffer_get_extension (buf) == FALSE);
- fail_unless (gst_rtp_buffer_set_extension_data (buf, 333, 2) == TRUE);
- fail_unless (gst_rtp_buffer_get_extension (buf) == TRUE);
- gst_rtp_buffer_get_extension_data (buf, &bits, &pointer, &size);
- fail_unless (bits == 333);
- fail_unless (size == 2);
- fail_unless (pointer == GST_BUFFER_DATA (buf) + 16);
- pointer = gst_rtp_buffer_get_payload (buf);
- fail_unless (pointer == GST_BUFFER_DATA (buf) + 24);
- gst_buffer_unref (buf);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_rtp_seqnum_compare)
-{
-#define ASSERT_COMP(a,b,c) fail_unless (gst_rtp_buffer_compare_seqnum ((guint16)a,(guint16)b) == c);
- ASSERT_COMP (0xfffe, 0xfffd, -1);
- ASSERT_COMP (0xffff, 0xfffe, -1);
- ASSERT_COMP (0x0000, 0xffff, -1);
- ASSERT_COMP (0x0001, 0x0000, -1);
- ASSERT_COMP (0x0002, 0x0001, -1);
-
- ASSERT_COMP (0xffff, 0xfffd, -2);
- ASSERT_COMP (0x0000, 0xfffd, -3);
- ASSERT_COMP (0x0001, 0xfffd, -4);
- ASSERT_COMP (0x0002, 0xfffd, -5);
-
- ASSERT_COMP (0x7ffe, 0x7ffd, -1);
- ASSERT_COMP (0x7fff, 0x7ffe, -1);
- ASSERT_COMP (0x8000, 0x7fff, -1);
- ASSERT_COMP (0x8001, 0x8000, -1);
- ASSERT_COMP (0x8002, 0x8001, -1);
-
- ASSERT_COMP (0x7fff, 0x7ffd, -2);
- ASSERT_COMP (0x8000, 0x7ffd, -3);
- ASSERT_COMP (0x8001, 0x7ffd, -4);
- ASSERT_COMP (0x8002, 0x7ffd, -5);
-
- ASSERT_COMP (0x7ffd, 0xffff, -0x7ffe);
- ASSERT_COMP (0x7ffe, 0x0000, -0x7ffe);
- ASSERT_COMP (0x7fff, 0x0001, -0x7ffe);
- ASSERT_COMP (0x7fff, 0x0000, -0x7fff);
- ASSERT_COMP (0x8000, 0x0001, -0x7fff);
- ASSERT_COMP (0x8001, 0x0002, -0x7fff);
-
- ASSERT_COMP (0xfffd, 0x7ffe, -0x7fff);
- ASSERT_COMP (0xfffe, 0x7fff, -0x7fff);
- ASSERT_COMP (0xffff, 0x8000, -0x7fff);
- ASSERT_COMP (0x0000, 0x8001, -0x7fff);
- ASSERT_COMP (0x0001, 0x8002, -0x7fff);
-
- ASSERT_COMP (0xfffe, 0x7ffe, -0x8000);
- ASSERT_COMP (0xffff, 0x7fff, -0x8000);
- ASSERT_COMP (0x0000, 0x8000, -0x8000);
- ASSERT_COMP (0x0001, 0x8001, -0x8000);
-
- ASSERT_COMP (0x7ffe, 0xfffe, -0x8000);
- ASSERT_COMP (0x7fff, 0xffff, -0x8000);
- ASSERT_COMP (0x8000, 0x0000, -0x8000);
- ASSERT_COMP (0x8001, 0x0001, -0x8000);
-
- ASSERT_COMP (0x0001, 0x0002, 1);
- ASSERT_COMP (0x0000, 0x0001, 1);
- ASSERT_COMP (0xffff, 0x0000, 1);
- ASSERT_COMP (0xfffe, 0xffff, 1);
- ASSERT_COMP (0xfffd, 0xfffe, 1);
-
- ASSERT_COMP (0x0000, 0x0002, 2);
- ASSERT_COMP (0xffff, 0x0002, 3);
- ASSERT_COMP (0xfffe, 0x0002, 4);
- ASSERT_COMP (0xfffd, 0x0002, 5);
-
- ASSERT_COMP (0x8001, 0x8002, 1);
- ASSERT_COMP (0x8000, 0x8001, 1);
- ASSERT_COMP (0x7fff, 0x8000, 1);
- ASSERT_COMP (0x7ffe, 0x7fff, 1);
- ASSERT_COMP (0x7ffd, 0x7ffe, 1);
-
- ASSERT_COMP (0x8000, 0x8002, 2);
- ASSERT_COMP (0x7fff, 0x8002, 3);
- ASSERT_COMP (0x7ffe, 0x8002, 4);
- ASSERT_COMP (0x7ffd, 0x8002, 5);
-
- ASSERT_COMP (0xfffe, 0x7ffd, 0x7fff);
- ASSERT_COMP (0xffff, 0x7ffe, 0x7fff);
- ASSERT_COMP (0x0000, 0x7fff, 0x7fff);
- ASSERT_COMP (0x0001, 0x8000, 0x7fff);
- ASSERT_COMP (0x0002, 0x8001, 0x7fff);
-
- ASSERT_COMP (0x7ffe, 0xfffd, 0x7fff);
- ASSERT_COMP (0x7fff, 0xfffe, 0x7fff);
- ASSERT_COMP (0x8000, 0xffff, 0x7fff);
- ASSERT_COMP (0x8001, 0x0000, 0x7fff);
- ASSERT_COMP (0x8002, 0x0001, 0x7fff);
-#undef ASSERT_COMP
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_rtcp_buffer)
-{
- GstBuffer *buf;
- GstRTCPPacket packet;
- guint8 *data;
-
- buf = gst_rtcp_buffer_new (1400);
- fail_unless (buf != NULL);
- fail_unless_equals_int (GST_BUFFER_SIZE (buf), 1400);
- data = GST_BUFFER_DATA (buf);
-
- fail_unless (gst_rtcp_buffer_get_first_packet (buf, &packet) == FALSE);
- fail_unless (gst_rtcp_buffer_get_packet_count (buf) == 0);
- fail_unless (gst_rtcp_buffer_validate (buf) == FALSE);
-
- /* add an SR packet */
- fail_unless (gst_rtcp_buffer_add_packet (buf, GST_RTCP_TYPE_SR,
- &packet) == TRUE);
-
- fail_unless (gst_rtcp_packet_get_padding (&packet) == 0);
- fail_unless (gst_rtcp_packet_get_count (&packet) == 0);
- fail_unless (gst_rtcp_packet_get_type (&packet) == GST_RTCP_TYPE_SR);
- fail_unless (gst_rtcp_packet_get_length (&packet) == 6);
-
- gst_rtcp_packet_sr_set_sender_info (&packet, 0x44556677,
- G_GUINT64_CONSTANT (1), 0x11111111, 101, 123456);
- {
- guint32 ssrc;
- guint64 ntptime;
- guint32 rtptime;
- guint32 packet_count;
- guint32 octet_count;
-
- gst_rtcp_packet_sr_get_sender_info (&packet, &ssrc, &ntptime, &rtptime,
- &packet_count, &octet_count);
-
- fail_unless (ssrc == 0x44556677);
- fail_unless (ntptime == G_GUINT64_CONSTANT (1));
- fail_unless (rtptime == 0x11111111);
- fail_unless (packet_count == 101);
- fail_unless (octet_count == 123456);
- }
-
- /* go to first packet, this should be the packet we just added */
- fail_unless (gst_rtcp_buffer_get_first_packet (buf, &packet) == TRUE);
-
- fail_unless (gst_rtcp_packet_get_padding (&packet) == 0);
- fail_unless (gst_rtcp_packet_get_count (&packet) == 0);
- fail_unless (gst_rtcp_packet_get_type (&packet) == GST_RTCP_TYPE_SR);
- fail_unless (gst_rtcp_packet_get_length (&packet) == 6);
-
- fail_unless (gst_rtcp_packet_move_to_next (&packet) == FALSE);
-
- /* add some SDES */
- fail_unless (gst_rtcp_buffer_add_packet (buf, GST_RTCP_TYPE_SDES,
- &packet) == TRUE);
- fail_unless (gst_rtcp_packet_sdes_add_item (&packet, 0xff658743) == TRUE);
- fail_unless (gst_rtcp_packet_sdes_add_entry (&packet, GST_RTCP_SDES_CNAME,
- sizeof ("test@foo.bar"), (guint8 *) "test@foo.bar") == TRUE);
-
- /* add some BYE */
- fail_unless (gst_rtcp_buffer_add_packet (buf, GST_RTCP_TYPE_BYE,
- &packet) == TRUE);
- fail_unless (gst_rtcp_packet_bye_add_ssrc (&packet, 0x5613212f) == TRUE);
- fail_unless (gst_rtcp_packet_bye_add_ssrc (&packet, 0x00112233) == TRUE);
- fail_unless (gst_rtcp_packet_bye_get_ssrc_count (&packet) == 2);
-
- fail_unless (gst_rtcp_packet_get_padding (&packet) == 0);
- fail_unless (gst_rtcp_packet_get_count (&packet) == 2);
- fail_unless (gst_rtcp_packet_get_type (&packet) == GST_RTCP_TYPE_BYE);
- fail_unless (gst_rtcp_packet_get_length (&packet) == 2);
-
- /* move to SDES */
- fail_unless (gst_rtcp_buffer_get_first_packet (buf, &packet) == TRUE);
- fail_unless (gst_rtcp_packet_move_to_next (&packet) == TRUE);
-
- fail_unless (gst_rtcp_packet_get_padding (&packet) == 0);
- fail_unless (gst_rtcp_packet_get_count (&packet) == 1);
- fail_unless (gst_rtcp_packet_get_type (&packet) == GST_RTCP_TYPE_SDES);
- fail_unless (gst_rtcp_packet_get_length (&packet) == 5);
-
- /* remove the SDES */
- fail_unless (gst_rtcp_packet_remove (&packet) == TRUE);
-
- /* we are now at the BYE packet */
- fail_unless (gst_rtcp_packet_get_padding (&packet) == 0);
- fail_unless (gst_rtcp_packet_get_count (&packet) == 2);
- fail_unless (gst_rtcp_packet_get_type (&packet) == GST_RTCP_TYPE_BYE);
- fail_unless (gst_rtcp_packet_get_length (&packet) == 2);
-
- /* close and validate */
- gst_rtcp_buffer_end (buf);
- fail_unless (gst_rtcp_buffer_validate (buf) == TRUE);
- gst_buffer_unref (buf);
-}
-
-GST_END_TEST;
-
-static Suite *
-rtp_suite (void)
-{
- Suite *s = suite_create ("rtp support library");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_rtp_buffer);
- tcase_add_test (tc_chain, test_rtp_buffer_validate_corrupt);
- tcase_add_test (tc_chain, test_rtp_buffer_set_extension_data);
- tcase_add_test (tc_chain, test_rtp_seqnum_compare);
-
- tcase_add_test (tc_chain, test_rtcp_buffer);
-
- tcase_add_test (tc_chain, test_rtp_buffer_list);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = rtp_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/libs/tag.c b/tests/check/libs/tag.c
deleted file mode 100644
index 292df929..00000000
--- a/tests/check/libs/tag.c
+++ /dev/null
@@ -1,783 +0,0 @@
-/* GStreamer
- *
- * unit tests for the tag support library
- *
- * Copyright (C) 2006-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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/check/gstcheck.h>
-
-#include <gst/tag/tag.h>
-#include <string.h>
-
-GST_START_TEST (test_parse_extended_comment)
-{
- gchar *key, *val, *lang;
-
- /* first check the g_return_val_if_fail conditions */
- ASSERT_CRITICAL (gst_tag_parse_extended_comment (NULL, NULL, NULL, NULL,
- FALSE));
- ASSERT_CRITICAL (gst_tag_parse_extended_comment ("\377\000", NULL, NULL, NULL,
- FALSE));
-
- key = val = lang = NULL;
- fail_unless (gst_tag_parse_extended_comment ("a=b", &key, &lang, &val,
- FALSE) == TRUE);
- fail_unless (key != NULL);
- fail_unless (lang == NULL);
- fail_unless (val != NULL);
- fail_unless_equals_string (key, "a");
- fail_unless_equals_string (val, "b");
- g_free (key);
- g_free (lang);
- g_free (val);
-
- key = val = lang = NULL;
- fail_unless (gst_tag_parse_extended_comment ("a[l]=b", &key, &lang, &val,
- FALSE) == TRUE);
- fail_unless (key != NULL);
- fail_unless (lang != NULL);
- fail_unless (val != NULL);
- fail_unless_equals_string (key, "a");
- fail_unless_equals_string (lang, "l");
- fail_unless_equals_string (val, "b");
- g_free (key);
- g_free (lang);
- g_free (val);
-
- key = val = lang = NULL;
- fail_unless (gst_tag_parse_extended_comment ("foo=bar", &key, &lang, &val,
- FALSE) == TRUE);
- fail_unless (key != NULL);
- fail_unless (lang == NULL);
- fail_unless (val != NULL);
- fail_unless_equals_string (key, "foo");
- fail_unless_equals_string (val, "bar");
- g_free (key);
- g_free (lang);
- g_free (val);
-
- key = val = lang = NULL;
- fail_unless (gst_tag_parse_extended_comment ("foo[fr]=bar", &key, &lang, &val,
- FALSE) == TRUE);
- fail_unless (key != NULL);
- fail_unless (lang != NULL);
- fail_unless (val != NULL);
- fail_unless_equals_string (key, "foo");
- fail_unless_equals_string (lang, "fr");
- fail_unless_equals_string (val, "bar");
- g_free (key);
- g_free (lang);
- g_free (val);
-
- key = val = lang = NULL;
- fail_unless (gst_tag_parse_extended_comment ("foo=[fr]bar", &key, &lang, &val,
- FALSE) == TRUE);
- fail_unless (key != NULL);
- fail_unless (lang == NULL);
- fail_unless (val != NULL);
- fail_unless_equals_string (key, "foo");
- fail_unless_equals_string (val, "[fr]bar");
- g_free (key);
- g_free (lang);
- g_free (val);
-
- /* test NULL for output locations */
- fail_unless (gst_tag_parse_extended_comment ("foo[fr]=bar", NULL, NULL, NULL,
- FALSE) == TRUE);
-
- /* test strict mode (key must be specified) */
- fail_unless (gst_tag_parse_extended_comment ("foo[fr]=bar", NULL, NULL, NULL,
- TRUE) == TRUE);
- fail_unless (gst_tag_parse_extended_comment ("foo=bar", NULL, NULL, NULL,
- TRUE) == TRUE);
- fail_unless (gst_tag_parse_extended_comment ("foobar", NULL, NULL, NULL,
- TRUE) == FALSE);
-
- /* test non-strict mode (if there's no key, that's fine too) */
- fail_unless (gst_tag_parse_extended_comment ("foobar", NULL, NULL, NULL,
- FALSE) == TRUE);
- fail_unless (gst_tag_parse_extended_comment ("[fr]bar", NULL, NULL, NULL,
- FALSE) == TRUE);
-
- key = val = lang = NULL;
- fail_unless (gst_tag_parse_extended_comment ("[fr]bar", &key, &lang, &val,
- FALSE) == TRUE);
- fail_unless (key == NULL);
- fail_unless (lang == NULL);
- fail_unless (val != NULL);
- fail_unless_equals_string (val, "[fr]bar");
- g_free (key);
- g_free (lang);
- g_free (val);
-}
-
-GST_END_TEST;
-
-#define ASSERT_TAG_LIST_HAS_STRING(list,field,string) \
- { \
- gboolean got_match = FALSE; \
- guint i, size; \
- \
- fail_unless (gst_tag_list_get_tag_size (list,field) > 0); \
- size = gst_tag_list_get_tag_size (list,field); \
- for (i = 0; i < size; ++i) { \
- gchar *___s = NULL; \
- \
- fail_unless (gst_tag_list_get_string_index (list, field, i, &___s)); \
- fail_unless (___s != NULL); \
- if (g_str_equal (___s, string)) { \
- got_match = TRUE; \
- g_free (___s); \
- break; \
- } \
- g_free (___s); \
- } \
- fail_unless (got_match); \
- }
-
-#define ASSERT_TAG_LIST_HAS_UINT(list,field,num) \
- { \
- guint ___n; \
- \
- fail_unless (gst_tag_list_get_tag_size (list,field) > 0); \
- fail_unless (gst_tag_list_get_tag_size (list,field) == 1); \
- fail_unless (gst_tag_list_get_uint_index (list, field, 0, &___n)); \
- fail_unless_equals_int (___n, num); \
- }
-
-#define MATCH_DOUBLE(p1, p2) ((p1 < p2 + 1e-6) && (p2 < p1 + 1e-6))
-#define ASSERT_TAG_LIST_HAS_DOUBLE(list,field,d) \
- { \
- gdouble ___d; \
- \
- fail_unless (gst_tag_list_get_tag_size (list,field) > 0); \
- fail_unless (gst_tag_list_get_tag_size (list,field) == 1); \
- fail_unless (gst_tag_list_get_double_index (list, field, 0, &___d)); \
- fail_unless (MATCH_DOUBLE (d, ___d), \
- "%f does not match expected %f", ___d, d); \
- }
-
-GST_START_TEST (test_muscibrainz_tag_registration)
-{
- GstTagList *list;
-
- gst_tag_register_musicbrainz_tags ();
-
- list = gst_tag_list_new ();
-
- /* musicbrainz tags aren't registered yet */
- gst_vorbis_tag_add (list, "MUSICBRAINZ_TRACKID", "123456");
- gst_vorbis_tag_add (list, "MUSICBRAINZ_ARTISTID", "234567");
- gst_vorbis_tag_add (list, "MUSICBRAINZ_ALBUMID", "345678");
- gst_vorbis_tag_add (list, "MUSICBRAINZ_ALBUMARTISTID", "4567890");
- gst_vorbis_tag_add (list, "MUSICBRAINZ_TRMID", "5678901");
- /* MUSICBRAINZ_SORTNAME = GST_TAG_ARTIST_SORTNAME now */
- gst_vorbis_tag_add (list, "MUSICBRAINZ_SORTNAME", "Five, 678901");
-
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_MUSICBRAINZ_TRACKID, "123456");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_MUSICBRAINZ_ARTISTID, "234567");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_MUSICBRAINZ_ALBUMID, "345678");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_MUSICBRAINZ_ALBUMARTISTID,
- "4567890");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_MUSICBRAINZ_TRMID, "5678901");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_ARTIST_SORTNAME, "Five, 678901");
-
- gst_tag_list_free (list);
-}
-
-GST_END_TEST;
-
-/* is there an easier way to compare two structures / tagslists? */
-static gboolean
-taglists_are_equal (const GstTagList * list_1, const GstTagList * list_2)
-{
- GstCaps *c_list_1 = gst_caps_new_empty ();
- GstCaps *c_list_2 = gst_caps_new_empty ();
- gboolean ret;
-
- gst_caps_append_structure (c_list_1,
- gst_structure_copy ((GstStructure *) list_1));
- gst_caps_append_structure (c_list_2,
- gst_structure_copy ((GstStructure *) list_2));
-
- ret = gst_caps_is_equal (c_list_2, c_list_1);
-
- gst_caps_unref (c_list_1);
- gst_caps_unref (c_list_2);
-
- return ret;
-}
-
-GST_START_TEST (test_vorbis_tags)
-{
- GstTagList *list;
-
- list = gst_tag_list_new ();
-
- /* NULL pointers aren't allowed */
- ASSERT_CRITICAL (gst_vorbis_tag_add (NULL, "key", "value"));
- ASSERT_CRITICAL (gst_vorbis_tag_add (list, NULL, "value"));
- ASSERT_CRITICAL (gst_vorbis_tag_add (list, "key", NULL));
-
- /* must be UTF-8 */
- ASSERT_CRITICAL (gst_vorbis_tag_add (list, "key", "v\377lue"));
- ASSERT_CRITICAL (gst_vorbis_tag_add (list, "k\377y", "value"));
-
- /* key can't have a '=' in it */
- ASSERT_CRITICAL (gst_vorbis_tag_add (list, "k=y", "value"));
- ASSERT_CRITICAL (gst_vorbis_tag_add (list, "key=", "value"));
-
- /* should be allowed in values though */
- gst_vorbis_tag_add (list, "keeey", "va=ue");
-
- /* add some tags */
- gst_vorbis_tag_add (list, "TITLE", "Too");
- gst_vorbis_tag_add (list, "ALBUM", "Aoo");
- gst_vorbis_tag_add (list, "ARTIST", "Alboo");
- gst_vorbis_tag_add (list, "PERFORMER", "Perfoo");
- gst_vorbis_tag_add (list, "COPYRIGHT", "Copyfoo");
- gst_vorbis_tag_add (list, "DESCRIPTION", "Descoo");
- gst_vorbis_tag_add (list, "LICENSE", "Licoo");
- gst_vorbis_tag_add (list, "LICENSE",
- "http://creativecommons.org/licenses/by/3.0/");
- gst_vorbis_tag_add (list, "LOCATION", "Bristol, UK");
- gst_vorbis_tag_add (list, "ORGANIZATION", "Orgoo");
- gst_vorbis_tag_add (list, "GENRE", "Goo");
- gst_vorbis_tag_add (list, "CONTACT", "Coo");
- gst_vorbis_tag_add (list, "COMMENT", "Stroodle is good");
- gst_vorbis_tag_add (list, "COMMENT", "Peroxysulfid stroodles the brain");
-
- gst_vorbis_tag_add (list, "TRACKNUMBER", "5");
- gst_vorbis_tag_add (list, "TRACKTOTAL", "77");
- gst_vorbis_tag_add (list, "DISCNUMBER", "1");
- gst_vorbis_tag_add (list, "DISCTOTAL", "2");
- gst_vorbis_tag_add (list, "DATE", "1954-12-31");
-
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_TITLE, "Too");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_ALBUM, "Aoo");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_ARTIST, "Alboo");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_PERFORMER, "Perfoo");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_COPYRIGHT, "Copyfoo");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_DESCRIPTION, "Descoo");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LICENSE, "Licoo");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LICENSE_URI,
- "http://creativecommons.org/licenses/by/3.0/");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_GEO_LOCATION_NAME, "Bristol, UK");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_ORGANIZATION, "Orgoo");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_GENRE, "Goo");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_CONTACT, "Coo");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_COMMENT,
- "Peroxysulfid stroodles the brain");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_COMMENT, "Stroodle is good");
- ASSERT_TAG_LIST_HAS_UINT (list, GST_TAG_TRACK_NUMBER, 5);
- ASSERT_TAG_LIST_HAS_UINT (list, GST_TAG_TRACK_COUNT, 77);
- ASSERT_TAG_LIST_HAS_UINT (list, GST_TAG_ALBUM_VOLUME_NUMBER, 1);
- ASSERT_TAG_LIST_HAS_UINT (list, GST_TAG_ALBUM_VOLUME_COUNT, 2);
-
- {
- GDate *date = NULL;
-
- fail_unless (gst_tag_list_get_date (list, GST_TAG_DATE, &date));
- fail_unless (date != NULL);
- fail_unless (g_date_get_day (date) == 31);
- fail_unless (g_date_get_month (date) == G_DATE_DECEMBER);
- fail_unless (g_date_get_year (date) == 1954);
-
- g_date_free (date);
- }
-
- /* unknown vorbis comments should go into a GST_TAG_EXTENDED_COMMENT */
- gst_vorbis_tag_add (list, "CoEdSub_ID", "98172AF-973-10-B");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_EXTENDED_COMMENT,
- "CoEdSub_ID=98172AF-973-10-B");
- gst_vorbis_tag_add (list, "RuBuWuHash", "1337BA42F91");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_EXTENDED_COMMENT,
- "RuBuWuHash=1337BA42F91");
-
- gst_vorbis_tag_add (list, "REPLAYGAIN_REFERENCE_LOUDNESS", "89.");
- ASSERT_TAG_LIST_HAS_DOUBLE (list, GST_TAG_REFERENCE_LEVEL, 89.);
- gst_vorbis_tag_add (list, "REPLAYGAIN_TRACK_GAIN", "+12.36");
- ASSERT_TAG_LIST_HAS_DOUBLE (list, GST_TAG_TRACK_GAIN, +12.36);
- gst_vorbis_tag_add (list, "REPLAYGAIN_TRACK_PEAK", "0.96349");
- ASSERT_TAG_LIST_HAS_DOUBLE (list, GST_TAG_TRACK_PEAK, 0.96349);
- gst_vorbis_tag_add (list, "REPLAYGAIN_ALBUM_GAIN", "+10.12");
- ASSERT_TAG_LIST_HAS_DOUBLE (list, GST_TAG_ALBUM_GAIN, +10.12);
- /* now check that we can parse floating point numbers with any separator
- * (',' or '.') regardless of the current locale */
- gst_vorbis_tag_add (list, "REPLAYGAIN_ALBUM_PEAK", "0,98107");
- ASSERT_TAG_LIST_HAS_DOUBLE (list, GST_TAG_ALBUM_PEAK, 0.98107);
- gst_vorbis_tag_add (list, "LICENSE", "http://foo.com/license-1.html");
-
- /* make sure we can convert back and forth without loss */
- {
- GstTagList *new_list, *even_newer_list;
- GstBuffer *buf, *buf2;
- gchar *vendor_id = NULL;
-
- buf = gst_tag_list_to_vorbiscomment_buffer (list,
- (const guint8 *) "\003vorbis", 7, "libgstunittest");
- fail_unless (buf != NULL);
- new_list = gst_tag_list_from_vorbiscomment_buffer (buf,
- (const guint8 *) "\003vorbis", 7, &vendor_id);
- fail_unless (new_list != NULL);
- fail_unless (vendor_id != NULL);
- g_free (vendor_id);
- vendor_id = NULL;
-
- GST_LOG ("new_list = %" GST_PTR_FORMAT, new_list);
- fail_unless (taglists_are_equal (list, new_list));
-
- buf2 = gst_tag_list_to_vorbiscomment_buffer (new_list,
- (const guint8 *) "\003vorbis", 7, "libgstunittest");
- fail_unless (buf2 != NULL);
- even_newer_list = gst_tag_list_from_vorbiscomment_buffer (buf2,
- (const guint8 *) "\003vorbis", 7, &vendor_id);
- fail_unless (even_newer_list != NULL);
- fail_unless (vendor_id != NULL);
- g_free (vendor_id);
- vendor_id = NULL;
-
- GST_LOG ("even_newer_list = %" GST_PTR_FORMAT, even_newer_list);
- fail_unless (taglists_are_equal (new_list, even_newer_list));
-
- gst_tag_list_free (new_list);
- gst_tag_list_free (even_newer_list);
- gst_buffer_unref (buf);
- gst_buffer_unref (buf2);
- }
-
- /* there can only be one language per taglist ... */
- gst_tag_list_free (list);
- list = gst_tag_list_new ();
- gst_vorbis_tag_add (list, "LANGUAGE", "fr");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LANGUAGE_CODE, "fr");
-
- gst_tag_list_free (list);
- list = gst_tag_list_new ();
- gst_vorbis_tag_add (list, "LANGUAGE", "[fr]");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LANGUAGE_CODE, "fr");
-
- gst_tag_list_free (list);
- list = gst_tag_list_new ();
- gst_vorbis_tag_add (list, "LANGUAGE", "French [fr]");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LANGUAGE_CODE, "fr");
-
- gst_tag_list_free (list);
- list = gst_tag_list_new ();
- gst_vorbis_tag_add (list, "LANGUAGE", "[eng] English");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LANGUAGE_CODE, "eng");
-
- gst_tag_list_free (list);
- list = gst_tag_list_new ();
- gst_vorbis_tag_add (list, "LANGUAGE", "eng");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LANGUAGE_CODE, "eng");
-
- gst_tag_list_free (list);
- list = gst_tag_list_new ();
- gst_vorbis_tag_add (list, "LANGUAGE", "[eng]");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LANGUAGE_CODE, "eng");
-
- /* free-form *sigh* */
- gst_tag_list_free (list);
- list = gst_tag_list_new ();
- gst_vorbis_tag_add (list, "LANGUAGE", "English");
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LANGUAGE_CODE, "English");
-
- /* now, while we still have a taglist, test _to_vorbiscomment_buffer() */
- {
- GstBuffer *buf1, *buf2;
-
- ASSERT_CRITICAL (gst_tag_list_to_vorbiscomment_buffer (NULL,
- (const guint8 *) "x", 1, "x"));
-
- buf1 = gst_tag_list_to_vorbiscomment_buffer (list, NULL, 0, NULL);
- fail_unless (buf1 != NULL);
-
- buf2 = gst_tag_list_to_vorbiscomment_buffer (list,
- (const guint8 *) "foo", 3, NULL);
- fail_unless (buf2 != NULL);
-
- fail_unless (memcmp (GST_BUFFER_DATA (buf1), GST_BUFFER_DATA (buf2) + 3,
- GST_BUFFER_SIZE (buf1)) == 0);
-
- gst_buffer_unref (buf1);
- gst_buffer_unref (buf2);
- }
-
- gst_tag_list_free (list);
-
- /* make sure gst_tag_list_from_vorbiscomment_buffer() works with an
- * empty ID (for Speex) */
- {
- const guint8 speex_comments_buf1[] = { 0x03, 0x00, 0x00, 0x00, 'f', 'o',
- 'o', 0x00, 0x00, 0x00, 0x00
- };
- GstBuffer *buf;
- gchar *vendor = NULL;
-
- buf = gst_buffer_new ();
- GST_BUFFER_DATA (buf) = (guint8 *) speex_comments_buf1;
- GST_BUFFER_SIZE (buf) = sizeof (speex_comments_buf1);
-
- /* make sure it doesn't memcmp over the end of the buffer */
- fail_unless (gst_tag_list_from_vorbiscomment_buffer (buf,
- (const guint8 *) "averylongstringbrownfoxjumpoverthefence", 39,
- &vendor) == NULL);
- fail_unless (vendor == NULL);
-
- /* make sure it bails out if the ID doesn't match */
- fail_unless (gst_tag_list_from_vorbiscomment_buffer (buf,
- (guint8 *) "short", 4, &vendor) == NULL);
- fail_unless (vendor == NULL);
-
- /* now read properly */
- list = gst_tag_list_from_vorbiscomment_buffer (buf, NULL, 0, &vendor);
- fail_unless (vendor != NULL);
- fail_unless_equals_string (vendor, "foo");
- fail_unless (list != NULL);
- fail_unless (gst_structure_n_fields ((GstStructure *) list) == 0);
- g_free (vendor);
- gst_tag_list_free (list);
-
- /* now again without vendor */
- list = gst_tag_list_from_vorbiscomment_buffer (buf, NULL, 0, NULL);
- fail_unless (list != NULL);
- fail_unless (gst_structure_n_fields ((GstStructure *) list) == 0);
- gst_tag_list_free (list);
-
- gst_buffer_unref (buf);
- }
-
- /* the same with an ID */
- {
- const guint8 vorbis_comments_buf[] = { 0x03, 'v', 'o', 'r', 'b', 'i', 's',
- 0x03, 0x00, 0x00, 0x00, 'f', 'o', 'o', 0x01, 0x00, 0x00, 0x00,
- strlen ("ARTIST=foo bar"), 0x00, 0x00, 0x00, 'A', 'R', 'T', 'I', 'S',
- 'T', '=', 'f', 'o', 'o', ' ', 'b', 'a', 'r'
- };
- GstBuffer *buf;
- gchar *vendor = NULL;
-
- buf = gst_buffer_new ();
- GST_BUFFER_DATA (buf) = (guint8 *) vorbis_comments_buf;
- GST_BUFFER_SIZE (buf) = sizeof (vorbis_comments_buf);
-
- /* make sure it doesn't memcmp over the end of the buffer */
- fail_unless (gst_tag_list_from_vorbiscomment_buffer (buf,
- (const guint8 *) "averylongstringbrownfoxjumpoverthefence", 39,
- &vendor) == NULL);
- fail_unless (vendor == NULL);
-
- /* make sure it bails out if the ID doesn't match */
- fail_unless (gst_tag_list_from_vorbiscomment_buffer (buf,
- (guint8 *) "short", 4, &vendor) == NULL);
- fail_unless (vendor == NULL);
-
- /* now read properly */
- list = gst_tag_list_from_vorbiscomment_buffer (buf,
- (guint8 *) "\003vorbis", 7, &vendor);
- fail_unless (vendor != NULL);
- fail_unless_equals_string (vendor, "foo");
- fail_unless (list != NULL);
- fail_unless (gst_structure_n_fields ((GstStructure *) list) == 1);
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_ARTIST, "foo bar");
- g_free (vendor);
- gst_tag_list_free (list);
-
- /* now again without vendor */
- list = gst_tag_list_from_vorbiscomment_buffer (buf,
- (guint8 *) "\003vorbis", 7, NULL);
- fail_unless (list != NULL);
- fail_unless (gst_structure_n_fields ((GstStructure *) list) == 1);
- ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_ARTIST, "foo bar");
- gst_tag_list_free (list);
-
- gst_buffer_unref (buf);
- }
-
- /* check date with time */
- {
- GDate *date = NULL;
-
- list = gst_tag_list_new ();
- gst_vorbis_tag_add (list, "DATE", "2006-09-25 22:02:38");
-
- fail_unless (gst_tag_list_get_date_index (list, GST_TAG_DATE, 0, &date));
- fail_unless (date != NULL);
- fail_unless (g_date_get_day (date) == 25);
- fail_unless (g_date_get_month (date) == G_DATE_SEPTEMBER);
- fail_unless (g_date_get_year (date) == 2006);
-
- g_date_free (date);
- gst_tag_list_free (list);
- }
-
- /* check date with month/day of 00-00 */
- {
- GDate *date = NULL;
-
- list = gst_tag_list_new ();
- gst_vorbis_tag_add (list, "DATE", "1992-00-00");
-
- fail_unless (gst_tag_list_get_date_index (list, GST_TAG_DATE, 0, &date));
- fail_unless (date != NULL);
- fail_unless (g_date_get_year (date) == 1992);
-
- g_date_free (date);
- gst_tag_list_free (list);
- }
-
- /* check date with valid month, but day of 00 */
- {
- GDate *date = NULL;
-
- list = gst_tag_list_new ();
- gst_vorbis_tag_add (list, "DATE", "1992-05-00");
-
- fail_unless (gst_tag_list_get_date_index (list, GST_TAG_DATE, 0, &date));
- fail_unless (date != NULL);
- fail_unless (g_date_get_year (date) == 1992);
- fail_unless (g_date_get_month (date) == G_DATE_MAY);
-
- g_date_free (date);
- gst_tag_list_free (list);
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_id3_tags)
-{
- guint i;
-
- fail_unless (gst_tag_id3_genre_count () > 0);
-
- for (i = 0; i < gst_tag_id3_genre_count (); ++i) {
- const gchar *genre;
-
- genre = gst_tag_id3_genre_get (i);
- fail_unless (genre != NULL);
- }
-
- {
- /* TODO: GstTagList *gst_tag_list_new_from_id3v1 (const guint8 *data) */
- }
-
- /* gst_tag_from_id3_tag */
- fail_unless (gst_tag_from_id3_tag ("TALB") != NULL);
- ASSERT_CRITICAL (gst_tag_from_id3_tag (NULL));
- fail_unless (gst_tag_from_id3_tag ("R2D2") == NULL);
- fail_unless_equals_string (gst_tag_from_id3_tag ("WCOP"),
- GST_TAG_COPYRIGHT_URI);
-
- /* gst_tag_from_id3_user_tag */
- ASSERT_CRITICAL (gst_tag_from_id3_user_tag (NULL, "foo"));
- ASSERT_CRITICAL (gst_tag_from_id3_user_tag ("foo", NULL));
- fail_unless (gst_tag_from_id3_user_tag ("R2D2", "R2D2") == NULL);
-
- /* gst_tag_to_id3_tag */
- ASSERT_CRITICAL (gst_tag_to_id3_tag (NULL));
- fail_unless (gst_tag_to_id3_tag ("R2D2") == NULL);
- fail_unless (gst_tag_to_id3_tag (GST_TAG_ARTIST) != NULL);
- fail_unless_equals_string (gst_tag_to_id3_tag (GST_TAG_COPYRIGHT_URI),
- "WCOP");
-
- fail_unless (GST_TYPE_TAG_IMAGE_TYPE != 0);
- fail_unless (g_type_name (GST_TYPE_TAG_IMAGE_TYPE) != NULL);
-}
-
-GST_END_TEST;
-
-
-GST_START_TEST (test_id3v1_utf8_tag)
-{
- const guint8 id3v1[128] = {
- /* marker */
- 'T', 'A', 'G',
- /* title (30 bytes) */
- 'D', 0xc3, 0xad, 'v', 'k', 'a', ' ', 's',
- ' ', 'p', 'e', 'r', 'l', 'a', 'm', 'i',
- ' ', 'v', 'e', ' ', 'v', 'l', 'a', 's',
- 'e', 'c', 'h', 0, 0, 0,
- /* artist (30 bytes) */
- 'A', 'l', 'e', 0xc5, 0xa1, ' ', 'B', 'r', 'i', 'c', 'h', 't', 'a',
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- /* album (30 bytes) */
- 'B', 'e', 's', 't', ' ', 'o', 'f', ' ', '(', 'P', 'r', 'o', 's', 't',
- 0xc4, 0x9b, ' ', 0xc3, 0xba, 0xc5, 0xbe, 'a', 's', 'n', 0xc3, 0xbd, ')',
- 0, 0, 0,
- /* year (4 bytes) */
- '2', '0', '0', '0',
- /* comment (28 bytes) */
- '-', '-', '-', ' ', 0xc4, 0x8d, 'e', 's', 'k', 0xc3, 0xa9, ' ', 'p',
- 0xc3, 0xad, 's', 'n', 'i', 0xc4, 0x8d, 'k', 'y', ' ', '-', '-', '-',
- 0, 0,
- /* track number */
- 0, 0,
- /* genre */
- 0x11
- };
- GstTagList *tags;
- GDate *d;
- gchar *s;
-
- /* set this, to make sure UTF-8 strings are really interpreted properly
- * as UTF-8, regardless of the locale set */
- g_setenv ("GST_ID3V1_TAG_ENCODING", "WINDOWS-1250", TRUE);
-
- tags = gst_tag_list_new_from_id3v1 (id3v1);
- fail_unless (tags != NULL);
-
- GST_LOG ("Got tags: %" GST_PTR_FORMAT, tags);
-
- s = NULL;
- fail_unless (gst_tag_list_get_string (tags, GST_TAG_TITLE, &s));
- fail_unless (s != NULL);
- fail_unless_equals_string (s, "Dívka s perlami ve vlasech");
- g_free (s);
-
- s = NULL;
- fail_unless (gst_tag_list_get_string (tags, GST_TAG_ARTIST, &s));
- fail_unless (s != NULL);
- fail_unless_equals_string (s, "Aleš Brichta");
- g_free (s);
-
- s = NULL;
- fail_unless (gst_tag_list_get_string (tags, GST_TAG_ALBUM, &s));
- fail_unless (s != NULL);
- fail_unless_equals_string (s, "Best of (Prostě úžasný)");
- g_free (s);
-
- d = NULL;
- fail_unless (gst_tag_list_get_date (tags, GST_TAG_DATE, &d));
- fail_unless (d != NULL);
- fail_unless_equals_int (g_date_get_year (d), 2000);
- g_date_free (d);
- d = NULL;
-
- gst_tag_list_free (tags);
-
- g_unsetenv ("GST_ID3V1_TAG_ENCODING");
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_language_utils)
-{
- gchar **lang_codes, **c;
-
-#define ASSERT_STRINGS_EQUAL fail_unless_equals_string
-
- lang_codes = gst_tag_get_language_codes ();
- fail_unless (lang_codes != NULL);
- fail_unless (*lang_codes != NULL);
-
- for (c = lang_codes; c != NULL && *c != NULL; ++c) {
- const gchar *lang_name, *c1, *c2t, *c2b;
-
- lang_name = gst_tag_get_language_name (*c);
- fail_unless (lang_name != NULL);
- fail_unless (g_utf8_validate (lang_name, -1, NULL));
-
- c1 = gst_tag_get_language_code_iso_639_1 (*c);
- fail_unless (c1 != NULL);
- fail_unless (g_utf8_validate (c1, -1, NULL));
-
- c2t = gst_tag_get_language_code_iso_639_2T (*c);
- fail_unless (c2t != NULL);
- fail_unless (g_utf8_validate (c2t, -1, NULL));
-
- c2b = gst_tag_get_language_code_iso_639_2B (*c);
- fail_unless (c2b != NULL);
- fail_unless (g_utf8_validate (c2b, -1, NULL));
-
- ASSERT_STRINGS_EQUAL (gst_tag_get_language_code_iso_639_1 (*c), *c);
- ASSERT_STRINGS_EQUAL (gst_tag_get_language_code_iso_639_1 (c2t), *c);
- ASSERT_STRINGS_EQUAL (gst_tag_get_language_code_iso_639_1 (c2b), *c);
-
- GST_DEBUG ("[%s] %s %s %s : %s\n", *c, c1, c2t, c2b, lang_name);
-
- }
- g_strfreev (lang_codes);
-
- fail_unless (gst_tag_get_language_name ("de") != NULL);
- fail_unless (gst_tag_get_language_name ("deu") != NULL);
- fail_unless (gst_tag_get_language_name ("ger") != NULL);
- fail_unless_equals_string (gst_tag_get_language_name ("deu"),
- gst_tag_get_language_name ("ger"));
- fail_unless_equals_string (gst_tag_get_language_name ("de"),
- gst_tag_get_language_name ("ger"));
- fail_unless (gst_tag_get_language_name ("de") !=
- gst_tag_get_language_name ("fr"));
-
- ASSERT_STRINGS_EQUAL (gst_tag_get_language_code ("deu"), "de");
- ASSERT_STRINGS_EQUAL (gst_tag_get_language_code ("de"), "de");
- ASSERT_STRINGS_EQUAL (gst_tag_get_language_code ("ger"), "de");
-
- ASSERT_STRINGS_EQUAL (gst_tag_get_language_code_iso_639_1 ("deu"), "de");
- ASSERT_STRINGS_EQUAL (gst_tag_get_language_code_iso_639_1 ("de"), "de");
- ASSERT_STRINGS_EQUAL (gst_tag_get_language_code_iso_639_1 ("ger"), "de");
-
- ASSERT_STRINGS_EQUAL (gst_tag_get_language_code_iso_639_2T ("de"), "deu");
- ASSERT_STRINGS_EQUAL (gst_tag_get_language_code_iso_639_2T ("deu"), "deu");
- ASSERT_STRINGS_EQUAL (gst_tag_get_language_code_iso_639_2T ("ger"), "deu");
-
- ASSERT_STRINGS_EQUAL (gst_tag_get_language_code_iso_639_2B ("de"), "ger");
- ASSERT_STRINGS_EQUAL (gst_tag_get_language_code_iso_639_2B ("deu"), "ger");
- ASSERT_STRINGS_EQUAL (gst_tag_get_language_code_iso_639_2B ("ger"), "ger");
-}
-
-GST_END_TEST;
-
-static Suite *
-tag_suite (void)
-{
- Suite *s = suite_create ("tag support library");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_muscibrainz_tag_registration);
- tcase_add_test (tc_chain, test_parse_extended_comment);
- tcase_add_test (tc_chain, test_vorbis_tags);
- tcase_add_test (tc_chain, test_id3_tags);
- tcase_add_test (tc_chain, test_id3v1_utf8_tag);
- tcase_add_test (tc_chain, test_language_utils);
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = tag_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/libs/video.c b/tests/check/libs/video.c
deleted file mode 100644
index 56e9f5f7..00000000
--- a/tests/check/libs/video.c
+++ /dev/null
@@ -1,598 +0,0 @@
-/* GStreamer unit test for video
- *
- * Copyright (C) <2003> David A. Schleef <ds@schleef.org>
- * Copyright (C) <2006> Jan Schmidt <thaytan@mad.scientist.com>
- * Copyright (C) <2008> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-
-#include <gst/video/video.h>
-#include <string.h>
-
-/* These are from the current/old videotestsrc; we check our new public API
- * in libgstvideo against the old one to make sure the sizes and offsets
- * end up the same */
-
-typedef struct paintinfo_struct paintinfo;
-struct paintinfo_struct
-{
- unsigned char *dest; /* pointer to first byte of video data */
- unsigned char *yp, *up, *vp; /* pointers to first byte of each component
- * for both packed/planar YUV and RGB */
- unsigned char *ap; /* pointer to first byte of alpha component */
- unsigned char *endptr; /* pointer to byte beyond last video data */
- int ystride;
- int ustride;
- int vstride;
- int width;
- int height;
-};
-
-struct fourcc_list_struct
-{
- char *fourcc;
- char *name;
- int bitspp;
- void (*paint_setup) (paintinfo * p, unsigned char *dest);
-};
-
-static void paint_setup_I420 (paintinfo * p, unsigned char *dest);
-static void paint_setup_YV12 (paintinfo * p, unsigned char *dest);
-static void paint_setup_YUY2 (paintinfo * p, unsigned char *dest);
-static void paint_setup_UYVY (paintinfo * p, unsigned char *dest);
-static void paint_setup_YVYU (paintinfo * p, unsigned char *dest);
-static void paint_setup_IYU2 (paintinfo * p, unsigned char *dest);
-static void paint_setup_Y41B (paintinfo * p, unsigned char *dest);
-static void paint_setup_Y42B (paintinfo * p, unsigned char *dest);
-static void paint_setup_Y800 (paintinfo * p, unsigned char *dest);
-static void paint_setup_AYUV (paintinfo * p, unsigned char *dest);
-
-#if 0
-static void paint_setup_IMC1 (paintinfo * p, unsigned char *dest);
-static void paint_setup_IMC2 (paintinfo * p, unsigned char *dest);
-static void paint_setup_IMC3 (paintinfo * p, unsigned char *dest);
-static void paint_setup_IMC4 (paintinfo * p, unsigned char *dest);
-#endif
-static void paint_setup_YUV9 (paintinfo * p, unsigned char *dest);
-static void paint_setup_YVU9 (paintinfo * p, unsigned char *dest);
-
-int fourcc_get_size (struct fourcc_list_struct *fourcc, int w, int h);
-
-struct fourcc_list_struct fourcc_list[] = {
-/* packed */
- {"YUY2", "YUY2", 16, paint_setup_YUY2},
- {"UYVY", "UYVY", 16, paint_setup_UYVY},
- {"Y422", "Y422", 16, paint_setup_UYVY},
- {"UYNV", "UYNV", 16, paint_setup_UYVY}, /* FIXME: UYNV? */
- {"YVYU", "YVYU", 16, paint_setup_YVYU},
- {"AYUV", "AYUV", 32, paint_setup_AYUV},
-
- /* interlaced */
- /*{ "IUYV", "IUY2", 16, paint_setup_YVYU }, */
-
- /* inverted */
- /*{ "cyuv", "cyuv", 16, paint_setup_YVYU }, */
-
- /*{ "Y41P", "Y41P", 12, paint_setup_YVYU }, */
-
- /* interlaced */
- /*{ "IY41", "IY41", 12, paint_setup_YVYU }, */
-
- /*{ "Y211", "Y211", 8, paint_setup_YVYU }, */
-
- /*{ "Y41T", "Y41T", 12, paint_setup_YVYU }, */
- /*{ "Y42P", "Y42P", 16, paint_setup_YVYU }, */
- /*{ "CLJR", "CLJR", 8, paint_setup_YVYU }, */
- /*{ "IYU1", "IYU1", 12, paint_setup_YVYU }, */
- {"IYU2", "IYU2", 24, paint_setup_IYU2},
-
-/* planar */
- /* YVU9 */
- {"YVU9", "YVU9", 9, paint_setup_YVU9},
- /* YUV9 */
- {"YUV9", "YUV9", 9, paint_setup_YUV9},
- /* IF09 */
- /* YV12 */
- {"YV12", "YV12", 12, paint_setup_YV12},
- /* I420 */
- {"I420", "I420", 12, paint_setup_I420},
- /* NV12 */
- /* NV21 */
-#if 0
- /* IMC1 */
- {"IMC1", "IMC1", 16, paint_setup_IMC1},
- /* IMC2 */
- {"IMC2", "IMC2", 12, paint_setup_IMC2},
- /* IMC3 */
- {"IMC3", "IMC3", 16, paint_setup_IMC3},
- /* IMC4 */
- {"IMC4", "IMC4", 12, paint_setup_IMC4},
-#endif
- /* CLPL */
- /* Y41B */
- {"Y41B", "Y41B", 12, paint_setup_Y41B},
- /* Y42B */
- {"Y42B", "Y42B", 16, paint_setup_Y42B},
- /* Y800 grayscale */
- {"Y800", "Y800", 8, paint_setup_Y800}
-};
-
-/* returns the size in bytes for one video frame of the given dimensions
- * given the fourcc */
-int
-fourcc_get_size (struct fourcc_list_struct *fourcc, int w, int h)
-{
- paintinfo pi = { NULL, };
- paintinfo *p = &pi;
-
- p->width = w;
- p->height = h;
-
- fourcc->paint_setup (p, NULL);
-
- return (unsigned long) p->endptr;
-}
-
-static void
-paint_setup_I420 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
- p->ustride = GST_ROUND_UP_8 (p->width) / 2;
- p->vp = p->up + p->ustride * GST_ROUND_UP_2 (p->height) / 2;
- p->vstride = GST_ROUND_UP_8 (p->ystride) / 2;
- p->endptr = p->vp + p->vstride * GST_ROUND_UP_2 (p->height) / 2;
-}
-
-static void
-paint_setup_YV12 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->vp = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
- p->vstride = GST_ROUND_UP_8 (p->ystride) / 2;
- p->up = p->vp + p->vstride * GST_ROUND_UP_2 (p->height) / 2;
- p->ustride = GST_ROUND_UP_8 (p->ystride) / 2;
- p->endptr = p->up + p->ustride * GST_ROUND_UP_2 (p->height) / 2;
-}
-
-static void
-paint_setup_AYUV (paintinfo * p, unsigned char *dest)
-{
- p->ap = dest;
- p->yp = dest + 1;
- p->up = dest + 2;
- p->vp = dest + 3;
- p->ystride = p->width * 4;
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_YUY2 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->up = dest + 1;
- p->vp = dest + 3;
- p->ystride = GST_ROUND_UP_2 (p->width) * 2;
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_UYVY (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest + 1;
- p->up = dest;
- p->vp = dest + 2;
- p->ystride = GST_ROUND_UP_2 (p->width) * 2;
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_YVYU (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->up = dest + 3;
- p->vp = dest + 1;
- p->ystride = GST_ROUND_UP_2 (p->width) * 2;
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_IYU2 (paintinfo * p, unsigned char *dest)
-{
- /* untested */
- p->yp = dest + 1;
- p->up = dest + 0;
- p->vp = dest + 2;
- p->ystride = GST_ROUND_UP_4 (p->width * 3);
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_Y41B (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * p->height;
- p->ustride = GST_ROUND_UP_16 (p->width) / 4;
- p->vp = p->up + p->ustride * p->height;
- p->vstride = GST_ROUND_UP_16 (p->width) / 4;
- p->endptr = p->vp + p->vstride * p->height;
-}
-
-static void
-paint_setup_Y42B (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * p->height;
- p->ustride = GST_ROUND_UP_8 (p->width) / 2;
- p->vp = p->up + p->ustride * p->height;
- p->vstride = GST_ROUND_UP_8 (p->width) / 2;
- p->endptr = p->vp + p->vstride * p->height;
-}
-
-static void
-paint_setup_Y800 (paintinfo * p, unsigned char *dest)
-{
- /* untested */
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->endptr = dest + p->ystride * p->height;
-}
-
-#if 0
-static void
-paint_setup_IMC1 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->up = dest + p->width * p->height;
- p->vp = dest + p->width * p->height + p->width * p->height / 2;
-}
-
-static void
-paint_setup_IMC2 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->vp = dest + p->width * p->height;
- p->up = dest + p->width * p->height + p->width / 2;
-}
-
-static void
-paint_setup_IMC3 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->up = dest + p->width * p->height + p->width * p->height / 2;
- p->vp = dest + p->width * p->height;
-}
-
-static void
-paint_setup_IMC4 (paintinfo * p, unsigned char *dest)
-{
- p->yp = dest;
- p->vp = dest + p->width * p->height + p->width / 2;
- p->up = dest + p->width * p->height;
-}
-#endif
-
-static void
-paint_setup_YVU9 (paintinfo * p, unsigned char *dest)
-{
- int h = GST_ROUND_UP_4 (p->height);
-
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->vp = p->yp + p->ystride * GST_ROUND_UP_4 (p->height);
- p->vstride = GST_ROUND_UP_4 (p->ystride / 4);
- p->up = p->vp + p->vstride * GST_ROUND_UP_4 (h / 4);
- p->ustride = GST_ROUND_UP_4 (p->ystride / 4);
- p->endptr = p->up + p->ustride * GST_ROUND_UP_4 (h / 4);
-}
-
-static void
-paint_setup_YUV9 (paintinfo * p, unsigned char *dest)
-{
- /* untested */
- int h = GST_ROUND_UP_4 (p->height);
-
- p->yp = dest;
- p->ystride = GST_ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * h;
- p->ustride = GST_ROUND_UP_4 (p->ystride / 4);
- p->vp = p->up + p->ustride * GST_ROUND_UP_4 (h / 4);
- p->vstride = GST_ROUND_UP_4 (p->ystride / 4);
- p->endptr = p->vp + p->vstride * GST_ROUND_UP_4 (h / 4);
-}
-
-#define gst_video_format_is_packed video_format_is_packed
-static gboolean
-video_format_is_packed (GstVideoFormat fmt)
-{
- switch (fmt) {
- case GST_VIDEO_FORMAT_I420:
- case GST_VIDEO_FORMAT_YV12:
- case GST_VIDEO_FORMAT_Y41B:
- case GST_VIDEO_FORMAT_Y42B:
- return FALSE;
- case GST_VIDEO_FORMAT_YUY2:
- case GST_VIDEO_FORMAT_YVYU:
- case GST_VIDEO_FORMAT_UYVY:
- case GST_VIDEO_FORMAT_AYUV:
- case GST_VIDEO_FORMAT_RGBx:
- case GST_VIDEO_FORMAT_BGRx:
- case GST_VIDEO_FORMAT_xRGB:
- case GST_VIDEO_FORMAT_xBGR:
- case GST_VIDEO_FORMAT_RGBA:
- case GST_VIDEO_FORMAT_BGRA:
- case GST_VIDEO_FORMAT_ARGB:
- case GST_VIDEO_FORMAT_ABGR:
- case GST_VIDEO_FORMAT_RGB:
- case GST_VIDEO_FORMAT_BGR:
- return TRUE;
- default:
- g_return_val_if_reached (FALSE);
- }
- return FALSE;
-}
-
-GST_START_TEST (test_video_formats)
-{
- guint i;
-
- for (i = 0; i < G_N_ELEMENTS (fourcc_list); ++i) {
- GstVideoFormat fmt;
- const gchar *s;
- guint32 fourcc;
- guint w, h;
-
- s = fourcc_list[i].fourcc;
- fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]);
- fmt = gst_video_format_from_fourcc (fourcc);
-
- if (fmt == GST_VIDEO_FORMAT_UNKNOWN)
- continue;
-
- GST_INFO ("Fourcc %s, packed=%d", fourcc_list[i].fourcc,
- gst_video_format_is_packed (fmt));
-
- fail_unless (gst_video_format_is_yuv (fmt));
-
- /* use any non-NULL pointer so we can compare against NULL */
- {
- paintinfo paintinfo = { 0, };
- fourcc_list[i].paint_setup (&paintinfo, (unsigned char *) s);
- if (paintinfo.ap != NULL) {
- fail_unless (gst_video_format_has_alpha (fmt));
- } else {
- fail_if (gst_video_format_has_alpha (fmt));
- }
- }
-
- for (w = 1; w <= 65; ++w) {
- for (h = 1; h <= 65; ++h) {
- paintinfo paintinfo = { 0, };
- guint off0, off1, off2, off3;
- guint size;
-
- GST_LOG ("%s, %dx%d", fourcc_list[i].fourcc, w, h);
-
- paintinfo.width = w;
- paintinfo.height = h;
- fourcc_list[i].paint_setup (&paintinfo, NULL);
- fail_unless_equals_int (gst_video_format_get_row_stride (fmt, 0, w),
- paintinfo.ystride);
- if (!gst_video_format_is_packed (fmt)) {
- /* planar */
- fail_unless_equals_int (gst_video_format_get_row_stride (fmt, 1, w),
- paintinfo.ustride);
- fail_unless_equals_int (gst_video_format_get_row_stride (fmt, 2, w),
- paintinfo.vstride);
- /* check component_width * height against offsets/size somehow? */
- }
-
- size = gst_video_format_get_size (fmt, w, h);
- fail_unless_equals_int (size, (unsigned long) paintinfo.endptr);
-
- off0 = gst_video_format_get_component_offset (fmt, 0, w, h);
- fail_unless_equals_int (off0, (unsigned long) paintinfo.yp);
- off1 = gst_video_format_get_component_offset (fmt, 1, w, h);
- fail_unless_equals_int (off1, (unsigned long) paintinfo.up);
- off2 = gst_video_format_get_component_offset (fmt, 2, w, h);
- fail_unless_equals_int (off2, (unsigned long) paintinfo.vp);
-
- /* should be 0 if there's no alpha component */
- off3 = gst_video_format_get_component_offset (fmt, 3, w, h);
- fail_unless_equals_int (off3, (unsigned long) paintinfo.ap);
-
- /* some gstvideo checks ... (FIXME: fails for Y41B and Y42B; not sure
- * if the check or the _get_component_size implementation is wrong) */
- if (fmt != GST_VIDEO_FORMAT_Y41B && fmt != GST_VIDEO_FORMAT_Y42B) {
- guint cs0, cs1, cs2, cs3;
-
- cs0 = gst_video_format_get_component_width (fmt, 0, w) *
- gst_video_format_get_component_height (fmt, 0, h);
- cs1 = gst_video_format_get_component_width (fmt, 1, w) *
- gst_video_format_get_component_height (fmt, 1, h);
- cs2 = gst_video_format_get_component_width (fmt, 2, w) *
- gst_video_format_get_component_height (fmt, 2, h);
-
- /* GST_LOG ("cs0=%d,cs1=%d,cs2=%d,off0=%d,off1=%d,off2=%d,size=%d",
- cs0, cs1, cs2, off0, off1, off2, size); */
-
- if (!gst_video_format_is_packed (fmt))
- fail_unless (cs0 <= off1);
-
- if (gst_video_format_has_alpha (fmt)) {
- cs3 = gst_video_format_get_component_width (fmt, 3, w) *
- gst_video_format_get_component_height (fmt, 3, h);
- fail_unless (cs3 < size);
- /* U/V/alpha shouldn't take up more space than the Y component */
- fail_if (cs1 > cs0, "cs1 (%d) should be <= cs0 (%d)", cs1, cs0);
- fail_if (cs2 > cs0, "cs2 (%d) should be <= cs0 (%d)", cs2, cs0);
- fail_if (cs3 > cs0, "cs3 (%d) should be <= cs0 (%d)", cs3, cs0);
-
- /* all components together shouldn't take up more space than size */
- fail_unless (cs0 + cs1 + cs2 + cs3 <= size);
- } else {
- /* U/V shouldn't take up more space than the Y component */
- fail_if (cs1 > cs0, "cs1 (%d) should be <= cs0 (%d)", cs1, cs0);
- fail_if (cs2 > cs0, "cs2 (%d) should be <= cs0 (%d)", cs2, cs0);
-
- /* all components together shouldn't take up more space than size */
- fail_unless (cs0 + cs1 + cs2 <= size,
- "cs0 (%d) + cs1 (%d) + cs2 (%d) should be <= size (%d)",
- cs0, cs1, cs2, size);
- }
- }
- }
- }
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_dar_calc)
-{
- guint display_ratio_n, display_ratio_d;
-
- /* Ensure that various Display Ratio calculations are correctly done */
- /* video 768x576, par 16/15, display par 16/15 = 4/3 */
- fail_unless (gst_video_calculate_display_ratio (&display_ratio_n,
- &display_ratio_d, 768, 576, 16, 15, 16, 15));
- fail_unless (display_ratio_n == 4 && display_ratio_d == 3);
-
- /* video 720x480, par 32/27, display par 1/1 = 16/9 */
- fail_unless (gst_video_calculate_display_ratio (&display_ratio_n,
- &display_ratio_d, 720, 480, 32, 27, 1, 1));
- fail_unless (display_ratio_n == 16 && display_ratio_d == 9);
-
- /* video 360x288, par 533333/500000, display par 16/15 =
- * dar 1599999/1600000 */
- fail_unless (gst_video_calculate_display_ratio (&display_ratio_n,
- &display_ratio_d, 360, 288, 533333, 500000, 16, 15));
- fail_unless (display_ratio_n == 1599999 && display_ratio_d == 1280000);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_parse_caps_rgb)
-{
- struct
- {
- const gchar *tmpl_caps_string;
- GstVideoFormat fmt;
- } formats[] = {
- /* 24 bit */
- {
- GST_VIDEO_CAPS_RGB, GST_VIDEO_FORMAT_RGB}, {
- GST_VIDEO_CAPS_BGR, GST_VIDEO_FORMAT_BGR},
- /* 32 bit (no alpha) */
- {
- GST_VIDEO_CAPS_RGBx, GST_VIDEO_FORMAT_RGBx}, {
- GST_VIDEO_CAPS_xRGB, GST_VIDEO_FORMAT_xRGB}, {
- GST_VIDEO_CAPS_BGRx, GST_VIDEO_FORMAT_BGRx}, {
- GST_VIDEO_CAPS_xBGR, GST_VIDEO_FORMAT_xBGR},
- /* 32 bit (with alpha) */
- {
- GST_VIDEO_CAPS_RGBA, GST_VIDEO_FORMAT_RGBA}, {
- GST_VIDEO_CAPS_ARGB, GST_VIDEO_FORMAT_ARGB}, {
- GST_VIDEO_CAPS_BGRA, GST_VIDEO_FORMAT_BGRA}, {
- GST_VIDEO_CAPS_ABGR, GST_VIDEO_FORMAT_ABGR}
- };
- gint i;
-
- for (i = 0; i < G_N_ELEMENTS (formats); ++i) {
- GstVideoFormat fmt = GST_VIDEO_FORMAT_UNKNOWN;
- GstCaps *caps, *caps2;
- int w = -1, h = -1;
-
- caps = gst_caps_from_string (formats[i].tmpl_caps_string);
- gst_caps_set_simple (caps, "width", G_TYPE_INT, 2 * (i + 1), "height",
- G_TYPE_INT, i + 1, "framerate", GST_TYPE_FRACTION, 15, 1,
- "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1, NULL);
- g_assert (gst_caps_is_fixed (caps));
-
- GST_DEBUG ("testing caps: %" GST_PTR_FORMAT, caps);
-
- fail_unless (gst_video_format_parse_caps (caps, &fmt, &w, &h));
- fail_unless_equals_int (fmt, formats[i].fmt);
- fail_unless_equals_int (w, 2 * (i + 1));
- fail_unless_equals_int (h, i + 1);
-
- /* make sure they're serialised back correctly */
- caps2 = gst_video_format_new_caps (fmt, w, h, 15, 1, 1, 1);
- fail_unless (caps != NULL);
- fail_unless (gst_caps_is_equal (caps, caps2));
-
- gst_caps_unref (caps);
- gst_caps_unref (caps2);
- }
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_events)
-{
- GstEvent *e;
- gboolean in_still;
-
- e = gst_video_event_new_still_frame (TRUE);
- fail_if (e == NULL, "Failed to create still frame event");
- fail_unless (gst_video_event_parse_still_frame (e, &in_still),
- "Failed to parse still frame event");
- fail_unless (gst_video_event_parse_still_frame (e, NULL),
- "Failed to parse still frame event w/ in_still == NULL");
- fail_unless (in_still == TRUE);
- gst_event_unref (e);
-
- e = gst_video_event_new_still_frame (FALSE);
- fail_if (e == NULL, "Failed to create still frame event");
- fail_unless (gst_video_event_parse_still_frame (e, &in_still),
- "Failed to parse still frame event");
- fail_unless (gst_video_event_parse_still_frame (e, NULL),
- "Failed to parse still frame event w/ in_still == NULL");
- fail_unless (in_still == FALSE);
- gst_event_unref (e);
-}
-
-GST_END_TEST;
-
-static Suite *
-video_suite (void)
-{
- Suite *s = suite_create ("video support library");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_video_formats);
- tcase_add_test (tc_chain, test_dar_calc);
- tcase_add_test (tc_chain, test_parse_caps_rgb);
- tcase_add_test (tc_chain, test_events);
-
- return s;
-}
-
-GST_CHECK_MAIN (video);
diff --git a/tests/check/pipelines/.gitignore b/tests/check/pipelines/.gitignore
deleted file mode 100644
index 500b0d1f..00000000
--- a/tests/check/pipelines/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-.dirstamp
-basetime
-gio
-simple-launch-lines
-theoraenc
-vorbisdec
-vorbisenc
-oggmux
-streamheader
diff --git a/tests/check/pipelines/basetime.c b/tests/check/pipelines/basetime.c
deleted file mode 100644
index 00072ef0..00000000
--- a/tests/check/pipelines/basetime.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* GStreamer
- *
- * unit test for audiotestsrc basetime handling
- *
- * Copyright (C) 2009 Maemo Multimedia <multimedia at maemo 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/check/gstcheck.h>
-
-#ifndef GST_DISABLE_PARSE
-
-static GstClockTime old_ts = GST_CLOCK_TIME_NONE;
-
-static gboolean
-break_mainloop (gpointer data)
-{
- GMainLoop *loop;
-
- loop = (GMainLoop *) data;
- g_main_loop_quit (loop);
-
- return FALSE;
-}
-
-static gboolean
-buffer_probe_cb (GstPad * pad, GstBuffer * buffer)
-{
- if (old_ts != GST_CLOCK_TIME_NONE) {
- fail_unless (GST_BUFFER_TIMESTAMP (buffer) != old_ts,
- "Two buffers had same timestamp");
- }
- old_ts = GST_BUFFER_TIMESTAMP (buffer);
-
- return TRUE;
-}
-
-GST_START_TEST (test_basetime_calculation)
-{
- GstElement *p1, *bin;
- GstElement *asrc, *asink;
- GstPad *pad;
- GMainLoop *loop;
-
- loop = g_main_loop_new (NULL, FALSE);
-
- /* The "main" pipeline */
- p1 = gst_parse_launch ("fakesrc ! fakesink", NULL);
- fail_if (p1 == NULL);
-
- /* Create a sub-bin that is activated only in "certain situations" */
- asrc = gst_element_factory_make (DEFAULT_AUDIOSRC, NULL);
- if (asrc == NULL) {
- GST_WARNING ("Cannot run test. test audio source %s not available",
- DEFAULT_AUDIOSRC);
- gst_element_set_state (p1, GST_STATE_NULL);
- gst_object_unref (p1);
- return;
- }
- asink = gst_element_factory_make ("fakesink", NULL);
-
- bin = gst_bin_new ("audiobin");
- gst_bin_add_many (GST_BIN (bin), asrc, asink, NULL);
- gst_element_link (asrc, asink);
-
- gst_bin_add (GST_BIN (p1), bin);
- gst_element_set_state (p1, GST_STATE_READY);
-
- pad = gst_element_get_static_pad (asink, "sink");
- fail_unless (pad != NULL, "Could not get pad out of sink");
-
- gst_pad_add_buffer_probe (pad, G_CALLBACK (buffer_probe_cb), NULL);
- gst_element_set_locked_state (bin, TRUE);
-
- /* Run main pipeline first */
- gst_element_set_state (p1, GST_STATE_PLAYING);
- g_timeout_add (2 * 1000, break_mainloop, loop);
- g_main_loop_run (loop);
-
- /* Now activate the audio pipeline */
- gst_element_set_locked_state (bin, FALSE);
- gst_element_set_state (p1, GST_STATE_PAUSED);
-
- /* Normally our custom audiobin would send this message */
- gst_element_post_message (asrc,
- gst_message_new_clock_provide (GST_OBJECT (asrc), NULL, TRUE));
-
- /* At this point a new clock is selected */
- gst_element_set_state (p1, GST_STATE_PLAYING);
-
- g_timeout_add (2 * 1000, break_mainloop, loop);
- g_main_loop_run (loop);
-
- gst_object_unref (pad);
- gst_element_set_state (p1, GST_STATE_NULL);
- gst_object_unref (p1);
-}
-
-GST_END_TEST;
-
-#endif /* #ifndef GST_DISABLE_PARSE */
-
-static Suite *
-baseaudiosrc_suite (void)
-{
- Suite *s = suite_create ("baseaudiosrc");
- TCase *tc_chain = tcase_create ("general");
-
- /* timeout 6 sec */
- tcase_set_timeout (tc_chain, 6);
- suite_add_tcase (s, tc_chain);
-
-#ifndef GST_DISABLE_PARSE
- tcase_add_test (tc_chain, test_basetime_calculation);
-#endif
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = baseaudiosrc_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/pipelines/gio.c b/tests/check/pipelines/gio.c
deleted file mode 100644
index b7bbc199..00000000
--- a/tests/check/pipelines/gio.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/* GStreamer
- *
- * unit test for GIO
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <gst/check/gstcheck.h>
-#include <gst/check/gstbufferstraw.h>
-#include <gio/gio.h>
-
-static gboolean got_eos = FALSE;
-
-static gboolean
-message_handler (GstBus * bus, GstMessage * msg, gpointer data)
-{
- GMainLoop *loop = (GMainLoop *) data;
-
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_EOS:
- got_eos = TRUE;
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:{
- gchar *debug;
- GError *err;
-
- gst_message_parse_error (msg, &err, &debug);
- g_free (debug);
-
- /* Will abort the check */
- g_warning ("Error: %s\n", err->message);
- g_error_free (err);
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-GST_START_TEST (test_memory_stream)
-{
- GMainLoop *loop;
- GstElement *bin;
- GstElement *src, *sink;
- GstBus *bus;
-
- GMemoryInputStream *input;
- GMemoryOutputStream *output;
-
- guint8 *in_data;
- guint8 *out_data;
- gint i;
- GstFormat fmt = GST_FORMAT_BYTES;
- gint64 duration;
-
- got_eos = FALSE;
-
- in_data = g_new (guint8, 512);
- out_data = g_new (guint8, 512);
- for (i = 0; i < 512; i++)
- in_data[i] = i % 256;
-
- input =
- G_MEMORY_INPUT_STREAM (g_memory_input_stream_new_from_data (in_data, 512,
- (GDestroyNotify) g_free));
-
- output = G_MEMORY_OUTPUT_STREAM (g_memory_output_stream_new (out_data, 512,
- (GReallocFunc) g_realloc, (GDestroyNotify) g_free));
- out_data = NULL;
-
- loop = g_main_loop_new (NULL, FALSE);
-
- bin = gst_pipeline_new ("bin");
-
- src = gst_element_factory_make ("giostreamsrc", "src");
- fail_unless (src != NULL);
- g_object_set (G_OBJECT (src), "stream", input, NULL);
-
- sink = gst_element_factory_make ("giostreamsink", "sink");
- fail_unless (sink != NULL);
- g_object_set (G_OBJECT (sink), "stream", output, NULL);
-
- gst_bin_add_many (GST_BIN (bin), src, sink, NULL);
-
- fail_unless (gst_element_link_many (src, sink, NULL));
-
- bus = gst_element_get_bus (bin);
- gst_bus_add_watch (bus, message_handler, loop);
- gst_object_unref (bus);
-
- gst_element_set_state (bin, GST_STATE_PAUSED);
- gst_element_get_state (bin, NULL, NULL, -1);
-
- fail_unless (gst_element_query_duration (bin, &fmt, &duration));
- fail_unless_equals_int (duration, 512);
-
- gst_element_set_state (bin, GST_STATE_PLAYING);
-
- g_main_loop_run (loop);
-
- gst_element_set_state (bin, GST_STATE_NULL);
-
- fail_unless (got_eos);
- got_eos = FALSE;
-
- out_data = g_memory_output_stream_get_data (G_MEMORY_OUTPUT_STREAM (output));
-
- for (i = 0; i < 512; i++)
- fail_unless_equals_int (in_data[i], out_data[i]);
-
- gst_element_set_state (bin, GST_STATE_PAUSED);
- gst_element_get_state (bin, NULL, NULL, -1);
-
- fail_unless (gst_element_query_duration (bin, &fmt, &duration));
- fail_unless_equals_int (duration, 512);
-
- gst_element_set_state (bin, GST_STATE_PLAYING);
-
- g_main_loop_run (loop);
-
- gst_element_set_state (bin, GST_STATE_NULL);
- gst_object_unref (bin);
-
- fail_unless (got_eos);
-
- g_object_unref (input);
- g_object_unref (output);
-
- g_main_loop_unref (loop);
-}
-
-GST_END_TEST;
-
-static Suite *
-gio_testsuite (void)
-{
- Suite *s = suite_create ("gio");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_memory_stream);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = gio_testsuite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/pipelines/oggmux.c b/tests/check/pipelines/oggmux.c
deleted file mode 100644
index 16bb3f20..00000000
--- a/tests/check/pipelines/oggmux.c
+++ /dev/null
@@ -1,430 +0,0 @@
-/* GStreamer
- *
- * unit tests for oggmux
- *
- * Copyright (C) 2006 James Livingston <doclivingston 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include <gst/check/gstcheck.h>
-#include <ogg/ogg.h>
-
-
-typedef enum
-{
- CODEC_UNKNOWN,
- CODEC_VORBIS,
- CODEC_THEORA,
- CODEC_SPEEX,
-} ChainCodec;
-
-typedef struct
-{
- gboolean eos;
- gulong serialno;
- gint64 last_granule;
- ChainCodec codec;
-} ChainState;
-
-static ogg_sync_state oggsync;
-static GHashTable *eos_chain_states;
-static gulong probe_id;
-
-
-static ChainCodec
-get_page_codec (ogg_page * page)
-{
- ChainCodec codec = CODEC_UNKNOWN;
- ogg_stream_state state;
- ogg_packet packet;
-
- ogg_stream_init (&state, ogg_page_serialno (page));
- if (ogg_stream_pagein (&state, page) == 0) {
- if (ogg_stream_packetpeek (&state, &packet) > 0) {
- if (strncmp ((char *) &packet.packet[1], "vorbis",
- strlen ("vorbis")) == 0)
- codec = CODEC_VORBIS;
- else if (strncmp ((char *) &packet.packet[1], "theora",
- strlen ("theora")) == 0)
- codec = CODEC_THEORA;
- else if (strncmp ((char *) &packet.packet[0], "Speex ",
- strlen ("Speex ")) == 0)
- codec = CODEC_SPEEX;
- }
- }
- ogg_stream_clear (&state);
-
- return codec;
-}
-
-static gboolean
-check_chain_final_state (gpointer key, ChainState * state, gpointer data)
-{
- fail_unless (state->eos, "missing EOS flag on chain %u", state->serialno);
-
- /* return TRUE to empty the chain table */
- return TRUE;
-}
-
-static void
-fail_if_audio (gpointer key, ChainState * state, gpointer data)
-{
- fail_if (state->codec == CODEC_VORBIS,
- "vorbis BOS occurred before theora BOS");
- fail_if (state->codec == CODEC_SPEEX, "speex BOS occurred before theora BOS");
-}
-
-static ChainState *
-validate_ogg_page (ogg_page * page)
-{
- gulong serialno;
- gint64 granule;
- ChainState *state;
-
- serialno = ogg_page_serialno (page);
- granule = ogg_page_granulepos (page);
- state = g_hash_table_lookup (eos_chain_states, GINT_TO_POINTER (serialno));
-
- fail_if (ogg_page_packets (page) == 0 && granule != -1,
- "Must have granulepos -1 when page has no packets, has %" G_GINT64_FORMAT,
- granule);
-
- if (ogg_page_bos (page)) {
- fail_unless (state == NULL, "Extraneous BOS flag on chain %u", serialno);
-
- state = g_new0 (ChainState, 1);
- g_hash_table_insert (eos_chain_states, GINT_TO_POINTER (serialno), state);
- state->serialno = serialno;
- state->last_granule = granule;
- state->codec = get_page_codec (page);
-
- /* check for things like BOS ordering, etc */
- switch (state->codec) {
- case CODEC_THEORA:
- /* check we have no vorbis/speex chains yet */
- g_hash_table_foreach (eos_chain_states, (GHFunc) fail_if_audio, NULL);
- break;
- case CODEC_VORBIS:
- case CODEC_SPEEX:
- /* no checks (yet) */
- break;
- case CODEC_UNKNOWN:
- default:
- break;
- }
- } else if (ogg_page_eos (page)) {
- fail_unless (state != NULL, "Missing BOS flag on chain %u", serialno);
- state->eos = TRUE;
- } else {
- fail_unless (state != NULL, "Missing BOS flag on chain %u", serialno);
- fail_unless (!state->eos, "Data after EOS flag on chain %u", serialno);
- }
-
- if (granule != -1) {
- fail_unless (granule >= state->last_granule,
- "Granulepos out-of-order for chain %u: old=%" G_GINT64_FORMAT ", new="
- G_GINT64_FORMAT, serialno, state->last_granule, granule);
- state->last_granule = granule;
- }
-
- return state;
-}
-
-static void
-is_video (gpointer key, ChainState * state, gpointer data)
-{
- if (state->codec == CODEC_THEORA)
- *((gboolean *) data) = TRUE;
-}
-
-
-static gboolean
-eos_buffer_probe (GstPad * pad, GstBuffer * buffer, gpointer unused)
-{
- gint ret;
- gint size;
- guint8 *data;
- gchar *oggbuffer;
- ChainState *state = NULL;
- gboolean has_video = FALSE;
-
- size = GST_BUFFER_SIZE (buffer);
- data = GST_BUFFER_DATA (buffer);
-
- oggbuffer = ogg_sync_buffer (&oggsync, size);
- memcpy (oggbuffer, data, size);
- ogg_sync_wrote (&oggsync, size);
-
- do {
- ogg_page page;
-
- ret = ogg_sync_pageout (&oggsync, &page);
- if (ret > 0)
- state = validate_ogg_page (&page);
- }
- while (ret != 0);
-
- if (state) {
- /* Now, we can do buffer-level checks...
- * If we have video somewhere, then we should have DELTA_UNIT set on all
- * non-header (not IN_CAPS), non-video buffers
- */
- g_hash_table_foreach (eos_chain_states, (GHFunc) is_video, &has_video);
- if (has_video && state->codec != CODEC_THEORA) {
- if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_IN_CAPS))
- fail_unless (GST_BUFFER_FLAG_IS_SET (buffer,
- GST_BUFFER_FLAG_DELTA_UNIT),
- "Non-video buffer doesn't have DELTA_UNIT in stream with video");
- }
- }
-
- return TRUE;
-}
-
-static void
-start_pipeline (GstElement * bin, GstPad * pad)
-{
- GstStateChangeReturn ret;
-
- ogg_sync_init (&oggsync);
-
- eos_chain_states =
- g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
- probe_id =
- gst_pad_add_buffer_probe (pad, G_CALLBACK (eos_buffer_probe), NULL);
-
- ret = gst_element_set_state (bin, GST_STATE_PLAYING);
- fail_if (ret == GST_STATE_CHANGE_FAILURE, "Could not start test pipeline");
- if (ret == GST_STATE_CHANGE_ASYNC) {
- ret = gst_element_get_state (bin, NULL, NULL, GST_CLOCK_TIME_NONE);
- fail_if (ret != GST_STATE_CHANGE_SUCCESS, "Could not start test pipeline");
- }
-}
-
-static void
-stop_pipeline (GstElement * bin, GstPad * pad)
-{
- GstStateChangeReturn ret;
-
- ret = gst_element_set_state (bin, GST_STATE_NULL);
- fail_if (ret == GST_STATE_CHANGE_FAILURE, "Could not stop test pipeline");
- if (ret == GST_STATE_CHANGE_ASYNC) {
- ret = gst_element_get_state (bin, NULL, NULL, GST_CLOCK_TIME_NONE);
- fail_if (ret != GST_STATE_CHANGE_SUCCESS, "Could not stop test pipeline");
- }
-
- gst_pad_remove_buffer_probe (pad, (guint) probe_id);
- ogg_sync_clear (&oggsync);
-
- /* check end conditions, such as EOS flags */
- g_hash_table_foreach_remove (eos_chain_states,
- (GHRFunc) check_chain_final_state, NULL);
-}
-
-static gboolean
-eos_watch (GstBus * bus, GstMessage * message, GMainLoop * loop)
-{
- if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_EOS) {
- g_main_loop_quit (loop);
- }
- return TRUE;
-}
-
-static void
-test_pipeline (const char *pipeline)
-{
- GstElement *bin, *sink;
- GstPad *pad, *sinkpad;
- GstBus *bus;
- GError *error = NULL;
- GMainLoop *loop;
- GstPadLinkReturn linkret;
-
- bin = gst_parse_launch (pipeline, &error);
- fail_unless (bin != NULL, "Error parsing pipeline: %s",
- error ? error->message : "(invalid error)");
- pad = gst_bin_find_unlinked_pad (GST_BIN (bin), GST_PAD_SRC);
- fail_unless (pad != NULL, "Could not locate free src pad");
-
- /* connect the fake sink */
- sink = gst_element_factory_make ("fakesink", "fake_sink");
- fail_unless (sink != NULL, "Could create fakesink");
- fail_unless (gst_bin_add (GST_BIN (bin), sink), "Could not insert fakesink");
- sinkpad = gst_element_get_static_pad (sink, "sink");
- fail_unless (sinkpad != NULL, "Could not get fakesink src pad");
-
- linkret = gst_pad_link (pad, sinkpad);
- fail_unless (GST_PAD_LINK_SUCCESSFUL (linkret),
- "Could not link to fake sink");
- gst_object_unref (sinkpad);
-
- /* run until we receive EOS */
- loop = g_main_loop_new (NULL, FALSE);
- bus = gst_element_get_bus (bin);
- gst_bus_add_watch (bus, (GstBusFunc) eos_watch, loop);
- gst_object_unref (bus);
-
- start_pipeline (bin, pad);
- g_main_loop_run (loop);
-
- /* we're EOS now; make sure oggmux out caps have stream headers on them */
- {
- GstStructure *s;
- GstCaps *muxcaps;
-
- muxcaps = gst_pad_get_negotiated_caps (sinkpad);
- fail_unless (muxcaps != NULL);
- s = gst_caps_get_structure (muxcaps, 0);
- fail_unless (gst_structure_has_name (s, "application/ogg"));
- fail_unless (gst_structure_has_field (s, "streamheader"));
- fail_unless (gst_structure_has_field_typed (s, "streamheader",
- GST_TYPE_ARRAY));
- gst_caps_unref (muxcaps);
- }
-
- stop_pipeline (bin, pad);
-
- /* clean up */
- g_main_loop_unref (loop);
- gst_object_unref (pad);
- gst_object_unref (bin);
-}
-
-#ifdef HAVE_VORBIS
-GST_START_TEST (test_vorbis)
-{
- test_pipeline
- ("audiotestsrc num-buffers=5 ! audioconvert ! vorbisenc ! oggmux");
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_vorbis_oggmux_unlinked)
-{
- GstElement *pipe;
- GstMessage *msg;
-
- pipe = gst_parse_launch ("audiotestsrc ! vorbisenc ! oggmux", NULL);
- if (pipe == NULL) {
- g_printerr ("Skipping test 'test_vorbis_oggmux_unlinked'");
- return;
- }
- /* no sink, no async state change */
- fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_PAUSED),
- GST_STATE_CHANGE_SUCCESS);
- /* we expect an error (without any criticals/warnings) */
- msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipe), -1,
- GST_MESSAGE_ERROR);
- gst_message_unref (msg);
- fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_NULL),
- GST_STATE_CHANGE_SUCCESS);
- gst_object_unref (pipe);
-}
-
-GST_END_TEST;
-#endif
-
-#ifdef HAVE_THEORA
-GST_START_TEST (test_theora)
-{
- test_pipeline
- ("videotestsrc num-buffers=5 ! ffmpegcolorspace ! theoraenc ! oggmux");
-}
-
-GST_END_TEST;
-#endif
-
-#if (defined (HAVE_THEORA) && defined (HAVE_VORBIS))
-GST_START_TEST (test_theora_vorbis)
-{
- test_pipeline
- ("videotestsrc num-buffers=10 ! ffmpegcolorspace ! theoraenc ! queue ! oggmux name=mux "
- "audiotestsrc num-buffers=2 ! audioconvert ! vorbisenc ! queue ! mux.");
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_vorbis_theora)
-{
- test_pipeline
- ("videotestsrc num-buffers=2 ! ffmpegcolorspace ! theoraenc ! queue ! oggmux name=mux "
- "audiotestsrc num-buffers=10 ! audioconvert ! vorbisenc ! queue ! mux.");
-}
-
-GST_END_TEST;
-#endif
-
-GST_START_TEST (test_simple_cleanup)
-{
- GstElement *oggmux;
-
- oggmux = gst_element_factory_make ("oggmux", NULL);
- gst_object_unref (oggmux);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_request_pad_cleanup)
-{
- GstElement *oggmux;
- GstPad *pad;
-
- oggmux = gst_element_factory_make ("oggmux", NULL);
- pad = gst_element_get_request_pad (oggmux, "sink_%d");
- fail_unless (pad != NULL);
- gst_object_unref (pad);
- pad = gst_element_get_request_pad (oggmux, "sink_%d");
- fail_unless (pad != NULL);
- gst_object_unref (pad);
- gst_object_unref (oggmux);
-}
-
-GST_END_TEST;
-
-static Suite *
-oggmux_suite (void)
-{
- Suite *s = suite_create ("oggmux");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
-#ifdef HAVE_VORBIS
- tcase_add_test (tc_chain, test_vorbis);
- tcase_add_test (tc_chain, test_vorbis_oggmux_unlinked);
-#endif
-
-#ifdef HAVE_THEORA
- tcase_add_test (tc_chain, test_theora);
-#endif
-
-#if (defined (HAVE_THEORA) && defined (HAVE_VORBIS))
- tcase_add_test (tc_chain, test_vorbis_theora);
- tcase_add_test (tc_chain, test_theora_vorbis);
-#endif
-
- tcase_add_test (tc_chain, test_simple_cleanup);
- tcase_add_test (tc_chain, test_request_pad_cleanup);
- return s;
-}
-
-GST_CHECK_MAIN (oggmux);
diff --git a/tests/check/pipelines/simple-launch-lines.c b/tests/check/pipelines/simple-launch-lines.c
deleted file mode 100644
index 51c3052e..00000000
--- a/tests/check/pipelines/simple-launch-lines.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005 Andy Wingo <wingo@pobox.com>
- *
- * simple_launch_lines.c: Unit test for simple pipelines
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-
-#include <gst/check/gstcheck.h>
-
-#ifndef GST_DISABLE_PARSE
-
-static GstElement *
-setup_pipeline (const gchar * pipe_descr)
-{
- GstElement *pipeline;
-
- GST_LOG ("pipeline: %s", pipe_descr);
- pipeline = gst_parse_launch (pipe_descr, NULL);
- g_return_val_if_fail (GST_IS_PIPELINE (pipeline), NULL);
- return pipeline;
-}
-
-/*
- * run_pipeline:
- * @pipe: the pipeline to run
- * @desc: the description for use in messages
- * @events: is a mask of expected events
- * @tevent: is the expected terminal event.
- *
- * the poll call will time out after half a second.
- */
-static void
-run_pipeline (GstElement * pipe, const gchar * descr,
- GstMessageType events, GstMessageType tevent)
-{
- GstBus *bus;
- GstMessage *message;
- GstMessageType revent;
- GstStateChangeReturn ret;
-
- g_assert (pipe);
- bus = gst_element_get_bus (pipe);
- g_assert (bus);
-
- fail_if (gst_element_set_state (pipe, GST_STATE_PLAYING) ==
- GST_STATE_CHANGE_FAILURE, "Could not set pipeline %s to playing", descr);
- ret = gst_element_get_state (pipe, NULL, NULL, 10 * GST_SECOND);
- if (ret == GST_STATE_CHANGE_ASYNC) {
- g_critical ("Pipeline '%s' failed to go to PLAYING fast enough", descr);
- goto done;
- } else if (ret != GST_STATE_CHANGE_SUCCESS) {
- g_critical ("Pipeline '%s' failed to go into PLAYING state", descr);
- goto done;
- }
-
- while (1) {
- message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 2);
-
-
- /* always have to pop the message before getting back into poll */
- if (message) {
- revent = GST_MESSAGE_TYPE (message);
- gst_message_unref (message);
- } else {
- revent = GST_MESSAGE_UNKNOWN;
- }
-
- if (revent == tevent) {
- break;
- } else if (revent == GST_MESSAGE_UNKNOWN) {
- g_critical ("Unexpected timeout in gst_bus_poll, looking for %d: %s",
- tevent, descr);
- break;
- } else if (revent & events) {
- continue;
- }
- g_critical
- ("Unexpected message received of type %d, '%s', looking for %d: %s",
- revent, gst_message_type_get_name (revent), tevent, descr);
- }
-
-done:
- fail_if (gst_element_set_state (pipe, GST_STATE_NULL) ==
- GST_STATE_CHANGE_FAILURE, "Could not set pipeline %s to NULL", descr);
- gst_element_get_state (pipe, NULL, NULL, GST_CLOCK_TIME_NONE);
- gst_object_unref (pipe);
-
- gst_bus_set_flushing (bus, TRUE);
- gst_object_unref (bus);
-}
-
-GST_START_TEST (test_element_negotiation)
-{
- gchar *s;
-
- /* Ensures that filtering buffers with unknown caps down to fixed-caps
- * will apply those caps to the buffers.
- * see http://bugzilla.gnome.org/show_bug.cgi?id=315126 */
- s = "fakesrc num-buffers=2 ! "
- "audio/x-raw-int,width=16,depth=16,rate=22050,channels=1,"
- "signed=(boolean)true,endianness=1234 ! "
- "audioconvert ! audio/x-raw-int,width=16,depth=16,rate=22050,channels=1 "
- "! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN);
-
-#ifdef HAVE_LIBVISUAL
- s = "audiotestsrc num-buffers=30 ! tee name=t ! alsasink t. ! audioconvert ! "
- "libvisual_lv_scope ! ffmpegcolorspace ! xvimagesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN);
-#endif
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_basetransform_based)
-{
- /* Each of these tests is to check whether various basetransform based
- * elements can select output caps when not allowed to do passthrough
- * and going to a generic sink such as fakesink or filesink */
- const gchar *s;
-
- /* Check that videoscale can pick a height given only a width */
- s = "videotestsrc num-buffers=2 ! "
- "video/x-raw-yuv,format=(fourcc)I420,width=320,height=240 ! "
- "videoscale ! video/x-raw-yuv,width=640 ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN);
-
- /* Test that ffmpegcolorspace can pick an output format that isn't
- * passthrough without completely specified output caps */
- s = "videotestsrc num-buffers=2 ! "
- "video/x-raw-yuv,format=(fourcc)I420,width=320,height=240 ! "
- "ffmpegcolorspace ! video/x-raw-rgb ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN);
-
- /* Check that audioresample can pick a samplerate to use from a
- * range that doesn't include the input */
- s = "audiotestsrc num-buffers=2 ! "
- "audio/x-raw-int,width=16,depth=16,rate=8000 ! "
- "audioresample ! audio/x-raw-int,rate=[16000,48000] ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN);
-
- /* Check that audioconvert can pick a depth to use, given a width */
- s = "audiotestsrc num-buffers=30 ! audio/x-raw-int,width=16,depth=16 ! "
- "audioconvert ! " "audio/x-raw-int,width=32 ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN);
-
- /* Check that videoscale doesn't claim to be able to transform input in
- * formats it can't handle for a given scaling method; ffmpegcolorspace
- * should then make sure a format that can be handled is chosen (4-tap
- * scaling is not implemented for RGB and packed yuv currently) */
- s = "videotestsrc num-buffers=2 ! video/x-raw-rgb,width=64,height=64 ! "
- "ffmpegcolorspace ! videoscale method=4-tap ! ffmpegcolorspace ! "
- "video/x-raw-rgb,width=32,height=32,framerate=(fraction)30/1,"
- "pixel-aspect-ratio=(fraction)1/1,bpp=(int)24,depth=(int)24,"
- "red_mask=(int)16711680,green_mask=(int)65280,blue_mask=(int)255,"
- "endianness=(int)4321 ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN);
- s = "videotestsrc num-buffers=2 ! video/x-raw-yuv,format=(fourcc)AYUV,"
- "width=64,height=64 ! ffmpegcolorspace ! videoscale method=4-tap ! "
- "ffmpegcolorspace ! video/x-raw-yuv,format=(fourcc)AYUV,width=32,"
- "height=32 ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN);
- /* make sure nothing funny happens in passthrough mode (we don't check that
- * passthrough mode is chosen though) */
- s = "videotestsrc num-buffers=2 ! video/x-raw-yuv,format=(fourcc)I420,"
- "width=64,height=64 ! ffmpegcolorspace ! videoscale method=4-tap ! "
- "ffmpegcolorspace ! video/x-raw-yuv,format=(fourcc)I420,width=32,"
- "height=32 ! fakesink";
- run_pipeline (setup_pipeline (s), s,
- GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
- GST_MESSAGE_UNKNOWN);
-}
-
-GST_END_TEST;
-
-#endif /* #ifndef GST_DISABLE_PARSE */
-static Suite *
-simple_launch_lines_suite (void)
-{
- Suite *s = suite_create ("Pipelines");
- TCase *tc_chain = tcase_create ("linear");
-
- /* time out after 60s, not the default 3 */
- tcase_set_timeout (tc_chain, 60);
-
- suite_add_tcase (s, tc_chain);
-#ifndef GST_DISABLE_PARSE
- tcase_add_test (tc_chain, test_element_negotiation);
- tcase_add_test (tc_chain, test_basetransform_based);
-#endif
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = simple_launch_lines_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/pipelines/streamheader.c b/tests/check/pipelines/streamheader.c
deleted file mode 100644
index c3872ad2..00000000
--- a/tests/check/pipelines/streamheader.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* GStreamer
- *
- * unit test for streamheader handling
- *
- * Copyright (C) 2007 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-#include <gst/check/gstbufferstraw.h>
-
-#ifndef GST_DISABLE_PARSE
-
-/* this tests a gdp-serialized tag from audiotestsrc being sent only once
- * to clients of multifdsink */
-
-static int n_tags = 0;
-
-static gboolean
-tag_event_probe_cb (GstPad * pad, GstEvent * event, GMainLoop * loop)
-{
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_TAG:
- {
- ++n_tags;
- fail_if (n_tags > 1, "More than 1 tag received");
- break;
- }
- case GST_EVENT_EOS:
- {
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-GST_START_TEST (test_multifdsink_gdp_tag)
-{
- GstElement *p1, *p2;
- GstElement *src, *sink, *depay;
- GstPad *pad;
- GMainLoop *loop;
- int pfd[2];
-
- loop = g_main_loop_new (NULL, FALSE);
-
- p1 = gst_parse_launch ("audiotestsrc num-buffers=10 ! gdppay"
- " ! multifdsink name=p1sink", NULL);
- fail_if (p1 == NULL);
- p2 = gst_parse_launch ("fdsrc name=p2src ! gdpdepay name=depay"
- " ! fakesink name=p2sink signal-handoffs=True", NULL);
- fail_if (p2 == NULL);
-
- fail_if (pipe (pfd) == -1);
-
-
- gst_element_set_state (p1, GST_STATE_READY);
-
- sink = gst_bin_get_by_name (GST_BIN (p1), "p1sink");
- g_signal_emit_by_name (sink, "add", pfd[1], NULL);
- gst_object_unref (sink);
-
- src = gst_bin_get_by_name (GST_BIN (p2), "p2src");
- g_object_set (G_OBJECT (src), "fd", pfd[0], NULL);
- gst_object_unref (src);
-
- depay = gst_bin_get_by_name (GST_BIN (p2), "depay");
- fail_if (depay == NULL);
-
- pad = gst_element_get_static_pad (depay, "src");
- fail_unless (pad != NULL, "Could not get pad out of depay");
- gst_object_unref (depay);
-
- gst_pad_add_event_probe (pad, G_CALLBACK (tag_event_probe_cb), loop);
-
- gst_element_set_state (p1, GST_STATE_PLAYING);
- gst_element_set_state (p2, GST_STATE_PLAYING);
-
- g_main_loop_run (loop);
-
- assert_equals_int (n_tags, 1);
-
- gst_element_set_state (p1, GST_STATE_NULL);
- gst_object_unref (p1);
- gst_element_set_state (p2, GST_STATE_NULL);
- gst_object_unref (p2);
-}
-
-GST_END_TEST;
-
-#ifdef HAVE_VORBIS
-/* this tests gdp-serialized Vorbis header pages being sent only once
- * to clients of multifdsink; the gdp depayloader should deserialize
- * exactly three in_caps buffers for the three header packets */
-
-static int n_in_caps = 0;
-
-static gboolean
-buffer_probe_cb (GstPad * pad, GstBuffer * buffer)
-{
- if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_IN_CAPS)) {
- GstCaps *caps;
- GstStructure *s;
- const GValue *sh;
- GArray *buffers;
- GstBuffer *buf;
- int i;
- gboolean found = FALSE;
-
- n_in_caps++;
-
- caps = gst_buffer_get_caps (buffer);
- s = gst_caps_get_structure (caps, 0);
- fail_unless (gst_structure_has_field (s, "streamheader"));
- sh = gst_structure_get_value (s, "streamheader");
- buffers = g_value_peek_pointer (sh);
- assert_equals_int (buffers->len, 3);
-
-
- for (i = 0; i < 3; ++i) {
- GValue *val;
-
- val = &g_array_index (buffers, GValue, i);
- buf = g_value_peek_pointer (val);
- fail_unless (GST_IS_BUFFER (buf));
- if (GST_BUFFER_SIZE (buf) == GST_BUFFER_SIZE (buffer)) {
- if (memcmp (GST_BUFFER_DATA (buf), GST_BUFFER_DATA (buffer),
- GST_BUFFER_SIZE (buffer)) == 0) {
- found = TRUE;
- }
- }
- }
- fail_unless (found, "Did not find incoming IN_CAPS buffer %p on caps",
- buffer);
-
- gst_caps_unref (caps);
- }
-
- return TRUE;
-}
-
-GST_START_TEST (test_multifdsink_gdp_vorbisenc)
-{
- GstElement *p1, *p2;
- GstElement *src, *sink, *depay;
- GstPad *pad;
- GMainLoop *loop;
- int pfd[2];
-
- loop = g_main_loop_new (NULL, FALSE);
-
- p1 = gst_parse_launch ("audiotestsrc num-buffers=10 ! audioconvert "
- " ! vorbisenc ! gdppay ! multifdsink name=p1sink", NULL);
- fail_if (p1 == NULL);
- p2 = gst_parse_launch ("fdsrc name=p2src ! gdpdepay name=depay"
- " ! fakesink name=p2sink signal-handoffs=True", NULL);
- fail_if (p2 == NULL);
-
- fail_if (pipe (pfd) == -1);
-
-
- gst_element_set_state (p1, GST_STATE_READY);
-
- sink = gst_bin_get_by_name (GST_BIN (p1), "p1sink");
- g_signal_emit_by_name (sink, "add", pfd[1], NULL);
- gst_object_unref (sink);
-
- src = gst_bin_get_by_name (GST_BIN (p2), "p2src");
- g_object_set (G_OBJECT (src), "fd", pfd[0], NULL);
- gst_object_unref (src);
-
- depay = gst_bin_get_by_name (GST_BIN (p2), "depay");
- fail_if (depay == NULL);
-
- pad = gst_element_get_static_pad (depay, "src");
- fail_unless (pad != NULL, "Could not get pad out of depay");
- gst_object_unref (depay);
-
- gst_pad_add_event_probe (pad, G_CALLBACK (tag_event_probe_cb), loop);
- gst_pad_add_buffer_probe (pad, G_CALLBACK (buffer_probe_cb), NULL);
-
- gst_element_set_state (p1, GST_STATE_PLAYING);
- gst_element_set_state (p2, GST_STATE_PLAYING);
-
- g_main_loop_run (loop);
-
- assert_equals_int (n_in_caps, 3);
-
- gst_element_set_state (p1, GST_STATE_NULL);
- gst_object_unref (p1);
- gst_element_set_state (p2, GST_STATE_NULL);
- gst_object_unref (p2);
-}
-
-GST_END_TEST;
-#endif /* HAVE_VORBIS */
-
-#endif /* #ifndef GST_DISABLE_PARSE */
-
-static Suite *
-streamheader_suite (void)
-{
- Suite *s = suite_create ("streamheader");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
-#ifndef GST_DISABLE_PARSE
- tcase_add_test (tc_chain, test_multifdsink_gdp_tag);
-#ifdef HAVE_VORBIS
- tcase_add_test (tc_chain, test_multifdsink_gdp_vorbisenc);
-#endif
-#endif
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = streamheader_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/pipelines/theoraenc.c b/tests/check/pipelines/theoraenc.c
deleted file mode 100644
index ddc37d61..00000000
--- a/tests/check/pipelines/theoraenc.c
+++ /dev/null
@@ -1,463 +0,0 @@
-/* GStreamer
- *
- * unit test for theoraenc
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <gst/check/gstcheck.h>
-#include <gst/check/gstbufferstraw.h>
-
-#include <theora/theora.h>
-
-#ifndef GST_DISABLE_PARSE
-
-#define TIMESTAMP_OFFSET G_GINT64_CONSTANT(3249870963)
-#define FRAMERATE 10
-
-/* I know all of these have a shift of 6 bits */
-#define GRANULEPOS_SHIFT 6
-
-
-#define check_buffer_is_header(buffer,is_header) \
- fail_unless (GST_BUFFER_FLAG_IS_SET (buffer, \
- GST_BUFFER_FLAG_IN_CAPS) == is_header, \
- "GST_BUFFER_IN_CAPS is set to %d but expected %d", \
- GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_IN_CAPS), is_header)
-
-#define check_buffer_timestamp(buffer,timestamp) \
- fail_unless (GST_BUFFER_TIMESTAMP (buffer) == timestamp, \
- "expected timestamp %" GST_TIME_FORMAT \
- ", but got timestamp %" GST_TIME_FORMAT, \
- GST_TIME_ARGS (timestamp), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)))
-
-#define check_buffer_duration(buffer,duration) \
- fail_unless (GST_BUFFER_DURATION (buffer) == duration, \
- "expected duration %" GST_TIME_FORMAT \
- ", but got duration %" GST_TIME_FORMAT, \
- GST_TIME_ARGS (duration), GST_TIME_ARGS (GST_BUFFER_DURATION (buffer)))
-
-static gboolean old_libtheora;
-
-static void
-check_libtheora (void)
-{
- old_libtheora = (theora_version_number () <= 0x00030200);
-}
-
-static void
-check_buffer_granulepos (GstBuffer * buffer, gint64 granulepos)
-{
- GstClockTime clocktime;
- int framecount;
-
- /* With old versions of libtheora, the granulepos represented the
- * start time, not end time. Adapt for that. */
- if (old_libtheora) {
- if (granulepos >> GRANULEPOS_SHIFT)
- granulepos -= 1 << GRANULEPOS_SHIFT;
- else if (granulepos)
- granulepos -= 1;
- }
-
- fail_unless (GST_BUFFER_OFFSET_END (buffer) == granulepos,
- "expected granulepos %" G_GUINT64_FORMAT
- ", but got granulepos %" G_GUINT64_FORMAT,
- granulepos, GST_BUFFER_OFFSET_END (buffer));
-
- /* contrary to what we record as TIMESTAMP, we can use OFFSET to check
- * the granulepos correctly here */
- framecount = GST_BUFFER_OFFSET_END (buffer);
- framecount = granulepos >> GRANULEPOS_SHIFT;
- framecount += granulepos & ((1 << GRANULEPOS_SHIFT) - 1);
- clocktime = gst_util_uint64_scale (framecount, GST_SECOND, FRAMERATE);
-
- fail_unless (clocktime == GST_BUFFER_OFFSET (buffer),
- "expected OFFSET set to clocktime %" GST_TIME_FORMAT
- ", but got %" GST_TIME_FORMAT,
- GST_TIME_ARGS (clocktime), GST_TIME_ARGS (GST_BUFFER_OFFSET (buffer)));
-}
-
-/* this check is here to check that the granulepos we derive from the
- timestamp is about correct. This is "about correct" because you can't
- precisely go from timestamp to granulepos due to the downward-rounding
- characteristics of gst_util_uint64_scale, so you check if granulepos is
- equal to the number, or the number plus one. */
-/* should be from_endtime, but theora's granulepos mapping is "special" */
-static void
-check_buffer_granulepos_from_starttime (GstBuffer * buffer,
- GstClockTime starttime)
-{
- gint64 granulepos, expected, framecount;
-
- granulepos = GST_BUFFER_OFFSET_END (buffer);
- /* Now convert to 'granulepos for start time', depending on libtheora
- * version */
- if (!old_libtheora) {
- if (granulepos & ((1 << GRANULEPOS_SHIFT) - 1))
- granulepos -= 1;
- else if (granulepos)
- granulepos -= 1 << GRANULEPOS_SHIFT;
- }
-
- framecount = granulepos >> GRANULEPOS_SHIFT;
- framecount += granulepos & ((1 << GRANULEPOS_SHIFT) - 1);
- expected = gst_util_uint64_scale (starttime, FRAMERATE, GST_SECOND);
-
- fail_unless (framecount == expected || framecount == expected + 1,
- "expected frame count %" G_GUINT64_FORMAT
- " or %" G_GUINT64_FORMAT
- ", but got frame count %" G_GUINT64_FORMAT,
- expected, expected + 1, framecount);
-}
-
-GST_START_TEST (test_granulepos_offset)
-{
- GstElement *bin;
- GstPad *pad;
- gchar *pipe_str;
- GstBuffer *buffer;
- GError *error = NULL;
-
- pipe_str = g_strdup_printf ("videotestsrc timestamp-offset=%" G_GUINT64_FORMAT
- " num-buffers=10 ! video/x-raw-yuv,format=(fourcc)I420,framerate=10/1"
- " ! theoraenc ! fakesink name=fs0", TIMESTAMP_OFFSET);
-
- bin = gst_parse_launch (pipe_str, &error);
- fail_unless (bin != NULL, "Error parsing pipeline: %s",
- error ? error->message : "(invalid error)");
- g_free (pipe_str);
-
- /* get the pad */
- {
- GstElement *sink = gst_bin_get_by_name (GST_BIN (bin), "fs0");
-
- fail_unless (sink != NULL, "Could not get fakesink out of bin");
- pad = gst_element_get_static_pad (sink, "sink");
- fail_unless (pad != NULL, "Could not get pad out of fakesink");
- gst_object_unref (sink);
- }
-
- gst_buffer_straw_start_pipeline (bin, pad);
-
- /* header packets should have timestamp == NONE, granulepos 0, IN_CAPS */
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- check_buffer_is_header (buffer, TRUE);
- gst_buffer_unref (buffer);
-
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- check_buffer_is_header (buffer, TRUE);
- gst_buffer_unref (buffer);
-
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- check_buffer_is_header (buffer, TRUE);
- gst_buffer_unref (buffer);
-
- {
- GstClockTime next_timestamp;
- gint64 last_granulepos;
-
- /* first buffer should have timestamp of TIMESTAMP_OFFSET, granulepos to
- * match the timestamp of the end of the last sample in the output buffer.
- * Note that one cannot go timestamp->granulepos->timestamp and get the
- * same value due to loss of precision with granulepos. theoraenc does
- * take care to timestamp correctly based on the offset of the input data
- * however, so it does do sub-granulepos timestamping. */
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- last_granulepos = GST_BUFFER_OFFSET_END (buffer);
- check_buffer_timestamp (buffer, TIMESTAMP_OFFSET);
- /* don't really have a good way of checking duration... */
- check_buffer_granulepos_from_starttime (buffer, TIMESTAMP_OFFSET);
- check_buffer_is_header (buffer, FALSE);
-
- next_timestamp = TIMESTAMP_OFFSET + GST_BUFFER_DURATION (buffer);
-
- gst_buffer_unref (buffer);
-
- /* check continuity with the next buffer */
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, next_timestamp);
- check_buffer_duration (buffer,
- gst_util_uint64_scale (GST_BUFFER_OFFSET_END (buffer), GST_SECOND,
- FRAMERATE)
- - gst_util_uint64_scale (last_granulepos, GST_SECOND, FRAMERATE));
- check_buffer_granulepos_from_starttime (buffer, next_timestamp);
- check_buffer_is_header (buffer, FALSE);
-
- gst_buffer_unref (buffer);
- }
-
- gst_buffer_straw_stop_pipeline (bin, pad);
-
- gst_object_unref (pad);
- gst_object_unref (bin);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_continuity)
-{
- GstElement *bin;
- GstPad *pad;
- gchar *pipe_str;
- GstBuffer *buffer;
- GError *error = NULL;
-
- pipe_str = g_strdup_printf ("videotestsrc num-buffers=10"
- " ! video/x-raw-yuv,format=(fourcc)I420,framerate=10/1"
- " ! theoraenc ! fakesink name=fs0");
-
- bin = gst_parse_launch (pipe_str, &error);
- fail_unless (bin != NULL, "Error parsing pipeline: %s",
- error ? error->message : "(invalid error)");
- g_free (pipe_str);
-
- /* get the pad */
- {
- GstElement *sink = gst_bin_get_by_name (GST_BIN (bin), "fs0");
-
- fail_unless (sink != NULL, "Could not get fakesink out of bin");
- pad = gst_element_get_static_pad (sink, "sink");
- fail_unless (pad != NULL, "Could not get pad out of fakesink");
- gst_object_unref (sink);
- }
-
- gst_buffer_straw_start_pipeline (bin, pad);
-
- /* header packets should have timestamp == NONE, granulepos 0 */
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- check_buffer_is_header (buffer, TRUE);
- gst_buffer_unref (buffer);
-
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- check_buffer_is_header (buffer, TRUE);
- gst_buffer_unref (buffer);
-
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- check_buffer_is_header (buffer, TRUE);
- gst_buffer_unref (buffer);
-
- {
- GstClockTime next_timestamp;
- gint64 last_granulepos;
-
- /* first buffer should have timestamp of TIMESTAMP_OFFSET, granulepos to
- * match the timestamp of the end of the last sample in the output buffer.
- * Note that one cannot go timestamp->granulepos->timestamp and get the
- * same value due to loss of precision with granulepos. theoraenc does
- * take care to timestamp correctly based on the offset of the input data
- * however, so it does do sub-granulepos timestamping. */
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- last_granulepos = GST_BUFFER_OFFSET_END (buffer);
- check_buffer_timestamp (buffer, 0);
- /* plain division because I know the answer is exact */
- check_buffer_duration (buffer, GST_SECOND / 10);
- check_buffer_granulepos (buffer, 1 << GRANULEPOS_SHIFT);
- check_buffer_is_header (buffer, FALSE);
-
- next_timestamp = GST_BUFFER_DURATION (buffer);
-
- gst_buffer_unref (buffer);
-
- /* check continuity with the next buffer */
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, next_timestamp);
- check_buffer_duration (buffer, GST_SECOND / 10);
- check_buffer_granulepos (buffer, (1 << GRANULEPOS_SHIFT) | 1);
- check_buffer_is_header (buffer, FALSE);
-
- gst_buffer_unref (buffer);
- }
-
- gst_buffer_straw_stop_pipeline (bin, pad);
-
- gst_object_unref (pad);
- gst_object_unref (bin);
-}
-
-GST_END_TEST;
-
-static gboolean
-drop_second_data_buffer (GstPad * droppad, GstBuffer * buffer, gpointer unused)
-{
- return !(GST_BUFFER_OFFSET (buffer) == 1);
-}
-
-GST_START_TEST (test_discontinuity)
-{
- GstElement *bin;
- GstPad *pad, *droppad;
- gchar *pipe_str;
- GstBuffer *buffer;
- GError *error = NULL;
- guint drop_id;
-
- pipe_str = g_strdup_printf ("videotestsrc num-buffers=10"
- " ! video/x-raw-yuv,format=(fourcc)I420,framerate=10/1"
- " ! theoraenc ! fakesink name=fs0");
-
- bin = gst_parse_launch (pipe_str, &error);
- fail_unless (bin != NULL, "Error parsing pipeline: %s",
- error ? error->message : "(invalid error)");
- g_free (pipe_str);
-
- /* the plan: same as test_continuity, but dropping a buffer and seeing if
- theoraenc correctly notes the discontinuity */
-
- /* get the pad to use to drop buffers */
- {
- GstElement *sink = gst_bin_get_by_name (GST_BIN (bin), "theoraenc0");
-
- fail_unless (sink != NULL, "Could not get theoraenc out of bin");
- droppad = gst_element_get_static_pad (sink, "sink");
- fail_unless (droppad != NULL, "Could not get pad out of theoraenc");
- gst_object_unref (sink);
- }
-
- /* get the pad */
- {
- GstElement *sink = gst_bin_get_by_name (GST_BIN (bin), "fs0");
-
- fail_unless (sink != NULL, "Could not get fakesink out of bin");
- pad = gst_element_get_static_pad (sink, "sink");
- fail_unless (pad != NULL, "Could not get pad out of fakesink");
- gst_object_unref (sink);
- }
-
- drop_id = gst_pad_add_buffer_probe (droppad,
- G_CALLBACK (drop_second_data_buffer), NULL);
- gst_buffer_straw_start_pipeline (bin, pad);
-
- /* header packets should have timestamp == NONE, granulepos 0 */
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- check_buffer_is_header (buffer, TRUE);
- gst_buffer_unref (buffer);
-
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- check_buffer_is_header (buffer, TRUE);
- gst_buffer_unref (buffer);
-
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- check_buffer_is_header (buffer, TRUE);
- gst_buffer_unref (buffer);
-
- {
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, 0);
- /* plain division because I know the answer is exact */
- check_buffer_duration (buffer, GST_SECOND / 10);
- check_buffer_granulepos (buffer, 1 << GRANULEPOS_SHIFT);
- check_buffer_is_header (buffer, FALSE);
- fail_if (GST_BUFFER_IS_DISCONT (buffer), "expected continuous buffer yo");
- gst_buffer_unref (buffer);
-
- /* check discontinuity with the next buffer */
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_duration (buffer, GST_SECOND / 10);
- /* After a discont, we'll always get a keyframe, so this one should be
- * 3<<GRANULEPOS_SHIFT */
- check_buffer_granulepos (buffer, 3 << GRANULEPOS_SHIFT);
- check_buffer_is_header (buffer, FALSE);
- fail_unless (GST_BUFFER_IS_DISCONT (buffer),
- "expected discontinuous buffer yo");
- gst_buffer_unref (buffer);
-
- /* Then the buffer after that should be continuous */
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- fail_if (GST_BUFFER_IS_DISCONT (buffer), "expected continuous buffer yo");
- /* plain division because I know the answer is exact */
- check_buffer_duration (buffer, GST_SECOND / 10);
- check_buffer_granulepos (buffer, (3 << GRANULEPOS_SHIFT) | 1);
- check_buffer_is_header (buffer, FALSE);
- gst_buffer_unref (buffer);
- }
-
- gst_buffer_straw_stop_pipeline (bin, pad);
- gst_pad_remove_buffer_probe (droppad, drop_id);
-
- gst_object_unref (droppad);
- gst_object_unref (pad);
- gst_object_unref (bin);
-}
-
-GST_END_TEST;
-
-#endif /* #ifndef GST_DISABLE_PARSE */
-
-static Suite *
-theoraenc_suite (void)
-{
- Suite *s = suite_create ("theoraenc");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
-
- check_libtheora ();
-
-#ifndef GST_DISABLE_PARSE
- tcase_add_test (tc_chain, test_granulepos_offset);
- tcase_add_test (tc_chain, test_continuity);
- tcase_add_test (tc_chain, test_discontinuity);
-#endif
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = theoraenc_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/pipelines/vorbisdec.c b/tests/check/pipelines/vorbisdec.c
deleted file mode 100644
index 9d467607..00000000
--- a/tests/check/pipelines/vorbisdec.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* GStreamer
- *
- * unit test for vorbisdec
- *
- * Copyright (C) 2007 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <gst/check/gstcheck.h>
-#include <gst/check/gstbufferstraw.h>
-
-#ifndef GST_DISABLE_PARSE
-
-static GMainLoop *loop;
-static gint messages = 0;
-
-static void
-element_message_cb (GstBus * bus, GstMessage * message, gpointer user_data)
-{
- gchar *s;
-
- s = gst_structure_to_string (gst_message_get_structure (message));
- GST_DEBUG ("Received message: %s", s);
- g_free (s);
-
- messages++;
-}
-
-static void
-eos_message_cb (GstBus * bus, GstMessage * message, gpointer user_data)
-{
- GST_DEBUG ("Received eos");
- g_main_loop_quit (loop);
-}
-
-GST_START_TEST (test_timestamps)
-{
- GstElement *pipeline;
- gchar *pipe_str;
- GstBus *bus;
- GError *error = NULL;
-
- pipe_str = g_strdup_printf ("audiotestsrc num-buffers=100"
- " ! audio/x-raw-int,rate=44100 ! audioconvert ! vorbisenc ! vorbisdec"
- " ! identity check-imperfect-timestamp=TRUE ! fakesink");
-
- pipeline = gst_parse_launch (pipe_str, &error);
- fail_unless (pipeline != NULL, "Error parsing pipeline: %s",
- error ? error->message : "(invalid error)");
- g_free (pipe_str);
-
- bus = gst_element_get_bus (pipeline);
- fail_if (bus == NULL);
- gst_bus_add_signal_watch (bus);
- g_signal_connect (bus, "message::element", (GCallback) element_message_cb,
- NULL);
- g_signal_connect (bus, "message::eos", (GCallback) eos_message_cb, NULL);
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- /* run until we receive EOS */
- loop = g_main_loop_new (NULL, FALSE);
-
- g_main_loop_run (loop);
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- /* FIXME: there seems to be a bug in vorbisdec on decoding the last packet
- * where it calculates the timestamp based on the granulepos of the incoming
- * packet and subtracting the number of samples it can decode, which can
- * result in a discontinuity in timestamps.
- * See http://bugzilla.gnome.org/show_bug.cgi?id=423086
- * Fix that bug and drop this number to 0.
- */
- fail_if (messages > 1, "Received imperfect timestamp messages");
- gst_object_unref (pipeline);
-}
-
-GST_END_TEST;
-#endif /* #ifndef GST_DISABLE_PARSE */
-
-static Suite *
-vorbisenc_suite (void)
-{
- Suite *s = suite_create ("vorbisenc");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
-#ifndef GST_DISABLE_PARSE
- tcase_add_test (tc_chain, test_timestamps);
-#endif
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = vorbisenc_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/pipelines/vorbisenc.c b/tests/check/pipelines/vorbisenc.c
deleted file mode 100644
index b207dffe..00000000
--- a/tests/check/pipelines/vorbisenc.c
+++ /dev/null
@@ -1,410 +0,0 @@
-/* GStreamer
- *
- * unit test for vorbisenc
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <gst/check/gstcheck.h>
-#include <gst/check/gstbufferstraw.h>
-
-#ifndef GST_DISABLE_PARSE
-
-#define TIMESTAMP_OFFSET G_GINT64_CONSTANT(3249870963)
-
-static void
-check_buffer_timestamp (GstBuffer * buffer, GstClockTime timestamp)
-{
- fail_unless (GST_BUFFER_TIMESTAMP (buffer) == timestamp,
- "expected timestamp %" GST_TIME_FORMAT
- ", but got timestamp %" GST_TIME_FORMAT,
- GST_TIME_ARGS (timestamp), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
-}
-
-static void
-check_buffer_duration (GstBuffer * buffer, GstClockTime duration)
-{
- fail_unless (GST_BUFFER_DURATION (buffer) == duration,
- "expected duration %" GST_TIME_FORMAT
- ", but got duration %" GST_TIME_FORMAT,
- GST_TIME_ARGS (duration), GST_TIME_ARGS (GST_BUFFER_DURATION (buffer)));
-}
-
-static void
-check_buffer_granulepos (GstBuffer * buffer, gint64 granulepos)
-{
- GstClockTime clocktime;
-
- fail_unless (GST_BUFFER_OFFSET_END (buffer) == granulepos,
- "expected granulepos %" G_GUINT64_FORMAT
- ", but got granulepos %" G_GUINT64_FORMAT,
- granulepos, GST_BUFFER_OFFSET_END (buffer));
-
- /* contrary to what we record as TIMESTAMP, we can use OFFSET to check
- * the granulepos correctly here */
- clocktime = gst_util_uint64_scale (GST_BUFFER_OFFSET_END (buffer), 44100,
- GST_SECOND);
-
- fail_unless (clocktime == GST_BUFFER_OFFSET (buffer),
- "expected OFFSET set to clocktime %" GST_TIME_FORMAT
- ", but got %" GST_TIME_FORMAT,
- GST_TIME_ARGS (clocktime), GST_TIME_ARGS (GST_BUFFER_OFFSET (buffer)));
-}
-
-/* this check is here to check that the granulepos we derive from the timestamp
- is about correct. This is "about correct" because you can't precisely go from
- timestamp to granulepos due to the downward-rounding characteristics of
- gst_util_uint64_scale, so you check if granulepos is equal to the number, or
- the number plus one. */
-static void
-check_buffer_granulepos_from_endtime (GstBuffer * buffer, GstClockTime endtime)
-{
- gint64 granulepos, expected;
-
- granulepos = GST_BUFFER_OFFSET_END (buffer);
- expected = gst_util_uint64_scale (endtime, 44100, GST_SECOND);
-
- fail_unless (granulepos == expected || granulepos == expected + 1,
- "expected granulepos %" G_GUINT64_FORMAT
- " or %" G_GUINT64_FORMAT
- ", but got granulepos %" G_GUINT64_FORMAT,
- expected, expected + 1, granulepos);
-}
-
-GST_START_TEST (test_granulepos_offset)
-{
- GstElement *bin;
- GstPad *pad;
- gchar *pipe_str;
- GstBuffer *buffer;
- GError *error = NULL;
-
- pipe_str = g_strdup_printf ("audiotestsrc timestamp-offset=%" G_GUINT64_FORMAT
- " ! audio/x-raw-int,rate=44100"
- " ! audioconvert ! vorbisenc ! fakesink", TIMESTAMP_OFFSET);
-
- bin = gst_parse_launch (pipe_str, &error);
- fail_unless (bin != NULL, "Error parsing pipeline: %s",
- error ? error->message : "(invalid error)");
- g_free (pipe_str);
-
- /* get the pad */
- {
- GstElement *sink = gst_bin_get_by_name (GST_BIN (bin), "fakesink0");
-
- fail_unless (sink != NULL, "Could not get fakesink out of bin");
- pad = gst_element_get_static_pad (sink, "sink");
- fail_unless (pad != NULL, "Could not get pad out of fakesink");
- gst_object_unref (sink);
- }
-
- gst_buffer_straw_start_pipeline (bin, pad);
-
- /* header packets should have timestamp == NONE, granulepos 0 */
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- GST_DEBUG ("Got buffer in test");
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- gst_buffer_unref (buffer);
- GST_DEBUG ("Unreffed buffer in test");
-
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- gst_buffer_unref (buffer);
-
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- gst_buffer_unref (buffer);
-
- {
- GstClockTime next_timestamp;
- gint64 last_granulepos = 0;
-
- /* first buffer should have timestamp of TIMESTAMP_OFFSET, granulepos to
- * match the timestamp of the end of the last sample in the output buffer.
- * Note that one cannot go timestamp->granulepos->timestamp and get the same
- * value due to loss of precision with granulepos. vorbisenc does take care
- * to timestamp correctly based on the offset of the input data however, so
- * it does do sub-granulepos timestamping. */
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- last_granulepos = GST_BUFFER_OFFSET_END (buffer);
- check_buffer_timestamp (buffer, TIMESTAMP_OFFSET);
- /* don't really have a good way of checking duration... */
- check_buffer_granulepos_from_endtime (buffer,
- TIMESTAMP_OFFSET + GST_BUFFER_DURATION (buffer));
-
- next_timestamp = TIMESTAMP_OFFSET + GST_BUFFER_DURATION (buffer);
-
- gst_buffer_unref (buffer);
-
- /* check continuity with the next buffer */
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, next_timestamp);
- check_buffer_duration (buffer,
- gst_util_uint64_scale (GST_BUFFER_OFFSET_END (buffer), GST_SECOND,
- 44100)
- - gst_util_uint64_scale (last_granulepos, GST_SECOND, 44100));
- check_buffer_granulepos_from_endtime (buffer,
- next_timestamp + GST_BUFFER_DURATION (buffer));
-
- gst_buffer_unref (buffer);
- }
-
- gst_buffer_straw_stop_pipeline (bin, pad);
-
- gst_object_unref (pad);
- gst_object_unref (bin);
-}
-
-GST_END_TEST;
-
-GST_START_TEST (test_timestamps)
-{
- GstElement *bin;
- GstPad *pad;
- gchar *pipe_str;
- GstBuffer *buffer;
- GError *error = NULL;
-
- pipe_str = g_strdup_printf ("audiotestsrc"
- " ! audio/x-raw-int,rate=44100 ! audioconvert ! vorbisenc ! fakesink");
-
- bin = gst_parse_launch (pipe_str, &error);
- fail_unless (bin != NULL, "Error parsing pipeline: %s",
- error ? error->message : "(invalid error)");
- g_free (pipe_str);
-
- /* get the pad */
- {
- GstElement *sink = gst_bin_get_by_name (GST_BIN (bin), "fakesink0");
-
- fail_unless (sink != NULL, "Could not get fakesink out of bin");
- pad = gst_element_get_static_pad (sink, "sink");
- fail_unless (pad != NULL, "Could not get pad out of fakesink");
- gst_object_unref (sink);
- }
-
- gst_buffer_straw_start_pipeline (bin, pad);
-
- /* check header packets */
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- gst_buffer_unref (buffer);
-
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- gst_buffer_unref (buffer);
-
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- gst_buffer_unref (buffer);
-
- {
- GstClockTime next_timestamp;
- gint64 last_granulepos;
-
- /* first buffer has timestamp 0 */
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- last_granulepos = GST_BUFFER_OFFSET_END (buffer);
- check_buffer_timestamp (buffer, 0);
- /* don't really have a good way of checking duration... */
- check_buffer_granulepos_from_endtime (buffer, GST_BUFFER_DURATION (buffer));
-
- next_timestamp = GST_BUFFER_DURATION (buffer);
-
- gst_buffer_unref (buffer);
-
- /* check continuity with the next buffer */
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, next_timestamp);
- check_buffer_duration (buffer,
- gst_util_uint64_scale (GST_BUFFER_OFFSET_END (buffer), GST_SECOND,
- 44100)
- - gst_util_uint64_scale (last_granulepos, GST_SECOND, 44100));
- check_buffer_granulepos_from_endtime (buffer,
- next_timestamp + GST_BUFFER_DURATION (buffer));
-
- gst_buffer_unref (buffer);
- }
-
- gst_buffer_straw_stop_pipeline (bin, pad);
-
- gst_object_unref (pad);
- gst_object_unref (bin);
-}
-
-GST_END_TEST;
-
-static gboolean
-drop_second_data_buffer (GstPad * droppad, GstBuffer * buffer, gpointer unused)
-{
- return !(GST_BUFFER_OFFSET (buffer) == 1024);
-}
-
-GST_START_TEST (test_discontinuity)
-{
- GstElement *bin;
- GstPad *pad, *droppad;
- gchar *pipe_str;
- GstBuffer *buffer;
- GError *error = NULL;
- guint drop_id;
-
- pipe_str = g_strdup_printf ("audiotestsrc samplesperbuffer=1024"
- " ! audio/x-raw-int,rate=44100" " ! audioconvert ! vorbisenc ! fakesink");
-
- bin = gst_parse_launch (pipe_str, &error);
- fail_unless (bin != NULL, "Error parsing pipeline: %s",
- error ? error->message : "(invalid error)");
- g_free (pipe_str);
-
- /* the plan: same as test_timestamps, but dropping a buffer and seeing if
- vorbisenc correctly notes the discontinuity */
-
- /* get the pad to use to drop buffers */
- {
- GstElement *sink = gst_bin_get_by_name (GST_BIN (bin), "vorbisenc0");
-
- fail_unless (sink != NULL, "Could not get vorbisenc out of bin");
- droppad = gst_element_get_static_pad (sink, "sink");
- fail_unless (droppad != NULL, "Could not get pad out of vorbisenc");
- gst_object_unref (sink);
- }
-
- /* get the pad */
- {
- GstElement *sink = gst_bin_get_by_name (GST_BIN (bin), "fakesink0");
-
- fail_unless (sink != NULL, "Could not get fakesink out of bin");
- pad = gst_element_get_static_pad (sink, "sink");
- fail_unless (pad != NULL, "Could not get pad out of fakesink");
- gst_object_unref (sink);
- }
-
- drop_id = gst_pad_add_buffer_probe (droppad,
- G_CALLBACK (drop_second_data_buffer), NULL);
- gst_buffer_straw_start_pipeline (bin, pad);
-
- /* check header packets */
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- gst_buffer_unref (buffer);
-
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- gst_buffer_unref (buffer);
-
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
- check_buffer_granulepos (buffer, 0);
- gst_buffer_unref (buffer);
-
- /* two phases: continuous granulepos values up to 1024, then a first
- discontinuous granulepos whose granulepos corresponds to a gap ending at
- 2048. */
- {
- GstClockTime next_timestamp = 0;
- gint64 last_granulepos = 0;
-
- while (last_granulepos < 1024) {
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- last_granulepos = GST_BUFFER_OFFSET_END (buffer);
- check_buffer_timestamp (buffer, next_timestamp);
- fail_if (GST_BUFFER_IS_DISCONT (buffer), "expected continuous buffer");
- next_timestamp += GST_BUFFER_DURATION (buffer);
- gst_buffer_unref (buffer);
- }
-
- fail_unless (last_granulepos == 1024,
- "unexpected granulepos: %" G_GUINT64_FORMAT, last_granulepos);
- }
-
- {
- buffer = gst_buffer_straw_get_buffer (bin, pad);
- /* The first buffer after the discontinuity will produce zero output
- * samples (because of the overlap/add), so it won't increment the
- * granulepos, which should be 2048 after the discontinuity.
- */
- fail_unless (GST_BUFFER_OFFSET_END (buffer) == 2048,
- "expected granulepos after gap: %" G_GUINT64_FORMAT,
- GST_BUFFER_OFFSET_END (buffer));
- fail_unless (GST_BUFFER_IS_DISCONT (buffer),
- "expected discontinuous buffer");
- gst_buffer_unref (buffer);
- }
-
- gst_buffer_straw_stop_pipeline (bin, pad);
- gst_pad_remove_buffer_probe (droppad, drop_id);
-
- gst_object_unref (droppad);
- gst_object_unref (pad);
- gst_object_unref (bin);
-}
-
-GST_END_TEST;
-
-#endif /* #ifndef GST_DISABLE_PARSE */
-
-static Suite *
-vorbisenc_suite (void)
-{
- Suite *s = suite_create ("vorbisenc");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
-#ifndef GST_DISABLE_PARSE
- tcase_add_test (tc_chain, test_granulepos_offset);
- tcase_add_test (tc_chain, test_timestamps);
- tcase_add_test (tc_chain, test_discontinuity);
-#endif
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = vorbisenc_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/examples/Makefile.am b/tests/examples/Makefile.am
deleted file mode 100644
index 7c4e1f8a..00000000
--- a/tests/examples/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-if HAVE_FT2
-FT2_SUBDIRS = seek snapshot
-else
-FT2_SUBDIRS =
-endif
-
-if USE_GIO
-GIO_SUBDIRS = gio
-endif
-
-SUBDIRS = app $(FT2_SUBDIRS) $(GIO_SUBDIRS) volume dynamic v4l overlay
-
-DIST_SUBDIRS = app seek volume dynamic snapshot gio v4l overlay
diff --git a/tests/examples/app/.gitignore b/tests/examples/app/.gitignore
deleted file mode 100644
index 8a2c7615..00000000
--- a/tests/examples/app/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-appsrc_ex
-appsrc-ra
-appsrc-seekable
-appsrc-stream
-appsrc-stream2
-appsink-src
diff --git a/tests/examples/app/Makefile.am b/tests/examples/app/Makefile.am
deleted file mode 100644
index 7d721b4c..00000000
--- a/tests/examples/app/Makefile.am
+++ /dev/null
@@ -1,32 +0,0 @@
-
-noinst_PROGRAMS = appsrc_ex appsrc-stream appsrc-stream2 appsrc-ra \
- appsrc-seekable appsink-src
-
-appsrc_ex_SOURCES = appsrc_ex.c
-appsrc_ex_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-appsrc_ex_LDFLAGS = \
- $(top_builddir)/gst-libs/gst/app/libgstapp-@GST_MAJORMINOR@.la \
- $(GST_LIBS)
-
-appsrc_stream_SOURCES = appsrc-stream.c
-appsrc_stream_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-appsrc_stream_LDFLAGS = $(GST_LIBS)
-
-appsrc_stream2_SOURCES = appsrc-stream2.c
-appsrc_stream2_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-appsrc_stream2_LDFLAGS = $(GST_LIBS)
-
-appsrc_ra_SOURCES = appsrc-ra.c
-appsrc_ra_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-appsrc_ra_LDFLAGS = $(GST_LIBS)
-
-appsrc_seekable_SOURCES = appsrc-seekable.c
-appsrc_seekable_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-appsrc_seekable_LDFLAGS = $(GST_LIBS)
-
-appsink_src_SOURCES = appsink-src.c
-appsink_src_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-appsink_src_LDFLAGS = \
- $(top_builddir)/gst-libs/gst/app/libgstapp-@GST_MAJORMINOR@.la \
- $(GST_LIBS)
-
diff --git a/tests/examples/app/appsink-src.c b/tests/examples/app/appsink-src.c
deleted file mode 100644
index a92dfb51..00000000
--- a/tests/examples/app/appsink-src.c
+++ /dev/null
@@ -1,192 +0,0 @@
-#include <gst/gst.h>
-
-#include <string.h>
-
-#include <gst/app/gstappsrc.h>
-#include <gst/app/gstappsink.h>
-#include <gst/app/gstappbuffer.h>
-
-/* these are the caps we are going to pass through the appsink and appsrc */
-const gchar *audio_caps =
- "audio/x-raw-int,channels=1,rate=8000,signed=(boolean)true,width=16,depth=16,endianness=1234";
-
-typedef struct
-{
- GMainLoop *loop;
- GstElement *source;
- GstElement *sink;
-} ProgramData;
-
-/* called when the appsink notifies us that there is a new buffer ready for
- * processing */
-static void
-on_new_buffer_from_source (GstElement * elt, ProgramData * data)
-{
- guint size;
- gpointer raw_buffer;
- GstBuffer *app_buffer, *buffer;
- GstElement *source;
-
- /* get the buffer from appsink */
- buffer = gst_app_sink_pull_buffer (GST_APP_SINK (elt));
-
- /* turn it into an app buffer, it's not really needed, we could simply push
- * the retrieved buffer from appsink into appsrc just fine. */
- size = GST_BUFFER_SIZE (buffer);
- g_print ("Pushing a buffer of size %d\n", size);
- raw_buffer = g_malloc0 (size);
- memcpy (raw_buffer, GST_BUFFER_DATA (buffer), size);
- app_buffer = gst_app_buffer_new (raw_buffer, size, g_free, raw_buffer);
-
- /* newer basesrc will set caps for use automatically but it does not really
- * hurt to set it on the buffer again */
- gst_buffer_set_caps (app_buffer, GST_BUFFER_CAPS (buffer));
-
- /* we don't need the appsink buffer anymore */
- gst_buffer_unref (buffer);
-
- /* get source an push new buffer */
- source = gst_bin_get_by_name (GST_BIN (data->sink), "testsource");
- gst_app_src_push_buffer (GST_APP_SRC (source), app_buffer);
-}
-
-/* called when we get a GstMessage from the source pipeline when we get EOS, we
- * notify the appsrc of it. */
-static gboolean
-on_source_message (GstBus * bus, GstMessage * message, ProgramData * data)
-{
- GstElement *source;
-
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_EOS:
- g_print ("The source got dry\n");
- source = gst_bin_get_by_name (GST_BIN (data->sink), "testsource");
- gst_app_src_end_of_stream (GST_APP_SRC (source));
- break;
- case GST_MESSAGE_ERROR:
- g_print ("Received error\n");
- g_main_loop_quit (data->loop);
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-/* called when we get a GstMessage from the sink pipeline when we get EOS, we
- * exit the mainloop and this testapp. */
-static gboolean
-on_sink_message (GstBus * bus, GstMessage * message, ProgramData * data)
-{
- /* nil */
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_EOS:
- g_print ("Finished playback\n");
- g_main_loop_quit (data->loop);
- break;
- case GST_MESSAGE_ERROR:
- g_print ("Received error\n");
- g_main_loop_quit (data->loop);
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-int
-main (int argc, char *argv[])
-{
- gchar *filename = NULL;
- ProgramData *data = NULL;
- gchar *string = NULL;
- GstBus *bus = NULL;
- GstElement *testsink = NULL;
- GstElement *testsource = NULL;
-
- gst_init (&argc, &argv);
-
- if (argc == 2)
- filename = g_strdup (argv[1]);
- else
- filename = g_strdup ("/usr/share/sounds/ekiga/ring.wav");
-
- data = g_new0 (ProgramData, 1);
-
- data->loop = g_main_loop_new (NULL, FALSE);
-
- /* setting up source pipeline, we read from a file and convert to our desired
- * caps. */
- string =
- g_strdup_printf
- ("filesrc location=\"%s\" ! wavparse ! audioconvert ! audioresample ! appsink caps=\"%s\" name=testsink",
- filename, audio_caps);
- g_free (filename);
- data->source = gst_parse_launch (string, NULL);
- g_free (string);
-
- if (data->source == NULL) {
- g_print ("Bad source\n");
- return -1;
- }
-
- /* to be notified of messages from this pipeline, mostly EOS */
- bus = gst_element_get_bus (data->source);
- gst_bus_add_watch (bus, (GstBusFunc) on_source_message, data);
- gst_object_unref (bus);
-
- /* we use appsink in push mode, it sends us a signal when data is available
- * and we pull out the data in the signal callback. We want the appsink to
- * push as fast as it can, hence the sync=false */
- testsink = gst_bin_get_by_name (GST_BIN (data->source), "testsink");
- g_object_set (G_OBJECT (testsink), "emit-signals", TRUE, "sync", FALSE, NULL);
- g_signal_connect (testsink, "new-buffer",
- G_CALLBACK (on_new_buffer_from_source), data);
- gst_object_unref (testsink);
-
- /* setting up sink pipeline, we push audio data into this pipeline that will
- * then play it back using the default audio sink. We have no blocking
- * behaviour on the src which means that we will push the entire file into
- * memory. */
- string =
- g_strdup_printf ("appsrc name=testsource caps=\"%s\" ! autoaudiosink",
- audio_caps);
- data->sink = gst_parse_launch (string, NULL);
- g_free (string);
-
- if (data->sink == NULL) {
- g_print ("Bad sink\n");
- return -1;
- }
-
- testsource = gst_bin_get_by_name (GST_BIN (data->sink), "testsource");
- /* configure for time-based format */
- g_object_set (testsource, "format", GST_FORMAT_TIME, NULL);
- /* uncomment the next line to block when appsrc has buffered enough */
- /* g_object_set (testsource, "block", TRUE, NULL); */
- gst_object_unref (testsource);
-
- bus = gst_element_get_bus (data->sink);
- gst_bus_add_watch (bus, (GstBusFunc) on_sink_message, data);
- gst_object_unref (bus);
-
- /* launching things */
- gst_element_set_state (data->sink, GST_STATE_PLAYING);
- gst_element_set_state (data->source, GST_STATE_PLAYING);
-
- /* let's run !, this loop will quit when the sink pipeline goes EOS or when an
- * error occurs in the source or sink pipelines. */
- g_print ("Let's run!\n");
- g_main_loop_run (data->loop);
- g_print ("Going out\n");
-
- gst_element_set_state (data->source, GST_STATE_NULL);
- gst_element_set_state (data->sink, GST_STATE_NULL);
-
- gst_object_unref (data->source);
- gst_object_unref (data->sink);
- g_main_loop_unref (data->loop);
- g_free (data);
-
- return 0;
-}
diff --git a/tests/examples/app/appsrc-ra.c b/tests/examples/app/appsrc-ra.c
deleted file mode 100644
index 46b19cae..00000000
--- a/tests/examples/app/appsrc-ra.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/* GStreamer
- *
- * appsrc-ra.c: example for using appsrc in random-access mode.
- *
- * Copyright (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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-/* FIXME: remove once we depend on GLib >= 2.22 */
-#if !GLIB_CHECK_VERSION (2, 22, 0)
-#define g_mapped_file_unref g_mapped_file_free
-#endif
-
-GST_DEBUG_CATEGORY (appsrc_playbin_debug);
-#define GST_CAT_DEFAULT appsrc_playbin_debug
-
-/*
- * an example application of using appsrc in random-access mode. When the
- * appsrc requests data with the need-data signal, we retrieve a buffer of the
- * requested size and push it to appsrc.
- *
- * This is a good example how one would deal with a local file resource.
- *
- * Appsrc in random-access mode needs seeking support and we must thus connect
- * to the seek signal to perform any seeks when requested.
- *
- * In random-access mode we must set the size of the source material.
- */
-typedef struct _App App;
-
-struct _App
-{
- GstElement *playbin;
- GstElement *appsrc;
-
- GMainLoop *loop;
-
- GMappedFile *file;
- guint8 *data;
- gsize length;
- guint64 offset;
-};
-
-App s_app;
-
-/* This method is called by the need-data signal callback, we feed data into the
- * appsrc with the requested size.
- */
-static void
-feed_data (GstElement * appsrc, guint size, App * app)
-{
- GstBuffer *buffer;
- GstFlowReturn ret;
-
- buffer = gst_buffer_new ();
-
- if (app->offset >= app->length) {
- /* we are EOS, send end-of-stream */
- g_signal_emit_by_name (app->appsrc, "end-of-stream", &ret);
- return;
- }
-
- /* read the amount of data, we are allowed to return less if we are EOS */
- if (app->offset + size > app->length)
- size = app->length - app->offset;
-
- GST_BUFFER_DATA (buffer) = app->data + app->offset;
- GST_BUFFER_SIZE (buffer) = size;
- /* we need to set an offset for random access */
- GST_BUFFER_OFFSET (buffer) = app->offset;
- GST_BUFFER_OFFSET_END (buffer) = app->offset + size;
-
- GST_DEBUG ("feed buffer %p, offset %" G_GUINT64_FORMAT "-%u", buffer,
- app->offset, size);
- g_signal_emit_by_name (app->appsrc, "push-buffer", buffer, &ret);
- gst_buffer_unref (buffer);
-
- app->offset += size;
-
- return;
-}
-
-/* called when appsrc wants us to return data from a new position with the next
- * call to push-buffer. */
-static gboolean
-seek_data (GstElement * appsrc, guint64 position, App * app)
-{
- GST_DEBUG ("seek to offset %" G_GUINT64_FORMAT, position);
- app->offset = position;
-
- return TRUE;
-}
-
-/* this callback is called when playbin2 has constructed a source object to read
- * from. Since we provided the appsrc:// uri to playbin2, this will be the
- * appsrc that we must handle. We set up some signals to push data into appsrc
- * and one to perform a seek. */
-static void
-found_source (GObject * object, GObject * orig, GParamSpec * pspec, App * app)
-{
- /* get a handle to the appsrc */
- g_object_get (orig, pspec->name, &app->appsrc, NULL);
-
- GST_DEBUG ("got appsrc %p", app->appsrc);
-
- /* we can set the length in appsrc. This allows some elements to estimate the
- * total duration of the stream. It's a good idea to set the property when you
- * can but it's not required. */
- g_object_set (app->appsrc, "size", (gint64) app->length, NULL);
- gst_util_set_object_arg (G_OBJECT (app->appsrc), "stream-type",
- "random-access");
-
- /* configure the appsrc, we will push a buffer to appsrc when it needs more
- * data */
- g_signal_connect (app->appsrc, "need-data", G_CALLBACK (feed_data), app);
- g_signal_connect (app->appsrc, "seek-data", G_CALLBACK (seek_data), app);
-}
-
-static gboolean
-bus_message (GstBus * bus, GstMessage * message, App * app)
-{
- GST_DEBUG ("got message %s",
- gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
-
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_ERROR:
- g_error ("received error");
- g_main_loop_quit (app->loop);
- break;
- case GST_MESSAGE_EOS:
- g_main_loop_quit (app->loop);
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-int
-main (int argc, char *argv[])
-{
- App *app = &s_app;
- GError *error = NULL;
- GstBus *bus;
-
- gst_init (&argc, &argv);
-
- GST_DEBUG_CATEGORY_INIT (appsrc_playbin_debug, "appsrc-playbin", 0,
- "appsrc playbin example");
-
- if (argc < 2) {
- g_print ("usage: %s <filename>\n", argv[0]);
- return -1;
- }
-
- /* try to open the file as an mmapped file */
- app->file = g_mapped_file_new (argv[1], FALSE, &error);
- if (error) {
- g_print ("failed to open file: %s\n", error->message);
- g_error_free (error);
- return -2;
- }
- /* get some vitals, this will be used to read data from the mmapped file and
- * feed it to appsrc. */
- app->length = g_mapped_file_get_length (app->file);
- app->data = (guint8 *) g_mapped_file_get_contents (app->file);
- app->offset = 0;
-
- /* create a mainloop to get messages */
- app->loop = g_main_loop_new (NULL, TRUE);
-
- app->playbin = gst_element_factory_make ("playbin2", NULL);
- g_assert (app->playbin);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (app->playbin));
-
- /* add watch for messages */
- gst_bus_add_watch (bus, (GstBusFunc) bus_message, app);
-
- /* set to read from appsrc */
- g_object_set (app->playbin, "uri", "appsrc://", NULL);
-
- /* get notification when the source is created so that we get a handle to it
- * and can configure it */
- g_signal_connect (app->playbin, "deep-notify::source",
- (GCallback) found_source, app);
-
- /* go to playing and wait in a mainloop. */
- gst_element_set_state (app->playbin, GST_STATE_PLAYING);
-
- /* this mainloop is stopped when we receive an error or EOS */
- g_main_loop_run (app->loop);
-
- GST_DEBUG ("stopping");
-
- gst_element_set_state (app->playbin, GST_STATE_NULL);
-
- /* free the file */
- g_mapped_file_unref (app->file);
-
- gst_object_unref (bus);
- g_main_loop_unref (app->loop);
-
- return 0;
-}
diff --git a/tests/examples/app/appsrc-seekable.c b/tests/examples/app/appsrc-seekable.c
deleted file mode 100644
index adff5bb9..00000000
--- a/tests/examples/app/appsrc-seekable.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/* GStreamer
- *
- * appsrc-seekable.c: example for using appsrc in seekable mode.
- *
- * Copyright (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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-/* FIXME: remove once we depend on GLib >= 2.22 */
-#if !GLIB_CHECK_VERSION (2, 22, 0)
-#define g_mapped_file_unref g_mapped_file_free
-#endif
-
-GST_DEBUG_CATEGORY (appsrc_playbin_debug);
-#define GST_CAT_DEFAULT appsrc_playbin_debug
-
-/*
- * an example application of using appsrc in seekable mode. When the
- * appsrc requests data with the need-data signal, we retrieve a buffer and
- * push it to appsrc. We can also use the method as demonstrated in
- * appsrc-stream.c, ie. pushing buffers when we can.
- *
- * This is a good example how one would deal with a remote http server that
- * supports range requests.
- *
- * Appsrc in seekable mode needs seeking support and we must thus connect
- * to the seek signal to perform any seeks when requested.
- *
- * In seekable mode we should set the size of the source material.
- */
-typedef struct _App App;
-
-struct _App
-{
- GstElement *playbin;
- GstElement *appsrc;
-
- GMainLoop *loop;
-
- GMappedFile *file;
- guint8 *data;
- gsize length;
- guint64 offset;
-};
-
-App s_app;
-
-#define CHUNK_SIZE 4096
-
-/* This method is called by the need-data signal callback, we feed data into the
- * appsrc with an arbitrary size.
- */
-static void
-feed_data (GstElement * appsrc, guint size, App * app)
-{
- GstBuffer *buffer;
- guint len;
- GstFlowReturn ret;
-
- buffer = gst_buffer_new ();
-
- if (app->offset >= app->length) {
- /* we are EOS, send end-of-stream */
- g_signal_emit_by_name (app->appsrc, "end-of-stream", &ret);
- return;
- }
-
- /* read any amount of data, we are allowed to return less if we are EOS */
- len = CHUNK_SIZE;
- if (app->offset + len > app->length)
- len = app->length - app->offset;
-
- GST_BUFFER_DATA (buffer) = app->data + app->offset;
- GST_BUFFER_SIZE (buffer) = len;
-
- GST_DEBUG ("feed buffer %p, offset %" G_GUINT64_FORMAT "-%u", buffer,
- app->offset, len);
- g_signal_emit_by_name (app->appsrc, "push-buffer", buffer, &ret);
- gst_buffer_unref (buffer);
-
- app->offset += len;
-
- return;
-}
-
-/* called when appsrc wants us to return data from a new position with the next
- * call to push-buffer. */
-static gboolean
-seek_data (GstElement * appsrc, guint64 position, App * app)
-{
- GST_DEBUG ("seek to offset %" G_GUINT64_FORMAT, position);
- app->offset = position;
-
- return TRUE;
-}
-
-/* this callback is called when playbin2 has constructed a source object to read
- * from. Since we provided the appsrc:// uri to playbin2, this will be the
- * appsrc that we must handle. We set up some signals to push data into appsrc
- * and one to perform a seek. */
-static void
-found_source (GObject * object, GObject * orig, GParamSpec * pspec, App * app)
-{
- /* get a handle to the appsrc */
- g_object_get (orig, pspec->name, &app->appsrc, NULL);
-
- GST_DEBUG ("got appsrc %p", app->appsrc);
-
- /* we can set the length in appsrc. This allows some elements to estimate the
- * total duration of the stream. It's a good idea to set the property when you
- * can but it's not required. */
- g_object_set (app->appsrc, "size", (gint64) app->length, NULL);
- /* we are seekable in push mode, this means that the element usually pushes
- * out buffers of an undefined size and that seeks happen only occasionally
- * and only by request of the user. */
- gst_util_set_object_arg (G_OBJECT (app->appsrc), "stream-type", "seekable");
-
- /* configure the appsrc, we will push a buffer to appsrc when it needs more
- * data */
- g_signal_connect (app->appsrc, "need-data", G_CALLBACK (feed_data), app);
- g_signal_connect (app->appsrc, "seek-data", G_CALLBACK (seek_data), app);
-}
-
-static gboolean
-bus_message (GstBus * bus, GstMessage * message, App * app)
-{
- GST_DEBUG ("got message %s",
- gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
-
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_ERROR:
- g_error ("received error");
- g_main_loop_quit (app->loop);
- break;
- case GST_MESSAGE_EOS:
- g_main_loop_quit (app->loop);
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-int
-main (int argc, char *argv[])
-{
- App *app = &s_app;
- GError *error = NULL;
- GstBus *bus;
-
- gst_init (&argc, &argv);
-
- GST_DEBUG_CATEGORY_INIT (appsrc_playbin_debug, "appsrc-playbin", 0,
- "appsrc playbin example");
-
- if (argc < 2) {
- g_print ("usage: %s <filename>\n", argv[0]);
- return -1;
- }
-
- /* try to open the file as an mmapped file */
- app->file = g_mapped_file_new (argv[1], FALSE, &error);
- if (error) {
- g_print ("failed to open file: %s\n", error->message);
- g_error_free (error);
- return -2;
- }
- /* get some vitals, this will be used to read data from the mmapped file and
- * feed it to appsrc. */
- app->length = g_mapped_file_get_length (app->file);
- app->data = (guint8 *) g_mapped_file_get_contents (app->file);
- app->offset = 0;
-
- /* create a mainloop to get messages */
- app->loop = g_main_loop_new (NULL, TRUE);
-
- app->playbin = gst_element_factory_make ("playbin2", NULL);
- g_assert (app->playbin);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (app->playbin));
-
- /* add watch for messages */
- gst_bus_add_watch (bus, (GstBusFunc) bus_message, app);
-
- /* set to read from appsrc */
- g_object_set (app->playbin, "uri", "appsrc://", NULL);
-
- /* get notification when the source is created so that we get a handle to it
- * and can configure it */
- g_signal_connect (app->playbin, "deep-notify::source",
- (GCallback) found_source, app);
-
- /* go to playing and wait in a mainloop. */
- gst_element_set_state (app->playbin, GST_STATE_PLAYING);
-
- /* this mainloop is stopped when we receive an error or EOS */
- g_main_loop_run (app->loop);
-
- GST_DEBUG ("stopping");
-
- gst_element_set_state (app->playbin, GST_STATE_NULL);
-
- /* free the file */
- g_mapped_file_unref (app->file);
-
- gst_object_unref (bus);
- g_main_loop_unref (app->loop);
-
- return 0;
-}
diff --git a/tests/examples/app/appsrc-stream.c b/tests/examples/app/appsrc-stream.c
deleted file mode 100644
index ea3286f2..00000000
--- a/tests/examples/app/appsrc-stream.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/* GStreamer
- *
- * appsrc-stream.c: example for using appsrc in streaming mode.
- *
- * Copyright (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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-/* FIXME: remove once we depend on GLib >= 2.22 */
-#if !GLIB_CHECK_VERSION (2, 22, 0)
-#define g_mapped_file_unref g_mapped_file_free
-#endif
-
-GST_DEBUG_CATEGORY (appsrc_playbin_debug);
-#define GST_CAT_DEFAULT appsrc_playbin_debug
-
-/*
- * an example application of using appsrc in streaming push mode. We simply push
- * buffers into appsrc. The size of the buffers we push can be any size we
- * choose.
- *
- * This example is very close to how one would deal with a streaming webserver
- * that does not support range requests or does not report the total file size.
- *
- * Some optimisations are done so that we don't push too much data. We connect
- * to the need-data and enough-data signals to start/stop sending buffers.
- *
- * Appsrc in streaming mode (the default) does not support seeking so we don't
- * have to handle any seek callbacks.
- *
- * Some formats are able to estimate the duration of the media file based on the
- * file length (mp3, mpeg,..), others report an unknown length (ogg,..).
- */
-typedef struct _App App;
-
-struct _App
-{
- GstElement *playbin;
- GstElement *appsrc;
-
- GMainLoop *loop;
- guint sourceid;
-
- GMappedFile *file;
- guint8 *data;
- gsize length;
- guint64 offset;
-};
-
-App s_app;
-
-#define CHUNK_SIZE 4096
-
-/* This method is called by the idle GSource in the mainloop. We feed CHUNK_SIZE
- * bytes into appsrc.
- * The ide handler is added to the mainloop when appsrc requests us to start
- * sending data (need-data signal) and is removed when appsrc has enough data
- * (enough-data signal).
- */
-static gboolean
-read_data (App * app)
-{
- GstBuffer *buffer;
- guint len;
- GstFlowReturn ret;
-
- buffer = gst_buffer_new ();
-
- if (app->offset >= app->length) {
- /* we are EOS, send end-of-stream and remove the source */
- g_signal_emit_by_name (app->appsrc, "end-of-stream", &ret);
- return FALSE;
- }
-
- /* read the next chunk */
- len = CHUNK_SIZE;
- if (app->offset + len > app->length)
- len = app->length - app->offset;
-
- GST_BUFFER_DATA (buffer) = app->data + app->offset;
- GST_BUFFER_SIZE (buffer) = len;
-
- GST_DEBUG ("feed buffer %p, offset %" G_GUINT64_FORMAT "-%u", buffer,
- app->offset, len);
- g_signal_emit_by_name (app->appsrc, "push-buffer", buffer, &ret);
- gst_buffer_unref (buffer);
- if (ret != GST_FLOW_OK) {
- /* some error, stop sending data */
- return FALSE;
- }
-
- app->offset += len;
-
- return TRUE;
-}
-
-/* This signal callback is called when appsrc needs data, we add an idle handler
- * to the mainloop to start pushing data into the appsrc */
-static void
-start_feed (GstElement * playbin, guint size, App * app)
-{
- if (app->sourceid == 0) {
- GST_DEBUG ("start feeding");
- app->sourceid = g_idle_add ((GSourceFunc) read_data, app);
- }
-}
-
-/* This callback is called when appsrc has enough data and we can stop sending.
- * We remove the idle handler from the mainloop */
-static void
-stop_feed (GstElement * playbin, App * app)
-{
- if (app->sourceid != 0) {
- GST_DEBUG ("stop feeding");
- g_source_remove (app->sourceid);
- app->sourceid = 0;
- }
-}
-
-/* this callback is called when playbin2 has constructed a source object to read
- * from. Since we provided the appsrc:// uri to playbin2, this will be the
- * appsrc that we must handle. We set up some signals to start and stop pushing
- * data into appsrc */
-static void
-found_source (GObject * object, GObject * orig, GParamSpec * pspec, App * app)
-{
- /* get a handle to the appsrc */
- g_object_get (orig, pspec->name, &app->appsrc, NULL);
-
- GST_DEBUG ("got appsrc %p", app->appsrc);
-
- /* we can set the length in appsrc. This allows some elements to estimate the
- * total duration of the stream. It's a good idea to set the property when you
- * can but it's not required. */
- g_object_set (app->appsrc, "size", (gint64) app->length, NULL);
-
- /* configure the appsrc, we will push data into the appsrc from the
- * mainloop. */
- g_signal_connect (app->appsrc, "need-data", G_CALLBACK (start_feed), app);
- g_signal_connect (app->appsrc, "enough-data", G_CALLBACK (stop_feed), app);
-}
-
-static gboolean
-bus_message (GstBus * bus, GstMessage * message, App * app)
-{
- GST_DEBUG ("got message %s",
- gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
-
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_ERROR:
- g_error ("received error");
- g_main_loop_quit (app->loop);
- break;
- case GST_MESSAGE_EOS:
- g_main_loop_quit (app->loop);
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-int
-main (int argc, char *argv[])
-{
- App *app = &s_app;
- GError *error = NULL;
- GstBus *bus;
-
- gst_init (&argc, &argv);
-
- GST_DEBUG_CATEGORY_INIT (appsrc_playbin_debug, "appsrc-playbin", 0,
- "appsrc playbin example");
-
- if (argc < 2) {
- g_print ("usage: %s <filename>\n", argv[0]);
- return -1;
- }
-
- /* try to open the file as an mmapped file */
- app->file = g_mapped_file_new (argv[1], FALSE, &error);
- if (error) {
- g_print ("failed to open file: %s\n", error->message);
- g_error_free (error);
- return -2;
- }
- /* get some vitals, this will be used to read data from the mmapped file and
- * feed it to appsrc. */
- app->length = g_mapped_file_get_length (app->file);
- app->data = (guint8 *) g_mapped_file_get_contents (app->file);
- app->offset = 0;
-
- /* create a mainloop to get messages and to handle the idle handler that will
- * feed data to appsrc. */
- app->loop = g_main_loop_new (NULL, TRUE);
-
- app->playbin = gst_element_factory_make ("playbin2", NULL);
- g_assert (app->playbin);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (app->playbin));
-
- /* add watch for messages */
- gst_bus_add_watch (bus, (GstBusFunc) bus_message, app);
-
- /* set to read from appsrc */
- g_object_set (app->playbin, "uri", "appsrc://", NULL);
-
- /* get notification when the source is created so that we get a handle to it
- * and can configure it */
- g_signal_connect (app->playbin, "deep-notify::source",
- (GCallback) found_source, app);
-
- /* go to playing and wait in a mainloop. */
- gst_element_set_state (app->playbin, GST_STATE_PLAYING);
-
- /* this mainloop is stopped when we receive an error or EOS */
- g_main_loop_run (app->loop);
-
- GST_DEBUG ("stopping");
-
- gst_element_set_state (app->playbin, GST_STATE_NULL);
-
- /* free the file */
- g_mapped_file_unref (app->file);
-
- gst_object_unref (bus);
- g_main_loop_unref (app->loop);
-
- return 0;
-}
diff --git a/tests/examples/app/appsrc-stream2.c b/tests/examples/app/appsrc-stream2.c
deleted file mode 100644
index e0c8922a..00000000
--- a/tests/examples/app/appsrc-stream2.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/* GStreamer
- *
- * appsrc-stream2.c: example for using appsrc in streaming mode.
- *
- * Copyright (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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-/* FIXME: remove once we depend on GLib >= 2.22 */
-#if !GLIB_CHECK_VERSION (2, 22, 0)
-#define g_mapped_file_unref g_mapped_file_free
-#endif
-
-GST_DEBUG_CATEGORY (appsrc_playbin_debug);
-#define GST_CAT_DEFAULT appsrc_playbin_debug
-
-/*
- * an example application of using appsrc in streaming pull mode. When the
- * appsrc request data with the need-data signal, we retrieve a buffer of an
- * arbitrary size and push it to appsrc.
- *
- * This example keeps the internal buffer queue of appsrc to a minimal size,
- * only feeding data to appsrc when needed.
- *
- * This is a good example how one would deal with a live resource, such as a udp
- * socket where one would feed the most recently acquired buffer to appsrc.
- *
- * Usually one would timestamp the buffers with the running_time of the
- * pipeline or configure the appsrc to do timestamping by setting the
- * do-timestamp property to TRUE.
- *
- * Appsrc in streaming mode (the default) does not support seeking so we don't
- * have to handle any seek callbacks.
- *
- * Some formats are able to estimate the duration of the media file based on the
- * file length (mp3, mpeg,..), others report an unknown length (ogg,..).
- */
-typedef struct _App App;
-
-struct _App
-{
- GstElement *playbin;
- GstElement *appsrc;
-
- GMainLoop *loop;
-
- GMappedFile *file;
- guint8 *data;
- gsize length;
- guint64 offset;
-};
-
-App s_app;
-
-#define CHUNK_SIZE 4096
-
-/* This method is called by the need-data signal callback, we feed data into the
- * appsrc.
- */
-static void
-feed_data (GstElement * appsrc, guint size, App * app)
-{
- GstBuffer *buffer;
- guint len;
- GstFlowReturn ret;
-
- buffer = gst_buffer_new ();
-
- if (app->offset >= app->length) {
- /* we are EOS, send end-of-stream */
- g_signal_emit_by_name (app->appsrc, "end-of-stream", &ret);
- return;
- }
-
- /* read the next chunk */
- len = CHUNK_SIZE;
- if (app->offset + len > app->length)
- len = app->length - app->offset;
-
- GST_BUFFER_DATA (buffer) = app->data + app->offset;
- GST_BUFFER_SIZE (buffer) = len;
-
- GST_DEBUG ("feed buffer %p, offset %" G_GUINT64_FORMAT "-%u", buffer,
- app->offset, len);
- g_signal_emit_by_name (app->appsrc, "push-buffer", buffer, &ret);
- gst_buffer_unref (buffer);
-
- app->offset += len;
-
- return;
-}
-
-/* this callback is called when playbin2 has constructed a source object to read
- * from. Since we provided the appsrc:// uri to playbin2, this will be the
- * appsrc that we must handle. We set up a signals to push data into appsrc. */
-static void
-found_source (GObject * object, GObject * orig, GParamSpec * pspec, App * app)
-{
- /* get a handle to the appsrc */
- g_object_get (orig, pspec->name, &app->appsrc, NULL);
-
- GST_DEBUG ("got appsrc %p", app->appsrc);
-
- /* we can set the length in appsrc. This allows some elements to estimate the
- * total duration of the stream. It's a good idea to set the property when you
- * can but it's not required. */
- g_object_set (app->appsrc, "size", (gint64) app->length, NULL);
-
- /* configure the appsrc, we will push a buffer to appsrc when it needs more
- * data */
- g_signal_connect (app->appsrc, "need-data", G_CALLBACK (feed_data), app);
-}
-
-static gboolean
-bus_message (GstBus * bus, GstMessage * message, App * app)
-{
- GST_DEBUG ("got message %s",
- gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
-
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_ERROR:
- g_error ("received error");
- g_main_loop_quit (app->loop);
- break;
- case GST_MESSAGE_EOS:
- g_main_loop_quit (app->loop);
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-int
-main (int argc, char *argv[])
-{
- App *app = &s_app;
- GError *error = NULL;
- GstBus *bus;
-
- gst_init (&argc, &argv);
-
- GST_DEBUG_CATEGORY_INIT (appsrc_playbin_debug, "appsrc-playbin", 0,
- "appsrc playbin example");
-
- if (argc < 2) {
- g_print ("usage: %s <filename>\n", argv[0]);
- return -1;
- }
-
- /* try to open the file as an mmapped file */
- app->file = g_mapped_file_new (argv[1], FALSE, &error);
- if (error) {
- g_print ("failed to open file: %s\n", error->message);
- g_error_free (error);
- return -2;
- }
- /* get some vitals, this will be used to read data from the mmapped file and
- * feed it to appsrc. */
- app->length = g_mapped_file_get_length (app->file);
- app->data = (guint8 *) g_mapped_file_get_contents (app->file);
- app->offset = 0;
-
- /* create a mainloop to get messages */
- app->loop = g_main_loop_new (NULL, TRUE);
-
- app->playbin = gst_element_factory_make ("playbin2", NULL);
- g_assert (app->playbin);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (app->playbin));
-
- /* add watch for messages */
- gst_bus_add_watch (bus, (GstBusFunc) bus_message, app);
-
- /* set to read from appsrc */
- g_object_set (app->playbin, "uri", "appsrc://", NULL);
-
- /* get notification when the source is created so that we get a handle to it
- * and can configure it */
- g_signal_connect (app->playbin, "deep-notify::source",
- (GCallback) found_source, app);
-
- /* go to playing and wait in a mainloop. */
- gst_element_set_state (app->playbin, GST_STATE_PLAYING);
-
- /* this mainloop is stopped when we receive an error or EOS */
- g_main_loop_run (app->loop);
-
- GST_DEBUG ("stopping");
-
- gst_element_set_state (app->playbin, GST_STATE_NULL);
-
- /* free the file */
- g_mapped_file_unref (app->file);
-
- gst_object_unref (bus);
- g_main_loop_unref (app->loop);
-
- return 0;
-}
diff --git a/tests/examples/app/appsrc_ex.c b/tests/examples/app/appsrc_ex.c
deleted file mode 100644
index c7aa4b6c..00000000
--- a/tests/examples/app/appsrc_ex.c
+++ /dev/null
@@ -1,95 +0,0 @@
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/app/gstappsrc.h>
-#include <gst/app/gstappbuffer.h>
-#include <gst/app/gstappsink.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-
-typedef struct _App App;
-struct _App
-{
- GstElement *pipe;
- GstElement *src;
- GstElement *id;
- GstElement *sink;
-};
-
-App s_app;
-
-static void dont_eat_my_chicken_wings (void *priv);
-
-int
-main (int argc, char *argv[])
-{
- App *app = &s_app;
- int i;
-
- gst_init (&argc, &argv);
-
- app->pipe = gst_pipeline_new (NULL);
- g_assert (app->pipe);
-
- app->src = gst_element_factory_make ("appsrc", NULL);
- g_assert (app->src);
- gst_bin_add (GST_BIN (app->pipe), app->src);
-
- app->id = gst_element_factory_make ("identity", NULL);
- g_assert (app->id);
- gst_bin_add (GST_BIN (app->pipe), app->id);
-
- app->sink = gst_element_factory_make ("appsink", NULL);
- g_assert (app->sink);
- gst_bin_add (GST_BIN (app->pipe), app->sink);
-
- gst_element_link (app->src, app->id);
- gst_element_link (app->id, app->sink);
-
- gst_element_set_state (app->pipe, GST_STATE_PLAYING);
-
- for (i = 0; i < 10; i++) {
- GstBuffer *buf;
- void *data;
-
- data = malloc (100);
- memset (data, i, 100);
-
- buf = gst_app_buffer_new (data, 100, dont_eat_my_chicken_wings, data);
- printf ("%d: creating buffer for pointer %p, %p\n", i, data, buf);
- gst_app_src_push_buffer (GST_APP_SRC (app->src), buf);
- }
-
- /* push EOS */
- gst_app_src_end_of_stream (GST_APP_SRC (app->src));
-
- /* _is_eos() does not block and returns TRUE if there is not currently an EOS
- * to be retrieved */
- while (!gst_app_sink_is_eos (GST_APP_SINK (app->sink))) {
- GstBuffer *buf;
-
- /* pull the next item, this can return NULL when there is no more data and
- * EOS has been received */
- buf = gst_app_sink_pull_buffer (GST_APP_SINK (app->sink));
- printf ("retrieved buffer %p\n", buf);
- if (buf)
- gst_buffer_unref (buf);
- }
- gst_element_set_state (app->pipe, GST_STATE_NULL);
-
- return 0;
-}
-
-static void
-dont_eat_my_chicken_wings (void *priv)
-{
- printf ("freeing buffer for pointer %p\n", priv);
- free (priv);
-}
diff --git a/tests/examples/dynamic/.gitignore b/tests/examples/dynamic/.gitignore
deleted file mode 100644
index 99b7654b..00000000
--- a/tests/examples/dynamic/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-addstream
-codec-select
-sprinkle
-sprinkle2
-sprinkle3
diff --git a/tests/examples/dynamic/Makefile.am b/tests/examples/dynamic/Makefile.am
deleted file mode 100644
index 087d5fe4..00000000
--- a/tests/examples/dynamic/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-noinst_PROGRAMS = addstream codec-select sprinkle sprinkle2 sprinkle3
-
-addstream_SOURCES = addstream.c
-addstream_CFLAGS = $(GST_CFLAGS) -D_GNU_SOURCE
-addstream_LDFLAGS = $(GST_LIBS)
-
-codec_select_SOURCES = codec-select.c
-codec_select_CFLAGS = $(GST_CFLAGS) -D_GNU_SOURCE
-codec_select_LDFLAGS = $(GST_LIBS)
-
-sprinkle_SOURCES = sprinkle.c
-sprinkle_CFLAGS = $(GST_CFLAGS) -D_GNU_SOURCE
-sprinkle_LDFLAGS = $(GST_LIBS)
-
-sprinkle2_SOURCES = sprinkle2.c
-sprinkle2_CFLAGS = $(GST_CFLAGS) -D_GNU_SOURCE
-sprinkle2_LDFLAGS = $(GST_LIBS)
-
-sprinkle3_SOURCES = sprinkle3.c
-sprinkle3_CFLAGS = $(GST_CFLAGS) -D_GNU_SOURCE
-sprinkle3_LDFLAGS = $(GST_LIBS)
diff --git a/tests/examples/dynamic/addstream.c b/tests/examples/dynamic/addstream.c
deleted file mode 100644
index 66ad0bec..00000000
--- a/tests/examples/dynamic/addstream.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/* GStreamer
- *
- * addstream.c: sample application to dynamically add streams to a running
- * pipeline
- *
- * Copyright (C) <2007> Wim Taymans <wim dot taymans at gmail dot 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-static GstElement *pipeline;
-static GstClock *theclock;
-static GMainLoop *loop;
-static GstElement *bin1, *bin2, *bin3, *bin4, *bin5;
-
-/* start a bin with the given description */
-static GstElement *
-create_stream (const gchar * descr)
-{
- GstElement *bin;
- GError *error = NULL;
-
- bin = gst_parse_launch (descr, &error);
- if (error) {
- g_print ("pipeline could not be constructed: %s\n", error->message);
- g_error_free (error);
- return NULL;
- }
-
- /* add the bin to the pipeline now, this will set the current base_time of the
- * pipeline on the new bin. */
- gst_bin_add (GST_BIN_CAST (pipeline), bin);
-
- return bin;
-}
-
-static gboolean
-pause_play_stream (GstElement * bin, gint seconds)
-{
- gboolean punch_in;
- GstStateChangeReturn ret;
- GstClockTime now, base_time, running_time;
-
- /* get current running time, we need this value to continue playback of
- * non-live pipelines. */
- now = gst_clock_get_time (theclock);
- base_time = gst_element_get_base_time (bin);
-
- running_time = now - base_time;
-
- /* set the new bin to PAUSED, the parent bin will notice (because of the ASYNC
- * message and will perform latency calculations again when going to PLAYING
- * later. */
- ret = gst_element_set_state (bin, GST_STATE_PAUSED);
-
- switch (ret) {
- case GST_STATE_CHANGE_NO_PREROLL:
- /* live source, timestamps are running_time of the pipeline clock. */
- punch_in = FALSE;
- break;
- case GST_STATE_CHANGE_SUCCESS:
- /* success, no async state changes, same as async, timestamps start
- * from 0 */
- case GST_STATE_CHANGE_ASYNC:
- /* no live source, bin will preroll. We have to punch it in because in
- * this situation timestamps start from 0. */
- punch_in = TRUE;
- break;
- default:
- case GST_STATE_CHANGE_FAILURE:
- return FALSE;
- }
-
- if (seconds)
- g_usleep (seconds * G_USEC_PER_SEC);
-
- if (punch_in) {
- /* new bin has to be aligned with previous running_time. We do this by taking
- * the current absolute clock time and calculating the base time that would
- * give the previous running_time. We set this base_time on the bin before
- * setting it to PLAYING. */
- now = gst_clock_get_time (theclock);
- base_time = now - running_time;
-
- gst_element_set_base_time (bin, base_time);
- }
-
- /* now set the pipeline to PLAYING */
- gst_element_set_state (bin, GST_STATE_PLAYING);
-
- return TRUE;
-}
-
-static void
-message_received (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
-{
- const GstStructure *s;
-
- s = gst_message_get_structure (message);
- g_print ("message from \"%s\" (%s): ",
- GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))),
- gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
- if (s) {
- gchar *sstr;
-
- sstr = gst_structure_to_string (s);
- g_print ("%s\n", sstr);
- g_free (sstr);
- } else {
- g_print ("no message details\n");
- }
-}
-
-static void
-eos_message_received (GstBus * bus, GstMessage * message,
- GstPipeline * pipeline)
-{
- message_received (bus, message, pipeline);
- g_main_loop_quit (loop);
-}
-
-static gboolean
-perform_step (gpointer pstep)
-{
- gint step = GPOINTER_TO_INT (pstep);
-
- switch (step) {
- case 0:
- /* live stream locks on to running_time, pipeline configures latency. */
- g_print ("creating bin1\n");
- bin1 =
- create_stream
- ("( v4l2src ! ffmpegcolorspace ! timeoverlay ! queue ! xvimagesink name=v4llive )");
- pause_play_stream (bin1, 0);
- g_timeout_add (1000, (GSourceFunc) perform_step, GINT_TO_POINTER (1));
- break;
- case 1:
- /* live stream locks on to running_time, pipeline reconfigures latency
- * together with the previously added bin so that they run synchronized. */
- g_print ("creating bin2\n");
- bin2 = create_stream ("( alsasrc ! queue ! alsasink name=alsalive )");
- pause_play_stream (bin2, 0);
- g_timeout_add (1000, (GSourceFunc) perform_step, GINT_TO_POINTER (2));
- break;
- case 2:
- /* non-live stream, need base_time to align with current running live sources. */
- g_print ("creating bin3\n");
- bin3 = create_stream ("( audiotestsrc ! alsasink name=atnonlive )");
- pause_play_stream (bin3, 0);
- g_timeout_add (1000, (GSourceFunc) perform_step, GINT_TO_POINTER (3));
- break;
- case 3:
- g_print ("creating bin4\n");
- bin4 =
- create_stream
- ("( videotestsrc ! timeoverlay ! ffmpegcolorspace ! ximagesink name=vtnonlive )");
- pause_play_stream (bin4, 0);
- g_timeout_add (1000, (GSourceFunc) perform_step, GINT_TO_POINTER (4));
- break;
- case 4:
- /* live stream locks on to running_time */
- g_print ("creating bin5\n");
- bin5 =
- create_stream
- ("( videotestsrc is-live=1 ! timeoverlay ! ffmpegcolorspace ! ximagesink name=vtlive )");
- pause_play_stream (bin5, 0);
- g_timeout_add (1000, (GSourceFunc) perform_step, GINT_TO_POINTER (5));
- break;
- case 5:
- /* pause the fist live stream for 2 seconds */
- g_print ("PAUSE bin1 for 2 seconds\n");
- pause_play_stream (bin1, 2);
- /* pause the non-live stream for 2 seconds */
- g_print ("PAUSE bin4 for 2 seconds\n");
- pause_play_stream (bin4, 2);
- /* pause the pseudo live stream for 2 seconds */
- g_print ("PAUSE bin5 for 2 seconds\n");
- pause_play_stream (bin5, 2);
- g_print ("Waiting 5 seconds\n");
- g_timeout_add (5000, (GSourceFunc) perform_step, GINT_TO_POINTER (6));
- break;
- case 6:
- g_print ("quiting\n");
- g_main_loop_quit (loop);
- break;
- default:
- break;
- }
- return FALSE;
-}
-
-int
-main (int argc, char *argv[])
-{
- GstBus *bus;
-
- gst_init (&argc, &argv);
-
- loop = g_main_loop_new (NULL, TRUE);
-
- pipeline = gst_pipeline_new ("pipeline");
-
- /* setup message handling */
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
- g_signal_connect (bus, "message::error", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::warning", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::eos", (GCallback) eos_message_received,
- pipeline);
-
- /* we set the pipeline to PLAYING, this will distribute a default clock and
- * start running. no preroll is needed */
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- /* get the clock now. Since we never set the pipeline to PAUSED again, the
- * clock will not change, even when we add new clock providers later. */
- theclock = gst_element_get_clock (pipeline);
-
- /* start our actions while we are in the mainloop so that we can catch errors
- * and other messages. */
- g_idle_add ((GSourceFunc) perform_step, GINT_TO_POINTER (0));
- /* go to main loop */
- g_main_loop_run (loop);
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- gst_object_unref (bus);
- gst_object_unref (pipeline);
- gst_object_unref (theclock);
-
- return 0;
-}
diff --git a/tests/examples/dynamic/codec-select.c b/tests/examples/dynamic/codec-select.c
deleted file mode 100644
index 2d8f9fac..00000000
--- a/tests/examples/dynamic/codec-select.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/* GStreamer
- *
- * codec-select.c: sample application to dynamically select a codec
- *
- * Copyright (C) <2008> Wim Taymans <wim dot taymans at gmail dot 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.
- */
-
-/*
- * This example sets up a pipeline to 'encode' an audiotestsrc into 3 different
- * formats. The format can be selected dynamically at runtime.
- *
- * Each of the encoders require the audio in a specific different format.
- *
- * This example uses identity as the encoder and enforces the caps on identity
- * with a capsfilter.
- *
- * This is a good example of input and output selector and how these elements
- * preserve segment and timing information while switching between streams.
- */
-
-#include <string.h>
-#include <gst/gst.h>
-
-/* Create an encoder element.
- * We make a bin containing:
- *
- * audioresample ! <enccaps> ! identity
- *
- * The sinkpad of audioresample and source pad of identity are ghosted on the
- * bin.
- */
-static GstElement *
-make_encoder (const GstCaps * caps)
-{
- GstElement *result;
- GstElement *audioresample;
- GstElement *capsfilter;
- GstElement *identity;
- GstPad *pad;
-
- /* create result bin */
- result = gst_bin_new (NULL);
- g_assert (result);
-
- /* create elements */
- audioresample = gst_element_factory_make ("audioresample", NULL);
- g_assert (audioresample);
-
- capsfilter = gst_element_factory_make ("capsfilter", NULL);
- g_assert (capsfilter);
- g_object_set (capsfilter, "caps", caps, NULL);
-
- identity = gst_element_factory_make ("identity", NULL);
- g_assert (identity);
- g_object_set (identity, "silent", TRUE, NULL);
-
- /* add elements to result bin */
- gst_bin_add (GST_BIN (result), audioresample);
- gst_bin_add (GST_BIN (result), capsfilter);
- gst_bin_add (GST_BIN (result), identity);
-
- /* link elements */
- gst_element_link_pads (audioresample, "src", capsfilter, "sink");
- gst_element_link_pads (capsfilter, "src", identity, "sink");
-
- /* ghost src and sink pads */
- pad = gst_element_get_static_pad (audioresample, "sink");
- gst_element_add_pad (result, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- pad = gst_element_get_static_pad (identity, "src");
- gst_element_add_pad (result, gst_ghost_pad_new ("src", pad));
- gst_object_unref (pad);
-
- return result;
-}
-
-/*
- * We generate:
- *
- * audiotestsrc ! <audiocaps> ! output-selector ! [enc1 .. enc3] ! input-selector
- * select-all = true ! fakesink
- *
- * <audiocaps> makes sure we only produce one format from the audiotestsrc.
- *
- * Each encX element consists of:
- *
- * audioresample ! <enccaps> ! identity !
- *
- * This way we can simply switch encoders without having to renegotiate.
- */
-static GstElement *
-make_pipeline (void)
-{
- GstElement *result;
- GstElement *audiotestsrc;
- GstElement *audiocaps;
- GstElement *outputselect;
- GstElement *inputselect;
- GstElement *sink;
- GstCaps *caps;
- GstCaps *capslist[3];
- gint i;
-
- /* create result pipeline */
- result = gst_pipeline_new (NULL);
- g_assert (result);
-
- /* create various elements */
- audiotestsrc = gst_element_factory_make ("audiotestsrc", NULL);
- g_object_set (audiotestsrc, "num-buffers", 1000, NULL);
- g_assert (audiotestsrc);
-
- audiocaps = gst_element_factory_make ("capsfilter", NULL);
- g_assert (audiocaps);
-
- caps =
- gst_caps_from_string
- ("audio/x-raw-int,signed=true,width=16,depth=16,rate=48000,channels=1");
- g_object_set (audiocaps, "caps", caps, NULL);
- gst_caps_unref (caps);
-
- outputselect = gst_element_factory_make ("output-selector", "select");
- g_assert (outputselect);
-
- inputselect = gst_element_factory_make ("input-selector", NULL);
- g_assert (inputselect);
- g_object_set (inputselect, "select-all", TRUE, NULL);
-
- sink = gst_element_factory_make ("fakesink", NULL);
- g_object_set (sink, "sync", TRUE, NULL);
- g_object_set (sink, "silent", TRUE, NULL);
- g_assert (sink);
-
- /* add elements */
- gst_bin_add (GST_BIN (result), audiotestsrc);
- gst_bin_add (GST_BIN (result), audiocaps);
- gst_bin_add (GST_BIN (result), outputselect);
- gst_bin_add (GST_BIN (result), inputselect);
- gst_bin_add (GST_BIN (result), sink);
-
- /* link elements */
- gst_element_link_pads (audiotestsrc, "src", audiocaps, "sink");
- gst_element_link_pads (audiocaps, "src", outputselect, "sink");
- gst_element_link_pads (inputselect, "src", sink, "sink");
-
- /* make caps */
- capslist[0] =
- gst_caps_from_string
- ("audio/x-raw-int,signed=true,width=16,depth=16,rate=48000,channels=1");
- capslist[1] =
- gst_caps_from_string
- ("audio/x-raw-int,signed=true,width=16,depth=16,rate=16000,channels=1");
- capslist[2] =
- gst_caps_from_string
- ("audio/x-raw-int,signed=true,width=16,depth=16,rate=8000,channels=1");
-
- /* create encoder elements */
- for (i = 0; i < 3; i++) {
- GstElement *encoder;
- GstPad *srcpad, *sinkpad;
-
- encoder = make_encoder (capslist[i]);
- g_assert (encoder);
-
- gst_bin_add (GST_BIN (result), encoder);
-
- srcpad = gst_element_get_request_pad (outputselect, "src%d");
- sinkpad = gst_element_get_static_pad (encoder, "sink");
- gst_pad_link (srcpad, sinkpad);
- gst_object_unref (srcpad);
- gst_object_unref (sinkpad);
-
- srcpad = gst_element_get_static_pad (encoder, "src");
- sinkpad = gst_element_get_request_pad (inputselect, "sink%d");
- gst_pad_link (srcpad, sinkpad);
- gst_object_unref (srcpad);
- gst_object_unref (sinkpad);
- }
-
- return result;
-}
-
-static gboolean
-do_switch (GstElement * pipeline)
-{
- gint rand;
- GstElement *select;
- gchar *name;
- GstPad *pad;
-
- rand = g_random_int_range (0, 3);
-
- g_print ("switching to %d\n", rand);
-
- /* find the selector */
- select = gst_bin_get_by_name (GST_BIN (pipeline), "select");
-
- /* get the named pad */
- name = g_strdup_printf ("src%d", rand);
- pad = gst_element_get_static_pad (select, name);
- g_free (name);
-
- /* set the active pad */
- g_object_set (select, "active-pad", pad, NULL);
-
- return TRUE;
-}
-
-static gboolean
-my_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
-{
- GstElement *sender = (GstElement *) GST_MESSAGE_SRC (message);
- const gchar *name = gst_element_get_name (sender);
- GMainLoop *loop = (GMainLoop *) data;
-
- g_print ("Got %s message from %s\n", GST_MESSAGE_TYPE_NAME (message), name);
-
- switch (GST_MESSAGE_TYPE (message)) {
-
- case GST_MESSAGE_ERROR:{
- GError *err;
- gchar *debug;
-
- gst_message_parse_error (message, &err, &debug);
- g_print ("Error: %s (%s)\n", err->message, debug);
- g_error_free (err);
- g_free (debug);
-
- g_main_loop_quit (loop);
- break;
- }
- case GST_MESSAGE_EOS:
- /* end-of-stream */
- g_main_loop_quit (loop);
- break;
- default:
- /* unhandled message */
- break;
- }
-
- return TRUE;
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
- GstElement *pipeline;
- GstBus *bus;
- GMainLoop *loop;
-
- /* init GStreamer */
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
-
- /* set up */
- pipeline = make_pipeline ();
-
- g_signal_connect (pipeline, "deep_notify",
- G_CALLBACK (gst_object_default_deep_notify), NULL);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_watch (bus, my_bus_callback, loop);
- gst_object_unref (bus);
-
- g_print ("Starting pipeline\n");
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- /* add a timeout to cycle between the formats */
- g_timeout_add (1000, (GSourceFunc) do_switch, pipeline);
-
- /* now run */
- g_main_loop_run (loop);
-
- g_print ("Nulling pipeline\n");
-
- /* also clean up */
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- return 0;
-}
diff --git a/tests/examples/dynamic/sprinkle.c b/tests/examples/dynamic/sprinkle.c
deleted file mode 100644
index 1b75840a..00000000
--- a/tests/examples/dynamic/sprinkle.c
+++ /dev/null
@@ -1,264 +0,0 @@
-/* GStreamer
- *
- * sprinkle.c: sample application to dynamically mix tones with adder
- *
- * Copyright (C) <2009> Wim Taymans <wim dot taymans at gmail dot 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.
- */
-
-/*
- * Produces a sweeping sprinkle of tones by dynamically adding and removing
- * elements to adder.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-static GstElement *pipeline, *adder;
-static GMainLoop *loop;
-
-typedef struct
-{
- GstElement *element;
- GstPad *srcpad;
- GstPad *sinkpad;
- gdouble freq;
-} SourceInfo;
-
-/* dynamically add the source to the pipeline and link it to a new pad on
- * adder */
-static SourceInfo *
-add_source (gdouble freq)
-{
- SourceInfo *info;
-
- info = g_new0 (SourceInfo, 1);
- info->freq = freq;
-
- /* make source with unique name */
- info->element = gst_element_factory_make ("audiotestsrc", NULL);
-
- g_object_set (info->element, "freq", freq, NULL);
-
- /* add to the bin */
- gst_bin_add (GST_BIN (pipeline), info->element);
-
- /* get pad from the element */
- info->srcpad = gst_element_get_static_pad (info->element, "src");
-
- /* get new pad from adder, adder will now wait for data on this pad */
- info->sinkpad = gst_element_get_request_pad (adder, "sink%d");
-
- /* link pad to adder */
- gst_pad_link (info->srcpad, info->sinkpad);
-
- /* and play the element */
- gst_element_set_state (info->element, GST_STATE_PLAYING);
-
- g_print ("added freq %f\n", info->freq);
-
- return info;
-}
-
-/* remove the source from the pipeline after removing it from adder */
-static void
-remove_source (SourceInfo * info)
-{
- g_print ("remove freq %f\n", info->freq);
-
- /* lock the state so that we can put it to NULL without the parent messing
- * with our state */
- gst_element_set_locked_state (info->element, TRUE);
-
- /* first stop the source. Remember that this might block when in the PAUSED
- * state. Alternatively one could send EOS to the source, install an event
- * probe and schedule a state change/unlink/release from the mainthread.
- * Note that changing the state of a source makes it emit an EOS, which can
- * make adder go EOS. */
- gst_element_set_state (info->element, GST_STATE_NULL);
-
- /* unlink from adder */
- gst_pad_unlink (info->srcpad, info->sinkpad);
- gst_object_unref (info->srcpad);
-
- /* remove from the bin */
- gst_bin_remove (GST_BIN (pipeline), info->element);
-
- /* give back the pad */
- gst_element_release_request_pad (adder, info->sinkpad);
- gst_object_unref (info->sinkpad);
-
- g_free (info);
-}
-
-/* we'll keep the state of the sources in this structure. We keep 3 sources
- * alive */
-typedef struct
-{
- guint count;
- SourceInfo *infos[3];
-} SprinkleState;
-
-static SprinkleState *
-create_state (void)
-{
- SprinkleState *state;
-
- state = g_new0 (SprinkleState, 1);
-
- return state;
-}
-
-static void
-free_state (SprinkleState * state)
-{
- SourceInfo *info;
- gint i;
-
- for (i = 0; i < 3; i++) {
- info = state->infos[i];
- if (info)
- remove_source (info);
- }
-
- g_free (state);
-}
-
-static gboolean
-do_sprinkle (SprinkleState * state)
-{
- SourceInfo *info;
- gint i;
-
- /* first remove the oldest info */
- info = state->infos[2];
-
- if (info)
- remove_source (info);
-
- /* move sources */
- for (i = 2; i > 0; i--) {
- state->infos[i] = state->infos[i - 1];
- }
-
- /* add new source, stop adding sources after 10 rounds. */
- if (state->count < 10) {
- state->infos[0] = add_source ((state->count * 100) + 200);
- state->count++;
- } else {
- state->infos[0] = NULL;
- }
- return TRUE;
-}
-
-static void
-message_received (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
-{
- const GstStructure *s;
-
- s = gst_message_get_structure (message);
- g_print ("message from \"%s\" (%s): ",
- GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))),
- gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
- if (s) {
- gchar *sstr;
-
- sstr = gst_structure_to_string (s);
- g_print ("%s\n", sstr);
- g_free (sstr);
- } else {
- g_print ("no message details\n");
- }
-}
-
-static void
-eos_message_received (GstBus * bus, GstMessage * message,
- GstPipeline * pipeline)
-{
- message_received (bus, message, pipeline);
- g_main_loop_quit (loop);
-}
-
-int
-main (int argc, char *argv[])
-{
- GstBus *bus;
- GstElement *filter, *convert, *sink;
- GstCaps *caps;
- gboolean res;
- SprinkleState *state;
-
- gst_init (&argc, &argv);
-
- loop = g_main_loop_new (NULL, TRUE);
-
- pipeline = gst_pipeline_new ("pipeline");
-
- /* add the fixed part to the pipeline. Remember that we need a capsfilter
- * after adder so that multiple sources are not racing to negotiate
- * a format */
- adder = gst_element_factory_make ("adder", "adder");
- filter = gst_element_factory_make ("capsfilter", "filter");
- convert = gst_element_factory_make ("audioconvert", "convert");
- sink = gst_element_factory_make ("autoaudiosink", "sink");
-
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
- "channels", G_TYPE_INT, 1,
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- "rate", G_TYPE_INT, 44100, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
- g_object_set (filter, "caps", caps, NULL);
- gst_caps_unref (caps);
-
- gst_bin_add_many (GST_BIN (pipeline), adder, filter, convert, sink, NULL);
-
- res = gst_element_link_many (adder, filter, convert, sink, NULL);
- g_assert (res);
-
- /* setup message handling */
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
- g_signal_connect (bus, "message::error", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::warning", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::eos", (GCallback) eos_message_received,
- pipeline);
-
- /* we set the pipeline to PLAYING, the pipeline will not yet preroll because
- * there is no source providing data for it yet */
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- /* and add the function that modifies the pipeline every 100ms */
- state = create_state ();
- g_timeout_add (100, (GSourceFunc) do_sprinkle, state);
-
- /* go to main loop */
- g_main_loop_run (loop);
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- free_state (state);
- gst_object_unref (bus);
- gst_object_unref (pipeline);
-
- return 0;
-}
diff --git a/tests/examples/dynamic/sprinkle2.c b/tests/examples/dynamic/sprinkle2.c
deleted file mode 100644
index abab47ce..00000000
--- a/tests/examples/dynamic/sprinkle2.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/* GStreamer
- *
- * sprinkle.c: sample application to dynamically mix tones with adder
- *
- * Copyright (C) <2009> Wim Taymans <wim dot taymans at gmail dot 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.
- */
-
-/*
- * Produces a sweeping sprinkle of tones by dynamically adding and removing
- * elements to adder.
- *
- * gcc `pkg-config --cflags --libs gstreamer-0.10` sprinkle2.c -osprinkle2
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-static GstElement *pipeline, *adder;
-static GMainLoop *loop;
-
-typedef struct
-{
- GstElement *src, *fx;
- GstPad *src_srcpad;
- GstPad *fx_sinkpad, *fx_srcpad;
- GstPad *adder_sinkpad;
- gdouble freq;
- gfloat pos;
-} SourceInfo;
-
-/* dynamically add the source to the pipeline and link it to a new pad on
- * adder */
-static SourceInfo *
-add_source (gdouble freq, gfloat pos)
-{
- SourceInfo *info;
-
- info = g_new0 (SourceInfo, 1);
- info->freq = freq;
- info->pos = pos;
-
- /* make source with unique name */
- info->src = gst_element_factory_make ("audiotestsrc", NULL);
- info->fx = gst_element_factory_make ("audiopanorama", NULL);
-
- g_object_set (info->src, "freq", freq, "volume", (gdouble) 0.35, NULL);
- g_object_set (info->fx, "panorama", pos, NULL);
-
- /* add to the bin */
- gst_bin_add (GST_BIN (pipeline), info->src);
- gst_bin_add (GST_BIN (pipeline), info->fx);
-
- /* get pads from the elements */
- info->src_srcpad = gst_element_get_static_pad (info->src, "src");
- info->fx_srcpad = gst_element_get_static_pad (info->fx, "src");
- info->fx_sinkpad = gst_element_get_static_pad (info->fx, "sink");
-
- /* get new pad from adder, adder will now wait for data on this pad */
- info->adder_sinkpad = gst_element_get_request_pad (adder, "sink%d");
-
- /* link src to fx and fx to adder */
- gst_pad_link (info->fx_srcpad, info->adder_sinkpad);
- gst_pad_link (info->src_srcpad, info->fx_sinkpad);
-
- /* and play the elements, change the state from sink to source */
- gst_element_set_state (info->fx, GST_STATE_PLAYING);
- gst_element_set_state (info->src, GST_STATE_PLAYING);
-
- g_print ("added freq %5.0f, pos %3.1f\n", info->freq, info->pos);
-
- return info;
-}
-
-/* remove the source from the pipeline after removing it from adder */
-static void
-remove_source (SourceInfo * info)
-{
- g_print ("remove freq %5.0f, pos %3.1f\n", info->freq, info->pos);
-
- /* lock the state so that we can put it to NULL without the parent messing
- * with our state */
- gst_element_set_locked_state (info->src, TRUE);
- gst_element_set_locked_state (info->fx, TRUE);
-
- /* first stop the source. Remember that this might block when in the PAUSED
- * state. Alternatively one could send EOS to the source, install an event
- * probe and schedule a state change/unlink/release from the mainthread. */
- gst_element_set_state (info->fx, GST_STATE_NULL);
- /* NOTE that the source emits EOS when shutting down but the EOS will not
- * reach the adder sinkpad because the effect is in the NULL state. We will
- * send an EOS to adder later. */
- gst_element_set_state (info->src, GST_STATE_NULL);
-
- /* unlink from adder */
- gst_pad_unlink (info->src_srcpad, info->fx_sinkpad);
- gst_pad_unlink (info->fx_srcpad, info->adder_sinkpad);
- gst_object_unref (info->src_srcpad);
- gst_object_unref (info->fx_srcpad);
- gst_object_unref (info->fx_sinkpad);
-
- /* remove from the bin */
- gst_bin_remove (GST_BIN (pipeline), info->src);
- gst_bin_remove (GST_BIN (pipeline), info->fx);
-
- /* send EOS to the sinkpad to make adder EOS when needed */
- gst_pad_send_event (info->adder_sinkpad, gst_event_new_eos ());
-
- /* give back the pad */
- gst_element_release_request_pad (adder, info->adder_sinkpad);
- gst_object_unref (info->adder_sinkpad);
-
- g_free (info);
-}
-
-/* we'll keep the state of the sources in this structure. We keep 3 sources
- * alive */
-typedef struct
-{
- guint count;
- SourceInfo *infos[3];
-} SprinkleState;
-
-static SprinkleState *
-create_state (void)
-{
- SprinkleState *state;
-
- state = g_new0 (SprinkleState, 1);
-
- return state;
-}
-
-static void
-free_state (SprinkleState * state)
-{
- SourceInfo *info;
- gint i;
-
- for (i = 0; i < 3; i++) {
- info = state->infos[i];
- if (info)
- remove_source (info);
- }
-
- g_free (state);
-}
-
-static gboolean
-do_sprinkle (SprinkleState * state)
-{
- SourceInfo *info;
- gint i;
-
- /* first remove the oldest info */
- info = state->infos[2];
-
- if (info)
- remove_source (info);
-
- /* move sources */
- for (i = 2; i > 0; i--) {
- state->infos[i] = state->infos[i - 1];
- }
-
- /* add new source, stop adding sources after 10 rounds. */
- if (state->count < 20) {
- state->infos[0] = add_source (
- (gdouble) ((state->count * 100) + 200),
- ((gfloat) (state->count % 5) / 2.0 - 1.0));
- state->count++;
- } else {
- state->infos[0] = NULL;
- }
- return TRUE;
-}
-
-static void
-message_received (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
-{
- const GstStructure *s;
-
- s = gst_message_get_structure (message);
- g_print ("message from \"%s\" (%s): ",
- GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))),
- gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
- if (s) {
- gchar *sstr;
-
- sstr = gst_structure_to_string (s);
- g_print ("%s\n", sstr);
- g_free (sstr);
- } else {
- g_print ("no message details\n");
- }
-}
-
-static void
-eos_message_received (GstBus * bus, GstMessage * message,
- GstPipeline * pipeline)
-{
- message_received (bus, message, pipeline);
- g_main_loop_quit (loop);
-}
-
-int
-main (int argc, char *argv[])
-{
- GstBus *bus;
- GstElement *filter, *convert, *sink;
- GstCaps *caps;
- gboolean res;
- SprinkleState *state;
-
- gst_init (&argc, &argv);
-
- loop = g_main_loop_new (NULL, TRUE);
-
- pipeline = gst_pipeline_new ("pipeline");
-
- /* add the fixed part to the pipeline. Remember that we need a capsfilter
- * after adder so that multiple sources are not racing to negotiate
- * a format */
- adder = gst_element_factory_make ("adder", "adder");
- filter = gst_element_factory_make ("capsfilter", "filter");
- convert = gst_element_factory_make ("audioconvert", "convert");
- sink = gst_element_factory_make ("autoaudiosink", "sink");
-
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
- "channels", G_TYPE_INT, 2,
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- "rate", G_TYPE_INT, 44100, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
- g_object_set (filter, "caps", caps, NULL);
- gst_caps_unref (caps);
-
- gst_bin_add_many (GST_BIN (pipeline), adder, filter, convert, sink, NULL);
-
- res = gst_element_link_many (adder, filter, convert, sink, NULL);
- g_assert (res);
-
- /* setup message handling */
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
- g_signal_connect (bus, "message::error", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::warning", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::eos", (GCallback) eos_message_received,
- pipeline);
-
- /* we set the pipeline to PLAYING, the pipeline will not yet preroll because
- * there is no source providing data for it yet */
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- /* and add the function that modifies the pipeline every 100ms */
- state = create_state ();
- g_timeout_add (100, (GSourceFunc) do_sprinkle, state);
-
- /* go to main loop */
- g_main_loop_run (loop);
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- free_state (state);
- gst_object_unref (bus);
- gst_object_unref (pipeline);
-
- return 0;
-}
diff --git a/tests/examples/dynamic/sprinkle3.c b/tests/examples/dynamic/sprinkle3.c
deleted file mode 100644
index 5983c335..00000000
--- a/tests/examples/dynamic/sprinkle3.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/* GStreamer
- *
- * sprinkle.c: sample application to dynamically mix tones with adder
- *
- * Copyright (C) <2009> Wim Taymans <wim dot taymans at gmail dot 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.
- */
-
-/*
- * Produces a sweeping sprinkle of tones by dynamically adding and removing
- * elements to adder.
- *
- * gcc `pkg-config --cflags --libs gstreamer-0.10` sprinkle3.c -osprinkle3
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-static GstElement *pipeline, *adder;
-static GMainLoop *loop;
-
-typedef struct
-{
- GstElement *bin, *src, *fx;
- GstPad *src_srcpad;
- GstPad *fx_sinkpad, *fx_srcpad;
- GstPad *adder_sinkpad;
- GstPad *bin_srcpad;
- gdouble freq;
- gfloat pos;
-} SourceInfo;
-
-/* dynamically add the source to the pipeline and link it to a new pad on
- * adder */
-static SourceInfo *
-add_source (gdouble freq, gfloat pos)
-{
- SourceInfo *info;
-
- info = g_new0 (SourceInfo, 1);
- info->freq = freq;
- info->pos = pos;
-
- /* make source with unique name */
- info->bin = gst_element_factory_make ("bin", NULL);
- info->src = gst_element_factory_make ("audiotestsrc", NULL);
- info->fx = gst_element_factory_make ("audiopanorama", NULL);
-
- g_object_set (info->src, "freq", freq, "volume", (gdouble) 0.35, NULL);
- g_object_set (info->fx, "panorama", pos, NULL);
-
- /* add to the bin */
- gst_bin_add (GST_BIN (info->bin), info->src);
- gst_bin_add (GST_BIN (info->bin), info->fx);
-
- /* get pads from the elements */
- info->src_srcpad = gst_element_get_static_pad (info->src, "src");
- info->fx_srcpad = gst_element_get_static_pad (info->fx, "src");
- info->fx_sinkpad = gst_element_get_static_pad (info->fx, "sink");
-
- /* create and add a pad for the bin */
- info->bin_srcpad = gst_ghost_pad_new ("src", info->fx_srcpad);
- gst_element_add_pad (info->bin, info->bin_srcpad);
-
- /* get new pad from adder, adder will now wait for data on this pad */
- info->adder_sinkpad = gst_element_get_request_pad (adder, "sink%d");
-
- /* link inside the bin */
- gst_pad_link (info->src_srcpad, info->fx_sinkpad);
-
- /* add bin to pipeline */
- gst_bin_add (GST_BIN (pipeline), info->bin);
-
- /* link bin to adder */
- gst_pad_link (info->bin_srcpad, info->adder_sinkpad);
-
- /* and play the elements */
- gst_element_set_state (info->bin, GST_STATE_PLAYING);
-
- g_print ("added freq %5.0f, pos %3.1f\n", info->freq, info->pos);
-
- return info;
-}
-
-/* remove the source from the pipeline after removing it from adder */
-static void
-remove_source (SourceInfo * info)
-{
- g_print ("remove freq %5.0f, pos %3.1f\n", info->freq, info->pos);
-
- /* lock the state so that we can put it to NULL without the parent messing
- * with our state */
- gst_element_set_locked_state (info->bin, TRUE);
-
- /* first stop the source. Remember that this might block when in the PAUSED
- * state. Alternatively one could send EOS to the source, install an event
- * probe and schedule a state change/unlink/release from the mainthread. */
- /* NOTE that the source inside the bin will emit EOS but it will not reach
- * adder because the element after the source is shut down first. We will send
- * EOS later */
- gst_element_set_state (info->bin, GST_STATE_NULL);
-
- /* unlink bin from adder */
- gst_pad_unlink (info->bin_srcpad, info->adder_sinkpad);
-
- /* release pads */
- gst_object_unref (info->src_srcpad);
- gst_object_unref (info->fx_srcpad);
- gst_object_unref (info->fx_sinkpad);
-
- /* remove from the bin */
- gst_bin_remove (GST_BIN (pipeline), info->bin);
-
- /* send EOS to the sinkpad to make adder EOS when needed */
- gst_pad_send_event (info->adder_sinkpad, gst_event_new_eos ());
-
- /* give back the pad */
- gst_element_release_request_pad (adder, info->adder_sinkpad);
- gst_object_unref (info->adder_sinkpad);
-
- g_free (info);
-}
-
-/* we'll keep the state of the sources in this structure. We keep 3 sources
- * alive */
-typedef struct
-{
- guint count;
- SourceInfo *infos[3];
-} SprinkleState;
-
-static SprinkleState *
-create_state (void)
-{
- SprinkleState *state;
-
- state = g_new0 (SprinkleState, 1);
-
- return state;
-}
-
-static void
-free_state (SprinkleState * state)
-{
- SourceInfo *info;
- gint i;
-
- for (i = 0; i < 3; i++) {
- info = state->infos[i];
- if (info)
- remove_source (info);
- }
-
- g_free (state);
-}
-
-static gboolean
-do_sprinkle (SprinkleState * state)
-{
- SourceInfo *info;
- gint i;
-
- /* first remove the oldest info */
- info = state->infos[2];
-
- if (info)
- remove_source (info);
-
- /* move sources */
- for (i = 2; i > 0; i--) {
- state->infos[i] = state->infos[i - 1];
- }
-
- /* add new source, stop adding sources after 10 rounds. */
- if (state->count < 20) {
- state->infos[0] = add_source (
- (gdouble) ((state->count * 100) + 200),
- ((gfloat) (state->count % 5) / 2.0 - 1.0));
- state->count++;
- } else {
- state->infos[0] = NULL;
- }
-
- GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (pipeline),
- /*GST_DEBUG_GRAPH_SHOW_ALL, */
- GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS | GST_DEBUG_GRAPH_SHOW_STATES,
- "sprinkle3");
- return TRUE;
-}
-
-static void
-message_received (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
-{
- const GstStructure *s;
-
- s = gst_message_get_structure (message);
- g_print ("message from \"%s\" (%s): ",
- GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))),
- gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
- if (s) {
- gchar *sstr;
-
- sstr = gst_structure_to_string (s);
- g_print ("%s\n", sstr);
- g_free (sstr);
- } else {
- g_print ("no message details\n");
- }
-}
-
-static void
-eos_message_received (GstBus * bus, GstMessage * message,
- GstPipeline * pipeline)
-{
- message_received (bus, message, pipeline);
- g_main_loop_quit (loop);
-}
-
-int
-main (int argc, char *argv[])
-{
- GstBus *bus;
- GstElement *filter, *convert, *sink;
- GstCaps *caps;
- gboolean res;
- SprinkleState *state;
-
- gst_init (&argc, &argv);
-
- loop = g_main_loop_new (NULL, TRUE);
-
- pipeline = gst_pipeline_new ("pipeline");
-
- /* add the fixed part to the pipeline. Remember that we need a capsfilter
- * after adder so that multiple sources are not racing to negotiate
- * a format */
- adder = gst_element_factory_make ("adder", "adder");
- filter = gst_element_factory_make ("capsfilter", "filter");
- convert = gst_element_factory_make ("audioconvert", "convert");
- sink = gst_element_factory_make ("autoaudiosink", "sink");
-
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
- "channels", G_TYPE_INT, 2,
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- "rate", G_TYPE_INT, 44100, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
- g_object_set (filter, "caps", caps, NULL);
- gst_caps_unref (caps);
-
- gst_bin_add_many (GST_BIN (pipeline), adder, filter, convert, sink, NULL);
-
- res = gst_element_link_many (adder, filter, convert, sink, NULL);
- g_assert (res);
-
- /* setup message handling */
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
- g_signal_connect (bus, "message::error", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::warning", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::eos", (GCallback) eos_message_received,
- pipeline);
-
- /* we set the pipeline to PLAYING, the pipeline will not yet preroll because
- * there is no source providing data for it yet */
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- /* and add the function that modifies the pipeline every 100ms */
- state = create_state ();
- g_timeout_add (100, (GSourceFunc) do_sprinkle, state);
-
- /* go to main loop */
- g_main_loop_run (loop);
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- free_state (state);
- gst_object_unref (bus);
- gst_object_unref (pipeline);
-
- return 0;
-}
diff --git a/tests/examples/gio/.gitignore b/tests/examples/gio/.gitignore
deleted file mode 100644
index 673c0788..00000000
--- a/tests/examples/gio/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-giosrc-mounting
diff --git a/tests/examples/gio/Makefile.am b/tests/examples/gio/Makefile.am
deleted file mode 100644
index 278edb71..00000000
--- a/tests/examples/gio/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-if HAVE_GTK
-if USE_GIO
-noinst_PROGRAMS = giosrc-mounting
-giosrc_mounting_SOURCES = giosrc-mounting.c
-giosrc_mounting_CFLAGS = $(GTK_CFLAGS) $(GIO_CFLAGS) $(GST_CFLAGS)
-giosrc_mounting_LDFLAGS = $(GTK_LIBS) $(GIO_LIBS) $(GST_LIBS)
-endif
-endif
diff --git a/tests/examples/gio/giosrc-mounting.c b/tests/examples/gio/giosrc-mounting.c
deleted file mode 100644
index b6d4731a..00000000
--- a/tests/examples/gio/giosrc-mounting.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* GStreamer
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <gst/gst.h>
-#include <gtk/gtk.h>
-
-#include <string.h>
-
-static GstElement *pipeline = NULL;
-
-static void
-mount_cb (GObject * obj, GAsyncResult * res, gpointer user_data)
-{
- gboolean ret;
- GError *err = NULL;
-
- ret = g_file_mount_enclosing_volume_finish (G_FILE (obj), res, &err);
-
- if (ret) {
- g_print ("mounted successfully\n");
- gst_bus_set_flushing ((GstBus *) user_data, FALSE);
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- } else {
- g_print ("mounting failed: %s\n", err->message);
- g_clear_error (&err);
- gtk_main_quit ();
- }
-}
-
-gboolean
-message_handler (GstBus * bus, GstMessage * message, gpointer user_data)
-{
-
- switch (message->type) {
- case GST_MESSAGE_ELEMENT:{
- const GstStructure *s = gst_message_get_structure (message);
- const gchar *name = gst_structure_get_name (s);
-
- if (strcmp (name, "not-mounted") == 0) {
- GMountOperation *mop = gtk_mount_operation_new (NULL);
- GFile *file =
- G_FILE (g_value_get_object (gst_structure_get_value
- (message->structure, "file")));
-
- g_print ("not-mounted\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_bus_set_flushing (bus, TRUE);
-
- g_file_mount_enclosing_volume (file, G_MOUNT_MOUNT_NONE,
- mop, NULL, mount_cb, bus);
-
- g_object_unref (mop);
- }
- break;
- }
-
- case GST_MESSAGE_EOS:
- g_print ("EOS\n");
- gtk_main_quit ();
- break;
- case GST_MESSAGE_ERROR:{
- GError *err = NULL;
-
- gst_message_parse_error (message, &err, NULL);
- g_print ("error: %s\n", err->message);
- g_clear_error (&err);
-
- gtk_main_quit ();
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-int
-main (int argc, char *argv[])
-{
- GstBus *bus;
- gint watch_id;
-
- if (argc != 2) {
- g_print ("usage: giosrc-mounting URI\n");
- return -1;
- }
-
- gst_init (NULL, NULL);
- gtk_init (NULL, NULL);
-
- pipeline = gst_element_factory_make ("playbin2", NULL);
- g_assert (pipeline);
- g_object_set (G_OBJECT (pipeline), "uri", argv[1], NULL);
-
- bus = gst_element_get_bus (pipeline);
- watch_id = gst_bus_add_watch (bus, message_handler, NULL);
- gst_object_unref (bus);
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- gtk_main ();
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- return 0;
-}
diff --git a/tests/examples/overlay/.gitignore b/tests/examples/overlay/.gitignore
deleted file mode 100644
index c8795e7f..00000000
--- a/tests/examples/overlay/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-gtk-xoverlay
-qt-xoverlay
-qtgv-xoverlay
-moc_*.cpp
-
diff --git a/tests/examples/overlay/Makefile.am b/tests/examples/overlay/Makefile.am
deleted file mode 100644
index 55085521..00000000
--- a/tests/examples/overlay/Makefile.am
+++ /dev/null
@@ -1,47 +0,0 @@
-EXAMPLES =
-
-if USE_X
-
-if HAVE_GTK_X11
-EXAMPLES += gtk-xoverlay
-
-gtk_xoverlay_SOURCES = gtk-xoverlay.c
-gtk_xoverlay_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS) $(GTK_CFLAGS)
-gtk_xoverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS) \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
-endif
-
-if HAVE_QT
-EXAMPLES += qt-xoverlay
-
-qt_xoverlay_SOURCES = qt-xoverlay.cpp
-qt_xoverlay_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CXXFLAGS) $(X_CFLAGS) $(QT_CFLAGS)
-qt_xoverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(QT_LIBS) \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
-
-endif
-
-if HAVE_QT_GV
-EXAMPLES += qtgv-xoverlay
-
-qtgv_xoverlay_SOURCES = qtgv-xoverlay.cpp
-qtgv_xoverlay_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CXXFLAGS) $(X_CFLAGS) $(QT_CFLAGS)
-qtgv_xoverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(QT_LIBS) \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
-
-# qt moc support, according to http://qtnode.net/wiki/Qt_with_autotools
-
-nodist_qtgv_xoverlay_SOURCES = moc_qtgv-xoverlay.cpp
-
-moc_%.cpp:%.h
- moc $< -o $@
-
-EXTRA_DIST = $(nodist_qtgv_xoverlay_SOURCES:moc_%.cpp=%.h) qtgv-xoverlay.h
-CLEANFILES = $(nodist_qtgv_xoverlay_SOURCES)
-
-endif
-
-endif
-
-noinst_PROGRAMS = $(EXAMPLES)
-
diff --git a/tests/examples/overlay/gtk-xoverlay.c b/tests/examples/overlay/gtk-xoverlay.c
deleted file mode 100644
index 9a08c95f..00000000
--- a/tests/examples/overlay/gtk-xoverlay.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* GStreamer
- * Copyright (C) <2010> Stefan Kost <ensonic@users.sf.net>
- *
- * gtk-xoverlay: demonstrate overlay handling using gtk
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <glib.h>
-#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
-
-#include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
-
-#include <string.h>
-
-static void
-window_closed (GtkWidget * widget, GdkEvent * event, gpointer user_data)
-{
- GstElement *pipeline = user_data;
-
- gtk_widget_hide_all (widget);
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gtk_main_quit ();
-}
-
-/* slightly convoluted way to find a working video sink that's not a bin,
- * one could use autovideosink from gst-plugins-good instead
- */
-static GstElement *
-find_video_sink (void)
-{
- GstStateChangeReturn sret;
- GstElement *sink;
-
- if ((sink = gst_element_factory_make ("xvimagesink", NULL))) {
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret == GST_STATE_CHANGE_SUCCESS)
- return sink;
-
- gst_element_set_state (sink, GST_STATE_NULL);
- }
- gst_object_unref (sink);
-
- if ((sink = gst_element_factory_make ("ximagesink", NULL))) {
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret == GST_STATE_CHANGE_SUCCESS)
- return sink;
-
- gst_element_set_state (sink, GST_STATE_NULL);
- }
- gst_object_unref (sink);
-
- if (strcmp (DEFAULT_VIDEOSINK, "xvimagesink") == 0 ||
- strcmp (DEFAULT_VIDEOSINK, "ximagesink") == 0)
- return NULL;
-
- if ((sink = gst_element_factory_make (DEFAULT_VIDEOSINK, NULL))) {
- if (GST_IS_BIN (sink)) {
- gst_object_unref (sink);
- return NULL;
- }
-
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret == GST_STATE_CHANGE_SUCCESS)
- return sink;
-
- gst_element_set_state (sink, GST_STATE_NULL);
- }
- gst_object_unref (sink);
- return NULL;
-}
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *window, *video_window;
- GstElement *pipeline, *src, *sink;
- gulong embed_xid;
- GstStateChangeReturn sret;
-
- if (!g_thread_supported ())
- g_thread_init (NULL);
-
- gst_init (&argc, &argv);
- gtk_init (&argc, &argv);
-
- /* prepare the pipeline */
-
- pipeline = gst_pipeline_new ("xvoverlay");
- src = gst_element_factory_make ("videotestsrc", NULL);
- sink = find_video_sink ();
-
- if (sink == NULL)
- g_error ("Couldn't find a working video sink.");
-
- gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
- gst_element_link (src, sink);
-
- /* prepare the ui */
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_signal_connect (G_OBJECT (window), "delete-event",
- G_CALLBACK (window_closed), (gpointer) pipeline);
- gtk_window_set_default_size (GTK_WINDOW (window), 320, 240);
- gtk_window_set_title (GTK_WINDOW (window), "GstXOverlay Gtk+ demo");
-
- video_window = gtk_drawing_area_new ();
- gtk_widget_set_double_buffered (video_window, FALSE);
- gtk_container_add (GTK_CONTAINER (window), video_window);
- gtk_container_set_border_width (GTK_CONTAINER (window), 16);
-
- gtk_widget_show_all (window);
- gtk_widget_realize (window);
-
- embed_xid = GDK_WINDOW_XID (video_window->window);
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), embed_xid);
-
- /* run the pipeline */
-
- sret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (sret == GST_STATE_CHANGE_FAILURE)
- gst_element_set_state (pipeline, GST_STATE_NULL);
- else
- gtk_main ();
-
- gst_object_unref (pipeline);
- return 0;
-}
diff --git a/tests/examples/overlay/qt-xoverlay.cpp b/tests/examples/overlay/qt-xoverlay.cpp
deleted file mode 100644
index 7edfabb7..00000000
--- a/tests/examples/overlay/qt-xoverlay.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/* GStreamer
- * Copyright (C) <2010> Stefan Kost <ensonic@users.sf.net>
- *
- * qt-xoverlay: demonstrate overlay handling using qt
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <glib.h>
-#include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
-
-#include <QApplication>
-#include <QTimer>
-#include <QWidget>
-
-/* slightly convoluted way to find a working video sink that's not a bin,
- * one could use autovideosink from gst-plugins-good instead
- */
-static GstElement *
-find_video_sink (void)
-{
- GstStateChangeReturn sret;
- GstElement *sink;
-
- if ((sink = gst_element_factory_make ("xvimagesink", NULL))) {
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret == GST_STATE_CHANGE_SUCCESS)
- return sink;
-
- gst_element_set_state (sink, GST_STATE_NULL);
- }
- gst_object_unref (sink);
-
- if ((sink = gst_element_factory_make ("ximagesink", NULL))) {
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret == GST_STATE_CHANGE_SUCCESS)
- return sink;
-
- gst_element_set_state (sink, GST_STATE_NULL);
- }
- gst_object_unref (sink);
-
- if (strcmp (DEFAULT_VIDEOSINK, "xvimagesink") == 0 ||
- strcmp (DEFAULT_VIDEOSINK, "ximagesink") == 0)
- return NULL;
-
- if ((sink = gst_element_factory_make (DEFAULT_VIDEOSINK, NULL))) {
- if (GST_IS_BIN (sink)) {
- gst_object_unref (sink);
- return NULL;
- }
-
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret == GST_STATE_CHANGE_SUCCESS)
- return sink;
-
- gst_element_set_state (sink, GST_STATE_NULL);
- }
- gst_object_unref (sink);
- return NULL;
-}
-
-int main(int argc, char *argv[])
-{
- if (!g_thread_supported ())
- g_thread_init (NULL);
-
- gst_init (&argc, &argv);
- QApplication app(argc, argv);
- app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit ()));
-
- /* prepare the pipeline */
-
- GstElement *pipeline = gst_pipeline_new ("xvoverlay");
- GstElement *src = gst_element_factory_make ("videotestsrc", NULL);
- GstElement *sink = find_video_sink ();
-
- if (sink == NULL)
- g_error ("Couldn't find a working video sink.");
-
- gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
- gst_element_link (src, sink);
-
- /* prepare the ui */
-
- QWidget window;
- window.resize(320, 240);
- window.setWindowTitle("GstXOverlay Qt demo");
- window.show();
-
- WId xwinid = window.winId();
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), xwinid);
-
- /* run the pipeline */
-
- GstStateChangeReturn sret = gst_element_set_state (pipeline,
- GST_STATE_PLAYING);
- if (sret == GST_STATE_CHANGE_FAILURE) {
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
- /* Exit application */
- QTimer::singleShot(0, QApplication::activeWindow(), SLOT(quit()));
- }
-
- int ret = app.exec();
-
- window.hide();
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- return ret;
-}
diff --git a/tests/examples/overlay/qtgv-xoverlay.cpp b/tests/examples/overlay/qtgv-xoverlay.cpp
deleted file mode 100644
index 69252864..00000000
--- a/tests/examples/overlay/qtgv-xoverlay.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/* GStreamer
- * Copyright (C) <2010> Alexander Bokovoy <ab@samba.org>
- *
- * qtgv-xoverlay: demonstrate overlay handling using qt graphics view
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "qtgv-xoverlay.h"
-
-#include <QApplication>
-#include <QTimer>
-
-#include <gst/interfaces/xoverlay.h>
-
-SinkPipeline::SinkPipeline(QGraphicsView *parent) : QObject(parent)
-{
- GstStateChangeReturn sret;
-
- pipeline = gst_pipeline_new ("xvoverlay");
- src = gst_element_factory_make ("videotestsrc", NULL);
-
- if ((sink = gst_element_factory_make ("xvimagesink", NULL))) {
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret != GST_STATE_CHANGE_SUCCESS) {
- gst_element_set_state (sink, GST_STATE_NULL);
- gst_object_unref (sink);
-
- if ((sink = gst_element_factory_make ("ximagesink", NULL))) {
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret != GST_STATE_CHANGE_SUCCESS) {
- gst_element_set_state (sink, GST_STATE_NULL);
- gst_object_unref (sink);
-
- if (strcmp (DEFAULT_VIDEOSINK, "xvimagesink") != 0 &&
- strcmp (DEFAULT_VIDEOSINK, "ximagesink") != 0) {
-
- if ((sink = gst_element_factory_make (DEFAULT_VIDEOSINK, NULL))) {
- if (!GST_IS_BIN (sink)) {
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret != GST_STATE_CHANGE_SUCCESS) {
- gst_element_set_state (sink, GST_STATE_NULL);
- gst_object_unref (sink);
- sink = NULL;
- }
- } else {
- gst_object_unref (sink);
- sink = NULL;
- }
- }
- }
- }
- }
- }
- }
-
- if (sink == NULL)
- g_error ("Couldn't find a working video sink.");
-
- gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
- gst_element_link (src, sink);
- xwinid = parent->winId();
-}
-
-SinkPipeline::~SinkPipeline()
-{
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-}
-
-void SinkPipeline::startPipeline()
-{
- GstStateChangeReturn sret;
-
- /* we know what the video sink is in this case (xvimagesink), so we can
- * just set it directly here now (instead of waiting for a prepare-xwindow-id
- * element message in a sync bus handler and setting it there) */
-
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), xwinid);
-
- sret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (sret == GST_STATE_CHANGE_FAILURE) {
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
- /* Exit application */
- QTimer::singleShot(0, QApplication::activeWindow(), SLOT(quit()));
- }
-}
-
-int main( int argc, char **argv )
-{
- QApplication app(argc, argv);
-
- QGraphicsScene scene;
- scene.setSceneRect( -100.0, -100.0, 200.0, 200.0 );
-
- QGraphicsView view( &scene );
- view.resize(320, 240);
- view.setWindowTitle("GstXOverlay Qt GraphicsView demo");
- view.show();
-
- gst_init (&argc, &argv);
- SinkPipeline pipeline(&view);
- pipeline.startPipeline();
-
- int ret = app.exec();
-
- view.hide();
-
- return ret;
-}
diff --git a/tests/examples/overlay/qtgv-xoverlay.h b/tests/examples/overlay/qtgv-xoverlay.h
deleted file mode 100644
index 091fff8b..00000000
--- a/tests/examples/overlay/qtgv-xoverlay.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* GStreamer
- * Copyright (C) <2010> Alexander Bokovoy <ab@samba.org>
- *
- * qtgv-xoverlay: demonstrate overlay handling using qt graphics view
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should 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 QTGV_XOVERLAY_H
-#define QTGV_XOVERLAY_H
-
-#include <QGraphicsView>
-#include <gst/gst.h>
-
-
-class SinkPipeline : public QObject
-{
- Q_OBJECT
-public:
- SinkPipeline(QGraphicsView *parent = 0);
- ~SinkPipeline();
-
- void startPipeline();
-
-private:
- GstElement *pipeline;
- GstElement *sink;
- GstElement *src;
- WId xwinid;
-};
-
-#endif // QTGV_XOVERLAY_H
diff --git a/tests/examples/seek/.gitignore b/tests/examples/seek/.gitignore
deleted file mode 100644
index e64781b2..00000000
--- a/tests/examples/seek/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-scrubby
-seek
-stepping
-stepping2
diff --git a/tests/examples/seek/Makefile.am b/tests/examples/seek/Makefile.am
deleted file mode 100644
index 792f96c1..00000000
--- a/tests/examples/seek/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-if HAVE_GTK_X11
-GTK_EXAMPLES=seek scrubby
-endif
-
-examples = $(GTK_EXAMPLES) stepping stepping2
-
-noinst_PROGRAMS = $(examples)
-
-LDADD = \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
- $(GST_LIBS) $(GTK_LIBS) $(LIBM)
-
-AM_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GTK_CFLAGS) -I$(top_builddir)/gst-libs
diff --git a/tests/examples/seek/scrubby.c b/tests/examples/seek/scrubby.c
deleted file mode 100644
index 7517ec2a..00000000
--- a/tests/examples/seek/scrubby.c
+++ /dev/null
@@ -1,570 +0,0 @@
-#include <stdlib.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gst/gst.h>
-#include <string.h>
-
-GST_DEBUG_CATEGORY_STATIC (scrubby_debug);
-#define GST_CAT_DEFAULT (scrubby_debug)
-
-static GstElement *pipeline;
-static gint64 position;
-static gint64 duration;
-static GtkAdjustment *adjustment;
-static GtkWidget *hscale;
-static GtkAdjustment *sadjustment;
-static GtkWidget *shscale;
-static gboolean verbose = FALSE;
-
-static guint bus_watch = 0;
-static guint update_id = 0;
-static guint changed_id = 0;
-static guint schanged_id = 0;
-
-//#define SOURCE "filesrc"
-#define SOURCE "gnomevfssrc"
-#define ASINK "alsasink"
-//#define ASINK "osssink"
-#define VSINK "xvimagesink"
-//#define VSINK "ximagesink"
-//#define VSINK "aasink"
-//#define VSINK "cacasink"
-
-#define RANGE_PREC 10000
-#define SEGMENT_LEN 100
-#define UPDATE_INTERVAL 500
-
-static gdouble prev_range = -1.0;
-static GstClockTime prev_time = GST_CLOCK_TIME_NONE;
-static gdouble cur_range;
-static GstClockTime cur_time;
-static GstClockTimeDiff diff;
-static gdouble cur_speed = 1.0;
-
-typedef struct
-{
- const gchar *padname;
- GstPad *target;
- GstElement *bin;
-}
-dyn_link;
-
-static GstElement *
-gst_element_factory_make_or_warn (gchar * type, gchar * name)
-{
- GstElement *element = gst_element_factory_make (type, name);
-
- if (!element) {
- g_warning ("Failed to create element %s of type %s", name, type);
- }
-
- return element;
-}
-
-static void
-dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer data)
-{
- dyn_link *connect = (dyn_link *) data;
-
- if (connect->padname == NULL ||
- !strcmp (gst_pad_get_name (newpad), connect->padname)) {
- if (connect->bin)
- gst_bin_add (GST_BIN (pipeline), connect->bin);
- gst_pad_link (newpad, connect->target);
- }
-}
-
-static void
-setup_dynamic_link (GstElement * element, const gchar * padname,
- GstPad * target, GstElement * bin)
-{
- dyn_link *connect;
-
- connect = g_new0 (dyn_link, 1);
- connect->padname = g_strdup (padname);
- connect->target = target;
- connect->bin = bin;
-
- g_signal_connect (G_OBJECT (element), "pad-added", G_CALLBACK (dynamic_link),
- connect);
-}
-
-static GstElement *
-make_wav_pipeline (const gchar * location)
-{
- GstElement *pipeline;
- GstElement *src, *decoder, *audiosink;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- decoder = gst_element_factory_make_or_warn ("wavparse", "decoder");
- audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), decoder);
- gst_bin_add (GST_BIN (pipeline), audiosink);
-
- gst_element_link (src, decoder);
-
- setup_dynamic_link (decoder, "src", gst_element_get_static_pad (audiosink,
- "sink"), NULL);
-
- return pipeline;
-}
-
-static GstElement *
-make_playerbin_pipeline (const gchar * location)
-{
- GstElement *player;
-
- player = gst_element_factory_make ("playbin", "player");
- g_assert (player);
-
- g_object_set (G_OBJECT (player), "uri", location, NULL);
-
- return player;
-}
-
-static gchar *
-format_value (GtkScale * scale, gdouble value)
-{
- gint64 real;
- gint64 seconds;
- gint64 subseconds;
-
- real = value * duration / RANGE_PREC;
- seconds = (gint64) real / GST_SECOND;
- subseconds = (gint64) real / (GST_SECOND / RANGE_PREC);
-
- return g_strdup_printf ("%02" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT ":%02"
- G_GINT64_FORMAT, seconds / 60, seconds % 60, subseconds % 100);
-}
-
-static gboolean
-update_scale (gpointer data)
-{
- GstFormat format;
-
- position = 0;
- duration = 0;
-
- format = GST_FORMAT_TIME;
-
- gst_element_query_position (pipeline, &format, &position);
- gst_element_query_duration (pipeline, &format, &duration);
-
- if (position >= duration)
- duration = position;
-
- if (duration > 0) {
- gtk_adjustment_set_value (adjustment,
- position * (gdouble) RANGE_PREC / duration);
- gtk_widget_queue_draw (hscale);
- }
-
- return TRUE;
-}
-
-static void
-speed_cb (GtkWidget * widget)
-{
- GstEvent *s_event;
- gboolean res;
-
- GST_DEBUG ("speed change");
- cur_speed = gtk_range_get_value (GTK_RANGE (widget));
-
- if (cur_speed == 0.0)
- return;
-
- s_event = gst_event_new_seek (cur_speed,
- GST_FORMAT_TIME, 0, GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_NONE, -1);
-
- res = gst_element_send_event (pipeline, s_event);
- if (!res)
- g_print ("speed change failed\n");
-}
-
-static gboolean do_seek (GtkWidget * widget, gboolean flush, gboolean segment);
-
-static void
-seek_cb (GtkWidget * widget)
-{
- if (changed_id) {
- GST_DEBUG ("seek because of slider move");
-
- if (do_seek (widget, TRUE, TRUE)) {
- g_source_remove (changed_id);
- changed_id = 0;
- }
- }
-}
-
-static gboolean
-do_seek (GtkWidget * widget, gboolean flush, gboolean segment)
-{
- gint64 start, stop;
- gboolean res = FALSE;
- GstEvent *s_event;
- gdouble rate;
- GTimeVal tv;
- gboolean valid;
- gdouble new_range;
-
- if (segment)
- new_range = gtk_range_get_value (GTK_RANGE (widget));
- else {
- new_range = (gdouble) RANGE_PREC;
- cur_time = -1;
- }
-
- valid = prev_time != -1;
-
- GST_DEBUG ("flush %d, segment %d, valid %d", flush, segment, valid);
-
- if (new_range == cur_range)
- return FALSE;
-
- prev_time = cur_time;
- prev_range = cur_range;
-
- cur_range = new_range;
-
- g_get_current_time (&tv);
- cur_time = GST_TIMEVAL_TO_TIME (tv);
-
- if (!valid)
- return FALSE;
-
- GST_DEBUG ("cur: %lf, %" GST_TIME_FORMAT, cur_range,
- GST_TIME_ARGS (cur_time));
- GST_DEBUG ("prev: %lf, %" GST_TIME_FORMAT, prev_range,
- GST_TIME_ARGS (prev_time));
-
- diff = cur_time - prev_time;
-
- GST_DEBUG ("diff: %" GST_TIME_FORMAT, GST_TIME_ARGS (diff));
-
- start = prev_range * duration / RANGE_PREC;
- /* play 50 milliseconds */
- stop = segment ? cur_range * duration / RANGE_PREC : duration;
-
- if (start == stop)
- return FALSE;
-
- if (segment)
- rate = (stop - start) / (gdouble) diff;
- else
- rate = cur_speed;
-
- if (start > stop) {
- gint64 tmp;
-
- tmp = start;
- start = stop;
- stop = tmp;
- }
-
- if (rate == 0.0)
- return TRUE;
-
- GST_DEBUG ("seek to %" GST_TIME_FORMAT " -- %" GST_TIME_FORMAT ", rate %lf"
- " on element %s",
- GST_TIME_ARGS (start), GST_TIME_ARGS (stop), rate,
- GST_ELEMENT_NAME (pipeline));
-
- s_event = gst_event_new_seek (rate,
- GST_FORMAT_TIME,
- (flush ? GST_SEEK_FLAG_FLUSH : 0) |
- (segment ? GST_SEEK_FLAG_SEGMENT : 0),
- GST_SEEK_TYPE_SET, start, GST_SEEK_TYPE_SET, stop);
-
- res = gst_element_send_event (pipeline, s_event);
- if (!res)
- g_print ("seek failed\n");
-
- gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
-
- return TRUE;
-}
-
-static gboolean
-start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
-{
- if (update_id) {
- g_source_remove (update_id);
- update_id = 0;
- }
-
- if (changed_id == 0) {
- changed_id =
- g_signal_connect (hscale, "value_changed", G_CALLBACK (seek_cb),
- pipeline);
- }
-
- GST_DEBUG ("start seek");
-
- return FALSE;
-}
-
-static gboolean
-stop_seek (GtkWidget * widget, gpointer user_data)
-{
- update_id =
- g_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
-
- GST_DEBUG ("stop seek");
-
- if (changed_id) {
- g_source_remove (changed_id);
- changed_id = 0;
- }
-
- do_seek (hscale, FALSE, FALSE);
-
- return FALSE;
-}
-
-static void
-play_cb (GtkButton * button, gpointer data)
-{
- GstState state;
-
- gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
- if (state != GST_STATE_PLAYING) {
- g_print ("PLAY pipeline\n");
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- update_id =
- g_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
- }
-}
-
-static void
-pause_cb (GtkButton * button, gpointer data)
-{
- GstState state;
-
- gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
- if (state != GST_STATE_PAUSED) {
- g_print ("PAUSE pipeline\n");
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- g_source_remove (update_id);
- }
-}
-
-static void
-stop_cb (GtkButton * button, gpointer data)
-{
- GstState state;
-
- gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
- if (state != GST_STATE_READY) {
- g_print ("READY pipeline\n");
- gst_element_set_state (pipeline, GST_STATE_READY);
- /* position and speed return to their default values */
- gtk_adjustment_set_value (adjustment, 0.0);
- gtk_adjustment_set_value (sadjustment, 1.0);
- g_source_remove (update_id);
- }
-}
-
-static void
-print_message (GstMessage * message)
-{
- const GstStructure *s;
-
- s = gst_message_get_structure (message);
- g_print ("Got Message from element \"%s\"\n",
- GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))));
-
- if (s) {
- gchar *sstr;
-
- sstr = gst_structure_to_string (s);
- g_print ("%s\n", sstr);
- g_free (sstr);
- }
-}
-
-static gboolean
-bus_message (GstBus * bus, GstMessage * message, gpointer data)
-{
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_EOS:
- g_print ("EOS\n");
- break;
- case GST_MESSAGE_ERROR:
- case GST_MESSAGE_WARNING:
- print_message (message);
- break;
- case GST_MESSAGE_SEGMENT_START:
- break;
- case GST_MESSAGE_SEGMENT_DONE:
- GST_DEBUG ("segment_done, doing next seek");
- if (!do_seek (hscale, FALSE, update_id == 0)) {
- if (changed_id == 0) {
- changed_id =
- g_signal_connect (hscale, "value_changed", G_CALLBACK (seek_cb),
- pipeline);
- }
- }
- break;
- default:
- break;
- }
-
- return TRUE;
-}
-
-typedef struct
-{
- gchar *name;
- GstElement *(*func) (const gchar * location);
-}
-Pipeline;
-
-static Pipeline pipelines[] = {
- {"wav", make_wav_pipeline},
- {"playerbin", make_playerbin_pipeline},
- {NULL, NULL},
-};
-
-#define NUM_TYPES ((sizeof (pipelines) / sizeof (Pipeline)) - 1)
-
-static void
-print_usage (int argc, char **argv)
-{
- gint i;
-
- g_print ("usage: %s <type> <filename>\n", argv[0]);
- g_print (" possible types:\n");
-
- for (i = 0; i < NUM_TYPES; i++) {
- g_print (" %d = %s\n", i, pipelines[i].name);
- }
-}
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *window, *hbox, *vbox, *play_button, *pause_button, *stop_button;
- GstBus *bus;
- GOptionEntry options[] = {
- {"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
- "Verbose properties", NULL},
- {NULL}
- };
- gint type;
- GOptionContext *ctx;
- GError *err = NULL;
-
- if (!g_thread_supported ())
- g_thread_init (NULL);
-
- ctx = g_option_context_new ("seek");
- g_option_context_add_main_entries (ctx, options, NULL);
- g_option_context_add_group (ctx, gst_init_get_option_group ());
-
- if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
- g_print ("Error initializing: %s\n", err->message);
- exit (1);
- }
-
- GST_DEBUG_CATEGORY_INIT (scrubby_debug, "scrubby", 0, "scrubby example");
-
- gtk_init (&argc, &argv);
-
- if (argc != 3) {
- print_usage (argc, argv);
- exit (-1);
- }
-
- type = atoi (argv[1]);
-
- if (type < 0 || type >= NUM_TYPES) {
- print_usage (argc, argv);
- exit (-1);
- }
-
- pipeline = pipelines[type].func (argv[2]);
- g_assert (pipeline);
-
- /* initialize gui elements ... */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- hbox = gtk_hbox_new (FALSE, 0);
- vbox = gtk_vbox_new (FALSE, 0);
- play_button = gtk_button_new_with_label ("play");
- pause_button = gtk_button_new_with_label ("pause");
- stop_button = gtk_button_new_with_label ("stop");
-
- adjustment =
- GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, (gdouble) RANGE_PREC, 0.1,
- 1.0, 1.0));
- hscale = gtk_hscale_new (adjustment);
- gtk_scale_set_digits (GTK_SCALE (hscale), 2);
- gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_CONTINUOUS);
-
- sadjustment =
- GTK_ADJUSTMENT (gtk_adjustment_new (1.0, 0.0, 5.0, 0.1, 1.0, 0.0));
- shscale = gtk_hscale_new (sadjustment);
- gtk_scale_set_digits (GTK_SCALE (shscale), 2);
- gtk_range_set_update_policy (GTK_RANGE (shscale), GTK_UPDATE_CONTINUOUS);
-
- schanged_id =
- g_signal_connect (shscale, "value_changed", G_CALLBACK (speed_cb),
- pipeline);
-
- g_signal_connect (hscale, "button_press_event", G_CALLBACK (start_seek),
- pipeline);
- g_signal_connect (hscale, "button_release_event", G_CALLBACK (stop_seek),
- pipeline);
- g_signal_connect (hscale, "format_value", G_CALLBACK (format_value),
- pipeline);
-
- /* do the packing stuff ... */
- gtk_window_set_default_size (GTK_WINDOW (window), 96, 96);
- gtk_container_add (GTK_CONTAINER (window), vbox);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
- gtk_box_pack_start (GTK_BOX (hbox), play_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), pause_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), stop_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (vbox), hscale, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (vbox), shscale, TRUE, TRUE, 2);
-
- /* connect things ... */
- g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play_cb),
- pipeline);
- g_signal_connect (G_OBJECT (pause_button), "clicked", G_CALLBACK (pause_cb),
- pipeline);
- g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb),
- pipeline);
- g_signal_connect (G_OBJECT (window), "delete_event", gtk_main_quit, NULL);
-
- /* show the gui. */
- gtk_widget_show_all (window);
-
- if (verbose) {
- g_signal_connect (pipeline, "deep_notify",
- G_CALLBACK (gst_object_default_deep_notify), NULL);
- }
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- g_assert (bus);
-
- bus_watch = gst_bus_add_watch_full (bus,
- G_PRIORITY_HIGH, bus_message, pipeline, NULL);
-
- gtk_main ();
-
- g_print ("NULL pipeline\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- g_print ("free pipeline\n");
- gst_object_unref (pipeline);
-
- return 0;
-}
diff --git a/tests/examples/seek/seek.c b/tests/examples/seek/seek.c
deleted file mode 100644
index 405e00ed..00000000
--- a/tests/examples/seek/seek.c
+++ /dev/null
@@ -1,2945 +0,0 @@
-/* GStreamer
- *
- * seek.c: seeking sample application
- *
- * Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
- * 2006 Stefan Kost <ensonic@users.sf.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <math.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gst/gst.h>
-#include <string.h>
-
-#ifdef HAVE_X
-#include <gdk/gdkx.h>
-#endif
-#include <gst/interfaces/xoverlay.h>
-
-GST_DEBUG_CATEGORY_STATIC (seek_debug);
-#define GST_CAT_DEFAULT (seek_debug)
-
-/* configuration */
-
-//#define SOURCE "filesrc"
-#define SOURCE "gnomevfssrc"
-
-#define ASINK "alsasink"
-//#define ASINK "osssink"
-
-#define VSINK "xvimagesink"
-//#define VSINK "sdlvideosink"
-//#define VSINK "ximagesink"
-//#define VSINK "aasink"
-//#define VSINK "cacasink"
-
-#define FILL_INTERVAL 100
-//#define UPDATE_INTERVAL 500
-//#define UPDATE_INTERVAL 100
-#define UPDATE_INTERVAL 40
-
-/* number of milliseconds to play for after a seek */
-#define SCRUB_TIME 100
-
-/* timeout for gst_element_get_state() after a seek */
-#define SEEK_TIMEOUT 40 * GST_MSECOND
-
-#define DEFAULT_VIDEO_HEIGHT 300
-
-/* the state to go to when stop is pressed */
-#define STOP_STATE GST_STATE_READY
-
-
-static GList *seekable_pads = NULL;
-static GList *rate_pads = NULL;
-static GList *seekable_elements = NULL;
-
-static gboolean accurate_seek = FALSE;
-static gboolean keyframe_seek = FALSE;
-static gboolean loop_seek = FALSE;
-static gboolean flush_seek = TRUE;
-static gboolean scrub = TRUE;
-static gboolean play_scrub = FALSE;
-static gboolean skip_seek = FALSE;
-static gdouble rate = 1.0;
-
-static GstElement *pipeline;
-static gint pipeline_type;
-static const gchar *pipeline_spec;
-static gint64 position = -1;
-static gint64 duration = -1;
-static GtkAdjustment *adjustment;
-static GtkWidget *hscale, *statusbar;
-static guint status_id = 0;
-static gboolean stats = FALSE;
-static gboolean elem_seek = FALSE;
-static gboolean verbose = FALSE;
-
-static gboolean is_live = FALSE;
-static gboolean buffering = FALSE;
-static GstBufferingMode mode;
-static gint64 buffering_left;
-static GstState state = GST_STATE_NULL;
-static guint update_id = 0;
-static guint seek_timeout_id = 0;
-static gulong changed_id;
-static guint fill_id = 0;
-
-static gint n_video = 0, n_audio = 0, n_text = 0;
-static gboolean need_streams = TRUE;
-static GtkWidget *video_combo, *audio_combo, *text_combo, *vis_combo;
-static GtkWidget *vis_checkbox, *video_checkbox, *audio_checkbox;
-static GtkWidget *text_checkbox, *mute_checkbox, *volume_spinbutton;
-static GtkWidget *skip_checkbox, *video_window, *download_checkbox;
-static GtkWidget *buffer_checkbox, *rate_spinbutton;
-
-static GStaticMutex state_mutex = G_STATIC_MUTEX_INIT;
-
-static GtkWidget *format_combo, *step_amount_spinbutton, *step_rate_spinbutton;
-static GtkWidget *shuttle_checkbox, *step_button;
-static GtkWidget *shuttle_hscale;
-static GtkAdjustment *shuttle_adjustment;
-
-static GList *paths = NULL, *l = NULL;
-
-/* we keep an array of the visualisation entries so that we can easily switch
- * with the combo box index. */
-typedef struct
-{
- GstElementFactory *factory;
-} VisEntry;
-
-static GArray *vis_entries;
-
-static void clear_streams (GstElement * pipeline);
-static void volume_notify_cb (GstElement * pipeline, GParamSpec * arg,
- gpointer user_dat);
-
-/* pipeline construction */
-
-typedef struct
-{
- const gchar *padname;
- GstPad *target;
- GstElement *bin;
-}
-dyn_link;
-
-static GstElement *
-gst_element_factory_make_or_warn (gchar * type, gchar * name)
-{
- GstElement *element = gst_element_factory_make (type, name);
-
- if (!element) {
- g_warning ("Failed to create element %s of type %s", name, type);
- }
-
- return element;
-}
-
-static void
-dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer data)
-{
- gchar *padname;
- dyn_link *connect = (dyn_link *) data;
-
- padname = gst_pad_get_name (newpad);
-
- if (connect->padname == NULL || !strcmp (padname, connect->padname)) {
- if (connect->bin)
- gst_bin_add (GST_BIN (pipeline), connect->bin);
- gst_pad_link (newpad, connect->target);
-
- //seekable_pads = g_list_prepend (seekable_pads, newpad);
- rate_pads = g_list_prepend (rate_pads, newpad);
- }
- g_free (padname);
-}
-
-static void
-setup_dynamic_link (GstElement * element, const gchar * padname,
- GstPad * target, GstElement * bin)
-{
- dyn_link *connect;
-
- connect = g_new0 (dyn_link, 1);
- connect->padname = g_strdup (padname);
- connect->target = target;
- connect->bin = bin;
-
- g_signal_connect (G_OBJECT (element), "pad-added", G_CALLBACK (dynamic_link),
- connect);
-}
-
-static GstElement *
-make_mod_pipeline (const gchar * location)
-{
- GstElement *pipeline;
- GstElement *src, *decoder, *audiosink;
- GstPad *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- decoder = gst_element_factory_make_or_warn ("modplug", "decoder");
- audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
- //g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), decoder);
- gst_bin_add (GST_BIN (pipeline), audiosink);
-
- gst_element_link (src, decoder);
- gst_element_link (decoder, audiosink);
-
- seekable = gst_element_get_static_pad (decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_static_pad (decoder, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_dv_pipeline (const gchar * location)
-{
- GstElement *pipeline;
- GstElement *src, *demux, *decoder, *audiosink, *videosink;
- GstElement *a_queue, *v_queue;
- GstPad *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- demux = gst_element_factory_make_or_warn ("dvdemux", "demuxer");
- v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
- decoder = gst_element_factory_make_or_warn ("ffdec_dvvideo", "decoder");
- videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
- a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
- audiosink = gst_element_factory_make_or_warn ("alsasink", "a_sink");
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
- gst_bin_add (GST_BIN (pipeline), a_queue);
- gst_bin_add (GST_BIN (pipeline), audiosink);
- gst_bin_add (GST_BIN (pipeline), v_queue);
- gst_bin_add (GST_BIN (pipeline), decoder);
- gst_bin_add (GST_BIN (pipeline), videosink);
-
- gst_element_link (src, demux);
- gst_element_link (a_queue, audiosink);
- gst_element_link (v_queue, decoder);
- gst_element_link (decoder, videosink);
-
- setup_dynamic_link (demux, "video", gst_element_get_static_pad (v_queue,
- "sink"), NULL);
- setup_dynamic_link (demux, "audio", gst_element_get_static_pad (a_queue,
- "sink"), NULL);
-
- seekable = gst_element_get_static_pad (decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
-
- return pipeline;
-}
-
-static GstElement *
-make_wav_pipeline (const gchar * location)
-{
- GstElement *pipeline;
- GstElement *src, *decoder, *audiosink;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- decoder = gst_element_factory_make_or_warn ("wavparse", "decoder");
- audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), decoder);
- gst_bin_add (GST_BIN (pipeline), audiosink);
-
- gst_element_link (src, decoder);
-
- setup_dynamic_link (decoder, "src", gst_element_get_static_pad (audiosink,
- "sink"), NULL);
-
- seekable_elements = g_list_prepend (seekable_elements, audiosink);
-
- /* force element seeking on this pipeline */
- elem_seek = TRUE;
-
- return pipeline;
-}
-
-static GstElement *
-make_flac_pipeline (const gchar * location)
-{
- GstElement *pipeline;
- GstElement *src, *decoder, *audiosink;
- GstPad *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- decoder = gst_element_factory_make_or_warn ("flacdec", "decoder");
- audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
- g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), decoder);
- gst_bin_add (GST_BIN (pipeline), audiosink);
-
- gst_element_link (src, decoder);
- gst_element_link (decoder, audiosink);
-
- seekable = gst_element_get_static_pad (decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_static_pad (decoder, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_sid_pipeline (const gchar * location)
-{
- GstElement *pipeline;
- GstElement *src, *decoder, *audiosink;
- GstPad *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- decoder = gst_element_factory_make_or_warn ("siddec", "decoder");
- audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
- //g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), decoder);
- gst_bin_add (GST_BIN (pipeline), audiosink);
-
- gst_element_link (src, decoder);
- gst_element_link (decoder, audiosink);
-
- seekable = gst_element_get_static_pad (decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_static_pad (decoder, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_parse_pipeline (const gchar * location)
-{
- GstElement *pipeline;
- GstElement *src, *parser, *fakesink;
- GstPad *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- parser = gst_element_factory_make_or_warn ("mpegparse", "parse");
- fakesink = gst_element_factory_make_or_warn ("fakesink", "sink");
- g_object_set (G_OBJECT (fakesink), "silent", TRUE, NULL);
- g_object_set (G_OBJECT (fakesink), "sync", TRUE, NULL);
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), parser);
- gst_bin_add (GST_BIN (pipeline), fakesink);
-
- gst_element_link (src, parser);
- gst_element_link (parser, fakesink);
-
- seekable = gst_element_get_static_pad (parser, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_static_pad (parser, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_vorbis_pipeline (const gchar * location)
-{
- GstElement *pipeline, *audio_bin;
- GstElement *src, *demux, *decoder, *convert, *audiosink;
- GstPad *pad, *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- demux = gst_element_factory_make_or_warn ("oggdemux", "demux");
- decoder = gst_element_factory_make_or_warn ("vorbisdec", "decoder");
- convert = gst_element_factory_make_or_warn ("audioconvert", "convert");
- audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
- g_object_set (G_OBJECT (audiosink), "sync", TRUE, NULL);
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- audio_bin = gst_bin_new ("a_decoder_bin");
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
- gst_bin_add (GST_BIN (audio_bin), decoder);
- gst_bin_add (GST_BIN (audio_bin), convert);
- gst_bin_add (GST_BIN (audio_bin), audiosink);
- gst_bin_add (GST_BIN (pipeline), audio_bin);
-
- gst_element_link (src, demux);
- gst_element_link (decoder, convert);
- gst_element_link (convert, audiosink);
-
- pad = gst_element_get_static_pad (decoder, "sink");
- gst_element_add_pad (audio_bin, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- setup_dynamic_link (demux, NULL, gst_element_get_static_pad (audio_bin,
- "sink"), NULL);
-
- seekable = gst_element_get_static_pad (decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_static_pad (decoder, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_theora_pipeline (const gchar * location)
-{
- GstElement *pipeline, *video_bin;
- GstElement *src, *demux, *decoder, *convert, *videosink;
- GstPad *pad, *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- demux = gst_element_factory_make_or_warn ("oggdemux", "demux");
- decoder = gst_element_factory_make_or_warn ("theoradec", "decoder");
- convert = gst_element_factory_make_or_warn ("ffmpegcolorspace", "convert");
- videosink = gst_element_factory_make_or_warn (VSINK, "sink");
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- video_bin = gst_bin_new ("v_decoder_bin");
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
- gst_bin_add (GST_BIN (video_bin), decoder);
- gst_bin_add (GST_BIN (video_bin), convert);
- gst_bin_add (GST_BIN (video_bin), videosink);
- gst_bin_add (GST_BIN (pipeline), video_bin);
-
- gst_element_link (src, demux);
- gst_element_link (decoder, convert);
- gst_element_link (convert, videosink);
-
- pad = gst_element_get_static_pad (decoder, "sink");
- gst_element_add_pad (video_bin, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- setup_dynamic_link (demux, NULL, gst_element_get_static_pad (video_bin,
- "sink"), NULL);
-
- seekable = gst_element_get_static_pad (decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_static_pad (decoder, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_vorbis_theora_pipeline (const gchar * location)
-{
- GstElement *pipeline, *audio_bin, *video_bin;
- GstElement *src, *demux, *a_decoder, *a_convert, *v_decoder, *v_convert;
- GstElement *audiosink, *videosink;
- GstElement *a_queue, *v_queue, *v_scale;
- GstPad *seekable;
- GstPad *pad;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- demux = gst_element_factory_make_or_warn ("oggdemux", "demux");
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
- gst_element_link (src, demux);
-
- audio_bin = gst_bin_new ("a_decoder_bin");
- a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
- a_decoder = gst_element_factory_make_or_warn ("vorbisdec", "a_dec");
- a_convert = gst_element_factory_make_or_warn ("audioconvert", "a_convert");
- audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
-
- gst_bin_add (GST_BIN (pipeline), audio_bin);
-
- gst_bin_add (GST_BIN (audio_bin), a_queue);
- gst_bin_add (GST_BIN (audio_bin), a_decoder);
- gst_bin_add (GST_BIN (audio_bin), a_convert);
- gst_bin_add (GST_BIN (audio_bin), audiosink);
-
- gst_element_link (a_queue, a_decoder);
- gst_element_link (a_decoder, a_convert);
- gst_element_link (a_convert, audiosink);
-
- pad = gst_element_get_static_pad (a_queue, "sink");
- gst_element_add_pad (audio_bin, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- setup_dynamic_link (demux, NULL, gst_element_get_static_pad (audio_bin,
- "sink"), NULL);
-
- video_bin = gst_bin_new ("v_decoder_bin");
- v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
- v_decoder = gst_element_factory_make_or_warn ("theoradec", "v_dec");
- v_convert =
- gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_convert");
- v_scale = gst_element_factory_make_or_warn ("videoscale", "v_scale");
- videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
-
- gst_bin_add (GST_BIN (pipeline), video_bin);
-
- gst_bin_add (GST_BIN (video_bin), v_queue);
- gst_bin_add (GST_BIN (video_bin), v_decoder);
- gst_bin_add (GST_BIN (video_bin), v_convert);
- gst_bin_add (GST_BIN (video_bin), v_scale);
- gst_bin_add (GST_BIN (video_bin), videosink);
-
- gst_element_link_many (v_queue, v_decoder, v_convert, v_scale, videosink,
- NULL);
-
- pad = gst_element_get_static_pad (v_queue, "sink");
- gst_element_add_pad (video_bin, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- setup_dynamic_link (demux, NULL, gst_element_get_static_pad (video_bin,
- "sink"), NULL);
-
- seekable = gst_element_get_static_pad (a_decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_static_pad (a_decoder,
- "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_avi_msmpeg4v3_mp3_pipeline (const gchar * location)
-{
- GstElement *pipeline, *audio_bin, *video_bin;
- GstElement *src, *demux, *a_decoder, *a_convert, *v_decoder, *v_convert;
- GstElement *audiosink, *videosink;
- GstElement *a_queue, *v_queue;
- GstPad *seekable, *pad;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- demux = gst_element_factory_make_or_warn ("avidemux", "demux");
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
- gst_element_link (src, demux);
-
- audio_bin = gst_bin_new ("a_decoder_bin");
- a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
- a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
- a_convert = gst_element_factory_make_or_warn ("audioconvert", "a_convert");
- audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
-
- gst_bin_add (GST_BIN (audio_bin), a_queue);
- gst_bin_add (GST_BIN (audio_bin), a_decoder);
- gst_bin_add (GST_BIN (audio_bin), a_convert);
- gst_bin_add (GST_BIN (audio_bin), audiosink);
-
- gst_element_link (a_queue, a_decoder);
- gst_element_link (a_decoder, a_convert);
- gst_element_link (a_convert, audiosink);
-
- gst_bin_add (GST_BIN (pipeline), audio_bin);
-
- pad = gst_element_get_static_pad (a_queue, "sink");
- gst_element_add_pad (audio_bin, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- setup_dynamic_link (demux, NULL, gst_element_get_static_pad (audio_bin,
- "sink"), NULL);
-
- video_bin = gst_bin_new ("v_decoder_bin");
- v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
- v_decoder = gst_element_factory_make_or_warn ("ffdec_msmpeg4", "v_dec");
- v_convert =
- gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_convert");
- videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
-
- gst_bin_add (GST_BIN (video_bin), v_queue);
- gst_bin_add (GST_BIN (video_bin), v_decoder);
- gst_bin_add (GST_BIN (video_bin), v_convert);
- gst_bin_add (GST_BIN (video_bin), videosink);
-
- gst_element_link_many (v_queue, v_decoder, v_convert, videosink, NULL);
-
- gst_bin_add (GST_BIN (pipeline), video_bin);
-
- pad = gst_element_get_static_pad (v_queue, "sink");
- gst_element_add_pad (video_bin, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- setup_dynamic_link (demux, NULL, gst_element_get_static_pad (video_bin,
- "sink"), NULL);
-
- seekable = gst_element_get_static_pad (a_decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_static_pad (a_decoder,
- "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_mp3_pipeline (const gchar * location)
-{
- GstElement *pipeline;
- GstElement *src, *parser, *decoder, *audiosink, *queue;
- GstPad *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- parser = gst_element_factory_make_or_warn ("mp3parse", "parse");
- decoder = gst_element_factory_make_or_warn ("mad", "dec");
- queue = gst_element_factory_make_or_warn ("queue", "queue");
- audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
-
- seekable_elements = g_list_prepend (seekable_elements, audiosink);
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
- //g_object_set (G_OBJECT (audiosink), "fragment", 0x00180008, NULL);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), parser);
- gst_bin_add (GST_BIN (pipeline), decoder);
- gst_bin_add (GST_BIN (pipeline), queue);
- gst_bin_add (GST_BIN (pipeline), audiosink);
-
- gst_element_link (src, parser);
- gst_element_link (parser, decoder);
- gst_element_link (decoder, queue);
- gst_element_link (queue, audiosink);
-
- seekable = gst_element_get_static_pad (queue, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_static_pad (decoder, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_avi_pipeline (const gchar * location)
-{
- GstElement *pipeline, *audio_bin, *video_bin;
- GstElement *src, *demux, *a_decoder, *v_decoder, *audiosink, *videosink;
- GstElement *a_queue = NULL, *v_queue = NULL;
- GstPad *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- demux = gst_element_factory_make_or_warn ("avidemux", "demux");
- seekable_elements = g_list_prepend (seekable_elements, demux);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
- gst_element_link (src, demux);
-
- audio_bin = gst_bin_new ("a_decoder_bin");
- a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
- audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
- a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
- gst_element_link (a_decoder, a_queue);
- gst_element_link (a_queue, audiosink);
- gst_bin_add (GST_BIN (audio_bin), a_decoder);
- gst_bin_add (GST_BIN (audio_bin), a_queue);
- gst_bin_add (GST_BIN (audio_bin), audiosink);
- gst_element_set_state (audio_bin, GST_STATE_PAUSED);
-
- setup_dynamic_link (demux, "audio_00", gst_element_get_static_pad (a_decoder,
- "sink"), audio_bin);
-
- seekable = gst_element_get_static_pad (a_queue, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_static_pad (a_decoder,
- "sink"));
-
- video_bin = gst_bin_new ("v_decoder_bin");
- v_decoder = gst_element_factory_make_or_warn ("ffmpegdecall", "v_dec");
- videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
- v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
- gst_element_link (v_decoder, v_queue);
- gst_element_link (v_queue, videosink);
- gst_bin_add (GST_BIN (video_bin), v_decoder);
- gst_bin_add (GST_BIN (video_bin), v_queue);
- gst_bin_add (GST_BIN (video_bin), videosink);
-
- gst_element_set_state (video_bin, GST_STATE_PAUSED);
-
- setup_dynamic_link (demux, "video_00", gst_element_get_static_pad (v_decoder,
- "sink"), video_bin);
-
- seekable = gst_element_get_static_pad (v_queue, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_static_pad (v_decoder,
- "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_mpeg_pipeline (const gchar * location)
-{
- GstElement *pipeline, *audio_bin, *video_bin;
- GstElement *src, *demux, *a_decoder, *v_decoder, *v_filter;
- GstElement *audiosink, *videosink;
- GstElement *a_queue, *v_queue;
- GstPad *seekable;
- GstPad *pad;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- //demux = gst_element_factory_make_or_warn ("mpegdemux", "demux");
- demux = gst_element_factory_make_or_warn ("flupsdemux", "demux");
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
- gst_element_link (src, demux);
-
- audio_bin = gst_bin_new ("a_decoder_bin");
- a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
- a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
- audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
- gst_bin_add (GST_BIN (audio_bin), a_decoder);
- gst_bin_add (GST_BIN (audio_bin), a_queue);
- gst_bin_add (GST_BIN (audio_bin), audiosink);
-
- gst_element_link (a_decoder, a_queue);
- gst_element_link (a_queue, audiosink);
-
- gst_bin_add (GST_BIN (pipeline), audio_bin);
-
- pad = gst_element_get_static_pad (a_decoder, "sink");
- gst_element_add_pad (audio_bin, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- setup_dynamic_link (demux, "audio_c0", gst_element_get_static_pad (audio_bin,
- "sink"), NULL);
-
- video_bin = gst_bin_new ("v_decoder_bin");
- v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
- v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
- v_filter = gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_filter");
- videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
-
- gst_bin_add (GST_BIN (video_bin), v_decoder);
- gst_bin_add (GST_BIN (video_bin), v_queue);
- gst_bin_add (GST_BIN (video_bin), v_filter);
- gst_bin_add (GST_BIN (video_bin), videosink);
-
- gst_element_link (v_decoder, v_queue);
- gst_element_link (v_queue, v_filter);
- gst_element_link (v_filter, videosink);
-
- gst_bin_add (GST_BIN (pipeline), video_bin);
-
- pad = gst_element_get_static_pad (v_decoder, "sink");
- gst_element_add_pad (video_bin, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- setup_dynamic_link (demux, "video_e0", gst_element_get_static_pad (video_bin,
- "sink"), NULL);
-
- seekable = gst_element_get_static_pad (v_filter, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_static_pad (v_decoder,
- "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_mpegnt_pipeline (const gchar * location)
-{
- GstElement *pipeline, *audio_bin, *video_bin;
- GstElement *src, *demux, *a_decoder, *v_decoder, *v_filter;
- GstElement *audiosink, *videosink;
- GstElement *a_queue;
- GstPad *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- demux = gst_element_factory_make_or_warn ("mpegdemux", "demux");
- //g_object_set (G_OBJECT (demux), "sync", TRUE, NULL);
-
- seekable_elements = g_list_prepend (seekable_elements, demux);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
- gst_element_link (src, demux);
-
- audio_bin = gst_bin_new ("a_decoder_bin");
- a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
- a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
- audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
- //g_object_set (G_OBJECT (audiosink), "fragment", 0x00180008, NULL);
- g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
- gst_element_link (a_decoder, a_queue);
- gst_element_link (a_queue, audiosink);
- gst_bin_add (GST_BIN (audio_bin), a_decoder);
- gst_bin_add (GST_BIN (audio_bin), a_queue);
- gst_bin_add (GST_BIN (audio_bin), audiosink);
-
- setup_dynamic_link (demux, "audio_00", gst_element_get_static_pad (a_decoder,
- "sink"), audio_bin);
-
- seekable = gst_element_get_static_pad (a_queue, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_static_pad (a_decoder,
- "sink"));
-
- video_bin = gst_bin_new ("v_decoder_bin");
- v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
- v_filter = gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_filter");
- videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
- gst_element_link_many (v_decoder, v_filter, videosink, NULL);
-
- gst_bin_add_many (GST_BIN (video_bin), v_decoder, v_filter, videosink, NULL);
-
- setup_dynamic_link (demux, "video_00", gst_element_get_static_pad (v_decoder,
- "sink"), video_bin);
-
- seekable = gst_element_get_static_pad (v_decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_static_pad (v_decoder,
- "sink"));
-
- return pipeline;
-}
-
-static void
-playerbin_set_uri (GstElement * player, const gchar * location)
-{
- gchar *uri;
-
- /* Add "file://" prefix for convenience */
- if (g_str_has_prefix (location, "/")) {
- uri = g_strconcat ("file://", location, NULL);
- g_object_set (G_OBJECT (player), "uri", uri, NULL);
- g_free (uri);
- } else {
- g_object_set (G_OBJECT (player), "uri", location, NULL);
- }
-}
-
-static GstElement *
-construct_playerbin (const gchar * name, const gchar * location)
-{
- GstElement *player;
-
- player = gst_element_factory_make (name, "player");
- g_assert (player);
-
- playerbin_set_uri (player, location);
-
- seekable_elements = g_list_prepend (seekable_elements, player);
-
- /* force element seeking on this pipeline */
- elem_seek = TRUE;
-
- return player;
-}
-
-static GstElement *
-make_playerbin_pipeline (const gchar * location)
-{
- return construct_playerbin ("playbin", location);
-}
-
-static GstElement *
-make_playerbin2_pipeline (const gchar * location)
-{
- GstElement *pipeline = construct_playerbin ("playbin2", location);
-
- /* FIXME: this is not triggered, playbin2 is not forwarding it from the sink */
- g_signal_connect (pipeline, "notify::volume", G_CALLBACK (volume_notify_cb),
- NULL);
- return pipeline;
-}
-
-#ifndef GST_DISABLE_PARSE
-static GstElement *
-make_parselaunch_pipeline (const gchar * description)
-{
- GstElement *pipeline;
- GError *error = NULL;
-
- pipeline = gst_parse_launch (description, &error);
-
- seekable_elements = g_list_prepend (seekable_elements, pipeline);
-
- elem_seek = TRUE;
-
- return pipeline;
-}
-#endif
-
-typedef struct
-{
- gchar *name;
- GstElement *(*func) (const gchar * location);
-}
-Pipeline;
-
-static Pipeline pipelines[] = {
- {"mp3", make_mp3_pipeline},
- {"avi", make_avi_pipeline},
- {"mpeg1", make_mpeg_pipeline},
- {"mpegparse", make_parse_pipeline},
- {"vorbis", make_vorbis_pipeline},
- {"theora", make_theora_pipeline},
- {"ogg/v/t", make_vorbis_theora_pipeline},
- {"avi/msmpeg4v3/mp3", make_avi_msmpeg4v3_mp3_pipeline},
- {"sid", make_sid_pipeline},
- {"flac", make_flac_pipeline},
- {"wav", make_wav_pipeline},
- {"mod", make_mod_pipeline},
- {"dv", make_dv_pipeline},
- {"mpeg1nothreads", make_mpegnt_pipeline},
- {"playerbin", make_playerbin_pipeline},
-#ifndef GST_DISABLE_PARSE
- {"parse-launch", make_parselaunch_pipeline},
-#endif
- {"playerbin2", make_playerbin2_pipeline},
- {NULL, NULL},
-};
-
-#define NUM_TYPES ((sizeof (pipelines) / sizeof (Pipeline)) - 1)
-
-/* ui callbacks and helpers */
-
-static gchar *
-format_value (GtkScale * scale, gdouble value)
-{
- gint64 real;
- gint64 seconds;
- gint64 subseconds;
-
- real = value * duration / 100;
- seconds = (gint64) real / GST_SECOND;
- subseconds = (gint64) real / (GST_SECOND / 100);
-
- return g_strdup_printf ("%02" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT ":%02"
- G_GINT64_FORMAT, seconds / 60, seconds % 60, subseconds % 100);
-}
-
-
-static gchar *
-shuttle_format_value (GtkScale * scale, gdouble value)
-{
- return g_strdup_printf ("%0.*g", gtk_scale_get_digits (scale), value);
-}
-
-typedef struct
-{
- const gchar *name;
- const GstFormat format;
-}
-seek_format;
-
-static seek_format seek_formats[] = {
- {"tim", GST_FORMAT_TIME},
- {"byt", GST_FORMAT_BYTES},
- {"buf", GST_FORMAT_BUFFERS},
- {"def", GST_FORMAT_DEFAULT},
- {NULL, 0},
-};
-
-G_GNUC_UNUSED static void
-query_rates (void)
-{
- GList *walk = rate_pads;
-
- while (walk) {
- GstPad *pad = GST_PAD (walk->data);
- gint i = 0;
-
- g_print ("rate/sec %8.8s: ", GST_PAD_NAME (pad));
- while (seek_formats[i].name) {
- gint64 value;
- GstFormat format;
-
- format = seek_formats[i].format;
-
- if (gst_pad_query_convert (pad, GST_FORMAT_TIME, GST_SECOND, &format,
- &value)) {
- g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
- } else {
- g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
- }
-
- i++;
- }
- g_print (" %s:%s\n", GST_DEBUG_PAD_NAME (pad));
-
- walk = g_list_next (walk);
- }
-}
-
-G_GNUC_UNUSED static void
-query_positions_elems (void)
-{
- GList *walk = seekable_elements;
-
- while (walk) {
- GstElement *element = GST_ELEMENT (walk->data);
- gint i = 0;
-
- g_print ("positions %8.8s: ", GST_ELEMENT_NAME (element));
- while (seek_formats[i].name) {
- gint64 position, total;
- GstFormat format;
-
- format = seek_formats[i].format;
-
- if (gst_element_query_position (element, &format, &position) &&
- gst_element_query_duration (element, &format, &total)) {
- g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
- seek_formats[i].name, position, total);
- } else {
- g_print ("%s %13.13s / %13.13s | ", seek_formats[i].name, "*NA*",
- "*NA*");
- }
- i++;
- }
- g_print (" %s\n", GST_ELEMENT_NAME (element));
-
- walk = g_list_next (walk);
- }
-}
-
-G_GNUC_UNUSED static void
-query_positions_pads (void)
-{
- GList *walk = seekable_pads;
-
- while (walk) {
- GstPad *pad = GST_PAD (walk->data);
- gint i = 0;
-
- g_print ("positions %8.8s: ", GST_PAD_NAME (pad));
- while (seek_formats[i].name) {
- GstFormat format;
- gint64 position, total;
-
- format = seek_formats[i].format;
-
- if (gst_pad_query_position (pad, &format, &position) &&
- gst_pad_query_duration (pad, &format, &total)) {
- g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
- seek_formats[i].name, position, total);
- } else {
- g_print ("%s %13.13s / %13.13s | ", seek_formats[i].name, "*NA*",
- "*NA*");
- }
-
- i++;
- }
- g_print (" %s:%s\n", GST_DEBUG_PAD_NAME (pad));
-
- walk = g_list_next (walk);
- }
-}
-
-static gboolean start_seek (GtkWidget * widget, GdkEventButton * event,
- gpointer user_data);
-static gboolean stop_seek (GtkWidget * widget, GdkEventButton * event,
- gpointer user_data);
-static void seek_cb (GtkWidget * widget);
-
-static void
-set_scale (gdouble value)
-{
- g_signal_handlers_block_by_func (hscale, (void *) start_seek,
- (void *) pipeline);
- g_signal_handlers_block_by_func (hscale, (void *) stop_seek,
- (void *) pipeline);
- g_signal_handlers_block_by_func (hscale, (void *) seek_cb, (void *) pipeline);
- gtk_adjustment_set_value (adjustment, value);
- g_signal_handlers_unblock_by_func (hscale, (void *) start_seek,
- (void *) pipeline);
- g_signal_handlers_unblock_by_func (hscale, (void *) stop_seek,
- (void *) pipeline);
- g_signal_handlers_unblock_by_func (hscale, (void *) seek_cb,
- (void *) pipeline);
- gtk_widget_queue_draw (hscale);
-}
-
-static gboolean
-update_fill (gpointer data)
-{
- if (elem_seek) {
- if (seekable_elements) {
- GstElement *element = GST_ELEMENT (seekable_elements->data);
- GstQuery *query;
-
- query = gst_query_new_buffering (GST_FORMAT_PERCENT);
- if (gst_element_query (element, query)) {
- gint64 start, stop;
- GstFormat format;
- gdouble fill;
- gboolean busy;
- gint percent;
-
- gst_query_parse_buffering_percent (query, &busy, &percent);
- gst_query_parse_buffering_range (query, &format, &start, &stop, NULL);
-
- GST_DEBUG ("start %" G_GINT64_FORMAT ", stop %" G_GINT64_FORMAT,
- start, stop);
-
- if (stop != -1)
- fill = 100.0 * stop / GST_FORMAT_PERCENT_MAX;
- else
- fill = 100.0;
-
- gtk_range_set_fill_level (GTK_RANGE (hscale), fill);
- }
- gst_query_unref (query);
- }
- }
- return TRUE;
-}
-
-static gboolean
-update_scale (gpointer data)
-{
- GstFormat format = GST_FORMAT_TIME;
-
- //position = 0;
- //duration = 0;
-
- if (elem_seek) {
- if (seekable_elements) {
- GstElement *element = GST_ELEMENT (seekable_elements->data);
-
- gst_element_query_position (element, &format, &position);
- gst_element_query_duration (element, &format, &duration);
- }
- } else {
- if (seekable_pads) {
- GstPad *pad = GST_PAD (seekable_pads->data);
-
- gst_pad_query_position (pad, &format, &position);
- gst_pad_query_duration (pad, &format, &duration);
- }
- }
-
- if (stats) {
- if (elem_seek) {
- query_positions_elems ();
- } else {
- query_positions_pads ();
- }
- query_rates ();
- }
-
- if (position >= duration)
- duration = position;
-
- if (duration > 0) {
- set_scale (position * 100.0 / duration);
- }
-
- /* FIXME: see make_playerbin2_pipeline() and volume_notify_cb() */
- if (pipeline_type == 16) {
- g_object_notify (G_OBJECT (pipeline), "volume");
- }
-
- return TRUE;
-}
-
-static void do_seek (GtkWidget * widget);
-static void connect_bus_signals (GstElement * pipeline);
-static void set_update_scale (gboolean active);
-static void set_update_fill (gboolean active);
-
-static gboolean
-end_scrub (GtkWidget * widget)
-{
- GST_DEBUG ("end scrub, PAUSE");
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- seek_timeout_id = 0;
-
- return FALSE;
-}
-
-static gboolean
-send_event (GstEvent * event)
-{
- gboolean res = FALSE;
-
- if (!elem_seek) {
- GList *walk = seekable_pads;
-
- while (walk) {
- GstPad *seekable = GST_PAD (walk->data);
-
- GST_DEBUG ("send event on pad %s:%s", GST_DEBUG_PAD_NAME (seekable));
-
- gst_event_ref (event);
- res = gst_pad_send_event (seekable, event);
-
- walk = g_list_next (walk);
- }
- } else {
- GList *walk = seekable_elements;
-
- while (walk) {
- GstElement *seekable = GST_ELEMENT (walk->data);
-
- GST_DEBUG ("send event on element %s", GST_ELEMENT_NAME (seekable));
-
- gst_event_ref (event);
- res = gst_element_send_event (seekable, event);
-
- walk = g_list_next (walk);
- }
- }
- gst_event_unref (event);
- return res;
-}
-
-static void
-do_seek (GtkWidget * widget)
-{
- gint64 real;
- gboolean res = FALSE;
- GstEvent *s_event;
- GstSeekFlags flags;
-
- real = gtk_range_get_value (GTK_RANGE (widget)) * duration / 100;
-
- flags = 0;
- if (flush_seek)
- flags |= GST_SEEK_FLAG_FLUSH;
- if (accurate_seek)
- flags |= GST_SEEK_FLAG_ACCURATE;
- if (keyframe_seek)
- flags |= GST_SEEK_FLAG_KEY_UNIT;
- if (loop_seek)
- flags |= GST_SEEK_FLAG_SEGMENT;
- if (skip_seek)
- flags |= GST_SEEK_FLAG_SKIP;
-
- if (rate >= 0) {
- s_event = gst_event_new_seek (rate,
- GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, real, GST_SEEK_TYPE_SET,
- GST_CLOCK_TIME_NONE);
- GST_DEBUG ("seek with rate %lf to %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT,
- rate, GST_TIME_ARGS (real), GST_TIME_ARGS (duration));
- } else {
- s_event = gst_event_new_seek (rate,
- GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, G_GINT64_CONSTANT (0),
- GST_SEEK_TYPE_SET, real);
- GST_DEBUG ("seek with rate %lf to %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT,
- rate, GST_TIME_ARGS (0), GST_TIME_ARGS (real));
- }
-
- res = send_event (s_event);
-
- if (res) {
- if (flush_seek) {
- gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, SEEK_TIMEOUT);
- } else {
- set_update_scale (TRUE);
- }
- } else {
- g_print ("seek failed\n");
- set_update_scale (TRUE);
- }
-}
-
-static void
-seek_cb (GtkWidget * widget)
-{
- /* If the timer hasn't expired yet, then the pipeline is running */
- if (play_scrub && seek_timeout_id != 0) {
- GST_DEBUG ("do scrub seek, PAUSED");
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- }
-
- GST_DEBUG ("do seek");
- do_seek (widget);
-
- if (play_scrub) {
- GST_DEBUG ("do scrub seek, PLAYING");
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- if (seek_timeout_id == 0) {
- seek_timeout_id =
- g_timeout_add (SCRUB_TIME, (GSourceFunc) end_scrub, widget);
- }
- }
-}
-
-static void
-set_update_fill (gboolean active)
-{
- GST_DEBUG ("fill scale is %d", active);
-
- if (active) {
- if (fill_id == 0) {
- fill_id =
- g_timeout_add (FILL_INTERVAL, (GtkFunction) update_fill, pipeline);
- }
- } else {
- if (fill_id) {
- g_source_remove (fill_id);
- fill_id = 0;
- }
- }
-}
-
-static void
-set_update_scale (gboolean active)
-{
-
- GST_DEBUG ("update scale is %d", active);
-
- if (active) {
- if (update_id == 0) {
- update_id =
- g_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
- }
- } else {
- if (update_id) {
- g_source_remove (update_id);
- update_id = 0;
- }
- }
-}
-
-static gboolean
-start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
-{
- if (event->type != GDK_BUTTON_PRESS)
- return FALSE;
-
- set_update_scale (FALSE);
-
- if (state == GST_STATE_PLAYING && flush_seek && scrub) {
- GST_DEBUG ("start scrub seek, PAUSE");
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- }
-
- if (changed_id == 0 && flush_seek && scrub) {
- changed_id =
- g_signal_connect (hscale, "value_changed", G_CALLBACK (seek_cb),
- pipeline);
- }
-
- return FALSE;
-}
-
-static gboolean
-stop_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
-{
- if (changed_id) {
- g_signal_handler_disconnect (hscale, changed_id);
- changed_id = 0;
- }
-
- if (!flush_seek || !scrub) {
- GST_DEBUG ("do final seek");
- do_seek (widget);
- }
-
- if (seek_timeout_id != 0) {
- g_source_remove (seek_timeout_id);
- seek_timeout_id = 0;
- /* Still scrubbing, so the pipeline is playing, see if we need PAUSED
- * instead. */
- if (state == GST_STATE_PAUSED) {
- GST_DEBUG ("stop scrub seek, PAUSED");
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- }
- } else {
- if (state == GST_STATE_PLAYING) {
- GST_DEBUG ("stop scrub seek, PLAYING");
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- }
- }
-
- return FALSE;
-}
-
-static void
-play_cb (GtkButton * button, gpointer data)
-{
- GstStateChangeReturn ret;
-
- if (state != GST_STATE_PLAYING) {
- g_print ("PLAY pipeline\n");
- gtk_statusbar_pop (GTK_STATUSBAR (statusbar), status_id);
-
- ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- switch (ret) {
- case GST_STATE_CHANGE_FAILURE:
- goto failed;
- case GST_STATE_CHANGE_NO_PREROLL:
- is_live = TRUE;
- break;
- default:
- break;
- }
- state = GST_STATE_PLAYING;
- gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Playing");
- }
-
- return;
-
-failed:
- {
- g_print ("PLAY failed\n");
- gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Play failed");
- }
-}
-
-static void
-pause_cb (GtkButton * button, gpointer data)
-{
- g_static_mutex_lock (&state_mutex);
- if (state != GST_STATE_PAUSED) {
- GstStateChangeReturn ret;
-
- gtk_statusbar_pop (GTK_STATUSBAR (statusbar), status_id);
- g_print ("PAUSE pipeline\n");
- ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
- switch (ret) {
- case GST_STATE_CHANGE_FAILURE:
- goto failed;
- case GST_STATE_CHANGE_NO_PREROLL:
- is_live = TRUE;
- break;
- default:
- break;
- }
-
- state = GST_STATE_PAUSED;
- gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Paused");
- }
- g_static_mutex_unlock (&state_mutex);
-
- return;
-
-failed:
- {
- g_static_mutex_unlock (&state_mutex);
- g_print ("PAUSE failed\n");
- gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Pause failed");
- }
-}
-
-static void
-stop_cb (GtkButton * button, gpointer data)
-{
- if (state != STOP_STATE) {
- GstStateChangeReturn ret;
-
- g_print ("READY pipeline\n");
- gtk_statusbar_pop (GTK_STATUSBAR (statusbar), status_id);
-
- g_static_mutex_lock (&state_mutex);
- ret = gst_element_set_state (pipeline, STOP_STATE);
- if (ret == GST_STATE_CHANGE_FAILURE)
- goto failed;
-
- state = STOP_STATE;
- gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Stopped");
-
- is_live = FALSE;
- buffering = FALSE;
- set_update_scale (FALSE);
- set_scale (0.0);
- set_update_fill (FALSE);
-
- if (pipeline_type == 16)
- clear_streams (pipeline);
- g_static_mutex_unlock (&state_mutex);
-
-#if 0
- /* if one uses parse_launch, play, stop and play again it fails as all the
- * pads after the demuxer can't be reconnected
- */
- if (!strcmp (pipelines[pipeline_type].name, "parse-launch")) {
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- g_list_free (seekable_elements);
- seekable_elements = NULL;
- g_list_free (seekable_pads);
- seekable_pads = NULL;
- g_list_free (rate_pads);
- rate_pads = NULL;
-
- pipeline = pipelines[pipeline_type].func (pipeline_spec);
- g_assert (pipeline);
- gst_element_set_state (pipeline, STOP_STATE);
- connect_bus_signals (pipeline);
- }
-#endif
- }
- return;
-
-failed:
- {
- g_static_mutex_unlock (&state_mutex);
- g_print ("STOP failed\n");
- gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Stop failed");
- }
-}
-
-static void
-accurate_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
-{
- accurate_seek = gtk_toggle_button_get_active (button);
-}
-
-static void
-key_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
-{
- keyframe_seek = gtk_toggle_button_get_active (button);
-}
-
-static void
-loop_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
-{
- loop_seek = gtk_toggle_button_get_active (button);
- if (state == GST_STATE_PLAYING) {
- do_seek (hscale);
- }
-}
-
-static void
-flush_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
-{
- flush_seek = gtk_toggle_button_get_active (button);
-}
-
-static void
-scrub_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
-{
- scrub = gtk_toggle_button_get_active (button);
-}
-
-static void
-play_scrub_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
-{
- play_scrub = gtk_toggle_button_get_active (button);
-}
-
-static void
-skip_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
-{
- skip_seek = gtk_toggle_button_get_active (button);
- if (state == GST_STATE_PLAYING) {
- do_seek (hscale);
- }
-}
-
-static void
-rate_spinbutton_changed_cb (GtkSpinButton * button, GstPipeline * pipeline)
-{
- gboolean res = FALSE;
- GstEvent *s_event;
- GstSeekFlags flags;
-
- rate = gtk_spin_button_get_value (button);
-
- GST_DEBUG ("rate changed to %lf", rate);
-
- flags = 0;
- if (flush_seek)
- flags |= GST_SEEK_FLAG_FLUSH;
- if (loop_seek)
- flags |= GST_SEEK_FLAG_SEGMENT;
- if (accurate_seek)
- flags |= GST_SEEK_FLAG_ACCURATE;
- if (keyframe_seek)
- flags |= GST_SEEK_FLAG_KEY_UNIT;
- if (skip_seek)
- flags |= GST_SEEK_FLAG_SKIP;
-
- if (rate >= 0.0) {
- s_event = gst_event_new_seek (rate,
- GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, position,
- GST_SEEK_TYPE_SET, GST_CLOCK_TIME_NONE);
- } else {
- s_event = gst_event_new_seek (rate,
- GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, G_GINT64_CONSTANT (0),
- GST_SEEK_TYPE_SET, position);
- }
-
- res = send_event (s_event);
-
- if (res) {
- if (flush_seek) {
- gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL, SEEK_TIMEOUT);
- }
- } else
- g_print ("seek failed\n");
-}
-
-static void
-update_flag (GstPipeline * pipeline, gint num, gboolean state)
-{
- gint flags;
-
- g_object_get (pipeline, "flags", &flags, NULL);
- if (state)
- flags |= (1 << num);
- else
- flags &= ~(1 << num);
- g_object_set (pipeline, "flags", flags, NULL);
-}
-
-static void
-vis_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
-{
- gboolean state;
-
- state = gtk_toggle_button_get_active (button);
- update_flag (pipeline, 3, state);
- gtk_widget_set_sensitive (vis_combo, state);
-}
-
-static void
-audio_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
-{
- gboolean state;
-
- state = gtk_toggle_button_get_active (button);
- update_flag (pipeline, 1, state);
- gtk_widget_set_sensitive (audio_combo, state);
-}
-
-static void
-video_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
-{
- gboolean state;
-
- state = gtk_toggle_button_get_active (button);
- update_flag (pipeline, 0, state);
- gtk_widget_set_sensitive (video_combo, state);
-}
-
-static void
-text_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
-{
- gboolean state;
-
- state = gtk_toggle_button_get_active (button);
- update_flag (pipeline, 2, state);
- gtk_widget_set_sensitive (text_combo, state);
-}
-
-static void
-mute_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
-{
- gboolean mute;
-
- mute = gtk_toggle_button_get_active (button);
- g_object_set (pipeline, "mute", mute, NULL);
-}
-
-static void
-download_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
-{
- gboolean state;
-
- state = gtk_toggle_button_get_active (button);
- update_flag (pipeline, 7, state);
-}
-
-static void
-buffer_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
-{
- gboolean state;
-
- state = gtk_toggle_button_get_active (button);
- update_flag (pipeline, 8, state);
-}
-
-static void
-clear_streams (GstElement * pipeline)
-{
- gint i;
-
- /* remove previous info */
- for (i = 0; i < n_video; i++)
- gtk_combo_box_remove_text (GTK_COMBO_BOX (video_combo), 0);
- for (i = 0; i < n_audio; i++)
- gtk_combo_box_remove_text (GTK_COMBO_BOX (audio_combo), 0);
- for (i = 0; i < n_text; i++)
- gtk_combo_box_remove_text (GTK_COMBO_BOX (text_combo), 0);
-
- n_audio = n_video = n_text = 0;
- gtk_widget_set_sensitive (video_combo, FALSE);
- gtk_widget_set_sensitive (audio_combo, FALSE);
- gtk_widget_set_sensitive (text_combo, FALSE);
-
- need_streams = TRUE;
-}
-
-static void
-update_streams (GstPipeline * pipeline)
-{
- gint i;
-
- if (pipeline_type == 16 && need_streams) {
- GstTagList *tags;
- gchar *name, *str;
- gint active_idx;
- gboolean state;
-
- /* remove previous info */
- clear_streams (GST_ELEMENT_CAST (pipeline));
-
- /* here we get and update the different streams detected by playbin2 */
- g_object_get (pipeline, "n-video", &n_video, NULL);
- g_object_get (pipeline, "n-audio", &n_audio, NULL);
- g_object_get (pipeline, "n-text", &n_text, NULL);
-
- g_print ("video %d, audio %d, text %d\n", n_video, n_audio, n_text);
-
- active_idx = 0;
- for (i = 0; i < n_video; i++) {
- g_signal_emit_by_name (pipeline, "get-video-tags", i, &tags);
- if (tags) {
- str = gst_structure_to_string ((GstStructure *) tags);
- g_print ("video %d: %s\n", i, str);
- g_free (str);
- }
- /* find good name for the label */
- name = g_strdup_printf ("video %d", i + 1);
- gtk_combo_box_append_text (GTK_COMBO_BOX (video_combo), name);
- g_free (name);
- }
- state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (video_checkbox));
- gtk_widget_set_sensitive (video_combo, state && n_video > 0);
- gtk_combo_box_set_active (GTK_COMBO_BOX (video_combo), active_idx);
-
- active_idx = 0;
- for (i = 0; i < n_audio; i++) {
- g_signal_emit_by_name (pipeline, "get-audio-tags", i, &tags);
- if (tags) {
- str = gst_structure_to_string ((GstStructure *) tags);
- g_print ("audio %d: %s\n", i, str);
- g_free (str);
- }
- /* find good name for the label */
- name = g_strdup_printf ("audio %d", i + 1);
- gtk_combo_box_append_text (GTK_COMBO_BOX (audio_combo), name);
- g_free (name);
- }
- state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (audio_checkbox));
- gtk_widget_set_sensitive (audio_combo, state && n_audio > 0);
- gtk_combo_box_set_active (GTK_COMBO_BOX (audio_combo), active_idx);
-
- active_idx = 0;
- for (i = 0; i < n_text; i++) {
- g_signal_emit_by_name (pipeline, "get-text-tags", i, &tags);
-
- name = NULL;
- if (tags) {
- const GValue *value;
-
- str = gst_structure_to_string ((GstStructure *) tags);
- g_print ("text %d: %s\n", i, str);
- g_free (str);
-
- /* get the language code if we can */
- value = gst_tag_list_get_value_index (tags, GST_TAG_LANGUAGE_CODE, 0);
- if (value && G_VALUE_HOLDS_STRING (value)) {
- name = g_strdup_printf ("text %s", g_value_get_string (value));
- }
- }
- /* find good name for the label if we didn't use a tag */
- if (name == NULL)
- name = g_strdup_printf ("text %d", i + 1);
-
- gtk_combo_box_append_text (GTK_COMBO_BOX (text_combo), name);
- g_free (name);
- }
- state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (text_checkbox));
- gtk_widget_set_sensitive (text_combo, state && n_text > 0);
- gtk_combo_box_set_active (GTK_COMBO_BOX (text_combo), active_idx);
-
- need_streams = FALSE;
- }
-}
-
-static void
-video_combo_cb (GtkComboBox * combo, GstPipeline * pipeline)
-{
- gint active;
-
- active = gtk_combo_box_get_active (combo);
-
- g_print ("setting current video track %d\n", active);
- g_object_set (pipeline, "current-video", active, NULL);
-}
-
-static void
-audio_combo_cb (GtkComboBox * combo, GstPipeline * pipeline)
-{
- gint active;
-
- active = gtk_combo_box_get_active (combo);
-
- g_print ("setting current audio track %d\n", active);
- g_object_set (pipeline, "current-audio", active, NULL);
-}
-
-static void
-text_combo_cb (GtkComboBox * combo, GstPipeline * pipeline)
-{
- gint active;
-
- active = gtk_combo_box_get_active (combo);
-
- g_print ("setting current text track %d\n", active);
- g_object_set (pipeline, "current-text", active, NULL);
-}
-
-static gboolean
-filter_features (GstPluginFeature * feature, gpointer data)
-{
- GstElementFactory *f;
-
- if (!GST_IS_ELEMENT_FACTORY (feature))
- return FALSE;
- f = GST_ELEMENT_FACTORY (feature);
- if (!g_strrstr (gst_element_factory_get_klass (f), "Visualization"))
- return FALSE;
-
- return TRUE;
-}
-
-static void
-init_visualization_features (void)
-{
- GList *list, *walk;
-
- vis_entries = g_array_new (FALSE, FALSE, sizeof (VisEntry));
-
- list = gst_registry_feature_filter (gst_registry_get_default (),
- filter_features, FALSE, NULL);
-
- for (walk = list; walk; walk = g_list_next (walk)) {
- VisEntry entry;
- const gchar *name;
-
- entry.factory = GST_ELEMENT_FACTORY (walk->data);
- name = gst_element_factory_get_longname (entry.factory);
-
- g_array_append_val (vis_entries, entry);
- gtk_combo_box_append_text (GTK_COMBO_BOX (vis_combo), name);
- }
- gtk_combo_box_set_active (GTK_COMBO_BOX (vis_combo), 0);
-}
-
-static void
-vis_combo_cb (GtkComboBox * combo, GstPipeline * pipeline)
-{
- guint index;
- VisEntry *entry;
- GstElement *element;
-
- /* get the selected index and get the factory for this index */
- index = gtk_combo_box_get_active (GTK_COMBO_BOX (vis_combo));
- if (vis_entries->len > 0) {
- entry = &g_array_index (vis_entries, VisEntry, index);
-
- /* create an instance of the element from the factory */
- element = gst_element_factory_create (entry->factory, NULL);
- if (!element)
- return;
-
- /* set vis plugin for playbin2 */
- g_object_set (pipeline, "vis-plugin", element, NULL);
- }
-}
-
-static void
-volume_spinbutton_changed_cb (GtkSpinButton * button, GstPipeline * pipeline)
-{
- gdouble volume;
-
- volume = gtk_spin_button_get_value (button);
-
- g_object_set (pipeline, "volume", volume, NULL);
-}
-
-static void
-volume_notify_cb (GstElement * pipeline, GParamSpec * arg, gpointer user_dat)
-{
- gdouble cur_volume, new_volume;
-
- g_object_get (pipeline, "volume", &new_volume, NULL);
- cur_volume = gtk_spin_button_get_value (GTK_SPIN_BUTTON (volume_spinbutton));
- if (fabs (cur_volume - new_volume) > 0.001) {
- g_signal_handlers_block_by_func (volume_spinbutton,
- volume_spinbutton_changed_cb, pipeline);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (volume_spinbutton), new_volume);
- g_signal_handlers_unblock_by_func (volume_spinbutton,
- volume_spinbutton_changed_cb, pipeline);
- }
-}
-
-static void
-shot_cb (GtkButton * button, gpointer data)
-{
- GstBuffer *buffer;
- GstCaps *caps;
-
- /* convert to our desired format (RGB24) */
- caps = gst_caps_new_simple ("video/x-raw-rgb",
- "bpp", G_TYPE_INT, 24, "depth", G_TYPE_INT, 24,
- /* Note: we don't ask for a specific width/height here, so that
- * videoscale can adjust dimensions from a non-1/1 pixel aspect
- * ratio to a 1/1 pixel-aspect-ratio */
- "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
- "endianness", G_TYPE_INT, G_BIG_ENDIAN,
- "red_mask", G_TYPE_INT, 0xff0000,
- "green_mask", G_TYPE_INT, 0x00ff00,
- "blue_mask", G_TYPE_INT, 0x0000ff, NULL);
-
- /* convert the latest frame to the requested format */
- g_signal_emit_by_name (pipeline, "convert-frame", caps, &buffer);
- gst_caps_unref (caps);
-
- if (buffer) {
- GstCaps *caps;
- GstStructure *s;
- gboolean res;
- gint width, height;
- GdkPixbuf *pixbuf;
- GError *error = NULL;
-
- /* get the snapshot buffer format now. We set the caps on the appsink so
- * that it can only be an rgb buffer. The only thing we have not specified
- * on the caps is the height, which is dependant on the pixel-aspect-ratio
- * of the source material */
- caps = GST_BUFFER_CAPS (buffer);
- if (!caps) {
- g_warning ("could not get snapshot format\n");
- goto done;
- }
- s = gst_caps_get_structure (caps, 0);
-
- /* we need to get the final caps on the buffer to get the size */
- res = gst_structure_get_int (s, "width", &width);
- res |= gst_structure_get_int (s, "height", &height);
- if (!res) {
- g_warning ("could not get snapshot dimension\n");
- goto done;
- }
-
- /* create pixmap from buffer and save, gstreamer video buffers have a stride
- * that is rounded up to the nearest multiple of 4 */
- pixbuf = gdk_pixbuf_new_from_data (GST_BUFFER_DATA (buffer),
- GDK_COLORSPACE_RGB, FALSE, 8, width, height,
- GST_ROUND_UP_4 (width * 3), NULL, NULL);
-
- /* save the pixbuf */
- gdk_pixbuf_save (pixbuf, "snapshot.png", "png", &error, NULL);
-
- done:
- gst_buffer_unref (buffer);
- }
-}
-
-/* called when the Step button is pressed */
-static void
-step_cb (GtkButton * button, gpointer data)
-{
- GstEvent *event;
- GstFormat format;
- guint64 amount;
- gdouble rate;
- gboolean flush, res;
- gint active;
-
- active = gtk_combo_box_get_active (GTK_COMBO_BOX (format_combo));
- amount =
- gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON
- (step_amount_spinbutton));
- rate = gtk_spin_button_get_value (GTK_SPIN_BUTTON (step_rate_spinbutton));
- flush = TRUE;
-
- switch (active) {
- case 0:
- format = GST_FORMAT_BUFFERS;
- break;
- case 1:
- format = GST_FORMAT_TIME;
- amount *= GST_MSECOND;
- break;
- default:
- format = GST_FORMAT_UNDEFINED;
- break;
- }
-
- event = gst_event_new_step (format, amount, rate, flush, FALSE);
-
- res = send_event (event);
-}
-
-static void
-message_received (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
-{
- const GstStructure *s;
-
- s = gst_message_get_structure (message);
- g_print ("message from \"%s\" (%s): ",
- GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))),
- gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
- if (s) {
- gchar *sstr;
-
- sstr = gst_structure_to_string (s);
- g_print ("%s\n", sstr);
- g_free (sstr);
- } else {
- g_print ("no message details\n");
- }
-}
-
-static gboolean shuttling = FALSE;
-static gdouble shuttle_rate = 0.0;
-static gdouble play_rate = 1.0;
-
-static void
-do_shuttle (GstElement * element)
-{
- guint64 duration;
-
- if (shuttling)
- duration = 40 * GST_MSECOND;
- else
- duration = -1;
-
- gst_element_send_event (element,
- gst_event_new_step (GST_FORMAT_TIME, duration, shuttle_rate, FALSE,
- FALSE));
-}
-
-static void
-msg_sync_step_done (GstBus * bus, GstMessage * message, GstElement * element)
-{
- GstFormat format;
- guint64 amount;
- gdouble rate;
- gboolean flush;
- gboolean intermediate;
- guint64 duration;
- gboolean eos;
-
- gst_message_parse_step_done (message, &format, &amount, &rate, &flush,
- &intermediate, &duration, &eos);
-
- if (eos) {
- g_print ("stepped till EOS\n");
- return;
- }
-
- if (g_static_mutex_trylock (&state_mutex)) {
- if (shuttling)
- do_shuttle (element);
- g_static_mutex_unlock (&state_mutex);
- } else {
- /* ignore step messages that come while we are doing a state change */
- g_print ("state change is busy\n");
- }
-}
-
-static void
-shuttle_toggled (GtkToggleButton * button, GstElement * element)
-{
- gboolean active;
-
- active = gtk_toggle_button_get_active (button);
-
- if (active != shuttling) {
- shuttling = active;
- g_print ("shuttling %s\n", shuttling ? "active" : "inactive");
- if (active) {
- shuttle_rate = 0.0;
- play_rate = 1.0;
- pause_cb (NULL, NULL);
- gst_element_get_state (element, NULL, NULL, -1);
- }
- }
-}
-
-static void
-shuttle_rate_switch (GstElement * element)
-{
- GstSeekFlags flags;
- GstEvent *s_event;
- gboolean res;
-
- if (state == GST_STATE_PLAYING) {
- /* pause when we need to */
- pause_cb (NULL, NULL);
- gst_element_get_state (element, NULL, NULL, -1);
- }
-
- if (play_rate == 1.0)
- play_rate = -1.0;
- else
- play_rate = 1.0;
-
- g_print ("rate changed to %lf %" GST_TIME_FORMAT "\n", play_rate,
- GST_TIME_ARGS (position));
-
- flags = GST_SEEK_FLAG_FLUSH;
- flags |= GST_SEEK_FLAG_ACCURATE;
-
- if (play_rate >= 0.0) {
- s_event = gst_event_new_seek (play_rate,
- GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, position,
- GST_SEEK_TYPE_SET, GST_CLOCK_TIME_NONE);
- } else {
- s_event = gst_event_new_seek (play_rate,
- GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, G_GINT64_CONSTANT (0),
- GST_SEEK_TYPE_SET, position);
- }
- res = send_event (s_event);
- if (res) {
- gst_element_get_state (element, NULL, NULL, SEEK_TIMEOUT);
- } else {
- g_print ("seek failed\n");
- }
-}
-
-static void
-shuttle_value_changed (GtkRange * range, GstElement * element)
-{
- gdouble rate;
-
- rate = gtk_adjustment_get_value (shuttle_adjustment);
-
- if (rate == 0.0) {
- g_print ("rate 0.0, pause\n");
- pause_cb (NULL, NULL);
- gst_element_get_state (element, NULL, NULL, -1);
- } else {
- g_print ("rate changed %0.3g\n", rate);
-
- if ((rate < 0.0 && play_rate > 0.0) || (rate > 0.0 && play_rate < 0.0)) {
- shuttle_rate_switch (element);
- }
-
- shuttle_rate = ABS (rate);
- if (state != GST_STATE_PLAYING) {
- do_shuttle (element);
- play_cb (NULL, NULL);
- }
- }
-}
-
-static void
-msg_async_done (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
-{
- GST_DEBUG ("async done");
- /* when we get ASYNC_DONE we can query position, duration and other
- * properties */
- update_scale (pipeline);
-
- /* update the available streams */
- update_streams (pipeline);
-}
-
-static void
-msg_state_changed (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
-{
- const GstStructure *s;
-
- s = gst_message_get_structure (message);
-
- /* We only care about state changed on the pipeline */
- if (s && GST_MESSAGE_SRC (message) == GST_OBJECT_CAST (pipeline)) {
- GstState old, new, pending;
-
- gst_message_parse_state_changed (message, &old, &new, &pending);
-
- /* When state of the pipeline changes to paused or playing we start updating scale */
- if (new == GST_STATE_PLAYING) {
- set_update_scale (TRUE);
- } else {
- set_update_scale (FALSE);
- }
- }
-}
-
-static void
-msg_segment_done (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
-{
- GstEvent *s_event;
- GstSeekFlags flags;
- gboolean res;
- GstFormat format;
-
- GST_DEBUG ("position is %" GST_TIME_FORMAT, GST_TIME_ARGS (position));
- gst_message_parse_segment_done (message, &format, &position);
- GST_DEBUG ("end of segment at %" GST_TIME_FORMAT, GST_TIME_ARGS (position));
-
- flags = 0;
- /* in the segment-done callback we never flush as this would not make sense
- * for seamless playback. */
- if (loop_seek)
- flags |= GST_SEEK_FLAG_SEGMENT;
- if (skip_seek)
- flags |= GST_SEEK_FLAG_SKIP;
-
- s_event = gst_event_new_seek (rate,
- GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, G_GINT64_CONSTANT (0),
- GST_SEEK_TYPE_SET, duration);
-
- GST_DEBUG ("restart loop with rate %lf to 0 / %" GST_TIME_FORMAT,
- rate, GST_TIME_ARGS (duration));
-
- res = send_event (s_event);
- if (!res)
- g_print ("segment seek failed\n");
-}
-
-/* in stream buffering mode we PAUSE the pipeline until we receive a 100%
- * message */
-static void
-do_stream_buffering (gint percent)
-{
- gchar *bufstr;
-
- gtk_statusbar_pop (GTK_STATUSBAR (statusbar), status_id);
- bufstr = g_strdup_printf ("Buffering...%d", percent);
- gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, bufstr);
- g_free (bufstr);
-
- if (percent == 100) {
- /* a 100% message means buffering is done */
- buffering = FALSE;
- /* if the desired state is playing, go back */
- if (state == GST_STATE_PLAYING) {
- /* no state management needed for live pipelines */
- if (!is_live) {
- fprintf (stderr, "Done buffering, setting pipeline to PLAYING ...\n");
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- }
- gtk_statusbar_pop (GTK_STATUSBAR (statusbar), status_id);
- gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Playing");
- }
- } else {
- /* buffering busy */
- if (buffering == FALSE && state == GST_STATE_PLAYING) {
- /* we were not buffering but PLAYING, PAUSE the pipeline. */
- if (!is_live) {
- fprintf (stderr, "Buffering, setting pipeline to PAUSED ...\n");
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- }
- }
- buffering = TRUE;
- }
-}
-
-static void
-do_download_buffering (gint percent)
-{
- if (!buffering && percent < 100) {
- gchar *bufstr;
-
- buffering = TRUE;
-
- bufstr = g_strdup_printf ("Downloading...");
- gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, bufstr);
- g_free (bufstr);
-
- /* once we get a buffering message, we'll do the fill update */
- set_update_fill (TRUE);
-
- if (state == GST_STATE_PLAYING && !is_live) {
- fprintf (stderr, "Downloading, setting pipeline to PAUSED ...\n");
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- /* user has to manually start the playback */
- state = GST_STATE_PAUSED;
- }
- }
-}
-
-static void
-msg_buffering (GstBus * bus, GstMessage * message, GstPipeline * data)
-{
- gint percent;
-
- gst_message_parse_buffering (message, &percent);
-
- /* get more stats */
- gst_message_parse_buffering_stats (message, &mode, NULL, NULL,
- &buffering_left);
-
- switch (mode) {
- case GST_BUFFERING_DOWNLOAD:
- do_download_buffering (percent);
- break;
- case GST_BUFFERING_LIVE:
- case GST_BUFFERING_TIMESHIFT:
- case GST_BUFFERING_STREAM:
- do_stream_buffering (percent);
- break;
- }
-}
-
-static void
-msg_clock_lost (GstBus * bus, GstMessage * message, GstPipeline * data)
-{
- g_print ("clock lost! PAUSE and PLAY to select a new clock\n");
-
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-}
-
-#ifdef HAVE_X
-
-static gulong embed_xid = 0;
-
-/* We set the xid here in response to the prepare-xwindow-id message via a
- * bus sync handler because we don't know the actual videosink used from the
- * start (as we don't know the pipeline, or bin elements such as autovideosink
- * or gconfvideosink may be used which create the actual videosink only once
- * the pipeline is started) */
-static GstBusSyncReply
-bus_sync_handler (GstBus * bus, GstMessage * message, GstPipeline * data)
-{
- if ((GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT) &&
- gst_structure_has_name (message->structure, "prepare-xwindow-id")) {
- GstElement *element = GST_ELEMENT (GST_MESSAGE_SRC (message));
-
- g_print ("got prepare-xwindow-id, setting XID %lu\n", embed_xid);
-
- if (g_object_class_find_property (G_OBJECT_GET_CLASS (element),
- "force-aspect-ratio")) {
- g_object_set (element, "force-aspect-ratio", TRUE, NULL);
- }
-
- /* Should have been initialised from main thread before (can't use
- * GDK_WINDOW_XID here with Gtk+ >= 2.18, because the sync handler will
- * be called from a streaming thread and GDK_WINDOW_XID maps to more than
- * a simple structure lookup with Gtk+ >= 2.18, where 'more' is stuff that
- * shouldn't be done from a non-GUI thread without explicit locking). */
- g_assert (embed_xid != 0);
-
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (element), embed_xid);
- }
- return GST_BUS_PASS;
-}
-#endif
-
-static gboolean
-handle_expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer data)
-{
- if (state < GST_STATE_PAUSED) {
- gdk_draw_rectangle (widget->window, widget->style->black_gc, TRUE,
- 0, 0, widget->allocation.width, widget->allocation.height);
- }
- return FALSE;
-}
-
-static void
-realize_cb (GtkWidget * widget, gpointer data)
-{
-#if GTK_CHECK_VERSION(2,18,0)
- /* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
- * as well */
- if (!gdk_window_ensure_native (widget->window))
- g_error ("Couldn't create native window needed for GstXOverlay!");
-#endif
-
-#ifdef HAVE_X
- embed_xid = GDK_WINDOW_XID (video_window->window);
- g_print ("Window realize: video window XID = %lu\n", embed_xid);
-#endif
-}
-
-static void
-msg_eos (GstBus * bus, GstMessage * message, GstPipeline * data)
-{
- message_received (bus, message, data);
-
- /* Set new uri for playerbins and continue playback */
- if (l && (pipeline_type == 14 || pipeline_type == 16)) {
- stop_cb (NULL, NULL);
- l = g_list_next (l);
- if (l) {
- playerbin_set_uri (GST_ELEMENT (data), l->data);
- play_cb (NULL, NULL);
- }
- }
-}
-
-static void
-msg_step_done (GstBus * bus, GstMessage * message, GstPipeline * data)
-{
- if (!shuttling)
- message_received (bus, message, data);
-}
-
-static void
-connect_bus_signals (GstElement * pipeline)
-{
- GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
-
-#ifdef HAVE_X
- /* handle prepare-xwindow-id element message synchronously */
- gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bus_sync_handler,
- pipeline);
-#endif
-
- gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
- gst_bus_enable_sync_message_emission (bus);
-
- g_signal_connect (bus, "message::state-changed",
- (GCallback) msg_state_changed, pipeline);
- g_signal_connect (bus, "message::segment-done", (GCallback) msg_segment_done,
- pipeline);
- g_signal_connect (bus, "message::async-done", (GCallback) msg_async_done,
- pipeline);
-
- g_signal_connect (bus, "message::new-clock", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::clock-lost", (GCallback) msg_clock_lost,
- pipeline);
- g_signal_connect (bus, "message::error", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::warning", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::eos", (GCallback) msg_eos, pipeline);
- g_signal_connect (bus, "message::tag", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::element", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::segment-done", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::buffering", (GCallback) msg_buffering,
- pipeline);
-// g_signal_connect (bus, "message::step-done", (GCallback) msg_step_done,
-// pipeline);
- g_signal_connect (bus, "message::step-start", (GCallback) msg_step_done,
- pipeline);
- g_signal_connect (bus, "sync-message::step-done",
- (GCallback) msg_sync_step_done, pipeline);
-
- gst_object_unref (bus);
-}
-
-/* Return GList of paths described in location string */
-static GList *
-handle_wildcards (const gchar * location)
-{
- GList *res = NULL;
- gchar *path = g_path_get_dirname (location);
- gchar *pattern = g_path_get_basename (location);
- GPatternSpec *pspec = g_pattern_spec_new (pattern);
- GDir *dir = g_dir_open (path, 0, NULL);
- const gchar *name;
-
- g_print ("matching %s from %s\n", pattern, path);
-
- if (!dir) {
- g_print ("opening directory %s failed\n", path);
- goto out;
- }
-
- while ((name = g_dir_read_name (dir)) != NULL) {
- if (g_pattern_match_string (pspec, name)) {
- res = g_list_append (res, g_strjoin ("/", path, name, NULL));
- g_print (" found clip %s\n", name);
- }
- }
-
- g_dir_close (dir);
-out:
- g_pattern_spec_free (pspec);
- g_free (pattern);
- g_free (path);
-
- return res;
-}
-
-static void
-delete_event_cb (void)
-{
- stop_cb (NULL, NULL);
- gtk_main_quit ();
-}
-
-static void
-print_usage (int argc, char **argv)
-{
- gint i;
-
- g_print ("usage: %s <type> <filename>\n", argv[0]);
- g_print (" possible types:\n");
-
- for (i = 0; i < NUM_TYPES; i++) {
- g_print (" %d = %s\n", i, pipelines[i].name);
- }
-}
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *window, *hbox, *vbox, *panel, *expander, *pb2vbox, *boxes,
- *flagtable, *boxes2, *step;
- GtkWidget *play_button, *pause_button, *stop_button, *shot_button;
- GtkWidget *accurate_checkbox, *key_checkbox, *loop_checkbox, *flush_checkbox;
- GtkWidget *scrub_checkbox, *play_scrub_checkbox;
- GtkWidget *rate_label, *volume_label;
- GOptionEntry options[] = {
- {"stats", 's', 0, G_OPTION_ARG_NONE, &stats,
- "Show pad stats", NULL},
- {"elem", 'e', 0, G_OPTION_ARG_NONE, &elem_seek,
- "Seek on elements instead of pads", NULL},
- {"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
- "Verbose properties", NULL},
- {NULL}
- };
- GOptionContext *ctx;
- GError *err = NULL;
-
- if (!g_thread_supported ())
- g_thread_init (NULL);
-
- ctx = g_option_context_new ("- test seeking in gsteamer");
- g_option_context_add_main_entries (ctx, options, NULL);
- g_option_context_add_group (ctx, gst_init_get_option_group ());
- g_option_context_add_group (ctx, gtk_get_option_group (TRUE));
-
- if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
- g_print ("Error initializing: %s\n", err->message);
- exit (1);
- }
-
- GST_DEBUG_CATEGORY_INIT (seek_debug, "seek", 0, "seek example");
-
- if (argc != 3) {
- print_usage (argc, argv);
- exit (-1);
- }
-
- pipeline_type = atoi (argv[1]);
-
- if (pipeline_type < 0 || pipeline_type >= NUM_TYPES) {
- print_usage (argc, argv);
- exit (-1);
- }
-
- pipeline_spec = argv[2];
-
- if (g_strrstr (pipeline_spec, "*") != NULL ||
- g_strrstr (pipeline_spec, "?") != NULL) {
- paths = handle_wildcards (pipeline_spec);
- } else {
- paths = g_list_prepend (paths, g_strdup (pipeline_spec));
- }
-
- if (!paths) {
- g_print ("opening %s failed\n", pipeline_spec);
- exit (-1);
- }
-
- l = paths;
-
- pipeline = pipelines[pipeline_type].func ((gchar *) l->data);
- g_assert (pipeline);
-
- /* initialize gui elements ... */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- video_window = gtk_drawing_area_new ();
- g_signal_connect (video_window, "expose-event",
- G_CALLBACK (handle_expose_cb), NULL);
- g_signal_connect (video_window, "realize", G_CALLBACK (realize_cb), NULL);
- gtk_widget_set_double_buffered (video_window, FALSE);
-
- statusbar = gtk_statusbar_new ();
- status_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (statusbar), "seek");
- gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Stopped");
- hbox = gtk_hbox_new (FALSE, 0);
- vbox = gtk_vbox_new (FALSE, 0);
- flagtable = gtk_table_new (4, 2, FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 3);
-
- /* media controls */
- play_button = gtk_button_new_from_stock (GTK_STOCK_MEDIA_PLAY);
- pause_button = gtk_button_new_from_stock (GTK_STOCK_MEDIA_PAUSE);
- stop_button = gtk_button_new_from_stock (GTK_STOCK_MEDIA_STOP);
-
- /* seek flags */
- accurate_checkbox = gtk_check_button_new_with_label ("Accurate Seek");
- key_checkbox = gtk_check_button_new_with_label ("Key-unit Seek");
- loop_checkbox = gtk_check_button_new_with_label ("Loop");
- flush_checkbox = gtk_check_button_new_with_label ("Flush");
- scrub_checkbox = gtk_check_button_new_with_label ("Scrub");
- play_scrub_checkbox = gtk_check_button_new_with_label ("Play Scrub");
- skip_checkbox = gtk_check_button_new_with_label ("Play Skip");
- rate_spinbutton = gtk_spin_button_new_with_range (-100, 100, 0.1);
- gtk_spin_button_set_digits (GTK_SPIN_BUTTON (rate_spinbutton), 3);
- rate_label = gtk_label_new ("Rate");
-
- gtk_widget_set_tooltip_text (accurate_checkbox,
- "accurate position is requested, this might be considerably slower for some formats");
- gtk_widget_set_tooltip_text (key_checkbox,
- "seek to the nearest keyframe. This might be faster but less accurate");
- gtk_widget_set_tooltip_text (loop_checkbox, "loop playback");
- gtk_widget_set_tooltip_text (flush_checkbox, "flush pipeline after seeking");
- gtk_widget_set_tooltip_text (rate_spinbutton, "define the playback rate, "
- "negative value trigger reverse playback");
- gtk_widget_set_tooltip_text (scrub_checkbox, "show images while seeking");
- gtk_widget_set_tooltip_text (play_scrub_checkbox, "play video while seeking");
- gtk_widget_set_tooltip_text (skip_checkbox,
- "Skip frames while playing at high frame rates");
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flush_checkbox), TRUE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scrub_checkbox), TRUE);
-
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (rate_spinbutton), rate);
-
- /* step expander */
- {
- GtkWidget *hbox;
-
- step = gtk_expander_new ("step options");
- hbox = gtk_hbox_new (FALSE, 0);
-
- format_combo = gtk_combo_box_new_text ();
- gtk_combo_box_append_text (GTK_COMBO_BOX (format_combo), "frames");
- gtk_combo_box_append_text (GTK_COMBO_BOX (format_combo), "time (ms)");
- gtk_combo_box_set_active (GTK_COMBO_BOX (format_combo), 0);
- gtk_box_pack_start (GTK_BOX (hbox), format_combo, FALSE, FALSE, 2);
-
- step_amount_spinbutton = gtk_spin_button_new_with_range (1, 1000, 1);
- gtk_spin_button_set_digits (GTK_SPIN_BUTTON (step_amount_spinbutton), 0);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (step_amount_spinbutton), 1.0);
- gtk_box_pack_start (GTK_BOX (hbox), step_amount_spinbutton, FALSE, FALSE,
- 2);
-
- step_rate_spinbutton = gtk_spin_button_new_with_range (0.0, 100, 0.1);
- gtk_spin_button_set_digits (GTK_SPIN_BUTTON (step_rate_spinbutton), 3);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (step_rate_spinbutton), 1.0);
- gtk_box_pack_start (GTK_BOX (hbox), step_rate_spinbutton, FALSE, FALSE, 2);
-
- step_button = gtk_button_new_from_stock (GTK_STOCK_MEDIA_FORWARD);
- gtk_button_set_label (GTK_BUTTON (step_button), "Step");
- gtk_box_pack_start (GTK_BOX (hbox), step_button, FALSE, FALSE, 2);
-
- g_signal_connect (G_OBJECT (step_button), "clicked", G_CALLBACK (step_cb),
- pipeline);
-
- /* shuttle scale */
- shuttle_checkbox = gtk_check_button_new_with_label ("Shuttle");
- gtk_box_pack_start (GTK_BOX (hbox), shuttle_checkbox, FALSE, FALSE, 2);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shuttle_checkbox), FALSE);
- g_signal_connect (shuttle_checkbox, "toggled", G_CALLBACK (shuttle_toggled),
- pipeline);
-
- shuttle_adjustment =
- GTK_ADJUSTMENT (gtk_adjustment_new (0.0, -3.00, 4.0, 0.1, 1.0, 1.0));
- shuttle_hscale = gtk_hscale_new (shuttle_adjustment);
- gtk_scale_set_digits (GTK_SCALE (shuttle_hscale), 2);
- gtk_scale_set_value_pos (GTK_SCALE (shuttle_hscale), GTK_POS_TOP);
- gtk_range_set_update_policy (GTK_RANGE (shuttle_hscale),
- GTK_UPDATE_CONTINUOUS);
- g_signal_connect (shuttle_hscale, "value_changed",
- G_CALLBACK (shuttle_value_changed), pipeline);
- g_signal_connect (shuttle_hscale, "format_value",
- G_CALLBACK (shuttle_format_value), pipeline);
-
- gtk_box_pack_start (GTK_BOX (hbox), shuttle_hscale, TRUE, TRUE, 2);
-
- gtk_container_add (GTK_CONTAINER (step), hbox);
- }
-
- /* seek bar */
- adjustment =
- GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, 100.0, 0.1, 1.0, 1.0));
- hscale = gtk_hscale_new (adjustment);
- gtk_scale_set_digits (GTK_SCALE (hscale), 2);
- gtk_scale_set_value_pos (GTK_SCALE (hscale), GTK_POS_RIGHT);
-#if GTK_CHECK_VERSION(2,12,0)
- gtk_range_set_show_fill_level (GTK_RANGE (hscale), TRUE);
- gtk_range_set_fill_level (GTK_RANGE (hscale), 100.0);
-#endif
- gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_CONTINUOUS);
-
- g_signal_connect (hscale, "button_press_event", G_CALLBACK (start_seek),
- pipeline);
- g_signal_connect (hscale, "button_release_event", G_CALLBACK (stop_seek),
- pipeline);
- g_signal_connect (hscale, "format_value", G_CALLBACK (format_value),
- pipeline);
-
- if (pipeline_type == 16) {
- /* the playbin2 panel controls for the video/audio/subtitle tracks */
- panel = gtk_hbox_new (FALSE, 0);
- video_combo = gtk_combo_box_new_text ();
- audio_combo = gtk_combo_box_new_text ();
- text_combo = gtk_combo_box_new_text ();
- gtk_widget_set_sensitive (video_combo, FALSE);
- gtk_widget_set_sensitive (audio_combo, FALSE);
- gtk_widget_set_sensitive (text_combo, FALSE);
- gtk_box_pack_start (GTK_BOX (panel), video_combo, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (panel), audio_combo, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (panel), text_combo, TRUE, TRUE, 2);
- g_signal_connect (G_OBJECT (video_combo), "changed",
- G_CALLBACK (video_combo_cb), pipeline);
- g_signal_connect (G_OBJECT (audio_combo), "changed",
- G_CALLBACK (audio_combo_cb), pipeline);
- g_signal_connect (G_OBJECT (text_combo), "changed",
- G_CALLBACK (text_combo_cb), pipeline);
- /* playbin2 panel for flag checkboxes and volume/mute */
- boxes = gtk_hbox_new (FALSE, 0);
- vis_checkbox = gtk_check_button_new_with_label ("Vis");
- video_checkbox = gtk_check_button_new_with_label ("Video");
- audio_checkbox = gtk_check_button_new_with_label ("Audio");
- text_checkbox = gtk_check_button_new_with_label ("Text");
- mute_checkbox = gtk_check_button_new_with_label ("Mute");
- download_checkbox = gtk_check_button_new_with_label ("Download");
- buffer_checkbox = gtk_check_button_new_with_label ("Buffer");
- volume_label = gtk_label_new ("Volume");
- volume_spinbutton = gtk_spin_button_new_with_range (0, 10.0, 0.1);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (volume_spinbutton), 1.0);
- gtk_box_pack_start (GTK_BOX (boxes), video_checkbox, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (boxes), audio_checkbox, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (boxes), text_checkbox, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (boxes), vis_checkbox, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (boxes), mute_checkbox, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (boxes), download_checkbox, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (boxes), buffer_checkbox, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (boxes), volume_label, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (boxes), volume_spinbutton, TRUE, TRUE, 2);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vis_checkbox), FALSE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (audio_checkbox), TRUE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (video_checkbox), TRUE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text_checkbox), TRUE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mute_checkbox), FALSE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (download_checkbox), FALSE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buffer_checkbox), FALSE);
- g_signal_connect (G_OBJECT (vis_checkbox), "toggled",
- G_CALLBACK (vis_toggle_cb), pipeline);
- g_signal_connect (G_OBJECT (audio_checkbox), "toggled",
- G_CALLBACK (audio_toggle_cb), pipeline);
- g_signal_connect (G_OBJECT (video_checkbox), "toggled",
- G_CALLBACK (video_toggle_cb), pipeline);
- g_signal_connect (G_OBJECT (text_checkbox), "toggled",
- G_CALLBACK (text_toggle_cb), pipeline);
- g_signal_connect (G_OBJECT (mute_checkbox), "toggled",
- G_CALLBACK (mute_toggle_cb), pipeline);
- g_signal_connect (G_OBJECT (download_checkbox), "toggled",
- G_CALLBACK (download_toggle_cb), pipeline);
- g_signal_connect (G_OBJECT (buffer_checkbox), "toggled",
- G_CALLBACK (buffer_toggle_cb), pipeline);
- g_signal_connect (G_OBJECT (volume_spinbutton), "value_changed",
- G_CALLBACK (volume_spinbutton_changed_cb), pipeline);
- /* playbin2 panel for snapshot */
- boxes2 = gtk_hbox_new (FALSE, 0);
- shot_button = gtk_button_new_from_stock (GTK_STOCK_SAVE);
- gtk_widget_set_tooltip_text (shot_button,
- "save a screenshot .png in the current directory");
- g_signal_connect (G_OBJECT (shot_button), "clicked", G_CALLBACK (shot_cb),
- pipeline);
- vis_combo = gtk_combo_box_new_text ();
- g_signal_connect (G_OBJECT (vis_combo), "changed",
- G_CALLBACK (vis_combo_cb), pipeline);
- gtk_widget_set_sensitive (vis_combo, FALSE);
- gtk_box_pack_start (GTK_BOX (boxes2), shot_button, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (boxes2), vis_combo, TRUE, TRUE, 2);
-
- /* fill the vis combo box and the array of factories */
- init_visualization_features ();
- } else {
- panel = boxes = boxes2 = NULL;
- }
-
- /* do the packing stuff ... */
- gtk_window_set_default_size (GTK_WINDOW (window), 250, 96);
- /* FIXME: can we avoid this for audio only? */
- gtk_widget_set_size_request (GTK_WIDGET (video_window), -1,
- DEFAULT_VIDEO_HEIGHT);
- gtk_container_add (GTK_CONTAINER (window), vbox);
- gtk_box_pack_start (GTK_BOX (vbox), video_window, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), play_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), pause_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), stop_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), flagtable, FALSE, FALSE, 2);
- gtk_table_attach_defaults (GTK_TABLE (flagtable), accurate_checkbox, 0, 1, 0,
- 1);
- gtk_table_attach_defaults (GTK_TABLE (flagtable), flush_checkbox, 1, 2, 0, 1);
- gtk_table_attach_defaults (GTK_TABLE (flagtable), loop_checkbox, 2, 3, 0, 1);
- gtk_table_attach_defaults (GTK_TABLE (flagtable), key_checkbox, 0, 1, 1, 2);
- gtk_table_attach_defaults (GTK_TABLE (flagtable), scrub_checkbox, 1, 2, 1, 2);
- gtk_table_attach_defaults (GTK_TABLE (flagtable), play_scrub_checkbox, 2, 3,
- 1, 2);
- gtk_table_attach_defaults (GTK_TABLE (flagtable), skip_checkbox, 3, 4, 0, 1);
- gtk_table_attach_defaults (GTK_TABLE (flagtable), rate_label, 4, 5, 0, 1);
- gtk_table_attach_defaults (GTK_TABLE (flagtable), rate_spinbutton, 4, 5, 1,
- 2);
- if (panel && boxes && boxes2) {
- expander = gtk_expander_new ("playbin2 options");
- pb2vbox = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (pb2vbox), panel, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (pb2vbox), boxes, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (pb2vbox), boxes2, FALSE, FALSE, 2);
- gtk_container_add (GTK_CONTAINER (expander), pb2vbox);
- gtk_box_pack_start (GTK_BOX (vbox), expander, FALSE, FALSE, 2);
- }
- gtk_box_pack_start (GTK_BOX (vbox), step, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (vbox), hscale, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (vbox), statusbar, FALSE, FALSE, 2);
-
- /* connect things ... */
- g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play_cb),
- pipeline);
- g_signal_connect (G_OBJECT (pause_button), "clicked", G_CALLBACK (pause_cb),
- pipeline);
- g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb),
- pipeline);
- g_signal_connect (G_OBJECT (accurate_checkbox), "toggled",
- G_CALLBACK (accurate_toggle_cb), pipeline);
- g_signal_connect (G_OBJECT (key_checkbox), "toggled",
- G_CALLBACK (key_toggle_cb), pipeline);
- g_signal_connect (G_OBJECT (loop_checkbox), "toggled",
- G_CALLBACK (loop_toggle_cb), pipeline);
- g_signal_connect (G_OBJECT (flush_checkbox), "toggled",
- G_CALLBACK (flush_toggle_cb), pipeline);
- g_signal_connect (G_OBJECT (scrub_checkbox), "toggled",
- G_CALLBACK (scrub_toggle_cb), pipeline);
- g_signal_connect (G_OBJECT (play_scrub_checkbox), "toggled",
- G_CALLBACK (play_scrub_toggle_cb), pipeline);
- g_signal_connect (G_OBJECT (skip_checkbox), "toggled",
- G_CALLBACK (skip_toggle_cb), pipeline);
- g_signal_connect (G_OBJECT (rate_spinbutton), "value_changed",
- G_CALLBACK (rate_spinbutton_changed_cb), pipeline);
-
- g_signal_connect (G_OBJECT (window), "delete-event", delete_event_cb, NULL);
-
- /* show the gui. */
- gtk_widget_show_all (window);
-
- /* realize window now so that the video window gets created and we can
- * obtain its XID before the pipeline is started up and the videosink
- * asks for the XID of the window to render onto */
- gtk_widget_realize (window);
-
- /* we should have the XID now */
- g_assert (embed_xid != 0);
-
- if (verbose) {
- g_signal_connect (pipeline, "deep_notify",
- G_CALLBACK (gst_object_default_deep_notify), NULL);
- }
-
- connect_bus_signals (pipeline);
- gtk_main ();
-
- g_print ("NULL pipeline\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- g_print ("free pipeline\n");
- gst_object_unref (pipeline);
-
- g_list_foreach (paths, (GFunc) g_free, NULL);
- g_list_free (paths);
-
- return 0;
-}
diff --git a/tests/examples/seek/stepping.c b/tests/examples/seek/stepping.c
deleted file mode 100644
index 6f6997fc..00000000
--- a/tests/examples/seek/stepping.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* GStreamer
- *
- * stepping.c: stepping sample application
- *
- * Copyright (C) 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <stdlib.h>
-#include <math.h>
-
-#include <gst/gst.h>
-
-static GMainLoop *loop;
-
-static gdouble period = 0.0;
-
-static gboolean
-do_step (GstElement * bin)
-{
- gdouble length;
-
- length = sin (period);
-
- period += M_PI / 40;
-
- length += 1.1;
- length *= 100 * GST_MSECOND;
-
- gst_element_send_event (bin,
- gst_event_new_step (GST_FORMAT_TIME, length, 1.0, TRUE, FALSE));
-
- return FALSE;
-}
-
-static gboolean
-handle_message (GstBus * bus, GstMessage * message, gpointer data)
-{
- GstElement *bin = GST_ELEMENT_CAST (data);
-
- switch (message->type) {
- case GST_MESSAGE_EOS:
- g_message ("got EOS");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_WARNING:
- case GST_MESSAGE_ERROR:
- {
- GError *gerror;
- gchar *debug;
-
- if (message->type == GST_MESSAGE_ERROR)
- gst_message_parse_error (message, &gerror, &debug);
- else
- gst_message_parse_warning (message, &gerror, &debug);
-
- gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug);
- g_error_free (gerror);
- g_free (debug);
- g_main_loop_quit (loop);
- break;
- }
- case GST_MESSAGE_ASYNC_DONE:
- g_timeout_add (40, (GSourceFunc) do_step, bin);
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-int
-main (int argc, char *argv[])
-{
- GstElement *bin;
- GstBus *bus;
-
- gst_init (&argc, &argv);
-
- if (argc < 2) {
- g_print ("usage: %s <uri>\n", argv[0]);
- return -1;
- }
-
- /* create a new bin to hold the elements */
- bin = gst_element_factory_make ("playbin2", "bin");
- g_assert (bin);
- g_object_set (bin, "uri", argv[1], NULL);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (bin));
- gst_bus_add_watch (bus, handle_message, bin);
-
- /* go to the PAUSED state and wait for preroll */
- g_message ("prerolling first frame");
- gst_element_set_state (bin, GST_STATE_PAUSED);
- gst_element_get_state (bin, NULL, NULL, -1);
-
- loop = g_main_loop_new (NULL, TRUE);
- g_main_loop_run (loop);
-
- g_message ("finished");
-
- /* stop the bin */
- gst_element_set_state (bin, GST_STATE_NULL);
-
- g_main_loop_unref (loop);
- gst_object_unref (bus);
-
- exit (0);
-}
diff --git a/tests/examples/seek/stepping2.c b/tests/examples/seek/stepping2.c
deleted file mode 100644
index 8cea180e..00000000
--- a/tests/examples/seek/stepping2.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* GStreamer
- *
- * stepping.c: stepping sample application
- *
- * Copyright (C) 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <stdlib.h>
-#include <math.h>
-
-#include <gst/gst.h>
-
-static GMainLoop *loop;
-
-static gdouble period = 0.0;
-
-static void
-do_step (GstElement * bin)
-{
- gdouble rate;
-
- rate = sin (period);
-
- period += M_PI / 150;
-
- rate += 1.2;
-
- gst_element_send_event (bin,
- gst_event_new_step (GST_FORMAT_TIME, 40 * GST_MSECOND, rate, FALSE,
- FALSE));
-}
-
-static void
-handle_sync_message (GstBus * bus, GstMessage * message, gpointer data)
-{
- GstElement *bin;
-
- bin = GST_ELEMENT_CAST (data);
-
- switch (message->type) {
- case GST_MESSAGE_STEP_DONE:
- do_step (bin);
- break;
- default:
- break;
- }
-}
-
-static void
-handle_message (GstBus * bus, GstMessage * message, gpointer data)
-{
- switch (message->type) {
- case GST_MESSAGE_EOS:
- g_message ("got EOS");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_WARNING:
- case GST_MESSAGE_ERROR:
- {
- GError *gerror;
- gchar *debug;
-
- if (message->type == GST_MESSAGE_ERROR)
- gst_message_parse_error (message, &gerror, &debug);
- else
- gst_message_parse_warning (message, &gerror, &debug);
-
- gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug);
- g_error_free (gerror);
- g_free (debug);
- if (message->type == GST_MESSAGE_ERROR)
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-}
-
-int
-main (int argc, char *argv[])
-{
- GstElement *bin;
- GstBus *bus;
-
- gst_init (&argc, &argv);
-
- if (argc < 2) {
- g_print ("usage: %s <uri>\n", argv[0]);
- return -1;
- }
-
- /* create a new bin to hold the elements */
- bin = gst_element_factory_make ("playbin2", "bin");
- g_assert (bin);
- g_object_set (bin, "uri", argv[1], NULL);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (bin));
- gst_bus_add_signal_watch (bus);
- gst_bus_enable_sync_message_emission (bus);
-
- g_signal_connect (bus, "message", (GCallback) handle_message, bin);
- g_signal_connect (bus, "sync-message", (GCallback) handle_sync_message, bin);
-
- /* go to the PAUSED state and wait for preroll */
- g_message ("prerolling first frame");
- gst_element_set_state (bin, GST_STATE_PAUSED);
- gst_element_get_state (bin, NULL, NULL, -1);
-
- /* queue step */
- do_step (bin);
-
- gst_element_set_state (bin, GST_STATE_PLAYING);
-
- loop = g_main_loop_new (NULL, TRUE);
- g_main_loop_run (loop);
-
- g_message ("finished");
-
- /* stop the bin */
- gst_element_set_state (bin, GST_STATE_NULL);
-
- g_main_loop_unref (loop);
- gst_object_unref (bus);
-
- exit (0);
-}
diff --git a/tests/examples/snapshot/.gitignore b/tests/examples/snapshot/.gitignore
deleted file mode 100644
index a701b4cb..00000000
--- a/tests/examples/snapshot/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-snapshot
-snapshot.png
diff --git a/tests/examples/snapshot/Makefile.am b/tests/examples/snapshot/Makefile.am
deleted file mode 100644
index 16830eef..00000000
--- a/tests/examples/snapshot/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-if HAVE_GTK
-GTK_EXAMPLES=snapshot
-endif
-
-examples = $(GTK_EXAMPLES)
-
-noinst_PROGRAMS = $(examples)
-
-LIBS = $(GST_LIBS) $(GTK_LIBS)
-AM_CFLAGS = $(GST_CFLAGS) $(GTK_CFLAGS)
diff --git a/tests/examples/snapshot/snapshot.c b/tests/examples/snapshot/snapshot.c
deleted file mode 100644
index b3071113..00000000
--- a/tests/examples/snapshot/snapshot.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* GStreamer snapshot example
- * Copyright (C) <2007> 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <gst/gst.h>
-#include <gtk/gtk.h>
-
-#include <stdlib.h>
-
-#define CAPS "video/x-raw-rgb,width=160,pixel-aspect-ratio=1/1,bpp=(int)24,depth=(int)24,endianness=(int)4321,red_mask=(int)0xff0000, green_mask=(int)0x00ff00, blue_mask=(int)0x0000ff"
-
-int
-main (int argc, char *argv[])
-{
- GstElement *pipeline, *sink;
- gint width, height;
- GstBuffer *buffer;
- gchar *descr;
- GError *error = NULL;
- GdkPixbuf *pixbuf;
- gint64 duration, position;
- GstFormat format;
- GstStateChangeReturn ret;
- gboolean res;
-
- gst_init (&argc, &argv);
-
- if (argc != 2) {
- g_print ("usage: %s <uri>\n Writes snapshot.png in the current directory",
- argv[0]);
- exit (-1);
- }
-
- /* create a new pipeline */
- descr =
- g_strdup_printf ("uridecodebin uri=%s ! ffmpegcolorspace ! videoscale ! "
- " appsink name=sink caps=\"" CAPS "\"", argv[1]);
- pipeline = gst_parse_launch (descr, &error);
-
- if (error != NULL) {
- g_print ("could not construct pipeline: %s", error->message);
- g_error_free (error);
- exit (-1);
- }
-
- /* get sink */
- sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");
-
- /* set to PAUSED to make the first frame arrive in the sink */
- ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
- switch (ret) {
- case GST_STATE_CHANGE_FAILURE:
- g_print ("failed to play the file\n");
- exit (-1);
- case GST_STATE_CHANGE_NO_PREROLL:
- /* for live sources, we need to set the pipeline to PLAYING before we can
- * receive a buffer. We don't do that yet */
- g_print ("live sources not supported yet\n");
- exit (-1);
- default:
- break;
- }
- /* This can block for up to 5 seconds. If your machine is really overloaded,
- * it might time out before the pipeline prerolled and we generate an error. A
- * better way is to run a mainloop and catch errors there. */
- ret = gst_element_get_state (pipeline, NULL, NULL, 5 * GST_SECOND);
- if (ret == GST_STATE_CHANGE_FAILURE) {
- g_print ("failed to play the file\n");
- exit (-1);
- }
-
- /* get the duration */
- format = GST_FORMAT_TIME;
- gst_element_query_duration (pipeline, &format, &duration);
-
- if (duration != -1)
- /* we have a duration, seek to 5% */
- position = duration * 5 / 100;
- else
- /* no duration, seek to 1 second, this could EOS */
- position = 1 * GST_SECOND;
-
- /* seek to the a position in the file. Most files have a black first frame so
- * by seeking to somewhere else we have a bigger chance of getting something
- * more interesting. An optimisation would be to detect black images and then
- * seek a little more */
- gst_element_seek_simple (pipeline, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
- position);
-
- /* get the preroll buffer from appsink, this block untils appsink really
- * prerolls */
- g_signal_emit_by_name (sink, "pull-preroll", &buffer, NULL);
-
- /* if we have a buffer now, convert it to a pixbuf. It's possible that we
- * don't have a buffer because we went EOS right away or had an error. */
- if (buffer) {
- GstCaps *caps;
- GstStructure *s;
-
- /* get the snapshot buffer format now. We set the caps on the appsink so
- * that it can only be an rgb buffer. The only thing we have not specified
- * on the caps is the height, which is dependant on the pixel-aspect-ratio
- * of the source material */
- caps = GST_BUFFER_CAPS (buffer);
- if (!caps) {
- g_print ("could not get snapshot format\n");
- exit (-1);
- }
- s = gst_caps_get_structure (caps, 0);
-
- /* we need to get the final caps on the buffer to get the size */
- res = gst_structure_get_int (s, "width", &width);
- res |= gst_structure_get_int (s, "height", &height);
- if (!res) {
- g_print ("could not get snapshot dimension\n");
- exit (-1);
- }
-
- /* create pixmap from buffer and save, gstreamer video buffers have a stride
- * that is rounded up to the nearest multiple of 4 */
- pixbuf = gdk_pixbuf_new_from_data (GST_BUFFER_DATA (buffer),
- GDK_COLORSPACE_RGB, FALSE, 8, width, height,
- GST_ROUND_UP_4 (width * 3), NULL, NULL);
-
- /* save the pixbuf */
- gdk_pixbuf_save (pixbuf, "snapshot.png", "png", &error, NULL);
- } else {
- g_print ("could not make snapshot\n");
- }
-
- /* cleanup and exit */
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- exit (0);
-}
diff --git a/tests/examples/v4l/.gitignore b/tests/examples/v4l/.gitignore
deleted file mode 100644
index da0c4eb8..00000000
--- a/tests/examples/v4l/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-probe
diff --git a/tests/examples/v4l/Makefile.am b/tests/examples/v4l/Makefile.am
deleted file mode 100644
index 6132cdc0..00000000
--- a/tests/examples/v4l/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-noinst_PROGRAMS = probe
-
-probe_SOURCES = probe.c
-probe_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) $(GST_CFLAGS)
-probe_LDFLAGS = \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
- $(GST_PLUGINS_BASE_LIBS) \
- $(GST_BASE_LIBS) $(GST_LIBS)
-
diff --git a/tests/examples/v4l/probe.c b/tests/examples/v4l/probe.c
deleted file mode 100644
index 435aeac9..00000000
--- a/tests/examples/v4l/probe.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* GStreamer
- * Copyright (C) 2009 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <stdlib.h>
-#include <gst/gst.h>
-#include <gst/interfaces/propertyprobe.h>
-
-int
-main (int argc, char *argv[])
-{
- GstElement *src, *sink;
- GstElement *bin;
- GstPropertyProbe *probe = NULL;
- const GParamSpec *pspec = NULL;
- GValueArray *array = NULL;
- gint i, ret;
- GValue *value;
- const gchar *device;
- gchar *name;
- guint flags;
-
- gst_init (&argc, &argv);
-
- bin = gst_pipeline_new ("pipeline");
- g_assert (bin);
-
- src = gst_element_factory_make ("v4lsrc", "v4l_source");
- g_assert (src);
- sink = gst_element_factory_make ("fakesink", "fake_sink");
- g_assert (sink);
-
- /* add objects to the main pipeline */
- gst_bin_add_many (GST_BIN (bin), src, sink, NULL);
- /* link the elements */
- gst_element_link_many (src, sink, NULL);
-
- /* probe devices */
- g_print ("Probing devices with propertyprobe...\n");
- probe = GST_PROPERTY_PROBE (src);
- pspec = gst_property_probe_get_property (probe, "device");
- array = gst_property_probe_probe_and_get_values (probe, pspec);
-
- if (!array) {
- g_print ("No device found\n");
- exit (1);
- }
-
- for (i = 0; i < array->n_values; i++) {
- value = g_value_array_get_nth (array, i);
- device = g_value_get_string (value);
- g_print ("Device: %s\n", device);
- g_object_set_property (G_OBJECT (src), "device", value);
- gst_element_set_state (bin, GST_STATE_READY);
- ret = gst_element_get_state (bin, NULL, NULL, 10 * GST_SECOND);
- if (ret != GST_STATE_CHANGE_SUCCESS) {
- g_print ("Couldn't set STATE_READY\n");
- continue;
- }
- g_object_get (G_OBJECT (src), "device-name", &name, NULL);
- g_print ("Name: %s\n", name);
- g_free (name);
- g_object_get (G_OBJECT (src), "flags", &flags, NULL);
- g_print ("Flags: 0x%08X\n", flags);
- gst_element_set_state (bin, GST_STATE_NULL);
- g_print ("\n");
- }
-
- exit (0);
-}
diff --git a/tests/examples/volume/.gitignore b/tests/examples/volume/.gitignore
deleted file mode 100644
index 4833bbb0..00000000
--- a/tests/examples/volume/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-volume
diff --git a/tests/examples/volume/Makefile.am b/tests/examples/volume/Makefile.am
deleted file mode 100644
index c4da3371..00000000
--- a/tests/examples/volume/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-if HAVE_GTK
-noinst_PROGRAMS = volume
-volume_SOURCES = volume.c
-volume_CFLAGS = $(GTK_CFLAGS) $(GST_CFLAGS) -D_GNU_SOURCE
-volume_LDFLAGS = $(GTK_LIBS) $(GST_LIBS) $(LIBM)
-endif
diff --git a/tests/examples/volume/volume.c b/tests/examples/volume/volume.c
deleted file mode 100644
index 59e4981f..00000000
--- a/tests/examples/volume/volume.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* GStreamer
- *
- * volume.c: sample application to change the volume of a pipeline
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <math.h>
-
-#include <gst/gst.h>
-#include <gtk/gtk.h>
-
-/* global pointer for the scale widget */
-GtkWidget *elapsed;
-GtkWidget *scale;
-
-#ifndef M_LN10
-#define M_LN10 (log(10.0))
-#endif
-
-static void
-value_changed_callback (GtkWidget * widget, GstElement * volume)
-{
- gdouble value;
- gdouble level;
-
- value = gtk_range_get_value (GTK_RANGE (widget));
- level = exp (value / 20.0 * M_LN10);
- g_print ("Value: %f dB, level: %f\n", value, level);
- g_object_set (volume, "volume", level, NULL);
-}
-
-static void
-setup_gui (GstElement * volume)
-{
- GtkWidget *window;
- GtkWidget *vbox;
- GtkWidget *label, *hbox;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_signal_connect (window, "destroy", gtk_main_quit, NULL);
-
- vbox = gtk_vbox_new (TRUE, 0);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- /* elapsed widget */
- hbox = gtk_hbox_new (TRUE, 0);
- label = gtk_label_new ("Elapsed");
- elapsed = gtk_label_new ("0.000");
- gtk_container_add (GTK_CONTAINER (hbox), label);
- gtk_container_add (GTK_CONTAINER (hbox), elapsed);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
-
- /* volume */
- hbox = gtk_hbox_new (TRUE, 0);
- label = gtk_label_new ("volume");
- gtk_container_add (GTK_CONTAINER (hbox), label);
- scale = gtk_hscale_new_with_range (-90.0, 10.0, 0.2);
- gtk_range_set_value (GTK_RANGE (scale), 0.0);
- gtk_widget_set_size_request (scale, 100, -1);
- gtk_container_add (GTK_CONTAINER (hbox), scale);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
- g_signal_connect (scale, "value-changed",
- G_CALLBACK (value_changed_callback), volume);
-
- gtk_widget_show_all (GTK_WIDGET (window));
-}
-
-static void
-message_received (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
-{
- const GstStructure *s;
-
- s = gst_message_get_structure (message);
- g_print ("message from \"%s\" (%s): ",
- GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))),
- gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
- if (s) {
- gchar *sstr;
-
- sstr = gst_structure_to_string (s);
- g_print ("%s\n", sstr);
- g_free (sstr);
- } else {
- g_print ("no message details\n");
- }
-}
-
-static void
-eos_message_received (GstBus * bus, GstMessage * message,
- GstPipeline * pipeline)
-{
- message_received (bus, message, pipeline);
- gtk_main_quit ();
-}
-
-int
-main (int argc, char *argv[])
-{
-
- GstElement *pipeline = NULL;
-
-#ifndef GST_DISABLE_PARSE
- GError *error = NULL;
-#endif
- GstElement *volume;
- GstBus *bus;
-
-#ifdef GST_DISABLE_PARSE
- g_print ("GStreamer was built without pipeline parsing capabilities.\n");
- g_print
- ("Please rebuild GStreamer with pipeline parsing capabilities activated to use this example.\n");
- return 1;
-#else
- gst_init (&argc, &argv);
- gtk_init (&argc, &argv);
-
- pipeline = gst_parse_launchv ((const gchar **) &argv[1], &error);
- if (error) {
- g_print ("pipeline could not be constructed: %s\n", error->message);
- g_print ("Please give a complete pipeline with a 'volume' element.\n");
- g_print ("Example: audiotestsrc ! volume ! %s\n", DEFAULT_AUDIOSINK);
- g_error_free (error);
- return 1;
- }
-#endif
- volume = gst_bin_get_by_name (GST_BIN (pipeline), "volume0");
- if (volume == NULL) {
- g_print ("Please give a pipeline with a 'volume' element in it\n");
- return 1;
- }
-
- /* setup message handling */
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
- g_signal_connect (bus, "message::error", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::warning", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::eos", (GCallback) eos_message_received,
- pipeline);
-
- /* setup GUI */
- setup_gui (volume);
-
- /* go to main loop */
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- gtk_main ();
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- return 0;
-}
diff --git a/tests/icles/.gitignore b/tests/icles/.gitignore
deleted file mode 100644
index d8083fdb..00000000
--- a/tests/icles/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-stress-playbin
-stress-xoverlay
-test-textoverlay
-test-scale
-test-box
-test-colorkey
-playbin-text
diff --git a/tests/icles/Makefile.am b/tests/icles/Makefile.am
deleted file mode 100644
index fa49403c..00000000
--- a/tests/icles/Makefile.am
+++ /dev/null
@@ -1,49 +0,0 @@
-if USE_X
-X_TESTS = stress-xoverlay
-
-stress_xoverlay_SOURCES = stress-xoverlay.c
-stress_xoverlay_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS)
-stress_xoverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
-
-if HAVE_GTK_X11
-X_TESTS += test-colorkey
-
-test_colorkey_SOURCES = test-colorkey.c
-test_colorkey_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS) $(GTK_CFLAGS)
-test_colorkey_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS) \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
-endif
-
-else
-X_TESTS =
-endif
-
-if USE_PANGO
-PANGO_TESTS = test-textoverlay
-
-test_textoverlay_SOURCES = test-textoverlay.c
-test_textoverlay_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-test_textoverlay_LDADD = $(GST_LIBS) $(LIBM)
-
-else
-PANGO_TESTS =
-endif
-
-stress_playbin_SOURCES = stress-playbin.c
-stress_playbin_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-stress_playbin_LDADD = $(GST_LIBS) $(LIBM)
-
-test_scale_SOURCES = test-scale.c
-test_scale_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-test_scale_LDADD = $(GST_LIBS) $(LIBM)
-
-test_box_SOURCES = test-box.c
-test_box_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-test_box_LDADD = $(GST_LIBS) $(LIBM)
-
-playbin_text_SOURCES = playbin-text.c
-playbin_text_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-playbin_text_LDADD = $(GST_LIBS) $(LIBM)
-
-noinst_PROGRAMS = $(X_TESTS) $(PANGO_TESTS) stress-playbin test-scale test-box playbin-text
diff --git a/tests/icles/playbin-text.c b/tests/icles/playbin-text.c
deleted file mode 100644
index a9868048..00000000
--- a/tests/icles/playbin-text.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-typedef struct _App App;
-
-struct _App
-{
- GstElement *playbin;
- GstElement *textsink;
-
- GMainLoop *loop;
-};
-
-App s_app;
-
-static gboolean
-bus_message (GstBus * bus, GstMessage * message, App * app)
-{
- GST_DEBUG ("got message %s",
- gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
-
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_ERROR:
- {
- GError *gerror;
- gchar *debug;
-
- gst_message_parse_error (message, &gerror, &debug);
- gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug);
- g_error_free (gerror);
- g_free (debug);
-
- g_main_loop_quit (app->loop);
- break;
- }
- case GST_MESSAGE_WARNING:
- {
- GError *gerror;
- gchar *debug;
-
- gst_message_parse_warning (message, &gerror, &debug);
- gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug);
- g_error_free (gerror);
- g_free (debug);
-
- g_main_loop_quit (app->loop);
- break;
- }
- case GST_MESSAGE_EOS:
- g_message ("received EOS");
- g_main_loop_quit (app->loop);
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-static void
-have_subtitle (GstElement * appsink, App * app)
-{
- GstBuffer *buffer;
-
- /* get the buffer, we can also wakeup the mainloop to get the subtitle from
- * appsink in the mainloop */
- g_signal_emit_by_name (appsink, "pull-buffer", &buffer);
-
- if (buffer) {
- guint8 *data;
- guint size;
- GstFormat format;
- gint64 position;
- GstClock *clock;
- GstClockTime base_time, running_time;
-
- format = GST_FORMAT_TIME;
- gst_element_query_position (appsink, &format, &position);
-
- clock = gst_element_get_clock (appsink);
- base_time = gst_element_get_base_time (appsink);
-
- running_time = gst_clock_get_time (clock) - base_time;
-
- gst_object_unref (clock);
-
- g_message ("received a subtitle at position %" GST_TIME_FORMAT
- ", running_time %" GST_TIME_FORMAT, GST_TIME_ARGS (position),
- GST_TIME_ARGS (running_time));
-
- data = GST_BUFFER_DATA (buffer);
- size = GST_BUFFER_SIZE (buffer);
-
- gst_util_dump_mem (data, size);
- }
-}
-
-int
-main (int argc, char *argv[])
-{
- App *app = &s_app;
- GstBus *bus;
-
- gst_init (&argc, &argv);
-
- if (argc < 2) {
- g_print ("usage: %s <filename>\n", argv[0]);
- return -1;
- }
-
- /* create a mainloop to get messages */
- app->loop = g_main_loop_new (NULL, TRUE);
-
- app->playbin = gst_element_factory_make ("playbin2", NULL);
- g_assert (app->playbin);
-
- /* set appsink to get the subtitles */
- app->textsink = gst_element_factory_make ("appsink", "subtitle_sink");
- g_object_set (G_OBJECT (app->textsink), "emit-signals", TRUE, NULL);
- g_object_set (G_OBJECT (app->textsink), "ts-offset", 0 * GST_SECOND, NULL);
- g_signal_connect (app->textsink, "new-buffer", G_CALLBACK (have_subtitle),
- app);
-
- g_object_set (G_OBJECT (app->playbin), "text-sink", app->textsink, NULL);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (app->playbin));
-
- /* add watch for messages */
- gst_bus_add_watch (bus, (GstBusFunc) bus_message, app);
-
- /* set to read from appsrc */
- g_object_set (app->playbin, "uri", argv[1], NULL);
-
- /* go to playing and wait in a mainloop. */
- gst_element_set_state (app->playbin, GST_STATE_PLAYING);
-
- /* this mainloop is stopped when we receive an error or EOS */
- g_main_loop_run (app->loop);
-
- g_message ("stopping");
-
- gst_element_set_state (app->playbin, GST_STATE_NULL);
-
- gst_object_unref (bus);
- g_main_loop_unref (app->loop);
-
- return 0;
-}
diff --git a/tests/icles/stress-playbin.c b/tests/icles/stress-playbin.c
deleted file mode 100644
index 33272a26..00000000
--- a/tests/icles/stress-playbin.c
+++ /dev/null
@@ -1,156 +0,0 @@
-#include <gst/gst.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define TEST_RUNTIME 120.0 /* how long to run the test, in seconds */
-
-static void
-play_file (const gchar * bin, const gint delay, const gchar * uri)
-{
- GstStateChangeReturn sret;
- GstMessage *msg;
- GstElement *play;
- guint wait_nanosecs;
-
- play = gst_element_factory_make (bin, "playbin");
-
- g_object_set (play, "uri", uri, NULL);
- g_printerr ("Playing %s\n", uri);
- sret = gst_element_set_state (play, GST_STATE_PLAYING);
- if (sret != GST_STATE_CHANGE_ASYNC && sret != GST_STATE_CHANGE_SUCCESS) {
- g_printerr ("ERROR: state change failed, sret=%d\n", sret);
- goto next;
- }
-
- wait_nanosecs = g_random_int_range (0, GST_MSECOND * delay);
- msg = gst_bus_poll (GST_ELEMENT_BUS (play),
- GST_MESSAGE_ERROR | GST_MESSAGE_EOS, wait_nanosecs);
- if (msg) {
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_ERROR:
- {
- GError *gerror;
- gchar *debug;
-
- gst_message_parse_error (msg, &gerror, &debug);
- gst_object_default_error (GST_MESSAGE_SRC (msg), gerror, debug);
- g_error_free (gerror);
- g_free (debug);
- break;
- }
- case GST_MESSAGE_EOS:
- g_printerr ("Got EOS\n");
- break;
- default:
- g_printerr ("Got unexpected %s messge\n", GST_MESSAGE_TYPE_NAME (msg));
- break;
- }
- gst_message_unref (msg);
- goto next;
- }
-
- /* on to the next one */
- g_print (".");
-
-next:
- gst_element_set_state (play, GST_STATE_NULL);
- gst_object_unref (play);
-}
-
-static void
-check_arg (GPtrArray * files, const gchar * arg)
-{
- GDir *dir;
-
- if ((dir = g_dir_open (arg, 0, NULL))) {
- const gchar *entry;
-
- while ((entry = g_dir_read_name (dir))) {
- gchar *path;
-
- path = g_strconcat (arg, G_DIR_SEPARATOR_S, entry, NULL);
- check_arg (files, path);
- g_free (path);
- }
-
- g_dir_close (dir);
- return;
- } else if (g_file_test (arg, G_FILE_TEST_EXISTS)) {
- /* hack: technically an URI is not just file:// + path, but it'll do here */
- g_ptr_array_add (files, g_strdup_printf ("file://%s", arg));
- }
-}
-
-int
-main (int argc, char **argv)
-{
- GPtrArray *files;
- gchar **args = NULL;
- guint num, i;
- GError *err = NULL;
- gchar *bin = NULL;
- gint run = 100;
- GOptionContext *ctx;
- GOptionEntry options[] = {
- {"bin", '\000', 0, G_OPTION_ARG_STRING, &bin, "playbin factory name", NULL},
- {"runtime", '\000', 0, G_OPTION_ARG_INT, &run, "maximum play time (ms)",
- NULL},
- {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &args, NULL},
- {NULL}
- };
- GTimer *timer;
-
- if (!g_thread_supported ())
- g_thread_init (NULL);
-
- ctx = g_option_context_new ("FILES OR DIRECTORIES WITH AUDIO FILES");
- g_option_context_add_main_entries (ctx, options, NULL);
- g_option_context_add_group (ctx, gst_init_get_option_group ());
- if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
- g_print ("Error initializing: %s\n", GST_STR_NULL (err->message));
- exit (1);
- }
- g_option_context_free (ctx);
-
- if (!bin)
- bin = "playbin";
-
- if (strcmp (bin, "playbin") && strcmp (bin, "playbin2")) {
- g_print ("Please provide a valid playbin argument; playbin | playbin2");
- return 1;
- }
- if (args == NULL || *args == NULL) {
- g_print ("Please provide one or more directories with audio files\n\n");
- return 1;
- }
-
- files = g_ptr_array_new ();
-
- num = g_strv_length (args);
- for (i = 0; i < num; ++i) {
- if (g_path_is_absolute (args[i])) {
- check_arg (files, args[i]);
- } else {
- g_warning ("Argument '%s' is not an absolute file path", args[i]);
- }
- }
-
- if (files->len == 0) {
- g_print ("Did not find any files\n\n");
- return 1;
- }
-
- timer = g_timer_new ();
-
- while (g_timer_elapsed (timer, NULL) < TEST_RUNTIME) {
- gint32 idx;
-
- idx = g_random_int_range (0, files->len);
- play_file (bin, run, (const gchar *) g_ptr_array_index (files, idx));
- }
-
- g_strfreev (args);
- g_timer_destroy (timer);
-
- return 0;
-}
diff --git a/tests/icles/stress-xoverlay.c b/tests/icles/stress-xoverlay.c
deleted file mode 100644
index 4a7a3c7a..00000000
--- a/tests/icles/stress-xoverlay.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/* GStreamer
- * Copyright (C) <2005> Julien Moutte <julien@moutte.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#include <math.h>
-#include <sys/time.h>
-
-static GMainLoop *loop;
-
-static Display *disp;
-static Window root, win = 0;
-static GC gc;
-static gint width = 320, height = 240, x = 0, y = 0;
-static gint disp_width, disp_height;
-
-static inline long
-myclock (void)
-{
- struct timeval tv;
-
- gettimeofday (&tv, NULL);
- return (tv.tv_sec * 1000 + tv.tv_usec / 1000);
-}
-
-static void
-open_display (void)
-{
- gint screen_num;
-
- disp = XOpenDisplay (NULL);
- root = DefaultRootWindow (disp);
- screen_num = DefaultScreen (disp);
- disp_width = DisplayWidth (disp, screen_num);
- disp_height = DisplayHeight (disp, screen_num);
-}
-
-static void
-close_display (void)
-{
- XCloseDisplay (disp);
-}
-
-static gboolean
-resize_window (GstPipeline * pipeline)
-{
- width = (sin (myclock () / 300.0) * 200) + 640;
- height = (sin (myclock () / 300.0) * 200) + 480;
-
- XResizeWindow (disp, win, width, height);
-
- XSync (disp, FALSE);
-
- return TRUE;
-}
-
-static gboolean
-move_window (GstPipeline * pipeline)
-{
- x += 5;
- y = disp_height - height + (sin (myclock () / 300.0) * height);
- if (x > disp_width)
- x = 0;
-
- XMoveWindow (disp, win, x, y);
-
- XSync (disp, FALSE);
-
- return TRUE;
-}
-
-static gboolean
-toggle_events (GstXOverlay * ov)
-{
- static gboolean events_toggled;
-
- gst_x_overlay_handle_events (ov, events_toggled);
-
- if (events_toggled) {
- g_print ("Events are handled\n");
- events_toggled = FALSE;
- } else {
- g_print ("Events are NOT handled\n");
- events_toggled = TRUE;
- }
-
- return TRUE;
-}
-
-static gboolean
-cycle_window (GstXOverlay * ov)
-{
- XGCValues values;
- Window old_win = win;
- GC old_gc = gc;
-
- win = XCreateSimpleWindow (disp, root, 0, 0, width, height, 0, 0, 0);
-
- XSetWindowBackgroundPixmap (disp, win, None);
-
- gc = XCreateGC (disp, win, 0, &values);
-
- XMapRaised (disp, win);
-
- XSync (disp, FALSE);
-
- gst_x_overlay_set_xwindow_id (ov, win);
-
- if (old_win) {
- XDestroyWindow (disp, old_win);
- XFreeGC (disp, old_gc);
- XSync (disp, FALSE);
- }
-
- return TRUE;
-}
-
-static GstBusSyncReply
-create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
-{
- const GstStructure *s;
- GstXOverlay *ov = NULL;
-
- s = gst_message_get_structure (message);
- if (s == NULL || !gst_structure_has_name (s, "prepare-xwindow-id")) {
- return GST_BUS_PASS;
- }
-
- ov = GST_X_OVERLAY (GST_MESSAGE_SRC (message));
-
- g_print ("Creating our own window\n");
-
- cycle_window (ov);
-
- g_timeout_add (50, (GSourceFunc) resize_window, pipeline);
- g_timeout_add (50, (GSourceFunc) move_window, pipeline);
- g_timeout_add (100, (GSourceFunc) cycle_window, ov);
- g_timeout_add (2000, (GSourceFunc) toggle_events, ov);
-
- gst_message_unref (message);
- return GST_BUS_DROP;
-}
-
-#if 0
-static gboolean
-terminate_playback (GstElement * pipeline)
-{
- g_print ("Terminating playback\n");
- g_main_loop_quit (loop);
- return FALSE;
-}
-#endif
-
-static gboolean
-pause_playback (GstElement * pipeline)
-{
- g_print ("Pausing playback\n");
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- return FALSE;
-}
-
-static gboolean
-start_playback (GstElement * pipeline)
-{
- g_print ("Starting playback\n");
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- return FALSE;
-}
-
-int
-main (int argc, char **argv)
-{
- GstElement *pipeline;
- GstBus *bus;
-
-#ifndef GST_DISABLE_PARSE
- GError *error = NULL;
-#endif
-
- gst_init (&argc, &argv);
-
- if (argc != 2) {
- g_print ("Usage: %s \"pipeline description with launch format\"\n",
- argv[0]);
- g_print ("The pipeline should contain an element implementing XOverlay.\n");
- g_print ("Example: %s \"videotestsrc ! ximagesink\"\n", argv[0]);
- return -1;
- }
-#ifdef GST_DISABLE_PARSE
- g_print ("GStreamer was built without pipeline parsing capabilities.\n");
- g_print
- ("Please rebuild GStreamer with pipeline parsing capabilities activated to use this example.\n");
- return 1;
-#else
- pipeline = gst_parse_launch (argv[1], &error);
- if (error) {
- g_print ("Error while parsing pipeline description: %s\n", error->message);
- return -1;
- }
-#endif
-
- loop = g_main_loop_new (NULL, FALSE);
-
- open_display ();
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, pipeline);
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- /* We want to get out after */
- //g_timeout_add (500000, (GSourceFunc) terminate_playback, pipeline);
- g_timeout_add (10000, (GSourceFunc) pause_playback, pipeline);
- g_timeout_add (20000, (GSourceFunc) start_playback, pipeline);
-
- g_main_loop_run (loop);
-
- close_display ();
-
- g_main_loop_unref (loop);
-
- return 0;
-}
diff --git a/tests/icles/test-box.c b/tests/icles/test-box.c
deleted file mode 100644
index 6d04e560..00000000
--- a/tests/icles/test-box.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* GStreamer interactive videoscale test
- * Copyright (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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-
-#include <gst/gst.h>
-
-#define CAPS " capsfilter caps=\"video/x-raw-yuv, format=(fourcc)I420, width=(int)640, height=(int)480\" "
-
-static GstElement *
-make_pipeline (gint type)
-{
- GstElement *result;
- gchar *pstr;
-
- switch (type) {
- case 0:
- pstr =
- g_strdup_printf ("videotestsrc ! " CAPS
- " ! videobox name=box ! videoscale ! " CAPS
- " ! ffmpegcolorspace ! ximagesink");
- break;
- default:
- return NULL;
- }
-
- result = gst_parse_launch_full (pstr, NULL, GST_PARSE_FLAG_NONE, NULL);
- g_print ("created test %d: \"%s\"\n", type, pstr);
- g_free (pstr);
-
- return result;
-}
-
-#define MAX_ROUND 100
-
-int
-main (int argc, char **argv)
-{
- GstElement *pipe, *filter;
- gint left, right;
- gint top, bottom;
- gint rdir, ldir;
- gint tdir, bdir;
- gint round, type, stop;
-
- gst_init (&argc, &argv);
-
- type = 0;
- stop = -1;
-
- if (argc > 1) {
- type = atoi (argv[1]);
- stop = type + 1;
- }
-
- while (TRUE) {
- GstMessage *message;
-
- pipe = make_pipeline (type);
- if (pipe == NULL)
- break;
-
- filter = gst_bin_get_by_name (GST_BIN (pipe), "box");
- g_assert (filter);
-
- /* start with no borders or cropping */
- left = right = top = bottom = 0;
- rdir = ldir = tdir = bdir = -10;
-
- for (round = 0; round < MAX_ROUND; round++) {
- g_print ("box to %dx%d %dx%d (%d/%d) \r", left, right, top, bottom,
- round, MAX_ROUND);
-
- g_object_set (filter, "left", left, "right", right, "top", top, "bottom",
- bottom, NULL);
-
- if (round == 0)
- gst_element_set_state (pipe, GST_STATE_PLAYING);
-
- left += ldir;
- if (left >= 40)
- ldir = -10;
- else if (left < -30)
- ldir = 10;
-
- right += rdir;
- if (right >= 30)
- rdir = -10;
- else if (right < -20)
- rdir = 10;
-
- top += tdir;
- if (top >= 20)
- tdir = -10;
- else if (top < -30)
- tdir = 10;
-
- bottom += bdir;
- if (bottom >= 60)
- bdir = -10;
- else if (bottom < -40)
- bdir = 10;
-
- message =
- gst_bus_poll (GST_ELEMENT_BUS (pipe), GST_MESSAGE_ERROR,
- 50 * GST_MSECOND);
- if (message) {
- g_print ("got error \n");
-
- gst_message_unref (message);
- }
- }
- g_print ("test %d done \n", type);
-
- gst_object_unref (filter);
- gst_element_set_state (pipe, GST_STATE_NULL);
- gst_object_unref (pipe);
-
- type++;
- if (type == stop)
- break;
- }
- return 0;
-}
diff --git a/tests/icles/test-colorkey.c b/tests/icles/test-colorkey.c
deleted file mode 100644
index b727e806..00000000
--- a/tests/icles/test-colorkey.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/* GStreamer
- * Copyright (C) <2008> Stefan Kost <ensonic@users.sf.net>
- *
- * test-colorkey: test manual colorkey 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <glib.h>
-#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
-
-#include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
-#include <gst/interfaces/propertyprobe.h>
-
-static GtkWidget *video_window = NULL;
-static GstElement *sink = NULL;
-static gulong embed_xid = 0;
-static GdkGC *trans_gc = NULL;
-
-static void
-redraw_overlay (GtkWidget * widget)
-{
- gdk_draw_rectangle (widget->window, widget->style->white_gc, TRUE,
- 0, 0, widget->allocation.width, widget->allocation.height);
-
- if (trans_gc) {
- guint x, y;
- guint h = widget->allocation.height * 0.75;
-
- gdk_draw_rectangle (widget->window, trans_gc, TRUE,
- 0, 0, widget->allocation.width, h);
-
- for (y = h; y < widget->allocation.height; y++) {
- for (x = 0; x < widget->allocation.width; x++) {
- if (((x & 1) || (y & 1)) && (x & 1) != (y & 1)) {
- gdk_draw_point (widget->window, trans_gc, x, y);
- }
- }
- }
- }
-}
-
-static gboolean
-handle_resize_cb (GtkWidget * widget, GdkEventConfigure * event, gpointer data)
-{
- redraw_overlay (widget);
- return FALSE;
-}
-
-static gboolean
-handle_expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer data)
-{
- redraw_overlay (widget);
- return FALSE;
-}
-
-static void
-realize_cb (GtkWidget * widget, gpointer data)
-{
-#if GTK_CHECK_VERSION(2,18,0)
- /* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
- * as well */
- if (!gdk_window_ensure_native (widget->window))
- g_error ("Couldn't create native window needed for GstXOverlay!");
-#endif
-
- embed_xid = GDK_WINDOW_XID (video_window->window);
- g_print ("Window realize: got XID %lu\n", embed_xid);
-}
-
-static void
-msg_state_changed (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
-{
- const GstStructure *s;
-
- s = gst_message_get_structure (message);
-
- /* We only care about state changed on the pipeline */
- if (s && GST_MESSAGE_SRC (message) == GST_OBJECT_CAST (pipeline)) {
- GstState old, new, pending;
- gint color;
-
- gst_message_parse_state_changed (message, &old, &new, &pending);
-
- /* When state of the pipeline changes to paused or playing we start updating scale */
- switch (GST_STATE_TRANSITION (old, new)) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- g_object_get (G_OBJECT (sink), "colorkey", &color, NULL);
- if (color != -1) {
- GdkColor trans_color = { 0,
- (color & 0xff0000) >> 8,
- (color & 0xff00),
- (color & 0xff) << 8
- };
-
- trans_gc = gdk_gc_new (video_window->window);
- gdk_gc_set_rgb_fg_color (trans_gc, &trans_color);
- }
- handle_resize_cb (video_window, NULL, NULL);
- break;
- default:
- break;
- }
- }
-}
-
-static void
-window_closed (GtkWidget * widget, GdkEvent * event, gpointer user_data)
-{
- GstElement *pipeline = user_data;
-
- g_print ("stopping\n");
- gtk_widget_hide_all (widget);
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gtk_main_quit ();
-}
-
-static gboolean
-start_pipeline (gpointer user_data)
-{
- GstElement *pipeline = GST_ELEMENT (user_data);
- GstStateChangeReturn sret;
-
- sret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (sret == GST_STATE_CHANGE_FAILURE) {
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
- gtk_main_quit ();
- }
- return FALSE;
-}
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *window;
- GstElement *pipeline, *src;
- GstBus *bus;
- GstStateChangeReturn sret;
- GstPropertyProbe *probe;
- GValueArray *arr;
-
- if (!g_thread_supported ())
- g_thread_init (NULL);
-
- gst_init (&argc, &argv);
- gtk_init (&argc, &argv);
-
- /* prepare the pipeline */
-
- pipeline = gst_pipeline_new ("xvoverlay");
- src = gst_element_factory_make ("videotestsrc", NULL);
- sink = gst_element_factory_make ("xvimagesink", NULL);
- gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
- gst_element_link (src, sink);
-
-#define COLOR_GRAY 0x7F7F7F
-
- g_object_set (G_OBJECT (sink), "autopaint-colorkey", FALSE,
- "force-aspect-ratio", TRUE, "draw-borders", FALSE,
- "colorkey", COLOR_GRAY, NULL);
-
- /* check xvimagesink capabilities */
- sret = gst_element_set_state (pipeline, GST_STATE_READY);
- if (sret == GST_STATE_CHANGE_FAILURE) {
- g_printerr ("Can't set pipeline to READY\n");
- gst_object_unref (pipeline);
- return -1;
- }
-
- probe = GST_PROPERTY_PROBE (sink);
- if (!probe) {
- g_printerr ("Can't probe sink\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
- return -1;
- }
- arr =
- gst_property_probe_probe_and_get_values_name (probe,
- "autopaint-colorkey");
- if (!arr || !arr->n_values) {
- g_printerr ("Can't disable autopaint-colorkey property\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
- return -1;
- }
- if (arr)
- g_value_array_free (arr);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
- g_signal_connect (bus, "message::state-changed",
- G_CALLBACK (msg_state_changed), pipeline);
- gst_object_unref (bus);
-
- /* prepare the ui */
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_signal_connect (G_OBJECT (window), "delete-event",
- G_CALLBACK (window_closed), (gpointer) pipeline);
- gtk_window_set_default_size (GTK_WINDOW (window), 320, 240);
-
- video_window = gtk_drawing_area_new ();
- g_signal_connect (G_OBJECT (video_window), "configure-event",
- G_CALLBACK (handle_resize_cb), NULL);
- g_signal_connect (G_OBJECT (video_window), "expose-event",
- G_CALLBACK (handle_expose_cb), NULL);
- g_signal_connect (video_window, "realize", G_CALLBACK (realize_cb), NULL);
- gtk_widget_set_double_buffered (video_window, FALSE);
- gtk_container_add (GTK_CONTAINER (window), video_window);
-
- /* show the gui and play */
-
- gtk_widget_show_all (window);
-
- /* realize window now so that the video window gets created and we can
- * obtain its XID before the pipeline is started up and the videosink
- * asks for the XID of the window to render onto */
- gtk_widget_realize (window);
-
- /* we should have the XID now */
- g_assert (embed_xid != 0);
-
- /* we know what the video sink is in this case (xvimagesink), so we can
- * just set it directly here now (instead of waiting for a prepare-xwindow-id
- * element message in a sync bus handler and setting it there) */
- g_print ("setting XID %lu\n", embed_xid);
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), embed_xid);
-
- g_idle_add (start_pipeline, pipeline);
- gtk_main ();
-
- gst_object_unref (pipeline);
-
- return 0;
-}
diff --git a/tests/icles/test-scale.c b/tests/icles/test-scale.c
deleted file mode 100644
index 6d131193..00000000
--- a/tests/icles/test-scale.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* GStreamer interactive videoscale test
- * Copyright (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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-
-#include <gst/gst.h>
-
-static GstElement *
-make_pipeline (gint type)
-{
- GstElement *result;
- gchar *pstr;
-
- switch (type) {
- case 0:
- pstr = g_strdup_printf ("videotestsrc ! capsfilter name=filter ! "
- "ximagesink");
- break;
- case 1:
- pstr = g_strdup_printf ("videotestsrc ! queue ! capsfilter name=filter ! "
- "ximagesink");
- break;
- case 2:
- pstr = g_strdup_printf ("videotestsrc peer-alloc=0 ! videoscale ! "
- "capsfilter name=filter ! " "ximagesink");
- break;
- case 3:
- pstr =
- g_strdup_printf ("videotestsrc peer-alloc=0 ! queue ! videoscale ! "
- "capsfilter name=filter ! " "ximagesink");
- break;
- case 4:
- pstr =
- g_strdup_printf ("videotestsrc peer-alloc=0 ! videoscale ! queue ! "
- "capsfilter name=filter ! " "ximagesink");
- break;
- case 5:
- pstr = g_strdup_printf ("videotestsrc peer-alloc=0 ! "
- "capsfilter name=filter ! " "ximagesink");
- break;
- case 6:
- pstr = g_strdup_printf ("videotestsrc ! videoscale ! "
- "capsfilter name=filter ! " "ximagesink");
- break;
- case 7:
- pstr = g_strdup_printf ("v4l2src ! ffmpegcolorspace ! videoscale ! "
- "capsfilter name=filter ! " "ximagesink");
- break;
- default:
- return NULL;
- }
-
- result = gst_parse_launch_full (pstr, NULL, GST_PARSE_FLAG_NONE, NULL);
- g_print ("created test %d: \"%s\"\n", type, pstr);
- g_free (pstr);
-
- return result;
-}
-
-#define MAX_ROUND 100
-
-int
-main (int argc, char **argv)
-{
- GstElement *pipe, *filter;
- GstCaps *caps;
- gint width, height;
- gint xdir, ydir;
- gint round, type, stop;
-
- gst_init (&argc, &argv);
-
- type = 0;
- stop = -1;
-
- if (argc > 1) {
- type = atoi (argv[1]);
- stop = type + 1;
- }
-
- while (TRUE) {
- GstMessage *message;
-
- pipe = make_pipeline (type);
- if (pipe == NULL)
- break;
-
- filter = gst_bin_get_by_name (GST_BIN (pipe), "filter");
- g_assert (filter);
-
- width = 320;
- height = 240;
- xdir = ydir = -10;
-
- for (round = 0; round < MAX_ROUND; round++) {
- gchar *capsstr;
- g_print ("resize to %dx%d (%d/%d) \r", width, height, round, MAX_ROUND);
-
- /* we prefer our fixed width and height but allow other dimensions to pass
- * as well */
- capsstr =
- g_strdup_printf ("video/x-raw-rgb, width=(int)%d, height=(int)%d;"
- "video/x-raw-rgb", width, height);
- caps = gst_caps_from_string (capsstr);
- g_free (capsstr);
- g_object_set (filter, "caps", caps, NULL);
- gst_caps_unref (caps);
-
- if (round == 0)
- gst_element_set_state (pipe, GST_STATE_PLAYING);
-
- width += xdir;
- if (width >= 320)
- xdir = -10;
- else if (width < 200)
- xdir = 10;
-
- height += ydir;
- if (height >= 240)
- ydir = -10;
- else if (height < 150)
- ydir = 10;
-
- message =
- gst_bus_poll (GST_ELEMENT_BUS (pipe), GST_MESSAGE_ERROR,
- 50 * GST_MSECOND);
- if (message) {
- g_print ("got error \n");
-
- gst_message_unref (message);
- }
- }
- g_print ("test %d done \n", type);
-
- gst_object_unref (filter);
- gst_element_set_state (pipe, GST_STATE_NULL);
- gst_object_unref (pipe);
-
- type++;
- if (type == stop)
- break;
- }
- return 0;
-}
diff --git a/tests/icles/test-textoverlay.c b/tests/icles/test-textoverlay.c
deleted file mode 100644
index 8d989a8f..00000000
--- a/tests/icles/test-textoverlay.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* GStreamer interactive textoverlay test
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-static void
-set_enum_property_by_name (gpointer object, const gchar * prop,
- const gchar * value)
-{
- GParamSpec *pspec;
- GValue val = { 0, };
- GEnumClass *eclass;
- GEnumValue *eval;
-
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), prop);
- g_return_if_fail (pspec != NULL);
-
- g_value_init (&val, pspec->value_type);
- g_object_get_property (G_OBJECT (object), prop, &val);
- eclass = G_ENUM_CLASS (g_type_class_peek (G_VALUE_TYPE (&val)));
- g_return_if_fail (eclass != NULL);
- eval = g_enum_get_value_by_name (eclass, value);
- if (eval == NULL)
- eval = g_enum_get_value_by_nick (eclass, value);
- g_return_if_fail (eval != NULL);
- g_value_set_enum (&val, eval->value);
- g_object_set_property (G_OBJECT (object), prop, &val);
- g_value_unset (&val);
-}
-
-static void
-show_text (GstElement * textoverlay, const gchar * txt, const gchar * valign,
- const gchar * halign, const gchar * line_align)
-{
- GstElement *pipe;
-
- g_object_set (textoverlay, "text", txt, NULL);
-
- set_enum_property_by_name (textoverlay, "valignment", valign);
- set_enum_property_by_name (textoverlay, "halignment", halign);
- set_enum_property_by_name (textoverlay, "line-alignment", line_align);
-
- pipe = textoverlay;
- while (GST_ELEMENT_PARENT (pipe))
- pipe = GST_ELEMENT_PARENT (pipe);
-
- gst_element_set_state (pipe, GST_STATE_PLAYING);
- gst_bus_poll (GST_ELEMENT_BUS (pipe), GST_MESSAGE_ERROR, GST_SECOND);
- gst_element_set_state (pipe, GST_STATE_NULL);
-}
-
-static void
-test_textoverlay (int width, int height)
-{
- const gchar *valigns[] = { /* "baseline", */ "bottom", "top" };
- const gchar *haligns[] = { "left", "center", "right" };
- const gchar *linealigns[] = { "left", "center", "right" };
- GstElement *pipe, *toverlay;
- gchar *pstr;
- gint a, b, c;
-
- pstr = g_strdup_printf ("videotestsrc pattern=blue ! "
- "video/x-raw-yuv,width=%d,height=%d ! t.video_sink "
- "textoverlay name=t font-desc=\"Sans Serif, 20\" ! "
- " ffmpegcolorspace ! videoscale ! autovideosink", width, height);
-
- pipe = gst_parse_launch_full (pstr, NULL, GST_PARSE_FLAG_NONE, NULL);
- g_assert (pipe);
-
- toverlay = gst_bin_get_by_name (GST_BIN (pipe), "t");
- g_assert (toverlay);
-
- g_object_set (toverlay, "xpad", 3, "ypad", 3, NULL);
-
- for (a = 0; a < G_N_ELEMENTS (valigns); ++a) {
- for (b = 0; b < G_N_ELEMENTS (haligns); ++b) {
- for (c = 0; c < G_N_ELEMENTS (linealigns); ++c) {
- gchar *s;
-
- s = g_strdup_printf ("line-alignment = %s\n"
- "&lt;----- halignment = %s -----&gt;\nvalignment = %s",
- linealigns[c], haligns[b], valigns[a]);
- show_text (toverlay, s, valigns[a], haligns[b], linealigns[c]);
- g_free (s);
- }
- }
- }
-
- g_free (pstr);
-}
-
-int
-main (int argc, char **argv)
-{
- gst_init (&argc, &argv);
-
- test_textoverlay (640, 480);
-
- g_print ("Now with odd width/height ...\n");
- test_textoverlay (639, 479);
-
- /* test_textoverlay (796, 256); */
-
- return 0;
-}
diff --git a/tests/old/Makefile.am b/tests/old/Makefile.am
deleted file mode 100644
index c376eaa7..00000000
--- a/tests/old/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
-if USE_ALSA
-ALSA_DIR=alsa
-else
-ALSA_DIR=
-endif
-
-# if HAVE_GTK
-# EMBED_DIR=embed
-# else
-# EMBED_DIR=
-# endif
-
-SUBDIRS = \
- $(ALSA_DIR) #seeking
-DIST_SUBDIRS = \
- alsa
-
-GST_PLUGIN_PATH=$(shell cd $(top_builddir) && pwd)
-
-#$(TESTS):
-# @echo -e '\nrunning gst-register...\n'
-# $(GST_TOOLS_DIR)/gst-register --gst-plugin-path=$(GST_PLUGIN_PATH)
-
-#TESTS=$(GST_TOOLS_DIR)/gst-compprep
-
-.PHONY: $(TESTS)
diff --git a/tests/old/examples/Makefile.am b/tests/old/examples/Makefile.am
deleted file mode 100644
index b4431197..00000000
--- a/tests/old/examples/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-if HAVE_FT2
-FT2_SUBDIRS=seeking
-else
-FT2_SUBDIRS=
-endif
-
-# if HAVE_GTK
-# GTK_SUBDIRS=dynparams $(FT2_SUBDIRS)
-# else
-GTK_SUBDIRS=
-# endif
-
-SUBDIRS=$(GTK_SUBDIRS)
-#DIST_SUBDIRS=capsfilter seeking indexing switch
-DIST_SUBDIRS=seeking
diff --git a/tests/old/examples/capsfilter/Makefile.am b/tests/old/examples/capsfilter/Makefile.am
deleted file mode 100644
index f8562fee..00000000
--- a/tests/old/examples/capsfilter/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-noinst_PROGRAMS = capsfilter1
-
-LDADD = $(GST_LIBS)
-AM_CFLAGS = $(GST_CFLAGS)
-
-
diff --git a/tests/old/examples/capsfilter/capsfilter1.c b/tests/old/examples/capsfilter/capsfilter1.c
deleted file mode 100644
index a59f728e..00000000
--- a/tests/old/examples/capsfilter/capsfilter1.c
+++ /dev/null
@@ -1,87 +0,0 @@
-#include <string.h>
-#include <gst/gst.h>
-
-/* This app uses a filter to connect colorspace and videosink
- * so that only RGB data can pass the connection, colorspace will use
- * a converter to convert the I420 data to RGB. Without a filter, this
- * connection would use the I420 format (assuming Xv is enabled) */
-
-static void
-new_pad_func (GstElement * element, GstPad * newpad, gpointer data)
-{
- GstElement *pipeline = (GstElement *) data;
- GstElement *queue = gst_bin_get_by_name (GST_BIN (pipeline), "queue");
-
- if (!strcmp (gst_pad_get_name (newpad), "video_00")) {
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- gst_pad_link (newpad, gst_element_get_pad (queue, "sink"));
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- }
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
- GstElement *pipeline;
- GstElement *filesrc;
- GstElement *demux;
- GstElement *thread;
- GstElement *queue;
- GstElement *mpeg2dec;
- GstElement *colorspace;
- GstElement *videosink;
- gboolean res;
-
- gst_init (&argc, &argv);
-
- if (argc < 2) {
- g_print ("usage: %s <mpeg1 system stream>\n", argv[0]);
- return (-1);
- }
-
- pipeline = gst_pipeline_new ("main_pipeline");
- filesrc = gst_element_factory_make ("filesrc", "filesrc");
- g_return_val_if_fail (filesrc, -1);
- g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
- demux = gst_element_factory_make ("mpegdemux", "demux");
- g_return_val_if_fail (demux, -1);
- g_signal_connect (G_OBJECT (demux), "new_pad", G_CALLBACK (new_pad_func),
- pipeline);
-
- thread = gst_thread_new ("thread");
- queue = gst_element_factory_make ("queue", "queue");
- mpeg2dec = gst_element_factory_make ("mpeg2dec", "mpeg2dec");
- g_return_val_if_fail (mpeg2dec, -1);
- colorspace = gst_element_factory_make ("ffmpegcolorspace", "colorspace");
- g_return_val_if_fail (colorspace, -1);
- videosink = gst_element_factory_make (DEFAULT_VIDEOSINK, "videosink");
- g_return_val_if_fail (videosink, -1);
-
- gst_bin_add (GST_BIN (pipeline), filesrc);
- gst_bin_add (GST_BIN (pipeline), demux);
-
- gst_bin_add (GST_BIN (thread), queue);
- gst_bin_add (GST_BIN (thread), mpeg2dec);
- gst_bin_add (GST_BIN (thread), colorspace);
- gst_bin_add (GST_BIN (thread), videosink);
- gst_bin_add (GST_BIN (pipeline), thread);
-
- gst_element_link_pads (filesrc, "src", demux, "sink");
- gst_element_link_pads (queue, "src", mpeg2dec, "sink");
- gst_element_link_pads (mpeg2dec, "src", colorspace, "sink");
- /* force RGB data passing between colorspace and videosink */
- res = gst_element_link_pads_filtered (colorspace, "src", videosink, "sink",
- gst_caps_new_simple ("video/x-raw-rgb", NULL));
- if (!res) {
- g_print ("could not connect colorspace and videosink\n");
- return -1;
- }
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- while (gst_bin_iterate (GST_BIN (pipeline)));
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- return 0;
-}
diff --git a/tests/old/examples/gob/Makefile.am b/tests/old/examples/gob/Makefile.am
deleted file mode 100644
index 7abde4dc..00000000
--- a/tests/old/examples/gob/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-
-plugin_LTLIBRARIES = libgstidentity2.la
-
-GOB_FILES_ID = gst-identity2.c gst-identity2.h gst-identity2-private.h
-
-BUILT_SOURCES = \
- $(GOB_FILES_ID)
-
-libgstidentity2_la_SOURCES = gst-identity2.gob $(GOB_FILES_ID)
-libgstidentity2_la_CFLAGS = $(GST_CFLAGS)
-libgstidentity2_la_LIBADD =
-
-%.c %.h %-private.h: %.gob
- gob $<
-
-CLEANFILES = $(GOB_FILES_ID)
-
-dist-hook:
- cd $(distdir); rm -f $(CLEANFILES)
diff --git a/tests/old/examples/gob/gst-identity2.gob b/tests/old/examples/gob/gst-identity2.gob
deleted file mode 100644
index 2c58f06f..00000000
--- a/tests/old/examples/gob/gst-identity2.gob
+++ /dev/null
@@ -1,139 +0,0 @@
-
-%header{
-#include <gst/gst.h>
-#include "gst-identity2.h"
-#include "gst-identity2-private.h"
-%}
-
-class Gst:Identity2 from Gst:Element {
-
- /* plugin init */
- private gboolean
- plugin_init (GModule *module, GstPlugin *plugin)
- {
- static GstElementDetails identity2_details =
- GST_ELEMENT_DETAILS (
- "GOB Identity",
- "Filter/Effect",
- "Does nothing",
- "Wim Taymans <wim.taymans@chello.be>");
- GstElementFactory *factory;
-
- factory = gst_elementfactory_new ("identity2", TYPE_SELF,
- &identity2_details);
- g_return_val_if_fail (factory != NULL, FALSE);
-
- gst_plugin_add_feature (plugin, &(factory->feature));
-
- return TRUE;
- }
-
- /* pads FIXME gob oculd be improved here */
- private GstPad *sinkpad =
- {
- gst_pad_new ("sink", GST_PAD_SINK);
- gst_element_add_pad (GST_ELEMENT (o), o->_priv->sinkpad);
- gst_pad_set_chain_function (o->_priv->sinkpad, chain);
- gst_pad_set_bufferpool_function (o->_priv->sinkpad, get_bufferpool);
- //gst_pad_set_negotiate_function (o->_priv->sinkpad, negotiate_sink);
- };
- private GstPad *srcpad =
- {
- gst_pad_new ("src", GST_PAD_SRC);
- gst_element_add_pad (GST_ELEMENT (o), o->_priv->srcpad);
- //gst_pad_set_negotiate_function (o->_priv->srcpad, negotiate_src);
- };
-
- /* arguments */
- /*
- private gboolean loop_based = FALSE; argument BOOL loop_based
- get {
- ARG = self->_priv->loop_based;
- }
- set {
- self->_priv->loop_based = ARG;
- if (self->_priv->loop_based) {
- gst_element_set_loop_function (GST_ELEMENT (self), loop);
- gst_pad_set_chain_function (self->_priv->sinkpad, NULL);
- }
- else {
- gst_pad_set_chain_function (self->_priv->sinkpad, chain);
- gst_element_set_loop_function (GST_ELEMENT (self), NULL);
- }
- };*/
- private guint sleep_time = 0; argument UINT sleep_time link;
- private gboolean silent = FALSE; argument BOOL silent link;
-
- /* signals */
- private signal last NONE(NONE) void handoff(self);
-
- /* core code here */
- private GstBufferPool*
- get_bufferpool (GstPad *pad (check null))
- {
- Self *self = SELF (gst_pad_get_parent (pad));
-
- return gst_pad_get_bufferpool (self->_priv->srcpad);
- }
-
- /* private GstPadNegotiateReturn
- negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data)
- {
- Self *self = SELF (gst_pad_get_parent (pad));
-
- return gst_pad_negotiate_proxy (pad, self->_priv->sinkpad, caps);
- }
-
- private GstPadNegotiateReturn
- negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data)
- {
- Self *self = SELF (gst_pad_get_parent (pad));
-
- return gst_pad_negotiate_proxy (pad, self->_priv->srcpad, caps);
- } */
-
- private void
- chain (GstPad *pad (check null), GstBuffer *buf (check null))
- {
- Self *self;
-
- self = SELF (gst_pad_get_parent (pad));
-
- if (!self->_priv->silent)
- g_print("identity2: chain ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(pad));
-
- handoff (self);
- gst_pad_push (self->_priv->srcpad, buf);
-
- if (self->_priv->sleep_time)
- usleep (self->_priv->sleep_time);
- }
-
- /*private void
- loop (GstElement *element (check null))
- {
- Self *self = SELF (element);
- GstBuffer *buf;
-
- do {
- buf = gst_pad_pull (self->_priv->sinkpad);
- g_print("identity2: loop ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(self->_priv->sinkpad));
-
- handoff (self);
- gst_pad_push (self->_priv->srcpad, buf);
-
- if (self->_priv->sleep_time)
- usleep (self->_priv->sleep_time);
-
- } while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element));
- }*/
-}
-
-%{
-GstPluginDesc plugin_desc = {
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "identity2",
- gst_identity2_plugin_init
-};
-%}
diff --git a/tests/old/examples/indexing/.gitignore b/tests/old/examples/indexing/.gitignore
deleted file mode 100644
index 5ce09473..00000000
--- a/tests/old/examples/indexing/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-indexmpeg
diff --git a/tests/old/examples/indexing/Makefile.am b/tests/old/examples/indexing/Makefile.am
deleted file mode 100644
index 022bfc85..00000000
--- a/tests/old/examples/indexing/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-examples = indexmpeg
-
-noinst_PROGRAMS = $(examples)
-
-# we have nothing but apps here, we can do this safely
-LIBS = $(GST_LIBS) $(GTK_LIBS)
-AM_CFLAGS = $(GST_CFLAGS) $(GTK_CFLAGS)
diff --git a/tests/old/examples/indexing/indexmpeg.c b/tests/old/examples/indexing/indexmpeg.c
deleted file mode 100644
index a670ad8a..00000000
--- a/tests/old/examples/indexing/indexmpeg.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <string.h>
-#include <gst/gst.h>
-
-static gboolean verbose = FALSE;
-static gboolean quiet = FALSE;
-
-static void
-entry_added (GstIndex * index, GstIndexEntry * entry)
-{
- switch (entry->type) {
- case GST_INDEX_ENTRY_ID:
- g_print ("id %d describes writer %s\n", entry->id,
- GST_INDEX_ID_DESCRIPTION (entry));
- break;
- case GST_INDEX_ENTRY_FORMAT:
- g_print ("%d: registered format %d for %s\n", entry->id,
- GST_INDEX_FORMAT_FORMAT (entry), GST_INDEX_FORMAT_KEY (entry));
- break;
- case GST_INDEX_ENTRY_ASSOCIATION:
- {
- gint i;
-
- g_print ("%p, %d: %08x ", entry, entry->id,
- GST_INDEX_ASSOC_FLAGS (entry));
- for (i = 0; i < GST_INDEX_NASSOCS (entry); i++) {
- g_print ("%d %" G_GINT64_FORMAT " ", GST_INDEX_ASSOC_FORMAT (entry, i),
- GST_INDEX_ASSOC_VALUE (entry, i));
- }
- g_print ("\n");
- break;
- }
- default:
- break;
- }
-}
-
-typedef struct
-{
- const gchar *padname;
- GstPad *target;
- GstElement *bin;
- GstElement *pipeline;
- GstIndex *index;
-}
-dyn_link;
-
-static void
-dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer data)
-{
- dyn_link *link = (dyn_link *) data;
-
- if (!strcmp (gst_pad_get_name (newpad), link->padname)) {
- gst_element_set_state (link->pipeline, GST_STATE_PAUSED);
- gst_bin_add (GST_BIN (link->pipeline), link->bin);
- gst_pad_link (newpad, link->target);
- gst_element_set_index (link->bin, link->index);
- gst_element_set_state (link->pipeline, GST_STATE_PLAYING);
- }
-}
-
-static void
-setup_dynamic_linking (GstElement * pipeline,
- GstElement * element,
- const gchar * padname, GstPad * target, GstElement * bin, GstIndex * index)
-{
- dyn_link *link;
-
- link = g_new0 (dyn_link, 1);
- link->padname = g_strdup (padname);
- link->target = target;
- link->bin = bin;
- link->pipeline = pipeline;
- link->index = index;
-
- g_signal_connect (G_OBJECT (element), "new_pad", G_CALLBACK (dynamic_link),
- link);
-}
-
-static GstElement *
-make_mpeg_systems_pipeline (const gchar * path, GstIndex * index)
-{
- GstElement *pipeline;
- GstElement *src, *demux;
-
- pipeline = gst_pipeline_new ("pipeline");
-
- src = gst_element_factory_make ("filesrc", "src");
- g_object_set (G_OBJECT (src), "location", path, NULL);
-
- demux = gst_element_factory_make ("mpegdemux", "demux");
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
-
- if (index) {
- gst_element_set_index (pipeline, index);
- }
-
- gst_element_link_pads (src, "src", demux, "sink");
-
- return pipeline;
-}
-
-static GstElement *
-make_mpeg_decoder_pipeline (const gchar * path, GstIndex * index)
-{
- GstElement *pipeline;
- GstElement *src, *demux;
- GstElement *video_bin, *audio_bin;
- GstElement *video_decoder, *audio_decoder;
-
- pipeline = gst_pipeline_new ("pipeline");
-
- src = gst_element_factory_make ("filesrc", "src");
- g_object_set (G_OBJECT (src), "location", path, NULL);
-
- demux = gst_element_factory_make ("mpegdemux", "demux");
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
-
- gst_element_link_pads (src, "src", demux, "sink");
-
- video_bin = gst_bin_new ("video_bin");
- video_decoder = gst_element_factory_make ("mpeg2dec", "video_decoder");
-
- gst_bin_add (GST_BIN (video_bin), video_decoder);
-
- setup_dynamic_linking (pipeline, demux, "video_00",
- gst_element_get_pad (video_decoder, "sink"), video_bin, index);
-
- audio_bin = gst_bin_new ("audio_bin");
- audio_decoder = gst_element_factory_make ("mad", "audio_decoder");
-
- setup_dynamic_linking (pipeline, demux, "audio_00",
- gst_element_get_pad (audio_decoder, "sink"), audio_bin, index);
-
- gst_bin_add (GST_BIN (audio_bin), audio_decoder);
-
- if (index) {
- gst_element_set_index (pipeline, index);
- }
-
- return pipeline;
-}
-
-static void
-print_progress (GstPad * pad)
-{
- gint i = 0;
- gchar status[53];
- GstFormat format;
- gboolean res;
- gint64 value;
- gint percent = 0;
-
- status[0] = '|';
-
- format = GST_FORMAT_PERCENT;
- res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &value);
- if (res) {
- percent = value / (2 * GST_FORMAT_PERCENT_SCALE);
- }
-
- for (i = 0; i < percent; i++) {
- status[i + 1] = '=';
- }
- for (i = percent; i < 50; i++) {
- status[i + 1] = ' ';
- }
- status[51] = '|';
- status[52] = 0;
-
- g_print ("%s\r", status);
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
- GstElement *pipeline;
- GstElement *src;
- GstPad *pad;
- GstIndex *index;
- gint count = 0;
- GstEvent *event;
- gboolean res;
- GstElement *sink;
- struct poptOption options[] = {
- {"verbose", 'v', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &verbose, 0,
- "Print index entries", NULL},
- {"quiet", 'q', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &quiet, 0,
- "don't print progress bar", NULL},
- POPT_TABLEEND
- };
-
- if (!gst_init_check_with_popt_table (&argc, &argv, options) || argc < 3) {
- g_print ("usage: %s [-v] <type> <filename> \n"
- " type can be: 0 mpeg_systems\n"
- " 1 mpeg_decoder\n"
- " -v : report added index entries\n"
- " -q : don't print progress\n", argv[0]);
- return -1;
- }
-
- /* create index that elements can fill */
- index = gst_index_factory_make ("memindex");
- if (index) {
- if (verbose)
- g_signal_connect (G_OBJECT (index), "entry_added",
- G_CALLBACK (entry_added), NULL);
-
- g_object_set (G_OBJECT (index), "resolver", 1, NULL);
- }
-
- /* construct pipeline */
- switch (atoi (argv[1])) {
- case 0:
- pipeline = make_mpeg_systems_pipeline (argv[2], index);
- break;
- case 1:
- pipeline = make_mpeg_decoder_pipeline (argv[2], index);
- break;
- default:
- g_print ("unknown type %d\n", atoi (argv[1]));
- return -1;
- }
-
- /* setup some default info/error handlers */
- g_signal_connect (G_OBJECT (pipeline), "deep_notify",
- G_CALLBACK (gst_element_default_deep_notify), NULL);
- g_signal_connect (G_OBJECT (pipeline), "error",
- G_CALLBACK (gst_element_default_error), NULL);
-
- /* get a pad to perform progress reporting on */
- src = gst_bin_get_by_name (GST_BIN (pipeline), "src");
- pad = gst_element_get_pad (src, "src");
-
- /* prepare for iteration */
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- g_print ("indexing %s...\n", argv[2]);
- /* run through the complete stream to let it generate an index */
- while (gst_bin_iterate (GST_BIN (pipeline))) {
- if (!quiet && (count % 1000 == 0)) {
- print_progress (pad);
- }
- count++;
- }
- g_print ("\n");
-
- /* bring to ready to restart the pipeline */
- gst_element_set_state (pipeline, GST_STATE_READY);
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
-
- if (index)
- GST_OBJECT_FLAG_UNSET (index, GST_INDEX_WRITABLE);
-
- src = gst_bin_get_by_name (GST_BIN (pipeline), "video_decoder");
-
- {
- gint id;
- GstIndexEntry *entry;
- gint64 result;
- gint total_tm;
-
- gst_index_get_writer_id (index, GST_OBJECT (src), &id);
-
- entry = gst_index_get_assoc_entry (index, id, GST_INDEX_LOOKUP_BEFORE, 0,
- GST_FORMAT_TIME, G_MAXINT64);
- g_assert (entry);
- gst_index_entry_assoc_map (entry, GST_FORMAT_TIME, &result);
- total_tm = result * 60 / GST_SECOND;
- g_print ("total time = %.2fs\n", total_tm / 60.0);
- }
-
- pad = gst_element_get_pad (src, "src");
- sink = gst_element_factory_make ("fakesink", "sink");
- gst_element_link_pads (src, "src", sink, "sink");
- gst_bin_add (GST_BIN (pipeline), sink);
-
- g_print ("seeking %s...\n", argv[2]);
- event = gst_event_new_seek (GST_FORMAT_TIME |
- GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, 5 * GST_SECOND);
-
- res = gst_pad_send_event (pad, event);
- if (!res) {
- g_warning ("seek failed");
- }
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- count = 0;
- while (gst_bin_iterate (GST_BIN (pipeline))) {
- if (!quiet && (count % 1000 == 0)) {
- print_progress (pad);
- }
- count++;
- }
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- return 1;
-}
diff --git a/tests/old/examples/seek/.gitignore b/tests/old/examples/seek/.gitignore
deleted file mode 100644
index fcb1d209..00000000
--- a/tests/old/examples/seek/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-cdparanoia
-cdplayer
-seek
-spider_seek
-vorbisfile
-
diff --git a/tests/old/examples/seek/Makefile.am b/tests/old/examples/seek/Makefile.am
deleted file mode 100644
index b53022bb..00000000
--- a/tests/old/examples/seek/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-examples = seek scrubby #cdplayer cdparanoia
-
-noinst_PROGRAMS = $(examples)
-
-# we have nothing but apps here, we can do this safely
-LIBS = $(GST_LIBS) $(GTK_LIBS)
-AM_CFLAGS = $(GST_CFLAGS) $(GTK_CFLAGS)
diff --git a/tests/old/examples/seek/cdparanoia.c b/tests/old/examples/seek/cdparanoia.c
deleted file mode 100644
index f5b8c326..00000000
--- a/tests/old/examples/seek/cdparanoia.c
+++ /dev/null
@@ -1,215 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <stdlib.h>
-#include <gst/gst.h>
-#include <string.h>
-
-static void
-get_position_info (GstElement * cdparanoia)
-{
- GstFormat track_format;
- const GstFormat *formats;
- GstPad *pad;
-
- track_format = gst_format_get_by_nick ("track");
- g_assert (track_format != 0);
-
- pad = gst_element_get_pad (cdparanoia, "src");
- formats = gst_pad_get_formats (pad);
-
- while (*formats) {
- const GstFormatDefinition *definition;
- GstFormat format;
- gint64 position;
- gboolean res;
-
- definition = gst_format_get_details (*formats);
-
- format = *formats;
- res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &position);
-
- if (format == GST_FORMAT_TIME) {
- position /= GST_SECOND;
- g_print ("%s: %" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT,
- definition->nick, position / 60, position % 60);
- } else {
- g_print ("%s: %" G_GINT64_FORMAT, definition->nick, position);
- }
-
- formats++;
- if (*formats) {
- g_print (", ");
- }
- }
- g_print ("\r");
-}
-
-static void
-get_track_info (GstElement * cdparanoia)
-{
- GstFormat track_format;
- gint64 total_tracks = 0, total_time = 0;
- GstPad *pad;
- const GstFormat *formats;
- gint i;
- gint64 time_count = 0;
-
- track_format = gst_format_get_by_nick ("track");
- g_assert (track_format != 0);
-
- pad = gst_element_get_pad (cdparanoia, "src");
- formats = gst_pad_get_formats (pad);
-
- /* we loop over all supported formats and report the total
- * number of them */
- while (*formats) {
- const GstFormatDefinition *definition;
- gint64 total;
- GstFormat format;
- gboolean res;
-
- definition = gst_format_get_details (*formats);
-
- format = *formats;
- res = gst_pad_query (pad, GST_QUERY_TOTAL, &format, &total);
- if (res) {
- if (format == GST_FORMAT_TIME) {
- total /= GST_SECOND;
- g_print ("%s total: %" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT "\n",
- definition->nick, total / 60, total % 60);
- } else
- g_print ("%s total: %" G_GINT64_FORMAT "\n", definition->nick, total);
-
- if (format == track_format)
- total_tracks = total;
- else if (format == GST_FORMAT_TIME)
- total_time = total;
- } else
- g_print ("failed to get %s total\n", definition->nick);
-
- formats++;
- }
-
- /* then we loop over all the tracks to get more info.
- * since pad_convert always works from 0, the time from track 1 needs
- * to be substracted from track 2 */
- for (i = 0; i <= total_tracks; i++) {
- gint64 time;
- gboolean res;
-
- if (i < total_tracks) {
- GstFormat format;
-
- format = GST_FORMAT_TIME;
- res = gst_pad_convert (pad, track_format, i, &format, &time);
- time /= GST_SECOND;
- } else {
- time = total_time;
- res = TRUE;
- }
-
- if (res) {
- /* for the first track (i==0) we wait until we have the
- * time of the next track */
- if (i > 0) {
- gint64 length = time - time_count;
-
- g_print ("track %d: %" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT
- " -> %" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT ", length: %"
- G_GINT64_FORMAT ":%02" G_GINT64_FORMAT "\n",
- i - 1,
- time_count / 60, time_count % 60,
- time / 60, time % 60, length / 60, length % 60);
- }
- } else {
- g_print ("could not get time for track %d\n", i);
- }
-
- time_count = time;
- }
-}
-
-int
-main (int argc, char **argv)
-{
- GstElement *pipeline;
- GstElement *cdparanoia;
- GstElement *audiosink;
- GstPad *pad;
- GstFormat track_format;
- GstEvent *event;
- gint count;
- gboolean res;
-
- gst_init (&argc, &argv);
-
- pipeline = gst_pipeline_new ("pipeline");
-
- cdparanoia = gst_element_factory_make ("cdparanoia", "cdparanoia");
- g_assert (cdparanoia);
- g_object_set (G_OBJECT (cdparanoia), "paranoia_mode", 0, NULL);
-
- audiosink = gst_element_factory_make (DEFAULT_AUDIOSINK, DEFAULT_AUDIOSINK);
- g_assert (audiosink);
-
- gst_bin_add (GST_BIN (pipeline), cdparanoia);
- gst_bin_add (GST_BIN (pipeline), audiosink);
-
- gst_element_link_pads (cdparanoia, "src", audiosink, "sink");
-
- g_signal_connect (G_OBJECT (pipeline), "deep_notify",
- G_CALLBACK (gst_object_default_deep_notify), NULL);
-
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
-
- /* now we go into probe mode */
- get_track_info (cdparanoia);
-
- track_format = gst_format_get_by_nick ("track");
- g_assert (track_format != 0);
-
- pad = gst_element_get_pad (cdparanoia, "src");
- g_assert (pad);
-
- g_print ("playing from track 3\n");
- /* seek to track3 */
- event = gst_event_new_seek (track_format |
- GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, 3);
-
- res = gst_pad_send_event (pad, event);
- if (!res)
- g_warning ("seek failed");
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- count = 0;
- while (count++ < 500) {
- get_position_info (cdparanoia);
- g_usleep (G_USEC_PER_SEC / 2);
- }
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
-
- g_print ("\nplaying from second 25 to second 29\n");
- /* seek to some seconds */
- event = gst_event_new_segment_seek (GST_FORMAT_TIME |
- GST_SEEK_METHOD_SET |
- GST_SEEK_FLAG_FLUSH, 25 * GST_SECOND, 29 * GST_SECOND);
- res = gst_pad_send_event (pad, event);
- if (!res)
- g_warning ("seek failed");
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- count = 0;
- while (count++ < 500) {
- get_position_info (cdparanoia);
- g_usleep (G_USEC_PER_SEC / 2);
- }
- g_print ("\n");
-
- /* shutdown everything again */
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- return 0;
-}
diff --git a/tests/old/examples/seek/cdplayer.c b/tests/old/examples/seek/cdplayer.c
deleted file mode 100644
index 6305d50c..00000000
--- a/tests/old/examples/seek/cdplayer.c
+++ /dev/null
@@ -1,292 +0,0 @@
-#include <stdlib.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gst/gst.h>
-#include <string.h>
-
-static GList *seekable_elements = NULL;
-
-static GstElement *pipeline;
-static GtkAdjustment *adjustment;
-static gboolean stats = FALSE;
-static guint64 duration;
-
-static guint update_id;
-
-#define UPDATE_INTERVAL 500
-
-static GstElement *
-make_cdaudio_pipeline (void)
-{
- GstElement *cdaudio;
-
- cdaudio = gst_element_factory_make ("cdaudio", "cdaudio");
- g_assert (cdaudio != NULL);
-
- seekable_elements = g_list_prepend (seekable_elements, cdaudio);
-
- return cdaudio;
-}
-
-static gchar *
-format_value (GtkScale * scale, gdouble value)
-{
- gint64 real;
- gint64 seconds;
- gint64 subseconds;
-
- real = value * duration / 100;
- seconds = (gint64) real / GST_SECOND;
- subseconds = (gint64) real / (GST_SECOND / 100);
-
- return g_strdup_printf ("%02" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT ":%02"
- G_GINT64_FORMAT, seconds / 60, seconds % 60, subseconds % 100);
-}
-
-typedef struct
-{
- const gchar *name;
- const GstFormat format;
-}
-seek_format;
-
-static seek_format seek_formats[] = {
- {"tim", GST_FORMAT_TIME},
- {"byt", GST_FORMAT_BYTES},
- {"buf", GST_FORMAT_BUFFERS},
- {"def", GST_FORMAT_DEFAULT},
- {NULL, 0},
-};
-
-
-G_GNUC_UNUSED static void
-query_durations ()
-{
- GList *walk = seekable_elements;
-
- while (walk) {
- GstElement *element = GST_ELEMENT (walk->data);
- gint i = 0;
-
- g_print ("durations %8.8s: ", GST_ELEMENT_NAME (element));
- while (seek_formats[i].name) {
- gboolean res;
- gint64 value;
- GstFormat format;
-
- format = seek_formats[i].format;
- res = gst_element_query (element, GST_QUERY_TOTAL, &format, &value);
- if (res) {
- g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
- } else {
- g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
- }
- i++;
- }
- g_print (" %s\n", GST_ELEMENT_NAME (element));
- walk = g_list_next (walk);
- }
-}
-
-G_GNUC_UNUSED static void
-query_positions ()
-{
- GList *walk = seekable_elements;
-
- while (walk) {
- GstElement *element = GST_ELEMENT (walk->data);
- gint i = 0;
-
- g_print ("positions %8.8s: ", GST_ELEMENT_NAME (element));
- while (seek_formats[i].name) {
- gboolean res;
- gint64 value;
- GstFormat format;
-
- format = seek_formats[i].format;
- res = gst_element_query (element, GST_QUERY_POSITION, &format, &value);
- if (res) {
- g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
- } else {
- g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
- }
- i++;
- }
- g_print (" %s\n", GST_ELEMENT_NAME (element));
- walk = g_list_next (walk);
- }
-}
-
-static gboolean
-update_scale (gpointer data)
-{
- GstClock *clock;
- guint64 position = 0;
- GstFormat format = GST_FORMAT_TIME;
-
- duration = 0;
- clock = gst_pipeline_get_clock (GST_PIPELINE (pipeline));
-
- if (seekable_elements) {
- GstElement *element = GST_ELEMENT (seekable_elements->data);
-
- gst_element_query (element, GST_QUERY_TOTAL, &format, &duration);
- gst_element_query (element, GST_QUERY_POSITION, &format, &position);
- }
-
- if (stats) {
- if (clock)
- g_print ("clock: %13" G_GUINT64_FORMAT " (%s)\n",
- position, gst_object_get_name (GST_OBJECT (clock)));
- query_durations ();
- query_positions ();
- }
- if (duration > 0) {
- gtk_adjustment_set_value (adjustment, position * 100.0 / duration);
- }
-
- return TRUE;
-}
-
-static gboolean
-start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
-{
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- g_timeout_remove (update_id);
-
- return FALSE;
-}
-
-static gboolean
-stop_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
-{
- gint64 real = gtk_range_get_value (GTK_RANGE (widget)) * duration / 100;
- gboolean res;
- GstEvent *s_event;
- GList *walk = seekable_elements;
-
- while (walk) {
- GstElement *seekable = GST_ELEMENT (walk->data);
-
- g_print ("seek to %" G_GINT64_FORMAT " on element %s\n", real,
- GST_ELEMENT_NAME (seekable));
- s_event =
- gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
- GST_SEEK_FLAG_FLUSH, real);
-
- res = gst_element_send_event (seekable, s_event);
-
- walk = g_list_next (walk);
- }
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- update_id =
- g_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
-
- return FALSE;
-}
-
-static void
-play_cb (GtkButton * button, gpointer data)
-{
- GstState state;
-
- gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
- if (state != GST_STATE_PLAYING) {
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- update_id =
- g_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
- }
-}
-
-static void
-pause_cb (GtkButton * button, gpointer data)
-{
- GstState state;
-
- gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
- if (state != GST_STATE_PAUSED) {
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- g_timeout_remove (update_id);
- }
-}
-
-static void
-stop_cb (GtkButton * button, gpointer data)
-{
- GstState state;
-
- gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
- if (state != GST_STATE_READY) {
- gst_element_set_state (pipeline, GST_STATE_READY);
- g_timeout_remove (update_id);
- }
-}
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *window, *hbox, *vbox,
- *play_button, *pause_button, *stop_button, *hscale;
- struct poptOption options[] = {
- {"stats", 's', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &stats, 0,
- "Show element stats", NULL},
- POPT_TABLEEND
- };
-
- gst_init_with_popt_table (&argc, &argv, options);
- gtk_init (&argc, &argv);
-
- pipeline = make_cdaudio_pipeline ();
-
- g_signal_connect (pipeline, "deep_notify",
- G_CALLBACK (gst_object_default_deep_notify), NULL);
-
- /* initialize gui elements ... */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- hbox = gtk_hbox_new (FALSE, 0);
- vbox = gtk_vbox_new (FALSE, 0);
- play_button = gtk_button_new_with_label ("play");
- pause_button = gtk_button_new_with_label ("pause");
- stop_button = gtk_button_new_with_label ("stop");
-
- adjustment =
- GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, 100.0, 0.1, 1.0, 1.0));
- hscale = gtk_hscale_new (adjustment);
- gtk_scale_set_digits (GTK_SCALE (hscale), 2);
- gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_CONTINUOUS);
-
- g_signal_connect (GTK_OBJECT (hscale),
- "button_press_event", G_CALLBACK (start_seek), pipeline);
- g_signal_connect (GTK_OBJECT (hscale),
- "button_release_event", G_CALLBACK (stop_seek), pipeline);
- g_signal_connect (GTK_OBJECT (hscale),
- "format_value", G_CALLBACK (format_value), pipeline);
-
- /* do the packing stuff ... */
- gtk_window_set_default_size (GTK_WINDOW (window), 96, 96);
- gtk_container_add (GTK_CONTAINER (window), vbox);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
- gtk_box_pack_start (GTK_BOX (hbox), play_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), pause_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), stop_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (vbox), hscale, TRUE, TRUE, 2);
-
- /* connect things ... */
- g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play_cb),
- pipeline);
- g_signal_connect (G_OBJECT (pause_button), "clicked", G_CALLBACK (pause_cb),
- pipeline);
- g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb),
- pipeline);
- g_signal_connect (G_OBJECT (window), "delete_event", gtk_main_quit, NULL);
-
- /* show the gui. */
- gtk_widget_show_all (window);
-
- gtk_main ();
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- return 0;
-}
diff --git a/tests/old/examples/seek/chained.c b/tests/old/examples/seek/chained.c
deleted file mode 100644
index bf23e05a..00000000
--- a/tests/old/examples/seek/chained.c
+++ /dev/null
@@ -1,107 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <stdlib.h>
-#include <gst/gst.h>
-#include <string.h>
-
-static GstElement *bin;
-
-static void
-unlinked (GstPad * pad, GstPad * peerpad, GstElement * pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- gst_bin_remove (GST_BIN (pipeline), bin);
- gst_element_set_state (bin, GST_STATE_READY);
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-}
-
-static void
-new_pad (GstElement * elem, GstPad * newpad, GstElement * pipeline)
-{
- GstScheduler *sched;
- GstClock *clock;
-
- g_print ("new pad %s\n", gst_pad_get_name (newpad));
-
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- gst_bin_add (GST_BIN (pipeline), bin);
-
- sched = gst_element_get_scheduler (GST_ELEMENT (pipeline));
- clock = gst_scheduler_get_clock (sched);
- gst_scheduler_set_clock (sched, clock);
-
- gst_pad_link (newpad, gst_element_get_pad (bin, "sink"));
-
- g_signal_connect (G_OBJECT (newpad), "unlinked", G_CALLBACK (unlinked),
- pipeline);
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-}
-
-int
-main (int argc, char **argv)
-{
- GstElement *pipeline;
- GstElement *filesrc;
- GstElement *oggdemux;
- GstElement *vorbisdec;
- GstElement *audioconvert;
- GstElement *audiosink;
-
- gst_init (&argc, &argv);
-
- if (argc < 2) {
- g_print ("usage: %s <oggfile>\n", argv[0]);
- return (-1);
- }
-
- pipeline = gst_pipeline_new ("pipeline");
-
- filesrc = gst_element_factory_make ("filesrc", "filesrc");
- g_assert (filesrc);
- g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
-
- oggdemux = gst_element_factory_make ("oggdemux", "oggdemux");
- g_assert (oggdemux);
-
- gst_bin_add (GST_BIN (pipeline), filesrc);
- gst_bin_add (GST_BIN (pipeline), oggdemux);
-
- gst_element_link_pads (filesrc, "src", oggdemux, "sink");
-
- g_signal_connect (G_OBJECT (oggdemux), "new_pad", G_CALLBACK (new_pad),
- pipeline);
-
- bin = gst_bin_new ("bin");
- vorbisdec = gst_element_factory_make ("vorbisdec", "vorbisdec");
- g_assert (vorbisdec);
- audioconvert = gst_element_factory_make ("audioconvert", "audioconvert");
- g_assert (audioconvert);
- audiosink = gst_element_factory_make (DEFAULT_AUDIOSINK, DEFAULT_AUDIOSINK);
- g_assert (audiosink);
- gst_bin_add (GST_BIN (bin), vorbisdec);
- gst_bin_add (GST_BIN (bin), audioconvert);
- gst_bin_add (GST_BIN (bin), audiosink);
-
- gst_element_link_pads (vorbisdec, "src", audioconvert, "sink");
- gst_element_link_pads (audioconvert, "src", audiosink, "sink");
-
- gst_element_add_ghost_pad (bin, gst_element_get_pad (vorbisdec, "sink"),
- "sink");
-
- g_object_ref (G_OBJECT (bin));
-
- g_signal_connect (pipeline, "deep_notify",
- G_CALLBACK (gst_element_default_deep_notify), NULL);
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- while (gst_bin_iterate (GST_BIN (pipeline)))
- /* nop */ ;
-
- /* stop probe */
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- return 0;
-}
diff --git a/tests/old/examples/stats/Makefile.am b/tests/old/examples/stats/Makefile.am
deleted file mode 100644
index 0f7d81cf..00000000
--- a/tests/old/examples/stats/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-noinst_PROGRAMS = mp2ogg
-
-LDADD = $(GST_LIBS)
-AM_CFLAGS = $(GST_CFLAGS)
-
-
diff --git a/tests/old/examples/stats/mp2ogg.c b/tests/old/examples/stats/mp2ogg.c
deleted file mode 100644
index fc56d5b5..00000000
--- a/tests/old/examples/stats/mp2ogg.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <gst/gst.h>
-
-/* This example app demonstartes the use of pad query and convert to
- * get useful statistics about a plugin. In this case we monitor the
- * compression status of mpeg audio to ogg vorbis transcoding.
- */
-
-gint
-main (gint argc, gchar * argv[])
-{
- GstElement *pipeline;
- GError *error = NULL;
- gchar *description;
- GstElement *encoder, *decoder;
- GstPad *dec_sink, *enc_src;
-
- gst_init (&argc, &argv);
-
- if (argc < 3) {
- g_print ("usage: %s <inputfile> <outputfile>\n", argv[0]);
- return -1;
- }
-
- description = g_strdup_printf ("filesrc location=\"%s\" ! mad name=decoder ! "
- "vorbisenc name=encoder ! filesink location=\"%s\"", argv[1], argv[2]);
-
- pipeline = GST_ELEMENT (gst_parse_launch (description, &error));
- if (!pipeline) {
- if (error)
- g_print ("ERROR: pipeline could not be constructed: %s\n",
- error->message);
- else
- g_print ("ERROR: pipeline could not be constructed\n");
- return -1;
- }
-
- decoder = gst_bin_get_by_name (GST_BIN (pipeline), "decoder");
- encoder = gst_bin_get_by_name (GST_BIN (pipeline), "encoder");
-
- dec_sink = gst_element_get_pad (decoder, "sink");
- enc_src = gst_element_get_pad (encoder, "src");
-
- if (gst_element_set_state (pipeline,
- GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) {
- g_print ("pipeline doesn't want to play\n");
- return -1;
- }
-
- while (gst_bin_iterate (GST_BIN (pipeline))) {
- gint64 position;
- gint64 duration;
- gint64 bitrate_enc, bitrate_dec;
- GstFormat format;
-
- format = GST_FORMAT_TIME;
- /* get the position */
- gst_pad_query (enc_src, GST_QUERY_POSITION, &format, &position);
-
- /* get the total duration */
- gst_pad_query (enc_src, GST_QUERY_TOTAL, &format, &duration);
-
- format = GST_FORMAT_BYTES;
- /* see how many bytes are genereated per 8 seconds (== bitrate) */
- gst_pad_convert (enc_src, GST_FORMAT_TIME, 8 * GST_SECOND,
- &format, &bitrate_enc);
-
- gst_pad_convert (dec_sink, GST_FORMAT_TIME, 8 * GST_SECOND,
- &format, &bitrate_dec);
-
- g_print ("[%2dm %.2ds] of [%2dm %.2ds], "
- "src avg bitrate: %" G_GINT64_FORMAT ", dest avg birate: %"
- G_GINT64_FORMAT ", ratio [%02.2f] \r",
- (gint) (position / (GST_SECOND * 60)),
- (gint) (position / (GST_SECOND)) % 60,
- (gint) (duration / (GST_SECOND * 60)),
- (gint) (duration / (GST_SECOND)) % 60, bitrate_dec, bitrate_enc,
- (gfloat) bitrate_dec / bitrate_enc);
- }
-
- g_print ("\n");
-
- return 0;
-}
diff --git a/tests/old/examples/switch/.gitignore b/tests/old/examples/switch/.gitignore
deleted file mode 100644
index 7893c435..00000000
--- a/tests/old/examples/switch/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-switcher
diff --git a/tests/old/examples/switch/Makefile.am b/tests/old/examples/switch/Makefile.am
deleted file mode 100644
index 9a706048..00000000
--- a/tests/old/examples/switch/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-
-noinst_PROGRAMS = switcher
-
-switcher_SOURCES = switcher.c
-switcher_CFLAGS = $(GST_CFLAGS)
-switcher_LDFLAGS = $(GST_LIBS)
-
diff --git a/tests/old/examples/switch/switcher.c b/tests/old/examples/switch/switcher.c
deleted file mode 100644
index 8d463c2a..00000000
--- a/tests/old/examples/switch/switcher.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Julien Moutte <julien@moutte.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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-static GMainLoop *loop = NULL;
-
-
-
-static void
-got_eos (GstElement * pipeline)
-{
- g_main_loop_quit (loop);
-}
-
-static gboolean
-idle_iterate (GstElement * pipeline)
-{
- gst_bin_iterate (GST_BIN (pipeline));
- return (GST_STATE (GST_ELEMENT (pipeline)) == GST_STATE_PLAYING);
-}
-
-static gboolean
-switch_timer (GstElement * video_switch)
-{
- gint nb_sources, active_source;
-
- g_object_get (G_OBJECT (video_switch), "nb_sources", &nb_sources, NULL);
- g_object_get (G_OBJECT (video_switch), "active_source", &active_source, NULL);
-
- active_source++;
-
- if (active_source > nb_sources - 1)
- active_source = 0;
-
- g_object_set (G_OBJECT (video_switch), "active_source", active_source, NULL);
-
- g_message ("current number of sources : %d, active source %d",
- nb_sources, active_source);
-
- return (GST_STATE (GST_ELEMENT (video_switch)) == GST_STATE_PLAYING);
-}
-
-int
-main (int argc, char *argv[])
-{
- GstElement *pipeline, *src1, *src2, *video_switch, *video_sink;
-
- /* Initing GStreamer library */
- gst_init (&argc, &argv);
-
- loop = g_main_loop_new (NULL, FALSE);
-
- pipeline = gst_pipeline_new ("pipeline");
- src1 = gst_element_factory_make ("videotestsrc", "src1");
- g_object_set (G_OBJECT (src1), "pattern", 0, NULL);
- src2 = gst_element_factory_make ("videotestsrc", "src2");
- g_object_set (G_OBJECT (src2), "pattern", 1, NULL);
- video_switch = gst_element_factory_make ("switch", "video_switch");
- video_sink = gst_element_factory_make (DEFAULT_VIDEOSINK, "video_sink");
-
- gst_bin_add_many (GST_BIN (pipeline), src1, src2, video_switch,
- video_sink, NULL);
-
- gst_element_link (src1, video_switch);
- gst_element_link (src2, video_switch);
- gst_element_link (video_switch, video_sink);
-
- g_signal_connect (G_OBJECT (pipeline), "eos", G_CALLBACK (got_eos), NULL);
-
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
-
- g_idle_add ((GSourceFunc) idle_iterate, pipeline);
- g_timeout_add (2000, (GSourceFunc) switch_timer, video_switch);
-
- g_main_loop_run (loop);
-
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY);
-
- /* unref */
- gst_object_unref (pipeline);
-
- exit (0);
-}
diff --git a/tests/old/testsuite/alsa/.gitignore b/tests/old/testsuite/alsa/.gitignore
deleted file mode 100644
index abf7b414..00000000
--- a/tests/old/testsuite/alsa/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-formats
-srcstate
-state
diff --git a/tests/old/testsuite/alsa/Makefile.am b/tests/old/testsuite/alsa/Makefile.am
deleted file mode 100644
index 6557bc58..00000000
--- a/tests/old/testsuite/alsa/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-testprogs = formats state srcstate
-
-noinst_PROGRAMS = $(testprogs)
-
-formats_SOURCES = formats.c sinesrc.c sinesrc.h
-state_SOURCES = state.c sinesrc.c sinesrc.h
-srcstate_SOURCES =srcstate.c
-
-# we have nothing but apps here, we can do this safely
-LIBS = $(GST_LIBS)
-AM_CFLAGS = $(GST_CFLAGS)
-
-noinst_HEADERS = sinesrc.h
diff --git a/tests/old/testsuite/alsa/formats.c b/tests/old/testsuite/alsa/formats.c
deleted file mode 100644
index 0142e9d9..00000000
--- a/tests/old/testsuite/alsa/formats.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * formats.c: Tests the different formats on alsasink
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "sinesrc.h"
-
-GstElement *pipeline;
-gint channels = 1;
-gboolean sign = FALSE;
-gint endianness = G_LITTLE_ENDIAN;
-gint depth = 8;
-gint width = 8;
-
-#define NUMBER_OF_INT_TESTS 28
-#define NUMBER_OF_FLOAT_TESTS 2
-#define NUMBER_OF_LAW_TESTS 2
-
-gint last = 0;
-gint counter = 0;
-
-static void create_pipeline (void);
-
-
-static void
-pre_get_func (SineSrc * src)
-{
- counter++;
-};
-static void
-create_pipeline (void)
-{
- GstElement *src;
- SineSrc *sinesrc;
- GstElement *alsasink;
-
- pipeline = gst_pipeline_new ("pipeline");
- src = sinesrc_new ();
- alsasink = gst_element_factory_make ("alsasink", "alsasink");
-
- gst_bin_add_many (GST_BIN (pipeline), src, alsasink, NULL);
- gst_element_link (src, alsasink);
-
- /* prepare our sinesrc */
- sinesrc = (SineSrc *) src;
- sinesrc->pre_get_func = pre_get_func;
- sinesrc->newcaps = TRUE;
- /* int tests */
- if (last < NUMBER_OF_INT_TESTS) {
- sinesrc->type = SINE_SRC_INT;
- sinesrc->sign = ((last % 2) == 0) ? TRUE : FALSE;
- sinesrc->endianness =
- ((last / 2) % 2 == 0) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
- switch ((last / 4) % 8) {
- case 0:
- sinesrc->depth = 8;
- sinesrc->width = 8;
- break;
- case 1:
- sinesrc->depth = 16;
- sinesrc->width = 16;
- break;
- case 2:
- sinesrc->depth = 24;
- sinesrc->width = 32;
- break;
- case 3:
- sinesrc->depth = 32;
- sinesrc->width = 32;
- break;
- /* nomore tests below until i know what 24bit width means to alsa wrt endianness */
- case 4:
- sinesrc->depth = 24;
- sinesrc->width = 24;
- break;
- case 5:
- sinesrc->depth = 20;
- sinesrc->width = 24;
- break;
- case 6:
- sinesrc->depth = 18;
- sinesrc->width = 24;
- break;
- case 7:
- /* not used yet */
- sinesrc->depth = 8;
- sinesrc->width = 8;
- break;
- default:
- g_assert_not_reached ();
- }
-
- g_print ("Setting format to: format: \"int\"\n"
- " sign: %s\n"
- " endianness: %d\n"
- " width: %d\n"
- " depth: %d\n",
- sinesrc->sign ? "TRUE" : "FALSE", sinesrc->endianness,
- sinesrc->width, sinesrc->depth);
- } else if (last < NUMBER_OF_INT_TESTS + NUMBER_OF_FLOAT_TESTS) {
- gint temp = last - NUMBER_OF_INT_TESTS;
-
- sinesrc->type = SINE_SRC_FLOAT;
- switch (temp) {
- case 0:
- sinesrc->width = 32;
- break;
- case 1:
- sinesrc->width = 64;
- break;
- default:
- g_assert_not_reached ();
- }
- g_print ("Setting format to float width %d\n", sinesrc->width);
- } else if (last <
- NUMBER_OF_INT_TESTS + NUMBER_OF_FLOAT_TESTS + NUMBER_OF_LAW_TESTS) {
- gint temp = last - NUMBER_OF_INT_TESTS - NUMBER_OF_FLOAT_TESTS;
- GstElement *law;
-
- sinesrc->type = SINE_SRC_INT;
- sinesrc->sign = TRUE;
- sinesrc->endianness = G_BYTE_ORDER;
- sinesrc->depth = 16;
- sinesrc->width = 16;
-
- if (temp == 0) {
- law = gst_element_factory_make ("mulawenc", "mulaw");
- } else {
- law = gst_element_factory_make ("alawenc", "alaw");
- }
- g_assert (law);
- gst_element_unlink (src, alsasink);
- gst_bin_add (GST_BIN (pipeline), law);
- gst_element_link_many (src, law, alsasink, NULL);
- if (temp == 0) {
- g_print ("Setting format to: format: \"MU law\"\n");
- } else {
- g_print ("Setting format to: format: \"A law\"\n");
- }
- } else {
- g_print ("All formats work like a charm.\n");
- exit (0);
- }
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
- gst_init (&argc, &argv);
-
- g_print ("\n"
- "This test will test the various formats ALSA and GStreamer support.\n"
- "You will hear a short sine tone on your default ALSA soundcard for every\n"
- "format tested. They should all sound the same (incl. volume).\n" "\n");
- create_pipeline ();
-
- while (pipeline) {
- gst_bin_iterate (GST_BIN (pipeline));
- if ((counter / 200) > last) {
- last = counter / 200;
- gst_object_unref (pipeline);
- create_pipeline ();
- }
- }
-
- return 0;
-}
diff --git a/tests/old/testsuite/alsa/sinesrc.c b/tests/old/testsuite/alsa/sinesrc.c
deleted file mode 100644
index f684aaec..00000000
--- a/tests/old/testsuite/alsa/sinesrc.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * sinesrc.c: An elemnt emitting a sine src in lots of different formats
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "sinesrc.h"
-#include <math.h>
-#include <string.h> /* memcpy */
-
-#define SAMPLES_PER_WAVE 200
-
-static GstStaticPadTemplate sinesrc_src_factory =
- GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, "
- "signed = (boolean) { FALSE, TRUE }, "
- "width = (int) [8, 32], "
- "depth = (int) [8, 32], "
- "rate = (int) [8000, 192000], "
- "channels = (int) [1, 16];"
- "audio/x-raw-float, "
- "endianness = (int) BYTE_ORDER, "
- "width = (int) {32, 64}, "
- "rate = (int) [8000, 192000], " "channels = (int) [1, 16]")
- );
-
-static GstElementClass *parent_class = NULL;
-
-static void sinesrc_init (SineSrc * src);
-static void sinesrc_class_init (SineSrcClass * klass);
-
-static GstData *sinesrc_get (GstPad * pad);
-static GstStateChangeReturn sinesrc_change_state (GstElement * element,
- GstStateChange transition);
-
-
-GType
-sinesrc_get_type (void)
-{
- static GType sinesrc_type = 0;
-
- if (!sinesrc_type) {
- static const GTypeInfo sinesrc_info = {
- sizeof (SineSrcClass), NULL, NULL,
- (GClassInitFunc) sinesrc_class_init, NULL, NULL,
- sizeof (SineSrc), 0,
- (GInstanceInitFunc) sinesrc_init,
- };
-
- sinesrc_type = g_type_register_static (GST_TYPE_ELEMENT, "SineSrc",
- &sinesrc_info, 0);
- }
- return sinesrc_type;
-}
-static void
-sinesrc_class_init (SineSrcClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- element_class->change_state = sinesrc_change_state;
-
- parent_class = g_type_class_peek_parent (klass);
-}
-
-static void
-sinesrc_init (SineSrc * src)
-{
- src->src =
- gst_pad_new_from_template (gst_static_pad_template_get
- (&sinesrc_src_factory), "src");
- gst_element_add_pad (GST_ELEMENT (src), src->src);
- gst_pad_set_get_function (src->src, sinesrc_get);
-
- src->width = 16;
- src->depth = 16;
- src->sign = TRUE;
- src->endianness = G_BYTE_ORDER;
- src->rate = 44100;
- src->channels = 1;
- src->type = SINE_SRC_INT;
- src->newcaps = TRUE;
-
- src->pre_get_func = NULL;
-
- GST_OBJECT (src)->name = "sinesrc";
-}
-
-static void
-sinesrc_force_caps (SineSrc * src)
-{
- GstCaps *caps;
-
- if (!src->newcaps)
- return;
-
- src->newcaps = FALSE;
-
- switch (src->type) {
- case SINE_SRC_INT:
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "signed", G_TYPE_BOOLEAN, src->sign,
- "depth", G_TYPE_INT, src->depth, NULL);
- if (src->width > 8)
- gst_caps_set_simple (caps,
- "endianness", G_TYPE_INT, src->endianness, NULL);
- break;
- case SINE_SRC_FLOAT:
- g_assert (src->width == 32 || src->width == 64);
- caps = gst_caps_new_simple ("audio/x-raw-float",
- "endianness", G_TYPE_INT, src->endianness, NULL);
- break;
- default:
- caps = NULL;
- g_assert_not_reached ();
- }
- gst_caps_set_simple (caps,
- "width", G_TYPE_INT, src->width,
- "rate", G_TYPE_INT, src->rate,
- "channels", G_TYPE_INT, src->channels, NULL);
-
- if (gst_pad_try_set_caps (src->src, caps) != GST_PAD_LINK_OK)
- g_assert_not_reached ();
-}
-
-/* always return 1 wave
- * there are 200 waves in 1 second, so the frequency is samplerate/200
- */
-static guint8
-UIDENTITY (guint8 x)
-{
- return x;
-};
-static gint8
-IDENTITY (gint8 x)
-{
- return x;
-};
-
-#define POPULATE(format, be_func, le_func) G_STMT_START {\
- format val = (format) int_value;\
- format *p = data;\
- switch (src->endianness) {\
- case G_LITTLE_ENDIAN:\
- val = le_func (val);\
- break;\
- case G_BIG_ENDIAN:\
- val = be_func (val);\
- break;\
- default: \
- g_assert_not_reached ();\
- };\
- for (j = 0; j < src->channels; j++) {\
- *p = val;\
- p ++;\
- }\
- data = p;\
-} G_STMT_END
-
-static GstData *
-sinesrc_get (GstPad * pad)
-{
- GstBuffer *buf;
- SineSrc *src;
-
- void *data;
- gint i, j;
- gdouble value;
-
- g_return_val_if_fail (pad != NULL, NULL);
- src = SINESRC (gst_pad_get_parent (pad));
-
- if (src->pre_get_func)
- src->pre_get_func (src);
-
- buf = gst_buffer_new_and_alloc ((src->width / 8) * src->channels *
- SAMPLES_PER_WAVE);
- g_assert (buf);
- data = GST_BUFFER_DATA (buf);
- g_assert (data);
-
- for (i = 0; i < SAMPLES_PER_WAVE; i++) {
- value = sin (i * 2 * M_PI / SAMPLES_PER_WAVE);
- switch (src->type) {
- case SINE_SRC_INT:{
- gint64 int_value =
- (value + (src->sign ? 0 : 1)) * (((guint64) 1) << (src->depth - 1));
- if (int_value ==
- (1 + (src->sign ? 0 : 1)) * (((guint64) 1) << (src->depth - 1)))
- int_value--;
- switch (src->width) {
- case 8:
- if (src->sign)
- POPULATE (gint8, IDENTITY, IDENTITY);
- else
- POPULATE (guint8, UIDENTITY, UIDENTITY);
- break;
- case 16:
- if (src->sign)
- POPULATE (gint16, GINT16_TO_BE, GINT16_TO_LE);
- else
- POPULATE (guint16, GUINT16_TO_BE, GUINT16_TO_LE);
- break;
- case 24:
- if (src->sign) {
- gpointer p;
- gint32 val = (gint32) int_value;
-
- switch (src->endianness) {
- case G_LITTLE_ENDIAN:
- val = GINT32_TO_LE (val);
- break;
- case G_BIG_ENDIAN:
- val = GINT32_TO_BE (val);
- break;
- default:
- g_assert_not_reached ();
- };
- p = &val;
- if (src->endianness == G_BIG_ENDIAN)
- p++;
- for (j = 0; j < src->channels; j++) {
- memcpy (data, p, 3);
- data += 3;
- }
- } else {
- gpointer p;
- guint32 val = (guint32) int_value;
-
- switch (src->endianness) {
- case G_LITTLE_ENDIAN:
- val = GUINT32_TO_LE (val);
- break;
- case G_BIG_ENDIAN:
- val = GUINT32_TO_BE (val);
- break;
- default:
- g_assert_not_reached ();
- };
- p = &val;
- if (src->endianness == G_BIG_ENDIAN)
- p++;
- for (j = 0; j < src->channels; j++) {
- memcpy (data, p, 3);
- data += 3;
- }
- }
- break;
- case 32:
- if (src->sign)
- POPULATE (gint32, GINT32_TO_BE, GINT32_TO_LE);
- else
- POPULATE (guint32, GUINT32_TO_BE, GUINT32_TO_LE);
- break;
- default:
- g_assert_not_reached ();
- }
- break;
- }
- case SINE_SRC_FLOAT:
- if (src->width == 32) {
- gfloat *p = (gfloat *) data;
- gfloat fval = (gfloat) value;
-
- for (j = 0; j < src->channels; j++) {
- *p = fval;
- p++;
- }
- data = p;
- break;
- }
- if (src->width == 64) {
- gdouble *p = (gdouble *) data;
-
- for (j = 0; j < src->channels; j++) {
- *p = value;
- p++;
- }
- data = p;
- break;
- }
- g_assert_not_reached ();
- default:
- g_assert_not_reached ();
- }
- }
-
- if (src->newcaps) {
- sinesrc_force_caps (src);
- }
- return GST_DATA (buf);
-}
-
-GstElement *
-sinesrc_new (void)
-{
- return GST_ELEMENT (g_object_new (TYPE_SINESRC, NULL));
-}
-
-void
-sinesrc_set_pre_get_func (SineSrc * src, PreGetFunc func)
-{
- src->pre_get_func = func;
-}
-
-static GstStateChangeReturn
-sinesrc_change_state (GstElement * element, GstStateChange transition)
-{
- SineSrc *sinesrc;
-
- g_return_val_if_fail (element != NULL, FALSE);
- sinesrc = SINESRC (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- sinesrc->newcaps = TRUE;
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- break;
- default:
- g_assert_not_reached ();
- }
-
- if (GST_ELEMENT_CLASS (parent_class)->change_state)
- return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- return GST_STATE_CHANGE_SUCCESS;
-}
diff --git a/tests/old/testsuite/alsa/sinesrc.h b/tests/old/testsuite/alsa/sinesrc.h
deleted file mode 100644
index 057428d3..00000000
--- a/tests/old/testsuite/alsa/sinesrc.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * sinesrc.h: Header file for sinesrc.c
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __SINESRC_H__
-#define __SINESRC_H__
-
-
-#include <gst/gst.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define TYPE_SINESRC \
- (sinesrc_get_type())
-#define SINESRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),TYPE_SINESRC,SineSrc))
-#define SINESRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),TYPE_SINESRC,SineSrcClass))
-#define IS_SINESRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),TYPE_SINESRC))
-#define IS_SINESRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),TYPE_SINESRC))
-
-typedef struct _SineSrc SineSrc;
-typedef struct _SineSrcClass SineSrcClass;
-
-typedef void (*PreGetFunc) (SineSrc *src);
-
-typedef enum {
- SINE_SRC_INT,
- SINE_SRC_FLOAT
-} SineSrcAudio;
-
-struct _SineSrc {
- GstElement element;
-
- /* pads */
- GstPad *src;
-
- /* audio parameters */
- SineSrcAudio type;
- gint width; /* int + float */
- gint depth; /* int */
- gboolean sign; /* int */
- gint endianness; /* int */
-
- gint rate;
- gint channels; /* interleaved */
-
- gboolean newcaps;
-
- /* freaky stuff for testing */
- PreGetFunc pre_get_func;
-};
-
-struct _SineSrcClass {
- GstElementClass parent_class;
-};
-
-GType sinesrc_get_type (void);
-GstElement * sinesrc_new (void);
-
-void sinesrc_set_pre_get_func (SineSrc *src, PreGetFunc func);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GST_SINESRC_H__ */
diff --git a/tests/old/testsuite/alsa/srcstate.c b/tests/old/testsuite/alsa/srcstate.c
deleted file mode 100644
index 4ae536da..00000000
--- a/tests/old/testsuite/alsa/srcstate.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * srcstate.c: Tests alsasrc for state changes
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <gst/gst.h>
-
-GstElement *pipeline;
-
-static void
-set_state (GstState state)
-{
- GstState old_state = gst_element_get_state (pipeline);
-
- g_print ("Setting state from %s to %s...",
- gst_element_state_get_name (old_state),
- gst_element_state_get_name (state));
-
- if (!gst_element_set_state (pipeline, state)) {
- g_print (" ERROR\n");
- exit (-1);
- }
-
- if (state == GST_STATE_PLAYING) {
- gint i;
-
- g_print (" DONE - iterating a bit...");
- for (i = 0; i < 5; i++) {
- if (!gst_bin_iterate (GST_BIN (pipeline))) {
- g_print (" ERROR in iteration %d\n", i);
- exit (-2);
- }
- }
- }
- g_print (" DONE\n");
-}
-
-static void
-create_pipeline (void)
-{
- GstElement *alsasrc;
- GstElement *fakesink;
-
- pipeline = gst_pipeline_new ("pipeline");
- alsasrc = gst_element_factory_make ("alsasrc", "alsasrc");
- fakesink = gst_element_factory_make ("fakesink", "fakesink");
-
- gst_bin_add_many (GST_BIN (pipeline), alsasrc, fakesink, NULL);
- gst_element_link (alsasrc, fakesink);
-
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
- gst_init (&argc, &argv);
-
- g_print ("\n" "This test will check if state changes work on the alsasrc.\n");
- create_pipeline ();
-
- /* simulate some state changes here */
- set_state (GST_STATE_READY);
- set_state (GST_STATE_NULL);
- set_state (GST_STATE_READY);
- set_state (GST_STATE_NULL);
- set_state (GST_STATE_PAUSED);
- set_state (GST_STATE_NULL);
- set_state (GST_STATE_PLAYING);
- set_state (GST_STATE_PAUSED);
- set_state (GST_STATE_PLAYING);
- set_state (GST_STATE_READY);
- set_state (GST_STATE_PLAYING);
- set_state (GST_STATE_NULL);
- set_state (GST_STATE_PLAYING);
-
- g_print ("The alsa plugin mastered another test.\n");
-
- gst_object_unref (pipeline);
-
- return 0;
-}
diff --git a/tests/old/testsuite/alsa/state.c b/tests/old/testsuite/alsa/state.c
deleted file mode 100644
index 9cbd8acf..00000000
--- a/tests/old/testsuite/alsa/state.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
- *
- * state.c: Tests alsasink for state changes
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "sinesrc.h"
-
-GstElement *pipeline;
-
-static void
-set_state (GstState state)
-{
- GstState old_state = gst_element_get_state (pipeline);
-
- g_print ("Setting state from %s to %s...",
- gst_element_state_get_name (old_state),
- gst_element_state_get_name (state));
-
- if (!gst_element_set_state (pipeline, state)) {
- g_print (" ERROR\n");
- exit (-1);
- }
-
- if (state == GST_STATE_PLAYING) {
- gint i;
-
- g_print (" DONE - iterating a bit...");
- for (i = 0; i < 400; i++) {
- if (!gst_bin_iterate (GST_BIN (pipeline))) {
- g_print (" ERROR in iteration %d\n", i);
- exit (-2);
- }
- }
- }
- g_print (" DONE\n");
-}
-
-static void
-create_pipeline (void)
-{
- GstElement *src;
- SineSrc *sinesrc;
- GstElement *alsasink;
-
- pipeline = gst_pipeline_new ("pipeline");
- src = sinesrc_new ();
- alsasink = gst_element_factory_make ("alsasink", "alsasink");
-
- gst_bin_add_many (GST_BIN (pipeline), src, alsasink, NULL);
- gst_element_link (src, alsasink);
-
- /* prepare our sinesrc */
- sinesrc = (SineSrc *) src;
- sinesrc->newcaps = TRUE;
- sinesrc->type = SINE_SRC_INT;
- sinesrc->sign = TRUE;
- sinesrc->endianness = G_BYTE_ORDER;
- sinesrc->depth = 16;
- sinesrc->width = 16;
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
- gst_init (&argc, &argv);
-
- g_print ("\n"
- "This test will check if state changes work on the alsasink.\n"
- "You will hear some short sine tones on your default ALSA soundcard,\n"
- "but they are not important in this test.\n" "\n");
- create_pipeline ();
-
- /* simulate some state changes here */
- set_state (GST_STATE_READY);
- set_state (GST_STATE_NULL);
- set_state (GST_STATE_READY);
- set_state (GST_STATE_NULL);
- set_state (GST_STATE_PAUSED);
- set_state (GST_STATE_NULL);
- set_state (GST_STATE_PLAYING);
- set_state (GST_STATE_PAUSED);
- set_state (GST_STATE_PLAYING);
- set_state (GST_STATE_READY);
- set_state (GST_STATE_PLAYING);
- set_state (GST_STATE_NULL);
- set_state (GST_STATE_PLAYING);
-
- g_print ("The alsa plugin mastered another test.\n");
-
- gst_object_unref (pipeline);
-
- return 0;
-}
diff --git a/tests/old/testsuite/embed/Makefile.am b/tests/old/testsuite/embed/Makefile.am
deleted file mode 100644
index 2ffdc768..00000000
--- a/tests/old/testsuite/embed/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-
-noinst_PROGRAMS = embed
-
-# we have nothing but apps here, we can do this safely
-LIBS = $(GST_LIBS) $(GTK_LIBS) \
- $(top_builddir)/gst-libs/gst/libgstinterfaces-$(GST_MAJORMINOR).la
-AM_CFLAGS = $(GST_CFLAGS) $(GTK_CFLAGS)
diff --git a/tests/old/testsuite/embed/embed.c b/tests/old/testsuite/embed/embed.c
deleted file mode 100644
index ed4a93cc..00000000
--- a/tests/old/testsuite/embed/embed.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Sample app for element embedding.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <gst/gst.h>
-#include <gst/xoverlay/xoverlay.h>
-#include <gtk/gtk.h>
-#include <gdk/gdkx.h>
-
-static void
-cb_expose (GtkWidget * w, GdkEventExpose * ev, GstElement * e)
-{
- if (GST_IS_X_OVERLAY (e) &&
- !GTK_WIDGET_NO_WINDOW (w) && GTK_WIDGET_REALIZED (w)) {
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (e),
- GDK_WINDOW_XWINDOW (w->window));
- }
-}
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *window, *content;
- GstElement *testsrc, *csp, *videosink, *pipeline;
-
- gtk_init (&argc, &argv);
- gst_init (&argc, &argv);
-
- pipeline = gst_element_factory_make ("pipeline", NULL);
- testsrc = gst_element_factory_make ("videotestsrc", NULL);
- csp = gst_element_factory_make ("ffmpegcolorspace", NULL);
- videosink = gst_element_factory_make (DEFAULT_VIDEOSINK, NULL);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
- gtk_window_set_title (GTK_WINDOW (window), "My application");
- content = gtk_event_box_new ();
- gtk_container_add (GTK_CONTAINER (window), content);
- g_signal_connect (content, "expose-event", G_CALLBACK (cb_expose), videosink);
- gtk_widget_show_all (window);
-
- gst_bin_add_many (GST_BIN (pipeline), testsrc, csp, videosink, NULL);
- gst_element_link_many (testsrc, csp, videosink, NULL);
-
- g_idle_add ((GSourceFunc) gst_bin_iterate, pipeline);
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/tests/old/testsuite/gst-lint b/tests/old/testsuite/gst-lint
deleted file mode 100755
index a924f052..00000000
--- a/tests/old/testsuite/gst-lint
+++ /dev/null
@@ -1,571 +0,0 @@
-#!/usr/bin/perl -w
-# vi: set ts=4:
-#
-
-#
-# GStreamer developers: please add comments on any tests you think
-# are dumb or have too many false positives.
-#
-
-#
-# Future ideas:
-# - spell check comments
-# - check each function for at least one assertion (?)
-# - check parameters that init/set/get have consistent types
-# - check for gst_caps_set() without check for writeability
-# - check .so files for stray symbols
-#
-
-#
-# Random "other" testing ideas
-# - load each plugin individually
-#
-
-sub check_copyright();
-sub check_license();
-sub check_buffer_alloc();
-sub check_bad_includes();
-sub check_begin_decls();
-sub check_c99_comments();
-sub check_carriage_returns();
-sub check_printf_lld();
-sub check_glibisms();
-sub check_indentation();
-sub check_no_ignore();
-sub check_deprecated();
-sub check_config_h();
-sub check_varargs_functions();
-sub check_debugging();
-sub check_old_typefind();
-sub check_bad_casts();
-sub check_old_plugin();
-sub check_signal_new();
-sub check_gnuc_const();
-sub check_caps();
-sub check_lib_deprecated();
-sub check_typo();
-sub check_explicit_caps();
-sub check_signals();
-sub check_gettext();
-sub check_padtemplate();
-sub check_parent_class();
-
-sub m_check_plugindir();
-sub m_check_interfaces();
-
-open FIND, "find . -name \"*.[ch]\" -print|";
-
-foreach $filename (<FIND>) {
- chomp $filename;
- open FILE, "$filename";
- @lines = <FILE>;
- close FILE;
-
- print "I: $filename\n";
-
- # important stuff
- check_bad_includes();
- check_printf_lld();
- check_no_ignore();
- check_deprecated();
- check_config_h();
- check_old_typefind();
- check_old_plugin();
- check_caps();
- check_lib_deprecated();
- check_typo();
- check_glibisms();
- check_explicit_caps();
- check_signals();
- check_gettext();
- check_padtemplate();
- check_parent_class();
-
- # less important stuff
- check_license();
-
-if (0) {
- check_copyright();
-
- check_gnuc_const();
- check_begin_decls();
- check_buffer_alloc();
- check_c99_comments();
- check_carriage_returns();
- #check_indentation();
- check_varargs_functions();
- check_debugging();
- check_bad_casts();
- check_signal_new();
-}
-}
-
-open FIND, "find . -name \"Makefile.am\" -print|";
-
-foreach $filename (<FIND>) {
- chomp $filename;
- open FILE, "$filename";
- @lines = <FILE>;
- close FILE;
-
- print "I: $filename\n";
-
- m_check_plugindir();
- m_check_interfaces();
-}
-
-#
-# Every source file must have a copyright block
-#
-sub check_copyright()
-{
- if (! grep { /copyright/i; } @lines) {
- print "E: no copyright block\n";
- }
-}
-
-#
-# Every source file should have a license statement
-#
-sub check_license()
-{
- if (grep { /Lesser General Public License/; } @lines) {
- print "I: license is LGPL\n";
- } elsif (grep { /Library General Public License/; } @lines) {
- print "I: license is LGPL\n";
- print "W: copyright header uses \"Library\" LGPL\n";
- } elsif (grep { /General Public License/; } @lines) {
- print "I: license is GPL\n";
- } else {
- print "E: unknown license or no copyright block\n";
- }
-}
-
-#
-# Suggest usage of gst_buffer_new_and_alloc()
-#
-sub check_buffer_alloc()
-{
- my $n = 0;
- my $lineno = 1;
-
- foreach $line (@lines){
- if($line =~ /gst_buffer_new/){
- $n=5;
- }
- if($n>0 && $line =~ /malloc/){
- print "W: ($lineno) gst_buffer_new() followed by malloc(), suggest gst_buffer_new_and_alloc()\n";
- return;
- }
- $n--;
- $lineno++;
- }
-}
-
-sub check_bad_includes()
-{
- #
- # malloc.h is non-standard (and probably not what is indended)
- #
- if (grep { /^#include\s+<malloc.h>/; } @lines) {
- print "E: bad header: malloc.h\n"
- }
-}
-
-sub check_begin_decls()
-{
- #
- # Prefer "G_BEGIN_DECLS" to 'extern "C" {'
- #
- if($filename =~ /\.h$/){
- if (grep { /extern\s*\"C\"\s*/; } @lines) {
- print "W: extern \"C\" { should be changed to G_BEGIN_DECLS,G_END_DECLS\n";
- }elsif (!grep { /G_BEGIN_DECLS/; } @lines) {
- print "E: header doesn't use G_BEGIN_DECLS\n";
- }
- }
-}
-
-#
-# Prefer c89-style comments
-#
-sub check_c99_comments()
-{
- if (grep { /\/\//; } @lines) {
- print "W: //-style comments should be converted to /* */\n"
- }
-}
-
-#
-# DOS end-of-line characters are just wrong
-#
-sub check_carriage_returns()
-{
- if (grep { /\r/; } @lines) {
- print "E: source has carriage returns (DOS-style files)\n"
- }
-}
-
-#
-# Many uses of %lld are wrong. This could have a lot of false-positives
-#
-sub check_printf_lld()
-{
- if (grep { /\".*\%\d*ll[du].*\"/; } @lines) {
- print "W: Possible \%lld or \%llu in printf format\n"
- }
-}
-
-#
-# Glib functions are preferred
-#
-sub check_glibisms()
-{
- if (grep { /\bcalloc\s*\(/; } @lines) {
- print "E: use g_malloc0() instead of calloc()\n"
- }
- if (grep { /\bfree\s*\(/; } @lines) {
- print "E: use g_free() instead of free()\n"
- }
- if (grep { /\bmalloc\s*\(/; } @lines) {
- print "E: use g_malloc() instead of malloc()\n"
- }
- if (grep { /\bprintf\s*\(/; } @lines) {
- print "E: use g_print() instead of printf()\n"
- }
- if (grep { /\brealloc\s*\(/; } @lines) {
- print "E: use g_realloc() instead of realloc()\n"
- }
- if (grep { /^#include\s+<ctype.h>/; } @lines) {
- print "E: ctype.h functions are not locale-independent and don't work in UTF-8 locales. Use g_ascii_is*()\n"
- }
-}
-
-#
-# I don't think that indentation necessarily needs to be fixed, since
-# it causes problems with patching and cvs annotate.
-#
-# This takes forever and isn't very useful
-#
-sub check_indentation()
-{
- my $changed_lines;
- my $percent;
-
- `indent -br -bad -cbi0 -cli2 -bls -l80 -ut -ce $filename -o .check_plugin.tmp`;
- $changed_lines = `diff $filename .check_plugin.tmp | grep '^>' | wc -l`;
- `rm -f .check_plugin.tmp`;
-
- $percent = int(100 * $changed_lines / $#lines);
-
- if($percent < 10){
- print "I: indent changed $percent % of the lines\n";
- }elsif($percent <20){
- print "W: indent changed $percent % of the lines\n";
- }else{
- print "E: indent changed $percent % of the lines\n";
- }
-}
-
-
-#
-# Check (roughly) for functions whose value should not be ignored
-#
-sub check_no_ignore()
-{
- if (grep { /^\s+gst_buffer_merge\s*\(/; } @lines) {
- print "E: return value of gst_buffer_merge () possibly ignored\n";
- }
- if (grep { /^\s+malloc\s*\(/; } @lines) {
- print "E: return value of malloc() possibly ignored\n";
- }
- if (grep { /^\s+gst_buffer_new\s*\(/; } @lines) {
- print "E: return value of gst_buffer_new() possibly ignored\n";
- }
-}
-
-#
-# Check for some deprecated stuff (that _shouldn't_ be around anymore)
-#
-sub check_deprecated()
-{
- #
- # Check for old GST_DEBUG() usage
- # (none found)
- #
- if (grep { /GST_DEBUG\s*\(\s+\d/; } @lines) {
- print "E: old-style GST_DEBUG()\n";
- }
- if (grep { /GST_INFO\s*\(\s+\d/; } @lines) {
- print "E: old-style GST_DEBUG()\n";
- }
- if (grep { /GstEventFlags/; } @lines) {
- print "W: who uses GstEventFlags\n";
- }
- if (grep { /g_type_class_ref/ } @lines) {
- print "W: g_type_class_ref should be changed to g_type_class_peek_parent\n";
- }
-
-}
-
-#
-# Every .c file should include config.h before any other headers
-# No .h file should include config.h
-#
-sub check_config_h()
-{
- if($filename =~ /\.c$/){
- #
- # config.h should be wrapped
- #
- my @includes = grep { /^#include/; } @lines;
-
- if (!grep { /^#include\s+["<]config.h[">]/; } @includes) {
- print "E: #include <config.h> missing\n";
- }else{
- if (!($includes[0] =~ /^#include\s+["<]config.h[">]/)){
- print "E: #include <config.h> is not first include\n";
- }
- if(!grep { /^#ifdef HAVE_CONFIG_H/; } @lines) {
- print "E: #include <config.h> not surrounded by #ifdef HAVE_CONFIG_H\n";
- }
- }
- }
-
- if($filename =~ /\.h$/){
- if (grep { /^#include\s+["<]config.h[">]/; } @lines) {
- print "E: headers should not #include <config.h>\n";
- }
- }
-
-}
-
-#
-# Check for functions that take varargs to make sure they are
-# named correctly
-#
-sub check_varargs_functions()
-{
- if($filename =~ /\.h$/){
- if (grep { /varargs/; } @lines) {
- print "I: has varargs\n";
- }
- }
-}
-
-#
-# Debugging checks
-#
-sub check_debugging()
-{
- if (grep { /\Wg_print\W/ || /\Wprintf\W/ && /\Wfprintf\W/; } @lines) {
- print "W: friendly libraries don't print to stdio or stderr\n";
- }
-
- if (grep { /GST_DEBUG.*\\n"/; } @lines) {
- print "W: possible newline in GST_DEBUG()\n";
- }
-
-}
-
-#
-# check for plugindir=
-#
-sub m_check_plugindir()
-{
- if (grep { /plugindir\s*=/; } @lines) {
- print "E: plugindir= is no longer necessary\n";
- }
-}
-
-#
-# check for old typefinding code
-#
-sub check_old_typefind()
-{
- if (grep { /GstTypeDefinition/ || /GstTypeFactory/ } @lines) {
- print "E: old typefind interface has been removed\n";
- }
-}
-
-#
-# check for casts that we've deemed incorrect (fix the prototype)
-#
-sub check_bad_casts()
-{
- if (grep { /GBaseInitFunc/ || /GBaseFinalizeFunc/ ||
- /GClassInitFunc/ || /GClassFinalizeFunc/ ||
- /GInstanceInitFunc/ || /GInterfaceInitFunc/ ||
- /GInterfaceFinalizeFunc/ } @lines) {
- print "W: bad casts (fix prototype)\n";
- }
- if (grep { /\(\s*Gst[A-Z][A-Za-z]*\s*\*\s*\)/ } @lines ) {
- print "W: use GST_XXX() instead of (GstXxx *)\n";
- }
-
-}
-
-#
-# check for old plugin code
-#
-sub check_old_plugin()
-{
- if (grep { /plugin_init.*GModule.*GstPlugin/ } @lines) {
- print "E: old plugin interface detected\n";
- }
- if (grep { /GstPluginDesc.*plugin_desc/ } @lines) {
- print "W: should use GST_PLUGIN_DEFINE() instead of GstPluginDesc\n";
- }
-}
-
-#
-# Check for calls to g_signal_new() with a callback type of G_TYPE_POINTER
-#
-sub check_signal_new()
-{
- my $n = 0;
- my $lineno = 1;
-
- foreach $line (@lines){
- if($line =~ /g_signal_new/){
- $n=5;
- }
- if($n>0 && $line =~ /G_TYPE_POINTER/){
- print "W: ($lineno) g_signal_new() with callback type of G_TYPE_POINTER. Register and use a boxed type instead.\n";
- return;
- }
- $n--;
- $lineno++;
- }
-}
-
-#
-# Check that libgstinterfaces is in LDADD
-#
-sub m_check_interfaces()
-{
- if (grep { /libgstinterfaces.la/ } @lines) {
- if (! grep { /libgstinterfaces_la/ } @lines) {
- if (! grep { /_LDADD.*libgstinterfaces.la/ } @lines) {
- print "E: libgstinterfaces.la not in LDADD\n";
- }
- }
- }
-}
-
-#
-# Check that get_type() functions return G_CONST_RETURN GType
-#
-sub check_gnuc_const()
-{
- my $n = 0;
- my $lineno = 1;
-
- foreach $line (@lines){
- if($line =~ /GType.*get_type.*/ &&
- !($line =~ /GType.*get_type.*G_GNUC_CONST/)) {
-
- print "E: get_type function does not have G_GNUC_CONST attribute\n";
- }
- }
-}
-
-#
-# Check caps usage
-#
-sub check_caps()
-{
- if (grep { /gst_pad_get_caps/ } @lines) {
- print "E: elements should not call gst_pad_get_caps(), use gst_pad_get_allowed_caps()\n";
- }
-}
-
-#
-# Check for use of deprecated functions
-#
-sub check_lib_deprecated()
-{
- if (grep { /bzero/ } @lines) {
- print "E: change bzero() to memset()\n";
- }
-}
-
-#
-# Check for typos
-#
-sub check_typo()
-{
- if (grep { /;\s*;\s*$/ } @lines) {
- print "W: typo? \";;\"\n";
- }
-}
-
-#
-# set_explicit_caps() should preceed pad_add()
-#
-sub check_explicit_caps()
-{
- my $n = 0;
- my $lineno = 1;
-
- foreach $line (@lines){
- if($line =~ /gst_element_add_pad/){
- $n=10;
- }
- if($n>0 && $line =~ /gst_pad_set_explicit_caps/){
- print "W: ($lineno) explicit caps should be set before adding pad\n";
- return;
- }
- $n--;
- $lineno++;
- }
-}
-
-#
-# Check for - in signal names
-#
-sub check_signals()
-{
- if (grep { /g_signal_new.*\".*-.*\"/; } @lines) {
- print "E: g_signal_new() with a signal name with a - in it (we prefer _)\n"
- }
-}
-
-#
-# Check for things that gettext gets wrong
-#
-sub check_gettext()
-{
- if (grep { /\b_\(.*G_GU?INT64_FORMAT/ ||
- /\b_\(.*GST_TIME_FORMAT/ ||
- /\b_\(.*GST_FOURCC_FORMAT/ } @lines) {
- print "E: gettext doesn't handle format strings that are defines\n"
- }
-}
-
-#
-# Check that pad templates are statically scoped
-#
-sub check_padtemplate()
-{
- foreach $line (@lines){
- if ($line =~ /GstStaticPadTemplate/ && !($line =~ /static/)) {
- print "W: pad template definitions should be static\n";
- return;
- }
- }
-}
-
-#
-# Check that parent_class is statically scoped
-#
-sub check_parent_class()
-{
- foreach $line (@lines){
- if ($line =~ /Gst.*\*\s*parent_class/ && !($line =~ /static/)) {
- print "E: parent_class definitions should be static\n";
- return;
- }
- }
-}
-
diff --git a/tools/.gitignore b/tools/.gitignore
deleted file mode 100644
index 745ef8a1..00000000
--- a/tools/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-gst-launch-ext-?.*
-gst-visualise-?.*
-gst-launch-ext-?.*.1
-gst-visualise-?.*.1
diff --git a/tools/Makefile.am b/tools/Makefile.am
deleted file mode 100644
index d16646cd..00000000
--- a/tools/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
-bin_SCRIPTS = \
- gst-visualise-@GST_MAJORMINOR@
-
-man_MANS = \
- gst-visualise-@GST_MAJORMINOR@.1
-
-CLEANFILES = $(man_MANS) $(bin_SCRIPTS)
-
-EXTRA_DIST = \
- gst-visualise-m.m gst-visualise.1.in
-
-# generate versioned scripts from templates
-%-@GST_MAJORMINOR@: %-m.m
- sed -e s,\@GST_MAJORMINOR\@,@GST_MAJORMINOR@,g $< > $@
- chmod +x $@
-
-# generate man pages
-%-@GST_MAJORMINOR@.1: %.1.in
- sed \
- -e s,gst-visualise,gst-visualise-@GST_MAJORMINOR@,g \
- $< >$@
-
-all: all-am chmod
-
-chmod: $(bin_SCRIPTS)
- chmod +x $^
diff --git a/tools/README.filterstamp b/tools/README.filterstamp
deleted file mode 100644
index a7b3d21e..00000000
--- a/tools/README.filterstamp
+++ /dev/null
@@ -1,24 +0,0 @@
-filterstamp.sh is a script to copy a filter and change filenames and all
-occurrences of the old name to the new name.
-
-This is used for writing new audio filters. The best one to copy for now is
-passthrough; it works on raw/audio int or float data.
-
-If your new filter is called StereoPan, for example, then do this :
-
-cd gst
-../tools/filterstamp.sh Passthrough StereoPan
-cd stereopan
-make
-
-(Please note the upper- and lower-case !)
-
-You should also add a line to configure.ac to make sure the Makefiles are built
-correctly. Just search for "passthrough" and add corresponding "stereopan" (or
-whatever your plugin is) lines.
-
-Register it, then try it out. It shouldn't do anything !
-
-Now edit the filter.func in the new directory; this file contains the body
-of the main processing loop.
-
diff --git a/tools/filterstamp.sh b/tools/filterstamp.sh
deleted file mode 100755
index 56b3d8d9..00000000
--- a/tools/filterstamp.sh
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/bash
-
-# copies from gstreamer filter boilerplate
-# to new filter
-# changing file names and function references
-
-# thomas@apestaart.org
-
-# modified 23 aug 2001 apwingo@eos.ncsu.edu:
-# conform better to gtk naming conventions (GstFoo->gst_foo in functions, etc)
-
-if [ "$1" = "" ]
-then
- echo "please specify the filter to copy FROM (e.g. Passthrough)"
- exit
-fi
-
-if [ "$2" = "" ]
-then
- echo "please specify the filter to copy TO (e.g. NewFilter)"
- exit
-fi
-
-FROM=$1
-TO=$2
-FROM_LC=`echo $FROM | tr [A-Z] [a-z]`
-TO_LC=`echo $TO | tr [A-Z] [a-z]`
-FROM_UC=`echo $FROM | tr [a-z] [A-Z]`
-TO_UC=`echo $TO | tr [a-z] [A-Z]`
-FROM_LC_UNDERSCORE=`echo $FROM | perl -n -p -e 's/([a-z])([A-Z])/$1_$2/g; tr/A-Z/a-z/'`
-TO_LC_UNDERSCORE=`echo $TO | perl -n -p -e 's/([a-z])([A-Z])/$1_$2/g; tr/A-Z/a-z/'`
-
-echo "Copying filter boilerplate $FROM to new filter $TO..."
-
-if [ ! -d $FROM_LC ]
-then
- echo "Filter directory $FROM_LC does not exist !"
- exit
-fi
-
-if [ -d $TO_LC ]
-then
- echo "Filter directory $TO_LC already exists !"
- exit
-fi
-
-cp -r $FROM_LC $TO_LC
-
-cd $TO_LC
-
-for a in *$FROM_LC*; do mv $a `echo $a | sed s/$FROM_LC/$TO_LC/g`; done
-
-perl -i -p -e "s/$FROM/$TO/g" *
-perl -i -p -e "s/${FROM_LC_UNDERSCORE}_/${TO_LC_UNDERSCORE}_/g" *
-perl -i -p -e "s/$FROM_LC/$TO_LC/g" *
-perl -i -p -e "s/$FROM_UC/$TO_UC/g" *
-
diff --git a/tools/gst-launch-ext.1.in b/tools/gst-launch-ext.1.in
deleted file mode 100644
index ada73802..00000000
--- a/tools/gst-launch-ext.1.in
+++ /dev/null
@@ -1,42 +0,0 @@
-.TH "GStreamer" "1" "February 2002" "" ""
-.SH "NAME"
-gst\-launch\-ext \- Run a predefined GStreamer pipeline
-.SH "SYNOPSIS"
-\fBgst\-launch\-ext\fR \fIfilename [filename...]\fR
-.SH "DESCRIPTION"
-.LP
-\fIgst\-launch\-ext\fP is a tool that is used to run a basic predefined
-\fIGStreamer\fP pipeline. This application is only used as a quick test to
-ensure proper working of codecs and GStreamer. It doesn't handle more advanced
-features like synchronisation.
-
-All supported formats in GStreamer should be playable by simply typing:
-
- gst\-launch\-ext filename
-
-It will also print out the pipeline it uses, so you can customize it using
-cut and paste.
-
-.SH "CONFIGURATION"
-.LP
-\fIgst\-launch\-ext\fP can be configured by creating a .gst file in your
-home directory. This is a perl-style configuration file and can override
-the defaults for audio and video output sinks.
-
-Here is an example .gst file that implements the same defaults as hard-coded
-in the script :
-
-AUDIOSINK = osssink
-VIDEOSINK = ffmpegcolorspace ! xvimagesink
-
-You can change osssink to esdsink or alsasink (if you have
-the plug-in), and you can change xvimagesink to ximagesink, aasink
-or sdlvideosink.
-
-Other plug-ins might be used as well if GStreamer has them.
-
-.SH "SEE ALSO"
-.BR gst\-inspect (1),
-.BR gst\-launch (1),
-.SH "AUTHOR"
-The GStreamer team at http://gstreamer.net/
diff --git a/tools/gst-visualise-m.m b/tools/gst-visualise-m.m
deleted file mode 100644
index 36d44974..00000000
--- a/tools/gst-visualise-m.m
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/perl -w
-
-# launch a gst-launch pipeline to display a visualisation of the
-# input audio.
-# make use of default input srcs.
-# visualisation plugin is specified on command line.
-
-### packages
-
-use File::Basename;
-
-
-my (%pipes, %cfg);
-
-sub read_config
-{
- my $config_file = `echo -n ~`."/.gst";
- if (-e $config_file)
- {
- open CONFIG, $config_file;
- while (<CONFIG>)
- {
- chomp;
- s/#.*//;
- s/\s+$//;
- next unless length;
- my ($var, $value) = split (/\s*=\s*/, $_, 2);
- $cfg{$var} = $value;
- }
- if (!($cfg{AUDIOSRC}))
- {
- print "Please add an AUDIOSRC to $config_file !\n";
- }
- if (!($cfg{VIDEOSINK}))
- {
- print "Please add a VIDEOSINK to $config_file !\n";
- }
- }
- else
- {
- print "No configuration file $config_file found. You might want to create one.\n";
- }
- if (!defined $cfg{AUDIOSRC}) { $cfg{AUDIOSRC} = "osssrc"; }
- if (!defined $cfg{VIDEOSINK}) { $cfg{VIDEOSINK} = "xvimagesink"; }
- if (!defined $cfg{CVS_PATH}) { $cfg{CVS_PATH} = `echo -n ~`."/gst/cvs"; }
-}
-
-sub visualise(@)
-{
- my $vis = $cfg{VISUALIZER};
- $vis = shift() if ($#_ != -1);
- $vis = "goom" unless $vis;
-
- my $pipe;
- $pipe = $vis unless $pipe = $pipes{$vis};
-
- $command = "gst-launch-@GST_MAJORMINOR@ $cfg{AUDIOSRC} ! $pipe ! { queue ! ffmpegcolorspace ! $cfg{VIDEOSINK} }";
- print "Running $command\n";
- system ("PATH=\$PATH:".$cfg{CVS_PATH}."/gstreamer/tools $command");
-}
-
-### main
-
-read_config ();
-
-%pipes = (
- "goom", "goom",
- "chart", "audioconvert ! chart",
- "synaesthesia", "synaesthesia",
- "monoscope", "audioconvert ! monoscope"
-);
-
-if ($#ARGV > 0) {
- print STDERR "Usage: gst-visualise [visualiser]\n";
- exit 1;
-}
-
-visualise(@ARGV);
-
diff --git a/tools/gst-visualise.1.in b/tools/gst-visualise.1.in
deleted file mode 100644
index 5b5a1fc7..00000000
--- a/tools/gst-visualise.1.in
+++ /dev/null
@@ -1,32 +0,0 @@
-.TH "GStreamer" "1" "February 2002" "" ""
-.SH "NAME"
-gst\-visualise \- Run a GStreamer pipeline to display an audio visualisation
-.SH "SYNOPSIS"
-\fBgst\-visualise\fR \fI[visualiser]\fR
-.SH "DESCRIPTION"
-.LP
-\fIgst\-visualise\fP is a tool that is used to run a basic \fIGStreamer\fP pipeline, to display a graphical visualisation of an audio stream.
-
-By default, the audio stream is read from ESD (the Enlightened Sound Daemon),
-but this can be changed by setting the AUDIOSRC parameter in ~/.gst. For
-example, you might set "AUDIOSRC=osssrc" to display a visualisation of the
-sound input to your soundcard.
-
-You can select a visualiser by providing a parameter naming the visualiser.
-For example:
-
- gst\-visualise synaesthesia
-
-will use the synaesthesia plugin. If no visualiser is named, the VISUALIZER
-property in ~/.gst will be used. If this is not specified either, the goom
-visualiser will be used.
-
-The videosink to use to display the visualisation will be read from the
-VIDEOSINK parameter in ~/.gst, defaulting to sdlvideosink.
-
-.SH "SEE ALSO"
-.BR gst\-launch\-ext (1),
-.BR gst\-inspect (1),
-.BR gst\-launch (1),
-.SH "AUTHOR"
-The GStreamer team at http://gstreamer.net/
diff --git a/win32/MANIFEST b/win32/MANIFEST
deleted file mode 100644
index f075b820..00000000
--- a/win32/MANIFEST
+++ /dev/null
@@ -1,84 +0,0 @@
-win32/MANIFEST
-win32/common/_stdint.h
-win32/common/config.h
-win32/common/gstrtsp-enumtypes.c
-win32/common/gstrtsp-enumtypes.h
-win32/common/interfaces-enumtypes.c
-win32/common/interfaces-enumtypes.h
-win32/common/libgstapp.def
-win32/common/libgstaudio.def
-win32/common/libgstcdda.def
-win32/common/libgstinterfaces.def
-win32/common/libgstnetbuffer.def
-win32/common/libgstpbutils.def
-win32/common/libgstriff.def
-win32/common/libgstrtp.def
-win32/common/libgstrtsp.def
-win32/common/libgstsdp.def
-win32/common/libgsttag.def
-win32/common/libgstvideo.def
-win32/common/audio-enumtypes.c
-win32/common/audio-enumtypes.h
-win32/common/pbutils-enumtypes.c
-win32/common/pbutils-enumtypes.h
-win32/common/video-enumtypes.c
-win32/common/video-enumtypes.h
-win32/vs6/gst_plugins_base.dsw
-win32/vs6/grammar.dsp
-win32/vs6/libgstadder.dsp
-win32/vs6/libgstaudio.dsp
-win32/vs6/libgstaudioconvert.dsp
-win32/vs6/libgstaudiorate.dsp
-win32/vs6/libgstaudioresample.dsp
-win32/vs6/libgstaudioscale.dsp
-win32/vs6/libgstaudiotestsrc.dsp
-win32/vs6/libgstcdda.dsp
-win32/vs6/libgstdecodebin2.dsp
-win32/vs6/libgstdecodebin.dsp
-win32/vs6/libgstffmpegcolorspace.dsp
-win32/vs6/libgstfft.dsp
-win32/vs6/libgstgdp.dsp
-win32/vs6/libgstinterfaces.dsp
-win32/vs6/libgstnetbuffer.dsp
-win32/vs6/libgstogg.dsp
-win32/vs6/libgstpbutils.dsp
-win32/vs6/libgstplaybin.dsp
-win32/vs6/libgstriff.dsp
-win32/vs6/libgstrtp.dsp
-win32/vs6/libgstrtsp.dsp
-win32/vs6/libgstsdp.dsp
-win32/vs6/libgstsinesrc.dsp
-win32/vs6/libgstsubparse.dsp
-win32/vs6/libgsttag.dsp
-win32/vs6/libgsttheora.dsp
-win32/vs6/libgsttypefindfunctions.dsp
-win32/vs6/libgstvideo.dsp
-win32/vs6/libgstvideorate.dsp
-win32/vs6/libgstvideoscale.dsp
-win32/vs6/libgstvideotestsrc.dsp
-win32/vs6/libgstvolume.dsp
-win32/vs6/libgstvorbis.dsp
-win32/vs8/gst-plugins-base.sln
-win32/vs8/libgstadder.vcproj
-win32/vs8/libgstaudio.vcproj
-win32/vs8/libgstaudioconvert.vcproj
-win32/vs8/libgstaudiorate.vcproj
-win32/vs8/libgstaudioresample.vcproj
-win32/vs8/libgstaudiotestsrc.vcproj
-win32/vs8/libgstdecodebin.vcproj
-win32/vs8/libgstffmpegcolorspace.vcproj
-win32/vs8/libgstinterfaces.vcproj
-win32/vs8/libgstogg.vcproj
-win32/vs8/libgstplaybin.vcproj
-win32/vs8/libgstriff.vcproj
-win32/vs8/libgstsubparse.vcproj
-win32/vs8/libgsttag.vcproj
-win32/vs8/libgsttcp.vcproj
-win32/vs8/libgsttheora.vcproj
-win32/vs8/libgsttypefind.vcproj
-win32/vs8/libgstvideo.vcproj
-win32/vs8/libgstvideorate.vcproj
-win32/vs8/libgstvideoscale.vcproj
-win32/vs8/libgstvideotestsrc.vcproj
-win32/vs8/libgstvolume.vcproj
-win32/vs8/libgstvorbis.vcproj
diff --git a/win32/common/_stdint.h b/win32/common/_stdint.h
deleted file mode 100644
index 9e9fa133..00000000
--- a/win32/common/_stdint.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _GST_PLUGINS_BASE__STDINT_H
-#define _GST_PLUGINS_BASE__STDINT_H 1
-#ifndef _GENERATED_STDINT_H
-#define _GENERATED_STDINT_H "gst-plugins-base 0.10.26.3"
-/* generated using gnu compiler gcc (Debian 4.4.3-2) 4.4.3 */
-#define _STDINT_HAVE_STDINT_H 1
-#include <stdint.h>
-#endif
-#endif
diff --git a/win32/common/audio-enumtypes.c b/win32/common/audio-enumtypes.c
deleted file mode 100644
index b87241dc..00000000
--- a/win32/common/audio-enumtypes.c
+++ /dev/null
@@ -1,175 +0,0 @@
-
-/* Generated data (by glib-mkenums) */
-
-#include "audio-enumtypes.h"
-
-#include "multichannel.h"
-#include "gstringbuffer.h"
-
-/* enumerations from "multichannel.h" */
-GType
-gst_audio_channel_position_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_AUDIO_CHANNEL_POSITION_INVALID, "GST_AUDIO_CHANNEL_POSITION_INVALID",
- "invalid"},
- {GST_AUDIO_CHANNEL_POSITION_FRONT_MONO,
- "GST_AUDIO_CHANNEL_POSITION_FRONT_MONO", "front-mono"},
- {GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- "GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT", "front-left"},
- {GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- "GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT", "front-right"},
- {GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
- "GST_AUDIO_CHANNEL_POSITION_REAR_CENTER", "rear-center"},
- {GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- "GST_AUDIO_CHANNEL_POSITION_REAR_LEFT", "rear-left"},
- {GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- "GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT", "rear-right"},
- {GST_AUDIO_CHANNEL_POSITION_LFE, "GST_AUDIO_CHANNEL_POSITION_LFE", "lfe"},
- {GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- "GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER", "front-center"},
- {GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
- "GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER",
- "front-left-of-center"},
- {GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
- "GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER",
- "front-right-of-center"},
- {GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
- "GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT", "side-left"},
- {GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
- "GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT", "side-right"},
- {GST_AUDIO_CHANNEL_POSITION_NONE, "GST_AUDIO_CHANNEL_POSITION_NONE",
- "none"},
- {GST_AUDIO_CHANNEL_POSITION_NUM, "GST_AUDIO_CHANNEL_POSITION_NUM", "num"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_enum_register_static ("GstAudioChannelPosition", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-/* enumerations from "gstringbuffer.h" */
-GType
-gst_ring_buffer_state_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_RING_BUFFER_STATE_STOPPED, "GST_RING_BUFFER_STATE_STOPPED",
- "stopped"},
- {GST_RING_BUFFER_STATE_PAUSED, "GST_RING_BUFFER_STATE_PAUSED", "paused"},
- {GST_RING_BUFFER_STATE_STARTED, "GST_RING_BUFFER_STATE_STARTED",
- "started"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_enum_register_static ("GstRingBufferState", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-GType
-gst_ring_buffer_seg_state_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_SEGSTATE_INVALID, "GST_SEGSTATE_INVALID", "invalid"},
- {GST_SEGSTATE_EMPTY, "GST_SEGSTATE_EMPTY", "empty"},
- {GST_SEGSTATE_FILLED, "GST_SEGSTATE_FILLED", "filled"},
- {GST_SEGSTATE_PARTIAL, "GST_SEGSTATE_PARTIAL", "partial"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_enum_register_static ("GstRingBufferSegState", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-GType
-gst_buffer_format_type_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_BUFTYPE_LINEAR, "GST_BUFTYPE_LINEAR", "linear"},
- {GST_BUFTYPE_FLOAT, "GST_BUFTYPE_FLOAT", "float"},
- {GST_BUFTYPE_MU_LAW, "GST_BUFTYPE_MU_LAW", "mu-law"},
- {GST_BUFTYPE_A_LAW, "GST_BUFTYPE_A_LAW", "a-law"},
- {GST_BUFTYPE_IMA_ADPCM, "GST_BUFTYPE_IMA_ADPCM", "ima-adpcm"},
- {GST_BUFTYPE_MPEG, "GST_BUFTYPE_MPEG", "mpeg"},
- {GST_BUFTYPE_GSM, "GST_BUFTYPE_GSM", "gsm"},
- {GST_BUFTYPE_IEC958, "GST_BUFTYPE_IEC958", "iec958"},
- {GST_BUFTYPE_AC3, "GST_BUFTYPE_AC3", "ac3"},
- {GST_BUFTYPE_EAC3, "GST_BUFTYPE_EAC3", "eac3"},
- {GST_BUFTYPE_DTS, "GST_BUFTYPE_DTS", "dts"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_enum_register_static ("GstBufferFormatType", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-GType
-gst_buffer_format_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_UNKNOWN, "GST_UNKNOWN", "unknown"},
- {GST_S8, "GST_S8", "s8"},
- {GST_U8, "GST_U8", "u8"},
- {GST_S16_LE, "GST_S16_LE", "s16-le"},
- {GST_S16_BE, "GST_S16_BE", "s16-be"},
- {GST_U16_LE, "GST_U16_LE", "u16-le"},
- {GST_U16_BE, "GST_U16_BE", "u16-be"},
- {GST_S24_LE, "GST_S24_LE", "s24-le"},
- {GST_S24_BE, "GST_S24_BE", "s24-be"},
- {GST_U24_LE, "GST_U24_LE", "u24-le"},
- {GST_U24_BE, "GST_U24_BE", "u24-be"},
- {GST_S32_LE, "GST_S32_LE", "s32-le"},
- {GST_S32_BE, "GST_S32_BE", "s32-be"},
- {GST_U32_LE, "GST_U32_LE", "u32-le"},
- {GST_U32_BE, "GST_U32_BE", "u32-be"},
- {GST_S24_3LE, "GST_S24_3LE", "s24-3le"},
- {GST_S24_3BE, "GST_S24_3BE", "s24-3be"},
- {GST_U24_3LE, "GST_U24_3LE", "u24-3le"},
- {GST_U24_3BE, "GST_U24_3BE", "u24-3be"},
- {GST_S20_3LE, "GST_S20_3LE", "s20-3le"},
- {GST_S20_3BE, "GST_S20_3BE", "s20-3be"},
- {GST_U20_3LE, "GST_U20_3LE", "u20-3le"},
- {GST_U20_3BE, "GST_U20_3BE", "u20-3be"},
- {GST_S18_3LE, "GST_S18_3LE", "s18-3le"},
- {GST_S18_3BE, "GST_S18_3BE", "s18-3be"},
- {GST_U18_3LE, "GST_U18_3LE", "u18-3le"},
- {GST_U18_3BE, "GST_U18_3BE", "u18-3be"},
- {GST_FLOAT32_LE, "GST_FLOAT32_LE", "float32-le"},
- {GST_FLOAT32_BE, "GST_FLOAT32_BE", "float32-be"},
- {GST_FLOAT64_LE, "GST_FLOAT64_LE", "float64-le"},
- {GST_FLOAT64_BE, "GST_FLOAT64_BE", "float64-be"},
- {GST_MU_LAW, "GST_MU_LAW", "mu-law"},
- {GST_A_LAW, "GST_A_LAW", "a-law"},
- {GST_IMA_ADPCM, "GST_IMA_ADPCM", "ima-adpcm"},
- {GST_MPEG, "GST_MPEG", "mpeg"},
- {GST_GSM, "GST_GSM", "gsm"},
- {GST_IEC958, "GST_IEC958", "iec958"},
- {GST_AC3, "GST_AC3", "ac3"},
- {GST_EAC3, "GST_EAC3", "eac3"},
- {GST_DTS, "GST_DTS", "dts"},
- {0, NULL, NULL}
- };
- GType g_define_type_id = g_enum_register_static ("GstBufferFormat", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-/* Generated data ends here */
diff --git a/win32/common/audio-enumtypes.h b/win32/common/audio-enumtypes.h
deleted file mode 100644
index b3d15581..00000000
--- a/win32/common/audio-enumtypes.h
+++ /dev/null
@@ -1,29 +0,0 @@
-
-/* Generated data (by glib-mkenums) */
-
-#ifndef __GST_AUDIO_ENUM_TYPES_H__
-#define __GST_AUDIO_ENUM_TYPES_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-/* enumerations from "multichannel.h" */
-GType gst_audio_channel_position_get_type (void);
-#define GST_TYPE_AUDIO_CHANNEL_POSITION (gst_audio_channel_position_get_type())
-
-/* enumerations from "gstringbuffer.h" */
-GType gst_ring_buffer_state_get_type (void);
-#define GST_TYPE_RING_BUFFER_STATE (gst_ring_buffer_state_get_type())
-GType gst_ring_buffer_seg_state_get_type (void);
-#define GST_TYPE_RING_BUFFER_SEG_STATE (gst_ring_buffer_seg_state_get_type())
-GType gst_buffer_format_type_get_type (void);
-#define GST_TYPE_BUFFER_FORMAT_TYPE (gst_buffer_format_type_get_type())
-GType gst_buffer_format_get_type (void);
-#define GST_TYPE_BUFFER_FORMAT (gst_buffer_format_get_type())
-G_END_DECLS
-
-#endif /* __GST_AUDIO_ENUM_TYPES_H__ */
-
-/* Generated data ends here */
-
diff --git a/win32/common/config.h b/win32/common/config.h
deleted file mode 100644
index 9da7f923..00000000
--- a/win32/common/config.h
+++ /dev/null
@@ -1,386 +0,0 @@
-/* Autogenerated config.h created for win32 Visual Studio builds */
-
-/* PREFIX -- specifically added for Windows for easier moving */
-#define PREFIX "C:\\gstreamer"
-
-/* Define if building universal (internal helper macro) */
-#undef AC_APPLE_UNIVERSAL_BUILD
-
-/* The implementation that should be used for integer audio resampling witll
- be benchmarked at runtime */
-#undef AUDIORESAMPLE_FORMAT_AUTO
-
-/* The float implementation should be used for integer audio resampling */
-#undef AUDIORESAMPLE_FORMAT_FLOAT
-
-/* The int implementation should be used for integer audio resampling */
-#undef AUDIORESAMPLE_FORMAT_INT
-
-/* defined if cdda headers are in a cdda/ directory */
-#undef CDPARANOIA_HEADERS_IN_DIR
-
-/* Default audio sink */
-#define DEFAULT_AUDIOSINK "directaudiosink"
-
-/* Default audio source */
-#undef DEFAULT_AUDIOSRC
-
-/* Default video sink */
-#define DEFAULT_VIDEOSINK "directdrawsink"
-
-/* Default video source */
-#undef DEFAULT_VIDEOSRC
-
-/* Default visualizer */
-#define DEFAULT_VISUALIZER "goom"
-
-/* Define to 1 if translation of program messages to the user's native
- language is requested. */
-#undef ENABLE_NLS
-
-/* gettext package name */
-#define GETTEXT_PACKAGE "gst-plugins-base-0.10"
-
-/* The GIO library directory. */
-#undef GIO_LIBDIR
-
-/* The GIO modules directory. */
-#undef GIO_MODULE_DIR
-
-/* The GnomeVFS modules directory. */
-#undef GNOME_VFS_MODULES_DIR
-
-/* macro to use to show function name */
-#undef GST_FUNCTION
-
-/* Defined if gcov is enabled to force a rebuild due to config.h changing */
-#undef GST_GCOV_ENABLED
-
-/* plugin install helper script */
-#define GST_INSTALL_PLUGINS_HELPER PREFIX "\\libexec\\gst-install-plugins-helper.exe"
-
-/* Default errorlevel to use */
-#define GST_LEVEL_DEFAULT GST_LEVEL_ERROR
-
-/* GStreamer license */
-#define GST_LICENSE "LGPL"
-
-/* package name in plugins */
-#define GST_PACKAGE_NAME "GStreamer Base Plug-ins prerelease"
-
-/* package origin */
-#define GST_PACKAGE_ORIGIN "Unknown package origin"
-
-/* I know the API is subject to change. */
-#undef G_UDEV_API_IS_SUBJECT_TO_CHANGE
-
-/* Define to enable ALSA (used by alsa). */
-#undef HAVE_ALSA
-
-/* Define to 1 if you have the `cbrt' function. */
-#undef HAVE_CBRT
-
-/* Define to enable CDParanoia (used by cdparanoia). */
-#undef HAVE_CDPARANOIA
-
-/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
- CoreFoundation framework. */
-#undef HAVE_CFLOCALECOPYCURRENT
-
-/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
- the CoreFoundation framework. */
-#undef HAVE_CFPREFERENCESCOPYAPPVALUE
-
-/* Define if the host CPU is an Alpha */
-#undef HAVE_CPU_ALPHA
-
-/* Define if the host CPU is an ARM */
-#undef HAVE_CPU_ARM
-
-/* Define if the host CPU is a CRIS */
-#undef HAVE_CPU_CRIS
-
-/* Define if the host CPU is a CRISv32 */
-#undef HAVE_CPU_CRISV32
-
-/* Define if the host CPU is a HPPA */
-#undef HAVE_CPU_HPPA
-
-/* Define if the host CPU is an x86 */
-#define HAVE_CPU_I386 1
-
-/* Define if the host CPU is a IA64 */
-#undef HAVE_CPU_IA64
-
-/* Define if the host CPU is a M68K */
-#undef HAVE_CPU_M68K
-
-/* Define if the host CPU is a MIPS */
-#undef HAVE_CPU_MIPS
-
-/* Define if the host CPU is a PowerPC */
-#undef HAVE_CPU_PPC
-
-/* Define if the host CPU is a 64 bit PowerPC */
-#undef HAVE_CPU_PPC64
-
-/* Define if the host CPU is a S390 */
-#undef HAVE_CPU_S390
-
-/* Define if the host CPU is a SPARC */
-#undef HAVE_CPU_SPARC
-
-/* Define if the host CPU is a x86_64 */
-#undef HAVE_CPU_X86_64
-
-/* Define if the GNU dcgettext() function is already present or preinstalled.
- */
-#undef HAVE_DCGETTEXT
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
-
-/* Define to enable building of experimental plug-ins. */
-#undef HAVE_EXPERIMENTAL
-
-/* Define to enable building of plug-ins with external deps. */
-#undef HAVE_EXTERNAL
-
-/* FIONREAD ioctl found in sys/filio.h */
-#undef HAVE_FIONREAD_IN_SYS_FILIO
-
-/* FIONREAD ioctl found in sys/ioclt.h */
-#undef HAVE_FIONREAD_IN_SYS_IOCTL
-
-/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
-#undef HAVE_FSEEKO
-
-/* defined if the compiler implements __func__ */
-#undef HAVE_FUNC
-
-/* defined if the compiler implements __FUNCTION__ */
-#undef HAVE_FUNCTION
-
-/* Define if the GNU gettext() function is already present or preinstalled. */
-#undef HAVE_GETTEXT
-
-/* Define to enable GIO library (used by gio). */
-#undef HAVE_GIO
-
-/* Define to 1 if you have the `gmtime_r' function. */
-#undef HAVE_GMTIME_R
-
-/* Define to enable GNOME VFS (used by gnomevfs). */
-#undef HAVE_GNOME_VFS
-
-/* Define to enable Video 4 Linux (used by video4linux). */
-#undef HAVE_GST_V4L
-
-/* Whether gudev is available for device detection */
-#undef HAVE_GUDEV
-
-/* Define if you have the iconv() function and it works. */
-#undef HAVE_ICONV
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* make use of iso-codes for ISO-639 */
-#undef HAVE_ISO_CODES
-
-/* Define to enable integer vorbis plug-in (used by ivorbisdec). */
-#undef HAVE_IVORBIS
-
-/* Define to 1 if you have the `asound' library (-lasound). */
-#undef HAVE_LIBASOUND
-
-/* Define to 1 if you have the `nsl' library (-lnsl). */
-#undef HAVE_LIBNSL
-
-/* Define to 1 if you have the `resolv' library (-lresolv). */
-#undef HAVE_LIBRESOLV
-
-/* Define to 1 if you have the `socket' library (-lsocket). */
-#undef HAVE_LIBSOCKET
-
-/* Define to enable libvisual visualization library (used by libvisual). */
-#undef HAVE_LIBVISUAL
-
-/* Define to 1 if you have the `localtime_r' function. */
-#undef HAVE_LOCALTIME_R
-
-/* Define if you have C99's lrint function. */
-#undef HAVE_LRINT
-
-/* Define if you have C99's lrintf function. */
-#undef HAVE_LRINTF
-
-/* Define to 1 if you have the <malloc.h> header file. */
-#undef HAVE_MALLOC_H
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to enable Xiph Ogg library (used by ogg). */
-#undef HAVE_OGG
-
-/* Define to enable Pango font rendering (used by pango). */
-#undef HAVE_PANGO
-
-/* defined if the compiler implements __PRETTY_FUNCTION__ */
-#undef HAVE_PRETTY_FUNCTION
-
-/* Define to 1 if you have the <process.h> header file. */
-#define HAVE_PROCESS_H 1
-
-/* Define if RDTSC is available */
-#undef HAVE_RDTSC
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the <sys/socket.h> header file. */
-#undef HAVE_SYS_SOCKET_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <sys/wait.h> header file. */
-#undef HAVE_SYS_WAIT_H
-
-/* Define to enable Xiph Theora video codec (used by theora). */
-#undef HAVE_THEORA
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define if valgrind should be used */
-#undef HAVE_VALGRIND
-
-/* Define to enable Xiph Vorbis audio codec (used by vorbis). */
-#undef HAVE_VORBIS
-
-/* defined if vorbis_synthesis_restart is present */
-#undef HAVE_VORBIS_SYNTHESIS_RESTART
-
-/* Define to 1 if you have the <winsock2.h> header file. */
-#define HAVE_WINSOCK2_H 1
-
-/* Define to enable X libraries and plugins (used by ximagesink). */
-#undef HAVE_X
-
-/* Define to enable X Shared Memory extension. */
-#undef HAVE_XSHM
-
-/* Define to enable X11 XVideo extensions (used by xvimagesink). */
-#undef HAVE_XVIDEO
-
-/* the host CPU */
-#define HOST_CPU "i686"
-
-/* prefix */
-#undef ISO_CODES_PREFIX
-
-/* */
-#undef ISO_CODES_VERSION
-
-/* directory in which the detected libvisual's plugins are located */
-#undef LIBVISUAL_PLUGINSBASEDIR
-
-/* gettext locale dir */
-#define LOCALEDIR PREFIX "\\share\\locale"
-
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
- */
-#undef LT_OBJDIR
-
-/* Define if you have no native hstrerror() function. */
-#undef NO_HSTRERROR
-
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-#undef NO_MINUS_C_MINUS_O
-
-/* Name of package */
-#define PACKAGE "gst-plugins-base"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer"
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME "GStreamer Base Plug-ins"
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "GStreamer Base Plug-ins 0.10.26.3"
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME "gst-plugins-base"
-
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION "0.10.26.3"
-
-/* directory where plugins are located */
-#ifdef _DEBUG
-# define PLUGINDIR PREFIX "\\debug\\lib\\gstreamer-0.10"
-#else
-# define PLUGINDIR PREFIX "\\lib\\gstreamer-0.10"
-#endif
-
-/* The size of `char', as computed by sizeof. */
-#undef SIZEOF_CHAR
-
-/* The size of `int', as computed by sizeof. */
-#undef SIZEOF_INT
-
-/* The size of `long', as computed by sizeof. */
-#undef SIZEOF_LONG
-
-/* The size of `short', as computed by sizeof. */
-#undef SIZEOF_SHORT
-
-/* The size of `void*', as computed by sizeof. */
-#undef SIZEOF_VOIDP
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Version number of package */
-#define VERSION "0.10.26.3"
-
-/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
- significant byte first (like Motorola and SPARC, unlike Intel). */
-#if defined AC_APPLE_UNIVERSAL_BUILD
-# if defined __BIG_ENDIAN__
-# define WORDS_BIGENDIAN 1
-# endif
-#else
-# ifndef WORDS_BIGENDIAN
-# undef WORDS_BIGENDIAN
-# endif
-#endif
-
-/* Define to 1 if the X Window System is missing or not being used. */
-#undef X_DISPLAY_MISSING
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-#undef _FILE_OFFSET_BITS
-
-/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
-#undef _LARGEFILE_SOURCE
-
-/* Define for large files, on AIX-style hosts. */
-#undef _LARGE_FILES
diff --git a/win32/common/gstrtsp-enumtypes.c b/win32/common/gstrtsp-enumtypes.c
deleted file mode 100644
index 8e47a45d..00000000
--- a/win32/common/gstrtsp-enumtypes.c
+++ /dev/null
@@ -1,391 +0,0 @@
-
-/* Generated data (by glib-mkenums) */
-
-#include "gstrtsp-enumtypes.h"
-
-#include "gstrtspdefs.h"
-
-/* enumerations from "gstrtspdefs.h" */
-GType
-gst_rtsp_result_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_RTSP_OK, "GST_RTSP_OK", "ok"},
- {GST_RTSP_ERROR, "GST_RTSP_ERROR", "error"},
- {GST_RTSP_EINVAL, "GST_RTSP_EINVAL", "einval"},
- {GST_RTSP_EINTR, "GST_RTSP_EINTR", "eintr"},
- {GST_RTSP_ENOMEM, "GST_RTSP_ENOMEM", "enomem"},
- {GST_RTSP_ERESOLV, "GST_RTSP_ERESOLV", "eresolv"},
- {GST_RTSP_ENOTIMPL, "GST_RTSP_ENOTIMPL", "enotimpl"},
- {GST_RTSP_ESYS, "GST_RTSP_ESYS", "esys"},
- {GST_RTSP_EPARSE, "GST_RTSP_EPARSE", "eparse"},
- {GST_RTSP_EWSASTART, "GST_RTSP_EWSASTART", "ewsastart"},
- {GST_RTSP_EWSAVERSION, "GST_RTSP_EWSAVERSION", "ewsaversion"},
- {GST_RTSP_EEOF, "GST_RTSP_EEOF", "eeof"},
- {GST_RTSP_ENET, "GST_RTSP_ENET", "enet"},
- {GST_RTSP_ENOTIP, "GST_RTSP_ENOTIP", "enotip"},
- {GST_RTSP_ETIMEOUT, "GST_RTSP_ETIMEOUT", "etimeout"},
- {GST_RTSP_ETGET, "GST_RTSP_ETGET", "etget"},
- {GST_RTSP_ETPOST, "GST_RTSP_ETPOST", "etpost"},
- {GST_RTSP_ELAST, "GST_RTSP_ELAST", "elast"},
- {0, NULL, NULL}
- };
- GType g_define_type_id = g_enum_register_static ("GstRTSPResult", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-GType
-gst_rtsp_event_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GFlagsValue values[] = {
- {GST_RTSP_EV_READ, "GST_RTSP_EV_READ", "read"},
- {GST_RTSP_EV_WRITE, "GST_RTSP_EV_WRITE", "write"},
- {0, NULL, NULL}
- };
- GType g_define_type_id = g_flags_register_static ("GstRTSPEvent", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-GType
-gst_rtsp_family_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_RTSP_FAM_NONE, "GST_RTSP_FAM_NONE", "none"},
- {GST_RTSP_FAM_INET, "GST_RTSP_FAM_INET", "inet"},
- {GST_RTSP_FAM_INET6, "GST_RTSP_FAM_INET6", "inet6"},
- {0, NULL, NULL}
- };
- GType g_define_type_id = g_enum_register_static ("GstRTSPFamily", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-GType
-gst_rtsp_state_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_RTSP_STATE_INVALID, "GST_RTSP_STATE_INVALID", "invalid"},
- {GST_RTSP_STATE_INIT, "GST_RTSP_STATE_INIT", "init"},
- {GST_RTSP_STATE_READY, "GST_RTSP_STATE_READY", "ready"},
- {GST_RTSP_STATE_SEEKING, "GST_RTSP_STATE_SEEKING", "seeking"},
- {GST_RTSP_STATE_PLAYING, "GST_RTSP_STATE_PLAYING", "playing"},
- {GST_RTSP_STATE_RECORDING, "GST_RTSP_STATE_RECORDING", "recording"},
- {0, NULL, NULL}
- };
- GType g_define_type_id = g_enum_register_static ("GstRTSPState", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-GType
-gst_rtsp_version_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_RTSP_VERSION_INVALID, "GST_RTSP_VERSION_INVALID", "invalid"},
- {GST_RTSP_VERSION_1_0, "GST_RTSP_VERSION_1_0", "1-0"},
- {GST_RTSP_VERSION_1_1, "GST_RTSP_VERSION_1_1", "1-1"},
- {0, NULL, NULL}
- };
- GType g_define_type_id = g_enum_register_static ("GstRTSPVersion", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-GType
-gst_rtsp_method_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GFlagsValue values[] = {
- {GST_RTSP_INVALID, "GST_RTSP_INVALID", "invalid"},
- {GST_RTSP_DESCRIBE, "GST_RTSP_DESCRIBE", "describe"},
- {GST_RTSP_ANNOUNCE, "GST_RTSP_ANNOUNCE", "announce"},
- {GST_RTSP_GET_PARAMETER, "GST_RTSP_GET_PARAMETER", "get-parameter"},
- {GST_RTSP_OPTIONS, "GST_RTSP_OPTIONS", "options"},
- {GST_RTSP_PAUSE, "GST_RTSP_PAUSE", "pause"},
- {GST_RTSP_PLAY, "GST_RTSP_PLAY", "play"},
- {GST_RTSP_RECORD, "GST_RTSP_RECORD", "record"},
- {GST_RTSP_REDIRECT, "GST_RTSP_REDIRECT", "redirect"},
- {GST_RTSP_SETUP, "GST_RTSP_SETUP", "setup"},
- {GST_RTSP_SET_PARAMETER, "GST_RTSP_SET_PARAMETER", "set-parameter"},
- {GST_RTSP_TEARDOWN, "GST_RTSP_TEARDOWN", "teardown"},
- {GST_RTSP_GET, "GST_RTSP_GET", "get"},
- {GST_RTSP_POST, "GST_RTSP_POST", "post"},
- {0, NULL, NULL}
- };
- GType g_define_type_id = g_flags_register_static ("GstRTSPMethod", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-GType
-gst_rtsp_auth_method_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_RTSP_AUTH_NONE, "GST_RTSP_AUTH_NONE", "none"},
- {GST_RTSP_AUTH_BASIC, "GST_RTSP_AUTH_BASIC", "basic"},
- {GST_RTSP_AUTH_DIGEST, "GST_RTSP_AUTH_DIGEST", "digest"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_enum_register_static ("GstRTSPAuthMethod", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-GType
-gst_rtsp_header_field_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_RTSP_HDR_INVALID, "GST_RTSP_HDR_INVALID", "invalid"},
- {GST_RTSP_HDR_ACCEPT, "GST_RTSP_HDR_ACCEPT", "accept"},
- {GST_RTSP_HDR_ACCEPT_ENCODING, "GST_RTSP_HDR_ACCEPT_ENCODING",
- "accept-encoding"},
- {GST_RTSP_HDR_ACCEPT_LANGUAGE, "GST_RTSP_HDR_ACCEPT_LANGUAGE",
- "accept-language"},
- {GST_RTSP_HDR_ALLOW, "GST_RTSP_HDR_ALLOW", "allow"},
- {GST_RTSP_HDR_AUTHORIZATION, "GST_RTSP_HDR_AUTHORIZATION",
- "authorization"},
- {GST_RTSP_HDR_BANDWIDTH, "GST_RTSP_HDR_BANDWIDTH", "bandwidth"},
- {GST_RTSP_HDR_BLOCKSIZE, "GST_RTSP_HDR_BLOCKSIZE", "blocksize"},
- {GST_RTSP_HDR_CACHE_CONTROL, "GST_RTSP_HDR_CACHE_CONTROL",
- "cache-control"},
- {GST_RTSP_HDR_CONFERENCE, "GST_RTSP_HDR_CONFERENCE", "conference"},
- {GST_RTSP_HDR_CONNECTION, "GST_RTSP_HDR_CONNECTION", "connection"},
- {GST_RTSP_HDR_CONTENT_BASE, "GST_RTSP_HDR_CONTENT_BASE", "content-base"},
- {GST_RTSP_HDR_CONTENT_ENCODING, "GST_RTSP_HDR_CONTENT_ENCODING",
- "content-encoding"},
- {GST_RTSP_HDR_CONTENT_LANGUAGE, "GST_RTSP_HDR_CONTENT_LANGUAGE",
- "content-language"},
- {GST_RTSP_HDR_CONTENT_LENGTH, "GST_RTSP_HDR_CONTENT_LENGTH",
- "content-length"},
- {GST_RTSP_HDR_CONTENT_LOCATION, "GST_RTSP_HDR_CONTENT_LOCATION",
- "content-location"},
- {GST_RTSP_HDR_CONTENT_TYPE, "GST_RTSP_HDR_CONTENT_TYPE", "content-type"},
- {GST_RTSP_HDR_CSEQ, "GST_RTSP_HDR_CSEQ", "cseq"},
- {GST_RTSP_HDR_DATE, "GST_RTSP_HDR_DATE", "date"},
- {GST_RTSP_HDR_EXPIRES, "GST_RTSP_HDR_EXPIRES", "expires"},
- {GST_RTSP_HDR_FROM, "GST_RTSP_HDR_FROM", "from"},
- {GST_RTSP_HDR_IF_MODIFIED_SINCE, "GST_RTSP_HDR_IF_MODIFIED_SINCE",
- "if-modified-since"},
- {GST_RTSP_HDR_LAST_MODIFIED, "GST_RTSP_HDR_LAST_MODIFIED",
- "last-modified"},
- {GST_RTSP_HDR_PROXY_AUTHENTICATE, "GST_RTSP_HDR_PROXY_AUTHENTICATE",
- "proxy-authenticate"},
- {GST_RTSP_HDR_PROXY_REQUIRE, "GST_RTSP_HDR_PROXY_REQUIRE",
- "proxy-require"},
- {GST_RTSP_HDR_PUBLIC, "GST_RTSP_HDR_PUBLIC", "public"},
- {GST_RTSP_HDR_RANGE, "GST_RTSP_HDR_RANGE", "range"},
- {GST_RTSP_HDR_REFERER, "GST_RTSP_HDR_REFERER", "referer"},
- {GST_RTSP_HDR_REQUIRE, "GST_RTSP_HDR_REQUIRE", "require"},
- {GST_RTSP_HDR_RETRY_AFTER, "GST_RTSP_HDR_RETRY_AFTER", "retry-after"},
- {GST_RTSP_HDR_RTP_INFO, "GST_RTSP_HDR_RTP_INFO", "rtp-info"},
- {GST_RTSP_HDR_SCALE, "GST_RTSP_HDR_SCALE", "scale"},
- {GST_RTSP_HDR_SESSION, "GST_RTSP_HDR_SESSION", "session"},
- {GST_RTSP_HDR_SERVER, "GST_RTSP_HDR_SERVER", "server"},
- {GST_RTSP_HDR_SPEED, "GST_RTSP_HDR_SPEED", "speed"},
- {GST_RTSP_HDR_TRANSPORT, "GST_RTSP_HDR_TRANSPORT", "transport"},
- {GST_RTSP_HDR_UNSUPPORTED, "GST_RTSP_HDR_UNSUPPORTED", "unsupported"},
- {GST_RTSP_HDR_USER_AGENT, "GST_RTSP_HDR_USER_AGENT", "user-agent"},
- {GST_RTSP_HDR_VIA, "GST_RTSP_HDR_VIA", "via"},
- {GST_RTSP_HDR_WWW_AUTHENTICATE, "GST_RTSP_HDR_WWW_AUTHENTICATE",
- "www-authenticate"},
- {GST_RTSP_HDR_CLIENT_CHALLENGE, "GST_RTSP_HDR_CLIENT_CHALLENGE",
- "client-challenge"},
- {GST_RTSP_HDR_REAL_CHALLENGE1, "GST_RTSP_HDR_REAL_CHALLENGE1",
- "real-challenge1"},
- {GST_RTSP_HDR_REAL_CHALLENGE2, "GST_RTSP_HDR_REAL_CHALLENGE2",
- "real-challenge2"},
- {GST_RTSP_HDR_REAL_CHALLENGE3, "GST_RTSP_HDR_REAL_CHALLENGE3",
- "real-challenge3"},
- {GST_RTSP_HDR_SUBSCRIBE, "GST_RTSP_HDR_SUBSCRIBE", "subscribe"},
- {GST_RTSP_HDR_ALERT, "GST_RTSP_HDR_ALERT", "alert"},
- {GST_RTSP_HDR_CLIENT_ID, "GST_RTSP_HDR_CLIENT_ID", "client-id"},
- {GST_RTSP_HDR_COMPANY_ID, "GST_RTSP_HDR_COMPANY_ID", "company-id"},
- {GST_RTSP_HDR_GUID, "GST_RTSP_HDR_GUID", "guid"},
- {GST_RTSP_HDR_REGION_DATA, "GST_RTSP_HDR_REGION_DATA", "region-data"},
- {GST_RTSP_HDR_MAX_ASM_WIDTH, "GST_RTSP_HDR_MAX_ASM_WIDTH",
- "max-asm-width"},
- {GST_RTSP_HDR_LANGUAGE, "GST_RTSP_HDR_LANGUAGE", "language"},
- {GST_RTSP_HDR_PLAYER_START_TIME, "GST_RTSP_HDR_PLAYER_START_TIME",
- "player-start-time"},
- {GST_RTSP_HDR_LOCATION, "GST_RTSP_HDR_LOCATION", "location"},
- {GST_RTSP_HDR_ETAG, "GST_RTSP_HDR_ETAG", "etag"},
- {GST_RTSP_HDR_IF_MATCH, "GST_RTSP_HDR_IF_MATCH", "if-match"},
- {GST_RTSP_HDR_ACCEPT_CHARSET, "GST_RTSP_HDR_ACCEPT_CHARSET",
- "accept-charset"},
- {GST_RTSP_HDR_SUPPORTED, "GST_RTSP_HDR_SUPPORTED", "supported"},
- {GST_RTSP_HDR_VARY, "GST_RTSP_HDR_VARY", "vary"},
- {GST_RTSP_HDR_X_ACCELERATE_STREAMING,
- "GST_RTSP_HDR_X_ACCELERATE_STREAMING", "x-accelerate-streaming"},
- {GST_RTSP_HDR_X_ACCEPT_AUTHENT, "GST_RTSP_HDR_X_ACCEPT_AUTHENT",
- "x-accept-authent"},
- {GST_RTSP_HDR_X_ACCEPT_PROXY_AUTHENT,
- "GST_RTSP_HDR_X_ACCEPT_PROXY_AUTHENT", "x-accept-proxy-authent"},
- {GST_RTSP_HDR_X_BROADCAST_ID, "GST_RTSP_HDR_X_BROADCAST_ID",
- "x-broadcast-id"},
- {GST_RTSP_HDR_X_BURST_STREAMING, "GST_RTSP_HDR_X_BURST_STREAMING",
- "x-burst-streaming"},
- {GST_RTSP_HDR_X_NOTICE, "GST_RTSP_HDR_X_NOTICE", "x-notice"},
- {GST_RTSP_HDR_X_PLAYER_LAG_TIME, "GST_RTSP_HDR_X_PLAYER_LAG_TIME",
- "x-player-lag-time"},
- {GST_RTSP_HDR_X_PLAYLIST, "GST_RTSP_HDR_X_PLAYLIST", "x-playlist"},
- {GST_RTSP_HDR_X_PLAYLIST_CHANGE_NOTICE,
- "GST_RTSP_HDR_X_PLAYLIST_CHANGE_NOTICE",
- "x-playlist-change-notice"},
- {GST_RTSP_HDR_X_PLAYLIST_GEN_ID, "GST_RTSP_HDR_X_PLAYLIST_GEN_ID",
- "x-playlist-gen-id"},
- {GST_RTSP_HDR_X_PLAYLIST_SEEK_ID, "GST_RTSP_HDR_X_PLAYLIST_SEEK_ID",
- "x-playlist-seek-id"},
- {GST_RTSP_HDR_X_PROXY_CLIENT_AGENT, "GST_RTSP_HDR_X_PROXY_CLIENT_AGENT",
- "x-proxy-client-agent"},
- {GST_RTSP_HDR_X_PROXY_CLIENT_VERB, "GST_RTSP_HDR_X_PROXY_CLIENT_VERB",
- "x-proxy-client-verb"},
- {GST_RTSP_HDR_X_RECEDING_PLAYLISTCHANGE,
- "GST_RTSP_HDR_X_RECEDING_PLAYLISTCHANGE",
- "x-receding-playlistchange"},
- {GST_RTSP_HDR_X_RTP_INFO, "GST_RTSP_HDR_X_RTP_INFO", "x-rtp-info"},
- {GST_RTSP_HDR_X_STARTUPPROFILE, "GST_RTSP_HDR_X_STARTUPPROFILE",
- "x-startupprofile"},
- {GST_RTSP_HDR_TIMESTAMP, "GST_RTSP_HDR_TIMESTAMP", "timestamp"},
- {GST_RTSP_HDR_AUTHENTICATION_INFO, "GST_RTSP_HDR_AUTHENTICATION_INFO",
- "authentication-info"},
- {GST_RTSP_HDR_HOST, "GST_RTSP_HDR_HOST", "host"},
- {GST_RTSP_HDR_PRAGMA, "GST_RTSP_HDR_PRAGMA", "pragma"},
- {GST_RTSP_HDR_X_SERVER_IP_ADDRESS, "GST_RTSP_HDR_X_SERVER_IP_ADDRESS",
- "x-server-ip-address"},
- {GST_RTSP_HDR_X_SESSIONCOOKIE, "GST_RTSP_HDR_X_SESSIONCOOKIE",
- "x-sessioncookie"},
- {GST_RTSP_HDR_LAST, "GST_RTSP_HDR_LAST", "last"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_enum_register_static ("GstRTSPHeaderField", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-GType
-gst_rtsp_status_code_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_RTSP_STS_INVALID, "GST_RTSP_STS_INVALID", "invalid"},
- {GST_RTSP_STS_CONTINUE, "GST_RTSP_STS_CONTINUE", "continue"},
- {GST_RTSP_STS_OK, "GST_RTSP_STS_OK", "ok"},
- {GST_RTSP_STS_CREATED, "GST_RTSP_STS_CREATED", "created"},
- {GST_RTSP_STS_LOW_ON_STORAGE, "GST_RTSP_STS_LOW_ON_STORAGE",
- "low-on-storage"},
- {GST_RTSP_STS_MULTIPLE_CHOICES, "GST_RTSP_STS_MULTIPLE_CHOICES",
- "multiple-choices"},
- {GST_RTSP_STS_MOVED_PERMANENTLY, "GST_RTSP_STS_MOVED_PERMANENTLY",
- "moved-permanently"},
- {GST_RTSP_STS_MOVE_TEMPORARILY, "GST_RTSP_STS_MOVE_TEMPORARILY",
- "move-temporarily"},
- {GST_RTSP_STS_SEE_OTHER, "GST_RTSP_STS_SEE_OTHER", "see-other"},
- {GST_RTSP_STS_NOT_MODIFIED, "GST_RTSP_STS_NOT_MODIFIED", "not-modified"},
- {GST_RTSP_STS_USE_PROXY, "GST_RTSP_STS_USE_PROXY", "use-proxy"},
- {GST_RTSP_STS_BAD_REQUEST, "GST_RTSP_STS_BAD_REQUEST", "bad-request"},
- {GST_RTSP_STS_UNAUTHORIZED, "GST_RTSP_STS_UNAUTHORIZED", "unauthorized"},
- {GST_RTSP_STS_PAYMENT_REQUIRED, "GST_RTSP_STS_PAYMENT_REQUIRED",
- "payment-required"},
- {GST_RTSP_STS_FORBIDDEN, "GST_RTSP_STS_FORBIDDEN", "forbidden"},
- {GST_RTSP_STS_NOT_FOUND, "GST_RTSP_STS_NOT_FOUND", "not-found"},
- {GST_RTSP_STS_METHOD_NOT_ALLOWED, "GST_RTSP_STS_METHOD_NOT_ALLOWED",
- "method-not-allowed"},
- {GST_RTSP_STS_NOT_ACCEPTABLE, "GST_RTSP_STS_NOT_ACCEPTABLE",
- "not-acceptable"},
- {GST_RTSP_STS_PROXY_AUTH_REQUIRED, "GST_RTSP_STS_PROXY_AUTH_REQUIRED",
- "proxy-auth-required"},
- {GST_RTSP_STS_REQUEST_TIMEOUT, "GST_RTSP_STS_REQUEST_TIMEOUT",
- "request-timeout"},
- {GST_RTSP_STS_GONE, "GST_RTSP_STS_GONE", "gone"},
- {GST_RTSP_STS_LENGTH_REQUIRED, "GST_RTSP_STS_LENGTH_REQUIRED",
- "length-required"},
- {GST_RTSP_STS_PRECONDITION_FAILED, "GST_RTSP_STS_PRECONDITION_FAILED",
- "precondition-failed"},
- {GST_RTSP_STS_REQUEST_ENTITY_TOO_LARGE,
- "GST_RTSP_STS_REQUEST_ENTITY_TOO_LARGE",
- "request-entity-too-large"},
- {GST_RTSP_STS_REQUEST_URI_TOO_LARGE, "GST_RTSP_STS_REQUEST_URI_TOO_LARGE",
- "request-uri-too-large"},
- {GST_RTSP_STS_UNSUPPORTED_MEDIA_TYPE,
- "GST_RTSP_STS_UNSUPPORTED_MEDIA_TYPE", "unsupported-media-type"},
- {GST_RTSP_STS_PARAMETER_NOT_UNDERSTOOD,
- "GST_RTSP_STS_PARAMETER_NOT_UNDERSTOOD",
- "parameter-not-understood"},
- {GST_RTSP_STS_CONFERENCE_NOT_FOUND, "GST_RTSP_STS_CONFERENCE_NOT_FOUND",
- "conference-not-found"},
- {GST_RTSP_STS_NOT_ENOUGH_BANDWIDTH, "GST_RTSP_STS_NOT_ENOUGH_BANDWIDTH",
- "not-enough-bandwidth"},
- {GST_RTSP_STS_SESSION_NOT_FOUND, "GST_RTSP_STS_SESSION_NOT_FOUND",
- "session-not-found"},
- {GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE,
- "GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE",
- "method-not-valid-in-this-state"},
- {GST_RTSP_STS_HEADER_FIELD_NOT_VALID_FOR_RESOURCE,
- "GST_RTSP_STS_HEADER_FIELD_NOT_VALID_FOR_RESOURCE",
- "header-field-not-valid-for-resource"},
- {GST_RTSP_STS_INVALID_RANGE, "GST_RTSP_STS_INVALID_RANGE",
- "invalid-range"},
- {GST_RTSP_STS_PARAMETER_IS_READONLY, "GST_RTSP_STS_PARAMETER_IS_READONLY",
- "parameter-is-readonly"},
- {GST_RTSP_STS_AGGREGATE_OPERATION_NOT_ALLOWED,
- "GST_RTSP_STS_AGGREGATE_OPERATION_NOT_ALLOWED",
- "aggregate-operation-not-allowed"},
- {GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED,
- "GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED",
- "only-aggregate-operation-allowed"},
- {GST_RTSP_STS_UNSUPPORTED_TRANSPORT, "GST_RTSP_STS_UNSUPPORTED_TRANSPORT",
- "unsupported-transport"},
- {GST_RTSP_STS_DESTINATION_UNREACHABLE,
- "GST_RTSP_STS_DESTINATION_UNREACHABLE", "destination-unreachable"},
- {GST_RTSP_STS_INTERNAL_SERVER_ERROR, "GST_RTSP_STS_INTERNAL_SERVER_ERROR",
- "internal-server-error"},
- {GST_RTSP_STS_NOT_IMPLEMENTED, "GST_RTSP_STS_NOT_IMPLEMENTED",
- "not-implemented"},
- {GST_RTSP_STS_BAD_GATEWAY, "GST_RTSP_STS_BAD_GATEWAY", "bad-gateway"},
- {GST_RTSP_STS_SERVICE_UNAVAILABLE, "GST_RTSP_STS_SERVICE_UNAVAILABLE",
- "service-unavailable"},
- {GST_RTSP_STS_GATEWAY_TIMEOUT, "GST_RTSP_STS_GATEWAY_TIMEOUT",
- "gateway-timeout"},
- {GST_RTSP_STS_RTSP_VERSION_NOT_SUPPORTED,
- "GST_RTSP_STS_RTSP_VERSION_NOT_SUPPORTED",
- "rtsp-version-not-supported"},
- {GST_RTSP_STS_OPTION_NOT_SUPPORTED, "GST_RTSP_STS_OPTION_NOT_SUPPORTED",
- "option-not-supported"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_enum_register_static ("GstRTSPStatusCode", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-/* Generated data ends here */
diff --git a/win32/common/gstrtsp-enumtypes.h b/win32/common/gstrtsp-enumtypes.h
deleted file mode 100644
index 5a631f69..00000000
--- a/win32/common/gstrtsp-enumtypes.h
+++ /dev/null
@@ -1,35 +0,0 @@
-
-/* Generated data (by glib-mkenums) */
-
-#ifndef __gst_rtsp_ENUM_TYPES_H__
-#define __gst_rtsp_ENUM_TYPES_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-/* enumerations from "gstrtspdefs.h" */
-GType gst_rtsp_result_get_type (void);
-#define GST_TYPE_RTSP_RESULT (gst_rtsp_result_get_type())
-GType gst_rtsp_event_get_type (void);
-#define GST_TYPE_RTSP_EVENT (gst_rtsp_event_get_type())
-GType gst_rtsp_family_get_type (void);
-#define GST_TYPE_RTSP_FAMILY (gst_rtsp_family_get_type())
-GType gst_rtsp_state_get_type (void);
-#define GST_TYPE_RTSP_STATE (gst_rtsp_state_get_type())
-GType gst_rtsp_version_get_type (void);
-#define GST_TYPE_RTSP_VERSION (gst_rtsp_version_get_type())
-GType gst_rtsp_method_get_type (void);
-#define GST_TYPE_RTSP_METHOD (gst_rtsp_method_get_type())
-GType gst_rtsp_auth_method_get_type (void);
-#define GST_TYPE_RTSP_AUTH_METHOD (gst_rtsp_auth_method_get_type())
-GType gst_rtsp_header_field_get_type (void);
-#define GST_TYPE_RTSP_HEADER_FIELD (gst_rtsp_header_field_get_type())
-GType gst_rtsp_status_code_get_type (void);
-#define GST_TYPE_RTSP_STATUS_CODE (gst_rtsp_status_code_get_type())
-G_END_DECLS
-
-#endif /* __gst_rtsp_ENUM_TYPES_H__ */
-
-/* Generated data ends here */
-
diff --git a/win32/common/interfaces-enumtypes.c b/win32/common/interfaces-enumtypes.c
deleted file mode 100644
index 3213b811..00000000
--- a/win32/common/interfaces-enumtypes.c
+++ /dev/null
@@ -1,276 +0,0 @@
-
-/* Generated data (by glib-mkenums) */
-
-#include "interfaces-enumtypes.h"
-
-#include "colorbalance.h"
-#include "colorbalancechannel.h"
-#include "mixer.h"
-#include "mixeroptions.h"
-#include "mixertrack.h"
-#include "navigation.h"
-#include "propertyprobe.h"
-#include "streamvolume.h"
-#include "tuner.h"
-#include "tunernorm.h"
-#include "tunerchannel.h"
-#include "videoorientation.h"
-#include "xoverlay.h"
-
-/* enumerations from "colorbalance.h" */
-GType
-gst_color_balance_type_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_COLOR_BALANCE_HARDWARE, "GST_COLOR_BALANCE_HARDWARE", "hardware"},
- {GST_COLOR_BALANCE_SOFTWARE, "GST_COLOR_BALANCE_SOFTWARE", "software"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_enum_register_static ("GstColorBalanceType", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-/* enumerations from "mixer.h" */
-GType
-gst_mixer_type_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_MIXER_HARDWARE, "GST_MIXER_HARDWARE", "hardware"},
- {GST_MIXER_SOFTWARE, "GST_MIXER_SOFTWARE", "software"},
- {0, NULL, NULL}
- };
- GType g_define_type_id = g_enum_register_static ("GstMixerType", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-GType
-gst_mixer_message_type_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_MIXER_MESSAGE_INVALID, "GST_MIXER_MESSAGE_INVALID", "invalid"},
- {GST_MIXER_MESSAGE_MUTE_TOGGLED, "GST_MIXER_MESSAGE_MUTE_TOGGLED",
- "mute-toggled"},
- {GST_MIXER_MESSAGE_RECORD_TOGGLED, "GST_MIXER_MESSAGE_RECORD_TOGGLED",
- "record-toggled"},
- {GST_MIXER_MESSAGE_VOLUME_CHANGED, "GST_MIXER_MESSAGE_VOLUME_CHANGED",
- "volume-changed"},
- {GST_MIXER_MESSAGE_OPTION_CHANGED, "GST_MIXER_MESSAGE_OPTION_CHANGED",
- "option-changed"},
- {GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED,
- "GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED", "options-list-changed"},
- {GST_MIXER_MESSAGE_MIXER_CHANGED, "GST_MIXER_MESSAGE_MIXER_CHANGED",
- "mixer-changed"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_enum_register_static ("GstMixerMessageType", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-GType
-gst_mixer_flags_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GFlagsValue values[] = {
- {GST_MIXER_FLAG_NONE, "GST_MIXER_FLAG_NONE", "none"},
- {GST_MIXER_FLAG_AUTO_NOTIFICATIONS, "GST_MIXER_FLAG_AUTO_NOTIFICATIONS",
- "auto-notifications"},
- {GST_MIXER_FLAG_HAS_WHITELIST, "GST_MIXER_FLAG_HAS_WHITELIST",
- "has-whitelist"},
- {GST_MIXER_FLAG_GROUPING, "GST_MIXER_FLAG_GROUPING", "grouping"},
- {0, NULL, NULL}
- };
- GType g_define_type_id = g_flags_register_static ("GstMixerFlags", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-/* enumerations from "mixertrack.h" */
-GType
-gst_mixer_track_flags_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GFlagsValue values[] = {
- {GST_MIXER_TRACK_INPUT, "GST_MIXER_TRACK_INPUT", "input"},
- {GST_MIXER_TRACK_OUTPUT, "GST_MIXER_TRACK_OUTPUT", "output"},
- {GST_MIXER_TRACK_MUTE, "GST_MIXER_TRACK_MUTE", "mute"},
- {GST_MIXER_TRACK_RECORD, "GST_MIXER_TRACK_RECORD", "record"},
- {GST_MIXER_TRACK_MASTER, "GST_MIXER_TRACK_MASTER", "master"},
- {GST_MIXER_TRACK_SOFTWARE, "GST_MIXER_TRACK_SOFTWARE", "software"},
- {GST_MIXER_TRACK_NO_RECORD, "GST_MIXER_TRACK_NO_RECORD", "no-record"},
- {GST_MIXER_TRACK_NO_MUTE, "GST_MIXER_TRACK_NO_MUTE", "no-mute"},
- {GST_MIXER_TRACK_WHITELIST, "GST_MIXER_TRACK_WHITELIST", "whitelist"},
- {GST_MIXER_TRACK_READONLY, "GST_MIXER_TRACK_READONLY", "readonly"},
- {GST_MIXER_TRACK_WRITEONLY, "GST_MIXER_TRACK_WRITEONLY", "writeonly"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_flags_register_static ("GstMixerTrackFlags", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-/* enumerations from "navigation.h" */
-GType
-gst_navigation_command_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_NAVIGATION_COMMAND_INVALID, "GST_NAVIGATION_COMMAND_INVALID",
- "invalid"},
- {GST_NAVIGATION_COMMAND_MENU1, "GST_NAVIGATION_COMMAND_MENU1", "menu1"},
- {GST_NAVIGATION_COMMAND_MENU2, "GST_NAVIGATION_COMMAND_MENU2", "menu2"},
- {GST_NAVIGATION_COMMAND_MENU3, "GST_NAVIGATION_COMMAND_MENU3", "menu3"},
- {GST_NAVIGATION_COMMAND_MENU4, "GST_NAVIGATION_COMMAND_MENU4", "menu4"},
- {GST_NAVIGATION_COMMAND_MENU5, "GST_NAVIGATION_COMMAND_MENU5", "menu5"},
- {GST_NAVIGATION_COMMAND_MENU6, "GST_NAVIGATION_COMMAND_MENU6", "menu6"},
- {GST_NAVIGATION_COMMAND_MENU7, "GST_NAVIGATION_COMMAND_MENU7", "menu7"},
- {GST_NAVIGATION_COMMAND_LEFT, "GST_NAVIGATION_COMMAND_LEFT", "left"},
- {GST_NAVIGATION_COMMAND_RIGHT, "GST_NAVIGATION_COMMAND_RIGHT", "right"},
- {GST_NAVIGATION_COMMAND_UP, "GST_NAVIGATION_COMMAND_UP", "up"},
- {GST_NAVIGATION_COMMAND_DOWN, "GST_NAVIGATION_COMMAND_DOWN", "down"},
- {GST_NAVIGATION_COMMAND_ACTIVATE, "GST_NAVIGATION_COMMAND_ACTIVATE",
- "activate"},
- {GST_NAVIGATION_COMMAND_PREV_ANGLE, "GST_NAVIGATION_COMMAND_PREV_ANGLE",
- "prev-angle"},
- {GST_NAVIGATION_COMMAND_NEXT_ANGLE, "GST_NAVIGATION_COMMAND_NEXT_ANGLE",
- "next-angle"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_enum_register_static ("GstNavigationCommand", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-GType
-gst_navigation_query_type_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_NAVIGATION_QUERY_INVALID, "GST_NAVIGATION_QUERY_INVALID", "invalid"},
- {GST_NAVIGATION_QUERY_COMMANDS, "GST_NAVIGATION_QUERY_COMMANDS",
- "commands"},
- {GST_NAVIGATION_QUERY_ANGLES, "GST_NAVIGATION_QUERY_ANGLES", "angles"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_enum_register_static ("GstNavigationQueryType", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-GType
-gst_navigation_message_type_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_NAVIGATION_MESSAGE_INVALID, "GST_NAVIGATION_MESSAGE_INVALID",
- "invalid"},
- {GST_NAVIGATION_MESSAGE_MOUSE_OVER, "GST_NAVIGATION_MESSAGE_MOUSE_OVER",
- "mouse-over"},
- {GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED,
- "GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED", "commands-changed"},
- {GST_NAVIGATION_MESSAGE_ANGLES_CHANGED,
- "GST_NAVIGATION_MESSAGE_ANGLES_CHANGED", "angles-changed"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_enum_register_static ("GstNavigationMessageType", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-GType
-gst_navigation_event_type_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_NAVIGATION_EVENT_INVALID, "GST_NAVIGATION_EVENT_INVALID", "invalid"},
- {GST_NAVIGATION_EVENT_KEY_PRESS, "GST_NAVIGATION_EVENT_KEY_PRESS",
- "key-press"},
- {GST_NAVIGATION_EVENT_KEY_RELEASE, "GST_NAVIGATION_EVENT_KEY_RELEASE",
- "key-release"},
- {GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS,
- "GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS", "mouse-button-press"},
- {GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE,
- "GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE",
- "mouse-button-release"},
- {GST_NAVIGATION_EVENT_MOUSE_MOVE, "GST_NAVIGATION_EVENT_MOUSE_MOVE",
- "mouse-move"},
- {GST_NAVIGATION_EVENT_COMMAND, "GST_NAVIGATION_EVENT_COMMAND", "command"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_enum_register_static ("GstNavigationEventType", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-/* enumerations from "streamvolume.h" */
-GType
-gst_stream_volume_format_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_STREAM_VOLUME_FORMAT_LINEAR, "GST_STREAM_VOLUME_FORMAT_LINEAR",
- "linear"},
- {GST_STREAM_VOLUME_FORMAT_CUBIC, "GST_STREAM_VOLUME_FORMAT_CUBIC",
- "cubic"},
- {GST_STREAM_VOLUME_FORMAT_DB, "GST_STREAM_VOLUME_FORMAT_DB", "db"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_enum_register_static ("GstStreamVolumeFormat", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-/* enumerations from "tunerchannel.h" */
-GType
-gst_tuner_channel_flags_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GFlagsValue values[] = {
- {GST_TUNER_CHANNEL_INPUT, "GST_TUNER_CHANNEL_INPUT", "input"},
- {GST_TUNER_CHANNEL_OUTPUT, "GST_TUNER_CHANNEL_OUTPUT", "output"},
- {GST_TUNER_CHANNEL_FREQUENCY, "GST_TUNER_CHANNEL_FREQUENCY", "frequency"},
- {GST_TUNER_CHANNEL_AUDIO, "GST_TUNER_CHANNEL_AUDIO", "audio"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_flags_register_static ("GstTunerChannelFlags", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-/* Generated data ends here */
diff --git a/win32/common/interfaces-enumtypes.h b/win32/common/interfaces-enumtypes.h
deleted file mode 100644
index 3c6960f0..00000000
--- a/win32/common/interfaces-enumtypes.h
+++ /dev/null
@@ -1,49 +0,0 @@
-
-/* Generated data (by glib-mkenums) */
-
-#ifndef __GST_INTERFACES_ENUM_TYPES_H__
-#define __GST_INTERFACES_ENUM_TYPES_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-/* enumerations from "colorbalance.h" */
-GType gst_color_balance_type_get_type (void);
-#define GST_TYPE_COLOR_BALANCE_TYPE (gst_color_balance_type_get_type())
-
-/* enumerations from "mixer.h" */
-GType gst_mixer_type_get_type (void);
-#define GST_TYPE_MIXER_TYPE (gst_mixer_type_get_type())
-GType gst_mixer_message_type_get_type (void);
-#define GST_TYPE_MIXER_MESSAGE_TYPE (gst_mixer_message_type_get_type())
-GType gst_mixer_flags_get_type (void);
-#define GST_TYPE_MIXER_FLAGS (gst_mixer_flags_get_type())
-
-/* enumerations from "mixertrack.h" */
-GType gst_mixer_track_flags_get_type (void);
-#define GST_TYPE_MIXER_TRACK_FLAGS (gst_mixer_track_flags_get_type())
-
-/* enumerations from "navigation.h" */
-GType gst_navigation_command_get_type (void);
-#define GST_TYPE_NAVIGATION_COMMAND (gst_navigation_command_get_type())
-GType gst_navigation_query_type_get_type (void);
-#define GST_TYPE_NAVIGATION_QUERY_TYPE (gst_navigation_query_type_get_type())
-GType gst_navigation_message_type_get_type (void);
-#define GST_TYPE_NAVIGATION_MESSAGE_TYPE (gst_navigation_message_type_get_type())
-GType gst_navigation_event_type_get_type (void);
-#define GST_TYPE_NAVIGATION_EVENT_TYPE (gst_navigation_event_type_get_type())
-
-/* enumerations from "streamvolume.h" */
-GType gst_stream_volume_format_get_type (void);
-#define GST_TYPE_STREAM_VOLUME_FORMAT (gst_stream_volume_format_get_type())
-
-/* enumerations from "tunerchannel.h" */
-GType gst_tuner_channel_flags_get_type (void);
-#define GST_TYPE_TUNER_CHANNEL_FLAGS (gst_tuner_channel_flags_get_type())
-G_END_DECLS
-
-#endif /* __GST_INTERFACES_ENUM_TYPES_H__ */
-
-/* Generated data ends here */
-
diff --git a/win32/common/libgstapp.def b/win32/common/libgstapp.def
deleted file mode 100644
index 9b1aa243..00000000
--- a/win32/common/libgstapp.def
+++ /dev/null
@@ -1,33 +0,0 @@
-EXPORTS
- gst_app_buffer_get_type
- gst_app_buffer_new
- gst_app_sink_get_caps
- gst_app_sink_get_drop
- gst_app_sink_get_emit_signals
- gst_app_sink_get_max_buffers
- gst_app_sink_get_type
- gst_app_sink_is_eos
- gst_app_sink_pull_buffer
- gst_app_sink_pull_buffer_list
- gst_app_sink_pull_preroll
- gst_app_sink_set_callbacks
- gst_app_sink_set_caps
- gst_app_sink_set_drop
- gst_app_sink_set_emit_signals
- gst_app_sink_set_max_buffers
- gst_app_src_end_of_stream
- gst_app_src_get_caps
- gst_app_src_get_emit_signals
- gst_app_src_get_latency
- gst_app_src_get_max_bytes
- gst_app_src_get_size
- gst_app_src_get_stream_type
- gst_app_src_get_type
- gst_app_src_push_buffer
- gst_app_src_set_callbacks
- gst_app_src_set_caps
- gst_app_src_set_emit_signals
- gst_app_src_set_latency
- gst_app_src_set_max_bytes
- gst_app_src_set_size
- gst_app_src_set_stream_type
diff --git a/win32/common/libgstaudio.def b/win32/common/libgstaudio.def
deleted file mode 100644
index bade6814..00000000
--- a/win32/common/libgstaudio.def
+++ /dev/null
@@ -1,71 +0,0 @@
-EXPORTS
- gst_audio_buffer_clip
- gst_audio_channel_position_get_type
- gst_audio_check_channel_positions
- gst_audio_clock_adjust
- gst_audio_clock_get_time
- gst_audio_clock_get_type
- gst_audio_clock_new
- gst_audio_clock_reset
- gst_audio_default_registry_mixer_filter
- gst_audio_duration_from_pad_buffer
- gst_audio_filter_class_add_pad_templates
- gst_audio_filter_get_type
- gst_audio_fixate_channel_positions
- gst_audio_frame_byte_size
- gst_audio_frame_length
- gst_audio_get_channel_positions
- gst_audio_is_buffer_framed
- gst_audio_set_caps_channel_positions_list
- gst_audio_set_channel_positions
- gst_audio_set_structure_channel_positions_list
- gst_audio_sink_get_type
- gst_audio_src_get_type
- gst_audio_structure_set_int
- gst_base_audio_sink_create_ringbuffer
- gst_base_audio_sink_get_provide_clock
- gst_base_audio_sink_get_slave_method
- gst_base_audio_sink_get_type
- gst_base_audio_sink_set_provide_clock
- gst_base_audio_sink_set_slave_method
- gst_base_audio_sink_slave_method_get_type
- gst_base_audio_src_create_ringbuffer
- gst_base_audio_src_get_provide_clock
- gst_base_audio_src_get_slave_method
- gst_base_audio_src_get_type
- gst_base_audio_src_set_provide_clock
- gst_base_audio_src_set_slave_method
- gst_base_audio_src_slave_method_get_type
- gst_buffer_format_get_type
- gst_buffer_format_type_get_type
- gst_ring_buffer_acquire
- gst_ring_buffer_activate
- gst_ring_buffer_advance
- gst_ring_buffer_clear
- gst_ring_buffer_clear_all
- gst_ring_buffer_close_device
- gst_ring_buffer_commit
- gst_ring_buffer_commit_full
- gst_ring_buffer_convert
- gst_ring_buffer_debug_spec_buff
- gst_ring_buffer_debug_spec_caps
- gst_ring_buffer_delay
- gst_ring_buffer_device_is_open
- gst_ring_buffer_get_type
- gst_ring_buffer_is_acquired
- gst_ring_buffer_is_active
- gst_ring_buffer_may_start
- gst_ring_buffer_open_device
- gst_ring_buffer_parse_caps
- gst_ring_buffer_pause
- gst_ring_buffer_prepare_read
- gst_ring_buffer_read
- gst_ring_buffer_release
- gst_ring_buffer_samples_done
- gst_ring_buffer_seg_state_get_type
- gst_ring_buffer_set_callback
- gst_ring_buffer_set_flushing
- gst_ring_buffer_set_sample
- gst_ring_buffer_start
- gst_ring_buffer_state_get_type
- gst_ring_buffer_stop
diff --git a/win32/common/libgstcdda.def b/win32/common/libgstcdda.def
deleted file mode 100644
index 736f61c5..00000000
--- a/win32/common/libgstcdda.def
+++ /dev/null
@@ -1,4 +0,0 @@
-EXPORTS
- gst_cdda_base_src_add_track
- gst_cdda_base_src_get_type
- gst_cdda_base_src_mode_get_type
diff --git a/win32/common/libgstinterfaces.def b/win32/common/libgstinterfaces.def
deleted file mode 100644
index 37f3c05e..00000000
--- a/win32/common/libgstinterfaces.def
+++ /dev/null
@@ -1,119 +0,0 @@
-EXPORTS
- gst_color_balance_channel_get_type
- gst_color_balance_get_balance_type
- gst_color_balance_get_type
- gst_color_balance_get_value
- gst_color_balance_list_channels
- gst_color_balance_set_value
- gst_color_balance_type_get_type
- gst_color_balance_value_changed
- gst_mixer_flags_get_type
- gst_mixer_get_mixer_flags
- gst_mixer_get_mixer_type
- gst_mixer_get_option
- gst_mixer_get_type
- gst_mixer_get_volume
- gst_mixer_list_tracks
- gst_mixer_message_get_type
- gst_mixer_message_parse_mute_toggled
- gst_mixer_message_parse_option_changed
- gst_mixer_message_parse_options_list_changed
- gst_mixer_message_parse_record_toggled
- gst_mixer_message_parse_volume_changed
- gst_mixer_message_type_get_type
- gst_mixer_mixer_changed
- gst_mixer_mute_toggled
- gst_mixer_option_changed
- gst_mixer_options_get_type
- gst_mixer_options_get_values
- gst_mixer_options_list_changed
- gst_mixer_record_toggled
- gst_mixer_set_mute
- gst_mixer_set_option
- gst_mixer_set_record
- gst_mixer_set_volume
- gst_mixer_track_flags_get_type
- gst_mixer_track_get_type
- gst_mixer_type_get_type
- gst_mixer_volume_changed
- gst_navigation_command_get_type
- gst_navigation_event_get_type
- gst_navigation_event_parse_command
- gst_navigation_event_parse_key_event
- gst_navigation_event_parse_mouse_button_event
- gst_navigation_event_parse_mouse_move_event
- gst_navigation_event_type_get_type
- gst_navigation_get_type
- gst_navigation_message_get_type
- gst_navigation_message_new_angles_changed
- gst_navigation_message_new_commands_changed
- gst_navigation_message_new_mouse_over
- gst_navigation_message_parse_angles_changed
- gst_navigation_message_parse_mouse_over
- gst_navigation_message_type_get_type
- gst_navigation_query_get_type
- gst_navigation_query_new_angles
- gst_navigation_query_new_commands
- gst_navigation_query_parse_angles
- gst_navigation_query_parse_commands_length
- gst_navigation_query_parse_commands_nth
- gst_navigation_query_set_angles
- gst_navigation_query_set_commands
- gst_navigation_query_set_commandsv
- gst_navigation_query_type_get_type
- gst_navigation_send_command
- gst_navigation_send_event
- gst_navigation_send_key_event
- gst_navigation_send_mouse_event
- gst_property_probe_get_properties
- gst_property_probe_get_property
- gst_property_probe_get_type
- gst_property_probe_get_values
- gst_property_probe_get_values_name
- gst_property_probe_needs_probe
- gst_property_probe_needs_probe_name
- gst_property_probe_probe_and_get_values
- gst_property_probe_probe_and_get_values_name
- gst_property_probe_probe_property
- gst_property_probe_probe_property_name
- gst_stream_volume_convert_volume
- gst_stream_volume_format_get_type
- gst_stream_volume_get_mute
- gst_stream_volume_get_type
- gst_stream_volume_get_volume
- gst_stream_volume_set_mute
- gst_stream_volume_set_volume
- gst_tuner_channel_changed
- gst_tuner_channel_flags_get_type
- gst_tuner_channel_get_type
- gst_tuner_find_channel_by_name
- gst_tuner_find_norm_by_name
- gst_tuner_frequency_changed
- gst_tuner_get_channel
- gst_tuner_get_frequency
- gst_tuner_get_norm
- gst_tuner_get_type
- gst_tuner_list_channels
- gst_tuner_list_norms
- gst_tuner_norm_changed
- gst_tuner_norm_get_type
- gst_tuner_set_channel
- gst_tuner_set_frequency
- gst_tuner_set_norm
- gst_tuner_signal_changed
- gst_tuner_signal_strength
- gst_video_orientation_get_hcenter
- gst_video_orientation_get_hflip
- gst_video_orientation_get_type
- gst_video_orientation_get_vcenter
- gst_video_orientation_get_vflip
- gst_video_orientation_set_hcenter
- gst_video_orientation_set_hflip
- gst_video_orientation_set_vcenter
- gst_video_orientation_set_vflip
- gst_x_overlay_expose
- gst_x_overlay_get_type
- gst_x_overlay_got_xwindow_id
- gst_x_overlay_handle_events
- gst_x_overlay_prepare_xwindow_id
- gst_x_overlay_set_xwindow_id
diff --git a/win32/common/libgstnetbuffer.def b/win32/common/libgstnetbuffer.def
deleted file mode 100644
index bd6f8c77..00000000
--- a/win32/common/libgstnetbuffer.def
+++ /dev/null
@@ -1,12 +0,0 @@
-EXPORTS
- gst_netaddress_equal
- gst_netaddress_get_address_bytes
- gst_netaddress_get_ip4_address
- gst_netaddress_get_ip6_address
- gst_netaddress_get_net_type
- gst_netaddress_set_address_bytes
- gst_netaddress_set_ip4_address
- gst_netaddress_set_ip6_address
- gst_netaddress_to_string
- gst_netbuffer_get_type
- gst_netbuffer_new
diff --git a/win32/common/libgstpbutils.def b/win32/common/libgstpbutils.def
deleted file mode 100644
index 7f4d71b9..00000000
--- a/win32/common/libgstpbutils.def
+++ /dev/null
@@ -1,32 +0,0 @@
-EXPORTS
- gst_install_plugins_async
- gst_install_plugins_context_free
- gst_install_plugins_context_get_type
- gst_install_plugins_context_new
- gst_install_plugins_context_set_xid
- gst_install_plugins_installation_in_progress
- gst_install_plugins_return_get_name
- gst_install_plugins_return_get_type
- gst_install_plugins_supported
- gst_install_plugins_sync
- gst_is_missing_plugin_message
- gst_missing_decoder_installer_detail_new
- gst_missing_decoder_message_new
- gst_missing_element_installer_detail_new
- gst_missing_element_message_new
- gst_missing_encoder_installer_detail_new
- gst_missing_encoder_message_new
- gst_missing_plugin_message_get_description
- gst_missing_plugin_message_get_installer_detail
- gst_missing_uri_sink_installer_detail_new
- gst_missing_uri_sink_message_new
- gst_missing_uri_source_installer_detail_new
- gst_missing_uri_source_message_new
- gst_pb_utils_add_codec_description_to_tag_list
- gst_pb_utils_get_codec_description
- gst_pb_utils_get_decoder_description
- gst_pb_utils_get_element_description
- gst_pb_utils_get_encoder_description
- gst_pb_utils_get_sink_description
- gst_pb_utils_get_source_description
- gst_pb_utils_init
diff --git a/win32/common/libgstriff.def b/win32/common/libgstriff.def
deleted file mode 100644
index e5661071..00000000
--- a/win32/common/libgstriff.def
+++ /dev/null
@@ -1,16 +0,0 @@
-EXPORTS
- gst_riff_create_audio_caps
- gst_riff_create_audio_template_caps
- gst_riff_create_iavs_caps
- gst_riff_create_iavs_template_caps
- gst_riff_create_video_caps
- gst_riff_create_video_template_caps
- gst_riff_init
- gst_riff_parse_chunk
- gst_riff_parse_file_header
- gst_riff_parse_info
- gst_riff_parse_strf_auds
- gst_riff_parse_strf_iavs
- gst_riff_parse_strf_vids
- gst_riff_parse_strh
- gst_riff_read_chunk
diff --git a/win32/common/libgstrtp.def b/win32/common/libgstrtp.def
deleted file mode 100644
index 420f6692..00000000
--- a/win32/common/libgstrtp.def
+++ /dev/null
@@ -1,123 +0,0 @@
-EXPORTS
- gst_base_rtp_audio_payload_flush
- gst_base_rtp_audio_payload_get_adapter
- gst_base_rtp_audio_payload_get_type
- gst_base_rtp_audio_payload_push
- gst_base_rtp_audio_payload_set_frame_based
- gst_base_rtp_audio_payload_set_frame_options
- gst_base_rtp_audio_payload_set_sample_based
- gst_base_rtp_audio_payload_set_sample_options
- gst_base_rtp_audio_payload_set_samplebits_options
- gst_base_rtp_depayload_get_type
- gst_base_rtp_depayload_push
- gst_base_rtp_depayload_push_ts
- gst_basertppayload_get_type
- gst_basertppayload_is_filled
- gst_basertppayload_push
- gst_basertppayload_push_list
- gst_basertppayload_set_options
- gst_basertppayload_set_outcaps
- gst_rtcp_buffer_add_packet
- gst_rtcp_buffer_end
- gst_rtcp_buffer_get_first_packet
- gst_rtcp_buffer_get_packet_count
- gst_rtcp_buffer_new
- gst_rtcp_buffer_new_copy_data
- gst_rtcp_buffer_new_take_data
- gst_rtcp_buffer_validate
- gst_rtcp_buffer_validate_data
- gst_rtcp_ntp_to_unix
- gst_rtcp_packet_add_rb
- gst_rtcp_packet_bye_add_ssrc
- gst_rtcp_packet_bye_add_ssrcs
- gst_rtcp_packet_bye_get_nth_ssrc
- gst_rtcp_packet_bye_get_reason
- gst_rtcp_packet_bye_get_reason_len
- gst_rtcp_packet_bye_get_ssrc_count
- gst_rtcp_packet_bye_set_reason
- gst_rtcp_packet_fb_get_media_ssrc
- gst_rtcp_packet_fb_get_sender_ssrc
- gst_rtcp_packet_fb_get_type
- gst_rtcp_packet_fb_set_media_ssrc
- gst_rtcp_packet_fb_set_sender_ssrc
- gst_rtcp_packet_fb_set_type
- gst_rtcp_packet_get_count
- gst_rtcp_packet_get_length
- gst_rtcp_packet_get_padding
- gst_rtcp_packet_get_rb
- gst_rtcp_packet_get_rb_count
- gst_rtcp_packet_get_type
- gst_rtcp_packet_move_to_next
- gst_rtcp_packet_remove
- gst_rtcp_packet_rr_get_ssrc
- gst_rtcp_packet_rr_set_ssrc
- gst_rtcp_packet_sdes_add_entry
- gst_rtcp_packet_sdes_add_item
- gst_rtcp_packet_sdes_copy_entry
- gst_rtcp_packet_sdes_first_entry
- gst_rtcp_packet_sdes_first_item
- gst_rtcp_packet_sdes_get_entry
- gst_rtcp_packet_sdes_get_item_count
- gst_rtcp_packet_sdes_get_ssrc
- gst_rtcp_packet_sdes_next_entry
- gst_rtcp_packet_sdes_next_item
- gst_rtcp_packet_set_rb
- gst_rtcp_packet_sr_get_sender_info
- gst_rtcp_packet_sr_set_sender_info
- gst_rtcp_sdes_name_to_type
- gst_rtcp_sdes_type_to_name
- gst_rtcp_unix_to_ntp
- gst_rtp_buffer_allocate_data
- gst_rtp_buffer_calc_header_len
- gst_rtp_buffer_calc_packet_len
- gst_rtp_buffer_calc_payload_len
- gst_rtp_buffer_compare_seqnum
- gst_rtp_buffer_default_clock_rate
- gst_rtp_buffer_ext_timestamp
- gst_rtp_buffer_get_csrc
- gst_rtp_buffer_get_csrc_count
- gst_rtp_buffer_get_extension
- gst_rtp_buffer_get_extension_data
- gst_rtp_buffer_get_header_len
- gst_rtp_buffer_get_marker
- gst_rtp_buffer_get_packet_len
- gst_rtp_buffer_get_padding
- gst_rtp_buffer_get_payload
- gst_rtp_buffer_get_payload_buffer
- gst_rtp_buffer_get_payload_len
- gst_rtp_buffer_get_payload_subbuffer
- gst_rtp_buffer_get_payload_type
- gst_rtp_buffer_get_seq
- gst_rtp_buffer_get_ssrc
- gst_rtp_buffer_get_timestamp
- gst_rtp_buffer_get_version
- gst_rtp_buffer_list_get_payload_len
- gst_rtp_buffer_list_get_payload_type
- gst_rtp_buffer_list_get_seq
- gst_rtp_buffer_list_get_ssrc
- gst_rtp_buffer_list_get_timestamp
- gst_rtp_buffer_list_set_payload_type
- gst_rtp_buffer_list_set_seq
- gst_rtp_buffer_list_set_ssrc
- gst_rtp_buffer_list_set_timestamp
- gst_rtp_buffer_list_validate
- gst_rtp_buffer_new_allocate
- gst_rtp_buffer_new_allocate_len
- gst_rtp_buffer_new_copy_data
- gst_rtp_buffer_new_take_data
- gst_rtp_buffer_pad_to
- gst_rtp_buffer_set_csrc
- gst_rtp_buffer_set_extension
- gst_rtp_buffer_set_extension_data
- gst_rtp_buffer_set_marker
- gst_rtp_buffer_set_packet_len
- gst_rtp_buffer_set_padding
- gst_rtp_buffer_set_payload_type
- gst_rtp_buffer_set_seq
- gst_rtp_buffer_set_ssrc
- gst_rtp_buffer_set_timestamp
- gst_rtp_buffer_set_version
- gst_rtp_buffer_validate
- gst_rtp_buffer_validate_data
- gst_rtp_payload_info_for_name
- gst_rtp_payload_info_for_pt
diff --git a/win32/common/libgstrtsp.def b/win32/common/libgstrtsp.def
deleted file mode 100644
index 8d5ffe31..00000000
--- a/win32/common/libgstrtsp.def
+++ /dev/null
@@ -1,111 +0,0 @@
-EXPORTS
- gst_rtsp_auth_method_get_type
- gst_rtsp_base64_decode_ip
- gst_rtsp_base64_encode
- gst_rtsp_connection_accept
- gst_rtsp_connection_clear_auth_params
- gst_rtsp_connection_close
- gst_rtsp_connection_connect
- gst_rtsp_connection_create
- gst_rtsp_connection_create_from_fd
- gst_rtsp_connection_do_tunnel
- gst_rtsp_connection_flush
- gst_rtsp_connection_free
- gst_rtsp_connection_get_ip
- gst_rtsp_connection_get_readfd
- gst_rtsp_connection_get_tunnelid
- gst_rtsp_connection_get_url
- gst_rtsp_connection_get_writefd
- gst_rtsp_connection_is_tunneled
- gst_rtsp_connection_next_timeout
- gst_rtsp_connection_poll
- gst_rtsp_connection_read
- gst_rtsp_connection_receive
- gst_rtsp_connection_reset_timeout
- gst_rtsp_connection_send
- gst_rtsp_connection_set_auth
- gst_rtsp_connection_set_auth_param
- gst_rtsp_connection_set_http_mode
- gst_rtsp_connection_set_ip
- gst_rtsp_connection_set_proxy
- gst_rtsp_connection_set_qos_dscp
- gst_rtsp_connection_set_tunneled
- gst_rtsp_connection_write
- gst_rtsp_event_get_type
- gst_rtsp_extension_after_send
- gst_rtsp_extension_before_send
- gst_rtsp_extension_configure_stream
- gst_rtsp_extension_detect_server
- gst_rtsp_extension_get_transports
- gst_rtsp_extension_get_type
- gst_rtsp_extension_parse_sdp
- gst_rtsp_extension_receive_request
- gst_rtsp_extension_send
- gst_rtsp_extension_setup_media
- gst_rtsp_extension_stream_select
- gst_rtsp_family_get_type
- gst_rtsp_find_header_field
- gst_rtsp_find_method
- gst_rtsp_header_allow_multiple
- gst_rtsp_header_as_text
- gst_rtsp_header_field_get_type
- gst_rtsp_marshal_ENUM__POINTER_POINTER
- gst_rtsp_message_add_header
- gst_rtsp_message_append_headers
- gst_rtsp_message_dump
- gst_rtsp_message_free
- gst_rtsp_message_get_body
- gst_rtsp_message_get_header
- gst_rtsp_message_get_type
- gst_rtsp_message_init
- gst_rtsp_message_init_data
- gst_rtsp_message_init_request
- gst_rtsp_message_init_response
- gst_rtsp_message_new
- gst_rtsp_message_new_data
- gst_rtsp_message_new_request
- gst_rtsp_message_new_response
- gst_rtsp_message_parse_data
- gst_rtsp_message_parse_request
- gst_rtsp_message_parse_response
- gst_rtsp_message_remove_header
- gst_rtsp_message_set_body
- gst_rtsp_message_steal_body
- gst_rtsp_message_take_body
- gst_rtsp_message_take_header
- gst_rtsp_message_unset
- gst_rtsp_method_as_text
- gst_rtsp_method_get_type
- gst_rtsp_options_as_text
- gst_rtsp_range_free
- gst_rtsp_range_parse
- gst_rtsp_range_to_string
- gst_rtsp_result_get_type
- gst_rtsp_state_get_type
- gst_rtsp_status_as_text
- gst_rtsp_status_code_get_type
- gst_rtsp_strresult
- gst_rtsp_transport_as_text
- gst_rtsp_transport_free
- gst_rtsp_transport_get_manager
- gst_rtsp_transport_get_mime
- gst_rtsp_transport_init
- gst_rtsp_transport_new
- gst_rtsp_transport_parse
- gst_rtsp_url_copy
- gst_rtsp_url_free
- gst_rtsp_url_get_port
- gst_rtsp_url_get_request_uri
- gst_rtsp_url_get_type
- gst_rtsp_url_parse
- gst_rtsp_url_set_port
- gst_rtsp_version_as_text
- gst_rtsp_version_get_type
- gst_rtsp_watch_attach
- gst_rtsp_watch_new
- gst_rtsp_watch_queue_data
- gst_rtsp_watch_queue_message
- gst_rtsp_watch_reset
- gst_rtsp_watch_send_message
- gst_rtsp_watch_unref
- gst_rtsp_watch_write_data
diff --git a/win32/common/libgstsdp.def b/win32/common/libgstsdp.def
deleted file mode 100644
index 7b9cb916..00000000
--- a/win32/common/libgstsdp.def
+++ /dev/null
@@ -1,75 +0,0 @@
-EXPORTS
- gst_sdp_media_add_attribute
- gst_sdp_media_add_bandwidth
- gst_sdp_media_add_connection
- gst_sdp_media_add_format
- gst_sdp_media_as_text
- gst_sdp_media_attributes_len
- gst_sdp_media_bandwidths_len
- gst_sdp_media_connections_len
- gst_sdp_media_formats_len
- gst_sdp_media_free
- gst_sdp_media_get_attribute
- gst_sdp_media_get_attribute_val
- gst_sdp_media_get_attribute_val_n
- gst_sdp_media_get_bandwidth
- gst_sdp_media_get_connection
- gst_sdp_media_get_format
- gst_sdp_media_get_information
- gst_sdp_media_get_key
- gst_sdp_media_get_media
- gst_sdp_media_get_num_ports
- gst_sdp_media_get_port
- gst_sdp_media_get_proto
- gst_sdp_media_init
- gst_sdp_media_new
- gst_sdp_media_set_information
- gst_sdp_media_set_key
- gst_sdp_media_set_media
- gst_sdp_media_set_port_info
- gst_sdp_media_set_proto
- gst_sdp_media_uninit
- gst_sdp_message_add_attribute
- gst_sdp_message_add_bandwidth
- gst_sdp_message_add_email
- gst_sdp_message_add_media
- gst_sdp_message_add_phone
- gst_sdp_message_add_time
- gst_sdp_message_add_zone
- gst_sdp_message_as_text
- gst_sdp_message_attributes_len
- gst_sdp_message_bandwidths_len
- gst_sdp_message_dump
- gst_sdp_message_emails_len
- gst_sdp_message_free
- gst_sdp_message_get_attribute
- gst_sdp_message_get_attribute_val
- gst_sdp_message_get_attribute_val_n
- gst_sdp_message_get_bandwidth
- gst_sdp_message_get_connection
- gst_sdp_message_get_email
- gst_sdp_message_get_information
- gst_sdp_message_get_key
- gst_sdp_message_get_media
- gst_sdp_message_get_origin
- gst_sdp_message_get_phone
- gst_sdp_message_get_session_name
- gst_sdp_message_get_time
- gst_sdp_message_get_uri
- gst_sdp_message_get_version
- gst_sdp_message_get_zone
- gst_sdp_message_init
- gst_sdp_message_medias_len
- gst_sdp_message_new
- gst_sdp_message_parse_buffer
- gst_sdp_message_phones_len
- gst_sdp_message_set_connection
- gst_sdp_message_set_information
- gst_sdp_message_set_key
- gst_sdp_message_set_origin
- gst_sdp_message_set_session_name
- gst_sdp_message_set_uri
- gst_sdp_message_set_version
- gst_sdp_message_times_len
- gst_sdp_message_uninit
- gst_sdp_message_zones_len
diff --git a/win32/common/libgsttag.def b/win32/common/libgsttag.def
deleted file mode 100644
index cbdc4499..00000000
--- a/win32/common/libgsttag.def
+++ /dev/null
@@ -1,26 +0,0 @@
-EXPORTS
- gst_tag_demux_get_type
- gst_tag_demux_result_get_type
- gst_tag_freeform_string_to_utf8
- gst_tag_from_id3_tag
- gst_tag_from_id3_user_tag
- gst_tag_from_vorbis_tag
- gst_tag_get_language_code_iso_639_1
- gst_tag_get_language_code_iso_639_2B
- gst_tag_get_language_code_iso_639_2T
- gst_tag_get_language_codes
- gst_tag_get_language_name
- gst_tag_id3_genre_count
- gst_tag_id3_genre_get
- gst_tag_image_data_to_image_buffer
- gst_tag_image_type_get_type
- gst_tag_list_add_id3_image
- gst_tag_list_from_vorbiscomment_buffer
- gst_tag_list_new_from_id3v1
- gst_tag_list_to_vorbiscomment_buffer
- gst_tag_parse_extended_comment
- gst_tag_register_musicbrainz_tags
- gst_tag_to_id3_tag
- gst_tag_to_vorbis_comments
- gst_tag_to_vorbis_tag
- gst_vorbis_tag_add
diff --git a/win32/common/libgstutils.def b/win32/common/libgstutils.def
deleted file mode 100644
index 5306c6bf..00000000
--- a/win32/common/libgstutils.def
+++ /dev/null
@@ -1,8 +0,0 @@
-EXPORTS
- gst_pb_utils_init
- gst_pb_utils_get_source_description
- gst_is_missing_plugin_message
- gst_missing_decoder_message_new
- gst_missing_element_message_new
- gst_missing_plugin_message_get_installer_detail
- gst_missing_uri_source_message_new
diff --git a/win32/common/libgstvideo.def b/win32/common/libgstvideo.def
deleted file mode 100644
index f2fc06dd..00000000
--- a/win32/common/libgstvideo.def
+++ /dev/null
@@ -1,28 +0,0 @@
-EXPORTS
- gst_video_calculate_display_ratio
- gst_video_event_new_still_frame
- gst_video_event_parse_still_frame
- gst_video_filter_get_type
- gst_video_format_convert
- gst_video_format_from_fourcc
- gst_video_format_get_component_height
- gst_video_format_get_component_offset
- gst_video_format_get_component_width
- gst_video_format_get_pixel_stride
- gst_video_format_get_row_stride
- gst_video_format_get_size
- gst_video_format_get_type
- gst_video_format_has_alpha
- gst_video_format_is_rgb
- gst_video_format_is_yuv
- gst_video_format_new_caps
- gst_video_format_new_caps_interlaced
- gst_video_format_parse_caps
- gst_video_format_parse_caps_interlaced
- gst_video_format_to_fourcc
- gst_video_frame_rate
- gst_video_get_size
- gst_video_parse_caps_framerate
- gst_video_parse_caps_pixel_aspect_ratio
- gst_video_sink_center_rect
- gst_video_sink_get_type
diff --git a/win32/common/multichannel-enumtypes.c b/win32/common/multichannel-enumtypes.c
deleted file mode 100644
index d8a64d67..00000000
--- a/win32/common/multichannel-enumtypes.c
+++ /dev/null
@@ -1,53 +0,0 @@
-
-/* Generated data (by glib-mkenums) */
-
-#include "multichannel-enumtypes.h"
-
-#include "multichannel.h"
-
-/* enumerations from "multichannel.h" */
-GType
-gst_audio_channel_position_get_type (void)
-{
- static GType etype = 0;
-
- if (etype == 0) {
- static const GEnumValue values[] = {
- {GST_AUDIO_CHANNEL_POSITION_INVALID, "GST_AUDIO_CHANNEL_POSITION_INVALID",
- "invalid"},
- {GST_AUDIO_CHANNEL_POSITION_FRONT_MONO,
- "GST_AUDIO_CHANNEL_POSITION_FRONT_MONO", "front-mono"},
- {GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
- "GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT", "front-left"},
- {GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
- "GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT", "front-right"},
- {GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
- "GST_AUDIO_CHANNEL_POSITION_REAR_CENTER", "rear-center"},
- {GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
- "GST_AUDIO_CHANNEL_POSITION_REAR_LEFT", "rear-left"},
- {GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
- "GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT", "rear-right"},
- {GST_AUDIO_CHANNEL_POSITION_LFE, "GST_AUDIO_CHANNEL_POSITION_LFE", "lfe"},
- {GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- "GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER", "front-center"},
- {GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
- "GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER",
- "front-left-of-center"},
- {GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
- "GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER",
- "front-right-of-center"},
- {GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
- "GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT", "side-left"},
- {GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
- "GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT", "side-right"},
- {GST_AUDIO_CHANNEL_POSITION_NONE, "GST_AUDIO_CHANNEL_POSITION_NONE",
- "none"},
- {GST_AUDIO_CHANNEL_POSITION_NUM, "GST_AUDIO_CHANNEL_POSITION_NUM", "num"},
- {0, NULL, NULL}
- };
- etype = g_enum_register_static ("GstAudioChannelPosition", values);
- }
- return etype;
-}
-
-/* Generated data ends here */
diff --git a/win32/common/multichannel-enumtypes.h b/win32/common/multichannel-enumtypes.h
deleted file mode 100644
index f3cc6bdf..00000000
--- a/win32/common/multichannel-enumtypes.h
+++ /dev/null
@@ -1,19 +0,0 @@
-
-/* Generated data (by glib-mkenums) */
-
-#ifndef __GST_AUDIO_ENUM_TYPES_H__
-#define __GST_AUDIO_ENUM_TYPES_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-/* enumerations from "multichannel.h" */
-GType gst_audio_channel_position_get_type (void);
-#define GST_TYPE_AUDIO_CHANNEL_POSITION (gst_audio_channel_position_get_type())
-G_END_DECLS
-
-#endif /* __GST_AUDIO_ENUM_TYPES_H__ */
-
-/* Generated data ends here */
-
diff --git a/win32/common/pbutils-enumtypes.c b/win32/common/pbutils-enumtypes.c
deleted file mode 100644
index 18ae03d9..00000000
--- a/win32/common/pbutils-enumtypes.c
+++ /dev/null
@@ -1,45 +0,0 @@
-
-/* Generated data (by glib-mkenums) */
-
-#include "pbutils-enumtypes.h"
-
-#include "pbutils.h"
-#include "descriptions.h"
-#include "install-plugins.h"
-#include "missing-plugins.h"
-
-/* enumerations from "install-plugins.h" */
-GType
-gst_install_plugins_return_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_INSTALL_PLUGINS_SUCCESS, "GST_INSTALL_PLUGINS_SUCCESS", "success"},
- {GST_INSTALL_PLUGINS_NOT_FOUND, "GST_INSTALL_PLUGINS_NOT_FOUND",
- "not-found"},
- {GST_INSTALL_PLUGINS_ERROR, "GST_INSTALL_PLUGINS_ERROR", "error"},
- {GST_INSTALL_PLUGINS_PARTIAL_SUCCESS,
- "GST_INSTALL_PLUGINS_PARTIAL_SUCCESS", "partial-success"},
- {GST_INSTALL_PLUGINS_USER_ABORT, "GST_INSTALL_PLUGINS_USER_ABORT",
- "user-abort"},
- {GST_INSTALL_PLUGINS_CRASHED, "GST_INSTALL_PLUGINS_CRASHED", "crashed"},
- {GST_INSTALL_PLUGINS_INVALID, "GST_INSTALL_PLUGINS_INVALID", "invalid"},
- {GST_INSTALL_PLUGINS_STARTED_OK, "GST_INSTALL_PLUGINS_STARTED_OK",
- "started-ok"},
- {GST_INSTALL_PLUGINS_INTERNAL_FAILURE,
- "GST_INSTALL_PLUGINS_INTERNAL_FAILURE", "internal-failure"},
- {GST_INSTALL_PLUGINS_HELPER_MISSING, "GST_INSTALL_PLUGINS_HELPER_MISSING",
- "helper-missing"},
- {GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS,
- "GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS", "install-in-progress"},
- {0, NULL, NULL}
- };
- GType g_define_type_id =
- g_enum_register_static ("GstInstallPluginsReturn", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-/* Generated data ends here */
diff --git a/win32/common/pbutils-enumtypes.h b/win32/common/pbutils-enumtypes.h
deleted file mode 100644
index 1b2398a6..00000000
--- a/win32/common/pbutils-enumtypes.h
+++ /dev/null
@@ -1,19 +0,0 @@
-
-/* Generated data (by glib-mkenums) */
-
-#ifndef __GST_INSTALL_ENUM_TYPES_H__
-#define __GST_INSTALL_ENUM_TYPES_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-/* enumerations from "install-plugins.h" */
-GType gst_install_plugins_return_get_type (void);
-#define GST_TYPE_INSTALL_PLUGINS_RETURN (gst_install_plugins_return_get_type())
-G_END_DECLS
-
-#endif /* __GST_INSTALL_ENUM_TYPES_H__ */
-
-/* Generated data ends here */
-
diff --git a/win32/common/video-enumtypes.c b/win32/common/video-enumtypes.c
deleted file mode 100644
index c5b9e46e..00000000
--- a/win32/common/video-enumtypes.c
+++ /dev/null
@@ -1,47 +0,0 @@
-
-/* Generated data (by glib-mkenums) */
-
-#include "video-enumtypes.h"
-
-#include "video.h"
-
-/* enumerations from "video.h" */
-GType
-gst_video_format_get_type (void)
-{
- static volatile gsize g_define_type_id__volatile = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
- static const GEnumValue values[] = {
- {GST_VIDEO_FORMAT_UNKNOWN, "GST_VIDEO_FORMAT_UNKNOWN", "unknown"},
- {GST_VIDEO_FORMAT_I420, "GST_VIDEO_FORMAT_I420", "i420"},
- {GST_VIDEO_FORMAT_YV12, "GST_VIDEO_FORMAT_YV12", "yv12"},
- {GST_VIDEO_FORMAT_YUY2, "GST_VIDEO_FORMAT_YUY2", "yuy2"},
- {GST_VIDEO_FORMAT_UYVY, "GST_VIDEO_FORMAT_UYVY", "uyvy"},
- {GST_VIDEO_FORMAT_AYUV, "GST_VIDEO_FORMAT_AYUV", "ayuv"},
- {GST_VIDEO_FORMAT_RGBx, "GST_VIDEO_FORMAT_RGBx", "rgbx"},
- {GST_VIDEO_FORMAT_BGRx, "GST_VIDEO_FORMAT_BGRx", "bgrx"},
- {GST_VIDEO_FORMAT_xRGB, "GST_VIDEO_FORMAT_xRGB", "xrgb"},
- {GST_VIDEO_FORMAT_xBGR, "GST_VIDEO_FORMAT_xBGR", "xbgr"},
- {GST_VIDEO_FORMAT_RGBA, "GST_VIDEO_FORMAT_RGBA", "rgba"},
- {GST_VIDEO_FORMAT_BGRA, "GST_VIDEO_FORMAT_BGRA", "bgra"},
- {GST_VIDEO_FORMAT_ARGB, "GST_VIDEO_FORMAT_ARGB", "argb"},
- {GST_VIDEO_FORMAT_ABGR, "GST_VIDEO_FORMAT_ABGR", "abgr"},
- {GST_VIDEO_FORMAT_RGB, "GST_VIDEO_FORMAT_RGB", "rgb"},
- {GST_VIDEO_FORMAT_BGR, "GST_VIDEO_FORMAT_BGR", "bgr"},
- {GST_VIDEO_FORMAT_Y41B, "GST_VIDEO_FORMAT_Y41B", "y41b"},
- {GST_VIDEO_FORMAT_Y42B, "GST_VIDEO_FORMAT_Y42B", "y42b"},
- {GST_VIDEO_FORMAT_YVYU, "GST_VIDEO_FORMAT_YVYU", "yvyu"},
- {GST_VIDEO_FORMAT_Y444, "GST_VIDEO_FORMAT_Y444", "y444"},
- {GST_VIDEO_FORMAT_v210, "GST_VIDEO_FORMAT_v210", "v210"},
- {GST_VIDEO_FORMAT_v216, "GST_VIDEO_FORMAT_v216", "v216"},
- {GST_VIDEO_FORMAT_NV12, "GST_VIDEO_FORMAT_NV12", "nv12"},
- {GST_VIDEO_FORMAT_NV21, "GST_VIDEO_FORMAT_NV21", "nv21"},
- {0, NULL, NULL}
- };
- GType g_define_type_id = g_enum_register_static ("GstVideoFormat", values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
- }
- return g_define_type_id__volatile;
-}
-
-/* Generated data ends here */
diff --git a/win32/common/video-enumtypes.h b/win32/common/video-enumtypes.h
deleted file mode 100644
index 3f99b475..00000000
--- a/win32/common/video-enumtypes.h
+++ /dev/null
@@ -1,19 +0,0 @@
-
-/* Generated data (by glib-mkenums) */
-
-#ifndef __GST_VIDEO_ENUM_TYPES_H__
-#define __GST_VIDEO_ENUM_TYPES_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-/* enumerations from "video.h" */
-GType gst_video_format_get_type (void);
-#define GST_TYPE_VIDEO_FORMAT (gst_video_format_get_type())
-G_END_DECLS
-
-#endif /* __GST_VIDEO_ENUM_TYPES_H__ */
-
-/* Generated data ends here */
-
diff --git a/win32/vs6/grammar.dsp b/win32/vs6/grammar.dsp
deleted file mode 100644
index 4d67df1d..00000000
--- a/win32/vs6/grammar.dsp
+++ /dev/null
@@ -1,424 +0,0 @@
-# Microsoft Developer Studio Project File - Name="grammar" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Generic Project" 0x010a
-
-CFG=grammar - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "grammar.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "grammar.mak" CFG="grammar - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "grammar - Win32 Release" (based on "Win32 (x86) Generic Project")
-!MESSAGE "grammar - Win32 Debug" (based on "Win32 (x86) Generic Project")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-MTL=midl.exe
-
-!IF "$(CFG)" == "grammar - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-
-!ELSEIF "$(CFG)" == "grammar - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-
-!ENDIF
-
-# Begin Target
-
-# Name "grammar - Win32 Release"
-# Name "grammar - Win32 Debug"
-# Begin Source File
-
-SOURCE="..\..\gst\playback\gstplay-marshal.list"
-
-!IF "$(CFG)" == "grammar - Win32 Release"
-
-# Begin Custom Build
-InputPath="..\..\gst\playback\gstplay-marshal.list"
-
-BuildCmds= \
- echo #include "glib-object.h" > gstplay-marshal.c.tmp \
- echo #include "gstplay-marshal.h" >> gstplay-marshal.c.tmp \
- glib-genmarshal --body --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list >> gstplay-marshal.c.tmp \
- move gstplay-marshal.c.tmp ..\..\gst\playback\gstplay-marshal.c \
- echo #include "gst/gstconfig.h" > gstplay-marshal.h.tmp \
- glib-genmarshal --header --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list >> gstplay-marshal.h.tmp \
- move gstplay-marshal.h.tmp ..\..\gst\playback\gstplay-marshal.h
-
-"..\..\gst\playback\gstplay-marshal.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"..\..\gst\playback\gstplay-marshal.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "grammar - Win32 Debug"
-
-# Begin Custom Build
-InputPath="..\..\gst\playback\gstplay-marshal.list"
-
-BuildCmds= \
- echo #include "glib-object.h" > gstplay-marshal.c.tmp \
- echo #include "gstplay-marshal.h" >> gstplay-marshal.c.tmp \
- glib-genmarshal --body --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list >> gstplay-marshal.c.tmp \
- move gstplay-marshal.c.tmp ..\..\gst\playback\gstplay-marshal.c \
- echo #include "gst/gstconfig.h" > gstplay-marshal.h.tmp \
- glib-genmarshal --header --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list >> gstplay-marshal.h.tmp \
- move gstplay-marshal.h.tmp ..\..\gst\playback\gstplay-marshal.h
-
-"..\..\gst\playback\gstplay-marshal.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"..\..\gst\playback\gstplay-marshal.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst\tcp\gsttcp-marshal.list"
-!IF "$(CFG)" == "grammar - Win32 Release"
-
-# Begin Custom Build
-InputPath="..\..\gst\tcp\gsttcp-marshal.list"
-
-BuildCmds= \
- echo #include "glib-object.h" > gsttcp-marshal.c.tmp \
- echo #include "gsttcp-marshal.h" >> gsttcp-marshal.c.tmp \
- glib-genmarshal --body --prefix=gst_tcp_marshal ..\..\gst\tcp\gsttcp-marshal.list >> gsttcp-marshal.c.tmp \
- move gsttcp-marshal.c.tmp ..\..\gst\tcp\gsttcp-marshal.c \
- echo #include "gst/gstconfig.h" > gsttcp-marshal.h.tmp \
- glib-genmarshal --header --prefix=gst_tcp_marshal ..\..\gst\tcp\gsttcp-marshal.list >> gsttcp-marshal.h.tmp \
- move gsttcp-marshal.h.tmp ..\..\gst\tcp\gsttcp-marshal.h
-
-
-"..\..\gst\tcp\gsttcp-marshal.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"..\..\gst\tcp\gsttcp-marshal.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "grammar - Win32 Debug"
-
-# Begin Custom Build
-InputPath="..\..\gst\tcp\gsttcp-marshal.list"
-
-BuildCmds= \
- echo #include "glib-object.h" > gsttcp-marshal.c.tmp \
- echo #include "gsttcp-marshal.h" >> gsttcp-marshal.c.tmp \
- glib-genmarshal --body --prefix=gst_tcp_marshal ..\..\gst\tcp\gsttcp-marshal.list >> gsttcp-marshal.c.tmp \
- move gsttcp-marshal.c.tmp ..\..\gst\tcp\gsttcp-marshal.c \
- echo #include "gst/gstconfig.h" > gsttcp-marshal.h.tmp \
- glib-genmarshal --header --prefix=gst_tcp_marshal ..\..\gst\tcp\gsttcp-marshal.list >> gsttcp-marshal.h.tmp \
- move gsttcp-marshal.h.tmp ..\..\gst\tcp\gsttcp-marshal.h
-
-
-"..\..\gst\tcp\gsttcp-marshal.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"..\..\gst\tcp\gsttcp-marshal.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE="..\common\interfaces-enumtypes.c"
-
-!IF "$(CFG)" == "grammar - Win32 Release"
-
-# Begin Custom Build
-InputPath="..\common\interfaces-enumtypes.c"
-
-BuildCmds= \
- copy ..\common\interfaces-enumtypes.h ..\..\gst-libs\gst\interfaces \
- copy ..\common\interfaces-enumtypes.c ..\..\gst-libs\gst\interfaces
-
-
-"..\..\gst-libs\gst\interfaces\interfaces-enumtypes.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"..\..\gst-libs\gst\interfaces\interfaces-enumtypes.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "grammar - Win32 Debug"
-
-# Begin Custom Build
-InputPath="..\common\interfaces-enumtypes.c"
-
-BuildCmds= \
- copy ..\common\interfaces-enumtypes.h ..\..\gst-libs\gst\interfaces \
- copy ..\common\interfaces-enumtypes.c ..\..\gst-libs\gst\interfaces
-
-
-"..\..\gst-libs\gst\interfaces\interfaces-enumtypes.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"..\..\gst-libs\gst\interfaces\interfaces-enumtypes.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\interfaces-marshal.list"
-
-!IF "$(CFG)" == "grammar - Win32 Release"
-
-# Begin Custom Build
-InputPath="..\..\gst-libs\gst\interfaces\interfaces-marshal.list"
-
-BuildCmds= \
- echo #include "interfaces-marshal.h" > interfaces-marshal.c.tmp \
- glib-genmarshal --body --prefix=gst_interfaces_marshal ..\..\gst-libs\gst\interfaces\interfaces-marshal.list >> interfaces-marshal.c.tmp \
- move interfaces-marshal.c.tmp ..\..\gst-libs\gst\interfaces\interfaces-marshal.c \
- echo #include "gst/gstconfig.h" > interfaces-marshal.h.tmp \
- glib-genmarshal --header --prefix=gst_interfaces_marshal ..\..\gst-libs\gst\interfaces\interfaces-marshal.list >> interfaces-marshal.h.tmp \
- move interfaces-marshal.h.tmp ..\..\gst-libs\gst\interfaces\interfaces-marshal.h
-
-
-"..\..\gst-libs\gst\interfaces\interfaces-marshal.list.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"..\..\gst-libs\gst\interfaces\interfaces-marshal.list.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "grammar - Win32 Debug"
-
-# Begin Custom Build
-InputPath="..\..\gst-libs\gst\interfaces\interfaces-marshal.list"
-
-BuildCmds= \
- echo #include "interfaces-marshal.h" > interfaces-marshal.c.tmp \
- glib-genmarshal --body --prefix=gst_interfaces_marshal ..\..\gst-libs\gst\interfaces\interfaces-marshal.list >> interfaces-marshal.c.tmp \
- move interfaces-marshal.c.tmp ..\..\gst-libs\gst\interfaces\interfaces-marshal.c \
- echo #include "gst/gstconfig.h" > interfaces-marshal.h.tmp \
- glib-genmarshal --header --prefix=gst_interfaces_marshal ..\..\gst-libs\gst\interfaces\interfaces-marshal.list >> interfaces-marshal.h.tmp \
- move interfaces-marshal.h.tmp ..\..\gst-libs\gst\interfaces\interfaces-marshal.h
-
-
-"..\..\gst-libs\gst\interfaces\interfaces-marshal.list.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"..\..\gst-libs\gst\interfaces\interfaces-marshal.list.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE="..\common\audio-enumtypes.c"
-
-!IF "$(CFG)" == "grammar - Win32 Release"
-
-# Begin Custom Build
-InputPath="..\common\audio-enumtypes.c"
-
-BuildCmds= \
- copy ..\common\audio-enumtypes.h ..\..\gst-libs\gst\audio \
- copy ..\common\audio-enumtypes.c ..\..\gst-libs\gst\audio
-
-
-"..\..\gst-libs\gst\audio\audio-enumtypes.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"..\..\gst-libs\gst\audio\audio-enumtypes.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "grammar - Win32 Debug"
-
-# Begin Custom Build
-InputPath="..\common\audio-enumtypes.c"
-
-BuildCmds= \
- copy ..\common\audio-enumtypes.h ..\..\gst-libs\gst\audio \
- copy ..\common\audio-enumtypes.c ..\..\gst-libs\gst\audio
-
-
-"..\..\gst-libs\gst\audio\audio-enumtypes.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"..\..\gst-libs\gst\audio\audio-enumtypes.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\rtsp-marshal.list"
-
-!IF "$(CFG)" == "grammar - Win32 Release"
-
-# Begin Custom Build
-InputPath="..\..\gst-libs\gst\rtsp\rtsp-marshal.list"
-
-BuildCmds= \
- echo #include "rtsp-marshal.h" > rtsp-marshal.c.tmp \
- glib-genmarshal --body --prefix=gst_rtsp_marshal ..\..\gst-libs\gst\rtsp\rtsp-marshal.list >> rtsp-marshal.c.tmp \
- move rtsp-marshal.c.tmp ..\..\gst-libs\gst\rtsp\rtsp-marshal.c \
- echo #include "gst/gstconfig.h" > rtsp-marshal.h.tmp \
- glib-genmarshal --header --prefix=gst_rtsp_marshal ..\..\gst-libs\gst\rtsp\rtsp-marshal.list >> rtsp-marshal.h.tmp \
- move rtsp-marshal.h.tmp ..\..\gst-libs\gst\rtsp\rtsp-marshal.h
-
-
-"..\..\gst-libs\gst\rtsp\rtsp-marshal.list.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"..\..\gst-libs\gst\rtsp\rtsp-marshal.list.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "grammar - Win32 Debug"
-
-# Begin Custom Build
-InputPath="..\..\gst-libs\gst\rtsp\rtsp-marshal.list"
-
-BuildCmds= \
- echo #include "rtsp-marshal.h" > rtsp-marshal.c.tmp \
- glib-genmarshal --body --prefix=gst_rtsp_marshal ..\..\gst-libs\gst\rtsp\rtsp-marshal.list >> rtsp-marshal.c.tmp \
- move rtsp-marshal.c.tmp ..\..\gst-libs\gst\rtsp\rtsp-marshal.c \
- echo #include "gst/gstconfig.h" > rtsp-marshal.h.tmp \
- glib-genmarshal --header --prefix=gst_rtsp_marshal ..\..\gst-libs\gst\rtsp\rtsp-marshal.list >> rtsp-marshal.h.tmp \
- move rtsp-marshal.h.tmp ..\..\gst-libs\gst\rtsp\rtsp-marshal.h
-
-
-"..\..\gst-libs\gst\rtsp\rtsp-marshal.list.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-..\..\gst-libs\gst\rtsp\rtsp-marshal.list.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE="..\common\gstrtsp-enumtypes.c"
-
-!IF "$(CFG)" == "grammar - Win32 Release"
-
-# Begin Custom Build
-InputPath="..\common\gstrtsp-enumtypes.c"
-
-BuildCmds= \
- copy ..\common\gstrtsp-enumtypes.h ..\..\gst-libs\gst\rtsp \
- copy ..\common\gstrtsp-enumtypes.c ..\..\gst-libs\gst\rtsp
-
-
-"..\..\gst-libs\gst\rtsp\gstrtsp-enumtypes.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"..\..\gst-libs\gst\rtsp\gstrtsp-enumtypes.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "grammar - Win32 Debug"
-
-# Begin Custom Build
-InputPath="..\common\gstrtsp-enumtypes.c"
-
-BuildCmds= \
- copy ..\common\gstrtsp-enumtypes.h ..\..\gst-libs\gst\rtsp \
- copy ..\common\gstrtsp-enumtypes.c ..\..\gst-libs\gst\rtsp
-
-
-"..\..\gst-libs\gst\rtsp\gstrtsp-enumtypes.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"..\..\gst-libs\gst\rtsp\gstrtsp-enumtypes.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE="..\common\pbutils-enumtypes.c"
-
-!IF "$(CFG)" == "grammar - Win32 Release"
-
-# Begin Custom Build
-InputPath="..\common\pbutils-enumtypes.c"
-
-BuildCmds= \
- copy ..\common\pbutils-enumtypes.h ..\..\gst-libs\gst\pbutils \
- copy ..\common\pbutils-enumtypes.c ..\..\gst-libs\gst\pbutils
-
-
-"..\..\gst-libs\gst\pbutils\pbutils-enumtypes.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"..\..\gst-libs\gst\pbutils\pbutils-enumtypes.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "grammar - Win32 Debug"
-
-# Begin Custom Build
-InputPath="..\common\pbutils-enumtypes.c"
-
-BuildCmds= \
- copy ..\common\pbutils-enumtypes.h ..\..\gst-libs\gst\pbutils \
- copy ..\common\pbutils-enumtypes.c ..\..\gst-libs\gst\pbutils
-
-
-"..\..\gst-libs\gst\pbutils\pbutils-enumtypes.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"..\..\gst-libs\gst\pbutils\pbutils-enumtypes.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Target
-# End Project
diff --git a/win32/vs6/gst_plugins_base.dsw b/win32/vs6/gst_plugins_base.dsw
deleted file mode 100644
index 40fd3a4b..00000000
--- a/win32/vs6/gst_plugins_base.dsw
+++ /dev/null
@@ -1,440 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "grammar"=".\grammar.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstadder"=".\libgstadder.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstaudio"=".\libgstaudio.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name grammar
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name libgstinterfaces
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "libgstaudioconvert"=".\libgstaudioconvert.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstaudiorate"=".\libgstaudiorate.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstaudioresample"=".\libgstaudioresample.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstaudiotestsrc"=".\libgstaudiotestsrc.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstcdda"=".\libgstcdda.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name libgsttag
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "libgstdecodebin"=".\libgstdecodebin.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name grammar
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name libgstpbutils
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "libgstdecodebin2"=".\libgstdecodebin2.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstffmpegcolorspace"=".\libgstffmpegcolorspace.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstfft"=".\libgstfft.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstgdp"=".\libgstgdp.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstinterfaces"=".\libgstinterfaces.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name grammar
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "libgstnetbuffer"=".\libgstnetbuffer.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstogg"=".\libgstogg.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name libgstriff
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "libgstpbutils"=".\libgstpbutils.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstplaybin"=".\libgstplaybin.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name grammar
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name libgstutils
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "libgstriff"=".\libgstriff.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstrtp"=".\libgstrtp.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstrtsp"=".\libgstrtsp.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name grammar
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "libgstsdp"=".\libgstsdp.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstsubparse"=".\libgstsubparse.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgsttag"=".\libgsttag.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgsttheora"=".\libgsttheora.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name libgsttag
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "libgsttypefindfunctions"=".\libgsttypefindfunctions.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstvideo"=".\libgstvideo.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstvideorate"=".\libgstvideorate.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstvideoscale"=".\libgstvideoscale.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstvideotestsrc"=".\libgstvideotestsrc.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstvolume"=".\libgstvolume.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libgstvorbis"=".\libgstvorbis.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name libgstaudio
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name libgsttag
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/win32/vs6/libgstadder.dsp b/win32/vs6/libgstadder.dsp
deleted file mode 100644
index 3616c303..00000000
--- a/win32/vs6/libgstadder.dsp
+++ /dev/null
@@ -1,123 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstadder" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstadder - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstadder.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstadder.mak" CFG="libgstadder - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstadder - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstadder - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstadder - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTADDER_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTADDER_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstadder.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstadder - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTADDER_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTADDER_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstadder.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstadder - Win32 Release"
-# Name "libgstadder - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\adder\gstadder.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\gst\adder\gstadder.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstaudio.dsp b/win32/vs6/libgstaudio.dsp
deleted file mode 100644
index bfd0a8a5..00000000
--- a/win32/vs6/libgstaudio.dsp
+++ /dev/null
@@ -1,207 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstaudio" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstaudio - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstaudio.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstaudio.mak" CFG="libgstaudio - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstaudio - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstaudio - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstaudio - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIO_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "./" /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /I "../../gst-libs/gst/audio" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIO_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 glib-2.0.lib gobject-2.0.lib libgstreamer-0.10.lib libgstbase-0.10.lib libgstinterfaces-0.10.lib /nologo /dll /machine:I386 /out:"Release/libgstaudio-0.10.dll" /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstaudio-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\bin
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstaudio - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIO_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /I "../../gst-libs/gst/audio" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIO_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 glib-2.0D.lib gobject-2.0D.lib libgstreamer-0.10.lib libgstbase-0.10.lib libgstinterfaces-0.10.lib /nologo /dll /debug /machine:I386 /out:"Debug/libgstaudio-0.10.dll" /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstaudio-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\bin
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstaudio - Win32 Release"
-# Name "libgstaudio - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\audio.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\gstaudioclock.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\gstaudiofilter.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\gstaudiofiltertemplate.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\gstaudiosink.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\gstaudiosrc.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\gstbaseaudiosink.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\gstbaseaudiosrc.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\gstringbuffer.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\common\libgstaudio.def
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\mixerutils.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\audio-enumtypes.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\multichannel.c"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\audio.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\gstaudioclock.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\gstaudiofilter.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\gstaudiosink.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\gstaudiosrc.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\gstbaseaudiosink.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\gstbaseaudiosrc.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\gstringbuffer.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\audio-enumtypes.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\audio\multichannel.h"
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstaudioconvert.dsp b/win32/vs6/libgstaudioconvert.dsp
deleted file mode 100644
index 132c2974..00000000
--- a/win32/vs6/libgstaudioconvert.dsp
+++ /dev/null
@@ -1,151 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstaudioconvert" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstaudioconvert - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstaudioconvert.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstaudioconvert.mak" CFG="libgstaudioconvert - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstaudioconvert - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstaudioconvert - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstaudioconvert - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIOCONVERT_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIOCONVERT_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstaudio-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstaudioconvert.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstaudioconvert - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIOCONVERT_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIOCONVERT_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstaudio-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstaudioconvert.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstaudioconvert - Win32 Release"
-# Name "libgstaudioconvert - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\audioconvert\audioconvert.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioconvert\gstaudioconvert.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioconvert\gstaudioquantize.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioconvert\gstchannelmix.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioconvert\plugin.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\gst\audioconvert\audioconvert.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioconvert\gstaudioconvert.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioconvert\gstchannelmix.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioconvert\plugin.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstaudiorate.dsp b/win32/vs6/libgstaudiorate.dsp
deleted file mode 100644
index 4487b113..00000000
--- a/win32/vs6/libgstaudiorate.dsp
+++ /dev/null
@@ -1,119 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstaudiorate" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstaudiorate - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstaudiorate.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstaudiorate.mak" CFG="libgstaudiorate - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstaudiorate - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstaudiorate - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstaudiorate - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIORATE_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIORATE_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstaudiorate.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstaudiorate - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIORATE_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIORATE_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstaudiorate.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstaudiorate - Win32 Release"
-# Name "libgstaudiorate - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\audiorate\gstaudiorate.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstaudioresample.dsp b/win32/vs6/libgstaudioresample.dsp
deleted file mode 100644
index a1ca5b0e..00000000
--- a/win32/vs6/libgstaudioresample.dsp
+++ /dev/null
@@ -1,163 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstaudioresample" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstaudioresample - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstaudioresample.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstaudioresample.mak" CFG="libgstaudioresample - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstaudioresample - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstaudioresample - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstaudioresample - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIORESAMPLE_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /I "../../gst/audioresample" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIORESAMPLE_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib liboil-0.3-0.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstaudioresample.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstaudioresample - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIORESAMPLE_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /I "../../gst/audioresample" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIORESAMPLE_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib liboil-0.3-0.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstaudioresample.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstaudioresample - Win32 Release"
-# Name "libgstaudioresample - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\audioresample\buffer.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioresample\functable.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioresample\gstaudioresample.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioresample\resample.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioresample\resample_chunk.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioresample\resample_functable.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioresample\resample_ref.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\gst\audioresample\buffer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioresample\debug.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioresample\functable.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioresample\gstaudioresample.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioresample\resample.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstaudioscale.dsp b/win32/vs6/libgstaudioscale.dsp
deleted file mode 100644
index f6148ccd..00000000
--- a/win32/vs6/libgstaudioscale.dsp
+++ /dev/null
@@ -1,125 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstaudioscale" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstaudioscale - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstaudioscale.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstaudioscale.mak" CFG="libgstaudioscale - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstaudioscale - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstaudioscale - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstaudioscale - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIOSCALE_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../.." /I "../../gst-libs" /I "../../../gstreamer/win32" /I "../../../gstreamer" /I "../../../gstreamer/win32/common" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIOSCALE_EXPORTS" /D "HAVE_CONFIG_H" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstaudioscale.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstaudioscale - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIOSCALE_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer/win32" /I "../../../gstreamer" /I "../../../gstreamer/win32/common" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIOSCALE_EXPORTS" /D "HAVE_CONFIG_H" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstaudioscale.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstaudioscale - Win32 Release"
-# Name "libgstaudioscale - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\audioscale\gstaudioscale.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\gst\audioscale\gstaudioscale.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\audioscale\private.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstaudiotestsrc.dsp b/win32/vs6/libgstaudiotestsrc.dsp
deleted file mode 100644
index ed291b32..00000000
--- a/win32/vs6/libgstaudiotestsrc.dsp
+++ /dev/null
@@ -1,123 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstaudiotestsrc" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstaudiotestsrc - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstaudiotestsrc.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstaudiotestsrc.mak" CFG="libgstaudiotestsrc - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstaudiotestsrc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstaudiotestsrc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstaudiotestsrc - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIOTESTSRC_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIOTESTSRC_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib libgstcontroller-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstaudiotestsrc.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstaudiotestsrc - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIOTESTSRC_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTAUDIOTESTSRC_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib libgstcontroller-0.10.lib glib-2.0D.lib gobject-2.0D.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstaudiotestsrc.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstaudiotestsrc - Win32 Release"
-# Name "libgstaudiotestsrc - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\audiotestsrc\gstaudiotestsrc.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\gst\audiotestsrc\gstaudiotestsrc.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstcdda.dsp b/win32/vs6/libgstcdda.dsp
deleted file mode 100644
index 744b444f..00000000
--- a/win32/vs6/libgstcdda.dsp
+++ /dev/null
@@ -1,143 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstcdda" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstcdda - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstcdda.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstcdda.mak" CFG="libgstcdda - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstcdda - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstcdda - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstcdda - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTCDDA_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTCDDA_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 glib-2.0.lib gobject-2.0.lib libgstreamer-0.10.lib libgstbase-0.10.lib libgsttag-0.10.lib /nologo /dll /machine:I386 /out:"Release/libgstcdda-0.10.dll" /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstcdda-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\bin
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstcdda - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTCDDA_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTCDDA_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 glib-2.0D.lib gobject-2.0D.lib libgstreamer-0.10.lib libgstbase-0.10.lib libgsttag-0.10.lib /nologo /dll /debug /machine:I386 /out:"Debug/libgstcdda-0.10.dll" /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstcdda-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\bin
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstcdda - Win32 Release"
-# Name "libgstcdda - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\cdda\base64.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\cdda\gstcddabasesrc.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\common\libgstcdda.def
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\cdda\sha1.c"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\cdda\base64.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\cdda\gstcddabasesrc.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\cdda\sha1.h"
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstdecodebin.dsp b/win32/vs6/libgstdecodebin.dsp
deleted file mode 100644
index bccea4fd..00000000
--- a/win32/vs6/libgstdecodebin.dsp
+++ /dev/null
@@ -1,123 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstdecodebin" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstdecodebin - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstdecodebin.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstdecodebin.mak" CFG="libgstdecodebin - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstdecodebin - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstdecodebin - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstdecodebin - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTDECODEBIN_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../.." /I "../../gst-libs" /I "../../../gstreamer/win32" /I "../../../gstreamer" /I "../common" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTDECODEBIN_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 glib-2.0.lib gobject-2.0.lib libgstreamer-0.10.lib libgstbase-0.10.lib libgstpbutils-0.10.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstdecodebin.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstdecodebin - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTDECODEBIN_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer/win32" /I "../../../gstreamer" /I "../common" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTDECODEBIN_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 glib-2.0D.lib gobject-2.0D.lib libgstreamer-0.10.lib libgstbase-0.10.lib libgstpbutils-0.10.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstdecodebin.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstdecodebin - Win32 Release"
-# Name "libgstdecodebin - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\playback\gstdecodebin.c
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst\playback\gstplay-marshal.c"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstdecodebin2.dsp b/win32/vs6/libgstdecodebin2.dsp
deleted file mode 100644
index 72b2d17b..00000000
--- a/win32/vs6/libgstdecodebin2.dsp
+++ /dev/null
@@ -1,135 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstdecodebin2" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstdecodebin2 - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstdecodebin2.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstdecodebin2.mak" CFG="libgstdecodebin2 - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstdecodebin2 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstdecodebin2 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstdecodebin2 - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTDECODEBIN2_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../.." /I "../../gst-libs" /I "../../../gstreamer/win32" /I "../../../gstreamer" /I "../common" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTDECODEBIN2_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 glib-2.0.lib gobject-2.0.lib libgstreamer-0.10.lib libgstbase-0.10.lib libgstpbutils-0.10.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstdecodebin2.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstdecodebin2 - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTDECODEBIN2_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer/win32" /I "../../../gstreamer" /I "../common" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTDECODEBIN2_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 glib-2.0D.lib gobject-2.0D.lib libgstreamer-0.10.lib libgstbase-0.10.lib libgstpbutils-0.10.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstdecodebin2.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstdecodebin2 - Win32 Release"
-# Name "libgstdecodebin2 - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\playback\gstdecodebin2.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\playback\gstfactorylists.c
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst\playback\gstplay-enum.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst\playback\gstplay-marshal.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\playback\gsturidecodebin.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstdirectsound.dsp b/win32/vs6/libgstdirectsound.dsp
deleted file mode 100644
index c205b32d..00000000
--- a/win32/vs6/libgstdirectsound.dsp
+++ /dev/null
@@ -1,125 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstdirectsound" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstdirectsound - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstdirectsound.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstdirectsound.mak" CFG="libgstdirectsound - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstdirectsound - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstdirectsound - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstdirectsound - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTDIRECTSOUND_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../.." /I "../../gst-libs" /I "../../../gstreamer/win32" /I "../../../gstreamer" /I "../../../gstreamer/win32/common" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTDIRECTSOUND_EXPORTS" /D "HAVE_CONFIG_H" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib libgsttagedit-0.10.lib libgstaudio-0.10.lib glib-2.0.lib gobject-2.0.lib vorbis.lib ogg.lib dsound.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstdirectsound.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstdirectsound - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTDIRECTSOUND_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer/win32" /I "../../../gstreamer" /I "../../../gstreamer/win32/common" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTDIRECTSOUND_EXPORTS" /D "HAVE_CONFIG_H" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib libgsttagedit-0.10.lib libgstaudio-0.10.lib glib-2.0.lib gobject-2.0.lib vorbis.lib ogg.lib dsound.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstdirectsound.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstdirectsound - Win32 Release"
-# Name "libgstdirectsound - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\libgstdirectsound\gstdirectsoundplugin.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libgstdirectsound\gstdirectsoundsink.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\libgstdirectsound\gstdirectsoundsink.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstffmpegcolorspace.dsp b/win32/vs6/libgstffmpegcolorspace.dsp
deleted file mode 100644
index ad7cd406..00000000
--- a/win32/vs6/libgstffmpegcolorspace.dsp
+++ /dev/null
@@ -1,163 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstffmpegcolorspace" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstffmpegcolorspace - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstffmpegcolorspace.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstffmpegcolorspace.mak" CFG="libgstffmpegcolorspace - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstffmpegcolorspace - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstffmpegcolorspace - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstffmpegcolorspace - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTFFMPEGCOLORSPACE_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /I "../../gst/ffmpegcolorspace" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTFFMPEGCOLORSPACE_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstffmpegcolorspace.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstffmpegcolorspace - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTFFMPEGCOLORSPACE_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /I "../../gst/ffmpegcolorspace" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTFFMPEGCOLORSPACE_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstffmpegcolorspace.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstffmpegcolorspace - Win32 Release"
-# Name "libgstffmpegcolorspace - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\ffmpegcolorspace\dsputil.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\ffmpegcolorspace\gstffmpeg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\ffmpegcolorspace\gstffmpegcodecmap.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\ffmpegcolorspace\gstffmpegcolorspace.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\ffmpegcolorspace\imgconvert.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\ffmpegcolorspace\mem.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\ffmpegcolorspace\utils.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\gst\ffmpegcolorspace\avcodec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\ffmpegcolorspace\dsputil.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\ffmpegcolorspace\gstffmpegcodecmap.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\ffmpegcolorspace\gstffmpegcolorspace.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\ffmpegcolorspace\imgconvert_template.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstfft.dsp b/win32/vs6/libgstfft.dsp
deleted file mode 100644
index 82e213fc..00000000
--- a/win32/vs6/libgstfft.dsp
+++ /dev/null
@@ -1,167 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstfft" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstfft - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstfft.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstfft.mak" CFG="libgstfft - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstfft - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstfft - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstfft - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTFFT_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /I "../../gst-libs/gst/interfaces" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTFFT_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /out:"Release/libgstfft-0.10.dll" /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstfft-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\bin
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstfft - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTFFT_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /I "../../gst-libs/gst/interfaces" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTFFT_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib /nologo /dll /debug /machine:I386 /out:"Debug/libgstfft-0.10.dll" /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstfft-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\bin
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstfft - Win32 Release"
-# Name "libgstfft - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\fft\gstfft.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\fft\gstfftf32.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\fft\gstfftf64.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\fft\gstffts16.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\fft\gstffts32.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\fft\kiss_fft_f32.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\fft\kiss_fft_f64.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\fft\kiss_fft_s16.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\fft\kiss_fft_s32.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\fft\kiss_fftr_f32.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\fft\kiss_fftr_f64.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\fft\kiss_fftr_s16.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\fft\kiss_fftr_s32.c"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstgdp.dsp b/win32/vs6/libgstgdp.dsp
deleted file mode 100644
index fb375ee6..00000000
--- a/win32/vs6/libgstgdp.dsp
+++ /dev/null
@@ -1,127 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstgdp" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstgdp - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstgdp.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstgdp.mak" CFG="libgstgdp - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstgdp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstgdp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstgdp - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTGDP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTGDP_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 glib-2.0.lib gobject-2.0.lib libgstcontroller-0.10.lib libgstinterfaces-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib libgstdataprotocol-0.10.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstgdp.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstgdp - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTGDP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTGDP_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 glib-2.0D.lib gobject-2.0D.lib libgstcontroller-0.10.lib libgstinterfaces-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib libgstdataprotocol-0.10.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstgdp.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstgdp - Win32 Release"
-# Name "libgstgdp - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\gdp\gstgdp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\gdp\gstgdpdepay.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\gdp\gstgdppay.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstinterfaces.dsp b/win32/vs6/libgstinterfaces.dsp
deleted file mode 100644
index 5b5596a2..00000000
--- a/win32/vs6/libgstinterfaces.dsp
+++ /dev/null
@@ -1,223 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstinterfaces" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstinterfaces - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstinterfaces.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstinterfaces.mak" CFG="libgstinterfaces - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstinterfaces - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstinterfaces - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstinterfaces - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTINTERFACES_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /I "../../gst-libs/gst/interfaces" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTINTERFACES_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /out:"Release/libgstinterfaces-0.10.dll" /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstinterfaces-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\bin
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstinterfaces - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTINTERFACES_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /I "../../gst-libs/gst/interfaces" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTINTERFACES_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib /nologo /dll /debug /machine:I386 /out:"Debug/libgstinterfaces-0.10.dll" /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstinterfaces-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\bin
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstinterfaces - Win32 Release"
-# Name "libgstinterfaces - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\colorbalance.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\colorbalancechannel.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\interfaces-enumtypes.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\interfaces-marshal.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\common\libgstinterfaces.def
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\mixer.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\mixeroptions.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\mixertrack.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\navigation.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\propertyprobe.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\tuner.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\tunerchannel.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\tunernorm.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\videoorientation.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\xoverlay.c"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\colorbalance.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\colorbalancechannel.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\interfaces.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\mixer.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\mixeroptions.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\mixertrack.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\navigation.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\propertyprobe.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\tuner.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\tunerchannel.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\tunernorm.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\interfaces\xoverlay.h"
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstnetbuffer.dsp b/win32/vs6/libgstnetbuffer.dsp
deleted file mode 100644
index 31110697..00000000
--- a/win32/vs6/libgstnetbuffer.dsp
+++ /dev/null
@@ -1,127 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstnetbuffer" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstnetbuffer - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstnetbuffer.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstnetbuffer.mak" CFG="libgstnetbuffer - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstnetbuffer - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstnetbuffer - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstnetbuffer - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTNETBUFFER_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTNETBUFFER_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /out:"Release/libgstnetbuffer-0.10.dll" /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstnetbuffer-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\bin
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstnetbuffer - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTNETBUFFER_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTNETBUFFER_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib /nologo /dll /debug /machine:I386 /out:"Debug/libgstnetbuffer-0.10.dll" /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstnetbuffer-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\bin
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstnetbuffer - Win32 Release"
-# Name "libgstnetbuffer - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\netbuffer\gstnetbuffer.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\common\libgstnetbuffer.def
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\net\gstnetbuffer.h"
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstogg.dsp b/win32/vs6/libgstogg.dsp
deleted file mode 100644
index 289097c8..00000000
--- a/win32/vs6/libgstogg.dsp
+++ /dev/null
@@ -1,139 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstogg" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstogg - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstogg.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstogg.mak" CFG="libgstogg - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstogg - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstogg - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstogg - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTOGG_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTOGG_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib libgsttag-0.10.lib glib-2.0.lib gobject-2.0.lib ogg.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstogg.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstogg - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTOGG_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTOGG_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib libgsttag-0.10.lib glib-2.0D.lib gobject-2.0D.lib ogg.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstogg.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstogg - Win32 Release"
-# Name "libgstogg - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\ext\ogg\gstogg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ext\ogg\gstoggaviparse.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ext\ogg\gstoggdemux.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ext\ogg\gstoggmux.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ext\ogg\gstoggparse.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ext\ogg\gstogmparse.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstpbutils.dsp b/win32/vs6/libgstpbutils.dsp
deleted file mode 100644
index 0e944b5a..00000000
--- a/win32/vs6/libgstpbutils.dsp
+++ /dev/null
@@ -1,139 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstpbutils" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstpbutils - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstpbutils.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstpbutils.mak" CFG="libgstpbutils - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstpbutils - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstpbutils - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstpbutils - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTPBUTILS_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTPBUTILS_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /out:"Release/libgstpbutils-0.10.dll" /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstpbutils-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\bin
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstpbutils - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTPBUTILS_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTPBUTILS_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib /nologo /dll /debug /machine:I386 /out:"Debug/libgstpbutils-0.10.dll" /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstpbutils-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\bin
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstpbutils - Win32 Release"
-# Name "libgstpbutils - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\pbutils\descriptions.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\pbutils\install-plugins.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\common\libgstpbutils.def
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\pbutils\missing-plugins.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\common\pbutils-enumtypes.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\pbutils\pbutils.c"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstplaybin.dsp b/win32/vs6/libgstplaybin.dsp
deleted file mode 100644
index 722fc0a8..00000000
--- a/win32/vs6/libgstplaybin.dsp
+++ /dev/null
@@ -1,151 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstplaybin" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstplaybin - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstplaybin.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstplaybin.mak" CFG="libgstplaybin - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstplaybin - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstplaybin - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstplaybin - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTPLAYBIN_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../.." /I "../../gst-libs" /I "../../../gstreamer/win32" /I "../../../gstreamer" /I "../common" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTPLAYBIN_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 glib-2.0.lib gobject-2.0.lib libgstreamer-0.10.lib libgstbase-0.10.lib libgstpbutils-0.10.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstplaybin.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstplaybin - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTPLAYBIN_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTPLAYBIN_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 glib-2.0D.lib gobject-2.0D.lib libgstreamer-0.10.lib libgstbase-0.10.lib libgstpbutils-0.10.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstplaybin.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstplaybin - Win32 Release"
-# Name "libgstplaybin - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\playback\gstfactorylists.c
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst\playback\gstplay-enum.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\playback\gstplayback.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\playback\gstplaybasebin.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\playback\gstplaybin.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\playback\gstplaybin2.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\playback\gstplaysink.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\playback\gststreaminfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\playback\gststreamselector.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstriff.dsp b/win32/vs6/libgstriff.dsp
deleted file mode 100644
index 0b227ad4..00000000
--- a/win32/vs6/libgstriff.dsp
+++ /dev/null
@@ -1,143 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstriff" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstriff - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstriff.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstriff.mak" CFG="libgstriff - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstriff - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstriff - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstriff - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTRIFF_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTRIFF_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 glib-2.0.lib gobject-2.0.lib libgstreamer-0.10.lib libgstbase-0.10.lib libgstaudio-0.10.lib libgsttag-0.10.lib /nologo /dll /machine:I386 /out:"Release/libgstriff-0.10.dll" /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstriff-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\bin
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstriff - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTRIFF_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTRIFF_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 glib-2.0D.lib gobject-2.0D.lib libgstreamer-0.10.lib libgstbase-0.10.lib libgstaudio-0.10.lib libgsttag-0.10.lib /nologo /dll /debug /machine:I386 /out:"Debug/libgstriff-0.10.dll" /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstriff-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\bin
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstriff - Win32 Release"
-# Name "libgstriff - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\common\libgstriff.def
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\riff\riff-media.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\riff\riff-read.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\riff\riff.c"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\riff\riff-ids.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\riff\riff-media.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\riff\riff-read.h"
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstrtp.dsp b/win32/vs6/libgstrtp.dsp
deleted file mode 100644
index 0cfe87b0..00000000
--- a/win32/vs6/libgstrtp.dsp
+++ /dev/null
@@ -1,155 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstrtp" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstrtp - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstrtp.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstrtp.mak" CFG="libgstrtp - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstrtp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstrtp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstrtp - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTRTP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTRTP_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /out:"Release/libgstrtp-0.10.dll" /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstrtp-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\bin
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstrtp - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTRTP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTRTP_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib /nologo /dll /debug /machine:I386 /out:"Debug/libgstrtp-0.10.dll" /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstrtp-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\bin
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstrtp - Win32 Release"
-# Name "libgstrtp - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtp\gstbasertpaudiopayload.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtp\gstbasertpdepayload.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtp\gstbasertppayload.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtp\gstrtcpbuffer.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtp\gstrtpbuffer.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtp\gstrtppayloads.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\common\libgstrtp.def
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtp\gstbasertpdepayload.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtp\gstbasertppayload.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtp\gstrtpbuffer.h"
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstrtsp.dsp b/win32/vs6/libgstrtsp.dsp
deleted file mode 100644
index d8fd4385..00000000
--- a/win32/vs6/libgstrtsp.dsp
+++ /dev/null
@@ -1,195 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstrtsp" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstrtsp - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstrtsp.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstrtsp.mak" CFG="libgstrtsp - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstrtsp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstrtsp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstrtsp - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTRTSP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /I "../../gst-libs/gst/rtsp" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTRTSP_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 glib-2.0.lib gobject-2.0.lib libgstreamer-0.10.lib libgstbase-0.10.lib Ws2_32.lib /nologo /dll /machine:I386 /out:"Release/libgstrtsp-0.10.dll" /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstrtsp-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\bin
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstrtsp - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTRTSP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /I "../../gst-libs/gst/rtsp" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTRTSP_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 glib-2.0D.lib gobject-2.0D.lib libgstreamer-0.10.lib libgstbase-0.10.lib Ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Debug/libgstrtsp-0.10.dll" /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstrtsp-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\bin
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstrtsp - Win32 Release"
-# Name "libgstrtsp - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE="..\common\gstrtsp-enumtypes.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\gstrtsp.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\gstrtspbase64.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\gstrtspconnection.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\gstrtspdefs.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\gstrtspextension.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\gstrtspmessage.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\gstrtsprange.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\gstrtsptransport.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\gstrtspurl.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\common\libgstrtsp.def
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\rtsp-marshal.c"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\gstrtspbase64.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\gstrtspconnection.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\gstrtspdefs.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\gstrtspextension.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\gstrtspmessage.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\gstrtsprange.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\gstrtsptransport.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\rtsp\gstrtspurl.h"
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstsdp.dsp b/win32/vs6/libgstsdp.dsp
deleted file mode 100644
index 0b76921f..00000000
--- a/win32/vs6/libgstsdp.dsp
+++ /dev/null
@@ -1,123 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstsdp" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstsdp - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstsdp.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstsdp.mak" CFG="libgstsdp - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstsdp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstsdp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstsdp - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTSDP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /I "../../gst-libs/gst/rtsp" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTSDP_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 glib-2.0.lib gobject-2.0.lib libgstreamer-0.10.lib libgstbase-0.10.lib Ws2_32.lib /nologo /dll /machine:I386 /out:"Release/libgstsdp-0.10.dll" /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstsdp-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\bin
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstsdp - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTSDP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /I "../../gst-libs/gst/rtsp" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTSDP_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 glib-2.0D.lib gobject-2.0D.lib libgstreamer-0.10.lib libgstbase-0.10.lib Ws2_32.lib /nologo /dll /debug /machine:I386 /out:"Debug/libgstsdp-0.10.dll" /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstsdp-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\bin
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstsdp - Win32 Release"
-# Name "libgstsdp - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\sdp\gstsdpmessage.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\common\libgstsdp.def
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstsinesrc.dsp b/win32/vs6/libgstsinesrc.dsp
deleted file mode 100644
index 52386edf..00000000
--- a/win32/vs6/libgstsinesrc.dsp
+++ /dev/null
@@ -1,121 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstsinesrc" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstsinesrc - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstsinesrc.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstsinesrc.mak" CFG="libgstsinesrc - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstsinesrc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstsinesrc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstsinesrc - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTSINESRC_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../.." /I "../../gst-libs" /I "../../../gstreamer/win32" /I "../../../gstreamer" /I "../../../gstreamer/win32/common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTSINESRC_EXPORTS" /D "HAVE_CONFIG_H" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstsinesrc.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstsinesrc - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTSINESRC_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer/win32" /I "../../../gstreamer" /I "../../../gstreamer/win32/common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTSINESRC_EXPORTS" /D "HAVE_CONFIG_H" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstsinesrc.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstsinesrc - Win32 Release"
-# Name "libgstsinesrc - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\sine\gstsinesrc.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\gst\sine\gstsinesrc.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstsubparse.dsp b/win32/vs6/libgstsubparse.dsp
deleted file mode 100644
index aac5e133..00000000
--- a/win32/vs6/libgstsubparse.dsp
+++ /dev/null
@@ -1,123 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstsubparse" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstsubparse - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstsubparse.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstsubparse.mak" CFG="libgstsubparse - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstsubparse - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstsubparse - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstsubparse - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTSUBPARSE_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../.." /I "../../gst-libs" /I "../../../gstreamer/win32" /I "../../../gstreamer" /I "../../../gstreamer/win32/common" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTSUBPARSE_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstsubparse.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstsubparse - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTSUBPARSE_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTSUBPARSE_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstsubparse.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstsubparse - Win32 Release"
-# Name "libgstsubparse - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\subparse\gstsubparse.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\gst\subparse\gstsubparse.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgsttag.dsp b/win32/vs6/libgsttag.dsp
deleted file mode 100644
index 7e68ec61..00000000
--- a/win32/vs6/libgsttag.dsp
+++ /dev/null
@@ -1,139 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgsttag" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgsttag - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgsttag.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgsttag.mak" CFG="libgsttag - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgsttag - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgsttag - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgsttag - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTTAGEDIT_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTTAGEDIT_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /out:"Release/libgsttag-0.10.dll" /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgsttag-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\bin
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgsttag - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTTAGEDIT_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTTAGEDIT_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib /nologo /dll /debug /machine:I386 /out:"Debug/libgsttag-0.10.dll" /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgsttag-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\bin
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgsttag - Win32 Release"
-# Name "libgsttag - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\tag\gstid3tag.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\tag\gsttagdemux.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\tag\gstvorbistag.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\common\libgsttag.def
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\tag\tags.c"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=..\..\gst\ffmpegcolorspace\avcodec.h
-# End Source File
-# End Target
-# End Project
diff --git a/win32/vs6/libgsttheora.dsp b/win32/vs6/libgsttheora.dsp
deleted file mode 100644
index b36eed52..00000000
--- a/win32/vs6/libgsttheora.dsp
+++ /dev/null
@@ -1,131 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgsttheora" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgsttheora - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgsttheora.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgsttheora.mak" CFG="libgsttheora - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgsttheora - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgsttheora - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgsttheora - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTTHEORA_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTTHEORA_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib theora_static.lib ogg.lib libgsttag-0.10.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgsttheora.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgsttheora - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTTHEORA_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTTHEORA_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgsttag-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib theora_static.lib ogg.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgsttheora.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgsttheora - Win32 Release"
-# Name "libgsttheora - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\ext\theora\theora.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ext\theora\theoradec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ext\theora\theoraenc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ext\theora\theoraparse.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgsttypefindfunctions.dsp b/win32/vs6/libgsttypefindfunctions.dsp
deleted file mode 100644
index 043d9de3..00000000
--- a/win32/vs6/libgsttypefindfunctions.dsp
+++ /dev/null
@@ -1,119 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgsttypefindfunctions" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgsttypefindfunctions - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgsttypefindfunctions.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgsttypefindfunctions.mak" CFG="libgsttypefindfunctions - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgsttypefindfunctions - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgsttypefindfunctions - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgsttypefindfunctions - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTTYPEFINDFUNCTIONS_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTTYPEFINDFUNCTIONS_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgsttypefindfunctions.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgsttypefindfunctions - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTTYPEFINDFUNCTIONS_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTTYPEFINDFUNCTIONS_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib glib-2.0D.lib gobject-2.0D.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgsttypefindfunctions.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgsttypefindfunctions - Win32 Release"
-# Name "libgsttypefindfunctions - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\typefind\gsttypefindfunctions.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstutils.dsp b/win32/vs6/libgstutils.dsp
deleted file mode 100644
index 965c5755..00000000
--- a/win32/vs6/libgstutils.dsp
+++ /dev/null
@@ -1,135 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstutils" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstutils - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstutils.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstutils.mak" CFG="libgstutils - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstutils - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstutils - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstutils - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTUTILS_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTUTILS_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /out:"Release/libgstutils-0.10.dll" /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstutils-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\bin
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstutils - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTUTILS_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTUTILS_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib /nologo /dll /debug /machine:I386 /out:"Debug/libgstutils-0.10.dll" /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstutils-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\bin
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstutils - Win32 Release"
-# Name "libgstutils - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\utils\base-utils.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\utils\descriptions.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\utils\install-plugins.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\common\libgstutils.def
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\utils\missing-plugins.c"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstvideo.dsp b/win32/vs6/libgstvideo.dsp
deleted file mode 100644
index 2560e15b..00000000
--- a/win32/vs6/libgstvideo.dsp
+++ /dev/null
@@ -1,143 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstvideo" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstvideo - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstvideo.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstvideo.mak" CFG="libgstvideo - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstvideo - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstvideo - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstvideo - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVIDEO_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVIDEO_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /out:"Release/libgstvideo-0.10.dll" /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstvideo-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\bin
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstvideo - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVIDEO_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVIDEO_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib /nologo /dll /debug /machine:I386 /out:"Debug/libgstvideo-0.10.dll" /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstvideo-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\bin
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstvideo - Win32 Release"
-# Name "libgstvideo - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\video\gstvideofilter.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\video\gstvideosink.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\common\libgstvideo.def
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\video\video.c"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\video\gstvideofilter.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\video\video.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\gst-libs\gst\video\videosink.h"
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstvideorate.dsp b/win32/vs6/libgstvideorate.dsp
deleted file mode 100644
index 17f3e426..00000000
--- a/win32/vs6/libgstvideorate.dsp
+++ /dev/null
@@ -1,119 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstvideorate" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstvideorate - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstvideorate.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstvideorate.mak" CFG="libgstvideorate - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstvideorate - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstvideorate - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstvideorate - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVIDEORATE_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVIDEORATE_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstvideorate.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstvideorate - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVIDEORATE_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVIDEORATE_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstvideorate.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstvideorate - Win32 Release"
-# Name "libgstvideorate - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\videorate\gstvideorate.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstvideoscale.dsp b/win32/vs6/libgstvideoscale.dsp
deleted file mode 100644
index ac69f826..00000000
--- a/win32/vs6/libgstvideoscale.dsp
+++ /dev/null
@@ -1,143 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstvideoscale" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstvideoscale - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstvideoscale.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstvideoscale.mak" CFG="libgstvideoscale - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstvideoscale - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstvideoscale - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstvideoscale - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVIDEOSCALE_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVIDEOSCALE_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstvideo-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib liboil-0.3-0.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstvideoscale.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstvideoscale - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVIDEOSCALE_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVIDEOSCALE_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstvideo-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib liboil-0.3-0.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstvideoscale.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstvideoscale - Win32 Release"
-# Name "libgstvideoscale - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\videoscale\gstvideoscale.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\videoscale\vs_4tap.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\videoscale\vs_image.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\videoscale\vs_scanline.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\gst\videoscale\gstvideoscale.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\videoscale\vs_image.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\videoscale\vs_scanline.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstvideotestsrc.dsp b/win32/vs6/libgstvideotestsrc.dsp
deleted file mode 100644
index cb4947d5..00000000
--- a/win32/vs6/libgstvideotestsrc.dsp
+++ /dev/null
@@ -1,131 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstvideotestsrc" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstvideotestsrc - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstvideotestsrc.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstvideotestsrc.mak" CFG="libgstvideotestsrc - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstvideotestsrc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstvideotestsrc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstvideotestsrc - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVIDEOTESTSRC_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../.." /I "../../gst-libs" /I "../../../gstreamer/win32" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVIDEOTESTSRC_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib liboil-0.3-0.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstvideotestsrc.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstvideotestsrc - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVIDEOTESTSRC_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer/win32" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVIDEOTESTSRC_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0D.lib gobject-2.0D.lib liboil-0.3-0.lib /nologo /dll /profile /debug /machine:I386 /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstvideotestsrc.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstvideotestsrc - Win32 Release"
-# Name "libgstvideotestsrc - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\videotestsrc\gstvideotestsrc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\videotestsrc\videotestsrc.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\gst\videotestsrc\gstvideotestsrc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\gst\videotestsrc\videotestsrc.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstvolume.dsp b/win32/vs6/libgstvolume.dsp
deleted file mode 100644
index 7f6a0efd..00000000
--- a/win32/vs6/libgstvolume.dsp
+++ /dev/null
@@ -1,119 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstvolume" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstvolume - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstvolume.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstvolume.mak" CFG="libgstvolume - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstvolume - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstvolume - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstvolume - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVOLUME_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVOLUME_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 glib-2.0.lib gobject-2.0.lib libgstcontroller-0.10.lib libgstinterfaces-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib liboil-0.3-0.lib libgstaudio-0.10.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstvolume.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstvolume - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVOLUME_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVOLUME_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 glib-2.0D.lib gobject-2.0D.lib libgstcontroller-0.10.lib libgstinterfaces-0.10.lib libgstreamer-0.10.lib libgstbase-0.10.lib liboil-0.3-0.lib libgstaudio-0.10.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstvolume.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstvolume - Win32 Release"
-# Name "libgstvolume - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\gst\volume\gstvolume.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs6/libgstvorbis.dsp b/win32/vs6/libgstvorbis.dsp
deleted file mode 100644
index 954038eb..00000000
--- a/win32/vs6/libgstvorbis.dsp
+++ /dev/null
@@ -1,147 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libgstvorbis" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstvorbis - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstvorbis.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstvorbis.mak" CFG="libgstvorbis - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstvorbis - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstvorbis - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstvorbis - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVORBIS_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVORBIS_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib libgsttag-0.10.lib libgstaudio-0.10.lib glib-2.0.lib gobject-2.0.lib vorbis.lib ogg.lib /nologo /dll /machine:I386 /libpath:"../../../gstreamer/win32/vs6/release" /libpath:"./release"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstvorbis.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstvorbis - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVORBIS_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../gst-libs" /I "../../../gstreamer" /I "../common" /I "../../../gstreamer/libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTVORBIS_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libgstreamer-0.10.lib libgstbase-0.10.lib libgsttag-0.10.lib libgstaudio-0.10.lib glib-2.0D.lib gobject-2.0D.lib vorbis.lib ogg.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"../../../gstreamer/win32/vs6/debug" /libpath:"./debug"
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstvorbis.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\lib\gstreamer-0.10
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstvorbis - Win32 Release"
-# Name "libgstvorbis - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\ext\vorbis\vorbis.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ext\vorbis\vorbisdec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ext\vorbis\vorbisenc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ext\vorbis\vorbisparse.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ext\vorbis\vorbistag.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\ext\vorbis\vorbisdec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ext\vorbis\vorbisenc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\ext\vorbis\vorbisparse.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/win32/vs7/gst-plugins-base.sln b/win32/vs7/gst-plugins-base.sln
deleted file mode 100644
index cd048c27..00000000
--- a/win32/vs7/gst-plugins-base.sln
+++ /dev/null
@@ -1,199 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstriff", "libgstriff.vcproj", "{3D36330F-1F68-44F6-A712-803E819A3DCD}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstaudio", "libgstaudio.vcproj", "{BD17F145-422C-4EC0-A756-C7675A5626B2}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstadder", "libgstadder.vcproj", "{E54E1872-C90A-4FF8-A4F4-27C3F8750D44}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstaudioconvert", "libgstaudioconvert.vcproj", "{EA99F8DE-660D-42E9-B14D-08F34FA45AD1}"
- ProjectSection(ProjectDependencies) = postProject
- {BD17F145-422C-4EC0-A756-C7675A5626B2} = {BD17F145-422C-4EC0-A756-C7675A5626B2}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstaudiorate", "libgstaudiorate.vcproj", "{C51F9363-7DC1-40F7-84D3-C9D4FD67A3CA}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstaudioresample", "libgstaudioresample.vcproj", "{0EE3173E-FCD3-4EC6-A28F-5AE5CE7196AC}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstaudiotestsrc", "libgstaudiotestsrc.vcproj", "{B5CDFF9E-28E0-4915-8C3E-95EDAE2D9DE3}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstffmpegcolorspace", "libgstffmpegcolorspace.vcproj", "{BE2600A9-5BEB-42D9-8F13-FD38FCF5B801}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstplaybin", "libgstplaybin.vcproj", "{7B296C12-D728-4CD8-8CF7-B8D7A433F85C}"
- ProjectSection(ProjectDependencies) = postProject
- {F7558C2A-C1BC-453C-8FDE-84F33DB73915} = {F7558C2A-C1BC-453C-8FDE-84F33DB73915}
- {80270384-C551-471F-86C2-D80FE61D9883} = {80270384-C551-471F-86C2-D80FE61D9883}
- {EA99F8DE-660D-42E9-B14D-08F34FA45AD1} = {EA99F8DE-660D-42E9-B14D-08F34FA45AD1}
- {0969BEF1-77F5-468F-9497-8470FDEC615A} = {0969BEF1-77F5-468F-9497-8470FDEC615A}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgsttypefind", "libgsttypefind.vcproj", "{F7558C2A-C1BC-453C-8FDE-84F33DB73915}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstvideorate", "libgstvideorate.vcproj", "{84F3B76C-4733-4032-B51E-F8E71022AFE6}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstvideoscale", "libgstvideoscale.vcproj", "{557CB36F-7F92-4B43-973D-05C6BF0A6414}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstvideotestsrc", "libgstvideotestsrc.vcproj", "{7586DFA1-F847-4BEF-9105-724DD9F12C2A}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstvolume", "libgstvolume.vcproj", "{80270384-C551-471F-86C2-D80FE61D9883}"
- ProjectSection(ProjectDependencies) = postProject
- {CF1687EC-9097-4A86-B7FB-C1ECF9E27EA4} = {CF1687EC-9097-4A86-B7FB-C1ECF9E27EA4}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstdecodebin", "libgstdecodebin.vcproj", "{0969BEF1-77F5-468F-9497-8470FDEC615A}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstinterfaces", "libgstinterfaces.vcproj", "{CF1687EC-9097-4A86-B7FB-C1ECF9E27EA4}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstsubparse", "libgstsubparse.vcproj", "{C41E324E-03FD-4483-92B1-B50F6E3B6B82}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgsttcp", "libgsttcp.vcproj", "{40412A73-43D3-4F1F-9078-DBD76705767D}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstvorbis", "libgstvorbis.vcproj", "{4F2E05FD-F87C-4325-8C2A-C1EEA21A483F}"
- ProjectSection(ProjectDependencies) = postProject
- {BD17F145-422C-4EC0-A756-C7675A5626B2} = {BD17F145-422C-4EC0-A756-C7675A5626B2}
- {626AF6BD-0AAB-4019-929A-2DB5CAD0419E} = {626AF6BD-0AAB-4019-929A-2DB5CAD0419E}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstogg", "libgstogg.vcproj", "{51E1F9C4-091E-43A0-97C1-E1B68700A5AF}"
- ProjectSection(ProjectDependencies) = postProject
- {3D36330F-1F68-44F6-A712-803E819A3DCD} = {3D36330F-1F68-44F6-A712-803E819A3DCD}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgsttheora", "libgsttheora.vcproj", "{AB7AD55A-A521-42F2-A953-623E5F059C1A}"
- ProjectSection(ProjectDependencies) = postProject
- {626AF6BD-0AAB-4019-929A-2DB5CAD0419E} = {626AF6BD-0AAB-4019-929A-2DB5CAD0419E}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgsttag", "libgsttag.vcproj", "{626AF6BD-0AAB-4019-929A-2DB5CAD0419E}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstvideo", "libgstvideo.vcproj", "{1975AEE8-05C5-42DE-8A8B-620168F9C1C9}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- Debug = Debug
- Release = Release
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {3D36330F-1F68-44F6-A712-803E819A3DCD}.Debug.ActiveCfg = Debug|Win32
- {3D36330F-1F68-44F6-A712-803E819A3DCD}.Debug.Build.0 = Debug|Win32
- {3D36330F-1F68-44F6-A712-803E819A3DCD}.Release.ActiveCfg = Release|Win32
- {3D36330F-1F68-44F6-A712-803E819A3DCD}.Release.Build.0 = Release|Win32
- {BD17F145-422C-4EC0-A756-C7675A5626B2}.Debug.ActiveCfg = Debug|Win32
- {BD17F145-422C-4EC0-A756-C7675A5626B2}.Debug.Build.0 = Debug|Win32
- {BD17F145-422C-4EC0-A756-C7675A5626B2}.Release.ActiveCfg = Release|Win32
- {BD17F145-422C-4EC0-A756-C7675A5626B2}.Release.Build.0 = Release|Win32
- {E54E1872-C90A-4FF8-A4F4-27C3F8750D44}.Debug.ActiveCfg = Debug|Win32
- {E54E1872-C90A-4FF8-A4F4-27C3F8750D44}.Debug.Build.0 = Debug|Win32
- {E54E1872-C90A-4FF8-A4F4-27C3F8750D44}.Release.ActiveCfg = Release|Win32
- {E54E1872-C90A-4FF8-A4F4-27C3F8750D44}.Release.Build.0 = Release|Win32
- {EA99F8DE-660D-42E9-B14D-08F34FA45AD1}.Debug.ActiveCfg = Debug|Win32
- {EA99F8DE-660D-42E9-B14D-08F34FA45AD1}.Debug.Build.0 = Debug|Win32
- {EA99F8DE-660D-42E9-B14D-08F34FA45AD1}.Release.ActiveCfg = Release|Win32
- {EA99F8DE-660D-42E9-B14D-08F34FA45AD1}.Release.Build.0 = Release|Win32
- {C51F9363-7DC1-40F7-84D3-C9D4FD67A3CA}.Debug.ActiveCfg = Debug|Win32
- {C51F9363-7DC1-40F7-84D3-C9D4FD67A3CA}.Debug.Build.0 = Debug|Win32
- {C51F9363-7DC1-40F7-84D3-C9D4FD67A3CA}.Release.ActiveCfg = Release|Win32
- {C51F9363-7DC1-40F7-84D3-C9D4FD67A3CA}.Release.Build.0 = Release|Win32
- {0EE3173E-FCD3-4EC6-A28F-5AE5CE7196AC}.Debug.ActiveCfg = Debug|Win32
- {0EE3173E-FCD3-4EC6-A28F-5AE5CE7196AC}.Release.ActiveCfg = Release|Win32
- {B5CDFF9E-28E0-4915-8C3E-95EDAE2D9DE3}.Debug.ActiveCfg = Debug|Win32
- {B5CDFF9E-28E0-4915-8C3E-95EDAE2D9DE3}.Debug.Build.0 = Debug|Win32
- {B5CDFF9E-28E0-4915-8C3E-95EDAE2D9DE3}.Release.ActiveCfg = Release|Win32
- {B5CDFF9E-28E0-4915-8C3E-95EDAE2D9DE3}.Release.Build.0 = Release|Win32
- {BE2600A9-5BEB-42D9-8F13-FD38FCF5B801}.Debug.ActiveCfg = Debug|Win32
- {BE2600A9-5BEB-42D9-8F13-FD38FCF5B801}.Debug.Build.0 = Debug|Win32
- {BE2600A9-5BEB-42D9-8F13-FD38FCF5B801}.Release.ActiveCfg = Release|Win32
- {BE2600A9-5BEB-42D9-8F13-FD38FCF5B801}.Release.Build.0 = Release|Win32
- {7B296C12-D728-4CD8-8CF7-B8D7A433F85C}.Debug.ActiveCfg = Debug|Win32
- {7B296C12-D728-4CD8-8CF7-B8D7A433F85C}.Debug.Build.0 = Debug|Win32
- {7B296C12-D728-4CD8-8CF7-B8D7A433F85C}.Release.ActiveCfg = Release|Win32
- {7B296C12-D728-4CD8-8CF7-B8D7A433F85C}.Release.Build.0 = Release|Win32
- {F7558C2A-C1BC-453C-8FDE-84F33DB73915}.Debug.ActiveCfg = Debug|Win32
- {F7558C2A-C1BC-453C-8FDE-84F33DB73915}.Debug.Build.0 = Debug|Win32
- {F7558C2A-C1BC-453C-8FDE-84F33DB73915}.Release.ActiveCfg = Release|Win32
- {F7558C2A-C1BC-453C-8FDE-84F33DB73915}.Release.Build.0 = Release|Win32
- {84F3B76C-4733-4032-B51E-F8E71022AFE6}.Debug.ActiveCfg = Debug|Win32
- {84F3B76C-4733-4032-B51E-F8E71022AFE6}.Debug.Build.0 = Debug|Win32
- {84F3B76C-4733-4032-B51E-F8E71022AFE6}.Release.ActiveCfg = Release|Win32
- {84F3B76C-4733-4032-B51E-F8E71022AFE6}.Release.Build.0 = Release|Win32
- {557CB36F-7F92-4B43-973D-05C6BF0A6414}.Debug.ActiveCfg = Debug|Win32
- {557CB36F-7F92-4B43-973D-05C6BF0A6414}.Debug.Build.0 = Debug|Win32
- {557CB36F-7F92-4B43-973D-05C6BF0A6414}.Release.ActiveCfg = Release|Win32
- {557CB36F-7F92-4B43-973D-05C6BF0A6414}.Release.Build.0 = Release|Win32
- {7586DFA1-F847-4BEF-9105-724DD9F12C2A}.Debug.ActiveCfg = Debug|Win32
- {7586DFA1-F847-4BEF-9105-724DD9F12C2A}.Release.ActiveCfg = Release|Win32
- {80270384-C551-471F-86C2-D80FE61D9883}.Debug.ActiveCfg = Debug|Win32
- {80270384-C551-471F-86C2-D80FE61D9883}.Debug.Build.0 = Debug|Win32
- {80270384-C551-471F-86C2-D80FE61D9883}.Release.ActiveCfg = Release|Win32
- {80270384-C551-471F-86C2-D80FE61D9883}.Release.Build.0 = Release|Win32
- {0969BEF1-77F5-468F-9497-8470FDEC615A}.Debug.ActiveCfg = Debug|Win32
- {0969BEF1-77F5-468F-9497-8470FDEC615A}.Debug.Build.0 = Debug|Win32
- {0969BEF1-77F5-468F-9497-8470FDEC615A}.Release.ActiveCfg = Release|Win32
- {0969BEF1-77F5-468F-9497-8470FDEC615A}.Release.Build.0 = Release|Win32
- {CF1687EC-9097-4A86-B7FB-C1ECF9E27EA4}.Debug.ActiveCfg = Debug|Win32
- {CF1687EC-9097-4A86-B7FB-C1ECF9E27EA4}.Debug.Build.0 = Debug|Win32
- {CF1687EC-9097-4A86-B7FB-C1ECF9E27EA4}.Release.ActiveCfg = Release|Win32
- {CF1687EC-9097-4A86-B7FB-C1ECF9E27EA4}.Release.Build.0 = Release|Win32
- {C41E324E-03FD-4483-92B1-B50F6E3B6B82}.Debug.ActiveCfg = Debug|Win32
- {C41E324E-03FD-4483-92B1-B50F6E3B6B82}.Release.ActiveCfg = Release|Win32
- {40412A73-43D3-4F1F-9078-DBD76705767D}.Debug.ActiveCfg = Debug|Win32
- {40412A73-43D3-4F1F-9078-DBD76705767D}.Release.ActiveCfg = Release|Win32
- {4F2E05FD-F87C-4325-8C2A-C1EEA21A483F}.Debug.ActiveCfg = Debug|Win32
- {4F2E05FD-F87C-4325-8C2A-C1EEA21A483F}.Debug.Build.0 = Debug|Win32
- {4F2E05FD-F87C-4325-8C2A-C1EEA21A483F}.Release.ActiveCfg = Release|Win32
- {4F2E05FD-F87C-4325-8C2A-C1EEA21A483F}.Release.Build.0 = Release|Win32
- {51E1F9C4-091E-43A0-97C1-E1B68700A5AF}.Debug.ActiveCfg = Debug|Win32
- {51E1F9C4-091E-43A0-97C1-E1B68700A5AF}.Debug.Build.0 = Debug|Win32
- {51E1F9C4-091E-43A0-97C1-E1B68700A5AF}.Release.ActiveCfg = Release|Win32
- {51E1F9C4-091E-43A0-97C1-E1B68700A5AF}.Release.Build.0 = Release|Win32
- {AB7AD55A-A521-42F2-A953-623E5F059C1A}.Debug.ActiveCfg = Debug|Win32
- {AB7AD55A-A521-42F2-A953-623E5F059C1A}.Debug.Build.0 = Debug|Win32
- {AB7AD55A-A521-42F2-A953-623E5F059C1A}.Release.ActiveCfg = Release|Win32
- {AB7AD55A-A521-42F2-A953-623E5F059C1A}.Release.Build.0 = Release|Win32
- {626AF6BD-0AAB-4019-929A-2DB5CAD0419E}.Debug.ActiveCfg = Debug|Win32
- {626AF6BD-0AAB-4019-929A-2DB5CAD0419E}.Debug.Build.0 = Debug|Win32
- {626AF6BD-0AAB-4019-929A-2DB5CAD0419E}.Release.ActiveCfg = Release|Win32
- {626AF6BD-0AAB-4019-929A-2DB5CAD0419E}.Release.Build.0 = Release|Win32
- {1975AEE8-05C5-42DE-8A8B-620168F9C1C9}.Debug.ActiveCfg = Debug|Win32
- {1975AEE8-05C5-42DE-8A8B-620168F9C1C9}.Debug.Build.0 = Debug|Win32
- {1975AEE8-05C5-42DE-8A8B-620168F9C1C9}.Release.ActiveCfg = Release|Win32
- {1975AEE8-05C5-42DE-8A8B-620168F9C1C9}.Release.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
diff --git a/win32/vs7/libgstadder.vcproj b/win32/vs7/libgstadder.vcproj
deleted file mode 100644
index 1d964a44..00000000
--- a/win32/vs7/libgstadder.vcproj
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstadder"
- ProjectGUID="{E54E1872-C90A-4FF8-A4F4-27C3F8750D44}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTADDER_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstadder.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstadder.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstadder.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTADDER_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstadder.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstadder.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst\adder\gstadder.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstaudio.vcproj b/win32/vs7/libgstaudio.vcproj
deleted file mode 100644
index 29e46c73..00000000
--- a/win32/vs7/libgstaudio.vcproj
+++ /dev/null
@@ -1,183 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstaudio"
- ProjectGUID="{BD17F145-422C-4EC0-A756-C7675A5626B2}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../../gst-libs,../common,../../gst-libs/gst/audio"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIO_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudio-0.10.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- ModuleDefinitionFile="..\common\libgstaudio.def"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstaudio-0.10.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstaudio-0.10.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\bin"/>
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="copy /y ..\common\audio-enumtypes.h ..\..\gst-libs\gst\audio
-copy /y ..\common\audio-enumtypes.c ..\..\gst-libs\gst\audio
-"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../../gst-libs,../common,../../gst-libs/gst/audio"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIO_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudio-0.10.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- ModuleDefinitionFile="..\common\libgstaudio.def"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstaudio-0.10.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\bin"/>
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="copy /y ..\common\audio-enumtypes.h ..\..\gst-libs\gst\audio
-copy /y ..\common\audio-enumtypes.c ..\..\gst-libs\gst\audio
-"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst-libs\gst\audio\audio.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\gstaudioclock.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\gstaudiofilter.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\gstaudiofiltertemplate.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\gstaudiosink.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\gstaudiosrc.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\gstbaseaudiosink.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\gstbaseaudiosrc.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\gstringbuffer.c">
- </File>
- <File
- RelativePath="..\common\libgstaudio.def">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\audio-enumtypes.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\multichannel.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstaudioconvert.vcproj b/win32/vs7/libgstaudioconvert.vcproj
deleted file mode 100644
index e6307925..00000000
--- a/win32/vs7/libgstaudioconvert.vcproj
+++ /dev/null
@@ -1,151 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstaudioconvert"
- ProjectGUID="{EA99F8DE-660D-42E9-B14D-08F34FA45AD1}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIOCONVERT_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudioconvert.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstaudioconvert.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstaudioconvert.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIOCONVERT_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudioconvert.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstaudioconvert.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst\audioconvert\audioconvert.c">
- </File>
- <File
- RelativePath="..\..\gst\audioconvert\gstaudioconvert.c">
- </File>
- <File
- RelativePath="..\..\gst\audioconvert\gstchannelmix.c">
- </File>
- <File
- RelativePath="..\..\gst\audioconvert\plugin.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstaudiorate.vcproj b/win32/vs7/libgstaudiorate.vcproj
deleted file mode 100644
index 27d93abe..00000000
--- a/win32/vs7/libgstaudiorate.vcproj
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstaudiorate"
- ProjectGUID="{C51F9363-7DC1-40F7-84D3-C9D4FD67A3CA}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIORATE_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudiorate.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstaudiorate.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstaudiorate.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIORATE_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudiorate.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstaudiorate.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst\audiorate\gstaudiorate.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstaudioresample.vcproj b/win32/vs7/libgstaudioresample.vcproj
deleted file mode 100644
index d07964ff..00000000
--- a/win32/vs7/libgstaudioresample.vcproj
+++ /dev/null
@@ -1,163 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstaudioresample"
- ProjectGUID="{0EE3173E-FCD3-4EC6-A28F-5AE5CE7196AC}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIORESAMPLE_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="liboil-0.3-0.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudioresample.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstaudioresample.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstaudioresample.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIORESAMPLE_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="liboil-0.3-0.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudioresample.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstaudioresample.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst\audioresample\buffer.c">
- </File>
- <File
- RelativePath="..\..\gst\audioresample\debug.c">
- </File>
- <File
- RelativePath="..\..\gst\audioresample\functable.c">
- </File>
- <File
- RelativePath="..\..\gst\audioresample\gstaudioresample.c">
- </File>
- <File
- RelativePath="..\..\gst\audioresample\resample.c">
- </File>
- <File
- RelativePath="..\..\gst\audioresample\resample_chunk.c">
- </File>
- <File
- RelativePath="..\..\gst\audioresample\resample_functable.c">
- </File>
- <File
- RelativePath="..\..\gst\audioresample\resample_ref.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstaudiotestsrc.vcproj b/win32/vs7/libgstaudiotestsrc.vcproj
deleted file mode 100644
index a04af46a..00000000
--- a/win32/vs7/libgstaudiotestsrc.vcproj
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstaudiotestsrc"
- ProjectGUID="{B5CDFF9E-28E0-4915-8C3E-95EDAE2D9DE3}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIOTESTSRC_EXPORTS;_USE_MATH_DEFINES;HAVE_CONFIG_H"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib libgstcontroller-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudiotestsrc.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstaudiotestsrc.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstaudiotestsrc.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIOTESTSRC_EXPORTS;_USE_MATH_DEFINES;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib libgstcontroller-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudiotestsrc.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstaudiotestsrc.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst\audiotestsrc\gstaudiotestsrc.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstdecodebin.vcproj b/win32/vs7/libgstdecodebin.vcproj
deleted file mode 100644
index ba64bcef..00000000
--- a/win32/vs7/libgstdecodebin.vcproj
+++ /dev/null
@@ -1,169 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstdecodebin"
- ProjectGUID="{0969BEF1-77F5-468F-9497-8470FDEC615A}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTDECODEBIN_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstdecodebin.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstdecodebin.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstdecodebin.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="if exist ..\..\gst\playback\gstplay-marshal.c goto HEADER
-echo #include &quot;glib-object.h&quot; &gt; gstplay-marshal.c.tmp
-echo #include &quot;gstplay-marshal.h&quot; &gt;&gt; gstplay-marshal.c.tmp
-glib-genmarshal --body --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list &gt;&gt; gstplay-marshal.c.tmp
-move gstplay-marshal.c.tmp ..\..\gst\playback\gstplay-marshal.c
-:HEADER
-if exist ..\..\gst\playback\gstplay-marshal.h goto END
-echo #include &quot;gst/gstconfig.h&quot; &gt; gstplay-marshal.h.tmp
-glib-genmarshal --header --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list &gt;&gt; gstplay-marshal.h.tmp
-move gstplay-marshal.h.tmp ..\..\gst\playback\gstplay-marshal.h
-:END
-"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTDECODEBIN_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstdecodebin.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstdecodebin.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="if exist ..\..\gst\playback\gstplay-marshal.c goto HEADER
-echo #include &quot;glib-object.h&quot; &gt; gstplay-marshal.c.tmp
-echo #include &quot;gstplay-marshal.h&quot; &gt;&gt; gstplay-marshal.c.tmp
-glib-genmarshal --body --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list &gt;&gt; gstplay-marshal.c.tmp
-move gstplay-marshal.c.tmp ..\..\gst\playback\gstplay-marshal.c
-:HEADER
-if exist ..\..\gst\playback\gstplay-marshal.h goto END
-echo #include &quot;gst/gstconfig.h&quot; &gt; gstplay-marshal.h.tmp
-glib-genmarshal --header --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list &gt;&gt; gstplay-marshal.h.tmp
-move gstplay-marshal.h.tmp ..\..\gst\playback\gstplay-marshal.h
-:END
-"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst\playback\gstdecodebin.c">
- </File>
- <File
- RelativePath="..\..\gst\playback\gstplay-marshal.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstffmpegcolorspace.vcproj b/win32/vs7/libgstffmpegcolorspace.vcproj
deleted file mode 100644
index 5b53b22b..00000000
--- a/win32/vs7/libgstffmpegcolorspace.vcproj
+++ /dev/null
@@ -1,160 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstffmpegcolorspace"
- ProjectGUID="{BE2600A9-5BEB-42D9-8F13-FD38FCF5B801}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../common,../../gst/ffmpegcolorspace"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTFFMPEGCOLORSPACE_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstffmpegcolorspace.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstffmpegcolorspace.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstffmpegcolorspace.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../common,../../gst/ffmpegcolorspace"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTFFMPEGCOLORSPACE_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstffmpegcolorspace.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstffmpegcolorspace.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst\ffmpegcolorspace\dsputil.c">
- </File>
- <File
- RelativePath="..\..\gst\ffmpegcolorspace\gstffmpeg.c">
- </File>
- <File
- RelativePath="..\..\gst\ffmpegcolorspace\gstffmpegcodecmap.c">
- </File>
- <File
- RelativePath="..\..\gst\ffmpegcolorspace\gstffmpegcolorspace.c">
- </File>
- <File
- RelativePath="..\..\gst\ffmpegcolorspace\imgconvert.c">
- </File>
- <File
- RelativePath="..\..\gst\ffmpegcolorspace\mem.c">
- </File>
- <File
- RelativePath="..\..\gst\ffmpegcolorspace\utils.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstinterfaces.vcproj b/win32/vs7/libgstinterfaces.vcproj
deleted file mode 100644
index cc2b9ff8..00000000
--- a/win32/vs7/libgstinterfaces.vcproj
+++ /dev/null
@@ -1,206 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstinterfaces"
- ProjectGUID="{CF1687EC-9097-4A86-B7FB-C1ECF9E27EA4}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTINTERFACES_EXPORTS"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstinterfaces-0.10.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- ModuleDefinitionFile="..\common\libgstinterfaces.def"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstinterfaces-0.10.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstinterfaces-0.10.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\bin"/>
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="if exist ..\..\gst-libs\gst\interfaces\interfaces-marshal.c goto HEADER
-echo #include &quot;interfaces-marshal.h&quot; &gt;&gt; interfaces-marshal.c.tmp
-glib-genmarshal --body --prefix=gst_interfaces_marshal ..\..\gst-libs\gst\interfaces\interfaces-marshal.list &gt;&gt; interfaces-marshal.c.tmp
-move interfaces-marshal.c.tmp ..\..\gst-libs\gst\interfaces\interfaces-marshal.c
-:HEADER
-if exist ..\..\gst-libs\gst\interfaces\interfaces-marshal.h goto END
-echo #include &quot;gst/gstconfig.h&quot; &gt; interfaces-marshal.h.tmp
-glib-genmarshal --header --prefix=gst_interfaces_marshal ..\..\gst-libs\gst\interfaces\interfaces-marshal.list &gt;&gt; interfaces-marshal.h.tmp
-move interfaces-marshal.h.tmp ..\..\gst-libs\gst\interfaces\interfaces-marshal.h
-:END
-copy /y ..\common\interfaces-enumtypes.h ..\..\gst-libs\gst\interfaces
-copy /y ..\common\interfaces-enumtypes.c ..\..\gst-libs\gst\interfaces
-"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTINTERFACES_EXPORTS"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstinterfaces-0.10.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- ModuleDefinitionFile="..\common\libgstinterfaces.def"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstinterfaces-0.10.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\bin"/>
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="if exist ..\..\gst-libs\gst\interfaces\interfaces-marshal.c goto HEADER
-echo #include &quot;interfaces-marshal.h&quot; &gt;&gt; interfaces-marshal.c.tmp
-glib-genmarshal --body --prefix=gst_interfaces_marshal ..\..\gst-libs\gst\interfaces\interfaces-marshal.list &gt;&gt; interfaces-marshal.c.tmp
-move interfaces-marshal.c.tmp ..\..\gst-libs\gst\interfaces\interfaces-marshal.c
-:HEADER
-if exist ..\..\gst-libs\gst\interfaces\interfaces-marshal.h goto END
-echo #include &quot;gst/gstconfig.h&quot; &gt; interfaces-marshal.h.tmp
-glib-genmarshal --header --prefix=gst_interfaces_marshal ..\..\gst-libs\gst\interfaces\interfaces-marshal.list &gt;&gt; interfaces-marshal.h.tmp
-move interfaces-marshal.h.tmp ..\..\gst-libs\gst\interfaces\interfaces-marshal.h
-:END
-copy /y ..\common\interfaces-enumtypes.h ..\..\gst-libs\gst\interfaces
-copy /y ..\common\interfaces-enumtypes.c ..\..\gst-libs\gst\interfaces
-"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\colorbalance.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\colorbalancechannel.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\interfaces-marshal.c">
- </File>
- <File
- RelativePath="..\common\libgstinterfaces.def">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\mixer.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\mixeroptions.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\mixertrack.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\navigation.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\propertyprobe.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\tuner.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\tunerchannel.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\tunernorm.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\xoverlay.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstogg.vcproj b/win32/vs7/libgstogg.vcproj
deleted file mode 100644
index bfd0cd99..00000000
--- a/win32/vs7/libgstogg.vcproj
+++ /dev/null
@@ -1,154 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstogg"
- ProjectGUID="{51E1F9C4-091E-43A0-97C1-E1B68700A5AF}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBOGG_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libogg.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstogg.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstogg.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstogg.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBOGG_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libogg.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstogg.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstogg.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\ext\ogg\gstogg.c">
- </File>
- <File
- RelativePath="..\..\ext\ogg\gstoggdemux.c">
- </File>
- <File
- RelativePath="..\..\ext\ogg\gstoggmux.c">
- </File>
- <File
- RelativePath="..\..\ext\ogg\gstoggparse.c">
- </File>
- <File
- RelativePath="..\..\ext\ogg\gstogmparse.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstplaybin.vcproj b/win32/vs7/libgstplaybin.vcproj
deleted file mode 100644
index 753c8ebc..00000000
--- a/win32/vs7/libgstplaybin.vcproj
+++ /dev/null
@@ -1,178 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstplaybin"
- ProjectGUID="{7B296C12-D728-4CD8-8CF7-B8D7A433F85C}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTPLAYBIN_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstplaybin.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstplaybin.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstplaybin.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="if exist ..\..\gst\playback\gstplay-marshal.c goto HEADER
-echo #include &quot;glib-object.h&quot; &gt; gstplay-marshal.c.tmp
-echo #include &quot;gstplay-marshal.h&quot; &gt;&gt; gstplay-marshal.c.tmp
-glib-genmarshal --body --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list &gt;&gt; gstplay-marshal.c.tmp
-move gstplay-marshal.c.tmp ..\..\gst\playback\gstplay-marshal.c
-:HEADER
-if exist ..\..\gst\playback\gstplay-marshal.h goto END
-echo #include &quot;gst/gstconfig.h&quot; &gt; gstplay-marshal.h.tmp
-glib-genmarshal --header --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list &gt;&gt; gstplay-marshal.h.tmp
-move gstplay-marshal.h.tmp ..\..\gst\playback\gstplay-marshal.h
-:END
-"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTPLAYBIN_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstplaybin.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstplaybin.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="if exist ..\..\gst\playback\gstplay-marshal.c goto HEADER
-echo #include &quot;glib-object.h&quot; &gt; gstplay-marshal.c.tmp
-echo #include &quot;gstplay-marshal.h&quot; &gt;&gt; gstplay-marshal.c.tmp
-glib-genmarshal --body --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list &gt;&gt; gstplay-marshal.c.tmp
-move gstplay-marshal.c.tmp ..\..\gst\playback\gstplay-marshal.c
-:HEADER
-if exist ..\..\gst\playback\gstplay-marshal.h goto END
-echo #include &quot;gst/gstconfig.h&quot; &gt; gstplay-marshal.h.tmp
-glib-genmarshal --header --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list &gt;&gt; gstplay-marshal.h.tmp
-move gstplay-marshal.h.tmp ..\..\gst\playback\gstplay-marshal.h
-:END
-"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst\playback\gstplay-marshal.c">
- </File>
- <File
- RelativePath="..\..\gst\playback\gstplaybasebin.c">
- </File>
- <File
- RelativePath="..\..\gst\playback\gstplaybin.c">
- </File>
- <File
- RelativePath="..\..\gst\playback\gststreaminfo.c">
- </File>
- <File
- RelativePath="..\..\gst\playback\gststreamselector.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstriff.vcproj b/win32/vs7/libgstriff.vcproj
deleted file mode 100644
index 4bf5a253..00000000
--- a/win32/vs7/libgstriff.vcproj
+++ /dev/null
@@ -1,153 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstriff"
- ProjectGUID="{3D36330F-1F68-44F6-A712-803E819A3DCD}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTRIFF_EXPORTS"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstriff-0.10.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- ModuleDefinitionFile="..\common\libgstriff.def"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstriff-0.10.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstriff-0.10.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\bin"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTRIFF_EXPORTS"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstriff-0.10.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- ModuleDefinitionFile="..\common\libgstriff.def"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstriff-0.10.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\bin"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\common\libgstriff.def">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\riff\riff-media.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\riff\riff-read.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\riff\riff.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstsubparse.vcproj b/win32/vs7/libgstsubparse.vcproj
deleted file mode 100644
index bce47524..00000000
--- a/win32/vs7/libgstsubparse.vcproj
+++ /dev/null
@@ -1,134 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstsubparse"
- ProjectGUID="{C41E324E-03FD-4483-92B1-B50F6E3B6B82}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;libgstsubparse_EXPORTS"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/libgstsubparse.dll"
- LinkIncremental="2"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstsubparse.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstsubparse.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;libgstsubparse_EXPORTS"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/libgstsubparse.dll"
- LinkIncremental="1"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstsubparse.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst\subparse\gstsubparse.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgsttag.vcproj b/win32/vs7/libgsttag.vcproj
deleted file mode 100644
index 32925d42..00000000
--- a/win32/vs7/libgsttag.vcproj
+++ /dev/null
@@ -1,150 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgsttag"
- ProjectGUID="{626AF6BD-0AAB-4019-929A-2DB5CAD0419E}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTTAG_EXPORTS"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgsttag-0.10.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- ModuleDefinitionFile="..\common\libgsttag.def"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgsttag-0.10.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgsttag-0.10.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\bin"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTTAG_EXPORTS"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgsttag-0.10.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- ModuleDefinitionFile="..\common\libgsttag.def"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgsttag-0.10.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\bin"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst-libs\gst\tag\gstid3tag.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\tag\gstvorbistag.c">
- </File>
- <File
- RelativePath="..\common\libgsttag.def">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgsttcp.vcproj b/win32/vs7/libgsttcp.vcproj
deleted file mode 100644
index 2c9d3c89..00000000
--- a/win32/vs7/libgsttcp.vcproj
+++ /dev/null
@@ -1,160 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgsttcp"
- ProjectGUID="{40412A73-43D3-4F1F-9078-DBD76705767D}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../gst-libs"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;libgsttcp_EXPORTS"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/libgsttcp.dll"
- LinkIncremental="2"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgsttcp.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgsttcp.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../gst-libs"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;libgsttcp_EXPORTS"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/libgsttcp.dll"
- LinkIncremental="1"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgsttcp.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst\tcp\fdsetstress.c">
- </File>
- <File
- RelativePath="..\..\gst\tcp\gstfdset.c">
- </File>
- <File
- RelativePath="..\..\gst\tcp\gstmultifdsink.c">
- </File>
- <File
- RelativePath="..\..\gst\tcp\gsttcp.c">
- </File>
- <File
- RelativePath="..\..\gst\tcp\gsttcpclientsink.c">
- </File>
- <File
- RelativePath="..\..\gst\tcp\gsttcpclientsrc.c">
- </File>
- <File
- RelativePath="..\..\gst\tcp\gsttcpplugin.c">
- </File>
- <File
- RelativePath="..\..\gst\tcp\gsttcpserversink.c">
- </File>
- <File
- RelativePath="..\..\gst\tcp\gsttcpserversrc.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgsttheora.vcproj b/win32/vs7/libgsttheora.vcproj
deleted file mode 100644
index 506c7650..00000000
--- a/win32/vs7/libgsttheora.vcproj
+++ /dev/null
@@ -1,148 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgsttheora"
- ProjectGUID="{AB7AD55A-A521-42F2-A953-623E5F059C1A}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTTHEORA_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="theora_static.lib libogg.lib libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgsttheora.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgsttheora.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgsttheora.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTTHEORA_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="theora_static.lib libogg.lib libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgsttheora.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgsttheora.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\ext\theora\theora.c">
- </File>
- <File
- RelativePath="..\..\ext\theora\theoradec.c">
- </File>
- <File
- RelativePath="..\..\ext\theora\theoraenc.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgsttypefind.vcproj b/win32/vs7/libgsttypefind.vcproj
deleted file mode 100644
index 41eafae2..00000000
--- a/win32/vs7/libgsttypefind.vcproj
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgsttypefind"
- ProjectGUID="{F7558C2A-C1BC-453C-8FDE-84F33DB73915}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTTYPEFIND_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgsttypefind.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgsttypefind.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgsttypefind.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTTYPEFIND_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgsttypefind.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgsttypefind.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst\typefind\gsttypefindfunctions.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstvideo.vcproj b/win32/vs7/libgstvideo.vcproj
deleted file mode 100644
index f7484d07..00000000
--- a/win32/vs7/libgstvideo.vcproj
+++ /dev/null
@@ -1,150 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstvideo"
- ProjectGUID="{1975AEE8-05C5-42DE-8A8B-620168F9C1C9}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTVIDEO_EXPORTS"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvideo-0.10.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- ModuleDefinitionFile="..\common\libgstvideo.def"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstvideo-0.10.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstvideo-0.10.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\bin"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTVIDEO_EXPORTS"
- RuntimeLibrary="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvideo-0.10.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- ModuleDefinitionFile="..\common\libgstvideo.def"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstvideo-0.10.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\bin"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst-libs\gst\video\gstvideofilter.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\video\gstvideosink.c">
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\video\video.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstvideorate.vcproj b/win32/vs7/libgstvideorate.vcproj
deleted file mode 100644
index 21fda00b..00000000
--- a/win32/vs7/libgstvideorate.vcproj
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstvideorate"
- ProjectGUID="{84F3B76C-4733-4032-B51E-F8E71022AFE6}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTVIDEORATE_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvideorate.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstvideorate.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstvideorate.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTVIDEORATE_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvideorate.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstvideorate.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst\videorate\gstvideorate.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstvideoscale.vcproj b/win32/vs7/libgstvideoscale.vcproj
deleted file mode 100644
index 1838c8bc..00000000
--- a/win32/vs7/libgstvideoscale.vcproj
+++ /dev/null
@@ -1,148 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstvideoscale"
- ProjectGUID="{557CB36F-7F92-4B43-973D-05C6BF0A6414}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTVIDEOSCALE_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvideoscale.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstvideoscale.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstvideoscale.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTVIDEOSCALE_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvideoscale.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstvideoscale.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst\videoscale\gstvideoscale.c">
- </File>
- <File
- RelativePath="..\..\gst\videoscale\vs_image.c">
- </File>
- <File
- RelativePath="..\..\gst\videoscale\vs_scanline.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstvideotestsrc.vcproj b/win32/vs7/libgstvideotestsrc.vcproj
deleted file mode 100644
index 7f30c064..00000000
--- a/win32/vs7/libgstvideotestsrc.vcproj
+++ /dev/null
@@ -1,145 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstvideotestsrc"
- ProjectGUID="{7586DFA1-F847-4BEF-9105-724DD9F12C2A}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTVIDEOTESTSRC_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="liboil-0.3-0.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvideotestsrc.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstvideotestsrc.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstvideotestsrc.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTVIDEOTESTSRC_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="liboil-0.3-0.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvideotestsrc.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstvideotestsrc.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst\videotestsrc\gstvideotestsrc.c">
- </File>
- <File
- RelativePath="..\..\gst\videotestsrc\videotestsrc.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstvolume.vcproj b/win32/vs7/libgstvolume.vcproj
deleted file mode 100644
index cf752027..00000000
--- a/win32/vs7/libgstvolume.vcproj
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstvolume"
- ProjectGUID="{80270384-C551-471F-86C2-D80FE61D9883}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTVOLUME_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib libgstcontroller-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvolume.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstvolume.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstvolume.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../../gstreamer/libs,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTVOLUME_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib libgstcontroller-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvolume.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstvolume.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\gst\volume\gstvolume.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs7/libgstvorbis.vcproj b/win32/vs7/libgstvorbis.vcproj
deleted file mode 100644
index f7089a08..00000000
--- a/win32/vs7/libgstvorbis.vcproj
+++ /dev/null
@@ -1,151 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="libgstvorbis"
- ProjectGUID="{4F2E05FD-F87C-4325-8C2A-C1EEA21A483F}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTVORBIS_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libvorbis.lib libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvorbis.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/libgstvorbis.pdb"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstvorbis.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTVORBIS_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libvorbis.lib libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvorbis.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs7/$(OutDir)"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstvorbis.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\ext\vorbis\vorbis.c">
- </File>
- <File
- RelativePath="..\..\ext\vorbis\vorbisdec.c">
- </File>
- <File
- RelativePath="..\..\ext\vorbis\vorbisenc.c">
- </File>
- <File
- RelativePath="..\..\ext\vorbis\vorbisparse.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/gst-plugins-base.sln b/win32/vs8/gst-plugins-base.sln
deleted file mode 100644
index e7a593d3..00000000
--- a/win32/vs8/gst-plugins-base.sln
+++ /dev/null
@@ -1,177 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual C++ Express 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstriff", "libgstriff.vcproj", "{3D36330F-1F68-44F6-A712-803E819A3DCD}"
- ProjectSection(ProjectDependencies) = postProject
- {BD17F145-422C-4EC0-A756-C7675A5626B2} = {BD17F145-422C-4EC0-A756-C7675A5626B2}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstaudio", "libgstaudio.vcproj", "{BD17F145-422C-4EC0-A756-C7675A5626B2}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstadder", "libgstadder.vcproj", "{E54E1872-C90A-4FF8-A4F4-27C3F8750D44}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstaudioconvert", "libgstaudioconvert.vcproj", "{EA99F8DE-660D-42E9-B14D-08F34FA45AD1}"
- ProjectSection(ProjectDependencies) = postProject
- {BD17F145-422C-4EC0-A756-C7675A5626B2} = {BD17F145-422C-4EC0-A756-C7675A5626B2}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstaudiorate", "libgstaudiorate.vcproj", "{C51F9363-7DC1-40F7-84D3-C9D4FD67A3CA}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstaudioresample", "libgstaudioresample.vcproj", "{0EE3173E-FCD3-4EC6-A28F-5AE5CE7196AC}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstaudiotestsrc", "libgstaudiotestsrc.vcproj", "{B5CDFF9E-28E0-4915-8C3E-95EDAE2D9DE3}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstffmpegcolorspace", "libgstffmpegcolorspace.vcproj", "{BE2600A9-5BEB-42D9-8F13-FD38FCF5B801}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstplaybin", "libgstplaybin.vcproj", "{7B296C12-D728-4CD8-8CF7-B8D7A433F85C}"
- ProjectSection(ProjectDependencies) = postProject
- {F7558C2A-C1BC-453C-8FDE-84F33DB73915} = {F7558C2A-C1BC-453C-8FDE-84F33DB73915}
- {80270384-C551-471F-86C2-D80FE61D9883} = {80270384-C551-471F-86C2-D80FE61D9883}
- {EA99F8DE-660D-42E9-B14D-08F34FA45AD1} = {EA99F8DE-660D-42E9-B14D-08F34FA45AD1}
- {0969BEF1-77F5-468F-9497-8470FDEC615A} = {0969BEF1-77F5-468F-9497-8470FDEC615A}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgsttypefind", "libgsttypefind.vcproj", "{F7558C2A-C1BC-453C-8FDE-84F33DB73915}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstvideorate", "libgstvideorate.vcproj", "{84F3B76C-4733-4032-B51E-F8E71022AFE6}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstvideoscale", "libgstvideoscale.vcproj", "{557CB36F-7F92-4B43-973D-05C6BF0A6414}"
- ProjectSection(ProjectDependencies) = postProject
- {1975AEE8-05C5-42DE-8A8B-620168F9C1C9} = {1975AEE8-05C5-42DE-8A8B-620168F9C1C9}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstvideotestsrc", "libgstvideotestsrc.vcproj", "{7586DFA1-F847-4BEF-9105-724DD9F12C2A}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstvolume", "libgstvolume.vcproj", "{80270384-C551-471F-86C2-D80FE61D9883}"
- ProjectSection(ProjectDependencies) = postProject
- {CF1687EC-9097-4A86-B7FB-C1ECF9E27EA4} = {CF1687EC-9097-4A86-B7FB-C1ECF9E27EA4}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstdecodebin", "libgstdecodebin.vcproj", "{0969BEF1-77F5-468F-9497-8470FDEC615A}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstinterfaces", "libgstinterfaces.vcproj", "{CF1687EC-9097-4A86-B7FB-C1ECF9E27EA4}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstsubparse", "libgstsubparse.vcproj", "{C41E324E-03FD-4483-92B1-B50F6E3B6B82}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgsttcp", "libgsttcp.vcproj", "{40412A73-43D3-4F1F-9078-DBD76705767D}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstvorbis", "libgstvorbis.vcproj", "{4F2E05FD-F87C-4325-8C2A-C1EEA21A483F}"
- ProjectSection(ProjectDependencies) = postProject
- {BD17F145-422C-4EC0-A756-C7675A5626B2} = {BD17F145-422C-4EC0-A756-C7675A5626B2}
- {626AF6BD-0AAB-4019-929A-2DB5CAD0419E} = {626AF6BD-0AAB-4019-929A-2DB5CAD0419E}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstogg", "libgstogg.vcproj", "{51E1F9C4-091E-43A0-97C1-E1B68700A5AF}"
- ProjectSection(ProjectDependencies) = postProject
- {3D36330F-1F68-44F6-A712-803E819A3DCD} = {3D36330F-1F68-44F6-A712-803E819A3DCD}
- {626AF6BD-0AAB-4019-929A-2DB5CAD0419E} = {626AF6BD-0AAB-4019-929A-2DB5CAD0419E}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgsttheora", "libgsttheora.vcproj", "{AB7AD55A-A521-42F2-A953-623E5F059C1A}"
- ProjectSection(ProjectDependencies) = postProject
- {626AF6BD-0AAB-4019-929A-2DB5CAD0419E} = {626AF6BD-0AAB-4019-929A-2DB5CAD0419E}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgsttag", "libgsttag.vcproj", "{626AF6BD-0AAB-4019-929A-2DB5CAD0419E}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgstvideo", "libgstvideo.vcproj", "{1975AEE8-05C5-42DE-8A8B-620168F9C1C9}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {3D36330F-1F68-44F6-A712-803E819A3DCD}.Debug|Win32.ActiveCfg = Debug|Win32
- {3D36330F-1F68-44F6-A712-803E819A3DCD}.Debug|Win32.Build.0 = Debug|Win32
- {3D36330F-1F68-44F6-A712-803E819A3DCD}.Release|Win32.ActiveCfg = Debug|Win32
- {3D36330F-1F68-44F6-A712-803E819A3DCD}.Release|Win32.Build.0 = Debug|Win32
- {BD17F145-422C-4EC0-A756-C7675A5626B2}.Debug|Win32.ActiveCfg = Debug|Win32
- {BD17F145-422C-4EC0-A756-C7675A5626B2}.Debug|Win32.Build.0 = Debug|Win32
- {BD17F145-422C-4EC0-A756-C7675A5626B2}.Release|Win32.ActiveCfg = Debug|Win32
- {BD17F145-422C-4EC0-A756-C7675A5626B2}.Release|Win32.Build.0 = Debug|Win32
- {E54E1872-C90A-4FF8-A4F4-27C3F8750D44}.Debug|Win32.ActiveCfg = Debug|Win32
- {E54E1872-C90A-4FF8-A4F4-27C3F8750D44}.Debug|Win32.Build.0 = Debug|Win32
- {E54E1872-C90A-4FF8-A4F4-27C3F8750D44}.Release|Win32.ActiveCfg = Debug|Win32
- {E54E1872-C90A-4FF8-A4F4-27C3F8750D44}.Release|Win32.Build.0 = Debug|Win32
- {EA99F8DE-660D-42E9-B14D-08F34FA45AD1}.Debug|Win32.ActiveCfg = Debug|Win32
- {EA99F8DE-660D-42E9-B14D-08F34FA45AD1}.Debug|Win32.Build.0 = Debug|Win32
- {EA99F8DE-660D-42E9-B14D-08F34FA45AD1}.Release|Win32.ActiveCfg = Debug|Win32
- {EA99F8DE-660D-42E9-B14D-08F34FA45AD1}.Release|Win32.Build.0 = Debug|Win32
- {C51F9363-7DC1-40F7-84D3-C9D4FD67A3CA}.Debug|Win32.ActiveCfg = Debug|Win32
- {C51F9363-7DC1-40F7-84D3-C9D4FD67A3CA}.Debug|Win32.Build.0 = Debug|Win32
- {C51F9363-7DC1-40F7-84D3-C9D4FD67A3CA}.Release|Win32.ActiveCfg = Debug|Win32
- {C51F9363-7DC1-40F7-84D3-C9D4FD67A3CA}.Release|Win32.Build.0 = Debug|Win32
- {0EE3173E-FCD3-4EC6-A28F-5AE5CE7196AC}.Debug|Win32.ActiveCfg = Debug|Win32
- {0EE3173E-FCD3-4EC6-A28F-5AE5CE7196AC}.Debug|Win32.Build.0 = Debug|Win32
- {0EE3173E-FCD3-4EC6-A28F-5AE5CE7196AC}.Release|Win32.ActiveCfg = Debug|Win32
- {0EE3173E-FCD3-4EC6-A28F-5AE5CE7196AC}.Release|Win32.Build.0 = Debug|Win32
- {B5CDFF9E-28E0-4915-8C3E-95EDAE2D9DE3}.Debug|Win32.ActiveCfg = Debug|Win32
- {B5CDFF9E-28E0-4915-8C3E-95EDAE2D9DE3}.Debug|Win32.Build.0 = Debug|Win32
- {B5CDFF9E-28E0-4915-8C3E-95EDAE2D9DE3}.Release|Win32.ActiveCfg = Debug|Win32
- {B5CDFF9E-28E0-4915-8C3E-95EDAE2D9DE3}.Release|Win32.Build.0 = Debug|Win32
- {BE2600A9-5BEB-42D9-8F13-FD38FCF5B801}.Debug|Win32.ActiveCfg = Debug|Win32
- {BE2600A9-5BEB-42D9-8F13-FD38FCF5B801}.Debug|Win32.Build.0 = Debug|Win32
- {BE2600A9-5BEB-42D9-8F13-FD38FCF5B801}.Release|Win32.ActiveCfg = Debug|Win32
- {BE2600A9-5BEB-42D9-8F13-FD38FCF5B801}.Release|Win32.Build.0 = Debug|Win32
- {7B296C12-D728-4CD8-8CF7-B8D7A433F85C}.Debug|Win32.ActiveCfg = Debug|Win32
- {7B296C12-D728-4CD8-8CF7-B8D7A433F85C}.Debug|Win32.Build.0 = Debug|Win32
- {7B296C12-D728-4CD8-8CF7-B8D7A433F85C}.Release|Win32.ActiveCfg = Debug|Win32
- {7B296C12-D728-4CD8-8CF7-B8D7A433F85C}.Release|Win32.Build.0 = Debug|Win32
- {F7558C2A-C1BC-453C-8FDE-84F33DB73915}.Debug|Win32.ActiveCfg = Debug|Win32
- {F7558C2A-C1BC-453C-8FDE-84F33DB73915}.Debug|Win32.Build.0 = Debug|Win32
- {F7558C2A-C1BC-453C-8FDE-84F33DB73915}.Release|Win32.ActiveCfg = Debug|Win32
- {F7558C2A-C1BC-453C-8FDE-84F33DB73915}.Release|Win32.Build.0 = Debug|Win32
- {84F3B76C-4733-4032-B51E-F8E71022AFE6}.Debug|Win32.ActiveCfg = Debug|Win32
- {84F3B76C-4733-4032-B51E-F8E71022AFE6}.Debug|Win32.Build.0 = Debug|Win32
- {84F3B76C-4733-4032-B51E-F8E71022AFE6}.Release|Win32.ActiveCfg = Debug|Win32
- {84F3B76C-4733-4032-B51E-F8E71022AFE6}.Release|Win32.Build.0 = Debug|Win32
- {557CB36F-7F92-4B43-973D-05C6BF0A6414}.Debug|Win32.ActiveCfg = Debug|Win32
- {557CB36F-7F92-4B43-973D-05C6BF0A6414}.Debug|Win32.Build.0 = Debug|Win32
- {557CB36F-7F92-4B43-973D-05C6BF0A6414}.Release|Win32.ActiveCfg = Debug|Win32
- {557CB36F-7F92-4B43-973D-05C6BF0A6414}.Release|Win32.Build.0 = Debug|Win32
- {7586DFA1-F847-4BEF-9105-724DD9F12C2A}.Debug|Win32.ActiveCfg = Debug|Win32
- {7586DFA1-F847-4BEF-9105-724DD9F12C2A}.Debug|Win32.Build.0 = Debug|Win32
- {7586DFA1-F847-4BEF-9105-724DD9F12C2A}.Release|Win32.ActiveCfg = Debug|Win32
- {7586DFA1-F847-4BEF-9105-724DD9F12C2A}.Release|Win32.Build.0 = Debug|Win32
- {80270384-C551-471F-86C2-D80FE61D9883}.Debug|Win32.ActiveCfg = Debug|Win32
- {80270384-C551-471F-86C2-D80FE61D9883}.Debug|Win32.Build.0 = Debug|Win32
- {80270384-C551-471F-86C2-D80FE61D9883}.Release|Win32.ActiveCfg = Debug|Win32
- {80270384-C551-471F-86C2-D80FE61D9883}.Release|Win32.Build.0 = Debug|Win32
- {0969BEF1-77F5-468F-9497-8470FDEC615A}.Debug|Win32.ActiveCfg = Debug|Win32
- {0969BEF1-77F5-468F-9497-8470FDEC615A}.Debug|Win32.Build.0 = Debug|Win32
- {0969BEF1-77F5-468F-9497-8470FDEC615A}.Release|Win32.ActiveCfg = Debug|Win32
- {0969BEF1-77F5-468F-9497-8470FDEC615A}.Release|Win32.Build.0 = Debug|Win32
- {CF1687EC-9097-4A86-B7FB-C1ECF9E27EA4}.Debug|Win32.ActiveCfg = Debug|Win32
- {CF1687EC-9097-4A86-B7FB-C1ECF9E27EA4}.Debug|Win32.Build.0 = Debug|Win32
- {CF1687EC-9097-4A86-B7FB-C1ECF9E27EA4}.Release|Win32.ActiveCfg = Debug|Win32
- {CF1687EC-9097-4A86-B7FB-C1ECF9E27EA4}.Release|Win32.Build.0 = Debug|Win32
- {C41E324E-03FD-4483-92B1-B50F6E3B6B82}.Debug|Win32.ActiveCfg = Debug|Win32
- {C41E324E-03FD-4483-92B1-B50F6E3B6B82}.Release|Win32.ActiveCfg = Debug|Win32
- {40412A73-43D3-4F1F-9078-DBD76705767D}.Debug|Win32.ActiveCfg = Debug|Win32
- {40412A73-43D3-4F1F-9078-DBD76705767D}.Release|Win32.ActiveCfg = Debug|Win32
- {4F2E05FD-F87C-4325-8C2A-C1EEA21A483F}.Debug|Win32.ActiveCfg = Debug|Win32
- {4F2E05FD-F87C-4325-8C2A-C1EEA21A483F}.Debug|Win32.Build.0 = Debug|Win32
- {4F2E05FD-F87C-4325-8C2A-C1EEA21A483F}.Release|Win32.ActiveCfg = Debug|Win32
- {4F2E05FD-F87C-4325-8C2A-C1EEA21A483F}.Release|Win32.Build.0 = Debug|Win32
- {51E1F9C4-091E-43A0-97C1-E1B68700A5AF}.Debug|Win32.ActiveCfg = Debug|Win32
- {51E1F9C4-091E-43A0-97C1-E1B68700A5AF}.Debug|Win32.Build.0 = Debug|Win32
- {51E1F9C4-091E-43A0-97C1-E1B68700A5AF}.Release|Win32.ActiveCfg = Debug|Win32
- {51E1F9C4-091E-43A0-97C1-E1B68700A5AF}.Release|Win32.Build.0 = Debug|Win32
- {AB7AD55A-A521-42F2-A953-623E5F059C1A}.Debug|Win32.ActiveCfg = Debug|Win32
- {AB7AD55A-A521-42F2-A953-623E5F059C1A}.Debug|Win32.Build.0 = Debug|Win32
- {AB7AD55A-A521-42F2-A953-623E5F059C1A}.Release|Win32.ActiveCfg = Debug|Win32
- {AB7AD55A-A521-42F2-A953-623E5F059C1A}.Release|Win32.Build.0 = Debug|Win32
- {626AF6BD-0AAB-4019-929A-2DB5CAD0419E}.Debug|Win32.ActiveCfg = Debug|Win32
- {626AF6BD-0AAB-4019-929A-2DB5CAD0419E}.Debug|Win32.Build.0 = Debug|Win32
- {626AF6BD-0AAB-4019-929A-2DB5CAD0419E}.Release|Win32.ActiveCfg = Debug|Win32
- {626AF6BD-0AAB-4019-929A-2DB5CAD0419E}.Release|Win32.Build.0 = Debug|Win32
- {1975AEE8-05C5-42DE-8A8B-620168F9C1C9}.Debug|Win32.ActiveCfg = Debug|Win32
- {1975AEE8-05C5-42DE-8A8B-620168F9C1C9}.Debug|Win32.Build.0 = Debug|Win32
- {1975AEE8-05C5-42DE-8A8B-620168F9C1C9}.Release|Win32.ActiveCfg = Debug|Win32
- {1975AEE8-05C5-42DE-8A8B-620168F9C1C9}.Release|Win32.Build.0 = Debug|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/win32/vs8/libgstadder.vcproj b/win32/vs8/libgstadder.vcproj
deleted file mode 100644
index e582576a..00000000
--- a/win32/vs8/libgstadder.vcproj
+++ /dev/null
@@ -1,206 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="libgstadder"
- ProjectGUID="{E54E1872-C90A-4FF8-A4F4-27C3F8750D44}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTADDER_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstadder.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTADDER_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstadder.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst\adder\gstadder.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstaudio.vcproj b/win32/vs8/libgstaudio.vcproj
deleted file mode 100644
index 6d320b02..00000000
--- a/win32/vs8/libgstaudio.vcproj
+++ /dev/null
@@ -1,254 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="libgstaudio"
- ProjectGUID="{BD17F145-422C-4EC0-A756-C7675A5626B2}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="copy /y ..\common\audio-enumtypes.h ..\..\gst-libs\gst\audio&#x0D;&#x0A;copy /y ..\common\audio-enumtypes.c ..\..\gst-libs\gst\audio&#x0D;&#x0A;"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;&quot;../../gst-libs&quot;;../common;&quot;../../gst-libs/gst/audio&quot;"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIO_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudio-0.10.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- ModuleDefinitionFile="..\common\libgstaudio.def"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\bin"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="copy /y ..\common\audio-enumtypes.h ..\..\gst-libs\gst\audio&#x0D;&#x0A;copy /y ..\common\audio-enumtypes.c ..\..\gst-libs\gst\audio&#x0D;&#x0A;"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;&quot;../../gst-libs&quot;;../common;&quot;../../gst-libs/gst/audio&quot;"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIO_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudio-0.10.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- ModuleDefinitionFile="..\common\libgstaudio.def"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\bin"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst-libs\gst\audio\audio.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\gstaudioclock.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\gstaudiofilter.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\gstaudiofiltertemplate.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\gstaudiosink.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\gstaudiosrc.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\gstbaseaudiosink.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\gstbaseaudiosrc.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\gstringbuffer.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\audio-enumtypes.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\audio\multichannel.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath="..\common\libgstaudio.def"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstaudioconvert.vcproj b/win32/vs8/libgstaudioconvert.vcproj
deleted file mode 100644
index 037311c6..00000000
--- a/win32/vs8/libgstaudioconvert.vcproj
+++ /dev/null
@@ -1,218 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="libgstaudioconvert"
- ProjectGUID="{EA99F8DE-660D-42E9-B14D-08F34FA45AD1}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIOCONVERT_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudioconvert.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIOCONVERT_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudioconvert.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst\audioconvert\audioconvert.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\audioconvert\gstaudioconvert.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\audioconvert\gstchannelmix.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\audioconvert\plugin.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstaudiorate.vcproj b/win32/vs8/libgstaudiorate.vcproj
deleted file mode 100644
index ac6acd73..00000000
--- a/win32/vs8/libgstaudiorate.vcproj
+++ /dev/null
@@ -1,206 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="libgstaudiorate"
- ProjectGUID="{C51F9363-7DC1-40F7-84D3-C9D4FD67A3CA}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIORATE_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudiorate.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIORATE_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudiorate.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst\audiorate\gstaudiorate.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstaudioresample.vcproj b/win32/vs8/libgstaudioresample.vcproj
deleted file mode 100644
index 0f9c62ef..00000000
--- a/win32/vs8/libgstaudioresample.vcproj
+++ /dev/null
@@ -1,230 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="libgstaudioresample"
- ProjectGUID="{0EE3173E-FCD3-4EC6-A28F-5AE5CE7196AC}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;&quot;../../gst-libs&quot;;../common;../../gst/audioresample"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIORESAMPLE_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="liboil-0.3-0.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudioresample.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;&quot;../../gst-libs&quot;;../common;../../gst/audioresample"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIORESAMPLE_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="liboil-0.3-0.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudioresample.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst\audioresample\buffer.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\audioresample\functable.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\audioresample\gstaudioresample.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\audioresample\resample.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\audioresample\resample_chunk.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\audioresample\resample_functable.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\audioresample\resample_ref.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstaudiotestsrc.vcproj b/win32/vs8/libgstaudiotestsrc.vcproj
deleted file mode 100644
index 9bcf5685..00000000
--- a/win32/vs8/libgstaudiotestsrc.vcproj
+++ /dev/null
@@ -1,206 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="libgstaudiotestsrc"
- ProjectGUID="{B5CDFF9E-28E0-4915-8C3E-95EDAE2D9DE3}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIOTESTSRC_EXPORTS;_USE_MATH_DEFINES;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib libgstcontroller-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudiotestsrc.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTAUDIOTESTSRC_EXPORTS;_USE_MATH_DEFINES;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib libgstcontroller-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstaudiotestsrc.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst\audiotestsrc\gstaudiotestsrc.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstdecodebin.vcproj b/win32/vs8/libgstdecodebin.vcproj
deleted file mode 100644
index 7f5332ff..00000000
--- a/win32/vs8/libgstdecodebin.vcproj
+++ /dev/null
@@ -1,212 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="libgstdecodebin"
- ProjectGUID="{0969BEF1-77F5-468F-9497-8470FDEC615A}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="if exist ..\..\gst\playback\gstplay-marshal.c goto HEADER&#x0D;&#x0A;echo #include &quot;glib-object.h&quot; &gt; gstplay-marshal.c.tmp&#x0D;&#x0A;echo #include &quot;gstplay-marshal.h&quot; &gt;&gt; gstplay-marshal.c.tmp&#x0D;&#x0A;glib-genmarshal --body --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list &gt;&gt; gstplay-marshal.c.tmp&#x0D;&#x0A;move gstplay-marshal.c.tmp ..\..\gst\playback\gstplay-marshal.c&#x0D;&#x0A;:HEADER&#x0D;&#x0A;if exist ..\..\gst\playback\gstplay-marshal.h goto END&#x0D;&#x0A;echo #include &quot;gst/gstconfig.h&quot; &gt; gstplay-marshal.h.tmp&#x0D;&#x0A;glib-genmarshal --header --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list &gt;&gt; gstplay-marshal.h.tmp&#x0D;&#x0A;move gstplay-marshal.h.tmp ..\..\gst\playback\gstplay-marshal.h&#x0D;&#x0A;:END&#x0D;&#x0A;"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTDECODEBIN_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstdecodebin.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="if exist ..\..\gst\playback\gstplay-marshal.c goto HEADER&#x0D;&#x0A;echo #include &quot;glib-object.h&quot; &gt; gstplay-marshal.c.tmp&#x0D;&#x0A;echo #include &quot;gstplay-marshal.h&quot; &gt;&gt; gstplay-marshal.c.tmp&#x0D;&#x0A;glib-genmarshal --body --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list &gt;&gt; gstplay-marshal.c.tmp&#x0D;&#x0A;move gstplay-marshal.c.tmp ..\..\gst\playback\gstplay-marshal.c&#x0D;&#x0A;:HEADER&#x0D;&#x0A;if exist ..\..\gst\playback\gstplay-marshal.h goto END&#x0D;&#x0A;echo #include &quot;gst/gstconfig.h&quot; &gt; gstplay-marshal.h.tmp&#x0D;&#x0A;glib-genmarshal --header --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list &gt;&gt; gstplay-marshal.h.tmp&#x0D;&#x0A;move gstplay-marshal.h.tmp ..\..\gst\playback\gstplay-marshal.h&#x0D;&#x0A;:END&#x0D;&#x0A;"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTDECODEBIN_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstdecodebin.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst\playback\gstdecodebin.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\playback\gstplay-marshal.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstffmpegcolorspace.vcproj b/win32/vs8/libgstffmpegcolorspace.vcproj
deleted file mode 100644
index add0dc76..00000000
--- a/win32/vs8/libgstffmpegcolorspace.vcproj
+++ /dev/null
@@ -1,230 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="libgstffmpegcolorspace"
- ProjectGUID="{BE2600A9-5BEB-42D9-8F13-FD38FCF5B801}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;../common;../../gst/ffmpegcolorspace"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTFFMPEGCOLORSPACE_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstffmpegcolorspace.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;../common;../../gst/ffmpegcolorspace"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTFFMPEGCOLORSPACE_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstffmpegcolorspace.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst\ffmpegcolorspace\dsputil.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\ffmpegcolorspace\gstffmpeg.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\ffmpegcolorspace\gstffmpegcodecmap.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\ffmpegcolorspace\gstffmpegcolorspace.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\ffmpegcolorspace\imgconvert.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\ffmpegcolorspace\mem.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\ffmpegcolorspace\utils.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstinterfaces.vcproj b/win32/vs8/libgstinterfaces.vcproj
deleted file mode 100644
index 10e8816a..00000000
--- a/win32/vs8/libgstinterfaces.vcproj
+++ /dev/null
@@ -1,264 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="libgstinterfaces"
- ProjectGUID="{CF1687EC-9097-4A86-B7FB-C1ECF9E27EA4}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="if exist ..\..\gst-libs\gst\interfaces\interfaces-marshal.c goto HEADER&#x0D;&#x0A;echo #include &quot;interfaces-marshal.h&quot; &gt;&gt; interfaces-marshal.c.tmp&#x0D;&#x0A;glib-genmarshal --body --prefix=gst_interfaces_marshal ..\..\gst-libs\gst\interfaces\interfaces-marshal.list &gt;&gt; interfaces-marshal.c.tmp&#x0D;&#x0A;move interfaces-marshal.c.tmp ..\..\gst-libs\gst\interfaces\interfaces-marshal.c&#x0D;&#x0A;:HEADER&#x0D;&#x0A;if exist ..\..\gst-libs\gst\interfaces\interfaces-marshal.h goto END&#x0D;&#x0A;echo #include &quot;gst/gstconfig.h&quot; &gt; interfaces-marshal.h.tmp&#x0D;&#x0A;glib-genmarshal --header --prefix=gst_interfaces_marshal ..\..\gst-libs\gst\interfaces\interfaces-marshal.list &gt;&gt; interfaces-marshal.h.tmp&#x0D;&#x0A;move interfaces-marshal.h.tmp ..\..\gst-libs\gst\interfaces\interfaces-marshal.h&#x0D;&#x0A;:END&#x0D;&#x0A;copy /y ..\common\interfaces-enumtypes.h ..\..\gst-libs\gst\interfaces&#x0D;&#x0A;copy /y ..\common\interfaces-enumtypes.c ..\..\gst-libs\gst\interfaces&#x0D;&#x0A;"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTINTERFACES_EXPORTS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstinterfaces-0.10.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- ModuleDefinitionFile="..\common\libgstinterfaces.def"
- GenerateDebugInformation="true"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstinterfaces-0.10.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\bin"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="if exist ..\..\gst-libs\gst\interfaces\interfaces-marshal.c goto HEADER&#x0D;&#x0A;echo #include &quot;interfaces-marshal.h&quot; &gt;&gt; interfaces-marshal.c.tmp&#x0D;&#x0A;glib-genmarshal --body --prefix=gst_interfaces_marshal ..\..\gst-libs\gst\interfaces\interfaces-marshal.list &gt;&gt; interfaces-marshal.c.tmp&#x0D;&#x0A;move interfaces-marshal.c.tmp ..\..\gst-libs\gst\interfaces\interfaces-marshal.c&#x0D;&#x0A;:HEADER&#x0D;&#x0A;if exist ..\..\gst-libs\gst\interfaces\interfaces-marshal.h goto END&#x0D;&#x0A;echo #include &quot;gst/gstconfig.h&quot; &gt; interfaces-marshal.h.tmp&#x0D;&#x0A;glib-genmarshal --header --prefix=gst_interfaces_marshal ..\..\gst-libs\gst\interfaces\interfaces-marshal.list &gt;&gt; interfaces-marshal.h.tmp&#x0D;&#x0A;move interfaces-marshal.h.tmp ..\..\gst-libs\gst\interfaces\interfaces-marshal.h&#x0D;&#x0A;:END&#x0D;&#x0A;copy /y ..\common\interfaces-enumtypes.h ..\..\gst-libs\gst\interfaces&#x0D;&#x0A;copy /y ..\common\interfaces-enumtypes.c ..\..\gst-libs\gst\interfaces&#x0D;&#x0A;"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTINTERFACES_EXPORTS"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstinterfaces-0.10.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- ModuleDefinitionFile="..\common\libgstinterfaces.def"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstinterfaces-0.10.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\bin"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\colorbalance.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\colorbalancechannel.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\interfaces-enumtypes.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\interfaces-marshal.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\mixer.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\mixeroptions.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\mixertrack.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\navigation.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\propertyprobe.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\tuner.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\tunerchannel.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\tunernorm.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\interfaces\xoverlay.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath="..\common\libgstinterfaces.def"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstogg.vcproj b/win32/vs8/libgstogg.vcproj
deleted file mode 100644
index f6b169bb..00000000
--- a/win32/vs8/libgstogg.vcproj
+++ /dev/null
@@ -1,226 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="libgstogg"
- ProjectGUID="{51E1F9C4-091E-43A0-97C1-E1B68700A5AF}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBOGG_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libogg.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstogg.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBOGG_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libogg.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstogg.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\ext\ogg\gstogg.c"
- >
- </File>
- <File
- RelativePath="..\..\ext\ogg\gstoggaviparse.c"
- >
- </File>
- <File
- RelativePath="..\..\ext\ogg\gstoggdemux.c"
- >
- </File>
- <File
- RelativePath="..\..\ext\ogg\gstoggmux.c"
- >
- </File>
- <File
- RelativePath="..\..\ext\ogg\gstoggparse.c"
- >
- </File>
- <File
- RelativePath="..\..\ext\ogg\gstogmparse.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstplaybin.vcproj b/win32/vs8/libgstplaybin.vcproj
deleted file mode 100644
index d490bf6a..00000000
--- a/win32/vs8/libgstplaybin.vcproj
+++ /dev/null
@@ -1,224 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="libgstplaybin"
- ProjectGUID="{7B296C12-D728-4CD8-8CF7-B8D7A433F85C}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="if exist ..\..\gst\playback\gstplay-marshal.c goto HEADER&#x0D;&#x0A;echo #include &quot;glib-object.h&quot; &gt; gstplay-marshal.c.tmp&#x0D;&#x0A;echo #include &quot;gstplay-marshal.h&quot; &gt;&gt; gstplay-marshal.c.tmp&#x0D;&#x0A;glib-genmarshal --body --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list &gt;&gt; gstplay-marshal.c.tmp&#x0D;&#x0A;move gstplay-marshal.c.tmp ..\..\gst\playback\gstplay-marshal.c&#x0D;&#x0A;:HEADER&#x0D;&#x0A;if exist ..\..\gst\playback\gstplay-marshal.h goto END&#x0D;&#x0A;echo #include &quot;gst/gstconfig.h&quot; &gt; gstplay-marshal.h.tmp&#x0D;&#x0A;glib-genmarshal --header --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list &gt;&gt; gstplay-marshal.h.tmp&#x0D;&#x0A;move gstplay-marshal.h.tmp ..\..\gst\playback\gstplay-marshal.h&#x0D;&#x0A;:END&#x0D;&#x0A;"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTPLAYBIN_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstplaybin.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="if exist ..\..\gst\playback\gstplay-marshal.c goto HEADER&#x0D;&#x0A;echo #include &quot;glib-object.h&quot; &gt; gstplay-marshal.c.tmp&#x0D;&#x0A;echo #include &quot;gstplay-marshal.h&quot; &gt;&gt; gstplay-marshal.c.tmp&#x0D;&#x0A;glib-genmarshal --body --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list &gt;&gt; gstplay-marshal.c.tmp&#x0D;&#x0A;move gstplay-marshal.c.tmp ..\..\gst\playback\gstplay-marshal.c&#x0D;&#x0A;:HEADER&#x0D;&#x0A;if exist ..\..\gst\playback\gstplay-marshal.h goto END&#x0D;&#x0A;echo #include &quot;gst/gstconfig.h&quot; &gt; gstplay-marshal.h.tmp&#x0D;&#x0A;glib-genmarshal --header --prefix=gst_play_marshal ..\..\gst\playback\gstplay-marshal.list &gt;&gt; gstplay-marshal.h.tmp&#x0D;&#x0A;move gstplay-marshal.h.tmp ..\..\gst\playback\gstplay-marshal.h&#x0D;&#x0A;:END&#x0D;&#x0A;"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTPLAYBIN_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstplaybin.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst\playback\gstplay-marshal.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\playback\gstplaybasebin.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\playback\gstplaybin.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\playback\gststreaminfo.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\playback\gststreamselector.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstriff.vcproj b/win32/vs8/libgstriff.vcproj
deleted file mode 100644
index 232da119..00000000
--- a/win32/vs8/libgstriff.vcproj
+++ /dev/null
@@ -1,222 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="libgstriff"
- ProjectGUID="{3D36330F-1F68-44F6-A712-803E819A3DCD}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTRIFF_EXPORTS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstriff-0.10.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- ModuleDefinitionFile="..\common\libgstriff.def"
- GenerateDebugInformation="true"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstriff-0.10.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\bin"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTRIFF_EXPORTS"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstriff-0.10.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- ModuleDefinitionFile="..\common\libgstriff.def"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstriff-0.10.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\bin"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst-libs\gst\riff\riff-media.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\riff\riff-read.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\riff\riff.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath="..\common\libgstriff.def"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstsubparse.vcproj b/win32/vs8/libgstsubparse.vcproj
deleted file mode 100644
index 3bc1c4fd..00000000
--- a/win32/vs8/libgstsubparse.vcproj
+++ /dev/null
@@ -1,200 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="libgstsubparse"
- ProjectGUID="{C41E324E-03FD-4483-92B1-B50F6E3B6B82}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;libgstsubparse_EXPORTS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/libgstsubparse.dll"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;libgstsubparse_EXPORTS"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/libgstsubparse.dll"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst\subparse\gstsubparse.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgsttag.vcproj b/win32/vs8/libgsttag.vcproj
deleted file mode 100644
index 878b10cd..00000000
--- a/win32/vs8/libgsttag.vcproj
+++ /dev/null
@@ -1,222 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="libgsttag"
- ProjectGUID="{626AF6BD-0AAB-4019-929A-2DB5CAD0419E}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTTAG_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgsttag-0.10.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- ModuleDefinitionFile="..\common\libgsttag.def"
- GenerateDebugInformation="true"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgsttag-0.10.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\bin"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer,../../gst-libs,../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTTAG_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgsttag-0.10.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- ModuleDefinitionFile="..\common\libgsttag.def"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgsttag-0.10.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\bin"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst-libs\gst\tag\gstid3tag.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\tag\gstvorbistag.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\tag\tags.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- <File
- RelativePath="..\common\libgsttag.def"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgsttcp.vcproj b/win32/vs8/libgsttcp.vcproj
deleted file mode 100644
index 6600730a..00000000
--- a/win32/vs8/libgsttcp.vcproj
+++ /dev/null
@@ -1,232 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="libgsttcp"
- ProjectGUID="{40412A73-43D3-4F1F-9078-DBD76705767D}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../gst-libs"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;libgsttcp_EXPORTS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/libgsttcp.dll"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../gst-libs"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;libgsttcp_EXPORTS"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/libgsttcp.dll"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst\tcp\fdsetstress.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\tcp\gstfdset.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\tcp\gstmultifdsink.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\tcp\gsttcp.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\tcp\gsttcpclientsink.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\tcp\gsttcpclientsrc.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\tcp\gsttcpplugin.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\tcp\gsttcpserversink.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\tcp\gsttcpserversrc.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgsttheora.vcproj b/win32/vs8/libgsttheora.vcproj
deleted file mode 100644
index c0b7dec5..00000000
--- a/win32/vs8/libgsttheora.vcproj
+++ /dev/null
@@ -1,218 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="libgsttheora"
- ProjectGUID="{AB7AD55A-A521-42F2-A953-623E5F059C1A}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTTHEORA_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libtheora.lib libogg.lib libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgsttheora.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTTHEORA_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libtheora.lib libogg.lib libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgsttheora.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\ext\theora\theora.c"
- >
- </File>
- <File
- RelativePath="..\..\ext\theora\theoradec.c"
- >
- </File>
- <File
- RelativePath="..\..\ext\theora\theoraenc.c"
- >
- </File>
- <File
- RelativePath="..\..\ext\theora\theoraparse.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgsttypefind.vcproj b/win32/vs8/libgsttypefind.vcproj
deleted file mode 100644
index 1c19e418..00000000
--- a/win32/vs8/libgsttypefind.vcproj
+++ /dev/null
@@ -1,206 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="libgsttypefind"
- ProjectGUID="{F7558C2A-C1BC-453C-8FDE-84F33DB73915}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTTYPEFIND_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgsttypefind.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTTYPEFIND_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgsttypefind.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst\typefind\gsttypefindfunctions.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstvideo.vcproj b/win32/vs8/libgstvideo.vcproj
deleted file mode 100644
index 4fa89d67..00000000
--- a/win32/vs8/libgstvideo.vcproj
+++ /dev/null
@@ -1,218 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="libgstvideo"
- ProjectGUID="{1975AEE8-05C5-42DE-8A8B-620168F9C1C9}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTVIDEO_EXPORTS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvideo-0.10.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- ModuleDefinitionFile="..\common\libgstvideo.def"
- GenerateDebugInformation="true"
- SubSystem="2"
- ImportLibrary="$(OutDir)/libgstvideo-0.10.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\bin"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTVIDEO_EXPORTS"
- RuntimeLibrary="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvideo-0.10.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- ModuleDefinitionFile="..\common\libgstvideo.def"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/libgstvideo-0.10.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\bin"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst-libs\gst\video\gstvideofilter.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\video\gstvideosink.c"
- >
- </File>
- <File
- RelativePath="..\..\gst-libs\gst\video\video.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstvideorate.vcproj b/win32/vs8/libgstvideorate.vcproj
deleted file mode 100644
index 8bec1301..00000000
--- a/win32/vs8/libgstvideorate.vcproj
+++ /dev/null
@@ -1,206 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="libgstvideorate"
- ProjectGUID="{84F3B76C-4733-4032-B51E-F8E71022AFE6}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTVIDEORATE_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvideorate.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTVIDEORATE_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvideorate.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst\videorate\gstvideorate.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstvideoscale.vcproj b/win32/vs8/libgstvideoscale.vcproj
deleted file mode 100644
index 8f9477b2..00000000
--- a/win32/vs8/libgstvideoscale.vcproj
+++ /dev/null
@@ -1,218 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="libgstvideoscale"
- ProjectGUID="{557CB36F-7F92-4B43-973D-05C6BF0A6414}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTVIDEOSCALE_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib liboil-0.3-0.lib"
- OutputFile="$(OutDir)/libgstvideoscale.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTVIDEOSCALE_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib liboil-0.3-0.lib"
- OutputFile="$(OutDir)/libgstvideoscale.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst\videoscale\gstvideoscale.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\videoscale\vs_4tap.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\videoscale\vs_image.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\videoscale\vs_scanline.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstvideotestsrc.vcproj b/win32/vs8/libgstvideotestsrc.vcproj
deleted file mode 100644
index b9d6d8a8..00000000
--- a/win32/vs8/libgstvideotestsrc.vcproj
+++ /dev/null
@@ -1,210 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="libgstvideotestsrc"
- ProjectGUID="{7586DFA1-F847-4BEF-9105-724DD9F12C2A}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTVIDEOTESTSRC_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="liboil-0.3-0.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvideotestsrc.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTVIDEOTESTSRC_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="liboil-0.3-0.lib libgstreamer-0.10.lib libgstbase-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvideotestsrc.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst\videotestsrc\gstvideotestsrc.c"
- >
- </File>
- <File
- RelativePath="..\..\gst\videotestsrc\videotestsrc.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstvolume.vcproj b/win32/vs8/libgstvolume.vcproj
deleted file mode 100644
index 02f6828f..00000000
--- a/win32/vs8/libgstvolume.vcproj
+++ /dev/null
@@ -1,206 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="libgstvolume"
- ProjectGUID="{80270384-C551-471F-86C2-D80FE61D9883}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTVOLUME_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib libgstcontroller-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvolume.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;../../../gstreamer/libs;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTVOLUME_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libgstreamer-0.10.lib libgstbase-0.10.lib libgstcontroller-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvolume.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\gst\volume\gstvolume.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/win32/vs8/libgstvorbis.vcproj b/win32/vs8/libgstvorbis.vcproj
deleted file mode 100644
index 92c38f85..00000000
--- a/win32/vs8/libgstvorbis.vcproj
+++ /dev/null
@@ -1,222 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="libgstvorbis"
- ProjectGUID="{4F2E05FD-F87C-4325-8C2A-C1EEA21A483F}"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../gstreamer;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBGSTVORBIS_EXPORTS;HAVE_CONFIG_H"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libvorbis.lib libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvorbis.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\debug\lib\gstreamer-0.10"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../gstreamer;&quot;../../gst-libs&quot;;../common"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBGSTVORBIS_EXPORTS;HAVE_CONFIG_H"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libvorbis.lib libgstreamer-0.10.lib glib-2.0.lib gobject-2.0.lib"
- OutputFile="$(OutDir)/libgstvorbis.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../gstreamer/win32/vs8/$(ConfigurationName)"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /y &quot;$(TargetPath)&quot; c:\gstreamer\lib\gstreamer-0.10"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\..\ext\vorbis\vorbis.c"
- >
- </File>
- <File
- RelativePath="..\..\ext\vorbis\vorbisdec.c"
- >
- </File>
- <File
- RelativePath="..\..\ext\vorbis\vorbisenc.c"
- >
- </File>
- <File
- RelativePath="..\..\ext\vorbis\vorbisparse.c"
- >
- </File>
- <File
- RelativePath="..\..\ext\vorbis\vorbistag.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>